sentences:
Dynamic object creation from data I want to write somewhat randomized object activation effects, like when you step on a trap, you can be tepelorted, damaged, cursed and so on. I applied strategy pattern for this: damage/healing managed by class ChangeHealth, teleportation by class SetPosition etc.

I want to know how can I manage creation of objects in code from data, so, for example I want to be able to set that there will be trap which will damage player and there will be shrine which should teleport you upon activation from, for example, string or bit stream.

I'm working in C#, but interested in overall approach to this problem.

sentences: Why is fog in games exponential and has a start distance? In most tutorials I see on how to achieve fog with shaders the fog is exponential and has a minimum / start distance from the camera. Why? Both seem counterintuitive, especially the minimum distance. Is this an artistic / design choice or is this how our eyes see fog in real life?

sentences:
Physics in my game confused after restructuring the Game loop I'm on my way with making a game in Java. Now I have some trouble with an interpolation based game loop in my calculations.

Before I used that system the calculation of a falling object was like this:

Delta based system

private static final float SPEED_OF_GRAVITY = 500.0f;

@Override
 public void update(float timeDeltaSeconds, Object parentObject) {

parentObject.y = parentObject.y +
          (parentObject.yVelocity * timeDeltaSeconds);

parentObject.yVelocity -= SPEED_OF_GRAVITY  * timeDeltaSeconds;
    ......

What you see here is that I used that delta value from previous frame to the current frame to calculate the physics. Now I switched and implement a interpolation based system and I actually left the current system where I used delta to calculate my physics.

However, with the interpolation system the delta time is removed - but now are my calculations screwed up and I've tried the whole day to solve this:

Interpolation based system

private static final float SPEED_OF_GRAVITY = 500.0f;

@Override
public void update(Object parentObject) {

parentObject.y = parentObject.y +
        (parentObject.yVelocity);

parentObject.yVelocity -= SPEED_OF_GRAVITY;
    ......

I'm totally clueless - how should this be solved? The rendering part is solved with a simple prediction method. With the delta system I could see my object be smoothly rendered to the screen, but with this interpolation/prediction method the object just appear sticky for one second and then it's gone.

The core of this game loop is actually from here deWiTTERS Game Loop, where I trying to implement the last solution he describes.

Shortly - my physics are in a mess and this need to be solved.

Any ideas? Thanks in advance!

sentences:
How to create a state based traffic signal? I want to create a traffic light for a Unity3D game. I will model it in blender.

What is the best way to control this light in a unity scene?

One way I could think of is to change texture of say red light from dull red to bright red, when it is time for red signal. But I am not sure if this is possible or a good strategy.

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:
Limit/Clamp camera movement using quaternions I'm making a camera object for rendering with OpenGL. However, instead of using the typical "LookAt" method I'm trying to use just a Quaternion for orientation and a Vector3 for position. Instead of messing with euler angles to rotate the Camera I use quaternions directly, like this:

glm::vec3 up = glm::normalize(glm::inverse(cam.Orientation) * glm::vec3(0, 1, 0));
glm::vec3 right = glm::vec3(-1, 0, 0);
cam.Orientation = glm::rotate(cam.Orientation, glm::radians(-xoffset), up);
cam.Orientation = glm::rotate(cam.Orientation, glm::radians(-yoffset), right);

xoffset and yoffset are just the amount the mouse has moved since the last frame.

I create my view matrix from the inverse of the two variables. I've already got FPS style camera movement and rotation working. The problem I have now is that I want to prevent the camera from being able to flip over. I.E. moving the mouse up or down enough that the view becomes upside down. Is there a way to clamp the rotation using purely quaternions to prevent this?

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:
SFML Animation class as a strategy or an inheritance everybody.
I need to add animations to my game.
And I have a question.

I found AnimatedSprite class on SFML Github which is an inheritance, but in my project, I am using a lot of elements made with strategy pattern,
for example movement behavior, jumping behavior, fighting behavior, etc.
I just try to avoid inheritance because it makes class inflexible.

But this time in contrast to other classes Animation class has a lot of methods
that can be used at runtime. I mean Play(), Stop(), Pause(), and more.
If I use this as a strategy I would have to give access to this object.

What do you think?
Maybe I just need to use another design pattern?

sentences:
LibGdx Input data in a textfield I have a textfield using scene2d but don't know how to save user input. this is what i have and it just draws the textfield.

     txtUsername = new TextField("", mSkin);
     txtUsername.setMessageText("test");
     txtUsername.setPosition(30, 30);
     mStage.addActor(txtUsername);

sentences:
How 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:
AI world exploration? For one of my exams, we have to make an AI for some sandbox survival game.

Well to be exact, we have been given a framework, and need to make a plugin that contains the AI logic.

So far, I already have the movement down, items, enemies, ... (movement uses a navmesh)

This is an image that show how the "world" could look like. (The AI has no way to get the exact layout of the map.)

The AI does have a navmesh, but can only ask for the closest node to a certain vector (so that it can use that node to move to). It starts with nothing, and the world doesn't change once the program starts. However, the pickups respawn (only inside houses) and thus I want to map all the houses. The agent has an FOV (I can't really see how big it is) and items, enemies and houses inside that FOV suddenly reveal all their data (position, size, ...)

However, following the checkpoints is not the most optimal way of exploring the world... The teachers want us to have "smart world exploration logic".
This is the part I am struggling with. Is there some kind of algorithm or logics to exploring this world?

I guess the question I'm asking is "How do I determine the goal to move to, if there's nothing in FOV?"

Maybe there's some "smart" wandering I could do? However, all I know for wandering is ones where it constantly changes its direction withing a certain limit.

sentences:
OpenGL texture shows as a white square I am trying to draw a simple 32x32 PNG image using SharpGL and OpenGL 2.1.
Despite many hours of searching, reading answers to similar questions, nothing could solve my issue. The image is showed as a white square.

I tried debugging OpenGL using glGetError() but it always returns 0.
I have no idea of what could be the problem.

Some help would be very appreciated!

Loading method

public static GLImage LoadImagePNG(OpenGL gl, Bitmap bmp)
{
    bmp = ResizeTo(bmp, 32, 32);

    uint[] textures = new uint[1];
    gl.GenTextures(1, textures);

    uint texture = textures[0];

    gl.Enable(OpenGL.GL_TEXTURE_2D);

    BitmapData data = bmp.LockBits(
        new Rectangle(0, 0, bmp.Width, bmp.Height),
        ImageLockMode.ReadOnly,
        PixelFormat.Format32bppArgb
    );

    gl.BindTexture(OpenGL.GL_TEXTURE_2D, texture);

    gl.TexImage2D(
        OpenGL.GL_TEXTURE_2D,
        0,
        4,
        bmp.Width,
        bmp.Height,
        0,
        OpenGL.GL_RGBA,
        OpenGL.GL_UNSIGNED_BYTE,
        data.Scan0
    );

    Console.WriteLine(gl.GetError());

    bmp.UnlockBits(data);

    gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_WRAP_S, OpenGL.GL_CLAMP_TO_EDGE);
    gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_WRAP_T, OpenGL.GL_CLAMP_TO_EDGE);
    gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MAG_FILTER, OpenGL.GL_LINEAR);
    gl.TexParameter(OpenGL.GL_TEXTURE_2D, OpenGL.GL_TEXTURE_MIN_FILTER, OpenGL.GL_LINEAR);

    // not disposing the Bitmap on purpose (for now)

    return new GLImage(texture, bmp);
}

Render method

public static void DrawImage(OpenGL gl, GLImage img, double x, double y)
{
    gl.PushMatrix();
    gl.Translate(x, y, 0.0D);

    gl.ActiveTexture(OpenGL.GL_TEXTURE0);
    gl.BindTexture(OpenGL.GL_TEXTURE_2D, img.TextureID);
    gl.Enable(OpenGL.GL_TEXTURE_2D);

    gl.Begin(BeginMode.Quads);
        gl.TexCoord(0.0f, 0.0f); gl.Vertex(0, 0);
        gl.TexCoord(1.0f, 0.0f); gl.Vertex(img.Width, 0);
        gl.TexCoord(1.0f, 1.0f); gl.Vertex(img.Width, img.Height);
        gl.TexCoord(0.0f, 1.0f); gl.Vertex(0, img.Height);
    gl.End();

    gl.Disable(OpenGL.GL_TEXTURE_2D);

    gl.PopMatrix();
}

and GLImage being a custom class

GLImage

public class GLImage
{
    public uint TextureID { get; private set; }

    public Bitmap Bitmap { get; private set; }

    public double Width
    {
        get
        {
            return this.Bitmap.Width;
        }
    }

    public double Height
    {
        get
        {
            return this.Bitmap.Height;
        }
    }

    public GLImage(uint textureID, Bitmap bmp)
    {
        this.TextureID = textureID;
        this.Bitmap = bmp;
    }
}

Thank you!

sentences:
Get Final output from UDK ( sorry for my bad english in advance :D )

I'm trying to get a .exe setup output, from my UDK !( with my own maps and scripts which I made within MyGame)
I tried UnrealFrontEnd! But It made a setup , that after installation I can see my .udk maps, my packages and etc.
But It's not a real output that I can show to my customers. I don't want, other can use my resources !

So... How can I get a binary-like output from UDK as a real Game-Output ? ( like what we see in all commercial games )
Is there any option in frontend that I missed ?

sentences:
Per-Texel lighting? (not per-vertex or per-pixel) In my game, I have a 3D shader that does lighting using color ramps on models with very low resolution textures. Basically, the vertex shader calculates color values for direct light and ambient occlusion, and then I look up into a color ramp what color to draw, and multiply this by the texture map.

Here's some pseudocode for that:

// vertex shader:
color_vert.r = ambient_occlusion(vertex)
color_vert.g = direct_lighting(vertex)
color_vert.b = shadow_lighting(vertex)

// fragment shader:
// First, the color is whatever the direct lighting was
color_fragment = direct_lighting_ramp_lookup(color_vert.g)
// Multiply by ambient occlusion and shadow
color_fragment *= ambient_lighting_ramp_lookup(color_vert.r)
color_fragment *= shadow_lighting_ramp_lookup(color_vert.b)
// Mutiply by the surface texture
color_fragment *= texture_lookup(color_vert.uv)

Now, this kind of lighting would be fine if I had very high resolution textures, but unfortunately my textures are very low resolution. So each texel (that is, the block of pixels corresponding to one pixel of the texture) is quite large, and lighting gets interpolated across the texel.

Here's an image of what that looks like:

And here's a closeup to show you what I mean:

Notice how the color is smoothly getting interpolated accross the low-resolution texels? How can I write my shader such that the lighting gets clamped on a per-texel basis? Is such a thing even possible? The only solution I can think of is to first generate a lightmap for the whole scene with 1-1 mapping to texels, but I'm afraid that would be too slow / use too much memory.

sentences:
How do I determine which voxels to test for collision against the player? I've implemented Minkowski subtraction to test whether (and where) two AABBs collide, independent of framerate/time-step, in my Minecraft-like game.

But since there may be tens of thousands of voxels, I'm realizing I can't just test everyone of them. Is there an alternative to just scanning for nearby voxels? I worry that if I just do collision for voxels within a fixed range, then I've undone the framerate independence that I had sought.

sentences: How to get elapsed time of keypress? I need to be able to determine how long a key has been held down with high accuracy. For example if they key tapped really fast it could report a time that is less than the time for each update frame.

sentences:
Entity Component Architecture and Scripting without using threads I am working on a small game engine for practicing purpose and also for putting
some of my ideas into action. What I have so far is a couple of systems for
rendering, sound etc. The next step is to put all these things together.
I already looked into entity component systems, in particular the following
article:
http://www.gamedev.net/page/resources/_/technical/game-programming/implementing-component-entity-systems-r3382

I think that this approach would suit my needs to a certain level, but I also
would like to implement the game logic itself inside scripts. I came up with a
slightly different approach:

The rendering, sound, physics, input and simulation systems perform actions
on the data, which is basically a level object and a list of entities
(for technical reasons I have to distinguish between entities and level
geometry). The particular systems only perform actions on those entities which
match their criteria (e.g. the physics system only handles entities with a
bounding volume). In my approach the systems do not directly implement behavior.
Instead they are either creating output (rendering, sound) or input
(physics, input). The simulation system manages the scripts which may be
assigned to entities. The script of an entity consists of two parts, first the
initialization code which is executed when the entity is added to the scene,
and second the code which is executed once per frame (or less, depending on
whether the code contains a wait-statement). Additionally every entity may
implement event handlers which are called whenever the input or physics system
throws an event (e.g. a CollisionEvent, KeyDownEvent etc.). Entity scripts may
define parameters, which can be modified inside the level editor.

My question is, whether this architecture has some severe weaknesses. Since I
want to avoid threading, my scripts will be scheduled by the simulation system,
which lead me to the restriction that an entity script is called once per frame
(which means that loops should be avoided, since basically everything already is
inside a big loop). Is this reasonable or is there any better way?

sentences:
How can I create a 2D "gooey"/"sticky" separation effect? I want to create an effect similar to this animation where two shapes separate over time but are connected (for a time) by something gooey that stretches and eventually breaks. Like pizza cheese, but specifically in 2D.

I'm using Swift and SpriteKit. I'm thinking this probably involves keyframes bezier path animations, but I'm not sure. How can I achieve this effect?

sentences: Should a wall be created as a plane or as a box? What are the benefits of a wall being as a plane or as a box? Should I use a plane with a box collider instead of mesh collider?

sentences:
Adding delay between damage I have a bunch of enemies chasing my main-character, and if they intersect I want them to damage him and that's all good. The problem is that right now they damage him as long as they stand around him, every frame! and since it gets called every frame my character's HP reaches 0 almost instantly.

I've tried adding delay and I've tried a timertask, but can't get it to work.

This is the code I use to check for intersection:

private void checkCollision(Canvas canvas) {
    synchronized (getHolder()) {
        Rect h1 = happy.getBounds();
        for (int i = 0; i < enemies.size(); i++) {
            for (int j = 0; j < bullets.size(); j++) {
                Rect b1 = bullets.get(j).getBounds();
                Rect e1 = enemies.get(i).getBounds();
                if (b1.intersect(e1)) {
                    enemies.get(i).damageHP(5);
                    bullets.remove(j);
                }
                if(e1.intersect(h1)){
                    happy.damageHP(5);
                // this is the statement that needs some sort of delay, I want them to damage him every 2 seconds they intersect him.
                }

                if(enemies.get(i).getHP() <= 0){
                    enemies.get(i).death(canvas, enemies);
                    score.incScore(5);
                    break;
                }
                if(happy.getHP() <= 0){
                    score.incScore(-50);
                    //end-screen
                }
            }
        }
    }
}

If anyone knows the logic to do this please do tell.

sentences:
How can I make something happen for a set number of frames? I want to add a nitro boost feature to my racing game. I want the car to go faster for 45 frames when the nitro is used, but for whatever reason I can't make it work. I originally tried using a while loop but obviously that doesn't work for JavaScript physics. Here's what I have now:

this.nitro = function() {
    if (this.hasNitro) {
        this.nitroSpeed = this.carSpeed * 2;
        this.speedCopy = this.carSpeed;
        var refreshIntervalId = setInterval(function() {
            this.carSpeed = this.nitroSpeed;
            this.nitroCount--;
            if(this.nitroCount==0){
                this.endNitro();
            }
        }, 1000 / FRAMES_PER_SECOND);
    }
}
this.endNitro = function(){
    clearInterval(refreshIntervalId);
    this.carSpeed = this.speedCopy;
    this.hasNitro = false;
}

There are two cars in the game, each an instance of the car class. One of them is controlled with the arrow keys and the other is controlled with WASD. When the car's nitro button is pressed, nitro() is called on that car. The goal of the nitro is to double the car's speed for NITRO_TIME frames. When the car is initialized, nitroCount is set to NITRO_TIME.

sentences: How can I create an "afterimage" effect like this one? How can I make an effect like this? With a particle system?

sentences:
EXC_BAD_ACCESS error when box2d joint is destroyed When I destroy the weldJoint in the update method (see below) I get an EXC_BAD_ACCESS error pointing to the line

world->DestroyJoint(weldJoint);

in the update method below:

    -(void) update: (ccTime) dt
{

int32 velocityIterations = 8;
int32 positionIterations = 1;

// Instruct the world to perform a single step of simulation. It is
// generally best to keep the time step and iterations fixed.
world->Step(dt, velocityIterations, positionIterations);

// using the iterator pos over the set
std::set<BodyPair *>::iterator pos;

for(pos = bodiesForJoints.begin(); pos != bodiesForJoints.end(); ++pos)
{

    b2WeldJointDef weldJointDef;

    BodyPair *bodyPair = *pos;
    b2Body *bodyA = bodyPair->bodyA;
    b2Body *bodyB = bodyPair->bodyB;

    weldJointDef.Initialize(bodyA, bodyB, bodyA->GetWorldCenter());

    weldJointDef.collideConnected = false;
    weldJoint = (b2WeldJoint*) world->CreateJoint(&weldJointDef);

    // Free the structure we allocated earlier.
    free(bodyPair);

    // Remove the entry from the set.
    bodiesForJoints.erase(pos);
}

for(b2Body *b = world->GetBodyList(); b; b=b->GetNext())    {
    if (b->GetUserData() != NULL)
    {
        CCSprite *mainSprite = (CCSprite*)b->GetUserData();
        if (mainSprite.tag == 1) {
            mainSprite.position = CGPointMake( b->GetPosition().x * PTM_RATIO, b->GetPosition().y * PTM_RATIO);
            CGPoint mainSpritePosition = mainSprite.position;
            if (mainSprite.isMoved) {

                        world->DestroyJoint(weldJoint);

                    }
            }
        }
    }

}

In the HelloWorldLayer.h I set the weldJoint with the assign property. Am I destroying the joint in the wrong way? I would really appreciate any help. Thanks

sentences:
In 3D camera math, calculate what Z depth is pixel unity for a given FOV I am working in iOS and OpenGL ES 2.0.  Through trial and error I've figured out a frustum to where at a specific z depth pixels drawn are 1 to 1 with my source textures.  So 1 pixel in my texture is 1 pixel on the screen.  For 2d games this is good.  Of course it means that I also factor in things like the size of the quad and the size of the texture.

For example if my sprite is a quad 32x32 pixels.  The quad size is 3.2 units wide and tall.  And the texcoords are 32 / the size of the texture wide and tall.

Then the frustum is:

    matrixFrustum(-(float)backingWidth/frustumScale,(float)backingWidth/frustumScale,
                   -(float)backingHeight/frustumScale, (float)backingHeight/frustumScale, 40, 1000, mProjection);

Where frustumScale is 800 for a retina screen.  Then at a distance of 800 from camera the sprite is pixel for pixel the same as photoshop.

For 3d games sometimes I still want to be able to do this.  But depending on the scene I sometimes need the FOV to be different things.

I'm looking for a way to figure out what Z depth will achieve this same pixel unity for a given FOV.

For this my mProjection is set using:

    matrixPerspective(cameraFOV, near, far,  (float)backingWidth / (float)backingHeight, mProjection);

With testing I found that at an FOV of 45.0 a Z of 38.5 is very close to pixel unity.  And at an FOV of 30.0 a Z of 59.5 is about right.  But how can I calculate a value that is spot on?

Here's my matrixPerspecitve code:

void matrixPerspective(float angle, float near, float far, float aspect, mat4 m)
{
    //float size = near * tanf(angle / 360.0 * M_PI);
    float size = near * tanf(degreesToRadians(angle) / 2.0);
    float left = -size, right = size, bottom = -size / aspect, top = size / aspect;

    // Unused values in perspective formula.
    m[1] = m[2] = m[3] = m[4] = 0;
    m[6] = m[7] = m[12] = m[13] = m[15] = 0;

    // Perspective formula.
    m[0] = 2 * near / (right - left);
    m[5] = 2 * near / (top - bottom);
    m[8] = (right + left) / (right - left);
    m[9] = (top + bottom) / (top - bottom);
    m[10] = -(far + near) / (far - near);
    m[11] = -1;
    m[14] = -(2 * far * near) / (far - near);
}

And my mView is set using:

lookAtMatrix(cameraPos, camLookAt, camUpVector, mView);

* UPDATE *

I'm going to leave this here in case anyone has a different solution, can explain how they do it, or why this works.

This is what I figured out.  In my system I use a 10th scale unit to pixels on non-retina displays and a 20th scale on retina displays.  The iPhone is 640 pixels wide on retina and 320 pixels wide on non-retina (obsolete).  So if I want something to be the full screen width I divide by 20 to get the OpenGL unit width. Then divide that by 2 to get the left and right unit position.  Something 32 units wide centered on the screen goes from -16 to +16.  Believe it or not I have an excel spreadsheet do all this math for me and output all the vertex data for my sprite sheet.

It's an arbitrary thing I made up to do .1 units = 1 non-retina pixel or 2 retina pixels.  I could have made it .01 units = 2 pixels and someday I might switch to that.  But for now it's the other.  So the width of the screen in units is 32.0, and that means the left most pixel is at -16.0 and the right most is at 16.0.

After messing a bit I figured out that if I take the [0] value of an identity modelViewProjection matrix and multiply it by 16 I get the depth required to get 1:1 pixels.  I don't know why.  I don't know if the 16 is related to the screen size or just a lucky guess.  But I did a test where I placed a sprite at that calculated depth and varied the FOV through all the valid values and the object stays steady on screen with 1:1 pixels.  So now I'm just calculating the unityDepth that way.

If someone gives me a better answer I'll checkmark it.

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:
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:
Slopes vs. Rectangles: Different Collision Points My platformer has both rectangular tiles and right-triangle slopes with rectangular hitboxes. My sprites are also rectangular.

Collision with only rectangular tiles works well. Even if there are multiple rectangular tiles, collision still works pretty well.

Sprites can collide with individual slopes correctly as well, however, they collide at a different point. In order for the character's feet to be walking down the slope instead of hovering over it, the collision point for slopes is the bottom-center point. For rectangles, it is either corner.

The problem is moving from a rectangular tile onto a sloped one. The sprite resolves by the corners first, since it is resting atop a rectangular tile. However, the center point is resting above the slope, and the sprite will not move onto the slope until it is entirely moved off of the rectangular tile.

Here's a diagram:

How can I reliably use two different collision points for different tiles in a way that allows sprites to walk between rectangular and sloped tiles?

sentences:
How to rotate a 3D character on top of a plane with an isometric picture on it How to calculate the angles of the 3d charater so that it fits into the isometric environment projektet on a 2d plane?
Also, how do you calculate the rotation of my character?
What I want to achieve:

Describing the scenario:

sentences:
How do you design a record/replay system for a frequently changing game? I'm working in a free MMORPG and I have a problem.

I'm (with other people) developing a video recording system for the game. The idea is basically: we record all the packages sent & received with timestamps, plus some local data from the client, and then dump it in a file. For playing the video, we just emulate everything that's on the file. We also have an option to export the video to avi with ffmpeg.

The problem is: when we change between versions of the game, it is hard to maintain backwards compatibility for the video (commands added / removed, function changes, etc). Is there a good way to handle this problem? instead of having a bunch of different players and choose the right one for each version of the video file?

It would be helpful to know how does other games handle this situation.

Thanks for the help, sorry for my english.

sentences:
Where can I find a good tutorial to replicate Game Maker's surfaces and blend modes in XNA? I know Game Maker's surfaces exist in XNA (It's more the othe way around, XNA's surfaces exist in Game Maker), same thing for blend modes, since (I think) they both use DirectX.

This is the question: "Where can I find a good tutorial to replicate Game Maker's surfaces and blend modes in XNA?"

I'm using XNA 4.0 and Game Maker 8.1 Pro.

Background

I'm slowly moving from Game Maker to... Something else.

I've learned some good C++ but DirectX is hardcore and OpenGL needs some pretty good understanding of the language to be able to use it correctly.

XNA and C# together seemed like a good middle but the documentation is hard to understand for a newb like me.

In the end, I chose to focus on XNA.

sentences:
OpenGL binding and relations among entities This is mostly a documentation question. I hope this is the proper place to ask and not, for example, programmers or stackoverflow.

I did not read the OpenGL specification, but from books (Red Book) and various tutorial, I cannot properly grasp how different objects and parts of the API interact and relate.

For example, I know that if a VAO is bound, then binding a VBO and setting an attribute will result in the VBO being bound to the VAO.

But there are many objects, their relation may vary. For example, the VAO is completely unrelated to the current shading program, but the outcome of drawing operations may depend on both of them.

Among all the various OpenGL components, I can see some relations like A-binds-to-B or A-and-B-are-used-by-C. All these relations concur in determining how one can alter the state of the context, how can change things, how can save things together and optimize.

I am looking for resources explaining just these relations. Like an UML diagram, a graph, or even a text document, which does not focus about the calls, but describes in a compact way how the various OpenGL components interact and relate one to each other.

Do you know where to find such a resource?

sentences:
LibGDX Change mouse cursor to custom image......and keep it there I'm able to create a custom cursor no problem using the following code running in my GameScreen's Show method:
Pixmap pixmap = new Pixmap(Gdx.files.internal("ui/cursor.png"));
Cursor cursor = Gdx.graphics.newCursor(pixmap, pixmap.getWidth() / 2, pixmap.getHeight() / 2);
Gdx.graphics.setCursor(cursor);
pixmap.dispose();

The problem is...if I deselect the game window and return back...the cursor has returned back to the default one. At least that happens for me on Mac desktop. If I move the cursor out of the screen (without deselecting) and then back again I get the custom cursor image back but I don't think people would know to do that.
But after searching I couldn't find any way for LibGDX to detect when the game window is deselected? I thought I would be able to find that since it would seem useful for something like automatically pausing when deselecting the game window and such.
That would seem to be the way to reset the cursor every time returning to the game window, unless there's some other way to make it more permanent?
EDIT: The cursor in fact just seems to randomly disappear for no reason during gameplay and then sometimes reappear briefly....seems like it's a bug.

sentences:
Elastically Object movement in unity3d I want to move an object towards the destination elastically. Currently I am using Vector3.Lerp it working to move the object, start with high speed and reached at destination with low speed but missing elastic effects.

float i = 50, t = 0;
        while (t < 1)
        {
            t += Time.deltaTime / i;
            transform.position = Vector3.Lerp(transform.position, newPostionAtDistance, t);
            transform.LookAt(targetFollow.transform);
            if (transform.position.ToString() == newPostionAtDistance.ToString())
            {
                //StartCoroutine(CamElasticMoveBackEffetcts());
                Debug.LogWarning("Object reached to the point.");
                yield break;
            }

            smoothTime += Time.deltaTime;
            yield return 0;
            i++;
        }

sentences:
Web single player 2d top-down RPG - background image, sprites, and new level loading I'm making a web single player 2D top-down rpg using JavaScript (create js library) and have a couple questions.

For the background image, I've currently loaded a 1000x1000 bitmap to represent the background for my rpg world (per level). It's drawn in relation to the camera (aka the canvas - 500x500) so not all of it is on the screen at the same time. If it's not on the screen, is it still using resources to be drawn? I eventually want to have a much larger "world", which will require a much larger bitmap... What is the best way to load a background image?

And what about sprites? I'm assuming if I create several sprite objects with bitmaps... even if they aren't on the camera, they are still using resources? This may slow down the game.

Level loading: If I walk to another level, or go inside a building, I'd like to load that bitmap... Is there a specific way to architect level loading?

Thank you!

sentences:
Web workers for HTML5 game physics simulation? A bit related to this question.

The idea is to guarantee the same physics behavior as much as possible. Would it be possible to run fixed time step physics on a web worker? The UI would update itself with different/variable refresh rate.

Has anyone tried such yet?

sentences: Best way to solve tile drawing in 2D side scroller? What i still can't figure out is which would be the more sane way / easier and faster way to draw the map on the screen.. I mean i will use many tiles for my maps in my side scroller.. But problem is should i make the maps in whole images like one .png file for each map (Example) or should i draw the tiles by code like a for loop in c++.. Which way is most recomended or where can i read about which way is the best.

sentences:
LWJGL - Mixing 2D and 3D I'm trying to mix 2D and 3D using LWJGL.

I have wrote 2D little method that allow me to easily switch between 2D and 3D.

protected static void make2D() {
    glEnable(GL_BLEND);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    glOrtho(0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
}

protected static void make3D() {
    glDisable(GL_BLEND);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity(); // Reset The Projection Matrix
    GLU.gluPerspective(45.0f, ((float) SCREEN_WIDTH / (float) SCREEN_HEIGHT), 0.1f, 100.0f); // Calculate The Aspect Ratio Of The Window

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    glLoadIdentity();
}

The in my rendering code i would do something like:

make2D();
//draw 2D stuffs here

make3D();
//draw 3D stuffs here

What i'm trying to do is to draw a 3D shape (in my case a quad) and i 2D image. I found this example and i took the code from TextureLoader, Texture and Sprite to load and render a 2D image.

Here is how i load the image.

TextureLoader loader = new TextureLoader();
Sprite s = new Sprite(loader, "player.png")

And how i render it:

make2D();
s.draw(0, 0);

It works great.

Here is how i render my quad:

glTranslatef(0.0f, 0.0f, 30.0f);
glScalef(12.0f, 9.0f, 1.0f);
DrawUtils.drawQuad();

Once again, no problem, the quad is properly rendered.

DrawUtils is a simple class i wrote containing utility method to draw primitives shapes.

Now my problem is when i want to mix both of the above, loading/rendering the 2D image, rendering the quad. When i try to load my 2D image with the following:

s = new Sprite(loader, "player.png);

My quad is not rendered anymore (i'm not even trying to render the 2D image at this point). Only the fact of creating the texture create the issue. After looking a bit at the code of Sprite and TextureLoader i found that the problem appears after the call of the glTexImage2d. In the TextureLoader class:

glTexImage2D(target,
        0,
        dstPixelFormat,
        get2Fold(bufferedImage.getWidth()),
        get2Fold(bufferedImage.getHeight()),
        0,
        srcPixelFormat,
        GL_UNSIGNED_BYTE,
        textureBuffer);

Commenting this like make the problem disappear. My question is then why? Is there anything special to do after calling this function to do 3D? Does this function alter the render part, the projection matrix?

sentences:
Workflow to have character look like : Tokyo ghoul:re [Call to exist] I am looking into a lot of different software and now that I got my head around most of them, I was asking mysel if someone knew what has been used to create the characters in the game I mentionned.

Not specifically software if there is no information about it, but at least as it been modeld/sculpted, etc.

Thanks

sentences:
Unity Android: Truecolor texture performance hit and alternatives for truecolor After integrating the graphics assets to my application, I noticed that when the textures are compressed they look very bad compared to truecolor. This happens to all the textures and it did not seem to help changing the texture type to GUI nor did it help to switch the 32-bit display buffering on.

Does using truecolor textures make the application much heavier to run? Or does it just increase the size of the .APK? Are there alternatives to getting a good texture quality and a smaller texture size instead of using truecolor?

EDIT:
I did some experiments with the dithering. I created a textures in GIMP 2.8, one which was RGB and one which was indexed with 255 colours and Floyd-Steinberg dithering with reduced colour bleeding. In the Windows Explorer this looked promising, the image quality had hardly been reduced but the size was halved.

But when they were imported to Unity, they were exactly the same size. And trying out different formats, there was not much noticeable difference between the image quality. Although the banding was a little bit less pronounced but still clearly seen.

EDIT 2:
I played around with the importing settings. And the only conclusion I can come up with is: Don't use alpha! Without the alpha channel, there is no banding with the ETC-compression which is supported by all OpenGL ES 2.0 GPUs.

To have an alpha channel and no banding. I had to go all the way to RGBA 32-bit, which increased the texture file size to 64Kb compared to the no alpha channel ETC's 8Kb.

Here again: not much difference between the GIMP dithered and the RGB versions. So conclusion with this: Dithering in GIMP did next to nothing.

sentences:
Projectile Not Correctly Inheriting Parent Velocity (Unity3D) I am trying to fire projectiles from a player who is moving at very high speeds. The issue is that the bullets do not seem to inherit the angular velocity. If the player is moving in a straight line at 500 U/s, then the bullet correctly inherits that velocity and adds its own speed onto that:

GameObject bullet = Instantiate(projectile, gun.transform.position, gun.transform.rotation);
bullet.GetComponent<Rigidbody>().velocity = r.velocity + bullet.transform.forward *bulletSpeed;

However, if the player is turning really quickly, it does not inherit the rotational velocity, and the bullet looks like it veers off to the side.

How can I implement this? I tried assigning the angular velocity of the player to the bullet, but this just caused the bullet to spin while moving in the same direction.

Some extra details:

I am using rigidbody.MoveRotation() to rotate my player, but I manually calculated angularVelocity to assign it to the bullet
I tried moving the player with AddTorque(), but could not produce any results with the bullets

sentences:
DirectX 11, using Tessellation & Geometry shader in a single pass Before all, sorry for my poor english !

With DirectX 11, i'm trying to create a random map full with GPU.

Using Hull shader stage, I'm managing LOD with tessellation.

Using Domain shader stage, I'm generating the map (based on perlin noise).

Now my goal, is to compute normals in the geometry shader (normal on vertex).
For that, I must use vertex adjency, like geometry is capable of.

But here is the problem... For tessellation, my primitives must be
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST.

But for geometry shader with 6 vertex (triangle primitive and adjency), I must use :
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ.

Think I'm missing something... It must be possible to tessellate and use the results in the geometry shader...
However, it's working with 3 points, but I cannot use the 3 others (they are 0.0, 0.0, 0.0)....

Thank you in advance for any help ;)

sentences:
How do I create my own GPU accelerated graphics API in C#? I am creating 2D game engine in C# and I need some graphic API, so that user can draw sprites or convex vector shapes. I tried to use GDI+ for it. But I discovered that GDI+ is not GPU accelerated and it is too slow. XNA (a toolset for game developers form Microsoft) and it is GPU accelerated.

So I made a performance comparison between XNA and GDI+. XNA draws 2048x2048 px sprite in ~0.05 ms in GDI+ it takes about 400-500 ms. How to start? How to make my own graphic API (like DirectX/OpenGL).

sentences:
How do I make my rigid body rotate a fixed angle value each time I click the movement keys Ive tried some experiments with the character rotation, but I dont want it to rotate when he touches something, but I also need to unfreeze the Z axis rotation or else the character doesnt rotate when I press a key. My code is this right now, each time I press play (with the Z axis unfreeze) the character just turns like 10 degrees each time I press a key and he is still interacting with objetcs, I dunno what I can do and I might need some help :/

public float speed = 2f;
private Rigidbody rb;
private float midJump = 1;
private Rigidbody rB;

//Character Movement

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

    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    Vector3 movement = new Vector3(moveHorizontal, 0f, moveVertical);

    rb.AddForce(movement * speed);

//Character Jump

    if (midJump == 1 && Input.GetKeyDown(KeyCode.Space))
    {
        rb.velocity = new Vector3(0, 45, 0);
        midJump = 2;
    }

//Character Rotation

    else if (rb.velocity.y == 0.0)
        midJump = 1;

    {
        if (Input.GetKeyDown(KeyCode.D))
            rb.AddRelativeTorque(new Vector3(0, 0, 90));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.A))
            rb.AddRelativeTorque(new Vector3(0, 0, -90));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.S))
            rb.AddRelativeTorque(new Vector3(0, 0, 180));
        rb.angularVelocity = Vector3.zero;

        if (Input.GetKeyDown(KeyCode.W))
            rb.AddRelativeTorque(new Vector3(0, 0, 0));
        rb.angularVelocity = Vector3.zero;
    }

}

sentences:
Logarithmic spacing of FFT subbands I'm trying to do the examples within the GameDev.net Beat Detection article ( http://archive.gamedev.net/archive/reference/programming/features/beatdetection/index.html ) I have no issue with performing a FFT and getting the frequency data and doing most of the article. I'm running into trouble though in the section 2.B, Enhancements and beat decision factors.

in this section the author gives 3 equations numbered R10-R12 to be used to determine how many bins go into each subband:

R10 - Linear increase of the width of the subband with its index

R11 - We can choose for example the width of the first subband

R12 - The sum of all the widths must not exceed 1024

He says the following in the article: "Once you have equations (R11) and (R12) it is fairly easy to extract 'a' and 'b', and thus to find the law of the 'wi'. This calculus of 'a' and 'b' must be made manually and 'a' and 'b' defined as constants in the source; indeed they do not vary during the song."

However, I cannot seem to understand how these values are calculated...I'm probably missing something simple, but learning fourier analysis in a couple of weeks has left me Decimated-in-Mind and I cannot seem to see it.

sentences:
knowing all available entity types I'm making a game where at some point the game will create enemies of random types. Each type of enemy available is defined on its own class derived from an enemy superclass. To do this, obviously the different types of enemies should be known. This is what I have thought of:

Just make a list manually. Very simple to do, but I don't like it because I'll be adding more enemy types over time, so any time I add a new class I have to remember to update this (same if I remove an enemy). I would like some kind of auto-updating list.
A completely component based system. There are no different classes for each enemy, but definitions of enemies in some file where all enemy types can be found. I really don't need that level of complexity for my game. I'm still using a component based model to some degree, but each Enemy type gets defined on its own class.
Java Annotation processing. Give each enemy subclass an annotation like @EnemyType("whatever"), then code an annotation processor that writes in a file all available enemy types. Any time a new class is added the file gets updated after compilation.This gives me a feeling of failure even if its a good solution, it's very dependant on Java, so it means I cant think of a general design good for any kind of language. Also I think that this would be too much work for something so simple.

I would like to see comments on these ideas and other possible solutions

Thanks

sentences:
AI using character controller makes unwanted change to it's y position The enemy parent object does not have any colliders except for the character controller. It starts out with y = .57 and immediately jumps to y=1.6355 because of my call to CharacterController.Move(.)

A code snippet is as follows:

myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(targetPos - myTransform.position), rotationSpeed*Time.deltaTime);
Vector3 forward = myTransform.TransformDirection (Vector3.forward);
character.Move (forward * moveSpeed * Time.deltaTime);

The above occurs in my update function. I am reluctant to post more code because this is for an assignment.

I feel like I've tried everything. Using rigidbodies, I fixed this problem but then the enemies began to overlap when they got close. So I reverted back to character controllers. In either case I have been trying different ways of keeping y constant, freezing it, making the y rotation component zero, you name it.

One other thing I'll note is that the enemy moves to this y position regardless of where it is initially placed. My main character also starts a distance in the sky and falls down. It so happens that the y position it ends up is this same one that the enemy teleports to.

EDIT: Also I am on Unity 5.2
EDIT 2: This is for a script I use to make the AI follow my player. It is similar to many you will find just googling, because I based it off of those. I have even tried other people's scripts and had the same problem.
EDIT 3: If I put the enemy lower to the ground (say y=.55) he will not pop up like before. However, he doesn't move toward the player anymore.

sentences: Animating a 3D model with XNA How do I animate a biped model from 3ds max using XNA framework or not necessarily the biped model, it could be any 3D model but how can I code the animation?

sentences:
How does the Maya ASCII FBX format store positions within animation? I want to understand Maya's ASCII FBX format so I can convert animations in it to OSG (OpenSceneGraph) format.

I have a simple sphere, with a translation in one direction for 30 frames baked into an animation. I was expecting to see a list of values like this:

Frame #, X-position, Y-position, Z-position

However, I find nothing like it in the output file. For example, at frame 1, X/Y/Z = -7.189/0/10.136, but I cannot find any of these, or any other X/Y/Z position anywhere in the file.

What am I missing?

Could someone point out the frame/xyz position in the file?

sentences:
Layering with slopes in Unity 2D isometric scene I'm newer to Unity so bear with me. I'm using Unity2D and so far I have my character up and walking around, colliding properly with his surroundings, and I've implemented an effective "isometric sorting" script which swaps the order of sprites based on their y coordinate. What I'm trying to do now is create a slope that exists in the middle of the stage or front (bottom of screen). I'll illustrate what I'm trying to do as explaining it is bound to be confusing.

Right now, I have the ability to move the player up the slope, and in front of the slope (using the isometric sorting script), but it seems maybe impossible to also be able to have the player walk behind the slope.

Here's my idea for how this could be accomplished, but I certainly would need some direction.

Basically, I'm thinking if I can detect that the player has crossed the green line in the image, I could use that information to flip a switch ON which would lower the slopes sorting priority (thus lowering it beneath the players feet), then I would need it to deactivate when the Player exits the slope.

Here is the Isometric Rendering script:

    using UnityEngine;

    [ExecuteInEditMode]
    public class IsometricSpriteRenderer : MonoBehaviour {

    void Update ()
    {
         GetComponent<Renderer>().sortingOrder = (int)(transform.position.y *       -1000);
    }
}

Thank you to anyone who bothers to take the time to help me! I really appreciate it!

sentences:
Euler adjustments between two quaternions I have two quaternions, q1 and q2. If my object's current rotation is at q1, but I need to get it to q2, what would be the process to figure out how much rotation I apply to x, y, and z in order to get there?

In this example, x=right, y=up, z=forward

I've tried getting the delta between the two quaternions and unwrapping that into Eulers and moving the x, y, z the amount of the unwraped Vector3f, but that does not seem to give the correct values. Current implementation in pseudo code:

var dQuat = Quaternion.Inverse(prevRotation) * target.rotation;
dChange = dQuat.eulerAngles;

This approach gives me only positive changes. If I rotate forward on x, I get positive lower numbers and if I rotate backwards on x, I get larger positive numbers.

I'm looking for, in order to get to q2 from q1, rotate n degrees along your x, y, z...

Thanks in advance for any help!

sentences:
Can you sync screen update on vertical retrace with OpenGL? In OpenGL, is there a way to ensure I get exactly, no more nor less, 60 (or whatever rate my monitor is set for) frames per second?

Of course given that the new frame can be calculated in less than 1/60 second.
I was thinking Windows more than Linux or Mac OSX, even though it is interesting to keep an eye on portability.

sentences:
Libgdx drawing a circle with large radius causes exception When drawing a circle using the ShapeRenderer and using a really big radius (in millions, planet/sun size, given in metres) libgdx throws an exception

Exception in thread "LWJGL Application" java.lang.ArrayIndexOutOfBoundsException: 20003
    at com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer20.color(ImmediateModeRenderer20.java:116)
    at com.badlogic.gdx.graphics.glutils.ShapeRenderer.circle(ShapeRenderer.java:880)
    at com.badlogic.gdx.graphics.glutils.ShapeRenderer.circle(ShapeRenderer.java:844)
    at com.kacpr.solar.system.Planet.draw(Planet.java:74)
    at com.kacpr.solar.system.SolarSystem.render(SolarSystem.java:66)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:223)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)

This didn't happen when I used smaller values.
The question I have is whether I'm doing something wrong using such high numbers for a radius and should scale this down before drawing (I use this radius for some other calculations) or is this a bug?

sentences: Making a licensed game you want to make If I, for example, wanted to make a Spongebob game and was not asked to to do so by the company that owns the character, what would I have to do in order to get the rights to make the game?

sentences:
SDL Multiple keyboard support I am making a game with multiplayer split screen mode using SDL. Basically, I like the idea of having each player plug in his own keyboard to the PC, set custom controls via options and being able to play it with controls that he likes.

However, there's a problem. This code gets the keyboard event:

SDL_Event event;
SDL_PollEvent(&event);

SDL_Event has member SDL_KeyboardEvent key, which has member Uint8 which. In short:

event.key.which;

According to this, it should represent keyboard device index, however, I've tried connecting three keyboards to my PC and press the buttons at the same time and the result wasn't satisfying: they all had same keyboard indexes. Is there a solution to this? Or am I missing something?

sentences:
Unity 2d circle collider not stopping after collision with box collider 2d I'm using unity circle collider 2d and rigid body 2d but when it hits the box it doesn't stop there but instead just pass through and fall. Can someone help?

Circle Collider and rigid body 2d setting

Box Collider Settings

Game output

As you can see in game output my circle instead of stopping at collision it is getting passed by box. I want the circle to fall in square rather than free fall.

sentences:
Cocos2d CCSpriteFrameCache: couldn't load texture file I am currently doing this Cocos2d tutorial: http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d

...and get the following error messages:

2011-12-30 16:36:28.536 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.537 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.537 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCache: couldn't load texture file. File not found: AnimBear_default.png.ccz
2011-12-30 16:36:28.538 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.538 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.539 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCache: couldn't load texture file. File not found: AnimBear_default.png.ccz
2011-12-30 16:36:28.540 AnimBear[11273:10a03] cocos2d: CCTexture2D. Can't create Texture. UIImage is nil
2011-12-30 16:36:28.540 AnimBear[11273:10a03] cocos2d: Couldn't add image:AnimBear_default.png.ccz in CCTextureCache
2011-12-30 16:36:28.541 AnimBear[11273:10a03] cocos2d: CCSpriteFrameCa[Switching to process 11273 thread 0x1410b]
[Switching to process 11273 thread 0x10a03]
che: Frame 'bear1.png' not found
2011-12-30 16:36:28.598 AnimBear[11273:10a03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(0x17e4052 0x1975d0a 0x17d136e 0x17d2220 0xc1997 0x3fcf1 0xc16dd 0xc0d7c 0x828b0e 0x8298a6 0x838743 0x8391f8 0x82caa9 0x2798fa9 0x17b81c5 0x171d022 0x171b90a 0x171adb4 0x171accb 0x8292a7 0x82aa9b 0xc085f 0x2135)
terminate called throwing an exceptionsharedlibrary apply-load-rules all

I have the following files in the Resource folder:

AnimBear_default.png.ccz
AnimBear_default.plist

The texture consists of eight(8) bears named Bear1.png - Bear8.png. I have bought and done the texture in Zwoptex, latest version.

The code looks like:

-(id) init {

if((self = [super init])) {

    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"AnimBear_default.plist" textureFile:@"AnimBear_default.png.ccz"];
    CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"AnimBear_default.png.ccz"];
    [self addChild:spriteSheet];

    NSMutableArray *walkAnimFrames = [NSMutableArray array];
    for (int i = 1; i <= 8 ; ++i) {
        [walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"bear%d.png", i]]];
    }

    CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:0.1f];

    CGSize winSize = [CCDirector sharedDirector].winSize;
    self.bear = [CCSprite spriteWithSpriteFrameName:@"bear1.png"];
    _bear.position = ccp(winSize.width/2, winSize.height/2);
    self.walkAction = [CCRepeatForever actionWithAction:
                       [CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
    [_bear runAction:_walkAction];
    [spriteSheet addChild:_bear];

}
return self;

}

I am completely new to Cocos2d and have been trying to search the web and tried different things but with no success :-(

sentences:
Character Controller Rotation in Unity I am using the following code for moving a capsule:
Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
controller.Move(move * Time.deltaTime * playerSpeed);

I am using the following code for the camera, which is a child of the capsule. (xRotation is intialized to 0.0f, and playerBody is a transform):
        float mouseX = Input.GetAxis("Mouse X") * mouseSpeed * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSpeed * Time.deltaTime;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);

The character is always moving in the same direction, ignoring the rotation. How can I fix this?

sentences:
Creating Cut Scenes For iPad I am working on an iPad game, and would like to have a few, pre-rendered cut scenes that are shown at key moments throughout the game.

How do low-budget software developers create pre-rendered cut scenes, especially when the target device is an iPad?

sentences:
Unity custom inspector - How to serialize scene objects in ScriptableObject? I am writing a custom inspector for the artist in our team to design some simple animations (without using mecanim).

The basic setup is the following:

Animations are saved as ScriptableObjects. There is a class AnimationBase that inherits from ScriptableObject and different Animation classes that inherit from AnimationBase.

There is an AnimationSystem script that stores the animations for one gameobject. Animations can be added dynamically for different events (I got multiple MyAnimation[] to store those per event type). It also stores a string with the name of a ScriptableObject AnimationList. That ScriptableObject stores the filenames for all the used animations in lists of strings for the different animation event types.

Now I have an animation "EnableAnimation" (inheriting from AnimationBase and therefore a ScriptableObject) that should enable a gameobject. If I select a gameobject from the assets, the reference is saved in the EnableAnimation asset as expected. But when I select a gameobject from the scene, the EnableAnimation assets shows "Type mismatch" instead.

I think the problem is that I use a EnableAnimation asset but want to store information in the scene. Is it possible to store the ScriptableObject in the scene instead?

Other things to take into account for solving the problem:

The custom inspector should work for prefabs, prefab instances and normal gameobjects. If possible prefab instances should be allowed to use the same animations as the prefab but change some values per scene.
I have a prefab "A" that has an AnimationSystem component and a child gamobject "B". With the default inspector I can select B as an gameobject in a script and apply that change to the prefab. If I select a different gameobject in the scene and try to apply, the prefab does not save the reference. If possible, this behaviour should be used too.

Thank you for your help!

sentences:
Using atan2 to calculate angle between two vectors I understand that:

atan2(vector.y, vector.x) = the angle between the vector and the X axis.

But I wanted to know how to get the angle between two vectors using atan2. So I came across this solution:

atan2(vector1.y - vector2.y, vector1.x - vector2.x)

My question is very simple:

Will the two following formulas produce the same number?

atan2(vector1.y - vector2.y, vector1.x - vector2.x)
atan2(vector2.y - vector1.y, vector2.x - vector1.x)

If not: How do I know what vector comes first in the subtractions?

Thanks

sentences:
Why does Everyplay indicate recording is not supported in this code? I am using Everyplay in my game and when I run my game on mobile. It showing me as recording supported as false. I put the Client ID and client secret as well and checked on Android enabled. Can somebody tell me whats wrong with my code or did I miss something? I am using onePlus2 with marshmallow. And using Unity 4.6.4f1 with latest SDK of Everyplay from Asset Store (2110-1530). Here's my code:

private bool readyForRecord = false;
private bool recordingInProgress = false;

void OnEnable(){

    Everyplay.ReadyForRecording += EveryPlayRadyForRecording;
    Everyplay.RecordingStarted += RecordingStarted;
    Everyplay.RecordingStopped += RecordingStopped;

}

void OnDisable(){

    Everyplay.ReadyForRecording -= EveryPlayRadyForRecording;
    Everyplay.RecordingStarted -= RecordingStarted;
    Everyplay.RecordingStopped -= RecordingStopped;
}

// Use this for initialization
void Start () {
    Everyplay.Initialize ();
    Debug.Log  ("Is recording supported =  " + Everyplay.IsRecordingSupported ());
  }

#region Recording Operations

public void StartRecording(){
    if (Everyplay.IsReadyForRecording ()) {

        Debug.Log ("Recording Started");

        recordingInProgress = true;
        Everyplay.StartRecording ();

    }

    if (recordingInProgress)
        StopRecording ();

}

public void PauseRecording(){
    Debug.Log ("Recording Paused!");

    if(!Everyplay.IsPaused())
        Everyplay.PauseRecording ();

}

public void ResumeRecording(){
    Debug.Log ("Resuming Recording");

    if (Everyplay.IsPaused ())
          Everyplay.ResumeRecording ();

}

public void StopRecording(){
    if (recordingInProgress) {
        Everyplay.StopRecording ();
        recordingInProgress = false;
        Debug.Log ("Recording Stopped!");
    }

}

public void ShowRecording(){
    Debug.Log  ("Showing Recording...please wait!");

    if (!recordingInProgress)
        Everyplay.ShowSharingModal ();

}

#endregion

#region Everyplay Callback Events

private void EveryPlayRadyForRecording(bool ready){
    Debug.Log ("Ready for recording =  " + ready);

    if (ready)
        readyForRecord = ready;

}

private void RecordingStarted(){
    Debug.Log ("Recording started");
}

private void RecordingStopped(){
    Debug.Log  ("Recording stopped");
}

private void SharingInProgress(int videoID, float progress){
    Debug.Log  (" Uploading " + videoID + " " + progress + "%" + " completed.");

}

private void SharingCompleted(int videoID){
    Debug.Log  (" Uploading Sucessful =  " + videoID);
}

#endregion

sentences:
Unity 2109.3.4 apk fails to install on to quest Hello's I was able to successfully sideload APK's on to the quest for a while now however when I updated to unity 2019.3.4 side quest is now unable to successfully load a built APK onto the oculus quest.
Here is the error I receive,  INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113
I have tried numerous things and am a bit stuck. Any help is appreciated
List of attempts :
Tried with SDK included in unity
Tried custom android studio location
Tried switching from MONO backend and enabling Arm 64
Tried lowering min to the lowest API level
Tried updating all SDK tools in android studio
Tried custom ndk, unable to get one unity is happy with
Tried clearing cache and uninstalling prev install

sentences:
How to setup for live player / observer pair w/ voice chat in Minecraft I'm trying to build a setup for educational use of Minecraft:

One person plays Minecraft, another person watches live online with the least lag/latency possible, and the pair can talk over high-quality voice chat.

What is the best setup to allow this?

Scenario A:

1) Write a mod that allows a watcher to be a passive spectator through their copy of Minecraft? The watcher would see exactly what the player sees.  Would this be the fastest and clearest picture? Is it a trivial mod to write?

2) Connect together over Hamachi? Can that be dead-easy to set up?

3) Use a voice-chat in the game itself?

Scenario B:

1) Use a streaming video technology. (Twitch? Google Hangouts? Something else?)

2) Third party voice chat like Skype. (Or just Google Hangouts?)

My fear here is lag, low quality video, bandwidth.

Scenario C ?

Thanks very much for any help :)

sentences:
How to translate from Slick2d coordinates to jBox2d I read through this question to try and get a grasp on the topic, but I can't figure out how to apply this to my Slick2d window.

I'm trying to do something as simple as place an edge on the bottom of the screen, so I had been thinking of something like

bottomEdge.setAsEdge(new Vec2(0f, SCREEN_HEIGHT), new Vec2(SCREEN_WIDTH, SCREEN_HEIGHT))

...but I have no idea how move from my pixel system to the MKS system of jBox2d. In fact, the body.getPosition().x of a movable body I am drawing returns a decimal value between 100 and 101, but I have no idea how it's deciding on this value. As I move off screen to the left, it decreases down to 99, 98, and so on.

How should I go about making this conversion and thereby also being able to support different screen sizes & resolutions? My instinct is to somehow use the LWJGL underneath Slick, but I'm lost.

sentences:
Anti-Aliasing in Java In my game I want to have the different anti-aliasing option like: none, x2, x4, x8 and x16. I know that you can use anti-aliasing with Graphics2D in the way below bu is there any way that I can use the different levels of anti-aliasing (x2, x4, x8 and x16)?.

RenderingHints rh = new RenderingHints(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHints(rh);

sentences:
Object not clamping after applying force/impulse? I am having issue with clamping the vertical position of my character after applying force. This causes a jittery effect in my character.

There are other several ways I think of, but I dont know if its the right way.

Use translate, but ive read somewhere that if I am dealing with physics its better that to use addforce.
Add an invisible gameobject with a collider to set bounderies.

and third is clamp its movement while using addforce which in my case does not work. here is my code which I call on the update.

 rb = player.GetComponent<Rigidbody2D>();
 Vector3 clampedPOS = player.transform.position;

    clampedPOS.y = Mathf.Clamp(player.transform.position.y, -6f, 4f);
    player.transform.position = clampedPOS;

    rb.AddForce(Vector2.up * upForce, ForceMode2D.Impulse);

could someone help me with these?

sentences:
libGDX/HTML5 game sounds doesn't work on iPhone I have a libGDX/HTML5 project that works well on desktop browsers, but on mobile browsers it has problems.

I can have some sounds on Android browsers (not perfect) but on iPhone browsers it doesn't work at all.

I don't know exactly which part of the project to put in here. There is an mp3 file to be played at menu screen, "music.mp3". I use:

import com.badlogic.gdx.audio.Music;
...
public class MyGame extends ApplicationAdapter {
...
private Music music;
...
@Override
    public void create () {
    ...
         music = Gdx.audio.newMusic(Gdx.files.internal("music.mp3"));
         music.setLooping(true);
         music.setVolume(0.1f);
         music.play();
    ...
    }
}

I would appreciate any help.

sentences:
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:
A* pathfinding takes too long, shortcuts needed So I have a game where the player can move on a grid 108 X 192 large. It uses a simple A* path-finding algorithm to move. Unfortunately, After 0.03 seconds, it would have only looked at about 300 nodes, meaning that if the end node is blocked from passage, it would take about 2 seconds for it to realize this (A* without optimizations returns failed when the open list is empty, when it has inspected every path and realized there was no solution). And I want at least 20 fps!

I have not used any optimizations, and each point in the grid is a boolean blocked or unblocked. Any ways to speed it up?

For example, in Dota 2 (a popular MOBA), the map is full of trees and cliffs, and is 15,000 game units by 15,000 game units big, but the character starts moving as soon as you click where you want it to go. How do they do that, and is it a simple thing I am missing?

sentences:
Unity : How to detect if a UI button is pressed down? I want a UI up arrow button to be able to detect if it is pressing down. It is a child of a canvas in a 3D scene. My target platform is webGL for both desktops and mobiles.
I coded not only the control of the up arrow UI button but also the control of keyboard arrow button for desktops.

The keyboard control worked fine in PC but the UI arrow button didn't work as expected both in desktop and mobile.

I tried the OnPointerDown() function attaching to the UI up arrow button and the logged it. The log didn't even show up when the UI button is pressed down both in desktop and mobile.

It seems the OnPointerDown() needs the image of the button to receive raycast so its image component Raycast target option is on.

Isn't the onPointerDown() supposed to be used in detecting press down of UI component by both mouse in desktop and touch in mobile?

How to get the UI button to be notified when it is pressed down?
Any approach other than onPointerDown() which can do the same thing?

My scripts are here:

the one attached to the car object to be controlled

using UnityEngine;

public class CarPlayerControl : MonoBehaviour {

public float speed = 40;
private bool touchCtrl = false;
private float xInput = 0f;
private float zInput = 0f;

void Awake(){
    //if (Input.touchSupported && Application.platform
         //     != RuntimePlatform.WebGLPlayer){
        //touchCtrl = true;
        //}
        }

void FixedUpdate(){

    xInput = 0f;
    zInput = 0f;

    if (touchCtrl)
    {

    }
    else //keyboard control in desktop
    {
        xInput = Input.GetAxis("Horizontal");
        zInput = Input.GetAxis("Vertical");
    }

    Move(xInput, zInput);
}

public void Move(float xInput, float zInput)
{
    float xMove = xInput * speed * Time.deltaTime;
    float zMove = zInput * speed * Time.deltaTime;

    float x = KeepXWithinRange(xMove);
    float y = transform.position.y;
    float z = KeepZWithinRange(zMove);

    transform.position = new Vector3(x, y, z);
}

private float KeepXWithinRange(float xMove){
    float x = transform.position.x + xMove;
    return Mathf.Clamp(x, 0, 900);
}

private float KeepZWithinRange(float zMove)
{
    float z = transform.position.z + zMove;
    return Mathf.Clamp(z, -470, 500);
}
}

and the one attached to the UI Up arrow button

using UnityEngine;

public class ButtonUpControl : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public GameObject car;
private CarPlayerControl carPlayerControl;
private bool mouseDown;
private float xInput;

void Awake()
{
    carPlayerControl = car.GetComponent<CarPlayerControl>();
    mouseDown = false;
}
void Start()
{

}

void FixedUpdate()
{
    if (mouseDown) {
        xInput = 1.0f;
    }
    else {
        xInput = 0f;
    }

    carPlayerControl.Move(xInput, 0f);
}

public void OnPointerDown(PointerEventData eventData)
{
    mouseDown = true;
    Debug.Log("on ptr down btn up ");
}

public void OnPointerUp(PointerEventData eventData)
{
    mouseDown = false;
    Debug.Log("on ptr up btn up ");
}
}

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:
Counting multiple touches using Cocos2dx 3.2 I'm trying to count the number of active touches in screen in order to perform an an action in case that there are two touches:

auto jumpListener = EventListenerTouchAllAtOnce::create();
    jumpListener->onTouchesBegan = [=](const std::vector<Touch*>& touches, Event* event)
    {
        CCLOG("Multi-touch detected %d", touches.size());
        if(touches.size() == 2)
        {
            this->_player->jump();
        }

    };

But even if I'm touching with two fingers, I get that only 1 touch has been made, any suggestions?

sentences:
What are some methods which can be applied to make arcade-highscore games fun/interesting? Consider an arcade game where you shoot falling objects and the goal is to beat the high-score.

What are some methods you can apply to such games to make the player feel it is fun and wants to play it again and again?

sentences:
Slick2d Particles loading xml returning null I've made a particle class that creates a particle of Slick2d library, but the XML file doesn't want to load , it keeps giving me null error. I gave it the path as I do for everything but it refuses to work and its been like this for days I just cant get it to open that XML file. If anyone can help me it would be much appreciated.

try {
        particleImage = new Image("res/particles/particle.png", false);
        system = new ParticleSystem(particleImage,1500);

        //load the xml file and add the emitter to the system
        File xmlFile = new File("res/particles/bloodDown.xml");
        ConfigurableEmitter emitter = ParticleIO.loadEmitter(xmlFile);
        emitter.setPosition(315, 358);
        system.addEmitter(emitter);
    } catch (Exception e) {
        System.out.println("Exception: " +e.getMessage());
        e.printStackTrace();
        System.exit(0);
    }

Entire particle class : http://pastebin.com/rBR0xpE7

Particle manager class : http://pastebin.com/N8gNFk6W

Slick 2d documentation : http://www.slick2d.org/javadoc/

My structure of workspace:

sentences:
Any way to track speed of hand movements below iPhone 3.2? I have used the pan gesture for tracking the Pixel-Per-Second (or speed of the movement of the hand) but the real trouble is that the PanGesture library doesn't support any deployment target less than 3.2.

So how would I track the speed of hand movements below a deployment target of 3.2?

sentences:
How to not render what is behind object? I am working on a 3d project using openGL. I am looking for a way to optimize my renderings.
Is there a way to tell if an object is behind another object and thus not visible to not waste time rendering it ?
I am already working on a frustrum culling implementation to not display what is not visible because out of the viewing frustrum, but I didn't find a way to know if an object in located behind another object.
Can any of you help me about this, please ?

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:
What is the general architecture of a server for a game like rust/minecraft? If a game's client is written in Unity or UE4 or another engine, is the server usually written in the same engine? Or is it written in standalone c++?

Does the server use a database like MySQL to store the locations of deployed structures and bases etc? Or is everything stored in memory in arrays or in another way?

sentences:
Crash when using datablocks I have really throughly searched the net and could not find any solution for this so I ask for help here.

Anyway, I have this datablock in datablocks.cs:

    datablock t2dSceneObjectDatablock(EnemyShipConfig)
{
   canSaveDynamicFields = "1";
   Layer = "3";
   size = "64 64";
   CollisionActiveSend = "1";
   CollisionActiveReceive = "1";
   CollisionCallback = true;
   CollisionLayers = "3";
   CollisionDetectionMode = "POLYGON";
   CollisionPolyList = "0.00 -0.791 0.756 0.751 -0.746 0.732";
   UsesPhysics = "0";
   Rotation = "-90";
   WorldLimitMode = "KILL";
   WorldLimitMax = "880 360";
   WorldLimitMin = "-765 -436";

   minFireRate = "2000";
   maxFireRate = "1200";
   laserSpeed  = "800";
   minSpeed    = "100";
   maxSpeed    = "150";
};

This is an exact reproduction of an object that I have manually edited in the editor. So far, I just used clone() to get as many enemies as I need, while it was out of sight. It is a r-type style shooter, so I need a variable amount of enemies. Since clone() spams my log, I decided to use datablocks, since it is also more flexible.

That's what I get when I use clone():

  Con::execute - 0 has no namespace: onRemoveFromScene

However, once spawning begins, my game freezes and crashes:

    function SpawnEnemy()
{
    //%spawnedEnemy = EnemyShipMaster.clone(true);
    %spawnedEnemy = new t2dStaticSprite()
    {
       class         = "EnemyShip";
       sceneGraph    = $global_sceneGraph;
       datablock     = "EnemyShipConfig";
       imageMap      = "starshipImageMap";
       layer = 3;
    };

    %speed  = getRandom(%spawnedEnemy.minSpeed, %spawnedEnemy.maxSpeed);
    %y      = getRandom(-320, 320);

    // Set Properties
    %spawnedEnemy.setPositionX(700);
    %spawnedEnemy.setPositionY(%y);
    %spawnedEnemy.setVisible(true);
    %spawnedEnemy.setLinearVelocityX( -%speed );
    %spawnedEnemy.setTimerOn( getRandom( %spawnedEnemy.maxFireRate, %spawnedEnemy.minFireRate ) );
}

// Definition of $global_sceneGraph from game.cs:
$global_sceneGraph = sceneWindow2D.loadLevel(%level);

As I said, it works fine when I use clone() (which is commented out here), but my log gets spammed. I really hope someone can shed some light for me, this is driving me crazy.

sentences:
Exporting a simple mesh from Blender for reading in Assimp I'm trying to create some simple assets for using in my rendering engine. What I'm trying to do is to generate simple low poly models and then importing them into my application using Assimp. I can successfully import models I find on the web so everything works fine application-wise. But since I'm a total noob at Blender (I managed to learn some interface basics through tutorials) I just seem able to export a model with geometry information (vertex positions) and that's it. My models don't have normals or uv-cordinates, and no textures whatsoever.
What I'm asking is a simple workflow to create and export a very simple mesh to a obj or collada format that I can read into my code.

sentences:
Bullet Physics ConvexDecomposition? I've looked at Bullet Physics ConvexComposition Demo and would like to implement that in my game but the code is so undescriptive and it's hard to understand what is going on. Would any of you people out there have the time to show how to use ConvexDecomposition?

Thank you very much!

sentences:
Shortest rotation value I have a top down game. The player moves the avatar with WASD where W rotates the avator to 180, S rotates to 0, A rotates to 90 and D rotates to 270. I also do diagonal movement so if they hold SA it rotates to 45, WA it rotates to 135, WD it rotates to 225, and SD it rotates to 315.

I smoothly rotate from the current rotation to the hardcoded desired rotation based on those key combo's. Of course what happens is if I'm rotating from anything > 180 to 0 it goes the long way back to 0. So if I'm at 270 rotation and I press S key it sends it back to 0 but that goes from 270 to 0 vs going from 270 to 360 which would result in the same end result but how it got there would be shorter.

I was looking at this (https://answers.unity.com/questions/556480/rotate-the-shortest-way.html) and trying to translate it but it's not working. Below is my translation.

function Script:CalcShortestRot(current, target)
    --if current == target then return from end

    local dist = target - current + 180
    dist = dist - math.floor(dist / 2 / 180) * 2 * 180 - 180

    System:Print("Dist = "..dist)

    if dist < 0 then
        System:Print("Value 1 = "..target - current)
        return current - dist
    else
        System:Print("Value 2 = "..current + target)
        return current + dist
    end
end

The usage is:

-- determine the model rotation based on direction we are going
    if move > 0 then
        if strafe > 0 then
            self.targetRot = self:CalcShortestRot(self.targetRot, 225)
            --self.targetRot = 225
        elseif strafe < 0 then
            --self.targetRot = 135
            self.targetRot = self:CalcShortestRot(self.targetRot, 135)
        else
            --self.targetRot = 180
            self.targetRot = self:CalcShortestRot(self.targetRot, 180)
        end
    elseif move < 0 then
        if strafe > 0 then
            --self.targetRot = 315
            self.targetRot = self:CalcShortestRot(self.targetRot, 315)
        elseif strafe < 0 then
            --self.targetRot = 45
            self.targetRot = self:CalcShortestRot(self.targetRot, 45)
        else
            --self.targetRot = 0
            self.targetRot = self:CalcShortestRot(self.targetRot, 0)
        end
    elseif strafe > 0 then
        --self.targetRot = 270
        self.targetRot = self:CalcShortestRot(self.targetRot, 270)
    elseif strafe < 0 then
        --self.targetRot = 90
        self.targetRot = self:CalcShortestRot(self.targetRot, 90)
    end

    self.rot = Math:Curve(self.targetRot, self.rot, self.damping)

EDIT: updated my CalcShortestRot() function per comments below but still not working. It spins all around

sentences:
Handling of Slopes for a Character Controller I recently moved from Bullet to PhysX to see if it would be a better solution for my game engine, and so far it is. The only problem that I'm having, which is part of the reason that I switched is with the character controller. The build in one is pretty good, but I've run into an issue when I walk down a slope (although up is fine). Because the player walks faster than gravity pulls him down (I set it to 0 when he is on the ground), he detaches from the slope, which obviously is not desirable.

I've considered and tested several ways to fix this. One idea that I had was to check if there was ground below the character once he moved in the xz-direction, with a distance less than or equal to to the magnitude of that vector because I decided that a 45º slope was what the character could not walk up. That had a huge amount of problems and resulted in a lot of teleporting.

Then I tried to make it so when the player was on the ground that a really high gravity would be applied to keep him on the slope. This also didn't work because if the character was on the ground and then moved over a cliff, he was on the ground before he walked over the cliff he would be teleported down.

I'm really not sure how to progress here because logically the problem has stumped me. I took a look at some of the behavior of the Unreal character and it doesn't seem to suffer from any of these problems and it uses PhysX, so obviously they found a solution.

If anyone has any ideas, I would appreciate it.

Thanks

sentences:
Random number in a range, biased toward the low end of the range I have an input of two values, let's say 1 and 10.
Lesser numbers should overall occur more often in the output than higher numbers, while there is a peak in the probability at #2:

1: very common
2: extremely common
3: very common
4: common
5: somewhat common
...
10: extremely rare

How do I achieve this? My code until now looks like this:

function getValue($min, $max) {
    return random($min, $max);
}

sentences:
I know fundamental programming. But how do I get started in game development now? I'm a 20 year old programming student. I know fundamental programming in BASIC, C, C++ and JAVA. What I wanted to ask is, where do I go from here? Are there any books that the community can mention that will help me develop a game or at least learn game development? I've had a lot of ideas and really want to make some sort of prototype to see if I'm suited for the industry.

I really don't mind learning any new languages but I need to know what I should begin with. A good book that will help with a little more understanding as I go up will be very helpful. Maybe a tutorial to develop some basic 2D games like a side-scroller, snake or pocket tanks in an easy to understand SDK?

I know that to get some credit under your belt, you need to be able to make a few games on your own.

Also, what platform should I start on? The PC, iOS or Android (as an introduction) for now. I don't want to get into high level game design just yet. Just something a bit basic to help out in future development.

Anything pointing me in the right direction will be  really really helpful.

Edit: Also, I want to say that I'm looking towards this from a game designer's point of view more than a game programmer. I want suggestions on any SDKs or easy to use programs I can use to understand game design. Then delve deeper into the programming after that.

Not as employment but as developing your own games (for now).

sentences:
Cocos2d/Cocos2d-x Attaching an arrow (sprite) to another body sprite (person) I am trying to set up a simple bow and arrow game. When the arrow hits the enemy body, the arrow's body is deleted and the arrow sprite continues to update, keeping the position correct in relation to the enemy it hit. Picture an arrow sticking into a body and that body still rotating and moving. My problem is that the rotation is completely wrong when the enemy rotates. I know how to do this in 3d with matrix transformation but I can't seem to figure it out in 2d with Cocos.

Here is my method.

I save offset at which the arrow hit the enemy.
Every frame, I make the rotation of the sprite match the rotation of the enemy.
Then, I apply the offset I took initially which is where the arrow hit the enemy.

When they rotate, they rotate about their respective anchors and I am wondering if I need to set the anchor of the arrow to the center of the sprite. Does anyone know of an easy way to do this. If not, I will try to create an algorithm where the anchor is set to the offset divided by the width and height of the sprite image hopefully giving me the correct anchor values.

Then I assume I need to reposition the sprite.

Does anyone have a simpler way to do this?

sentences:
How should I share variables between instances/classes? I'm making a game using LOVE, so everything is programmed in Lua. I've been experimenting with using classes and object orientation recently. I've found out that a nice system to use is having most of the game's code in different classes, and having a table of instances with all of the instances of any class in it. This way, I can go through every instance of every class and update and draw it by calling the same function.

There is a problem, though. Let's say I have an instance of a player with variables for health and recharge time of a weapon. I also have a master instance which is responsible for drawing the HUD. How can I tell the master instance what the player's health is? Bad solutions:

Assuming that the player instance will always have the same position in the table - that can be easily changed.
Using global variables. Global variables are evil.
Have the master instance outside of the instances table, and have the player set variables inside the master instance, which it then uses for HUD drawing. This is really bad because now I have to make a duplicate of every variable the master instance needs.

What is the proper, standard way of sharing variables between instances? Do I need to change the way I keep track of instances?

Edit: the hump library for LOVE has a signal/slot system. Would that be a reasonable way to share variables between instances?

sentences:
Is it a good idea to use box2d to control sprite movement in a 2D game? I'm trying to use Box2D to control sprite movement.Some burning issues are these:

1.When I trying to move the sprite on a slope or a lean barrier. The sprite will move off the slope which is not what I want.

2.ALternatively, I could use setPosition or CCAction which provides by cocos2d-x to move the sprite and update the body position use SetTransform. But the body will lost it's physical limitation, it will passthrough other body.

Thanks for your time, if you guys got any solution?

sentences: How to continue Lego microgame tutorial? I was passing Lego microgame tutorial. I closed it and quit Unity. Now, how can I continue it from the same place? If I opening it's project, I am getting just silent Unity project, without any guidance.

sentences:
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:
Does GLSL support multitexturing? I am using LWJGL libraries to code myself a game. I want to be able to import a project from blender to my game. I have the wavefront .obj reader and it works perfectly for my needs. Although because my model uses multiple images I do not know how to set that up in my game engine. All it does is stretch the first image I send to the shaders across the entire model. Then I ran across a couple videos that makes me doubt that GLSL can support multiple images. Also, I found a couple solutions but they were depreciated because I use LWJGL 3 with slick-util 3 to load the image.

So I would first like to know, does GLSL support rendering multiple images on a single object?

If GLSL can support rendering multiple images on a single object, how would I proceed conceptually to perform this feat?

P.S. Let me know if want images or anything to better understand my question. Thank you all!

sentences:
In-Game Level Design with XNA? I am wondering about in-game level design. My current situation revolves around Tiled - I have many different layers with different types of objects in them (for anyone who isn't familiar with Tiled, an object is nothing more than a coordinate with arbitrary properties assigned to it).

I am currently re-compiling the game every time I make a little change to my map file to see if everything is positioned properly. Is there a way for me to have my game automatically re-load the level if a map file change is detected? Does XNA even allow for this, or does the way the content pipeline work not allow for dynamic content in such a way? Any tips or suggestions are absolutely welcome.

sentences:
Porting to Android...what is the equivalent of Properties.Settings.Default? I'm porting my MonoGame/OpenGL app to Android.  My game uses Properties.Settings.Default to store user preferences.

What is the equivalent of this in Android?

sentences:
Emissive material not casting light on itself in Unreal I have a static mesh that has an emissive material applied to part of the mesh. The emissive material successfully cast light to surrounding objects. However, the face of the mesh with the emissive material fails to cast light on the rest of the mesh.

This is how the unlit scene look:

The parts circled blue has the emissive material, and the sphere and cube are both lit by the emissive material. However, the part of the stairs (highlighted in red) does not get lit.

The lit scene:

Is there a way for the stairs to be lit by itself?

sentences:
Can a partially completed game be sold to a game development company for completion? I'm a lone programmer with an idea for a game.  I believe I can code the mechanics of the game by myself.  I do not think I have the expertise, time, or creativity to create the graphics and audio of a marketable game.  I have a very good understanding of how to design applications that are loosely coupled to their front ends and I feel I could create the game with an ugly UI.

I was wondering if I were to create a game, would I then be able to sell or license my game to a game development company that has the resources to replace my UI with quality work?  If this can work, are there any examples of other people doing it?

I imagine the scale of the game would be a consideration for this approach.  A large scale game would probably be more attractive, but there is no way a lone programmer could create it to begin with.  A small scale game may not be worth the time for a game development company.

sentences:
Unity using raw mocap data without actually moving the character I play around with animations and unitys raw motion capture data asset pack. My problem is as followed:

I have an idle, walkforward and a runforward animation and play them based on the keyboard input. But i realized when i move my character backwards (using a movement script) but still playing the walkforward animation the character basically moves backward and forward at the same time.

So how can i play the animation but without actually effecting the position of the character?

Thank you

sentences:
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:
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: How to discern boxes and spheres when importing from fbx I can import scene from FBX file into my engine, and i want spheres, boxes and capsules to be imported as colliders. So, how i can check if imported instance is one of them? Thanks.

sentences:
Fade a texture effect as it nears the end of a cylinder mesh In my game I have a laser beam that travels for about 15m, but abruptly stops due to the mesh the texture is attached to. How can I setup my shader graph so that the end of the texture fades away? I can't find anything similar to this anywhere online, and have tried multiple things (gradient/colors with lerp attached to alpha) but just can't figure it out as I'm too new to the whole shader graph thing. Anything helps, thank you.
Note: The texture is 'animated' and scrolls along the path of the beam using the shader graph

sentences:
Math > Logic for a Logarithmic Score Meter I'm trying to implement a score meter whereby I specify a maximum value (say 15,000) and I can render values on it in a logarithmic manner ie:

+------+---+--+-++        +------+---+--+-++
|==              |        |======          |
+------+---+--+-++        +------+---+--+-++
 200 pts                   1,000 pts

+------+---+--+-++        +------+---+--+-++
|=============   |        |================|
+------+---+--+-++        +------+---+--+-++
 5,000 pts                 15,000 pts +

The upper bound needs to be variable, and need to be able to convert a score to a percentage, using the above mockup as an example:

score2pct(15000, 200)   = 0.2
score2pct(15000, 1000)  = 0.4
score2pct(15000, 5000)  = 0.8
score2pct(15000, 15000) = 1

Does anyone have any pointers for me?

sentences:
Why don't raytracing algorithms include the speed of light? From what I understand about ray-tracing, it is instantaneous in its speed from the light source to the user. Is there a type of ray-tracing where the "rays" move at the speed of light or are affected by gravity? Such methods would be useful in simulating large scale systems (like planets).

Also, can the same method be applied to sound?

sentences:
What are the pros and cons to building an audience with a small, simple, free game first as opposed to focusing efforts on a commercial release There are two projects we can work on. One would be a small free game to try and get our name out/build an audience. The second is our main idea for a first product.

What are the pros and cons of building the small, simple, free game first instead of focusing that time/effort into the main money making project.

sentences:
Finding other programmers to help on a project As a semi FAQ question attempt :

Where can you find people to work with you on a project? Particularly programmers. One thing that is obvious is that all programmers have a project (or twenty), and the chances of a programmer just hanging around looking for something to do is a lot less likely than if it were an artist needed on the team.

So, where do you post? Where do you search and follow people around until it looks like they are a viable team member? Is it really difficult to assemble a team that are not close friends or chat buddies? Are there sites with this sort of posting?

To clarify : I am referring to a team.

Example 1 : I am making gameEngineOfAwesomeness. I need help.

Example 2 : I am 70% complete on this game, and i need help.

Example 3 : I have an open source project idea, with a prototype. I need help.

It doesn't necessarily mean open source, just programmers who can work with me on something (and where to find them :))

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: Should beginning/indie game developers target multiple platforms initially? Partially as a response to How do game developers target multiple platforms (Xbox 360, PS3, PC and Linux)? but mainly because there are people on here with published games, should cross platform be the first requirement/feature for a developer trying to break into the business?  I have always been a believer (in a totally procrastinating sort of way) in picking either a 'niche' or 'mass market' platform and porting later if demand justified it.  Cross platform always felt like an artifical barrier to entry.  Why shouldn't we all write iPhone, Windows, or Browser games?

sentences:
Platform independent replacement for LuaInterface I'm currently working on a project in C#/XNA, however I'm planning to migrate this to MonoGame so that it can go onto more platforms. The problem is that I am currently using a lot of Lua, and for that in XNA, I am using LuaInterface.

The issue I now have is that LuaInterface only runs on Windows because of the dlls that it requires, but I would like to make this project available on Linux and Macs as well. Does anyone know of a good alternative to LuaInterface that could slot into Mono quite nicely?

Re-writing the parts which are currently in Lua in another language wouldn't be too much of a problem, but I need to be able to use scripting as I want to make large portions of my game open to players for modding.

sentences:
3DS Max 2015 - Viewport issues when using sub-object selection box I'm fairly new to using 3DS Max (2015), and have encountered an issue that I can't figure out.

Whenever I'm using the selection tools (Vertices, Edges, Polys, etc) and drag out a marquee/selection box, it has a regular tendency of either forcing a strange wireframe view, or actually sending the whole viewport grey.

This is immediately fixed once I release the marquee, however it does interfere with my ability to select and manipulate objects, as I'm forced to select by memory. It tends to happen in 'spurts', and then doesn't happen for a few more minutes, so it would seem that it's not a setting issue or the like, as it doesn't happen consistently.

I have discussed the issue with someone who is familiar with the software, and he believes that it is a memory/performance thing, and isn't necessarily a bug. If this is the case, is there any way of disabling the feature?

I have attached images demonstrating the issue below:

Working image. This is the view for both the images below it; pan or zoom doesn't change at all.
Greyed out viewport. This is the most common change that happens, and restricts any sort of view of the object (or any other object).
WireframeThis happens reasonably regularly, though not as much as the completely greyed out view. I can handle this view if necessary, though wold still appreciate the ability to disable the 'feature' altogether.

I can confirm that none of the objects are in isolation mode, although it does happen under that mode too (for what it's worth). It also happens in all

My system specs are:

Processor: Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz
Graphics: NVIDIA GeForce GTX 880M - 8GBVRAM
RAM: 32GB
OS: Windows 8.1 x64

I hope that I have provided enough information, and please let me know if you need more.

I tried asking this over on the Graphic Design SE, but was shot down when finding out that the community seems to have agreed NOT to answer any questions relating to 3D modelling, so I really hope this is a place I can ask! If not, please give me somewhere to go, because I'm running out of options. :/

Thanks in advance.

sentences: No RenderWindow class in SFML? In their official tutorials it is said that to draw graphics on screen, i have to use RenderWindow instead of Window. But when i write sf:: RenderWindow window, error pops up saying that there is no RenderWindow in sf::  . I  copy-pasted the code but it still does not works. What could possibly be the  reason behind this ?

sentences:
How to get a safe index for glVertexAttribPointer without shader? I'm learning to use VBOs and trying to keep it simple before building up. Trying to do it without writing a shader right now. It looks like this is possible, but I cannot seem to find a way to get the index parameter for glVertexAttribPointer.

I've seen that you can get the index with glGetAttribLocation, but that function seems to require a shader be passed in to get the index.

I don't want to assign the index, because I'm worried about different pieces of a project accidentally using the same index and causing problems. (If there's some reason I shouldn't be worried about that, please let me know)

Question is: Without using shaders and without assigning the index, how can I get the index for glVertexAttribPointer?

sentences:
How to handle circle penetration I've been working on circle to circle collision and have gotten the intersection method working correctly, but I'm having problems using the returned values to actually separate the circles from one another.

This is the method which calculates the depth of the circle collision

public static Vector2 GetIntersectionDepth(Circle a, Circle b)
{
    float xValue = a.Center.X - b.Center.X;
    float yValue = a.Center.Y - b.Center.Y;

    Vector2 depth = Vector2.Zero;

    float distance = Vector2.Distance(a.Center, b.Center);

    if (a.Radius + b.Radius > distance)
    {
        float result = (a.Radius + b.Radius) - distance;
        depth.X = (float)Math.Cos(result);
        depth.Y = (float)Math.Sin(result);
    }

    return depth;
}

This is where I'm trying to apply the values to actually seperate the circles.

Vector2 depth = Vector2.Zero;
for (int i = 0; i < circlePositions.Count; i++)
{
    for (int j = 0; j < circlePositions.Count; j++)
    {
        Circle bounds1 = new Circle(circlePositions[i], circle.Width / 2);
        Circle bounds2 = new Circle(circlePositions[j], circle.Width / 2);

        if(i != j)
            depth = CircleToCircleIntersection.GetIntersectionDepth(bounds1, bounds2);

        if (depth != Vector2.Zero)
        {
            circlePositions[i] = new Vector2(circlePositions[i].X + depth.X, circlePositions[i].Y + depth.Y);
        }
    }
}

sentences:
How do I find out where a script is attached to in Unity? I'm using Unity 2017.03.0f3 and I have a scripts folder with scripts (C#).

Suppose I forget, or am working on someone else's project:

How do I know exactly which scripts are attached to what GameObjects or PreFabs, without clicking and going through all the Hierarchy objects please, and by first clicking on a script in the Project view?

I hope that's specific enough.

sentences:
Using an engine to create content with PHP - but how should it happen? I need to create an engine that will allow me to add content to a website. The website is a browser-based game. This is a verbose engine that should be able to handle many different aspects of the project.

For an example, I want the developers to be able to insert "dreams" into the game. A dream is called each night for the player, and upon login they will see the dream they had. A developer will write up a cool dream for the game and insert it... but to where?

That's what I'm struggling with. Naturally, I think to myself that all content for the game will enter a database once a developer is done with it. However, the amount of content could be potentially very high, and it may be too hard on the server's resources once the game grows bigger - userbase included. The other way to do it to simply hardcode everything in: a simple "dreams" file that a developer would append their dream to. I cannot have such a system, however, if this project were to have five casual developers that don't know how to even open a PHP tag! ;)

Presently the best way I can imagine a player receiving a dream is to have a developer write it and then the database pulls the dream the player receives from the database. It seems unnecessarily arduous and I'm hoping that if I still must use a database, that you folks can steer me into the right direction for how to execute this efficiently.

sentences:
OpenAL seems to ignore sound attentuation/orientation for long sounds I don't know how else to describe it in the title, sorry.

My sound engine currently works perfectly with listener positioning and sound positioning to create the attentuation and panning effects.  At least, for short sounds.

I converted an .mp3 to .wav to test out playing a song from a specific point, but suddenly OpenAL ignores that the sound and the listener are not at the same place and just plays the song at full volume right in the center.

Has anyone ever had this problem before?  If so, just what is the problem?

EDIT:
If it helps, the song is stereo and the sounds are mono, all at 16 bits per sample.

sentences: In a 2D multiplayer game should I send the position of user to the server all the time? In a 2D game where the user moves with the keyboard arrows, should the user send all the time he moves his position (x, y)?. If the user has some speed, the user would send (x, y) like 50 times pixel by pixel in just a second.

sentences:
Unity: How to keep animation keyframe position in the transform I want to make a paired animation-
I have 2 characters. One is doing a Grabbing-Move on a character who is grabbed.

But for that its necessary to animate all those animations on a character on a certain pose.

And for now I can only do the "grabber" animations on a T-Pose (first character has T-Pose always when I try to animate the second).

But I dont want to do animations on a "T-Pose"
I want to animate the Second Character(Grabber-) on a "Grabbed" - Pose.

I already have a "Grabbed-" Animation.
Now I want the "Grabbed-"Animation to stay.

For that I need to "safe" the current keyframe position of the first character - while animating the second character

How is that possible?

sentences:
How do I compile further libraries into my game? This might be vague; I don't know how to search for this.

How do I link a GUI framework (in my case, CEGUI) to a graphics framework (in my case, SDL)?

I'm using a Mac. My mental model on how to add libraries is something like this in my head:

  There are .framework files. They go in /Library/Framework/. You then link them to Xcode in build settings, then they magically work. Then there are libraries you add to header path, and library path and something about include and lib folders, but I don't understand those.

A guide from the ground up would help, because I would like to get a better understanding of how it works. I also have no idea what cmake is, although I've been seeing it a lot.

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:
CreateGraphicsPipelineState Hi!

Would someone answer my question, please?
Does the title's method create the same components always or verify possible duplicates?

For exaple:
I have one D3D12_INPUT_LAYOUT_DESC struct and two shaders need the same IL.
How many ILs will it create? (In the D3D11 one was enough).
Is it possible to avoid duplicates?

I highly appreciate the answer.

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: Distributed Leaderboard for p2p games I've heard about this term distributed leaderboard for p2p games and I've searched it online but couldn't find much of a thing about it.I was curious what does it really mean and didn't really knew where to ask.Do you guys know what does it mean to have a distributed leaderboard? it's something like a global leaderboard but for p2p players?

sentences:
Box2d making a body follow the mouse accurately I am trying to make a box2d b2Body follow my mouse position. This is the code I am using at the moment but it is not performing very well:

deltaPos = mousePos - body->GetPosition();
deltaPos *= k;
body->ApplyForce(deltaPos, b2Vec2(0, 0));

I have tried playing with k but the body either lags too far behind the mouse or flies round and round the mouse like crazy. Should I be using an exponentiation there instead of multiplication? I am scared of applying too much force and breaking the sim (I suppose I could use a max).

Is there a more straightforward way to do this?

sentences:
Unity Animator - bool transitions keep re-entering state while true My StateMachine is triggered in a loop as long as transition boolean is true.

I have made sure my code only runs once, where I set the animation bool:

animator.SetBool("talk", true);

This does trigger the transition but the problem is that it re-triggers every frame as long as the bool is true. I had the same issue with a normal state earlier, but there I could turn off "Can transition to self" which solved it.
However a StateMachine does not have that option.

I want the animation to play until the bool is set back to false, so using a trigger would not be good here.

EDIT: For some reason it seems the "Transition duration" is the one resetting my animation. So if I change that to 3, it re-enters every 3 seconds, and so on. This seems really weird?

How do I just make sure that the animation plays until its done, then it re-enters (to choose another random talking animation from my StateMachine), as long as talk == true?

sentences:
Direction between objects (shortest distance around sphere) I have two objects rotating around a sphere. One is controlled by the user (object A), another is simulating a user but controlled by the computer (object B). At random intervals of time I'd like object B to start moving towards object A.

I can get this to work using this formula to determine the movement direction between two points:

public Vector3 DirectionTowards(Vector3 from, Vector3 to)
{
    return (to - from).normalized;
}

This gives me a normalized direction vector to update the x/y movement with. Since this is momentum based, if the objects need to move in an opposite direction I update their movement direction vector like so: (notice the "+=" instead of just "=" to give the effect of momentum/acceleration, more on this below)

// This code runs when  I need to move object B toward object A
var newDirection = DirectionTowards(transform.position, target.transform.position);
xMove = newDirection.x;
yMove = newDirection.y;

...

// This code runs in my update method
_moveVector.x += xMove * _acceleration;
_moveVector.y += yMove * _acceleration;

The problem I'm having is that when the objects are at opposite sides of the sphere, sometimes object B will start moving in the direction that is not the shortest distance to object A. Is there a way I can determine the direction in a similar way, but force it to choose the shortest distance around the sphere?

Also, to go along with this. By using "+=" vs "=" when I update the _moveVector sometimes that causes the direction to get changed slightly because it does an arc as it slows down its momentum before moving in the new direction. Does anyone know why that might be, or if I'm doing that incorrectly? Basically object B will start moving "almost" in the right direction due to this, but eventually after a while the whole things gets screwed up. If I use "=" only, this works perfectly every time except for the issue of shortest distance as I mentioned above.

Thanks! Let me know if any other information is needed.

sentences:
How to position a sprite in a 2D animation skeleton? Given two joints that define a bone, I would like to know how to decide where, between those two joints, I should draw the sprite. This should be a fairly simple thing to solve, but there is one thing that I am not sure about.

After I've determined the rotation of the sprite (which is the absolute angle the joints form with the x-axis), I also need to determine the origin point from where I need to start drawing the transformed image.

So how should I position the sprite between the two joints? Should I make the center of the image be the midpoint between the two joints, or should I make one the of the joints be the origin? Do these things matter that much (could the wrong positioning make the sprite move oddly during the animation)?

sentences:
Associating game object with some class Disclaimer: Somewhat long-winded question & new to developing

In my game I have a class called Item which defines what an item is. It contains several fields like the name of the item, the sprite of the item, the item's ID number, etc. I also have little physical objects on the ground that "represent" items, but they aren't really tied to the Item class in the way I want. I'll get back to this point.

So, when an enemy dies in my game, SpawnItem(Item item) is called. Depending on a randomly generated number, SpawnItem(ItemData.sword) might be called or SpawnItem(ItemData.axe) and so forth. SpawnItem itself just instantiates a generic prefab (that little physical object on the ground), modifies some state like bool itemDropped and int numItemsDropped, makes some calculations to determine where to drop the item, and displays that item's name in a UI label above the item.

I'm currently in the process of making an inventory system, and I've realized something. Those physical objects on the ground that are supposed to be items don't really know that they're items (in the sense defined by the class). A sword doesn't know it's a sword, and an axe doesn't know it's an axe (the game object sword doesn't know that it's a sword Item defined by the class) So when I pick up an item, I can probably do some code gymnastics to get the appropriate sprite to appear in the inventory, but that doesn't seem like a smart solution.

So, my question is how do I get my sword game object (just a sphere on the ground representing a dropped item) to be linked to the sword Item? How do I get the sphere to know that it represents a sword with the ID number "1", the name "Sword", a weight of "1.5" etc. so that I don't have to do awkward code gymnastics? After all, when I'm adding an item to my inventory, I don't really think of it as JUST drawing that item's sprite in the first non-empty slot of the inventory. I would think it's much better to get each game object to know what Item it represents than to just try and get that sprite to show up in the inventory.

I might be overlooking something basic, but understand that I'm pretty new to Unity. Anyway, thanks for the time and help!

sentences: How can I convert screen space to GUI Space/View Space? Is there any way available to convert screen space into view space as like in the following figure:

sentences: What methods are there for representing 3D terrain? I'm making a terrain system which needs to be procedurally generated and would like to know my options. So far I know of: Height-field terrain, Vector-field terrain, and Voxel terrain. Is there anything missing from that list?

sentences:
Displaying text on a 3D plane I am busy with a pet project where I am trying to create a Collectible Card Game in 3D.

These cards have Hp and Damage etc. but I cannot find a way to neatly display these values.
I tried to use a TextMesh, but all the text just blends into each other if the cards happen to overlap (eg. when the cards are in the hand).

Currently, I am using a plane for each value, and then changing the Material used on that plane, to match the value (eg. a '3' Material if the Damage is 3). It works, but I can't help to think that there has to be a better way.

Is there a way to dynamically display values on a plane so that it looks like the value is a part of the card itself, without changing the materials every time a change occurs? Or suggest anything else that would suit my needs?

If I am taking a horrible approach, you're welcome to nudge me in a better direction.

Thanks in advance

sentences:
Unable to destroy collider Unity3d So I was making an android game in unity3d. I wrote a script to draw straight lines with touch what I do is I first create a gameobject named temp and add line renderer to it and give the line renderer properties. Then I create a collider gameobject , parent it to the line and change its dimensions to the dimension of the line. What I am trying to do is add two colliders one while the line is being moved i.e "touch.phase == TouchPhase.Moved" and delete this collider and add another collider when "touch.phase == TouchPhase.Ended". For some weird reasons I am not able to delete the first collider.

Here is my code

void Update()
{

    foreach (Touch touch in Input.touches)
    {

        if (touch.phase == TouchPhase.Began)
        {
            temp = new GameObject();
            temp.AddComponent<LineRenderer>();
            temp.layer = LayerMask.NameToLayer("lines");

            lr = temp.GetComponent<LineRenderer>();
            lr.positionCount = 2;
            lr.SetWidth(0.2f, 0.2f);
            lr.material = new Material(Shader.Find("Sprites/Default"));
            lr.SetColors(Color.black, Color.black);

            temp.transform.position = camera.ScreenToWorldPoint(touch.position) + camOffset;
            fingerUp = camera.ScreenToWorldPoint(touch.position)+camOffset;

            lr.useWorldSpace = true;
            spawnCollider = false;

        }

        //Detects Swipe while finger is still moving
        if (touch.phase == TouchPhase.Moved)
        {
            lr.SetPosition(0, fingerUp);
            fingerDown = camera.ScreenToWorldPoint(touch.position)+camOffset;
              lr.SetPosition(1,fingerDown);
            spawnCollider = true;

            lastLine = temp;

            // The first collider temporary one

            BoxCollider2D col1 = new GameObject().AddComponent<BoxCollider2D>();
            col1.transform.parent = temp.transform;
            float lineLength = Vector2.Distance(fingerUp, fingerDown);
            col1.size = new Vector2(lineLength, 0.2f);
            Vector2 midPoint = (fingerUp + fingerDown) / 2;
            col1.transform.position = midPoint;
            float angle = (Mathf.Abs(fingerDown.y - fingerUp.y) / Mathf.Abs(fingerDown.x - fingerUp.x));
            if ((fingerUp.y < fingerDown.y && fingerUp.x > fingerDown.x) || (fingerDown.y < fingerUp.y && fingerDown.x > fingerUp.x))
            {
                angle *= -1;
            }
            angle = Mathf.Rad2Deg * Mathf.Atan(angle);
            col1.transform.Rotate(0, 0, angle);

        }

        if (touch.phase == TouchPhase.Ended)
        {
            if (spawnCollider == true)
            {
                Destroy(col1);  // Deleting the first collider

                // Adding the final collider
                BoxCollider2D col = new GameObject("Collider").AddComponent<BoxCollider2D>();
                col.transform.parent = temp.transform;
                float lineLength = Vector2.Distance(fingerUp, fingerDown);
                col.size = new Vector2(lineLength, 0.2f);
                Vector2 midPoint = (fingerUp + fingerDown) / 2;
                col.transform.position = midPoint;
                float angle = (Mathf.Abs(fingerDown.y - fingerUp.y) / Mathf.Abs(fingerDown.x - fingerUp.x));
                if ((fingerUp.y < fingerDown.y && fingerUp.x > fingerDown.x) || (fingerDown.y < fingerUp.y && fingerDown.x > fingerUp.x))
                {
                    angle *= -1;
                }
                angle = Mathf.Rad2Deg * Mathf.Atan(angle);
                col.transform.Rotate(0, 0, angle);
            }
        }

    }

}

I have added comments where I am doing what.

sentences:
How to randomly spawn obstacles for infinite runner? I am trying to create randomly generated path properly? Think of flappy bird (its not really) but my code/algorithm is all wrong. If I make BarMax, BarMin too large, then player can cheat cos in centre there will always be space. Make it too small and pipes are spawned randomly and sometimes very close to each other (unlike flappy). So my player sometimes could run into a situation where its impossible to move past two pipes. My adjacent pipes are really close together as well unlike flappy birds big gap between pipes.

So this is what i dont want to happen.  I have also thought about spawning sets of pre-configured pipes but then i thought they might run into this impossible situation at some point too. I had my level set-up like this  So when a bar touches the looper, it spawns again - code is above.

int numBGPanels = 35;

float BarsMax = 1.5f; float BarsMin = -1.5f;

float widthOfBGObject = 1; float offset = 0.75f; Vector3 pos;

void Start() {
    StartBarsPosition(); }

void OnTriggerEnter2D(Collider2D collider) {

    if(collider.tag == "Bars") {       // this is not getting called cos theres no collider attached atm
        pos = collider.transform.position;
        pos.x += widthOfBGObject * numBGPanels * offset;

        pos.y = Random.Range(BarsMin, BarsMax);
        collider.transform.position = pos;

    }

}

void StartBarsPosition() {
    GameObject[] bars = GameObject.FindGameObjectsWithTag("Bars");

    foreach(GameObject bar in bars) {
        Vector3 initialpos = bar.transform.position;
        initialpos.y = Random.Range(BarsMin, BarsMax);
        bar.transform.position = initialpos;
    }

}

sentences:
How do I calculate impulse when an object collides with plane(fixed object)? I've been developing simple 3D impulse-based physics engine.
I calculate impulse as follows:
$$j_r = \frac{-1(1+e)v_r\cdot\hat n}
{m_1^{-1}+\bbox[yellow,5px,border:2px solid red]{m_2^{-1}}+(I_1^{-1}(r_1\times\hat n)\times r_1+
\bbox[yellow,5px,border:2px solid red]{I_2^{-1}(r_2\times \hat n)\times r_2)}\cdot \hat n}
$$
where:
  \$e\$ is restitution constant
  \$\hat n\$ is a contact normal
  \$v_r\$ is relative velocity of the contact point
  \$m\$ is mass of objects
  \$I\$ is moment of inertia tensor
  \$r\$ is a vector from center of mass to contact point
Note: I've been assigned value 0.0f to the boxed/highlighted terms in the expression when an object collides with plane.
Then update linear & angular velocity as below:
$$
\begin{align}
v'_1&=v_1-\frac{j_r}{m_1}\hat n \\
v'_2&=v_2+\frac{j_r}{m_2}\hat n
\end{align}
$$
$$
\begin{align}
\omega'_1&={\omega}_1-j_rI_1^{-1}(r_1\times\hat n) \\
\omega'_2&={\omega}_2+j_rI_2^{-1}(r_2\times\hat n)
\end{align}
$$
Those expressions are referenced from the Wikipedia collision response entry.
It works well when two objects collide.
However, the box object rotates strangely and continuously glide around when it collides with plane as below:

(red sphere is detected contact point)
I set contact normal as plane normal.
I assume that the expression has to be modified for the case of fixed object (ex. plane).
I've been assigned value 0.0f to the boxed/highlighted terms in the expression when an object collides with plane.
Is this approach right?
If it isn't, how can I fix this?

sentences:
Random generation of interesting puzzle levels? I'm making a Sokoban-like game i.e. there's a grid that has some crates on it you can push and you have to get the crates on crosses to win the level (although I'm going to add some extra elements to it). Are there any general algorithms or reading material I can look at for  how I could go about generating interesting (as in, not trivial to solve) levels for this style of game? I'm aware that random level generators exist for Sokoban but I'm having trouble finding the algorithm descriptions.

I'm interested in making a game where the machine can generate lots of levels for me, sorted by difficulty. I'm even willing to constrain the rules of the game to make the level generation easier (e.g. I'll probably limit the grid size to about 7x7). I suspect there are some general ways to do level generation here as I've seen e.g. Traffic Jam-like games (where you have to move blocks around the free some block) with 1000s of levels where each one has a unique solution.

One idea I had was to generate a random map in its final state (i.e. where all crates are on top of their crosses) and then the computer would pull (instead of push) these crates around to create a level. The nice property here is that we know the level is solvable. However, I'd need some heuristics to ensure the level was interesting.

sentences:
C++ Frogger game - Logs on Water bounding boxes? I am making a Frogger game in C++ using SFML but have come across a problem.
I have a block of water and log rectangles moving over it (All sprites) and would like the Frog sprite to do something when it hits the water, however with bounding boxes, even in the frog sprite moves onto a log it still passes the water bounding box and carries out the code for that. Is there any way to have the conditions so it intersects the water but only does something when it's not in collision with the log's?

Thank you.

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:
Why the transform is not moving back to the originPos(Original Position)? using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour
{
    public Transform target;
    public float rotationSpeed;
    public float moveSpeed;

    private Vector3 originPos;
    private Quaternion originRot;

    private void Start()
    {
        originPos = transform.position;
        originRot = transform.rotation;
    }

    private void Update()
    {
        var distance = Vector3.Distance(transform.position, target.position);
        if(distance < 0.1f)
        {
            transform.rotation = Quaternion.Lerp(transform.rotation, originRot, Time.deltaTime * rotationSpeed);
            transform.position = Vector3.MoveTowards(transform.position, originPos, Time.deltaTime * moveSpeed);
        }

        transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, Time.deltaTime * rotationSpeed);
        transform.position = Vector3.MoveTowards(transform.position, target.position, Time.deltaTime * moveSpeed);
    }
}

At this line if the distance is less then 0.1f it should start moving back to the original position but the transform is not moving it's just staying at the same place :
transform.position = Vector3.MoveTowards(transform.position, originPos, Time.deltaTime * moveSpeed);

sentences: How did Blizzard implement replay like in Warcraft 3 with not consistent data(attack damage)? Units in wc3 has range of attack damage and it isn't consistent most of the time e.g critical hit and so on. Yet, they managed to make a replay that could even reconstruct bugs scene. I am just curious how they do it. It could be useful for fighting games or perhaps to easily submit evidence of recurring bugs. The best part is it's not even a big of a file and even could be used on a customize games. Come back to the title, how did they do it?

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:
Stop animation from playing while waiting to destroy object I'm working on functionality in Unity where if a game object's health is zero, it does and the object is destroyed.  This works fine as is, I reduce the health to zero, the die animation plays and the game object is destroyed.  I want to have the script wait a certain amount of time and then run the destroy method.  I thought using WaitForSeconds() would do the trick, and technically, it does, but the death animation continues to play until the object is destroyed.  My question is, how do I get the animation to stop playing as the script waits to destroy the object?

C#

void Die(){
    GetComponent<Animation>().CrossFade(die.name);
    //If the current animation time is greater than 90% of the entire animation length, destroy the object.
    if(GetComponent<Animation>()[die.name].time > GetComponent<Animation>()[die.name].length * 0.9){
        StartCoroutine(RemoveBody());
    }
}

IEnumerator RemoveBody(){
    yield return new WaitForSeconds(5);
    Destroy(gameObject);
}

sentences: Will changing app name in iOS app store affect/reset app ranking? I want to change the name of my app but was wondering if that would change/affect/reset the ranking it already has. Anyone know?

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:
Section cut through (solid) geometry I'm looking for image based (screen space) technique to render section cuts through arbitrary (solid) geometry. I found and studied image based CSG (Kirsch 05 / OpenCSG) but I found it to be perhaps a bit of a overkill for my case, where all I need is a section plane cut.

Above is a naive implementation using a discard in the fragment shader, but that obviously is not even half-way there as I need to close the gaps. Does anyone know of a technique/hack I could use?

sentences: When does depth testing happen? I'm working with 2D sprites - and I want to do 3D style depth testing with them. When writing a pixel shader for them, I get access to the semantic DEPTH0. Would writing to this value help? It seems it doesn't. Maybe it's done before the pixel shader step? Or is depth testing only done when drawing 3D things (I'm using SpriteBatch)? Any links/articles/topics to read/search for would be appreciated.

sentences:
How can we sell rights to our computer game We have an indie team that created a game on PC using Unity. We created the game for a long time and everything was exciting. We just don't even have money for advertising.
We had to borrow $100 for steam direct to release the game into early access. Since there was no money for advertising, the game collected only $66. But we did not receive them either, due to the fact that payments from Steam come only when income is above $100.
I'm looking for a way to sell the rights to this computer game to recoup our costs. We are so desperate that we are ready to sell all the rights to the game together with source code (The game was created for more than two years).
How can we go about finding a buyer for this game?

sentences: How to interact with object in HTC-vive Unity I just start to learn HTC vive app development with unity and want to interact with Object and want to get it as controller interact with it. Try to learning form StreamVR Unity Toolkit documentation. I found a scene in sample demo where Gameobject are interacting through controller but there are so many scripts involved. I am amazed that on a cube VRTK_InteractalbeObject is attached and it is responding to controller. how can i get interacted object in htc vive.?

sentences:
How to handle collisions without ugly conditionals and type checking? (I asked a similar question, but this one is far more specific).

How can I handle collisions without having to do a lot of type checking and if statements?

People here suggested that when spotting a collision, the collision detector should notify both entities in the collision, and the entities themselves will encapsulate the logic to react to the collision.

I like the idea of having the entities themselves decide how to handle the collisions. However I'm not sure how to avoid doing a lot of type checking and if statements inside the handleCollision methods.

For example (in psuedocode):

class CollisionDetector{
    foreach entity in entities
        foreach otherEntity in entities
            if(collision(entity,otherEntity)) entity.handleCollision(otherEntity);
}

class Entity{
    // .. stuff omitted
    void abstract handleCollision();
}

class Alien extends Entity{
    // .. stuff omitted
    void handleCollision(Entity entity){
        // lots of ugly conditionals and type checking
        if(entity instanceof Missile) die();
        if(entity instanceof Alien) lifePoints -= ((Alien)entity).getDamagePoints();
        if(entity instanceof Wall) setVelocity(0,0);
        // .. etc
    }
}

In OOP we should try to avoid type checking and employ Polymorphism. But I don't see how this can be done in this case.

Is there a way to avoid the ugly type checking and lots of conditionals? Or should I just make my peace with it? How is this most commonly done?

sentences:
Is AGS outdated for Point & Click Adventures? I am working on a Point and Click Adventure game being coded on the AGS engine, and just recently, the question of 'is this outdated?' has come up.

I'll admit, AGS is a rather old, and kind of went out of style with the P&C genre itself, but I have not found anything quite like it that specializes in this specific format of games.

So, is it outdated, and if so, is there a better alternative?

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:
Computer animation in C++ and if it can be integrated in web designes I have a PhD in Mathematics with some experience in C++ programming. I am very interested in computer animation, and would like to try to teach myself in C++.

My humble resources at the moment are: Borland Builder 6 and a Toshiba laptop with 1.49 GG of ram and a maths co-processor. Please give me as generous advise as you can, detailing what resources are essential, and if at all possible give me some idea of cost.

Finally, is it possible to integrate animation created in C++ in web design?

Thank you in advance for your help.

sentences:
Box 2d Level Editor for AndEngine I am getting started with Box2d in AndEngine.
I need to know if there is any level editor to be used with box2d and gives output capatable with AndEngine.

Is there any tool which can help me building complex body with joints like a bike or car?

What do you suggest which is the best way to do this kind of stuff.

sentences:
Shader that render canvas before any object I have a canvas (in world space/3d) which is not showing to camera due to this shader which is applied to another (sphere) object.

Shader "Custom/TextureHolderCustom" {
    Properties {

        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Mask ("Mask Texture", 2D) = "white" {}

    }
    SubShader {
    Tags{"Queue" = "Transparent"}
       Cull Off
       Lighting On
       Zwrite On
       Blend SrcAlpha OneMinusSrcAlpha

       Pass
       {
       SetTexture[_Mask]{combine texture}
       SetTexture[_MainTex]{combine texture,previous}
       }
    }
    FallBack "Diffuse"
}

sphere object where my above shader is attached showing first but my canvas is not showing. I want to show the canvas first. I think i attach above shader to my canvas but it is not possible to apply m

I am zero in shader programming

sentences:
Is it possible to correctly catch up a particle system simulation based on long delta time between many frames? I have a particle system with a physics simulation integrator based on delta time (elapsed time between frames) which is implemented on the GPU in a compute shader. I also have a frustum culling system implemented on the GPU. The frustum culling gives me the possibility to cull away draw calls and the dispatch calls for the particle simulation. The culling of draw calls works well, I also don't have a problem with culling the particle simulation when the camera is looking away.
My problem happens when I want to catch up the particle system simulation when the camera looks back at the particle system after looking away for a while. What I do is accumulate the time passed while looking away, then I resume the simulation using all that accumulated time. The problem with this approach is that if the simulation is anything but a simple constant velocity change in one direction, the simulation just doesn't look the same as if the simulation was playing one frame delta at a time.
From what I have read this is a common issue with using time elapsed between frames to simulate physics. What I wonder is if there's a different approach that can actually allow me to correctly play back many seconds of simulation (let's say 20 seconds) the same as if it was played one frame delta at a time?

sentences:
What freeware frameworks and tools to choose if I want to build a game like Farmville or Club Penguin? Say I like to experiment with multiplayer games and I do not want to reinvent the wheel and build yet another game server. I don’t mind configuring and writing wrappers and adapters (both in c++ and java) for the server.
What server does Farmville use? Is it Java or C based?
What isometric flash engine do they use?  What other examples can I look into to learn the subject?
Thanks.

sentences:
Hold touch at the screen to move object I'm using unity2D and C#, and I have a code for touch screen:

if (Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            startTime = Time.time;
            startPos = touch.position;

        }
        else if (touch.phase == TouchPhase.Ended)
        {
            endTime = Time.time;
            endPos = touch.position;
            swipeDist = (endPos - startPos).magnitude;
            swipeTime = endTime - startTime;

            if (swipeTime < maxTime && swipeDist > minSwipeDist)
            {
                swipe();
            }

And this code for swipe:

void swipe()
{
     Vector2 distance = endPos - startPos;
    if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y))
    {
           if (distance.x > 0)
        {
            Debug.Log("Right swipe");
        }
        if (distance.x < 0)
        {
            Debug.Log("Left swipe");
        }
    }
    if (Mathf.Abs(distance.x) < Mathf.Abs(distance.y))
    {
        if (distance.y > 0)
        {
            Debug.Log("Up swipe");
        }
        if (distance.y < 0)
        {
            Debug.Log("Down swipe");
        }
    }
}

}

How can I add to this code hold function, for for example move object at the screen?

sentences:
Problems exporting animations to Unity 5 I've finished a model in SpeedTree Cinema v7.1.1 and the model exports correctly, but I can't figure out how to export the wind animation to Unity 5. The only problem is that the wind animation itself doesn't export.

I think that the problems are one of the following:

The way I export the mesh (.FBX ascii).
The settings in the export process.

I'll add some images so you understand better.

(Image 1.) In here you can see the export settings, the important aspects, regarding the animation, are in the 'Extra Data' tab, in there I included Wind, there are other options which I will describe in the next paragraph.

(Image 2.) In the 'Include' section, in the 'Extra Data' tab I can choose from a variety of things, but I don't know which one will work for exporting the wind animation to Unity 5.

In the 'Extra Data' tab there is also a sections where it says 'Format', under Include, in the 'Format' section the options are FBX/MC, FBX/PC2 and MDD. In the 'Files' sector the options are One or Per Frame.

If you know or think you know how to do this, please tell me, any help will be appreciated.

Thank you.

sentences:
Applications programmer - Where to start? So far I've done web design/development and applications programming and of course video games has always been one of those things that I've wanted to take a stab at but never tried outside of a few minor and failed incursions. The only notable game programming I can say I have done was a little puzzle-ish game for the NES written in 6502 assembly so that doesn't exactly count for much.

Basically, what would be a good jumping off point for me? I do know C++ and Java if that gets me anywhere.

sentences:
Dynamic model interactions I am just curious as to how in many games (namely games like arkham asylum/city, manhunt, hitman) do they make it so that your character can "grab" a character in front of you and do stuff to them. I know this may sound very confusing but for an example go to youtube and search "hitman executions", and the first video is an example of what i'm asking.

Basically I'm wondering how they make your model dynamically interact with whatever other model you come across, so in hitman when you come up behind some one with the fibre wire you strangle the other character or if you have the anesthetic you come up behind some person and put your hand over there mouth while they struggle and slowly go to the floor where you lay them down.  I am confused as to whether it was animated to use two models using specific bone/skeletal identifiers, if it is just two completely separate animations that are played at the correct time to make it look like they are actually interacting or something else all together.

I am not an animator so i assume most of what i just said is not right but i hope that some one can understand what i mean and provide an answer.

PS) I am a programmer and I am in the process of building a hitmanesque game, just because i love that style of game and I want to increase my skills on something fun, so if you do know what i'm talking about have some examples with involving both models and programming (i use c++ and mainly Ogre3D at the moment but i am getting into unity and XNA) i would greatly appreciate it.

Thanks.

sentences:
Why Index Particles? This is a general question, but as a specific example, I'll use the XNA Particles3D sample (http://xbox.create.msdn.com/en-US/education/catalog/sample/particle_3d).

What is the point of the index buffer in a particle system? If the advantage is indexing repeated vertices, wouldn't only a connected mesh take advantage of these? The probability that the vertices in a particle system will be shared for extended periods of time is extremely low.

sentences:
Unity and the problem with calling functions from other scripts I'm not sure how everyone handles this, but I'm running into lots of instances where I want to call a nonstatic script from another script which forces me to add the nonstatic script to the gameobject that also handles the other script. Such as, I would have two classes in different scripts:

public class Example1:MonoBehaviour{
public void someMethod(){
}
}

    public class Example2:MonoBehaviour{
public void anotherMethod(){
}
}

if I wanted to call anotherMethod from someMethod, I would need to do this:

   public class Example1:MonoBehaviour{
    private Example2 exampleTwo;

void Awake(){
exampleTwo = gameObject.AddComponent<Example2>();
}
        public void someMethod(){
exampleTwo.anotherMethod();
        }
        }

Is this really how everyone is working? It just seems extremely long and complicated, making me attach a whole bunch of scripts to one gameobject at runtime, and then I run into a whole bunch of issues with multiple copies of each script (such as with mousedown functions or input functions).

sentences:
Keep 3d model facing the camera at all angles I'm trying to keep a 3d plane facing the camera at all angles but while i have some success with this:

Vector3 gunToCam = cam.cameraPosition - getWorld.Translation;
Vector3 beamRight = Vector3.Cross(torpDirection, gunToCam);
beamRight.Normalize();
Vector3 beamUp = Vector3.Cross(beamRight, torpDirection);
shipeffect.beamWorld = Matrix.Identity;
shipeffect.beamWorld.Forward = (torpDirection) * 1f;
shipeffect.beamWorld.Right = beamRight;
shipeffect.beamWorld.Up = beamUp;
shipeffect.beamWorld.Translation = shipeffect.beamPosition;

*Note: Logic not wrote by me i just found this rather useful

It seems to only face the camera at certain angles. For example if i place the camera behind the plane you can see it that only Roll's around the axis like this:

http://i.imgur.com/FOKLx.png (imagine if you are looking from behind where you have fired from.

Any idea what to what the problem is (angles are not my specialty)

shipeffect is an object that holds this class variables:
public Texture2D altBeam;
public Model beam;
public Matrix beamWorld;
public Matrix[] gunTransforms;
public Vector3 beamPosition;

sentences:
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:
XML, how to have two variables under the same node? I have XML sheet that I use in my game. In my unity(C#) game, a game's monster can spawn at predetermined position or random position.

<monster delay="0.2" isRed = "true" position ="random"/>
<monster delay="0.3" isRed = "true" position ="10 20"/>

Right now I read value of position and if it is "random" then I assign random position for the monster.

If it is not "random" then I parse the value, separate them by a space bar then use the two numbers I obtain from the "position" as position of my monster.

I get this gut feeling what I am doing is probably really ugly and inefficient that there is probably better way to do this, but I am not sure.

sentences:
How does an energy-conservative Blinn-Phong-Fresnel model work? What is a plausible, basic equation/pseudo-code for energy-conservative Blinn-Phong shading, including Fresnel with a coloured light-source?

The net gives so many alternatives that it's hard to figure out which I should use.

sentences:
Transformation movement by using Accelerometer data Is It possible to make transformation movement by using Accelerometer data or Accel + Gyro ?
as we know, we can make rotation by using Accel or Gyro data.
However, how can we make transformation movement?
I know this is still problematic and experimental. but there must be some ways to reach.

Is there any algorithm or math formula solving this problem?

sentences:
Does LibGDX have methods capable of creating dynamic text like in candy crush? As you see, the "Retry" button and the "Invite Friends" button are both animated, smoothly and cleanly.

If I were to do this in Libgdx, would I have to use the Animation class and provide multiple texture regions of the buttons to create this animation effect? Or are in built methods included to help simulate this effect?

I've seen examples of people claiming you must use OpenGl ES methods directly. Is that true? Are there extensions to help create this effect?

sentences:
How would I edit .anim files in Blender? I absolutely cannot stand animating in Unity.
I am making an FPS game with many weapons, and each weapon has four animations: running, jumping, aiming, and shooting. I would like to create a .anim file in Unity with the keyframes of the character and the weapon, and then edit that .anim file in Blender. How would I edit .anim files in Blender?

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:
Moving inventory items around causes reference problems I'm in the process of implementing an inventory system in my game.

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

public class InventorySlotManager : MonoBehaviour
{
    ItemData itemData;

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

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

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

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

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

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

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

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

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

sentences:
How to remove terrain in 3d? After the release of Minecraft I saw more and more rip offs of the game but some actually began to change it up a bit making the game have a organic look instead of the iconic blocky one that Minecraft does. If you'd like to look at the game that i'm referring to you can do so here. If you skip to around 50 seconds on the first video the steam page offers you can see the mining part that i'm wondering about.

I was wondering how this affect is achieved where they are able to remove part of the 3D object on collison with the players pick. I have heard about constructive solid geometry before and figured that could have been used but i'm not so sure.

sentences:
Recursive dungeon maps as represented by an elastic 2d array I came up with a method for recursively generating simple dungeon maps by starting with one room and recursively connecting new adjacent rooms randomly to it.

Maps are represented as two dimensional arrays where each cell contains a value of 0-15. 0 represents no room while each direction is represented by north=1, east=2, south=4, west=8.

I wanted to start with a single non room ([[0]]) and then expand the 2d array as necessary to fit the generated map. The difficulty I face with this tree like recursion is that if the arrays have to be unshifted to add rows and columns to the left and top of the map, I have to adjust the current position of the function, what row and column it is at. This makes it so that separate branches are not aware of array index adjustments from other branches, only their child functions will know because they have the adjusted position passed to them as their row and column arguments.

Is there a way to do this? I tried storing row and column offset values outside of the recursion, but it did not work for some reason.

sentences:
How do I get roblox studio on a Chromebook? I have seen Youtube videos of people having roblox studio on their chromebook, but I have tried to install it and it didn't work.
How can I get it to work?

sentences:
Entity Component Systems, Input, and Angry Birds! I am using Artemis ECS. I have the very basics of a game already. I am now trying to determine how to gracefully handle input and to a lesser extent collisions. Some people say with ECSs, everything should be a component and data driven and you shouldn't really use events/messages, or at least avoid them where possible.

Input handling in component based design covers what I am asking as well, but I would understand when and how to raise events, add components or whatever much more fully by using a game we all know (Angry Birds) as an example.

So, for Angry Birds I would have some entities with components (where components are pure data, and an entity is just an id):

catapult (position, sprite, state{free, available}?, clickable?, dragable? releasable?)
bird (position, velocity, physics{density}, sprite)
baddy (position, velocity, physics {density}, sprite, health)
box (position, velocity, physics{density}, sprite, health)

And the following systems to start with:

SpriteSystem (has all entities with sprite component)
PhysicsSystem (has all entities with position, velocity and physics components)
HealthSystem (has all entities with health component)
InputSystem (knows about keyboard/mouse events such as clicked, dragged, released, key down etc, not sure what entities should have...)

How would the InputSystem interact with other Systems to say the catapult was clicked, and if there are birds left, and none are in flight, allow it to be dragged and release/fire the bird.

Would the InputSystem modify ClickableComponent, DragableComponent and ReleasableComponents on the catapult entity? Or, should it raise some sort of Click, Drag and Release Events? What System would listen for the component changes/events? A CatapultSystem perhaps?

When the PhysicsSystem notices a collision between the bird and a baddy, should it create a Collision event, that I guess the HealthSystem would listen for? Or again, should it modify a collision Component already on the Entity?

Collision and click components would need to be cleared every game loop if I took the component approach (seems a bit naff...)

sentences:
UI background animation makes camera render beyond canvas, need fix? I have a background animation for a menu where I have to make the background larger than the canvas and drag it over it. Even though I am using a panel the same size as the canvas as a mask, this causes the camera to render beyond the canvas. How can I get this same effect while only rendering what's on the canvas?

w/o mask (so you can see how big this background is):

w/ mask:

running in editor (looks good):

running build of the game from executable (camera shows more than it should but nothing was changed):

The camera bounds are fixed to the canvas, as it should be, if I remove the animated background, so that is the major cause.

(BTW, I know the gifs look crappy but the animation is seamless; I just had to crop the gifs to reduce file size.)

Also, you guys might not be able to see, but the tiling pattern has a slight white border where the tiles meet (the sprite it uses is only like 227x227 on "repeat"), does anybody know how to avoid that?

UPDATE @ 1:12am PST: upscaling turd texture to 256x256 eliminates white border, as suggested by trollingchar.

sentences:
Calculate normal angle in screen space I'm working on adding billboarded sprites to a game engine, but the engine allows for walking on curved terrain, like spheres. In order to look like the player is walking on the terrain, I want to start with the billboard, then rotate it around its origin (bottom centre) so that its up vector matches the screenspace normal of the terrain.

Here's a diagram of the general idea:

The billboarding works fine - passed the camera's rotation matrix to the sprite, and the poly quad's 0,0,0 is at the bottom centre of the canvas.

How can I get the angle between the normal and screenspace up?

I think it's a matter of projecting the normal with the MVP matrix, to get it as a 2D screenspace vector to calculate the angle from. But I'm not having much luck attempting to implement it.

The sprites take their positioning from the centre of the tiles, along with the normal. I'd also like to move the sprites down in the rotated axis, so that they cover the tile they're standing on.

Any other methods are welcome too.

sentences:
Collision resolution - Character walking on ascendent ground I don't know if the solution to this problem is quite straight-foward but I really don't know how to handle collision resolution on a game where the player walks on an ascendent floor which is not flat. How can the player position itself on the y axis depend on the ground x and z (opengl coords)? What if the floor's slope is too much and the player can't go up, how do you handle that?

I don't need any code, just a simple explanation would be great.

sentences:
Unity: Adding a border to a button I want to give a border to all the buttons of settings that are enabled in my options menu.

Let's say that the demo mode is enabled, then the according "on" button should have an e.g. red border, while the "off" button hasn't got one. I don't care if the border is visible when you hover over the button (= the "highlighted" color is used) as long as the actual color change for highlighting/pressing the button still works.

So far I've only found the "Outline" effect but it only seems to work on the text component of a button, not the actual button itself. How do you do this in Unity (2017.3.1f1, preferably without using additional assets)?

sentences:
Online multiplayer. Provoke lagged move on local player I am developing an online multiplayer 2D videogame with Unity as a client and a server programmed in c ++.
I do the synchronization of movement through an interpolation so that the movement is smoothed, but I have a doubt that I cannot find an answer anywhere.
In any multiplayer game when the client has a bad connection (lag) the character moves awkwardly and not fluidly, but in reality I don't understand why this behavior happens, currently in my game even though the client has a bad connection, it moves from fluid form because movement management is done locally and what is sent to the server is the player's position.
How can I produce this in my game?
Thank you very much and sorry for my level of English. Thank you

sentences:
Calculating World Unit or Pixels Per Unit values Is there a formula to calculate world unit or pixels per unit values in LibGdx?
 Most of my objects fit into a 32x32 or 16x16 frame. When the objects are close to 32x32, and I use 1f as the size or 16x16 and use .5f things seem to work out fine. What I try to do is use this:

// Create viewport that is used to as the game size
static final float VIEWPORT_WIDTH = 15f;
static final float VIEWPORT_HEIGHT = 7f;

viewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);

// Scale sizes
final float UNIT_PIXEL = 0.03125f;  // 1 / 32
float newSize = 32f * UNIT_PIXEL;

Which seems to work for 32x32 or 16x16. But size problems seem to happen when you try to use that to calculate other widths or heights. Like if I try to use:

float newSize = 24f * UNIT_PIXEL;

Using this the bounding rectangle becomes much larger than the object.

sentences:
Can you achieve a non-square look with tiles or a similar technique? Just to explain the kind of look that is refered to in the question, it is apparent in the game Toejam and Earl 2.

Not asking how this was made but would like to know how you could efficiently blit a level design that isn't made or doesn't appear to look like easily identifiable square tiles. Another example for a "non-blocky" world would be worms but that looked more like a bitmap which sounds like it would require a lot of memory and could potentially limit the game world size.

sentences:
How to make a Multicast Delegates in Blueprint? I used the Set Timer by Event, but I could not use the delegate in more than one event:

I've been researching about and it's possible, but I've only found results in c ++:

https://docs.unrealengine.com/en-US/Programming/UnrealArchitecture/Delegates/index.html

My code:

This is not at all functional. I'm using the same function twice.

I could call the "second" event after the execution of the "first" event, but I would like to know a way (if any) to use the delegate in more than one event.

sentences:
Developing a 2D Android game on Unity - Pros and Cons Depending on your experiences, if you have created a 2D game on Android using Unity, was it painful? Have you ever said "I wish I have used X instead of Unity!"?

Tell me the Pros, Cons and the name of "X" please.

Edit: Consider it for a commercial shoot em up game. The programming language can be anything.

sentences:
What are Textures in games development? At any time, a game will likely have many objects rendering textures.
So what is a texture? an image for example?

sentences:
Multi Threading In Update Loop Okay so I am working on a game engine and this was my previous game loop:

Game::Run()
{
    While(!m_GameDone)
        Client.Update();
        LocalServer.Update();
}

but what I want to do is:

Game:Run()
{
    ClientThread = new CThread(...);
    ServerThread = new CThread(...);
    ClientThread.StartTask(Client::Run);
    ServerThread.StartTask(LocalServer::Run);
    CThreadSystem.WaitForTasksToFinish();
    return;
}

And then Client::Run and Server::Run would be:

Client::Run()
{
    while(!m_Gamedone)
    {
        this.Update();
        this.Render();
    }
}
Server::Run()
{
    while(!m_Gamedone)
        this.Update
}

So my two big questions are.. Is this a good idea? and How do I make a thread execute a function from a class instance?
The threading system I am using right now is WinAPI and XTL (not STL).

UPDATE:

Okay, everyone wants to tell me about locks and data sync.
The client and server threads DO NOT SHARE ANY COMMON DATA/OBJECTS.
The client and server threads have their own serialized update loops and don't use any common classes or structures. I just wanted to know how to start a thread with a function in class instance scope.

sentences:
LibGDX Scene2D and updating labels inside a table I have a (Scene2d) Table containing a Label, both added to a Stage, and I'm properly calling stage.act(float) and stage.draw(). However, if I modify the text of the Label (using setText()) to be wider than the Table, the Table doesn't automatically widen, which I can tell because it's being rendered with a background. This is surprising to me since the setText(CharSequence) method calls invalidateHierarchy(), which I'd assume would be sufficient. I suspect if I were to then call pack() on the Table instance it would be sized correctly, but that seems like a code smell to me. (Calling pack() on the Label itself appears to do nothing.)

Should I be calling pack() on the Table anyway? Or should I be recursing up the parent hierarchy of the Label calling pack() as I go? Or is there some other sane way of handling this...

Thanks!

sentences: Bike game - following a road path I am writing a game in java which has a bike riding down a road. I intend to add some obstacles on the road which are structures having a slope, which the biker must negotiate. In other words, the bike must climb and run along the slope whenever it encounters one so obviously it must be aligned accurately with the slopy path. Im currently doing this using trig functions to find the angle of rotation, x y coordinates for the bike when it is climbing, descending etc. Can someone suggest a better algorithm to achieve this please ?

sentences:
Making the camera look at the player while keeping another object in view I'm working on a sorta football game where I need my player to always be at the center of the camera view while keeping the ball into view, without any vertical movement. The idea would be for the camera to act like the picture below.

What I came up with was the following code that I'm using in a LateUpdate. I'm computing a directional vector between the player and the ball and placing my camera behind the player using that data, and then I look at my player.

Vector3 ballPosition = ballTransform.position;
Vector3 playerPosition = playerTransform.position;

ballPosition.y = 0.0f;
playerPosition.y = 0.0f;

Vector3 directionVector = (ballPosition - playerPosition).normalized;
directionVector.y = 0.0f;

Vector3 newPosition = playerTransform.position - directionVector * 12.0f;
newPosition.y = 9.0f;

transform.position = newPosition;

transform.LookAt(playerTransform.position);

The code itself is working, but the camera movement is a bit nauseous, and when I'm trying to smooth it I end up with the ball leaving the camera field most of the time. Plus when I get too close from the ball I end up with some really quick camera movements which makes the whole thing kinda hard to follow. I tried to use a totally different technique by working with a Cinemachine Camera, but there doesn't seem to be an easy way to achieve such a view.

Does anyone have an idea of how to achieve such a thing?

sentences:
Rotating an object about a point (2D) using box2d i just started developing using box2d on flixel and i realise the pivot point of the rotation of an object in box2d is set to the center of an object.

i had read on forums and i found out that SetAsBox can change the pivot point of the object, however, i cannot seem to get it work to rotate about a point.

what i would like to achieve is to rotate an object about a point like earth revolving around the sun. any one can help me with it? really thanks a lot and sorry for the bad english

sentences:
Tweening multiple image objects in html5/js Is there an optimal way to choose when tweening multiple images as a single image?

For example let's say i have 10 preloaded image objects in my script, and i want to place them one on top of the other (the arrangement is supposed to be dynamic), and then tween it as a single "collage".

Do javascript tweening libraries like Tweenjs/GSAP etc, care about how many objects you tween concurrently (as long as in the end they move in the same direction and with same speed), or is it transparent for the fact that the hardware will move an array of pixels in the end?

Do you think that it would be better - performance-wize - to pre-combine the multiple images into one larger image, and then feed it to the tweening algorithm?

I would like to do it this way, as it would be more transparent to me, seperating the image "collage" process from the tweening process, but i haven't found a way to dynamically create javascript image objects by combining multiple single images.

Thank you.

sentences:
Am I liable if my game damages someone's computer? Do i really have to tell somewhere in my game documents that "there is no warranty for this software for any damage" etc? I see it a lot in almost every program, if not all, but is it really necessary, can someone sue me if i forgot to add that line of text and their GFX card burns out when they play my graphics-intensive game? (because that has actually happened to me few times, i didnt sue anyone though).

(Someone can fix my tags, couldnt add new tags because of low score.)

sentences:
Java multiplayer cards game I need to develop a simple multiplayer card game. For example, a poker game; this is only for study. I am going to develop it in Java.

How I can I manage communication between the server and clients? Can I use sockets for this game?

Edit: Thanks, I know socket programming. I know the programming socket. I just wanted to know if it was the correct technique for a multiplayer game like online poker.

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:
Applying different materials to an object I'm currently implementing an Object Loader for the Wavefront File Format (*.obj). When exporting a model (with associated materials) from blender, a material for a group of faces is specified like this:

usemtl MyMaterial
s off
f 2/1/1 4/2/1 3/3/1
f 1/4/1 2/1/1 3/3/1

Since each material consists of (at least) 3 components for each of ambient, diffuse specular color and also shininess (which totals up to 10 floats) I would consider it to be a tremendous waste of memory to store all of these values for each vertex.

Does OpenGL provide us with a more elegant/viable way to achieve the same result with a more reasonable memory consumption or do I have to swallow the bitter pill?

sentences:
how to apply a texture to a 3d scene background? i don't really know the exact term for that (i thought it was hdr but no...).

i want to put a texture as a background in opengl-es , and when we rotate the view , the background rotate too (obviously) but when there is translation , the background doesn't change.

like if i was inside a sphere and the texture are stick to it.

(and i don't think the sphere idea is the best way to do it).

I have certainly not explained the problem correctly , I'm sorry for that and thanks a lot if you understand me (even more if you have the answer :p)

sentences:
Converted XWM(A) files get silence at the end I am writing a playback mechanism for looping background music with XAudio2 and SharpDX.

I converted some perfectly looping WAV files to XWM(A) with the xWMAEncode command line utility (from the DX SDK of June 2010), but as soon as I play back the XWM file in a looping audio buffer, I notice a significantly noticable silence before it loops over.

I found out that when filling an XAudio2 audio buffer manually with a synthesized vibrato sound, no looping bug occurs. To further support this, I decoded the XWM file back into WAV, and the WAV file had exactly the same amount of silence at the end as I noticed in the playback, which turns out to be of 0,06 seconds length:

My first question is if anyone noticed the same behavior of the xWMAEncode utility, and if it is either a bug of the utility or even of the XWMA format itself.

I'd love to know some workaround for this if it can't be fixed by the encoding of the WAV itself.

I thought of setting the LoopLength sample of the audio buffer to exactly before the silence occurs. But for that I'd need to pray that such a silence isn't dynamic depending on the sample rate. Has anyone fixed it like this before and can provide or link me to details about this?

Head-shaking corner: MP3 adds silence to the start of each file, so XWM likes to put it at the end? Do we live in times were only OGG gets stuff looping correctly?

sentences:
What Game Development books should my partner/myself read? My partner and I are starting to get into game development on the iPhone. I'm a programmer and he's not. We are looking for some good language agnostic game programming books. Hopefully things that will explain basic game development principles without focusing too much on the particulars of a language and more on the concepts needed to build and design games.

We will probably focus on 2D games (at the beginning anyways) so no need for books on in depth 3D math, complex AI, etc.

Any suggestions?

sentences:
RayCast node always return null I'm using RayCast node to check the object is grounded. Here's the setting:

RayCast node is placed near by ground and the length enough to collide with ground. Also RayCast node is enabled.

RayCast node is child node of FPSController node, and here's the code of FPSController that processing grounded logic:

onready var ground_check_raycast: RayCast = $GroundCheckRayCast

func _physics_process(delta):
    process_grounded(delta)

func process_grounded(delta):
    var hit_collider = ground_check_raycast.get_collider()
    print(hit_collider)

When I run the game, first few times it return floor, and then immediately return false and never return floor back.

** Debug Process Started **
OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
[StaticBody:1140]
[StaticBody:1140]
[StaticBody:1140]
[Object:null]
[Object:null]
[Object:null]
[Object:null]
...

I have no idea why this won't work. Is there a something that I missed?

P.S. Floor object has static body and CollisionShape.
P.P.S. Using Godot 3.1.1

sentences:
Does `yield return false;` have special meaning in Unity3d C# scripts? In Unity, we have some special things for coroutines that are additional to normal C#.

for example, we can use

yield return WaitForSeconds(5.f);

to have a coroutine wait 5 seconds before continuing.

What do yield return false; and yield return true; do?

sentences:
How to handle movements of objects in a platformer with a cylindrical map? I was wondering what would be the best approach for a game with a perspective like  Resogun, where the world wraps around in a cylinder:

In my opinion, the easiest approach is to:

have a "Center Parent" for each moving object

Offset the child object by the wanted  radius

Rotate the parent

=> The objects will move, though this will become super limited very quickly, especially if you want to do any sort of physics.
The 2nd approach is math:
x = centerX + cos(angle)*radius;
x = centerY + sin(angle)*radius;

Now i wonder if there is another way, I was thinking of another method which basically consist of changing the Forward direction of the moving objects based on their position in "the circle", so basically the objects always move forward but adjust their rotation according to their position so they are always facing the right angle.
My main question is that if you want to create a puzzle platformer game like Limbo for example, but in a "cylindrical" map like Resogun, how would you tackle it ?
Thanks!

sentences:
Backface culling without light leaking through I want to be able to see through walls, so to do this I used planes for the walls, and enabled backface culling. However with shadow mapping I have a lot of light leaking through:

I read that using a thick wall solves this, so I did just that. This solved the leaking light:

but now I cannot see through the walls (camera is within the room in the above screen), all the backfaces are inward.

How could I prevent light leaking, as well as enable seeing through the walls?

sentences:
Level design algorithm/pattern for Linerunner etc I am wondering: how does someone make levels for a game like Linerunner or any other game that uses similar patterns?

About Linerunner (game)
You are a stick man running, you have to jump or crawl without hitting boxes. Google Play is very illustrative.

The algorithm I am looking for
How does the game engine know that if it places a box here and here and here, the user will be able to make it without hitting any of the boxes? Two possible solutions came to mind, but neither of them seem very good.

Design the entire level.
Create an array of small patterns the user can win in and then join the patterns to create a level.

I hope someone understands what I am talking about, otherwise I am willing to explain in depth what I want to accomplish.

sentences:
Automatically triggering standard spaceship controls to stop its motion I have been working on a 2D top-down space strategy/shooting game. Right now it is only in the prototyping stage (I have gotten basic movement) but now I am trying to write a function that will stop the ship based on it's velocity. This is being written in Lua, using the Love2D engine.

My code is as follows (note- object.dx is the x-velocity, object.dy is the y-velocity, object.acc is the acceleration, and object.r is the rotation in radians):

function stopMoving(object, dt)
    local targetr = math.atan2(object.dy, object.dx)
    if targetr == object.r + math.pi then
        local currentspeed = math.sqrt(object.dx*object.dx+object.dy*object.dy)
        if currentspeed ~= 0 then
            object.dx = object.dx + object.acc*dt*math.cos(object.r)
            object.dy = object.dy + object.acc*dt*math.sin(object.r)
        end
    else
        if (targetr - object.r) >= math.pi then
            object.r = object.r - object.turnspeed*dt
        else
            object.r = object.r + object.turnspeed*dt
        end
    end
end

It is implemented in the update function as:

if love.keyboard.isDown("backspace") then
    stopMoving(player, dt)
end

The problem is that when I am holding down backspace, it spins the player clockwise (though I am trying to have it go the direction that would be the most efficient at getting to the angle it would have to be) and then it never starts to accelerate the player in the direction opposite to it's velocity.

What should I change in this code to get that to work?

EDIT :

I'm not trying to just stop the player in place, I'm trying to get it to use it's normal commands to neutralize it's existing velocity.

I also changed math.atan to math.atan2, apparently it's better. I noticed no difference when running it, though.

sentences: How To generate spiky terrain in 2D? I am learning game design, and wanted to know how one can automatically generate spiky terrain (something like this: Cavernaut, notice, the terrain at the sides?). I have heard about midpoint displacement algorithm. But How can I apply that to my problem, given that I would also like to increase/decrease the randomness of the terrain. Also, Is there any helpful library for this in libgdx?

sentences: Any tips on developing an RTS unit movement collision? so I am developing an RTS and I am a little stuck at this. I am not talking about pathfinding algorithms like A*. The problem is moving units in bulk and their collision along the way. Can anyone give me some pointers or tips on how to start working on this. Older RTSs have a lot of problems in this. Warcraft 3 for example. When playing it now after some SC2 it is excruciating when units collide and block each others path and so on. I really want to avoid that. Thanks.

sentences:
Can i add friction in air? I have issue regarding speed in air. When i jump and move simultaneously that time speed of player increase.For jump i am using impuls and for movement i am using force.I want to slow speed when player is in air.

Thanks in advance

Following is my update method ih HUDLayer

-(void)update:(ccTime)dt :(b2Body *)ballBody :(CCSprite *)player1 :(b2World *)world
{

    if (moveRight.active==YES)
    {
            ballBody->SetActive(true);
        b2Vec2 locationworld=b2Vec2(maxSpeed,0);
        double mass=ballBody->GetMass();
        ballBody->ApplyForce(mass*locationworld, ballBody->GetWorldCenter());
      //  ballBody->SetLinearDamping(1.2f);
    }
    else if(moveLeft.active==YES)
    {
            ballBody->SetActive(true);
        b2Vec2 locationworld=b2Vec2(-10,0);
        double mass=ballBody->GetMass();
        ballBody->ApplyForce(mass*locationworld, ballBody->GetWorldCenter());
    //    ballBody->SetLinearDamping(1.2f);

    }

}
Following is jump

-(void)jump:(b2Body*)ballBody:(ccTime)dt:(BOOL)touch
{
    if (touch)
    {

        if (jumpSprte.active==YES)
        {
            ballBody->SetActive(true);
            b2Vec2 locationWorld;
        //locationWorld=b2Vec2(0.0f,98.0f);
            locationWorld=b2Vec2(0,32);
//        double mass=ballBody->GetMass();
            ballBody->ApplyLinearImpulse(locationWorld, ballBody->GetWorldCenter());
      //  ballBody->ApplyForce(mass*locationWorld, ballBody->GetWorldCenter());
            ballBody->SetLinearDamping(1.2f);

        }
    }
}

So where i apply logic??

sentences:
Using MCTS in Unreal Engine I have been making a turn-based board game in UE4 and have come to the point of making a first pass on the AI. I planned to use Monte Carlo Tree Search but this requires you to make (at least) one copy of the game state for each simulation. I am guessing that I will have to do  hundreds of simulations per move.

I am fairly new to UE4 but the problem is that there isn't really a separation between view and logic (at least the way that I have programmed it!). For example I have actors which contain their static meshes, current material etc as well as their logical state. I think in UE4 to create a real deep copy I would have to spawn new actors etc. Obviously in hindsight I have  made a big mistake and should have realised this earlier so that I could have switched to a different engine, but too late for that now.

Neither of the ideas that I have come up with are good:

1) Implement a special copy function which sets the static mesh etc to nullptr. I am not sure how Unreal will react to creating all of these actors but not spawning them in the level, my experience up to now suggests not well.

2) Make AI versions of all classes e.g. an AIUnit class which can be constructed from a normal Unit class but only initialises the minimum required data. I think this would work but it would be painfully inelegant with the obvious downside that I will essentially have to maintain two almost identical games and keep the rules in sync.

MCTS with UE4 doesn't seem to have many hits on google so any advice would be appreciated, I am willing to sacrifice some dead time e.g. wait 1 second every turn for AI "thinking" time.

sentences:
OnPointerDown / OnPointerUp aren't working in world-space canvases I'm working on a project where I have a main UI (Screen Space - Overlay canvas) and various game objects that have little popups above them (World Space canvas) that the player should be able to click on.  Everything on the main UI works fine, but the OnPointerDown and OnPointerUp methods on the World Space canvases aren't firing when I click on them.

Things I've made sure to check:

The canvases have a Graphic Raycaster
The canvases have their Event Camera set to the scene's camera
The Image on the canvas that's supposed to get clicked on has Raycast Target set to true

This was all working fine in Unity 2018, but in 2019 it's not.  Is this a bug, or has something changed that I just don't know about?  Either way, is there any way to fix this?

sentences:
How to check if the bottom side of one object touches the top side of another object? How can I check if the bottom side of one object touches the top side of another object? Like on the image:

I tried this:
foreach (tile t in tiles)
        {
            foreach (tile t2 in tiles)
            {
                if (t != t2)
                {
                    if (t.rect.Intersects(t2.rect))
                    {
                        if (t.rect.Center.Y < t2.rect.Center.Y)
                        {
                            kill_tiles_list.Add(t2);
                            kill_tiles_list.Add(t);
                        }
                    }
                }
            }
        }
    }

It will work to tell me that there has been a collision, but it will not tell me about which parts collided.

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:
Free Moddable 2d game with good community and tools Disclaimer: I'm okay with making this a community wiki, as I see a lot of benefit in having a place to ask this question and get good answers from people who have experience.

I would like to mod a 2D game. Having never modded a 2D game before (unless you count Starcraft custom maps back in 199x), I am looking for a game/system that has:

A good community: this means I can ask questions if I get stuck and expect a (decent) answer in roughly a day.
Solid tools: I would ideally prefer clicking and creating content over diving into optimized C++ to make changes. The better the tools, the faster you move.
Scripting language: Ideally, access to some scripting language above and beyond the main tools is an ideal middle-ground between high-level puritan tools (SC level editor) and low-level coding.
Free: I'm looking for something I can try out free, or very cheap.

It also goes without mention that I want something current; I'm sure I can mod Super Mario Brothers, Link to the Past, etc. (SNES-era games) but that's pretty worthless to me.

And please don't say "Starcraft (1)" :)

sentences:
I want to get back into 2D games programming I used to develop games in the late 80's / early 90's and would like to look at getting back into it these days.

I have seen online there are so many options and libraries etc, so just thought I would try asking on here to see if anyone could offer some advice/a path to take.

I only really want to do 2D games as I did many years. I have seen things like Unity and other javascript libraries and it looks a bit of a minefield.

Ideally I would like to target Android / IPhone games.

I know c#, some c++, javascript/html5

Any info greatly appreciated.

C

sentences:
How to make simple game from max model Possible Duplicate:
  Are there any video tutorials available for game programming with Max?

Suppose i have model of simple 3d ball made in 3ds max. i just want to make simple game for fun . the scene will have only one ball , which will move with cursor.

I know there may be other tools for game but i just want to know how to export 3ds max model in game

sentences:
Is it possible to give an animated GIF a transparent background? I'm making a Fire Emblem-esque game. There are very cute 2D frames I made for each character, and, like a game like Fire Emblem, I want these characters to animate constantly.

To circumvent the graphics programming involved I came up with a novel idea! I would make each character an animated gif, and only in special conditions ever halt their constant movement - in that case just change what image is being displayed.

Simple enough.  But I have a dilemma - I want the background of my .gifs to be transparent (so that the "grass" behind each character naturally shows, as per the screenshot - which has them as still images with transparent backgrounds). I know how to make a background transparent in numerous tools (GIMP, Photoshop). But it seems every .gif creator replaces the transparent background with something and I can't edit it back to transparent.

Is it possible to have a .gif with a transparent "background"? Perhaps my knowledge of file formats is limiting me here.

sentences:
What's the best program to learn/create 2d vector sprites? I have Photoshop experience and a bit of drawing experience, and am looking to learn how to create sprites like this: http://www.lostgarden.com/2009/03/dancs-miraculously-flexible-game.html

Any tips on what app(s) to use and any reading material/online tutorials to get started?

Thanks!

sentences:
How manage multiple images in Unity? I'm new in Unity and creating a game. So I have a class PicManager in which I have to load my images(sprites) from assets into a List and then use them in my game. What is the proper way to load multiple images from a folder in Assets?

I know, that I can use  Sprite[] sprites = Resources.LoadAll<Sprite>(texture.name);
But this article of Unity says not to use Resource folder.

sentences:
Unity: Assign GameObject to Class that hasn't been yet instantiated I'm creating a game where I have an Entity class that contains basic entity info (pos, health,..) and some functions. Enemies and Player later on inherit from this class.

Public class Entity {

public Vector2 position;
public float health;
,...

Lets say that I have a function like this inside the Entity class:

public GameObject movingIntoEnemy(Vector2 movingToPoint)
{
    foreach (GameObject go in GameObject.Find("GameMap").GetComponent<GameMap>().enemyList)
    {
        if (go.GetComponent<EnemyScript>().enemy.position == movingToPoint)
        {
            return go;
        }
    }
    return null;
}

This function looks for a GameObject called "GameMap" and then cycles through enemies in it's list. If an enemy is found, it returns it's GameObject. Using GameObject.Find() is pretty ineffective, so what would be a better approach to this? I mean, I can't just easily use

public GameObject GameMap;

since the code is in a class, and this class needs to be instantiated first in my player/enemy scripts.

My question is - how do I attach gameObjects to this class before it is even created? What is the appropriate approach to this? I guess that I might pass these GameObjects to the class through it's constructor, but it would make things much more complicated.

Thanks in advance ;)

sentences:
(Unity) does NativeArray.Copy, or NativeArray.CopyTo, allocate any memory? Is there any memory allocation if there are two arrays of the same size and same type? If they are already of the same length, and the values are of struct, when there's the copy, is any more memory used? Like, is it the same as if I did a for loop setting values from one array to the other?

Are they the same?
https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.CopyTo.html
https://docs.unity3d.com/ScriptReference/Unity.Collections.NativeArray_1.Copy.html

[What should I write here? Is this enough for a question?]

sentences:
Moving pac-man in maze game using objective c I am trying to develop maze game using objective-c, I want to allow moving the pac-man using swipe method, the user can swipe his fingers on the iPhone to indicate where he want PAC-MAN to go but I'm stuck on moving pac_man.
I used UIPanGesture but it can't indicate the collision of ghosts?

Please see the bellow code:

- (IBAction)pacmanmovement:(UIPanGestureRecognizer *)sender {
    CGPoint netTranslation;
    CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:self.pacman];

    sender.view.transform = CGAffineTransformMakeTranslation(
        netTranslation.x +  translatedPoint.x,
        netTranslation.y += translatedPoint.y);

    if ([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) {
        netTranslation.x += translatedPoint.x;
        netTranslation.y += translatedPoint.y;
    }

    [self collisionWithGhosts];
}

- (void)collisionWithGhosts {

    CALayer *ghostLayer1 = [self.ghost1.layer presentationLayer];
    CALayer *ghostLayer2 = [self.ghost2.layer presentationLayer];
    CALayer *ghostLayer3 = [self.ghost3.layer presentationLayer];
    CALayer *ghostLayer4 = [self.ghost4.layer presentationLayer];

    if (CGRectIntersectsRect(self.pacman.frame, ghostLayer1.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer2.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer3.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer4.frame) ) {

        self.currentPoint  = CGPointMake(0, 144);
    }

Any help?

sentences:
How to draw a smooth circle in Android using OpenGL? I am learning about OpenGL API on Android. I just drew a circle. Below is the code I used.

public class MyGLBall {

private int points=360;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;

//centre of circle

public MyGLBall(){

    vertices=new float[(points+1)*3];
    for(int i=3;i<(points+1)*3;i+=3){
      double rad=(i*360/points*3)*(3.14/180);
      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float) Math.sin(rad);
      vertices[i+2]=0;
    }
      ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
      bBuff.order(ByteOrder.nativeOrder());
      vertBuff=bBuff.asFloatBuffer();
      vertBuff.put(vertices);
      vertBuff.position(0);

}

public void draw(GL10 gl){
    gl.glPushMatrix();
    gl.glTranslatef(0, 0, 0);
//  gl.glScalef(size, size, 1.0f);
    gl.glColor4f(1.0f,1.0f,1.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();
 }

 }

It is actually taken directly from here
The circle looks pretty good. But now I want to make the boundary of the circle smooth. What changes do I need to make to the code? Or do I need to use some other technique for drawing the circle?

Thanks.

sentences: How could you use mirror in unity to network across multiple networks rather than only LAN (Port Forwarding?) I've been working on a game for my friends and I to play during quarantine but I can't figure out or find any information on networking using mirror. Everything I see gives vague answers to even vaguer questions that assume you have prior knowledge of networking. Could anyone give me any sort of direction on how to port forward using mirror or if there's a better solution?

sentences:
Strategies to make it difficult to cheat + easier to identify cheaters in Javascript/HTML5 game I intend to have a Javascript/HTML5 game with a global leaderboard. I have devised a very simple system for submitting highscores as follow:

  When the game finishes, the game client makes a POST request to server hosting the leaderboard that contains the name of the player and their score. Then, the server inserts the submission into its database.

However, this system can easily be cheated by an individual with an html form submitting POST requests with whatever score they want to my server.

I already know that a foolproof anti-cheat system is impossible because of how easy it is to modify Javascript and HTML on the client. I also know that I should never trust the client. However, implementing everything on the server side will be impractical for me since my server will not have the resources necessary to perform all the calculations for all the players.

So instead, I simply wish to make it as hard as possible for the average individual to cheat (and recognizing that it will always be possible to cheat), while making it as easy as possible for me to identify when a score that was submitted might possibly be fake.

What are strategies I can use to accomplish such? Please include examples whenever possible. For example, I have heard someone suggest using "pre-shared keys". However, I am not a cryptography expert and I have no idea how to go about implementing that.

sentences:
Why do tutorials use different approaches to OpenGL rendering? http://www.sdltutorials.com/sdl-opengl-tutorial-basics

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/

These two tutorials use completely different approaches to get nearly the same result. The first uses things like glBegin(GL_QUADS). The second one uses stuff like vertexBufferObjects, shaders based on GLEW. But the result is the same: you get basic shapes.

Why do these differences exist?

The first approach seems much easier to understand. What's the advantage of the complicated second approach?

sentences:
Android game to iOS, go with an engine? I have developed a game on android using native coding. However I am being asked to port it to ios.

So I thought that I should bite the bullet and recode it in unity so I can go cross platform.

I am just upset that I have to recode everything in unity. Is there any other way or tool that at least will make me use half of my code or so thing?
Basically what would you do.

Ps:I don't even know unity but I heard learning it is easy

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:
What rendering techniques would I use to draw a drop shadow effect for cards in a card game? What type of shading algorithm might be used to create shadows like these?

the one I'm making is similar but it is all done with a 2D drawing API powered by OpenGL so there is no Z coordinate.

In addition, for the hand itself, I'd really like to get a shaded feel like seen here:

I'm just not sure how to achieve a shaded look close to that.

The number of cards is bound to change and the cards get thrown onto the table so I can't use any type of light map of sorts.

What sorts of algorithms should I look into (aside from blur which I know 'll need to do?)

Thanks

Update

I'm making a 2D card game. I want to add dropshadows offset from the cards, a bit like:

The way I'm thinking of doing it is:

Keep a texture that is the same size as the backbuffer.
Draw dark rectangles as makeshift cards to that texture.
Blur that texture.
Draw my cards to that texture.
Do additional lighting on the cards.
Draw this texture to the backbuffer.

My questions are:

Is this the right way to do this?
Is there a way to do it without render to texture (keeping a bitmap
as big as the backbuffer)?
Is it safe to assume that the maximum texture size will not be
exceeded by the backbuffer size? (What I mean is, if the backbuffer
is 2000x3000, then is it safe to say that I can create a texture in
video memory of that size?

Thanks

sentences:
Obtain linear depth values on FBO and deal with small differences I've a render target on which I have both a color and a depth attachment. In a second pass I need to run a filter whose width depends on the derivative and values of the depth.

Now, if I try, in the second pass where I'm accessing the texture on which I rendered on previously, to display the depth information all I have is a grey blotch:

http://imgur.com/UFm5oI6   (Don't pay attention to background, I'm showing just non-background values)

Before displaying it I modify it by:

float depthValue = texture(depthTexture, uv);
depthValue =(depthValue - 0.1)/0.9;

as my near clip is 0.1 and far one is 1.0

Instead, if I run the program with gDEBugger and look at the content of the depth texture what I see is a much cleaner result:

http://imgur.com/TtOgMY2

Why what I see is totally different? How gDEBugger show the values? Are the value I fetch from the depth texture wrong? Should I render depth values differently?

Moreover, the width of the kernel doesn't really change as it is computed based on depth value and depth derivatives and those two are practically identical, at least judging from what I see. Is there a way to make these differences more marked?

Sorry if it's a dumb question. Thank you.

sentences:
Can a Unity button detect a tap AND send that tap through to objects below it? I'm trying to make a "highlight frame," like a flashing box around a button for use in the game's tutorial. When the frame is tapped, I'd like it to register the tap (so the frame can be dismissed) but ALSO allow the button underneath to register the same tap (so that button's action is triggered.)

Is this possible? For a button to "detect a raycast without blocking a raycast," or something similar?

I could just have the button's action dismiss any highlight frames that exist, but that would entail putting "dismiss frame if exists" statements all over the place in my code. It would be much neater just to have the frame be a button which dismisses itself, without blocking the interaction with whatever it's highlighting.

Is there a way to accomplish this?

sentences:
ball reflection angles Xna c# I'm trying to find a way to handle reflections for a breakout clone.

I would upload an image to the post instead of the following paragraph, however i have not yet gained the privilege of that yet.

If the ball intersects the left hand side i want it to bounce off to the left. if the ball intersects the right hand side i want it to bounce off to the right. if the ball intersects the middle section i want it to bounce up the way. i want to learn how to make it bounce in a varying direction dependant on what side of the left, right, or middle section was intersected

I would like to not use three separate rectangles for this, i want to learn how to do it with one.

I use a Vector2 for ball velocity, projVel.

It's position is projPos.

A rectangle for the paddle lightRect.

The reason I use proj.collRect for the beginning of the if is because I cannot use the intersect method with Vector2.

This is my makeshift collision handler at present, which does work but the speed changes to an extent which renders the game unplayable. The speed clamp i have only slightly slows it down i think. i have a variable for projSpeed i cannot clamp that or it will never be able to stop.

if (proj.collRect.Intersects(lightSaber.lightRect))
{
            proj.projPos.Y = lightSaber.lightRect.Y - proj.projTxr.Height;
            proj.projVel.Y *= -1;

    proj.projVel.X = 10 * (proj.projPos.X - lightSaber.lightRect.Center.X) / (lightSaber.lightRect.Center.X);
}

        proj.projVel.X = Math.Max(-4, Math.Min(proj.projVel.X, 4));
        proj.projVel.Y = Math.Max(-4, Math.Min(proj.projVel.Y, 4));

Help me by showing me how I could do this, maybe in the Math. method, or even an alternative to .Intersects so I can use projPos instead of collRect.

I really am not sure where to start, if there is another way I could do it an example would be great.

sentences:
lightmap equivalent with realtime shadow i'm using in Unity free edition.

I try to bake a lightmap which equivalent feeling with Unity's real time light map and shadowing, like left figure.

But the result is the right figure.

How can i set a paremters of lighting window to get result like left figure?

--added--

here's all of screenshots.

sentences:
track 2D offset after rotation red is my origin point, blue is my offset, both are 2D vectors, how can calculate blue after rotation?
this is the code I've been trying(just throwing things against a wall to see what sticks)
public static Vector2F CalcPointWithRotation(Vector2F origin, Vector2F point, float rotation)
{
    return new Vector2F((float)Math.Cos(rotation) * origin.x, (float)Math.Sin(rotation) * origin.y);
}

sentences:
custom mesh object orientation is not correct using I am making a custom mesh with the help of Traingulator script.  At runtime, user can click and and generate a point then mesh creation start. Here is the way i am getting user input.

void Update()
    {
        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit))
        {
            if (Input.GetMouseButtonDown(0))
            {
                GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                sphere.transform.position = hit.point;
                sphere.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
                positions.Add(sphere.transform.position);
                positionsVector2.Add(new Vector2(sphere.transform.position.x, sphere.transform.position.z));

                traingulatorTester.MeshMaker(positionsVector2.ToArray());
            }
        }

    }

And here is the mesh maker function that calling tringulator

 public void MeshMaker(Vector2[] vertices2D)
    {
        // Use the triangulator to get indices for creating triangles
        Triangulator tr = new Triangulator(vertices2D);
        int[] indices = tr.Triangulate();

        // Create the Vector3 vertices
        Vector3[] vertices = new Vector3[vertices2D.Length];
        for (int i = 0; i < vertices.Length; i++)
        {
            vertices[i] = new Vector3(vertices2D[i].x, vertices2D[i].y, 0);
        }

        // Create the mesh
        Mesh msh = new Mesh();
        msh.vertices = vertices;
        msh.triangles = indices;
        msh.RecalculateNormals();
        msh.RecalculateBounds();
        if (gameObject.GetComponent<MeshRenderer>() == null)
        {
            // Set up game object with mesh;
            gameObject.AddComponent(typeof(MeshRenderer));
            filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;
        }
        filter.mesh = msh;

    }

Now the problem is the rotation of the custom mesh object is not correct look at this.

Now I have manually set the rotation.

sentences:
Pokemon Battle System A.I For my newest project, a Pokemon fan-edition, I need to collect much information on the game mechanics. So I need to know a few things about the A.I. implemented in the games. For the sake if simplicity here are my questions:

Do today's Pokemon games (Diamond, Pearl, Platinum, HeartGold, SoulSilver, Black, White) include an A.I. or is everything more or less random?
Has anyone information or even resources on that topic so that I can reuse this to build my battle system?

sentences:
Drag and Drop Team Selection I have a Fantasy F1 Website, currently users select their teams using dropdown menus.  It works OK but isn't as user friendly as I would like.

I would like to implement a drag and drop type of system, there's jQuery code out there that would go part of the way to allowing me to do this:

http://jqueryui.com/demos/draggable/

But I am not sure about how to integrate that into PHP and MySQL, my jQuery skills are limited!

I'd also need to stop them spending more than a certain amount of money, each driver has a value and the teams can only spend a certain amount of money.

There's also limits for example you can only pick a driver once, but you can have three different drivers.

Finally, how would you decide that the user had picked their team, I don't want a submit button as that kind of defeats the object of the exercise!

Thanks for any advice, I don't expect anyone to write the code for me but some pointers would be greatly appreciated.

sentences:
glDrawElements Crash This is the "init" code of the Renderer class:

glGenBuffers(1,&_idVBO);
glGenBuffers(1,&_idEBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,_idEBO);
glBindBuffer(GL_VERTEX_ARRAY,_idVBO);

GLint lUV       = glGetAttribLocation(_SID,"inUV");
GLint lPosition = glGetAttribLocation(_SID,"inPosition");

glEnableVertexAttribArray(lPosition);
glEnableVertexAttribArray(lUV);
glVertexAttribPointer(lUV, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);
glVertexAttribPointer(lPosition, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3*sizeof(GLfloat)));

...and this is the "flush" function:

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,_idEBO);
glBindBuffer(GL_VERTEX_ARRAY,_idVBO);
glBufferData(GL_ARRAY_BUFFER,_lVBO*sizeof(GLfloat),_pOriginVBO,GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,_lEBO*sizeof(GLuint),_pOriginEBO,GL_STATIC_DRAW);

glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_INT,0);

The glDrawElements call crashes with error code c0000005, which is caused by memory acces violation i.e. bad pointers.
But I do not understand where the problem is. Any ideas? Thanks in advance...

sentences:
Is game development Subcontracted? I was having a conversation with someone who believed that components of a games code where subcontracted out to programmers in different countries where it would be cheaper, then assembled by the local company.
I understand that people often use pre-built engines but I would think that making the actual game would require people to work closely in the same studio.

I couldn't find much clear information on this when I looked, does anyone know?

sentences:
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:
Use of synthetic vs. natural sounds in modern large games Wondering generally how sounds are created for a large game such as Halo or Mario. Obviously 8-bit games probably used synthetic sounds (like regular Mario), and modern games have prerecorded voices in them. But I'm wondering sort of how much natural sounding synthetic sounds are used in a large game. In reading about documentaries and movies, a lot of the time they have microphones and go around in nature (or have a sound studio) and record "natural" sounds. Also, some of the iPhone sounds like the bell and whatnot sound like real sounds, though not sure if they were programmatically generated / synthetic.

More specifically, wondering what an example of a game is that uses synthetic sounds (that sound realistic) extensively. I would like to learn what is possible with synthetic sounds as opposed to natural sounds, to see how realistic they can be. Then from there I might be interested in looking into how those realistic synthetic sounds are made.

sentences: How can i show all edges in monogame? I am using Monogame 3.5 and i have simple model of cube. I use BasicEffect to draw it. I want it transparent so i use effect.Alpha = 0.5f. Is it possible to show all edges something like on picture?

sentences:
How do I get the width of a string as it would be displayed on screen? What is the best and easiest way to get the width of a String using Slick2D?

I'm working on the achievement interface menu in my game that displays some images. On each image I need to draw a string such as "Reach Level 5.". Only problem is that I don't know how to get the string width to properly center the string on the image.

sentences:
2D Spaceship Thruster Movement - Turning I have a spacecraft (shown in the image) built out of ‘blocks’ / 3D planes. It is drawn within a 3D space, but I’m ignoring the Y axis for now and keeping things on a “2D” XZ axis.

The ship has a number of thruster blocks (represented in blue); each of which should fire depending on user input (does the user want to go forward? or turn left? etc).

Although the image doesn’t show it, each thruster is oriented in a logical direction; i.e the thrusters labelled A & E point left, B & F point right, thrusters G & H point down, thrusters C & D point up.

Thrusters are placed arbitrarily around the ship. There is no actual 'Thruster A' or 'Thruster B'; I'm just using the spacecraft in the above image as an example.

I already have the following which works for forward/backward thrust and strafing (in pseudo code):

foreach(thruster in ship.thrusters) {

    // Forward thrust
    if(keyPressed W) && thruster.direction == ShipLocalSOUTH) {

        thruster.fire();
    }

    // Backward thrust
    if(keyPressed S) && thruster.direction == ShipLocalNORTH) {

        thruster.fire();
    }

    // Strafe Left
    if(keyPressed Q) && thruster.direction == ShipLocalEAST) {

        thruster.fire();
    }

    // Strafe right
    if(keyPressed E) && thruster.direction == ShipLocalWEST) {

        thruster.fire();
    }

    // Turn left
    if(keyPressed A && ??) {

        // ??
    }

    // Turn right
    if(keyPressed D && ??) {

        //??
    }
}

class Thruster {

    private thrusterPower = 10;

    public void fire() {

        shipRigidbody.AddForceAtPosition (thruster.transform.forward * thrusterPower, thruster.transform.position);
    }
}

My problem lies in determining which thrusters to fire to turn the ship.

I’ve done a lot of googling on this and have found quite a lot of info already. I.e:

Using Torque and Thrusters to Move and Rotate a Player-Designed Spaceship

However my maths/trig skills are - to be blunt - crap and so I’m hoping to get a somewhat simpler explanation or even some code to help me understand and solve this problem. I'm not aiming for superbly accurate physics, just something that is fun to play.

sentences:
Complex system-component dependencies in entity-component-system? I am trying to design a data-oriented ECS engine. The issue I am struggling with is that my rendering system have to rely on two different sets of entities to actually do rendering.

My current idea is to have (usually one, but possibly more) entities representing cameras (e.g. sets of components describing views and viewports). Then, I can have RenderingSystem that iterates through all CameraComponents and renders everything they 'see' to appropriate viewports.

However, this requires RenderingSystem to query for two non-intersecting sets of components: cameras and renderables. My current approach allows systems to select a set of nodes that have one or several required components. It does not allow for more complex queries, like either CameraComponent or RenderableComponent. This is not the first time when more complex system-component dependencies (using unions of component sets insetead of their intersections) seem useful to me.

Plain old data components have crucial advantages:

They are trivially serializable
Can be changed by game designers without recompilation or coding knowledge
Describe behaviors in purely declarative way

That is why I would like to put cameras among other things in the ECS.

Use case: if we are implementing mirrors, we may put Renderable, Position and Camera components on them, then Renderable's texture will also be a render target for Camera. RenderingSystem then will render them in some efficient way.

So, is defining more complex relations with components (like "this system should receive all nodes that have Camera and Position as 'cameras' collection and all nodes with Renderable and Position as 'renderables') the most flexible solution in this case, or is there a better way?

UPDATE(1): I ended up allowing systems to define their dependencies like this (the word "aspect" is borrowed from Artemis ECS framework):

aspects: {
    renderables: Aspect.all(['Transform', 'Sprite']),
    cameras: Aspect.all(['Transform', 'Camera']),
    emitters: Aspect.all(['Transform', 'ParticleEmitter']),
    ...
}

These lists are gathered, passed to a system, cached and rendered in an efficient way. This actually works quite nicely (in other systems too), as well as cameras being entities. Is this a common way to do it?

UPDATE(2): I have spent some time working with ECS-like architectures and added a conclusion as an answer. I hope it makes clear that the approach I have suggested in the first update is just one of available options.

sentences:
What is the size limit to the Unity 2017.2 Tilemap? I've been digging through the documentation on the Tilemap feature of Unity 2017.2.

Does Unity limit the maximum number of tiles it will support for a particular tilemap mesh?

I know that each tile is instantiated once and used to texture the quads on the Tilemap mesh at runtime, so I would guess that the mesh quad count limit is ultimately dependent on the hardware, and more or less is arbitrarily high.

Is that a correct assumption, or is there a hard cap in the engine?

sentences:
How to prevent tendencies to upper-left corner? In a 2D tile-based game I'm making, I have a loop that runs through each of the tiles to check and apply values.
One of the effects is intended to make a circle around itself, using a similar method. However, instead of making a circle (or a square, due to the shape of the map), it tends to smear towards the upper left corner.

In have tried running the loop in the reverse direction every other round, but oddly the effect persists.

I am wondering if there are any tips for preventing such a buildup.

edit:
here's the current code of the simulation system
http://pastebin.com/NsgK0SxP

sentences:
How can I draw beautiful lines with XNA on WP7? I'm trying to figure out how to draw good looking lines using XNA on the WP7 platform. By good looking I mean something not skinny and flat that a simple primitive gives you. A nice gradient, or texture or something applied.
It would be pretty easy if the lines were all straight, but I need to be able to make 45* and 90* turns.
Has anyone else tried doing this? I have found ways to do it, but they all require custom shaders which the platform doesn't support. Like this one for example
Example output from that library:

sentences:
Controlled rotation on 3D object with mouse movement I've a scene with a cube that I can rotate around yaw, pitch and roll. I do this by click the circles and drag the mouse on x/y-axis. I want similar functionality as the Unity rotation tool in editor mode.

My problem is that I can't figure out how to transform the mouse movement so the rotation doesn't become reversed if the cube is rotated 180 degrees in some axis. And how to use correct mouse direction depending on how the cube is rotated.

An image of the cube:

Here I get the mouse input

var direction = InputHandler.GetMouseDirection();
Vector3 diff = new Vector3(direction.X, direction.Y, 0);

if (selectedIntersect == Intersect.Yaw) //green
    block.Rotate2(diff.X, 0, 0);

else if (selectedIntersect == Intersect.Pitch) //blue
    block.Rotate2(0, 0, diff.Y);

else if (selectedIntersect == Intersect.Roll) //red
    block.Rotate2(0, diff.Y, 0);

Here I rotate the cube:

public void Rotate2(float yaw, float pitch, float roll)
{
    Quaternion yawrotation = Quaternion.CreateFromAxisAngle(
        Vector3.Normalize(this.WorldRotation.Up), MathHelper.ToRadians(yaw));
    Quaternion pitchrotation = Quaternion.CreateFromAxisAngle(
        Vector3.Normalize(this.WorldRotation.Right), MathHelper.ToRadians(pitch));
    Quaternion rollrotation = Quaternion.CreateFromAxisAngle(
        Vector3.Normalize(this.WorldRotation.Forward), MathHelper.ToRadians(roll));

    Quaternion.Concatenate(ref orientation, ref yawrotation, out orientation);
    Quaternion.Concatenate(ref orientation, ref pitchrotation, out orientation);
    Quaternion.Concatenate(ref orientation, ref rollrotation, out orientation);
}

sentences:
How can I control the volume of the music and the sound effects seperately with two sliders? In the Hierarchy i have one Main Camera with Audio Listener.
In the Hierarchy I have AudioPanel and two child Sliders.

And the AudioManager script that attached to the AudioPanel:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

[System.Serializable]

public class AudioManager : MonoBehaviour
{

    public Slider musicVolume;
    public Slider effectsVolume;

    private void SetMusicListenerVolume()
    {
        AudioListener.volume = musicVolume.value;
    }

    public void ApplyMusicSettings()
    {
        SetMusicListenerVolume();
    }

    private void SetEffectsListenerVolume()
    {
        AudioListener.volume = effectsVolume.value;
    }

    public void ApplyEffectsSettings()
    {
        SetEffectsListenerVolume();
    }
}

Now in the Hierarchy I have some Audio Sources components for the sound effects and I want to control them with the Slider (1).

And to control the music sound with the Slider.
The music sound have his own Audio Source.

The problem is that the AudioListener in the script control all the Audio Sources. Music and Effects. Or maybe only the Music ? U'm not sure.
But when i change both sliders when the game is running it's changing the music volume.

My question/s is how to control with Slider only the volume of the music and with Slider (1) the effects volume ?

And how can i get all the effects audio sources in the script and control the volume of them using the Slider (1) ?

The audio source component of the music is attached to GameObject name Sound.
All the other audio sources components are effects and are in some places in the Hierarchy.

sentences:
Comparison between Cocos2d and Corona I'm having a really hard time deciding which way to go on this.  I'm about to start developing a game and I haven't been able to find many good comparisons between these approaches.  I don't have many requirements for the game yet, but here is what I do know.

needs to work on iPhone
I don't have much money ($400 for Unity for iPhone is probably too much. I can probably afford $99 for Corona.)
Graphics will be 2D
Physics support is not needed
Ability to use particles would be nice
Game Center support would be nice (Corona is planning to support it soon)
It would be nice to be able to support Android as well if it isn't much effort.

I have done my own research, so I know basic things about them.  I know Corona uses Lua and Cocos2D uses Objective C.  I know that Corona allows deployment to iPhone and Android, but how easy is it?

Cocos2D is free, but so many people talk about how easy it is to use Corona, but I don't like being restricted to features Corona supports or the price tag.  I feel so torn here.

sentences:
Convert triangle mesh to group of line segments I have a 3D .OBJ model file that is loaded in my OpenGL ES 2 Android application using ASSIMP library. All the faces are triangulated.

I want to draw the wireframe for my mesh. In OpenGL we have something called glPolygonMode that enables wireframe drawing just in one line.

Is there a function I can use to convert those triangulated faces into a pair of Line segments and then draw these line segments using GL_LINES?

Any better approach to draw wireframe for 3D mesh in OpenGL ES 2 would be appreciated. Maybe something based on GLSL shader.

sentences:
JavaScript movement of player Okay so I am quite new, I've got the player to move using up, down, right, and left. But what I am trying to do is make the character move with a left click.

var Player = function(id){
    var self = {
        x:250,
        y:250,
        id:id,
        number:"" + Math.floor(10 * Math.random()),
        pressingRight:false,
        pressingLeft:false,
        pressingUp:false,
        pressingDown:false,
        maxSpd:10,
    }
    self.updatePosition = function(){
        if(self.pressingRight)
            self.x += self.maxSpd;
        if(self.pressingLeft)
            self.x -= self.maxSpd;
        if(self.pressingUp)
            self.y -= self.maxSpd;
        if(self.pressingDown)
            self.y += self.maxSpd;
    }
    return self;
}

That's what I have for the up, down, left, right movement. I've seen a few documents stating the click but just can't seem to implement it into the file.

sentences:
unity UI limitation for tutorial purpose i want to add a tutorial part to my game that i make by unity.i have some panels that for tutorial purpose i want to limit user to just click a button.most of games make a dark panel over all places except learning  UI.

i know there is lots of ways for making that but is there any standard way for that?

sentences:
Batches Count increase when applying GPU instancing I have camera across a very weird issue where my batches count significantly increase if I enable GPU instancing:
Before applying GPU instancing"

After Applying Gpu Instanching:

I have a pylon object where i am sharing the material with standar specular shader.

sentences:
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: How can I import a Google Sketchup model with textures? I'm using Unity 4 and trying to import a SketchUp Model into Unity and other Engines - but I can't get it to import correctly. Can anyone help me out?

sentences:
Is correct to calculate values in percentage, using the total number of iterations? Trying to clarify the problem.

Imagine a factory that produce soccer balls; if you produce 1 ball, it will take a certain amount of game cycles. For sake of simplicity, let's say it could take between 5 and 15 cycles (depending from various conditions, like number of workers, quality of workers and so on). Once you make a certain amount of soccer balls, the process is considered done.

Now, I want to display a value in percentage for costs, and a value of defective balls made. with "cost", I am trying to display how much did I spent (materials, workers wage and so on), at the moment. The number in currency is self esplicative, but I believe a percentage value could help to know if you are using too many workers, or burning too many resources, resulting in a waste of money.

To calculate the percentage of defective is relatively simple, since every X amount of time, when I refresh, I can check the balls produced against the defective ones, and the result should be

Total produced * 100 / defective = percentage of defective.

But for the costs, things are different; so I was planning to use the number of cycles to calculate percentage for costs:

cycles * 100 / current costs = percentage of costs

Would this be considered correct? Since the number of cycles for a whole batch of balls may vary slightly, this may represent that when there are less cycles, it means that you spent less money, henche the percentage will be smaller.

sentences:
Away3D vs Papervision3D I have served Google and I found that there are many 3D game engine also I have another question here

Do Playfish and Zynga use Flash game engines?

and I know that away3D is used for social media games on Facebook

but I'm confused now which one is the best and will be good and easy to start with as I'm very new in game development

so if anyone can advice me I will be thankful

also if anyone can support me with tutorial or book that may help me this is will be great

Thanks in Advance

sentences:
How do you increase the spacing on text within LibGDX labels So I'm following along with some tutorials for creating an application with LibGDX, and when I go to print parts of the UI to the screen, the text is all bunched up. How do I increase the spacing, or is it due to something else I've done?

....
    game = gam;
    stage = new Stage(new StretchViewport(800, 400));
    Gdx.input.setInputProcessor(stage);
    uiSkin = new Skin(Gdx.files.internal("uiskin.json"), new TextureAtlas(Gdx.files.internal("uiskin.atlas")));
    Label nameLabel = new Label("Name:", uiSkin);
    TextField nameText = new TextField("", uiSkin);
    Label addressLabel = new Label("Address:", uiSkin);
    TextField addressText = new TextField("", uiSkin);

    table = new Table();
    table.add(nameLabel).expandX();
    table.add(nameText).width(200);
    table.row();
    table.add(addressLabel);
    table.add(addressText).width(200);
    table.setFillParent(true);
    stage.addActor(table);
    table.setDebug(true);

sentences:
Precalculate the position of a rotating Aircraft To start honestly, this question is probably mostly handling math. But thats only the road I tried to go and failed miserably, so maybe theres a much more simple way to do.

Ok the game situation is pretty simple: A 3D space game with nearly no constraints. I don't care about physics in this game, besides from collision.

There is an aircraft (or actually more of them) that gets moved forward every frame according to it's speed and the delta time.  The movement of the aircraft occurs according to its own z-Axis. Before the translation the aircraft gets rotated, too. First around it's y-Axis and then around it's x-Axis. The result is a simply controllable aircraft.

Here some code for you:

void Update()
{
  //Rotate left/right
  float h = HORZ_SPEED * paramX * Time.deltaTime; //HORZ_SPEED is a fixed property of the aircraft, paramX an input value
  Quaternion deltaRotation = Quaternion.Euler(Vector3.up*h);,
  rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

  //Vertical rotation
  float v = VERT_SPEED * (-1.0f) * paramY * Time.deltaTime;
  deltaRotation = Quaternion.Euler(v,0,0);
  rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

  //Translation
  rigidbody.velocity = this.speed * transform.TransformDirection(Vector3.forward);
}

I simplified it a bit, but it's not really much more to that. The problem now is:
I want to predict this movement.

For different AI issues like collision avoidance and pattern recognition, I would like to calculate with constant parameters v and h and speed, where my aircraft would be at a point in time X seconds in the future.

What I tried is calculating it the hard way, starting with a start position of object axes, speed and rotation per second and constructing transformations and positions for a few frames progress, hoping it would collapse to a simple pattern. But I didn't find it.

If got the strong feeling that this kind of movement should form a simple pattern like a circle (ok, not soo simple) or an ellipse that I can calculate through a few variables. But I can't seem to make my mind up what that pattern should be and how I can calculate it's characteristics out of the data I have.

EDIT: What I managed to calculate is the transformation the local unit vectors take each frame:
e_z -> e_y * sin(a_y) + [e_z * cos(a_x) + e_x * sin(a_x)]*cos(a_y)
e_x -> e_x * cos(a_x) - e_z * sin(a_x)
e_y -> e_y * cos(a_y) - [e_z * cos(a_x) + e_x * sin(a_x)]*sin(a_y)

On the right all unit vectors are used in their state of the last frame.
a_x and a_y are the rotation parameters for the x resp. y axis:
a_x = VERT_SPEED * paramY
a_y = HORZ_SPEED * paramX

sentences:
Predicted target location I'm having an issue with calculating the predicted linear angle a projectile needs to move in to intersect a moving enemy ship for my 2D game.

I've tried following the document here, but what I've have come up with is simply awful.

protected Vector2 GetPredictedPosition(float angleToEnemy, ShipCompartment origin, ShipCompartment target)
{
    // Below obviously won't compile (document wants a Vector, not sure how to get that from a single float?)
    Vector2 velocity = target.Thrust - 25f; // Closing velocity (25 is example projectile velocity)
    Vector2 distance = target.Position - origin.Position; // Range to close
    double time = distance.Length() / velocity.Length(); // Time

    // Garbage code, doesn't compile, this method is incorrect
    return target.Position + (target.Thrust * time);
}

I would be grateful if the community can help point out how this is done correctly.

EDIT

Here is my (working) method following the advice given:

protected Vector2 GetPredictedPosition(ShipCompartment origin, ShipCompartment target, Ship enemyShip, Ship firingShip)
{
    Vector2 targetVelocity = enemyShip.Direction * enemyShip.Thrust;
    Vector2 projectileVelocity = firingShip.Direction * 25f;

    Vector2 velocity = targetVelocity - projectileVelocity; // Closing velocity
    Vector2 distance = target.Position - origin.Position; // Range to close
    double time = distance.Length() / velocity.Length(); // Time

    return target.Position + new Vector2(Convert.ToSingle(targetVelocity.X * time), Convert.ToSingle(targetVelocity.Y * time));
}

sentences:
Open source component-based game engines? Possible Duplicate:
  Are there existing FOSS component-based frameworks?

What open source game engines with component-based design of game objects do you know? And which best of them? I mean best not in Graphics or Physics, but best in context of Behaviour, Messaging, etc.

This question is the result of inspiration by another question

Thank you!!!

sentences:
When is the Z coordinate normalized in GLSL? I thought that whenever you transform an object to world space, then view space and finally screen space, the last matrix you apply(the projection matrix) normalizes the z values between 0 and 1.

However, I'm getting big z coordinates, which implies that the projection matrix didn't normalize it. Am I doing something wrong? I mean, all I do is:

gl_Position = projection * view * world * gl_Vertex;

sentences:
Implementing acceleration in topdown 2d game So I'm making this topdown game and I'm trying to implement player control movement so that it feels more natural. Right now I have an update method like this:

void update(float delta) {
    velocity = sf::Vector2f();

    if right:
        velocity.x = 1;
    if left:
        velocity.x = -1;
    if up:
        velocity.y = -1;
    if down:
        velocity.y = 1;

    velocity *= sf::Vector2f(delta, delta);
    position += velocity;
}

I want to implement acceleration, so that the player doesn't reach top speed as soon as they hit a key, as well as de-acceleration so that they slow down (but quicker than they accelerate) as they release the key.

So I remove the velocity being reset to zero, and if they go right I increment the x component of the velocity by the speed and then if they still hold right I increment the speed by acceleration. Then when they release the key I slow down this acceleration, but the way I've done it you move right it works, then you move left and the player goes right again but really fast.

Note that I'm only doing left + right before I move on to up and down since its the same principle, so the code is unfinished:

void Player::update(double delta) {
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) {
        vel.x += speed;
        speed += accel;
        if (speed > max_accel) {
            speed = max_accel;
        }
    }
    else if (vel.x > 0) {
        speed -= accel;
        if (vel.x <= 0) {
            vel.x = 0;
            speed = accel;
        }
    }

    if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)) {
        vel.x -= speed;
        speed -= accel;
        if (speed < -max_accel) {
            speed = -max_accel;
        }
    }
    else if (vel.x < 0) {
        vel.x += speed;
        if (vel.x >= 0) {
            vel.x = 0;
            speed = accel;
        }
    }

    pos.x += vel.x * delta;
    pos.y += vel.y * delta;
}

What am I doing wrong here? I can't seem to get the logic right for when you release a key or not. I figured that if they aren't holding A, but their velocity is in the direction of A then we apply the slowdown but I can't seem to figure out how to handle when we actually reach the velocity of zero.

sentences:
How can I get the assignment of an object back? I have been struggling with this NullReferenceExpection error.

When I don't add anything and just use this version of the code. The game adds a tower, upgrades a tower and takes money for it.

It worked all fine until I tried to add a menu that opens up and then you can choose a tower type you can buy.

So after I add all of this I get a NullReferenceExpection at return tower == null && gameManager.Gold >= cost; and at gameManager.Gold -= tower.GetComponent<TowerData>().CurrentLevel.cost;. The game also doesn't take any money from purchases and you can spawn near infinite amounts of towers on one spot.

  //tower = (GameObject)

  theTowerMenu.gameObject.SetActive (false);

  transform.position = new Vector3(openSpot.transform.position.x, openSpot.transform.position.y, transform.position.z

If i take 'tower = (GameObject)' out of comments I get "error CS0030: Cannot convert type void' toUnityEngine.GameObject'".

The current script:

using UnityEngine;
using System.Collections;

public class PlaceTower : MonoBehaviour {

public GameObject towerPrefab;
private GameObject tower;

public GameObject openSpot;

private GameManagerBehavior gameManager;

public GameObject theTowerMenu;

// Use this for initialization
void Start () {
    gameManager = GameObject.Find ("GameManager").GetComponent<GameManagerBehavior>();
}

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

}

private bool canPlaceTower() {
    int cost = towerPrefab.GetComponent<TowerData> ().levels[0].cost;
    return tower == null && gameManager.Gold >= cost;
}

void OnMouseUp () {
    if (canPlaceTower ()) {
        //tower = (GameObject)
        theTowerMenu.gameObject.SetActive (false);
        transform.position = new Vector3(openSpot.transform.position.x, openSpot.transform.position.y, transform.position.z);
        Instantiate (towerPrefab, transform.position, Quaternion.identity);

        AudioSource audioSource = gameObject.GetComponent<AudioSource> ();
        audioSource.PlayOneShot (audioSource.clip);

        gameManager.Gold -= tower.GetComponent<TowerData>().CurrentLevel.cost;
    } else if (canUpgradeTower ()) {
        tower.GetComponent<TowerData> ().increaseLevel ();
        AudioSource audioSource = gameObject.GetComponent<AudioSource> ();
        audioSource.PlayOneShot (audioSource.clip);
        gameManager.Gold -= tower.GetComponent<TowerData> ().CurrentLevel.cost;
    }

}

private bool canUpgradeTower() {
    if (tower != null) {
        TowerData towerData = tower.GetComponent<TowerData> ();
        TowerLevel nextLevel = towerData.getNextLevel ();
        if (nextLevel != null) {
            return gameManager.Gold >= nextLevel.cost;
        }
    }
    return false;
}
}

Please help. I've been stuck with this for a long time.

sentences:
How can I change the gear of my 2D character? Is it possible to change the clothes of a 2D character(it's a 2D Windows Phone game) without creating new animations for that character? I want that the player can change the clothes of the character, but the character animations(for example walking, jumping, attacking) should rest the same. The clothes won't affect the character's animations.

I create my animations in Anime Studio Pro. Is it possible to change the clothes without creating new walking, jumping and attacking animations for every single dress?

sentences:
2D Rain Creation (and Fluid Dynamics) I am experimenting with weather conditions in a game of mine, and I was impressed by the way Starbound handled the rain. Basically, when rain hits the ground, it's either dispersed horizontally (and absorbed by the ground), or it creates piles of water (when raindrops land inside a hole in the ground).

This video demonstrates this clearly:
http://imgur.com/gallery/CKCGKbG

I know how to make rain fall and check where it hits the ground, but that's where I get stuck. My question is: how could this have been created? And how could one model the water flow so perfectly, without killing performance?

Thanks in advance!

sentences:
Octree LOD without traversing the entire tree I am working on a voxel engine that uses a huge Hashed Linear Octree that reconfigures when you move. Each octree leaf is a voxel. The world is procedurally generated using 2D Perlin noise.
The octree utilizes face culling and instancing to accomplish pretty good performance in OpenGL. I have implemented LODs in order to allow for much bigger scenes and my bottleneck has quickly shifted from rendering faces to generating the Octree.
Each time the camera moves I need to reconfigure the Octree's LOD in order to ensure the viewer sees high detail near him and low detail in the distance. The system works great for small Octrees (256^3) but as soon as I go to a 1024^3 Octree, the generation of the Octree LOD takes 1-2 minutes. Even done on a separate thread it isn't enough.
I am sure there is a way to generate the Octree world without traversing the whole Octree but I could not find it.
The basic outline of how I do the Octree LOD generation when the camera moves:

Start traversing the Octree at the root node

For each node, check the distance of the node's center from the camera
2.a. If the node is a leaf and the distance is smaller than the node size * CONSTANT, divide it. If it is not a leaf, traverse its children and go back to (2).
2.b. If the node is not a leaf, and the distance is larger than the node size * CONSTANT, collapse the node if needed.

That's basically it. Because the world is procedurally generated, dividing each node means iterating its entire volume (x+1,z,x+2,z...x,z+1,x,z+2...x+1,z+1....) to determine if the 2D Perlin noise passes through the node volume, above it, or below it (This has to be part of the problem as for 256^3 nodes it takes 65536 iterations).
I know that I can improve this by parallelizing the entire algorithm, but I still feel like there has to be 1) a way to calculate LODs without entire tree traversal, and 2) figuring out if to divide the node without iterating through its whole volume 1 by 1.
Would love to get some pointers, I could not find many resources about this online.

sentences:
Integrating Unity physics with Entitas I've used Entitas a bit and it appeared to me as a great way of creating clean, modular code. I've seen few examples of games created with this framework, and most of them were puzzles, TD's, simple RPG's, etc. Those made me come to think, that ECS like that is not suitable for games making big use of Unity built-in physics engine. Rigidbody in this case is part of View layer, but it would affect for example "position" component, so we can't say they are really separated. Unity Physics also works at it's own pace, so there is not really a chance for independent Component-System based simulation.

Are there any generally accepted solutions, or if I don't wan't to write my own physics engine, I should give up Entitas?

sentences:
Game Programming Junior Demo Design Consider the following demo:

http://www.ashereinhorn.com/post/11140243390/short-capture-from-the-last-xna-version-direct3d

(It has now almost been converted to C++ and DirecX10, and so the code is not important here, it's the substance I'm interested in)

Basically the little agents move around killing each other, their states are displayed in a corner and you can select one so as to see the items it can see, it's field of view and the things it is holding in memory.

I showed it to someone that works in the industry and they said I should focus on tracking a single agent and make what's going on more clear - so maybe animate each state with simple animations or model swapping to make it more obvious when they are searching / in combat / running away. The other thing they said I should change was the fact that the agents simply disappear when killed, and reappear when spawned because again, it's not clear what's happeneing. As a result I'm going to implement a simple particle system so that agents 'shatter' when killed and possibly reassemble when spawned.

My question is, are there any really obvious changes that I should make to this demo with a view to getting my first game programming job? If you work or know about the industry, is there anything that jumps out at you that should be included? Or is bad? or good for that matter?

Are there any things that would particularly impress or grab your attention in a game demo?

Thank you very much for any help you can give!

EDIT - The walls are actually solid in the C++ version

sentences:
Why does a call to vkCreateInstance() take noticeable time to complete? I decided to learn Vulkan and started writing a simple program. I then ran the program (which only called vkCreateInstance()) to see if the Vulkan instance was created successfully and was shocked to see that my computer's fan started spinning loudly (and kept doing so for 5 seconds) and I saw a spike of 8% of the computer's processes being used for a second(and the function call took 1.5 billion cycles -- enough to make the program's loading time noticeable). Complaining about a one second CPU-usage spike would seem humorous if the spike were due to a loop doing hundreds of function calls, but I only called a single function once (vkCreateInstance()). Is there a way to reduce the overhead of some of Vulkan's functions and should I be using Vulkan for 2-D rendering?

Here is the code that took 1.5 billion cycles to run:

VkInstance instance;

VkApplicationInfo appInfo = { 0, 0, 0, 0, 0, 0, 0 };
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.pApplicationName = "Hello Triangle";
appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.pEngineName = "No Engine";
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.apiVersion = VK_API_VERSION_1_0;

VkInstanceCreateInfo createInfo = { 0, 0, 0, 0, 0, 0, 0, 0 };
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
createInfo.pApplicationInfo = &appInfo;
createInfo.enabledExtensionCount = 0;
createInfo.ppEnabledExtensionNames = NULL;

VkResult result = vkCreateInstance(&createInfo, NULL, &instance);

sentences:
Why is the Tilemap not fitting the screen? I have a background image which I made it in tiled map editor of width 40tiles and height of 8tiles.When I run the game the tilemap bounces with the player and I can see the black portion of the screen.The game screen width and height is 320 by 256.Here is the problem
Play class

sentences:
Destroying instantiated objects stored in a list not working in Unity I have a GameObject with associated a javascript. I have defined a private variable like this:

    private var objects = new Array();

now in the Update method I instantiate new objects and push each obtained reference into the private array like this

    objects.push(newObjectInstance);

when a certain event occurs (i.e. the user press a button in the GUI) I'd like all the objects to be destroyed. I am doing that like this

    for (var i =0 ;i<objects.length; i++){
        Destory(objects[i]);
    }
    objects.clear();

The problem is that although the objects are removed from the array they remain displayed in the Game. What am I doing wrong?

sentences:
How can I orient a circle relative to the position of a 3D object? How can I orient a circle that has a position to a 3D object? If I have a 3D object which is a hemisphere, I would like to let the circle be underneath that hemi-sphere and whenever the hemisphere moves, the circle move with the same angle and position, and underneath it.

In other words, I would like to attach a 2D circle to a hemisphere and parallel to it.

sentences:
How to access `GameObject` to which `MonoBehaviour` is added from C# `Attribute` Unity's RequireComponent inherits from System.Attribute. Somehow they made it that whenever component is added it has a reference to GameObject its being added to. So they can callAddComponent` to it.

I am trying to replicate that behaviour.

My theory is that because UnityEngine.RequireComponent has types stored inside class - they do it by reflection later. In method AddComponent<T> they get T class attributes from type and then try to cast them, get information from them, and apply to GameObject. If that is the case, then I doubt I will be able to do something with it, unless I have access to change AddComponent<T> somehow.

Is there another way around it?(that is no problem to do in code (just extension), but what about how it will work in inspector) Maybe apply different method to Unity`s default component addition.

EDIT

[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class RequireComponentAttribute : Attribute
{
    public RequireComponentAttribute(Type type, int quantity)
    {
        if (quantity < 0)
            throw new ArgumentOutOfRangeException("Required components quantity cannot be negative");
    }

#if UNITY_EDITOR
#endif
}

sentences:
How to create custom methods for sprite groups in pygame? I want to use sprite groups in my game using pygame and the default draw isn't enough. I have tried some tutorials but I failed.

So, being more specific: I want to create custom methods for sprite groups in pygame such as .handle_event (this method can exist at all sprites or not).

sentences:
Unity Click make Jump and Pause I use Unity 5 and I have an issue with my game, when I click on the Pause button my character jumps before the game is paused. My script detects the click for jump before the pause button so for that I add gameObject.tag but doesn't work:

void Update () {
    if (Input.GetKeyDown (KeyCode.Space) && Time.timeScale == 1 || Input.GetMouseButtonDown (0) && Time.timeScale == 1 && gameObject.tag != "Pause") {
        GetComponent<Rigidbody2D> ().AddForce (Vector2.up * force);
    }

http://makeagif.com/i/bmCKQ3:

Look when I click on the pause button it jumps and pauses directly.
How can I click on the Pause button without making my player jump?

sentences:
How to add the concept of entities and components into an isometric tile map? To get some practice with SpriteKit, entities and components I built a little demo.

I created a SKNode subclass (IsometricMapNode) which renders an isometric map. It does so by adding SKSpriteNode (TileSpriteNode) subclasses to itself.

The data of the map is stored in a platform agnostic class IsometricMap which manages IsometricLayers and Tile objects. The map can do things like loading a TMX file and generate tiles which carry information (type of tile, texture name, ...).

The map is then passed to aforementioned IsometricMapNode and displayed.

All is working fine but then I read about GKEntity and I wonder if I can introduce the concept of entities into my code. I was wondering if every tile in my map should be an entity which would then get a render component and maybe a physics component or a particle component.

What I don't understand though: Would my model class Tile become a GKEntity, or its visual cousin TileSpriteNode? Or is it just philosophical?

If Tile is the entity, users of my map would add new entities to it, hopefully with a render component attached to them.

If I keep my Tile model class, the map would internally create entities from this class, add some standard components (mainly rendering) and allow the user to change those components later.

Is this making sense at all? :-)

sentences:
Game not accepted in Google Play even though it's built in 64 bit (Unity) I tried building my game according to the google play rules, but I get the following error message:
"This release is not compliant with the Google Play 64-bit requirement

The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 1.

Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code that it needs. This avoids increasing the overall size of your app."

According to the documentation (https://developer.android.com/distribute/best-practices/develop/64-bit) for Unity I should get a working version when I do:

Set Scripting Backend to IL2CPP
Select the **Target Architecture > ARM64 checkbox
Build as normal

I've built the game both as APK and as AAB, but neither are accepted. I am using Unity 2018.3.14f1.

I have downloaded this NDK: https://dl.google.com/android/repository/android-ndk-r16b-windows-x86_64.zip and put the content to: C:\Users\MyName\AppData\Local\Android

sentences:
Important aspects to consider while making a technical design document I'm working on a open world strategy game for which I'm planning to make technical design documentation.

How do we decide exactly what we need to include to ensure the design document is as complete as it can be?

sentences: How do I play background music in Slick/LWJGL? I'm trying to play music in the background for my opening menu, but cant seem to find a tutorial specifically on how to play a music file. Does anyone know how this can be accomplished?

sentences:
How to get the physical camera sensor size on iOS / Android in Unity I'm trying to get the physical camera sensor size on iOS and Android mobile devices for intrinsics calculations.
On Android the sensor size should be found in the SENSOR_INFO_PIXEL_ARRAY_SIZE (Android CameraCharacteristics API). However I don't find a way to access that array via ArFoundation. I can imagine to write a plug-in for that, but I would also require a plug-in for iOS so I don't know if that's the right way to go.
Is there maybe another (easier) way to get the physical sensor size?

sentences:
In Game Maker Studio, how do I make a sound play only once when I jump on a block? In my Game Maker Studio game, jumping on a musical block should play a note. Currently, if I step on it, the note keeps repeating.

How can I avoid that? I only want the note to play once.

sentences:
Rigidbody & Ray alternative or optimization I am creating an AI that moves around to certain points, but should interact with ais or objects seen.
The ai should find other ai to comunicate or look for objects on the ground.
It works with all those solutions with a low number. But when I have +300 ais the fps drops a lot, caused by Physics2D.FixedUpdate or something related with physics.
How would you deal with this?
I have tried those solutions:

Solution 1
AI:

Rigidbody2D Kinematic
SphereCollider2D Trigger
OnTriggerEnter & Exit Script.

Objects

Rigidbody2D Kinematic
SphereCollider2D Trigger

Solution 2
AI:

Rigidbody2D Kinematic
SphereCollider2D Trigger
OnTriggerStay Script executed each 120 frames & a Coroutine to simulate OnTriggerExit.

Objects

Rigidbody2D Kinematic
SphereCollider2D Trigger

Solution 3
AI:

No RigidBody
SphereCollider2D Trigger
Cone of Rays executed each 2 second to detect colliders at certain layers.

Objects

No RigidBody
SphereCollider2D Trigger

EDIT
In solution 1 and 2, all AI have an "eyes" children GameObject with a TriggerCircleCollider2D and no RigidBody2D, to detect near AIs and GroundObjects.

sentences:
Where to put SFML Window in GameStateManager I have a Pong game using SFML organized after this tutorial.

This is the UML diagram from the tutorial.

Now I am not sure where I should put my SFML RenderWindow variable (and other things that might need to be shared between game states.

I have a PlayingGameState with a shared_ptr to a GameStateManager. So the right place should be the GameStateManager class. Or should I put it into the DirectRenderingGameStateManager and change the shared_ptr to DirectRenderingGameStateManager?

sentences:
UnityEngine.Vector2 does not contian a definition for "Set".... using futile I am a bit lost, I am using futile and I am just trying to run the demo. But I keep getting UnityEngine.Vector2 does not contian a definition for "Set" in just one class, my using statments are:

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

When I look at the documents, I see that Set is a function http://docs.unity3d.com/Documentation/ScriptReference/Vector2.html
I am using version 3.4.2 (in futile its happening in just the FAtlas class)

sentences: Eliminate delay between looping XNA songs? I'm making a game with XNA and trying to get some background music to loop correctly. Because the file is an MP3 of about 30 seconds in length, I instantiated it as a Song. I want it to loop perfectly, but even when I set the MediaPlayer.IsRepeating property to true, there is always a delay of about one second before the song starts up again. Is there any way to eliminate this delay such that the song loops instantly, so it can play more fluently?

sentences:
Unity order issue with TilemapRenderer.Render I'm using unity, with 2D Tilemaps (I'm doing something like an RPG)

I want to have a Tile which should be rendered with a random sprite.

When I use a tile like a tree that is bigger than the tile size and RandomTile, the draw order seems to get confused. Even if the sort order on the Tilemap Renderer is set appropriately, some of the tiles are drawing on top of the other tiles with no consistent pattern.

After stepping through with the Frame Debugger, it looks like all tiles with the same sprite are drawn at the same Draw Dynamic event under TilemapRenderer.Render.

I'm using the following script:

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

#if UNITY_EDITOR
using UnityEditor;
#endif

using UnityEngine;

namespace UnityEngine.Tilemaps
{
    [Serializable]
    public class RandomTile : Tile
    {
        [SerializeField]
        public Sprite[] m_Sprites;

        public override void GetTileData(Vector3Int location, ITilemap tileMap, ref TileData tileData)
        {
            base.GetTileData(location, tileMap, ref tileData);
            if ((m_Sprites != null) && (m_Sprites.Length > 0))
            {
                long hash = location.x;
                hash = (hash + 0xabcd1234) + (hash << 15);
                hash = (hash + 0x0987efab) ^ (hash >> 11);
                hash ^= location.y;
                hash = (hash + 0x46ac12fd) + (hash << 7);
                hash = (hash + 0xbe9730af) ^ (hash << 11);
                Random.InitState((int)hash);
                tileData.sprite = m_Sprites[(int) (m_Sprites.Length * Random.value)];
            }
        }

#if UNITY_EDITOR
        [MenuItem("Assets/Create/Random Tile")]
        public static void CreateRandomTile()
        {
            string path = EditorUtility.SaveFilePanelInProject("Save Random Tile", "New Random Tile", "asset", "Save Random Tile", "Assets");

            if (path == "")
                return;

            AssetDatabase.CreateAsset(ScriptableObject.CreateInstance<RandomTile>(), path);
        }
#endif
    }

#if UNITY_EDITOR
    [CustomEditor(typeof(RandomTile))]
    public class RandomTileEditor : Editor
    {
        private RandomTile tile { get { return (target as RandomTile); } }

        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            int count = EditorGUILayout.DelayedIntField("Number of Sprites", tile.m_Sprites != null ? tile.m_Sprites.Length : 0);
            if (count < 0)
                count = 0;
            if (tile.m_Sprites == null || tile.m_Sprites.Length != count)
            {
                Array.Resize<Sprite>(ref tile.m_Sprites, count);
            }

            if (count == 0)
                return;

            EditorGUILayout.LabelField("Place random sprites.");
            EditorGUILayout.Space();

            for (int i = 0; i < count; i++)
            {
                tile.m_Sprites[i] = (Sprite) EditorGUILayout.ObjectField("Sprite " + (i+1), tile.m_Sprites[i], typeof(Sprite), false, null);
            }
            if (EditorGUI.EndChangeCheck())
                EditorUtility.SetDirty(tile);
        }
    }
#endif
}

Is there any way to fix it?

sentences:
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:
How do I determine the rotation of a Tile using Tilemap in Unity 2d? I want to know the rotation of the tile in C# in order to do some logic on another object that is sitting on the tile. The rotation matters for the logic. I don't see anything except GetTileData in the doc, but that doesn't actually seem to "Get" the tile data. I could cast to Tile but not all tiles are Tile. Alternatively, I think I can get the rotation if I can get the GameObject for the tile but I have no idea how to do that either from a BaseTile.

Anyone have any suggestions? Maybe I'm trying to do this wrong and I should make different tiles for each orientation or extend BaseTile or some other solution instead of trying to determine rotation. Any help or ideas would be greatly appreciated!

Additional info: When I inspect around in the Unity editor I see that the rotation is stored in Z in something called "Grid Selection" but I can't find a programmatic way of accessing that.

sentences:
Raycasting with a selection rectangle box I'm currently making a level editor for my game and want to implement a selection tool to make it easier to select multiple voxels at once.
My question is what the most efficient way is to get all the selected objects?
Do I just unproject the starting position and end position of the selection rectangle and create a bounding box that I then can use for intersection checking or is there a better way?

EDIT: Since I can't rotate a bounding box I need to find another way. I just need a way to find out if the bounding box of a voxel is inside the box that is formed by the four points of the selection.

sentences: Is the 3.x version of the Android SDK compatible with a version 2.1 phone? i am just starting android app development. I was downloading SDK via the Android Manager. I had to select the SDK versions. I have a phone of android 2.1 So i selected only SDK 2.1 and its samples as to download all it takes too much time. If i download the latest SDK 3.X will it be compatible with my mobile?

sentences:
Where is linked_portal_door in the Source SDK? I just made a new mod in the Source SDK. I saw online that there is an entity that allows portals to be created (linked_portal_door). However, I cannot find or create this entity.

Is it included in the base SDK or do you have to have an add-on. If it is not included, is there an alternative?

I am using Source Engine 2007.

sentences:
How do I create multiple 2D spotlights? I'm looking to create a 2D "spotlight" effect that allows a spotlight on multiple entities.  I.e., as if several sprites were holding torches.  For a single entity (one spotlight), I use a technique where I overlay a gradient sprite and have the centerpoint chase that entity.  This technique works fine for a single spotlight.  Here's a screenshot to illustrate what I'm talking about:
Single Spotlight - Works

The problem I run into is that this technique does not extend to multiple entities.  If I overlay another spotlight image I run into several problems.  Here's a simulated screenshot:
Multiple Spotlights = Problems

The most obvious problem is the visible corners.  This could be solved by making the spotlight image gigantic to cover the whole level, but that doesn't feel right.  The second and more intractable problem is that I'm effectively multiplying the darkness with this technique.  So each sprite added has the effect of darkening everybody else.  Clearly I'm approaching this problem incorrectly.
Any ideas?

Continuing Efforts
There's been some discussion of blending options in the comments.  Here's my current thinking.  In my single spotlight example above, I use an image file that looks something like this:  (I've replaced the transparency with the color green to make it easier to illustrate)

As discussed above, the problem is that alpha blending this image with another image is not going to produce the desired effect.  Instead it will produce this:

That doesn't strike me as a blending options issue.  The problem, it seems to me, is that that sort of image has the transparency mask and image (a black square) built in, when they should be separated.
So instead of a black image with a cut-out transparency built-in, I ought to be using transparency masks that are utilized at run time against the black square.  When doing that, I still can't use a traditional white and black transparency mask or it'll run into the same problem.  Here's an example, this time the white and black represent white and black:

The solution, it seems, would be to apply a transparency mask that itself utilizes transparency.  Something like this:  (green = transparent)

That way, multiple transparency masks could be alpha blended together and THEN used as a transparency mask against the black square.  Here's an example of two of the transparency masks alpha blended together:

Anyway, that's the approach I'm working on implementing.  I'll post results if this works.  What I don't know (at present) is if I can use a transparency mask that itself has transparency.

sentences:
Shadow mapping too slow and ugly! As many of you are, I am working on a game.

I have just added my first attempt at shadow mapping (standard variation) and quite frankly I am very disappointed.

I am literally squeezing as much out of this approach as possible and it simply not usable.

Its too slow and too ugly to look at!

So what do people do?

I have bumped into something called "Perspective shadow mapping" but I have not got any working examples of this yet and I don't really want to spend a long time working on this only to find that its too slow to use and not all that much better.

So what I am asking for is some feedback on your experiences and how you overcome all the problems with shadow maps.

Some details are:
I have a single light (point light)
Standard first person type game
The light moves (all the time, but slowly)
The draw distance is not very far

If I don't use shadows then the game runs at 500 FPS, and with shadows it drops to 90!

Edit:
As I have said, I have put a lot of effort into this so I have already solved:
Getting the tightest possible near/far
Getting the tightest X/Y (without constant change per frame)
I have no peter panning
No acne

But, due to the fact that my light moves all the time I get constantly (shaking) shadow pixels.

And the only way I am able to make the shadows look crisp/and stop shaking is to make the shadow map ridiculously high resolution. And this then drops the frame rate too much.

I understand all the problem, but what I want to know is what do people rely do to solve the problem. People cant really be using this in games as its just no good.

I am also looking into cascaded Shadow Mapping. That looks to be the solution. What are people experience with this?

sentences:
Import from mesh vs hardcoded vertices performance Which brings better performance at run-time: a cube imported from a mesh, or a cube made from hardcoded vertices?

Are there limitations to a certain method? Is one of them better architectural-wise?

sentences:
Player not detecting layermask I'm trying to implement a simple collision detection for my player but it is not detecting the layer mask as my Player comes into contact with it. I have a move point that moves slightly ahead of the player, and if it comes in contact with the StopMovement layermask then it should NOT move any further. Unfortunately, the layer is never detected and therefore the player just moves right through the object.
Script:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    public float moveSpeed = 5f;
    private float moveHorizontal;
    private float moveVertical;

    public Transform movePoint;

    public LayerMask whatStopsMovement;

    // Start is called before the first frame update
    void Start()
    {
        movePoint.parent = null;
    }

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

    private void FixedUpdate()
    {
        transform.position = Vector3.MoveTowards(transform.position, movePoint.position, moveSpeed * Time.fixedDeltaTime);

        // stops the movePoint from going too far
        if (Vector3.Distance(transform.position, movePoint.position) == 0f)
        {
            if (Mathf.Abs(moveHorizontal) == 1f) // makes it so we can check if 1f OR -1f without == 1f || -1f
            {
                if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(moveHorizontal, 0f, 0f), 0.2f, whatStopsMovement))
                {
                    Debug.Log("No collision");
                    movePoint.position += new Vector3(moveHorizontal, 0f);
                }
                else
                {
                    Debug.Log("Collision");
                }
            }

            else if (Mathf.Abs(moveVertical) == 1f) // makes it so we can check if 1f OR -1f without == 1f || -1f
            {
                if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(moveVertical, 0f, 0f), 0.4f, whatStopsMovement))
                {
                    Debug.Log("No collision");
                    movePoint.position += new Vector3(0f, moveVertical);
                }
                else
                {
                    Debug.Log("Collision");
                }
            }
        }
    }
}

Any help at all is appreciated.

sentences:
OpenGL and Java user interface architecture/comunication I'm working on the UIs for a turn based tactical rpg made with Java and LWJGL.
I'd like to make a set of "dynamic" UIs similar to those of the game Torchlight 2. I would like to know if there are any good technique (or article) for build UI's architecture and regarding the comunication between UI and game (to handle, for example, events like button clicking).

sentences:
GLSL Bokeh using Quads and Textures I'm trying to create a depth of field effect with bokeh sprites in GLSL. Specifically, what i would like to do is, for each pixel:

See if the pixel is out of the focal range
If it is, draw a quad and apply a texture to provide a bokeh sprite.

This kind of implementation is seen in the Unreal Engine and by Matt Pettineo, however, both implementations are in DX11 and I'm using OpenGL.

I'm a bit stuck on the drawing a quad and applying a texture bit. Does anyone know how I can do this, or provide any relevant links as to how I can do this?

Thanks

sentences:
How can I center a circle around a point on an HTML canvas? I've got a job to make an engine and light game for canvas in HTML5. I like the things I make to be centered on the x,y positions I give it, I don't know why, it just helps me think about them clearer. I've got it set up for rectangles, all I had to do was subtract half the hieght and half the width from the x/y supplied like this:

c.fillRect(x-width/2,y-height/2,width,height);

But I'm rather stumped when trying to do this with arcs. At first I thought it would be simple, I just did this:

c.beginPath();
c.arc(x-rad/2,y-rad/2,rad,0,Math.PI*2,false);
c.closePath();

But here's how they look when I try them out, 4 rects of increasing width/height and 4 circles of increasing radius.

Does anyone know the math needed to calculate the correct offset for arcs?

sentences:
How do I write a simple 2-player server? I've recently started learning JavaScript and HTML and developed simple 2-player game such as tick-tack-toe, battleship, and dots & boxes. However, these 2P games can only be played on one computer (i.e. the 2 players must sit together).

I want them to be able to play with a friend on a different computer.

Would anyone have a general, simple working example of a web-game server?

sentences:
Detecting Hitbox Collisions (Rectangle) So I have some Hitboxes set up on 2 classes, HealthPickup and Player.

public static Rectangle Hitbox;

public override void Initialize()
{
    Hitbox = new Rectangle(Pos.X, Pos.Y, 32, 32);
}

That's just general code, there are other things in the classes too. So what I want to know is why this doesn't work:

// This is in the HealthPickup class' Update function.
if (Hitbox.Intersects(Player.Hitbox))
{
    Console.Beep();
}

Doesn't work if I put it in the main update function either. Am I missing something?

sentences:
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:
Translating ChainShape to world coordinates according to touch drag input I'm trying to draw a ChainShape according to touch screen coordinates, however the coordinates are slightly off from my touch coordinates. I translate the chain drawn on the screen to world coordinates but don't think I've done it correctly.

I tried setting the shape's position to the first vertex but it positions it even further from the original touch coordinates. Can someone please help me understand where I'm going wrong?

public class Play implements Screen {
    private static final float TIMESTEP = 1 / 60f;
    private static final int VELOCITYITERATIONS = 8, POSITIONITERATIONS = 3;

    private Box2DDebugRenderer debugRenderer;
    private OrthographicCamera camera;
    private PolygonSpriteBatch batch;
    private World world;

    private List<Float> chain_verts = new ArrayList<Float>();
    private float[] chain;

    @Override
    public void show() {
        world = new World(new Vector2(0f, -9.81f), true);
        debugRenderer = new Box2DDebugRenderer();
        camera = new OrthographicCamera();
        batch  = new PolygonSpriteBatch();

        InputProcessor input_0 = new GestureDetector(new Gesture() {
        }) {
            @Override
            public boolean touchUp(float x, float y, int pointer, int button) {
                if (chain_verts.size() != 0) {
                    chain = new float[chain_verts.size()];
                }

                for (int i = 0; i < chain_verts.size(); i++) {
                    chain[i] = chain_verts.get(i);
                    System.out.print(chain[i] + " ");
                }

                ChainShape chainShape = new ChainShape();
                chainShape.createChain(chain);

                Vector3 mouse = new Vector3();
                camera.unproject(mouse.set(Gdx.input.getX(), Gdx.input.getY(), 0));

                BodyDef bodyDef = new BodyDef();
                bodyDef.type = BodyType.StaticBody;
                bodyDef.position.set(mouse.x , mouse.y);

                FixtureDef fixtureDef = new FixtureDef();
                fixtureDef.shape = chainShape;

                world.createBody(bodyDef).createFixture(fixtureDef);

                chain_verts.clear();
                chainShape.dispose();

                return super.touchUp(x, y, pointer, button);
            }

            @Override
            public boolean touchDragged(float x, float y, int pointer) {
                chain_verts.add(x);
                chain_verts.add(Gdx.graphics.getHeight()-y);
                return super.touchDragged(x, y, pointer);
            }
        };

        Gdx.input.setInputProcessor(input_0);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS);

        camera.position.set(0, 20, 0);
        camera.update();

        batch.setProjectionMatrix(camera.combined);

        debugRenderer.render(world, camera.combined);
    }

    @Override
    public void resize(int width, int height) {
        camera.viewportWidth = 1200;
        camera.viewportHeight = 800;
    }

    @Override
    public void pause() {}

    @Override
    public void resume() {}

    @Override
    public void hide() {
        dispose();
    }

    @Override
    public void dispose() {
        batch.dispose();
        world.dispose();
        debugRenderer.dispose();
    }
}

sentences:
How do I control an animation with a drag command? I want to play an animation when someone drags a sprite from it's default position to another selected position. If they drag half of the selected position then animation will be play half. For example, I have 15 frames of a animation for a projectile arm. The projectile arm can be rotated a maximum of 30°, if someone rotates the arm 2° then the animation sprite should show the 2nd frame, if rotated 12° then the animation sprite should  show the 6th frame.... and so on.
Also when they release the arm, the arm will be reverse back to it's default position and animation frames also will be reverse back to the default first frame.

I am new on cocos2D. I know how to make an animation and how to drag a sprite but I have no idea how to combine them. Can anyone give me an idea or any tutorial on how to do this?

sentences:
How I get the value from different class i get error , i cant get the value from different class..

public class First1 : MonoBehaviour {
    private List<IFirstListener> listeners = new List<IFirstListener>();
    public int watt;
    void OnTriggerEnter2D(Collider2D theCollider)
    {
        try {
            CharacterA characterA = theCollider.GetComponent<CharacterA>();
            this.watt += characterA.watt;
            for (int i = 0; i < listeners.Count; i++) {
                listeners[i].OnBaterryPluggedIn(this, characterA, characterA.watt);
            }
        }
        catch { /*On error do nothing*/ }
    }

    void OnTriggerExit2D(Collider2D theCollider) {
        try {
            CharacterA characterA = theCollider.GetComponent<CharacterA>();
            this.watt -= characterA.watt;
            if (characterA != null) {
                for (int i = 0; i < listeners.Count; i++) {
                }
                    listeners[i].OnBaterryPluggedOut(this, characterA, characterA.watt);
            }
        }
        catch { /*On error do nothing*/ }
    }

i want to get the value var watt and assign to tott.. (tott = watt)

public class Second2 : MonoBehaviour {
    private List<ISecondListener> listeners = new List<ISecondListener>();
    public int tott;

    public void cek (){
        tott = watt; /* <--- how i can get the value from var watt at class First() to var tott?? */
    }

sentences:
UDK Modular construction (customisable vehicles etc) I'd like to build an interface whereby the user can attach various components and blocks onto a vehicle, this is then saved (as object/coordinate, rotation, scale values - in database) and can be used again later.

After looking into sockets I haven't been able to find a way of saying connect ObjectA's SocketOne to ObjectB's SocketX with rotation Z and Scaling V for instance.

If that sounds infeasible to you (which it may well be), is there another way of scripting 2 objects to be "joined", so they act as one item when they move/animate?

   Create ObjectA at 0,0,0
   Create ObjectB is at 10,0,0
   ObjectA.link(ObjectB)

I would like the sub objects to still be animated etc (like meshes connected to sockets can)

If anyone has any pointers they would be greatly appreciated.

Thanks,
Martin

sentences: OpenGL ES 2.0 facet lighting I am trying to figure out if there is a way to achieve facet lighting in OpenGL ES 2.0 without extensions. I know it is possible if I don't used indexed vertices but I don't really want to do that because it is a bit wasteful. I have seen people use dFdx and dFdy to achieve this in the shader but unfortunately they are only avaible with extensions here. Are the other options or is there perhaps a way to implement these functions manually?

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:
Rotate the player in a certain way that makes it look like he is sliding I'm trying to make my first game in Unity: a 3d platformer inspired by the classic Crash Bandicoot games.
I've managed to make most of the movement with the character control script below. However, I don't know how I can do a slide/crouch.
What I want to do is to rotate and move the player down closer to the ground and give him some more speed that decreases over time until he reaches a normal waking state.

I thought about making the player rotate on a specific axis but when he turns the axis doesn't change so now I'm kind of lost in what to do.
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    public CharacterController controller;

    public float speed = 10f;

    //turnning smoothness

    public float turnSmoothTime = 0.1f;
    float turnSmoothVelocity;

    //jump controls

    public float jumpHeight = 3f;
    public float gravity = -29.43f;
    Vector3 velocity;
    bool isGrounded;

    //gravity check
    public Transform groundCheck;
    public float groundDistance = 0.4f;
    public LayerMask groundMask;

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

        if(isGrounded && velocity.y < 0)
        {
            velocity.y = -1f;
        }

       //player movement on both axis

        float horizontal = Input.GetAxisRaw("Horizontal");
        float vertical = Input.GetAxisRaw("Vertical");

        Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;

        velocity.y += gravity * Time.deltaTime;
        controller.Move(velocity * Time.deltaTime);

        if (Input.GetKeyDown("space") && isGrounded)
        {
            velocity.y += Mathf.Sqrt(jumpHeight * -2f * gravity);
        }

        if (direction.magnitude >= 0.1f)
        {
            //player turning depending on where moving

            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            controller.Move(direction * speed * Time.deltaTime);

        }

    }
}

sentences: How can I make an movieclip move in a circular path with GTween? How can I make an movieclip move in a circular path with GTween? it's straightforward to have something move with various easing effects in a line or a curve, but I would need a complete circular path.

sentences:
How do I create an installer for my XNA demo? I have a demo coded in XNA3.1 using VS2008. I'd really love to be able to send this to anyone with a PC and let them install and run it without requiring them to have VS installed or the .Net framework etc.

I thought it would be the publish option but I'm a little confused by it. Can anyone shed some light on the matter?

Thank you in advance.

sentences:
How to receive a Knock Back when the player touched the enemy I'm still new to C#, making my 2D game atm and my problem is how can I give my player a Knock Back when it touches the enemy. How to add it with this code?

public int health;

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Enemy"))
    {
        health -= 20;
        //Check for death
        if (health <= 0)
        {
            gameObject.SetActive(false);
        }
    }
}

sentences:
Implementing multithreaded loading screens Ok, I have fairly little multi-threading experience, but i have done a similar thing before without issue...but this has me stumped.

This is in C++, Directx9 Visual Studio...

My game basically runs in one thread, apart from loading screens. When I want to load a new game, I fire up a new thread which goes through and does all of the simulation and asset loading stuff. Meanwhile, the original (base) thread displays an animated loading screen.
Once the loading is finished, the loading thread sets a flag in tjhe loading screen saying it's done, and during the loading screens Draw() it spots the flag, ends the 'loading' thread, and starts the main game.

All of this works perfectly, in debug and release.

Except fullscreen...

For some reason, if I run the game in fullscreen mode, it goes wrong. The game hangs at the end of loading, and it looks like the flag in the loading screen is never getting set. if I force a debug break into the base thread, it seems to always be inside the D3D flip().

I can't see what I'm doing wrong. The loading thread does zero rendering. It creates some directx assets but never uses them. The flag I'm using to communicate between threads is a simple int, and it's read/write should thus be atomic.
I've done a very similar thing in my previous games with no problems, but this has me stumped. Should I really be using CriticalSections etc for something this simple?
Help!

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

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

sentences:
Does SFML support these specific features that I require? I've been working on a game in c++ for about a week and a half, and I've been using SDL. However, my current engine only needs the following from whatever library I use:

enable double buffering
load an image from path into something that I can apply to the screen
apply an image to the screen with a certain x,y
enable transparency on an image
(possibly) image clipping, for sprite sheets.

I am fairly sure that SFML has all of this functionality, I'm just not positive. Will someone confirm my suspicions?

sentences:
How would I properly flip a character when they reach the edge of a ground object in Unity 2D? The idea here is that the raycast shoots downwards from an empty game object and when it detects that there is no ground below it the character should bounce back and walk the other way. When I get to the edge of my platform the character just gets stuck in place and keeps rotating on the Y axis.

public class npcAI : MonoBehaviour
{
public float speed;
public float distance;
private bool movingRight = true;
public Transform groundDetection; //raycast goes downward from this point

private Vector2 movementDirection;

void Start()
{
    //Initialise direction
    movementDirection = Vector2.right;
}

void Update()
{
    transform.Translate(movementDirection * speed * Time.deltaTime);
    RaycastHit2D groundInfo = Physics2D.Raycast(groundDetection.position, Vector2.down, distance);
    if (groundInfo.collider == false)
    {
        if (movingRight)
        {
            movingRight = false;
            movementDirection = Vector2.left;
      transform.localScale -= new Vector3(0.30F, 0, 0);

        }
        else
        {
            movingRight = true;
            movementDirection = Vector2.right;
      transform.localScale += new Vector3(0.30F, 0, 0);
        }

    }
}

The code above was edited to reflect the answer below. If you find yourself attempting to do the same thing and need to flip your sprite when you reach the edge change 0.30F to whatever double the X value of your sprite is in order to flip it. My sprites scale was (0.15, 0.15, 0) so I used 0.30F to flip my sprite. Be mindful of when you should use -= and when you should use +=.

sentences:
How do I write an interface for the keyboard and mouse input? I have started to develop a simple 3D engine. I use OpenGL for rendering, and it is developed for Windows. It is all written in C.

How do I write an interface for the keyboard and mouse input? I would like to keep it as simple as possible - in contrast to the native Win32 input system.

sentences:
Turning a game into a server-client game I'm redoing a game i wrote in XNA to Unity. The XNA game was the client to a server I wrote as a console application.

How does Unity work with a server exactly, and how do you set that up?

sentences:
Getting Started with Component Architecture: DI? TLDR:  if I have entities like Ship and Bullet and components like Positionable and Drawable, should I create interfaces for each component and inject them into my entities using DI, or should I be doing something else?

(In this case, Ship would extend IPositionable and have an instance of a PositionableComponent which is injected by DI. Any calls to ship.getX or ship.setX would be implemented as myPositionable.getX or myPositionable.setX.)

I just moved away from MVC towards something more component-architecture-like. I have no concept of messages yet (it's rough prototype code), objects just get internal properties and values of other classes for now.

That issue aside, it seems like this is turning into an aspect-oriented-programming challenge. I've noticed that all entities with, for example, a position component will have similar properties (get/set X/Y/Z, rotation, velocity).

Is it a common practice, and/or good idea, to push these behind an interface and use dependency injection to inject a generic class (eg. PositionComponent) which already has all the boiler-plate code?

(I'm sure the answer will affect the model I use for message/passing)

Edit: The DI model I'm proposing is as follows.

Create entity classes like Ship and Bullet
Create interfaces to represent these components. Eg. I can expect a PositionableComponent.getX method.
Create component classes like PositionableComponent, DrawableComponent which implement my interface
Entities like Ship will have components like PositionableComponent. They will implement the methods by internally keeping an instance of a positionalbleComponent and redirecting all interface calls to the component.
My DI framework will (presumably automatically) wire up components by interface, eg. Ship._positionableComponent = new PositionableComponent(). This is how NInject works, which is the only framework I've ever used (and I'm working in Haxe now).

This will allow me to work on a higher level (ships contain components), and reduce boilerplate code (component implementations), but introduces duplicate code (redirecting to the internal component). Since I'm working in Haxe, I may be able to avoid writing that boilerplate by hand.

However, the advantage is that I can override component behaviours. If undeadMonster.IsAlive() should return true when its HP is above -100 (instead of 0), I can easily code this, and the change becomes very visible from the code level.

But I'm not sure if I'm solving this correctly.

sentences:
Cant center screen between black bars As I was trying to adapt my game to different device resolutions I ran into a problem when adjusting the game screen between the "black bars." In my case I am using the FitViewport class from the LibGdx library to add the black bars for me. Everything works fine and the black bars (one bar in my case) are being effectively created when necessary. My problem, however, is that my screen is not centered and I end up with one ugly black bar either to the top, bottom, right, or left of my game. For example:

How can I fix this so it looks like this:

Here is my code:

public class NordicMadness extends Game implements ApplicationListener{
    private Camera camera;
    public static FitViewport viewport;

    @Override
    public void create () {
        camera = new PerspectiveCamera();
        viewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera);
        AssetLoader.loadAssets();
        setScreen(new SplashScreen(this));
        System.out.println(Gdx.graphics.getWidth() + ", " + Gdx.graphics.getHeight());
    }

    @Override
    public void dispose(){
        super.dispose();
        AssetLoader.dispose();
    }

    @Override
    public void resize(int width, int height) {
        // All resizing shall be done in main Game class
        viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getWidth(), true);
    }
}

The libgdx API states that adding true to the third argument of viewport.update(width, height, boolean center) should do the job but it's not working in my case.

After this I tried doing the following but with no success:

public void resize(int width, int height) {
        // All resizing shall be done in main Game class
        ScalingViewport scalingViewport = (ScalingViewport)viewport;
        float leftGutterWidth = scalingViewport.getTopGutterHeight();
        viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getWidth()); // Resize screen
        camera.position.set(0, Gdx.graphics.getHeight() - (leftGutterWidth / 2), 0);
    }

sentences:
Excluding some scene elements from bloom effect I've enabled HDR and bloom effects in my SceneKit app, but I don't want some of the elements in my scene to bloom.

For example, the lighter spots on the skybox are currently glowing.

Is there some way I can stop those elements from glowing selectively?

sentences:
How do I use images with copyright in my game? Our game requires to show images from movies, cartoon characters, etc. but we don't know how we can include them.

We have seen that games like QuizUp and other guess the pic like games have images from Disney characters, Pokemon or company logos, etc.

How does it work? Is this usage considered fair use?

sentences:
Is the TCP protocol good enough for real-time multiplayer games? Back in the day, TCP connections over dialup/ISDN/slow broadband resulted in choppy, laggy games because a single dropped packet resulted in a resync. That meant a lot of game developers had to implement their own reliability layer on top of UDP, or they used UDP for messages that could be dropped or received out of order, and used a parallel TCP connection for information that must be reliable.

Given the average user has faster network connections now, can a real time game such as an FPS give good performance over a TCP connection?

sentences:
Why is my gravity script repelling and not attracting? I'm currently working on a small simulation of Newton's Law of Gravitation in Unity3d, and it seems to be working pretty well, except, it's doing the opposite of what I expected. Instead of attracting as it should, this script is repelling objects instead:

using UnityEngine;

/// <summary>
/// Gravity component.
/// </summary>
public class GravityComponent : MonoBehaviour
{
    public float gravityConstant;
    public Vector3 startingForce;
    public GameObject twinObject;

    /// <summary>
    /// Applies attraction to the object.
    /// </summary>
    public void ApplyAttraction()
    {
        Vector3 currentForce = this.transform.position - this.twinObject.transform.position;
        float attraction =
              ((this.gravityConstant * this.rigidbody.mass * this.twinObject.rigidbody.mass)
            / (Mathf.Pow(currentForce.magnitude, 2)));
        this.rigidbody.AddForce(currentForce * attraction);
    }

    public void Start()
    { this.rigidbody.AddForce(this.startingForce); }

    public void FixedUpdate()
    { this.ApplyAttraction(); }
}

While it is possible to "fix" this by making the result of the attraction calculation negative as seen below, this solution feels "dirty", as it's not truly following Newton's Law of Gravitation.

float attraction =
      -((this.gravityConstant * this.rigidbody.mass * this.twinObject.rigidbody.mass)
    / (Mathf.Pow(currentForce.magnitude, 2)));

What's the issue here? Is there a way to solve this issue without the above "dirty" fix?

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:
Should I render all of my HUD views to a single SurfaceView? I'm using a SurfaceView and canvas to implement a game HUD, title screens etc., by overlaying standard Android view widgets over my SurfaceView. This works reasonably well and maintains an acceptable frame-rate, but it is a simple game with little happening on or off screen.

I have handlers flinging messages around and runOnUiThreads everywhere. Quite cumbersome. Can I draw all my views to the one SurfaceView, controlled by the main game thread? Is there an advantage to this?

sentences:
Are polygon normals really shadeable? Garry's Mod has a copy-protection trap that shows this error:

  Unable to shade polygon normals

It made me wonder if such a problem could ever actually exist.  Can polygon normals be shaded? Is a failure to do so detectable and reportable?

sentences:
How to make score points based on time So the idea is simple.
a) Players why finish the level faster, should get higher score.
b) The levels (1 to N) where every next becomes more difficult should impact the score.
So it's kind of mix of "time to complete" and "level number".
If would know the fastest possible time the user can complete the level, I would do the fallowing:
a) If player completes the level in fastest time, it gets max score 100.
b) If it takes, for example, twice as long I divide by 2 and get 50.
c) Then I multiple by the level number assuming that every next level is twice as difficult.
Example: Player completes level N two times slower than fastest time, so: Score = 100/2 * N = 50N
But the problem is that I can't really figure out the this fastest time for each level, because my game is a complex randomized 4d maze and I have no idea how fast a pro gamer can complete it to define the max score. And without that I have no idea how to calculate the score.
This question is all about: "Can we figure out the score without knowing the fastest time"
Any help appreciated.

sentences:
How can I see whether my sprite is .png or .jpg in the Inspector view or some place alike in Unity? How can I see whether my sprite is .png or .jpg in the Inspector view or some place alike in Unity?

Here is an example of me trying to get the file extension using Editor:

sentences:
Is running cron jobs every minute a good practice for browser-based games? I'm trying to create a browser-based game (made in PHP, MySQL, Js, HTML, and CSS) that is heavily dependent on user's actions being carried out after a certain amount of time passed whether online or offline. Will running cron jobs every second/minute a good practice or a solution to my problem?

Please check out this question first before answering, I ask this new question to focus more on the pros and cons of using cron jobs. To be more specific, here's a list of the things that I want to know:

Scalability? Up to what extent?
Performance? How fast? How slow?
Server Overhead? Will a normal server be able to accommodate the load?

Assuming the game will be an MMO.

I appreciate all the help people! Thanks in advance!

sentences:
Xna, after mouse click cpu usage goes 100% Hi i have following code and it is enough just if i click on blue window then cpu goes to 100% for like at least one minute even with my i7 4 cores. I just check even with empty project and is the same !!!

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    private Texture2D cursorTex;
    private Vector2 cursorPos;
    GraphicsDevice device;

    float xPosition;
    float yPosition;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);

        Content.RootDirectory = "Content";

    }

    protected override void Initialize()
    {
        Viewport vp = GraphicsDevice.Viewport;

        xPosition = vp.X + (vp.Width / 2);
        yPosition = vp.Y + (vp.Height / 2);
        device = graphics.GraphicsDevice;
        base.Initialize();
    }

    protected override void LoadContent()
    {

        spriteBatch = new SpriteBatch(GraphicsDevice);
        cursorTex = Content.Load<Texture2D>("strzalka");
    }

    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {

        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(cursorTex, cursorPos, Color.White);
        spriteBatch.End();
        base.Draw(gameTime);
    }
}

sentences:
Adding a simple mix() destroys the framerate I have a very simple shader and added linear fog via mix like this:

finalColor = mix(finalColor, vec3(0.5, 0.8, 0.95), vUVoutAndViewZ.z);

Note that the view Z distance is in the variable that also contains the UV coordinates, so the fog didn't even add a new interpolator.

Still, this one innocuous line brought the framerate on the OG Droid with the Power SGX chipset from 33fps to 22fps. Even the HTC Evo with the Adreno 200 GPU stays under 30fps. (The Adreno 205 is at a constant 60fps, but that thing is a beast).

The fragment shader itself is primitive (all values are hard-coded since it's a test shader):

precision mediump float;
varying mediump vec3 vUVoutAndViewZ;
varying lowp vec3 vNormalOut;

uniform lowp sampler2D diffuse;

void main() {
    lowp vec3 normal = vNormalOut;

    // Lighting
    lowp vec3 lightDir = vec3(0.5, 0.3, 0.5);
    lowp vec3 light = vec3(dot(normal, lightDir));

    lowp vec3 diffuse = texture2D(diffuse, vUVoutAndViewZ.xy).rgb;

    lowp vec3 finalColor = diffuse * light;

    // Fog
    finalColor = mix(finalColor, vec3(0.5, 0.8, 0.95), vUVoutAndViewZ.z);

    gl_FragColor = vec4(finalColor.xyz, 1.0);
}

I added the lowp/mediump declarations later (which added about 2fps), it works just as bad without them.

I refuse to believe that the PowerVR chipset is so weak that it can't handle a simple shader like this. There must be something stupid in this shader (like something implicitly swizzling a lowp register) that just completely messes up the unit.

ANSWER and EDIT:

Ellis has some fantastic information in the answer and the subsequent comments. In this particular case, it seems that mix() is flat-out broken. It brought the shader to 12 cycles (from 4) and 4 GPRs (from 2). I got back to 29fps by using this code instead:

lowp vec3 fogDiff = vec3(0.5, 0.8, 0.95) - finalColor;
fogDiff *= vUVoutAndViewZ.z;
finalColor += fogDiff;

sentences:
Converting 3D coordinates to 2D and back? I'm wondering if there is a simple way to convert 3D coordinates to 2D coordinates. Also, if it's possible, to convert in the reverse direction.

I'm using OpenGL(GLUT) in my C++ project.

I am also using SFML for the 2D information (sprites text etc.)

I found out that I can use gluProject(), but I have no idea how to use this.

I'm asking for a simple example of using gluProject() or another example to convert 3D coordinates (such as from the player) to 2D coordinates.

If I can't get the simple process I'm confident that I can figure out the rest.

sentences:
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:
Bullet pointer becoming zero I am currently trying to implement the Bullet physics into my game project. However, when i add some rigid bodies to the scene, i occasionally get an error in btDbvtBroadphase.cpp at the line
  if(proxy->stage==STAGECOUNT) (line 294).

If i then inspect the proxy pointer, it points to 0x0. If I go back to the function btCollisionWorld::updateSingleAabb(btCollisionObject * colObj) on the call stack, and inspect the member m_broadphaseHandle, it is non-zero, which is being passed as first parameter to btDbvtBroadphase::setAabb(btBroadphaseProxy* absproxy, const btVector3& aabbMin, const btVector3& aabbMax, btDispatcher* __ formal).
In this method it is being cast into a btDbvtProxy pointer and stored in proxy. What I don't get here is, why proxy becomes 0x0, even though a valid pointer is being passed to the function.

The call stack looks like this:

MyProject.exe!btDbvtBroadphase::setAabb(btBroadphaseProxy * absproxy, const btVector3 & aabbMin, const btVector3 & aabbMax, btDispatcher * __formal) Line 294   C++
MyProject.exe!btCollisionWorld::updateSingleAabb(btCollisionObject * colObj) Line 171   C++
MyProject.exe!btCollisionWorld::updateAabbs() Line 204  C++
MyProject.exe!btCollisionWorld::performDiscreteCollisionDetection() Line 220    C++
MyProject.exe!btDiscreteDynamicsWorld::internalSingleStepSimulation(float timeStep) Line 492    C++
MyProject.exe!btDiscreteDynamicsWorld::stepSimulation(float timeStep, int maxSubSteps, float fixedTimeStep) Line 452    C++

The initialization of bullet looks like this:

broadphase = new btDbvtBroadphase();
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
solver = new btSequentialImpulseConstraintSolver;

world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
world->setGravity(btVector3(0.0f, -10.0f, 0.0f));

I create RigidBodies procedurally and this is, how I add them:

bp.mesh = new btTriangleMesh(true, false);

for (int i = 0; i < bp.numFaces; ++i)
{
    btVector3 a(vertices[indices[i * 3 + 0]].position.x, vertices[indices[i * 3 + 0]].position.y, vertices[indices[i * 3 + 0]].position.z);
    btVector3 b(vertices[indices[i * 3 + 1]].position.x, vertices[indices[i * 3 + 1]].position.y, vertices[indices[i * 3 + 1]].position.z);
    btVector3 c(vertices[indices[i * 3 + 2]].position.x, vertices[indices[i * 3 + 2]].position.y, vertices[indices[i * 3 + 2]].position.z);
    bp.mesh->addTriangle(a, b, c);
}

btMotionState* ms = new btDefaultMotionState;
btBvhTriangleMeshShape* shape = new btBvhTriangleMeshShape(bp.mesh, true);

sect->rigidBody = new btRigidBody(0.0f, ms, shape);

btWorld->addRigidBody(sect->rigidBody, 64, 128);

My question now is, why proxy occasionally points to 0x0, even though it should be a valid pointer? I downloaded and successfully compiled bullet-2.82-r2704 with VS2012 and changed the project settings from /MT(d) to /MD(d), if this does matter.

Edit: I may also mention that the rigid bodies are added in a different thread, than the thread in which I initialize and simulate the bullet physics. Can this cause any problems?

sentences: Getting help on collaboration with Unity especially programmers My team and I are currently creating a 3D tower defense game with Unity and are compromised of me a few animators modelers and programmers. However as I am still fairly new to Unity I have trouble figuring out ways to collaborate with them. I know not what practices or advice I could get on the front of developing this game. I was hoping someone here might have some insight as to how best to collaborate with all team members and what one might do to get a better flow of information and help or assistance when working on this project. We are all about an hour or more away from each other so we must work remotely to collaborate. Thank you in advance.

sentences:
Correctly transforming normals for G-Buffer in Deferred Rendering I have a deferred rendering system: first there is the G buffer generation, then there is the lighting or shading calculation on that gbuffer data.

However there seems to be an issue with various rendering algorithms and I can’t determine why that is. I think it’s because my normal’s Gbuffer texture or other G buffer texture does not have the proper format or space in terms of world space, tangent  space etc.

The algorithms that rely on normal information such as normal oriented ambient occlusion and parallax occlusion mapping don’t work they just look wrong And not what they’re supposed to be by a long shot.

In the G buffer generation stage, my vertex shader simply passes along world space vertex positions and world space normals to the Gbuffer's fragment shader. I do this by multiplying the world matrix or model matrix by the normal and by the position. In the fragment shader I then write these out as is to the G buffer.

Is this correct? Should I be passing along the Raw position & normals to the fragment shader and then multiplying the matrices in the fragment shader instead?

Edit 1:

Ok, So using the "normalMatrix" didn't change anything.  Here is a screen shot of my ambient-occlusion pass demonstrating the issue.  There is a screen space split that basically inverts the colors. and some other oddities.

The SSAO Shader is As Follows.

void main()
{

vec3 WorldPosition = texture(GPositionsTexture, In_TexCoords).xyz;
vec3 WorldNormal = normalize(UnScaleNormal( texture( GNormalsTexture, In_TexCoords ).xyz ));

vec3 Random = texture(KernalNoiseTexture, In_TexCoords * KernelNoiseScale).xyz;
vec3 Tangent = normalize(Random - WorldNormal * dot(Random, WorldNormal));
vec3 BiTangent = cross(WorldNormal, Tangent);
mat3 TBN = mat3(Tangent, BiTangent, WorldNormal);

float Occlusion = 0.0;
for (int i = 0; i < KERNEL_SIZE; ++i)
{
    // get sample position:
    vec3 Sample = TBN * Kernel[i];
    Sample = Sample * Radius + WorldPosition;

    // project sample position:
    vec4 Offset = vec4(Sample, 1.0);
    Offset = CamData.Projection * CamData.View * Offset;
    Offset.xy /= Offset.w;
    Offset.xy = Offset.xy * 0.5 + 0.5;

    // get sample depth:
    float SampleDepth = texture(GPositionsTexture, Offset.xy).z;

    // range check & accumulate:
    float RangeCheck= abs(WorldPosition.z - SampleDepth) < Radius ? 1.0 : 0.0;
    Occlusion += (SampleDepth <= Sample.z ? 1.0 : 0.0) * RangeCheck;
}

Occlusion = 1 - (Occlusion / KERNEL_SIZE);

Out_Diffuse = pow(Occlusion, Power);
}

sentences:
How to fuse 2 sprites as they approach each other in Unity2D? Hi i seen this video by Sebastian Lague on ray marching. Link: https://www.youtube.com/watch?v=Cp5WWtMoeKg&t=204s At 3:19 mins.

I want this merging effect but for 2D sprites. Please can someone instruct me on how it can be made or the steps to make it.

sentences:
Implement an action "while" touching event I'm making a game using Xcode for iOS. This is a segment of code I have that makes the sprite jump up when the screen is tapped:

//tap/touch to jump (& play sound)
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event{
       [self playSound];
       jumpUp = 16;
}

It's pretty simple to achieve that, but how can I implement it so that the sprite just keeps going up whist you are touching the screen instead of just a single tap?

//Simple pseudo code:
while touchingScreen Event {
    jumpUp +=1;
}

sentences:
The A * algorithm in the map has many moving objects I am using the A * algorithm for my game, it is a kind of Isometric map with lots of tiles. If all the game objects are trees, rocks, houses and only one game object is a moving hero, the A * algorithm works well because then all objects are objects static except for my hero. I use a function: Check_Block (i, j) where i is the row and j is the column of the map. This function will return false if at that location there is a rock or house or tree, etc. But if there are many heroes moving together, I will not be able to use this function because the heroes are not in position permanent.

I have a solution if the hero is in a certain cell, Map [i] [j] = Hero. But if there are many heroes in the same box, I think this solution no longer good.
Can someone show me a solution?

sentences:
How to shoot on direction of touch I'm new to the Corona SDK(and I also suck in trigonometry) and I'm trying to achieve this:

Shoot a bullet from the player, towards the direction of the point the user touched, but always with ethe same speed, regardless of how far the touch was from the player.

I have tried several solutions. After some research I saw that I should calculate the angle from the two deltas in degrees, and then use the cos and sin of the angle as the x and y values respectively. But when I try to do so, I get pretty random results.

The closer I was able to get from what I want to achieve was to use the delta variables as the X and Y (multiplied by the speed factor). It worked, but then the speed varied based on how far from the player I touched and I want the speed to be fixed.

Here's my latest code(using sin and cos)

local math, physics = require("math"), require('physics')

physics.start()
physics.setGravity( 0, 0 )

display.setStatusBar( display.HiddenStatusBar )

local screenW, screenH = display.contentWidth, display.contentHeight
local playerX, playerY = (screenW / 2), (screenH / 2)

local player = display.newRect( 0, 0, 30, 30 )
player.x = playerX
player.y = playerY

-- local sinT = display.newText("", 100, 10)
-- local cosT = display.newText("", 100, 30)
local angleT = display.newText("", 100, 70)

local function onScreenTouch( event )
  if (event.phase == "began") then
    speed = 3
    deltaX = event.x - playerX
    deltaY = event.y - playerY

    angle = math.atan2( deltaY, deltaX ) * 180 / math.pi

    -- sin, cos = math.sin( angle ), math.cos( angle )

    -- sinT.text = sin
    -- cosT.text = cos
    angleT.text = angle

    bullet = display.newRect( 0, 0, 6, 6 )
    bullet.x = playerX
    bullet.y = playerY

    physics.addBody( bullet )

    bullet:setLinearVelocity( math.cos( angle ) * speed, math.sin( angle ) * speed )
  end
end

Runtime:addEventListener( "touch", onScreenTouch )

sentences:
ELO algorithm for handling people who don't play often I'm using the ELO algorithm to rank players in an ongoing pong competition. Most players play every day, but we've got one player who hasn't played in a month. My algorithm currently only tracks scores over the last 30 days, and as a result, this player is rapidly rising through the ranks, despite having never played. He lost a bunch of his first games, but won most of his last few games, which means that his losses are dropping off the charts and his score is going up as a result.

Obviously, my plan to drop off scores after 30 days isn't working. What other methods can I use to penalize players for not playing often?

The only thing I've come up with thus far is to reduce the points based on percentage that is based on the days of inactivity (i.e. if a user hasn't played in a week, his points are only worth 70% of normal, and he would have to play X times to get back up to 100% points).

However, this seems too arbitrary. Does anyone have any better ideas or suggestions for handling inactive players in an otherwise active environment?

Thanks in advance.

sentences:
Turn a single player game into multiplayer game hobbyist / indie dev here and I was wondering about network programming and making a game capable of multiplayer.

So basically I just haven't touched on network programming yet and really don't know much and have very little experience with coding multiplayer games. So with that in mind I have a project I want to make and I have all the key points pretty much on paper and a clear vision of what I want to make, I am also going to end up recruiting help (for such things as multiplayer capability more than likely as well as other aspects) since this is outside the scope of my ability to do alone.

I do not plan on having this game hosted by a central server I control and am leaning heavily on the side off a type of p2p connection like minecraft / starbound / terraria (I think those are p2p anyway) with that in mind is it extremely important that I code / build the game with multiplayer from the ground up or might I be able to work on other systems first such as game mechanics and the procedural world creation first and might it be easy to basically create a multiplayer system ontop of the game?

I guess the question is kind of broad but what it boils down to is might it be critical to focus on the networking / multiplayer first or is it a safe and(or) common practice to implement it later in development?

sentences:
Netty: Disconnect client from server keeps reconnecting automatically I have a game that connects to a server using the Netty API. Everything works correctly it seems when I click 'Login'; it will connect to server. However i've added an ingame button 'Back To Lobby'. All this button does is call channel.disconnect(). However when it goes back to the login screen it continously reconnects on its own. Is there something I am missing?
My goal is to make it disconnect from server completely and only reconnect when user clicks login again.
Client Task Class:
public class ClientConnectionTask extends Bootstrap implements Runnable {

    /**
     * The game context
     */
    private GameContext context;

    /**
     * The worker
     */
    private EventLoopGroup worker = new NioEventLoopGroup();

    /**
     * The IP Address to connect
     */
    private String ip;

    /**
     * The callback to notify
     */
    private ClientConnectionCallback callback;

    public ClientConnectionTask(GameContext context, String ip, ClientConnectionCallback callback) {
        this.context = context;
        this.ip = ip;
        this.callback = callback;
    }

    @Override
    public void run() {
        group(worker);
        channel(NioSocketChannel.class);
        option(ChannelOption.TCP_NODELAY, true);
        handler(new ChannelInitializer<SocketChannel>() {
            @Override
            protected void initChannel(SocketChannel socketChannel) throws Exception {
                ChannelPipeline p = socketChannel.pipeline();
                p.addLast("encoder", new PacketEncoder());
                p.addLast("decoder", new PacketDecoder());
                p.addLast("handler", new ClientChannelHandler(context));
            }
        });

        try {
            ChannelFuture future = connect(ip, Constants.PROTOCOL_PORT).syncUninterruptibly();
            if (future.isSuccess()) {
                callback.onSuccess(future.channel());
            }
            future.channel().closeFuture().sync();
            future.channel().flush();
        } catch (Exception e) {
            e.printStackTrace();
            callback.onFailure();
        } finally {
            worker.shutdownGracefully();
        }
    }

}

Login method:
    public void connect(final String displayName, String ip, String code, int team) throws UnknownHostException {
        haveServerResponse = false; // reset for next connect
        if(!RandomUtils.validIP(ip) && RandomUtils.validUrl(ip)) {
            try {
                InetAddress address = InetAddress.getByName(ip);
                ip = address.getHostAddress();
            } catch(UnknownHostException e) {
                return;
            }
        }
        service.execute(new ClientConnectionTask(this, ip, new ClientConnectionCallback() {
            @Override
            public void onSuccess(Channel channel) {
                serverChannel = channel; // initialize the server channel
                connectScene.setState(ConnectionSceneState.CREATING_PROFILE);
                sendLoginPacket(code, displayName, team); // send login packet
            }

            @Override
            public void onFailure() {
                // only show if server appears dead
                if (!haveServerResponse) {
                    connectScene.loginFailed();
                    dispose();
                }
            }
        }));
    }

When debugging it seems like some threads are still staying alive, which may keep it from disconnecting completely. Sometimes it disconnects completely other times it just auto logs in.

sentences:
Starting with shaders and particles I'm working on a flow field with particle systems and starting to learn about shaders in three.js.

Current state of my work is available here.

As such amount of calculations is quite heavy for a big amount of particles I am wondering is it possible to move it to the vertex shader? (Im just a beginner, no experience with shaders, only what i've read, so please be patient)

The calculations requires previous position to add further displacement and to move the particle further according to the noise value on given position, but i don't think it is possible to output anything from the shader?

sentences:
AS3: Using a SharedObject for showing/hiding a Tutorial Basically, I am either having trouble understanding how to use SharedObjects correctly, or I am not properly referencing a variable (from a seperate class from which it is defined) within a SharedObject, and I think the latter is my problem, although I’m not sure.

When my character dies, my game goes to a game over screen, where I create 2 variables within a SharedObject: the bestScore (user’s all-time best score in the game) and then a tutorialBoolean (which will determine if the tutorial shows up or does not in future game play). My bestScore works 100% fine, so I set that up correctly. Now the problem is, in a different class, I want to make an if statement, so that if my tutorialBoolean does not exist or is true, the tutorial runs, and if it is false, the tutorial does not run.

When I try to say

if (sharedObject.data.tutorialBoolean) {runTutorial()}

I get TypeError: Error #1009: Cannot access a property or method of a null object reference. And I am sure that it's having trouble with the sharedObject because I have created a tutorialBoolean without using SharedObjects and it works just fine. So all in all, I just want to be able to make an if statement in separate class than where my sharedObject variable is defined. I will probably have to use

if (sharedObject.data.tutorialBoolean == null)...

or

if (sharedObject.data.tutorialBoolean == "undefined")...

although I'm not really sure which one to use....neither is working at the moment. Shouldn't one of these work no matter what?...I mean if my variable is non existent surely one of these would work...

GameOver Class

package  {

    import flash.display.MovieClip;
    import flash.display.SimpleButton;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    import flash.ui.Mouse;
    import flash.net.SharedObject;

    public class GameOver extends MovieClip {

        public static var sharedObject:SharedObject;
        public var finalScore:TextField;
        public var bestScore:TextField;

        public function GameOver() {

            sharedObject = SharedObject.getLocal( "smgScores" );
            sharedObject.data.tutorial1BooleanShared = false;
            sharedObject.flush();
        }

        public function onClickRestart(mouseEvent:MouseEvent):void
        {
            dispatchEvent( new NavigationEvent( NavigationEvent.RESTART ) );
        }

        public function onClickMainMenu(mouseEvent:MouseEvent):void
        {
            dispatchEvent( new NavigationEvent(NavigationEvent.MAINMENU));
        }

        public function setFinalScore( scoreValue:Number ):void
        {
            trace(sharedObject.data.bestScore);
            try
            {
                finalScore.text = scoreValue.toString();
                if ( sharedObject.data.bestScore == null )
                {
                    sharedObject.data.bestScore = scoreValue;
                }
                if ( scoreValue > sharedObject.data.bestScore )
                {
                    sharedObject.data.bestScore = scoreValue;
                }
                bestScore.text = sharedObject.data.bestScore.toString();
                sharedObject.flush();
            }
            catch( sharedObjectError:Error )
            {
                trace( "Caught this error:", sharedObjectError.name, sharedObjectError.message );
                bestScore.text = "change flash storage options";
            }
        }

}

and in my playScreen class I basically just want to be able to say

if (GameOver.sharedObject.data.tutorial1BooleanShared)
{
    runTutorial1();
}

But I get the error as I said above. I'm not sure if it's worth reconstructing my classes a bit and using sharedObjects in different places, or if there is a simple fix. I like the structure I have at the moment, so the latter is preferable. Thanks!

sentences:
Vertical camera rotation has reduced speed & range when looking at the character from the left or right I completed a camera tutorial for Unity. I can rotate a camera around my figure around the Y axis (Vector3.up) and I wanted to extend that for a Fixed-Free 3rd Person camera (What are the types of 3rd-person camera called?) where I can tilt aswell but I am stuck with the wrong rotation.

I expect the camera to go up/down whenever I use the joystick up/down and always go left/right when I use the joystick left/right.

But instead of that I get always left/right movement as I wish but up/down is only working at the center. The further I go left or right (see images) the less I go up/down. This sounds super complicated, please see the images. I want the same behaviour as shown when the camera is behind the object and I want to avoid the behaviour at the right side like in the first image.

Bonus would be if I can limit the up and down movement to say 160° so the player can't look top down.

The Code looks like this (only RotateCamera() and UpdateCameraPosition() are relevant):

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

public class PlayerCamera : MonoBehaviour
{
    [System.Serializable]
    public class InputSettings : System.Object
    {
        public float inputThreshold = 0.1f;
        public string VERTICAL_AXIS = "CameraVertical";
        public string HORIZONTAL_AXIS = "CameraHorizontal";
        public string LOCK_TARGET_PYRAMID = "LockToPyramid";
        public string LOCK_TARGET_AREA = "LockToArea";
    }

    [SerializeField] private Transform target;
    [SerializeField] private float cameraSpeed = 2;
    [SerializeField] private Vector3 lookAtPlayerOffset = new Vector3(0f, 0.6f);

    private PlayerController playerController;
    private float cameraHorizontal, cameraVertical;
    private float lockPyramid, lockArea;
    private InputSettings inputSettings;
    private Vector3 cameraPlayerOffset;

    void Start()
    {
        SetCameraTarget(target);

        inputSettings = new InputSettings();
        cameraPlayerOffset = transform.position - playerController.transform.position;
    }

    private void Update()
    {
        GetInput();
    }

    private void LateUpdate()
    {
        RotateCamera();
        UpdateCameraPosition();
    }

    private void RotateCamera()
    {
        Quaternion cameraRotationXDelta = Quaternion.AngleAxis(cameraHorizontal * cameraSpeed, Vector3.up);
        Quaternion cameraRotationYDelta = Quaternion.AngleAxis(cameraVertical * cameraSpeed, Vector3.right);

        // this does not work how I wish it would after rotating around a bit
        cameraPlayerOffset = cameraRotationYDelta * cameraRotationXDelta * cameraPlayerOffset;

    }

    private void UpdateCameraPosition()
    {
        // prevent camera from clipping through floor
        Vector3 newPos = playerController.transform.position + cameraPlayerOffset;
        newPos.y = newPos.y < 0.2f ? newPos.y = 0.2f : newPos.y;
        transform.position = newPos;
        transform.LookAt(target.transform.position + lookAtPlayerOffset);
    }

    private void GetInput()
    {
        cameraHorizontal = Input.GetAxis(inputSettings.HORIZONTAL_AXIS); // interpolated
        cameraVertical = Input.GetAxis(inputSettings.VERTICAL_AXIS); // interpolated

        lockPyramid = Input.GetAxis(inputSettings.LOCK_TARGET_PYRAMID); // interpolated
        lockArea = Input.GetAxis(inputSettings.LOCK_TARGET_AREA); // interpolated
    }

    private void SetCameraTarget(Transform targetTransform)
    {
        target = targetTransform;

        if (target != null)
        {
            if (target.GetComponent<PlayerController>())
            {
                playerController = target.GetComponent<PlayerController>();
            }
            else
            {
                Debug.LogError("The camera's target needs a player character controller.");
            }
        }
        else
        {
            Debug.LogError("Your camera needs a target");
        }
    }
}

sentences:
Cocos 2D - Hold down CCMenuItem I am using the following code to move a CCSprite left and right.

-(id)init{
    CCMenuItemImage * moveLeftButton = [CCMenuItemImage itemFromNormalImage:@"Move Left Button.png" selectedImage:@"Move Left Button.png" target:self selector:@selector(moveLeftVoid:)];
}
-(void)moveLeftVoid{
    id moveLeft = [CCMoveBy actionWithDuration:.3 position:ccp(-10, 0)];
                [_mainSprite runAction:moveLeft];
}

This does work, but only as a single tap. What I want for the CCSprite to move continously in that direction when the CCMenuItem is held down. Then when it's released the character stops moving. If you need to see more code, please just ask. :) Thanks

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:
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:
Projection Matrix Breaks My Rectangle This is my vertex shader, shown below.

#version 330 core

in vec3 a_position;
in vec4 a_colour;

// FOV = 70, near plane = 0.1, far plane = 1000
const mat4 u_projection = mat4(
    1.428148, 0.0, 0.0, 0.0,
    0.0, 1.428148, 0.0, 0.0,
    0.0, 0.0, -1.0001999, -0.20002,
    0.0, 0.0, -1.0, 0.0
);

//uniform mat4 u_projection;
//uniform mat4 u_view;
uniform mat4 u_transformation;

out vec4 v_colour;

void main() {

   gl_Position = u_projection * u_transformation * vec4(a_position, 1);
   v_colour = a_colour;
}

Whenever I take out u_projection, my square appears. When I add it back, the square is malformed.

The vertices of my square are as follows, aka the contents of a_position.

float[] vertices = {
    0, 0, 0.5f,
    0.5f, 0.5f, 0.5f,
    0, 0.5f, 0.5f,
    0, 0, 0.5f,
    0f, 0.5f, 0.5f,
    0, 0.5f, 0.5f
};

The position of the square is (0, 0, 0), the rotation is (0, 0, 0) and the scale is 1. These are computed into u_transformation and uploaded. This works perfectly.

If I change the -1.0001999 and the last 0 to 1 part to 1 then the square is not hidden.

void bindAttribute(int index, String name) {
    GL20.glBindAttribLocation(program, index, name);
}
bindAttribute(0, "a_position");
bindAttribute(1, "a_colour");

sentences:
Combining Quaternion Rotations I'm trying to understand Quaternions in relation to rotation and orientation.
As an example in learning, I'm trying to rotate a point (e.g. at [0.7071, 0, -0.7071], on the unit sphere) about the line x=z (or the vector [0.7071, 0, 0.7071] for a unit vector pointing in x/z direction. It should rotate around the unit sphere, passing through [0,1,0]
I've read that "multiple rotations are just multiplication", but if that's the case, why are the following are not equivalent?
# This version does what I want, rotates a point about the line x=z
val q = Quaternion().setAngleAxis(toRadians(45), 0.7071, 0, 0.7071)

# neither of the following multiplications produce the equivalent to the above q
val qx = Quaternion().setAngleAxis(toRadians(45), 1, 0, 0)
val qy = Quaternion().setAngleAxis(toRadians(45), 0, 1, 0)
val q1 = qx.mul(qy)
val q2 = qy.mul(qx)

(My reasoning is like looking at a unit vector starting in the x direction, which if I rotate 45 degrees in the y axis would give me a vector pointing in the z=x direction, but this is clearly naive as it doesn't work)
An example plot of qx * qy (but using 5 degree rotations instead of 45) is:

The q rotation I want gives me:

My understanding is qx and qy represent rotations about the given axis, or indeed also represent orientations, and if I use these independently and plot them, I get what I would expect, a point being rotated as required.
But if I start from either one of these, why doesn't the multiplication of the other (which represents an initial orientation multiplied by a rotation) result in a rotation that would rotate a point by both the x and the y axis?
Which leads me to the question, what does qx * qy (or vica verca) represent here? (I think this is the key bit I'm not understanding.)
Is it possible to apply something to qx or qy to get the original q directly?

sentences:
Copying a ID3D11Texture2D created by one device without the D3D11_RESOURCE_MISC_SHARED flag to another device I'm writing a native plugin for Unity that is responsible for presenting the rendered Unity scene in a separate window with its own swap chain and an associated device and context all owned by the plugin. I'm rendering the Unity scene to a texture and passing the native pointer of the texture to the plugin. Had Unity's texture been created with the D3D11_RESOURCE_MISC_SHARED flag enabled, I could have simply accessed the texture using OpenSharedResource and created a ID3D11ShaderResourceView bound to it. But since Unity does not specify that flag at the creation of its texture, I need to copy that texture to another texture which is created with the D3D11_RESOURCE_MISC_SHARED flag enabled. I'm facing issues while doing this copy.

To test this pipeline, I'm working with the SpriteBatch example in DirectXTK tweaking it a little bit - create a texture using one device, and pass it on to another device (the original example uses the same device to create the first texture) which is responsible for rendering it on the screen.

I create a first texture from an image file using the first ID3D11Device1 without the D3D11_RESOURCE_MISC_SHARED flag enabled, and create a second empty texture using the second ID3D11Device1 with the D3D11_RESOURCE_MISC_SHARED flag enabled. Then I copy the contents of the first texture to the second texture, and create a ID3D11ShaderResourceView bound to the second texture.

ComPtr<ID3D11Resource> textureResource;
DX::ThrowIfFailed(CreateWICTextureFromFile(m_d3dDevice.Get(), L"cat.png", textureResource.GetAddressOf(), nullptr));

ComPtr<ID3D11Texture2D> cat;
DX::ThrowIfFailed(textureResource.As(&cat));

CD3D11_TEXTURE2D_DESC catDesc;
cat->GetDesc(&catDesc);

ComPtr<ID3D11Texture2D> spriteBatchTexture;
D3D11_TEXTURE2D_DESC sharedTextureDesc = catDesc;
sharedTextureDesc.Usage = D3D11_USAGE_DEFAULT;
sharedTextureDesc.Format = catDesc.Format;
sharedTextureDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
sharedTextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;

//Create a texture which is a copy of cat, that belongs to the wicDevice but with a SHARED flag
DX::ThrowIfFailed(wicDevice->CreateTexture2D(&sharedTextureDesc, nullptr, spriteBatchTexture.ReleaseAndGetAddressOf()));
wicContext->CopyResource(spriteBatchTexture.Get(), cat.Get());

IDXGIResource* sharedResource(nullptr);
HANDLE sharedHandle;
DX::ThrowIfFailed(spriteBatchTexture->QueryInterface(__uuidof(IDXGIResource), (void**)&sharedResource));
DX::ThrowIfFailed(sharedResource->GetSharedHandle(&sharedHandle));
sharedResource->Release();
DX::ThrowIfFailed(m_d3dDevice->OpenSharedResource(sharedHandle, __uuidof(ID3D11Texture2D), (void**)(spriteBatchTexture.GetAddressOf())));

D3D11_SHADER_RESOURCE_VIEW_DESC sbSRVDesc = {};
sbSRVDesc.Format = catDesc.Format;
sbSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
sbSRVDesc.Texture2D.MipLevels = 1;
sbSRVDesc.Texture2D.MostDetailedMip = 0;

DX::ThrowIfFailed(m_d3dDevice->CreateShaderResourceView(spriteBatchTexture.Get(), &sbSRVDesc, m_texture.ReleaseAndGetAddressOf()));

The m_texture is the ID3D11ShaderResourceView that is finally used by the example to render the image on to the screen.

The code goes through fine, but there's no image rendered onto the window when I do this.

Note: It does not seem to matter which device - m_d3dDevice or wicDevice I choose as the creator of the spriteBatchTexture. As long as OpenSharedResource is used properly, the code does not break but the end result is the same blank screen.

sentences: How to Load PDF file in runtime using PDF Renderer Asset in unity? Hello Guys : I am working in Unity PDF Renderer. I will purchased that Asset but i need to Know, How to load PDF file one by one in run time in File path mode but old PDF File will remove and Load new PDF file in run time. can any one help

sentences: Introduction movie running before game starts There are many games out there that feature a movie or cut scene to feature either in-game features or to set the mood for the player. Some examples are the intro from Tony Hawk Pro Skater 4, Fifa Street 2, Modern Warfare 3, etc. How do I integrate a movie I made to Unity so it launches right at the start, ends playing and then shows the main menu? Is it available for unity personal edition or is it only for pro users?

sentences:
How to render transparent meshes without sorting? Let's assume we have some arbitrary triangle manifold meshes which are transparent.

How real guys effectively render it?

Is it possible todo it without sorting faces back to front (e.g. via bsp) and then render it with blending?

sentences:
Unity: How to fix shadows with several meshes in different objects? I'm creating many GameObjects and each one has a single mesh, created in a script. The problem is that I would like to draw them so that they behave like a single mesh. Is it possible? Or I must combine all the meshes togheter?

Thanks for your help!

Edit:
Added the code where I create the mesh and an image to clarify what I did

public void createMesh() {
        List<Vector3> vertices = new List<Vector3>();
        List<int> triangles = new List<int>();

        Vector3 _right = rightBase * radiusBase;

        //BASE
        //POC = Point on circumference
        Vector3 axis = Vector3.Cross(_right, fwdBase); //Axis of rotation of the vector _right for the base
        for(int POC = 0; POC < numberOfSections; POC++) {
            vertices.Add(_right);

            _right = Quaternion.AngleAxis(360 / numberOfSections, axis) * _right;
        }

        //TOP
        _right = rightTop * radiusTop;

        axis = Vector3.Cross(_right, fwdTop);
        for(int POC = 0; POC < numberOfSections; POC++) {
            vertices.Add(direction + _right);

            _right = Quaternion.AngleAxis(360 / numberOfSections, axis) * _right;
        }

        //The 2 points at the center of the base and the top
        vertices.Add(Vector3.zero);
        vertices.Add(direction);

        //Triangles
        for(int face = 0; face < numberOfSections - 1; face++) {
            triangles.Add(face);
            triangles.Add(face + numberOfSections);
            triangles.Add(face + 1);

            triangles.Add(face + 1);
            triangles.Add(face + numberOfSections);
            triangles.Add(face + numberOfSections + 1);
        }
        triangles.Add(numberOfSections - 1);
        triangles.Add(2 * numberOfSections - 1);
        triangles.Add(0);

        triangles.Add(0);
        triangles.Add(2 * numberOfSections - 1);
        triangles.Add(numberOfSections);

        //COVER BASE
        for(int POC = 0; POC < numberOfSections - 1; POC++) {
            triangles.Add(2 * numberOfSections);
            triangles.Add(POC);
            triangles.Add(POC + 1);
        }
        triangles.Add(2 * numberOfSections);
        triangles.Add(numberOfSections - 1);
        triangles.Add(0);

        //COVER TOP
        for(int POC = 0; POC < numberOfSections - 1; POC++) {
            triangles.Add(2 * numberOfSections + 1);
            triangles.Add(numberOfSections + POC + 1);
            triangles.Add(numberOfSections + POC);
        }
        triangles.Add(2 * numberOfSections + 1);
        triangles.Add(numberOfSections);
        triangles.Add(2 * numberOfSections - 1);

        getMesh().Clear();
        getMesh().vertices = vertices.ToArray();
        getMesh().triangles = triangles.ToArray();
        getMesh().RecalculateNormals();
        getMesh().RecalculateBounds();
        obj.GetComponent<MeshCollider>().sharedMesh = getMesh();
    }

sentences:
How to deal with inconsistent network delay caused by packets arriving at different times in the frame? I'm developing a multiplayer game that does not have prediction. It implements client-side interpolation. The problem with this is that input delay can be perceived. I've measured the various times involved in calculating the delay(packet arrival time, server respond time, time spent interpolating), and it seems about 50ms is spent on interpolating(correct), and 60ms is spent on ping and what I can only assume to be unfortunate message arrival time.

The ping is 18ms, which leaves 42ms. If the message arrives at the server immediately after the server has finished reading it's incoming messages this frame, we suffer at least a 16ms delay(at 60fps) that wouldn't be there if the message arrived right before the reading. If this happens with both the server and the client, the delay really adds up, especially at lower frame rates.

How can posts like this http://pastebin.com/ekk07PKn claim to have exactly 50ms  delay with 0 ping if this is an issue?

If it's relevant, this is being developed with Unity3d and the Lidgren networking library in C#. I've moved the server snapshot writing to a different thread with a lock around the game world update method. This helped a lot, but from what I understand moving the reading to a different thread won't help in the same way, because the client won't be able to use the new information until the next frame anyway.

sentences:
Are delayed abilities bad in turn-based strategy games? In my PvP turn-based strategy, one of the balancing mechanisms for separating stronger from weaker abilities is their "delay", which is the number of turns it will take to actually execute that ability, from when it was commanded. For example, if you cast an ability with delay = 1, that unit won't use it until the start of your next turn. Most abilities have delay = 0, meaning it's used right when the command is given. It is clear when a unit is "casting" a delayed ability; they have an ongoing casting animation, there are tick marks above their head to count how many turns left for casting, and when you click on them, you see which tiles are targeted.

It's similar to "casting time" in Final Fantasy Tactics.

It serves several purposes in my game. For one thing, I need to balance stronger vs weaker abilities somehow, and there's already a lot of other resources to keep track of (action points, gold, etc). I don't want to clutter the game with more resources, such as mana on individual units. Units can have "cooldown" (number of turns where they can't be used) after being used, so moving units into enemy territory with cooldown can be dangerous, because they're vulnerable to the more powerful "delay" abilities. Finally, some of them can just be used as a deterrent, such as casting a large AoE delayed ability to say "don't come into this territory".

However, I read this article about Final Fantasy Tactics. It's an interview with a developer of a new indie game inspired by FFT, who was also a dev in FFT. Basically he says that casting time won't be in the new game, and was only in FFT because of technical limitations (the game needed time to load the graphics of certain spells). Also, I notice that it hasn't appeared in any of the later Tactics games by Square, nor in many other tactical games that are self-confessed "clones" of FFT (Fell Seal, for example). I basically haven't seen delayed abilities in any tactical turn-based game since FFT.

I also noticed, when playing the prototype of my game with some friends, that they were annoyed that some abilities didn't execute right away, even though it was advertised in their details that they have delay.

These things make me wonder if delay is an inherently bad mechanic, and that there's a good reason developers have been avoiding it since FFT. Perhaps it just feels bad or clunky on the side of the user, and reduces their overall gaming experience.

I have a few alternatives in mind. But my question is, are delayed abilities in turn-based strategies generally a bad mechanic?

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:
What is the difference between a Sprite and a Texture? I have an assignment due for University, and my task is to discuss textures used within video games, and how they have evolved.

My main question is, what is the fundamental difference between using a sprite, or using other texture methods?

Having done a little research myself, I seem to be inclined that Sprites store images in a single file, and can be used for animations etc.. and were commonly used with older video games, generally using sprites as all of their game visuals. Now, with modern games, sprites I believe tend to be less used as technology advances and other textures are available such as bump mapping. Although sprites are still used today to accommodate features such as a health bar or long distance textures.

But what are the main advantages of using textures, over sprites?

sentences:
Error CS1585: Member modifier 'private' must precede the member type and name I've been knocking errors out of my script after working thoroughly through them but this one has me stumped, even though I'm sure it's something really simple. This is the following error that I'm getting:

  Assets\Scripts\Movement_Scripts\FirstPersonCharacter\Scripts\FirstPersonController.cs(44,9):
  error CS1585: Member modifier 'private' must precede the member type
  and name

From my script:

using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using UnityStandardAssets.Utility;
using Random = UnityEngine.Random;
using MouseLook = UnityEngine.MouseLook;

public class FirstPersonController : MonoBehaviour
{
    [SerializeField] private bool m_IsWalking;
    [SerializeField] private float m_WalkSpeed;
    [SerializeField] private float m_RunSpeed;
    [SerializeField] [Range(0f, 1f)] private float m_RunstepLenghten;
    [SerializeField] private float m_JumpSpeed;
    [SerializeField] private float m_StickToGroundForce;
    [SerializeField] private float m_GravityMultiplier;
    [SerializeField] private MouseLook m_MouseLook;
    [SerializeField] private bool m_UseFovKick;
    [SerializeField] private FOVKick m_FovKick = new FOVKick();
    [SerializeField] private bool m_UseHeadBob;
    [SerializeField] private CurveControlledBob m_HeadBob = new CurveControlledBob();
    [SerializeField] private LerpControlledBob m_JumpBob = new LerpControlledBob();
    [SerializeField] private float m_StepInterval;
    [SerializeField] private AudioClip[] m_FootstepSounds;    // an array of footstep sounds that will be randomly selected from.
    [SerializeField] private AudioClip m_JumpSound;           // the sound played when character leaves the ground.
    [SerializeField] private AudioClip m_LandSound;           // the sound played when character touches back on ground.

    private Camera m_Camera;
    private bool m_Jump;
    private float m_YRotation;
    private Vector2 m_Input;
    private Vector3 m_MoveDir = Vector3.zero;
    private CharacterController m_CharacterController;
    private CollisionFlags m_CollisionFlags;
    private bool m_PreviouslyGrounded;
    private Vector3 m_OriginalCameraPosition;
    private float m_StepCycle;
    private float m_NextStep;
    private bool m_Jumping;
    private AudioSource m_AudioSource;
    readonly AudioSource AudioSource;
    public UnityStandardAssets.Characters.FirstPerson.MouseLook

    // Use this for initialization
    private void Start()   /* This is line 44 */
    {
        m_CharacterController = GetComponent<CharacterController>();
        m_Camera = Camera.main;
        m_OriginalCameraPosition = m_Camera.transform.localPosition;
        m_FovKick.Setup(m_Camera);
        m_HeadBob.Setup(m_Camera, m_StepInterval);
        m_StepCycle = 0f;
        m_NextStep = m_StepCycle / 2f;
        m_Jumping = false;
        m_AudioSource = GetComponent<AudioSource>();
        m_MouseLook.Init(transform, m_Camera.transform);
    }

    // Update is called once per frame
    private void Update()
    {
        RotateView();
        // the jump state needs to read here to make sure it is not missed
        if (!m_Jump)
        {
            m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
        }

        if (!m_PreviouslyGrounded && m_CharacterController.isGrounded)
        {
            StartCoroutine(m_JumpBob.DoBobCycle());
            PlayLandingSound();
            m_MoveDir.y = 0f;
            m_Jumping = false;
        }
        if (!m_CharacterController.isGrounded && !m_Jumping && m_PreviouslyGrounded)
        {
            m_MoveDir.y = 0f;
        }

        m_PreviouslyGrounded = m_CharacterController.isGrounded;
    }

...

Now I know the problem is private void Start() on line 44, and from everything I've read, it's in the wrong place (to make sure, I changed it to public void, then just left it as void, both resulting in errors) however I'm stumped as to where I should move Private Void too.

I appreciate any and all advice on this.

sentences:
What data should a generic collision detection system gather? I'm working on a relatively generic 2D AABB collision detection system for a game engine, and I've re-written it more times than I'd like to admit, due to not calculating or recording specific details of each collision. Right now, this is what I'm collecting:

Collision time as a fraction of an update cycle in the game loop.
Location of the collision.
ID of the colliding object.

Each object has a Set that holds this data for each collision (I'm working with a component/entity system) so other systems can use the recorded data. The problem I just ran into was that I needed to know which side of the object the collision takes place on.

What other values or points of interest should I calculate or record, per collision? What do you look for in a standard collision detection system?

sentences:
Unity3D Only render when key is pressed I am researching Interaction Latency - the delay between pressing a key and seeing the result on screen.

I have my Unity3D application deployed remotely to an EC2 instance on AWS. I have another application, on the client, sending keyboard and mouse events to the server Unity3D application.

My goal is to measure the time between pressing a key or moving the mouse on the client and having the corresponding image displayed (on the client!). A GUID is sent from the client to the server and when the image comes back, it has the GUID that supposedly matches the command which generated the command which calls ReadPixels (yes, I know RenderTarget is faster, but I do not have the Pro license, yet).

My system works well, but I am concerned that the frame that the client receives (and which I measure against), is not the result of key that was pressed. The reason for this is because Unity3D renders, regardless of whether or not it received a command from the client application.

I'd like to only render if a key press is received from the client.

How can I do this? Any suggestions on how to measure the delay between the client key press and the updated image on the client is also welcome.

sentences:
How can I implement world generation like in Don't Starve? I am working on a game similar to Don’t Starve. Mechanics of the game are all also pretty similar. You craft things, you can explore a random open world and you need to survive. Because I really like the way Don’t Starve generates worlds with biomes, and this branch like structure:

I want my world generator to generate worlds similar to this on a large tilemap, with custom biomes, but I don’t think they use perlin noise for it.
Here you can see different biome sections of the game:

Also I want to explore other possibilities than noise to generate worlds, so I don’t want to use it for this project.

sentences:
Find point in 3D plane I have four points in a 3D space, example:

(0,0,1)
(1,0,1)
(1,0,2)
(0,0,2)

Then I have a 2D position on that square plane:

x = 0.5
y = 0.5

I need to find out the 3D space point of that position in the plane. In this example it's easy: (0.5,0,1.5) Because Y is zero. But imagine that Y was not zero (and not all the same), that the plane is leaning in some direction. How would I calculate the point in that case?

I imagine this should be a pretty easy thing to solve, but I can't figure it out. Please answer in programming terms and not in straight math terms.

Update with image: The gray plane (made out of two triangles) are the real one actually existing. I create a non-existing plane on top of this, the ABCD corners are exactly the same, however it doesn't slope. What I need to do is project a pixel (blue one in example) from the non-existing plane to the existing plane. It will be in the exact same location, except that it has gained a Y value from the sloping plane.

What I've been able to work out so far on my own is which one of the two triangles to use in the gray plane and the normal of triangle. I basically just need to figure out how I can project the pixel.

sentences:
How can I push a button with VR hands? New programmer here.

I am currently trying to create a sample game in Unity (2019.2.11f1) where I push a button using the VR hands of my Oculus Rift (the hands follow my controllers). I can't believe how difficult is to find documentation or tutorials for said task. I've tried to read documentation but I'm at a loss here.

I have tried putting sphere colliders on the Hands, and tried to use raycast, with no success. I use the localAvatar with both grabbers as children, and the avatar is itself child of the OVR Player Controller prefab you get when you download the Oculus asset from the store.

How can I achieve this?

sentences:
How to Make Different Instances of an Object Have Different Sprites In Game Maker, I am trying to make it so that three instances of an object have three different sprites. Using DnD, what would be the optimal way to do this? If it helps, the three instances are different sizes and are in separate, fixed places.

EDIT: I have added the following, and it gives an error that the global variable has not been set.

sentences:
Deslect targeted enemy question. How to change back to original color In the code below I have now:

Press tab, enemy changes green.
Press tab again, (deselecting the target) enemy changes to blue.

What I want to happen:

Press tab, enemy changes to green.
Press tab again, (deselecting the
target) green goes away. (enemy is its original color)

Here is my current code:

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

public class Targetting : MonoBehaviour {
    public List<Transform> targets;
    public Transform selectedTarget;

    private Transform myTransform;

    // Use this for initialization
    void Start () {
        targets = new List<Transform>();
        selectedTarget = null;
        myTransform = transform;

        AddAllEnemies();
    }

    public void AddAllEnemies()
    {
        GameObject[] go = GameObject.FindGameObjectsWithTag("Enemy");

        foreach(GameObject enemy in go)
            AddTarget(enemy.transform);
    }

    public void AddTarget(Transform enemy)
    {
        targets.Add(enemy);
    }

    private void SortTargetsByDistance()
    {
        targets.Sort(delegate(Transform t1,Transform t2) {
                return Vector3.Distance(t1.position, myTransform.position).CompareTo(Vector3.Distance(t2.position, myTransform.position));
                });
    }

    private void TargetEnemy()
    {
        if(selectedTarget == null)
        {
            SortTargetsByDistance();
            selectedTarget = targets[0];
        }
        else
        {
            int index = targets.IndexOf(selectedTarget);

            if(index < targets.Count -1)
            {
                index++;
            }
            else
            {
                index = 0;
            }
            DeselectTarget();
            selectedTarget = targets[index];
        }
        SelectTarget();
    }

    private void SelectTarget()
    {
        selectedTarget.renderer.material.color = Color.green;
    }

    private void DeselectTarget()
    {
        selectedTarget.renderer.material.color = Color.blue;
        selectedTarget = null;
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKeyDown(KeyCode.Tab))
        {
            TargetEnemy();
        }
    }

}

sentences: How do I make sure my tic-tac-toe AI always plays to a draw? I'm working on a little project. The aim is to play Tic-Tac-Toe against an AI, but I require that the game always results in a draw against the AI opponent. How can I implement the AI to ensure that?

sentences:
How to stop Objects with Rigidbodies from explosion when dragging I have a sequence of capsules linked with fixed join and each capsule have a Rigidbody and a cube collider (the picture bellow shows how it's look like)

and this is the drag script I applied on it

public class MouseDrag : MonoBehaviour
{
Vector3 screenPoint;
Vector3 offset;

bool dragging = false;

Rigidbody rigid;

void Awake()
{
    rigid = GetComponent<Rigidbody>();
}

void OnMouseDown()
{
    screenPoint = Camera.main.WorldToScreenPoint(transform.position);
    offset = transform.position - Camera.main.ScreenToWorldPoint(
        new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));

    dragging = true;
}

void OnMouseUp()
{
    dragging = false;
}

void FixedUpdate()
{
    if (dragging)
    {
        Vector3 point = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 dest = Camera.main.ScreenToWorldPoint(point) + offset;

        rigid.AddForce((dest - rigid.position) * 200f);
        rigid.velocity *= 0.8f;
    }
}}

it works but at some point of the drag all the capsules explode and all the other components do the same thing

after some research I found some people says that the Rigidbody did the problem but I couldn't understand why or how it did the problem ?

Here is a link to a small video of the problem :
https://drive.google.com/file/d/1Ia3X356L_VaIGIrDAdLyZHG9K5k71S1j/view?usp=sharing

sentences:
Converting data file of Sprite Atlas from JSON to Cocos 2D I have an existing Sprite Atlas with its data file in JSON format. How do I convert it for use with Cocos 2D and other frameworks ?

I tried poking around in Texture Packer which supports publishing to multiple formats. But I can't figure out how to convert from one format to another

EDIT : Is there any other software that is able to convert between different formats ?

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:
LWJGL Java 2D collision when lagging I'm using a tile based collision, but when the game is lagging (the lag isn't the problem) the collision fails and the player falls through tiles.

This is the movement/collision detection code of my Player class:

gravity.y = gspeed;

speed.y+=gravity.y;

position.set(position.x + direction.x * speed.x * deltaSeconds, position.y + direction.y * speed.y * deltaSeconds);

for (int i = (int) Math.round(position.x / 32) - 2 * t; i < (int) Math.round(position.x / 32) + 3 * t; i++)
            {
                for (int j = (int) Math.round(position.y / 32); j < (int) Math.round((position.y + height + 64) / 32); j++)
                {
                    checkCollision(i, j, deltaSeconds);
                }
            }

public void checkCollision(int i, int j, float deltaSeconds)
    {
        bbox.setBounds((int) position.x, (int) position.y, (int) width, (int) height);
        Tile t = null;
        t = Map.getTile(i, j);
        if (t != null)
        {
            if (t.isSolid())
            {
                if (t.getTop().intersects(bbox))
                {
                    if (position.y + height < t.y * 32 + 32)
                    {
                        if (speed.y >= 0)
                        {
                            position.y = t.y * 32 - height;
                            speed.y = 0;
                            gravity.y = 0;
                            jumpState = 0;
                        }

                    }

                }
                if (t.getBottom().intersects(bbox))
                {
                    if (position.y < t.y * 32 + 32)
                    {
                        position.y = t.y * 32 + 32;
                        speed.y = 0;
                    }
                }
                else
                {
                    if (t.getLeft().intersects(bbox))
                    {
                        if (position.x + width > t.x * 32)
                        {
                            position.x = t.x * 32 - width;
                            speed.x = 0;
                        }
                    }
                    if (t.getRight().intersects(bbox))
                    {
                        if (position.x < t.x * 32 + 32)
                        {
                            position.x = t.x * 32 + 32;
                            speed.x = 0;
                        }
                    }
                }
            }

        }
    }

Is it possible to fix my code, if yes how? Or is it possible to tell if the game is lagging?

sentences:
Enter in a match that is already started In my Unity mobile game, I need multiplayer online functionalities. All the players should be visible in the world at any given time (of course, with some filtering), and a player should be able to connect at any time. Let's say that, for the purpose of this question, only 100 players at the time will log into the game.

My first try involved using Unity's built-in NetworkManager, but the two problems that arose are that:

One player is always the host, meaning that if that player logs out all the other players.
I did not manage to make it work on two different networks.

The implementation I used comes from this tutorial.

Next try was using an extension of NetworkLobbyManager, that allows through the Matchmaking system to solve problem 2.

This is my implementation:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.Match;
using UnityEngine.SceneManagement;

public class AutoLobbyManager : NetworkLobbyManager {

    protected int currentPage = 0;
    protected int previousPage = 0;

    public void CreateOrJoin() {
        StartMatchMaker();
        RequestPage(0);
    }

    public void OnMatchListReceived(bool success, string extendedInfo, List<MatchInfoSnapshot> matches)
    {
        if (matches.Count == 0) {
            // Server does not exist yet. Create one.
            CreateMatch();
            return;
        }

        // There is then a server. Join it.
        JoinMatch(matches[0]);

    }

    public void RequestPage(int page) {
        matchMaker.ListMatches(page, 1, "", true, 0, 0, OnMatchListReceived);
    }

    public void CreateMatch() {
        matchMaker.CreateMatch( "Main Match", (uint)maxPlayers, true, "", "", "", 0, 0, OnMatchCreate);
    }

    void JoinMatch(MatchInfoSnapshot match) {
        matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, OnMatchJoined);
    }

    public override void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo) {
        base.OnMatchCreate(success, extendedInfo, matchInfo);
        Debug.Log("Match created!");
        ServerChangeScene(playScene);
    }

     public override void OnClientSceneChanged(NetworkConnection conn) {
         string loadedSceneName = SceneManager.GetSceneAt(0).name;
         if (loadedSceneName == lobbyScene) {
           if (client.isConnected)
               CallOnClientEnterLobby();
         } else {
           CallOnClientExitLobby();
         }

         OnLobbyClientSceneChanged(conn);
    }

    void CallOnClientEnterLobby() {
        OnLobbyClientEnter();
        foreach (var player in lobbySlots)
        {
            if (player == null)
                continue;

            player.readyToBegin = false;
            player.OnClientEnterLobby();
        }
    }

    void CallOnClientExitLobby() {
        OnLobbyClientExit();
        foreach (var player in lobbySlots)
        {
            if (player == null)
                continue;

            player.OnClientExitLobby();
        }
    }

}

This makes possible to create a Lobby if there is no Lobby, and join the first if there is. It works, if we remove the highlighted line here:

public override void OnMatchCreate(bool success, string extendedInfo,
MatchInfo matchInfo) {
    base.OnMatchCreate(success, extendedInfo, matchInfo);
    Debug.Log("Match created!");
    ***** ServerChangeScene(playScene); *****
}

Because this starts the game. If that line is activated (since I want to start the game as soon as possible), when a client tries to connect, the Server logs:

NetworkLobbyManager can't accept new connection [hostId: 0 connectionId: 1 isReady: False channel count: 2], not in lobby and game already in progress.

And the client is not added to the game. I understand that lobbies usually work like that, but:

1. Is it possible to add a client after a game is added, with NetworkLobbyManager?

2. Is it the right approach to achieve a multiplayer, non-lobby-based, non-host-based, online game in Unity?

sentences:
Performance problem with chunked LOD I managed to create Zoomable planet. When I get closer to it the respective chunks are splitting and every split holds 4 x 16x16 grid (1024 verts). When getting closer the respective chunks split again and so on. AT the end (let's say when Im on ground), there is so much splits, that when looking on horizont its about 120000 vertices, what is way to much and drops fps to around 7-12. Where I really want like 3-4 layers - near detailed, far less detailed, farest coarse.

I can't get my brain around how to fix this. Any advice appreciated.

sentences:
How to texture a surface generated by marching cubes algorithm? I'm working on a voxel game, and I have some problems with texturing. I have read the related questions on this stack exchange, but they seem adressing a generic problem (using triplanar texturing), and I think mine is simpler.

You can see that the resulting geometry contains a limited set of polygons. Last I checked I saw only 44 of them. My idea was to uv map these polygons to a regular texture using a static map table, without having to use any triplanar texturing (currently, every polygon is mapped to the same values, so it's ugly).

My questions :

Is it valid ? It seems much simpler than triplanar texturing, but I can't find a single resource on the subject, so I'm wondering if it's a right approach.
Where can I find / How can I generate a UV map for this kind of geometrical figure ? I have tried to use blender but it seems like my blender-fu is not strong enough. Is there some simpler software to generate UV map with models like this one ?

sentences:
Understanding the ModelView Matrix I want to analyze the each component of my 4*4 ModelView Matrix.

I came to know that the starting 3*3 of ModelView Matrix stores rotation.

If i want my object to have no rotation with respect to camera so My ModelView Matrix looks like this

How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this

sentences:
Problem using glm::lookAt and glm::perspective I'm trying to change the code from the 22th tutorial at http://ogldev.atspace.co.uk/, using the GLM library, but the result seems wrong.
The problem is shown in the below picture:

While it should be:

This program displays a model onto the screen. The model is loaded using a library and I ensure that all of its vertices, normals, and texuture coordinates are loaded correctly. The problem seems to be at creating the Projection - model - view matrix. I searched for the use of GLM and use the below code to calcualate that matrix:

    glm::vec3 Pos(3.0f, 7.0f, -10.0f);
    glm::vec3 Target(0.0f, -0.2f, 1.0f);
    glm::vec3 Up(0.0, 1.0f, 0.0f);

    glm::mat4 viewMat = glm::lookAt(Pos, Target, Up);
    glm::mat4 perMat = glm::perspective(60.0f, (float)WINDOW_WIDTH/WINDOW_HEIGHT, 1.0f, 100.0f);

    glm::mat4 modelMat = glm::scale(glm::mat4(1.0f),glm::vec3(0.1f, 0.1f, 0.1f));
    modelMat = glm::rotate(modelMat, m_scale, glm::vec3(0.0f, 1.0f, 0.0f));
    modelMat = glm::translate(modelMat, glm::vec3(0.0f, 0.0f, 10.0f));

    //FINAL MATRIX
    glm::mat4 PVMMat = perMat * viewMat * modelMat;

After that, I supplied the matrix to the shader like this:

glUniformMatrix4fv(m_WVPLocation, 1, GL_TRUE, &PVMMat[0][0]);

Finally, in the shader, I calculate the gl_Position as below:

//vertex shader
void main()
{
    gl_Position = gWVP * vec4(Position, 1.0);
    TexCoord0   = TexCoord;
    Normal0     = (gWorld * vec4(Normal, 0.0)).xyz;
    WorldPos0   = (gWorld * vec4(Position, 1.0)).xyz;
}";
//Fragment shader
void main()
{
    FragColor = texture2D(gSampler, TexCoord0.xy);
}";

I tried my best for a few days and I can't see any error in the way I use glm::lookAt and  gml::perspective. This is exactly as in the manual on the GLM website. Could you suggest some reason for the problems I'm seeing, or some way for me to further investigate the error? Thanks so much. I hope to see your answer.

sentences:
Rendering characters, with cut off limbs (Blender models in Java/OpenGL) What aspects should I take into consideration for creating character animation and rendering classes if I want to be able to have detachable limbs? I've developed a detailed body system that can have everything down to the nervous system defined. I'm aiming for something similar to the level of damage detail found in Dwarf Fortress. For example, when a character takes damage to their upper arm, there is a chance of nerve damage that can disable the entire arm. Or they could lose the arm entirely.

I have a system written up for handling the data part of this. Each character has a trunk, which has appendages and internal parts. Each appendage can also have child appendages and internal parts. Child appendages are disabled/removed if a parent appendage is disabled/removed. If any of the disabled/removed appendages or internal parts are required for life, the character will soon die.

What I'm working on now is the drawing/animation portion of this. How do I define animations to know which ones are allowed given the current state of the body (missing arms/legs and so on)? How do I set up the drawing system to not draw missing limbs? Does each limb/appendage have to be its own model (I'd like to draw cut off appendages on the ground)?

The simple system I'm transitioning from (I just wrote it for testing) imports all the key frames of an animation as full models into a VBO (along with vertex counts for where key frames start/stop). It doesn't import or utilize the bones defined in Blender, and it doesn't interpolate between frames.

This is likely a pretty big question, so I'm also looking for resources that can get me where I need to go.

EDIT

I ask about the animation knowing which limbs it's animating because I would like to have it set up to perform an alternate animation if a required limb is missing. After thinking about that, I imagine I would perform that check before activating an animation, and activate the appropriate animation at that time.

sentences:
What are some good books which detail the fundamentals of graphics processing? The best book on the nitty gritty of graphics that I've found is Computer Graphics: Principles and Practice http://www.amazon.com/Computer-Graphics-Principles-James-Foley/dp/0201121107

However, as this was written in the early 90s, it is a little out of date.

Are there some similar books which go over the more recent developments?

sentences:
trouble getting correct transforms for multiple meshes from assimp importer I have had excellent success in extracting almost everything i need from a collada file that i imported with assimp, however I am struggling to get the correct transforms for each mesh in the file. Each individual mesh has correct vertex data but is not transformed relative to the others.

At first I thought my issue was that I simply wasn't applying the hierarchy of transforms for the meshes, and i read http://www.assimp.org/lib_html/data.html based on an answer from another thread and implemented the void CopyNodesWithMeshes function that is given in pseudo-code there.  However I have found that this didn't help as each mesh is a child of the root node and has only the identity matrix transform for the root and each of the mesh nodes (thus the combined transform for each mesh is identity also).  The hierarchy in the scene appears as follows :

           sceneRoot (identity)
               |
-------------------------------------------------
|               |                  |            |
Mesh0           Mesh1           Mesh2           Skeleton
(identity)      (identity)      (identity)      |
                                                ------------
                                                |    |   (etc)....
                                                (not identity)

There is no reference in the Skeleton to any of the mesh nodes as far as  i can tell.  I have also extracted the skeleton and bones for animation and they work but each mesh is simply at my origin since i cannot extract their transforms.

So i tried to load the model directly with assimp viewer and the 3 meshes load correctly from the model file and are in their correct relative positions.  I even tried to step through the loader code of assimp viewer and as far as i could tell it was getting identity matrix transforms just as i was for the 3 meshes from the sceneNode hierarchy.  But somehow assimp manages to render the 3 meshes correctly.

I am stumped at this point - does anyone know what i might be missing here?

Thanks

I am calling the following from assimp

const aiScene* scene = aiImportFile (fullpath, aiProcess_Triangulate
    | aiProcess_FlipWindingOrder);

And using the following code that i wrote to extract the combined transform for each mesh (though it doesnt do me any good since i get the identity transform for each):

//based on pseudocode of assimp http://www.assimp.org/lib_html/data.html
void CopyNodesWithMeshes(const aiScene* scene, aiNode* node, Matrix& accTransform)
{
    Matrix transform;
    Matrix nodeTrans;
    convertAssimpMatrix(nodeTrans, node->mTransformation);
    //transform = node.mTransformation * accTransform;
    multiplyMatrix(transform, nodeTrans, accTransform);

    // if node has meshes, create a new scene object for it
    if( node->mNumMeshes > 0)
    {
        //new SceneObject
        SceneObj& so = s_sceneObjs[s_numSceneObjs];
        so.numMeshes = node->mNumMeshes;
        for (int i=0; i < node->mNumMeshes; ++i)
        {
            so.mesh[i] = scene->mMeshes[node->mMeshes[i]];
        }
        s_numSceneObjs++;
        assert(s_numSceneObjs < eMaxSceneObjs);
        memcpy(&so.transform, &transform, sizeof(so.transform));

    }

    // continue for all child nodes

    for (int i=0; i < node->mNumChildren; ++i)
    {
        CopyNodesWithMeshes(scene, node->mChildren[i], transform);
    }
}

sentences:
Is it legal to publish a game that uses a youtube tutorials code? I am working on my noughts and crosses game, and I am following a youtube tutorial,
It is helping me write the Java code.
I am wondering I could to publish it to the website itch.io legally.
The game would be free.
Thankyou.

sentences:
Unity: Shader Graph and GPU-Instancing? Unity Version: 2019.4.1f1
Render Pipeline: URP
I created a shader using Unity's ShaderGraph, and i want to apply GPU Instancing on this shader, but there is no way to declare per-instance properties inside the shader graph.
Is there a way to make GPU Instancing work on shader graphs' materials?

sentences:
Auto-generate optimal direction for Unity Raycast with specifications How can I have a Physics.Raycast auto-generate a direction for itself to try to hit a given target through a restricted window of space?

[Update]

After much work, my problem has slightly morphed into one about mesh colliders: given a (convex) mesh collider, how can I detect all of the points intersecting with the collider? Or, if this can be done easily, can I get one Vector3 per object that is within the mesh collider?

[/Update]

This is kind of a long question, so I'll try to explain it the best I can:

I have 3 GameObjects: a source, a target, and a "window". This window sits between the source and target.
I want the source to make a raycast that points in the direction of the target (not necessarily it's transform.position, just a direction that will make it hit the target) and this raycast must pass through (collide and continue through) the window GameObject
I would like to automatically generate this direction for the raycast to follow such that #2 happens
I would like this algorithm to also recognize if the above is not possible
As an added item, I would like this raycast to pass through (collide and continue through) any objects that may be in it's way between it and the window

Here's an image describing my issue in more detail:

How can I accomplish this?

Thank you for your help in advanced!

sentences: whats the difference between the two switches in rpg maker mv? I dont understand what is the difference between the top and bottom set of switches in rpg maker mv. Can someone please explain?

sentences:
Persist emitted particles in scene after particle system has ended/destroyed? In Unity, is is possible to persist emitted particles in a scene after the system has ended or even possibly destroyed?

I have a particle system attached to my player prefabs that does a rudimentary blood splatter, and I'd like for the emitted "blood" particles to stay in the scene for as long as the scene is active, even after the player prefab that originally emitted the particles is destroyed.

sentences: Is sidescroller movement just offsetting the background?, MonoGame/XNA When I make a sidescroller game and what to move my character do I just offset the background, or is there another better way?

sentences:
Should I link GLFW and GLEW into my engine directly? I want to write my own (simple) game engine with OpenGL.
I use GLEW and GLFW and so far linked it successfully.

Should the engine or the respective game (which depends on the engine) include GLFW and GLEW?

Ultimately I would like to create a library out off my engine and include it into my game, but I'm not quite sure if that is possible, if its the case, that the engine should depend on GLFW and GLEW. Would I have to link all the libraries that are neccessary for GLEW and GLFW into the game plus the engine-lib itself?

sentences: 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 I save and load settings on the Xbox? I'm using XNA 4.0. How can I load and save settings when on the Xbox? And can I write to and read from files?

sentences:
Detecting collisions without rigidbody I have a car with the following aspect:

As you can see, colliders are locally static, because they are separated from the original rigidbody component.

Well, as you can suppose, I have a problem, because MonoBehaviours with an OnTrigger(...) or an OnCollision(...) method won't work. (It needs an rigidbody and a collider on the same object)

I thought about Raycasting:

https://docs.unity3d.com/ScriptReference/Physics.BoxCast.html

https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

https://docs.unity3d.com/ScriptReference/Physics.SphereCast.html

But I have another problem, I have to specify a direction, so, using this: http://answers.unity.com/answers/539155/view.html isn't an option because this is too slow?

What can you suggest me?

sentences:
Set multiple render targets with OMSetRenderTargets using ComPtr I've recently decided to get rid of pretty much all of the raw pointers from my Direct3D code, and I ran into a problem with using ComPtr<T> template with multiple render targets.

Microsoft suggests using ComPtr<T> for D3D instead of unique_ptr<T> or shared_ptr<T>. However even their example shows how to use it with OMSetRenderTargets, but I couldn't really find anything how to use it when you have to bind an array of managed objects.

Here's some code of my current solution:

class Texture{
public:
    void Initialize(const Bitmap &bitmap){ /* ... */}

    ID3D11ShaderResourceView* GetShaderResourceView() const { return this->m_pResourceView; }
    ID3D11RenderTargetView* GetRenderTargetView() const { return this->m_pTargetView; }
    ID3D11Resource* GetTextureResource() const { return this->m_pTexture; }

    ID3D11Texture2D* GetTexture2D() const { return static_cast<ID3D11Texture2D*>(this->m_pTexture); }

private:
    ID3D11ShaderResourceView * m_pResourceView;
    ID3D11RenderTargetView * m_pTargetView;
    ID3D11Resource * m_pTexture;
}

class Renderer{
public:
    void Initialize(const Window & targetWindow){ /* ... */ }

    void SetDepthStencilView(ID3D11DepthStencilView* pDepthStencilView = nullptr){
        n = n < RENDER_TARGET_MAX ? n : RENDER_TARGET_MAX;
        if (!n && pRenderTargetView == nullptr) {
            m_renderTargetViews[0] = m_myRenderTargetView;
        } else {
            m_renderTargetViews[n] = pRenderTargetView;
        }
    }

    void SetRenderTargetView(ID3D11RenderTargetView* pRenderTargetView = nullptr, size_t n = 0){
        if (pDepthStencilview == nullptr) {
            m_depthStencilView = m_myDepthStencilView;
        }
        else {
            m_depthStencilView = pDepthStencilview;
        }
    }

    void ApplyRenderTargetView(size_t count = 1){
        m_renderTargetViewCount = count < RENDER_TARGET_MAX ? count : RENDER_TARGET_MAX;
        m_deviceContext->OMSetRenderTargets(m_renderTargetViewCount, m_renderTargetViews, m_depthStencilView);
    }

private:
    ID3D11Device* m_device; // device context, swap chain, raster state, etc ...
    ID3D11RenderTargetView* m_renderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT], *m_myRenderTargetView; // This is the screen as a default
    size_t m_renderTargetViewCount;
    // depth stencil buffer, etc ...
}

void some_use_case(Renderer & render){
    Texture colorMap;
    Texture normalMap;
    Texture positionMap;

    render.SetRenderTargetView(colorMap.GetRenderTargetView(), 0);
    render.SetRenderTargetView(normalMap.GetRenderTargetView(), 1);
    render.SetRenderTargetView(positionMap.GetRenderTargetView(), 2);

    // ... Render geometry
    // ... Render posteffects
}

Keep tracking and releasing all of the resources are way too tedious, and It's reasonable to introduce some smart pointer solution here. How could I replace the pointer definition, and how could I bind it m_renderTargetViews to OMSetRenderTargets?

sentences:
Word in different color in middle of string XNA Is it possible to use different font colors for the same string, for example, when buying a weapon in CoD AW Exo Zombies:

How do I do this?

Thanks.

sentences:
Unity - How to Receive "Animator" on AnimationEvent How to receive "Animator" by parameter on an Animation Event parameter?

Its possible?

sentences: How to efficiently organize different game zones with different functionality? For now I have a list of basic data class like position in game world, dimensions, type and stuff like that, but since I am starting to implement their functionality it seems kind of a bad pattern, I need each zone to have totally different data and behaviour, use different UIs etc, is there a pattern to realize that other that just making one totally different class for each zone?

sentences:
Best approach to 2D racing game AI? I have no experience in AI at all, but I would like to know how I could do this?
Even if the AI just followed a path how could I do this?

sentences:
Why aren't my enemy positions updating? I'm trying to make a dungeon crawler but I need to make the monster move around each turn.

Here's what I tried:

My map is initialized like this:

char map[10][10];

and this is how I spawn the monsters to avoid overwriting:

void fieldinfo::RandomizeMonsterPositions()
{
    int Mcounter=0;
    amountEnemies=10;
    int i=0;
    srand(time(0));

    do
    {
        MposX=rand()%9;
        MposY=rand()%9;

        if(map[MposX][MposY]==enemy)
        {
            //do nothing
        }
        else if(map[MposX][MposY]==player)
        {
            //do nothing
        }
        else
        {
            map[MposX][MposY] = enemy;
            tempPosX[i]=MposX;
            tempPosY[i]=MposY;
            i++;
            Mcounter++;
        }

    }while(Mcounter<10);
}

You can see that I tried to "save" each monster's position in the tempPosX/Y variables to use them here, in my movement logic:

void fieldinfo::RandomizeMonsterMovement()
{
    int mouvement;
    for(int i; i<amountEnemies; i++)
    {
        mouvement=rand()%0;
        switch(mouvement)
        {
        case 0:
            tempPosX[i]++;
            MposX=tempPosX[i];
            break;
        case 1:
            tempPosX[i]--;
            MposX=tempPosX[i];
            break;
        case 2:
            tempPosY[i]++;
            MposY=tempPosY[i];
            break;
        case 3:
            tempPosY[i]--;
            MposY=tempPosY[i];
            break;
        }
    }
}

This doesn't work and I don't know why?

sentences:
GLFW- Help implementing glBufferedData Good Morning,

I've been trying to learn some OpenGL by following the tutorials on learnopengl.com and I've hit a bit of a snag. I'm trying to implement the same functionality as the "Hello Triangle" tutorial (learnopengl.com->Getting Started->Hello Triangle) except I'm trying to put it in its own class. Essentially it is the same code just moved around, The issue is coming from glBufferData(...). from my understanding this function is to essentially bind the data with the buffer object. When glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); is called in my main.cpp file the program operates how it should and it draws the square. But if i comment that out on Main.cpp and move it to BindBuffers on Window.cpp the program still runs but it does not render the square. Any input on why this is happening/ what im doing wrong?

Main.cpp

#include "Engine\Window.h"
#include <glad/glad.h>

#include <GLFW/glfw3.h>

#include <iostream>

int main()

{
    Window window;

// set up vertex data (and buffer(s)) and configure vertex attributes
// ------------------------------------------------------------------
float vertices[] = {
    0.5f,  0.5f, 0.0f,  // top right
    0.5f, -0.5f, 0.0f,  // bottom right
    -0.5f, -0.5f, 0.0f,  // bottom left
    -0.5f,  0.5f, 0.0f   // top left
};
unsigned int indices[] = {  // note that we start from 0!
    0, 1, 3,  // first Triangle
    1, 2, 3   // second Triangle
};

window.GenBuffers();

window.BindBuffers(vertices,indices);
//glBindVertexArray(window.GetVAO());
//glBindBuffer(GL_ARRAY_BUFFER, window.GetVBO());
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, window.GetEBO());
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);

glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
while (window.CheckClose())
{
    window.processInput();
    window.Begin();
    window.Render(window.GetVAO());
    window.End();
    window.Update();
}
window.~Window();
return 0;
}

Window.cpp

#include "Window.h"

Window::~Window() {
    glDeleteVertexArrays(1, &VAO);
    glDeleteBuffers(1, &VBO);
    glDeleteBuffers(1, &EBO);
    glfwTerminate();
}
Window::Window() {
/*** Creates window and intializes shader, if this is needed I can edit but I chopped it to save some room*/
}

void Window::Update() {
    glfwPollEvents();
}
void Window::Begin() {
    glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
}
void Window::End() {
    glfwSwapBuffers(window);
}
bool Window::CheckClose() {
/*Checks if window was closed*/
}
int Window::GetShader() {
    return shaderProgram;
}
void Window::Render(unsigned int VAO) {
    // draw our first triangle
    glUseProgram(GetShader());
    glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized
                            //glDrawArrays(GL_TRIANGLES, 0, 6);
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    // glBindVertexArray(0); // no need to unbind it every time
}
void Window::GenBuffers() {
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &VBO);
    glGenBuffers(1, &EBO);
}
void Window::BindBuffers(float vertices[],unsigned int indices[]) {
    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    //glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
}
unsigned int Window::GetVBO() {
    return VBO;
}
unsigned int Window::GetVAO() {
    return VAO;
}
unsigned int Window::GetEBO() {
    return EBO;
}

sentences:
Why do I get an exception when accessing my sprite members in this fashion? I'm getting a NullReferenceException error on the line where I do new Vector2(...).

I think the problem is with the variables I'm using even though they're working to control the player sprite, so surely they can't be null, right? That is, however, in a different class and is initialized at the top of this one.

Here is the method in question:

public void Shoot()
{
    //if bullet delay resets then shoot
    if (bulletDelay >= 0)
        bulletDelay--;

    //if bullet delay is 0 then create a bullet at player bulletPosition
    if (bulletDelay <= 0)
    {
        //Here I create the new bullet passing in the texture and then modifying the bulletPosition were the bullet will appear from
        bullets newBullet = new bullets();
        bulletPosition = new Vector2(mySprite.imgX, mySprite.imgY);

        newBullet.isVisible = true;
        //These two lines mean that you can have no more that 20 bullets on screen at once
        if (bulletList.Count < 20)
        {
            bulletList.Add(newBullet);
        }
    }

    //reset bullet delay
    if (bulletDelay == 0)
        bulletDelay = 10;
}

bulletDelay is so the player can't spam the shoot button and have it be too easy. I tried to add a breakpoint on that line, when I run the program and hit the space bar that runs the Shoot() method the program stops and tells me about the error. When I hover over though it still says they are null.

I had the instances of the classes in the following code below. I've changed it so they are in the Shoot() method and all seems to well however I'm curious as to why the below code wasn't the correct way to do it:

public void Initialize()
{
    mySprite = new PlayerSprite();
    bulletList = new List<bullets>();
}

sentences:
Animate from end frame of one animation to end frame of another Unity3d/C# So I have two legacy FBX animations; Animation A and Animation B.

What I'm looking to do is to be able to fade from A to B regardless of the current frame A is on.

Using animation.CrossFade() will play A in reverse until it reaches frame 0, then play B forward.

What I'm looking to do is blend from the current frame of A to the end frame of B. Probably via some sort of lerp between the facial position in A and the facial position in the last frame of B.

Does anyone know how I might be able to accomplish this? Either via a built in function or potentially lerping of some sort?

EDIT:
Does anyone perhaps know of a way to read bone positions of an animation at a certain frame? Perhaps if I could read that I could fake animations by doing Vector3 lerps.

sentences:
Get and destroy gameobject component of same type I want to destroy any graphic component on a gameobject , example is image,raw image, sprite , ect .But i don't have the list of all graphic component so i don't know how to loop through it . The reason is because i want to replace the component with the same type , for example i want to add Text component , but i can't add it if there is already graphic component attached in the gameobject because there can only be one graphic component in a gameobject , so i need to destroy the graphic component first , how do i do it ?
I personally prefer the answer on c# but any programming language is accepted !

sentences:
How to move an object to a position? I'm trying to move an object to the coordinates 48.7, 51.07, 102.8, but it does not move. I did some test to make sure that "OnMouseDown" works, and it does, I think it could not be finding the object "upgradeone".

public class click1 : MonoBehaviour {
    GameObject Upgradeone;
    GameObject cube;

    // Use this for initialization
    void Start () {
        Upgradeone = GameObject.Find("upgradeone");
        cube = GameObject.Find ("Cube");
    }

    void OnMouseDown(){
        Upgradeone.transform.localScale = new Vector3(48.7f,51.07f,102.8f);
    }
}

sentences:
How can I improve rendering speeds of a Voxel/Minecraft type game? I'm writing my own clone of Minecraft (also written in Java). It works great right now. With a viewing distance of 40 meters I can easily hit 60 FPS on my MacBook Pro 8,1. (Intel i5 + Intel HD Graphics 3000). But if I put the viewing distance on 70 meters, I only reach 15-25 FPS. In the real Minecraft, I can put the viewing disntance on far (= 256m) without a problem. So my question is what should I do to make my game better?

The optimisations I implemented:

Only keep local chunks in memory (depending on the player's viewing distance)
Frustum culling (First on the chunks, then on the blocks)
Only drawing really visible faces of the blocks
Using lists per chunk that contain the visible blocks. Chunks that become visible will add itself to this list. If they become invisible, they are automatically removed from this list. Blocks become (in)visible by building or destroying a neighbour block.
Using lists per chunk that contain the updating blocks. Same mechanism as the visible block lists.
Use nearly no new statements inside the game loop. (My game runs about 20 seconds until the Garbage Collector is invoked)
I'm using OpenGL call lists at the moment. (glNewList(), glEndList(), glCallList()) for each side of a kind of block.

Currently I'm even not using any sort of lighting system. I heard already about VBO's. But I don't know exactly what it is. However, I'll do some research about them. Will they improve performance? Before implementing VBO's, I want to try to use glCallLists() and pass a list of call lists. Instead using thousand times glCallList(). (I want to try this, because I think that the real MineCraft doesn't use VBO's. Correct?)

Are there other tricks to improve performance?

VisualVM profiling showed me this (profiling for only 33 frames, with a viewing distance of 70 meters):

Profiling with 40 meters (246 frames):

Note: I'm synchronising a lot of methods and code blocks, because I'm generating chunks in another thread. I think that acquiring a lock for an object is a performance issue when doing this much in a game loop (of course, I'm talking about the time when there is only the game loop and no new chunks are generated). Is this right?

Edit: After removing some synchronised blocks and some other little improvements. The performance is already much better. Here are my new profiling results with 70 meters:

I think it is pretty clear that selectVisibleBlocks is the issue here.

Thanks in advance!
Martijn

Update: After some extra improvements (like using for loops in stead of for each, buffering variables outside loops, etc...), I now can run viewing distance 60 pretty good.

I think I'm going to implement VBO's as soon as possible.

PS: All source code is available on GitHub:
https://github.com/mcourteaux/CraftMania

sentences:
Keeping a Character Controller grounded? I've got a character that makes use of isGrounded() to determine whether I can jump, whether my air-jump is reset, and the amount of friction to be applied. I've run into a common problem, isGrounded() is fluctuating every frame returning true and false randomly resulting in jagged movement.

The standard suggestion is to constantly apply gravity. Unfortunately, aside from any other more nuanced issues that this could result in, this only works for me if I apply so much gravity that I am no longer able to climb up slopes. I need a way to keep the character grounded without applying large amounts of gravity every frame.

sentences:
XNA/MonoGame screen scale and keeping aspect My aim is to make a simple 2D platformer, the idea is that it will be a base resolution of 480x270 (16:9) which can scale x2, x4(1920x1080) or go full screen.

I basically do:

graphics.PreferredBackBufferWidth = 480;
graphics.PreferredBackBufferHeight = 270;

and call methods do double or x4 them and then call graphics.ApplyChanges() which work well, I assume any 1x1 pixels from 1x resolution now appear as 2x2 or 4x4.

However in full screen the image is just stretched to whatever fits, how can I make it "letterboxed"?

sentences:
Pathfinding over a moving platform I have beens struggling with the following. In the game I am developing with Unity 5 in C#, I need to implement basic pathfinding over moving platforms (not with moving platforms). It means, I am not concerned that NPC are able to take moving platforms, I am specifically concerned that the whole pathfinding process should happen on big moving floors.

Being that the case, NavMeshes are not an option. Would anyone happen to know of any approach, or have any good tips for that? Thanks in advance for your time.

sentences:
Calculating vertex normals on the GPU I have some height-map sampled on a regular grid stored in an array. Now, I want to use the normals on the sampled vertices for some smoothing algorithm. The way I'm currently doing it is as follows:

For each vertex, generate triangles to all it's neighbours. This results in eight neighbours when using the 1-neighbourhood for all vertices except at the borders.

 +---+---+
 ¦ \ ¦ / ¦
 +---o---+
 ¦ / ¦ \ ¦
 +---+---+

For each adjacent triangle, calculate it's normal by taking the cross product between the two distances.
As the triangles all have the same size when projected on the xy-plane, I simply average over all eight normals then and store it for this vertex.

However, as my data grows larger, this approach takes too much time and I would prefer doing it on the GPU in a shader code. Is there an easy method, maybe if I could store my height-map as a texture?

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:
How do I draw a world rectangle as a GUI I would like to draw a perspective green rectangle that glows (=it constantly changes its alpha between 0 an 1).

I already achieved this, but not as a GUI element, but as a real 3D object.

In order to show this rectangle in front of everything else, I have to turn this into a GUI element. And I don't know how I would draw a perspective rectangle that constantly changes its alpha on the GUI.

I do not only mean the math behind it, but also how to do it exacetly:
Do I use actual materials, or do I use an image in the size of the green box?

Thank you.

Edit:

This is what I'm trying to rebuild:

sentences: My Character objects are complex, how should I organize their structure? I'm using Monogame to make a fighter.  I have created an abstract Character class that has basic character functionality such as HP, meter, update boilerplate and such, and will be overridden as each specific character to include parameters specific to said character.  The abstract Character class has a Move subclass that has mostly static functionality and takes in a delegate that handles its effects.  The problem here is that most of this functionality is static and, to me, doesn't seem to need instantiating, but because the move delegate requires, at the very least, a reference to the instance of the Character that owns it (so that it can work its arbitrary effects on the character, the opponent, the environment, w/e) it seems like it needs to be instantiated, which means feeding a move in (or its delegate) as a parameter for every move I want to give a character, which is going to get very messy very fast.  What should I do about this?

sentences:
Choosing the correct network protocol for my type of game (its Wc3 Warlock style) I need to code a little game for a school project.

The type of the game is like the Warcraft 3 map "Warlock", if anyone doesnt know it, here is a short description:
up to ten players spawn into an arena filled with lava, the goal of each player is to push the other players into the lava with spells (basically variations of missiles, aoe nukes, moba spells etc)
http://www.youtube.com/watch?v=c3PoO-gcJik&feature=related

we need to provide multiplayer-support over the internet, for that reason I am looking for the best network protocol for this type of game (udp, tcp, lock step, client-server...)

what the requirements are:
- same/stable simulation on all clients
- up to ten players
- up to ~100 missiles on the field
- very low latency since its reaction based (i dont know the method wc3 used, but it was playable with the old servers)

what would be nice (if even possible, since the traffic might be too big):
- support for soft bodies over the network (with bullet physics), but this is no real requirement

I read several articles about the lock step method used for RTS games, this seems to be great, but does it fit for real-time action games too (ping-related)?

If anyone has run into the same problems/questions like me, I would be very happy about any help

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

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

thank you.

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:
Restricting Camera Movements with OpenGL I've been programming a game using the Java library LWJGL. I've got a little problem, though. It is a 2D game, and I'm aiming for a game like the original Civilization (I quick Google of "Civilization 1" will show you what I want). So far I have been able to generate a random 64x64 tile world. Each tile is .5f in size, drawn like this:

float size = .5f;

//...

GL11.glTexCoord2f(uvCoords[0][0], uvCoords[0][1]); GL11.glVertex3f(-size, size, 0.0f);
    GL11.glTexCoord2f(uvCoords[1][0], uvCoords[1][1]); GL11.glVertex3f( size, size, 0.0f);
    GL11.glTexCoord2f(uvCoords[2][0], uvCoords[2][1]); GL11.glVertex3f( size,-size, 0.0f);
    GL11.glTexCoord2f(uvCoords[3][0], uvCoords[3][1]); GL11.glVertex3f(-size,-size, 0.0f);

Now, I don't want my camera to be able to leave this 64x64 space and see black. My camera works like this:

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 am restricting its movements like this:

public void moveForward(float distance)
    {
        if(position.y <= 0.5f)
        {
            return;
        }
        position.y -= distance;
    }

    public void moveBackward(float distance)
    {
        if(position.y >= Constants.WORLD_SIZEY - 0.5)
        {
            return;
        }
        position.y += distance;
    }

    public void moveLeft(float distance)
    {
        if(position.x <= 0.5f)
        {
            return;
        }
        position.x -= distance;
    }

    public void moveRight(float distance)
    {
        if(position.x >= Constants.WORLD_SIZEX - 0.5)
        {
            return;
        }
        position.x += distance;
    }

Because the camera's location is the top left corner of the display, it works great for moveForward and moveLeft. However, for moveBackward and moveRight, it moves out of the 64x64 box until the top left corner gets to the edge.
How do I prevent this, because I don't know how to get the screens length in the units I am making the tile sizes.

Sorry if this is hard to understand, because I don't know how to explain it myself. That's why I've had so much trouble finding an answer.

sentences:
Increasing flexibility of a data passing system in a component based entity system I'm creating a Component orientated system for a small game I'm developing. The basic structure is as follows: Every object in the game is composed of a "GameEntity"; a container holding a vector of pointers to items in the "Component" class.

Components and entities communicate with one another by calling the send method in a component's parent GameEntity class. The send method is a template which has two parameters, a Command (which is an enum which includes instructions such as STEP_TIME and the like), and a data parameter of generic type 'T'. The send function loops through the Component* vector and calls each's component's receive message, which due to the template use conveniently calls the overloaded receive method which corresponds to data type T.

Where the problem comes in however (or rather the inconvenience), is that the Component class is a pure virtual function and will always be extended. Because of the practical limitation of not allowing template functions to be virtualised, I would have to declare a virtual receive function in the header for each and every data type which could conceivably be used by a component. This is not very flexible nor extensible, and moreover at least to me seems to be a violation of the OO programming ethos of not duplicating code unnecessarily.

So my question is, how can I modify the code stubs provided below to make my component orientated object structure as flexible as possible without using a method which violates best coding practises

Here is the pertinent header stubs of each class and an example of in what ways an extended component class might be used, to provide some context for my problem:

Game Entity class:

class Component;

class GameEntity
{

public:
GameEntity(string entityName, int entityID, int layer);

~GameEntity(void){};

//Adds a pointer to a component to the components vector.
void addComponent (Component* component);

void removeComponent(Component*);

    //A template to allow values of any type to be passed to components
template<typename T>
void send(Component::Command command,T value){
       //Iterates through the vector, calling the receive method for each component
    for(std::vector<Component*>::iterator it =components.begin();  it!=components.end();it++){
        (*it)->receive(command,value);
    }
}
private:
     vector <Component*> components;

};

Component Class:

#include "GameEntity.h"
class Component
{
public:
static enum Command{STEP_TIME, TOGGLE_ANTI_ALIAS, REPLACE_SPRITE};

Component(GameEntity* parent)
    {this->compParent=parent;};

virtual ~Component (void){};

GameEntity* parent(){
    return compParent;
}
void setParent(GameEntity* parent){
    this->compParent=parent;
}

virtual void receive(Command command,int value)=0;
virtual void receive(Command command,string value)=0;
virtual void receive(Command command,double value)=0;
virtual void receive(Command command,Sprite value)=0;
    //ETC. For each and every data type

private:
GameEntity* compParent;

};

A possible extension of the Component class:

#include "Sprite.h"
#include "Component.h"
class GraphicsComponent: Component{
    public:
          GraphicsComponent(Sprite sprite, string name, GameEntity* parent);
          virtual void receive(Command command, Sprite value){
                 switch(command){
                      case REPLACE_SPRITE: this->sprite=value; break
                 }
           }

    private:
          Spite sprite;

}

Should I use a void pointer and cast it as the appropriate type? This might be feasible as in most cases the type will be known from the command, but again is not very flexible.

sentences:
SDL_SetColorKey in SDL c++ removes most of the white pixels but there is a border around my character I have drawn all of the images of my sprite in paint. Is there a way to remove all white pixels?

bool Game::loadFromFile(std::string path)
{
    free();

    SDL_Texture* newTexture = NULL;
    SDL_Surface* loadedSurface = IMG_Load(path.c_str());

    if(loadedSurface == NULL)
    {
        printf("Unable to load image %s! SDL_image Error: %s\n", path.c_str(), IMG_GetError());
    }

    else
    {
        //Color key image
        Uint32 colorKey = SDL_MapRGB(loadedSurface->format, 255, 255, 255);
        SDL_SetColorKey(loadedSurface, SDL_TRUE, colorKey);

        //Create texture from surface pixels
        newTexture = SDL_CreateTextureFromSurface(gRenderer, loadedSurface);

        if(newTexture == NULL)
        {
            printf("Unable to create texture from %s! SDL Error: %s\n", path.c_str(), SDL_GetError());
        }

        else
        {
            //Get image dimensions
            mWidth = loadedSurface->w;
            mHeight = loadedSurface->h;
        }

        //Get rid of old loaded surface
        SDL_FreeSurface(loadedSurface);
    }

    //Return success
    mTexture = newTexture;
    return mTexture != NULL;
}

void Game::free()
{
    //Free texture if it exists
    if(mTexture != NULL)
    {
        SDL_DestroyTexture(mTexture);
        mTexture = NULL;
        mWidth = 0;
        mHeight = 0;
    }
}

void Game::render(int x, int y, SDL_Rect* clip)
{
    //Set rendering space and render to screen
    SDL_Rect renderQuad = {x, y, mWidth, mHeight};

    //Set clip rendering dimensions
    if(clip != NULL)
    {
        renderQuad.w = clip->w;
        renderQuad.h = clip->h;
    }

    //Render to screen
    SDL_RenderCopy(gRenderer, mTexture, clip, &renderQuad);
}

int Game::getWidth()
{
    return mWidth;
}

int Game::getHeight()
{
    return mHeight;
}

bool Game::Initialize()
{
    bool success = true;

    if(SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf("SDL could not initialize! SDL Error: %s\n", SDL_GetError());
        success = false;
    }

    else
    {
        if(!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1"))
        {
            printf("Warning: Linear texture filtering not enabled!");
        }

        gWindow = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);

        if(gWindow == NULL)
        {
            printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
            success = false;
        }

        else
        {
            gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
            sBackground = SDL_LoadBMP("BackgroundLeft.bmp");
            tBackground = SDL_CreateTextureFromSurface(gRenderer, sBackground);

            if(gRenderer == NULL)
            {
                printf("Renderer could not be created! SDL Error: %s\n", SDL_GetError());
                success = false;
            }

            else
            {
                SDL_SetRenderDrawColor(gRenderer, 255, 0, 255, 0xFF);

                int imgFlags = IMG_INIT_PNG;

                if(!(IMG_Init(imgFlags) & imgFlags))
                {
                    printf("SDL_image could not initialize! SDL_mage Error: %s\n", IMG_GetError());
                    success = false;
                }
            }
        }
    }

    return success;
}

sentences: What is some game development literature purely in javascript? I'm mainly interested in the videogames development in pure javascript, since nowadays there's so many books about htm5 and javascript I couldn't find any book about game development with javascript only.

sentences:
How to update UI after changing text in a view After applying a text change to a scrolling view, how do you get the new height of the text, resize other UI elements around the changed text length, etc?

Many have posted this question. Some have noted that the rect size doesn't change or that they have to wait multiple frames to then react to the UI updates.

sentences:
unity3d - Instantiate and fire bullet realtive to player rotation in 3D 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. Also tried putting the script on the player itself but also didn't work.

GameObject projectile =  Instantiate (bullet, transform.position, transform.rotation) as GameObject;

 projectile.GetComponent().AddForce(transform.forward * speed);

The problem is the bullets doesn't behave as intended, instead they don't appear relative to the player rotation and they just go in a very different direction. Shouldn't "Transform.Forward" mean forward in the Z position regarding the object's transform ?

sentences:
Mathf.Clamp not Working Properly I want to clamp the vertical rotation of the first person controller I was making. I want to restrict the vertical rotation of the main camera between -90 and 90 degrees. The code is as follows:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseY : MonoBehaviour
{
    [SerializeField]
    private float _sensitivity = 5.0f;
    private float _verticalInput;

    // Update is called once per frame
    void Update()
    {
        _verticalInput = Input.GetAxis("Mouse Y") * _sensitivity;
        Vector3 lookDirectionY = transform.localEulerAngles;
        lookDirectionY.x -= _verticalInput;
        lookDirectionY.x = Mathf.Clamp(lookDirectionY.x, -90f, 90f);
        transform.localEulerAngles = lookDirectionY;
    }
}

In the above code, Mathf.Clamp does not work for -90. On reaching 0 degrees, it reels back to the +90 degrees. What could be the reason for this and how to resolve it?

sentences:
Moving an image by rotating and increasing y axis causes a trailing issue Forgive me if me anything is unclear, this is a tricky thing for me to explain.

In an applet I draw a little ship gif. I have it so I can rotate the object and then increase or decrease the y axis to move the little guy around the screen. The problem it seems is that the coordinates for the ship are not in sync with those of the applet window?

For example: the boundaries for my applet window are 800 by 600. I move the ship by rotating it and then increasing or decreasing the y axis, but whenever the Y axis is exceeds 600 or is lower than 0 I get this weird trailing issue. Am I doing buffering right?

here are my "Main" and "ship" classes:

Main class:

    public class Main extends Applet implements Runnable, KeyListener
{
    ship player1;
    private Image i;
    private Graphics buffer;
    AffineTransform affineTransform = new AffineTransform();

    public void init()
    {
        this.setSize(800, 600);
        this.setBackground(Color.BLACK);
        addKeyListener(this);
    }

    @Override
    public void start() {
        player1 = new ship();
        Thread thread = new Thread(this);
        thread.start();
    }

    @Override
    public void paint (Graphics g){
        Graphics2D g2d=(Graphics2D)g;
        player1.paint(g2d, this);
    }

    @Override
    public void update(Graphics g){
        Graphics2D g2d=(Graphics2D)g;
        if(i == null){
            i = createImage(this.getSize().width, this.getSize().height);
            buffer = i.getGraphics();
        }
        buffer.setColor(getBackground());
        buffer.fillRect(0, 0, this.getWidth(), this.getHeight());
        buffer.setColor(getForeground());
        paint(buffer);
        g2d.drawImage(i, 0, 0, this);
    }

    @Override
    public void keyPressed(KeyEvent e) {
        switch(e.getKeyCode()){
        case KeyEvent.VK_RIGHT:
            player1.rotateRight();
            break;
        case KeyEvent.VK_LEFT:
            player1.rotateLeft();
            break;
        case KeyEvent.VK_UP:
            player1.moveUp();
            break;
        case KeyEvent.VK_DOWN:
            player1.moveDown(this);
            break;
        }
    }

    @Override
    public void keyReleased(KeyEvent e) {
    }
    @Override
    public void keyTyped(KeyEvent e) {
    }

    @Override
    public void run() {
        while(true){
            repaint();
            try {
                Thread.sleep(17);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

ship class:

    public class ship {
    private Image sprite_ship;
    //private Image ship_engines_green;
    private int x = 300;
    private int y = 500;
    //private int dx = 10;
    private int dy = 10;
    private int my = 0;
    AffineTransform affineTransform = new AffineTransform();
    double rotation;

    public ship() {
        sprite_ship = Toolkit.getDefaultToolkit().getImage("ship.gif");
        //ship_engines_green = Toolkit.getDefaultToolkit().getImage("ship_engines_green.gif");
    }

    public void moveDown(Main M){
        y += dy;
        System.out.println("Y axis: "+y);
        System.out.println("X axis: "+x);
    }

public void moveUp(){
        y -= dy;
        System.out.println("Y axis: "+y);
        System.out.println("X axis: "+x);
    }

public void rotateRight(){
    rotation += 5;
    System.out.println("Rotation : "+rotation);
}
public void rotateLeft(){
    rotation -= 5;
    System.out.println("Rotation : "+rotation);
}
    public void paint(Graphics g, Main M){
        int spriteHeight = sprite_ship.getHeight(null);
        int spriteWidth = sprite_ship.getWidth(null);
        Graphics2D g2d=(Graphics2D)g;
        affineTransform = g2d.getTransform();
        g2d.rotate(Math.toRadians(rotation), x+spriteWidth/2, y+spriteHeight/2);
        g2d.drawImage(sprite_ship,x,y,M);
        rotation = 0;
    }
}

much thanks for any suggestions or if anyone can point out something I'm doing that's terribly misguided.

sentences:
How to represent a map in a top-down perspective game with low algorithm complexity? This is the first time I develop a video-game, and I am kind of lost.

I would like to know about ways on representing 2D maps on a top-down perspective game...

(Like this one: vengadoravg.github.io/1/game.html btw, this is the first game I develop)

So far, I've found one way to represent a 2D map in a top-down perspective game:

Using a matrix. Where a normal floor place is represented by some number (or character), the obstacles are represented by a different number, and the enemies by another different number. This matrix would allow me to run graph theory algorithms and crazy things, but i think it would be, algorithmically, very complex, because the graph would be really populated and dense. Thus, all the sprites should be the same size, otherwise, the matrix would be really, really big.

Are there any other (better) ways?

In terms of algorithm complexity, which of them are the best to run graph theory algorithms?

I apologize if the question sounds subjective... but i think the superiority of an approach can be determined by its algorithmic complexity :)

sentences: 2d game with png sequences slowing on Unity3d We are building a tower defence game,In which enemy movement is done through sprite sheets as well the tower rotation is also done through sprites...every tower and every enemy has its own script attached to it which controle its animation...but when enemies and towers are in greater ammount the games slows down..and become laggy on iphone and unity ..can anyone tell what is the problem with it...

sentences:
How can I handle delayed function calls? I have objects, and each object has a function pointer that will be assigned a function. When the object is clicked, the assigned function will be called.
I want to have a function do things with delay, meaning it would look something like this:

void function() {
    doSomething();
    wait(1000);     // either 1000 frames, or 1000 miliseconds
    doSomethingElse();
}

I heard threading shouldn't be abused, and main script should all be put in the same thread. There are lots of game engines out there that can handle such functions with a delay in time. My idea was to call the function in a new thread every time.

Is this a bad idea? If it is, how else would I manage to achieve this functionality?

Edit: the website asked to confirm it's not a duplicate question and I think it's not because it's a bit more complicated of an issue, even though it may use a similar solution.

sentences:
What is the code for panning a camera from touch input? (libGDX + scene2d) I would like the user to pan around a game world by dragging their finger on a touch screen - just like Google Maps. I tried a few things but I'm not having much success thus far.

Here is where I'm up to.

public class Game extends ApplicationAdapter {
    Stage stage;

    @Override
    public void create () {

        stage = new Stage(new ScreenViewport());
        Gdx.input.setInputProcessor(stage);

        // Create world
        Planet planet = new Planet();
        stage.addActor(planet);

        stage.addListener(new ActorGestureListener() {

            public void pan(InputEvent event, float x, float y, float deltaX, float deltaY) {
                ((OrthographicCamera)stage.getCamera()).translate(deltaX, deltaY);
                stage.getCamera().update();
            }
        });

    }

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

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

}

sentences:
determine collision angle on a rotating body update: new diagram and updated description

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

questions:

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

I have the following javascript so far:

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

  var pos = this.body.GetPosition();

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

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

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

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

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

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

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

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

}

sentences:
What is the difference between a bonus and a power-up? What is the difference between the notions of "bonus" and "power-up?"

I have in-game some objects and the player has the ability to pick up some bonuses/power-ups that allow the player to create an explosion all around. There's also an item that lets the player teleport from one place to another -- are these all power-ups?

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:
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 you prevent inflation in a virtual economy? With your typical MMORPG, players can usually farm the world for raw materials essentially forever. Monsters/mineral veins/etc are usually on some sort of respawn timer, so other than time there really isn't a good way to limit the amount of new currency entering the system.

That really only leaves money sinks to try to take money out of the system. What are some strategies to prevent inflation of the in-game currency?

sentences:
Unity3d Resources.LoadAll empty array In my resources folder structure I have myself a file, now in the unity editor this file is a Texture Type Sprite (2D and UI), now when I attempt to run this code in one of my scripts

var icons = Resources.LoadAll<Sprite>("Images/BuffIcons");

My icons variable is empty, now if I change the line above to

var icons = Resources.LoadAll("Images/BuffIcons");

It comes back with an array which has a Texture2D and then multiple Sprite objects. Now why can't I cast the objects to a Sprite?

Also just for your information the Sprite (2D and UI) is a Multiple sprite so this sprite in total has like 42 different sprites. It seems to me the sprite which holds all the other sprites is classed as a Texture2D and then all the sprites inside of the Texture2D are Sprites. How can I just tell the Resources.LoadAll to load the sprites?

Basically the same problem as this user http://answers.unity3d.com/questions/900990/assetdatabaseloadallassetsatpath-not-loading-asset.html however the answers provided don't work for me either :(

sentences:
How to map texture to shape in Slick 2D I need to map texture to shape. Texture:

This is a example of shapes I need to map texture to:

Notice that each piece in mesh has exactly 4 point to map texture. Logic is pretty straight forward: Top center edge to top in mesh etc.

I found some methods on Graphics object like texture(...) however these methods cannot handle diamond texture properly..?

I found this method:

ShapeRenderer.texture(shape, image, generator)

Where generator is:

org.newdawn.slick.geom.TexCoordGenerator

However I don't understand How It can be used to map the image to the shape.

How to use it? Is there other way?

sentences:
Placeing stones/tiles on a board game I am a beginner at libGdx.

I am building a board game (the Fanorama game). I would like to use a pic as the board and place the pieces on the board on top of the board sprite. Is there a nice way to pre-determine what (x,y) co-ordinate locations on the board sprite are valid for placing a piece. Later on, when the game is being played I would like to move the pieces from location to location.

Right now, the only way I can think of is to calculate each piece location pixel co-ordinates and hard-code it in an array. I am not sure if there is a better way to do this and a best practice way for me to learn. I am also concerned if this will be affected when the user resized the screen or uses a different sized device (mobile).

How to solve this problem?

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:
Bullet 3D Physics Objects Not Rotating? So I've got Bullet 3D controlling the motion of objects rendered with DirectX.
In the clipping below I've got 2 identical rectangles & 5 balls.
The lowest rectangle has a mass of 0 and doesn't move (as expected).  All other objects have a mass of 1 and fall as expected.

There are two issues that I'm seeing:
1. When the balls land on an angled surface (not shown) they don't rotate, but they do move 'down hill'.
2. Pictured below you see that the top rectangle is perched on the bottom rectangle when it should've rotated a bit and kept falling.

What do I need to do in Bullet to enable object rotations? I'm not a physicist so I suspect my google-fu is lacking, also the Bullet docs are painfully inadequate.

This code here is how I initialize my rigid bodies:

RESULT_CODE ubAddRigidBody(HANDLE collisionShape, float mass, ubVector3 position, ubVector4 orientation, HANDLE* rigidBodyHandle)
{
if (rigidBodyHandle == nullptr)
{
    return INVALID_PARAM;
}

if (_world->isValidCollisionShapeHandle(collisionShape) != SUCCESS)
{
    return INVALID_HANDLE;
}

auto transform = btTransform(btQuaternion(orientation.x, orientation.y, orientation.z, orientation.w), btVector3(position.x, position.y, position.z));
auto collisionShapeObject = _world->m_collisionShapes[collisionShape].get();

auto motionStateObject = new btDefaultMotionState();
motionStateObject->setWorldTransform(transform);

auto rigidBodyInfo = btRigidBody::btRigidBodyConstructionInfo(btScalar(mass), motionStateObject, collisionShapeObject);

// Enable rotations for the object

collisionShapeObject->calculateLocalInertia(mass, rigidBodyInfo.m_localInertia);
rigidBodyInfo.m_linearDamping = .2f;
rigidBodyInfo.m_angularDamping = .2f;

auto rigidBody = new btRigidBody(rigidBodyInfo);
auto uniqueHandle = _world->getUniqueHandle();

rigidBody->setFriction(.5f);
rigidBody->setRollingFriction(.5f);

_world->m_world->addRigidBody(rigidBody);
_world->m_rigidBodies[uniqueHandle] = unique_ptr<ubRigidBody>(new ubRigidBody(rigidBody, collisionShapeObject, motionStateObject));

*rigidBodyHandle = uniqueHandle;

return SUCCESS;
}

sentences:
Reset Opengl multisampling I start using multisampling by doing

        ContextAttribs attribs = new ContextAttribs(3, 3).withForwardCompatible(true).withProfileCore(true);
        Display.create(new PixelFormat().withSamples(8), attribs);
        GL11.glEnable(GL13.GL_MULTISAMPLE);

How would I reset how many samples it uses?

sentences:
Does collision detection data structures require a manifold mesh Is it possible to apply spatial split techniques (oct-trees bsp-trees, etc) when meshes are not necessary manifolds?

The mesh in question represents the "map". This means that it is static so spatial splits should be a good approach. Not requiring a manifold saves a lot of time when modeling, and also it may reduce the number of extra faces that has to be drawn, as forcing the mesh to be a manifold may require additional cuts.

sentences: Publishing a game on Google Play with a fake name I'm almost publishing my game to Google Play, but I wonder if I can use an fake name, I mean, not using a fake name with a real names, just some words like Lazer Dude or anything else, because I don't want to show who am I, I wanna keep my anonymously. There's no problem to use an fake name?

sentences:
XNA: How to capture precise time of button press? I'm guessing the default XNA model encourages checking for button presses in Update(). However, I am developing a game-like application for research and need to measure reaction times as quickly as possible. If I only check button presses in Update(), this constrains me to the refresh rate of the application. For example, if Update() runs 60 times per second, button capture times could be off by up to 16.6ms (1/60) if they happen soon after the thread goes to sleep. Is there another way to design my application to catch button presses as soon as possible?

Should I run a separate thread that polls the game controller and runs faster than the regular application's 60 Hz, say 120 Hz?

Or should I run a thread that gets a hardware interrupt when a button is pressed and store the time?

Other ideas?

(I know this sounds excessive when we are talking about button pressing and 20ms or less, but there are a number of scientific applications out there that advertise millisecond level timing precision. I am just wondering if I might be able to get something reasonably close with XNA.)

sentences:
How to choose a success and failure sound I create a math game where the user has to solve an equation. If the user is right, the application plays sound A. If he's wrong, it plays sound B.

What criteria should I use to choose sounds for A and B?

sentences:
Make gameObject “stick” to another gameObject after it has collided with it? Currently, I am using the following code to make objects stick to other gameObjects.

rb = GetComponent<Rigidbody>();
rb.isKinematic = true;
gameObject.transform.SetParent (col.gameObject.transform);

It works perfectly, but it causes many other problems... For example, after colliding, it can no longer detect collisions... Is there an alternative to this code (which makes a gameObject stick to another one after collision)?

sentences:
Is it possible to work with a dedicated server in XNA? Hi I want to release my XNA game to the XBOX platform, but I'm worried about the networking limitations. Basically, I want to have a dedicated (authoritative) server, but it sounds like that is not possible.

Which is why I'm wondering about:

Using port 80 web calls to php-driven database
Using an xbox as a master-server (is that possible?)

I like the sound of #1, because I could write my own application to run on the xbox, and I would assume other users could connect to it similar to the p2p architecture.
Anyone able to expand on theory #2 above? or #1 as worst-case scenario?

sentences: How to move a body from one world to another? I have a Box2D world for each level in my game. When a level is completed, I want the player to be removed from the completed level's world and added to the next level's world. How do I do this?

sentences:
How to get all tiles along a straight vector path? Let's say I have a 100x100 map of tiles where each tile is 16x16 pixels.
How would I get all tiles along a path? For example, let's say I wanted to get a list of all tiles along the shortest direct path between x: 50, y: 100 and x: 225, y: 200
To convert a coordinate to tile space, you simply divide the coordinate by the tile size and then floor it.
So with this example, the world coordinates would be converted to the following tile coordinates:
let tileStartX = Math.floor(50 / 16); // 3
let tileStartY = Math.floor(100 / 16); // 6

let tileEndX = Math.floor(225 / 16); // 14
let tileEndY = Math.floor(200 / 16); // 12

So, we'd be looking for all tiles between x: 3, y: 6 and x: 14, y: 12 like in this example image (0, 0 is top left here):

It's easy enough to convert world coordinates to tile coordinates, but what I'm having trouble with how to get all the intermediate tiles along the diagonal.
Also, I think I may have messed up the drawing slightly because I didn't fill in some white squares where the units have to briefly walk through.

sentences:
Coroutine problem, I don't know what's happening Calling function.

 private const int deathHangTime = 2;
 private void Die()
    {
          Debug.Log("1 " + Time.time);
          StartCoroutine(DelayForTime(deathHangTime));
          Debug.Log("4 " + Time.time);
    }

  Coroutine

IEnumerator DelayForTime(float time)
{
     Debug.Log("2 " + Time.time);
     yield return new WaitForSeconds(time);
     Debug.Log("3 " + Time.time);
}

Why doesn't it wait for 2 seconds?
Why doesn't it print the 3rd Debug line?

sentences:
JSON Parse (Invalid Value) My settings.json (generated with JsonUtility.ToJson):

{
    "masterVolume": 0.10000000149011612,
    "fullScreenMode": 1,
    "cheatsEnabled": false
}

Offending line:

SettingsData sd = JsonUtility.FromJson<SettingsData>(Application.dataPath + "/Settings/settings.json");

My SettingsData-class.

[System.Serializable]
public class SettingsData
{
    [SerializeField]public float masterVolume;
    [SerializeField]public int fullScreenMode;
    [SerializeField]public bool cheatsEnabled;

    public SettingsData(float masterVolume, FullScreenMode fullScreenMode, bool cheatsEnabled)
    {
        this.masterVolume = masterVolume;
        this.fullScreenMode = (int)fullScreenMode;
        this.cheatsEnabled = cheatsEnabled;
    }
}

I really can't fathom why it's having trouble reading this back in, I even tried to save the enum as an int instead, but still no luck.

sentences:
How can I find the center position of two or more objects? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveCameraBehind : MonoBehaviour
{
    public GameObject camera;
    public List<GameObject> targets = new List<GameObject>();
    public float cameraDistance = 10.0f;
    public bool behindMultipleTargets = false;
    public string cameraWarningMsgs = "";
    public string targetsWarningMsgs = "";

    // Use this for initialization
    void Start()
    {
        if (camera == null)
        {
            var cam = GetComponent<Camera>();
            if (cam != null)
            {
                cameraWarningMsgs = "Gettig camera component.";

                camera = transform.gameObject;
            }
            else
            {
                cameraWarningMsgs = "Creating a new camera component.";

                GameObject NewCam = Instantiate(new GameObject(), transform);
                NewCam.name = "New Camera";
                NewCam.AddComponent<Camera>();
                camera = NewCam;
            }
        }

        if(targets.Count == 0)
        {
            targetsWarningMsgs = "No targets found.";
        }
    }

    void FixedUpdate()
    {
        if (targets.Count > 0)
        {
            MoveCameraToPosition();
        }
    }

    public void MoveCameraToPosition()
    {
        if (targets.Count > 1 && behindMultipleTargets == true)
        {
            var center = CalculateCenter();
            transform.position = new Vector3(center.x, center.y + 2, center.z + cameraDistance);
        }

        if (behindMultipleTargets == false)
        {
            Vector3 center = targets[0].transform.position - targets[0].transform.forward * cameraDistance;
            transform.position = new Vector3(center.x, center.y + 2, center.z);
        }
    }

    private Vector3 CalculateCenter()
    {
        Vector3 center = new Vector3();

        var totalX = 0f;
        var totalY = 0f;
        foreach (var target in targets)
        {
            totalX += target.transform.position.x;
            totalY += target.transform.position.y;
        }
        var centerX = totalX / targets.Count;
        var centerY = totalY / targets.Count;

        center = new Vector3(centerX, centerY);

        return center;
    }
}

The CalculateCenter function make the targets(objects) to change positions and vanish away far away.
Even if there is only one single target.

What I want to do is if there is one object for example one 3d cube position the camera behind the cube.
And if there are more cubes for example two or ten and the camera is somewhere else calculate the middle position behind the targets and position the camera in the middle behind them.

To show what I mean in this example the view(like a camera) is behind the two soldiers in the middle position between them from behind.

But what if there are 5 soldiers how can I find the middle position and then position the camera behind them like this example in the screenshot ?

sentences:
How can use a 3D map with 2D characters (Unity)? I tried to search something about it but I can't find any complete or well-explained tutorials about how to use a 3D map with 2D characters and items, like Ragnarok or Final Fantasy Tactics.

If there is no tutorials about this topic, are there any recommendations for studying the subject? I've already developed some games using XNA, but only 2D games, I've never tried to use 3D models, nor have I used Unity to develop games.

sentences:
How do I change a shape without affecting the rest of the screen? I have drawn a shape like this in OpenGL:

 glColor4f(red,green,blue);
        glBegin(GL_QUADS);
            glVertex2f(x1,y1);
            glVertex2f(x2,y2);
            glVertex2f(x3,y3);
            glVertex2f(x4,y4);
        glEnd();
glFlush();

and I want change one the vertices like

glVertex2f(x_delta,y_delta);

But how do I redraw the shape without altering the other components of the screen?

sentences:
3DS Max MassFX -- Animation to XNA without bones/skins? I made a model in which a number of cobble stones fall into a hole using the rigid bodies in 3DS Max 2012 MassFX. They are just editable polys, no skin, no bone. I want this to play (Take 001, 0-100 frames) when the game loads the mesh. I haven't found a way to get to the animation though.

Does anyone have suggestions? All the tutorials for animated skinned models don't seem to work with a model set up like this? Do I really need to give each of 145 rocks a bone? If so, does anyone have a suggestion how to streamline that, or if there is an alternate solution to achieving this effect? The animation only needs to play once when the game starts, and that's it.

Thanks.

sentences: Is it possible to use C++ with Unity instead of C#? The title kind of says it all. Is it possible to replace C# with C++ on a game using Unity?

sentences:
Can not enable IME to capture Chinese characters in SharpDX Just found that direct integration of IME is blocked in Windows 8, moving on to TSF now.
  By now, there is lack of Microsoft's Document about TSF, this will be hard.

I am using SharpDX and the RenderForm. However, when I execute the game, IME is disabled and I can only capture English chars.

Hot Keys are not working. I tried using

ImmSetOpenStatus(imeContext, true);

and

this.ImeMode = System.Windows.Forms.ImeMode.On;

but nope, not working, and I tried to disable DirectInput in the game, still can not switch on the IME.

Are there any window message that tells IME to open?
Here is my code of capturing window's message:

    protected override void WndProc(ref Message m)
    {
        if (m.Msg == WindowMessage.InputLanguageChange)
            return;
        if (m.Msg == WindowMessage.ImeSetContext && m.WParam.ToInt32() == 1)
        {
            IntPtr imeContext = ImmGetContext(this.Handle);
            if (context == IntPtr.Zero)
                context = imeContext;
            ImmSetOpenStatus(imeContext, true);
            ImmAssociateContext(this.Handle, context);
        }
        base.WndProc(ref m);

        switch (m.Msg)
        {
            case (int)WindowMessages.WM_GETDLGCODE:
                if (Is32Bit)
                {
                    int returnCode = m.Result.ToInt32();
                    returnCode |= (DLGC_WANTALLKEYS | DLGC_WANTCHARS);
                    m.Result = new IntPtr(returnCode);
                }
                else
                {
                    long returnCode = m.Result.ToInt64();
                    returnCode |= (DLGC_WANTALLKEYS | DLGC_WANTCHARS);
                    m.Result = new IntPtr(returnCode);
                }
                break;
            case (int)WindowMessages.WM_CHAR:
                int charInt = m.WParam.ToInt32();
                InputChar InputChar = new InputChar();
                InputChar.IsUsed = false;
                InputChar.Chars = (char)charInt;
                    switch (charInt)
                    {
                        case 8:
                            InputChar.CharacterType = charType.BackSpace;
                            break;
                        case 9:
                            InputChar.CharacterType = charType.Tab;
                            break;
                        case 13:
                            InputChar.CharacterType = charType.Enter;
                            break;
                        case 27:
                            InputChar.CharacterType = charType.Esc;
                            break;
                        default:
                            InputChar.CharacterType = charType.Char;
                            break;
                    }
                    if (OnInput != null)
                    {
                        InputChars.Add(InputChar);
                        OnInput(this, InputString);
                    }
                break;
        }
    }

Hope you guys can help me, really don't know what to do now.

sentences:
FBO picking in Oculus Rift applications I am writing an Oculus Rift application, I am rendering a very high poly mesh that I wish to be able to perform picking on using the Oculus Touch. Ideally, I want to be able to get the "triangle" id and other information attached to it.

Currently, I am using an OBB Tree and ray casting to perform picking on the CPU, It works perfectly, the problem is that even with OBB tree the picking process is slow. I thought I'd perform picking on the GPU by rendering the view (from the point of view of the Oculus Touch) to an FBO using a custom shader that outputs "triangle information" to the buffer and then use glReadPixels to  read the central pixel data. The problem I am facing is that the Oculus does distortion to  my on-screen scene but there is no way to apply it to the off-screen buffer, so there is significant difference between the on-screen buffer and the off-screen buffer.

My question is, Is ray casting the only feasible way to do picking in Oculus Apps or is there a way to perform the faster FBO picking even when the view distorted?

sentences:
2D non-tile based map editor I am currently developing a relatively simple 2D, topdown oriented adventure game for the iPhone and was wondering what would be the easiest way to create the maps for my game. I figured I would need some kind of visual editor that would give me immediate feedback and would allow me to place all objects in the world exactly where I want them. I could then load the saved representation of the world I create in the editor in my game.

So, I am looking for a simple map editor that allows me to do this. All the objects in my game are simply textured rectangles build up from two triangles. All I need to be able to do is position different rectangles/objects in the map, and give them a texture. I am using texture atlases, so it would be useful to be able to assign portions of textures to the objects. I then need to be able to extract all the objects from the saved representation of my maps, together with the name/identifier of the texture(atlas) they use, and the area of the texture atlas.

I have looked at some tile-based map editors like Tiled and Ogmo, but they don't seem to be able to do what I want.
Any suggestions?

EDIT: a more concrete example: something like the GameMaker level editor, but then with added export functionality in a handy format.

sentences:
Making a game preloader (Flash) Possible Duplicate:
  How do you create a single/internal pre-loader for a Flash game written using Flex?

Hi guys, Im trying to make a preloader in a Flash game.

Thing is, I need some advices on this since I never made one, I have the game almost complete, but when, i.e, I upload the game to a website I get a white screen for a few seconds, and then I see the game.

Is there a simple way, maybe using an a API or something like that, to make a preloader screen?

Im using Flash Builder fyi.

Thx!

sentences:
2D simulating light sources (subtract a texture from an other) I want to simulate a night and day cycle with SFML (plain 2D, no shadows). What I want is to get a smooth transition from day to night, and during night having some lights "on".

So the approach I've thought is adding a black layer on top and change its transparency with time, that gives the effect I'm looking for. For adding lights I can crop out circles out of that layer

sf::CircleShape lightCircle(200);
lightCircle.setFillColor(sf::Color(255, 255, 255, 1));

sf::RenderTexture renderTexture;
renderTexture.create(/* view size */);

while (window.isOpen()) {
  // ...

  // update light
  renderTexture.clear(sf::Color::Black);
  renderTexture.draw(lightCircle, sf::BlendNone);
  renderTexture.display();

  // draw
  window.clear();
  window.draw(sf::Sprite(renderTexture.getTexture()));
  window.display();
}

Now, what I would like to do is use my own image instead of a CircleShape. Say a circle or a cone with fading borders, some more realistic than just a circle. Like

I have tried with sf::Image and createMaskFromColor but I'm not able to handle the fading edges.

How can I get that?

Am I in the right path or is there a simpler approach?

sentences:
What are the advantages and disadvantages of exporting spritesheets instead of models from Spriter into Unity? I'm working on a simple 2D platformer in Unity and have been using the Spriter2Unity tool to import my Spriter animations directly into Unity.
I have noticed that this creates large hierarchies of gameobjects within the imported prefabs, basically 1 per image piece.

Since the animations are fairly simple, I am thinking it would be cleaner to import each of them as a spritesheet and hook them up with a spriterenderer on the player object rather than using the importer tool.

Would this actually result in any performance benefit at runtime or are the impacts of animating a lot of game objects at once negligible?

sentences: How do I publish to Google Play if I'm under 18? I've finished my first Unity and want to release it on the Google Play store but can't because I am under 18.  The main issue is that Google Wallet requires you to be over 18.  How could I work around this?

sentences:
HLSL postprocessing for day to night (DTN) I am trying to implement a "day-to-night"-filter (as commonly used in cinema) for a 2D game (XNA) by using a full screen HLSL pixel shader. The aim is to transform any bright and colorful image into a dark and bluish night version of that image somewhat like:

Conceptually, my ideas would be to:

Decrease brightness
Merge blueish tinted greyscale version of image with original image
Increase contrast

The current shader I came up with is:

// Look up the color of the original pixel
float3 colorOriginal = tex2D(TextureSampler, texCoord);

// Get corresponding greyscale value (adjusted to human vision)
float greyscale = dot(colorOriginal, float3(0.3, 0.59, 0.11));

// Merge and tint
color.rgb = lerp(colorOriginal, colorOriginal * float3(pow(greyscale,6), pow(greyscale,6), pow(greyscale,3)), timeFactor);

The result is still not completely satisfying. How could I improve this?

sentences:
Unity game in edit the scene mode all of a sudden became incredibly slow/"laggy" So I recently have been working on a game. So far I have very few assets in the game, which are a point light, a piece of terrain (which is textured), a player controller and a tree. Everything was going well until I put the tree in the scene. I made  tree and started to add some branches I got to about 8 branches, and then I added 35 leafs. Then the edit scene started to become laggy.
When I played the game it was running perfectly. But as soon as I changed the scene back to edit mode it became laggy again. I then deleted the tree to see if that would solve the problem but it seems to have done nothing at all. I would really appreciate if someone could explain why the edit scene is becoming laggy even though there are only a few assets within the game.

Thanks, Nova

sentences:
OpenGL: Resizing Display and glOrtho/glViewport I have researched this question from several sources and have yet to find a firm answer saying that "yes that is correct thinking" or "no, here is how it's done."

I am trying to ensure resolution independence with OpenGL rendering. The way I think I should go about it, is to create a projection using glOrtho with whatever I want the world coordinates to be. For example, glOrtho(-50.0, 50.0, -50.0, 50.0, 1.0, -1.0).  Next, set the viewport to the screen resolution, i.e. - glViewport(0, 0, 800, 600). Finally, whenever the window is re-sized, make a call to glViewport with the updated screen resolution. This will scale your figures.

Is this the correct way to ensure that models take the same proportion of screen-space on different resolutions? Should I be using a projection equal to the resolution as well? I found some answers saying glOrtho should use the resolution of your window while others said it should/can be different.

Thoughts?

sentences:
How to implement a multi-platform Java 2D game engine's graphics? I'm not sure whether this question should be posted here. I'm trying to make a basic generic game engine in Java. Here's what I have so far.

public abstract class Device {
    public abstract void startDevice();
    public abstract void closeDevice();
    public abstract int getWidth();
    public abstract int getHeight();
    public abstract void displayImage(Image im);
}
public class Game {
    public final Device device;
    public synchronized void gameStart() { ... }
}
public abstract class GameEntity implements Serializable {
    public abstract void create(Game g);
    public abstract void updateAndDraw(Game g, Graphics2D g2d);
    public abstract void destroy(Game g);
}

So far, I have implemented two concrete classes for Device, SwingDevice and J2meDevice, and it's working fine. Now the problem is I want to implement AndroidDevice. Everything will work just fine except for that I have enforced using java.awt.Image and java.awt.Graphics2D to paint Game's graphics offline. Then I forward this Image to the device for rendering.

Is there any way I can absolutely decouple the Device's graphics from the rest of the engine?

I have two solutions but I doubt they'll fully achieve what I need:

Stick with the java.awt.Image. Devices that support OpenGL will not fully utilize their hardware capabilities as drawing is done on CPU. And it might not work on platforms on which can't import java.awt (I doubt their existence).
Create my Graphics2D-like interface. This will make defining new devices harder and again it might hide some of the device's features.

sentences:
Where should the collision response/resolution code go? I've got a collision response/resolution function that does the same for any pair of two entities. It's is in the World class right now.

But right before that function is invoked, I have some entity-specific logic:

A specific pair of entities should never have their collisions resolved (this is literally to keep the player from hitting itself with a carried object)
When two specific entities collide, an event should be triggered

Because of this, I'm starting to wonder if I should move the collision resolution function as a method into Entity, that'd allow me to use polymorphism. However, this sound very messy to me: If both entities involved in a collision can resolve it, how can I figure out which one should do it?

Is there another way to move these special cases out of World?

sentences:
Why does clip space in OpenGL have 4 dimensions? I will use this as a generic reference, but the more i browser online docs and books, the less i understand about this.

const float vertexPositions[] = {
    0.75f, 0.75f, 0.0f, 1.0f,
    0.75f, -0.75f, 0.0f, 1.0f,
    -0.75f, -0.75f, 0.0f, 1.0f,
};

in this online book there is an example about how to draw the first and classic hello world for OpenGL about making a triangle.

The vertex structure for the triangle is declared as stated in the code above.

The book, as all the other sources about this, stress the point that the Clip Space is a 4D structure that is used to basically decide what will be rasterized and rendered to the screen.

Here I have my questions:

i can't imagine something in 4D, i don't think that a human can do that, what is a 4D for this Clip space ?
the most human-readable doc that i have read speaks about a camera, which is just an abstraction over the clipping concept, and i get that, the problem is, why not using the concept of a camera in the first place which is a more familiar 3D structure? The only problem with the concept of a camera is that you need to define the prospective in other way and so you basically have to add another statement about what kind of camera you wish to have.
How i'm supposed to read this 0.75f, 0.75f, 0.0f, 1.0f ? All i get is that they are all float values and i get the meaning of the first 3 values, what does it mean the last one?

sentences: How many shadow casting lights are in modern games? I'd like to know how many shadow casting lights are supported in modern games, such as Uncharted 2, Crysis 2, Modern Warfare 2, Halo: Reach, etc. Do they all limit themselves to just a couple of shadow casting lights, or do the numbers vary wildly?

sentences:
Dot Product Vs Cross Product Turning a Turret Towards A Enemy and firing http://pastebin.com/iw9DHf7s is code demonstrating dot product turning a turretto a target and firing. It works and chooses best angle to spin.

A problem can occur when game goes faster (better computer) and that threshold no longer applies. Making the threshold bigger obviously stops the turret early.

My friend mentions cross product is the way to fix it. Then he disappears for long periods of time. Doesn't dot product NOT get a inner angle between two vectors? Ok lets just say I agree and dot product doesn't work ever.

So tell me how does vector product do the trick? I'm going from a single scalar that I can get degrees out of to a third orthogonal vector. I've read about cross product and the function and watched a you tube video and I don't get (given the same code pasted) how to use cross product here.

Update:
Would this work?

//towerFacing is the at/forward vector of the cannon
Vector v1 = cannonPos - targetPos ;
Vector v2 = towerFacing - cannonPos ;

//The z plane
double cross = v1.x*v2.y - v1.y*v2.x ;
if (cross > 0) { return Direction.Left ; }
if (cross < 0) { return Direction.Right ; }

Obviously the zero is not what we want to use in games. However The difference is now our zero means our at vector and target is perpendicular and on each other which a x b = 0. The dot product since it uses cosine I used the right vector which is orthogonal with the facing( a . b = 0).

Am I wrong on how the cross product works by what has listed for answers still?

sentences:
Can I make and test PS Vita games without registration? I am currently not registered as a Playstation Developer at the moment, but I have emailed Sony in the mean time to ask how a single person can register as an Indie Developer to publish. But can I still make my game in the mean time?

I have Unity and I know that Unity has Playstation support, so is there any chance that I can test my current game on PS Vita as well without registering with Sony first? That way, when I do register, the game can be closer to release.

sentences:
What is actually loaded during a game's loading screen? I am at the stage of my game where I have to develop the loading screen. It's actually already there, but I don't know exactly what it should be loading while it's presented.

Why would I have a loading scene instead of just going directly to my game scene? I don't even know what else to load besides the textures with the texture SpriteCache.

Am I doing the correct content loading? I missing something to load during that loading scene?

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:
What is the package-lock.json file for in Unity? My project contains this file:
Packages/packages-lock.json
And I'm curious about what it's for. It has a bunch of json about my packages in it, but it's not clear to me what goes in the lock file vrs the normal packages file.

sentences:
Cocos2D V3 Blur effect performance test without iOS device I am testing the blur effect (CCEffectBlur) in Cocos 2D V3 and I found that when I add an effect to an EffectNode it takes up to 5 seconds to appear in the IOS Simulator screen. (I know that the IOS Simulator is not to test performance)

When I run the same code in my device (iPhone 6), it appears almost instant.

My problem is to test the performance in old devices like iPhone 4S or iPhone 5 but, unfortunately, I don't have those devices to do some tests.

Is there any way to check my game's performance on those devices without the devices?

This is what I am testing.

I have a hierarchy with an EffectNode as a root node.
I am using a code like the following to add the effect
effectNode.effect = [CCEffectBlur effectWithBlurRadius:10];

sentences:
How to handle collision detection So the way that I am doing the movement for my game is that you can left click a unit (which is just a rectangle object), and then it is selected. While it is selected, you can right click and that will be the unit's destination.

This is the process input method:

    public void ProcessInput(Vector2 mouseLoc)
    {
        // SO, I have to take this mouse location, which is the location on the screen
        // And convert it to a "world" coordinate

        Vector2 distance = new Vector2(mouseLoc.X - position.X, mouseLoc.Y - position.Y);

        if (distance.Length() < speed)
        {
            position = mouseLoc;
            isMoving = false;
        }
        else
        {
            distance.Normalize();
            Vector2 toMove = new Vector2((int)(distance.X * speed), (int)(distance.Y * speed));
            position += toMove;
            bounds = new BoundingSphere(new Vector3(position, 0), radius);
        }
    }

I have a basic Wall class that is essentially just another rectangle object but with different properties like textures and what not.

This is my check collision method with the wall:

    public Boolean checkCollision(Wall wall)
    {
        if (wall.Bounds.Intersects(this.bounds))
        {
            Vector2 direction = new Vector2((position.X - destination.X) * -1,
            (position.Y - destination.Y) * -1);
            direction.Normalize();
            position += direction * 5;
            destination = position;
            return true;
        }
        return false;
    }

The problem is that the unit just kinda gets stuck in the wall when it hits it. I'm wondering what is the best way to fix this problem. I know that I have to move the unit out of that spot, but I'm not sure how to.

Any thoughts on how to handle this are appreciated.

sentences:
How do I customise automatically-generated script? When you create a script via the Unity editor, it generates a script with some pre-formatted code.

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

public class GenericClass : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

    }
}

When I create a script, I am generally guaranteed to use additional code, such as a namespace or a custom editor. Furthermore, I almost always delete content from the automatically-generated script. Is there a way to change the automatic code generated by Unity?

sentences:
Using full resolution of depth buffer for 2D rendering I'm working on a front-to-back renderer for a 2D engine using an orthographic projection. I want to use the depth buffer to avoid overdraw. I have a 16-bit depth buffer, a camera at Z=100 looking at Z=0, zNear is 1, and zFar is 1000. Each sprite rendered sets its Z co-ordinates to increasingly distant values, allowing depth test to skip rendering anything which is underneath.

However I'm aware the way Z positions end up with Z buffer values is non-linear. I want to make use of the full resolution of the 16-bit depth buffer, i.e. allowing 65536 unique values. So for every sprite rendered, I want to increment the Z position to the next position to correlate to the next unique depth buffer value.

In other words I want to turn an incrementing index (0, 1, 2, 3...) of the sprite being drawn in to the appropriate Z position for each sprite to have a unique depth buffer value. I'm not sure of the maths behind this. What is the calculation to do this?

Note I'm working in WebGL (basically OpenGL ES 2), and I need to support a wide range of hardware, so while extensions like gl_FragDepth might make this easier, I can't use it for compatibility reasons.

sentences:
Delay for seconds when key is held down? Hello I am very new to Unity and am trying to make a shooting game in which when the space key is pressed down the gun charges then shoots. I want it to wait for 0.3 seconds before the gun fires off because I want an effect to happen with a particle system(I confused animation with effect in the first post). Also the problem the script has is that the bullet would not fire at all when the space is pressed. Here is the scripts I wrote:

 void Start()
 {
     StartCoroutine("Shoot",0.3f);
 }

 IEnumerator Shoot()
 {
     yield return new WaitForSeconds (0.3f);
     Bam ();
 }

 void Bam()
 {
     transform.Translate (0, 0, 12);
 }

 void Update ()
 {
     if (Input.GetKey (KeyCode.Space))
         Shoot();
 }

sentences:
How can I support many point light sources in a dynamically-generated level in Unity? I'm currently working with a dungeon game which is similar to Dungeon Keeper by Mythic Entertainment. I'm using Unity and developing this game for Ipad 2 and above. Player can modify his dungeon, and I'd written a dungeon generator which creates it. In this case, I can't use lightmaps, because the dungeon has been created dynamically and player can tweak it. I also devised a way to combine separate game objects in a single mesh, so imagine that the entire dungeon (except special objects such as pillars, statues and mobs) is the single mesh. There's many point light sources (10-15 and above) on the stage, but Unity don't allow to use more than 8 light sources per object.

So, if all dungeon cells are separated objects, I can use the diffuse or even vertex-lit lighting, but if the entire dungeon is a single mesh, there's the hardware limit appears.

Ways to solve this problem I'd divised:

Use separated geometry (tried) - bad, because it harms berformance because there's many-many-many drawcalls (16-17 fps on Ipad 4).
Use deffered shading (tried) - bad, because it harms performance even more than separated geometry.
Use a custom shader (haven't tried) - I don't know how.
Don't unite all cells in the single mesh but unite groups of cells to reduce the number of separated objects (haven't tried)
Use the light manager (haven't tried) - I don't know how.
???

How can I deal with it?

sentences:
What are good ways to model environment radiance (not irradiance)? I'm trying to compile a list with relevant techniques in game development to model scene radiance.
The (probably obvious) candidates I have so far is:

Discreet light source objects in the scene (point ligts, directional lights, area lights etc)
spherical [HDR] bitmap data (mapped to the sphere in various ways. long lat, cube map, oct map etc.)
spherical harmonics
halfspherical harmonics

What other relevant techniques are there to model radiance (not irradiance)?

sentences:
How to generate random level from a seed? How would I go about using a random seed to generate a game level? The same seed should always generate the exact same level.

For this example it would be a Worms style level. So each level would have a theme (grasslands, snow etc), base terrain, different objects such as trees.

So where would I start to create this kind of level generator? What would be involved? What concepts does it use?

Bonus points for any any good links (bonus bonus points for anything related to how it was done in worms or similar).

Thanks.

sentences:
Detect transform from detection of QR code? I want to calculate the transform I need to render a 3D object in my world.

How I see my idea:

You open a camera
You point it at a QR code
The app detects the QR code and returns the 4 corners and the correct direction
The app calculates the transform that this QR code is currently at (I need help with this step)
The app uses that transform to render the 3D object in a fixed position over the QR code

I want something like Vuforia, but for QR codes (as they are used often).

I don't really know how I can extract the transform from the detected QR code (I will get the location of the 4 corners)

sentences:
Steps to take before trying to implement screen space ambient occlusion I very recently started learning modern OpenGL. I have implemented a wavefront file loader and a basic ADS shading model. At some point I'd like to implement screen space ambient occlusion. I tried reading on the technique and I understand the concept, but I have trouble understanding the details (i.e. extracting the depth information and reconstructing the positions in space etc.).

Thus the question is, what techniques should I learn/practice before trying to implement the SSAO?

sentences:
What kind of projection is used here? Tibia is a 2d game, but it's sprites are drawn using certain kind of orthographic projection that is not the same I'm used to:

test http://dl.dropbox.com/u/62862049/Screenshots/97.png

I'm trying to figure out what projection is used here. I've guessed the following:

project(x,y,z) = (x-z/sqrt(2), y-z/sqrt(2))

It produces a circle very similar to that wheel, and alright cubes, but the spheres are not projected as perfect circles like the globe and the crystal ball on the picture above.

test http://o7.no/TfNmfZ
test http://o7.no/TfMZSA
test http://o7.no/TNCuCt

So which is the actual projection that game is using?

sentences:
Coding Spelunky Edge Roll Mechanic Inspired by the recently released Spelunky 2, I've been making Spelunky clone from scratch using Monogame for gamedev coding practice.
I've successfully coded the basic platforming mechanics: terrain collision solving, gravity, running and jumping, even having the camera pan up or down after pressing those buttons for a half-second.
The next thing I am trying to implement is edge-hanging. Getting the basic case of hanging after falling onto an edge in the right way was easy enough. I basically just checked for the right conditions and added a boolean in my player class for whether the player is hanging, which prevents left/right motion and keeps the player from falling when it's true.
My question is: how can I implement the edge-rolling mechanism, where you can roll over edges into an edge-hang by pressing down as you walk off? I don't understand what extra information I need to store or how to smoothly transition the player from being halfway on the edge to hanging off of the edge one block lower.
Right now the player just kind of falls away from the edge after walking off, as you would expect with the basic mechanics so far.
Any advice is appreciated! Thanks for your time.

sentences:
Libgdx game rendering works only after app resume I've encountered a strange problem while trying to develop my game.
I deployed the game to my Honor5C and when I open it, a red screen appears, because (I think) only these 2 standard lines of code are functioning properly:

Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

But every other sprite is NOT being rendered. The thing is, if I go back to the phone's main menu, without closing the app, and then I pop it back up again, everything works fine. Here's my render method:

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

    cam.update();

    world.step(1f/60f, 6, 2);

    batch.begin();
    batch.setProjectionMatrix(cam.combined);
    bgSprite.draw(batch);

    platformSprite.draw(batch);

    idleSprite1.setPosition((playerBody.getPosition().x * PIXELS_TO_METERS) -
            idleSprite1.getWidth() / 2, (playerBody.getPosition().y * PIXELS_TO_METERS) -
            idleSprite1.getHeight() / 2);

    idleSprite1.draw(batch);

    batch.end();
}

What could it be? I've found absolutely nothing googling the issue for an hour straight now. Thank you all.

EDIT @ Charanor

No static variables are being used.
Here's the initialization for the variables used in the render method:

batch = new SpriteBatch();

    background = new Texture(Gdx.files.internal("data/bg.jpg"));
    bgSprite = new Sprite(background);
    bgSprite.setPosition(-683f, -384f);

    platform = new Texture(Gdx.files.internal("data/platform.jpg"));
    platformSprite = new Sprite(platform);
    platformSprite.setPosition(-50f, -100f);

    idle1 = new Texture(Gdx.files.internal("data/Idle.png"));
    idleSprite1 = new Sprite(idle1);
    idleSprite1.setPosition(-70f, 0);

    cam = new OrthographicCamera();
    cam.position.set(0,0,0);

    viewport = new StretchViewport(1366f, 768f, cam);
    viewport.apply();

EDIT 2: I've discovered the game still keeps not working if, after launching it, you press the android "back" button and then pop the game back up . The red screen stays. It appears the only way to make it work is to launch the app, press the android button that lets you see what applications are active and switch back to the game from there. It's getting ridiculous.

EDIT 3: I've done some more testing and here's what I found: if you deselect the app and reselect it again either with the recent apps button or the home button we know it works. But, if you press the android back button (it goes back to the phone main menu) after the game is already working fine, and then reopen it, the problem comes back and the screen goes back to full red!

sentences:
3D Model package for Mac/iOS I am getting my 3D modeling pipeline started and a few questions have come up about modeling packages and formats:

What 3D model format is easy to parse, free to use, and is usable on the iOS/Mac platforms?
Will I be able to create my own wrapper classes for said 3D model formats, or is it a code-and-format packaged deal?  Does this format come with a free or cheap toolchain for creating new models and editing old models?

Thanks for the insight ahead of time!

sentences:
Screen blending from Photoshop in Unity 2D I want to use "Screen blending" from Photoshop in my Unity 2D game, I want to use that for exported lights from 3D Max that we want to use in our game, Now for a sample, I have my sprite that I want to mask it :

And I also have a mask for it :

Now my question is how to make this in Unity like this :

Can make this happen by Sprite mask?

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:
Is it dramatically more efficient to have less BoxCollider2D's (for raycasting/custom physics)? I have a temporary tile system for my platformer where I simply duplicate the same tiny box sprite with a BoxCollider2Don it over and over again. Like I said this is a temporary procedure for design testing before I choose something for practical, I don't need it to be the most efficient.

That being said, I'm curious: when using BoxCollider2D's and detecting them with a custom ray-cast script is it much less efficient than having a few larger colliders? How much less efficient?

Please back up answers with explanations of source code if possible.

sentences:
How to update and render an 2D endless runner that goes bothways I want to make an 2D endless runner, that also allows player to go backwards.

So I have to create random world as the map goes, also keep the old map in case player goes back. I ask about how to update and render this program.

I am thinking having a generate function that takes an x value and generates world from x to (x + chunk size) and when camera reaches x + chunk size, call this function again to generate more map:

function source(x) {
  // generate world for x value
};

And maybe use this function like:

  let worldThings = [];

   // push the world from 0 to chunk size
   worldThings.push(...source(0));

   // called every frame to update world
   function update() {
     if (camera.x > chunkSize) {
       // generate more world
       worldThings.push(...source(chunkSize));
     }
   }

To render these something like:

   // object pooling for rendering things in view
   let renderPool = new Pool();

   function render() {
     // release all objects
     renderPool.releaseAll();

     // take things that are visible
     let renderThings = worldThings.filter(thingsInCameraView);

     // for everything allocate a resource in the render pool
     renderThings.each(renderPool.allocate);

     // render the pool
     renderPool.each(renderThing);
   }

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:
Unreal Engine Visual Studio 2019 C++ - Could not open source file CoreMinimal.h I'm trying to follow a YouTube tutorial and I've ran into this (Severity    Code    Description Project File    Line    Suppression State
Error (active)  E1696   cannot open source file "CoreMinimal.h" Network2    E:\Unreal Projects\Network2\Source\Network2\MyClass.h   5   ) and a lot more errors, so if anybody has more experience than me with C++ please help me out.

sentences:
How do I cap rendering of tiles in a 2D game with SDL? I have some boilerplate code working, I basically have a tile based map composed of just 3 colors, and some walls and render with SDL. The tiles are in a bmp file, but each tile inside it corresponds to an internal number of the type of tile(color, or wall).
I have pretty basic collision detection and it works, I can also detetc continuous presses, which allows me to move pretty much anywhere I want. I also have a moving camera, which follows the object.

The problem is that, the tile based map is bigger than the resolution, thus not all of the map can be displayed on the screen, but it's still rendered. I would like to cap it, but since this is new to me, I pretty much have no idea.

Although I cannot post all the code, as even though I am a newbie and the code pretty basic, it's already quite a few lines, I can post what I tried to do

void set_camera()
{
    //Center the camera over the dot
    camera.x = ( player.box.x + DOT_WIDTH / 2 ) - SCREEN_WIDTH / 2;
    camera.y = ( player.box.y + DOT_HEIGHT / 2 ) - SCREEN_HEIGHT / 2;

    //Keep the camera in bounds.
    if(camera.x < 0 )
    {
        camera.x = 0;
    }
    if(camera.y < 0 )
    {
        camera.y = 0;
    }
    if(camera.x > LEVEL_WIDTH - camera.w )
    {
        camera.x = LEVEL_WIDTH - camera.w;
    }
    if(camera.y > LEVEL_HEIGHT - camera.h )
    {
        camera.y = LEVEL_HEIGHT - camera.h;
    }
}

set_camera() is the function which calculates the camera position based on the player's positions. I won't pretend I know much about it.

Rectangle box = {0,0,0,0};

for(int t = 0; t < TOTAL_TILES; t++)
{
    if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT))
        apply_surface(box.x - camera.x, box.y - camera.y, surface, screen, &clips[tiles[t]]);

    box.x += TILE_WIDTH;

    //If we've gone too far
    if(box.x >= LEVEL_WIDTH)
    {
        //Move back
        box.x = 0;

        //Move to the next row
        box.y += TILE_HEIGHT;
    }
}

This is basically my render code. The for loop loops over 192 tiles stored in an int array, each with their own unique value describing the tile type(wall or one of three possible colored tiles).

box is an SDL_Rect containing the current position of the tile, which is calculated on render.

TILE_HEIGHT and TILE_WIDTH are of value 80.

So the cap is determined by

if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT))

However, this is just me playing with the values and see what doesn't break it. I pretty much have no idea how to calculate it.

My screen resolution is 1024/768, and the tile map is of size 1280/960.

sentences:
How can I reduce Unity's package size? I've been experimenting with Unity3D 4.3's 2D features.  I've created a simple prototype game to learn how Unity works, how to create sprite animations, collisions and all the basic things.  My project compiled for PC was approximately 23MB.

The game includes one larger bitmap for a background (originally 1MB JPEG). The player spritesheet was black and white with almost no details. So all the assets had (in their original, compressed form) no more than 2-3 MB.  I ended up with one large executable file (about 10MB) and a folder with .dll files and assets (5-6MB).

Can that be reduced?

My experience with C# WinForms code makes me believe that executables and DLLs grow that big only when binary data was involved (images, sound, etc).  Is that the case with Unity?  I am interested in developing 2D applications for Android and iOS, where low total app size is a priority.

sentences:
How to alter the angle of texture projection I'm currently working on a 3Dish game; it's on a grid, with 3D props and the camera looking down on the grid at about 45º, but I want to use 2D sprites for the player and NPCs.

Currently, I'm using a quad as a canvas, but I've run into some problems. If the quad is coming up vertically from the floor, foreshortening squashes the player. If I tilt the quad to the same angle as the camera (manual billboarding), the player looks fine but will clip through 3D objects to the "north" from the camera on the grid. I've looked into point sprites but it seems like these would have the same problem.

So, tilting the canvas is out. I need the player to be able to go in front and behind things.

My latest and most promising attempt was to turn the vertical-oriented square canvas into a trapezoid, to compensate for the perspective change. (The canvas is 32x32; at a 45º angle it ended up having a top length of 28.14 and a height of 39.68.) This gets me a square canvas again, but the texture isn't right. It ends up slightly squashed; on nearest-neighbour sampling it loses a row of pixels in the middle (on the character where it's noticeable) and gains one somewhere at the top (above the character's head...)

My maths on the trapezoid might not be exact, but this doesn't really seem like the right answer for keeping things pixel-perfect. Is there a way to use that canvas quad as, I don't know, like a window onto another rendering context which would be pixel-perfect?

Context: This is in Python, PyOpenGL and Pygame; the maximum GLSL version my computer can handle is 120 so it's openGL 3-ish but not quite.

sentences: How to use NGUI with Unity I feel like Im missing something really simple, but Ive read about all the events NGUI can generate from an object and just dont get where to recive (or handle) the event. Do I just attach it to a script on the object?

sentences:
Objective-C or C++ of game engine header file for iOS developers? We've developed a game engine written in C++. Now we are preparing our game engine for iOS developers.

I guess that many game developers use C++ or Objective-C for their game apps. So I think we should expose the API of our library in both Objective-C (@class blahblah) header files and in C++ (class blahblah) header files.

Am I on the right track? If not, what is the most recommended way of exposing the API for our library?

sentences:
What is the best way to remove a list reference after the object has been deleted at edit time? Inside a MonoBehaviour MyComponentA I have a list of MyComponentB (also a MonoBehaviour) like so:

List<MyComponentB> myList;

This list gets populated mostly through editor scripts at edit time.
Now say that someone who is editing the scene comes along and deletes a game object that has MyComponentB attached, and also happens to be referenced by the list above.

How can MyComponentA fix the list to remove null references after such a deletion? I basically want to make this automatic so that when designers delete these objects, they dont have to go hunt down which MyComponentA referenced them and fix the list.

My naive approach was to have a circular reference from MyComponentB to MyComponentA (so that it knows which list it belongs in), and then unregister it properly when OnDestroy gets called. This however doesn't work at edit time unfortunately since OnDestroy is not called.

Thanks for your help!

sentences:
Function destroying wrong object I am using the collision_line_list function to detect all objects of a type.
In this case, the object is obj_CapMan.
Code:
collision_line_list(obj_HatMan.x,obj_HatMan.y,mouse_x,mouse_y,obj_CapMan,false,true,listaCap,false);

This code is in an object that would be equivalent to the game administrator. What should not influence anything, but in any case, is the information.
Full Code:
listaCap=ds_list_create();
listaNum=collision_line_list(obj_HatMan.x,obj_HatMan.y,mouse_x,mouse_y,obj_CapMan,false,true,listaCap,false);

if(listaNum>0){
    instance_destroy(listaCap);
    ds_list_destroy(listaCap);
}

As a result, none of the objects on the list are being destroyed, but another one that is neither the manager nor the obj_CapMan, is being destroyed.
Documentation Link:
https://manual-en.yoyogames.com/#t=GameMaker_Language%2FGML_Reference%2FMovement_And_Collisions%2FCollisions%2Fcollision_line_list.htm&rhsearch=collision_line&rhhlterm=collision_line_list%20collision_line

This red square is an object to detect a headshot.
That same object that is being destroyed, even though it is not mentioned in that part of the code at any time:

sentences:
In my browser game's website description, can I use a title of another game? For instance, if I think my game is a cross between Age of Empires and Minesweeper, can I have written on the description of my website "A browser-based hybrid of Age of Empires and Minesweeper" ?
Thanks!

sentences:
Multiple render targets and pixel shader outputs terminology I'm a little confused on the jargon: does Multiple Render Targets (MRT) refer to outputting from a pixel shader to multiple elements in a struct? That is, when one says "MRT is to write to multiple textures", are multiple elements interleaved in a single output texture, or do you specify multiple discrete output textures?

By the way, from what I understand, at least for DX9, all the elements of this struct need to be of the same size. Does this restriction still apply to DX11?

sentences:
Unity3d - Find out if current animator animation is playing? I need to call a function immediately after animator animation finished playing, I know I could solve this by adding an event to my animation, but I try it without.

How can I find out if the current animator animation is playing?

On normal legacy animations I solved it by writing a coroutine:

public static IEnumerator playAndWaitForAnim(Animation anim, string clipName, Action callback)
{
    anim.Play(clipName);

    //Wait until Animation is done Playing
    while (anim.IsPlaying(clipName)) {
        yield return null;
    }

    //Done playing. Do something below!
    callback();
}

Which I use like this:

StartCoroutine(AnimationHelper.playAndWaitForAnim(
    myAnimation,
    "ToSettings",
    () => {
        Debug.Log ("Finished playing");
    }
));

But how does this work with mecanim animator animations?

sentences:
Photon2 Unity2D How to send float with RPC I have big problem in my code .. I want to spawn obstacle exactly on the same position as on the server is spawned so I made rpc Method and tried to pass random variable of float , but when i run the game obstacles are spawned on the diffrent position. I am loosing a lot of time to get it done but I still can not find solution.

Here is the code

   [PunRPC]
    void RPC_SpawnColumn(Vector3 position)
    {
        // Instantiate(prefab, position, Quaternion.identity);
        Debug.Log("THIS IS SPAWNYPOSITION" + spawnYPosition);

        Instantiate(prefab, new Vector2(9, spawnYPosition), Quaternion.identity);

    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        //print("Are we here");
        if (collision.GetComponent<ColumnsMultiplayer>() != null)
        {

            print("Or are we here");
            if (SpawnOnce)
            {
                spawnYPosition = Random.Range(-3.36f, 2.98f);

                photonView.RPC("RPC_SpawnColumn", RpcTarget.Others,new Vector3(9, spawnYPosition));  // this is

            }
                //SpawnColumn();

            SpawnOnce = false;

        }
    }

Thank you so much for reading post.

Edit: I need to send spawnYPosition  from method two to method one and spawn it with same position of spawnYPosition  in the second method.

sentences:
What's the most efficient way to implement low poly flat shading style? I want to know what's the most efficient way to implement low poly style flat shading. I have checked this post, however the options listed in the page don't feel perfect to me. I list them below for reference.

Duplicate each vertex so that same vertex can associate with a different normal.
Use flat to disable interpolation.
Evaluate normal at fragment shader using dFdx and dFdy.

To me, option 1 wastes some vertex attributes, since duplicate vertices have the same position. Option 3 perform unnecessary calculation on every fragment even though the normal should all be the same. Option 2 feels conceptually right to me, but I don't know what normal value should be saved at each vertex. This is also the approach hinted in book 'Real Time Rendering' (4e, p120).

My question is: what's the best way to implement it? Given so many commercial games used this style, I want to know how it is typically implemented by real world games?

sentences:
is there a formula to know how many enemies i can place before jumping character? My game is very similar to the hidden game in chromes web browser. I have a character that needs to jump over incoming enemies. Is there any way i can know when to send an incoming enemy? Some of the factors to take in to account i guess are the speed of enemies, height of jump, speed of jump, and dimensions of bitmaps (that represent character, and enemies).

Thanks

sentences:
How do I destroy a class/how do I link a class to a gameObject I am fairly new to programming and I decided to create a Pong game. I created the sprites and was able to make the paddles and the dot work. The only help I needed was when I wanted the dot to recognize where it was hit.

Now I wanted to respawn the dot when it hits an wall behind the racket. I created an transparent sprite with a 2D Collider. Now I wanted to use this:

If dot hits LeftWall destroy gameobject dot

But when I use:

 if (col.gameObject.name == "WandLinks")
    {
      Destroy(Dot.gameObject);
    }

it tells me "Dot" is a class and can't be destroyed. This I understand. But why does the rest work? And how do I create a reference from the class to a new gameObject? Thank you very much.

(My next solution is to place the code for the destruction inside my wall but that's not my desired solution)

-
This is my whole code for the dot

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

public class Dot : MonoBehaviour

{
public float speed = 5;
public Transform spawnPoint;

void Start()
{
    // Initial Velocity
    GetComponent<Rigidbody2D>().velocity = Vector2.right * speed;
}

float hitFactor(Vector2 ballPos, Vector2 racketPos,
                float PaddleRight)
{
    // ascii art:
    // ||  1 <- at the top of the racket
    // ||
    // ||  0 <- at the middle of the racket
    // ||
    // || -1 <- at the bottom of the racket
    return (ballPos.y - racketPos.y) / PaddleRight;
}
public void RespawnDot()
{
    Instantiate(dot, spawnPoint.position, spawnPoint.rotation);
}

void OnCollisionEnter2D(Collision2D col)
{
    // Note: 'col' holds the collision information. If the
    // Ball collided with a racket, then:
    //   col.gameObject is the racket
    //   col.transform.position is the racket's position
    //   col.collider is the racket's collider

    // Hit the left Racket?
    if (col.gameObject.name == "PaddleLeft")
    {
        // Calculate hit Factor
        float y = hitFactor(transform.position,
                            col.transform.position,
                            col.collider.bounds.size.y);

        // Calculate direction, make length=1 via .normalized
        Vector2 dir = new Vector2(1, y).normalized;

        // Set Velocity with dir * speed
        GetComponent<Rigidbody2D>().velocity = dir * speed;
    }

    // Hit the right Racket?
    if (col.gameObject.name == "PaddleRight")
    {
        // Calculate hit Factor
        float y = hitFactor(transform.position,
                            col.transform.position,
                            col.collider.bounds.size.y);

        // Calculate direction, make length=1 via .normalized
        Vector2 dir = new Vector2(-1, y).normalized;

        // Set Velocity with dir * speed
        GetComponent<Rigidbody2D>().velocity = dir * speed;
    }

    if (col.gameObject.name == "WandRechts")
    {
        RespawnDot();
    }

    if (col.gameObject.name == "WandLinks")
    {

    }
}
}

sentences:
How to use quaternion on another referential I'm new on Three.js and despite a mechanical background, I can't find how quaternion works: it's like it always refers on local part referential and not the global one.

I've illustrated it here : http://jsfiddle.net/ehsktuj2/13/

function applyRotation(){
    var redRotationQuaternion = new THREE.Quaternion();
    redRotationQuaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), control.rotationSpeedRedY );
    applyQuaternion(_cubeRed, redRotationQuaternion);

    var greenRotationQuaternion = new THREE.Quaternion();
    greenRotationQuaternion.setFromAxisAngle( new THREE.Vector3( 0, 0, 1 ), control.rotationSpeedGreenZ );
    applyQuaternion(_cubeGreen, greenRotationQuaternion);
}

function applyQuaternion(cube, quaternion){
    var cubeQuaternion = cube.quaternion;
    cubeQuaternion.multiplyQuaternions(quaternion, cubeQuaternion);
    cubeQuaternion.normalize();
}

The rotation quaternion of the green box is via the vector (0,0,1) but it's not in the global referential, it's the one of the projected referential of the green cube.

How can I project the quaternion back on the global referential? So that the green cube rotates via the (0,0,1) vector of the scene?

sentences:
Scene2d Stage Actor setup issues I am creating a game using libgdx.

In the same each level has a class. I have stage as a member variable of the class. To this stage, I add actors.

Inside the levels class, I have attaced the input processor to the stage like below.

stage = new Stage();
sviewPort = new StretchViewport(OSR_Constants.VIEWPORT_WIDTH, OSR_Constants.VIEWPORT_HEIGHT);
OrthographicCamera camera = new OrthographicCamera(OSR_Constants.VIEWPORT_WIDTH, OSR_Constants.VIEWPORT_HEIGHT);
camera.position.set(0, 0, 0);
camera.update();
sviewPort.setCamera(camera);
stage.setViewport(sviewPort);

Gdx.input.setInputProcessor(stage);

The level object is instantiated in another class known as GameScreen. GameScreen implements the Screen interface.

I am unable to detect touch events on my actors in the stage. Each actor has also been given bounds as per the world coordinates. I have added the following code on each actor to detect touch

this.addListener(new InputListener(){
     public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
          System.out.println("touchdown at " + x + " " + y);
          return true;
      }
  });

sentences:
Need help to find error in collision dection in XNA I really need some help to find the reason why not any of my Asteroids sprites are visible on the screen after I added som code to dedect collision. My suspect is that it has to do in the collision method and that the sprites are removed from the list from the beginning!? The Spaceship is visible.

In my manager class I have this method for checking the collision:

public void CollisionControl(Spaceship spaceShip)
    {
        for (int i = 0; i < asteroidList.Count(); i++)
        {
            if (asteroidList.ElementAt(i).Bounds().Intersects(spaceShip.Bounds()))
            {
                asteroidList.RemoveAt(i);
                i--;
            }
        }
    }

And then from the Game1 class I call this manager from the Update Method like this:

 asteroidManager.CollisionControl(spaceship);

And finally in the SpaceShip class and the Asteroids Class I have this code:

// Bounds
    public Rectangle Bounds()
    {
        //return new Rectangle((int)(position.X - orgin.X), (int)(position.Y - orgin.Y), texture.Width, texture.Height);
        return new Rectangle(0,0,60,60);
    }

// Draw method
    public void Draw(SpriteBatch spriteBatch)
    {
        //spriteBatch.Draw(texture, position, new Rectangle(0,0, (int)texture.Width, (int)texture.Height) , Color.White, rotation, orgin, 1, SpriteEffects.None, 0);
        spriteBatch.Draw(texture, position, null, Color.White, rotation, orgin, 1, SpriteEffects.None, 0);
    }

Help is really preciated! I'm doing a hand in task that I need to complete soon! Thanks!

sentences: what algorithms exist for combining multiple triangle meshes into one mesh Let's say I have a terrain mesh of some triangles, and several smaller meshes which I want to add to that terrain mesh (think ground and some small mounds or berms for example). What would I look for to find algorithms to let me do this? I know it's like some kind of computational geometry but I wonder if anyone might know search terms or even better urls to look at. Ideally I would like to do this on the fly to simplify drawing of a terrain where the basic ground and the detailed "interesting" bits are stored separately. Right now we draw the ground and the other parts separately which is less than ideal.

sentences: Lighting, shader and GI is messing up the materials in Unity3D Hello Guys I am not very sound with Unity3D Lightmapping. Currently I have a set of low poly items in my scene. Textures on my models are getting washed out. They totally look absurd. here is a picture of expected (Right) vs current result (left)

sentences:
How do I achieve supersampling / anti-aliasing in pixel shaders? I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect:

But I noticed there is aliasing in my resulting image (the above image is a sample from the linked website).

What can I do to prevent this? I couldn't find any article that explains how to solve this. I read some techniques like rendering in a higher resolution and then downsizing the image, but I need to solve this in a pixel shader capacity.

sentences:
How to spin a 2D quad in place using only matrices? In short, I have a textured 2D quad (a sprite).  I would like to rotate/spin it about the z-axis (coming out of the screen) using nothing but matrices.

If I do the following to a transform with scale in it already, the object spins, but also follows a circular path around the origin.   As a test, if I first undo the scale, then this works fine (the object spins in place).  But I'm not normally keeping scale, orientation and translation separate and then computing the matrix every frame in this case.  I'm mutating the matrix all the time.  So this isn't workable.  Can this be done without first undoing the scale?

self is the current transformation matrix (4x4)
pivot is the "center" of the quad's AABB (recomputed immediately before this)
eulerAngles is a vec3 containing {0.0, 0.0, z-angle}

/* translate to the origin */
translate(self, -pivot);

/* rotate */
rotate(self, eulerAngles);

/* go back */
translate(self, pivot);

(I'm using OpenGL, but that probably doesn't matter much here)

There are other related articles, but I didn't get to a solution.  I'm linking for reference:

Combining rotation,scaling around a pivot with translation into a matrix
How can I rotate about an arbitrary point in 3D (instead of the origin)?

sentences:
Calculate slope for linear interpolated movement I want to move rectangles to their targets the "smooth" way with linear interpolation. I hope this is right.

float slope(float x1, float x2, float y1, float y2) {
    return std::abs((y2 - y1)) / std::abs((x2 - x1));
}

int s = slope(x, target->x, y, target->y);

if(x > target->x) {
    x -= s * speed * delta;
} else if(x < target->x) {
    x += s * speed * delta;
}

if(y > target->y) {
    y -= s * speed * delta;
} else if(y < target->y) {
    y += s * speed * delta;
}

The result is that they barely move. But when they move it is very slow or fast as hell.
I would also apreciate any suggestions on how to reach the target better.
Thanks in advance.

sentences:
Unity AI issue with recalculating NavMesh at runtime I am using Unity NavMesh to control my units.
I am running into an Issue when updating Navmesh at runtime, It seems agents re-calculate their path whenever it is modified, which makes sense, but it causes this line (check if unit is on last corner) to return an IndexOutOfBounds error:
agent.steeringTarget == agent.path.corners[agent.path.corners.Length - 1]

I guess something is happening while re-calculating path that might mess with this for 1 frame. I solved this by putting a try/catch around it, but is there some better way I can manage this so I don't get the error at all?

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:
Calculate the best route for racing games I'm trying to structure a system for rating player's performance in my arcade-style racing game. So I'm thinking about calculating the best route possible, and trying to guide the player towards the best way of driving.
Is there any work into such problem? Links to papers/implementations would be awesome.

sentences:
Inconsistent accessibility error in xna Hey all, you may remember me asking a question regarding a snake game I was creating about two weeks ago.

Well I'm quite far now into making the game (thanks to a brilliant tutorial I found). But I've come across the error described named above.

So heres my problem;

I have a SnakeFood class that has a method called "Reposition". In the game1 class I have a method called "UpdateInGame" which calls the reposition method to load an orange that spawns in a random place every second.

My latest piece of code changed the reposition method to allow the snake I have on the screen to not be overlapped by the orange that randomly spawns.

Now I get the error (in full):

Error   1   Inconsistent accessibility: parameter type 'TheMathsSnakeGame.Snake' is less accessible than method 'TheMathsSnakeGame.SnakeFood.Reposition(TheMathsSnakeGame.Snake)'   C:\Users\Tom\Documents\Visual Studio 2008\Projects\TheMathsSnakeGame\TheMathsSnakeGame\SnakeFood.cs 33  21  TheMathsSnakeGame

I understand what the errors trying to tell me but having changed the accessiblity of the methods, I still can't get it to work.

Sorry about the longwinded question.

Thanks in advance :)

Edit: Code I'm using

 (Game1 Class)
private void UpdateInGame(GameTime gameTime)
    {
        //Calls the oranges "reposition" method every second
        if (gameTime.TotalGameTime.Milliseconds % 1000 == 0)
            orange.Reposition(sidney);
        sidney.Update(gameTime);
    }

(SnakeFood Class)
 public void Reposition(Snake snake)
    {
        do
        {
            position = new Point(rand.Next(Grid.maxHeight),     rand.Next(Grid.maxWidth));
        } while (snake.IsBodyOnPoint(position));
    }

sentences:
C# XNA :Snake Game, direction problem I am trying to do a snake game in XNA but I have some little problems...

I explain :

The Snake has a direction (Enum Type : Haut(=up), Bas(=down), Droite(=right), Gauche(=left))
When the player press a direction key this funcion is used :

public void SetDirection(Direction newDirection) // Teste les directions impossibles => impossible de faire un demi tour
{
    if (_direction == Direction.Haut && newDirection == Direction.Bas)
    {
        return;
    }
    else if (_direction == Direction.Bas && newDirection == Direction.Haut)
    {
        return;
    }
    else if (_direction == Direction.Gauche && newDirection == Direction.Droite)
    {
        return;
    }
    else if (_direction == Direction.Droite && newDirection == Direction.Gauche)
    {
        return;
    }
    _direction = newDirection;
}

In theory, the snake can't make a U-turn.
But it does not work properly (I will try to explain why) :

The snake moves each 100ms. while these 100ms, the snake is waiting for a direction.
BUT if the snake goes up for example, and if the user presses {Droite(=right), Bas(=down)} or {Gauche(=left), Bas(=down)} while these 100ms, the snake makes a U-turn, and die because he cuts himself.

As a consequence, the user loose the game...

I can't see how to solve this problem.

If I am not clear or if you need any other information, please let me know.

Thanks in advance for your help

PS : I am sorry for the grammar faults but I don't speak perfectly english... :)

PPS : Here is the call to setDirection :

case GameState.Infini:
    if (newKeyboardState.IsKeyDown(Keys.Escape))
    {
        CurrentGameState = GameState.Pause;
    }
    else if (newKeyboardState.IsKeyDown(Keys.Up))
    {
        _snake.SetDirection(Direction.Haut);
    }
    else if (newKeyboardState.IsKeyDown(Keys.Down))
    {
        _snake.SetDirection(Direction.Bas);
    }
    else if (newKeyboardState.IsKeyDown(Keys.Left))
    {
        _snake.SetDirection(Direction.Gauche);
    }
    else if (newKeyboardState.IsKeyDown(Keys.Right))
    {
        _snake.SetDirection(Direction.Droite);
    }

sentences:
Best way to implement achievement system? I'm currently trying to implement achievement system for my game. However, I can't find a better way to realize some complex ones like: The player has collected x coins, complete level with time least than x seconds, Kill over x enemies etc. Can you share your experiences please?

Secondly, Why don't we just implement achievement system as local only instead of using server like Scoreloop or OpenFeint? Or put it in another way, What are the advantages of using server for managing player's achievement?

sentences:
Collision detection recommendations I am currently developing a prototype game for mobile devices in which the user will see several objects on the screen and will have to touch them one by one in the correct order to win. I guess it that you can say that it is similiar to a Whack a Mole game, but instead of having moles popping up on the screen, I will have several objects moving around.

I am having some difficulties in implementing a collision detection algorithm for this game, thefore I would like your recommendation on what is the best method to use.

For example suppose an object is moving in a given direction, then I could use the SAT to check if it collides with other objects. If it does collides, then it will stop and move in another direction which is randomly chosen.

Another option would be to divide my screen into square or hexagonal tiles. This way I could just check if the tiles are free or occupied before moving the objects.

My game be 2D and will use a top-down ortographic projection and I am developing it using Cocos2d-X and Marmalade SDK. I am not using any physics engine, because my game does not require them (the objects just have to move around, they don't bounce or need any sort of physics behavior).

sentences:
Rotate 3D object relative to the camera I really need the help of an expert. I'm trying to rotate an object in all 3 axes relative to the camera in response to the gamepad sticks. I have succeeded but with an unexpected error, depending on its orientation, the object can rotate in the opposite direction of the stick direction.
For example, if the object is on its back, when I move the stick to the left the object rotates to the left. But, when the object is facing the camera, when I move the stick to the left the object rotates to the right. The same happens in all 3 axes, on each axis I have 180 degrees with the correct stick orientation and 180 degrees with inverted sticks. Also, both the camera and the object can freely move adding more complexity to this problem.
I would like to find a way where the orientation of the rotation always follows the direction of the stick. This is solved with a minus sign applied to the angle according to the object orientation (relative to the camera) but I can't find out how.
This is the code I'm using, it works fine except for the orientation problem. Can anyone find the solution to this problem?
public void ObjectRotate(int dir, float angle) // Object is defined elsewhere
{
    var rotate = 360 * Time.deltaTime * angle;
    var target = Object.transform;

    if(dir == 1) { target.RotateAround(target.transform.position, Camera.main.transform.right,  rotate ); }
    else if(dir == 2) { target.RotateAround(target.transform.position, Camera.main.transform.up, rotate); }
    else if(dir == 3) { target.RotateAround(target.transform.position, Camera.main.transform.forward, rotate); }
}

sentences:
Basic procedural generated content works, but how could I do the same in reverse? My 2D world is made up of blocks. At the moment, I create a block and assign it a number between 1 and 4. The number assigned to the nth block is always the same (i.e if the player walks backwards or restarts the game.) and is generated in the function below.
(Image shows a small portion of the game, in practice there are much more blocks)

As shown here by this animation, the colours represent the number.

function generate_data(n)
    math.randomseed(n) -- resets the random so that the 'random' number for n is always the same
    math.random() -- fixes lua random bug
    local no = math.random(4)
    --print(no, n)
  return no
end

Now I want to limit the next block's number - a block of 1 will always have a block 2 after it, while block 2 will either have a block 1,2 or 3 after it, etc.
The next block's number is taken at random from the next table:

{
   [1] = {next = {2}},
   [2] = {next = {1,2,3}},
   [3] = {next = {4}},
   [4] = {next = {1,3,4}},
}

Before, all the blocks data was randomly generated, initially, and then saved. This data was then loaded and used instead of being randomly called. While working this way, I could specify what the next block would be easily and it would be saved for consistency.
I have now removed this saving/loading in favour of procedural generation as I realised that save whiles would get very big after travelling.

Back to the present. While travelling forward (to the right), it is easy to limit what the next blocks number will be. I can generate it at the same time as the other data.

The problem is when travelling backwards (to the left) I can not think of a way to load the previous block so that it is always the same.

Does anyone have any ideas on how I could sort this out?

sentences:
Is the source code of the Source Engine available? Is the full C++ source code of the Source Engine available?

I know the SDK is available with the purchase of a Source-based game, but my goal is to find a open-sourced game engine that includes its full implementation details for learning purposes.

sentences: How to calculate the Forward, Up, Right vectors using the rotation angles? As the title says, I have the pitch and the yaw of an object, How do i use them to calculate the forward, up, right vectors (like the ones in unity), I've searched everywhere and only could find the forward vector.

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: Standard key bindings for movement along three axes? I understand that the WASD keys are standard for moving a character along two axes (left/right, up/down) because in the QWERTY layout, they are arranged like the arrow keys. I want to make a game where the character can move along three axes, i.e. also front/back. Are there standard key bindings for this as well?

sentences:
Help finding coordinate for left of screen in this frustum I have a frustum with l=-2, r=2, n=0.5, f=10, corresponding to left, right, near, far respectively. I also define top and bottom too.

I've set the camera eye up at (0, 0, -2.5), looking directly at (0, 0, 0) with up (0, 1, 0).

Suppose I want to position an object centred at z=-1. I want to find the x coordinate so that under this frustum it appears exactly centred on the left edge of the screen.

I set up the following diagram to help me:

                       +z
                       |
            \          |          /
     -x<_____\_________|_________/______>x
              \____x___|-1      /
               \       |       /
                \      |      /
                 \_|l|_|     /
                  \    |    /     |near dist=n=0.5
                   \   |   /      |
                    \  |  /       |
                     \a| /        |
                      \|/         |
                       |-2.5
                       |
                       -z

So to find x I can use simple trig. Since tan a = |l|/n and tan a=x/1.5 then the formula for x is x=|l|/n*1.5=2/0.5*1.5=6, where |.| is the absolute value.

But when I use this x value to draw an object left of the centre, it does not appear centred at the edge of the screen. I can see the object but it's not on the edge. Moreover, if I increase n then the gap between the object and the left edge increases. What am I doing wrong?

UPDATE

Empirically I have discovered that if I compute x=|l|/n*2.5 then my object is correctly centred on the left edge of the device screen, and works for any n value I choose. Not sure why 2.5 works...

SOLUTION

Not really worthy of an answer, but I found in some legacy code that the renderer was set up to transalte the z forward by 1 unit, so this was undoing my -1 z value, hence why multiplying by 2.5 worked and not 1.5.

Despite this annoying fact, I'm now confident I fully understand how the frustum fits into OpenGL.

sentences:
How to create walking animations in Gamemaker 8 We are learning how to use Gamemaker 8.1 in my game design class, and I wanted to experiment with it, and try to make my own game.
I have run into a problem when trying to animate an object walking.
I've looked all over google for how to animate the walking, but the only tutorials I can use what looks like a different kind of Gamemaker where you code everything.

To specify, I am using the version of Gamemaker where you drag and drop different actions into events. You can add code, but I would prefer not to use it.

I would like to know a way to either import a sprite sheet or a gif and have a walking animation play while the character is moving whenever you use the arrow keys.

sentences: Don't Render always on top Unity world space canvas UI I have a World Space Canvas where I have a text object which is always rendering on top. I checked that it has UI/Default Shader attach. Is there any way available to not render always on top, the 3d UI text.? Any built-in or custom shader available to restrict it? I tried diffuse shader but now the text is not readable. I have also tried a shader from another post at gamedev but the problem is still persist.

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:
debug unreal engine c++ - how to run in break mode I have a number of things not working properly with my FBX imports and I would like to understand how FBX imports work internally. Now, I am noob in software development, so how do I debug the internal C++ code of Unreal? I want to set a breakpoint in Visual Studio Code and explore variables / memory etc. I have found some sources, but for my level of knowledge, they explain nothing to me
To make it clearer: I need to debug internal code, for fbx imports, like not the code that I am writing for my game objects. Basically, I want the engine to stop at the break point once it starts importing fbx (I have found functions seemingly responsible for that)

sentences:
How can I create a random "world" in a tile engine? I am designing a game that is working on a classic tile engine, but whose world is generated randomly. Are there existing games or algorithms that do this?
The procedural generation algorithms I have found are never using a tile system...
What would be the best way to generate a whole "world" using a tile system? I am not talking about mazes of blocks, but an overall "world map"
thanks

sentences:
Is it possible/recommended to make a universal game library interface in C Lets say I want a game to be able to run with SDL, Allegro, on Game parks or Tiny Arcade and I don't want to recode everything everytime I port my game.

The C and C++ language separate definition in .h files and source in .c files. My teacher said it could be possible use the same .h declaration file but have different .c implementation files.

So in theory I could write something like this in the .h (the syntax is not perfect)

typedef myBitmapStruct;
void myBlittingFunction ( myBitmapStruct bmp, int x, int y );

Then I could have different .c for each game library. myBitmapStruct will refer to a BITMAP in the allegro implementation, or an sdl_surface in the SDL implementation, etc.

So in theory I think it could work, in practice it might lead to optimization issues. Since first it needs an additional method call because library functions are encapsulated. Second it might been additional code to make conversion or adjustments. For example allegro 5 use an on grid coordinate system, so 0.5 must be added to any x, y coordinates passed in parameter.

Do you think it could be recommended to do a such universal interface?

Did other people already attempted to do this before?

sentences:
Stencil mask with AlphaTestEffect I am trying to pull off the following effect in XNA 4.0:

The purple area has 50% opacity. I have gotten pretty close with the following code:

public static DepthStencilState AlwaysStencilState = new DepthStencilState()
        {

            StencilEnable = true,
            StencilFunction = CompareFunction.Always,
            StencilPass = StencilOperation.Replace,
            ReferenceStencil = 1,
            DepthBufferEnable = false,
        };

public static DepthStencilState EqualStencilState = new DepthStencilState()
        {
            StencilEnable = true,
            StencilFunction = CompareFunction.Equal,
            StencilPass = StencilOperation.Keep,
            ReferenceStencil = 1,
            DepthBufferEnable = false,
        };

...

if (_alphaEffect == null)
{
       _alphaEffect = new AlphaTestEffect(_spriteBatch.GraphicsDevice);
       _alphaEffect.AlphaFunction = CompareFunction.LessEqual;
       _alphaEffect.ReferenceAlpha = 129;
       Matrix projection = Matrix.CreateOrthographicOffCenter(0, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferWidth, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferHeight, 0, 0, 1);
       _alphaEffect.Projection = world.SystemManager.GetSystem<RenderSystem>().Camera.View * projection;
}

_mask = new RenderTarget2D(_spriteBatch.GraphicsDevice, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferWidth, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
_spriteBatch.GraphicsDevice.SetRenderTarget(_mask);
_spriteBatch.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.Stencil, Color.Transparent, 0, 0);

_spriteBatch.Begin(SpriteSortMode.Immediate, null, null, AlwaysStencilState, null, _alphaEffect);
_spriteBatch.Draw(sprite.Texture, position, sprite.SourceRectangle,Color.White, 0f, sprite.Origin, 1f, SpriteEffects.None, 0);
_spriteBatch.End();

_spriteBatch.Begin(SpriteSortMode.Immediate, null, null, EqualStencilState, null, null);
_spriteBatch.Draw(_maskTex, new Vector2(x * _maskTex.Width, y * _maskTex.Height), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
_spriteBatch.End();

_spriteBatch.GraphicsDevice.SetRenderTarget(null);
_spriteBatch.GraphicsDevice.Clear(Color.Black);

_spriteBatch.Begin();
_spriteBatch.Draw((Texture2D)_mask, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, layer/max_layer);
_spriteBatch.End();

My problem is, I can't get the AlphaTestEffect to behave. I can either mask over the semi-transparent purple junk and fill it in with the green design, or I can draw over the completely opaque grassy texture. How can I specify the exact opacity that needs to be replace with the green design?

sentences:
Making a camera in a 2D game (glOrtho) I'm trying to make a camera that follows my character and it seems I've managed. However, I don't know how to limit that my camera don't follow me when my character reachs the boundaries of the windows (it's ugly see black spaces beyond my tile map x_x).

So, this is my code:

public class Camera {
    public void update(Vector2f spritePos) {
        Vector2f pos = new Vector2f(spritePos.getX()-368, spritePos.getY()-268);

        if((pos.getX()+368 > 368) && (pos.getY()+268 > 268)) {
                glMatrixMode(GL_PROJECTION);
            glLoadIdentity();
            glOrtho(pos.getX(),
                pos.getX() + Display.getDisplayMode().getWidth(),
                pos.getY() + Display.getDisplayMode().getHeight(),
                pos.getY(),
                -1,
                1);
            glMatrixMode(GL_MODELVIEW);
        }
    }
}

I substract 368 to the X position, because I want to place my character at the center of my camera. Same with 268. This is a bad way to archieve this, because my camera "jumps" roughly to the position of my character >.

Thank you very much.

sentences:
How to implement throw curve with virtual height in a 2D side-view game I am working on a 2d side-view soccer game that looks like this image:

But now I stuck on how to implement parabola pass ball. I have found many questions corresponding to my problem:

Calculating velocity needed to hit target in parabolic arc
Throw object towards predefined place?
http://en.wikipedia.org/wiki/Trajectory_of_a_projectile

But they all just tell how to draw parabola in simple 2d space. In my game, except for the normal x,y there is also a virtual height coordinate, so the final viewing position of the ball is:

world position + current_height * Calc_Scale. (Calc_Scale is 0.3f)

Currently I did it the following way: I calculate the pass time(T) and distance(D) from point A to B

the pct = current_time / T
current_height = D * (4* pct - 4 * pct* pct)

Unfortunately, it looks bad...

UPDATE: @ashes999  I tried quadratic equation like current_height = D * (4* pct - 4 * pct* pct), it is not good(I am continuing to try different factors).I am pretty sure sin/cos can not work here, for example, player A is in(300, 200), B is(300, 800), the ball will make a direct line beyond B's head then drop to B's feet(or head), and this can not be done by cos/sin way, And I am thinking can this be done by some sort of projection, I just calculate the x,y,z then project z value into y axis?

void RSSoccerBall::Pass(const vector2d& target, double force)
{
vector2d DistVec(target - m_vPosition);
m_PassDistance = DistVec.getLength();
if(m_PassDistance > MaxShortPassDistance)
{
m_CurrentPassTime = 0.f;
m_PassTime = TimeToCoverDistance(target, m_vPosition, force, true);
}
}

void RSSoccerBall::update(float dt)
{
//for parabola calc
if(m_CurrentPassTime < m_PassTime)
{
m_CurrentPassTime += dt;
float pct = m_CurrentPassTime / m_PassTime;

m_Height = m_PassDistance * 0.7 *  (4 * pct - 4 * pct * pct);
}
vector2d    exactViewPos = m_vPosition; //m_vPosition is the 2d world position
exactViewPos.y += m_Height;
//render football at exactViewPos;
...
}

@Mario, These are my code ,I have used an extra variable to store height. - Determing an object's position along a curve over time this is where the equation from

I do not want the top of the arc always to be at 50% distance traveled, because player A and B probably not in same Y value, if B's Y value is higher than A's Y, the top of the arc will be exceed 50%.
I found a wiki link: - http://en.wikipedia.org/wiki/Range_of_a_projectile
describe Ideal projectile motion on uneven ground, but the formulas are complicated for me to convert into current situation(we have start point, end point, start velocity, travel time)

Can anyone give me some pointers how to accomplish that?

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:
Why won't InvokeRepeating work for me? I am designing an FPS game and scripted this shooting enemy that is supposed to shoot at the player if he is in the trigger zone once every second, but it just rapid fires and InvokeRepeating doesn't seem to do anything. No errors or anything. I am new to programming so it is most likely a rookie mistake. So here is the code

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

public class EnemyAI2 : MonoBehaviour
{
    public float fireRate = 10f;
    public float CanShoot;
    public float forceadded;
    public Transform BulletSpawn;
    public Transform PlayerTransform;
    GameObject player;
    NavMeshAgent enemy;
    public GameObject bulletclone;

    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        enemy = GetComponent<NavMeshAgent>();
        {
            InvokeRepeating("OnTriggerStay", 1.0f, 1.0f);
        }
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 direction = PlayerTransform.position - this.transform.position;
        enemy.destination = player.transform.position;

    }

    void OnTriggerStay(Collider other)
    {
        if(other.gameObject.tag == ("Player"))
        {
            gameObject.GetComponent<NavMeshAgent>().enabled = false;
            {
                Vector3 direction = PlayerTransform.position - this.transform.position;
                {
                    var Bullet = (GameObject)Instantiate(bulletclone, BulletSpawn.position, BulletSpawn.rotation);
                    Bullet.GetComponent<Rigidbody>().velocity = Bullet.transform.forward * forceadded;
                    Destroy(Bullet, 1.0f);

                }

            }
        }
        else
        {
            gameObject.GetComponent<NavMeshAgent>().enabled = true;
            enemy.destination = player.transform.position;
            Vector3 direction = PlayerTransform.position - this.transform.position;
        }
    }
}

sentences:
How to build a C# library for Unity as a pure Visual Studio project The aim is to build a relatively simple (2D) game in Unity with most of the game logic in a non-visual AI. The AI needs a lot of testing and debugging independently of any visuals (which is best done using VS tools), and the API connecting them is one class and a few methods/properties. [A future version might not even use Unity.]

So the question is how to set up a VS solution file to build the AI for testing and debugging while remaining compatible with the Mono build environment used by Unity. Yes, I know it has to be C# 4, but beyond that? At present I'm copying CS files around and that doesn't feel right.

Just to make it crystal clear, the AI has no dependency on Unity and will be built in a project that has VS testing and code analysis but no Unity tools or imports. In future it may be used with a different engine.

sentences:
How to properly translate a point by a matrix? I wrote a simple Matrix class and it has methods like rotate, translate, etc. They all seem to be working, but whenever I try to translate a rectangle using the matrix, the translation axis seem to be flipped. It doesn't appear to be the fault of the matrix, however, because if I do matrix.translate(50, 0), It gives me a matrix that looks like this:

$$
\begin{bmatrix}
1 & 0 & 50 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{bmatrix}
$$
As expected. It appears that I am applying the matrix incorrectly instead. I am using this code to get the resulting X/Y axis for each point in the rectangle:

pointX = x * mat.row1.x + y * mat.row1.y + mat.translateX
pointY = x * mat.row2.x + y * mat.row2.y + mat.translateY

But when I call translate(50, 0), I get this:

Instead of this:

As you would expect. What am I doing wrong? Am I incorrectly calculating the points?

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:
How do I provide a fully programmable pipeline for rendering? I am writing a game engine and I want people who use it allow to define the rendering pipeline. Just they can define the scene geometry, characters, items, light sources, and so on. So the term programmable pipeline doesn't refer to using custom shaders in OpenGL, which is the case anyway.

To provide a programmable pipeline, I want to abstract the OpenGL level so that people who use the engine don't directly have to struggle with framebuffers, render targets, and so on. The definition of the pipeline have to be done in scripting. The engine will then load the definition and create the framebuffers, render tagets and so on at initialization time.

Are the already approaches to this kind of a programmable pipeline in game engines? How can I let the people who use the engine define the pipeline on a sensible abstraction level? I do not want them to create all their render targets on their own. It would be better to just define connections beweent passes and the shaders which should be used.

Another problem is to connect geometry and lights with the pipeline if it is customizable. How can I approach this challenging goal? Every idea, as answer or comment, is appreciated.

sentences:
Predict Time of projectile flight I am trying to matemathically predict how long will projectile fly until it reach
 the target. I am trying to implement this formula:

t = [V * sin(α) + √(V * sin(α))² + 2 * g * h)] / g

where I know V (velocity of projectile) , α (angle of launch) , h (height of launch) The problem is it shows some weird results. I am not sure what is wrong (using ue4):

float Time = Velocity * FMath::Sin(AngleDeg) + FMath::Sqrt(FMath::Square(Velocity * FMath::Sin(AngleDeg)) + (2.f * Gravity * Height));
Time /= Gravity;

For example this test inputs:
        Gravity = 9.8;
        Height = 10;
        Velocity = 10;
        AngleDeg = 10;
shows 0.97 seconds but theresult should be 1.61 according this calculator: https://www.omnicalculator.com/physics/projectile-motion ... When I try different inputs the result is always wrong... I also got the formula from this website so not sure what's wrong. Thanks for any advice

sentences:
What is an acceptable receive rate for a client? I've noticed that syncing a transform( in Unity, so a Vector3, and a Quaternion ) ends up being close to 1000 byes per second received on a client( send rate of 20hz ). Multiply this by a generous 20 entities a single match might have and that's about 15k-20k bytes per second.

Is this too much? What should I be aiming for? What data rates do games typically have?

sentences:
Entity interpolation with a Unity listen server How can this be done? I've implemented client side interpolation but I'm at a loss on how to implement it on a listen server. In order for the listen server player to see the same thing as the clients, it needs to display it's past positions.

The problem with this is, as far as I know, there's no way to specify positions for rendering and positions for collision and everything else in Unity. transform.position is used for everything. Is there a way to draw in a different position?

sentences:
How to make UI Button to rotate an gameobject? I'm trying to make a button to make a gameobject rotate and stay rotating in its own axis (Y) but I cannot make it work...

As far as I know it's very simple:

Create an empty gameobject (or whatever you want)
Make a script and attach it to the gameobject
Create public methods
Link the gameobject with the script attached to the button onClick event
Click the button and test the script

My problem is that I don't know how I'm wrong here are the scripts of my project

This first script is my attempt using keys, and it works like charm

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

public class TurntableRotation : MonoBehaviour
{
    public GameObject turntable;
    public float turnSpeed;
    public bool canRotate = false;

    void Start ()
    {
    }

    void Update ()
    {
        StartTurntableRotation();

        StopTurntableRotation();
    }

    public void StartTurntableRotation()
    {
        if (Input.GetKey(KeyCode.I))
            {
                canRotate = true;
            }

            if (canRotate)
            {
                turntable.transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime);
            }
    }

    public void StopTurntableRotation()
    {
        if (Input.GetKey(KeyCode.P))
        {
            canRotate = false;
        }

        if (!canRotate)
        {
            turntable.transform.Rotate(0,0,0);
        }
    }
}

This second script is my work in progress

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

public class TurntableUIBtns : MonoBehaviour
{
    public GameObject turntable;
    public float turnSpeed;

        //This is my public method used by the button
    public void StartTurntableBtn()
    {

                //This is my attempt to write the code for the object to rotate
        turntable.transform.Rotate(Vector3.up * turnSpeed * Time.deltaTime);
    }
}

As far as my knowledge goes, it is supposed to work, but I have to click every time to rotate my object, my goal is to click the button and make the object rotate and stay rotating

sentences:
I can't understand the batcher.draw at libgdx here is the code:

batcher.draw(birdMid, bird.getX(), bird.getY(), bird.getWidth() / 2.0f,
             bird.getHeight() / 2.0f, bird.getWidth(), bird.getHeight(),
             1, 1, bird.getRotation());

what each parameter in this method presents?
Please explain in detail

sentences:
coordinate transformation I have two coordinate systems, like so

How can I transform a point on the one of the coordinate system to other ?

Pxyz = M . Px'y'z'    what is M ?

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:
How is actual object size in a scene calculated? I've got stuck with 'pixel per unit' parameters and object scale.

I've created two different sprites. A background picture, 1000x1000 pixels, and another one for a 'player', 200x200 pixels.
I've added two empty game objects, with default transform, so positions are (0; 0; 0) and scale is (1; 1; 1). I added a sprite renderer to both of them, and assigned the required sprites. Both sprites have 1 pixel per unit.

And the 'player' in the scene looks much more bigger than the background.

I expect that if ppu=1, then the background would have a size of 1000 units, a player 200 units and it would be 5 times smaller.

What am I doing or understanding wrong? What is an actual object size?

sentences:
Rotating 2D positions without rotating graphics I am working on a basic 2D game from an overhead/fake isometric perspective. Arrow keys move the camera left/right/up/down. The trouble occurs when I tried to add rotation.

I want the player to be able to rotate the camera (or map?) around the camera's center. The sprite positions should move during the rotation, but the sprite graphics should not rotate. For example, the sprites will always point "up" even as their position rotates around the screen.

I thought this was would be easy. Just keep track of the X, Y, and rotation of the camera. However, I am having some issues. Here is a snippet of my code (Go with the Pixel 2d library):

if win.Pressed(pixelgl.Key1) {
    camRot += camRotSpeed * dt
}
if win.Pressed(pixelgl.KeyLeft) {
    camX += camSpeed * dt
}
// similar for other key presses...

// Draw objects
for i, entity := range entities {
    sin := math.Sin(camRot)
    cos := math.Cos(camRot)
    adjustedCamX := camX*cos - camY*sin
    adjustedCamY := camX*sin + camY*cos
    adjustedMatrix := matrices[i].Moved(pixel.V(camX, camY)).Moved(pixel.V(adjustedCamX, adjustedCamY))
    entity.Draw(win, adjustedMatrix)
}

There are two issues: (1) after rotating, using the arrow keys now moves the camera at an angle instead of up/down/left/right and (2) I do not know how to rotate around the screen's center rather than whatever the current orientation is (0,0 in the bottom left?).

Note: The Pixel library makes use of transformation matrices rather than pure coordinates. At first I thought this was good (I can just do a rotation on the entire screen!) but then the graphics rotate as well. As such, I just try to emulate using pure coordinates and ignore the matrix (see the line with adjustedMatrix, the matrices[i] is just that entities' X Y position).

An example of what I am trying to achieve can be seen in the first few seconds of this video

sentences:
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:
Does a game have to explicitly support SLI/Crossfire to take advantage of it? This is more of a general curiosity question than a howto question. Just as the title says, do games have to explicitly support SLI/Crossfire to take advantage of multiple graphics cards or are they linked in such a way that you don't need to write extra code?

If explicit support is required, is it common for games to have this support?

sentences:
How could I figure out the shortest way to turn, and whats the angle? I'm creating some robots for my tank game. I want them to find each other and shoot each other down, so I'm trying to implement a way for them to turn towards each other, and turn the shortest way. For instance, if we where T1 (tank 1), how could I figure out if I where to turn right of left, and at what angle to turn if

Tank1 (us) position is (8906,76), facing is 23 degrees.
Tank2 (enemy) position is (888,61)

0/360 is straight up.

The way I've tried to do is to decide what quadrant the enemy is of myself. But that leaves out a 45 degree angle to fail. I know there is some archtan but I cant simply get a grip on them...

sentences:
Unity Android Orientation Bug in Auto Rotate I am currently looking for a workaround, or fix, for a Unity bug.

I want to be able to auto-rotate my game, while respecting the Android system settings.

Currently, if you set your Unity Orientation Mode to "Auto Rotation", your application will automatically change its orientation based on the physical's device orientation.  In iOS, if you disable the Screen Rotation in device settings, the auto rotation stops as intended.  In Android, even if you lock your screen orientation, the application will continue to auto rotate.  This is a major bug.

Does anyone know of a workaround, so that my android application will be able to auto-rotate, while still respecting the device system settings?

You can easily reproduce this bug by creating a blank project, setting the orientation mode to "auto rotation" and running it on an android device.

sentences:
How to store information about a simulated sport match in a browser game? There is a browser game called Soccerstar where users play in a soccer team and compete in matches against other teams. Matches are scheduled at specific times of the day and played automatically and when the user logs in he can watch an animation representing the last played match.

Now, I want to implement a similar feature: a match is simulated on the server based on the players statistics and tactical choices and the information about the match progression is stored in the database. Please note that I want the outcome of the players actions (tackles, shots etc.) not to be completely deterministic because I want to introduce some randomness.
Once the match has been simulated and stored, the client can retrieve the information and generate the animation at any time.

My main doubt is how to represent and store the information about the match progression: what would be the smartest way to do it?

sentences:
Image effect console error I have imported image effects from asset store in my project.
When imported, I've got 5 error messages :

Assets/Standard Assets/Effects/TonemappingColorGrading/Editor/TonemappingColorGradingEditor.cs(370,134): warning CS0618: `UnityEditor.TextureImporterFormat.AutomaticTruecolor' is obsolete: `Use textureCompression property instead'

What to do ?

sentences:
How to make illusion of round world? I want to make a flat world, but i want to split it into pieces which will load in segments (for better optimization), and when you are at the end of map it will start loading segments from the beginning again. And I want to make an illusion of roundness (only optical effect if possible). For example, when you watch ships on the horizon, you see their masts first.

I'm asking only for theoretical ideas, so you don't need to send any scripts.

sentences:
ways to make a physics engine Hey so i've been looking into real time physics engines, which led me to the crazyLaggoa multiphysics engine by thiaga costa, and brought up the question of:

What are some possible ways, ideas that have or have not already been done to make a real time physics engine? How about non-real time?

I know the Lagoa engine uses meshes and a crapload of particles... and then there's the rigid body way of going about things.....
Also i'm only at 2d level in creating games right now so any 2d physics ideas would be great too!

sentences:
Help with 3D Double Jumping in Unity I'm having some trouble with vertical movement. I'm trying to add double-jumping but none of the scenarios online seem to be working, and I can only ever manage to get a single jump. Here's my code:

using UnityEngine;
using System.Collections;

public class Moving : MonoBehaviour {
//public float speed;
CharacterController controller;
public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
public bool candoublejump = true;
public int jumptime = 0;
private Vector3 moveDirection = Vector3.zero;
// Use this for initialization
void Start () {
    controller  = GetComponent<CharacterController>();
}

void FixedUpdate() {
    if (controller.isGrounded) {
        moveDirection = new Vector3 (Input.GetAxis ("Horizontal") * 2000, 0, Input.GetAxis ("Vertical") * 2000);
        moveDirection = transform.TransformDirection (moveDirection);
        moveDirection *= speed;
    }
    if (Input.GetButton ("Jump")) {
        if (controller.isGrounded) {
            moveDirection.y = 0;
            moveDirection.y = jumpSpeed;
            candoublejump = true;
        } else {
            if (candoublejump) {
                candoublejump = false;
                moveDirection.y = jumpSpeed;
            }
        }
    }
    moveDirection.y -= gravity * Time.deltaTime;
    controller.Move(moveDirection * Time.deltaTime);
}
}

Is there something wrong with my keyboard maybe? My theory is that it's checking for the double jump in the split second after you did the first one, which isn't helpful because you're still holding the jump button.

sentences: Is it possible to achieve the same performance of CUDA on OpenCL? I am planning on porting some of my CPU code to GPU. I want my code to run on all GPUs, so openCL seems to be the right choice. Will I be able to achieve the same performance as of CUDA in openCL?. What framework would do better if I want to support all GPUs?

sentences:
What would be a good sport game for a beginner/intermediate game dev to make for practice? I'm interested in making a sport game for practice, but giving it some fun twists sort of like nintendo does, (super strikers charged, mario golf.)  I'm planning on using unity, but since I am by no means an expert I'm trying to figure out a sport that will be reasonably easy to create.  I'm aware that its not going to be easy, but, for instance I'm not going to make a game like madden, which would have a ton of difficult stuff like play calls which involve predetermined paths and intelligence on both sides, in general way to difficult.  What would be a good sport to try a stylized version of?
I'm aware that this is a subjective question, but it isn't a question where any answer is as good as another, so I think it's allowed according to the guideline, but correct me if I'm wrong I guess.

sentences:
Random Y Axis Movement Within Set Limits (C#) I've searched everywhere for this answer but everything I find is in Javascript and a lot of it doesn't help/work in my situation since most of it is Vector3's and using each axis, and my game is 2D.

So I have these prefabs that get spawned off-screen and then I have a script attached to them that tells them to move left on the x axis. I need them to also pick a random direction (up or down) on the y axis, and travel that way until they get to a certain spot (range) and then to switch directions and go the opposite etc.

Here is what I have tried most recently:

public float itemUp = 0.1f;
public float itemMove = 0.7f;

public float x;
float y;
float z;
Vector3 pos;

void Update () {

    //transform.position = Vector2(Random.Range (1,4),Random.Range (1,4),10);

    transform.position -= Vector3.right * itemMove * Time.deltaTime;

    x = 0;
    y = Random.Range(-100, 100);
    z = 0;
    pos = new Vector3(-x, y, z);
    transform.position = pos * itemUp * Time.deltaTime;
}

Anyone know what I'm missing/not doing correctly? I'd really appreciate any help you can give, thank you.

sentences:
Wandering motion in Unity I am trying to come up with a smooth wandering motion for my game-object using Unity. What I currently doing is rotate the object by some random angle calculated every 1.5 second delay. But I am aiming getting a smooth rotation whenever it transitions to a different randomly generated angle.

Below is my script attached to my character.

 void Update () {
     if (canWander && (currTime + delay < Time.time)){
        changeAngle();
        currTime = Time.time;
     }
     if(canWander){
        Wander();
     }
}

private void changeAngle(){
    float prevPosY = transform.position.y;
    Vector3 waypoint = Random.insideUnitSphere + new Vector3(10,prevPosY,10);  //waypoints are generated based on random unit sphere + ( bounds of the plane they are on )
    Vector3 relative = transform.InverseTransformPoint (waypoint);
    float angle = Mathf.Atan2 (relative.x, relative.z) * Mathf.Rad2Deg;
    transform.Rotate (0, angle, 0);
}

private void Wander(){
    transform.position += transform.forward * Time.deltaTime * acceleration;
    if (acceleration < maxSpeed) {
        acceleration += 0.5f;
    }
}

So the character wanders with newly generated random angles every time but its not a smooth transition. It suddenly transitions to the new angle and it does not feel realistic at all. What could I possibly change with my current code to make it more smooth and realistic?

sentences:
Can Event Triggers be used on Non-UI objects? Is there any way to use UI-Based event triggers on Non-UI objects?

Example : on any UI object, you add an EventTrigger component, set the event, and then set the actions for the event. Its easy, and clean, to make UI do various actions on things like mouse enter / exit, drag, etc.

For non UI objects (a cube, for example) these kind of things are mostly done through scripts with raycast code. Its not impossible, but I find it messier, harder to organize, and less flexible then the EventTrigger approach.

I'm working on a turn based strategy type game. Much of the game mechanics is based around mouse movement and clicking. I tried just adding an on-click event to a cube, but it didn't do anything.

Is this scenario just plain not supported?

sentences:
Have both Cubemaps and TextureArray in a single texture register? I want to have both Point Lights, aswell as Spot Lights.
For the Point Lights I have a TextureCubeArray and for the Spot Lights I have a Texture2DArray. Is it possible to combine these two into a single Texture2DArray and treat the Point Light Shadow Maps as Cubemaps, and treat the SpotLight shadow maps as single textures?
I would like to bind only one array instead of multiple ones.

sentences:
MVC? patterns for game development? Possible Duplicate:
  MVC-like compartmentalization in games?

I am thinking of the best way to structure my project and was thought a MVC style pattern would be appropriate. Would be correct having the model handle the majority and basically being the game engine?

Are there any standardised patterns recommended for simple game development?

Model / Game Engine

Data: Level Design, Chat feeds, etc
Game Status: Player status, Enemy status, World Status etc etc.
Engine: Physics, Collisions, AI

View

3D: Gameplay, Camera, Rendering...
2D: UI etc

Controller:

Player Input
UI Input

sentences:
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:
glGenBuffers fails with 0x0, win7, glew I try to run a simple renderer on my win7 machine but it dies at the first glGenBuffers call.
The computer has an Intel HD3000 card, with the latest driver (OpenGL 3.0 support).
I use glew 1.10 (self compiled with mingw).
The linker command is:

g++ -LC:\Program Files\Microsoft SDKs\Windows\v7.1\Lib -Lc:\opt\glew-1.10.0\lib -LC:\opt\SDL-1.2.15\lib\x86 -o pysicsdemo.exe src\main.o src\Box.o -lOpenGL32 -lglu32 -lSDLmain -lSDL -lglew32.dll

And the result is 0x0. Most probably glew can't load the extension, but why?

sentences:
help animating a player in Corona SDK Working on a game in the Corona SDK with Lua and I need help so the player animates on the line drawn. Right now he animates at the beggining and the end but not on the line.

Here is the player code:

function spawnPlayerObject(xPlayerSpawn,yPlayerSpawn,richTurn) --spawns Rich where we need him.
-- riches sprite sheet and all his inital spirites. We need to adjust this so that animations 3-6 are the only ones that animate when moving horizontally
    local richPlayer = sprite.newSpriteSet(richSheet1,1,6)
    sprite.add(richPlayer, "rich", 1,6,500,1)
    rich = sprite.newSprite(richPlayer)
    rich.x = xPlayerSpawn
    rich.y = yPlayerSpawn
    rich:scale(_W*0.0009, _W*0.0009) -- scale is used to adjust the size of the object.
    richDir = richTurn
    rich.rotation = richDir
    rich:prepare("rich")
    rich:play()
    physics.addBody( rich, "static", { friction=1, radius = 15 } ) -- needs a better physics body for collision detection.
end

And here is the code for the line:

function movePlayerOnLine(event)
    --for the original image replace all rich with player.
 if posCount ~= linePart then
    richDir = math.atan2(ractgangle_hit[posCount].y-rich.y,ractgangle_hit[posCount].x-rich.x)*180/math.pi
    playerSpeed = 5
    rich.x = rich.x + math.cos(richDir*math.pi/180)*playerSpeed
    rich.y = rich.y + math.sin(richDir*math.pi/180)*playerSpeed
        if rich.x < ractgangle_hit[posCount].x+playerSpeed*10 and rich.x > ractgangle_hit[posCount].x-playerSpeed*10 then
            if rich.y < ractgangle_hit[posCount].y+playerSpeed*10 and rich.y > ractgangle_hit[posCount].y-playerSpeed*10 then
            posCount = posCount + 1
        end
    end

I don't think anything has changed recently but I have been getting an error when testing of "attempt to upvalue "rich" a nil value" on the second line, richDir = etc.

sentences:
Database structure for a trading cards video game (TCG) Just started and after pondering with registered users' table everything came to a halt.

So far I've got:

+----------------------+
| tblUsers             |
+----------------------+
| userID(primaryKey)   |
| username             |
| password *           |
| accountStatus **     |
+----------------------+

* hashed
** 0=not activated, 1=activated, 2=suspended

Still haven't decided on each of the field's data type. But the question is: should I have one big massive table for all the cards or split them into say tblCreatures, tblSpells, tblTraps, tblQuests tables?

Plus, for example, some of the creatures have special abilities besides the usual strength and health stats. So I assume if there was tblCreatures, it would have  cardTitle, cardStrength, cardHealth, cardDescription and then it would have cardAbility0...4, because I doubt that a single creature card can have more than 2 abilities?

Also how would I contain each user's decks? A single user for example can have up to 10 decks created by themselves, which will be saved on the server.

Any suggestions/remarks?

The project will either be purely written in C# (both client and server) and XNA4, or maybe in the future the client will be ported to Flash+AS3 while server will be done in C#.

sentences:
How to prepare for a game development competition? Ludum Dare 18 is coming up and I'll be participating in it. I've done a couple other short-term game competitions in the past but this is my first big one (and my first solo one). I am REALLY excited for it, but I'm wondering if there are any tricks to preparing for this sort of thing, and any advice on what to do while in the competition. So...

How do you best prepare for, or participate in, a short-term game competition?

Your answer can be specific to Ludum Dare but I'm really talking about any game competition, as long as it's short-term -- not the month-long ones where you casually develop your game and release it; I'm talking high-pressure, finish-in-time, pull-an-all-nighter type competitions. The Global Game Jam fits here as well, if you participated in that earlier this year.

Also any tips in the context of a group of people (each working on their own solo game) would be great; I will be with the game development club at my school for most of the 48 hours (only a few other people, not a huge group).

sentences:
Properway to pass information from one system to another in an entity component system design After having read some example programs (namely Pong, Snake and Pacman) I am now experiencing with ECS. I am wondering where to put the elements for a reward flow. Do you know good practices for implementing the following feature in an ECS spirit?
Example:
Let coins_reward be a component carrying an amount of coins to be rewarded, energy_gauge be a component storing the remaining energy of an entity and damage be a component storing the damage inflicted to an entity.
Let say that there are enemies on the map, each enemy has an energy_gauge, maybe a damage if he has been hit and maybe a coins_reward if he his supposed to reward the player for killing him.
Let propagate_damages be the system that propagate the damages:
propagate_damages()
{
    collect_and_do<energy_gauge, damage>(apply_damage);
}

apply_damage(entity e, energy_gauge g, damage d)
{
    g.value -= d.value;

    if ( g.value > 0 )
        return;

    coins_reward r = get_optional_component<coins_reward>(e);

    if ( !r )
        return;

    reward_player(r);
}

Now how should be implemented reward_player()?
I though about the following designs:

Immediately give the reward to the player. This one seems to be out of scope for propagate_damages. Following the single responsibility principle I would rather have the player's state updated in another system.
Spawn a new entity and give him the coins_reward component as well as a collectible component. Then in a collect_rewards system collect the entities with these components and give them to the player. This one feels weird to me because temporary entities are created to carry information for another system. It feels more like I need a message system. Is it usual to have entities whose whole lifetime fits in a frame? On the plus side if I assign a position to this entity then I may be able to spawn visual indicators of the rewards on the map in another system.
Have a reference to the collect_reward system inside propagate_damages and queue the rewards here. Then process collect_reward later in the frame. If I pass the position here I can also spawn indicators on the map. In this case there no entities created but it does not feel like ECS.

For now I would go with number 2 but the entity-as-message part does not feel good. Is it how you would do it? Experienced programmers, how would you solve this problem?

sentences:
What direction does directional audio come from for a 2D view? In a 3D game, it makes sense that stereo balance is based on the angle between your camera direction and the directionto the audio source.

Is 2D audio just "fudge the left-right balance until it sounds good"? Are there games where the audio balance was still character-oriented rather than view oriented (so a character facing south causes stereo balance to be backwards)?

I'd be interested in answers supported by examples where a notable game was played by blind players using audio cues. The only one that comes to mind is Brood War

sentences:
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:
How do I make an HTML5 canvas tiled map with tiles which have other than squared edges? I'm creating an HTML canvas map and I'm trying to have the edges of the tiles not appear square, as in the tiles merge in to each other.  I've scoured the internet for hours but can't seem to find anything.  How would I go about doing this?

Dropbox link to project

I've included the used images so when the project is downloaded and run on the browser, the map should look like the following picture.  This is not how I want it to look but how it currently looks.

I know it's probably not possible to get this exact effect using a tile based map, and it's not a perfect representation, but here's a general idea of what I want to accomplish.  Notice how the corners are no longer squared but have a more rounded look and appear to be blending in with the next color tile.  That's my goal.

  Thanks in advance.

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:
Parallel Storylines - Underused Francise Characters One Hero Rule: Video games have only one protagonist. Example: in an rpg, party members are not seen in a field map, or they just follow you. Their role is "cannon fodder" tier, meaning who the hell cares if it dies. I never added it to my party anyway, following the min max gamefaq guide telling me to remove all its equipment beforehand. You end up with a video game that has only a single actor that plays 1000 tropes, in real life each person plays ~5 tropes at most. This is a bug caused by a single protagonist rule, i want to eliminate this rule through smart game design.

The problem is, in movies you can depict unlimited different characters and the story continuity never breaks, but in a video game leads to loss of context, can it be done?
conclusion: video games are an inferior mean of screenplay.

In Suikoden / Breath of fire 4, each chapter is devoted to a specific protagonist view, this is nice concept however it can get ankward...

Loss of context:
You would end up progressing their individual character storylines a little bit, but since you "switched context" to another protagonist, you lost track of what the other protagonist did, you no longer remember the progression of the story. This will never work... Especially if switch happens very frequently and the battles last too long.

Game Balance: Extra party members do not add to battle effectiveness:
in suikoden by endgame you have 200 party members but they are irrelevant since random encounters use only 4 party members. It is better to keep the same cast throughout the game and become overleveled than spread xp to never used party members.

Android "Pimp your money" games fixes this by adding a 30 min cooldown to each party member. This is nice, but they don't have story... Also this mechanic enforces a "play everyone a little bit", disables free choice of which party member to pick, amplifying your loss of context.

Why i want this? imagine a game like kingdom hearts where each party member gets its own storyline.

Questions:

1) Need Story-Telling Methods that avoid loss of context.

2) Need Battle Game Balance Rules.

sentences:
Rotating RigidBody2Ds in Godot I am practising programming games with the Godot Engine and I've been having some issues with RigidBody2Ds.

In this case I have a RigidBody2D as a child of a Node2D. The Node2D is rotating and the RigidBody2D with it. However, as soon as I use apply_impulse() it just returns to it's initial rotation point, which is zero.

Does anyone know what's going on here?

sentences:
GLSL C++ Only first sampler array index is accessible I have the following shader, which whose fragment shader contains a sampler array of 16 elements.

Fragment

#version 330 core
in vec2 _uv;
flat in int _instanceID;

out vec4 color;

uniform sampler2D sampler[16];

void main() {
    color = texture(sampler[_instanceID], _uv);
}

Now when I try to set the second array element using the following method

void Shader::setUniform(const std::string& uniform, GLuint* values, size_t amount) const {
    bindProgram();

    GLuint loc = getUniformLocation(uniform + "[0]");
    for(int i = 0; i < amount; i++){
        glUniform1ui(loc+i, values[i]);
        std::cout << values[i] << " "; //For debug
    }
    std::cout << std::endl; //For debug
}

It just sets the first element of the shader. Even though I'm passing 2 values.

This is the output of the cout's:

5 4
5 4
5 4
5 4
...

Looking up the shader variables with GDebugger, only the first element is set.

It also only draws the first (index 0) image.

sentences:
How can I add to the text multiple words or numbers? Now I'm using {0} I add anywhere in the text in the editor {0} and it will add the random number or random word. But I want now to be able to add for example also {1} and {2} so if for example the array of words is: hello,hi,bye and I will make in the editor in the text {0}……{1} it will add randomly two words from the array like hello and hi or hi and bye. It will pick up two random words. I don't place the {0} and {1} in same place each one in other place in the text and each time it will pick two random words and will display one word at {0} and one at {1}

Same for the numbers.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;

public class CustomText : MonoBehaviour
{
    public Text textField;
    public Vector2 randomRangeHours;
    public string[] words;
    public bool randomWords = false;

    private string defaultValue;
    private string originalValue;

    public void Init()
    {
        defaultValue = textField.text;
        originalValue = textField.text;
        GenerateRandomHour();
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            GenerateRandomHour();
        }
    }

    private void GenerateRandomHour()
    {
        string word = "";
        if (words.Length > 0)
        {
            word = words[UnityEngine.Random.Range(1, words.Length)];
        }

        string numberName = UnityEngine.Random.Range((int)randomRangeHours.x, (int)randomRangeHours.y).ToString();

        int t = Int32.Parse(numberName);
        if (t == 1)
        {
            defaultValue = defaultValue.Replace("hours", "hour");
        }
        else
        {
            defaultValue = originalValue;
        }

        if (randomWords)
        {
            textField.text = string.Format(defaultValue, word);
        }
        else
        {
            textField.text = string.Format(defaultValue, numberName);
        }
    }
}

sentences:
I want to develop basic level GameRanger link game lobby I want to develop basic level GameRanger link game lobby.

I am using Winform, C# Framework 4.0.
currently i am exploring below code
https://www.codeproject.com/Articles/14050/A-game-lobby-system-in-C?msg=5449482#xx5449482xx

But getting error to load gametypes/bridge.dll

desktop app GUI

sentences: Game developing on the oculus rift My question is, do I need the oculus rift development kit to develop games or can I do it with a standard pair of oculus rift,and if I can do it with a standard pair of oculus rift why does the development kit exist?

sentences:
Instance creation order error in GameMaker Look at the order of creation of the instances of a of the phases of my game.

Notice that first obj_BolaAzul (blue circle/square) is created, then obj_BolaVermelha (red circle/square).

As you can see, this is not what happens in the game. The obj_BolaAzul even being created first, it is above of obj_BolaVermelha.

This is happening in all other phases and began to occur a few days ago. Could someone tell me in some global configuration that I have modified.

sentences:
Scene2D Actor walking animation? I used to extend my Player/Entity class with Sprite, that way I could create a walking animation using SetRegion and super(stilldown.getKeyFrame(0));

I've recently started porting everything over to Scene2D and I use Actors now. I do not know how to use this way of animation anymore, does anybody have a guess how I could do this?

        animationtime += delta;
    if(dir == Direction.DOWN){
        setRegion(velocity.y == 0 ? stilldown.getKeyFrame(animationtime) : walking.getKeyFrame(animationtime));
    }else if (dir == Direction.UP){
        setRegion(velocity.y == 0 ? stillup.getKeyFrame(animationtime) : walkingup.getKeyFrame(animationtime));
    }else if (dir == Direction.RIGHT){
        setRegion(velocity.x == 0 ? stillright.getKeyFrame(animationtime) : walkingright.getKeyFrame(animationtime));
    }else if (dir == Direction.LEFT){
        setRegion(velocity.x == 0 ? stillleft.getKeyFrame(animationtime) : walkingleft.getKeyFrame(animationtime));
    }

This is how I'd initialise the animation

    playeratlas = new TextureAtlas("overworld/player/playersheet.pack");

    Animation walking;
    Animation walkingup;
    Animation walkingright;
    Animation walkingleft;

    Animation stilldown;
    Animation stillup;
    Animation stillright;
    Animation stillleft;

    walking = new Animation(1 / 4f, playeratlas.findRegions("walkingdown"));
    walkingup = new Animation(1 / 4f, playeratlas.findRegions("walkingup"));
    walkingright = new Animation(1 / 4f, playeratlas.findRegions("walkingright"));
    walkingleft = new Animation(1 / 4f, playeratlas.findRegions("walkingleft"));

    stilldown = new Animation(1 / 4f, playeratlas.findRegions("stilldown"));
    stillup = new Animation(1 / 4f, playeratlas.findRegions("stillup"));
    stillright = new Animation(1 / 4f, playeratlas.findRegions("stillright"));
    stillleft = new Animation(1 / 4f, playeratlas.findRegions("stillleft"));

    walking.setPlayMode(Animation.PlayMode.LOOP);
    walkingup.setPlayMode(Animation.PlayMode.LOOP);
    walkingright.setPlayMode(Animation.PlayMode.LOOP);
    walkingleft.setPlayMode(Animation.PlayMode.LOOP);

    stilldown.setPlayMode(Animation.PlayMode.LOOP);
    stillup.setPlayMode(Animation.PlayMode.LOOP);
    stillright.setPlayMode(Animation.PlayMode.LOOP);
    stillleft.setPlayMode(Animation.PlayMode.LOOP);

For now I only use a static image for my Actor

Sprite text = new Sprite(new Texture(Gdx.files.internal("overworld/player/placeholder.png")));

Now I draw it like this

public void draw(Batch batch, float ParentAlpha){
    text.draw(batch);
}

I would greatly appreciate help, I'm new to Scene2D and I can't find much on it.

sentences: The recommended road map to be a good graphics/game engine programmer I am a computer science student and I am developing with C/C++ and Python and I want to begin learning graphics tools to start developing with game engines, especially the Blender Game Engine. So what is your recommendation for me to learn and to read? And recommend me a road map for it.

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:
Magnitude of a vector in Generalized Balanced Ternary? Generalized Balanced Ternary is a fairly obscure but very elegant method of indexing a hex grid, using only a single integer coordinate. Operations like addition and multiplication on these coordinates have intuitive effects: translation and rotation respectively.

The only difficulty with GBT is calculating the magnitude of a vector given its coordinate, or alternatively, of decomposing it into a series of one-unit steps. Is there a standard method of doing this?

sentences:
Is Update(GameTime) called before it's finished? Code at the beginning of Update(GameTime) is being called over and over again, and code at the end of Update(GameTime) is only being called after a delay. Is Update(GameTime) called again before it's finished?

Relevant code:

    public override void Update(GameTime gameTime)
    {
        Console.WriteLine($"Current Position (Outer): {Texture.Position.Y}");
        if (Keyboard.IsKeyDown(Keys.Space))
        {
            Jump(gameTime);
        }

        UpdateGravity(gameTime);

        if (Keyboard.IsKeyDown(Keys.A))
        {
            velocity.X = -HorizontalMoveSpeed*(float) gameTime.ElapsedGameTime.TotalMilliseconds;
        }
        else if (Keyboard.IsKeyDown(Keys.D))
        {
            velocity.X = HorizontalMoveSpeed*(float) gameTime.ElapsedGameTime.TotalMilliseconds;
        }
        else
        {
            velocity.X = 0f;
        }

        Texture.Position += velocity;

        CheckCollisions();

        base.Update(gameTime);
    }

    private void UpdateGravity(GameTime gameTime)
    {
        velocity.Y += Gravity * (float) gameTime.ElapsedGameTime.TotalMilliseconds;
    }

    private void Jump(GameTime gameTime)
    {
        if (jumping) return;
        jumping = true;
        velocity.Y -= JumpSpeed * (float) gameTime.ElapsedGameTime.TotalMilliseconds;
    }

    private void CheckCollisions()
    {
        foreach (var platform in CryoGame.Platforms.Where(CollidesWith))
        {
            Console.WriteLine($"Current Position (Inner): {Texture.Position.Y}");
            var collision = false;

            var topInsideOther = Texture.Top <= platform.Texture.Bottom;
            var bottomOutsideOther = Texture.Bottom >= platform.Texture.Bottom;
            if (topInsideOther && bottomOutsideOther)
            {
                Texture.Top = platform.Texture.Bottom;
                collision = true;
            }

            var topOutsideOther = Texture.Top <= platform.Texture.Top;
            var bottomInsideOther = Texture.Bottom >= platform.Texture.Top;
            if (topOutsideOther && bottomInsideOther)
            {
                Texture.Bottom = platform.Texture.Top;
                collision = true;
            }

            if (collision)
            {
                velocity.Y = 0f;
            }
        }
    }

Example output:

Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Inner): ...

```

sentences:
Why do I get "UObject" has no member "BeginPlay" errors? I loaded up UE4 to work on a new project. I created two C++ classes, one for a bullet, one for a cannon. Upon loading into Visual Studio 2015 I immediately get the error:

  "UObject" has no member "BeginPlay"

Keep in mind I have not written a single line of code. This error just popped up. I have not written a single comment, a single variable, I don't even get to enter some white space so that I have room for new code. I just get the error. I tried remaking the project with different settings (like a blank project, third person, et cetera) and I keep getting that error.

sentences:
Issue with Mapping Textures to Models in Blender I've been trying to texture a model using Blender, but when I draw on the UV Editor it doesn't show up on the model, and I can't draw on the model itself. I've tried saving the image and the 3D View is set to Texture. Everything seems to be in order and I've followed several tutorials, but none of them seem to work with the version I'm using (2.64-- update was necessary for import plugin) and I'm absolutely stumped.

How can I draw textures to the model? If not within Blender itself, how do I export/import the textures?

EDIT: Vertex Paint works, though it is insufficient for my purposes. In addition, moving to the rendered view produces a solid-color model with none of the applied textures.

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:
Particles not rendering over projectors I am using projectors for shadows...When I use particles for bike speed up i.e., nitro speed the particles get cutout by those shadows....

Here is screenshot of it,

Here is my shader code of projectors ,

Shader "Projector/Projector Multiply Black"
{
    Properties
    {
        _ShadowTex("Cookie", 2D) = "gray" { TexGen ObjectLinear }
    _ShadowStrength("Strength",float) = 1
    }

        Subshader
    {
        Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+100" }
        Pass
    {
        ZWrite Off

        //Fog { Mode Off }

        Blend DstColor Zero

        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;
        float2 uv_Main     : TEXCOORD0;
    };

    sampler2D _ShadowTex;
    float4x4 unity_Projector;
    float _ShadowStrength;

    v2f vert(appdata_tan v)
    {
        v2f o;

        o.pos = mul(UNITY_MATRIX_MVP, v.vertex);

        o.uv_Main = mul(unity_Projector, v.vertex).xy;

        return o;
    }

    half4 frag(v2f i) : COLOR
    {
        half4 tex = tex2D(_ShadowTex, i.uv_Main);
        half strength = (1 - tex.a*_ShadowStrength);
        tex = (strength,strength,strength,strength);
        return tex;
    }
        ENDCG

    }
    }
}

Here is my particle code,

// Simple additive particle shader.

Shader "Custom/Particle additive"
{
Properties
{
    _MainTexture ("Particle Texture (Alpha8)", 2D) = "white" {}
}

Category
{
    Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    Blend SrcAlpha One
    Cull Off Lighting Off ZWrite Off Fog {Color (0,0,0,0)}

    BindChannels
    {
        Bind "Color", color
        Bind "Vertex", vertex
        Bind "TexCoord", texcoord
    }

    SubShader
    {
        Pass
        {
            SetTexture [_MainTexture]
            {
                combine primary, texture * primary
            }
        }
    }
}
}

sentences:
Saving an interface instance into a Bundle All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle.  When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu (Another custom class) which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

sentences:
How can I more efficiently write my Math-Code in AS3 So this might be an odd question to ask. But I'm not really the biggest mathematician out there, and I have a weird habit of writing code. So I'm going to post what I'm working on. I'm doing a self-game jam this weekend which will be 48 hours long, and I've kind of cheated by already starting. The question is -- well what I'm trying to do is create a ease-in / bouncing effect without using a Tween library.

I feel that what I have is suffice, but I don't think it is very efficient and that I'm overcomplicating my code with clutter.

Below is code from my Engine class with comments that should help decipher what I am doing.

package {
    import flash.display.MovieClip;
    import flash.ui.Mouse;
    import flash.display.Stage;
    import flash.events.Event;

    public class Engine extends MovieClip {

        public var spaceShip:Ship = new Ship(stage);
        private var logo:IcarusLogo = new IcarusLogo();

        //Math, Velocities , Numbers
        private var vF : Number = 0.5; // Velocity Forward
        private var vX : Number = 0; // Velocity X
        private var vY : Number = 0; // Velocity Y
        private var iV : Number = 0.2; // Initial Velocity
        private var fV : Number = .90; //Friction
        private static var pI:Number = 3.14; // pI

        public function Engine() {
            initGraphics();
            runGame();
            Mouse.hide();
        }
        //INIT EVERYTHING
        private function initGraphics():void {
            initShip();
            initLogo();
        }
        private function initShip():void {
            spaceShip.x = stage.stageWidth/2;
            spaceShip.y = stage.stageHeight/2;
            stage.addChild(spaceShip);
        }
        private function initLogo():void {
            stage.addChild(logo);
            logo.x = stage.stageWidth - 1200;
            logo.y = 200;
        }
        //RUN THE GAME
        private function runLogoStyles():void {
            logo.x += vX;
            iV = .025;
            vX *= fV + iV;
            if (logo.x <= 450) {
                logo.x += vX;
                vX += fV + iV;
                iV = -.2;
            }
        }
        public function runGame():void {
            stage.addEventListener(Event.ENTER_FRAME, update);
        }
        public function update(e:Event):void {
            runGame();
            runLogoStyles();
        }
        //TRASH EVERYTHING THATS NOT NEEDED.
        //AS3 HAS NO NARC RULE SO JUST REMOVE.CHILD
        public function trashCan():void {
            //TrashCan is similar to init. Create Sub-Functions // and init everything in here.
        }
    }
}

Here's a screenshot to give a better understanding : http://f.cl.ly/items/3X3j0L052v0M2b0v2p1b/screen.png

sentences:
Construct 2's Scroll-to too small? I'm making a platformer that wants the screen to closely follow the player, and I know I need the Scroll TO behavior.

However, when I tried to make the screen move to the player, I get this:

As seen in the picture, the player's sprite is (I think) too small. Is there any way to increase the 'zoom-ness' of the Scroll-to behavior?

Below is the code's snippet:

Do you know what I have to do, or is there something wrong with my code?

Thanks in advance,

JamieK

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:
Wait until continuing inside a function with a coroutine in Unity I have a base class called Ability and then children classes for each ability like BasicMeleeStrike. I have a turn based game so the Do() method of each ability does it's logic sequentially. I'm trying to make coding a little nicer looking in each child ability class and I want to not have to yield out from in them but call base class functions that will do the operations over time but I want them to wait until they come back to the child class Do() function but what I have doesn't work. Is this possible?

class Ability{
   public virtual IEnumerator Do(Actor target){}
   protected IEnumerator JumpToTarget(Actor target){
      yield return StartCoroutine(_JumpToTarget(target);
   }
   private IEnumerator _JumpToTarget(Actor target){
      // inside here I tween to a location so it's yielding return null until it's done
   }
}

class BasicMeleeAttack : Ability{
   public override IEnumerator Do(Actor target){
      JumpToTarget(target);
      anim.Play("attack");
   }
}

No jumping happens but the attack animation plays. When I put a breakpoint on anim.Play() it's hit right away. Is there a way to make it stay inside JumpToTarget(target) until it's finished without having to do a yield inside BasicMeleeAttack's Do() function? I just think it's much friendlier to not have to code that for all my actions.

sentences:
Rendering a distant star field in Unity using a separate camera for near stars I'm currently working on a hobby project which is a universe simulator (exclusive to stars) built in unity3D. In order to deal with the raw scale of the universe I'm trying to implement two co-ordinate systems.

In my project I have two cameras; camera1 is the first co-ordinate system where all stars are loaded as high detail 3D objects. While camera2 is used for gathering a list of points within this "extended" frustum. I want to display these stars from camera2 on the farplane of camera1 in a lowdetail 2d manner.

I'm new to game development so this may be completely wrong; my plan was to generate a mesh from all the points in cameras2 frustum (this mesh now respresents my points in world space). I have a variable that represents the conversionFactor between the two co-ordinate systems. I will convert this mesh into projection view using the my conversionFactor in the translation component.

I will display this projection view on my camera1 farplane selling the illusion of far away stars? Please let me know the flaws in my deisgn! any help is much appreciated

sentences:
Unity game crashing when dialogue with NPC initiated I have 3 NPCs in my "Game". When the player walks up to any of them, they're supposed to have their own dialogue; I've tested this, and they do.

I tried to create a display that shows this dialogue text using a TextMeshProUGUI attached to a blank GameObject called dialogDisplay (tagged DialogDisplay). There is one DialogDisplay object in the scene that I'm trying to get each of my NPC's to use. I tried to make the display object inactive in the NPC Start() function, and enable it when it's time to display the NPC's next sentence.

When I run my game, I get an error on line 21, where SetActive() is called: "Object Reference Not Set to an Instance of an Object".

Here's the NPC script (DisplayNextSentence() is at the bottom, where dialogDisplay is used):

public class NPC : Character {
private bool charInRange;
public Dialogue dialogue;
public bool talkedTo = false;
private Queue<string> sentences;
public TextMeshProUGUI textPro;
public GameObject dialogDisplay;
private bool isTalking;

// Use this for initialization
void Start () {
    charInRange = false;
    textPro = FindObjectOfType<TextMeshProUGUI>();
    dialogDisplay = GameObject.FindGameObjectWithTag("DialogDisplay");
    dialogDisplay.SetActive(false);
}

// Update is called once per frame
void Update () {
    //if player is in range and presses space, triggers NPC dialogue
    if (charInRange && Input.GetKeyDown(KeyCode.Space))
    {
        TriggerDialogue();
    }
}

//if Player gameObject is in NPC collider, player is in range
void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.tag == "Player")
    {
        charInRange = true;
    }
}

//if player exits NPC collider, player is not in range
void OnTriggerExit2D(Collider2D other)
{
    if (other.gameObject.tag == "Player")
    {
        charInRange = false;
    }
}

//if NPC has been talked to before, displays next sentence; if not, loads dialogue and displays first sentence
private void TriggerDialogue()
{
    if (!talkedTo)
    {
        talkedTo = true;
        StartDialogue(dialogue);
    }
    else
    {
        DisplayNextSentence();
    }
}

//loads a queue with lines from Dialogue and displays first sentence
public void StartDialogue(Dialogue dialogue)
{
    sentences = new Queue<string>();

    foreach (string sentence in dialogue.sentences)
    {
        sentences.Enqueue(sentence);
    }

    DisplayNextSentence();
}

//displays next sentence in the queue
public void DisplayNextSentence()
{
    string sentence;
    bool done = false;

    //if last sentence in the queue, display it again
    if (sentences.Count == 1)
    {
        sentence = sentences.Peek();
        textPro.text = sentence;
        Debug.Log(sentence);
        return;
    }

    sentence = sentences.Dequeue();
    textPro.text = sentence;
    dialogDisplay.SetActive(true);
    while (!done) {
        Debug.Log("In WHile Looop");
        if (Input.GetKeyDown(KeyCode.A))
        {
            done = true;
        }
    }
    dialogDisplay.SetActive(false);
}
}

Grateful for any insight or tips you can provide. Happy to provide further information if it helps. Thank you!

sentences: Attempting to create LOD variations of unity prefab Hey guys I am attempting to make some LOD variants of my prefab and am getting a strange result. I am using unity fbx exporter and blender version 2.80.7. Here is the model before and after but even without altering the model two of the plants look completely flat on import. Is there some common cause for this or could this be just the model?

sentences:
Unity5x GetComponent().Play("sequence".StopAll) not working I'm working with Unity3D 5x using C#. I've attached collision detection to the character controller script that plays a "gothit" animation clip (using legacy animations).

Here are the code snippets, the first is for the collision:

void OnTriggerEnter (Collider other)
{
     if(other.gameObject.CompareTag ("dmgEnvironment")||other.gameObject.CompareTag ("dmgPlayerHit"))
    {
        GetComponent<Animation>().Play("gothit", PlayMode.StopAll);
        GetComponent<Animation>().wrapMode = WrapMode.Once;
        print("hit damage");
    }
}

The attack animation call:

public void AnimatePunch()
{
    DidAttack ();
    //play animation
    if (canHit && lastAttackTime < lastAttackButtonTime + attackTimeout) {
        SendMessage("DidAttack", SendMessageOptions.DontRequireReceiver);
    }
    GetComponent<Animation>().Play("punch", PlayMode.StopAll);
    GetComponent<Animation>().wrapMode = WrapMode.Once;
}

The problem I'm running into is that the "gothit" sequence won't play on collision but will do so when wired to the AnimatePunch().

I'm not sure why this is happening. Any help is greatly appreciated.

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:
When are HLSL literals taken as a float and integer? float2 uv = float2(fX % 1, fY % 1) * 1/16;

In the above example 1/16 is treated as a float, multiplying the float2 by 0.0625, but in:

float2 uv = float2(fX % 1, fY % 1) * 1/16 + float2(1/16,0);

The second 1/16 is taken as an integer and the second float2 becomes (0,0).

What's the order in which a specific type is used.  And is there any suffix to force a float?  I know 1.0/16.0 would work.

sentences:
When should you check collisions? Suppose a basic game with several circles drawn to screen. The user can select and drag any ball and move it around the screen. Should the selected ball overlap with any other ball on screen, the other ball should displace so they are no longer touching.

The example I've seen use the following structure:

for (every ball pair):
   if (collision = true){
   - resolve collision
  }

However, with this method, isn't there a risk that a displacement could cause an overlap in a pair already checked, and therefore the overlap printed to the screen?

Would it not be better to re-check every ball pair's collision, every time a ball is displaced, rather than every time-step?

Maybe something like:

for (every ball pair):
    if (collision = true){
      -resolve collision
         for (every ball pair):
            if (collision = true){
              - resolve collision
              }
       }

EDIT:

Even the method I've listed above shouldn't always provide 100% accurate results. The only way I can think this could work is with some sort of recursive function which only stops when there are no more collisions. Does that seem right?

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:
"CVar system" - are CVar always looked up or cached? Many famous game such as Quake or Half-Life use CVars to allow easy and flexible game parameter manipulations.

You can simply open up the console and write something like

sv_cheats 1

to enable cheat codes.

CVars are used intensively during the game - if they were set or retrieved by string name lookup there would certainly be a performance hit. Therefore, I'm assuming CVars are somehow cached.

How would this kind of system be implemented? I thought about storing pointers to the real values in a map having the CVar names, and then use the real values in the game.
Is this a viable approach? Do the AAA games have a better one?

Example:

struct Game
{
    std::map<std::string, int*> cVars;
    int volume, sensitivity; // Example game parameters

    Game()
    {
        cVars.emplace("volume", &volume);
        cVars.emplace("sensitivity", &sensitivity);
    }

    void setCVar(std::string mName, int mValue)
    {
        *cVars[mName] = mValue;
    }
};

sentences:
Dynamic navigation mesh changes I'm currently trying to convert from grids to navigation meshes for pathfinding, since grids are either too coarse for accurate navigation, or too fine to be useful for object tracking.

While my map is fairly static, and the navigation mesh could be created in advance, this is somewhat of a tower defense game, where objects can be placed to block paths, so I need a way to recalculate portions of the navigation mesh to allow pathing around them.

Is there any existing documentation on good ways to do this? I'm still very new to navigation meshes, so the prospect of modifying them to cut or fill holes sounds daunting.

EDIT:
To be clear, I'm looking for solutions that use a polygon navigation mesh, not a grid. I currently use grids, but I'm trying to move away from using them. It is the efficient dynamic modification of that polygon mesh that I'm trying to figure out.

sentences:
How can I check for Shader Model 3 support? Currently I am working on a 3D visualization app. A requirement of my app is that host's graphics card supports Shader Model 3. How can I check for Shader Model 3 support?

I know that these versions are supposed to support these models:

DirectX 8.0 - Shader Model 1.0 & 1.1
DirectX 8.0a - Shader Model 1.3
DirectX 8.1 - Shader Model 1.4
DirectX 9.0 - Shader Model 2.0
DirectX 9.0a - Shader Model 2.0a
DirectX 9.0b - Shader Model 2.0b
DirectX 9.0c - Shader Model 3.0
DirectX 10.0* - Shader Model 4.0
DirectX 10.1* - Shader Model 4.1
DirectX 11.0* - Shader Model 5.0

But some graphic hardware doesn't support Shader Model 3.0 even with the proper DirectX version. So I want to determine it by checking the hardware not just the DirectX version.

sentences:
How to handle realtime random movement with client side prediction I'm building a realtime multiplayer game that runs the same 'physics' loop on client and server. I'm using a steering behavior 'wander' that is essential random movement. The client and server generate different Random numbers when running the wander algorithms.

I'm wondering how I can keep a naturally random looking movement but use some constant that will insure the client and server come to the same conclusion.

sentences:
When constructing an orientation matrix, are the rows of the matrix the axis? When constructing an orientation matrix, are the rows of the matrix the axis?

The matrix is row-major and I'm multiplying vectors on the right (Mv).  So, the matrix looks like

r0c0 r0c1 r0c2
r1c0 r1c1 r1c2
r2c0 r2c1 r2c2

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:
Entity-System Architecture; Pools and Factories I'm creating a 2D game based on entity-system architecture using C++, the C++ port of Artemis, and SFML. I've had to jump through a few hoops, but it's been fairly smooth until now.

In this game, I have an EntityFactory class which basically just makes artemis::Entity objects, does some processing (such as creating sprites or setting the position of the entity) and returns that artemis::Entity. This is represented by a static class, something like this:

class EntityFactory {
public:
    //Creates the player, should only be called once
    static artemis::Entity CreatePlayer(artemis::World& world, sf::Vector2f pos);
    //Creates a bullet, can be called many times
    static artemis::Entity CreateBullet(artemis::World& world, sf::Vector2f pos);
    //Creates a static image
    static artemis::Entity CreateStatic(artemis::World& world, sf::Vector2f pos, std::string imgLoc);

    //Some more entities...
}

It's fairly essential that I call these functions to create the entities; the class does a lot of boilerplate stuff, like adding all the necessary components to the entity.

Lately, I've been thinking about implementing a particle system in the game as well. In addition, I'd like to be able to reuse my bullet entities instead of creating &  destroying them all the time. To this end, I figured I'd create a Pool class that holds entities, and disables/enables entities as needed - a common pattern. Here's the basic layout that I was thinking of:

class Pool {
public:
    //Enables/returns a disabled entity, or creates a new
    // one and returns it if there are none available.
    artemis::Entity& get(/*Some data about the object*/);
    //Disables an entity, and marks it as reusable.
    void disable(artemis::Entity&);
private:
    //Data structures for holding the active/disabled entities...
    Function_of_some_sort createEntity;
}

Alright, that's all well and good, except for the one sore spot - that ambiguous Function_of_some_sort. I'd like to let the Pool create its own Entity objects in  Pool::get() . Obviously, I want to use the EntityFactory, since it does a bunch of work; however, to do so, I'd need to be able give the Pool a function with an arbitrary number of arguments and be able to pass Pool::get() the same number of arguments.

As I see it, I have these options:

Limit my functions to a single signature and use a function pointer, eliminating possibilities like EntitySystem::CreateStatic (above).
Implement arbitrary, generic callbacks as described here, sacrificing some typesafety.
Give up the idea of an arbitrary-entity Pool, and make a Pool class for each entity I need. Might be ok, since I don't really have that many classes that need a Pool, but I'm only changing a single function call in each Pool class...
Refactor EntityFactory somehow so that I don't need function callbacks. Probably the best solution, but I haven't been able to come up with a good way to do it.

I feel like there has to be some elegant way of pulling this off, as these are two fairly common patterns that I'm sure have been used in conjunction before. I'm stuck in analysis paralysis; does anyone have examples or experience to offer on the subject, or just some suggestions?

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:
Checking distant 2D objects from the player in pure javascript I'm checking if the objects are too far from the player to be able to disable some things, I'm doing so:

const obj1 = {
     x: 0,
     y: 0
};

const player = {
   x: 0,
   y: 0
};

const sqrMagnitude = (x, y) => {
    return (x * x + y * y);
};

const isAwayFromPlayer = (entity, targetEntity, distanceMax) => {
    if(sqrMagnitude((targetEntity.x - entity.x), (targetEntity.y -
entity.y)) > distanceMax * distanceMax){
        console.log("yes!");
    }else{
        console.log("no!");
    }
};

awayFromPlayer(obj1, player, 250);

but when walking with the player, sometimes I approach the objects and I get the console.log("yes!"), sometimes I move away and also I get, but it was only to work if I were away from them, I'm forgetting to do some conversion to absolute value with Math.abs for example? I remember that this is how it was when I needed some time ago, but something is not working properly.

sentences:
OpenGL generate hills looking vertices I want to generate a terrain which looks like hills. Some sort of sine waves. Should be as simple as possible. But I can not figure out how. I get very scary results, which are nothing worth. I need to have vertices, normals and the indices of the vertices.

for(int i=0; i < size; i++) {
for(int j=0;j < size; j++) {
verticesList.add((float) j);
verticesList.add((float)Math.sin(j) * 1.5f);
verticesList.add((float) i);

normalsList.add((float) j);
normalsList.add((float)Math.sin(j) * 1.5f);
normalsList.add((float) i);

indicesList.add((byte)(i+j));

verticesList.add((float) j);
verticesList.add((float)Math.sin(j) * 1.5f);
verticesList.add((float) i+1);

normalsList.add((float) j);
normalsList.add((float)Math.sin(j) * 1.5f);
normalsList.add((float) i+1);

indicesList.add((byte)(i+j + 1));
}
}

I know that this is not the way how normals a "calculated".

P.S.: I need something like this:

edit:

How do I compute the normals?

sentences:
How can I integrate someone well into my project? I am working alone, since over one year on a decent sized project... to speed up things i wanted to incorporate some friends into development, unfortunately i never  did something like this before and so i dont know where to start.

What is important to work as a team ? What should he know, see and understand ? And what shouldnt he be aware of ? And most important, how would you integrate someone into your project ?

sentences:
how to reference a variable in an anothere script i have a object which sets pickedup = true on collision
public class IDCARD : MonoBehaviour
    {
    private bool pickedup = false;

    // Start is called before the first frame update
    void Start()
    {

    }

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

    }

    private void OnCollisionEnter(Collision collision)
    {
       print("k");
        pickedup = true;
        Destroy(gameObject);
    }
}

now i want exit script in an another object to check if pickedup == true on collison
now what can i do pls  give a brief explanation  with a names i have given
i have written your code. but i think there is some issues

sentences:
Real Time Cloud Algorithm I want to know how the algorithm works in this game:
http://www.gametrailers.com/user-movie/cloud-the-game/45068

Especially how the game generates the real time cloud, and be able to merge with other clouds dynamically.

I tried to google some info, but was unable to find the useful information.
Probably because I used to wrong keywords

sentences:
Looking for very simple implicit integration example I am trying to design a robust cloth system. I have no problem at all simulating things like that using forward integration such as euler, midpoint, runge-kutta, verlet, etc. However, I just can't wrap my head around implicit methods.

I don't understand how you formulate the equations in linear algebra terms.
I'd really like to see a VERY simple tutorial, and an actual example of how to construct the equations, and then solve for a very simple system (for example, 3 particles connected by 3 springs).

I looked into David Baraff's Large Steps in Cloth Simulation, and I can kind of follow it, but going from equations to code is a weak spot of mine.

I can use a package like eigen to solve, but I'd also really like to see some code for something like conjugate gradient descent. I don't care about efficiency at the moment, I just want to be able to clearly understand what's going on.

Thanks

sentences:
Cascade(Waterfalls) particles animation - openframeworks, alternatives Has anyone tried to create a waterfall particles animation using openframeworks? Is it possible? Is it good?

If not, can you recommend any other frameworks for easier creation of cascade animation?

Thanks a LOT!

sentences:
How to render a texture partly transparent? Good Morning StackOverflow, I'm having a bit of a problem right now as I can't seem to find a way to render part of a texture transparently with openGL.

Here is my setting : I have a quad, representing a wall, covered with this texture (converted to PNG for uploading purposes). Obviously, I want the wall to be opaque, except for the panes of glass. There is another plane behind the wall which is supposed to show a landscape. I want to see the landscape from behind the window. Each texture is a TGA with alpha channel.

The "landscape" is rendered first, then the wall. I thought it would be sufficient to achieve this effect but apparently it's not the case. The part of the window supposed to be transparent is black and the landscape only appears when I move past the wall.

I tried to fiddle with GLBlendFunc() after having enabled it but it doesn't seem to do the trick.

Am i forgetting an important step ?

Thank you :)

sentences:
DX11: Alpha blending not working with textured quads A bit novice on directx11.
I am rendering some textured quads out of PNG files (with alpha transparency) and get some inconsistency with my alpha blending. I have a background changing color constantly and you can see transparency is there , since in the transparent bits of the texture you can see the background colour below.

However , when it comes to having one texture on top of another it seems to skip the one below and use the background colour instead!

I can provide some code but I don't exactly know where to problem might sprawl from yet.

Any ideas?
Thanks!

sentences:
SMAPI add warp to existing map [Stardew Valley] I am trying to add a warp into the existing farm map using SMAPI.
I tried the following things but both didn't work.

Setting the Warp inside the map properties:

Map farm = Game1.getLocationFromName("Farm").Map;
farm.Properties.TryGetValue("Warp", out PropertyValue initialWarps);
farm.Properties.Remove("Warp");
farm.Properties.Add("Warp", initialWarps + "64 18 TestRoom 5 5");

Setting the Warp inside a Tile:

Game1.currentLocation.setTileProperty(64, 18, "Back", "Warp", "64 18 TestRoom 5 5");

I can confirm that the first approach works when you set the Warp property directly in the map file but it doesn't seem to work if you add it afterwards.

sentences:
Why is it possible to encounter a texture coordinate greater than 1 or less than 0 I'm studying a text about texture mapping and in the preparing to draw session, I read:

Define the texture wrapping parameters. This will control what happens when a texture
coordinate greater than 1.0 or less than 0.0 is encountered:

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,wrap);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,wrap);

where wrap is:
GL_REPEAT : specifies that this pattern will repeat (i.e., wrap-around) if transformed texture coordinates less than 0.0 or greater than 1.0 are encountered.

GL_CLAMP : specifies that the pattern will “stick” to the value at 0.0 or 1.0.

But there's no explanation what is the reason of encountering such texture coordinates?
For example suppose that I have just drawen a rectangle and I want to apply an image as a texture on it, is it possible to encounter such coordinates?

sentences:
What problem does double or triple buffering solve in modern games? I want to check if my understanding of the causes for using double (or triple) buffering is correct:

A monitor with 60Hz refresh's the monitor-display 60 times per second.
If the monitor refresh the monitor-display, he updates pixel for pixel and line for line.
The monitor requests the color values for the pixels from the video memory.

If I run now a game, then this game is constantly manipulating this video memory.

If this game don't use a buffer strategy (double buffering etc.) then the following problem can happen:

The monitor is now refreshing his monitor-display. At this moment the monitor had refreshed the first half monitor-display already. At the same time, the game had manipulated the video memory with new data. Now the monitor accesses for the second half monitor-display this new manipulated data from the video memory. The problems can be tearing or flickering.

Is my understanding of cases of using buffer strategy correct? Are there other reasons?

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:
How can I prevent pinching and jagged edges when deforming joints in 3ds Max? I've rigged and skinned a character, but no matter how or how much I blend the weights, it doesn't look good:

Why does the weight map look pixelated? I don't get it. I've never been able to get past this point when animating. I don't think it's a model resolution issue, since as you can see in the picture, the model is quite detailed.

How can I prevent the indicated problems?

Here are some reference images of my wireframe and weight maps:

EDIT

After recreating a model entirely to try and have another go at this, Ive found that my new model is repeating the previous outcome. Here are some images

enter image description here

sentences: How can I handle copyrighted music? I have a curious question regarding on musics used in music rhythm game. In Guitar Hero for example, they used all different music albums in one program. Then, each album requires to ask permission to the owner, composer of the music, or the copyright owner of the music. Let's say, if you used 15 albums for the music rhythm game, then you have to contact 15 copyright owners and it might be that, for the game developer, that the profit earned goes to the copyright owner or owner of this music. For the independent game developers, was it okay if either used the copyright music by just mentioning the name of the singer included in the credits and in the music select screen or use the non-popular/old music that about 50 years ago? And, does still earn money for the indie game developers by making free downloadable game?

sentences:
Character bouncing off ground due to gravity Implementing gravity in the game, the character keeps bouncing up and down slightly when he hits the ground, upon debugging the character is essentially bouncing on and off the ground. Not quite sure how to iron out the issue any help here would be greatly appreciated.

The constant value

private float gravity = 0.09f;

adding to the velocity if the character is on the ground

if (!isOnGround)
 velocity.Y += gravity;

adding the characters overall velocity to the overall position.

position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;

Part of the collision method which determines if the character is on the ground or not.

for (int y = topTile; y <= bottomTile; ++y)
            {
                for (int x = leftTile; x <= rightTile; ++x)
                {
                    // If this tile is collidable,
                    TileCollision collision = Level.GetCollision(x, y, tileMap);
                    if (collision != TileCollision.Passable)
                    {
                        // Determine collision depth (with direction) and magnitude.
                        Rectangle tileBounds = Level.GetBounds(x, y);
                        Vector2 depth = RectangleExtensions.GetIntersectionDepth(bounds, tileBounds);
                        float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

                        if (depth != Vector2.Zero)
                        {
                            float absDepthX = Math.Abs(depth.X);
                            float absDepthY = Math.Abs(depth.Y);

                            // Resolve the collision along the shallow axis.
                            if (absDepthY <= absDepthX || collision == TileCollision.Platform)
                            {
                                // If we crossed the top of a tile, we are on the ground.
                                if (previousBottom <= tileBounds.Top)
                                    isOnGround = true;

sentences:
How to create a 2D Polygon Sprite from prefab at runtime? At start of my 2D unity game I want to create a new "building" (at random).
So I created a prefab named "Building" from a polygon sprite. Then I created a "Empty Game Object" named "GameManager" with a script named "GameManager" attached to it. The script looks like this:
public class GameManager : MonoBehaviour
{
    public GameObject Building;
    // Start is called before the first frame update
    void Start()
    {
        var createdBuilding = Instantiate(Building, new Vector3(0, 0, 0), Quaternion.identity);
        var sprite = createdBuilding.GetComponent<SpriteRenderer>().sprite;
        Vector2[] geometry = new Vector2[6];
        geometry[0] = new Vector2(0,0);
        geometry[1] = new Vector2(0,20);
        geometry[2] = new Vector2(20,20);
        geometry[3] = new Vector2(27,20);
        geometry[4] = new Vector2(29,29);
        geometry[5] = new Vector2(16,0);
        sprite.OverrideGeometry(geometry, sprite.triangles);
    }
}

The hardcoded position values are just for testing purporses. The plan is to create multible buildings but first I have to get unity to show at least one of them.
Afterwards I attached the prefab "Building" to the variable "Building" via the inspector.
But when I ran the game the sprite is shown as a Pentagon, regardless what I write into the "geometry"-Array.
So why I cant change the geometry? And is this even the right way to create buildings at startup?

sentences:
How to animate alpha channel of sprite color using Animator in code in Unity3D? I tried Animator + AnimationClipPlayable, but failed. Sprite disappears completely after 1 second, without animation happening. If I set "1" instead of "0" for final point, then nothing happens.

Code:

    AnimationClip clip = new AnimationClip();
    AnimationClipPlayable playable = AnimationClipPlayable.Create(clip);

    gameObject.AddComponent<Animator>();

    AnimationCurve alpha = AnimationCurve.Linear(0, 255, 1, 0);
    clip.SetCurve("", typeof(SpriteRenderer), "m_Color.a", alpha);

    gameObject.GetComponent<Animator>().Play(playable);

sentences:
Easy way to edit vertex attributes I'm trying to edit large amounts of vertex attributes in my models for my game. The main attributes I really care about are strength (so wind can interact with them) and a couple of other things so the interaction with wind looks decent.

However, I'm not quite sure how do edit them easily. Of course I could manually write all of them, but that would be ridiculous. My first thought was to use a format in Blender that I could just export vertex colours and use the value as the attribute value.

Here's a picture for example (red = leaves, very windy, strength = 0.1; green = wood, strength = 0.7)

I don't really see any problems with this other than the fact I don't know of any formats, but I'm sure I can find some.

Is is there any way (or any program that can do this easier)? Or is the way of just colouring them the best way to go.

sentences:
Does a basic game engine prototyping tool exist, for common game types? There are a lot of classic game engines out there (Real Time Strategy, Turn Based, etc), of which you can find countless variations. All of them have a basic starting point which involves units, buildings that produce units, unit/building parameters like health, damage, etc, a map canvas. These can be simulated at a very basic level, no graphics, no animations.

I want to build a Tower Defense type of game, and it would be great if i could build a very basic prototype just to simulate parameters like health, damage, speed, range, etc.

Does such a tool exist?

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:
What do I need to know for writing code for both OpenGL and OpenGL ES 2.0 I am developing an engine that uses both OpenGL and OpenGL ES 2.0. I am well seasoned in OpenGL but not ES (although I am aware it is a subset of OpenGL). I could not find a set of differences that I should be aware of so that I can write code to take those differences into account and allow the engine to robustly handle the situation where a feature is not supported in OpenGL ES.

For example, the following forum post mentions a couple gotchas: http://forums.arm.com/index.php?/topic/13799-tips-tricks-opengl-vs-opengl-es/

A link to an exhaustive list would be nice.

sentences:
Android developer/publisher royalty sharing I am creating and Android game, and will need to partner with a publisher. I am curious about how this is typically implemented. Probably publishers are going to have a difficult time trusting some developer that they don't know to pay them, assuming the develop puts the game up on Google Play. So will the publisher want the apk file so that they can put it up on Google Play themselves?
Or does Google Play have a mechanism where the royalties can be automatically split between two parties from sales/IAP?
I know that all contracts will be different and it will depend, but I'm just looking to get a general idea of what is usual/typical.

sentences:
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:
Element's texture is null - Monogame/XNA, C# I have a ArgumentNullException everytime I try to call the Draw() method of my Projectile class in the Game1.Draw() method.

In Game1.cs Initialize() method:

//PROJECTILES INITIALIZATION
        lesProjectiles = new List<Projectile>(20);
        for (int i = 0; i < lesProjectiles.Capacity; i++)
        {
            lesProjectiles.Add(new Projectile(projectileSprite,
                new Vector2(playerPosition.X - 15.5f, playerPosition.Y - 20)));
        }

This is the Projectile class constructor:

public Projectile(Texture2D texture, Vector2 startPos)
    {
            this.projectileSprite = texture;
            this.projectilePosition = startPos;
    }

The -15.5f and -20 values are for placing the projectile at the middle of my spaceship. (Not optimized logic ikr.)

Apart from my whole game logic, let's say I wanna draw the first element of my array. I'm doing that:

In Game1.cs Draw(GameTime gameTime) method:

        spriteBatch.Begin();
        lesProjectiles[0].Draw(gameTime, spriteBatch);
        spriteBatch.End();

And there is the Draw() method from my Projectile class :

public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(this.projectileSprite, this.projectilePosition,
            Color.White);
    }

The returned error:
System.ArgumentNullException: Value cannot be null. Parameter name: texture

I don't understand why the projectileSprite values of my array elements are null, considering it's done in the initialization method whenever the constructor is called.

Thanks for further help, sorry if my explanations are bad

sentences:
Coroutine to move to position passing the movement speed? I'm using this coroutine to move my player to a new position. The problem is that it takes the duration as an argument instead of the speed of the object. Which makes it hard for me to make sure the object always moves at the same speed.

How can I create a coroutine that takes the source position, target position and movement speed to move my character?

This is my current code:

IEnumerator MoveObject(Vector3 source, Vector3 target, float duration)
{
    float startTime = Time.time;
    while(Time.time < startTime + duration)
    {
        player.transform.position = Vector3.Lerp(source, target, (Time.time - startTime) / overTime);
        yield return null;
    }
    player.transform.position = target;
}

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:
How to update game handle touch input faster I'm making a LibGDX game where the player needs to tap to jump. But in this game, the player has to tap extra fast because the player needs to jump extra fast.

The problem is, the program can't register the taps fast enough to keep up with the user.

I've tried to handle the input 3 times per frame, but that turned out to be very problematic.

public void handleInput(float dt){
        if(Gdx.input.justTouched()){
                player.jump();
        }
    }

@Override
    public void render(float delta) {
        handleInput(dt);
        handleInput(dt);
        handleInput(dt);

        //handle everything else down here

    }

Are there any other ways to handle input at the speed of the user?

sentences:
How are these bullets done? I really want to know how the bullets in Radiangames Inferno are done. The bullets seem like they are just billboard particles but I am curious about how their tails are implemented. They can curve so this means they are not just a billboard. Also, they appear continuous which implies that the tails are not made of a bunch of smaller particles (I think).

Can anyone shead some light on this for me?

sentences:
Applying velocity to parent that ignores children's mass not working I am making a VR data visualisation app in Unity and I have a parent with many children (just some primitive cubes) that I can toss around the scene by just setting the parent's rigidbody to the same velocity as my tracked VR controller.
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity(); // how I ref the controller velocity in SteamVR
rb.velocity = controllerVelocity * 2f; // the 2f is just to speed up the velocity

The above code works fine, but the problem is I think the scale of the children objects, which can be adjusted by the player, is affecting the velocity the parent moves at. Or maybe just when the children are very large...the controller velocity is comparatively too slow? Basically I need this to not be the case; I want the parent's rigidbody to move at roughly the same velocity no matter the children's scales/masses.
So to achieve that I thought to use Rigidbody.AddForce but it doesn't seem to be making any difference i.e. larger children are still moving slower. Here is what I have so far:
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity();
rb.AddForce(controllerVelocity  * 2f, ForceMode.VelocityChange);

I also tried ForceMode.Acceleration but then nothing moved at all? Am I using AddForce incorrectly? Or do I just need a scaling multiplier based on the size of the children? Any help is welcome.

sentences:
Saving Information in Byte[] sorry for the unhelpful title. I'm trying to understand how to convert information to bytes so that I can save it using Google's Saved Games feature that comes with Play Services, as explained here.

https://codelabs.developers.google.com/codelabs/playservices_unity/index.html?index=..%2F..%2Findex#9

I've mostly copy-pasted the code but it's not really working out for me.

However, my initial question is about bytes. So it looks like Google stores game information in bytes[] . The example only shows a single int being converted to byte and then being saved. What if I wanted to save multiple integers in Google's Saved Game services? I'm not exactly sure what this byte array is in the first place and how everything can be converted to bytes. If anybody has any good resources or examples, it would be much appreciated! Thank you

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:
Movement and rotation of bodies in top down game We are developing a 2D top down game with libgdx using the included box2d as physics engine.

We don't want our bodies to accelerate but to instantly move with the wanted velocity.
The bodies are moved like this, which works perfectly for our purpose:

Vector2 currentVelocity = body.getLinearVelocity();
Vector2 targetVelocity = velocity.velocityApplyVector.cpy();
targetVelocity.sub(currentVelocity);

targetVelocity.scl(body.getMass());

body.applyLinearImpulse(targetVelocity, body.getWorldCenter(), true);

The problem now is, that we also want the bodies to instantly rotate to the direction they are facing. The direction of the player is determined by the mouse position, so it is possible that the body is moving in another direction than it is facing. I tried to accomplish it like this:

float bodyAngle = body.getAngle() * MathUtils.radDeg;
float totalRotation = (inputRotation - bodyAngle) % 360;
if(Math.abs(totalRotation) > 1) {
    if ( totalRotation < -180) totalRotation += 360;
    if ( totalRotation >  180) totalRotation -= 360;
    float impulse = body.getInertia() * totalRotation;
    body.applyTorque(impulse, true);
}

This causes the body to rotate in the wanted direction but it needs multiple frames until it totally reaches the wanted angle.

The body mass is set to 70 and the angular damping to 8 (I tried some values for the damping and 8 was the best value for my cause, but that's, of course, not a final solution...).

I guess I have to somehow increase the needed impulse depending on the body mass and the angular damping (we want to be able to change it) but I can't figure out how to get the values right. I don't want to use setTransform since it totally destroys the physically correct behaviour of the bodies. How can I calculate the needed values? Is there any better way to solve my problem?

sentences:
Calculate normals given vertices and indices Can I calculate normals given vertices and indices? Can't figure out the code. Any help appreciated.

Edit: Could be it as simple as?:

function calculateVertexNormal(vertices:Array<Vector3>) {
        var vertNormal:Array<Vector3> = [];

        for(i in 0...vertices.length){
            var v0 = vertices[i];
            vertNormal.push(new Vector3(v0.x, v0.y, v0.z).normalized());
        }
        return vertNormal;
    }

Edit 2: Trying like this, with no luck

function calculateVertexNormal(vertices:Array<Vector3>) {
        var i = 0;

        while(i<indices.length){
            var A = vertices[indices[i]];
            var B = vertices[indices[i+1]];
            var C = vertices[indices[i+2]];

            var v1 = new Vec3().subvecs(A,B);
            var v2 = new Vec3().subvecs(A,C);
            var norm = new Vec3().crossvecs(v1, v2);

            normals.push(norm.x);
            normals.push(norm.y);
            normals.push(norm.z);

            i+=3;
        }
    }

sentences:
Implementing my own UI sprite class in Unity using shaders: where and how to position the sprites For learning purposes, I am trying to implement my own UI classes in Unity "from scratch", in the GPU using shaders. I mean, I am trying to use simple 2D sprites either positioned via shaders or created within the geometry shaders. These sprites should be, of course, displayed above all else.

I know how to create or translate the sprites within the shader. However, I am struggling with a couple of conceptual issues:

1) where exactly, relative to the camera (or to the near frustum plane), should the UI sprites be positioned? I man, thinking of the Z axis as being the camera.forward, what is the correct default distance to display the sprites at (assuming that at that location, the sprite texture would be the closes to its correct 100% zoom scale).

2) for the correct positioning+rotation, would it just be the case of, every frame, calculating in the shader such correct world position of the sprite in relation to the camera/near frustum plane, and then making the sprite rotate towards the camera? Or is there a better way of doing that, i.e. disregarding world position at all and going directly for the screen position of the sprites within the shaders, since the final step of shaders is to paint the pixels in screen-space?

Thanks for your suggestions!

sentences:
How to set a static size for an object in GameMaker? I have many sprites with different sizes, and I have an object in which I set those sprites, but this object gets resized by the currently displayed sprite.

How can I set a fixed size for the object so that it can no longer change size?

Thanks for any help.

sentences:
Warp GameObject Size When Entering/Leaving Area Below I have an image describing the desired functionality I am going for. Let's say you control a square and when you move this square into a given area, any part of your rigidbody/model inside of the area will be magnified upon entering and shrunk upon leaving. So now you more or less are made up of two rectangles, one small and one large.

What would be an elegant approach towards achieving this effect?

sentences: Difference Between LibGDX and LWGJL I've been looking into developing a small game with Java, as I am fairly familiar with it and see game development as good opportunity to improve my knowledge. When I research different libraries and other such things, the two resources I have often seen are LibGDX and LWJGL. I am however still unsure of the differences between the two. Would someone be able to explain where the differences lie and what each's strength is.

sentences:
How do I scale a texture within the inside of a PolygonRegion? I have a Box2D body which plays the role of the ground, and PolygonRegion, to give the body a texture. I want to texture repeat inside the PolygonRegion, to fill the whole body with a small image. However, there is a problem: the texture which I use stretches up, inside the PolygonRegion. Maybe it happens because the texture greater than the body.

How do I scale a texture within the inside of a PolygonRegion?

sentences:
XNA: Instancing Cubes, Each Side Different Texture I am trying to make thousands of instanced cubes, each with a unique texture on each side.

Am I going to have to split each cube into 6 instanced faces, or can I unwrap it in such a way the the texture atlas coordinates will come out right?

My idea is have each cube unwrapped into a 2 tile by 3 tile area as such:

Top     Bottom
Front   Back
Left    Right

Will the unwrap make it into the DrawInstancedPrimitives call?

Next, some cubes will have different textures than others. I was thinking about handling it with an atlas. One 2x3 texture in one slot, and another texture in another, forming a multi-texture image.

Am I on the right track here?

sentences:
Turning a 2D character to face left or right So far I know of the following ways to turn a 2D character to face the other direction (in my case the char can only walk left or right):

Mirror the right walk animation and use that as a separate state in the animation controller.
Simply set a 180 rotation on the game object that hold all of my characters parts when he turns the other way.
Create a transition animation by blending (I don't know if it's called exactly like this) the left oriented sprite and the right one.
Orient the sprite based on its movement direction using this code:

void OrientChar()
{
    Vector3 moveDirection = gameObject.transform.position - _origPos;
    if(moveDirection != Vector3.zero)
    {
        float angle = Mathf.Atan2(moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
        gameObject.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }
}

1 and 2 will create a rather abrupt change and might not look smooth. How do I make them or is it possible to make them smooth?

For number 3 I have a very basic idea on how to do it. Can I do it directly Unity?

sentences:
Procedural object generation and unique identification My question relates to procedural content generation and data management of the emerging objects in a database.

I assume a networked game, with a server-client model. Unspecified objects in the game world are generated while the game is running with procedural algorithms (for example perlin noise). The players (/clients) can modify the properties of these objects, but have to notify the server of these changes. How could this communication address unique objects, so that both the server and the client know of which object they are speaking?

Not only the inner properties of the objects can differ, but also visible, such as the position. When the player wants to select one of these objects the game has to find out the id - does anyone know which methods or algorithms can accomplish that?

sentences:
How/whether to pool bullets for a shmup in Unity? I'm working on my first Unity project, which (maybe naively) I decided to make a shmup.

I've been doing a lot of reading about Unity, and about object pools, and about using components to control behaviors of game objects.

Right now my idea for how a bullet works is that each bullet should be a game object, with a component that controls how it moves, and another component that controls what happens when it collides with something it can damage. Depending on the enemy or player shooting the bullet, however, the way it moves or how it deals with collisions may be entirely different, which means that a bullet from enemy A may need one component to control motion, but a bullet from enemy B may need a different type of component. (And the same for damage-dealing.)

If I want to pool bullets, since a shmup tends to need a lot of bullets all the time, I'm not sure how to handle "resetting" the bullets when I'm done with them and grab them out of the pool to use the next time.

So my question is, what is the ideal way to design a bullet system for a shmup in Unity, from the point of view of an expert in Unity instead of my beginner perspective? Am I going about using components wrong? Should I have a completely different pool for each possible type of bullet (which may not be feasible since I want a good amount of variety in the game)? Should I just have one monolithic motion control component that has a ton of code and can control every imaginable type of motion a bullet could ever need (I hope not)? Should I just forget about pooling and use Instantiate and Destroy? Is there a good way to reset what components are attached to a GameObject to the state of its prefab when I'm done with it?

I'm afraid my beginner-ness to this ecosystem makes it hard to even know what the right question is.

sentences:
Why "polar angle" should be restricted to the range of [0,PI] when moving camera? In the sample code d3d12book-master\Chapter 6 Drawing in Direct3D\Box\BoxApp.cpp of "Introduction to 3D Game Programming with DirectX12 : Frank D. Luna", the camera position is modified via three variables mTheta for the azimuthal angle, mPhi for the polar angle, and mRadius, in the mouse move event handler.

As shown in the code, there is not any restriction to mTheta. However, mPhi is restricted to [0,PI]; if the restriction is commented out, the image changes suddenly at the boundaries of [0,PI]. Could you help to comment the reasoning behind such restriction ? Is it possible to see a continuous rotation of camera across the boundaries of [0,PI] ? O_O

initialized to certain values in world space in constructor

    XMFLOAT4X4 mWorld = MathHelper::Identity4x4();
    XMFLOAT4X4 mView = MathHelper::Identity4x4();
    XMFLOAT4X4 mProj = MathHelper::Identity4x4();

    float mTheta = 1.5f*XM_PI;
    float mPhi = XM_PIDIV4;
    float mRadius = 5.0f;

modified in mouse move

void BoxApp::OnMouseMove(WPARAM btnState, int x, int y)
{
    if((btnState & MK_LBUTTON) != 0)
    {
        // Make each pixel correspond to a quarter of a degree.
        float dx = XMConvertToRadians(0.25f*static_cast<float>(x - mLastMousePos.x));
        float dy = XMConvertToRadians(0.25f*static_cast<float>(y - mLastMousePos.y));

        // Update angles based on input to orbit camera around box.
        mTheta += dx;
        mPhi += dy;

        // Restrict the angle mPhi.
        mPhi = MathHelper::Clamp(mPhi, 0.1f, MathHelper::Pi - 0.1f);
    }

    mLastMousePos.x = x;
    mLastMousePos.y = y;
}

used to update camera postion

void BoxApp::Update(const GameTimer& gt)
{
    // Convert Spherical to Cartesian coordinates.
    float x = mRadius*sinf(mPhi)*cosf(mTheta);
    float z = mRadius*sinf(mPhi)*sinf(mTheta);
    float y = mRadius*cosf(mPhi);

    // Build the view matrix.
    XMVECTOR pos = XMVectorSet(x, y, z, 1.0f);
    XMVECTOR target = XMVectorZero();
    XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);

    XMMATRIX view = XMMatrixLookAtLH(pos, target, up);
    XMStoreFloat4x4(&mView, view);

    XMMATRIX world = XMLoadFloat4x4(&mWorld);
    XMMATRIX proj = XMLoadFloat4x4(&mProj);
    XMMATRIX worldViewProj = world*view*proj;

    // Update the constant buffer with the latest worldViewProj matrix.
    ObjectConstants objConstants;
    XMStoreFloat4x4(&objConstants.WorldViewProj, XMMatrixTranspose(worldViewProj));
    mObjectCB->CopyData(0, objConstants);
}

sentences:
How to write a custom shader in Unity 3D that lights up a specific pixel or group of pixel? I'm making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment.
The map would be entirely put in darkness at the beginning, but as the player shoots the environment, it would be rendered with its "real texture". So say I have a tree. First it is entirely black or greyish, but if I shoot somewhere, I would see some green.
To accomplish this, I'm using a raycast to get the impact point and so I can access any renderer of the point that the player is shooting on. I guess the next step would be to write a custom shader to light the exact pixel that is shot. Do you have any idea how I could write this shader or another way of doing this effect?

Regards

sentences:
GameObject with Audio File called with FindGameObjectWithTag returns "Object reference not set to an instance of an object" I'm puzzled with this error because in a different file (see below), I'm doing exact same process to an object to enable/disable and works fine. But this new object throws the error, the object has a Script calling an audio file.
Enabling manually the Object, and playing the game the audio is fine. I hit the check box to disable it and I get the error "Object reference ..."
This audio object is attached to another GameObject which is the character of the game.

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

    [RequireComponent(typeof(BoxCollider2D))]
    public class carController : MonoBehaviour {

        public float carSpeed;
        public float maxPos = 4.17f;

        Vector3 position;

        public ParticleHit pr;
        public AudioManager cr;
        public Blast cb;

                audioObj = GameObject.FindGameObjectWithTag("policeAuTag");
                audioObj.SetActive (true);
                cr.carSound.Play ();

What am I doing wrong.?
I have closed and reopened unity but nothing. I have changed the tag name but same error.

I have tried also "FindWithTag" and doesn't work.

What is causing the code to throw errors?

sentences:
What are the disadvantages of marking every edge as a seam when unwrapping a mesh? I'm a programmer who's trying to learn a little basic 3D modelling. I'm reasonably comfortable with basic geometry modelling, and can unwrap and texture simple models. But I have a question...

When it comes to unwrapping models, all the tutorials emphasise the need to mark as few seams as possible when unwrapping a mesh. My question is, why? I'm guessing this is super-obvious to people with modelling experience, but not to me (given that my texturing efforts mostly are constrained to the generation of AO or normal maps).

I’m guessing that it’s purely to do with preserving the model’s shape when it comes to editing the diffuse texture? Is that the only reason you don’t want to simply cut every edge and lay all faces out individually?

I realise I’m displaying my utter ignorance of the subject matter when asking this question, so apologies, but sometimes the super-obvious things are the hardest to find answers to .

sentences:
Are web browser games like Travian/Tribal Wars based on asynchronous responses? I'm coding in Python. Currently, with some group of people, we are making a decision about server-side language choice for our web-browser-based strategy game. I have some questions:

Are games like Travian based on asynchronous requests or it's all normal synchronous?
WSGI for Python web apps is synchronous. Does it mean only one request is processed in the moment? If I have 10000 requests, I must wait for each one?
For this type of game, requests based on RESTful or GET/POST methods are most suitable? No need of sockets (I hope so)?

sentences:
Move vehicle towards the cursor I am making a game similar to Asteroids. The ship always points toward the mouse cursor. I want to know how to move towards the mouse so if I press w I will drive towards the mouse and if I press s I will move away from the mouse. How can I do this? Here is my code so far:

public class player {

    public int x,y;
    private Image img;

    float xDistance;
    float yDistance;
    double rotationAngle;

    public player(int x,int y){
        this.x = x;
        this.y = y;
    }

    public void tick(){
         xDistance = Comp.mx - x;
         yDistance = Comp.my - y;
         rotationAngle = Math.toDegrees(Math.atan2(yDistance, xDistance));
         handleinput();
    }

    public void render(Graphics g){
        Graphics2D g2 = (Graphics2D) g;

        RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
        g2.setRenderingHints(rh);

        ImageIcon i2 = new ImageIcon("res/player.png");
        img = i2.getImage();

        AffineTransform at = AffineTransform.getTranslateInstance(x, y);
        at.rotate(Math.toRadians(rotationAngle) ,20,20);

        g2.drawImage(img, at, null);

    }

    public void handleinput(){
        if(Keys.isPressed(Keys.w)){

        }
    }

}

sentences:
How to prevent fish eye effect when using CCOrbitCamera in Cocos2D? Note: I'm using CocosSharp, a Xamarin C# version but the question is valid for all Cocos2D versions I presume. I'm also fine with answers in any Cocos2D dialect (there is no tag yet for CocosSharp here).

I'm trying to create a card flip animation using CCOrbitCamera. This works pretty well with the code below - unless the sprite ist not in the center of the screen.

var animateInFirstHalf = new CCOrbitCamera(animDurationSeconds, 1, 0, 0, 90f, 0, 0);

My idea is to flip the card 90 degrees, then exchange the texture, and flip further. At 90 degrees the only thing that's visible is a thin line if the sprite is centered. If it is out of the center, it looks something like this:

The picture is from a blog post where the issue was solved by faking the animation with skew and scale. However I wonder if it is possible to somehow run the animation as if the sprite was centered? Something like virtually translating it to the center.

sentences: setTint() on half image I'm developing a game where I need to paint half of a image when the user is either wrong or right. To paint the image, I'm using setTint() to paint the image the color I need, but it paints the whole image, is there any way I can paint only half, using setTint or another method?

sentences:
Displaying an image when ScrollPane item is highlighted I would like to have images displayed when an item in the list is highlighted as a form of a "preview" of the map that is selected. I'm not sure how i would implement this with clickListeners or things of that sort as I am new to libgdx and would like some assistance in making this happen. For example the transition between the images following:

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle;
import com.badlogic.gdx.scenes.scene2d.ui.List;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;

public class LevelSelect implements Screen {

private Stage stage;
private Table table;
private Label heading;
private BitmapFont white, black;
private TextureAtlas atlas;
private Skin skin;
private List<String> list;
private ScrollPane scrollPane;
private TextButton play, back;
private String[] items = new String[] { "UNDECIDED", "\"East Side!!! West Side!!!\"" };

@Override
public void show() {

    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/atlas.pack");
    skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), atlas);

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    list = new List<String>(skin);
    list.setItems(items);

    white = new BitmapFont(Gdx.files.internal("font/fd.fnt"), false);
    black = new BitmapFont(Gdx.files.internal("font/fd2.fnt"), false);
    LabelStyle headingStyle = new LabelStyle(black, Color.WHITE);
    heading = new Label("Level Select", headingStyle);
    heading.setFontScale(3);

    scrollPane = new ScrollPane(list, skin);

    play = new TextButton("PLAY", skin);
    back = new TextButton("BACK", skin);
    back.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y)
        {
            ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());
        }
    });

    //TEXTURES FOR MAP PREVIEW
    Texture kingdoms_0 = new Texture(Gdx.files.internal("image/mapPreview/kingdoms_0"));
    Image kingdoms_0_pic = new Image(kingdoms_0);
    Texture kingdoms_1 = new Texture(Gdx.files.internal("image/mapPreview/kingdoms_1"));
    Image kingdoms_1_pic = new Image(kingdoms_1);

    table.add(heading).center().colspan(3).row();
    table.add(scrollPane).expandY().left();
    table.add(kingdoms_0_pic).row();
    table.add(play);
    table.add(back);

    stage.addActor(table);
}

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

    stage.act(delta);
    stage.draw();

}

@Override
public void resize(int width, int height) {
    stage.getViewport().update(width, height, false);
    table.setFillParent(true);
}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {
    stage.dispose();
    atlas.dispose();
    skin.dispose();
}

}

Help is greatly appreciated!

sentences: How to make an Alert Dialog "Rate my game" for my game I wonder if anyone can help me on how to make an alert dialog which makes user rate the game from inside the game itself or taking the user to google play to rate. Please help. I'm using andengine.

sentences:
How Do I Play An Animation In Unity 5.3.4? I am confused on how to play an animation with the new unity version because the flag "Automatically Play Animation" is gone.  I cant have the animation connected to my GameObject because it plays right away.

using UnityEngine;
using System.Collections;

public class FPSCamera : MonoBehaviour {

    public float lookSensitivity = 5;
    private float xRotation;
    private float yRotation;
    private float currentRotationX;
    private AnimationClip walking;

    void Start() {
        // DONT KNOW HOW TO FIND AND START WALKING ANIMATION CLIP
    }
    void Update() {
        yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
        xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;
        xRotation = Mathf.Clamp(xRotation, -90, 90);
        transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
    }
}

sentences:
Can GMod/SFM models be converted to Unity GameObjects? Someone made a suite of GMod/SFM models available for free for people making games and videos in GMod and SFM. These are of type .dmx, .dx80.vtx, .dx90.vtx, .mdl, .phy, .sw.vtx, .vvd, .vmt, and .vtf. I don't use GMod or SFM, so I don't know what these are, thus making it hard for me to manually convert them. Is there any way to change these into files Unity can recognize and use?

I'd like to have an easy step from converting them, but I would also accept instructions on how to export them to generic mesh/skeleton/texture files, and then how to import and combine these in Unity.

sentences: Is there any way to detect cpu/battery temperature on Android 7.0+ platform in Unity? I tried WeTest but it's not working because my test device is Android 8.1. Also, I tried Emmagee however it's just working on Android 6.0 and below. Is there any other thing?

sentences:
Unity objects with flickering and noisy edges In our game which is still in early development we're (we, Unity rookies) facing this flickering issue occurring especially in edges which are very close to each other, but not limited to them. The problem worsens once the camera moves but in the idle state it's not also not working as expected.

Here is a video depicting the situation. Notice that once I disable the edge detection the problem improves some, but still persists.
https://youtu.be/EL28HORkbbU

Here are our Edge Detection settings

Here is our PP anti-aliasing settings (We also tried FXAA but it gives worse results)

The buildings are natively modeled with ProBuilder.
Unity version: 2018.2.14f1

Is there a way to solve this issue to obtain smoothness in such edge detection cases? Are we missing something? We want to keep that visual style in which edges are drawn in black.

sentences:
Networking SFML Berkley Sockets So I'm starting work on a multi-player space shooter. And I've run into some issues. As I type this, my system is currently:

//Main While Loop
Gather Input
Update Own Sprites Based on Input
Send Position Information to Server. [Owner,Obj#,Image,X,Y,Theta] (TCP)
Receive All Position Information for All Objects From Server
Update Game Screen.

Now I won't end up using this, it's for the initial networking testing phase. I'll probably end up using dead reckoning. However I have a couple questions:

1: I am using TCP for all my networking. However it jumps and skips if you drop any packets at all, so I'd like to switch to UDP and have a numbering mechanism to make sure all packets arrive. Is there a preferred Networking Schema for game communication?

2: For critical things like object hits with bullets Should I implement a second port for these important events, or just use the same UDP proto?

3: (Side Question) How should I regulate my framerate with the networked game? I don't want to have an unnecessary Sleep in each frame...

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:
Unity Nav Mesh instantiation Issue I've been working on a wave-based zombie game for the past few months and all of the systems have been working perfectly - until I upgraded to the latest version of Unity. Since then, spawning a zombie onto a nav mesh and then calling SetDesination is throwing the exception:

"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:SetDestination(Vector3)

The zombies are spawned a random spawn point and their destination set as so:

 GameObject go;
        for (int i = 0; i < SpawnAmount; i++)
        {
            Vector3 location = new Vector3(transform.position.x + i + UnityEngine.Random.Range(-1, 1), transform.position.y, transform.position.z + i + UnityEngine.Random.Range(-1, 1));
            go = Instantiate(enemyPrefab, location, spawnRotation) as GameObject;
            go.GetComponent<NavMeshAgent>().SetDestination(players[0].transform.position);
        }

It is the setdestination line that is causing me issues.

I have a static baked nav area. The player characters (who also use nav agent to move) can move across the nav area perfectly - it is only the zombies which seem to have trouble.

I have spent a long while tweaking settings here and there. Adjusting the location of the zombie and even having a zombie in the game before starting the game. However I can't seem to correct this exception - all while the player characters are moving perfectly.

Any ideas on what I could be missing or areas I should be looking?

EDIT The updated and working code:

GameObject go;
for (int i = 0; i < SpawnAmount; i++)
{
    Vector3 location = new Vector3(transform.position.x + i + UnityEngine.Random.Range(-1, 1), transform.position.y, transform.position.z + i + UnityEngine.Random.Range(-1, 1));
    go = Instantiate(enemyPrefab, location, spawnRotation) as GameObject;
    go.GetComponent<NavMeshAgent>().Warp(location);
    go.GetComponent<NavMeshAgent>().SetDestination(players[0].transform.position);
}

sentences:
Direct3D reducing DrawIndexed CPU usage I am trying to optimise some of my rendering to get is useable on lower end machines (in my case a 2GHz i5 laptop with a GT 520M).

A quick investigation showed that the GPU isnt actually getting to 100%, but both CPU cores are. While most of this is non-rendering stuff (which I can likely make faster), I was surprised to find the piece of code below is apparently using 10% (20% of a core).

void RenderStaticTerrain()
    SetShadersInputLayoutConstantsEtc();
    for region in regionsInView: //about 20
        region->SetVertexAndIndexBuffer()
        for texture in regoin->UsedTextures(): //around 100
            d3dContext->SetAsShaderResource(texture);
            d3dContext->DrawIndexed(...);

I used the Windows Performance Analyzer sample based profiling and that points at some AMD or Nvidia DLL's as being where the CPU spends its time, largely I believe within the DrawIndexed (found via QueryPerformanceCounter. The sampling results seemed to dump the dll time just in RenderStaticTerrain itself).

The textures, buffers, etc are all immutable usage so don't see anything obvious to consume CPU there like moving vertices about or anything like that.

Two idea I have which (both of which look like some work) is texture arrays and using a few very large textures containing the others. However I am not sure how viable either of those are, and if it would actually make any performance difference.

For texture arrays it seems I can have upto 2048 which is plenty. However I am not sure if the GPU is going happy with what seems to me like effectively random access via a vertex buffer field. The major problem  however is it appears all the textures need to have the same size, while most of mine are in the 32x32 to 128x128 range, with some even larger ones.

Another idea was to pack them into some really big textures, but this always seems to cause problems with mip-mapping and texture filtering, since even if I repeat each textures border pixel a few times, a few mip levels down and I have one pixel in the small texture being made from pixels of unrelated textures.

Not sure what other options there are. I am still not really sure why that loop uses much CPU at all.

The current code is only D3D11 targeting D3D11 hardware, but I do plan to support older hardware and OpenGL.

sentences:
What ways are there for making vector types available in scripting? I use Google V8 engine to embed Javascript into my game for scripting. As interface to my native code, I already registered some C++ functions to the scripting context.

In the native code, I make intense use of the C++ library GLM which adds vector types and geometry functions. The naming is in a style that may be known from shader code, for example vec3, uvec2, normalize(), length(), and much more.

Now I would like to make these types available in scripting. That would be useful because of both, the geometry functions and the vector types. Especially, I want to use the vector types as parameters in the C++ functions I mapped to the Javascript context. At the moment I'm using arrays like float[3] instead of the vectors like vec3.

So I am looking for possible ways to bring GLM functionality into Javascript. This is what I can think of.

Create the most important types by hand, either in a Javascript file or injected from C++ code using object templates. Unfortunately, I cannot do this for all of the many functions in GLM. But it would better than nothing.
There might already be a GLM port of Javascript, which I haven't found on the internet.
I could pick a different geometry library for use in Javascript. For bound C++ functions, I'd have to translate their types into GLM ones then.
What can you think of...

Maybe there is a cool way to all the functionality of GLM over to Javascript. Are there things like C++ to Javascript source code converters? Or automatically binding a whole C++ namespace to scripting? I don't think that is possible. But Javascript is such a dynamic language, there must be a way to make the GLM types available for it.

What ways are there for making the vector types, and preferably also the useful geometry helper functions, available in scripting?

sentences:
Best way to network the movement of 2D tanks? I'm working on a multiplayer Flash game with a Python server and I have a quick question regarding how I should send positional updates for tanks for other players.

Should I choose

Option A:

When the player presses the move key, send the new velocity to the server and let the server calculate the new position per tick?

or

Option B:

When the player presses the move key, send the new position to the server and calculate the velocity clientside?

Which is the best option, in your opinion? What is most common? What will have less issues?

Other suggestions are welcome, I don't really know what I'm doing here. ;)

sentences: In a team of 2 people (one front end, one scripting), is there any way I could write scripts without the use of Unity all together? So, I'm curious whether or not it would be possible to write scripts for a Unity game without using Unity itself, but using a third-party IDE, such as Visual Studio. My reason for this would be the following: I have a very low-end laptop, so I can not run Unity in any usable fashion. So I'm wondering if I could do the programming only part for the game without using Unity? By this, I mean writing the actual code and sending it over some online platform to be integrated with the Unity environment. And I know, this would not be productive at all.

sentences:
Make image follow path I made an animated main menu introducing my game. In the menu there is snow and fog to create a more alive feel to it. Now I want to add a hawk that randomly spawns and flies across the screen in the distance.

Any idea how I'd create a "path" for it to follow? The path would be a curved line or something for the hawk to follow to simulate realistic movement. I have no idea how to design this.

As a side note, I'm writing this game in Löve2D.

sentences:
3D: How how handle like 500 NPC I'm currently working on a 3D game. My game have like 10 NPC's and a really small world.
But if I want to have a larger world with lots of NPC's? I think it's not a good idea to update and check collision with NPC's that is far far away from the hero.

So any tip on how to handle things that are outside the hero's sight.

sentences: How do we add a spell in Skyrim with the Creation Kit that can spawn several variants of the same NPC? I am thinking of adding a spell that can summon a Nord, but I want it to have a random chance of spawning a female nord. I also want the NPC to appear in different armors, have different tattoos and different hairstyles. Is it possible to do this without using a script? What's the easiest way to achieve this?

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:
How to use SmoothDamp with speed? I have a moving platform which is being moved like this:
Vector2 currentPosition = rigidBody2d.position;
Vector2 movement = Vector2.MoveTowards(currentPosition, target, speed * Time.deltaTime);
rigidBody2d.MovePosition(movement);
velocity = (movement - currentPosition) / Time.deltaTime;

And I want to have the moving platform ease in and out of target speed when moving. Basically accelerate from starting position up to speed defined in speed parameter and then decelerate when near target position.
Someone told me to try using SmoothDamp instead of MoveTowards but I am a little perplexed with the behavior.
I've tried using it as follows:
Vector2 movement = Vector2.SmoothDamp(currentPosition, target, ref velocity, 0.1f, speed);

but no matter how much I modify the smoothTime the platform never goes near the set speed (5). It is mostly below 1 or around 1-1.1
What am I doing wrong here? How can I implement easing for my moving platform while still having it reach the set speed?

sentences:
Animating child objects via parent object animator in script I'm using unity 5

I'm trying to animate multiple child objects via a parent object. The animation worked in the animation view but would not work when I tried to preview the game. In the script I use the code:

ParentObject.GetComponent<Animator>().Play("intro");

to play the animation. A similar line of code worked when playing a singular object, not sure what's going wrong now, any sugestions?

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:
How would I make a bullet shoot from my player to my mouse. So far I've created an object called obj_mouse. And my plan is whenever the player left clicks, it spawns a bullet from him toward where ever the mouse is pointing. I've got the concept down, but I'm struggling getting it to work.

Extra bits of code I'm messing around with to try and get it to work:

    bullet=instance_create(x,y,obj_bullet)
with (bullet) {
move_towards_point(mouse_x,mouse_y,5)
image_angle=direction
}

point_direction(obj_mouse,obj_mouse,obj_mouse,obj_mouse)
image_angle=direction

(In the above code, I havent attempted to specify to the program that I want the bullet to go in the direction of obj_mouse, or rather, just the mouse. The above code works, and bullets do shoot, however the player must have the mouse on the players sprite for it to work.)

Thank you in advance for any advice given.

sentences:
Implementing an automatic navigation mesh generation for 2d top down map? I am currently in the middle of implementing an A* pathfinding for enemies. In order to implement the actual A* logic, I need a navigation mesh for my map.

I am working on a 2D top down rpg map. The world is static, meaning there is no requirement for dynamic runtime mesh generation. My world objects are freely placed (not snapped to grid), rotated and scaled, which means that using a grid based A* is going to be a little complicated.

For example, how would I know a grid tile contains a collidable object? Lets say that object is actually located on the tile next to this, but is rotated and scaled such that it is still blocking the way?

I could check for the middle pixel of the grid tile to see if it contains any of the nearby objects color data, but it still wouldn't be all that accurate and occasionally enemies could get stuck in between objects.

sentences:
Handling movement in an Entity Component System I'm working on a 2d RPG game in C# using an Entity-Component-System architecture, and I'm currently working on movement. Right now, I'm wondering how to organise the code so it looks a bit more.. pretty, or dignified, than it is. Currently, I have four components:

VelocityComponent - Contains the speed (velocity) of an Entity. The behaviour currently is that if an Entity does not contain a VelocityComponent, then we continue onto the next Entity, because we cannot move if we haven't a velocity.

TransformComponent - Contains the Width, Height, X and Y fields for the Entity. Basically, the position. Similar to VelocityComponent, if an Entity does not have a TransformComponent, then the GPSSystem just continues the next iteration, because we cannot move anywhere if we don't have a position.

MovementComponent - Contains a pair of co-ordinates for use as a destination position, and a boolean indicating if the Entity is currently moving.

MoveFromKeyboardComponent - Signals whether or not a key is pressed so that the Entity that this Component is attached to should move or not.

The update loop currently goes that the GPSSystem collects a list of all entities (by accessing the EntityManager. The EntityManager simply contains a key-value pairing of Guid to Entity of all active entities. All systems have access to it), then iterates over the whole lot.. It'd be better if I just posted the code;

    /// <summary>
    /// Update the GPS System.
    /// </summary>
    /// <param name="gameTime"></param>
    public override void Update(GameTime gameTime)
    {
        // Handle the movement.
        foreach (Entity entity in entityManager.GetEntities())
        {
            VelocityComponent velocity = (VelocityComponent)entity.GetComponent("Velocity");
            MovementComponent movement = (MovementComponent)entity.GetComponent("Movement");
            TransformComponent transform = (TransformComponent)entity.GetComponent("Transform");
            MovementFromKeyboardComponent movementFromKeyboard =
                (MovementFromKeyboardComponent)entity.GetComponent("MovementFromKeyboard");

            // can't do any movement manipulation without a transform (position) component.
            if (transform == null || velocity == null)
                continue;
        }

        base.Update(gameTime);
    }

However, I am unsure of how to proceed after this point. I just don't know how to manage the movement. I am aiming to have a movement style similar to Pokémon, where all Entities move one square (16 x 16) at a time and have smooth movement across those tiles, however the player can hold down a button and keep moving square after square, and when he releases that key, he stops moving (and snaps to the nearest tile if he is in the middle of two).

So, on to the question:
Am I going about this correctly? Have I got too many (or too few) components for movement? And lastly, how would I manage the fact that an Entity may have a MovementComponent and a MoveFromKeyboardComponent? I'm just confused I suppose.
I am not looking for the code for that, I am just wondering whether I am going about this correctly? This is my first whack at an entity component system, you see.

Best regards.

EDIT 1:
I should add I have now changed the structure of the System class, such that it now has a ComponentAdded and ComponentRemoved method; that is, we no longer iterate over every Entity in existence every Update(), instead we store the entities that have components we want to listen to in a data structure in the class. My question remains the same, though.

sentences: Unity - Best Random Movement Strategy? As of now, to get random movement of my enemies, I am adding a Rigidbody and a BoxCollider then "throwing" them (i.e. adding velocity) in a random direction for a random amount of time and making them choose a new direction if ever they get outside of their designated area. This does not seem to work that well all the time. Sometimes they manage to get themselves stuck inside obstacles which should be impossible. The more I add guys, the more it seems the physics can't keep up or something with the collisions. Is there a better method to random movement or is "throwing" them perfectly valid? Is my method expensive and terrible? I might have around 50 guys active at a time and perhaps a few hundred to a thousand static obstacles each with their own colliders.

sentences:
Why does the engine crash when I POST data to a server? I am working on communications between my game and a cloud database. I'm working on the authentication part but when I try to pass data to the server in a POST the engine crashes. If I pass in a simple string like "username" it does not crash and I get an error response from the server as expected. But when I try to pass in a JSON string the engine crashes. Here is my code:
OnAuthCookieResponse = cookieResponseDelegate;
TSharedRef<IHttpRequest> request = FHttpModule::Get().CreateRequest();
FString url = NewObject<UURLBuilder>()
     ->Host(BASE_URL)
     ->Path(SESSION)
     ->Build();

request->SetURL(url);
request->SetVerb("POST");
request->SetContentAsString("{\"username\":xxxxxxxx}");
request->OnProcessRequestComplete().BindUObject(this, &UAClass::ReceivedAuth);
request->ProcessRequest();

The stack trace points me to line 559 in CurlHttp.cpp. IsURLEncoded() returns false which causes the check() to fail.
check(!GetHeader("Content-Type").IsEmpty() || IsURLEncoded(RequestPayload));

However when the engine passes data here, IsURLEncoded() returns true and the check() passes. Here is a sample of some data from the engine that passes. You can see it is a JSON string.

Here is what my data looks like that causes the engine to crash

You can see they are both JSON strings but mine causes the check to fail. I have also tried to completely URL encode the JSON string and the check still fails.
So why does this fail for me but passes when used by the engine?

sentences:
Why do MMORPGs still use multiple servers? MMORPGs, some MOBAs like League of Legends or even StarCraft 2 usually force you to pick a server. Usually they are US, EU and SEA, in MMORPGs many per location. I can see that that was necessary a few years ago, but now with the advent of AWS and similar offerings that allow you to seamlessly scale your "server-power", why are there still separate servers?

My train of thought is like this (using Star Wars: The Old Republic as an example): - You are always on one planet, an isolated "instance" from other planets. - If there are too many people on one planet, SW:TOR creates a new instance of the world and puts players in there. - If you leave the world / switch instances you have a loading-screen

So why can't the game create an instance for this planet. This instance (and only this one) has your current data in its database and manages x players. As soon as x-50 players are on this instance, a new server will fire up and new people will spawn on that instance. The 50 spots are reserved for switching to your group, etc.

There could be an instance for all three major regions to keep the latency low, but it would allow you to still play with other players from i.e. SEA if you can live with a 140ms delay (which is still nothing imho).

Whenever you switch an instance or travel to another world, your current server gives all your data to the next server, making sure you don't need one big centralized database. You could still have one that gets updates periodically for analysis purposes.

When you log off or the servers loses connection, the data could then be transferred into a massive database that is optimized for storing the data. The instance servers can then be optimized for high throughput.

Is there any particular reason this will not work? Are there other problems I am missing?

sentences:
Optimise Gear-VR text rendering with Unity I have a problem with my text being always kind of broken, so there are just some parts of the text visible (parts of letters) and the text flickers a lot.

At the moment I have this text 2D-UI text inside a canvas. Are there some optimisation techniques to resolve this issue, or are these glasses just not made for such "fine" lines? And no, it's not extremely tiny text and this does not happen in such an extreme way, when I display the text as an imported image.

Sorry for the lack of images, but I don't know how to capture an image from the app since I can't open the Oculus menu.

Update:
I figured out, that at a particular font-size, the flickering decreases a lot. I will investigate further on that.

Update:
Actually there is a particular font size, which is fine and everything larger works fine too. So I think you have to deal with pretty large font-sizes to prevent the text from flickering.

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:
Unity Seamless Terrain I am programmatically generating terrain using unity's terrain object and assigning height maps to it via the terrainData, the problem is that there are seams even when using the GroupingId(which is used for auto connect).
I even tried creating a terrain object in the editor with neighbours, and modified their terrain data via script, seams still there.

I have also tried SetConnectivityDirty after applying terrainData.

Most people who have reported this seemed(lol) to have issues with their normals at the edges, I cant see that being the issue here, but if it is, how do i approach solving it given I am using unity terrains.

If there is no good answer I will have to resort to custom meshes and lose all the nice terrain tool functionality.

Edit: Here is how I'm setting heights.

var terrain = GameObject.Find("test").GetComponent<Terrain>();
var terrainData = terrain.terrainData;
var noiseMap = Tool_Generators.GenerateNoiseMap(chunkSize, seed, scale, octaves, persistance, lacunarity, 0f, 0f);
terrainData.SetHeights(0, 0, noiseMap);

Then the actual noise generation is just a 2D array of heights, i have been using a simplified version with only 1 pass for testing.

  public static float[,] GenerateNoiseMap(int chunkSize, int seed, float scale, int octaves, float persistance, float lacunarity, float offsetX, float offsetY)
  {
    float[,] noiseMap = new float[chunkSize, chunkSize];

    for (int y = 0; y < chunkSize; y++)
    {
        for (int x = 0; x < chunkSize; x++)
        {
            float noiseHeight = 0;

            float sampleX = (x + offsetX) / scale;
            float sampleY = (y + offsetY) / scale;

            noiseHeight = Mathf.PerlinNoise(sampleX, sampleY);
            noiseMap[y, x] = noiseHeight;
        }
    }

    return noiseMap;
  }

sentences:
Shaky Camera Effect 2D The camera in my game engine can be modified by following a rectangle properties, that can be scaled, moved and even rotated. I need this effect for the shaking of the screen when a zombie attacks a character.

How should I go about implementing this?

sentences:
How can I control two events at once? I am trying to make a doorway that is 2 tiles high.
I have created an item called, Door Key. But I want both event tiles To hide or remove when I use the Door Key. The problem is I have to create two events to cover the doorway but can only get 1 event to change. So is there a way to change 2 events at once?

sentences:
How can I duplicate this color/hue shifting effect in C#? I am looking for a way to duplicate this color shifting effect:

I don't think it matters but the starting frame would be this:

My instinct was that some type of hue shift is occurring in a way that causes it to loop back over. The problem arose when I saw that the source of this effect was taking any image of any color palette and reducing it to this effect, always taking 14 frames to finish the loop.

Input frame:

Result of effect:

I'm not sure how this effect is being performed, I'm hoping someone will be able to help me duplicate it. This is for a game where I'm using C#. If I can get something working in C# I'll probably move it over to a shader. I'm using the MonoGame platform.

sentences:
Blender For Game Development, Pros And Cons Blender is one of those applications that you either love or hate. I know it is great for 3D modeling and and animations and there is a lot said about the UI and its steep learning curve.

I am more interested in how Blender stands out as far as Game Development goes. So my question is, what would be the Pros and Cons of choosing to use Blender to develop a high performance 3D game?

sentences:
How can I make a character Blink effect in Unity? I am making a game where I am making a health script where I have made a blueprint of what needs to be done. I'm trying a blinking effect after the character is hurt.

Can someone help me make a blink effect in Unity for JS?

sentences:
How Can I Make These Collisions Work Outside Of Unity's Built-In? (C#) I'm having some trouble working out what's wrong with my code. Basically I want to have my player be able to collide with obstacles it's flying through.

So I have an obstacle, and a pathway or two for the player to go through, if they don't make it into the pathway and hit the obstacle, they'll die, but if they do make it in, I need the floor and roof of the path to stop my player from going through it.

Here is what I've got so far (sorry for the copious amounts of code, I've tried to compress it down to the bare essentials for you but it's still a lot):

void OnTriggerEnter2D(Collider2D obstacles) {

    if (obstacles.gameObject.tag == "Obstacles") {
        playerInObstacle = true;
    }

    if (obstacles.gameObject.tag == "Path") {
        playerInPath = true;
        path = obstacles;
    }
}

void OnTriggerExit2D(Collider2D obstacles) {

    if (obstacles.gameObject.tag == "Obstacles") {
        playerInObstacle = false;
    }
    if (obstacles.gameObject.tag == "Path") {
        playerInPath = false;
    }
}

void Update() {

    playerY = transform.position.y;

    if (playerY > Y_Max) {
        aboveClouds = true;
    } else {
        aboveClouds = false;
        hasJumped = false;
    }

    if (aboveClouds == false) {

        if (Input.GetKey (KeyCode.UpArrow)) {

            ySpeed += horizontalSpeed * Time.deltaTime;
        }
    }

    //a bunch of other movement stuff is actually in this section, if you need that, let me know and I'll post it.

    if (timer >= jumpTime) {
        hasJumped = true;
        timer = 0;
    }

    if (aboveClouds == false) {
        hasJumped = false;
    }

    if (ySpeed > ySpeedLimit) {
        ySpeed = ySpeedLimit;
    } else if (ySpeed < -ySpeedLimit) {
        ySpeed = -ySpeedLimit;
    }

    transform.position += Vector3.up * ySpeed * Time.deltaTime;

    //floor collisions (this one works)

    if (playerY < Y_Min) {
        floorOn = true;
        ySpeed = noSpeed;
    } else {
        floorOn = false;
    }

    //path & obstacles collisions (this one doesn't work)

    if (playerInObstacle == true) {

        if (playerInPath == true) {

            if (playerY > path.bounds.max.y) {
                ySpeed = noSpeed;
            } else if (playerY < path.bounds.min.y) {
                ySpeed = noSpeed;
            }
        }
    }

    playerY = transform.position.y;

}

Also, I originally tried having the onTriggerEnter2D's as separate entities for both the obstacles tag and the path tag, but apparently you can't do that, so maybe I'm doing this part wrong too..

All help is greatly appreciated, thank you!

sentences:
3D rotation matrices deform object while rotating I'm writing a small 3D renderer (using an orthographic projection right now).

I've run into some trouble with my 3D rotation matrices. They seem to squeeze my 3D object (a box primitive) at certain angles.

Here's a live demo (only tested in Google Chrome):
http://dl.dropbox.com/u/109400107/3D/index.html

The box is viewed from the top along the Y axis and is rotating around the X and Z axis.

These are my 3 rotation matrices (Only rX and rZ are being used):

var rX = new Matrix([
        [1, 0, 0],
        [0, Math.cos(radiants), -Math.sin(radiants)],
        [0, Math.sin(radiants), Math.cos(radiants)]
    ]);

    var rY = new Matrix([
        [Math.cos(radiants), 0, Math.sin(radiants)],
        [0, 1, 0],
        [-Math.sin(radiants), 0, Math.cos(radiants)]
    ]);

    var rZ = new Matrix([
        [Math.cos(radiants), -Math.sin(radiants), 0],
        [Math.sin(radiants), Math.cos(radiants), 0],
        [0, 0, 1]
    ]);

Before projecting the verticies I multiply them by rZ and rX like so:

vert1.multiply(rZ);
vert1.multiply(rX);

vert2.multiply(rZ);
vert2.multiply(rX);

vert3.multiply(rZ);
vert3.multiply(rX);

The projection itself looks like this:

bX = (pos.x + (vert1.x*scale));
bY = (pos.y + (vert1.z*scale));

Where "pos.x" and "pos.y" is an offset for centering the box on the screen.

I just can't seem to find a solution to this and I'm still relativly new to working with Matricies.

You can view the source-code of the demo page if you want to see the whole thing.

sentences:
Unity Shader blending colors and color values above 1 I have source images where each pixel is one of exactly 4 colors:

red = (1,0,0)
green = (0,1,0)
blue = (0,0,1)
black = (0,0,0)

I'm trying to modify Unity's default sprite shader to use those colors (besides black) as a key to change to other colors. For example, any pixel that's red should become _RedColor. My first attempt was:

fixed4 _RedColor;
fixed4 _BlueColor;
fixed4 _GreenColor;

fixed4 frag(v2f IN) : SV_Target {
    fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;

    fixed4 modColor;
    modColor.rgb = _RedColor.rgb*step(1, c.r);
    modColor.rgb = _BlueColor.rgb*step(1, c.b);
    modColor.rgb = _GreenColor.rgb*step(1, c.g);

    modColor.rgb *= c.a;
    return modColor;
}

This worked. The problem was it was very jagged. In exporting the image and being compressed in Unity I think some pixels had multiple colors but the shader simply would set the color to the last matching color.

So I tried to modify it to not reset the color if the next color matches, but instead blend between any colors present in the pixel weighted by their contribution. Here was my second attempt:

fixed4 frag(v2f IN) : SV_Target {
    fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;

    float total = c.r + c.b + c.g;

    // we set the total to 1 if it's 0 so that we don't divide by zero when the color is black
    total += step(total, 0);

    c.rgb = _RedColor.rgb*c.r + _BlueColor.rgb*c.b + _GreenColor.rgb*c.g;
    c.rgb /= total;

    c.rgb *= a;
    return c;
}

This also worked and the jaggedness went away everywhere except the border of black and nonblack colors. So then I tried getting rid of the total and it was perfect:

fixed4 frag(v2f IN) : SV_Target {
    fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;

    c.rgb = _RedColor.rgb*c.r + _BlueColor.rgb*c.b + _GreenColor.rgb*c.g;

    c.rgb *= c.a;
    return c;
}

It's perfectly blended between any of the pixels. But I don't get why. I was dividing by the total so that the color values wouldn't go above 1 and it would blend between them. For example if a pixel had both red and blue present it would be adding the 50% of _RedColor's rgb value and 50% of the _BlueColor's rgb value. So when I didn't divide by the total it appears nothing changed besides blending between black and other colors.

This implies to me that I never had any pixels that actually had more than one nonzero color component to them (or else I could/would be getting white colors at those pixels). But if that's the case, why did switching from the first step function approach to a blend approach even do anything?

This is my first foray into shaders so it's entirely possible I'm doing something terribly, but I just want to wrap my head around what's going on and why. So I definitely appreciate any help/ideas.

sentences:
Can I use PARSE for creating turned based Game? I am working on creating a Turned - Based game similar to "Draw Something". I want to replace the Game Center feature with my own server using PARSE. Replace in terms of all game logic like Match making, Notifying Turns etc in PARSE Server. I have used PARSE to create app like similar to Instagram where user will have their account and they do stuff within. However I am wondering if I can put logic of match making in PARSE Server to get match for any of player. More of features of Game Center might needed to be build in PARSE Server.

Kindly let me know any suggestions if anyone has used PARSE as Game Server. Thanks in Advance.

sentences:
How can I generate a texture that looks like left-over tea leaves? We are working on a project for iPhone and Windows Phone 7 where we'd like to be able to generate tea leaves at the bottom of a cup. It doesn't have to look photo-realistic, and actually cartoon-y is ok.

What sort of techniques should we research to accomplish this? Are there any libraries (preferably in C, but we can translate) that would be helpful?

Here are some samples pulled from a Google Image search

sentences:
How can I detect if a gameObject has collided with two other specific objects at the same time? How can I detect if a gameObject has collided with two other specific objects AT THE SAME TIME?

This is what I intend to do but it does not work:

void OnCollisionEnter (Collision col)
{

if(col.gameObject.name == "object1" && "object2")
{
    Destroy(gameObject);
}
}

How can I correct this piece of code?

sentences:
Camera Touch Zoom and Pan with world - 2D I am doing my first unity2d game and im in need of a little optimization for my camera.

I have a camera which could pan and zoom with the speed i have defined. The problem with that is the speed i defined for panning will be too fast when zoomed in and soo slow when zoomed out. Maybe it could be achieved by having varying speed with zoom level. I dont want that.

Instead, i would like to have the camera used in Clash of Clans (i have seen it only in that).

The camera pans/zooms async with the world.
That is, at any zoom level, if we placed our finger on an object X and started moving, the object X will be right below our fingers all the way. That means the world moves relatively.

Its the same with the zooming.
If we placed two fingers on object X & on object Y and started 'zooming' in or out,
Those two objects will be there right below the fingers all the way.

That is what i would like.

For panning, i tried this and failed :
(Unity C#)

Touch t = Input.getTouch(0); //when touchcount = 1 only

Vector2 prev_touch_position = t.position - t.deltaPosition;

Vector3 resultant_unitvector = (prev_touch_position - t.position) / (prev_touch_position - t.position).magnitude;

float resultant_magnitude = Info.half_height / camera.orthographicSize * (prev_touch_position - t.position).magnitude;
//Info.half_height is calculated during change in orthographic size and is a static variable.

camera.transform.position += resultant_unitvector * resultant_magnitude;

The above code doesnt work as expected on debugging.

It would be a great help for the community if someone could solve this cuz that is some pretty good camera :)
(Include damping after touch release if you could ? :) )
Im just a student by the way :)

Thanks in advance :)

sentences:
SDL_Image and typical SDL BMP loading fails completely been messing with OpenGL and SDL for a pair of weeks.

The thing is quite weird. I have been loading a texture from a BMP and using a really easy shader to make it work, and so far it has worked very well.

Now, i've refractored my code and made a heightmap loader, with is pretty cool and works nice. I have a ResourceManager class which successfully loads shaders but fails at loading textures.

The structure of that class is simple:

Constructor (empty)
Destructor (empty)
AddTexture (const char* FileName, const char* indexName)
GetTexture (const char* indexName)
typedef map TextureMap
typedef TextureMap::iterator TextureIt
TextureMap Textures

I tried using SDL Load BMP function and SDL_img Load IMG function. The first one makes this weird result:

Close-Up

When the real image is a simple BMP in 32bit format, as always:

Real Texture

And the second method, using SDL_image, simply doesn't show the image.

The 'AddTexture' function:

bool TEXTURE::TextureManager::AddTexture(const char* fileName, const char* indexName)
{
    SDL_Surface* img = SDL_LoadBMP(fileName);
unsigned int id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img->w, img->h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, img->pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
SDL_FreeSurface(img);
Textures[indexName] = id;
return true;
}

And the 'AddTexture' SDL_image version:

GLuint id = 0;

SDL_Surface* Surface = IMG_Load(fileName);

glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);

int Mode = NULL;
if(Surface->format->BytesPerPixel == 4)
    Mode = GL_RGBA;
else
    Mode = GL_RGB;

glTexImage2D(GL_TEXTURE_2D, 0, Mode, Surface->w, Surface->h, 0, Mode, GL_UNSIGNED_BYTE, Surface->pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glBindTexture(GL_TEXTURE_2D, 0);

std::cout << "The ID of the tex is " << id << std::endl;

Textures[indexName] = id;

return true;

I create the texture here:

Res->TexManager->AddTextureAlt("res/sum.bmp", "Brick");

And the following code is used to bind the texture:

GLuint TEX = Res->TexManager->GetTexture("Brick");
glBindTexture(GL_TEXTURE_2D, TEX);

The normals and tex coords are alright, i've been using it all the time and it was displaying the tex and light perfectly well before.

I can't find the problem. I just can't. Is someone able to help a poor noob?

sentences:
Wrong texture position on camera move When in my game i move my character, the camera follows it. I have no problem drawing this char when it is moving or moving another char when the camera is still. Now, when i move both of them, the texture position of the second character is wrong, you can see it here:

Under the hood i round the values before moving the viewport and drawing textures, and i had no problems except in this case. How can i fix this?

sentences: What does the alpha channel on a back buffer do? I see that e.g. in OpenGL it is possible to create a back buffer with an alpha channel (RGBA8888). What's the effect/advantage over having an RGB888 back buffer?

sentences: jMonkeyEngine Pros and Cons I want to know some good reasons to use jMonkeyEngine for a Java 3d game development tool instead of just creating a game with LWJGL myself? I want to know a good reason I should choose this tool. Does anyone have a list of pros and cons for me to work with?

sentences:
Unity - Autoscroll when selecting buttons out of viewport I have a ScrollView element, that contains many buttons. I want that when I select buttons (via arrow keys), the panel scrolls so that the selected button is contained within the viewport.

How could I achieve this?

UPDATE

This is example of my structure (with 2 buttons only, but you get the gist...)

sentences:
Has anyone ever made a shader that produces something similar to pixel art? I find that pixel art is really pleasing to look at; it has this kind of crisp, satisfying perfection to it.

I've been following some beginner pixel art tutorials, when I got an idea: what if someone made a shader (in GLSL for example) that took 3D scenes and did the best possible job at making it look like it was drawn by a pixel artist? The concepts of anti-aliasing and shading should be relatively easy to perform. Constraining your colour palette would be very simple as well.

Of course, no computer program could outdo the manual work of a great pixel artist, but has anyone ever tried this before?

Is this idea at all possible?
Are there any games that use it?
Have there been (documented) failed attempts?

sentences:
Shaderlab and Cg API reference I am looking for definitive information on Shaderlab's API and the Cg language. The documentation I have found so far has been by way of example programs rather than a definition of APIs. Also, searching for a specific API term such as Sampler2D didn't turn up anything definitive.

What reference documentation is available or possibly documentation of precursors to Shaderlab and Cg?

sentences: Optimized rendering of a cube mesh world I want to render a cube-mesh (a.k.a. Minecraft-style) world. If I render each existing cube it will eat up FPS pretty quickly. How can I optimize it? I understand that the point is to not render invisible meshes (faces?) but my problem is to find out what is invisible and what isn't.

sentences:
How to code a 4x shader/filter which emulates arcade crt display behavior? I want to write a shader/filer probably in adobe Pixel Bender that will do the best job possible in emulating the fill of an oldskul monochromatic arcade CRT screen. Much like this here:

http://filthypants.blogspot.com/2012/07/customizing-cgwgs-crt-pixel-shader.html

Here are some attributes I know will exist in this filter:

It will take in a low res image 160 x 120 and return a medium res image 640 x 480.
It will add scanlines
It will blur the color channels to create that color bleeding effect
It will distort the shape of the image from a perfect rectangle into a rounder shape.

The question is, could you please provide any other attributes that are beneficial to emulating an arcade CRT feel and links and resources on coding these effects.

Thanks

sentences:
(UE4) Simulate physics breaks timeline animation I'm using timelines to animate my boat object, which does not have any limbs.  So all I need to accomplish is rotation and a little movement.

However, when the player dies, I need the boat to sink using simulate physics.
When I turn simulate physics on, the timelines stop animating the boat.

The nodes I'm using are GetActorTransform and SetActorRotation

sentences:
How to set LinearVelocity exactly in onSceneTouchEvent? I'm beginner in Android programming.
And i use AndEngine GLS2 with Body and AnimatedSprite.

I have a object ball and i want to move it to follow my hand. This is description for my idea:

And my code:

@Override
public boolean onSceneTouchEvent(final Scene pScene,
            final TouchEvent pSceneTouchEvent) {
     ballObject.getBodyball().setLinearVelocity(
                    new Vector2(pX, pY));
}

How to get exactly variables:pX, pY ?

sentences:
How to set the runtime of an animation based on attack speed? Based on an answer I received on this question:

How to make an action perform only after an animation has run?

I am using notifications in animations to perform certain commands/actions.

See in the documentation:

https://docs.unrealengine.com/en-US/Engine/Animation/Sequences/Notifies/index.html

Before resorting to this site, I researched elsewhere for something about modifying the animation speed and the closest question I found was this:

https://answers.unrealengine.com/questions/509654/how-do-you-change-the-ratespeed-of-animation.html

Simply changing the speed of the animation, I know how to do it, but I want to control its runtime. Sort of determining how much time the animation has to play.

In the image below I show more or less the scenario I have:

Note that the notification happens at the end of the animation (where I apply the damage).

So based on the speed I set for animation to perform, every time it's finished the notification happens, applying the damage.

It turns out that the animation doesn't necessarily have the exact duration of an attack starting when the other one ends (the image below will make it easier to understand):

There is one more scenario I imagined.

In the latter case, assuming the animation is (usually) 1 second long, and the character has the maximum attack speed (I set the maximum to 2 attacks per second). So the animation would be running 2 times faster:

But the attack speed will not always be a "simple" number, I would like to know how to calculate/set it time so I have no problems when the attack speed is any number.

I want to know how to set the animation runtime and a time interval between the animation running.

sentences:
create terrain with some vertical cliffs, natural arcades, caves using octree I am about to start creating the first terrain. I would like to create a terrain with vertical cliffs, natural arcades and caves.

For instance in one point the terrain might look like this.

I want to discuss about how to store this information about the terrain.

I think quadtree will not do the trick. From my understainding with quadtree perfectly vertical terrain is bound to be low quality in the vertical part, as you cannot subdivide it.

So I thounght that octree should be the right tool. But I have a conceptual problem with octree. I cannot understand how to store the triangle data in a octree structure.

Understanding how to store data in a quadtree is easy: you subdivide the region in a lot of squares and you give a coordinate value to each vertex of the squares, then you just connect all the verticies with triangles.

But what can you do when it comes to octtree? Which information should you store conceptually in the octree tree?

I cannot guess the logic and the algorithm that lays behind a octtree terrain.

Thank you

sentences:
How to get dynamic RigidBody rotation/tilt on uneven platform? I have a rigid body with PolygonCollider2D which has some complex circular shape and I'm using uneven platform.

Im using Following code to move the object forward

CharacterRigidBody.velocity = new Vector2 (speed, CharacterRigidBody.velocity.y);

Problem : The rigid body keeps on rotating when it moves forward.

I want the character to move without rotation on asymmetrical  platform(above).But i don't want to freeze rotation because i want the character to tilt when climbing or decending platform.

My RigidBody2D config(I'm using unity 5.1.2)

Can collider do anything with this problem?

sentences:
Point plotting with a line graph Please see attached screenshot.

Here's how it works.

A is a slider that goes up and down, and the red line uses the centre point of the A slider to draw its start point.

B is another slider, but this goes left and right (stops in the middle as shown below).

The current issue is, the red line should always rest on top of B like a see-saw. Currently the line's end point has a fixed x position so it is always in line with the green crosses below to the right. But I need to position the end Y point of the line correctly so that the line as a whole is resting on top of B at all times. Whether the user slides A or B.

My guess is I need to work out some form of distance calculation with angles. I have something along the lines of:

Called 60fps:

this.startPoint.x = this.verticalSliderModel.xPos;
this.startPoint.y = this.verticalSliderModel.yPos;
this.endPoint.x = 653;
this.endPoint.y = this.horizontalSliderModel.yPos;

var angle = Phaser.Math.angleBetween(this.startPoint.x, this.startPoint.y, this.endPoint.x, this.endPoint.y);

this.seeSawController.updateModel(this.startPoint, this.endPoint, angle, width);
this.seeSawController.updateView();

I then use html canvas to draw the line:

update(start:Point, end:Point, angle:number, width:number) {

    this.bmd.clear();
    this.bmd.ctx.beginPath();
    this.bmd.ctx.moveTo(start.x, start.y);
    this.bmd.ctx.lineTo(end.x, end.y);
    this.bmd.ctx.lineWidth = 4;
    this.bmd.ctx.stroke();
    this.bmd.ctx.closePath();
    this.bmd.render();
}

So yeah I want to calculate the green cross plot points moving forward.

sentences:
No files in .net.minecraft So, I've been trying to make a minecraft 1.11.2 client for minecraft. Thing is, the mcp/src/minecraft folder is empty, without any net files. The only error I had while decompiling was missing lwjgl 2.9.4, which does not exist. I have everything ready, but those files are missing, and thus I cannot code anything on my client(I am only using allowed mods.) This is a massive project I am taking for my favorite server, and I would like some help. Can anyone be kind and tell me how to fix this?

I have installed Optifine files for my client, and seems to have got about half of the files that I need.

What I need:

What I have:

As you can see, I am missing a lot of packages and have errors in most of them.

sentences: How can I copy/move a file from a folder to another with RGSS? I've been trying to do this but I can only find Ruby answers. I'm trying to move or copy a file from, say, Game Directory/Graphics/Pictures/file.png to Game Directory/file.png. How can I do this in RGSS?

sentences:
Storing a block world I've gotten a basic Minecraft clone working (thanks to gamedev.stackexchange's help! ^_^), but know I have no idea how to save the file.

Minecraft itself uses a naive list of block ids as far as I can tell, but there are three problems with this:

There appears to be a 4096 block limit.
My game uses strings to represent block ids, not integers.
Extra data for blocks, like washing machines holding their state and contents.

Of course, (b) can be easily solved with a map generated at runtime, but that sounds really dirty. And Minecraft's solution to (c), NBT data, looks really quirky too.

How would I avoid these three problems when saving a Minecraftian world?

sentences:
What is the workflow of modeling 3D rooms? I'm always struggling with creating flexible, reusable rooms for my underground-set games. When creating reusable rooms I have encountered the following problems:

Size - levels can have wildly different sizes and separate objects for all of the sizes seems repetitive and unnecessary
Holes in the room - i.e. windows, doors. There may be rooms with exactly the same size but different placement of doors, windows, etc... that only multiplies the amount of possible combinations

Possible solutions:

Not creating whole rooms but creating separate walls, floors, roofs so I can mix and match in the engine later?

Those parts would still require different sizes, unless I am to put 1 object per square meter or similar

Creating flexible Blender model so I can quickly change it export different variations of the room?

Thanks for any ideas, opinions, experiences

sentences: Managing a complex game storyline or quests system What kind of methods are best used managing complex story lines in a game? A simple story is basically linear line with stops, so that would not be that difficult, but a more complex one is basically an elaborate directed graph, with certain requirements to move between nodes. So how does one effectively store and maintain a complex game storyline that has multitude of paths and goals?

sentences:
How to predict future position of an object(bullet sync)? There is a multiplayer game and server sends to all clients a message when a shot happens, containing bullet position, bullet velocity and timestamp. By having timestamp, we can calculate the lag, let's say it's 100ms.

My game uses Box2D. How can I predict the real and current bullet position by having such data? I guess velocity might also change a little bit too.

sentences:
Can't enable script component on a prefab instance in Unity Prefab structure:

 MainObject (parent; prefab instance in the scene)
 |-Child
 |-Child
 |-Triggers
     |-Trigger1

MainObject has: ScriptIWantToEnable (Script) component (Disabled)

Trigger1 has: ScriptThatTriesToEnableIt (Script) component

Hello,

I'm trying to enable a script component on a prefab instance(MainObject) from a child object script component(Trigger1). For some reason though it doesn't get enabled. Run-time error shows up and the game breaks. Trigger works fine, up until the "enable" part. I checked it with the Debug.Log(). The MainObject is in the Hierarchy view already when the game starts.

Error:

  NullReferenceException: Object reference not set to an instance of an
  object ScriptThatTriesToEnableIt.Update () (at
  Assets/Scripts/ScriptThatTriesToEnableIt.cs:30)

Part of the code in ScriptThatTriesToEnableIt that tries to enable the ScriptIWantToEnable script component of MainObject:

 public class ScriptThatTriesToEnableIt : MonoBehaviour {
     public GameObject MainObjectRef; //MainObject prefab instance drag&dropped in the Inspector

     void Update() {
         // if triggered
         MainObjectRef.GetComponent<ScriptIWantToEnable>().enabled = true; //breaks here and throws the error
     }
 }

sentences:
Mip Maps on 2D Sprite causing black line above. Why is this? I am new to Unity. I'm trying it out and using Futile for a code-first approach, but still importing textures using the Unity system.

The problem I'm having is that when I use mip maps to scale large sprites down to smaller sizes without jagged edges, I'm getting a black line artefact above said sprites.

A little hard to see, but they're there. If I turn down the resolution, you can clearly see them:

These are my texture settings:

My question is, why are these black lines here? Is it a mistake I've made? Is it just a common side effect? How can I reduce these? Also, if this is the wrong approach, how can I use smooth sprites in a game with the ability for them to scale up smoothly?

Thanks!

sentences:
Unity inspector not showing variables of custom component that inherits from a built-in class I made a class AdvancedButton that inherits from the built-in class Button:
public class AdvancedButton : Button
{
    public bool advancedTest = false;
}

The Unity inspector only shows the variables of Button, but not the variable advancedTest. Is this normal or am I missing something?

sentences:
Vector Art Tool: Size, Position, Shapes, Symbols I'm looking for a vector art tool for gameart, similar to Flash, but preferably free. It just needs the following capabilities:

Create vector images (can scale up/down without losing quality)
Specify shape X/Y to the pixel (eg. set the X to 24.1, like in Flash)
Draw primitive shapes (square/circle/triangle) with border and colour (or gradient)
Specify shape width/height in precise pixels
Export to PNG

Flash can do all this, but it's expensive (and heavy to install). Is there a free alternative that I can use?

This is NOT for pixely, pixel-style art.

sentences:
XNA- Scale only parent I was wondering, is it possible to Scale(Vector3) a ModelBone without scaling its children. Lets say I got a Bone A at position 1,0,3. And one of its children Bone B is at position 1,0,5 (he is touching Bone A). Could I scale Bone A along Z axis without scaling Bone B, but keep Bone B position and rotation so that he is still touching Bone A.

Thanks in advance

sentences:
How to rotate an object to face another in Unity? I'm having an issue where I can't seem to rotate my bullet appropriately whenever I spawn one. I currently have a capsule prefab I am testing with. I spawn it with the following code.

        GameObject b = (GameObject)Instantiate(Resources.Load<GameObject>("Prefabs/Bullet"));

I am using the following code to try and orient the bullet so that it lays along the imaginary ray between it's spawn location and the centre of the target.

    void Start() {
    go = InputController.instance.hit.transform.gameObject;
    transform.position = new Vector3(transform.parent.position.x, transform.parent.position.y - 5, transform.parent.position.z);
}

void Update () {
    transform.LookAt(go.transform.position);
    Vector3 rotation = transform.eulerAngles; //THIS IS THE LINE I NEED TO ALTER
    transform.rotation = Quaternion.Euler(rotation);
    transform.position = Vector3.MoveTowards(transform.position, go.transform.position, SPEED * Time.deltaTime);
    Debug.DrawRay(transform.position, transform.forward * 10000000, Color.red); //DEBUGGING
    Debug.DrawRay(transform.position, transform.up * 1000000, Color.green); //DEBUGGING
}

Essentially the issue I am having is how I can calculate the rotation of the object based on the two I have available.

As you can see the line that I can't seem to calculate is the second line of the Update method, what it needs to do is orient the Vector3.up direction of the object to run along the Vector3 created by linking its position with the target location.

Interestingly the bullet is already laying horizontally but the LookAt method changes its rotation so I just need to fix it but I'm not sure on the math to do that.

sentences:
How can I display an image larger than the screen and allow the user to scroll to see more? I am new to development and trying to understand my options.  I have found no info or threads on this idea so I was hoping some of you folks could weigh in.

When developing for Android, I know that different images optimized for different screen densities and sizes are typically used.  I am wondering if anyone just flicks in the resizing and develops so that the smallest device (i.e. phone) shows enough of say a game world to make it relevant for the user and larger screens (i.e. tablet) just show more of that world but at the same scale.

I guess you would have to have a couple versions for different densities or graphics could appear too small, but it could really cut down on the number of asset files the user would have to download.  Though the whole background/world image would be one big file.  I assume when downloading an app graphics files for all screen sizes and resolutions are downloaded and then the app detects the screen size and chooses from among them for display.

sentences:
How to implement mutable functionality at runtime? I am making a game in which the player character can gain traits that change how their character behaves in my world model or add functionality to it. For example, the character might gain the "feather" trait that changes how fall damage is calculated or the "strong" trait that means the player can now pick up items that were previously just part of the scenery.

I have been hard coding traits in their relevant classes and switching a boolean to change behavior when they come into play, but it is getting rather unmanageable as my trait list grows.(I am also missing out on a lot of the emergence I was hoping to get) There must be a more scalable and decoupled way of doing this.

How would you code such a feature where code behavior changes or expands at runtime? If you are not inclined to do my work for me, which programming patterns would you use to achieve this kind of behavior?

sentences:
How does interpolation actually work to smooth out an object's movement? I've asked a few similar questions over the past 8 months or so with no real joy, so I am going make the question more general.

I have an Android game which is OpenGL ES 2.0. within it I have the following Game Loop:

My loop works on a fixed time step principle (dt = 1 / ticksPerSecond)

loops=0;

    while(System.currentTimeMillis() > nextGameTick && loops < maxFrameskip){

        updateLogic(dt);
        nextGameTick+=skipTicks;
        timeCorrection += (1000d/ticksPerSecond) % 1;
        nextGameTick+=timeCorrection;
        timeCorrection %=1;
        loops++;

    }

    render();

My intergration works like this:

sprite.posX+=sprite.xVel*dt;
sprite.posXDrawAt=sprite.posX*width;

Now, everything works pretty much as I would like. I can specify that I would like an object to move across a certain distance (screen width say) in 2.5 seconds and it will do just that.  Also because of the frame skipping that I allow in my game loop, I can do this on pretty much any device and it will always take 2.5 seconds.

Problem

However, the problem is that when a render frame skips, the graphic stutter.  It's extremely annoying.  If I remove the ability to skip frames, then everything is smooth as you like, but will run at different speeds on different devices.  So it's not an option.

I'm still not sure why the frame skips, but I would like to point out that this is Nothing to do with poor performance, I've taken the code right back to 1 tiny sprite and no logic (apart from the logic required to move the sprite) and I still get skipped frames.  And this is on a Google Nexus 10 tablet (and as mentioned above, I need frame skipping to keep the speed consistent across devices anyway).

So, the only other option I have is to use interpolation (or extrapolation), I've read every article there is out there but none have really helped me to understand how it works and all of my attempted implementations have failed.

Using one method I was able to get things moving smoothly but it was unworkable because it messed up my collision.  I can foresee the same issue with any similar method because the interpolation is passed to (and acted upon within) the rendering method - at render time.  So if Collision corrects position (character now standing right next to wall), then the renderer can alter it's position and draw it in the wall.

So I'm really confused.  People have said that you should never alter an object's position from within the rendering method, but all of the examples online show this.

So I'm asking for a push in the right direction, please do not link to the popular game loop articles (deWitters, Fix your timestep, etc) as I've read these multiple times.  I'm not asking anyone to write my code for me.  Just explain please in simple terms how Interpolation actually works with some examples.  I will then go and try to integrate any ideas into my code and will ask more specific questions if need-be further down the line. (I'm sure this is a problem many people struggle with).

edit

Some additional information - variables used in game loop.

private long nextGameTick = System.currentTimeMillis();
//loop counter
private int loops;
//Amount of frames that we will allow app to skip before logic is affected
private final int maxFrameskip = 5;
//Game updates per second
final int ticksPerSecond = 60;
//Amount of time each update should take
private final int skipTicks = (1000 / ticksPerSecond);
float dt = 1f/ticksPerSecond;
private double timeCorrection;

sentences:
Questions regarding games architecture with XNA So I've finally got around to playing around with XNA and have been toying around with making a 2D game (I have a bunch of art assets from a friend who developed it on iOS)

A lot of things seem to be easy to do and come out of the box however I'm left stumped for a bunch of stuff since most of the literature (the books I bought for instance) don't pay too much attention to 2D.

I'd really appreciate any clarification or being pointed to more information on the following questins:

What is the point of a Game Service?
I understand the whole idiom of registering an object as a service so that any other GameComponent can grab it, however how does this beat out simply making it perhaps public or static?
For instance, my book recommended registering the SpriteBatch object in the Game.cs class. I'm not sure how this is preferrable to simply making it public/static since there should only be one instance of Game anyways (singleton)?
I'm confused on when I should inherit from GameComponent or RenderableGameComponent.
I'm trying to follow a Manager/Controller design, such that all entities are created/owned by a single manager and the same for other things. I currently have each Manager/Controller inherit from GameComponent, however how does this beat out having the Game object own all the Managers and manually call update on them and draw ?
I noticed that Initialize is called before ContentLoad(), I found this annoying since in my Initialize is where I'd like to create some of my entities (i.e. Sprite, Player etc..), however I can't give them their loaded SpriteSheets or Textures since the call to load them hasn't occurred yet.
Am I perhaps initializing incorrectly or do people just assign the texture further down in ContentLoad?

Those seem to be my biggest "WTF" of not really understanding

sentences:
Actors with multiple Textures - class Hierarchy? In my 2D side-scroller game I have a bunch of actors being drawn, each of which has a single, non-animated Texture (a png image). These actors all inherit from a base GameActor class.

I want to add some more NPC's (e.g. tanks or cannons) that have one texture that doesn't move (the base) and another that rotates to shoot at things (the gun / barrel). How should I structure my Actor class hierarchy so as to allow for this? Should I refactor my base Actor class to allow for N textures? Or should I create a brand new sort of Actor for things that need > 1 texture (and then have to manage these actors separately from 'regular' actors)? Or is there a better approach I can't see?

Thus far I've been opting to keep things as simple as possible (KISS, right?), but am not sure how to proceed.

Any pointers greatly appreciated.

sentences:
How to rotate an image around its own center in AndEngine? I'm beginner in Android programming with Andengine framework. And my question:

How to rotate an image around its own center in AndEngine?

I use Body and AnimatedSprite.

Update

This is my code:

        final AnimatedSprite face;
        final Body body;
        face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face,
                BodyType.DynamicBody, FIXTURE_DEF);
        face.setUserData(body);
        face.animate(200);
        face.applyTorque(100);
        face.setUserData("monster");
        this.mScene.registerTouchArea(face);
        this.mScene.attachChild(face);
        this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face,
                body, true, true));

And here in the ContactListener when have a collision with other object.

private ContactListener createContactListener() {
        ContactListener contactListener = null;
        contactListener = new ContactListener() {
            @Override
            public void beginContact(Contact contact) {
                try {
                    Fixture x1 = null;
                    Fixture x2 = null;
                    x1 = contact.getFixtureA();
                    x2 = contact.getFixtureB();
                    if (x2.getBody().getUserData().equals("player")
                            && x1.getBody().getUserData().equals("monster")) {
                        x1.getBody().setFixedRotation(true);
                        hitsound.play();
                        mEngine.vibrate(100);
                        Log.i("CONTACT", "BETWEEN PLAYER AND MONSTER!");
                    }
                } catch (Exception e) {
                    Log.d("ErrorMessage", e.getMessage());
                }
            }
            @Override
            public void preSolve(Contact contact, Manifold oldManifold) {
            }
            @Override
            public void postSolve(Contact contact, ContactImpulse impulse) {
            }
            @Override
            public void endContact(Contact contact) {
            }
        };
        return contactListener;
    }

I have set  x1.getBody().setFixedRotation(true);. But position of this object isn't kept. What is wrong with my code?

sentences:
Unity: White outline around seams in my character, make it stop! so once upon a time I made a really cool character for my game project and he looked great. Then at some unspecific point in time, my character's UV seams got these awful white outlines around them:

I assumed the problem was that during some texture revision, I didn't paint past the island seams, so I compared the texture file with an image of the UV output, but in fact I did paint past the seams, so that isn't the problem. I have heard that this may have something to do with antialiasing, but I don't want to turn that off if I can fix the problem another way. Also, notice that the enemy character in the above gif does not suffer from the same problem.

What could be causing this? How can I fix it?

sentences:
How can I create an orthographic display that handles different screen dimensions? I'm trying to create an iPad/iPhone game using GLES2.0 that contains a 3D scene with a heads-up-display/GUI overlaid on the top. However, this problem would also apply if I were to port my game to a computer and run the game in a resizable window, or allow the user to change screen resolutions...

When trying to make the 2D GUI/HUD work I've made the assumption that all I'm really doing is drawing a load of 2D textured 'quads' on the screen and am trying to treat the orthographic projection as an old-style 2D display with 0,0 in the upper left and screenWidth,ScreenHeight in the lower right.

This causes me all sorts of confusion when I rotate my ipad into Landscape mode since I can't work out what to put into my projection and modelview matrices to turn everything around the right way. It also gets messy if I want to support the iPad's large screen, an iPhone or a Retina display since I have to then draw three sets of textures for everything and work out which ones to use.

Should I be trying to map the 2D OpenGL co-ords 1:1 with the screen? While typing out this question it occurs to me that I could keep my origin in the centre, still running -1/+1 along the axes. This would let me scale my 2D content appropriately on the different screen sizes, but wouldn't I end up with the textures being scaled and possibly losing quality?

I'm using OpenGLES 2.0 and have a matrix library that has equivalents to the GLES1.1 glOrthof() and glFrustrum() calls.

sentences:
How well (or badly) does Minecraft SMP scale? Has anyone tested and collected some data about how well does Minecraft SMP scale, with an increasing number of players (up to large amounts of players)?

I.e. the bottlenecks are:

mostly in the server or in the client or both
if the players are all in the same area, or if they are in different areas, or it is irrelevant where they are

sentences:
LibGDX moving game window with mouse drag TL;DR

How can I move window with mouse without tide effect.

Long Version

So when I tried to move my game window via InputListener(just to test if it would work). I got some strange result. The window goes back and forth between last two locations when mouse drags and while button is held.

Game Part

Gdx.input.setInputProcessor(new InputAdapter() {
    int b;
    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        b = button;
        // TODO Auto-generated method stub
        Rectangle.tmp.set(0, 0, 100, 100);
        if (Rectangle.tmp.contains(screenX, screenY)) {
            lastx = screenX;
            lasty = screenY;
            System.err.println("Touch ( " + screenX + " , " + screenY + " )");
        }

        return true;
    }

    @Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        if (lastx != null && tr != null) {
            tr.translate(screenX - lastx, screenY - lasty);
            System.err.println("Drag  ( " + lastx + " - " + screenX + " , " + lasty + " - " + screenY + " )");
            lastx = screenX;
            lasty = screenY;
        }
        return true;
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        lastx = null;
        lasty = null;
        System.err.println("Up ( " + lastx + " , " + lasty + " )");
        return true;
    }
});

DesktopLauncher Part

Game.tr = new Translator() {

    @Override
    public boolean translate(int x, int y) {
        Display.setLocation(Display.getX() + x, Display.getY() + y);
        return true;
    }
};

PS: What I try&tried to make may look stupid.

Edit: Actually I noticed that window moves less than actual mouse movement.
Edit2: When I move the movement code to touchUp I get exact result as movement.

sentences:
Unity Networked gaming 2019... What happened to NetworkBehaviour, OnServerStart() etc After a long break, I am now trying to learn some basics in networked gaming in Unity. I've installed the latest beta client (because I want to ultimately make a network multiplayer game but it will be many months of learning and building barebone prototypes to ensure I can get game objects spawning correctly and be controllable by the correct client etc etc

I have some experience in Unet, by extending the NetworkBehaviour class. I don't remember exactly but there were things such as [Client RPC] and [Command] and also OnServerStart() methods etc.

But I am aware Unet is being removed. And I tried to extend my class from NetworkBehaviour (I also tried NetworkBehavior lol) and it doesn't recognise it anymore.

So what replaces OnServerStart() method and [ClientRpc] instruction? Ideally I want to use a Dedicated Server solution (which I will run on my own computer in order to play small tests online of my game). The game im trying to make to start off with is extremely simple. The 'player' is just a capsule which can shoot small cubes and give damage to other players. Also the player object 'you' are controlling will appear blue, but all the other players will be grey.

Using Unet I was able to make the above small game idea work. But now I am unable to.

sentences:
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:
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:
Testing my game in the engine works fine, I export to HTML5 and try but all the tiles in tilemap have disappeared Here is a link to the live game:
https://44351-w21.github.io/one-screen-platformer-francescainfranca/
As the title says all the platforms in the tilemap do not appear when you run the game on the HTML5 export. I have no missing assets, and I made sure the filenames match where they are referenced. I have no idea why this is. Any help is much appreciated.
Error in the console:
**ERROR**: No loader found for resource: res://Assets/Platform/grassLeft.png.
put_char @ tmp_js_export.js:8
tmp_js_export.js:8    At: core/io/resource_loader.cpp:286:_load() - Method failed. Returning: RES()
put_char @ tmp_js_export.js:8
tmp_js_export.js:8 **WARNING**: Couldn't load external resource: res://Assets/Platform/grassLeft.png
put_char @ tmp_js_export.js:8
tmp_js_export.js:8    At: scene/resources/resource_format_text.cpp:175:_parse_ext_resource() - Couldn't load external resource: res://Assets/Platform/grassLeft.png

sentences:
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:
Unity UpdateExternalTexture from MovieTexture windows crash I'm trying to play a MovieTexture object with a SpriteRenderer object.
My code is working fine on OSX.

It crashes my windows 7 exported game, and play mode in Unity editor in windows 7.

I am sure the currentTexture.UpdateExternalTexture() call is making it crash, but I can't figure out why.

Can anybody explain why this is not working or how to debug it? The Unity log file didn't contain anything that seemed useful, just the message Crashed.

Here is what I am using

using UnityEngine;
using System.Collections;

public class FMAC_VideoPlayer : MonoBehaviour {

public string animationName = "escalator";

MovieTexture movieTexture;
Texture2D currentTexture;
SpriteRenderer spriteRenderer;
Sprite sprite;

void Start ()
{
    movieTexture = Resources.Load (animationName) as MovieTexture;

    currentTexture = new Texture2D(movieTexture.width, movieTexture.height);
    currentTexture.UpdateExternalTexture(movieTexture.GetNativeTexturePtr());

    spriteRenderer = GetComponent<SpriteRenderer> ();
    sprite = Sprite.Create (currentTexture, new Rect(Vector2.zero, new Vector2(movieTexture.width, movieTexture.height)), new Vector2(0.5f, 0.5f));
    spriteRenderer.sprite = sprite;

    movieTexture.Play();
}
}

Ideas?

Update

I have Debug.Log() ed the native texture pointer which prints the pointer address (ex. 556409680 ), so it does not seem to be NULL.

sentences:
How to reset RectTransform's position? So, I am trying to make a simple GUI Instantiate system. The GUI is going to spawn successfully, but the position is wrong.

Position : (Left, Right: 249.8423 ; Top, Bottom : 400)
Anchors : (Min: X:0 Y:0 ; Max: X:1 Y:1)
Pivots : (X:0.5 Y:0.5)
Rotation : (X:0 Y:0 Z:0)
Scale : (X:1 Y:1 Z:1) always...

My Code :

    GUIPausePopup pause = UI.Create<GUIPausePopup>(GameObject.Find("Canvas"));
    //Spawn and set parent(Canvas)
    pause.GetComponent<Transform>().gameObject.SetActive(true);
    //Working without any issues.

    //Position system not work. I don't know why.
    pause.GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, 0f, 0f);
    pause.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 0f);
    pause.GetComponent<RectTransform>().localPosition = new Vector3(0f, 0f, 0f);
    pause.GetComponent<RectTransform>().position = new Vector3(0f, 0f, 0f);
    pause.transform.position = new Vector3(0f, 0f, 0f);
    pause.transform.localPosition = new Vector3(0f, 0f, 0f);

Thanks for help...

sentences:
Show Sprites on Overlap (Shader Graph) [2D] I have a character sprite mesh and mesh renderer (The black wavy box). I am hoping to be able to overlay the black box onto the character covering the sprites but I am not sure how to do that.

I looked at this question : Unity: How do I only show parts of objects that overlap [2D]

But this works more as a cover that you can see through. I am hoping to have the variable black mask the sprites of the character but I cant seem to layer these correctly. Is there a way to do this using the LWRP and shader graph?

The over arching idea is to use this as a damage marker. Moving the black box up or down depending on the health lost.

sentences:
How detect collision between two bodies? I'm using LibGDX with Box2D and I've two bodies. I just need to know that they have collided.

So, I just need a boolean output.

Example:

if (bodyA.collision(bodyB) == true) {
   // Do something
}

How can I do this?

If it is too complicated, can I detect if two PolygonShape intersect?

sentences:
What's wrong with my planar reflection? At some angle my mirror with planar reflection shows this result. Looks like it mix with the sphere reflection capture.
How to fix it?

sentences:
Why won't my vertex buffer render in GLFW3? I have started to try to learn OpenGL, and I decided to use GLFW to assist in window creation. The problem is, since GLFW3 is so new, there are no tutorials on it or how to use it with modern OpenGL (3.3, specifically).

Using the GLFW3 tutorial found on the website, which uses older OpenGL rendering (glBegin(GL_TRIANGLES), glVertex3f(), and such), I can get a triangle to render to the screen. The problem is, using new OpenGL, I can't get the same triangle to render to the screen.

I am new to OpenGL, and GLFW3 is new to most people, so I may be completely missing something obvious, but here is my code:

static const GLuint g_vertex_buffer_data[] =
{
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f
};

int main(void)
{
    GLFWwindow* window;

    if(!glfwInit())
    {
        fprintf(stderr, "Failed to initialize GLFW.");
        return -1;
    }

    glfwWindowHint(GLFW_SAMPLES, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    window = glfwCreateWindow(800, 600, "Test Window", NULL, NULL);
    if(!window)
    {
        glfwTerminate();
        fprintf(stderr, "Failed to create a GLFW window");
        return -1;
    }
    glfwMakeContextCurrent(window);

    glewExperimental = GL_TRUE;
    GLenum err = glewInit();
    if(err != GLEW_OK)
    {
        glfwTerminate();
        fprintf(stderr, "Failed to initialize GLEW");
        fprintf(stderr, (char*)glewGetErrorString(err));
        return -1;
    }

    GLuint VertexArrayID;
    glGenVertexArrays(1, &VertexArrayID);
    glBindVertexArray(VertexArrayID);

    GLuint programID = LoadShaders("SimpleVertexShader.glsl", "SimpleFragmentShader.glsl");

    GLuint vertexBuffer;
    glGenBuffers(1, &vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

    while(!glfwWindowShouldClose(window))
    {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glUseProgram(programID);

        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);

        glDrawArrays(GL_TRIANGLES, 0, 3);

        glDisableVertexAttribArray(0);

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glDeleteBuffers(1, &vertexBuffer);
    glDeleteProgram(programID);

    glfwDestroyWindow(window);

    glfwTerminate();
    exit(EXIT_SUCCESS);
}

I know it is not my shaders, they are super simple and I've checked them against GLFW 2.7 so I know that they work. I'm assuming that I've missed something crucial to using the OpenGL context with GLFW3, so any help locating the problem would be greatly appreciated.

sentences:
How to modularly call a script based on parameters within the script? I am coding an interaction system in Unity that does things based on whether the player taps interaction, or holds interaction. Each object holds their own scripts of how a player can interact with them and what happens (e.g., they can physically lift an object, add an object to their inventory, open/close a door, etc)

What I want is for the interactable_object to call component scripts that have been added to it and categorized as tapInteraction or holdInteraction, but I also want the component scripts to be separated from how they're called (e.g., they might be called via tap or hold, it shouldn't matter).

If I use interfaces, the tapInteraction could check for GetComponent<ITap>() and the holdInteraction could check for GetComponent<IHold>(), but then wouldn't each action need separate scripts defined as Lift : ITap and Lift : IHold? I feel like there would be a lot of repetition.

I'm wondering if there is some better way to go about this.

EDIT:

Thank you very much for the input DMGregory and Alex F!

I ended up going with an interface approach similar to what Alex F answered, but with two key differences:

It was very important to me to have the actions as components on the gameobject since a specific action (e.g. Lift or AddToInventory) would have a large amount of customization from object to object.
I also wanted the interaction to return a status as to whether it succeeded or not.

As such I created a base class Interaction that implements the interface IInteraction with a bool TryInteraction method, and registers/deregisters itself to an interactable_object via OnEnable and OnDisable as the tapAction or holdAction depending on if that Interaction is set as a tapAction or holdAction.

InteractionLift and InteractionInventoryPickUp inherit that base Interaction class, they implement the TryInteraction interface, and depending on their parameters will register themselves to a interactable_object script as either the hold or tap action. Then the interactable_object fires the hold or tap TryInteraction accordingly.

sentences:
Using a custom map gui disables the ability to save I'm quite confused at the moment. I've created a custom gui (a fuel display on map) that works nicely, but somehow whenever I try to save the game when this gui is active....clicking on the slot where I want to save the game does not work!
thus when I add the following code and let it be called via a trigger (a common event which has a switch as trigger calls this javascript code...event runs parallel with a wait (5)):
REITD.SpaceClass.prototype.showCargoAndFuelStatusUI = function (vehicleType, currentCargo, maxCargo, currentFuel, maxFuel) {
    if (!(SceneManager._scene instanceof Scene_Menu)) {
        if ($gameSystem._REITD_definedWindows["CargoAndFuel"] !== undefined) {
            SceneManager._scene.removeChild($gameSystem._REITD_definedWindows["CargoAndFuel"]);
        }

        $gameSystem._REITD_definedWindows["CargoAndFuel"] = new Window_Base(new Rectangle(1, 1, 211, 200));
        SceneManager._scene.addChild($gameSystem._REITD_definedWindows["CargoAndFuel"]);

        $gameSystem._REITD_shownStatusUIWindows["CargoAndFuel"] = "shown";

        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText("Vehicle Fuel", 1, 5, 190, "center");
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 40, 200, 25, _Colors.gray);
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 40, 2 * this.calcFuelPercent(vehicleType), 25, _Colors.blue);  // 2 px per percent full.
        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText(
            padLeft(this.getCurrentFuel(vehicleType), 6, "0") + " / " + padLeft(this.getMaxFuel(vehicleType), 6, "0"), 30, 35, 100, "left");

        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText("Vehicle Cargo", 1, 75, 190, "center");
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 110, 200, 25, _Colors.gray);
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 110, 2 * this.calcCargoPercent(vehicleType), 25, _Colors.red);  // 2 px per percent full.
        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText(
            padLeft(this.getCurrentCargo(vehicleType), 6, "0") + " / " + padLeft(this.getMaxCargo(vehicleType), 6, "0"), 30, 105, 100, "left");
    }
}

update: Even when I call a method to deactivate the custom gui....saving is still not possible:
REITD.SpaceClass.prototype.hideStatusUI = function (uiType) {
    if (uiType in $gameSystem._REITD_shownStatusUIWindows && $gameSystem._REITD_shownStatusUIWindows[uiType] == "shown") {
        //  Status UI exists => hide it!
        SceneManager._scene.removeChild($gameSystem._REITD_definedWindows[uiType]);
        $gameSystem._REITD_shownStatusUIWindows[uiType] = "";
    }
}

Also what I noticed...deactivating just the adding to the scene is enough to eliminate the problem (but means no custom gui being active):   //SceneManager._scene.addChild($gameSystem._REITD_definedWindows["CargoAndFuel"]);  => no problem. Thus somehow this part starts the problem and I don't understand why
I'm running into the problem.
Now my question is:
Why is that so and what can I do to correct this problem (or can I somehow deactivate this while a menu is open?)
Engine: RPGMaker MZ

sentences:
How to save game progress (savefile) I am currently working on a terminal text game just to practice my skills (C). It will be story driven escape the mansion kind of game. Even though the game will be short I want it to support save files.

Since I am new to game programming I am not sure how should I handle save files. The game will be short yet players will be able to find a lot of objects. I was thinking about saving a structure into a .txt file OR saving lots of 1 and 0 into txt file. Where each line represents each item or progress.

Is there a better way or common way how to do it?

sentences: How to check battery usage of an iPhone/Android app? I think the title says Enough. For example Unity can generate you a report how much CPU/GPU power it's using or how fast it's going to drain device battery, but what about the applications developed using Cocos2d or the ones you develop directly using OpenGL? How should you profile them? In general what should you profile? or Should I simply run the application and wait for it's battery to run out?

sentences:
How can I rotate the two endpoints of a line around the line's center in 3d? The object is a capsule. I have the position of the object vector3, and the orientation of the object, a quaternion. I want to construct a line which goes through the middle of the capsule with the two endpoints of the line being the top and bottom.
The capsule can be rotated in all 3 dimensions.

sentences: How can I edit collisions in Unreal Engine? I made a concave house model. When I import it to Unreal Engine it generates a simple box collision that covers the full mesh. I need a collision that only covers the walls. How can I generate one or edit the collision? (I'm using Maya.)

sentences:
Box2D + Love2D (Lua) - Assertion fail with polygon meshes When I try to create a triangle collider for my game it sometimes leads to an assertion fail. I use the physics engine that comes with love2d (Box2D). That's the error message that appears when the assertion fails:

love: modules/physics/box2d/Source/Collision/Shapes/b2PolygonShape.cpp:85: b2Vec2 ComputeCentroid(const b2Vec2*, int32): Assertion `area > 1.19209289550781250000e-7F' failed.

Here's an example of a triangle that doesn't cause the error (represented by a table with 3 points): {{258,451},{740,767},{284,597}}

And this one leads to a crash: {{258,450},{222,569},{306,723}}

The bodies of both shapes lie at {0, 0} (upper-left corner of the screen)

Does anyone know a possible reason and/or solution for the problem?

Edit:
I'm not allowed to answer my question right now for some reason so I'll post the answer here before I've forgotten it:
In Box2D, the order of placement of vertices seems to play an important role, since I was able to avoid the crash with the "problematic" triangle in my example from my question just by placing the first vertex between the second and the third one.
Maybe I'll repost the answer when I'm able to provide more information (and am also allowed to do so)

sentences:
Wrong behavior when trying to move on air I´m using Andengine and jBox2D to implement a Mario-like platform videogame. Jumping and moving works fine. The problem comes in a very specific case:

I keep the "Move left" button pressed all the time
Player is on air and when moving left, it hits a wall and it stops moving left (while it keeps falling) This is correct.
When the player passes the wall, if the "Move left" button is pressed, it should start moving left while falling but it doesn't. If I lift my finger and press "Move left" again, it works.

The code to move left/right is:

_playerBody.setLinearVelocity(-mLinearVelocityX, _playerBody.getLinearVelocity().y);

The jump code is:

_playerBody.applyLinearImpulse(0, -mImpulseY, _playerBody.getPosition().x, // /////JUMP
            _playerBody.getPosition().y);

This is the code for the hud:

Sprite left = new Sprite(-10, CAMERA_HEIGHT - 150, mLeftTextureRegion) {
    @Override
        public boolean onAreaTouched(TouchEvent pEvent, float pX, float pY) {

            if (!pEvent.isActionOutside() && !isDead && !isPaused) {
                movePlayerLeft(player_self_sprite, player_self_body);
            }

            if (pEvent.isActionUp())  {
                if (isPlayerMoving) {
                    stopPlayer(player_self_sprite, player_self_body);
                    isPlayerMoving = false;
                }
            }
            return true;
        }
    };

sentences:
How to make and render a simple game just with 3d max? I want to make a simple EXE file, where there is one object in the scene and the user can rotate that object by using arrow keys (or mouse).
Is there any way in which I don't have to use a game engine and do it only using 3dsmax script?
Cause there is a special renderer I want to use, which is V-Ray a kind of renderer which provides 3D images for 3D glasses.
I am not good at making games and engines so I want to know if I can do it only with 3dsmax scripts?

sentences:
Candy crush saga popup-like messages I was wondering how could I make in Android something like the popup messages seen in Candy Crush Saga, those messages like "Delicious!", "Tasty!" or similar:

As well as the score of each movement, they will pop up at first and then vanish:

How could I implement something like that in Android?

sentences:
How do I use warble to package libgdx and ruby? My ruby code is as follows

include Java

Dir[File.expand_path "#{File.dirname(__FILE__)}/../libs/\*.jar"].each { |x| require x; puts "go"}

module LibGDX
        include_package "com.badlogic.gdx"
        include_package "com.badlogic.gdx.backends.lwjgl"
        include_package "com.badlogic.gdx.graphics"
end

class Game
        include LibGDX::ApplicationListener

        @LOG = Game.java.simple_name

        def create
                LibGDX::Gdx.app.log(@LOG, "Is a thing")
        end

        def resize width, height
                LibGDX::Gdx.app.log(@LOG, "Resizing game to #{width} by #{height}")
        end

        def render
                LibGDX::Gdx.gl.glClearColor(0, 0, 0, 0)
                LibGDX::Gdx.gl.glClear(LibGDX::GL20.GL_COLOR_BUFFER_BIT)
        end

        def pause
                LibGDX::Gdx.app.log(@LOG, "Pausing")
        end

        def resume
                LibGDX::Gdx.app.log(@LOG, "resuming")
        end

    def dispose
            LibGDX::Gdx.app.log(@LOG, "disposing")
    end
end

listener = Game.new

width = 800
height = 600

useOpenglES2 = false;

game = LibGDX::LwjglApplication.new(listener, "Game", width, height, useOpenglES2)

If I run this through jruby it works just fine but if I package it up with warble it skips all of the Game class's initialization and tells "AL lib: alc_cleanup: 1 device not closed" and stops.

Does anyone know the proper way to build a libGDX project with jruby and warble?

P.S. I know this seems like a very localized problem but I'm asking how to use jruby and libgdx with warble using my program as an example so... I think it's more broad then it seems... still getting used to stackexchange.

sentences:
Texturing edges of a procedurally generated polygon I'm generating a polygon from code to display unit ranges in my game. Here's how it looks so far:

I would love to be able to now use my texture and only apply it to the edges of this polygon (imagine a stroke with no fill). Could someone point me in the right direction with this issue?

sentences:
Deal with mini states in game Hi :)
I want to ask what is the best way to deal with "mini-states" in game? For example I making game like Simcity, i can build buildings, roads, rails, or I can change something in economy.
I am making something like:

enum
{
  ROAD_CONSTRUCT,
  BUILDING_CONSTRUCT
  VIEW_MAP
  etc..
}

and in the game loop big switch. But the code is getting big. Is there some solution for all popular languages? I am asking because I am writing in C++, AS3 and sometimes in C.

sentences:
Change entity's size based on health [ECS] I'm making a kind of entity component system framework and I have a doubt:

I have two components 'health_damage', 'physic' (which contains position, weight,...) and 'sprite' (position, dimensions...).

When this entity takes damage I want to reduce its dimensions based on health percentage (50% life -> 50% original size) and I thought that I need to create a new system 'change_dimensions_on_hit', register the entity and on hit send a message to it which will update the dimensions (and weight) based on health. And that's, in my opinion, it's fine.

The problem is: imagine I create an item which increases the dimensions of the entity when it's picked up. It would increase the size of a fixed amount without knowing it's original or not (maybe it's at 10%) and when the entity regains health it will become huge
Ex.
Health = 10; MaxHealth = 100
ActiveDimensions = 10 (original is 100);
I take a +20 size object and then a full heal item:
ActiveDimensions would be (10 + 20)/0.1*1.0f = 300 (and not 120)

These are the solutions I found (but I don't really like anyone of them):

storing for each 'mutable variable' its current and max value like for health, so I can always calculate the current percentage and change correctly the original size. I think that's not a good idea because really few entities would have this behaviour and so I would waste a lot of memory.
make the physic component aware of the existence of the health component and (if a flag is set) look for che percentage when it is modified. I think it similar to the first and it also forces a tied relationship which I think it's even worse.
(the one that I think it's the best) I'm using a message system to handle things such as damage on collision, creation of entities... I still need to figure if it's the best way but I'm pretty sure of this. I can use it to handle everything possible and so also the changing of sizes: the item picked up sends a message to the entity 'grow up/shrink'; the entity spreads it to all the systems which is registered to and they can modify the message data before it's handled by the 'base components' (physic, dimensions,...). So it will be received at first by the change_dimensions_on_hit which would adjust the amount of growing based on current health. At the moment I handle messages in a very specific way:
1) it's handled by the systems which will modify them directly (ex.'double_growing_items')
2) by the ones which need to read other components to perform the change (ex. 'Change_dimensions_on_hit')
3) by the base components such as dimensions.
This solution seems the best to me, even if has its own limitation (I have a specific path for each message and I'll face problems such as 'I need that this message, in this case, is handled first by this system and then from that, and not the opposite') and relies entirely on a message system which isn't the best solution performance wise (but I don't think that's a real problem).

Any advice and suggestion is welcomed. Do you think message system is the right way? Or maybe the firsts methods with slightly changes? Something totally new? (I can't change too much because I need to finish this project in one two month for the high school's final exam)

sentences:
Using hard coded values for Items? Is it a bad idea to use hard coded values for things like items (static data) that would change infrequently in an online game? I'm designing an online game in node js, and I'm trying to decide if it would be better to store the data in a database, or hardcoded in a javascript hash (and maybe cache some of the data in a db for filtering). Points I've thought up:

Since javascript is a scripting language, updating it wouldn't be a big deal, it would mean restarting the server, but it would seem most online games go through some sort of restart when introducing new things anyways.

Items in my game are really hard to define in data, as they can have wildly different functions, if its a javascript object, I can define a 'use' function for all of them and don't need to worry about creating a complex item definitions in the database.

If I used a database only, I would have to come up with some sort of way to define every possible item ever, and I don't think its likely I will imagine all of them.

I could use a database for things like name, and description, but still have a hash of functions somewhere.

Maybe having all these items hard coded could increase memory foot print of the web application as they would all always be loaded into memory?

I'm afraid I'm missing something important though? Is there a better answer? Or just preference? Is there a clear right way to do this?

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:
Make an object rotates by an arbitrary angle and rotates toward a target in Unity I have an object facing up in Unity. I need it to move from point A to point B, without prior knowledge of where A and B are. So when I place it at point A, I need to rotate it toward point B. I used this:

this.gameObject.transform.rotation = Quaternion.FromToRotation(A.position, B.position);

However, before doing the movement, I also need to rotate the object by 90° around the X axis. I used this:

this.gameObject.transform.rotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);

These two functions worked, but separately. When I try to use these two functions together, the last function called overrides the other.

sentences:
Programmers/Designers: working with artists Expanding on this question, what information do I need to communicate my artistic goals for a game to a professional artist?

Assuming I'm an indie programmer. and I've found or hired an artist to for my game, how to I go about setting a template or a brief for the look and feel of my game?

sentences: How can non-indie devs stop reinventing the wheel? It seems like the status quo in the games industry is to write most software in-house, maybe excluding the engine if you use one of the dozen or so big ones. Before working here I was mostly an open-source developer, so this mindset seems downright crazy to me. Is there any good way we can all stop building things like log viewers, network diagnostics, and patching systems?

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:
Textures quality issues with Libgdx I have drawn several vector objets and characters ( in Adobe Illustrator ) for my game on Android. They are all scalable at any size without any quality losses ( of course it's vector ^^ ).

I have tried to simulate my gameboard directly on Illustrator just before setting my assests on libdgx to implement them in my game.

I set all the objects at the good size, so that they fit perfectly on my XHDPI device I am running my test on.

As you can see it works great ( for me at least ^^ ), the PNG quality is good for me, as expected !

So I have edited all my PNG at this size, set my assets on libgdx and build my game apk.

And here is a screenshot of my gameboard ( don't pay attention at the differences of placing and objects, but check at the objets presents on both screenshot ).

As you can see, I have a loss of my PNG quality in the game.
It can be seen clealry on the hedgehog PNG, but also ( but not as obvious ) on the mushroom ( check at the outline ) and the hole PNG. If you really pay attention, on every objects, you can see pixels that are not visible on my first screenshot.

And I just can't figure out why this is happening Oo
If you have any ideas, you are very welcome !

Thanks.

PS : You can check more clearly the 2 gameboard on this two links ( look at them at 100%, display at high resolution ) :

Good quality link, from Illustrator

Poor quality link, from the game

Second phase of tests :

We display an object ( the hedgehog ) on our main menu screen to see how it looks like.
The things is that it looks like he is suppose to, which means, high quality with no pixels.

The hedgehog PNG is coming from an atlas :

layer.addActor(hedgehog);

No loss of quality with this method

So we think the problem is comming from the method we are using to display it on our gameboard :

blocks[9][3] = new Block(TextureUtils.hedgehog, new Vector2(9, 3));

the block is getting the size from the vector we are associating to it, but we have a loss of quality with this method.

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:
Optimal number of work groups for compute shaders In OpenGL, is there a way to dynamically determine the preferred workgroup size of the underlying hardware? Or at least, to approximate it using some queried metrics?

In OpenCL, you can do this using some implementation defined constants, but so far I wasn't able to find something similar for OpenGL.

sentences:
State changes in entities or components I'm having some trouble figuring how to deal with state management in my entities.

I don't have trouble with Game state management, like pause and menus, since these are not handled as an entity component system; just with state in entities/components.

Drawing from Orcs Must Die as an example, I have my MainCharacter and Trap entities which only have their components like PositionComponent, RenderComponent, PhysicsComponent.

On each update the Entity will call update on its components. I also have a generic EventManager with listeners for different event types.

Now I need to be able to place the traps: first select the trap and trap position then place the trap.

When placing a trap it should appear in front of the MainCharacter, rendered in a different way and following it around. When placed it should just respond to collisions and be rendered in the normal way.

How is this usually handled in component based systems?

(This example is specific but can help figure out the general way to deal with entities states.)

sentences:
Water simulation in Isometric game I'm creating a game in Flash AS3 in which the player needs to modify land in order to direct the water in the right direction.

However, water simulation is a new topic for me and I'm kinda stuck. It doesn't have to be like realistic water, with ripples and stuff, but it has to flow, and if there's enough water, it needs to rise.

I've thought up two different types of water:

A Spring: Infinite source of water. Used for simulating seas and stuff.
Water block: Just one unit of water.

My current implementation shows how I'd like the water to spread, but it doesn't rise, and doesn't allow for finite water. Also, the spreading isn't accounting for any amount of water, it just duplicates instead of actually moving units of water.

I'm curious to how you guys would solve this problem. Any examples/pseudo-code is always appreciated.

Current version: http://dl.dropbox.com/u/319897/ProjectWater.swf
You can manipulate the land by pressing left mouse. And can simulate one step of water at a time by pressing A.

Source of the water part: http://pastebin.com/Js2kYt4y

sentences: How can I edit a float that is in another script? (In C#) So basically, I have one script for the UI, which holds the float, score. Then I also have another script on my coin that detects when the player collides with it. What I want it to do is change the value of score, but I don't know how to change it, as it is in the UI script. How can I do this?

sentences:
Comparing strings doesn't work I'm making something for a dialogue system that reads "cues" from a textfile to identify which emotion to show in the character's portrait during a conversation. Basically if the current line says "2", it means change the portrait to where the character is smiling. "1" for neutral, etc. Unfortunately the part that compares the emotion variable, and the string from the text file doesn't return true.
I already checked using debug.log if the string from the text file is showing the right number, and it does. I tried comparing them using "==" sign and ".equals();" but neither seems to work.
public TextAsset textFileP;
public string[] textLineP;
public GameObject character;
public Animator anim;
public string smile = "2";

void Start()
{
    anim = GetComponent<Animator>();

    if (textFileP != null)
    {
        textLineP = (textFileP.text.Split('\n'));
        character.SetActive(true);
    }
}

void Update()
{

    if (DialogueParser.nextLine < DialogueParser.textLine.Length - 1)
    {

        //change portrait
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            string cue = textLineP[DialogueParser.nextLine];
            // Debug.Log(cue);
            if (cue.Equals(smile))
            {
                anim.SetInteger("2", 2);
            }

        }

sentences:
How do I better organise rendering in an entity component system? I'm developing an isometric RPG, with 3D characters in 2D level. I was using a standard object orientated programming paradigm, but was faced with a lot of issues. Recently, I learned about entity component systems, and am currently rewriting my engine using this paradigm.

I use OpenGL, and have two rendering systems - one for drawing in 2D, and one for drawing in 3D. Each system consists of one VBO id, with the appropriate geometry, shader program id, id of texture unit binded to the texture atlas (which accommodates all tilesets or all model textures) and other information like that. The alternate systems provide different logic for drawing in 2D and 3D.

When it comes to the components for these systems, I am stuck.

Say I have component, defined by the buffer offset from the beginning of VBO buffer and the primitive count that needs to be rendered. Let's pretend that I have two instances of these components. The first instance belongs to the level floor entity, and describes the bunch of quad tiles. The second instance is a character mesh that belongs to the player entity. The first component instance should use the 2D rendering system, and second instance should use the 3D rendering system, but the data structure of these instances are identical. It must be said that I use EntityX and the components gets in the systems, automatically depending on their type.

Both systems require position and craphics components, so both systems will take both component instances, and one of these component will be processed improperly, what with a 2D graphics component in a 3D rendering system, and vice versa. I'm thinking about creating the "hollow" components, like sprite and model, which will indicate what graphics components in the entity mean. Since these component will not contain any properties, and would be used only as flags, this solution seems clumsy.

How do I better organise rendering in an entity component system?

sentences: A ball hits the corner, where will it deflect? I need to brush up my trigonometry and hope you can help here with a simple mathematical model. Here is my model so far in the image attached. I am aware that the frame animation has other problems when the ball is moving very fast, but for now I just need to calculate ballDx and ballDy. It is also possible that ballDx = 0 (vertical movement only), but when the ball deflects ballDx may get a different value.

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:
Cocos 2D putting things on the cocos thread or not? We are using Cocos 2D for Android and are unsure if it's a good thing to execute our non-ui tasks on the Cocos thread as a way to get the animations in our game to pause.

What is the recommended practice?

sentences:
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:
Angle range detection I'm trying to make game like portal which players can transform between two holes.
My problem is, how to detect if player's have the right angle to the hole. (hole has an angle to a direction, if player's angle to hole meet the right direction can do transform)

Pseudo code:

var range=30;
 if(collission){
     if(abs(ball.getAngle()-player.getAngle())<=range){
            ball.doTransform(player);
     }
 }

below is some situation:

ball.setAngle(20);
player.setAngle(30);
abs(ball.getAngle()-player.getAngle()) ==10 //ok
player.setAngle(350);
abs(ball.getAngle()-player.getAngle()) ==320 //not ok
ball.setAngle(350);
player.setAngle(20);
abs(ball.getAngle()-player.getAngle()) ==330 //not ok
ball.setAngle(120);
player.setAngle(100);
abs(ball.getAngle()-player.getAngle()) ==20 //ok

and anybody can help me to figure out the right condition so that ball can transform player? thanks!

sentences:
Is A* suitable for this particular case? I have a 2D map of nodes a train could travel. They are not in a grid. The node positions are placed by a designer and exported to a JSON file which the game loads to display the node positions on the map texture/sprite.

I'm tying to implement pathfinding for the train. The user can select a node and set a waypoint to that node. The game should find the shortest path and take that (avoiding locked nodes).

The way the nodes are set up right now is that each node has other neighbour nodes. There's the condept of a 'link' which connects two nodes. Nodes do not store any neighbour information in them, instead they're stored in the links which are stored separately (a list of links, each link contain two integers representing the linked nodes' ids)

The train has no restriction on its movement it could move from A->B or B->A, only restriction is that it doesn't move to the previous node it came from. So going from A->B, when asking B of its neighbours, we exclude A and look at the other neighbours.

I hope that's enough context to answer my question: Is A* applicable to me? If so, I'm not really sure how to write a function to generate weights/costs on nodes. I just can't seem to answer the question of: What's the total distance between A->B in order to assign costs/distances? Because there could be more than one path to go from A->B, which requires path-finding in itself (see the infinite loop in my logic?). If A* is not the best here, what is?

[EDIT] Replying to Matt's answer. I thought of using distances to calculate the weights/costs but take this example for instance:

Where's at 'P' trying to go to 'T'. Edge/link 'A' is shorter than 'E' but if we take the 'A' route it would be longer in the long run. I would have to travel both the paths to determine which distance is shorter, otherwise how do I know? am I missing/misunderstanding something here?

Another question is, how do I track paths/links/nodes that I shouldn't visit anymore? I can't just mark a node as 'visited' once I visit it the first time because there could be a branch in there and I have to visit it twice to know which one is shorter, correct?

[EDIT] I guess in the first case^, it would be benefecial to also do the pathfinding backwards from 'T' to 'P' then pick which ever is the shortest between going P->T and T->A?

sentences:
Is object-oriented underestimated for game development? I'd like to understand whether the object-oriented paradigm applied to game programming is bad, or whether it's just an urban legend.

A friend of mine is developing a game with HTML5 and Javascript using data-oriented paradigm, and he's trying to convince me about the issues of the object-oriented design.

His best example is this:

"If you have a Tree (a static object in the game) and a Warrior (an object which can perform some action, like movements, attacks..) and suddenly you decide to put in your game a Warrior Tree, how do you do it by object-oriented?"

He is right or he is underestimating the "power" of the object-oriented paradigm?

sentences:
How remove banner adView from a Screen in libgdx? I have an AdMob banner in the game. But I need this banner not to be shown in Screen_1 and when user enter Screen_2 I need to show the banner.
When I call AdView.gone() it dissapears from screen but coordinates becomes wrong and touch position doesn't match with coordinates. How can I properly remove AdView.

sentences:
database design help for game / user levels / progress Sorry this got long and all prose-y. I'm creating my first truly gamified web app and could use some help thinking about how to structure the data.

The Set-up

Users need to accomplish tasks in each of several categories before they can move up a level. I've got my Users, Tasks, and Categories tables, and a UserTasks table which joins the three. ("User 3 has added Task 42 in Category 8. Now they've completed it.") That's all fine and working wonderfully.

The Challenge

I'm not sure of the best way to track the progress in the individual categories toward each level. The "business" rules are:

You have to achieve a certain number of points in each category to move up.
If you get the number of points needed in Cat 8, but still have other work to do to complete the level, any new Cat 8 points count toward your overall score, but don't "roll over" into the next level.
The number of Categories is small (five currently) and unlikely to change often, but by no means absolutely fixed.
The number of points needed to level-up will vary per level, probably by a formula, or perhaps a lookup table.

So the challenge is to track each user's progress toward the next level in each category. I've thought of a few potential approaches:

Possible Solutions

Add a column to the users table for each category and reset them all to zero each time a user levels-up.
Have a separate UserProgress table with a row for each category for each user and the number of points they have. (Basically a Many-to-Many version of #1.)
Add a userLevel column to the UserTasks table and use that to derive their progress with some kind of SUM statement.

Their current level will be a simple int in the User table.

Pros & Cons

(1) seems like by far the most straightforward, but it's also the least flexible. Perhaps I could use a naming convention based on the category ids to help overcome some of that. (With code like "select cats; for each cat, get the value from Users.progress_{cat.id}.") It's also the one where I lose the most data -- I won't know which points counted toward leveling up. I don't have a need in mind for that, so maybe I don't care about that.

(2) seems complicated: every time I add or subtract a user or a category, I have to maintain the other table. I foresee synchronization challenges.

(3) Is somewhere in between -- cleaner than #2, but less intuitive than #1. In order to find out where a user is, I'd have mildly complex SQL like:

SELECT categoryId, SUM(points) from UserTasks WHERE userId={user.id} & countsTowardLevel={user.level} groupBy categoryId

Hmm... that doesn't seem so bad. I think I'm talking myself into #3 here, but would love any input, advice or other ideas.

P.S. Sorry for the cross-post. I wrote this up on SO and then remembered that there was a game dev-focused one. Curious to see if I get different answers one place than the other....

sentences:
GLImpl.gldrawelements longer than usual I'm developing a little game engine for the Android platform and I'm trying to improve the performance of this one. (I'm not an OpenGL expert)
I can see a framerate drop sometimes, when using DDMS method profiling, I can see that the cause is a longer GLImpl.gldrawelements : the first one right after the eglSwapBuffers.

So my questions are : Do you have an idea why sometimes this call is longer?
It seems that GLImpl.gldrawelements is waiting for something, am I right?

Why the first GLImpl.gldrawelements call (between two eglswapbuffers calls) is longer than the followings?

sentences:
Collision filtering techniques I was wondering what efficient techniques are out there for mapping collision filtering between various bodies, sub-bodies, and so forth.
I'm working on a physics engine and I need ways for a user to easily specify some complex relationships between bodies (what should/shouldn't collide), and ways to organize that filtering data so that it's easily attainable / memory-efficient.   One part of my engine that could also be taken advantage is what my 'bodies' actually are. They're like folders that you can put convex shapes, and other bodies in as to organize the parts of a complex rigid body.

I'm familiar with the simple idea of having different layers of 2D bodies, but this is not sufficient for more complex mapping:

EXAMPLE:
(Think of having sub-bodies of a body, such as limbs, collide with each other by placing them on the same layer, and then wanting to only have the limbs collide with the ground but not the body)
- I don't see how a user could accomplish the above example with just a bunch of different layers... The body must collide with the ground and therefore be in the same layer, but the limbs must also be in the same layer as the ground, causing unwanted collision between the body and the limbs.

This can be solved with a multidimensional layer setup, but I would probably end up just creating more and more layers to the point where the simplicity and efficiency of layer filtering would be gone.

Are there any more complex filtering techniques that would solve complex situations such as the example? And even more possibly complex situations?

sentences:
Representing realistic population What's the best way to represent a realistic population number (e.g USA:317,569,000) in game?

For example, Civilization your city has 1 Citizen. Obviously, a city can't just have one person in a city but Civ seems to do a good job at representing citizens that way.

What I'm after is to represent 300+ million in an easy to swallow number to a player.

I have a calculation which states that, in theory, to have 300+ people you would need 79 million 4 person dwellings. (I understand this may not be totally accurate, but it works for my needs)

It seems tedious to have the player do that with a couple of methods I've thought about.

So my question then is I need some way to make the game and the player aware that the player's city has 100,000 people in it without making the player create 25,000 dwellings.

Update 1:

As @Patrick M states, in Civ you only have to build one of a building type.

Much like dwellings, it doesn't make sense to force the player to build one police station/1000 people.

I have a formula that calculates the theoretical population limits of an area and I want to constrain the player to this limit. (Players have a reason for wanting larger regions)

However, I don't want the player to instantly have 10,000 citizens simply because he built a "house/neighborhood".

I want to represent real world constraints and requirements without the super micro management that would be present in forcing the player to build 2,500 dwellings (to get the 10k)

sentences:
How can I fix “Cannot read value of type Vector2 from composite” error in Unity? I'm making a 2D game with Unity using the new Input System. I used spriteRenderer.flipX to flip the player but since it is made of three parts (body and two eyes), the spriteRenderer didn't work. Also, I couldn't convert them to a single sprite because I need the eyes in order to animate them. So, I decided to use transform.localscale for flipping and change movementInput value from a float to a Vector2. The problem is that when I press the arrow or AD keys to move the character, an error pops up saying "Cannot read value of type Vector2 from composite". This error is from InputActionState which is a long and complicated code related to the new Input System. Also, getting input from gamepad causes the same error. I don't know what does this error mean and how can I fix it. Now, the player can jump but it can't move or flip. You can see the code, the error and my action map down below.
This is my Player Controller:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    [SerializeField] private float speed, jumpSpeed;
    [SerializeField] private LayerMask ground;
    private PlayerActionControls playerActionControls;
    private Rigidbody2D rb;
    private PolygonCollider2D pol;
    private Animator animator;
    private bool facingRight = true;
    private Vector2 movementInput;

private void Awake() {

    playerActionControls = new PlayerActionControls();
    rb = GetComponent<Rigidbody2D>();
    pol = GetComponent<PolygonCollider2D>();
    animator = GetComponent<Animator>();

   }

private void OnEnable() {

    playerActionControls.Enable();

   }

 private void OnDisable() {

    playerActionControls.Disable();
   }

 void Start()
   {
     playerActionControls.Land.Jump.performed += ctx => Jump(ctx.ReadValue<float>());

    }

private void Jump(float val) {
       if (val == 1 && IsGrounded()) {
           rb.AddForce(new Vector2(0, jumpSpeed), ForceMode2D.Impulse);
       }
   }

private bool IsGrounded() {

       Vector2 topLeftPoint = transform.position;
       topLeftPoint.x -= pol.bounds.extents.x;
       topLeftPoint.y += pol.bounds.extents.y;

       Vector2 bottomRightPoint = transform.position;
       bottomRightPoint.x += pol.bounds.extents.x;
       bottomRightPoint.y -= pol.bounds.extents.y;

       return Physics2D.OverlapArea(topLeftPoint, bottomRightPoint, ground);
   }
     void FixedUpdate()
   {
       if(facingRight == false && movementInput.x > 0){
           Flip();
       } else if (facingRight == true && movementInput.x < 0){
           Flip();
       }
   }
   void Flip(){
        facingRight = !facingRight;
        Vector3 Scaler = transform.localScale;
        Scaler.x *= -1;
        transform.localScale = Scaler;
   }

   void Update()
   {
      movementInput = playerActionControls.Land.Move.ReadValue<Vector2>();

       Vector2 currentPosition = transform.position;  // This was a Vector3 but since I got the error  "Operator '+=' is ambiguous on operands of type 'Vector3' and 'Vector2", I changed it to a Vector2.
       currentPosition += movementInput * speed * Time.deltaTime;
       transform.position = currentPosition;

   }
}

This is the error I get when I want to move the player.

This is my action map.

sentences:
How do I go about selecting minimum GPU requirements for a video game a couple years out from release? How does one go about determining a good minimum GPU requirement for a game that development is starting on, that will be published in approximately 2 years?

On one hand, you want as many people as possible to be able to play it, but on the other hand, you want the capabilities to be as high as possible for a better experience. The higher the DX/GL API you can use also means some things will be much better optimized.

My current idea is basically to identify what GPUs of the past have done, over a two year period, and identify the best one at the moment that will more than likely be hitting the bargain bin at the expected release date.

sentences:
How can I make an AI agent avoid screen edges? I'm programming an AI agent and I want them to avoid the screen edges. I've been considering using either the obstacle avoidance or the fleeing behaviour. Do either of these make sense?

How should I approach this?

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:
Why do I get an error "exit() redefinition" while using OpenGL? I am using Visual C++ 2010 and I get the following errors:

1>d:\visual c++\vc\include\stdlib.h(353): error C2381: 'exit' : redefinition; __declspec(noreturn) differs
1>d:\glut-3.7.6-bin\include\gl\glut.h(146) : see declaration of 'exit'

In my project I have 3 files.  Here are the includes from each of them.

Main.cpp

#include<iostream>
#include "BmpLoader.h"
#include<glut.h>

BmpLoader.h

#include<stdio.h>
#include<glut.h>
#include<Windows.h>

BmpLoader.cpp

#include "BmpLoader.h"

As far as I know, I receive this error due to the include order.  I have tried so far several arrangements of the includes, but haven't figured out the proper arrangement.

What library combination causes this error and what include order should I use in order to prevent it?

sentences:
Developing an iOS/Android game with the free Unity license - feasible? I recall, when I looked up the Unity license comparison page several months ago, seeing that some iOS/Android features were disabled for the Free license. However I can't seem to find that page now, all I can find is http://unity3d.com/get-unity which isn't platform-specific.

But the Pro Android and Pro iOS licenses still exist, which means that there is SOME difference. I already know of the revenue limit and the mandatory Unity splash screen for Free. But are there any other differences? Notably, anything that would really impact the game's performance or flexibility?

Are there any serious iOS and Android game developers who use the Free license?

sentences:
3D position to UV coordinates in fragment shader I am interested in converting an arbitrary 3D position computed at run time in the fragment shader to its corresponding UV coordinates. Notice that the 3D position I am interested in is NOT a 3D vertex present in the VBO, but an arbitrary 3D location that may lay somewhere inside one of the triangles of the mesh.

What is the best way to perform this 3D to UV mapping? I am thinking of looking at the vertices of the face where the 3D point is, and interpolate its UV coordinates using the distance between the 3D point and the 3D vertices as a weights, but I have a feeling I may be overthinking this problem.

Ideally, I want to do it in a GLSL fragment shader. Does any body have any suggestion, example code, or better idea to solve this problem?

sentences:
What 3d mesh formats usable with DirectX10 are there? I want to load a mesh into my game (written in C#, if this matters) but am not sure what mesh format to use. What mesh formats are there, how easy/hard it is to load them into DirectX10 and what's the difference between those formats?

Or is it best to write my own mesh format?

sentences:
Unity- how to render-to-texture with VR distortion I've also asked the question here http://answers.unity3d.com/questions/1392099/how-to-set-a-render-to-texture-camera-to-be-a-vr-c.html (but it's currently "under moderation")

So, I want to do some post processing effects in VR. I put a camera as a child of the Main Camera and set it to render-to-texture. Then, I take what is rendered, and display it (with my post-proc shader) on a quad in front of the Main Camera (The main camera and the child camera render different layers, so I don't render the same thing twice). (Also worth noting- I know that the depth will be collapsed out of the rendered-to-texture content; this is intentional.) The problem is, in this process, the positional data (that was rendered to texture) gets misaligned.

I've already fixed a problem where I have to manually set camera_project.GetComponent<Camera>().aspect = main_camera.GetComponent<Camera>().aspect; every frame. (Changing/setting the screen size auto sets the aspect ratio of the main camera- it does not automatically set the aspect ratio of the child camera.

So, with just that, everything lines up great and looks fine when it isn't in VR. But, when it is in VR, it appears that maybe some distortion is happening to the main camera that isn't happening to the render-to-texture camera, and thus, the overlay (the post-proc'd content) isn't lining up.

So what can I do to emulate the VR distortion in the child camera? Are there other properties of the Main Camera that are getting auto-set in VR that I can manually copy to the Main Camera? (I also noticed that aspect wasn't listed in the camera documentation [https://docs.unity3d.com/Manual/class-Camera.html] unless you knew to search for it explicitly, so I think it might be likely there is some other property I'm missing?)

sentences:
Generating terrain using Marching Cubes I searched around the web but I found nothing that could help me, so I'm asking here.

I'm trying to  procedurally generate terrain using the marching cubes algorithm, and I can generate a mesh. The problem is that the mesh that may be anything!

https://www.dropbox.com/s/w99lvynrfra2a5v/question.JPG

As you can see in that screenshot, everything is messed up.

Is this a problem with the noise function? I'm using a simple Perlin noise function. How can I achive a result like this:

http://www.youtube.com/watch?v=-hJkrr5Slv8

If the problem is with the noise, what do I need to change to achieve this? I want to create natural terrain with hills, mountains, plains etc.

(I'm using Unity3D, but I don't think this makes any difference.)

sentences:
2D RGBA texture is gray in GLSL shader I have a shader to perform LUT coloring of a texture and a c++/c# programs that call it which work perfectly when i use a 1D texture.
Since i need to support computers that don't support the 1D texture in the shader i thought the easiest would be to convert the 1D texture to a 2D texture with the height==1.
After the conversion (1D -> 2D) when i run the program it seems that the LUT 2D texture is received gray in the shader. I render the exact same texture in another place (not using a shader) in the program and the texture looks fine (same as it did when i used a 1D texture).
The shader code:

uniform sampler2D FluorImage;
uniform sampler2D FluorColorLutRGBA;

void main(void)
{
  vec3 FluorPix = texture2D(FluorImage, gl_TexCoord[0].st).rgb;
  vec2 Coord = vec2(FluorPix.g, 0.0);
  vec4 NewColorFluor = texture2D(FluorColorLutRGBA, Coord).rgba;
  gl_FragColor.rgb  = NewColorFluor.rgb;
}

The texture creation code

glGenTextures(1, &m_FluorShadersParams[fpsFused].m_LutTexture);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);

Filling the texture with data

glActiveTexture(a_FluorTextureIndexes[fpsFused]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i, 256, 1, GL_RGBA, GL_UNSIGNED_BYTE, pLUT);
glActiveTexture(GL_TEXTURE0);

Calling the shader

glUseProgram(m_progObj[fsFluorFused]);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, FluorTextureIndexesNum[fpsFused]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, inputTextures[eftIR]); // Fluor image

glBindFramebuffer(GL_FRAMEBUFFER,outputFBO.m_FBO[eftFused]);

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorImage");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, 1);
}

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorColorLutRGBA");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, FluorTextureIndexesNum[fpsFused]);
}

glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_QUADS);
 glTexCoord2f(0,    fTextureRatioY);
 glVertex2f(0,      fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   fTextureRatioY);
 glVertex2f(fTextureRatioX,     fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   0);
 glVertex2f(fTextureRatioX,     0);
 glTexCoord2f(0,        0);
 glVertex2f(0,          0);
glEnd();

glUseProgram(0);
glActiveTexture(GL_TEXTURE0);

glBindFramebuffer(GL_FRAMEBUFFER,0);
glBindTexture(GL_TEXTURE_2D,0);

The strange thing is that if i change all the places in the code back from Texture2D into Texture1D and the sampler in the shader to 1D everything works great.
Anyone has any idea where the issue can be?

sentences: How a "view" is handled in an Entity-Component based model? Coming from an MVC background, I am trying to understand Entity-Component based model. However, i can see description about the use components( data objects ) and entities ( group of different data-objects ie components), but cannot see how view is created. I can see something called "render" components though. But how would i use it ? It seems, i don't need to bother about separation of view from data in this architecture. But i doubt, if this is the case, then things would mess up.

sentences:
Game Engine Renderer Architecture I'm currently building a game engine renderer but I got stuck when I had to separate engine and client code.

I had been following OpenGL tutorials to learn about buffer creation, etc so all my code for rendering was in a single place and was tied to that specific example.

I created a VBO, a IBO/EBO, a VAO and a shader, then set the VertexAttribPointers for that VAO (and VBO layout) and rendered it. Everything worked fine.

Then I created C++ abstractions for all of those "objects" and recreated the example; that also worked.

So what I wanted to do know is to have each of my game objects create a VBO and an IBO, create a global VAO in my renderer (since all my objects share the same layout) submit them to the renderer and have them rendered. But I discovered I could not setup vertex attribute pointers without having a VBO bound (I have none bound since they get created after the renderer starts up).

So my question is:

How should I set up the VAOs and VBOs for the renderer to work?

I read in some places that what I have to do is to set up few VBOs (so as to have little binding calls and draw calls) and then store every object inside
that one giant buffer. (Of course while still creating different buffers for objects with different vertex layouts and different shaders). I also know that to do that you have to allocate a big buffer and then call buffer sub data to store the new data inside that one buffer, but what I don't know is how to store that data if it must be offset (because of its position in the world and how to update its position)

So if that's the case my next question is:

How do I create one giant buffer and then store different objects inside that one giant buffer and then render those stored objects with their respective positions? (For both static and dynamic objects).

sentences:
Unity3D playing sound when Player collides with an object with a specific tag I using Unity 2019.2.14f1 to create a simple 3D game.

In that game, I want to play a sound anytime my Player collides with a gameObject with a specific tag.

The MainCamera has an Audio Listener and I am using Cinemachine Free Look, that is following my avatar, inside the ThridPersonController (I am using the one that comes on Standard Assets - but I have hidden Ethan and added my own character/avatar).

The gameObject with the tag that I want to destroy have an Audio Source:

In order to make the sound playing on the collision, I started by creating an empty gameObject to serve as the AudioManager, and added a new component (C# script) to it:

using UnityEngine.Audio;
using System;
using UnityEngine;

public class AudioManager : MonoBehaviour
{

    public Sound[] sounds;

    // Start is called before the first frame update
    void Awake()
    {
        foreach (Sound s in sounds)
        {
            s.source = gameObject.AddComponent<AudioSource>();
            s.source.clip = s.clip;

            s.source.volume = s.volume;
            s.source.pitch = s.pitch;
        }
    }

    // Update is called once per frame
    public void Play (string name)
    {
        Sound s = Array.Find(sounds, sound => sound.name == name);
        s.source.Play();
    }
}

And created the script Sound.cs:

using UnityEngine.Audio;
using UnityEngine;

[System.Serializable]
public class Sound
{
    public string name;

    public AudioClip clip;

    [Range(0f, 1f)]
    public float volume;
    [Range(.1f, 3f)]
    public float pitch;

    [HideInInspector]
    public AudioSource source;
}

After that, in the Unity UI, I went to the Inspector in the gameObject AudioManager, and added a new element in the script that I named: CatchingPresent.

On the Third Person Character script, in order to destroy a gameObject (with a specific tag) when colliding with it, I have added the following:

void OnCollisionEnter(Collision other)
        {
            if (other.gameObject.CompareTag("Present"))
            {
                Destroy(other.gameObject);
                count = count - 1;
                SetCountText();

            }
        }

It is working properly as that specific object is disappearing on collision. Now, in order to play the sound "CatchingPresent" anytime the Player collides with the object with the tag, in this case, Present, I have tried adding the following to the if in the OnCollisionEnter:

FindObjectOfType<AudioManager>().Play("CatchingPresent");

But I get the error:

  The type or namespace name 'AudioManager' could not be found (are you
  missing a using directive or an assembly reference?)

AudioManager.instance.Play("CatchingPresent");

But I get the error:

  The name 'AudioManager' does not exist in the current context

As all the compiler errors need to be fixed before entering the Playmode, any guidance on how to make the sound playing after a collision between the player and the gameObject with the tag Present is appreciated.

sentences:
How do I call functions that take more than one frame to finish? I'm trying to figure out how to implement C# scripting into my XNA game. How do I call functions that take more than one frame to finish?

For example:

class UserScript : Script
{
    public override void execute(Game game)
    {
        //script must wait for dialog to be closed
        game.openDialog("This is a dialog");

        //script should'nt wait for this
            int goldToGive = 100;
            goldToGive += 100;
            game.addGold(goldToGive);
        //

        //script should wait for cinematic to end
        game.startCinematic("name_of_cinematic");

        //doesn't wait
        game.addGold(100);
    }
}

I found a question that suggests you can do it with yield, but I'm not sure if it's the correct way, as the referenced article is from 2010, and no longer exists. Is using yield the answer? If so, how do I use it? If not, should I take a differant approach, or am I better off with multi-threading?

sentences:
Very simple open source games in various languages? Are there any very simple open source games available just to demonstrate the basics of the programming techniques?  Preferably something which fits in to a couple hundred lines of actual code.  Specifically, I'm looking for an open source game written in Objective-C and Cocoa.

I would also appreciate one written in C.

All the projects that I find online are relatively complicated.

sentences:
Have VSync on or off while do a game profiling I'm trying to profile the game using Unity Profiler in order to catch any potential performance issues. The graphics settings support VSync feature.

However, I am not sure which one is the best practice to have a better profiling insight, having VSync on or off?

sentences:
Is there a way to capture back button twice in same activity libgdx game Can anybody tell me if there is a possibility to capture back button twice in same activity in libgdx.
What i want to achieve is  that if the user press back button once the game pause. if in the pause screen user press back key again so the level exit. This happens well in "Video" that is the built in app in android OS. During video play a if user press back button it toast to press back again to exit.

so I want somthing like this.

if (Gdx.input.isKeyPressed(Keys.BACK)) {

        code to call game pause  state

  if (Gdx.input.isKeyPressed(Keys.BACK)){   //// is this possible?

  game.setScreen(new Menu(game))

 }

    } else {
        code to call game resume state
    }

sentences:
How to apply transform matrices retrieved from FBX I'm trying to import a skeletal animation using FBX SDK. I followed this article, managing to load all the needed data, but when I try to display the animation the mesh falls apart. My knowledge of skeletal animation is fairly limited which may be the issue.

Here is the animation code

for (int i = 0; i < m_numTriangles; i++)
{
    for (int j = 0; j < 3; j++)
    {
        currVertex = m_verticies[m_triangles[i].vertices[j]];
        posVec1.Set(0, 0, 0);
        normVec1 = currVertex.normal;
        for (int k = 0; k < currVertex.blendingInfo.size(); ++k)
        {
            jointIndex = currVertex.blendingInfo[k].index;
            jointWeight = currVertex.blendingInfo[k].weight;

            if (jointWeight != 0)
            {
                transMat1 = m_skeleton.joints[jointIndex].animation[frameIndex1 - 1].transform;
                temp = transMat1.MultT(currVertex);
                posVec1 += temp*jointWeight;
            }
        }
        glNormal3f(normVec1.mData[0], normVec1.mData[1], normVec1.mData[2]);
        glVertex3f(posVec1.mData[0], posVec1.mData[1], posVec1.mData[2]);
    }
}

I iterate over all the triangles, get the vertices, iterate over all the joints that affect said vertex, get the transformation matrix for the current frame and apply.

I believe the problem is with how I'm applying the matrix, but I don't know what I'm doing wrong. I think either I'm skipping a step or I'm misunderstanding what the transform matrix represents.

The article retrieves the global bind pose inverse as follows

currCluster->GetTransformMatrix(transformMatrix);   // The transformation of the mesh at binding time
currCluster->GetTransformLinkMatrix(transformLinkMatrix);   // The transformation of the cluster(joint) at binding time from joint space to world space
globalBindposeInverseMatrix = transformLinkMatrix.Inverse() * transformMatrix * geometryTransform;

This is done for each joint. Do I need to multiply this with the transform matrix before applying to vertex? Like this

transMat1 = m_skeleton.joints[jointIndex].animation[frameIndex1 - 1].transform * m_skeleton.joints[jointIndex].globalBindposeInverse;

Or do I need to also multiply each joints globalBindposeInverse with its parents first?

This is how the article calculates the transform for each frame of animation

for (FbxLongLong i = m_startFrame; i <= m_endFrame; ++i)
{
    FbxTime currTime;
    currTime.SetFrame(i, FbxTime::eFrames24);
    currAnim.number = i;
    FbxAMatrix currentTransformOffset = inNode->EvaluateGlobalTransform(currTime);
    currentTransformOffset *= geometryTransform;
    currAnim.transform = currCluster->GetLink()->EvaluateGlobalTransform(currTime);
    currAnim.transform *= currentTransformOffset.Inverse();
    m_skeleton.joints[currJointIndex].animation.push_back(currAnim);
}

I'm sorry if this is a trivial question, but I've been stuck on this for 4 days now.

sentences:
Will Vulkan Kill the use of GLSL? After reading this link I am still unclear as to the shading language support in Vulkan.

As Vulkan only supports SPIR-V is it the case that GLSL is therefore being phased out? Are there any indication of what the next 5 years looks like in terms of the "hot"  language to study in for graphics programming?

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 should I update vectors, et cetera, in a time-based fashion? I'm trying to write something I believe is straightforward but wanted to check that I'm doing it right.

All I want is to update the position of a 2D sprite based an acceleration and velocity. I'm using time based modelling so I have time deltas at my disposal. My current approach looks a little like this:

int rotDuration = btnRight.GetDuration() - btnLeft.GetDuration();
ship.Facing += (ANGULAR_VELOCITY * (rotDuration)); //angular displacement (rads?)

Rise::Vector2D forwardDir(sin(ship.Facing), cos(ship.Facing));
Rise::Vector2D finalVelocity = ship.Velocity + (elapsedTime * btnAcc.GetDuration() * MAX_ACC * forwardDir);
ship.Position += finalVelocity;

Hopefully that's pretty straightforward. I get the duration that rotation was occurring for, then multiply this by the speed I wish to allow my ships to rotate. For the velocity, I applied the equation from here. I'm very unsure as to why it says to scale the whole thing by max acceleration, though...

Does this look correct and will it produce the sort of rotation you would expect? For context I'm simulating space- or ice-like inertia.

sentences:
How to know if mouse coordinates is delta or absolute on Window and Android in Unity? I wrote sample application, that allows to "rotate" object by mouse. Rotation occured by rotating of camera object around central object and the code is following:

float mouseX = -Input.GetAxis("Mouse X");
float mouseY = -Input.GetAxis("Mouse Y");

float magnitude = transform.position.magnitude;

Vector3 mouseSwipe = new Vector3(mouseX, mouseY, 0);
Vector3 startPoint = new Vector3((float)camera.pixelWidth / 2, (float)camera.pixelHeight / 2, magnitude - 1);

Vector3 startPointWorld = camera.ScreenToViewportPoint(startPoint);
Vector3 endPointWord = camera.ScreenToViewportPoint(startPoint + mouseSwipe);

Vector3 mouseSwipeWord = endPointWord - startPointWorld;

float dragLat = mouseSwipeWord.y;
float dragLng = mouseSwipeWord.x;

Vector3 oldPosition = transform.position / magnitude;

float lat = Mathf.Asin(oldPosition.y);
float rsmall = Mathf.Acos(oldPosition.y);

float lng = Mathf.Atan2(oldPosition.z / rsmall, oldPosition.x / rsmall);

lat += dragLat * 10 * 2 * Mathf.PI;
if( lat*180/Mathf.PI > 80 )
{
    lat = 80 * Mathf.PI / 180;
}
else if( lat*180/Mathf.PI < -80)
{
    lat = -80 * Mathf.PI / 180;
}

lng += dragLng * 10 * 2 * Mathf.PI * 2;

float y = Mathf.Sin(lat);
rsmall = Mathf.Cos(lat);

float x = rsmall * Mathf.Cos(lng);
float z = rsmall * Mathf.Sin(lng);

Vector3 newPosition = new Vector3(x, y, z);
newPosition *= magnitude;

transform.position = newPosition;

LookAtTarget();

The code assumes that mouse returns delta value on each swipe and this works well on Windows. For example, if I do several separate swipes, I can gradually rotate object for full circle.

Unfortunately, when I run this on Android, it doesn't happen. Each swipe object restarts from some position, depending on swipe point. I.e. on Android, swipes return in absolute value.

Is it possible to know, whether swipes retunrs delta or absolute values and how? Is it possible to claim compatible return units?

sentences:
Implementing Galaga Style Enemy Behavior in Unity I've been trying to work on a space shooter with the idea of having enemies behaving like it is shown in this video : https://www.youtube.com/watch?v=3p7u8uCR6yw

In the video above, enemies fly from different portions outside the view area of the screen doing elaborate movement before finding a spot to form an organized formation.

I've been thinking of ways how this could all be done. One way is by having either the enemies and/or a manager use a Finite State Machine that will control when there is a "performing" state and when there is a "FindingSpot" state.

but at as far as implementing the complex patterns, I'm at a loss. Is there some sort of Math formulation that's used to generate those movement patterns?

sentences:
Can I create custom framebuffer and render to it in cocos2dx? I want to do post processing effects so I was thinking If I could just make custom framebuffer in cocos2dx like OpenGL and render the ALL SCENES objects in it. I want a single frame buffer for all scenes. Is there any
 way? Thanks.

sentences:
Unity Nav mesh lading data each frame Hey all I had a question, I was looking into my game's performance and noticed this in the profiler:

Is there any way to optimize this such as pre-generating tiles so it doesn't have to do it each update :) ?

sentences: 3D Game Engine comparable to UDK that's not GPL'd Are there any good, free 3D game engines similar to UDK that are under open-source licenses without copyleft provisions?

sentences:
How to fx low FPS in a single threaded Directx9 3D game We're having issues with low FPS in a third-person shooter 3D game. This happens when you have too many polygons on screen. The FPS is locked to 60, and the gameplay is fine, but the moment when you have like 900 entities on screen, the FPS immediately drops to 45 or 50.

IDirect3DDevice9::DrawIndexedPrimitive is normally called 200-900 times to render the entities, however, when you render more polygons than usual, let's say 500,000 more vertices then it's called 6000-7000 times and the FPS drops to 45-50. I ran a profiler and saw this function eating up the CPU, consuming around 19% of the resources.

I have some ideas to deal this issue, but I need some advice. Possible solutions that I can think of:

Secondary thread for rendering

I'm not sure if introducing multi-threading will fix the problem, but I'm hopeful.

Upgrading to Directx11

If this can help, then can someone explain how we need to render the vertex buffers of entites? This how we do it now for every entity:

d3dDevice->Clear(0,NULL,D3DCLEAR_TARGET, D3DCOLOR_XRGB(255,255,255),1.0f,0);

// Turn on wireframe mode
d3dDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
d3dDevice->BeginScene();

for (DWORD i=0; i<numMaterials; i++)
{
    // Set the material and texture for this subset
    d3dDevice->SetMaterial(&meshMaterials[i]);
    d3dDevice->SetTexture(0,meshTextures[i]);

    // Draw the mesh subset
    mesh->DrawSubset( i );
}

d3dDevice->EndScene();
d3dDevice->Present(NULL, NULL, NULL, NULL);

Both

Upgrade to Directx11 and use a secondary thread for rendering?

sentences:
Force Reload VS soution Explorer when adding new c# Script via Unity3d? When I create C# script (Create -> C# Script) via Unity3d  or delete it from Unity3d - Visual Studio shows me the warning window.

it's annoying.

Is there any way to force "ReloadAll" in solution Explorer without the window?

sentences:
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 many Fringe/Base layers in a 2D map editor? I'm creating a highly flexible 2D tile-based map editor in XNA to make some of my future projects easier (will work for side-scrollers and top-down games). This editor can work with any sized tile.

This editor is based on a standard system. It has pre-determined layers such as Base, Fringe, and Collision. However, I've run into a bit of a problem. I don't know how many Fringe layers to use.

I'll be working with fairly detailed tilesets and will want enough Fringe layers to be able to render a wide variety of fairly complex scenes (e.g., forests with lots of trees overlapping).

I'm also considering having multiple Base layers to enable things like a player walking both over and under a bridge.

So my question is this: Is there a "right way" to approach this situation, and if so, what is it? Just lots of Fringe and Base layers? If you were a map editor, how would you expect/want this situation to be approached?

Also, while I have this question here, is storing layered maps in 3D arrays a good way to go about things? Meaning the first level is an array of layers, the second is an array of tile columns within the layer, and the third is the array of tile rows within the column.

sentences:
Storing a List to PlayerPrefs Not Working I have a test database of 37 records and I have stored each column into a list and I am storing each record into PlayerPrefs.

void storeStarData()
{
    // Code to store star data in PlayerPrefs...
    PlayerPrefs.SetInt("totStars", NumOfStars);
    int i = 0;
    while (i < NumOfStars)
    {
        PlayerPrefs.SetString(("starID" + i), StarIDID[i]);
        PlayerPrefs.SetString(("starName" + i), StarName[i]);
        PlayerPrefs.SetString(("starHIP" + i), StarIDHIP[i]);
        PlayerPrefs.SetString(("starHD" + i), StarIDHD[i]);
        PlayerPrefs.SetString(("starHR" + i), StarIDHR[i]);
        PlayerPrefs.SetString(("starGL" + i), StarIDGL[i]);
        PlayerPrefs.SetString(("starBF" + i), StarIDBF[i]);
        PlayerPrefs.SetString(("starRA" + i), StarRA[i]);
        PlayerPrefs.SetString(("starDec" + i), StarDec[i]);
        PlayerPrefs.SetString(("starMag" + i), StarMag[i]);
        PlayerPrefs.SetString(("starCI" + i), StarCI[i]);
        PlayerPrefs.Save();
        i++;
    }
    PlayerPrefs.Save();
    Debug.Log(PlayerPrefs.GetString("StarID0"));
    Debug.Log(PlayerPrefs.GetString("StarID1"));
    Debug.Log(PlayerPrefs.GetString("StarID2"));
    Debug.Log(PlayerPrefs.GetString("StarID3"));
    startSimulation();
}

First record in list StarIDID[0] = 1
Last record in list StarIDID[36] = 37

At the end, I've added 4 Debug.Logs that return the IDs of the first 4 stars. For some reason, only the first StarIDID is being stored into Player prefs.

Here is the output of the Debug.Log:

As you can see, StarID0 is the only PlayerPref with a valid value stored, the other ones don't have any values stored in them for some reason.

Is there a way to fix this and am I doing anything wrong here?

sentences:
Client side prediction on FPS game I've recently attempted to develop a simple client prediction for an FPS based on Gaffer on Games famous blog (http://gafferongames.com/game-physics/networked-physics/).

Now I've gotten to the point that everything works (more or less), my main problem is crossing the message sent from the server and finding the appropriate snapshot on the client. I can use the last/average ping time to find a very near state, but it will never be exactly timed/placed as on the server.

So my question is - how exactly can I sync and find the time stamp sent from the server to the client and find which snapshot is the correct one on the client?

sentences:
Love2D : How can I keep up with lots of small sprites' collision data? So I'm using a SpriteBatch to keep up with lots of small pieces for a falling-piece puzzle game. I have an array of Quads (for different color blocks), and they are randomly added to the aforementioned SpriteBatch. Right now, the game determines when the current piece has hit the ground, then that piece is stopped and a new piece spawns that the player now can control.

In order to figure out when to stop dropping the piece, I need to do a collision check. This shouldn't be hard, because I should only have to check the falling piece (unless the current falling piece causes a chain reaction). But, what type of data structure should I use? I can't use the position data of the individual Quads, because the boundary boxes will actually be a different size/shape than the pieces (think triangle pieces, but I will need to use a slightly skinnier rectangle to fit upside-down pieces in between right-side up pieces).

Should I just duplicate the (x, y) pairs using offsets with a width and height, and store them in an array, or am I missing a more obvious/efficient way? I'm guessing that the play screen could fill up with several hundred of these pieces, and if I add two player mode, double that.

EDIT: Here's what the Quad size issue is all about:

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:
What values to construct "Projection Matrix" from? I am curious to what standard values I should use to create a camera's projection matrix, as well as if certain measurements need to be taken if I want to represent a very small world or a very big world and make it feel natural.

What values (field-of-view, nearplane, farplane) to construct a projection matrix should be used if:

1 unit to represent 1 meter?
1 unit to represent 1 cm?
1 unit to represent 100 meter?

sentences:
How do I compute the point of a triangle-ray intersection? I have a line (the direction vector of the player) and a triangle representing the face of a model (so composed of 3 points).

I can't find the mathematical operation to check if that vector is intersecting with this triangle, and how far from the player...

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 to implement multicolored flashing sprite effect like in Contra and the Messenger? I want to implement an effect similar to what you see in this clip of Contra.

When the boss takes damage, he flashes wildly with different colors.

A similar effect can be seen in this clip from the Messenger (with the addition of an outline).

I don't care how they did it in Contra or the Messenger. I want to achieve a similar effect, preferably with a shader using GLSL.

Any ideas on how to go about it?

The effect seems to alternate the sprites between red and blue palettes, but I'm not sure if palette swapping is an effective way to achieve this, especially since I don't have my art assets in gray scale.

Maybe a hue shift shader is a viable alternative? Or maybe there's another way.

sentences:
Unity2D Multiplayer - Spawning player at user's end I am currently into a 2d mobile multiplayer project. Its going to be a 2 player game for now. So the host and the client are the only players.

I am using Unity 5.4 and the default multiplayer platform by the way. I am able to spawn the character both on client and server. The syncing also works pretty well.

But for the game to be user friendly, obviously I have to spawn the player on his end of the screen and the opponent on the other end. I am unable to achieve this on the client screen. In the client screen, the client starts from the upper end of the screen making it difficult to play with.

So, my question. How would I go about spawning a player in his device on his end of the screen and the opponent on the other side? The only idea I came up with was switching the spawn points in the client version of the game. Is it possible accessing client's version of the game during runtime? And would it be the right way to go about it? If not please share an alternate solution.

Thanks

sentences:
Need help drawings planets in Java I am looking for help/links/notes/agorithms/URLs/examples on drawing/rendering spheres in pure Java (so that I can hopefully, one day, generate/render planets with various surfaces & atmospheres)

So for the moment, i'd be pretty happy to be able to start off with just drawing a wireframed sphere(s).

ps: I don't want to use external libraries like Java3D, JOGL or aftermarket engines like JMonkeyEngine, Would rather keep it as straight Java.

sentences:
How can I perform a masked erase in SDL2? I'm trying to implement some shadow/lighting effects in my 2D-project, and I've concluded that if there is an easy way to perform a masked erase on an SDL_Texture, it would make the drawing operations quite cheap.

Let's say I have a texture of the part of the level where light is not meant to be rendered.
I also have a texture with my "light map"; I want to use this to just draw omni lights from my light sources.
Then I want to use the first image to 'subtract' the portions of the light map that are not to be rendered on the final scene.
Then I draw my "light map" texture on top of my scene, with additive blending enabled.

This sounds like a good theory in my head, but I can't see any functions in the SDL2 API that let me do masked erase from a texture.

Am I overlooking something?  Does anything like this exist?

sentences:
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:
Reset 3ds Max 2017 keyboard shortcuts to default I somehow messed up my keyboard shortcuts for 3ds Max 2017. How can I restore them to the default? Is there a default shortcut file I can restore them with?

I'm aware there's a Reset button inside the Keyboard options, but my 3ds Max crashes when I hit that button.

sentences:
How can I display a loading state until a song loaded with www.GetAudioClip() is ready to play? I use www.GetAudioClip() to get a song and play it when my Android mobile game starts.

My issue is that it takes a 3-second delay to play the song.

My idea is to add some loading screen before starting the game, and the game starts after www.GetAudioClip() finishes getting the song and I begin to play it. But I don't know how to control the loading screen so it disappears after the right delay.

sentences:
Game engine design: Multiplayer and listen servers My game engine right now consists of a working singleplayer part. I'm now starting to think about how to do the multiplayer part.

I have found out that many games actually don't have a real singleplayer mode, but when playing alone you are actually hosting a local server as well, and almost everything runs as if you were in multiplayer (except that the data packets can be passed over an alternate route for better performance)

My engine would need major refactoring to adapt to this model. There would be three possible modes: Dedicated client, Dedicated server and Client-Server (listen mode)

How often is the listen-server model used in the gaming industry?
What are the (dis)advantages of it?
What other options do I have?

sentences:
How can I add a transparent overlay to a UI in libGDX? I am attempting to use the following code

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(3,3,3,.3f);
        shapeRenderer.rect(0,0,gameWidth,gameHeight);
        shapeRenderer.end();

So that when the menu is accessed, a transparent background appears. The problem I am facing is that when I try to do this the objects rendered by the SpriteBatch seem to misbehave. Upon further research i found that attempting to nest that code within SpriteBatch.begin() and SpriteBatch.end() is the cause of that. However, If I try to place the code after the SpriteBatch.end(), because the SpriteBatch has ended the objects rendered by it do not appear behind the transparent rectangle.
(I tried assigning SpriteBatch and Shaperender a different camera, however, that didn't fix the problem.) How can I fix this or find another way to implement the transparent background for the menu.

sentences:
3D zooming technique to maintain the relative position of an object on screen Is it possible to zoom to a certain point on screen by modifying the field of view and rotating the view of the camera as to keep that point/object in the same place on screen while zooming ? Changing the camera position is not allowed.

I projected the 3D pos of the object on screen and remembered it.

Then on each frame I calculate the direction to it in camera space and then I construct a rotation matrix to align this direction to Z axis (in cam space).

After this, I calculate the direction from the camera to the object in world space and transform this vector with the matrix I obtained earlier and then use this final vector as the camera's new direction.

And it's actually "kinda working", the problem is that it is more/less off than the camera's rotation before starting to zoom depending on the area you are trying to zoom in (larger error on edges/corners).

It looks acceptable, but I'm not settling for only this. Any suggestions/resources for doing this technique perfectly? If some of you want to explain the math in detail, be my guest, I can understand these things well.

sentences:
Handheld video playback pauses when going to the home screen Put an MP4 movie in your StreamingAssets folder and play it with

Handheld.PlayFullScreenMovie("MyMovie.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput);

Then, in the middle of the movie, go to the home screen and then go back to the game. The video is paused.

You can't resume it because upon tapping the screen the video will disappear because of the CancelOnInput parameter (which I want to keep).

So - how can I make it so when the player returns to the game, the video resumes? I don't want to show video controls.

I am using Unity Pro 5.4.2, running on an iPhone 7 with iOS 10.1.

sentences:
How can I calculate the U,V texture coordinates on a disk at infinity given only a view vector and a vector pointing to the disk's center? I'm using an approach similar to Bruneton's paper on atmospheric scattering for rendering my sky and am trying to extend it to add a textured moon.

Long story short, the paper works by essentially inverting a screen pixel to a world-space vector, then effectively raytracing the sky. To draw the sun, the paper checks the dot product between the sun-vector and pixel view-vector, and gives a "yes hit" or "no not hit" 1 or 0 based on a step function and the angular size of the sun. All of these vectors are unit.

Similarly, I'm doing the same thing to determine if there's a hit on the moon, however unlike the sun, I also now need to determine a texture coordinate. At first I simply subtracted the view vector from the moon vector, normalized the result, then scaled it by the angle between the view and moon vectors. This gives me the correct world-space point, but I'm having a hard time converting this 3-D world space point to a U,V texture coordinate on the intersected moon-disk.

A graphic to illustrate my problem:

My question is this:
Given two unit vectors, how can I calculate a texture coordinate of a point formed by the angle between them?

sentences:
Selling Android game with using Google Play Games I'm making an Android Game that using Google Play Games for authentication, and storing user data to cloud.

Originally I planned this game as free, and put some in-app-purchasement stuffs in it, but unfortunately there is a serious technical issue, so that I have to rid off IAP from my game.

I spent lots of my time to developing this game, and I want to get some reward from my work, so I decided to sell this stuff with reasonable cheap price, but is it ok to sell the game that using Google Play Games? I googled it already, but couldn't find any related information about this.

sentences:
How does OpenGL-ES 2 assemble primitives? Two things I'm quite confused about.

1) OpenGL ES 2.0 creates primitives before the vertex shader is invoked. Why, then, does it not automatically provide the vertex shader the position of the vertex?

2) OpenGL ES 2.0 supports glDrawElements(), but it does not support glEnableClientState() or GL_VERTEX_ARRAY, so how can this call possibly be used to construct primitives?

NOTE: this is OpenGL ES 2.0, NOT normal OpenGL!

Thanks!

Resolution:

I think my confusion was stemming from the built in variable gl_Vertex that some versions of GLSL support (according to some sources, I couldn't find this in the official documentation at http://www.opengl.org/sdk/docs/manglsl/) which gives you the position of the vector provided to the draw command. This isn't present in GL ES. Further, my code was't working, and as GLSL can be difficult to debug, I had no idea what was going on :)

In this case, using vertex attributes and passing the model-space location of the vertices and my transformation matrix allows me to transform the vertices correctly.

sentences:
Observer pattern for clickable 2D Elements? So i am currently thinking about the best way to handle and implement clickable 2D menu elements in a very simple DirectX Game.
I very much like the idea of having subscribers to a event where they are getting notified (e.g. the mouse click).

My question now is: Where and how do i determine which subscriber gets notified by a mouse click? Does the publisher know about all the positional data of the subscribers? Should the publisher just notify all 2D menu elements, so that they need to handle this event (check if the clicked position intersects with their own dimension)? Is this even a good idea?

As already stated, this will be a very basic game, so performance should not be any real issue yet. Still i always like to use some of the best practices, so i will at least learn some part of it (thus i will not implement a complete GUI system, only the subscriber part).

Thank you!

sentences:
Button onClick in a menu prefab doesn't work I don't seem to be able to make a reference to a Button inside a menu prefab.
My menu prefab consists of a panel and the panel has 4 buttons.
I added
public GameObject prefabMenu;

in my code and drag and dropped the prefab in the Unity Editor to it.
When my scene is starting (Start() method) I instantiate this prefab into a GameObject like this:
panelMenu = Instantiate(prefabMenu, canvas.transform);

after that I try to refer one of the buttons with this line and set an onClick listener:
btnResume = panelMenu.transform.Find("BtnResume").GetComponent<Button>();
btnResume.onClick.AddListener(() => Log.I("Working"));

The log method however doesn't not get called when I click on the button (I checked and the btnResume is not null).
I appreciate any help on this. Thank you.

sentences:
How do I save and restore an int value with PlayerPrefs? I am stuck on how to save the player's amount of money. When I build the game in the exe as soon as I shutdown the game my money value gets lost. I want this money to be saved. I am using the following code in UnityEngine:

using UnityEngine.UI; using System.Collections;

namespace CompleteProject
{
    public class MoneyManager : MonoBehaviour {
        public static int money; // The player's money.
        Text moneytext;          // Reference to the Text component.

        void Awake ()
        {
            // Set up the reference.
            moneytext = GetComponent <Text> ();
            money=print(PlayerPrefs.GetInt("Money"));
        }

        void Update ()
        {
            moneytext.text = "" + money;
            PlayerPrefs.SetInt ("Money", money);
        }
    }
}

sentences:
How do I find artists to work on my game? I ask "how" rather than "where" because there are undoubtedly lots of artists that are just plain lousy or unreliable.

Let's assume both paying and non-paying (mods, free games/open-source) positions.

sentences:
GLSL default shaders I've been arming my engine with error checking code. I'll try to describe this situation to my best abilities. Whenever i load a shader and there's an error (file doesn't exist, compilation error, anything that could go wrong) i delete the shader and set the pointer to 0 (can't think of annother way to make sure i don't try to attach or delete trash by accident). I don't want to stop the program if this happens, because somebody might delete or modify a single file by accident in the game folder and don't want to render the whole game unusable because of that.

Now the thing is, is there a default behavior in the situation where i attach shaders to a program that have the pointer equal to 0?

In my program, if i attach a vertex shader equal 0 and a fragment shader equal 0, then OpenGL will use the default program (will display everything white):

This is a rotated cube that's dimensions are in clip space already, rendered without perspective projection or depth checking. It's loaded from an .obj file.

Now, if i attach a proper fragment shader, but the vertex shader will be 0, i get this:

Which is what i would expect, all the fragment shader does is outputs a vec4(1.0, 0.3, 0.7, 1.0), there's no vertex shader so OpenGL uses the default one (is this a correct assumption?).

Now, however, if i attach a correct vertex shader, but i attach a fragment shader equal to 0 (or i won't attach a fragment shader at all) i'll get this mess:

Something you can't see is that this model is contantly being painted different colors, so on my screen it looks like an acid trip with black horizontal lines going through.

I'm confused a bit, because i would expect the cube to just be white. I'd like to point out that my shader code is bare bones, i'm not exchanging any variables between vertex and fragment shaders. Checking if the pointer is not equal to 0 doesn't change anything, the linked program acts the same as if i gave it a pointer equal to 0. The weirdest thing to me is that it's always nicely shaded, it's not just trash.

EDIT: Maybe the default fragment shader expects a gl_ value from the vertex that i'm ommiting to set? That would kind of explain why the surface is nicely shaded, the fragment shader expects a smooth in, but that value is just trash, because i didnt' set it.

Now is this an "undefined behavior" or is this how it's suppoused to work?

sentences:
Unity Proximity Warning System Trigger issues I'm trying to set up a proximity warning system but I'm having some trouble.

To simplify things as much as possible:

I have two game objects in a scene (Object1 and Object2). Object1 has a large child object (twice as large as Object1 or Object2) which has no mesh renderer, but has a box collider (with the Is Trigger box ticked). Object 2 has a rigidbody component.

When Object1 gets close enough that it's child's Box Collider overlaps with Object2's rigidbody, a script on Object1 should Debug.Log the name of the object it's close to once a frame until Object1 moves away.

My code is as follows:

public Collider objectCollidedWith;

void OnTriggerStay(Collider other)
{
objectCollidedWith = other.transform.GetComponent<Collider>();
}

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

Unfortunately, something about my setup isn't working. The console just shows "null" once a frame and the objects getting close doesn't change this.

Can you tell me what I'm doing wrong?

Many thanks for your time.

sentences:
Reliability of Google Analytics data I have developed an iOS game and currently the game is in beta phase. I have integrated Google Analytics (GA) to understand the users' behavior. I am distributing the game to my beta testers using TestFlight.

Recently, I found that number of sessions shown by TestFlight data is not matching with that of GA's data.

I have following questions:

Is GA's data is more reliable than the TestFlight's data?
Is GA suitable analytics solution for mobile games? If not, what are the reasons for that? Is Firebase analytics more reliable compared to GA?
I am looking for an analytics solution which can help to analyze behavior of each user (per user tracking instead of aggregated data). Can Firebase analytics provide this feature?

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences:
Why aren't regular quadratic and cubic splines used much in games? After investigating a bit about splines and reading a bunch of docs, I have noticed regular quadratic and cubic splines are not used very much in games.

Splines using quadratic/cubic Bézier curves, Catmull-Rom, B-splines, and other spline interpolation methods seem to be used widely though.

I can be totally wrong here but from books and tutorials I have seen that for regular cubic/quadratic you have to solve systems including first derivative for continuity and second derivative to match curvature. It seems that the most used splines (Bézier, Catmull-Rom, etc...) implicitly bring these features with fewer calculations.

Is this the reason that regular quadratic and cubic spline interpolation are not often used in game programming?

sentences:
How to create JSON file in notepad that will hold my positional vector3 data for one type of object I'm trying to get my head around using JSON files to store level data . Specifically in this example is to make my walls. (its a top-down game like pacman). Each wall prefab is a 1x1x1 cube. I just want the JSON to hold the x,y,z. I have seen tutorials about how best to deserialise the data into Unity and I think im fine doing that, but I am unsure of how exactly to word the JSON file.

I see the example on Unity docs says the format is like this:

{"level":1,"timeElapsed":47.5,"playerName":"Dr Charles Francis"}

so, I could just do something like:

{"index":0,"x":5,"y":1,"z":0}

but I know that there needs to be a bit above, similar to XML and of this im clueless of what it needs to contain.

I looked on Json.org but i didnt really understand it still. This is one example:

{
"glossary": {
    "title": "example glossary",
    "GlossDiv": {
        "title": "S",
        "GlossList": {
            "GlossEntry": {
                "ID": "SGML",
                "SortAs": "SGML",
                "GlossTerm": "Standard Generalized Markup Language",
                "Acronym": "SGML",
                "Abbrev": "ISO 8879:1986",
                "GlossDef": {
                    "para": "A meta-markup language, used to create markup languages such as DocBook.",
                    "GlossSeeAlso": ["GML", "XML"]
                },
                "GlossSee": "markup"
            }
        }
    }
}

}

But what is 'Glossary' and 'title' in the context of my game? All I currently have is a cube called Wall, with a script attached called Wall.cs that currently does nothing, but I will be making an array of Wall and plan on using the deserialised data from the json file to lay the Walls[] out using my GameController.cs

Once  I know what to put above and below to open and close the JSON file off, im pretty sure I can get it working how I need it to. I hope that made some sense.

sentences:
Stop movement if transform.position.y == 0 Why does the following code not step the object's movement when its y coordinate reaches zero?

    public GameObject cube;
    private GameObject inst;
    public float speed=5;

    void Start () {
        inst = Instantiate(cube, new Vector3(0, 10.6f, 0),Quaternion.identity);
    }

    void Update () {

        inst.transform.Translate(speed * Vector3.down * Time.deltaTime, Space.World);

        if (inst.transform.position.y == 0)
        {
            speed = 0; //stop moving
        }
    }

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:
How to disconnect all signals of an emitter? This a follow-up question of this one
I want to disconnect multiple signals before using queue_free().
In docs we have:
void disconnect ( String signal, Object target, String method )

Is it possible to disconnect all signals of an emitter without using the names of the signals or methods involved?

sentences:
XNA - Darkening background and drawing something on top In a game a group of friends and I are working on using XNA, we wanted to create an effect where we could darken the screen and draw something else on top of the darkened portion. For example, we have a title screen that is drawn as a background sprite, a logo, a few buttons, and a lot of particle effects (all separate Texture2D's), but when you select the "Exit" button, the entire title screen darkens, and two (undarkened) buttons are drawn over-top ("exit" and "cancel" buttons).

Initially, we were going to do this by having two separate render targets, one for the title screen, and one for the yes and no buttons. Then, when we wanted to display the topmost render target, we darkened the render target that the title screen was drawn to, and then draw the new render target on top. The problem with this is that the second render target is filled with black pixels that simply get drawn over the background, blocking it out completely.

We have two ideas to fix this. The first idea is to draw the second render target on top of the first using BlendState.Additive, so that the black pixels are simply added to the background instead of drawn over-top. The problem with this is that it makes the other buttons look weird, since they're being drawn over top other things on the title screen. The second idea was to manually set every black pixel in the second render target to Color.Transparent, but we're not sure how efficient that is.

Any ideas on how we could achieve this effect?

sentences:
Implementing a switch statement based on user input I'm trying to delay the time it takes for the main menu screen to pop up after a user has won / lost a match. As it stands, the game immediately displays a message stating "you won / lost" and waits for 6 seconds before loading the menu screen.

I would also like players to have the ability to press a key to advance to the menu screen immediately but thus far my switch statement doesn't seem to do the trick. I've included the switch statement, along with my (theoretical) inputs. What could I be doing wrong here?

if (gamestate == GameStates.End)
                    switch (input.IsMenuDown(ControllingPlayer))
                    {
                        case true:
                            ScreenManager.AddScreen(new MainMenuScreen(), null); // Draws the MainMenuScreen
                            break;

                        case false:
                            if (screenLoadDelay > 0)
                            {
                                screenLoadDelay -= gameTime.ElapsedGameTime.TotalSeconds;
                            }
                            ScreenManager.AddScreen(new MainMenuScreen(), null); // Draws the MainMenuScreen
                            break;
                    }

     /// <summary>
    /// Checks for a "menu down" input action.
    /// The controllingPlayer parameter specifies which player to read
    /// input for. If this is null, it will accept input from any player.
    /// </summary>
    public bool IsMenuDown(PlayerIndex? controllingPlayer)
    {
        PlayerIndex playerIndex;

        return IsNewKeyPress(Keys.Down, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.DPadDown, controllingPlayer, out playerIndex)
               || IsNewButtonPress(Buttons.LeftThumbstickDown, controllingPlayer, out playerIndex);
    }

sentences:
How to stop SDL from freezing the rendering while resizing the window? I have a simple SDL application with a re-sizeable window. If I minimize it and then maximize the window the rendering freezes. I've included a simple code example below which makes the screen flash through varying shades of grey. Try minimizing and then maximizing the window, and you can see that the rendering halts while the window is resizing. How do I stop the rendering freezing when going from minimized to maximized?

//FLASHING SCREEN CODE
//Demonstrates screen freeze when you minimise then maximise the screen....

#include "SDL.h"

using namespace std;

int main( int argc, char* args[] )
{
    //Initialise SDL2, declare Window + Renderer
    SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ); //Initialize SDL for video and audio
    SDL_Window* pWindow = NULL;
    SDL_Renderer* pRenderer = NULL;
    pWindow = SDL_CreateWindow("Minimise Maximise Test", 50, 50, 1200, 600, SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED);
    pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_TARGETTEXTURE);

    //The Screen colour which is going to flash through different shades of grey
    SDL_Color screenColour = {0, 0, 0};

    //SDL event for detecting X-out (quit)
    SDL_Event event;
    bool quit = false;

    //Loop
    while( quit == false )   //While SDL has not been X'ed out
    {
        //Handle quit
        if (SDL_PollEvent(&event) != 0)
        {
            if(event.type == SDL_QUIT) quit = true; //Press X-out to quit (but not visible on fullscreen)
        }

        //Make screen flash by changing its colour through shades of grey
        screenColour.r++;
        screenColour.g++;
        screenColour.b++;

        //Render the screen
        SDL_SetRenderDrawColor(pRenderer, screenColour.r, screenColour.g, screenColour.b, 255);
        SDL_RenderFillRect(pRenderer, NULL);
        SDL_RenderPresent(pRenderer); //like SDL_flip
    }

    //Shutdown
    SDL_DestroyRenderer(pRenderer);
    SDL_DestroyWindow(pWindow);
    SDL_Quit();

    return 0;
}

I'm currently running SDL2.0 v 2.0.3 on Windows 10 machine (experienced the same problem running on previous Windows 7 machine).

sentences:
Mismatch of Entity System and Savegames There is a theoretical mismatch of the entity system and the savegame system, which is think is common, but I haven't found resources about that. Therefore I will explain both systems first, as short as possible. I would really appreciate any thoughts and solutions for this conceptual problem.

Entity system

I have an entity system for my game. That means there is a function to create a new entity that simply returns a unique integer id. And there are functions to add, get and remove properties, thus any C++ objects, to a given id.

An entity id is just a contiguous integer, which is stored as a member. When a new entity is created, this number is incremented by one and returned as the new id. When entities get deleted, only all of their properties are removed and freed but their id actually remains and is not given to a new entity again.

Now you know the basics of my entity system. As an example, an entity might have properties for physics simulation, character animation, health and skill points, camera to render from its view, and so on.

(Originally, I described my entity system in more detail. But it wasn't directly related to this question and and wanted to shorten the question. It can still be viewed in the revision history.)

Savegame system

Previously, there was no savegame system and I created all entities as new ones on startup. But now I want to save the state when closing the application and load that on startup so that the player can continue where he left off.

I use SQLlite for storing, where each type of entity property gets its own table. I haven't decided yet if each row should store the entity id as primary key. Because this is part of my current problem.

Mismatch of both

Unfortunately, I cannot just store simply all of the entities to database, because some entities are only temporarily valid. For example the window property that holds a window handler from the operating system, which must be requested every startup. Or the meshes which aren't kept in memory, but just hold the VBO ids to the vertices on the GPU.

So I have to store some, but not all entities. I could store their entity id in the SQLite table and allow the entity system to add entities by a given new id. But I cannot guarantee that this id isn't already used by entities that where newly created at startup. Do you see the mismatch?

Can can I store the entity id to table, and still ensure that when being loaded, no other entity shares this id? Or how to restructure and rethink my entity system and savegame system to overcome this issue, in general?

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:
How to set speed of circular motion Edit 2 - clarification

Just to clarify, the issue I have at the moment is how I specify a time (in seconds) for a complete revolution to occur.  My delta is fixed and is 1/ticks per second (1/60).  As you can see with my linear sprite movement, I have a 'time' variable which is where I specify (in seconds) how long the sprite should take to travel the length (or height) of the screen. I'm looking at how I do this for circular movement.

Edit 1 - Results from suggestions

See at end of question.

Background

When moving my sprites along a straight path, I'm using delta so I can get the same rate of relative motion on all devices like so:

spriteGridX = 240/480;  //I start out with a virtual 'Grid' so I can scale position to all resolutions etc so 240/480 would place the sprite at the center of the screen (X)

spriteScreenX = spriteGridX * width;  //Scale to physical screen where width is the width of the current devices screen (viewport)

spriteXTime = 8f; //8 being the amount of time in seconds that this sprite will take to traverse the entire width of the screen

spriteXVel = 1/spriteXTime; //Velocity that will be used to move the sprite along the virtual grid position

So, when I need to move the sprite, I simply do the following:

spriteXGrid+= (spriteXVel * Delta) //+= for right -=for left. I'm using a fixed delta time
spriteScreenX = spriteGridX * width; //And again, convert to usable screen position for current device
drawsprite(spriteScreenX, SpriteScreenY); //Draw the sprite (drawSprite is just a method I've written to draw openGL quads and it takes the screen X and Y as coordinates - spriteScreenY not shown here but essentially same as X with height instead of width.

Now, I need to have a sprite move along a circular path. So far, I have a test up and running which directly acts on the 'screen' coordinates of the sprite directly like so:

Java Code

int rad = 25;
float angle = 50;

spriteScreenX-=Math.round(rad*Math.cos(angle));
spriteScreenY+=Math.round(rad*Math.sin(angle));
angle+=.1;

The Problem

Now, the above does work, but the sprite completes it's circular path way too quickly (it's doing approximately 1 revolution per second).

So my question is:

Am I doing this correctly and if so..........
How do I slow this down?  I won't particularly need to keep changing the speed, I just want to be able to set it initially.

Would really appreciate some pointers.

Edit 1

When I put the following the code above I get the following result:

If I put the following:

spriteScreenX-=Math.round(rad*Math.cos(angle*Math.PI/180*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*Math.PI/180*delta));
angle+=.1;

Or:

spriteScreenX-=Math.round(rad*Math.cos(angle*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*delta));
angle+=.1;

Something like this happens:

sentences:
How do I create an Ubuntu snap for a MonoGame application? I've been going through the snapcraft documentation and examples and I'm still really confused about how to go about creating my snapcraft.yaml file.

Basically I have a folder with my game in it.  The folder contains all the files that are needed to run it.

I just want it to copy the files onto the end user's computer and have the shell script that launches the game targeted.

Here is my yaml file:
https://gist.github.com/c349bc23febbe73a6976b83b7757f887

Here are the contents of my directory:
https://github.com/SoundGoddess/OpenSolitaire/releases/download/0.9.2/OpenSolitaire.Classic.0.9.2.Linux.tgz

When I execute "snapcraft snap" I get the following error:
'NoneType' object has no attribute 'lstrip'

It looks like the parts folder gets generated ok, but then it fails on the build:

kati@linux:~/Development/OpenSolitaire.Classic$ snapcraft snap
Skipping pull opensolitaire-classic (already ran)
Preparing to build opensolitaire-classic
Building opensolitaire-classic
'NoneType' object has no attribute 'lstrip'

Any help would be greatly appreciated :)

sentences:
Procedural star field generator Is anyone aware of any code to procedurally generate star fields?

Ideally I'd like it to be physics-based so I can have realistic planets and moons.
Best would be in C++, open source, and workable with Ogre3d.

I'm not afraid of coding something from a university paper if there's nothing available.

sentences:
Selected enemy off camera I'm facing a problem with a game I'm making.
Currently I can select an enemy and mark it as shown on the image:

But now I want to show the position of the selected enemy on the screen when it's off camera.
So my questions are:

How do I know when an enemy is off camera.
How can I show in GUI an arrow on the edge of the screen that points to the position of that enemy. Perhaps something related to what I did to point towards the crosshair?

Vector3 positionOnScreen = Camera.main.ScreenToWorldPoint(mousePos + Vector3.forward * range);
Vector3 targetDir = positionOnScreen - transform.position;

Thanks!

sentences:
Use ramp and steps meshes as actual ramp in unreal engine 4.26 Is it possible to use a ramp mesh as an actual ramp in UE4? It seems that the system create a rectangle box around the ramp o the character does not climb the ramp, it is over it like on a box.
I know that we can use landscape ramp's generator, but it's one more step that could be avoid.
thanks guys!

sentences:
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:
Finding inspiration / help for making up (weapon) names I'm really bad with words, especially with English words. Currently I'm struggling to make a good weapon names for my game, it needs to display the weapon functionality (weak/strong/fast/ballistic etc) correctly as well. For example the best weapon in a (futuristic) game cannot be called just with the name "Laser", it's just too boring, right?

Are there any tools, websites or anything that helps me finding good names for weapons? (or anything else similar).

I was thinking to use scientific names, but noticed that they are really hard to write, and they get very long, and I also lack information about science, I only know I could use the atomic sub-particles names in the weapons for example.

How do I get started with becoming good with making up names? (this could apply in generally to any naming problems).

sentences:
How to organize a fallback system for older GPUs in OpenGL? I don't want to make this question too broad or opinion based, but I really need some help about good practices.

The scenario:

I created a particle engine with functions which require at least OpenGL 4.3. But some GPUs don't support this version, so I want to try to implement a fallback system for it.

But it's not only the particle system. There are many features in 3D engines that can't be simply replaced by a different function name. Some features need different logic behind them and it can go quite complex.

What are the best practices to manage fallback rendering in OpenGL?

sentences:
Find transformation to align two polygons at fixed points? Problem

I have a source image (arbitrary width and height c) shown here as a rectangle [X1,X2,X3,X4]. It contains two points C and D (both known coordinates within the image - X4 / top left).

Then I have a target image (might have different height a and width b than source image) that contains two points A and B (|AB| doesn't necessarily equal |CD|). There's also a source of projection S.

I need to somehow calculate coordinates of a transformed rectangle (polygon) such that:

Point C will always be mapped to A (therefore A will be equal to C) and D will be mapped to B (B = D)
Point X3 of this newly calculated polygon will lie on a line between S and A/C (now identical)
Point X4 will lie on a line from S to B/D.
Distance from parallel lines [X1,X2] and [X3,X4] will be still c. (If it turns out that it's not always possible to construct such a polygon the condition 4. can be dropped, and [X1,X2] don't need to be parallel to [X3,X4] as well)

(see below)

What I've tried

I thought I will solve it by:

shrinking width of source image by ratio of |AB| and |CD|
aligning C with A (move source image)
finding angle difference  between AB and CD
rotating source image by angle  (with center in C/A)
calculating X3 and X4

But it doesn't work universally. Steps 1-4 work well, but then changing X3 and X4 moves C (resp. D) away from A (resp. B).

sentences:
libgdx+android: White screen after re-create() but not resume() I have this weird issue only on android where if I push the home button, when I get back into the game it passes through resume() and it display by background texture correctly. But if I push the back button it destroy and when I get back it the game it calls create(), but it draws the background as a white texture instead.

I searched a bit on the subject and what I know so far:

Android static variables are not reinitialized on activity recreation, so you must make sure that create() will initialize those variables.
OpenGL will free the textures when the application loses focus, so this is why they must be reloaded when the application resume.

Unfortunately, even having this information in mind while programming did not fix the issue. I'll just show important portion of the code below:

// The asset manager is created statically, but not initialized
private static AssetManager _manager;

//Then during the create() and resume() method, the manager is initialized and all the
//textures will be loaded afterwards.
_manager = new AssetManager();

//When the app is destroyed, dispose() is called and the manager is nullified
_manager.dispose();
_manager = null;

So given the code above, if the application is destroyed or resumed, they will both pass into the same initialization method that creates the assets manager and load textures.

So why it only works on resume() and not on create() when the same code is actually called.

A quick fix that worked was something I found on this forum which consisted in killing the application on disposal with the following code in the android project:

//SOURCE: https://gamedev.stackexchange.com/questions/102079/screen-not-rendering-after-restarting-game
@Override
protected void onDestroy() {
    android.os.Process.killProcess(android.os.Process.myPid()); // this line will kill process
    super.onDestroy();
}

But I am not sure it is the right way to do things.

sentences:
Why do my sprites stutter when I move them too quickly? The Problem
I have some sprites animating across my screen (some spaceships).
I alter their X coordinates (like -5, for animation) in my game loop.

I want the animation to happen faster, however when I alter their coordinates too much (like position-=5 each time), the animation becomes jumpy and stutters.

For example, decrementing objects xPosition by 1 = slow moving smooth animation
But, decrementing objects xPosition by 5 = faster, but choppy/stuttering animation

What I've tried
The only way I can think is to make my game FPS like 100 with a lower position incrementing speed, which is extremely wasteful.

My game loop is below.
(I know this isn't a great game loop, but its one of the few I understand. I also can't see how it would be a problem for this example)

private final int FPS = 60;
private final long TICKS = 1000/FPS; //16.67ms per update max

public void run() {
    long startTime = System.currentTimeMillis();

    while(gameRunning){

        cycleEnemies();
        repaint();

        startTime += TICKS;

        sleepTime = startTime - System.currentTimeMillis();

        //So timeout isnt negative
        if(sleepTime > 0){
            try{
                Thread.sleep(sleepTime);
            }catch(InterruptedException e){
                System.out.println("Interrupted: " + e.getMessage());
            }
        }else{
            //We're running behind!
        }
    }

}

And this is my cycle method:

    private void cycleEnemies(){
        for(Enemy e : enemyShips){
            e.setXPosition(e.getXPosition() - 5);
        }
    }

This is my drawing code:

private void drawEnemy(Graphics g){
    //Loop through enemyShips array, drawing all
    for(Enemy e: enemyShips){
        g.drawImage(e.getTexture().getImage(), e.getXPosition(), e.getYPosition(), null);
    }
}

sentences:
Kinect for Xbox One (+ adapter) and Windows 10 Can I use Kinect Xbox One (with adapter like Kinect for Windows V2 device), SDK 2.0, to build applications on Windows 10? I've read the requirements for Kinect and it lists only Win 8.0 and Win 8.1.

I'd like to use Kinect Xbox One device with Unity 3D and Hololens. Before I buy the device I'd appreciate if anyone can share some experiance or at least to confirm that would be possible to develop apps with Kinect for Xbox One on Win10?

Many thanks.

sentences:
Enable and disable different component on a Gameobject So far I am not clear how do you actually access the various components on a game object, to enable and disable them.

I have a component that has various scripts and elements, like a camera, transform, audio listener and few other custom scripts.

It is in the scene, so I try to access to it via script:

private GameObject _player;

_player = GameObject.Find("the_player")

So far so good; if I want to access for example to the camera, and enable or disable it, I can do it

    _player.GetComponent<Camera>().enabled = true;

This disable correctly the camera, or eanble it, depending from the paramenter that I pass.

Now, if I want to access my script, called "playerscript"; I can't do the same thing, since I get an error:

    _player.GetComponent<playerscript>().enabled = true;

Not sure why I get an error; I have a class that is called "playerscript", that is attached to that _player object, but instead, VS complain.

This is the error message:

Error   CS0246  The type or namespace name 'playerscript' could not be found (are you missing a using directive or an assembly reference?)

I did try to use also GetComponentInChildren, but the result is the same.

If I have the object _player, which hold a reference to the original game object instantiated in the scene, why I can't simply access all the elements attached to it, via GetComponent and dot notation? I believe this used to work time ago, but in Unity5 I can't get this to work.

EDIT: This is the content of the playerscript class:

using UnityEngine;
using System.Collections;

public class playerscript : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        // get the instance of the button from UI manager
    }

    void OnTriggerEnter(Collider world_item)
    {
        //enable item animation
    }

    void OnTriggerExit(Collider world_item)
    {
        //disable item animation
    }
}

sentences: When should I talk to a lawyer about intellectual property for an indie team? Let's say you have a team building a decent game and all is well technically and people-wise. You feel pretty sure you'll get to a product that can be sold. How does an indie studio (with good practices in this domain) typically manage the IP, esp. trademarking and copyrighting? When's the right time to do this, early or later?

sentences:
How can I tell a fragment shader to not write a particular pixel? In a WebGL I'd like to send a screen space quad through that gets processed by a fragment shader, but have the fragment shader only write out a pixel under certain conditions (say... that it was within a circle, or that the pixel belonged to the positive side of a halfspace defined by a curve equation or something).

Is it possible within a fragment shader to say "don't write a pixel"?

I know this could be accomplished using various other methods like alpha blending, rendering this first and having it put the background color where it doesn't want to draw a pixel, or maybe doing some trick with the depth or stencil buffers.  I also know i could create a bunch of geometry to match what it is that I want to render.

Is there a way though to make the fragment shader choose not to write a pixel at all?

sentences:
Custom Coloring of Tileset Characters Games like Dwarft Fortress and Dungeon Crawl Stone Soup are drawing their boards using tiles from a tileset image (I think?). I know you can do color keying and replace the background color with transparency or another color, but how are games like these drawing the text characters into different colors? Using the same method? I am trying to find the best way to use a tilesheet to draw ascii graphics and be able to choose what color the text is, and what color the background of the tile is separately.

Something similar to what is pictured here.

sentences: Disable spaces in InputField This is straight forward. I have an input field and I want to restrict the user of inputting any spaces. I was thinking to make a script that checks if the user typed in a space and then remove it, but is there a simpler way of doing this?

sentences:
Game state and input handling in component-based entity systems My question is:

How can I handle game states in my entity system, without resorting to keeping a stack of game state objects around?

So the design of my entity system means that when an entity needs to register for input events for instance, the input component calls the input system and says "register this entity for this input". This is all fine and well, however if you add into this the concept of game states (say a pause screen), it becomes a problem to work out if an entity is in the current state and should receive the input.

I could augment the input component/system so that it says, "register this entity for this input while in these game states", but this requires that every entity know which states it's going to be used in, and that may not be obvious. Also, keeping a list of game states around per registered input (and other systems that use callbacks) doesn't sound too efficient.

Another idea I had is since there will be an entity that represents the game state, mark that as being disabled, then when generating the input event check that the entity is not a descendant of a disabled game state entity. Seems expensive to work out the parent for every callback.

Another idea is to have all the systems store their data keyed against the current state, that way when generating the input, the target entity won't even be a candidate. However this really hurts the ability to allow communication between entities in different states (not so much a problem for pause screens, but think lock picking in Oblivion/Skyrim).

The only other idea I've had is to have all components handle a state change events and communicate with their relevant system to disable anything they have registered, and re-enable it when switching back to this state.

The second (mark an object as disabled) and forth (have each component deal with state changes) seem like the best of my ideas, but none of them jump out at me as being particularly great.

Does anyone else have any other ideas on how to do this?

edit While I talk about input specifically in this question, it can mean any system capable of sending messages/events to entities, such as collisions, timer events, etc...

sentences:
Changing Unity Rigidbody.centerOfMass throws off AddRelativeTorque() calculations This is an odd one, that has me kind of stumped. If I execute the code:

void FixedUpdate()
{
    rigidbody.AddRelativeTorque(0, 1000, 0);
}

I get this:

Normal, expected behavior. The (car in this case) rotates fine around Y. But if I try and change the center of mass,

void Start()
{
    rigidbody.centerOfMass = new Vector3(0, -0.2, 0.9);
}
void FixedUpdate()
{
    rigidbody.AddRelativeTorque(0, 1000, 0);
}

The car spins on all 3 axis. AddTorque has the same problem. It is as if AddRelativeTorque/AddTorque are not accounting for the moved position of the center-of-mass. This was done in an empty Scene with the car floating at 0x 0y 0z.

sentences:
Suitability of ground fog using layered alpha quads? A layered approach would use a series of massive alpha-textured quads arranged parallel to the ground, intersecting all intervening terrain geometry, to provide the illusion of ground fog quite effectively from high up, looking down, and somewhat less effectively when inside the fog and looking toward the horizon (see image below).

Alternatively, a primarily shader-based approach would instead calculate density as function of view distance into the ground fog substrate, and output the fragment value based on that.

Without having to performance-test each approach myself, I would like first to hear others' experiences (not speculation!) on what sort of performance impact the layered alpha texture approach is likely to have. I ask specifically due to the oft-cited impacts of overdraw (not sure how fill-rate bound your average desktop system is). A list of games using this approach, particularly older games, would be immensely useful: if this was viable on pre DX9/OpenGL2 hardware, it is likely to work fine for me.

One big question is in regards to this sort of effect:

(Image credit goes to Lume of lume.com)

Notice how the vertical fog gradation is continuous / smooth. OTOH, using textured quad layers, I can only assume that layers would be mighty obvious when walking through them  -- the more sparse they were, the more obvious this would be. This is in contrast to where fog planes are aligned to face the player every frame, where this coarseness would be much less obvious.

sentences: LibGDX Texture blending I have two textures 1 and 2, and a "mask" image 3. I'd like to interpolate between the two textures by using the mask image, and get something like 4. I'm not really sure where to start, as I never did "blending" like this before. Can I do this with the SpriteBatch class, or do I have to make my own shader for this effect?

sentences:
Unity [MenuItem] disappears when `priority` is 100 Create these classes:

public class MyTestComponent : MonoBehaviour
{
}

-

[CustomEditor(typeof(MyTestComponent))]
public class MyTestComponentEditor : Editor
{
    [MenuItem("GameObject/XXX/DoTest", false, 100)]
    private static void DoTest()
    {
        Debug.Log("DoTest");
    }
}

save, and check if there is a new menu item in the context menu and it won't be there. Now change the priority parameter to 10 or 1 and try again - it won't appear anyway. Sometimes even commenting/uncommenting and reloading the editor doesn't help.

Is this a bug or am I doing something wrong?

sentences:
How to improve my maxscript random blood generation code? The idea was simple. Draw basic blood drop meshes. Shuffle them with random generator to get final drop's. Export and render them in game as other meshes.

The problem is that it's not looks like a blood drop, but a rocks.

What is the best way to improve this? Redraw basic drops? Apply some modifier to final drop mesh? But what modifier? How to smooth borders in final drop mesh? I am totally stuck with this. The improvment must be codeable in MAXSCRIPT, not a manual correction of mesh, because I am a programmer not 3D modeller.

The generator final result screenshot.

Final blood drop:

P.S. For those who would like to test generator manually here it goes the prooflink. Works nice at 2010 version.

sentences:
Java vs Javascript for Web-based games With all the recent interest in developing HTML5 apps and games, and I am curious why all the focus is on Javascript, and not on Java.

Minecraft is a great example of what can be accomplished in a browser, and it's written in Java, not JS. I doubt if it is even possible/practical to attempt such a complex project in JS.

Java is clearly a more powerful platform, and it probably runs significantly faster (this is just my guess, though). About the only drawback of Java I can think of is that it runs as a plugin, and with the trend towards plugin-free browsers (e.g. IE10 metro) Java applets may become obsolete in mobile environments. This has already happened with Flash on iOS.

What do you think? Is there a future in developing Java-based Web apps (especially for mobile devices)?

Thanks

sentences:
Program compiled with assimp will not start I have recently updated my game engine source code to use the visual studio(2017) vc141 toolkit.

I am using Assimp 3.1.1 for model loading. The project compiles and links, and the appropriate dll's are in the debug folder for the solution.

To begin with I was getting a missing dll error "assimp-vc140-mt.dll", which disappeared, when I redownloaded the library, and replaced the dlls/libs/includes, in my solution.

But now, when I try to run the program I get:

"The application was unable to start correctly (0x000007b). Click OK to close the application."

I've never seen this error before. Could this be related to the new toolkit?

sentences: Why must VBOs be "broken in?" If I create a VBO in LWJGL of, say, 128,000 vertices, and push it to the graphics card, there's a considerable delay. This delay lasts for about 11 to 12 milliseconds. The same thing happens the second and third time I push the (slightly changed) array. However, after that, the length of the delay sharply drops to between 1 and 3 milliseconds. Why exactly does this happen? I can't seem to think of a plausible reason for this phenomenon; perhaps someone could shed some light onto the situation?

sentences:
Simulate wind in a powder game I would like to create a game similar to powder game.

I've got a 2d array that stores different types of powder such as sand, water, gas, and fire. I've managed to get these to all move around successfully.

I would now like the powders to react to wind. For example if there is fire it should push air upwards. If the air is moving upwards it will move other bits of powder around.

The way I've been trying is to have two more 2d byte arrays. One for the wind x direction and another for the wind y direction. The fire will then add an amount to the cells and each update will add the wind x and y to the piece of powder that is on that cell. This almost works but pushes the powder much to fast.

The difficulty in doing this is that the powder is on a grid while the wind could be going a variety of directions.

What is the most efficient way of doing this?

sentences:
Spawn scene object not found for 1 I'm getting this error with the new Unity Networking (5.1):

Spawn scene object not found for 1
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

This happens in the client, when it connects to the server: the server is file, while the client fails to load the scene. I guess this error means "I failed to load the (online) scene" (which in fact it is the scene number 1), but I've no clue why it does fail.

The server has a custom player spawning function:

public class NetworkDirector : NetworkManager
{
    public override void OnServerConnect (NetworkConnection conn)
    {
        base.OnServerConnect(conn);

        Transform spawnPoint = FindObjectOfType<SpawnPoints>().getNextSpawnLocation();
        GameObject spawned = FindObjectOfType<InstancedElements>().SpawnObjectFree(playerPrefab,spawnPoint);

        FindObjectOfType<CameraFollow>().SetTarget(spawned);
        NetworkServer.AddPlayerForConnection(conn,spawned,0);
    }
}

sentences:
Anti- Aliasing a small image? As you can see above, I have an image of a game I've been working on using Java. Using AWT I added the following:

public static void drawImageRotated(
        Graphics2D g2d, BufferedImage img, double x, double y, int scale, double angle) {

    BufferedImage image = new BufferedImage(
                                     (int)(img.getWidth() * 1.5D),
                                     (int)(img.getHeight() * 1.5D),
                                     2);
    Graphics2D g = (Graphics2D)image.getGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.rotate(Math.toRadians(angle), image.getWidth() / 2, image.getHeight() / 2);
    g.drawImage(img,
                image.getWidth()  / 2 - img.getWidth() / 2,
                image.getHeight() / 2 - image.getHeight() / 2,
                null);
    g2d.drawImage(image,
                 (int)x-(image.getWidth()*scale/2),
                 (int)y-(image.getHeight()*scale/2),
                 image.getWidth()*scale,
                 image.getHeight()*scale,
                 null);
    g.dispose();
}

This is the code which draws the ships onto the screen. As you can see there is a blue and a cyan ship on the screen, the blue ship's rotation being 0 and the cyan having a rotation of just over 270 degrees. The cyan ship is distorted and that's what I want to get rid of. Is there an anti-aliasing for small images like that one (16x16)?

sentences:
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:
How would you declare a Texture object in the libgdx skin json file, using a region from a texture atlas? I have a texture atlas that is linked to my skin.json file. The atlas contains a region named "game-title".
I would like to declare a com.badlogic.gdx.graphics.Texture object in the json file, to retrieve it later in my code via skin.get(name, Texture.class).
I tried declaring it as follows, but it does not work - exception gets thrown - com.badlogic.gdx.utils.SerializationException: Class cannot be created (missing no-arg constructor): com.badlogic.gdx.graphics.Texture:

"com.badlogic.gdx.graphics.Texture": {
  "game-title": {name: "game-title"}
}

What am I doing wrong here? What would be the correct way to do this?
Is trying to declare a Texture in such a way a correct thing to do, in the first place?

Many thanks in advance for your feedback.

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:
Texture blends into one single color It looks like that it's being sampled from the least detailed MIP level, at least RenderDoc sees the texture as it should be, and what the actual texture looks like is the same as MIP 9th. I'm using DirectXTex, so I think the shader resource view should be correct.
    DirectX::ScratchImage* pImageData = new DirectX::ScratchImage();
    LoadFromDDSFile(path.c_str(), DirectX::DDS_FLAGS_NONE, nullptr, *pImageData);
    const DirectX::TexMetadata& textureMetaData = pImageData->GetMetadata();
    const DirectX::Image* image = pImageData->GetImage(0, 0, 0);
    DirectX::CreateShaderResourceView(
        GetDevice(gfx),
        image, textureMetaData.mipLevels,
        textureMetaData,
        &pShaderResourceView);

and the sampler is
    D3D11_SAMPLER_DESC samplerDesc;
    samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC;
    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
    samplerDesc.MipLODBias = 0.0f;
    samplerDesc.MaxAnisotropy = 4;
    samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
    samplerDesc.MinLOD = 0;
    samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

    DX::ThrowIfFailed(GetDevice(gfx)->CreateSamplerState(&samplerDesc, &pSamplerState));
    pImageData->Release();

then
    GetContext(gfx)->PSSetShaderResources(0u, 1u, &pShaderResourceView);
    GetContext(gfx)->PSSetSamplers(0u, 1u, &pSamplerState);

Input layout might be relevant
    const std::vector<D3D11_INPUT_ELEMENT_DESC> inputElemDesc =
    {
        {"Position", 0u, DXGI_FORMAT_R32G32B32_FLOAT, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u},
        {"TexCoordinate", 0u, DXGI_FORMAT_R32G32_FLOAT, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u},
        {"Normal", 0u, DXGI_FORMAT_R8G8B8A8_UNORM, 0u, D3D11_APPEND_ALIGNED_ELEMENT,
        D3D11_INPUT_PER_VERTEX_DATA, 0u}
    };

Vertex shader
struct VertexIn
{
    float3 position : Position;
    float2 texCoord : TexCoordinate;
    float3 normal : Normal;
};

struct PSstruct
{
    float4 PosH : SV_Position;
    float3 PosW : Position;
    float3 NormalW : Normal;
    float2 Tex : TEXCOORD;
};
PSstruct main(VertexIn vin)
{
    PSstruct vout;

    vout.Tex = vin.texCoord;;
    return vout;
}

pixel shader. I removed light related code, I'm fairly sure that here it's not important. And I temporarily disabled it
Texture2D cubeTexture : register(t0);
SamplerState cubeSample : register(s0);

struct PSstruct
{
    float4 PosH : SV_Position;
    float3 PosW : Position;
    float3 NormalW : Normal;
    float2 tex : TEXCOORD;
};
float4 main(PSstruct pin) : SV_TARGET
{
    float4 texColor = float4(1, 1, 1, 1);
    texColor = cubeTexture.Sample(cubeSample, pin.tex);
    float4 litColor = texColor;
    return litColor;
}

sentences:
Optimal OpenGL 2D Sprite Batching (Best Practice) I am working on simple 2D engine using OpenGL (3.3+) for rendering and was wondering what the optimal method of sprite batching would be. I plan to put all sprites into one (or fewer) texture atlases. Unsurprisingly, each sprite consists of 2 triangles and 4 texture coordinates.
For simplicity, let's assume only the sprites are not animated for now.

Now to my question, I do not know what would be the optimal way to draw them. As far as I was able to dig up, I have two options:

Draw each sprite separately, which would allow me to modify the position/rotation/scale of each sprite within the shader via MVP matrices. This also means that I would not need to update the sprite data buffers (vertex pos. & tex. coords) on GPU.
Stuff all sprites' data into a single VBO and draw them all with one glDrawElements call (assuming they use the same texture atlas and shader). However, I would then need to update the VBO every frame (or at least the changed parts, which also means that I would have to watch every sprite's state).

Which of these options is better from a practical point of view? Or is there any other method to achieve what I'm trying to do?

sentences:
Unity RTS Single Selection Problem I am trying to build an RTS game and I have managed to form a way to select a unit using Raycast and the tag system. I made it so that if the object the ray falls onto is of tag "TankUnit" Make so and so variable true and allow it to move to another place. However, Units of the same tag even when not selected also move. How do I fix this problem? The script is bound to each unit.

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

public class UnitController: MonoBehaviour { bool clicked = false; //public float speed = 10f; //public float rotationSpeed = 10f;

 public LayerMask groundLayer;
 public NavMeshAgent playerAgent;
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButton(0))
     {
         Debug.Log("Clicked");
         FindClickPos();
     }
     if (Input.GetMouseButton(1) && clicked == true)
     {
         Debug.Log("I clicked right mouse");
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             MoveTo(hit);
         }
     }
 }
 private void FindClickPos()
 {
     RaycastHit hitInfo = new RaycastHit();
     bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
     if (hit == true)
     {
         Debug.Log("I hit " + hitInfo.collider.name);
         if (hitInfo.collider.tag == "TankUnit")
         {
             Debug.Log("I hit" + hitInfo.collider.tag + "!");
             clicked = true;
         }
         else
         {
             Debug.Log("I didnt hit a unit :/");
             clicked = false;
         }
     }
     else
     {
         Debug.Log("I didnt hit anything...");
         clicked = false;
     }
 }
 void MoveTo(RaycastHit hit)
 {
     Debug.Log("Position: " + hit.point);
     playerAgent.SetDestination(hit.point);
 }

}

sentences:
How to render a field of view of over 180 degrees? In most 3D renderings, a view frustum is used.
This has the problem, that things get stretched out towards the edges.
At "normal" fov (field of view) of about 60 degrees, the effect is not very noticeable, unless compared side by side (example) but at a higher fov of something like 120 degrees it's really noticeable by making things near the edge look way larger/closer (example).
A fov of anything near or over 180 degrees breaks the rendering completely.
So far, I couldn't find anything on how to render in such a way that fixes this or even how it's called.
The ultimate goal would be to be able to render up to 360 degrees (ignoring the hardware needed, to display it) without any distortion, relative to other parts of the image.
So, how would I approach rendering that? Is there already some open source software, I can take a look at?

sentences:
How are the packet boundaries in the Source engine DEM format determined? I'm trying to write a program that reads Source DEM files, and about all I can at this point is the header which is a magic string, few ints and floats and 280-long strings.

The last field in the header is an int which specifies the length of the "sign on" data in bytes, but after reading that much forward into the file then attempting to read a new int for another packet of data, I get garbage values (0's or negative values) after 2-3 packets (I expect a few thousand).

Basically I'm interpreting the documentation as so:

Header Data (less sign-on length)
Sign-on length (int, "Length of the signon data (Init for first frame)")
Sign-on packet (of above specified length)
Next packet length (int)
Next packet data (length above)
...repeat to EOF.

If I consume another 4-bytes between the "sign-on length" and packet itself (it's a bit unclear if the last field in the header is actually part of the header or just the start of the first packet), I also get garbage.

All this is before even trying to parse the contents of the packet data, I'm currently just trying to jump through the recording and chop it up in to the frame packets.

sentences: How do I determine if one polygon completely contains another? I have 2 polygons.  I know the vertex coordinates of both polygons.  What's the best way to check if one is completely inside the other?  For example, the algorithm should only recognize the black trapezoid below as being contained:

sentences:
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:
Unity Input System On-Screen Button doesn't work with touchscreen 2019.3.2f1 I am trying to make my player jump whenever the space button is pressed (if a keyboard is present), and I'm adding a on-screen button for players on mobile. The on-screen button works fine in the editor but when I try the game in a device the on-screen button doesn't work.

Here's how things are set up:

Change the Active Input Handling to Input System Package (New) on
the player settings.
Create the Jump action for the Player action map.
Bind <Keyboard>/space to my Jump action.
Add a PlayerInput component to my player object, pass my actions
file to it, and set up the events to call for each action.
Change the StandaloneInputModule to an InputSystemUIInputModule in my
event system object.
In my canvas I add an image and add OnScreenButton component to it (I
do NOT add a Button component).
Set the control path to <Keyboard>/space.

When I try the game on the device the rest of the UI buttons work fine except the on-screen button. On the editor though (using mouse input), the on-screen button works fine.
This is my first time using the Input System, I had actually found it somewhat nice to work with, however this does seem really strange. It is either a really strange bug (unlikely), or I messed up some setting (the setup process feels really convoluted actually).

sentences:
Good approach in designing game classes I took a semester-long course in java but I'm still a beginner in Object-Oriented programming paradigm. Suppose that I want to create a simple game where the player can go to different locations. Each location has its own unique treasure (that has other attributes) and has its own set of different animals. The question: How can I design classes that are not too naive based on the game? (can be too broad) Is my approach below correct or can it be improved? (narrowed)

I was thinking that I should create a Location, treasure, and Animal classes; Each classes declared in its own file.

public class Location {
    // attributes such as treasure and animals
    private ArrayList<Animal> animals;
    private Treasure treasure;
    public Location(String name) {
        // initialization of attributes
        if(name.equals("Jungle")) {
            treasure = new Treasure("Rare Vine");
            animals.add(new Animal("Monkey", 90, 50);
            animals.add(new Animal("Snake", 100, 60);
        }
        else if(name.equals("Valley")){
            // and so on
        }
        // and so forth
    }
}
public class Treasure {
    // attributes such as name and value
    public Treasure(String name, int value) {
        // initialization of attributes
        this.name = name;
        this.value = value;
    }
}
public class Animal {
    // attributes such as name
    public Animal(String name, int encounterRate, int captureRate) {
        // initialization of attributes
        this.name = name;
        this.encounterRate = encounterRate;
        this.captureRate = captureRate;
    }
}

But I doubt that the use of conditional statements in Location class to initialize its attributes makes the method have so many lines and may confuse the developer after some time. what if there are so many attributes per location and there are many locations?

Another approach that I can think of is to create subclasses of Location and put the corresponding values for the location's attributes. For me, I can understand the structure of the game and efficient if the number of location subclasses is small.

I'm new in creating java games so I don't have a solid view in designing game classes. this problem may be broad so I narrowed it down to my code above.

sentences:
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:
Java libgdx Game Screens and rendering tile map I'm working on a 2D tiled game with Java and libGDX. I'm having problems implementing gamescreens. I'm trying to set the screen to gameScreen and start rendering tiles, but I'm getting a nullpointer exception on my camera and my renderer.

I think what's happening is that it's calling the render method before the create method for some reason. The create method is where the camera and renderer are set up.

This is my entry point, gameClass

package com.psillicoder.farmGame;
import com.badlogic.gdx.Game;

public class gameClass extends Game {
    gameScreen gameScreen;

    public static final String TITLE="Farm Game";
    public static final int WIDTH=800,HEIGHT=600;

    @Override
    public void create() {
        gameScreen = new gameScreen(this);
        setScreen(gamaeScreen);
    }

    @Override
    public void render () {
        super.render();
    }
}

This is my gameScreen class:

package com.psillicoder.farmGame;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;

public class gameScreen implements Screen {
    gameClass game;

    private OrthographicCamera camera;
    private OrthogonalTiledMapRenderer renderer;
    private TiledMap map;

    SpriteBatch batch;

    float unitScale = 1/16f;

    public gameScreen(gameClass game) {
        this.game = game;
    }

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

        camera.update();
        renderer.setView(camera);
        renderer.render();

        batch.begin();

        batch.end();
    }

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

    @Override
    public void show() {

        TiledMap map = new TmxMapLoader().load("tdmap1.tmx");
        OrthogonalTiledMapRenderer renderer = new OrthogonalTiledMapRenderer(map,unitScale);

        OrthographicCamera camera = new OrthographicCamera();

        camera.setToOrtho(false,40,40);
        renderer.setView(camera);
        camera.update();

        batch = new SpriteBatch();
    }

    @Override
    public void hide() {
        dispose();
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }

    @Override
    public void dispose() {
        System.out.println("Disposed");
        batch.dispose();
        renderer.dispose();
    }
}

sentences:
box2d not centered in sprite I am trying to create a bounding box for my sprite using box2d, but the box is being created at the wrong spot. I followed a tutorial on the wiki using this code

    BodyDef bodyDef1 = new BodyDef();
    bodyDef1.type = BodyDef.BodyType.DynamicBody;
    bodyDef1.position.set(player.getX(), player.getY());
    playerBody = world.createBody(bodyDef1);
    PolygonShape square = new PolygonShape();
    square.setAsBox(player.getWidth() / 2, player.getHeight() / 2);
    FixtureDef fixtureDef1 = new FixtureDef();
    fixtureDef1.shape = square;
    fixtureDef1.density = 0.1f;

Player is a just the sprite that I am trying to create the box around.

sentences:
Unity CaptureScreenshot captures and editor as well I'm trying to create some screenshots but ScreenCapture.CaptureScreenshot actually captures the entire editor and not just the Game view.

I'm using this few lines of code here:

public class ScreenShotTaker : MonoBehaviour
{
    public KeyCode takeScreenshotKey = KeyCode.S;
    public int screenshotCount = 0;
    private void Update()
    {
        if (Input.GetKeyDown(takeScreenshotKey))
        {
            ScreenCapture.CaptureScreenshot("Screenshots/"
                 + "_" + screenshotCount + "_"+ Screen.width + "X" + Screen.height + "" + ".png");
            Debug.Log("Screenshot taken.");
        }
    }
}

What could be the issue?

sentences:
iOS Facebook SDK, Games Start Playing post im trying to implement a method in my native iOS game the publish a story on face book such as this photo

most games that is integrated with facebook share stories like this in the activity section on the timeline

any good example especially for iOS 6

sentences:
Trouble rigging rotating head to pivoting arm I've got a 3ds max model and I'm trying to rig it. I followed some tutorials, but I got stuck. I've got my rotating head, and the arm that holds it and pivots up and down, but the two don't "connect" well.

Here's my rigging set up:

The leftmost dummy should move up and down and control the height of the miner head (the jagged-edge wheel) and the arm that holds it.

But, when I move my dummy up vertically to test, the arm works perfectly, but the miner head ... uh, doesn't. This is from the same angle as the first shot and you can see that the miner head tilts, instead of moving straight up and down.

I tried playing with the miner head's pivot points, but they seemed perfectly centered. Is there a way to make my miner head only go straight up and down (that will still work with my rotation constraint? ) instead of doing this strange sideways tilting motion? Maybe that's not the right thing to do, I could really use some hints in where to go from here to fix this strange tilting motion..

sentences:
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:
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:
How to make an object which position is not on the world origin rotate around the world orgin in threejs? I've loaded an object and set its position on vector(5,2,-5) by threejs. And I wanted it to rotate around the origin point in the world coodinate system. I found a method in class Object3D called 'rotateOnWorldAxis', so I had a try on it but it didn't work, it still rotate on it own space. I want to know why it didn't work and how to make this right.

The code is like this:

var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
//resize event
window.addEventListener("resize",function(){
  var width = window.innerWidth;
  var height = window.innerHeight;
  renderer.setSize(width,height);
  camera.aspect = width / height;
  camera.updateProjectionMatrix();
});

camera.position.set(0,0,15);

var ambientLight = new THREE.AmbientLight(0xffffff,0.8);
scene.add(ambientLight);

var mesh;
var fgxloader = new THREE.FBXLoader().
load("asset/source/1520514930250.FBX",function(object){
  object.position.set(5,2,-5);
  scene.add(object);
  mesh = object;
},function(xhr){
  console.log("object "+(xhr.loaded/xhr.total*100)+"% loaded");
},function(error){
  alert(error);
});

var rotateSpeed = 0.1;
var update = function(){
  if(mesh===undefined)
    return;
  mesh.rotateOnWorldAxis(new THREE.Vector3(0,0,0),rotateSpeed);
  //mesh.rotateOnAxis(new THREE.Vector3(0,1,0),rotateSpeed);
  //mesh.rotateY(rotateSpeed);
  //mesh.rotation.y += rotateSpeed
};

var render = function(){
  renderer.render(scene,camera);
};

var GameLoop = function(){
  requestAnimationFrame(GameLoop);
  update();
  render();
};

GameLoop();

sentences:
Why game engines usually don't offer a vector3.rotate method? Game engines like Three.js, Ogre3d and Unity3d often don't provide a default rotate method on their vector class. You usually have to do something like:

rotated = vector.applyQuaternion(
    new Quaternion().setFromEuler(
        new THREE.Vector3(0,0,Math.PI)));

This is a little confusing for me, so I just define a rotate method. Is there a special reason for this?

sentences:
Do you need expensive servers and fancy hosting in order to make a multiplayer game? I've finished working on an RPG and it would seem so much more fun to make it multiplayer. SFML has a networking feature, I figured it's possible but then again, never in my life have I even tried something basic about networking, in fact my knowledge of it is very limited.

What would it take to make a multiplayer game resource-wise? I'm not talking about an MMO, more like a co-op type of game. Do I need mountains of cash to pay for hosting and servers and many many things to make one?

sentences:
Are there benefits to stage selections where only the appearance changes (i.e. Street fighter, King of fighters etc.)? I'm not really sure if it's a good value add seeing as it would entail asset generation.

The only value I see in it would be for variance but even that would wear thin really quickly.

Clarification: i.e. Backgrounds that don't add game play related features, just appearance changes.

sentences: How do I add a text area to my 3D android world i am learning 3d game development on android , i was wondering is it possible to add text areas or any thing that allows a user to enter a text in a 3d world ? and how ?

sentences: SGC toolkit for PyGame and resizeable windows Can I create a resizeable main window if I use the SGC GUI toolkit for PyGame? If so, how?

sentences:
File saved to IndexedDB lost unless we change scenes Our game includes an in-game level editor. When the user saves a custom level, the level is serialized and written to a file:
public void SaveFile<T>(T obj, string path) {
    if (!typeof(T).IsSerializable) {
        throw new ArgumentException("Tried to save non-serializable type " + typeof(T).Name);
    }

    FileStream fs = null;
    try {
        fs = new FileStream(path, FileMode.Create);
        DataContractJsonSerializer serializer = GetSerializer();
        serializer.WriteObject(fs, obj);
    } catch (Exception ex) {
        Debug.LogException(ex);
    } finally {
        if (fs != null) fs.Close();
    }
}

Serialized files can be loaded like this:
public T LoadFile<T>(string path) {
    if (!typeof(T).IsSerializable) {
        throw new ArgumentException("Tried to deserialize non-serializable type " + typeof(T).Name);
    }

    if (!File.Exists(path)) return default(T);

    FileStream fs = null;
    T result;
    try {
        fs = new FileStream(path, FileMode.Open);
        DataContractJsonSerializer serializer = GetSerializer();
        var result = (T)serializer.ReadObject(fs);
    } catch (Exception ex) {
        Debug.LogException(ex);
        throw ex;
    } finally {
        if (fs != null) fs.Close();
    }

    return result;
}

When displaying a "Load" menu, we enumerate the saved files like this:
public List<T> LoadFiles() {
    if (!Directory.Exists(path)) {
        Debug.Log("No save files found");
        return new List<T>();
    }

    var files = Directory.EnumerateFiles(path);
    Debug.Log("Found " + files.Count() + " files");

    List<T> result = new List<T>(files.Count());
    foreach (string file in files) {
        Debug.Log(file);
        T obj = LoadFile<T>(file);
        if (obj == null) Debug.Log("File at " + file + " loaded null");
        if (obj != null) result.Add(obj);
    }
    return result;
}

I have omitted a lot of code for brevity, but what is shown above should cover the important parts.
In the Editor, everything works perfectly. However, in WebGL builds (where files are saved to/loaded from the browser IndexedDB), there is a strange quirk: the file doesn't remain in IndexedDB unless the user changes to a different scene after saving.
Scenario 1:

In the level Editor, Bob presses "Save"
The file is saved, and the browser console shows the log entry File saved to /idbfs/abc123/CustomLevels//FileName
Bob refreshes the webpage
Bob clicks "Load"
The game searches IndexedDB but does not find the file saved in step 2

Scenario 2:

In the level Editor, Alice presses "Save"
The file is saved, and the browser console shows the log entry File saved to /idbfs/abc123/CustomLevels//FileName
Alice returns to the main menu scene
Alice refreshes the webpage
Alice clicks "Load"
The game searches IndexedDB and does find the file saved in step 2

The browser console log suggests that after Bob refreshes the page in Scenario 1, the file no longer exists. If this was the only scenario that Bob had saved, we see the message "No save files found". If Bob had previously saved other scenarios and used the workaround of returning to the main menu scene, those previously saved files will appear in the console and save list, but the most recent file is missing.
Why would the save file disappear from the IndexedDB if the user leaves the webpage without changing scenes, but remain in the IndexedDB if the user returns to the main menu scene before leaving the webpage?

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: different speed on different devices I am running a simple Libgdx app that I have wrote, on my Android phone and Android tablet and I am getting the unexpected result of having different velocities when a body is moved. To move the body I am using a "drag" movement in this way (snippet):

private Body ballBody;
private int ballX1, ballY1;

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

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    Vector2 v2 = new Vector2(ballX1 - screenX, screenY - ballY1);
    v2.scl(0.25f);
    ballBody.setLinearVelocity(v2);
    return true;
}

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

Render part with some of my attempts to fix delta-time and FPS:

private static final int SCREEN_HEIGHT = 16; //320;
private static final int SCREEN_WIDTH = 24; //480;
private static final int BOX_VELOCITY_ITERATIONS = 6;
private static final int BOX_POSITION_ITERATIONS = 2;
private static final float BALL_RADIUS = 0.1f;
private static final float MAX_FPS = 1 / 60f;
private static final float PIXELS_TO_METERS = 20f;
private static final long ONE_SECOND_NS = 1000000000;

private int maxUpdates = 10;
private long lastTime = System.nanoTime();
private World world = new World(new Vector2(0, -9.8f), true);

@Override
public void render() {
    ballIsNotMoving = ballIsNotMoving();
    if (ballIsNotMoving && ballBody.getPosition().x > landscape2d[20] && ballBody.getPosition().x < landscape2d[28]) {
        newHole();
    } else if (ballBody.getPosition().x > SCREEN_WIDTH + ball.getWidth() / 2 || ballBody.getPosition().x < - ball.getWidth() / 2) {
        resetBallPosition();
    }

    camera.update();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glClearColor(34/255f, 167/255f, 240/255f, 0);

    fixTimeStep();

    world.step(MAX_FPS, BOX_VELOCITY_ITERATIONS, BOX_POSITION_ITERATIONS);

    shapeRenderer.setProjectionMatrix(camera.combined);

    // Set the sprite's position from the updated physics body location
    ball.setPosition(
            ballBody.getPosition().x - ball.getWidth() / 2,
            ballBody.getPosition().y - ball.getHeight() / 2);

    polySpriteBatch.setProjectionMatrix(camera.combined);
    polySpriteBatch.begin();
    pitch.draw(polySpriteBatch);
    polySpriteBatch.end();

    createStartArea(shapeRenderer);

    fixFPS();

//        debugRenderer.render(world, camera.combined);
}

private boolean ballIsNotMoving() {
    float speedNow = ballBody.getLinearVelocity().len();
    recentSpeed = 0.1f * speedNow + 0.9f * recentSpeed;
    if (recentSpeed < 0.20f) {
        stopBallMovement();
        return true;
    }
    return false;
}

private void fixTimeStep() {
    long time = System.nanoTime();
    long timeDelta = time - lastTime;
    float timeDeltaSeconds = timeDelta / (float) ONE_SECOND_NS;
    lastTime = time;

    // Update the game state in capped time steps (in case we're running too slow)
    int updateCount = 0;
    while (timeDelta > 0 && (maxUpdates <= 0 || updateCount < maxUpdates)) {
        // Update using a time step in seconds
        float updateTimeStep = Math.min(timeDeltaSeconds, ONE_SECOND_NS * MAX_FPS);
        float updateTimeStepSeconds = updateTimeStep / (float) ONE_SECOND_NS;

        world.step(updateTimeStepSeconds, BOX_VELOCITY_ITERATIONS, BOX_POSITION_ITERATIONS);

        timeDelta -= updateTimeStep;
        updateCount++;
    }
}

private void fixFPS() {
    long sleepTime = Math.round((ONE_SECOND_NS / MAX_FPS) - (System.nanoTime() - lastTime));
    if (sleepTime <= 0)
        return;
    long prevTime = System.nanoTime();
    while (System.nanoTime() - prevTime <= sleepTime) {
        try {
            Thread.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

The app start with the same resolution for both devices. Any idea about how to get the same speed?

sentences:
PCF shadow shader math causing artifacts For a while now I used PCSS for my shadow technique of choice until I discovered a type of percentage closer filtering. This method creates really smooth shadows and with hopes of improving performance, with only a fraction of texture samples, I tried to implement PCF into my shader. This is the relevant code:

float c0, c1, c2, c3;
float f = blurFactor;
float2 coord = ProjectedTexCoords;
if (receiverDistance - tex2D(lightSampler, coord + float2(0, 0)).x > 0.0007)
    c0 = 1;
if (receiverDistance - tex2D(lightSampler, coord + float2(f, 0)).x > 0.0007)
    c1 = 1;
if (receiverDistance - tex2D(lightSampler, coord + float2(0, f)).x > 0.0007)
    c2 = 1;
if (receiverDistance - tex2D(lightSampler, coord + float2(f, f)).x > 0.0007)
    c3 = 1;

coord = (coord % f) / f;
return 1 - (c0 * (1 - coord.x) * (1 - coord.y) + c1 * coord.x * (1 - coord.y) + c2 * (1 - coord.x) * coord.y + c3 * coord.x * coord.y);

This is a very basic implementation. blurFactor is initialized with 1 / LightTextureSize. So the if statements fetch the occlusion values for the four adjacent texels. I now want to weight each value based on the actual position of the texture coordinate. If it's near the bottom-right pixel, that occlusion value should be preferred. The weighting itself is done with a simple bilinear interpolation function, however this function takes a 2d vector in the range [0..1] so I have to convert my texture coordinate to get the distance from my first pixel to the second one in range [0..1]. For that I used the mod operator to get it into [0..f] range and then divided by f.
This code makes sense to me, and for specific blurFactors it works, producing really smooth one pixel wide shadows, but not for all blurFactors.
Initially blurFactor is (1 / LightTextureSize) to sample the 4 adjacent texels. I now want to increase the blurFactor by factor x to get a smooth interpolation across maybe 4 or so pixels. But that is when weird artifacts show up. Here is an image:
Using a 1x on blurFactor produces a good result, 0.5 is as expected not so smooth. 2x however doesn't work at all. I found that only a factor of 1/2^n produces an good result, every other factor produces artifacts.
I'm pretty sure the error lies here: coord = (coord % f) / f; Maybe the modulo is not calculated correctly? I have no idea how to fix that. Is it even possible for pixel that are further than 1 pixel away?

sentences:
Restrict render in Blender is not working I click "Restrict renderability", so that everything except the item I want to export is grayed out. However, it still exports lights and everything when I import it into Unity.

How can I fix this?

sentences: Configurable Dice Cup Sound Effect for HTML5 Game I am developing an HTML5/javascript based game, where the players will have to roll virtual dice. I am working on a 3d model of a dice Cup and plan on having the users shake it and turn it upside down in order to roll the dice. I would like some realistic sound effects to go along with this interaction, but do not know how to achieve this. The problem is that the number of dice, the duration, intensity and speed of the dice cup shake will vary. Consequently, I don't think I will be able to create a convincing sound experience by using a prerecorded sound effect. How does one deal with making such sound effects configurable?Would I need to programmatically generate the sound using the web audio API? If so I would be grateful for any pointers as to how to do it.

sentences:
How can I have the character come back to its full height after crouching? I'm making a simple game and when the player crouches/slides I would want to make the character to change size. However when it changes to its smaller size it doesn't go back to its original size after you release the crouch button.
using UnityEngine;

public class advancedMovement : MonoBehaviour
{

    PlayerMovement basicMovementScript;
    public float sprint = 5f;
    public float slideSprint = 6f;
    public float deceleration = 0.5f;

    public CharacterController ccr_controller;
    public float ControllerHeight;

    // Start is called before the first frame update
    void Start()
    {
        basicMovementScript = GetComponent<PlayerMovement>();
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.LeftShift))
            basicMovementScript.speed += sprint;
        else if (Input.GetKeyUp(KeyCode.LeftShift))
            basicMovementScript.speed -= sprint;

        if (Input.GetKeyDown(KeyCode.LeftControl))
        {
            basicMovementScript.speed += slideSprint;
            ccr_controller.height = ControllerHeight;
            ControllerHeight = 7f;
        }

        if (Input.GetKeyUp(KeyCode.LeftControl))
        {
            basicMovementScript.speed -= slideSprint;
            ccr_controller.height = ControllerHeight;
            ControllerHeight = 14f;
        }
    }
}

sentences:
Why do I get a jitter/stutter when moving and following a target? I am using the script below to move a transform to quickly follow a target (the player), and come to a stop close to the player.
When I move the player around, the transform is following the player, keeping the 1.5 distance.
To ensure the transform can keep up with the player, I set the moveSpeed to 5, But when I do that, the transform jitters/stutters when moving.
If I set the moveSpeed to 1 for example, the transform will move smoothly but will not keep up with the player - the player has to stop moving and wait for it to catch up. But increasing the speed makes the stutter return.
Why is this stutter happening, and how can I make the movement smooth?
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class Follow : MonoBehaviour
{
    public Transform targetToFollow;
    public Text text;
    public Text text1;
    public float lookAtRotationSpeed;
    public float moveSpeed;

    private float minMoveSpeed = 0f;
    private Vector3 originPos;

    // Start is called before the first frame update
    void Start()
    {
        originPos = targetToFollow.position;
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 lTargetDir = targetToFollow.position - transform.position;
        lTargetDir.y = 0.0f;
        transform.rotation = Quaternion.RotateTowards(transform.rotation,
            Quaternion.LookRotation(lTargetDir), Time.time * lookAtRotationSpeed);

        var distance = Vector3.Distance(transform.position, targetToFollow.position);

        text.text = "Transform Distance From Target " + distance.ToString();

        float ms = moveSpeed;

        if (distance > 5f)
        {
            ms = moveSpeed + 0.5f;
        }
        else if (distance < 1.5f)
        {
            ms = Mathf.Max(minMoveSpeed, ms - 0.3f);
        }
        else
        {
            //transform.position = Vector3.MoveTowards(transform.position, targetToFollow.position, Time.deltaTime * ms);
        }

        if (distance < 0.5f && originPos == targetToFollow.position)
        {
            ms = 0f;
        }

        if (distance > 1.5f)
            transform.position = Vector3.MoveTowards(transform.position, targetToFollow.position, Time.deltaTime * ms);

        originPos = targetToFollow.position;
    }
}

sentences:
I want to blit a standing man on pygame I was making a game with pygame and python and I wanted to blit an image of a standing man and when a right key is pressed I want the man to run and when the right key is released I want the man to stand again... I tried to make it like that but couldn't work... here's the code I tried

import pygame
from pygame.locals import *
from sys import exit

pygame.init()

screen = pygame.display.set_mode((600,600))
pygame.display.set_caption('running man')

image_1 = pygame.image.load('standing-man.jpg')
image_2 = pygame.image.load('running-man-1.jpg')
image_3 = pygame.image.load('running-man-2.jpg')

move_x = 0
x = 0

clock = pygame.time.Clock()

while True:
    running_man = [0]
    #creates a loop and make the image look like its running by swithching the two man images
    for man in running_man:
        screen.fill((255,255,255))
        x += move_x
        #first i want a standing man to be seen on the screen and when a right key is pressed i want the other two images to blit on the screen
        if man == 0:
            screen.blit(image_1,(x,100))
        if man == 1:
            screen.blit(image_2,(x,100))
        if man == 2:
            screen.blit(image_3,(x,100))
        pygame.display.update()
        clock.tick(7)

        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
            if event.type == KEYDOWN:
                if event.key == K_RIGHT:
                    move_x = +1
                    #here i want the variable running_man to be 1,2 so to blit the otherr images and remove the standing man image
                    running_man = [1,2]
            if event.type == KEYUP:
                if event.key == K_RIGHT:
                    move_x = +0
                    #when the right key is released i want the value of the variable running_man to be 0 again so to blit the standing man image again
                    running_man = [0]
        pygame.display.update()

sentences:
sf::mouse::getPosition method help I am trying to write sf::mouse::getPosition(const Window &Relative To) in a function but I can't write the correct argument in it. Why is that?

Here is my Game.cpp File:
EDIT: I pasted the current code:

#include "Game.h"

Game::Game() : m_window("Multiplayer Space Shooter Game", sf::Vector2u(800, 600)) {
    // Setting up class members.
    m_shipText.loadFromFile("C:\\Users\\AliTeo\\Desktop\\Piksel çalışmaları\\ship_pixel2.png");
    m_ship.setTexture(m_shipText);
    m_ship.setOrigin(m_shipText.getSize().x / 2, m_shipText.getSize().y / 2);
    m_ship.setPosition(320, 240);
}
Game::~Game() {}
void Game::Update() {
    m_window.Update(); // Update window events.
    m_ship.move(m_speedX, m_speedY);
    m_ship.setRotation(90 + m_angle);
    HandleInput();
}
void Game::HandleInput() {
    sf::Mouse m_mouse;
    m_angle = atan2(m_mouse.getPosition(&m_window).y - m_ship.getPosition().y, m_mouse.getPosition(&m_window).x - m_ship.getPosition().x);
    m_angle *= 180 / m_PI;

    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right) && m_speedX <= m_speedLimit) {
        m_speedX += m_acceleration;
    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) && m_speedX >= -1 * m_speedLimit) {
        m_speedX -= m_acceleration;
    }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down) && m_speedY <= m_speedLimit) {
        m_speedY += m_acceleration;
    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && abs(m_speedY) >= -1 * m_speedLimit) {
        m_speedY -= m_acceleration;
    }
}
void Game::Render() {
    m_window.BeginDraw(); // Clear.
    m_window.Draw(m_ship);
    m_window.EndDraw(); // Display.
}
Window* Game::GetWindow() { return &m_window; }

m_window is a member of Game.h

no instance of overloaded function "sf::Mouse::getPosition" matches the argument list

#include "Window.h"
class Game {
public:
    Game();
    ~Game();
    void HandleInput();
    void Update();
    void Render();
    Window* GetWindow();
private:
    sf::Sprite m_ship;
    sf::Texture m_shipText;
    //sf::Vector2i mousePos = sf::Mouse::getPosition();
    Window m_window;
    const float m_PI = 3.1415f;
    float m_speedX = 0;
    float m_speedY = 0;
    float m_acceleration = 0.001f;
    //float m_friction = 0.001f;
    float m_speedLimit = 0.5f;
    float m_angle;
};

sentences:
Positive Evaluation Function - Territory AI Help I am trying to implement some positive evaluation into my game. Let me explain.

I have a series (anywhere from 5 to 25 (might vary)) of circles (three sizes, big medium small). And each player starts with a main circle which gains 1 every turn (like risk the circles gain at different speeds, the big one gains the fastest and the small one gains the slowest). You can use these numbers to take over other circles, if the "enemy" is on this circle it does a risk thing (you fight to see who takes it over, who ever has more wins most of the time, I'm not getting into this logic as it is rather irreverent).

So this is a very basic overview of what occurs, now what I need some help with is how I can create an AI which will look at all available (and taken) circles and determine where it wants to move to. There would be circles closes to it, and circles in the enemies area and circles available and circles taken over. And it would need to determine where to move it's forces too next, and so on and so forth.

So after some research I read a lot about Positive Evaluation, which it takes all possible moves and determines the best one.

So I am wondering if anyone could help me out or give me some direction as to where to go from here. I think what I need to do is take all the circles with any forces on them, throw them into a table/array with the cords of each circle and determine which would be best, then I would need to determine how many forces I want to send and where from.

Help!

ADDITION:

Allow me to explain a bit, http://imm.io/4Xwy see that diagram lets assume the circles are sections of forces, and you gain a new force each "time interval" and lets say I want to take all my forces (I'm pink) the circle directly below me and capture it, well the AI would need look at all available circles and pick for example the big green on in the top right (since big would make more troops and its close to the "main"). I'm assuming what you said would still work? Weighted options?

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:
What matrix operations do I perform to translate then rotate then translate then rotate? In an android game I want to draw a running leg. To output the thigh I do something like:

// legCX,legCY is the location on screen about which the leg rotates.
Matrix m = new Matrix();
m.postTranslate(-legCX,-legCY);
m.postRotate(legRot);
m.postTranslate(legCX,legCY);

So, the above translates the 0,0 point over to the point of rotation about which I want to rotate the leg, then it rotates by the amount I want the leg rotated, then it translates 0,0 back to the original origin.

I then use that matrix to draw the thigh. It ends up rotated as expected. So far so good.

How do I draw the second part of the leg below the knee? It rotates differently than the part of the leg above it and has a center point which moves with the leg above it. I tried the following, but it turns out that the end result is rotation around some single point which doesn't follow the thigh.

Matrix m = new Matrix();
m.postTranslate(-legCX,-legCY);
m.postRotate(legRot);
m.postTranslate(0,-thighLength);
m.postRotate(shinRot);
m.postTranslate(0,thighLength);
m.postTranslate(legCX,legCY);

I suspect that it's probably necessary to do the two rotations in two different Matrix objects and then combine them somehow, but I can't figure out how exactly to do that.

I've tried reading the various wikipedia articles on matrix operations, but I'm having trouble finding the sort of operation that I'm trying to perform.

EDIT: This type of matrix seems to be called a "transformation matrix". Combining multiple operations is called composition of transformations. However, none of the pages on this topic mention how to do a series of translations and rotations.

Surely, if you can use a matrix to do rotation about one point, it must be possible to do multiple matrix operations somehow to allow rotation about one point and then an additional rotation around a different point.

I've tried looking at pages on skeletal animation, but I can't make head nor tail of what they're talking about. My game won't involve many characters, so I don't need to use a physics engine to do super complex stuff. I just want to do the calculations to draw a character that runs.

EDIT: Hooray! Thanks dkantowitz! Your answer wasn't quite right, but you got me really close. I've edited your answer to be correct now. The second matrix needed to translate from the origin, not relative to the leg's center of rotation. And, the combined matrix needs to preConcat the shin matrix first and then the thigh's matrix. Thanks!

sentences: How to read the binary file generated by the Unity profiler? I'd like to know how can I read the binary file generated by profiling Unity game and how can I save it on external hard disk.

sentences:
Unity - strange performance impact with moving objects I'm trying to find the solution for 46 hours now and I'd be really happy if someone knows it!

I'm using a DOTween library for moving the objects. I also use LeanTween, cause I heard it's faster but none of these work for me in this case. I've used tweening libraries alot, but never faced an issue like this.

The bug appeared in my project, so to check it I created a blank one. An empty scene, with a camera and one cube with scale[10,2,10].

Now, I've added a simple script:

    Sequence sequence = DOTween.Sequence();

    sequence.Insert(0f, transform.DOMove(transform.position + new Vector3(10f,0f,0f),1f)).SetEase(Ease.Linear);
    sequence.Insert(1f, transform.DOMove(homePosition,1f)).SetEase(Ease.Linear);
    sequence.SetDelay(1f);
    sequence.SetLoops(-1);

The script moves the cube continously by 10 units to the right, and back (both in 1 second).

There's a noticable jitter.

This jitter is strange, cause it does not happen contantly. It choses a time and just freezes the cube in place for a really tiny amount of time which is noticable - when you see a smoothly moving object and it freezes for a moment.

As you can see, there's a linear interpolation, but I've tried with many (it's even better visible with other interplation types).

Now. The profiler is not the case, cause I've tested it on the empty project with one object on the scene.

Things I've already tried:

Turning off occlusion culling
Turning off everything I could
All the combinations of quality settings
LeanTween instead of DoTween

The one thing I came up with is the profiler's WaitForTargetFramerate.
By definition, when WFTF is huge it means that the app is doing well, cause it finished it's work and waits for the next frame. In my opinion in this case it's the reason of the bug.

I have a screenshot of the profiler window (with one cube, one directional light and this script attached to a cube):

Now, I'm not 100% sure, but I think that this jitter may happen on these V-Sync drops on the screen.

Everything is tested on the PC. On Android there's the same thing (a noticable jitter), but I didn't run the profiler.

If someone has any idea what may be the cause of this - I'd be grateful. I'll put a bounty here as soon as I can, cause I'm really tired! :)

@ DMGregory

This is before the 'jump' on the GPU chart:

and that's on the 'jump':

There's no RigidBody or Collider, but on my main project there are box colliders on these floors. I've also tried adding RB with the Interpolation checked. No difference.

@ Josh Hamilton

Even if this is a normal behavior, that the frame completed faster - there are games on Google Play and AppleStore without any glitches like this. In my main project (where I discovered the issue) the biggest problem is that this lag is happening when I move the camera to follow the player smoothly and the freeze it noticable like anywhere else. Like the entire enviroment was freezing for 1-3 frames.

sentences:
Lightmapped prefabs for procedural content I'm doing a game with procedural content from handmade prefabs, but I ran into a problem as Unity bakes the scene instead of objects when lightmapping with Beast. So when the prefabs are instanced they are without lightmaps.

Is there a way to get lightmaps for dynamically created prefabs with Unity's built-in lightmapper?

sentences:
How do I approach large companies if I have a killer mobile game idea? I have an idea for a game that has potential, but I'm not a programmer.

How do I tell this to development companies without having my idea stolen?  All I want from the company is for somebody to watch a three minute long video presentation about my idea and if they see potential in it then we can talk about the details.

I have already sent an e-mail to several big companies that have the expertise needed to code the game, they haven't answered me. Actually the idea is nothing fancy, no 3D, but fun and unique.

sentences:
Why would it be faster to render using multiple canvas elements? This video suggests that rendering using multiple canvas elements helps performance.

How does this work?

The idea was to use one for the player, one for the enemies, another for the background, though I really don't understand how could it be faster if you use more of the same thing.

Could someone clarify?

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:
Camera relative movement is pushing into/off the ground instead of parallel I'm building upon roll a ball tutorial in unity, and I have managed to rotate the camera around the ball just fine with the code below. But there's one problem.

In this code, when I add force to the ball, with W for example, the force will be added in the exact direction the camera is looking at the ball, meaning pushing the ball onto the ground, increasing friction and lowering speed. And if I press S the force will push the ball to the air, lowering friction and making the ball move fast.

So my question is, how can I achieve rotation without this issue?

Code for Camera (CameraController):

public GameObject Player;
private Vector3 offset;
public float cameraSpeed;
private Vector3 point;
static public Vector3 finalMovement;

void Start () {
    offset = transform.position - Player.transform.position;

    point = Player.transform.position;
    transform.LookAt(point);
}

void LateUpdate()
{
    point = Player.transform.position;

    offset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * cameraSpeed, Vector3.up) * offset;
    transform.position = point + offset;
    transform.LookAt(point);
}

Vector3 movement;
void FixedUpdate()
{
    movement = new Vector3();
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");
    movement = new Vector3(moveHorizontal, 0f, moveVertical);

    finalMovement = GetComponent<Camera>().transform.TransformDirection(movement);
}

Code for ball:

public float speed;
void FixedUpdate()
{
    rb.AddForce((CameraController.finalMovement) * speed);
}

sentences:
what is the best way to add avoidance behaviour to an AI framework? I have a small AI framework for a shooting based game. Although this is rarely needed, as when agents are close to each other they are usually fighting, I would none the less like some way of implementing avoidance behaviour.

For example, if in the future I wanted to take away their weapons and have many of them wonder around in a crowd, how would I make them not hit / pass through each other, but instead avoid each other? while still following their calculated paths that is.

two ideas I had would be to add steering behaviour and allow that to deviate from their path, or to use a dynamic pathfinding technique. Are these valid solutions? If yes how, in theory, would I implement them? Are there better ways? What is the more respected practice?

sentences:
2D Platform character getting "unaligned" with the map I'm trying to make a 2D Platform game and so far I can have my character moving around in a tiled map and collisions are working too. So far so good.

The problem I'm having is that the character can get "unaligned" with the map if I spawn it without double checking the X coordinate. This means that, on certain conditions, the character could walk over a small gap (just large enough for it to fit in) on the floor.
This happens because the X speed is a constant value, so in one frame the character is standing before the gap but the next frame it's past the gap.

I can solve it by simply making sure the spawning coordinates will be aligned with the map (and the X speed allows it since the tile size is a multiple of it), but it does sound like a fishy solution to me since I may want to add power-ups in the future that increase the speed.

So I'm wondering if I'm missing something on how characters should move or maybe I should actually just double check the spawning coordinates? Or maybe it is a normal thing to happen in a game??

sentences:
How make circle with multiples holes In Unity, how can I programmatically make a shape like:

The gaps in the shape will all be the same size but their number may vary.

sentences:
Is it acceptable to mix simple physics logic with gameplay logic? In my 2D game I have a PhysicsEngine class. It currently does two things:

Called every frame to apply global forces on all entities (e.g. gravity).
Called by the CollisionDetector to do the physics part of collision response.

Currently, (almost) all physics-related logic goes through this class (including single-line things like entity.applyImpulse(..)).

My question is, from an OO design perspective: is it okay for an entity to do simple physics logic by itself, or should all physics logic (even simple things) go through classes dedicated to it?

For example: in my game, when spotting a collision the CollisionDetector notifies both entities to take care of gameplay related logic, and the PhysicsEngine to take care of physics related logic. Looks like this:

// on collision between entityA and entityB
entityA.handleCollision(entityB); // take care of gameplay
entityB.handleCollision(entityA); // take care of gameplay
physicsEngine.handleCollision(entityA, entityB); // take care of physics

But what if, for example when a Missile hits something I want to apply an impulse on the hit object? (In addition to the physics that always happens on collisions, in PhysicsEngine).

This is easy to do by simply adding about 3 lines of code to the handleCollision() method in Missile:

public void handleCollision(Entity entity) {
    Vector impulse = entity.getPosition().subtract(this.position);
    impulse.scaleBy(5);
    entity.applyImpulse(impulse);
    explode();
}

However, this would be putting physics logic in a 'gameplay' class. Should the Missile delegate to the PhysicsEngine in some way? Or is it okay that it would contain physics logic?

Another example I encountered in my game, is that when an entity 'fires' a Missile, I want to apply an impulse on the entity to push it backwards. Again, this can be done easily by adding 2-3 lines to the fire() method in the Entity subclass, but I'm not sure it's okay design-wise to mix gameplay and physics logic.

So, is it acceptable to have simple physics logic mixed with the gameplay logic? Or should I always separate the two?

How is this done in 'serious' games?

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

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

The code:

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

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

How can I solve that?

sentences:
Correct way to "randomly" generate flowing terrain I'm creating a simple top down RTS game.  I plan on it "randomly" generating maps on the fly when I need to.  I plan on it all working in 'passes':

Fill the terrain in with all grass
Go back and add some random spurts of gravel
Round out the gravel
Draw Mountain Landscape on second layer
Round out mountains
etc. etc.

Now, take a look at this picture below:

I hand created this using my map editor but I plan on this basically being the result after hopefully pass/step 3.

How should I go about deciding when and were to place my gravel so that it is at least irregularly shaped and sporadic enough to look natural?

Thanks if you can!  Any and all help is appreciated!

As a side note:

Each pass is basically me iterating through all of my tiles (The map is divided into 40x40 tiles) similar to this:

for (int x = 0; x <= GRIDMAX - 1; x++) {
    for (int y = 0; y <= GRIDMAX - 1; y++) {
        //Terrain(x, y, 0) = SomethingHere;
    }
}

sentences:
How can I optimize performance when updating tiles? So I'm making a side-scrolling adventure type game in Java. The worlds are procedurally generated, so I can't manually place tiles. Therefore, I every 20 ticks (1/3 second) I update every block's tile on the screen. I know this is a terrible solution, and it's causing a bit of lag. I tried only updating the blocks' tiles once when it was created, but it doesn't work well with the way I've programmed my world generation.

Basically, how the ground is generated is the top layer of ground is generated first, then when the player gets close enough, the layers below are created.

public void testForBlocks()
{
        topTaken=false;
        bottomTaken=false;
        rightTaken=false;
        leftTaken=false;

        for(int i=0;i<handler.screenBlocks.size();i++)
        {
                Block b = handler.screenBlocks.get(i);
                if(b.solid)
                {
                        if(b.oneWay==oneWay)
                        {
                                if(b.x==x&&b.y==y+32)
                                        bottomTaken=true;
                                if(b.x==x&&b.y==y-32)
                                        topTaken=true;
                                if(b.y==y&&b.x==x+32)
                                        rightTaken=true;
                                if(b.y==y&&b.x==x-32)
                                        leftTaken=true;
                        }
                }
        }

        setSprite();
}

This means that if I only update the tile's position once, the tile won't recognize that there is a block below it yet(because there isn't), and will be assigned the wrong tile.

Basically, my question is: How can I update tiles, while keeping it efficient?

I feel like I'm missing an obvious solution. Can anyone help me? Thanks in advance. :)

sentences:
music for an arcade game? I'm thinking about music for my brick breaker game, but I don't know how to choose any.

If I'd make a loop from a few seconds, I think it would get annoying very quickly. I also found some longer length tracks (about 2 minutes), but when this is over, it's going to be repeated anyway, just like when you'd select a new level, you'd have to listen to the same beginning of the song again.

I can't put an hour of music in my application, so what would you recommend I'd do for the music?

sentences:
Boat passing under a bridge in a 2D tile based RTS I'm writing a 2D tile based RTS. And I want to add a 'pseudo 3D' feature to it - bridges over the rivers.

I havent't start any coding yet, just trying to think how it fits the collision detection model. A boat passing under the bridge and a unit moving over the bridge will eventually occupy the same cell on the map. How to prement them from colliding?

Is there a common approach to solve such a problem? Or I need to implement a 3D world to do this?

sentences:
SFML: Generate a background image I want to generate a background, which is used in the game, on every instance of the game based on certain conditions. To do so, I'm using a sf::RenderTexture and a sf::Texture like this:

sf::RenderTexture image;
std::vector<sf::Texture> textures;
sf::Texture texture;
// instantiating the vector of textures and the image not shown here
for (int i = 0; i < certainSize; ++i)
{
    if(certainContition)
    {
        texture.setTexture("file");
        texture.setPosition(pos1, pos2);
    } else
    {
        ...
    }
image.draw(texture);
}

The point here is that I draw single textures on a sf::RenderTexture, but because textures always are on the graphic cards memory, I can't exceed a certain map size which I have to.
I also considered using an sf::Image, but I can't find a way to draw an image (i.e. a texture) to it.
The third way I found was using an sf::VertexArray, but this seems to be a bit too low-level for my rather simple purposes.
So is there a common way to dynamically generate a background image based on other existing images?

sentences:
Ice transition particle effect We are small indie team developing a casual mobile game.
We are trying to implement an effect like the normal-to-ice block transition in Angry Birds 2:

How can we implement an effect like this in Unity?

sentences:
Correct way to move player in cocos2d-x chipmunk platformer I'm attempting to make a physics based 2d platformer in cocos2d-x using the built in chipmunk physics engine.  I've not used a physics engine before and I'm having some issues setting the correct values (mass, friction, etc...) for my physics bodies so that I can make the player move correctly.  The problem that I'm facing is that when I add any amount of friction to either the tilemap bodies or the player body, the player moves so slowly that it's almost not visible.

Right now I'm loading a TMXTileMap and creating a PhysicsBody for each tile and a PhysicsBody for the player.  Relevant code for player physics body material:

 auto physicsBody = PhysicsBody::createCircle(this->getContentSize().width, PhysicsMaterial(0.0f, 0.0f, 1.0f));

relevant code for tile map physics bodies:

auto physicsBody = PhysicsBody::createBox(tileSprite->getContentSize(), PhysicsMaterial(0.0f, 0.0f, 0.0f));
physicsBody->setDynamic(false);
physicsBody->setGravityEnable(false);

And here is how I'm trying to move the player:

void Player::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event) {
    log("Key with keycode %d pressed", keyCode);
    switch(keyCode){
        case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
            _impulseX += -700.0f;
            break;
        case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
            _impulseX += 700.0f;
            break;
    }
}

void Player::update(float dt) {
    this->getPhysicsBody()->applyImpulse(Vec2(_impulseX * dt, _impulseY * dt));
}

I currently have all of the PhysicsMaterial values set to 0.0f.  Without setting those to 0 I can't get the player to move, but when they are set at 0 the player appears as if he's moving on ice and there is no friction to slow it down.  Is there something wrong with the way I'm moving the player?  Or is there something wrong with my PhysicsMaterial?

note: I'm not currently using a fixed timestep but plan to in the future.  Could this be causing my problem?

edit:  I've read a few places that it's better to use surface velocity to move a character but I can't find any examples of doing that.  Is it possible using cocos2d-x?

sentences:
Cocos2d v3.4 Templates How to create cocos2d v3.4 without using Cocos2D-SpriteBuilder?

I installed Cocos2D-SpriteBuilder as they recommended in cocos2d blog:

http://cocos2d.spritebuilder.com/get-started

But I need to create cocos2d v3.4 project from Xcode without creating it first in Cocos2D-SpriteBuilder.

Any help?

sentences: How to create axes for a console controller What should I change in the input manager to enable me to use a joystick? I have a usb cable to connect the joystick to the computer but how do I set up the controls?

sentences:
How can I display triangle faces (not quads) in Cinema4D? I started to learn Cinema 4D. I've noticed it's really easy to use for motion graphics, but I want to use it for modeling for games/realtime 3d engines.

Before I used 3dsmax and it was easy to estimate how a model would look/behave in a 3d engine. The two main things I did was displaying Polygon triangles and displaying the Polygon Count.

I've found the Total Polygons tick in HUD settings in Cinema 4D, but I can't find any display mode that will show triangles.

Is there there a way to display triangle faces/not quads in Cinema4D ? If so how ?

There is a Triangulate function, but I'd rather not Triangulate/Untriangulate all the time, especially since it's converting back and forth between the two doesn't always produce the same result.

I imagine I'm asking for old school techniques, but I plan to use these to make low poly models for web(canvas/webGL) and mobile.

sentences:
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've been learning graphics programming for some time now using OpenGL and Linux. I'm pretty familiar with most of the concepts, but I would really like to further my knowledge and eventually pursue a career in game development, especially game engine development.

So far it seems to me that the majority of game studios make games for Windows using DirectX.

Edit: I know that the OpenGL vs DirectX question has been asked here before, but I haven't found an answer in the perspective I want.

Edit 2: After reading all the responses/comments I've decided to continue diving deeper into graphics with OpenGL/GLSL, but I'll try to play around with DX as well, just to have a basic understanding of the API.
I'd like to thank everyone for the answers and insight you've given me.

sentences:
Should I use DirectX 11 for 2d games or should I stick to DirectX 9? After two years now I wanted to continue working on my sandbox project which I actually used to learn and experiment with various C++ features and DirectX. So far I have simple elements for 2d adventures with a very basic engine, external map loading, scripts and this kind of stuff. So far the project was ported once from SDL to DirectX 9 and now I am considering to move on to DirectX 11 and the question would be: should I consider doing the step from DX9 to DX11 even though I am no going to make any 3d content at all?

Although often asked in various threads like this or this one which tech to use I couldn't find a suitable answer as people are referring to 3d rather than 2d.

sentences:
What is the simplest algorithm or pattern to continues ground/Floor Im beginner in 3d gaming , i have basic question not Language specific.
Say i have ground model for example terrain i modeled what is the common way to load the terrain  and use it again Or load another terrain when
the main model for example AirCraft im controlling in the game approaching its end , and i   want the player to see the terrain continue like in never ending world .

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:
Make enemy disappear after spawn I have enemies that spawn in different positions but what I want to do is that if you don't kill it after three seconds, the enemy disappears (but the spawning keeps happening of course, the enemy will show up again eventually). I tried using a coroutine but after reading the documentation and watching some tutorials I still don't understand very well how it works so I need some help. Thanks in advance.
This is my code so far:

public class TimedSpawn : MonoBehaviour {

    public GameObject spawnee;
    public bool stopSpawning;
    public float spawnTime;
    public float spawnDelay;

    private GameManagerScript GMS;

    void Start ()
    {
        GMS = GameObject.Find ("GameManager").GetComponent<GameManagerScript> ();
        InvokeRepeating ("SpawnObject", spawnTime, spawnDelay);
    }

    public void SpawnObject ()
    {
        if  (GMS.counterDownDone == true){

        Instantiate (spawnee, transform.position, transform.rotation);
     }

        if (stopSpawning) {
            CancelInvoke ("SpawnObject");
        }
    }
 }

sentences:
How do I check to see if a tile corner is visible in 2d space? I am trying to implement fog of war, and I have run into trouble. I want to check to see if the player is able to see the corners of each tile within a certain radius, however I am unsure how to check if the vision of the corners is to be obstructed or not. Is there a quick way to do this? I used a system of drawing a line and checking if the tiles the line is on are solid blocks in a rougelike, but I am unsure if this method would be suitable, as it is possible to see parts of a tile, unlike in a rougelike where it's a yes or no type thing.

For example, the black tile is obstructing the view partially of the white tile.

The red lines signify that the player is able to see the corner, while the blue signifies they can't (as the black obstructs it).

sentences:
Alpha From PNGs Butchered I have a pretty vanilla Monogame game. I'm using PNG for all my sprites (made in Photoshop). I noticed that XNA is butchering the aliasing; no matter what I do, my graphics appear jaggedy.

Below is a screenshot. The bottom half is what XNA shows me when I zoom in 2X using a Matrix on my GraphicsDevice (to make the effect more obvious). The top is when I pasted the same sprites from Photoshop and scaled them to 200%.

Note that partially transparent pixels are turning whiteish.

Is there a way to fix this? What am I doing wrong?

Here's the relevant call to draw to the SpriteBatch:

spriteBatch.Draw(this.texture, this.positionVector, null, Color.White, this.Angle, this.originVector, 1f, SpriteEffects.None, 0f);

(this.positionVector can easily be Vector.Zero; Color.White as 100% alpha, I think; this.Angle can be a real angle (small > in the image) or zero (the orb itself).

sentences:
Preventing banding textures in DirectX I have a 3D scene that I've tried rendering in Direct3D 10 and using WPF's 3D framework. Obviously, going directly to Direct3D is producing far better performance but I am getting banding which doesn't appear using the same scene in WPF.

Does anyone have any tips on removing this type of artifact? It's obviously possible because WPF doesn't have it... If you have any questions about my Direct3D setup I will be please to add that information.

WPF:

Direct3D:

sentences:
(Unity) Optimised networking solution for many moving objects I've currently undertaking quite an ambitious project. In short, it's a real time multiplayer strategy game which has bacteria mechanics.

Essentially, I have two remote players in the environment, and they can spawn bacteria-like units which attack each other and multiply, duplicating themselves until a resource limit is hit.
This often results in around 200+ game objects being rendered to the screen, each with their own state and movement. This sounds bad, but the local gameplay against a bot is actually very good, and I've managed to make it quite performant.

However, the issue arises when I try to network this game. I have already attempted to follow this guide to implement this feature: http://www.paladinstudios.com/2013/07/10/how-to-create-an-online-multiplayer-game-with-unity/

This produces quite a slow, displeasing game experience even with the best latency. This is likely caused by having to transmit movement data for hundreds of units.

The question I am posing:

How can I optimize the networking and synchronization of many moving units between two clients?

I've already thought of one way to do this. After spawning a unit, they will only travel in one direction until they hit something - perhaps I can synchronize only when units are spawned and when they interact with another object? Would this have much benefit? What's the ideal way to implement this?

Thanks in advance for responses!

sentences:
Is it possible to access vertex values of an object created using display lists? I wanted to learn to develop games so started with tetris. I encountered a problem right in the beginning. My game is 20% ready. There are five types of shapes viz YELL, BOX, LINE, TEE, YEL which are shapes of different kinds. I created five display lists like this

#define YELL 1
#define BOX 2
#define LINE 3
#define TEE 4
#define YEL 5
int bs=20;
void defineshapes()
{
glNewList(YELL,GL_COMPILE);
    glPushMatrix();
    glTranslated(-bs,0,0);
    glColor3fv(color[color1]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(bs,0,0);
    glColor3fv(color[color2]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(bs,0,0);
    glColor3fv(color[color3]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glTranslated(-2*bs,-bs,0);
    glColor3fv(color[color4]);
    glBegin(GL_POLYGON);
    glVertex2i(0,0);
    glVertex2i(bs,0);
    glVertex2i(bs,-bs);
    glVertex2i(0,-bs);
    glEnd();
    glPopMatrix();
glEndList();
glNewList(BOX,GL_COMPILE);
    glPushMatrix();
      .....

and randomly picking one like this

srand(time(NULL));
color1=rand()%6;
color2=rand()%6;
color3=rand()%6;
color4=rand()%6;
defineshapes();
randshape=rand()%5+1;

and drawing in display function like this

void display()
{
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
    glTranslated(x2,y2,0);
    glCallList(randshape);
    glPopMatrix();
    glFlush();
}

I expected problem in the beginning itself when i used the display lists because i had to access the vertex values(x,y) of the shapes to check if they might overlap with another block below before moving them down. Is there a way of knowing the vertex values of objects drawn using display lists.

I encountered the same problem once before when i needed to create a tyre of a car. I wanted the tyre to be painted with colors so created a mesh by rotating a circle again using display lists. Then i needed to know the values of the intersection points of longitudes and latitudes which i didnt know how to get so i abandoned that task.

A YELL looks like this

What is the easiest method of getting around this problem. I am sure OpenGL has a way of getting this done but i am new to it.

sentences:
Solution for lightweight LAN peer discovering? I built a library for purely cross-platform programming. My games made with it run fine in Android , Pc, Linux, Mac etc.

The networking capabilities are provided by ENET library, therefore all communication between my apps is not TCP or UDP compatible, but only in the custom protocol, even tough its based on the UDP ultimately.

I don't think its possible to do what i want with ENET, thats why I ask here for help!

Lets say I have the same game running in my Android phone, my laptop and my pc. They are all in the same wifi network, and therefore in a LAN, whether its Wifi hotspot(?) or the household router.

I need each of those 3 peers to discover the other two in the network. This is meant only to find the IP of alive apps in the LAN network, to be able to host multiplayer games between them.

I can only think of one effective way to do this, UDP broadcast, wait responses, but if that is the solution, i need something small, since its the only purpose of the implementation.

Other way could be to try to connect to all IPs in the LAN address subrange, but I don't think the OS would be with me on this one :p

sentences:
Unity AssetBundles, server and security concerns We're trying to implement AssetBundles in our current Unity project for Android and iOS.

My question is about security. To download AssetBundles, our application need to connect to our server. On our server, we got a web service that returns the download link for the bundle needed by the application.

However, the ID and password to connect to our web service are written in plain text in our application. This may sounds as extremely naive, but is this an issue? Could someone find the ID and password from say, the .apk file?

I don't have a lot of knowledge in the field of servers and network security, so I'm trying to keep up with what our team is doing.

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:
How can I place nice-looking tile-based cliffs automatically? Legend of Zelda: A Link to the Past had some pretty nice cliffs. I'd like to create something similar, but am having trouble figuring out how to place them.

Image is from:
How did LoZ: A Link to the Past handle sub-tile collisions?

Anyways, I have a bunch of tiles like in the above image. How can I simplify how they are placed in the game world?
I currently have a 50x50 grid and a painter class in Java that tells the system where to place the tile:
Painter.fill(this, 15, 30, 13, 50, Terrain.EMPTY) would fill X-15 and Y-30 with a set of EMPTY tiles (basic ground tiles) 13x50 tiles wide.
I can also apply 'for' loops to paint the entire map with a type of tile, or tell it to only make a row X-tiles long, like this:

for (int i=0; i < LENGTH; i++) {
        if (map[i] == Terrain.EMPTY && map[i+50] == Terrain.WATER){
            map[i] = Terrain.CLIFF_S_BOTTOM;
            map[i-50] = Terrain.CLIFF_S_MID;
            map[i-100] = Terrain.CLIFF_S_TOP;
        }
    }

Is there a simpler way I could be telling my code to place lots tiles in a particular formation quickly?

EDIT: I just learned about the concept of bitmasking. I think this will solve most of my problems, but I'm still open to other ways of solving the problem.

Enums keep appearing as a possible alternative to the bitmask solution. Are they viable for this application?

sentences:
Unity/VS debugging only with UnityVS? Hi,

this one thing isn't clear to me:
Is it possible, to debug C# of Unity 4.3 with Visual Studio 2013 without any plugin?

If no, what or how else should I debug then?

sentences:
Photon-Unity Instantiation not working I use Unity and Photon for the multiplayer. I Instantiate my gameObjects using this method :

void LoadGameObject(PhotonPlayer player,bool isMaster)
 {
  if (isMaster)
  {
    GameObject baby = PhotonNetwork.InstantiateSceneObject(babies[0].name,
    babies[0].transform.position, Quaternion.identity, 0,null);
    baby.SetActive(true);
    Debug.Log("playerpref created on " + player.ID);
  }
  else
  {
   //Nothing for the moment
  }
}

I call the method in "OnJoinedRoom()" and "OnPhotonPlayerConnected(PhotonPlayer other)", but when the second player join the room, he can't see the gameObjects because they aren't activated on his scene.

Any Idea of the mistake ?

sentences:
Time complexity of solving constraints in physics engine Erin Catto mentioned in a talk that solving constraints precisely requires cubic time and quadratic space. What algorithm is he talking about when he mentions cubic time?

pdf of slides with following quote:

  We can model and program our constraints perfectly. Good enough to drive a robot arm on an assembly line or
  launch a satellite into space. Unfortunately for games, we do not have enough cycles to solve constraints accurately.
  Solving constraints precisely requires cubic time and quadratic space. For games we make due with linear time and
  space, so we are constantly wrestling with our solvers. The better you understand constraint solvers, the better
  chance you’ll have of creating robust simulations in your game.

sentences:
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:
Why are huge polygon amounts bad? It is always said that the polygon amount of a single modell must be as little as possible when it comes to realtime simulations such as computer games. (Or at least lower than when rendering a movie)
I am fully aware that this must be done in order to save performance. But aside from that information i cannot find why huge polygon amounts must be avoided.

(In Short: I know that polygons eat performance. I want to know why they eat performance)

So my question would be:
What happens when a frame is rendered? The polygons are surely somehow processed in the graphicard. What happens there?.
If possible i would like to have some links to sites containig this information.

sentences:
How to change AddForce code to MovePosition or SetVelocity? Vector2 vec = new Vector2(horizontal, vertical);
    vec = Vector2.ClampMagnitude(vec, 1f);

    Vector3 camF = cam.transform.forward;
    Vector3 camR = cam.transform.right;

    camF.y = 0;
    camR.y = 0;
    camF = camF.normalized;
    camR = camR.normalized;

    targetPosition = (camF * vec.y + camR * vec.x) * MoveSpeed;

    Vector2 targetVelocity = (targetPosition - transform.position)/Time.deltaTime;

    rb.AddForce(targetPosition - rb.velocity, ForceMode.VelocityChange);

My problem is my character doesn't affects by the gravity when i changed my code from transform.position to rb.AddForce. I searched online and even asked here how to calculate gravity and add it to my character, nobody knew, so i think if i can change this code to rb.MovePosition or rb.SetVelocity maybe it does affects by the gravity?

sentences:
May I distribute a game engine that is based on textbook examples? I have purchased several game programming books to start my journey as a game developer. One of them teaches its readers by building a game engine's parts in each chapter until finally you have a complete working game engine. It's bare-bones, but still a game engine.

What exactly am I allowed to do with this engine, as far as releasing an indie game of my own? Is it copyright infringement if I attempt to use the game engine from the book even with my little changes and adjustments?

sentences:
Dynamic Mesh Generation Algorithm I was recently given an assignment to generate a mesh from code, in Unity.

  At runtime, the player will click at random positions on the screen.
  An array will store all these points. There must be at least 4 points
  for the calculation to take place. The users clicks will stop getting
  accepted once the player has clicked very close to the first clicked
  point (till here, I got it to work).

  After all the points are added to the array/List, a mesh should be
  created from those points.

I thought of a few algorithms to work it out. First one - Delaunay triangulation

But what if there are 5 points on the same circle for the mesh? This negates the Delaunay's algorithm.

So I figured I'd first take the entire list of points, and parse through each point to find a convex hull. And then try to do each of the triangles within.

I'm not sure if I'm doing this the right way, or if there is any better way for what I want to do. If this is the best way, I don't know how to do the algorithm for the triangulation inside the convex hull

sentences:
Custom Music in Skyrim's Creation Kit? Can you bring in external music such as mp3s?  If so, how?  I didn't see anything about this in the wiki Bethesda released.

Also how does this work with regards to the Steam Workshop?  Don't imagine they would appreciate uploading copyrighted content.  I don't particularly care about making a public mod, I just want to screw around privately and create dungeons/towns using music from some of my favorite games.

Thanks.

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: Getting grid coordinates of cells bordering a square region I have a board that is 4x4 ( the blue cells) with the origin (0 , 0) being in the bottom left for example, how can I get the coords which are adjacent to the board (the red cells) to store them in an array?

sentences:
Maintaining frame rate while using many High Resolution models I have shelves "made of" steel rods as a 3D-file. So a lot of virtual metal rods make up a cage. When cloning this in unity a few times even my fast computer can only show this in a choppy way. But using an opacity map yields a flat result, which I don't want. For realism purposes there should be cylinders or similar, i.e. real 3D objects or the impression of real 3D objects, at least in close range.

How could I do that with more shelves without making the frame rate drop considerately?

I found that even though I am using opacity maps(128 x 128) just ten shelves and even 3dsmax begins stuttering.

EDIT: I uploaded a demo, it's for Win, X86 and X64. Get it here: http://www.sockshare.com/file/08BD739BDF94601C You need the opensource 7zip to extract.

sentences:
Finding a point between 2 moving points colinearly , given 2 moving points and distance P/S: The engine I work on doesn't have grouping integration. That's why I need a formula to change the position.

A------B---------------C

A and C are moving points that can move anywhere

A = (xa, ya), C = (xc, yc)

B (xb, yb) is a point between A and C colinearly

With one condition that distance of AB = constant = r, distance of AC can be varied.

How to find xb and yb?

Asked from Mathematics StackExchange:

  Deepak says:

  The locus of all possible points B is a circle centred on A and of
  radius r. The intersection between this circle and line AC will give
  you point B (and another point opposite it on the circle which you can
  neglect).

  Try to write down the relevant equations and solve them?

Example: http://www.mathopenref.com/collinear.html

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:
GLFW3. Destroying and create new window results in a black window I am trying to write a fullscreen toggle handler and running into an issue.

In order to change between fullscreen and windowed I need to destroy the current window and create a new one with the 'monitor' parameter changed. I have written this and the program changes between windowed and fullscreen fine. However the new window that is created is not being rendered to and is black.

For simplicity I have reduced the code to the following that just creates a new window with the same parameters:

/* generic set up stuff */

//main draw loop
while (!glfwWindowShouldClose(window)) {

    /* generic draw stuff */

    if (GLFW_PRESS == glfwGetKey(window, GLFW_KEY_F)){
        glfwDestroyWindow(window);
        window = glfwCreateWindow(g_gl_width, g_gl_height, "Title", NULL, NULL);
        glfwMakeContextCurrent(window);
    }
}

When the program first loads everything renders fine. When I hit F, a new window is created but it stays black.

Any ideas?

Kind regards.

sentences:
How do I implement unit selection in this program? I'm trying to implement unit selection on a large, scrollable surface.

# Arbitrary values for window size
self.w, self.h = 1600, 900

# Game world surface, everything gets blitted to this, which is then drawn to the screen:
self.mapSurf = pygame.Surface((3600, 3600))

The general process looks like this:

# draw the floor first
    for e in self.map_layout.fixed_list:
        if e.type == 1:
            self.mapSurf.blit(self.map_sprite_list['floor_red'], e.rect)
# then draw the walls
    for e in self.map_layout.fixed_list:
        if e.type == 2:
            self.mapSurf.blit(self.map_sprite_list['wall'], e.rect)
# add agents (units) to the mapSurf
    for a in self.agent_list:
        self.mapSurf.blit(self.map_sprite_list['proto_unit'], a.pos)
# draw everything to screen
    self.screen.blit(self.mapSurf, self.mapSurfRect)

I have a method for getting the coordinates of a click on the screen. And tried to use this to select units.

def mouseUp(self, button, pos):

# select agent
    if button==1:
        for a in self.agent_list:
            if a.pos.get_distance(vec2d(pos)) < 24:
                self.selected.append(a)

The problem is that the value pos does not correspond to the mapSurf, but rather to the self.screen surface, so when comparing a.pos to the pygame event.pos returned from mouseUp, this function can only return coordinates within the window size, and I can't select agents which are spawned outside of the top left area of mapSurf.

What would be the general method of selecting units I need to implement to fix this program?

For some more details, here are three relevant links, all of which describe different aspects of how my program was built:

Trying to make a python map editor

Collision detection performance problem

Pygame performance issue for many images

sentences:
Create and use a Button class on AS3.0 I am currently working on a game and it is all going well.
On the shop screen there are several buttons that affect the player's stats for when the player restarts the game.

The button's names (with a text on the left), however, are rather cryptic and it's hard to figure out what they do unless you test or something.

So the solution I came up with, is to create an InfoBox with an InfoText inside so that when the cursor is over the button it appears with the description, cost and etc.

This I managed to do too however, the way I was about to do it would mean that I had to create 3 event listeners per button (CLICK, ROLL_OVER, ROLL_OUT) and, obviously, 3 functions connected to each event listener.

Now, I don't mind much about having 1 event listener per button, for the click, but since the other events are just to make a box appear and disappear as well as display some text, I thought it was way too much of a mess of code.

What I tried to do: I created a new class called InfoBoxButton, and this is the class' code:
    package  {

import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.ui.Mouse;
import flash.events.MouseEvent;

public class InfoBoxButton extends SimpleButton
{
    public var description:String;
    public var infoBox:InfoBox;

    public function InfoBoxButton(description)
    {
        this.addEventListener( MouseEvent.ROLL_OVER, displayInfoText, false, 0, true);
        this.addEventListener( MouseEvent.ROLL_OUT, hideInfoText, false, 0, true);
    }

    private function displayInfoText()
    {
        infoBox.infoText.text = description;
        infoBox.visible = true;
    }

    private function hideInfoText()
    {
        infoBox.infoText.text = "";
        infoBox.visible = false;
    }
}

}

But now I don't have an idea how to associate it with the button, I have tried this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

The SoonButton is a button I made on the shopscreen, SoonButton is it's instance name, but I can't think of a way of associating one button to the other... I have been fiddling with the code for like 3 hours yesterday and no luck... can anyone give me some pointers on how I should go about doing it?

--EDIT--

I tried to trace the SoonButton after it is created like this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

and I got an error saying:
    1120: Access of undefined property SoonButton.

if I separeted the first line a bit to:
    public var SoonButton:InfoBoxButton;
    SoonButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

I would get the same error but two times, for each SoonButton... so clearly it must be the InfoBoxButton that isn't being created... what am I missing?

sentences:
How to move the camera to center an object in screen? For example, an object is located at (x,y,z) in world space. Now how to calculate the offset translation, I mean no rotation, that will be applied to the camera so as to place the object at the center of the screen?

BTW, I'm using three.js r91. But pseudo code/C++/C# is also OK.

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:
Bandwidth cost / hour for one MMORPG player I am trying to calculate / guesstimate the costs of running an MMORPG for a client. And now I need a pretty accurate estimate for the monthly bandwidth cost so I can calculate the possible revenue of the investor / client. So what is a pretty reasonable bandwidth cost for each player per hour?
The MMORPG I'm trying to make is a virtual conference with gamification. We can go to booths, see other people, make a transaction in the booths. And we will also have a quest and mini-game system for the gamification.
We will be making it using Unity + Forge. We were thinking of using Photon before, but when I reached out to them, they said I need to subscribe for Photon Industries since it's not a game, per se, which is like 2.5x the cost of PUN.
We will split the server into two: the game server and the REST API server. I'm in charge of the game side of the project so the REST API and backend is not my jurisdiction. I this is the specs of the game that I had in mind:

The event will be held for 10 days, possibly running 24 hours straight.
Max customer that we have anticipated is around 1000-2000 CCU
There will be multiple scenes / rooms that the customer can go to (e.g. Commerce area, Lobby area, Mini-Game area, etc)
The quest system, booth transactions, and other features that doesn't need real time update will be handled by the backend.

So that leaves these data that needed to be synced:
Player:

position : 4 bytes * 3 (X, Y , Z) = 12 bytes
currentScene: 1 byte
avatarModel: 4 bytes (will use bitmasking to handle the current type of clothing and accessories of the player model)
playerAction: 4 bytes (player's enumerated action type)
playerActionTarget: 4 bytes (player's action's target)

Scene:

sceneStatus: 16 bytes (any status of the current scene e.g. the current quest. Still unsure how many bytes I need to sync)

So, this is what I have calculated so far using AWS EC2 (possibly wrong):

sentences:
How can I achieve this lighting with OpenGL? I'm currently trying to implement a type of "smooth" lighting. How can I achieve lighting which looks like this:

http://dl.dropbox.com/u/1668516/concept/warp3.png

Using OpenGl. I've attempted to use blending modes and have come very close to making it work but it came out like this:
https://pbs.twimg.com/media/A1071viCEAAlFmJ.png

Edit:
The technique usedis drawing the lighting image (a white gradient) then drawing all my images using the blending effect glBlendFunc(GL_DIST_COLOR,GL_ZERO)
however the images come out slightly transparent as shown previously I also have no control of how dark the black background is.

and I also wasn't able to change the alpha of the black background which I want to be able to do.

Could I get a few pointers in the right direction?

sentences:
why one model can have different vertices and normal size? I am using TinyObj to load models.  I found many obj files have different vertices and normal size, how could it happen?  I thought in the obj file one normal should be correspond to one vertex.

For example, I am loading one apple model, the vertices size is 6492 and normal size is 6557.  How to handle this stituation?  Some files have more vertices and some have more normals. Does it means I have to give up some attributes of the model?

I also found the obj file has normal index, but I dont know how to use it.  Does it matter to this problem?

In opengl/directx I have only used vertex index in the index buffer.

Can you give me some idea or reference about it?

sentences:
Adding an InputListener to a Group I'm trying to detect when a Group actor (my "slot") on my stage is clicked by add an InputerListener to the group. I've added the stage to my InputMultiplexer, but when I click on the actor, nothing happens.

Relevant code from the main Screen:

InputMultiplexer inputMultiplexer = new InputMultiplexer();
Stage stage = new Stage();
inputMultiplexer.addProcessor(stage);
Gdx.input.setInputProcessor(inputMultiplexer);

From the Group class:

Label amountLabel = new Label("", GameScreen.labelStyle);
Image itemImage = new Image();
Image slotImage = new Image(new TextureRegionDrawable(new TextureRegion(new Texture("Slot.png"))));
public SlotGroup() {
    this.addActor(amountLabel);
    this.addActor(itemImage);
    this.addActor(slotImage);

    this.addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("Hello world");
            return true;
        }
    });
    this.setStage(Screen.stage);
}

sentences:
No more FallbackHand in SteamVR Player prefab A few weeks ago when I wanted to test some VR stuff in Unity without an HTC Vive I could add the Player prefab from the SteamVR asset and then fly around while testing the game just like in the editor. I could also interact with something like a Throwable with my mouse.
Now it looks like they changed the asset and when I test the game the first time the SteamVR Input window pops up. I just went with the default settings there and hoped it would work just like before. It didn't.
Now I can still fly around but I can't grab and move anything like a Throwable. This small red ball (the Indicator GameObject) that is placed by raycasting on the GameObject I would interact with also doesn't move anymore when I move. It just stays where I placed the Player prefab.
I already tried it with the most basic example possible. A fresh project, imported the Steam VR asset, added a plane as a floor, added a cube and gave it the Throwable component, added the Player prefab. A few weeks ago this worked just fine.
Do I have to make some settings in the SteamVR Input window? Nothing there looks like it would affect this Indicator GameObject for the NoSteamVRFallback.
What do I have to do to be able to develop for the Vive without a Vive attached to the computer as I did before?

I'm using Unity 2018.2.13f1. When I'm opening an older project that has still the old version of the asset it works as expected. So the version of Unity itself is not the problem and rather the SteamVR asset.
The version of the SteamVR asset in the older project is 1.2.2. Right now it's not working with version 2.0.1.

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:
Should frame update and network packet sending synchronous or asynchronous? I am making a game server that has 60 Update-Per-Second (assume I can most of the time achieve it). In the current model, my main loop does the following tasks in sequence:

Update game logic (position, etc...)
Serialize the data to JSON string
Broadcast the data (through WebSocket) to the clients. Currently the broadcast method is async, that means my server does not stop and wait for the broadcast to finish.

I have 3 questions:

Is it good to send the packages at this frequency?
Should I cap the UPS to 30 instead?
Should I separate the broadcast into another thread, so no matter the UPS of my server, the broadcast will do asynchronous time and depend on the update?

Here is my current code:

public MusicGame(GameRoom room)
{
    this.Room = room;
    this.ConnectedSessions = new List<GameBehavior>();

    this.timer = new Stopwatch();
    this.timer.Start();

    new Thread(() =>
    {
        while (!this.Disposed)
        {
            float delta = (float)this.timer.Elapsed.TotalSeconds;
            if (this.timer.Elapsed.TotalSeconds < MusicGame.FpsLimit)
            {
                Thread.Sleep((int)((MusicGame.FpsLimit - delta) * 1000));
                continue;
            }
            this.timer.Restart();

            delta = Math.Min(DeltaTimeLimit, delta);
            this.Act(delta);
        }
    }).Start();

    this.CurrentScreen = new WaitingScreen(this);
}

public void Act(float delta)
{
    if (this.CurrentScreen != null)
    {
        this.CurrentScreen.Act(delta);
        this.CurrentScreen.SerializeData();

        var data = this.CurrentScreen.SerializedData;
        this.BroadcastGameAsync(data);
    }
}

I am using C# Console Application and WebSocketSharp if it matters.

sentences:
How can I obtain in-game data from Warcraft 3 from an external process? I am implementing a behavior algorithm and would like to test it with my lovely Warcraft III game to watch how it will fight against real players.

The problem I'm having is that I don't know how to obtain information about in-game state (units, structures, environment, etc.) from the running WC3 game. My algorithm needs access to the hard drive and possibly distributed computing, that's why JASS (WC3's editor language) isn't appropriate; I need to run my algorithm from a separate process.

Direct3D hooking is an approach, but it wasn't done for WC3 yet and a significant drawback of that approach would be the inability to watch how the AI performs online, since it uses the viewport to issue commands.

How I read in-game data from WC3 in a different process in a fastest and easiest way?

Precisely what I need for Warcraft 3 exists for Starcraft: BWAPI.

sentences:
What strategies are best for managing Game Center and offline saves in the same app? I have an iOS app for which I want to use the Game Center API for saving games. At the same time, I want to have the option to save multiple games on the local file system, using the familiar save-slots mechanism. I anticipate that a user may not wish to use the Game Center, or may wish to support a guest user on their device.

I initiate authentication and loading asynchronously, as recommended by Apple, which in itself causes issues as the callbacks may arrive before or after the ViewControllers which are interested in them are loaded.

Typically, the app starts before the authentication is complete, which means the offline games are available first and the game center games become available at a later point. However, if the user is using the Game Center, it is likely that these later arriving games are the ones that would be interesting.

I am wondering how to handle these two sets of save-games. My first thought was to allow the user to explicitly switch between Game Center mode and local mode, but Apple explicitly says that you should not do this. I also want to avoid blocking waiting for the authentication to complete. I have to admit that, since I am still in development, I lack the ability to try out various strategies easily.

Are there any good patterns for managing both online and offline saves in an iOS app?

sentences:
How can I sample from a normal distribution in HLSL? I need to 'distort' individual pixels inside a compute shader node of an Unreal material. Specifically, the pseudocode for this per-pixel operation looks as follows.

pol = // analyze the pixel values here to output either +1 or -1
C = (pol > 0) ? Cp : Cm;
sigma_C = (pol > 0) ? sigma_Cp : sigma_Cm;
if(sigma_C > 0)
{
    C += sampleNormalDistribution(0, sigma_C);   // zero-mean normal distribution
}

How can I sample from a normal distribution through HLSL to achieve this?

sentences:
How can this kind of entity/component organization improve cache efficiency? I've been reading up about entity component systems as a design pattern for an OpenGL engine. The style I'm trying to implement has entities only being integers, and components being long contiguous arrays of, for example glm::vec3 for a world-position component.

The entity integers then work as indices into those arrays. All of this described best by this post.

As I understand, the main benefits of an ECS would include:

Simplification and elimination of unnecessary dependencies and spaghetti code
Performance boost: contiguous component arrays translate into fewer cache misses and an overall de-bloating of complex inheritance

While I do agree with the first point, I don't understand how the second could be true.

On a regular draw call, you'd need almost always the majority of components. You need position, scale, rotate for loading a MVP matrix into the shaders. You need the mesh and textures for rendering itself. You even need details like light color or whether or not it casts shadows. Everything! This means that you will inevitably encounter cache misses in some form, since you can't fit your component arrays in cache.

Add to that the fact that since the entity integers are indices into the component arrays, all of the component arrays need to grow in size whenever you add an entity - independent of it's type. This means that adding 30 entities with no mesh will inevitable generate 30 empty mesh allocations that will never be used.

How would you implement such a system to truly minimize cache misses without incurring in unnecessary memory waste?

sentences:
Where can I get a list or data base of light reflectance values for different materials? I'm implementing lighting for a WebGL app but I'm not an artist so I don't know how to generate or where to obtain a list of materials with its values (diffuse, specular, ambient and shininess). I've been searching a lot but with no luck.

Is there any list or DB I might have overlooked? Any common repository or something similar?

Thanks in advance.

Note: English is not my main language, let me know if you don't understand something and I'll try to rephrase it.

sentences:
DragonBones import question Most DragonBones tutorials I've found seem to have you importing separate files at the start of a project, but the example projects use a single PNG texture containing all the parts of the final armature, along with an accompanying JSON file that says how to chop up the texture to get at each part.

How would you create this pair of files?

sentences:
How can I split my terrain into quads so that each quad would have a renderable vertex/index buffer? (DirectX11, C++) I am creating a quad tree to store my terrain in chunks and currently have the implementation working to an extent.

I am currently starting with a grid of triangle pairs that make squares and splitting this down into quads. I have my vertices split into quads, but I'm struggling with the indices.

Here is how I generate the plane

snip

This gives me one list of indices, and one list of vertices. This is taken by the quadtree and split into different vertex lists and stored in different nodes. This works fine and the vertices seem to be correct, however I'm not sure how to create the indices for each vertex list as before I was doing it based on the height and width of the whole terrain. How would I create an indices list for each node in the quadtree or is there a better way to do this?

If I just use the whole list of indices for each node, I get weird results

Edit: There is an issue generating my plane, I am fixing this and seeing if it resolves my problem.

Edit: I have edited the topic title to something more suitable.

I have fixed my issue with the grid generation and I am using a smaller grid to make the issues more clear. I am using a 2x2 grid (9 verts, 24 indices, 8 tris) which is split into 4 quads (4 verts per quad, 2 tris per quad) and it's almost working, just a small issue with one of the sides.

I know this is potentially duplicating verts on a small scale, but on a larger scale with culling, this should actually save performance. Can anyone spot what's going on? Vertex issue? When splitting the quads, should it be by triangle, vertices, or indices? What happens if we split by triangle and a triangle overlaps 2 quads (although  this shouldn't happen)

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:
Calculating Directional Shadow Map using Camera Frustum I'm trying to calculate the 8 corners of the view frustum so that I can use them to calculate the ortho projection and view matrix needed to calculate shadows based on the camera's position. Currently, I'm not sure how to convert the frustum corners from local space into world space. Currently, I have calculated the frustum corners in local space as follows (correct me if I'm wrong):

float tan = 2.0 * std::tan(m_Camera->FOV * 0.5);
float nearHeight = tan * m_Camera->Near;
float nearWidth = nearHeight * m_Camera->Aspect;
float farHeight = tan * m_Camera->Far;
float farWidth = farHeight * m_Camera->Aspect;

Vec3 nearCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Near;
Vec3 farCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Far;

Vec3 frustumCorners[8] = {
    nearCenter - m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near bottom left
    nearCenter + m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near top left
    nearCenter + m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near top right
    nearCenter - m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near bottom right

    farCenter - m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far bottom left
    farCenter + m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far top left
    farCenter + m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far top right
    farCenter - m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far bottom right
};

How do I move these corners into world space?

Update:

I'm still not sure if what I'm doing is right. I've also attempted to build the ortho projection by looping through the frustum corners and getting the min and max x,y,z coordinates. Then simply setting the values of the projection as:

left = minX
right = maxX
top = maxY
botton = minY
near = - maxZ
far = -minZ

I've searched on the internet but all the tutorials use hard coded values so the shadow maps aren't applicable to an open world but a restricted portion of the scene. Any help? Pseudocode is preferred as my linear algebra skills (and reading skills) aren't that great

sentences:
game resuming stats password i'm asking for a more clever encoding algorithm to retrieving game stats
which generates a shorter and more clear password

for example i have this information's to be saved via a short CODE

Health                    0 - 99
Armor                    0 - 99
Ammo                    0 - 999
Shells                     0 - 99
Rockets                  0 - 9
Weapon1                0 - 1 // picked or not (boolean)
Weapon2                0 - 1
Weapon3                0 - 1
Weapon4                0 - 1
Level                       1 - 3

what i did :

an inline example of above information's :
99    99  999 99  9   1111    3

the encoded result with base64 as String : OTkgOTkgOTk5IDk5IDkgMTExMSAz

the encoded result with base64 as Decimal : Y2PPp2MJ0ZcD (good but long yet)

what i know is to handly encoding some part of the code
for example for boolean part, there is only 16 states, 0000 0001 0010 0011 ...etc

so it can be reduced to only 16, information could be reduced to: 99 99 999 99 9 16 3

then result will be still same : Y2PPp2MJEAM= (ogly and long)

i used this website for decoding and encoding

sentences:
SDL - Limiting loop with timer? Not polling I am using SDL/Glew to create an engine for a game I want to make. I am trying to set a constant framerate of like around 60 (once every 17ish ms). I don't know the best way to do this so I do attempted to do it with a timer.

//Main Loop
int EngineLoop(int interval, CEngine* engine)
{
    Input->Poll();
}
//---------

void CEngine::Start()
{
    _running = true;

    SDL_AddTimer(17, (SDL_TimerCallback)EngineLoop, this);
}

The input poll is this:

void CInput::Poll()
{
    SDL_Event evnt;

    while (SDL_PollEvent(&evnt))
    {
        switch (evnt.type)
        {
        case SDL_MOUSEMOTION:
            *(Rect*)(&MousePosition) = Rect(evnt.motion.x, evnt.motion.y);
            *(Rect*)(&MouseDelta)    = Rect(evnt.motion.xrel, evnt.motion.yrel);

            break;

        case SDL_MOUSEBUTTONDOWN:
            _mouseButtons[evnt.button.button - 1] = true;
            break;

        case SDL_MOUSEBUTTONUP:
            _mouseButtons[evnt.button.button - 1] = false;
            break;
        }
    }
}

This system works perfectly when I put it in some random class function to pump as much as it'd like. But when I introduced the timer, nothing works, no input is taken and the window freezes up. Is it because I am not Polling the events quick enough or?

I tried using a separate timer function that called the class function to poll the input because maybe having it on a different thread is the reason, that didn't work either.

So why didn't this work?
What other approach should I take if necessary?

sentences:
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:
Marching cubes leaving holes in the mesh Hi I'm trying to reproduce GPU Gems 3 chapter 1 (Generating Complex Procedural Terrains Using the GPU) and so far I managed the basics... Now I'm betting some strange output.

I started with the suggested -ws.y to generate a plane. Then when I moved to the noise I noticed some holes in the mesh. But unlike this previous question.

The noise mesh:

So I decided to try something more simple, 3 tubes:
x^2+y^2-2

x^2+z^2-2

y^2+z^2-2

I would assume there is some problem with the z axis. But I can seem to figure out what.
My function to get the triangles vertex positions also seems ok...

Vector3 vertexAlongEdge(int edge, Voxel v){
    Vector3 result=new Vector3(0,0,0);

    Vector3 p1=v.vertexes[edges [edge, 0]];
    Vector3 p2=v.vertexes[edges [edge, 1]];
    float v1 = density (p1);
    float v2 = density (p2);
    if (Mathf.Abs (isoLevel - v1) < 0.00001)
        return p1;
    if (Mathf.Abs (isoLevel - v2) < 0.00001)
        return p2;
    if (Mathf.Abs (v1 - v2) < 0.00001)
        return p1;

    float m = Mathf.Abs((isoLevel - v1) / (v1 - v2));
    result.x = p1.x + m * (p2.x - p1.x);
    result.y = p1.y + m * (p2.y - p1.y);
    result.z = p1.z + m * (p2.z - p1.z);

    return result;
}

The only thing I can think of right now is an error in my table with the edges for each case.
Please help.

sentences:
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:
IOException java problem I'm working through the Head First Java book, and one piece of code it makes me write looks like this:

import java.io.*;
public class GameHelper {
    public String getUserInput(String promt){
        String inputLine = null;
        System.out.print(promt + " ");
        try {
            BufferedReader is = new BufferedReader(
                    new InputStreamReader(System.in));
            if (inputLine.length() == 0) return null;
        } catch (IOException e){
            System.out.println("IOException: " + e);
        }
        return inputLine;
    }
}

But eclipse tells me the exception is never thrown from the try statement, what does that mean?

sentences:
Are there still advantages to using gl_quads? OK, I understand that gl_quads are deprecated, and thus we're not 'supposed' to use them anymore. I also understand that a modern PC when running a game using gl_quads is actually drawing two triangles.

Now, I've heard because of that a game should be written using triangles instead. But I'm wondering if, due to the specifics of how OpenGL makes that quad into two triangles, it is ever advantageous to use quads still?

Specifically, I'm currently rendering many unconnected quads from rather large buffer objects. One of the areas I have to be careful is how large the vector of floats I'm using to make/update these buffer objects get (I have quite a few extra float values per vertex, and a lot of vertices in a buffer - the largest buffers are about 500KB).

So it strikes me that if I change my buffer objects to draw triangles this vertex data is going to be 50% larger (six vertices to draw a square rather than 4), and take 50% longer for the CPU to generate.

If gl_quads still work, am I getting a benefit here, or is the 50% extra memory and CPU time still being used on OpenGL's automatic conversion to two triangles?

sentences:
How do I start the process of looking for playtesters for an iOS game? How does an independent developer typically go about finding a group of people to playtest their iOS game in 2013?

Is it through Reddit? College campuses? Steam Forums?

For example my game is targeted at males, ages 25-33 and the initial test I want to do on an iPad.

sentences: How to make a car move sharper at high speed? I am working on a car-racing game on Unity 2018.1. My car works perfectly at low speed but as it speeds up, I lose control over the car and it starts to drift independently. What can I do to prevent 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:
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:
Linking error when compiling Allegro example I am currently learning about game development tools and decided to use Allegro and OpenGL for starters. I've run into some problems in getting examples to compile though. It seems the allergro.h library isn't linking correctly. Some web searching didn't help.

Here's my example code:

#include <stdio.h>
#include <allegro.h>

int main()
{
    allegro_init();
    //...
    return 0;
}
END_OF_MAIN();

I'm running this command to compile it:

g++ allegroTemplate.cpp -o allegroTemplate

This is the error I'm getting:

/tmp/ccbpAXIY.o: In function `main':
allegroTemplate.cpp:(.text+0x2a): undefined reference to `_install_allegro_version_check'
collect2: ld returned 1 exit status

I'm running this in Ubuntu.

sentences:
Momentum and order of update problems in my physics engine This question is a "follow-up" question from my previous one, regarding collision detection and resolution, which you can find here.

If you don't want to read the previous question, here's a brief description on how my physics engine works:

Every physical entity is stored in a class called SSSPBody.
Only AABBs are supported.
Every SSSPBody is stored in a class called SSSPWorld, which updates every body and handles gravity.
Every frame, SSSPWorld updates every body.
Every updated body looks for nearby bodies in a spatial hash, checks if they need to detect collisions with them. If yes, they invoke a "collision" event and check if they need to resolve collisions with them. If yes, they calculate the penetration vector and directional overlap, then change their position in order to resolve the penetration.
When a body collides with another, it transfers its velocity to the other one by simply setting the body's velocity to its own.
A body is velocity is set to 0 when it hasn't changed position from the last frame. If it also collides with a moving body (such as a lift or a moving platforms) it calculates the movement difference of the lift to see if the body hasn't moved from its last position.
Also, a body invokes a "crushed" event when all its AABB corners overlapped something in a frame.

This is the FULL source code of my game. It's divided in three projects. SFMLStart is a simple library handling input, drawing and updating of entities. SFMLStartPhysics is the most important one, where the SSSPBody and SSSPWorld classes are. PlatformerPhysicsTest is the game project, containing all the game logic.
And this is the "update" method in the SSSPBody class, commented and simplified. You can take a look only at this if you don't feel like looking at the whole SFMLStartSimplePhysics project. (And even if you do, you should still take a look at this since it's commented.)

The .gif shows two problems.

If bodies are placed in a different order, different results happen. The crates on the left are identical to the crates on the right, only placed in the inverse order (in the editor).
Both crates should be propelled towards the top of the screen. In the situation on the left, no crates are propelled. On the right, only one of them is. Both situations are unintended.

First problem: order of update
This is fairly simple to understand. In the situation on the left, the topmost crate is updated before the other one. Even if the crate on the bottom "transfers" velocity to the other one, it needs to wait the next frame to move. Since it didn't move, the bottom crate's velocity is set to 0.
I don't have any idea how to fix this. I'd prefer the solution to not be dependent on "sorting" the update list, because I feel I'm doing something wrong in the whole physics engine design.
How do the major physics engines (Box2D, Bullet, Chipmunk) handle the update order?

Second problem: only one crate is propelled towards the ceiling
I yet don't understand why this happens. What the "spring" entity does is set the body's velocity to -4000 and re-position it on top of the spring itself. Even if I disable the re-positioning code, the problem still occurs.
My idea is that when the bottom crate collides with the top crate, its velocity is set to 0. I'm not sure why this happens.

Despite the chance of looking like someone who gives up at the first problem, I posted the whole project source code above. I don't have anything to prove it, but believe me, I tried hard to fix this but I just couldn't find a solution and I don't have any previous experience with physics and collisions. I've been trying to solve these two problems for more than a week and now I'm desperate.
I don't think I can find a solution on my own without stripping many features out of the game (velocity transfer and springs, for example).
Thanks a lot for the time spent reading this question, and thanks even more if you even try coming up with a solution or a suggestion.

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:
graphics.GraphicsDevice.Clear strange result (XNA) I have such Execution:

graphics.GraphicsDevice.Clear(new Color(255, 0, 0, 0));

Alpha is 0. So why it draws me Red color?

graphics.GraphicsDevice.Clear(new Color(255, 0, 0, 255));

Also draws the same red color. Changing alpha value doesn't affects the color on the screen. Why?

sentences:
Can a 4x4 matrix describe a camera's perspective? I'm working with a closed-source 3D engine, and it only allows you to set the view projection via a 4x4 matrix. Can this matrix describe the camera's translation, rotation & perspective?

I turned perspective on/off in the engine using a function call, and the matrix values are as follows.

Without perspective:

1   0   0   -0.0559203194265751
0   1   0   -0.0251115292255206
0   0   1   -0.016129
0   0   0   0.0926626011715394

With perspective:

1   0   0   -0.0560158276396793
0   1   0   -0.0251013526176432
0   0   1   -0.016129
0   0   0   0.0308875337238465

sentences: How do you add a scripting language to a game? Let's say I have a game written in C++. But I want to add some modding or scripting functionality to it. How would one go about adding a scripting functionality to your game?

sentences:
Is it possible to get object rotation in a shader for dynamically batched objects? All the batched objects have the same rotation. To simulate the effect of directional light I need to determine the object sides actual (world) directions. Normally I would use unity_ObjectToWorld & unity_ObjectToWorld for that, which is not possible when the objects are batched.
Is it possible to pass the object rotation to the shader in one action (since it's the same for all of them) without breaking the batching?

This is a simplified shader example (here I use colors instead of light/shadow effect and only 2 sides instead of 4):
Shader "Test/UnlitTest"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _TopColor ("TopColor", Color) = (1, 0, 0, 1)
        _BottomColor ("_BottomColor", Color) = (0, 0, 1, 1)
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        ZTest Off
        ZWrite Off
        Lighting Off
        Cull Off
        Fog { Mode Off }

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

            sampler2D _MainTex;
            float4 _MainTex_ST;
            float4 _MainTex_TexelSize;
            fixed4 _TopColor, _BottomColor;

            struct vertData
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct fragData
            {
                float2 uv : TEXCOORD0;
                float2 uvW : TEXCOORD1;
                float4 vertex : SV_POSITION;
            };

            fragData vert (vertData v)
            {
                fragData f;
                f.vertex = UnityObjectToClipPos(v.vertex);
                f.uv = TRANSFORM_TEX(v.uv, _MainTex);
                f.uvW = mul(unity_ObjectToWorld, f.uv);
                return f;
            }

            fixed isTransparentPixel(fixed2 uv)
            {
                return step(tex2D(_MainTex, uv).a, 0.0);
            }

            fixed isEdgePixel(fixed2 uv)
            {
                uv = mul(unity_WorldToObject, uv); // back to object space
                return isTransparentPixel(uv);
            }

            fixed4 frag (fragData f) : SV_Target
            {
                fixed isTransparent = isTransparentPixel(f.uv);
                clip(-isTransparent);

                fixed4 c = tex2D(_MainTex, f.uv);
                float2 borderSize = float2(3, 3); // border size in tex pixels
                float dy = borderSize.y * _MainTex_TexelSize.y;
                fixed3 borderColor = fixed3(0, 0, 0);
                float borderColorsCount = 0;
                float2 uvW = f.uvW; // UV in the world space

                // Top edge:
                fixed isEdge = isEdgePixel(uvW + float2(0, dy));
                borderColor += isEdge * _TopColor.rgb;
                borderColorsCount += isEdge;

                // Bottom edge:
                isEdge = isEdgePixel(uvW + float2(0, -dy));
                borderColor += isEdge * _BottomColor.rgb;
                borderColorsCount += isEdge;

                fixed noBorderColor = step(length(borderColor), 0);
                fixed hasBorderColor = 1 - noBorderColor;
                c.rgb = c.rgb * noBorderColor + hasBorderColor * borderColor / max(borderColorsCount, 1);
                return c;
            }
            ENDCG
        }
    }
}

It gets a semi-transparent image as a texture. The image is completely transparent at the edges and contains an opaque shape in the center.

The shader colors the top edges of the non-transparent shape in red and the bottom ones in yellow. It uses unity_WorldToObject & unity_ObjectToWorld to check the edges facing directions in the world space.

sentences:
Given a grid system where some coordinates are marked as impassable, how to find natural-looking car driving path between two locations? I can compute an A* path, but I get only cardinal directions from that.   A 45˚ path would look like "up 1 left 1 up 1 left 1 up 1 left 1..."

My specific question is, given a grid with a pathing solution involving non-90˚ paths, how do you figure out those paths?

I have curves working as described here: https://gamedev.stackexchange.com/a/121016/66189

but I just don't know how to combine it with areas that block the path.  I've seen a little bit about "pulling the string", but very little detail.

Another issue I have is that A* will suggest that I immediately go "backwards" for the facing of my car or take way too sharp of a turn.

edit:  How do I make sure I get the blue line, not the red line, which is unusable, even though A* loves it:

The issue I'm seeing here is that a block that isn't usable on the red path is usable for the blue path -- but A* would mark it as unusable or as having a very bad score when checking the red path.

sentences:
How should I implement a Game Over menu in Android? By Game Over menu, I mean a menu displayed when you die, with an option to play again.

I have two approaches in mind:

Use OpenGL

Have some button textures ready. When the character dies, draw them. Listen for events on those textures.
Use a view

(This is what I'm doing now.) When the user opens the game, I have a basic activity, along with a basic view with a FrameLayout: The root is a GlSurfaceView and there's a menu on top of it (embedded in a LinearLayout). When the user hits "Play", this menu is translated away (using a translate animation) from the screen, leaving only the GlSurfaceView visible, with which the user can interact. I was thinking of implementing something similar when the game ends, but I'm not sure where to start.

I don't particularly like the first approach, since implementing button events in OpenGL seems hard.

How should I approach this?

sentences:
Understanding the "gradient" in Perlin Noise If I didn't get it wrong from the wikipedia, the word "gradient" should represents either the derivative for continuous functions, or the differential for discrete functions.
To rebuild the original function, I would integrate the gradient function, or calculate the partial sum of them.
Dot production between a unit vector and a gradient vector represents the slope/change-rate along the direciton of the unit vector.

But perlin noise seems unable to be explained. We calculate 4 gradient productions between related positions and random generated gradients in 4 corners, then simply interpolate them resulting the final value.

Is there something I've missed? How to understand operations on gradient vectors for perlin noise?

sentences:
Swap buttons in layout Say I have 4 buttons. I want to have button 2 always swap out with another button, randomly.
So, when the user taps button 2, it should swap with another button (randomly).

Now, button 2 is at the bottom right corner. So if the user taps button 2 again, it has the option to
swap with the other three buttons. How can I achieve this?

I have already tried to make an array of the four values:

top_right, top_left, bottom_right, bottom_left

And have successfully had them swap, but it was very memory inefficient, and took a while.

sentences:
How to structure a game that continue even when closed? I'm developing a Unity based game purely for fun but I'm stuck with a problem.
How can I implement a system that keep my game running even when is closed? I don't want to HAVE IT running when it's closed, but I was thinking to add some kind of timer and compute the logic of the game with the time difference between (LAST_SESSION)-(ACTUAL_SESSION).

But how can I implement this? The thing is, how can I "accelerate" the game when I open it so that it's current state is equal to what would have been if I would not have closed it?

EDIT: The game is a sort of RTS. You control a base that has some number of entities that can move independently. Each entity has some kind of job like mine minerals, defend the base from enemy AI, build a structure. The mechanics are the interactions between each entity and the world.

I have a main loop where I update every entity, one at a time. I was thinking that I could do some kind of Load function that calls that main loop with a time_elapsed variable and with every iteration lower this variable by Time.deltaTime or something like that, and when it reaches zero I can start the game.

Sorry for my bad english.

sentences:
Rendering skybox in first person shooter I am trying to get a skybox rendered correctly in my first person shooter game. I have the skybox cube rendering using GL_TEXTURE_CUBE_MAP. I author the cube with extents of -1 and 1 along X,Y and Z.

However, I can't wrap my head around the camera transformations that I need to apply to get it right. My render loop looks something like this:

mp_Camera->ApplyTransform() :: Takes the current player transformation and inverts it and pushes that on the modelview stack.
Draw GameObjects
Draw Skybox

DrawSkybox does the following:

glEnable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_FALSE);

// draw the cube here with extents

glDisable(GL_TEXTURE_CUBE_MAP);
glDepthMask(GL_TRUE);

Do I need to translate the skybox by the translation of the camera ? (btw, that didn't help either)

EDIT: I forgot to mention: It looks like a small cube with unit extents. Also, I can strafe in/out of the cube.
Screenshot:

sentences:
Is my social game technical solution viable? I'm currently working on a board social game using HTML5 (canvas) & Asp.net MVC 4, Azure, Sql server, EF.
I'd like to do a server side realtime validation (using Ajax) of a player moves (not more than one every 2 seconds).
The problem is that I can't allow a communication to be longer than 200 ms (time of the client side animation).  On the server side I have to go to the database to do the validation.
I'm not sure that it is possible to keep a good communication speed over time with a growing community.

What would be a better scenario ?

Edit:
An other possibility would be to load the grid answers on the grid load but then every player with a bit of firebug background could get the answers with no pain..
Then I'm forced to go server side.
Maybe the best would be to load in the web role memory all the grids to not have to go to the database.

Another scenario could be:
1 ajax request to check in the server memory the grid solution
1 ajax request to confirm the player move in database
but  it's not cheater safe neither..

Thank for your help

David

sentences:
Materials aren't loading correctly from SketchUp into Unity I imported a SketchUp COLLADA (.dae) file from 2017 SketchUp Make, and imported it into Unity. I then clicked "Use External Materials" and the colors began to load. But I noticed quickly that one of the wings of my imported B-29 was Dark Gray, while the other way a proper color. Random parts, such as the front engine housing piece, were also dark gray. Parts of my advanced dials were also dark gray, and I immediately decided that there is now ay that I am going to manually go in and fix every single dark-gray material, but at the moment, I found no alternative.
I began with the wing. I went to assign the material that I used for the other wing, which was white, to the dark gray wing, but I found out that the other wing already had that material in use. And when I went to assign a different white color, absolutely nothing changed, aside from the fact that the wing now claimed that it had that color in use. Is there a fix for this problem? I could try importing as a .SKP file, if the reason for the issue is something to do with the COLLADA (.dae) file.
What I had was 2 wings. they were both components in SketchUp, so whatever I did to one applied to the other, Then I made them unique before importing to Unity. The Wing that won't work right is the one wing that had the USAF Insignia on it. But I doubt this is the problem, because all engines on that wing were also not colored correctly, whereas the other wing was fine. Those engines were also components, but were also made unique before the import.
Each wing has 9 groups inside of it. The other wing is identical in this sense. I imported the file from file explorer by dragging the file from file explorer and dropping it into unity.
This is what the plane looks like in Unity:

My apologies for the crude handwriting, it is difficult to draw with a touchpad.
In the image, I numbered the incorrectly-colored parts visible in the image (Right/Left references are perspective to image)
1. Left Wing. Color: Dark gray. Color intended: White.
2. Propeller blade hub. This is the part that all propeller blades are connected to. Both hubs on the two propellers on the Left Wing are colored incorrectly. Color: white. Color Intended: Grey.
3. Pistons. All piston components, such as the pistons, securing poles, and piston heads are not colored correctly; same on the other engine on the Left Wing. Color: White. Color Intended: Grey pistons, darkish-grey piston heads, and copper-orange securing poles.
4. Cowl Flaps. In the image, this appears to be a stripe in the engine. Same with the other cowl flaps on the other engine on the Left Wing. Color: Dark gray. Color Intended: White.
5. Propeller blades. All 4 propeller blades on both engines on the left wing are not colored correctly. Color: White. Color Intended: Black, with yellow tips.
6. Right-Wing Pistons. Most piston components, such as the pistons heads and securing poles are not colored correctly. Same with the other engine on the Right Wing. Color: White Piston Heads, Grey Pistons, Almost-Black Gray in the lines on the pistons, white securing poles. Color Intended: Grey pistons, darkish-grey piston heads, and copper-orange securing poles.
7. Front Engine Casing. The same error is in the other engine's front engine casing on the Right Wing. Color: Dark Gray, with an apparent shine coming from beneath the part, which shouldn't be happening (the directional light is above the engine part). Color Intended: White.
8. Rear Engine Casing. The same error is in the other engine's rear engine casing on the Right Wing. Color: Dark Gray, with an apparent shine coming from beneath the part, which shouldn't be happening (the directional light is above the engine part). Color Intended: White.

sentences:
How To Set Constants Using ID3DShaderReflection I got to the point where I am tired of hardcoding shaders and decided that it was now time to look into using ID3D11ShaderReflection to get data from the shader and set my shader's constant buffer using that data.  I have a simple system that loads up shaders and gets it's data.  Now that I have the data, I would like to know how the correct way to upload the data to the constant buffer.  I've searched on Google and couldn't find too much information on this.  Any help? Thanks!

Here's some code: http://www.gamedev.net/topic/654950-setting-constants-using-id3d11shaderreflection/

sentences:
LibGDX limit the PerspectiveCamera for a FPS view I'm using LibGDX and I'm trying to implement a FPS camera into my game. I'm not using the FirstPersonCameraController for multiple reasons:

I don't want to touch to roll (only yaw and pitch), with this camera when looking on sides the horizon goes up and down like waves (meaning that the roll is changing)
I don't want dragging, I want the camera to always move with the mouse.
I want movements to stay consistent whatever the player is looking at. I don't want it to go slower even if he looks at the ground.

So I've come up with this which does pretty much what I want:

    @Override
    public boolean mouseMoved(int screenX, int screenY)
    {
        float deltaX = (mousePos.x - screenX) * sensitivity;
        float deltaY = (mousePos.y - screenY) * -sensitivity;

        Vector3 tmpAxis = game.getGame().getPool().obtain(Vector3.class);

        game.getCamera().rotate(Vector3.Y, deltaX);
        tmpAxis.set(game.getCamera().direction.z, 0, -game.getCamera().direction.x);

        game.getCamera().rotate(tmpAxis, deltaY);
        //if(game.getCamera().up.y < 0)
        //  game.getCamera().up.y = 0;

        mousePos.set(screenX, screenY, 0);
        game.getGame().getPool().free(tmpAxis);
        return true;
    }

However, I have an issue described by the commented lines. When the camera goes to low or too high (when the y value of the up vector become negative), the rotation is reversed and the rotation starts to make it come back. In pratice, it just flickers a lot and when I try to go back, I have 1/2 chance of going back normally, and 1/2 chance of looking backward with my camera reversed (if the up vector is negative).

So naturally, what I want is to lock the movement so It can never look pass his feets or pass the sky. Locking the up vector is easy, I just have to prevent it from going negative but I need to replace the direction vector also. However, I don't know how to "replace" the direction vector. I search on google for how to set the camera rotation or just how to get it and didn't found anything convincing.

I've just tried also adding game.getCamera().direction.y = -1f; to my commented if to make it look down when getting past the point I don't want it to get past. However, I found out the direction vector isn't normalized and that's really confusing.

sentences:
How do I derive an appropriate acceleration value for my game? I am creating a Flappy Bird clone from this tutorial.

I have a question about acceleration in libgdx. The author assigned the bird a constant acceleration vector in the constructor of the bird

        acceleration = new Vector2(0, 460);

and later updated the velocity vector from the accleration vector with

        velocity.add(acceleration.cpy().scl(delta));

I understand generally why acceleration is constant - like the author mentioned, acceleration due to gravity is 9.81m/s^2, meaning that the speed of an object falling will increase by 9.81m/s every second. It seems the author somehow got from 9.81 real world value to 460 in the actual code. How does one go about deriving this value? Is this a standard derivation or something the author just made up?

sentences:
PhysicsJS on mobile devices: how to optimize for speed I'm (physics n00b) developing a small animation (gamification) in a mobile HTML5 app (PhysicsJS, HTML5, Cordova, Ionic, JavaScript).

This animation is derived from Basket of verlet constraints. This basket has to carry a lot more bodies (circles).

I'm experiencing performance problems, even on decent hardware (iOS and Android, the latter is worse). The bodies move like if they were in an aquarium. If I remove the basket, the performance is way better, but not yet satisfactory.

How can this be optimized in a sense that users don't have the feeling of watching a film in slow-motion?

Are there any tweaks to control the engine to do less calculation?

Am I using the appropriate physics engine or are there alternatives with significant better performance?

Remark: on my MacBook in Chrome, there is absolutely no performance problem and all movements are very smooth -> no aquarium.

sentences:
How do I create a Shadow of the Colossus - like climbing system? I'm developing a game in Unreal Engine 4, and I want to implement a climbing system just like in Shadow of the Colossus, where you can grab and climb onto specific parts of the monster (fur, in this case).

It probably doesn't use the same logic as a building a climbing system/edge grabbing, where it uses a sphere trace by channel to detect edges and then disable the player movement, as the player must be attached to the colossus since it moves.

How would I go about creating something like this?

sentences:
multipass shadow mapping renderer in XNA I am wanting to implement a multipass renderer in XNA (additive blending combines the contributions from each light).  I have the renderer working without any shadows, but when I try to add shadow mapping support I run into an issue with switching render targets to draw the shadow maps.  When I switch render targets, I lose the contents of the backbuffer which ruins the whole additive blending idea.

For example:

Draw()
{
    DrawAmbientLighting()
    foreach (DirectionalLight)
    {
        DrawDirectionalShadowMap() // <-- I lose all previous lighting contributions when I switch to the shadow map render target here
        DrawDirectionalLighting()
    }
}

Is there any way around my issue?  (I could render all the shadow maps first, but then I have to make and hold onto a render target for each light that casts a shadow--is this the only way?)

sentences:
Vector2 to 3D world coordinates I think I am almost there, but not quite. I am trying to transform a 2D point, (in the following example (100,100)) into 3D world coordinates, in order to draw my 3D Model named TestModel in XNA/Monogame. Here is my attempt:

Matrix[] transforms = new Matrix[TestModel.Bones.Count];
TestModel.CopyAbsoluteBoneTransformsTo(transforms);
ModelMesh mesh = TestModel.Meshes[0];
BasicEffect effect = (BasicEffect)mesh.Effects[0];
float Scale = 1.2f;

effect.View = Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 6115.0f),
     Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
    aspectRatio, 1.0f, 10000.0f);
effect.EnableDefaultLighting();

//here i am using the function to calculate the world coordinates from (100,100) Point
//it gives me modelPosition = {X:284,0316 Y:384,2054 Z:0,9999364} in this example
Vector3 modelPosition = graphics.GraphicsDevice.Viewport.Project(new Vector3(100, 100, 1),
   effect.Projection, effect.View, Matrix.Identity);

effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateScale(Scale) *
   Matrix.CreateTranslation(modelPosition);

//finally i draw the model
mesh.Draw();

I suppose this is the correct function to do it graphics.GraphicsDevice.Viewport.Project, so what exactly am I missing here ? Right now the model is drawn around (393, 444) in the 2D world (instead of (100,100) which is where i am trying to draw it)

Edit: I had wrong numbers before
Edit2: I think the correct function is Unproject, but i still can't get it drawn at (100,100)

sentences:
Passing Gameobject to another script in unity 3d I'm trying to pass a gameobject from one script to another runtime attached script. My fisrt script is attached to the FirstPlayerController and the gameobject is not dragged in the editor, but is picked up and carried in the script. All i want is to pass the gameobject to the CameraController class to as make the second camera follow that object. Below is what i've tried so far. I dont want to access the gameobject with the tag, because there are more gameobjects that can be picked up. I want to access the carried object to the cameracontroller class.

Thanks!

Pickupobject.cs

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

public class pickupobject : MonoBehaviour
{
    GameObject mainCamera;

    bool carrying;

    public GameObject carriedObject;

    public float distances;

    public float smooth;

    float speed = 1000f;

    new Camera camera;

    // Use this for initialization
    void Start()
    {

        mainCamera = GameObject.FindWithTag("MainCamera");

        camera = GameObject.FindWithTag("secondCamera").GetComponent<Camera>();

        camera.enabled = false;

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.T) && carrying)
        {
            carrying = !carrying;

            ThrowBall();
        }
        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 = mainCamera.GetComponent<Camera>().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;

                    //camera.enabled = true;

                   // camera.gameObject.AddComponent<CameraController>();

                    //carriedObject.AddComponent<MovingBall>();

                }
            }
        }
    }

    void carry(GameObject o)
    {
        o.GetComponent<Rigidbody>().isKinematic = true;

        o.transform.position = mainCamera.transform.position + mainCamera.transform.forward * distances;

    }

    //void CheckDrop()
    //{
    //    if (Input.GetKeyDown(KeyCode.U))
    //    {
    //        Drop();
    //    }
    //}

    //void Drop()
    //{
    //    ThrowBall();

    //}
    void ThrowBall()
    {

        mainCamera.SetActive(false);

        camera.enabled = true;

       // carriedObject.AddComponent<CameraController>();

        camera.gameObject.AddComponent<CameraController>();

        carriedObject.AddComponent<MovingBall>();

        carriedObject.GetComponent<Rigidbody>().isKinematic = false;

        carriedObject.GetComponent<Rigidbody>().AddForce(0f, 0f, speed);

     }

}

CameraController.cs

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

public class CameraController : MonoBehaviour {

   public GameObject icosphere;

    public GameObject abc;
    Vector3 offset;

    // Use this for initialization

    void Start () {

        icosphere = GameObject.FindWithTag("purpleball");

        offset = transform.position - icosphere.transform.position;
        }

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

            transform.position = icosphere.transform.position + offset;
    }
}

sentences:
Rendering SVG art directly in XNA Suppose I have a bunch of 2D art in some vectorized format such as SVG. Is there an easy-ish way to render that directly without having to implement a full SVG renderer myself?

Of course I could rasterize it off-line (e.g. in the content pipeline) for different resolutions/zoom levels, but I would like to maintain the crisp visuals at continuous zoom levels that vector graphics offer.

sentences:
Positioning tile sprites so they connect seamlessly What is the easiest and the most accurate way to combine tiles into a single platform in Unity, with no gaps, overlaps, or misalignment with the already-placed tiles, so that it looks like one continuous piece?

Here is what I mean:

I would like to be able to do the combination of platforms without the dragging by mouse.

I thought about doing it through the coordinates and a little bit of small calculations, but I was not able to find the width of the game object with the respect to coordinates in the Inspector.

sentences:
what are the networking features available in iphone? So far I couldn't find anything on google so I'm asking here:

I need to connect two iphones or more to each other for a multiplayer game, what features does iphone api provide? is there some kind of bluetooth device or equivalent in iphone or should i just search over the wireless network connection? and what api should I use to connect them? is it possible to use c++ or are the api functions only available via obj-c iphone sdk?

sentences: 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:
Trouble with Inventory System and Item References I'm currently trying to get a simple inventory system to work but I'm having a lot of trouble.

This isn't the exact code I have, but it's a shorter version that I'm pretty sure would function the same:

public struct ItemSlot {
    public Item item;

    public ItemSlot(Item item) {
        this.item = item;
    }
}

public class Item : MonoBehaviour {
    public string itemName;
}

public class Accessory : Item {

}

public class Inventory : MonoBehaviour {
    public ItemSlot[] itemSlots = new ItemSlot[1];

    public void AddItem(ItemSlot slot) {
        itemSlots[0] = slot;
    }
}

public class Player : MonoBehaviour {
    public Inventory inventory;

    private void Update() {
        if (Input.GetKeyDown(KeyCode.E)) {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;

            if (Physics.Raycast(ray, out hitInfo, 20)) {
                GameObject target = hitInfo.collider.gameObject;

                inventory.AddItem(new ItemSlot(target.GetComponent<Item>()));
                Destroy(target);
            }
        }

        if (Input.GetKeyDown(KeyCode.G)) {
            print(inventory.itemSlots[0].item);
        }
    }
}

For a bit more prefacing I have a capsule object with the Player script on it, an empty with the Inventory script on it, which is then attached to the Player script (I'm not sure if I want to make the inventory a scriptable object which is why I've done this), and then lastly I have a cube object with the Accessory script on it.

So, when I press E and pick up the item it gets added into the player's inventory and then destroyed from the scene. Then, when I press G to display that item in the inventory the console just says null. Not Null, which is what an actual null would show up as, but the string "null". If I use visual studio's debugger and have a look at what the accessory's base is, it also says null, but for some reason if I then try and print the accessory's name then that works fine, even though that variable is defined in the Item class.

If I instead do this in the Inventory class:

public void AddItem(ItemSlot slot) {
    ItemSlot[0] = slot;
    print(ItemSlot[0].item);
}

It works fine and prints Item (Accessory) in the console. Even if I print it right after I destroy target in the Player class, that also prints Item (Accessory), so I have no idea why it doesn't work on the next block of code.

Sorry this is so long and maybe an easy fix, but I'm lost.

Edit: I think everything should be fixed now.

sentences:
Combining Rotation, Jump, and Crouch Animations with 2D Blend Tree I have a 2D Freeform Blend Tree that I'm using to animate a character that can currently:

Walk / Sprint Forward
Walk / Sprint Backward
Strafe / Sprint Strafe Left
Strafe / Sprint Strafe Right
Idle

My goal is to add in rotation, jump, crouch, and "firing when walking" animations.
In just dealing with turning or even jumping for now, I understand how to handle and call the animations in the code, but not sure of how it should be set up in the animator.
Do I transition to rotation/jump animations on the base layer? I'm reserved doing it this way because I lose the ability to blend and take advantage of those transitions.
Can I build it into my current 2D blend tree even though the blend tree is only X and Z axis?

public class twoDControllerMovement : MonoBehaviour
{
    Animator animator;
    public CharacterController controller;

    [SerializeField] private float walkSpeed = 12.0f;
    [SerializeField] private float strafeSpeed = 10.0f;
    [SerializeField] private float sprintMultipler = 2.0f;
    [SerializeField] private float rotationSpeed = 120.0f;

    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
        controller = GetComponent<CharacterController>();
    }

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

        // handle sprint
        float currentWalkSpeed = walkSpeed;
        float currentStrafeSpeed = strafeSpeed;
        bool runPressed = false;

        // handle shift
        if (Input.GetKey(KeyCode.LeftShift))
        {
            currentWalkSpeed = walkSpeed * sprintMultipler;
            currentStrafeSpeed = strafeSpeed * sprintMultipler;
            runPressed = true;
        }

        // calculate movement
        float strafe = Input.GetAxis("Strafe") * currentStrafeSpeed * Time.deltaTime;
        float translation = Input.GetAxis("Vertical") * currentWalkSpeed * Time.deltaTime;
        float rotation = Input.GetAxis("Horizontal") * rotationSpeed * Time.deltaTime;

        // execute movement
        transform.Translate(strafe, 0f, translation);
        transform.Rotate(0, rotation, 0f);

        // handle movement animations
        if (runPressed) {
            animator.SetFloat("VelocityZ", Input.GetAxis("Vertical") * sprintMultipler);
            animator.SetFloat("VelocityX", Input.GetAxis("Strafe") * sprintMultipler);
        } else
        {
            animator.SetFloat("VelocityZ", Input.GetAxis("Vertical"));
            animator.SetFloat("VelocityX", Input.GetAxis("Strafe"));
        }

        // handle roration animations
        if (Input.GetAxis("Horizontal") < 0.1f)
        {
            //Debug.Log(Input.GetAxis("Horizontal"));
        } else if (Input.GetAxis("Horizontal") > 0.1f)
        {
            //Debug.Log(Input.GetAxis("Horizontal"));
        }

    }
}

Also open to any feedback on improving the code above, my goal is as small and clean as possible!  I do have a slight delay in animations starting when switching directions that I have to work out at some point and would eventually.

sentences:
Improving bouncing logic - Atari breakout clone I'm creating an Arkanoid clone using Haxe and Openfl. I'm thinking the bouncing algorithms could be improved. But I'm not sure how to handle those. I was hoping you guys could help.

    private function bounceBall():Void {
    var direction:Int = (ballMovement.x > 0)?( -1):(1);
    var randomAngle:Float = (Math.random() * Math.PI / 2) - 45;
    ballMovement.x = -1 * Math.cos(randomAngle) * ballSpeed;
    ballMovement.y = Math.sin(randomAngle) * ballSpeed;
}

Since I've never coded anything in Haxe I followed a tutorial to build a pong game. This is one of the functions that was used in the pong exercise. I think it's causing the ball to bounce left/right and rarely up or down. Can you guys help me out? How can I recreate the arkanoid bouncing ball logic?

You can find the rest of the source Here

sentences:
Opening an executable process in background from unity I am trying to make a chess engine run in the background from an interface i designed

    Process stockfish;
        stockfish = new Process {
            StartInfo = new ProcessStartInfo {
                FileName = System.IO.Directory.GetCurrentDirectory () + "\\Assets\\Scripts\\Stockfish\\stockfish.exe",
                Arguments = "",
                UseShellExecute = false,
                RedirectStandardOutput = true,
                RedirectStandardInput = true,
                RedirectStandardError = true,
                CreateNoWindow = true
            }
        };
        try{
            stockfish.Start();
        }
        catch (Exception e) {
            print (e);
        }

The code is throwing an exception

System.ComponentModel.Win32Exception: ApplicationName='E:\Narsun Projects\Ahmad's Projects\CoachChess\Narsun-CoachChess-Unity\Assets\Scripts\Stockfish\stockfish.exe', CommandLine='', CurrentDirectory=''
 at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
 at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
 at System.Diagnostics.Process.Start () [0x00000] in <filename unknown>:0
 at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()

sentences:
How can I make my LibGDX game persist on android even if it's not the active activity I want my android game using LibGDX to continue keeping track of events in the game, even while it's not the active window.

For example, I have a stat that reduces over time even, if the game is not the active activity. When the stat gets to a certain percentage, I want to push a notification to the android platform.

I found some information to push android notifications. However, I could not find one on how to make a stat persist in the game when a different app or activity is on the main screen.

sentences:
Do textures that are inside a shader resource need to be explicitly released too? (DirectX 11) I have a ID3D11Texture2D (that I've created manually) inside a ID3D11ShaderResourceView. When I want to Release() the resource view, do I need to Release() the texture that it is inside too? Or is it not necessary to do so?

Msdn doc and Google couldn't help me on this one. :/

sentences: How to keep my Quaternion-using FPS camera from tilting and messing up? I am using an FPS-like camera, and it uses quaternions. But, whenever I try looking up and then sideways, it tilts, and sometimes it can turn upside down. How can I fix this?

sentences:
How should I balance temporary buffs to make my game fun? As a game developer, I understand many players (usually in RPGs) expect short term buffs to be available to them, such as potions, war cries, drugs, etc.

As a player, I've never understood what fun there is in using them. I think it's because they never seem to be very strong. They usually grant a 10-20% bonus to some attribute, for example -- just enough to turn a rage-quit situation into a merely-annoying one.

Maybe I just don't know how to use them; so how should I approach temporary buffs when balancing them? For the people who enjoy using them, what are they getting out of it? How might I go about confirming if my players agree that the mechanic is fun?

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:
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:
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:
Enhancing ambient occlusion via vert colors on vertex lit scene We have a deformable terrain surface. Initially ambient occlusion was baked, but since the terrain can deform in real time, this approach isn't practical anymore. Therefore we used vertex paint to imitate occlusion based on the angle of the surrounding terrain vertices. We will then multiply the vertex color with the terrain texture and get a relatively cheap ambient occlusion.

Below are two examples of our terrain. The second has applied occlusion based on surrounding vertices, as mentioned before. But unfortunately it seems like the lower a set of vertices is in relation to the surrounding vertices (or the tighter the crease), the darker the vertex will be.

Vertex lighting in general works, but the results aren't as good as I expect. I wonder there is any document about a similar implementation out there.

That's our terrain without additional shading.

That's our terrain with vertex color applied to simulate ambient occlusion.

sentences:
Multi-threading for rhythm game? I'm trying to recreate a rhythm game. However trying to get the key-presses with SDL2 I ran into the problem, that you can only get an event every time a frame has been successfully rendered (I can't poll the events from another thread than the main thread). As you could separate game-logic from rendering, I thought I could run the game logic (including the polling of the events) for every 1ms and render the screen for every 16ms (60fps).

I read some articles stating that it doesn't make much sense to use multi-threading for that usage, but 16ms are quite a lot of latency for a rhythm game (which has about 30ms to determine a better rating for a better high-score).
(The problem is also described here: Accuracy and frame-rate in a rhythm game)

EDIT: Here It's being said that multi-threading shouldn't be used:

What is the best way to handle event with SDL/C++

Now my question is:"Should I really not separate game-logic from render logic, as I don't need visual feedback for this kind of game and accuracy is more important"

sentences:
24-Bit Colordepth not enough? I noticed that in very soft gradients, the 24-Bit colordepth is not enough as you can see the transitions of the color. This pops out the most in dark scenes or night skies.

Why doesn't anybody change the colordepth to two bytes per channel? I know that would be alot of work and a lot of hardware would have to be repalced, but I find it a bit annoying. I really don't think that the technology of the hardware isn't mature enough.

So why is no one doing that?

Here's a picture of "The War Z" where you can see what I mean:

sentences: First person shooter camera movement I am making an FPS in XNA. I cannot seem to make a FPS camera that I can move Forward, Back, Side to Side using the keyboard. How do I do that?

sentences:
SDL2 event mouse wheel trouble it's been all day I have a problem getting mousewheel events properly in one of my program. I can make a program from scratch and it work properly, however as soon as i do the same things inside this one, nothing seem to work as i want:

#include <iostream>

#include <SDL2/SDL.h>

int    SCREEN_WIDTH = 640;
int    SCREEN_HEIGHT = 480;

SDL_Event e;
SDL_Window* gWindow;

bool initSDL();

bool handleKeys();

void close();

bool initSDL()
{

    if( SDL_Init( SDL_INIT_EVERYTHING ) < 0 )
    {
    }

    gWindow = SDL_CreateWindow( "Opengl Test",
                                SDL_WINDOWPOS_CENTERED,
                                SDL_WINDOWPOS_CENTERED,
                                SCREEN_WIDTH,
                                SCREEN_HEIGHT,
                                SDL_WINDOW_SHOWN );

    return true;
}

bool handleKeys()
{
    while( SDL_PollEvent( &e ) )
    {
        if ( e.type == SDL_MOUSEWHEEL )
        {
            std::cout << "WhhheeeeeelllllllLLLLLLLLlllllll" << std::endl;
        }

        if  ( e.type           == SDL_QUIT )
        {
            return true;
        }

    }
}

void close()
{
    //Destroy Window
    SDL_DestroyWindow( gWindow );
    gWindow = NULL;

    //Quit SDL subsystem
    SDL_Quit();
}

int main()
{
    if(!initSDL())
    {
    }

    while( !handleKeys() )
    {
    }

    close();
}

I compile with this makefile:

#comment
#Compiler to use:
CC=g++
#Compiler flags:
APPNAME=TutOpengl
OBJ=main.o
#LIBS=-lSDL2
LIBS=-lSDL2
CFLAGS=-c -g -Wall -std=c++11 -I ./src $(LIBS)

all: $(APPNAME)

$(APPNAME): $(OBJ)
    $(CC) $(OBJ) -o $(APPNAME) $(LIBS)

main.o: main.cpp
    $(CC) $(CFLAGS) main.cpp

clean:
    rm -rf *.o $(APPNAME)

Under Ubuntu(14.04), SDL2. I can't get MouseWheel events properly and as of today i'm unable to find out. In the larger program set i get the MOUSEWHEELS events only every now and then like at random. Compiling should give you one warning, thanks in advance if anyone can help.

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:
How to store an iOS game save file in multiple devices? (Without remote servers) I've been developing an iOS game for iPhone. My game saves the progress as a couple of .plist documents in the device.

I have come to realize that when I install a game in my iPhone, this same game is installed in my iPad. And then it struck me: how would I manage save files? I mean, I'd like the player to be able to continue playing from where they left no matter what device are they using... without using remote servers.

What have you done to address this issue?

sentences:
Ray-tracing Moveable Objects I am fond of creating graphics and animations using the frameworks on the iOS platform; lately, I discovered that, in order to create better visual designs, those higher-level of frameworks do not provide enough controls to satisfy the needs of creating more advanced-level designs. Hence, I decided to invest my time in studying OpenGL ES.

Whilst doing so, I came across the ray-tracing topic; I have spent quite a bit of time studying the mathematics and topics related to it. And, I have been able to render simple stationary objects (geometrically) using this technique.

In order to learn deeper, I started to toy around with the idea of allowing these objects to have movements based upon user-interactions (I.e., when the user moves the object on the screen with her finger, the corresponding object will spin around or simply move to the respective location based upon the user's touch (on mobile device)).

According to what I have studied thus far on ray-tracing, however, this operation of allowing the objects to move based on user-interactions could be very costly in ray-tracing. To me, for example, it would mean that, if a rendered sphere were to spin around based on user's touch on the screen, I would need to ray-trace the whole sphere for every frames as the sphere spins.

Is my understanding correct here?

My question is, is it possible to perform ray-tracing on objects that are movable; if so, is there another ray-tracing technique specialized especially for this purpose, which could be less costly? Or, is ray-tracing more suitable for rendering only architectural objects, which are usually stationary?

Thank you.

sentences:
Followed the XNA GameStateManagement sln, but my doesn't work. What am I doing wrong? If someone has the time I wanted to know if you would be willing to check out my solution file here: http://elvis.rowan.edu/~majeko02/AwesomeShip.zip

I followed the XNA GameStateManagement on AppHub, but nothing comes up from me. and I haven't the clue why.

I believe I done everything correctly and verified it as well.

I wanted to know if someone has the time could they check it out?

Download link here: http://elvis.rowan.edu/~majeko02/AwesomeShip.zip

I am racking my brain trying to figure out why it doesn't work.

Any help, is greatly appreciated.

sentences:
How can I chain together Stencil tests from the same re-occurring routine, but keep the tests separate? Sorry for the bad title; I don't know how else to explain this.

I have a class called a Container. An instance of Container has other elements "inside" it. These elements have independent positions that are relative to the position of the container.

So if I move the container, the elements inside of it are moved along with it; but keep their distance relative to each other.

This Container is therefore like a window through which you can view it's contents.

So, I would like to use a Stencil buffer for this. I have the following code:

glEnable(GL_STENCIL_TEST);
glClear(GL_STENCIL_BUFFER_BIT);
glStencilMask(0xFF);    // everything is written to the buffer
glStencilFunc(GL_ALWAYS, 1, 0xFF);
glStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);
glColorMask(GL_TRUE,GL_FALSE,GL_FALSE,GL_FALSE);

glBindVertexArray(m_screenQuad->GetVAO());

glDrawElements(GL_TRIANGLES,m_screenQuad->GetMesh()->GetIndices()->size(),GL_UNSIGNED_INT,0);

glBindVertexArray(0);
glStencilFunc(GL_EQUAL, 1, 0xFF);
glStencilOp(GL_KEEP,GL_REPLACE,GL_REPLACE);
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);

// draw the things that are visible through this window. The window is defined by m_screenQuad

glDisable(GL_STENCIL_TEST);

This works great.

The problem I'm having arises when one of the things that are visible through the window, are also another window.

In the above example you can see that I didn't mask out the red channel, this was to reveal that when the bounds of an "interior" container went outside the edge of he exterior container, the whole stencil doesn't work as planned.

Here's some screen shots with the above code (again, note that the red it to show the different bounds being drawn by the m_screenQuad objects).

Here's another image where the object inside the first Container is a subsequent Container. Each calls the same code above, with the second one being called at the // draw the things that are visible through this window. The window is defined by m_screenQuad line.

As you can see, the bounding m_screenQuad being drawn in the same way by the internal Container overlaps with the external Containers m_screenQuad and effectively extends the Stencil Mask further than it should.

How do I separate these two different Stencil tests so that they don't affect each other? Consider that the internal Container may be smaller than the external one, so it would need to truncate/cut it's internal contents as well.

sentences:
Synchronize turn based browser game I'm writing a browser game in php and Sql. I'm also using Javascript - Ajax and Mysql.

I'm stack on the battle system because I want to Synchronize the turns of the players in the battle.

What I doing is to put two players on a battle. So from the first turn a countDown of 60sec will start.
What I am thinking is to use a server function to check the countdown, not to the client side. This because I think that in that case a bad synchronization will came, instead if it is the server to count down.

But.. how can I let the server do all this stuff?

sentences: Implementing an enum from an abstract class Both my Player class and Enemy class should have an enum called State. (The values inside of that enum would be different in each class.) I'd like to have the Player class and Enemy class inherit from an abstract base class that would require those two classes to have that enum. Is this possible?

sentences: 2D character movement My character moves right and left correctly, I want to know if it is possible to move character forward and backward to collect hearts   (I know that in 2d no z axis I want to know if it is possible or not? )

sentences:
How do you parameterize turn based AI? I would like to create/find an AI algorithm/process that can be parameterized such that a change in the parameters causes a change in the AI behavior. I am specifically looking to apply this to a turn based game environment where the player is able to perform several moves (or none at all) in a single turn. The player has full knowledge of the board and should be able to take the opponent's current positioning into account when deciding what moves to make in the current turn.

My question is how can I create this type of AI? An example of behavior that I would like it to show in various situations would be:

Turn X: Attack location A with 7 units and attack location C with 12 units
Turn Y: Do nothing
Turn Z: Invest in resource collection

Then a small change in a parameter may cause the AI to only send 6 units to location A instead of 7 in the same situation as Turn X.

My only thought of how to implement something like this would be to have the parameters act as probabilities of doing action T with magnitude R. However, I could imagine how this wouldn't facilitate long term thinking, and I also have no idea how that approach would take the opponent's positioning into account. I also suspect that this approach would cause the AI to overspend within a single turn, as in, it tries to attack 3 locations with a total of 30 units, but it only has 15.

I've spent the last few hours looking through Google Scholar and have found a few papers that say that they have used a parameterized AI approach, but they don't discuss any actual implementation details. If anyone could tell me what this concept is normally called (so I can Google and research it further) or has any reference links to code that uses an implementation like this then I would really appreciate you adding it as an answer.

Also, just so people don't waste their time answering something that isn't needed, I'm only interested in the design/structure of the described process, I am not looking for ways to get good values for the parameters.

Thanks everyone!

sentences:
Showing background transparent image in android I have a image with transparent background created from photoshop.

I added this to my android game which I am creating using libgdx. But when I add it to that, it is shown with white background like following.

Whats the reason for this? How can I fix this?

sentences:
OpenGL Arc-Ball Camera Yaw Pitch GLM::Rotate I'm currently working on a small Voxel-Editor Project. In the editor, I plan on using an Arc-Ball camera which rotate around the model. My camera is currently working but in an odd way. I can't seem to be able to move around the Z-Axis on my model which cause my camera angle to get smaller as I reach one side. For example, if I go to the left side of my ball, I wont be able to turn around it completly.

Here is my code which update my current View-Matrix into the updated one.

void t_Math::CreateLookAt(glm::mat4& InMatrix, sf::Vector3f pointToFix,   GLfloat InPitch, GLfloat InYaw, GLfloat valueToScale)
{

    glm::mat4 rotationMatrix = glm::mat4(1.0);

    const GLfloat FinalPitchDegree = InPitch / 57.2958;
    const GLfloat FinalYawDegree = InYaw / 57.2958;

    rotationMatrix = glm::rotate(rotationMatrix, FinalPitchDegree,                               glm::vec3(1.0, 0.0, 0.0));
    rotationMatrix = glm::rotate(rotationMatrix, FinalYawDegree, glm::vec3(0.0, 1.0, 0.0));

    const glm::vec4 cameraPosition4 =  rotationMatrix * glm::vec4(1.0);
    const glm::vec3 cameraPositionFinal = valueToScale * glm::vec3(cameraPosition4);

    const glm::vec3 constObjetMiddle = glm::vec3(pointToFix.x, pointToFix.y, pointToFix.z);

    InMatrix = glm::lookAt(cameraPositionFinal, constObjetMiddle,         glm::vec3(0.0, 1.0, 0.0));
}

Here is what I believe my code do.

The function receive a View Matrix, The model Center Coords, The Pitch, The Yaw and finally the Scalar (The zoom). Note: My Pitch and Yaw are simple GLFloat which mean they don't have limits and can go from -R to +R.

Now for the code. -We first create a base Matrix 4 -We Divide the Pitch and Yaw by 57.2958 (a radian) because GLM::rotate works with radian and I want it to be precise so in degree. -We then rotate the base Matrix on their respective Axis using the proper Pitch and Yaw -We then calculate the position of the Camera by using the ROTATED matrix which we transform into a Vec4 -We calculate the final Camera position by multiplying by the Scaling Vector (The Zoom) and we transform this Vector4 into a Vec3 -We create another Vec3 which is the Camera Target by using the value received by the function -We use all we collected to create a new lookAt matrix and we apply it to the view matrix.

I think I might be missing the Z-Axis rotation but how am I suppose to calculate it ? Should I use the Pitch or the Yaw ? Since i'm using (W-A-S-D) to move around here is what my keys does.

W: Increase Pitch S: Decrease Pitch D: Increase Yaw A: Decrease Yaw

Do I need to put the Roll into this and which keys should increase and decrease it ?

sentences:
Making certain GameObjects visible for a camera I have 2 cameras in my 2D game.

One displays gameobjects normally, and the other camera draws some of these gameobjects reflected (scale.y *= -1). The reflected camera would draw only objects in the "Water" layer, and I would change the layer of the GameObjects I want to reflect on the precull and postrender functions. This way I can decide which GameObjects would be reflected, changing the layer on the fly at runtime, which is a requirement.

-Precull: Change the desired GameObjects layer to "water", and apply scale.y*= -1

-OnPostRender:  Change the Gameobjects layer to their original value, and apply scale*= -1

This was working correctly when my objects were simple, but now my objects are more complex, and I can't rely on changing the layer of the gameobjectson the fly, as I can't tell what their original layer was for each part of the object, in order to revert the changes applied during the precull.

Is there anyway to tell a camera which objects should it render besides using the culling mask?

sentences:
What is the difference between a game object being disabled and it made inactive? I am looking over a script that has a particular function called to disable the script and mark a list for re-structuring:

void Disable()
{
    gameObject.SetActive(false);
    isEnumerated = false;
}

What I am trying to determine is whether it would be better to simply have the code in the OnDisable() function:

void OnDisable()
{
    isEnumerated = false;
}

I found that OnDisable() calls whenever the game object is "disabled" or "inactive", but I am a bit confused on the exact difference between the two. Documentation I have found that references both is only specific in that they are two different cases, where places that offer definition appear to use the two words synonymously.

sentences: Shear transformation in the projection matrix? I am trying to understand what the shear transformation (l+r/r-l & b+t/t-b) is actually doing in the projection matrix? The only thing I got till now is headache :) Can you please help?

sentences:
Why does my character move diagonally? So i've been trying to make the player face towards the direction i pressed. That part works just fine but when I try to move the player it moves diagonally instead of left/right. Any clues?

 if (Input.GetKey(KeyCode.RightArrow))
             {
                 //moves the player
                 rb2d.velocity = new Vector3(2.5f, 0, 0);
                 transform.Translate(rb2d.velocity * Time.deltaTime);

                 //flips the player right
                 if (human.flipY == true)
                 {
                     human.transform.rotation = Quaternion.Euler(0, 0, 270);
                 }
                 else
                 {
                     transform.rotation = Quaternion.Euler(0, 0, -270);
                 }

sentences:
When do I copyright a game? I don't know how to copyright a video game idea.

I don't know if I should make a game document and get that copyrighted first or make the game then copyright it.

The main gist is.. I am lost.

sentences: Unity set ui image as active onclick I want my button to activate an inactive ui image in the hierarchy through c# called "Responded_A" when the "Response_A" button is clicked. I assume this will use setActive in someway, but I'm just starting out and a little lost. I think some guidance here could really set me in motion. Thanks!

sentences: Farseer: Only allow the collision one time with the object I have there serveral platforms. I would like to allow the player to collide only one time with the object! Hope you can help me

sentences:
Unity 3D C# - Setting Material's Emission Texture via Script Hi, I just wanted to know if there is a way to set emission's texture via script. I haven't found nothing in the documentation, neither on any forum, except the setting of the emission color setting via script.

Thanks in advance.

sentences:
How to create a ladder script in Unity I tried to create a climb script and found some similar code. I would like to climb with my player on a ladder. I came up with the following:

bool canClimb = false;
    float speed = 1;

GameObject player;                          // Reference to the player GameObject.

void Awake () {
    // Setting up the references.
    player = GameObject.FindGameObjectWithTag ("Player");
}

void OnTriggerEnter2D(Collider2D other) { // send in the other collider (should always work)

    if (other.gameObject.tag == "Player") { // used a tag to ID collider as player
        canClimb = true;
        player.rigidbody.useGravity = false;

    }
}

void OnTriggerExit2D(Collider2D other) { // send in the other collider (should always work)

    if(other.gameObject == "Player"){
        canClimb = false;
        other.attachedRigidbody.useGravity = true;

    }
}

void Update () {

    if(canClimb == true){

        if(Input.GetKey(KeyCode.Z)){

            player.transform.Translate (Vector3(0,1,0) * Time.deltaTime*speed);

        }
        if(Input.GetKey(KeyCode.S)){
            player.transform.Translate (Vector3(0,-1,0) * Time.deltaTime*speed);

        }
    }
}

The above code will give a red mark on the useGravity in the line of player.rigidbody.useGravity. I doesn't know how to fix this.

sentences: Visual studio alternatives for unity as intellisense not working I am new to unity and unity tools for game dev are unavailable in vs community,i also tried vs code.So what are some alternatives for vs for unity scripts for a beginner?

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:
Problem with loading models with different shaders I am lerning opengl programming from http: //learnopengl.com .And i can load any model which i want.But if i want to load two models with different shaders,a problem occurs.
For example:
First i draw two models with same shader and there is no problem.

Model1.Draw(shader);
Model2.Draw(shader);

Then if i do this:

Model1.Draw(shader);
Model2.Draw(otherShader);

The first model is not drown.Only the second model is drown.
Here is my Model.h code and Mesh.h code:

Model.h: Model.h

Mesh.h Mesh.h

And if you want, these are my vertex and fragment shaders:

Shaders: http: //pastebin.com/d0v3Y4vU

Thank you for help!

sentences:
Different camera movement methods in a 2d- side-scrolling game that makes it fun Possible reference to this question, but I want specific answers pertaining to Side-scrollers.
IMO, side-scrollers can be classified as

Player doesn't move, the background graphics move to fake player movement.
Player moves also background moves, but background movement is dependent on the (x,y) movement of the player > I find this more appealing
Player can't move, the background
moves at a fast speed. Depending
upon the obstacles coming along with
the background the player has to
perform actions like jumping,
ducking, charging, etc...

I would like to know what all other things can be added to the gameplay so that the above mentioned 3 side-scroller categories can be made more addicting.Please mention the category of the side-scroller in your reply.
Edit Modified the question title to reflect what I actually want

sentences:
Character Movement and Collision with Ragdoll Rigidbodies/Colliders? I have a player character that I'm moving with a character controller script and it is moved by applying velocity to a Ridigbody.

This works when I have a rigidbody component on the player but my character also has ragdoll colliders and rigidbodies on each body parts (set up with Untiy's ragdoll wizard).

What I'd like to do is remove the ridigbody and collider that are on the player and use the ragdoll colliders and rigidbodies instead for physics movement and collision.

But it's not working! When I use the rigidbody from the skeleton Root and try to apply velocity the character won't move (animation plays but she keeps running on the same spot). What do I need to do to get this working?

Another issue is that if I leave the player rigidbody on but remove the large capsule collider I can move the character but collision doesn't work and she runs through static objects. I already tried with convex set to true on static meshes but it doesn't make a difference.

Does somebody know what causes movement and collision not to work with the ragdoll rigidbodies and colliders?

sentences:
Best practise for representing large spaces in a scene graph I'm attempting to represent a procedurally generated world in a scene graph, specifically in the Jmonkey engine (Jme3). To make this managable I have broken up the world into smaller chunks. Each chunk consists of a triangle mesh of the relevant piece of terrain. (A Geometry object holding the mesh and the relevant texture.)

I can't find any information however on which way is best to represent these within a scene graph, specifically how to deal with the coordinates of the map & camera.

One way of doing it would be to simply add these pieces on their world coordinate (which could get extremely large) detaching any nodes that are not within range of the camera and moving the camera trough this theoretically-infinite space. This would be very convenient but can the scene graph deal with the currently rendered scene having very large coordinates? The translations on each piece could easily go into the millions or more "distance units" on the graph's axis.

Another method that comes to mind is converting the world coordinates to a smaller local space and move the terrain that is being rendered to stay close to the origin of the scene graph. Essentially moving the world around the camera.Possibly moving the whole structure along with the camera 1 chunk in the opposite direction to keep it centred whenever a chunk border is crossed. However this seems like it could also have a large impact on performance.

Which of these options, or possibly a completely different one, would be preferable to represent the world in terms of CPU/GPU usage?

sentences:
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: What is the difference between a Facebook Canvas and Facebook Web project? I am making a game on cocos2d-JS for Facebook. What is the difference between Facebook Canvas & Facebook Web project. From what I can tell, Facebook Canvas ask for the secure url and Web ask for the site URL.

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:
How to achieve lighting like this in Unity for 2D games? How could I accomplish a lighting effect something similar to this game?:

I'm not talking about the shadows but about the glowing/lighting effect on the crystals and the torches.

Anyone got any clues?

More images from the games steam page

sentences:
Drawing collision detection boxes So I have a TileSprite class that makes a TileSpriteobject with a collision box in it named bCollisionRect:

public TileSprite(Texture2D textureImage, Vector2 position, Point frameSize, Point currentFrame)
        : base (textureImage, position, frameSize, currentFrame)
{
    bCollisionRect = new Rectangle((int)position.X + collisionOffSet, (int)position.Y + collisionOffSet, frameSize.X - (collisionOffSet * 2), frameSize.Y - (collisionOffSet * 2));
}

But when I try to draw the collision boxes (to test collision detection), it doesn't draw the box. I tried using this:

public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
    // This is what I tried:
    spriteBatch.Draw(textureImage, bCollisionRect, Color.White);

    // base.Draw draws the texture (.Draw method from another abstract class)
    base.Draw(gameTime, spriteBatch);
}

I use this line of code in another class to draw my tiles (pure for testing!):

tilename.Draw(gameTime, spriteBatch);

sentences:
Heightmap, Voxel, Polygon (geometry) terrains In relation to Heightmap, Voxel and Polygon (geometry) terrains:

What are the main differences between all these three?
Can you form a "smooth" terrain with Voxels, I mean, can you for example get a smooth mountain with Voxels, or Voxels are limited to cubes?
Performance wise, a world 2000x2000 units, what would be faster Heightmap terrain, Voxel terrain or Polygon based, geometry terrain? (Assuming that there is "reasonable" performance gains/optimization done for rendering for every of possibilities)
Are there any more techniques used for terrain creation?
Any good titles representing each of types?

P.S. Polygon based terrain should be fully traingulated, no squareish stuff.

sentences:
Best way to make a Side Panel UI with Libgdx? (Java) Take this image for example, the game is called Realm of the mad god, and it has this side panel filling the whole screen height with the player info.
To reproduce it, Is there any way to make the game "view" smaller so I can fit the side panel to its right without literally overlaying the game, PROBABLY like this game did, or is the only way out to overlay the game?
(Tibia might also be an example of a game smaller then its UI)

sentences:
Using a Wii remote as main controller? I would like to use a Wii remote to control my player in my 3D game.

So far I have the arrow keys and mouse to move and look but I want the Wii d-pad to move and accelerometer data to look around.

I have downloaded Unity-Wiimote-1.1 and the demo works fine. In my game I have imported the Unity package for the Wii remote but I'm not sure what script goes where, attached to what, how to call particular functions. They are mostly C# scripts.

There is no documentation with the Unity-Wiimote-1.1 and as I'm a newbie, I'm clueless on what to do.

Or is there a simpler method to getting the Wii remote to be the main controller?

sentences: What is the revenue split between me and Google in the Play store? I want to sell an app on the Google Chrome store for $0.50. How much of this will I pocket after Google's cut?

sentences:
Resolution problems with global illumination in Unity I am pretty new to Unity and after hours of searching I have finally figured out how to set everything up for (baked) global illumination to work for my model.

However the model is an export from a CAD program and so the mesh is rather bad quality (it seems it is optimized by the CAD program for minimum number of triangles). At least I am implicitely assuming that this is a bad quality mesh because it would by standard of finite element meshes, which of course doesn't directly apply here.

So what I am observing is three resolution problems (see images):

1) the lighting in the scene is somewhat "cloudy" although the faces are evenly colored and there are no lights that could explain the patterns (see eg. area inside drawn red rectangle)

2) there are slight jumps in brightness visible at the edges of the triangles of the mesh (see red arrows and, for comparison image of mesh)

3) the shadows are pixelated (see red ellipse, yes I have already tried to change shadow quality to high in the project settings, but to no avail)

Because there are so many settings that affect lighting, I assume it will take me hours if not days with trial and error to figure that out.

Which settings are likely to be responsible for these three problems?

I found a display mode of the scene view, called: Baked Global Illumination->UV Charts that probably explains the first problem, but I don't know how to interpret it, see third image below:

sentences:
Marching cubes density function: noise sampling leaves holes in plane I'm following the GPU Gems 3 chapter 1 (Generating Complex Procedural Terrains Using the GPU). The main difference is that I'm using the CPU for generating the mesh(es) based off of marching cubes. And I have this problem that I'm not sure how to solve or even debug.

In Figure 1-8, they start adding noise to the plane at y=0:

density += noiseVol.Sample(TrilinearRepeat, ws).x;

I tried to do the same thing, but I got a plane with island-like holes in it:

Here is my density function:

float densityFunction(Vector3 ws) {
    float density = -ws.y;
    density += noise[(int)ws.x, (int)ws.y, (int)ws.z];
    return density;
}

noise is a 3-dimensional float array of pink (Perlin) noise whose mean is 0. It has a frequency of 2 and 3 octaves with half persistence. Its standard deviation is ~ 0.2. And it varies around ±0.65.

The isolevel of the marching cubes algorithm is set to 0.

What could be causing this undesired effect?

sentences: Jump function of player I'm developing game in marmalade sdk in c++. I have player in the area.and I wanna make him jump when i pressed a button.When I use this player.moveUp(5px); it just go up 5px, but he has to fall down back. so that when i use these: player.moveUp(5px); and player.movedown(5px); it do nothing.Because the fps is 30 and it's performing so fast. how i can fix that?

sentences:
XNA triangle grid not drawn using DrawIndexedPrimitives I have just recently started working with Monogame (XNA). Now I had code that was drawing a grid using DrawUserIndexedPrimitives. However I read that it reloads the vertices in the GPU each draw, and I don't think that is going to cut it for me. Therefore I wanted to use DrawIndexedPrimitives instead.

However, when I made the switch, my pretty grid suddenly dissapeared. The question is thus: What did I do wrong using DrawIndexedPrimitives? The code within the draw method is given below:

game.GraphicsDevice.Indices = terrainIndexBuffer;
game.GraphicsDevice.SetVertexBuffer(terrainVertexBuffer);

game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,
                                          0,
                                          0,
                                          terrainVertices.Length,
                                          0,
                                          triangleIndicesList.Length / 3);
// This worked VV
// game.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList,
//                                               terrainVertices,
//                                               0,
//                                               terrainVertices.Length,
//                                               triangleIndicesList,
//                                               0,
//                                               triangleIndicesList.Length / 3);

Here terrainVertices is the list of vertices for the triangles, triangleIndicesList is a list representing the triangles (each three entries here refer to the vertices of one triangle).
Outside of the Draw method, I initialized the grid and index list as follows:

terrainVertexBuffer = new VertexBuffer(game.GraphicsDevice,
                                       typeof(VertexPosition),
                                       terrainVertices.Length,
                                       BufferUsage.None);

terrainIndexBuffer = new IndexBuffer(game.GraphicsDevice,
                                     IndexElementSize.SixteenBits,
                                     sizeof(short) * triangleIndicesList.Length,
                                     BufferUsage.None);

terrainVertexBuffer.SetData<VertexPosition>(terrainVertices);

sentences:
Unity C# - moving objects and Debug.Log; show multiple messages only once (easy but stuck) I have the following scenario:

a sphere is moving towards an object it can see (a cube). The cube is moving randomly through the landscape. The sphere will keep following it. I have a script that will check IF the cube is Within Sight. If it is, it will move towards it and it will keep following it.

What I want

I want a Debug.Log message to show when:

When the sphere is moving towards a (new) target. it must say: "Searching..."
When the sphere has found the cube, I want it to say: "Found the cube."
When the cube is found, I want it to continue searching for new cubes. So it must say once more: "Searching..."

Problem:

It keeps showing these messages nonstop. I found a solution with a false bool in an IF statement. But, I don't know how to combine 2 messages.

Code:

using UnityEngine;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.Tasks;

public class MoveTowards : Action {

public float speed = 0;
public SharedTransform target;
private bool pietje;

private bool jaap;

void PrintMessage (string message) {
    Debug.Log(message);
}

void Start() {
    pietje = false;
}

public override TaskStatus OnUpdate() {

    if (Vector3.SqrMagnitude (transform.position - target.Value.position) < 0.1f && !pietje) {
        PrintMessage ("Found the cube.");
        pietje = true;
        return TaskStatus.Success;
    }

        transform.position = Vector3.MoveTowards (transform.position, target.Value.position, speed * Time.deltaTime);
        transform.LookAt (target.Value.position);
        return TaskStatus.Running;

}

}

I just don't know how to fix the last part where it says: "Searching..." I don't know how to implement it with an IF statement (doesn't work somehow) or  how to create the IF statement (when I use this, it doesn't work:

if (TaskStatus.Running == 1 && !pietje)

Anyone that can help me? That would be awesome! Have been trying to fix this for some hours now....

sentences:
Creating VR Headset Video So I have a video stream of known resolution and I have a VR headset via HDMI at a known resolution.

Is there an existing library to create the slight fisheye and side-by-side layout for these single screen headsets? (It's a custom build, so no hardware locked API please)

Target: Win 7/8/10

sentences:
How to achieve a sheet of paper unfolding from the center in XNA 2D? I need to create an effect like a folded sheet of paper unfolding.

I was thinking about transforming an image so it "scales" from the center to the borders by cutting the image in half and scaling both parts to create this effect.

Is there a better way?

sentences:
Weird stuttering with fixed-timestep, variable-framerate game loop I've been trying to set up fixed-timestep loop for my game, using the technique from here. I have no need for the interpolation step as I intend to run the logic at or above vsync speed.

Here is a simplified version of my test code (C#):

const double MILLISECONDS = 1000.0;
const double TARGET_SPEED = 60.0; //Logic tick rate in hertz

const double dt = MILLISECONDS / TARGET_SPEED;

double currentTime;
double accumulator = 0.0;
Stopwatch logicTimer = new Stopwatch();

double theta = 0;
float spinSpeed = 0.005f;

//Game loop:
while (true)
{
    double newTime = logicTimer.ElapsedMilliseconds;
    double frameTime = newTime - currentTime;

    currentTime = newTime;
    accumulator += frameTime;

    while (accumulator >= dt)
    {
        theta = (theta + spinSpeed * dt) % (Math.PI * 2.0);
        accumulator -= dt;
    }

    //Draw sprite, rotated theta radians
    Draw();
}

With TARGET_SPEED at 60Hz on a 60Hz monitor, most of the time it runs smoothly. However, often when I run the test I see periodic jumps in the rotation. The time to complete a revolution does not change, but it appears to stand still for an extra frame or two and then jump ahead to make up the difference. The frequency of these stutters is constant during a run, but subsequent runs with the same settings will stutter at different rates.

I've measured how much theta changes each logic step, and it's rock steady across multiple runs regardless of stuttering.

This leads me to believe the problem is something to do with differences between my game's clock and my monitor's refresh clock. However, I can't figure out anything beyond that.

The problem still happens whether vsync is on or off. It happens less often when TARGET_SPEED is a multiple of 60; for any other value it happens on every run. Increasing TARGET_SPEED past 1000 or 10,000 Hz appears much smoother, but there's no way I can run a real game that fast. Drawing more or fewer sprites to control the time spent rendering doesn't seem to have any consistent effect on the problem.

So basically I'm completely stumped. Any idea why this is happening and how I can fix it?

Here's the full source file for my test project (XNA) if you want to try it for yourself.

sentences: Is there a browser game engine with options of payments? I would like to make some browser game, where you can buy stuff for real money. Is there any engine I could use? Or should I implement it by myself?

sentences:
OpenGL tesselation doesn't change geometry shape I implemented tessellation control and evaluation shaders in OpenGL, but the effect it has on my terrain was not what I expected.

I expected that the low poly-count curves and shapes on the terrain would be smoothed out with new vertices between the old ones but instead I get the effect shown below.

This tessellation seems to simply create a high poly-count version of the exact same model with no difference in shape.

How do I remedy this, or am I misunderstanding the purpose of tessellation?

Without Tessellation

With Tessellation

Tessellation Control Shader

#version 450

layout(vertices = 3) out;

in VS_OUT {
    vec3 normal;
} tesc_in[];

out TESC_OUT {
    vec3 normal;
} tesc_out[];

uniform vec3 view_position;

/* Return level of tessellation based on distance */
float tess_level(vec4 pos1, vec4 pos2) {
    const float d = distance(pos1, pos2);
    if(d < 0.5) { return 25; }
    if(d < 1.0) { return 20; }
    if(d < 1.5) { return 15; }
    if(d < 2.0) { return 10; }
    if(d < 2) { return 5; }
    if(d < 3) { return 2; }
    return 1;
}
float tess_level(vec3 pos1, vec3 pos2) {
    return tess_level(vec4(pos1, 1.0), vec4(pos2, 1.0));
}

/* Sets tessellation levels */
void set_LoD() {
    vec4 d1 = vec4(gl_in[1].gl_Position.xyz + (gl_in[2].gl_Position.xyz - gl_in[1].gl_Position.xyz) / 2, 1.0);
    vec4 d2 = vec4(gl_in[0].gl_Position.xyz + (gl_in[2].gl_Position.xyz - gl_in[0].gl_Position.xyz) / 2, 1.0);
    vec4 d3 = vec4(gl_in[0].gl_Position.xyz + (gl_in[1].gl_Position.xyz - gl_in[0].gl_Position.xyz) / 2, 1.0);

    vec4 view_position_v4 = vec4(view_position, 1.0);
    float e0 = tess_level(d1, view_position_v4);
    float e1 = tess_level(d2, view_position_v4);
    float e2 = tess_level(d3, view_position_v4);
    float m = min(e0, min(e1, e2));

    gl_TessLevelInner[0] = floor((min(e0, min(e1, e2)) + max(e0, max(e1, e2))) / 2);
    gl_TessLevelOuter[0] = e0;
    gl_TessLevelOuter[1] = e1;
    gl_TessLevelOuter[2] = e2;
}

void main() {
    if(gl_InvocationID == 0) {
        set_LoD();
    }

    tesc_out[gl_InvocationID].normal = tesc_in[gl_InvocationID].normal;
    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;
}

Tessellation Evaluation Shader

#version 450

layout(triangles, fractional_even_spacing, ccw) in;

in TESC_OUT {
    vec3 normal;
} tesc_in[];

out TESE_OUT {
    vec3 normal;
    float height;
    vec4 shadow_position;
} tesc_out;

uniform mat4 model_view;
uniform mat4 model_view_perspective;
uniform mat3 normal_matrix;
uniform mat4 depth_matrix;

vec3 lerp(vec3 v0, vec3 v1, vec3 v2) {
    return (
        (vec3(gl_TessCoord.x) * v0) +
        (vec3(gl_TessCoord.y) * v1) +
        (vec3(gl_TessCoord.z) * v2)
    );
}

vec4 lerp(vec4 v0, vec4 v1, vec4 v2) {
    return (
        (vec4(gl_TessCoord.x) * v0) +
        (vec4(gl_TessCoord.y) * v1) +
        (vec4(gl_TessCoord.z) * v2)
    );
}

void main() {
    gl_Position = lerp(
        gl_in[0].gl_Position,
        gl_in[1].gl_Position,
        gl_in[2].gl_Position
    );

    tesc_out.normal = normal_matrix * lerp(
        tesc_in[0].normal,
        tesc_in[1].normal,
        tesc_in[2].normal
    );

    tesc_out.height = gl_Position.y;

    tesc_out.shadow_position = depth_matrix * gl_Position;
    gl_Position = model_view_perspective * gl_Position;
}

sentences:
How would I implement an endless road the player runs down? I want to create the illusion that a man is running down a long road i.e. this pic

http://camlinecambridgelimited.web.officelive.com/images/road%20graphic1.jpg

If you have played Temple Run on the iPhone, it's the same principle, but instead of a temple it's a normal road.

I want to know how this is implemented. For example, do I just repeat this road image in a loop?

sentences:
How do C# and UnityScript differ in Unity development? Other than the obvious language differences, how do UnityScript and C# differ when developing games in Unity3D?

Is there a noticable performance difference?
Is the UnityScript code packaged as-is? If yes, does this help the game's moddability?
Is it possible to use libraries developed for one language while developing in the other one?
Can the two languages be mixed in the same Unity project; coding some parts in C# and others in UnityScript?

sentences:
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:
Issues implementing arcball viewer My scene has a simple cube, and a camera built with the lookAt function (I'm using OpenGL). The scene renders fine, and I'm sure I have my model/view/projection matrices set up correctly.

Now I'm trying to implement arcball rotation for my camera, but I'm having some trouble. I've got it down to calculating the angle/axis rotation for a virtual sphere in normalized screen coordinates. That means when I move my mouse left to right, I get an angle around the Y axis... and moving my mouse up/down will get me an angle about X.

I'm not sure where to go from here -- what do I need to do with my axis so I can apply the angle to simulate camera rotation about its viewpoint?

If I try directly applying the axis/angle rotation the camera/view transform I get what you'd expect. The view is rotated about the world axes which the mouse moving over the virtual sphere on the screen corresponds to. So if I move the mouse up/down the view rotates about the world's X axis (what I get reminds me of a first-person view)... but this isn't what I want.

I think I need the axis I get to be transformed so it passes through the camera viewpoint and is oriented correct in reference to the camera... but I don't know if that's right or how to do that.

sentences:
Unity animation - Cull completely vs Cull transform with hundreds of objects I am making a game with a lot of animated AI, somewhere around 500 active AI at a time. This works great so far.
My one issue is how much performance animating uses up. My issue is with culling, take the scenario below:
I have 20 units off screen that chop wood, if I cull comletely I cannot use animation events because they will not get triggered while culled, so I use cull transforms. I always prefer using animation events instead of using some timer in the code that calls ChopWood() at a set interval, I find it produces a lot of messy code.
I tried comparing performance between cull completely and cull transform and didnt notice any huge difference when using 200 agents.
So I am wondering if anyone has experience with this scenario and can warn me of any pitfalls I might encounter using animation events for this many agents. Will it end up killing my performance? Is it unreliable? If so, how did you solve it?

sentences: How check if an arbitrary given mesh is a single closed mesh? I'm building a space game where it is allowed for the player to insert his own mesh to be his spaceship. The problem I'm facing is that a ship must be a Polygon Mesh. The player will then be able to place thing inside the ship to make it behave. My question is, given an arbitrary mesh (a set of vertices and triangles), how check if it is a polygon mesh (no holes, with a clear inner side)?

sentences:
Back-face culling in 2d OpenGL game I have a 2d game I've made using OpenGL ES. The game contains a large quad that fills the entire screen (as a background image) and many smaller quads that make up a number of balls that bounce across the screen.

To illustrate displaying a ball, I may have a single quad with vertices (0,0),(0,1),(1,1),(1,0). I then fill this quad with a texture (a colored ball).

I am wondering if I need to perform back-face culling (for performance reasons). Given these 4 vertices, I assume a polygon is drawn to connect them. Is it actually the case that two polygons are drawn? One facing forward and another one facing the back? I'm struggling to understand.

I have tried getting face culling working and I think I've succeeded, but I've not really noticed any difference in rendering times.

Not sure if relevant, but here is my environment setup code:

gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glViewport(0, 0, width, height);
gl.glLoadIdentity();
gl.glMatrixMode (GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(0, width, height, 0, 0, 1);
gl.glMatrixMode (GL10.GL_MODELVIEW);

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:
How to find the right direction to plug a sword into a rig's hand after projecting it? I've downloaded BVH animations and projected it following a book. I can now see a 3D moving rig and it looks alright. The problem is, now I want to plug a sword on the hand of the rig, but I don't know which direction it should face. That is because each vertex has a rotation and an offset, so I can calculate their positions, but there is no information available about their normals. How is this done?

Pseudocode of the position finding procedure for illustration

calculate_position(bone)
     local = bone.rotation_x * bone.rotation_y * bone.rotation_z # matrices
     local[3] = bone.offset_x
     local[7] = bone.offset_y
     local[11] = bone.offset_z
     global = local * bone.parent.global
     return [global[3], global[7], global[11]]

sentences: Lerp UI Color outside update method? I'm able to Lerp the color of a UI panel within the Update method. However I'd like to trigger behavior a single time when needed. If I put it in a method and call it it only changes for a brief time and doesn't fully complete. I could probably set a bool flag within the update method but that seems sloppy.

sentences:
Can't load model using ContentTypeReader I'm writing a game where I want to use ContentTypeReader. While loading my model like this:

terrain = Content.Load<Model>("Text/terrain");

I get following error:

Error loading "Text\terrain". Cannot find ContentTypeReader
AdventureGame.World.HeightMapInfoReader,AdventureGame,Version=1.0.0.0,Culture=neutral.

I've read that this kind of error can be caused by space's in assembly name so i've already removed them all but exception still occurs.

This is my content class:

[ContentTypeWriter]
public class HeightMapInfoWriter : ContentTypeWriter<HeightmapInfo>
{
    protected override void Write(ContentWriter output, HeightmapInfo value)
    {
        output.Write(value.getTerrainScale);
        output.Write(value.getHeight.GetLength(0));
        output.Write(value.getHeight.GetLength(1));

        foreach (float height in value.getHeight)
        {
            output.Write(height);
        }
    }

    public override string GetRuntimeType(TargetPlatform targetPlatform)
    {
        return
            "AdventureGame.World.Heightmap,AdventureGame,Version=1.0.0.0,Culture=neutral";
    }

    public override string GetRuntimeReader(TargetPlatform targetPlatform)
    {
        return
        "AdventureGame.World.HeightMapInfoReader,AdventureGame,Version=1.0.0.0,Culture=neutral";
    }
}

Does anyone meed that kind of error before?

sentences:
Puzzle design in Adventure games Creating interesting, original, logical, thoughtful puzzles is an art.

What techniques and methods do you use to create good puzzles?

Do you write storyline before designing puzzles or combine these 2 processes?

sentences:
How and when should I update events occuring after a while? This question is not language specific but a more generic approach on how to deal with lazy updates for some game variables.

Let's say, for instance, that I want to implement a "character age system" for a game.

I guess that the "age" attribute does not need to be updated 60 times per second for each of my 10.000 or so RTS/MMO characters.

So, how to implement in the game loop the update of this "long term" variables that may have it value changed very sparsely?

At the moment, I would implement some global variables to accumulate the delta time between the frames until it reaches a certain value, then, it resets and updates that variables.

Is that correct? I mean, that's how things work? Or depending on the language/plataform you would set some timers, or events that trigger the update of these variables?

sentences:
How can I implement an infinite parallax background like in Slither.io? I am trying to replicate the endless scrolling of slither.io but, I can't figure out how to implement it. Since the players can move to any direction and the background needs to be available during player's displacement.

All the parallax background scrolling tutorials show only moving on one axis, either x or y, but my case it could be to any possible direction like an arrow compass.

Can some one point me in the right direction about how I can implement this effect?

EDIT: User can move to any possible direction like an arrow in a compass.

Custom Camera Controller that follows the player

public class CameraController : MonoBehaviour {

    public GameObject Player;

    private Vector3 offset;

    // Use this for initialization
    void Start () {

        offset = transform.position - Player.transform.position;
    }

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

        transform.position = Player.transform.position + offset;
    }
}

sentences:
Throwing away inner faces of cubes of a transparent voxel structure in Unity3D? I want to create a "Building site is (not) obstructed." indicator for my building system.

How can I throw away those faces which would be hidden if the material would be opaque?

sentences:
Keybindings in Unity I need to know how to bind keys to actions through Javascript within Unity.

When I develop web applications, I normally use this:

var KeyBind = function() {
    if (document.addEventListener) {
        document.addEventListener("keydown", keyDownHandler, false);
        document.addEventListener("keydown", keyUpHandler, false);
    }
    else if (document.attachEvent) {
        document.attachEvent("onkeydown", function() {
            keyDownHandler(window.event);
        });
        document.attachEvent("onkeydown", function() {
            keyUpHandler(window.event);
        });
    }

    function keyDownHandler(e) {
        var key = e.which || e.keyCode;
        if (key == "27") {
            window.location="file:///D:/Users/pferris/Documents/Unnamed%20Site%202/HordeAttack.html";
        };
};

Does Unity use a similar method, or will I have to do something completely different?

I've been through the help section a bit, but nothing seemed very satisfactory.

sentences:
Basic terrain shader without using external texture I have this:

(Right now I have the height map in a x*x size 2D array and a 1D vector too.)
What I am trying to achieve is something like this:

Without using any textures, only plain colors. So basically smooth transitions and some shadow (using shaders).
My vertex shader looks like this:
    #version 330
    layout (location = 0) in vec3 Position;
    layout (location = 1) in vec3 Normal;
    layout (location = 2) in vec3 Color;

    out vec3 fragmentNormal;
    out vec4 ex_color,pos;
    out vec3 N;
    out vec3 v;

    void main () {
    pos= vec4(Position,1);
    ex_color = vec4(Color,1);
    fragmentNormal = Normal;

    v = vec3(gl_ModelViewMatrix * pos);
    N = normalize(gl_NormalMatrix * Normal);

    gl_Position = gl_ModelViewProjectionMatrix * vec4(Position,1);

I have normals for all the vertices. Color is set simply in the c++ code based on height.
Here is the fragment shader
    in vec3 N;
    in vec3 v;
    in vec4 ex_color;
    void main(void)
    {
       vec3 L = normalize(gl_LightSource[0].position.xyz - v);
       vec4 Idiff = gl_FrontLightProduct[0].diffuse * max(dot(N,L), 0.0);
       Idiff = clamp(Idiff, 0.0, 1.0);
       gl_FragColor = Idiff*ex_color;
    }

So I guess my problem is what formula should I use to mix the colors. I think I don't need to set the colors in the c++ code but in the shaders.
Update:
Here is the wireframe of the terrain.

Update2:
Based on @Babis' answer the result is:

So the gradient is not "projected" onto the surface as I would like to do. What could cause this? Maybe my qustion wasn't clear.

sentences:
AI and rendering to screen I'm using LWJGL, however I'm a bit confused on what to do.

I'm trying to write an AI simulation, however I'm stuck at this problem. I have one camera, and I plan to move the camera to the mob position and then save it to the screen, then I will then use that to input into the neural network, then it does its action, then I move onto the next mob and repeat. Then, finally I move the camera to the player position so I can see what is happening.

The problem is that I just want to see out of the player eyes and not the mob eyes. However, I'm confused on how to do it. http://www.lwjgl.org/wiki/index.php?title=Taking_Screen_Shots the only way I can think of getting the information for what the mobs see is to take a screen shot if I render it to the screen. But, then if I do this all I will see is everything jump around a lot.

The code will look something like this

public class Game() {
  public Game() {
      camera = new Camera();
      player = new Player();
      ArrayList<Mobs> mobs = new ArrayList<Mobs>();
  }

  public void update() {
  player.update();
    for(int i=0; i<mobs.length; i++) {
      camera.setPos(mobs.get(i).getPos();
      mobs.get(i).render;
      saveScreen();
      mobs.get(i).logic();
    }
  }

   public void render() {
     player.render();
   }
}

There must be a better way. For example, maybe it possible to not render to the screen to input the data into the mob. Or maybe, I don't need to save it to say .png to then put into the neural network.

sentences:
Load state / continue game based on user input I'm working on a rather simple 2D game, with a pretty small set of values that will need to be preserved for a user to pick up where they left off last time they played.

Rather than saving/loading the state of the game for users to leave/return, I'm considering something akin to what MegaMan did, where a user enters a "password" to resume from their previous state, like so:

How is something like this generally implemented? My two thoughts were

Build list of all valid passwords and their corresponding states. Reject anything not on the list, and load the corresponding state when correct input is received.
Represent the state as a binary string, and make that the password. If the user's input parses validly, assume it to be valid and set it to the state.

What are the concerns with each of these approaches, and is there another way to go about this that I've overlooked?

Note: If this question is tagged poorly, it's because this is my first question on gamedev.stackexchange, and I'm not yet familiar with the ta

sentences: What NPC gets attacked first when attacking an NPC party in an RPG? Let's say I am in a battle with four trolls, and I have the highest initiative, so I attack first. Should I randomly choose a troll to attack? Proximity to each troll does not matter (it is not a factor in the algorithm). I remember playing an older RPG (I think one of the Final Fantasy games on N64), and the attacks appeared random. You might have one troll that never gets hit, or you might have one that always gets hit. Is there an acceptable standard?

sentences:
Rotate an image in a scaled context Here is my working piece of code to rotate an image toward a point (in my case, the mouse cursor).

float dx = newx - ploc.x;
float dy = newy - ploc.y;
float angle = (float) Math.toDegrees(Math.atan2(dy, dx));

Where ploc is the location of the image i'm rotating.

And here is the rendering code:

g.rotate(loc.x + width / 2, loc.y + height / 2, angle);
g.drawImage(frame, loc.x, loc.y);

Where loc is the location of the image and "width" and "height" are respectively the width and height of the image.

What changes are needed to make it works on a scaled context? e.g make it works with something like g.scale(sx, sy).

sentences:
how to create texture for modelmesh? Is there a possibiltiy to create a texture from a meshpart in xna. By getting a flat version of the mesh. So I can create a texture for it and edit that texture(via rendertarget)? I need to get the texture(wich is not yet a texture) so I can put another texture on it.

I can create a texture and put it on a certain mesh. But I just cant figure out how I can create a texture with the right size.

I also already found out i can use text2dproj in hlsl. But when i do this i get a gray stripe in the look.

Is there a better solution?

sentences:
Jump Script Component For Character Controller I'm trying to implement a jump method into my FPSInput script. I know how to make this work for a Rigidbody, but how can I accomplish this with my Character Controller? Does CharacterController have a method comparable to AddForce?

First Person Movement Input:

public class FPSInput : MonoBehaviour {
    public float speed = 6.0f;
    public float gravity = -9.8f;

    private CharacterController _charController;

    void Start() {
        _charController = GetComponent<CharacterController>();
    }

    void Update() {
        float deltaX = Input.GetAxis("Horizontal") * speed;
        float deltaZ = Input.GetAxis("Vertical") * speed;
        Vector3 movement = new Vector3(deltaX, 0, deltaZ);
        movement = Vector3.ClampMagnitude(movement, speed);

        movement.y = gravity;

        movement *= Time.deltaTime;
        movement = transform.TransformDirection(movement);
        _charController.Move(movement);
    }
}

Works for Rigidbody only:

public class Jump : MonoBehaviour {

    public Vector3 jumpVector;

    // Update is called once per frame
    void Update() {
        if (Input.GetKeyDown(KeyCode.Space)) {
            GetComponent<Rigidbody>().AddForce(jumpVector, ForceMode.VelocityChange);
            }
        }
}

sentences:
How do I calculate logical velocity / direction? I have a simple jBox2D (Java) implementation of a world with couple of Circle bodies that at the begining are static.

I want to make them movable when the user touches the circle. But I want them to be movable from the point where it's touched to its logical velocity direction.

How do I set the velocity / direction of the body after the touch so that it moves to the point that is logical to the touch?

10x

sentences:
How can i keep the spawned cubes to be inside the given area? In this case the 4 walls and objects I spawn inside the 'wall area' are all cubes. This situation could change to where the walls will be spheres and the other objects can be cylinders or cubes (its not limited to cubes only).

What I'm trying to do is to spawn the objects in random positions but within the 'wall area'. The problem is when some cubes (objects) are spawning too close to the walls, part of the cubes will inside the area and some will be outside.

In the screenshot example on the right, a cube is going out of the wall area.
In this case the walls area is sized according to the terrain (500x500) but it could be any size like 45x23 or 100x100.

In the script below I'm getting the 4 walls objects in array.

walls = GameObject.FindGameObjectsWithTag("Wall");

Now I wonder how can I use a ray cast to detect if each cube is spawning too close to one of the walls and if so then re-position the cube randomly, over and over again until it's inside the walls area. I'm not sure if using ray cast is the best way but that's what I had in mind.

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

public class SpawnObjects : MonoBehaviour
{
    public int numberOfObjects;
    public GameObject objectToPlace;
    public Vector3 newObjectsSize;
    public float spawnSpeed = 0.1f;

    private int wallsLengthX;
    private int wallsLengthZ;
    private int wallsPosX;
    private int wallsPosZ;
    private int currentObjects;
    private GameObject[] walls;
    private List<GameObject> objects = new List<GameObject>();
    private GameObject spawnedObjects;

    void Start()
    {
        var wi = GetComponent<Walls>();
        wallsLengthX = (int)wi.lengthX;
        wallsLengthZ = (int)wi.lengthZ;
        wallsPosX = (int)wi.wallsStartPosition.x;
        wallsPosZ = (int)wi.wallsStartPosition.z;

        walls = GameObject.FindGameObjectsWithTag("Wall");
        spawnedObjects = GameObject.Find("Spawned Objects");

        StartCoroutine(Spawn());
    }

    IEnumerator Spawn()
    {
        for (int i = 0; i < numberOfObjects; i++)
        {
            GameObject newObject = (GameObject)Instantiate(objectToPlace);
            newObject.transform.localScale = GenerateRandomScale(newObject);
            newObject.transform.localPosition = new Vector3(GenerateRandomPositions(newObject).x , GenerateRandomPositions(newObject).y + newObject.transform.localScale.y / 2.0f, GenerateRandomPositions(newObject).z);
            newObject.name = "Spawned Object";
            newObject.tag = "Spawned Object";
            newObject.transform.parent = spawnedObjects.transform;

            objects.Add(newObject);
            yield return new WaitForSeconds(spawnSpeed);
            currentObjects += 1;
        }

        var wp = GetComponent<WayPoints>();
        wp.FindMyObjects();
    }

    private Vector3 GenerateRandomScale(GameObject newObject)
    {
        Vector3 newScale = new Vector3(UnityEngine.Random.Range(5, 100), UnityEngine.Random.Range(5, 100), UnityEngine.Random.Range(5, 10));

        return newScale;
    }

    private Vector3 GenerateRandomPositions(GameObject newObject)
    {
        float paddingX = Mathf.Clamp(newObject.transform.localScale.x, 0, wallsLengthX) / 2f;
        float paddingZ = Mathf.Clamp(newObject.transform.localScale.z, 0, wallsLengthZ) / 2f;
        float originX = wallsPosX + paddingX - wallsLengthX / 2f;
        float originZ = wallsPosZ + paddingZ - wallsLengthZ / 2f;
        float posx = UnityEngine.Random.Range(originX, originX + wallsLengthX - paddingX);
        float posz = UnityEngine.Random.Range(originZ, originZ + wallsLengthZ - paddingZ);
        float posy = Terrain.activeTerrain.SampleHeight(new Vector3(posx, 0, posz));

        return new Vector3(posx, posy, posz);
    }
}

sentences:
Bad to learn XNA without an amazing foundation on C#? I've been going though Head First C#, and enjoying it's style of teaching.
But I'm into this as a hobby for now, and I'm itching to learn more about games, so I've been diving into Learning XNA 4.0 as well.

Is this a bad idea? Is my lack of C# gonna harm adapting it? 'cause as of now, it feels much more rewarding.
Between that and http://rbwhitaker.wikidot.com/2d-tutorials, I've been having more "fun" drawing sprites and animations than making calculators.

sentences:
How to make levels that never get old, even with a leveling system? I always get the feeling that in games with a linear plot and leveling system, players never go back to the older levels because the monsters there are too easy and the world has nothing new to offer there.

Players usually don't go visit floor 1 just for memory's sake or to remember the good times they had there. In fact, they probably forget what happened there and move on like it's nothing. For some reason, this bothers me to no end.

Is there a way to remedy that? I don't want the feeling of certain game areas to become obsolete to the player as the story progresses.

I want my game to be dynamic and ever-changing, with things to offer at every location, at every point in the player's game progress, even if one place is not at the right "level" to match with the player's current overall character levels. There should be a kind of equality, where at no point does the player tire of one place and can move freely from one place to the next. Does this sound slightly open-world ish?

This is not only for replayability, but also to provide a certain kind of elegance to the game. I feel like there is something lacking, and something that might be able to be improved, in RPGs, where the story is everything and so "old" levels are treated as second-class citizens. I was always slightly bored when I had "conquered the world" and ran through every monster like it was spaghetti.

One of the solutions I thought of is to simply update the monsters, treasure chests, items, dialogue, etc. at the old locations. Perhaps even updating the graphics would provide a visual cue that the player can have some more novel experiences there. However, isn't that essentially just changing the very nature of the location itself? The problem I have with that is that players will then forget what happened because the place itself disappeared/changed.

If anyone thinks of any good ideas, I would like to hear them. Thanks!

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:
Is it possible to measure Used vs Unused time in a 60hz frame in Unity? In custom engines I've often made a frame rate meter that shows how much of the each frame was actually used. In other words if the game is locked to 60fps using vblank I show a graph of how much of each frame was used for processing and how much was just waiting for the next vblank. This gives a visual indication of how much more can be added to a scene without hitting my frame rate budget.

Is this possible to do in Unity?

What I tried:

I made a script that creates a System.Diagnostics.StopWatch and starts it. I set that script's Script Execution Order to be the very first script.

In the script's Update I record the ElapsedTicks from the stopwatch as startTicks. In the scripts's OnGUI I compute a deltaTicks as in

long deltaTicks = m_stopWatch.ElapsedTicks - startTicks;

I can then compute how much of a 60fps frame was taken with

long ticksPerFrame = System.Diagnostics.Stopwatch.Frequency / 60;
float amountOfFrameUsed = (float)((double)deltaTicks / ticksPerFrame);

Note: I get that OnGUI is called multiple times per frame but the way I end up storing amountOfFrameUsed I only end up recording the time from the last time OnGUI is called that frame.

Anyway, this does give me a graph to look at but I have no idea if what it's slowing me is correct for Unity.

In my own engine I'd record the time at VBlank and then in my code, when all processing was done I'd compute the elapsed time since vblank.

Is what I'm doing correct? Is there a better or another way I should be doing this? (note: I have not used the profiler because I wanted to see this FPS meter in a production app, not in the Editor where there is tons of overhead).

sentences:
Do I need a rendering system in my engine? I am planning to create a cRPG game engine that would allow to easily create games like Baldur's Gate. I already tried to do that once, but my knowledge was vastly insufficient at the time. I settled for C++, SFML and TGUI (a GUI library), as this is what I have most experience with. I've read this article on game engine architecture, and I have decided to follow that system's architecture (event/message driven), because I know how much of a unworkable hairball my previous attempt was.

I am mindmapping the concept and its architecture for the past few days now (something I didn't do at all previously); and I came up to the point of how I want to divide (or do I?) the gameplay and rendering. The rendering part is actually very simple, as SFML does bulk of the job. I concluded that I don't even know what I could place in the rendering system apart from drawing sprites. I also can't seem to find more resources about game engine systems, because every time I search for that I get system requirements for unity and unreal.

If I decide to go with the rendering system, what would be the best way to store and send sprites? I suppose that I need to make a sprite resource manager. If so, how is the best way to send them to the render system without coupling things too much? Or perhaps the sprite resource manager should reside in the render system itself?

EDIT:
As of current, the planned architecture is divided into 6 systems (Input, Audio, Logging, GUI, Gameplay, Render). I will use Events for decoupling. The problem with this design is that i will have at least 3 direct connections between GUI, Gameplay and Render. Those are:

Between GUI and Render. The TGUI library introduces a TGUI Window class that inherits from SFML one, and can be used as one. In my case, it will be a part of the Render system. Hovewer, the GUI system will need to have a pointer to the Window to register GUI widgets.
Between Gameplay and Render. Where applicable, Actor class will have a AnimatedSprite, which i will implement on my own. It will be a part of the Gameplay system, and will have a pointer to the sprite in resource manager (in the Render system); it will just cut it depending on animation/frame. In some cases, when animations are not required, the Actor class will just have pointer to a normal sprite. To get those pointers a function in resource manager will be called from the Gameplay system.

The latter of two is the major problem; as the function could be called at any time. But, it would be a simple function like sf::Sprite * getResource(std::string name) so i think it wont present all those big bad problems of coupling.

sentences:
Why nearby triangles tend to disappear? I've just enabled back face culling and I'm noticing a weird behavior: when all vertices of my triangle is outside the view and 2 of them is behind me (I think) the triangle disappears.

So to see it, here is a GIF.

I suspect the projection matrix reverses the order of the two vertices when they fall behind me, and changes the winding of my triangle.

But it's unclear why does the triangles disappear only if all vertices out of view...

How can I work around this problem, if possible?

I develop on Linux if that matters.

UPDATE:

It's pointed out it might not be due to the back face culling. I disabled it and I can indeed reproduce it. The cubes are 20×20 and the vertical field view is 90°. Its vertical apparent size roughly fills the window.

UPDATE 2:

Ok I'll post the relevant part of the code, projection and view matrixes are set up using my own functions:

void createViewMatrix(
    GLfloat matrix[16],
    const Vector3 *forward,
    const Vector3 *up,
    const Vector3 *pos
)
{
    /* Setting up perpendicular axes */
    Vector3 rright;
    Vector3 rup = *up;
    Vector3 rforward = *forward;

    vbonorm(&rright, &rup, &rforward); /* Orthonormalization (right is computed from scratch) */

    /* Filling the matrix */
    matrix[0] = rright.x;
    matrix[1] = rup.x;
    matrix[2] = -rforward.x;
    matrix[3] = 0;

    matrix[4] = rright.y;
    matrix[5] = rup.y;
    matrix[6] = -rforward.y;
    matrix[7] = 0;

    matrix[8] = rright.z;
    matrix[9] = rup.z;
    matrix[10] = -rforward.z;
    matrix[11] = 0;

    matrix[12] = -vdp(pos, &rright);
    matrix[13] = -vdp(pos, &rup);
    matrix[14] = vdp(pos, &rforward);
    matrix[15] = 1;
}

void createProjectionMatrix(
    GLfloat matrix[16],
    GLfloat vfov,
    GLfloat aspect,
    GLfloat near,
    GLfloat far
)
{
    GLfloat vfovtan = 1 / tan(RAD(vfov * 0.5));

    memset(matrix, 0, sizeof(*matrix) * 16);
    matrix[0] = vfovtan / aspect;
    matrix[5] = vfovtan;
    matrix[10] = (near+far)/(near-far);
    matrix[11] = -1;
    matrix[14] = (2*near*far)/(near-far);
}

Projection matrix set up with this call:

createProjectionMatrix(projMatrix, VERTICAL_FOV, ASPECT_RATIO, Z_NEAR, 10000);

(VERTICAL_FOV = 90, ASPECT_RATIO = 4.0/3, Z_NEAR = 1)

Level drawing is simply:

void drawStuff()
{
    GLfloat projectView[16];

    glClearColor(0, 0, 0, 1);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    createViewMatrix(viewMatrix, &camera.forward, &camera.up, &camera.pos);

    multiplyMatrix(projectView, viewMatrix, projMatrix); /*< Row mayor multiplication. */

    glUniformMatrix4fv(renderingMatrixId, 1, GL_FALSE, projectView);
    bailOnGlError(__FILE__, __LINE__);

    renderLevel(&testLevel);
}

Cubes are rendered wall by wall (optimizing this will be another story):

    for (j = 0; j < 6; j++)
    {
        glBindTexture(GL_TEXTURE_2D, cube->wallTextureIds[j]);
        bailOnGlError(__FILE__, __LINE__);

        glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, (void*)(sizeof(GLuint) * 4 * j));
        bailOnGlError(__FILE__, __LINE__);
        glUniform4f(extraColorId, 1, 1, 1, 1);
        bailOnGlError(__FILE__, __LINE__);
    }

Vertex shader:

#version 110

attribute vec3 position;
attribute vec3 color;
attribute vec2 texCoord;

varying vec4 f_color;
varying vec2 f_texCoord;

uniform mat4 renderingMatrix;

void main()
{
    gl_Position =  renderingMatrix * vec4(position, 1);
    f_color = vec4(color, 1);
    f_texCoord = texCoord;
}

Fragment shader:

#version 110

varying vec4 f_color;
varying vec2 f_texCoord;

uniform sampler2D tex;

uniform vec4 extraColor;

void main()
{
    gl_FragColor = texture2D(tex, f_texCoord) * vec4(f_color) * extraColor;
}

The depth buffer simply set up by enabling it.

sentences:
Flipped Normals On Back Faces I'm trying to create grass quads and have therefore disabled backface culling when rendering these quads. With each vertex normal set upwards ( 0.f, 1.f, 0.f ), all front faces are lit correctly, but backfaces are black. If I change the the Y normal to -1.f the backfaces light up and the front faces go black.

D3D11_RASTERIZER_DESC desc {};

desc.AntialiasedLineEnable  = false;
desc.CullMode               = D3D11_CULL_NONE;
desc.DepthBias              = 0;
desc.DepthBiasClamp         = 0.f;
desc.DepthClipEnable        = true;
desc.FillMode               = D3D11_FILL_SOLID;
desc.FrontCounterClockwise  = false;
desc.MultisampleEnable      = false;
desc.ScissorEnable          = false;
desc.SlopeScaledDepthBias   = 0.f;

I'm not so sure there's a problem here. Any ideas?

sentences:
How to calculate max region/area of 2d circles? I have some 2d circles on a plane, each has its own minRadius and maxRadius. When two circles collides, both of them will shrink their radius, so the actual radius of a circle is in range [minRadius, maxRadius].

I need to calculate the max possible radius of each circle. See below image for an example.

Currently, I use the following algorithm to calculate the radius of each circle.
I try to increase each circle's radius a little each steps, then check and solve if there is any collisions.

foreach c in circles: c.radius = c.minRadius;

for (int i = 0; i < 10000; ++i)
{
  foreach c in circles: c.radius = c.radius + 1
  foreach c in circles: calculate_radius(c)
}

function calculate_radius(c)
  collides = find_all_circles_which_radius_is_overlap_with_c()

  foreach x in collides {
    x.radius -= somevalue;
    c.radius -= somevalue;
  }
end

For now, the result looks fine, but the algorithm costs too much time.

So I wonder if there exists other ways to solve it?

=======================================================

@wondra counterexample(maybe)

The image below illustrates the problem.

From my understanding of your algorithm, the final radius of circle A is 1.6, the calculation sequence is (BC, AB, AD)

But if using my algorithm(increase radius by a small amount each step), the final radius of circle A is 1.5.

I don't think recalculate the dist matrix after each selection will solve the problem, as stated in my question, each circle may have its own minRadius and max Radius.

sentences:
Calculating vertex normals to be able to have both sharp edges and smooth gradients I'm computing area-weighted vertex normals, but lighting looks bad on meshes containing sharp edges and corners (e.g. cubes look 'blobby' as the light leaks onto the dark sides).

Is there a way of calculating/using vertex normals to preserve sharp edges and still have smooth regions? Ideally, without the need to create extra geometry (e.g. splitting faces adjacent to a sharp edge and creating new vertices).

Most sources talk about having different 'smoothing groups' which influence geometry generation.

Could someone explain what are "per-corner" normals?
From Libigl tutorial:
"Storing normals per-corner is an efficient and convenient way of supporting both smooth and sharp (e.g. creases and corners) rendering."

sentences:
Snake game steering with Java FX I am currently trying to make a snake game with Java FX, I read several posts about it and I understand on theory how to move the snake body (for each part of the snake reference the previous one and move it to its former location) but I am facing some issues, my snake is not able to turn around properly:

I would just like it to react as a normal snake, when the head steers into a direction then the other body parts follow one by one.

In my case I created a vector class to store positions and velocity (I use velocity to be able to move all the part at the same speed and therefore be able to keep the 3 pixel gap between them).

I usually trying my best to resolve issues but this time I've spent almost 3 hours knowing the theory and groping for a proper way to do it but without any improvements.

I tested different approaches but this one seems to be the clearest and the nearest to the solution to me:

I got 2 simple classes that are Vector (only holding reference to X and Y) and Block that holds references such as Position, Velocity for the current motion, nextVelocity to anticipate steering, Previous for the previous block in the snake body.

I initialize my snake like that :

    public Snake(){
    this.head = new Block(250,250);
    for(int i = 0; i < 5; i++){
        if(i == 0){
            body.add(i, new Block(new Vector(head.getPosition().getX() - 18 , head.getPosition().getY())));
            body.get(i).setPrevious(this.head);
        }else{
            body.add(i, new Block(new Vector(body.get(i-1).getPosition().getX() - 18, body.get(i-1).getPosition().getY())));
            body.get(i).setPrevious(body.get(i-1));
        }
    }
    this.head.setPrevious(body.get(0));
}

Then there are my steer() method for the head as well as my follow() method for the other body parts.

I used the variable nextVelocity that stores the velocity of the previous part if this one is different from the current one, in this case nextVelocity is passed to velocity at the next frame to avoid that the whole body moves at the same time in the direction taken by the head (which apparently doesn't work):

public void steer(Vector velocity){
    this.velocity = velocity;
    this.position.add(velocity);
    this.shape.relocate(this.getPosition().getX(), this.getPosition().getY());
}

public void follow(Block previous){
    if(this.velocity == null) {
        this.velocity = new Vector(previous.velocity);
    }else if(this.nextVelocity != null) {
        this.velocity = new Vector(this.nextVelocity);
        this.nextVelocity = null;
    }else if(this.previous.velocity != this.velocity){
        this.nextVelocity = new Vector(this.previous.velocity);
    }
    this.position.add(this.velocity);
    this.shape.relocate(this.getPosition().getX(), this.getPosition().getY());
}

And finally my move() method handling the whole snake moves:

public void move(Vector direction){
    this.head.steer(direction);
    for(int i = 0; i < body.size(); i++){
        if(i == 0){
            body.get(i).follow(this.getHead());
        }else{
            body.get(i).follow(body.get(i-1));
        }
    }
}

If anyone could point me into the right direction or just let me know where I am mistaking it would be amazing.

sentences: AI engine for iOS game development? I'm looking for an AI engine for iOS game development (machine learning, path finding).

sentences:
Spherical harmonics lighting - what does it accomplish? From my understanding, spherical harmonics are sometimes used to approximate certain aspects of lighting (depending on the application).

For example, it seems like you can approximate the diffuse lighting cause by a directional light source on a surface point, or parts of it, by calculating the SH coefficients for all bands you're using (for whatever accuracy you desire) in the direction of the surface normal and scaling it with whatever you need to scale it with (e.g. light colored intensity, dot(n,l),etc.).

What I don't understand yet is what this is supposed to accomplish. What are the actual advantages of doing it this way as opposed to evaluating the diffuse BRDF the normal way. Do you save calculations somewhere? Is there some additional information contained in the SH representation that you can't get out of the scalar results of the normal evaluation?

sentences:
Animating sprites in HTML5 canvas I'm creating a 2D platformer game with HTML5 canvas and javascript. I'm having a bit of a struggle with animations. Currently I animate by getting preloaded images from an array, and the code is really simple, in player.update() I call a function that does this:

var animLength = this.animations[id].length;
this.counter++;
this.counter %= 3;
if (this.counter == 2) this.spriteCounter++;
this.spriteCounter %= animLength;
return this.animations[id][this.spriteCounter];

There are a couple of problems with this one: When the player does 2 actions that require animating at the same time, animation speed doubles. Apparently this.counter++ is working twice at the same time. I imagine that if I start animating multiple sprites with this, the animation speed will multiply by the amount of sprites. Other issue is that I couldn't make the animation run only once instead of looping while key is held down.

Someone told me that I should create a function Animation(animation id, isLooped boolean) and the use something like player.sprite = new Animation("explode", false) but I don't know how to make it work.

sentences:
How to do placeable electricity cables that work like the ones in "Prison Architect" I would like to know one (of the probably many) ways to code a (sort of) Prison-Architect-ish electricity cable building system.

Here's a picture of what I mean:

How can I detect that cables are connected?
How can I detect if the block it's connected to is a power source?

And these 2 (above) will all be placed inside a dictionary when they are placed.

That dictionary does not yet have a key type, but the second type is a sprite.

How should I do this?

sentences:
Tile base Farm Simulation in Unity I am thinking of creating a sprite base 2d top down farm simulation game. The game uses tiles and I was wondering (conceptually) what is the best way to handle the farm tiles. Each tiles should have the following list of features.

The player should be able to add seeds to each tile
The player should be able to plant a variety of vegetables.
Plants should have different stages of growth
The player should be able to interact with each tile (dig, cover holes, water, add fertilizer, etc).
The farm layout can have a variety of shapes (i.e. Not just a square (9 x 9) or rectangle (9 x 15) a shaped farm.)

Currently I have a script that generates a square or rectangle shaped like farm, each tile is a sprite object with a 2D collider. I have come up with a solution for planting and the different stages of growth. However, it isn't the most elegant solution. My current solution is to create prefab for each plant. Then once a seed is planted onto a tile, create a plant object in the location of the tile (using it's vector position), and make the plant a child object to that tile. Each plant will have an age counter that increase when a new day is triggered. To show the growth stage swap the texture depending on the plant's age.

My biggest problem with the implementation is that if the players farm is very large the game will have to create a hundreds object, which seem very taxing. Is that a different way achieve these features without the use of so many objects? If so, how would I implement it (conceptual of course). Thanks!

sentences:
Opengl - Know when a new frame is drawn, regardless of window I want to know the framenumber of the current frame at any time, regardless the bound window or if it was changed. I dont want to implement a framecounter in my window class, since that would 1. require every depending library to check which window is bound and only use frames from there and 2. Isnt independent of windows.

I am sure there is a way to simply know when A opengl context has something new send to it. Please help me find it!

I want a frame number that is in sync with other debugging tools so I can easily compare and contrast.

sentences:
How can I reference for a two cameras on prefab through script? I have this script for controlling the cameras :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CamerasViewSwitch : MonoBehaviour
{
    public List<Camera> cameras = new List<Camera>();
    public string currentViewMode;

    // Start is called before the first frame update
    void Start()
    {
        if (cameras[0].enabled)
        {
            currentViewMode = "Third Person";
        }
        else
        {
            currentViewMode = "First View";
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.V))
        {
            cameras[0].enabled = !cameras[0].enabled;
            cameras[1].enabled = !cameras[1].enabled;

            if (cameras[0].enabled)
            {
                currentViewMode = "Third Person";
            }
            else
            {
                currentViewMode = "First View";
            }
        }
    }
}

In the Assets, I have a prefab with two children's cameras that I want to use in this script.
In this screenshot to show what I mean, I dragged the prefab name Platform to the hierarchy to show where the cameras are. The script is on the object name Cameras Switch.
How do I get these two cameras from the prefab and using them in the script?

I'm using the Platform prefab with this script but the problem is when I'm starting the game the CamerasViewSwitch script is missing the two cameras I'm not to get/find them.

sentences:
How to keep a square in front of moving camera? I'm currently attempting to create a Lens of Truth effect like what we find in Zelda: Ocarina of Time:

  The Lens of Truth allows [the player] to see things that are not normally visible to the naked eye. It can show fake walls and floors, and invisible objects and enemies. (Source: Zelda wiki)

I'm attempting it by using a square frame that is positioned in a scene and an object that should only be visible when viewed through that frame.

The way I tried it is, I defined the square vec4s like this and transform it using the world, view and projection matrix:

vec4 fc[4];
fc[0]=vec4(0,0,0,1);
fc[1]=vec4(1,0,0,1);
fc[2]=vec4(1,1,0,1);
fc[3]=vec4(0,1,0,1);
for(int i=0;i<4;i++){
   fc[i].xyz =  vec4( (worldMat * fc[i]) ).xyz;
   fc[i].w=1.0;
   fc[i] = pass.Proj*(pass.View*fc[i]);
}

In theory I should now get the positions of these 4 points in screen space relative to the position of the object.

Now I should just be able to do this:

if(!inside(inPs.glPosition.xy,fc[0].xy,fc[1].xy,fc[2].xy,fc[3].xy) ){
    discard;
}

to clip the fragment if it is outside the quad of those points (inside is  function by me, the problem is not here), since I basically figure out the screen space coordinates of the square frame.

But if I run the thing the coordinates of the square corners move all over the place.

If I debug the thing by displaying the position of those points on the object, they  don't move at all when I translate the camera, but only when I rotate it, when It should logically be the other way around. Imagine a sheet with a ligthbulb behind it. If you stand still, the position of the lamp on the sheet doesn't change, but when you move around, the light will be on other places of the sheet. I have a feeling, there's something wrong with my thought process here, but I can't figure out why.

sentences:
Effecient finding of long-range spotting targets I'm creating a top-down 2d strategy game, with a square grid map.
So far, I've used Bresenham's line drawing algorithm in a circle to determine what's in LOS of each unit, and then targedt one of the targets in the circle.
Now I find that this limits my units to shoot only at targets that they see. I want to extend my targeting algorithm to target any other unit in range of my weapon, even if they're out of sight range of this given unit, if they're "spotted" by another friendly unit. In other words, I want to enable usage of weapons with ranges longer than sight range.
Is there a better way than iterating over all sighted units and computing range and LOSto each of them?

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:
dual contouring concept and term translations I am working on a 3D sandbox mmo with destructible terrain, using Java and LWJGL. I looked at most options to achieve this and found that dual contouring would probably be the best option for me. I've read about every paper i could find on the internet about how to implement such a thing and, since i have a very basic experience in game/3d/complex programming, I've had quite a hard time. but I think I've found the solution i was looking for and would like to check with some more experienced programmer if my solution seems right and if I really successfully wrapped my mind around some of those pesky terms that were haunting my nights for the last few months;

Edit: I will try and add some more precise detail as to what i already do here in bold

so, first of all, I've created an object called voxel when I say object, i refer the the user side's way of handling the data received from the server. I already compress the data as to have it fit a byte or a short and use bitwise operations. Voxels are loaded once from the server then stored to memory unless the server returns a change to that voxel (not sending entire chunks for a small change), a voxel knows it's type and it's "integrity" (in this case, how much that stone voxel has been mined for example. I think it refers the the volume i often read about?). Those voxels "will" be created from a pre generated world map for a persistent world. Yes, the world will have overhangs and most of all, tunnels players can mine.

then i got a chunk, composed of at most 32x32x32 voxels. A chunk knows it's world position and has a 3D array of voxels passed from the server when first loaded to memory, then the client/server only updates the voxels that have changed since the last update. A chunk also knows it's neighbors (if such neighbors have been loaded into memory, or creates a default chunk of 32x32x32 air voxels)

To find the surface, inside a chunk, i check every voxel from the bottom,left,near (I think it is the right order to fit with the way OpenGL read it's coordinates?) to the top,right,far. each time, i take the current voxels and all it's 7 neighbors in a cube shape and check whether their is a type change from solid to air in any of them, indicating a surface running through that cube. If there's a type change, i compare every edges to see if there's a type change and if so, place the entersection of that edge using and average of both corners integrity. doing so for all 12 edges allows me to average all the planes to a single point inside that cube and create a vertex and store it in an array.

The point where I'm confused is this: what should i do next? I think I should check along one edge that displays a type change to find the 3 other cubes that has the same edge and find their vertices. Since i know what direction the ground is (comparing the type change along the edge axis) I can deduce the front and back of the quad. taking 3 of those 4 vertices should allow me to get a normal from their dot product and from there, go around that normal CCW and send those vertices to the GPU for the rendering phase. I guess the real question here is: How do I get the right order of vertices to form triangles that OpenGL can draw correctly from that large collection of vertices generated while finding the surface?

In theory, in my mind, it makes sense! but I find it so much simpler than all those papers I've found, that i fear I've missed the boat completely! I get lost when it comes to Isosurface (I guess here, the formula they're talking about would be the average of integrity along any type change?) and hermite data (here, should i read voxel collection instead?) and most maths are slightly beyond my understanding yet (working on it tho and I progressed quite a bit) please, can you help me out here and guide me a bit?

sentences:
Unity Network how to move noplayer object from client side When i drag a nonplayer object from host, client can see it, but when move the object from client, host player doesnt see any changes. How can i fix it?

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

public class DragObject : NetworkBehaviour
{
private Vector3 screenPoint;
private Vector3 offset;

void OnMouseDown()
{
    screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
    offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
}

void OnMouseDrag()
{
    Vector3 cursorPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
    Vector3 cursorPosition = Camera.main.ScreenToWorldPoint(cursorPoint) + offset;
    transform.position = cursorPosition;
}}

sentences:
Java - simultaneous ground and wall collision I've been working on a Line2D based collision system:

public void update() {
    for (int i = 0; i < lines.size(); i++) {
        line = lines.get(i);
        if (line.line.intersects(player.hitbox))
            playerCollision();
    }
}

public void playerCollision() {
    if (Math.abs(line.angle) <= 45) {
        player.jumped = false;

        if (player.speedY > 0)
            player.speedY = 0;

        // inefficient?
        while (line.line.intersects(player.hitbox)) {
            player.centerY--;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }

        player.centerY++;
        player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2, player.WIDTH,
                player.HEIGHT);

    } else if (line.angle > 0) {
        while (line.line.intersects(player.hitbox)) {
            player.centerX--;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }

    } else if (line.angle < 0) {
        while (line.line.intersects(player.hitbox)) {
            player.centerX++;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }
    }
}

Overall, it works pretty well. There is, however, one problem I haven't been able to fix. When the player collides on a place where a wall and the ground meet, both the ground and wall collisions are executed, however, only one should be.

The result is that the player is abruptly pushed off a cliff when approaching one, or that the player is abruptly moved up when jumping alongside a cliff.

When approaching a cliff:

After one step to the right:

I've been able to come up with a method to determine which collision should be executed:

if (player.hitbox.getMaxY() - player.speedY > line.line.getY1())
    // execute wall collision only
if (player.hitbox.getMaxY() - player.speedY <= line.line.getY1())
    // execute ground collision only

However, I haven't been able to come up with how to implement this. I can't check all lines for collision first and execute the collision later, as the collision is executed per line. Does anyone know how I can fix my collision system?

P.S. I'm a beginning game developer, so my collision detection system might be bad or inefficient. If there's a better way to do this, that doesn't have the same problems, I'd love to hear about it. Please keep in mind, though, that I'm trying to keep the code simple and efficient.

sentences:
Three levels deep composition (player<-character<-spell), with preset character+skill sets So I'm creating a rather generic strategy game similar to Warcraft or League of Legends, which needs to have:

a Player class for representing the users playing the game
a Character class for the character the user is controlling (champions in LoL, heroes in Warcraft)
a Spell class for the spells each character has

Also, each player can own multiple characters, but only one can be active at a time (for now at least...)

So the design issue I'm having is with defining the characters and spells:

I want there to be "presets", similar to how Warcraft and LoL have predefined sets of heroes/champions + spells, i.e. you don't get to choose which spells you want for your character, but you choose a character and it has its own unique spells. And multiple people can pick the same character, in which case they have the same spells too, just on different levels.

First I thought to just create Character and Spell classes, but it's not that simple, since I want it to be easy to define new characters, and defining a character isn't as simple as just creating a new object like this:

char = Character(name='Warrior', spells=[...])

Since I want every player who wants to play "Warrior" to have the same set of spells (every warrior should have FireBall spell while mages have FrostBolt, for example) and same name (Warrior), but different instances.

How should I define something like this? I'm using Python 3.5, but any generic design pattern to solve this is more than welcome.

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

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

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

Thanks.

sentences:
IConvertGameObjectToEntity interface on Unity ECS Was working on ECS and following the tutorials by Mike Geig in Unite Copenhagen on YouTube(https://youtu.be/BNMrevfB6Q0), and understood that unity automatically converts transforms, mesh renderers and things like that to ECS, the IConvertGameObjectToEntity interface converts entities that I want specifically for my game. But, while following his tutorial exactly as he did it, the entities that I have on my game do not have colliders in them, but is seen in his demo, how do I resolve that?

EDIT: I've Instantiated an entity, and it works fine, but then implementing the
void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem); from the IConvertGameObjectToEntity interface,  I just have an entity, and only the mesh is visible, and an empty Component data that I've assigned on the Convert() method is available, I don't have a collider as it is on the prefab.

Here is my Spawn Entity Code:

void Start (){
        manager = World.Active.EntityManager;
        ObjectEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(ObjectPrefab, World.Active);

        for (int i = 0; i < 100; i++)
            SpawnTheObject();

}

private void SpawnTheObject()
{
    Entity object = manager.Instantiate(ObjectEntityPrefab);

    manager.SetComponentData(object, new Translation { Value = transform.position });
    manager.SetComponentData(object, new Rotation { Value = Quaternion.identity });

}

Here is The code attached to The Object:

public class AsteroidLifeECS : MonoBehaviour, IConvertGameObjectToEntity {
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
    MoveSpeed moveSpeed = new MoveSpeed { Value = MovementSpeed }; //A component data that has only one float called Value
    dstManager.AddComponentData(entity, moveSpeed);

    RotateSpeed rotateSpeed = new RotateSpeed { Value = RotationSpeed }; //A component data that has only one float called Value
    dstManager.AddComponentData(entity, rotateSpeed);

    Health health = new Health { Value = Health }; //A component data that has only one float called Value
    dstManager.AddComponentData(entity, health);
}

}

sentences:
How to keep consistent between image quality, device range support and final size of the game? I am developing a game with the LibGdx framework, but I would like to discuss a more theoretical question.

Criteria:

I want to support as many devices as possible for my game (phones and tablets)
I want to see the same image quality for each device (it is a different topic about scaling or aspect ratio)
I want my game to not freeze (support devices with a low amount of RAM).
I want to make my game as small as possible.

For example, let's take a look at the Samsung Galaxy Tab S4 10.5. It has a resolution of 2560x1600.

If I take this resolution as standard, and make all other textures dependent on this background resolution, it will make a huge size for images. Also, It won't work on slower and older devices with small resolution. (800x480, etc). So it does not satisfy criteria #1, #2 and #3.

I suppose I can make different quality versions of the same images for different devices. It may affect only the #4 criteria, but it's not as critical as others.

What strategies do you guys use to satisfy the above criteria?

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:
Why does my player walk animation take so long to begin? I'm new to Unity and after doing some tutorials and reading documentation from Unity, I've started a test project. The game is a 2.5D platformer and I wrote the PlayerController; it looks like this:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    public float turnSmoothing = 15f;
    public float speedDampTime = 0.1f;

    private Animator anim;
    private Rigidbody rb;
    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator>();
        anim.SetLayerWeight(1, 1f);

        rb = GetComponent<Rigidbody>();
    }

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

    }

    void FixedUpdate()
    {
        float h = Input.GetAxis("Horizontal");
        MovementManagement(h);
    }

    void MovementManagement (float horizontal)
    {
        if (horizontal != 0.0f)
        {
            anim.SetBool("Move", true);
            anim.SetFloat("Speed", 5.5f, speedDampTime, Time.deltaTime);
            Rotating(horizontal);

        }
        else
        {
            anim.SetFloat("Speed", 0.0f);
            anim.SetBool("Move", false);
        }
    }

    void Rotating (float horizontal)
    {
        Vector3 targetDirection = new Vector3(horizontal, 0.0f, 0.0f);
        Quaternion targetRotation = Quaternion.LookRotation(targetDirection, Vector3.up);
        Quaternion newRotation = Quaternion.Lerp(rb.rotation, targetRotation, turnSmoothing * Time.deltaTime);
        rb.MoveRotation(newRotation);
    }
}

My AnimatorController has a BlendTree called Locomotion and looks like this:

When I run the game and use the keyboard or the controller the player starts walking, but it takes a long time (I can see the Speed parameter from the blend Tree that has to reach "5" to start walking)

I think I'm not understanding something but I don't know what it is.

sentences: How do you transform a vector to use another objects orientation? I want to take a vector that is using world coordinates and position it using the orientation of an object.  So, if the direction of the object is the z-axis, and the vector is (0,0,1), then the orientated vector would point in the direction of the object.  I want to vector to remain in the world coordinate system.  All I have for the object is it's up and direction vector.  So, I can build a matrix with those by crossing them to create the third axis.  Multiplying the vector by this matrix transform the vector into the object coordinate system (right?).  But, I want the vector in world coordinate system.  Should I use the matrix to find euler angles and then use those angles to create a rotation matrix?

sentences:
Moving object through nodes in Quadtree I'm working on my own quadtree for use in games for physics (collision detection to be exact) but am unable to move an object from one node to another node.

What I'm doing is if some object is to be moved, I'm deleting it from its old position and adding a new object (with same property, such as width and height) to the new position. Is my approach correct or is there any other optimized process to do same?

The problem I'm facing is that if I move an object from node 0 to node 3 (both node being children of, for ex., root node) the root node container(I'm using std::vector) gets the object but it is not updated in the node 3's container.

Any solution to my problem? Though would be happy to try some other method too.

Thanks.

sentences:
Use Slick2D for standard application instead of game I was wondering how well Slick2D would work when used for a custom rendered GUI in a standard application?  A standard application not being a game.  More like a text editor or 2D level editor that doesn't strictly need to render at 30/60fps.

More specifically, can Slick2D be configured to only render when a change has occurred in the user interface?

Background: I want to develop a level editor for a 2D puzzle game called Enigma that takes advantage of hardware rendering and cross platformness offered by Slick2D.  I have decided that implementing the whole interface with Slick's rendering will give me the greatest flexibility when it comes to user interaction.  However, rendering at a constant fps would be a bit wasteful, which is why I ask the question above about rendering only when needed.

sentences:
How can I identify loaded models so I can efficiently avoid loading them twice? I'm making a fairly basic OpenGL 3D engine, at the moment. In this engine, when you load an object, you would write

manager->LoadObjFile("cube.obj");
manager->AddParent("uvmap.bmp", "cube.obj", "cube", glm::vec3(10.0f, 1.0f, 0.0f));

"uvmap.bmp" being the texture, "cube.obj" is the .obj file path, "cube" being the ID for the object.

My question is, at the moment, when it loads an object, it stores the object in a struct with all of the buffer data and an ID, the ID being the path of the obj file, so when I load an .obj, it runs through all of the already loaded files and compared the ID of each using strcmp, which obviously when there's thousands of items, is going to start to get a bit slow.... it does the same for AddParent, and most of my other methods (different vector of data than where the obj data is stored).

What would be best in terms of identifying items, an integer? I really don't know, I want this to be as high level, user friendly as possible, but want to keep it as optimized and as efficient as possible.

sentences:
Java Distance between two Vector positions never 0 I have a Player moving, but when the player reaching the destination it should stop. But problem is that distance never return 0.

It starts printing this:
0.9672514210000003

End by this and then start to raise back again:
0.0015875672000023044

// My position is 5.0 and toPosition is either +1 or -1
if (getDistance(getPosition(), toPosition) <= 0) {
    allowMovement = false;
}

public double getDistance (PositionVector pos1, PositionVector pos2) {
    double dx = pos1.x - pos2.x;
    double dy = pos1.y - pos2.y;
    return Math.sqrt(dx * dx + dy * dy);
}

Cheers.

sentences:
How to randomly calculate the necessary velocity changes to reach a x,y,z target? I am working on creating a mini vector graphics ping pong table, as described in this previous post: Trying to use 3D vectors for a 2D ping pong game

Currently, the stage I am at, I am trying to make it so that when the ball exceeds the X bounds of the table, it will reflect backwards and at a new target: a random x,y,z position on the opponent's side of the table.

Trying to use this post as a starting point:
How can I launch a GameObject at a target if I am given everything except for its launch angle?
I have attempted to adapt some of that example code in my program, but I am not quite getting the desired results.

** updated code **

update: function(paceFactor) {
  this.ball.pos3D.x += this.ball.vel.x * paceFactor;
  this.ball.pos3D.y += this.ball.vel.y * paceFactor;
  this.ball.pos3D.z += this.ball.vel.z * paceFactor;
  this.ball.vel.y += this.gravity * paceFactor;

  if (!this.stop && Math.abs(this.ball.pos3D.x) > 15) {
    this.stop = true; // for testing to prevent velocity from getting changed due to bad values returned from velocityForNextTarget()
    var modifier = this.ball.pos3D.x < 0 ? 1 : -1;
    var velocity = this.velocityForNextTarget(modifier);
    this.ball.vel.x += velocity.x;
    this.ball.vel.y += velocity.y;
    this.ball.vel.z += velocity.z;
  }

  if (this.ball.pos3D.y >= 0) {
    this.ball.vel.y *= -1;
    this.ball.pos3D.y -= this.ball.pos3D.y;
  }

  this.convert3Dto2D();
},

velocityForNextTarget: function(modifier) {
  var targetX = 5 * modifier;
  var targetY = 0;
  var targetZ = 0;

  var deltaX = this.ball.pos3D.x - targetX;
  var deltaY = this.ball.pos3D.y - targetY;
  var deltaZ = this.ball.pos3D.z - targetZ;

  var sqrMagnitude = (deltaX * deltaX) + (deltaY * deltaY) + (deltaZ * deltaZ);
  var speed = Math.sqrt((this.ball.pos3D.x * this.ball.pos3D.x) + (this.ball.pos3D.y * this.ball.pos3D.y) + (this.ball.pos3D.z * this.ball.pos3D.z));

  var gSquared = this.gravity * this.gravity;
  var b = speed * speed + (deltaY * this.gravity);
  var discriminant = (b * b) - (gSquared * sqrMagnitude);

  var discRoot = Math.sqrt(discriminant);

  var t = Math.sqrt((b - discRoot) * 2 / gSquared);

  return {
    x: deltaX / t * t / 2,
    y: deltaY / t - this.gravity * t / 2,
    z: deltaZ / t * t / 2,
  };
},

So what I am trying to do is make it so that when the ball reaches the location of a player, it will target the center of the opponent's side of the table, and the ball will move there, and right now this code is making the ball rapidly jump off the screen as soon as it hits the x bounds, and I am not sure what I am doing wrong with the math in velocityForNextTarget()...

I should also mention that gravity is just a constant that I am only adding to my Y velocity so far.  I am not sure if that's "right" ?

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:
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:
Separation algorithm in flock simulation? I'm using box2d (the c++ one).

I found a method for an arriving behavior (on http://www.red3d.com/cwr/steer/gdc99/ ), which works well, problem is, the bodies are bumping into each other and it results in an ugly shaking effect.

How do you make sure bodies keep away from each other after I applied the arriving behavior ? Or the other way around ?

I'm wondering if it might be a better idea to completely remove the arriving behavior to implement the separate algorithm.

edit: even setting a low restitution results in shaking

sentences: How do I place a progress bar in AndEngine? I am developing game using AndEngine. I need to place a progress bar in my game to denote time remaining in the game. Is there a built-in method for doing this in AndEngine? My searches only turned up results for Android, not for AndEngine.

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:
NullReferenceException Error For Respawning I am making an infinite runner game, and I am having issues with killing and respawning the player. I have a coroutine setup on the GameMaster objec which is the respawn and on the player I have a method that calls that coroutine. But when ever the player hits an enemy I get a Null Reference Exception and I am not sure why this is happining.

Here is the entire error

NullReferenceException: Object reference not set to an instance of an object
Player.OnCollisionEnter2D (UnityEngine.Collision2D col) (at Assets/Script/Player.cs:32)

Here is the line that when I double click on the error it goes to. This line is on the player.

StartCoroutine(GetComponent<GameMaster>().RespawnPlayer());

This is the method that the above line is in. This method is on the player.

void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "Enemy")
    {
        Debug.Log("HIT");
        Destroy(col.gameObject);
        StartCoroutine(GetComponent<GameMaster>().RespawnPlayer());
    }
}

Here is the coroutine that the above method is trying to call. This method is on the GameMaster GameObject and this object never gets destoryed or setActive false.

public IEnumerator RespawnPlayer()
{
    player.GetComponent<SpriteRenderer>().enabled = false;
    player.GetComponent<BoxCollider2D>().enabled = false;
    player.GetComponent<movemnt>().enabled = false;
    yield return new WaitForSeconds(respawnDelay);
    adMenu.SetActive(true);
}

If anybody can give any suggestions that would be great!

sentences:
Legal considerations when starting a game development team I am about to start a project with two other developers and an artist, who I still haven't found. I'm not sure how exactly should we handle that from a legal perspective, though.

Are we supposed to sign a contract? What should be stated in such a document?

The game will most likely be free.

sentences:
How would I warp a mesh with code? I recently asked a question about putting a camera at the head of a 3D human model here and it worked out rather well and whatnot, but there is still a problem that bothers me:

How would I contort/warp the mesh of the human model with code? I'd only really have to turn the head a bit using the mouse, and the rest can be animated (i.e. walking, moving arms, speaking, etc).

I was initially thinking about an animation for moving the head in a certain direction, and you would move the mouse and the animation would go along with the mouse movement until it reached the maximum angle (about 85 degrees) on either side of the model.

Is there a better way of doing this, and if so, how can I do it?

sentences:
Code for inventory function not working I'm working on an inventory, and I've ran into some problems. Some code in my CollisionDetection class doesn't work properly.

My CollisionDetection class contains functions that involve mouse and item collision. You can pick up and place down items in your inventory, you can stack and split stackable items and you can replace items.

These is an example of the working function:

If you look closely you can see that the item that I'm holding with the mouse is drawn above the other item.

This is the example of the broken function:

I need to click twice before the item finally switches.

If you look closely you can see that the item that I'm holding with the mouse is drawn below the other item and the function doesn't work properly.

I think it has to do with the layer that the item is drawn on...

The stack/replace code (the whole function uses i which is the item. The function is started by a for loop that loops through the item and inventory tiles lists):

Item i2;
// Searches item 2
i2 = items.Find(x => x.itemBox.X == r.X + 9 && x.itemBox.Y == r.Y + 9 && !x.clicked && x != i);

// If the item intersects another item (item 2)
if (i.itemBox.Intersects(i2.itemBox))
{
  // If the item is stackable
  if (i.stackable && i2.stackable)
  {
    // Hiding one item visually
    if (!i.hide_Box_Def)
    {
      i2.quantity += i.quantity;
      i.hide_Box_Def = true;
      i.error = true;

      // Bool for changing the item state (picking up/ placing down)
      // But these 2 lines of code are not really used, I wrote these trying to fix this problem.
      i.m_Switch2 = true;
      i.watch.Start();
    }
  }
  // When the item is not stackable -> item needs to be replaced by another item
  else
  {
    // Item 1 (attached to the mouse)
    // clicked: a bool that attaches the item to the mouse
    i.clicked = false;

    // itembox: collisionbox for the item
    i.itemBox.X = i2.itemBox.X;
    i.itemBox.Y = i2.itemBox.Y;

    // Oldposition for the item
    i.oldPosition.X = i.itemBox.X;
    i.oldPosition.Y = i.itemBox.Y;

    // info bool: do/ do not show item info
    i.info = false;

    // Item 2 (in inventory)
    // mouse_Click_Left: bool that changes the item state (picking up/ placing down)
    i2.mouse_Click_Left = true;
    i2.info = true;
    i2.clicked = true;
    i2.itemBox.X = (int)coords.X - 15;
    i2.itemBox.Y = (int)coords.Y - 15;
  }

Summary:

The code works when the item that's attached to the mouse is above the other item.

The code doesn't work when the item that's attached to the mouse is below the other item.

UPDATE

I fixed the first problem, so I changed the question a bit.

sentences:
game story event programming I have developed a game engine in c/c++ and DirectX.

I have a tile engine for the maps, animated player/npc sprites, talking to the npc, menus, and level changing but there is no game, it just feels empty.

I have looked around and keep hearing buzzword answers but I want to know how to implement a story in my game.

Some people have said a save file that holds flags governing every possible action/state available in the game but this sounds ludicrous.

It is a bit ambitious but I am aiming to get a game like the older Pokemon/Final Fantasy games.

Does any one know how these games work or the theory used?

I have been looking for a while and would really appreciate any input people have.

sentences:
algorithm to change the center of the image I need and algorithm in Java if possible to change the center of the image when scaling.What is happening to me is represented in the first image:
when I scale the image the image scale according to the center point of the image, what I want to do is on image2, I want to create a point A and make the image scale using that point on the horizontal line (y=540).

I have the screen size(1920x1080) the horizontal line y=540, the length and width of the rectangle, image_X=0,image_Y=0 will put the center point o x=0 and y=0, (on the image example x=1000)

Every time I do scale_image=2 the image is reduced to half the size, which is fine but it does that using center point. What I want to do is to adjust image_Y so it uses point A as the new center.

sentences:
Unity3d: Rotation of game object Quaternion objectRotation = Quaternion.identity;
Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
objectRotation *= rotation;

gameObject.transform.rotation *= objectRotation;

here angle = -90

But the gameobject isn't rotating as desired,
when I replaced

gameObject.transform.rotation *= objectRotation;

with

 gameObject.transform.Rotate (0,0,angle);

Then the gameobject rotated -90 degree, dont understand why the Quaternion part isn't working? It rotated 90 degrees

sentences:
Food Game using Online Searchs I am thinking of making a simple game with Unity. The aim would be to keep a person healthy by feeding it well balanced food and drinks.

Rather than hard codding every single type of food or drink I can think of I was thinking of letting the player choose any type of food he wants and then screen the internet for it's calorific value, saturated fat, sugars etc ...

This would make the game much more enjoyable than being limited by the foods I can think of.

I was wondering how you would go about doing that ? Could I use an API to extract data from google or wikipedia.

I noticed that when you type "[food] calories" in Google you get a return from the Wikipedia page like this:

Obviously, there is a way of extracting the data from Wikipedia and I could automate the searchs by taking the player's entry as a string and running a search with it.

How would one recommend going about this ? Also, is it safe ?

Thanks

sentences:
Why does my 3D model not translate the way I expect? In my first image, my model displays correctly:

But when I move the model's position along the Z-axis (forward) I get this, yet the Y-axis doesnt change. An if I keep going, the model disappears into the ground:

Any suggestions as to how I can get the model to translate properly visually? Here is how Im calling the model and the terrain in draw():

cameraPosition = new Vector3(camX, camY, camZ);

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

        // Draw the model. A model can have multiple meshes, so loop.
        foreach (ModelMesh mesh in mShockwave.Meshes)
        {
            // This is where the mesh orientation is set, as well
            // as our camera and projection.
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.PreferPerPixelLighting = true;
                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                    * Matrix.CreateTranslation(modelPosition);
                // Looking at the model (picture shouldnt change other than rotation)
                effect.View = Matrix.CreateLookAt(cameraPosition,
                    modelPosition, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(45.0f), aspectRatio,
                    1.0f, 10000.0f);
                effect.TextureEnabled = true;
            }

            // Draw the mesh, using the effects set above.
            prepare3d();
            mesh.Draw();
        }

        //Terrain test
        foreach (ModelMesh meshT in terrain.Meshes)
        {

            foreach (BasicEffect effect in meshT.Effects)
            {
                effect.EnableDefaultLighting();
                effect.PreferPerPixelLighting = true;
                effect.World = ttransforms[meshT.ParentBone.Index] *
                    Matrix.CreateRotationY(0)
                    * Matrix.CreateTranslation(terrainPosition);
                // Looking at the model (picture shouldnt change other than rotation)
                effect.View = Matrix.CreateLookAt(cameraPosition,
                    terrainPosition, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(45.0f), aspectRatio,
                    1.0f, 10000.0f);
                effect.TextureEnabled = true;
            }

            // Draw the mesh, using the effects set above.
            prepare3d();
            meshT.Draw();
            DrawText();
        }
        base.Draw(gameTime);
    }

I'm suspecting that there may be something wrong with how I'm handling my camera. The model rotates fine on its Y-axis.

sentences:
Defining an OpenGL unit I have read that you can define your OpenGL unit by using glViewport.
As far as I understood if you use something like glViewport(0,0,600,600) then 1 OpenGL unit = 600 pixels. Now my problem is what happens if the 2 sizes aren't equal? How do you calculate your OpenGL unit?

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: What is a "tick" in the context of game development? Ok so this is a very beginner level question but I need to know this, what does the term "tick" refer to in the context of game development? Is it the same thing as FPS? Thanks!

sentences:
How do I orbit one object around another? I am trying to do animation using glut. I have 2 squares overlapping to each other and i want other square to rotate around this central object without rotating themselves. I want to rotate in orbit manner. I am calculating circular path using parametric equation and translating that one of the square to that distance. i am calling this function in a loop.

Here is my code in which the motion of other square is not in a orbit instead it moves along a diagonal of middle one. Let me know where it is going wrong.
I have added expected image as well

sentences:
Unity3d web player fails to load textures I'm having a problem with Unity3d Web Player. I have developed a project and succesfully deployed it in a web app. It works with absolutely no problem on my PC.

This app is to be installed on two identical machines. I have installed them in both and it only works properly in one. The issue I have is on a computer it fails to properly load the models and textures, so the game runs but instead of the models I can only see black rectangles on a blue background. It has the same problem with all browsers and I get no errors either by the player or by JavaScript.

The only difference between these computers is that one that has the problem is running on Windows 8.1 and the other one on Windows 8 only. Could this be the cause of the issue?

It works fine on my computer with Windows 8.1. However both of the other computers have specs that are significantly lower than mine.

I have already searched everywhere and it seems that it has to do with the individual games, however I think it may have to do with the computer itself because it runs properly in the other two.

The specs on the computes I'm installing the app on are as follows: Intel Celeron 1.40 GHz, 2GB RAM, Intel HD Graphics

If anybody could point me in the right direction I would be very grateful

I forgot to mention, I'm running Unity Web player 4.3.5 and the version on the other two computers is 4.5.0

sentences:
3D Perspective issues My team is currently developing a 3D Sidescroller game and we encountered some issues regarding the whole in-game perspective of the levels.
The levels are composed of 3D modeled corridors which are specifically modified to simulate the effect of - 'immersive-depth'.

Example(Front View - InGame View):

Example(Side View - Angled Floor):

Example(Flat Floor Comparison - Angle vs No Angle)

The issues I spoken of are appearing at the moment I start adding 3D objects on the corridor, like lamps, crates, cabinets etc. They all seem off, due to the fact that the whole floor of the corridor is angled forward
(even if the objects themselves are angled forward).

I know it seems like a strange question to ask but are there any smarter ways/alternatives of simulating the same depth of the corridor without angling it's floor?

P.S.

1) 2D is not an option. The camera isn't static.

2) Increasing the Angle of the camera on a flat floor doesn't simulate the same effect.
The camera was meant to change dynamically in certain situations, via it's angles and position (up and down). The higher it is the more it resembles the perpendicular version. However, if the camera is lower, at a lower position and angle (on the same level as the floor is) the difference comes in place, due to the back walls being higher.

EDIT:

We've decided to stick with the 'flat'- 90 deg, floor, it's easier to maintain.

Although the Angled version is more entertaining, it is limited by the fact
    that increasing the depth - means increasing the angle, which at a certain
    point will generate an inadequate look.

sentences:
Updating object's property on Start is visible for a second when game loads I have a world selection scene in which I have GameObjects representing worlds. The GameObjects have default properties when the scene is loaded. For example: the world name text is red and each world has a "locked" status. This initial state can be seen in the following screenshot:

On the Start() method I'm dynamically updating the properties on each GameObject based on values I'm reading from a save file. If a world is unlocked the name text is set to white. If a world is currently selected the name text is set to green. Here's what that looks like at run time:

The problem is that when the scene is loaded from another scene(e.g. by clicking a navigation button) the initial state of the GameObjects can be seen for a second and then they change to the proper values as dictated by the save file. How can I prevent this from happening? I was under the impression that anything that happens in the Start() method takes place before GameObjects are rendered.

Here's some slimmed down code of what my code looks like:

    var worldIcons = FindObjectsOfType<WorldIcon>().OrderBy(x => x.WorldNumber).ToList();
    var saveFile = GameSaveManager.GetSaveFile();

    if (saveFile == null)
    {
        Debug.LogError("Could not find save file while loading worlds");
        return;
    }

    foreach (var worldIcon in worldIcons)
    {
        var savedWorld = saveFile.Worlds.SingleOrDefault(x => x.Number == worldIcon.WorldNumber);

        if (savedWorld == null)
        {
            //add world to save file
            GameSaveManager.CreateWorld(worldIcon.Controller);

            //unlock first world by default
            if (saveFile.Worlds.Count == 0 && worldIcon.WorldNumber == 1)
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
        }
        else
        {
            worldIcon.DisplayName = savedWorld.Name;
            worldIcon.WorldNumber = savedWorld.Number;

            var button = worldIcon.GetComponent<Button>();

            if (savedWorld.Unlocked)
            {
                button.interactable = true;
                button.targetGraphic.color = Color.white;
                worldIcon.Unlocked = LevelMapController.LockedStatus.Unlocked.ToString();
            }
            else
                worldIcon.Unlocked = LevelMapController.LockedStatus.Locked.ToString();
        }
    }

sentences:
Update function in html5 canvas game isn't working properly Jsfiddle :  http://jsfiddle.net/seekpunk/6eeKH/15/

the code :

if (this.collection.length > 0) {
    if (((this.collection[0].blockX + this.collection[0].blockW) >= cw)
       || (this.collection[0].blockX <= 0)) {
        this.collection[0].blockSpeed *= -1;
    }
    this.collection[0].blockX += this.collection[0].blockSpeed;
}

the first block from top is drawn twin and i can't figure out why i guess the  problem is in drawing the levels can someone please help me figure out what i did wrong in my code

sentences:
Loading images using their bytes in Unity If you import an image into the Unity inspector, the image will be encoded in Unity's own format. Usually the resulting image is much bigger than the original (from 100kb to 1MB). Of course, you can do stuff like compress and change the texture max size to reduce the image's size, but at the end it will almost always be bigger.

I noticed that you can create a Texture2D if you got the necessary bytes. As an experiment, I took my 100kb image and imported it to Unity as a .bytes file. Then I read the bytes and created my Texture2D:

    Texture2D texture = new Texture2D(100, 100);
    texture.LoadImage(myTextAsset.bytes);
    Sprite sprite = Sprite.Create(texture, new Rect(0,0,350, 288));

And it works. And it is smaller (100kb).

So my question is: what's the difference between Unity's builtin way of handling images and my way of loading them using their bytes? Because I'm saving tons of memory with this method. I imagine that it is a bit slower. But if that's the only difference, I can live with that.

sentences: Is it possible to display no white images/sprites when using the latest Android OS? Was it okay to use Texture.setEnforcePotImages(false) in order to disable conditional width and height pixel size that requires power of 2? I'm planning to sell the game app at Google Play. I want to know and make sure that most of the latest models and Android OS's that won't display faulty white images by estimation, depending how many smartphone owners have latest Android OS's. (Gingerbread, ICS, or Jellybean) I had updated my LibGDX library.

sentences:
Game Update in Libgdx In libgdx, the game loop is the render() method. But why is that, and is there a way where I can make an update() method that is called 60 times a second? As in the update() method, I would add the game logic, and leave the rendering to the render method.
Basically, separate methods, and the update() method called 60 times per second using Libgdx with java.

sentences:
What is the best way to learn Cocos2D? I've messed around with iPhone development for a couple years now. I've done some contract work. I want to get into Cocos2D to develop a game idea that I have.

I was wondering what might be the best/quickest way to get up in running in cocos2d?

I've thought about a book, but I wondering if that is needed? I'm the type of guy that just wants to know what everything does and is suppose to be used for.

Any ideas?

sentences:
Blueprint For Switching Between Cameras In The Unreal Engine So basically I have a scene in the Unreal Engine which has multiple cameras within it, the cameras are intentionally static as the application should behave more like a viewing gallery than a game. As the application is intended for mobile devices, the idea is that when a person touches the screen of their device, the rendering switches from the present camera to another one to show a different image. I have attempted to implement this action in the level blueprint with the following blueprint design:

Closer up:

Obviously in the scene there are three camera actors which must be switched between with the first camera viewed through being the 1st CameraActor hence the connection of the EventBeginPlay variable to the Set View Target With Blend variable that the 1st camera actor is connected to. When the Play button is pressed, the scene viewed from the first camera is rendered to the screen as desired however when the left mouse button is clicked equating to touch input on mobile devices, the scene does not switch to the second camera and the question is why?

sentences:
How to Interpolate between two game states? What is the best pattern to create a system that all the objects positions to be interpolated between two update states?

The update will always run at the same frequency, but I want to be able to render at any FPS. So the rendering will be as smooth as possible no matter the frames per second, whether its lower, or higher than the update frequency.

I would want to update 1 frame into the future interpolate from the current frame to the future frame. This answer has a link that talks about doing this:

Semi-fixed or Fully-fixed timestep?

Edit: How could I also use the last and current speed in the interpolation? For example with just linear interpolation, it will move at the same speed between positions. I need a way to have it interpolate the position between the two points, but take into consideration the speed at each points for the interpolation. It would be helpful for low rate simulations like particle effects.

sentences:
Positioning game object on a grid I am learning how to code by programming easy, 2D games. Here I want to try to get only a map, like in strategy games (2D isometric) and put new objects (pictures) on it.

In short: I want load a big picture and put little pictures on this big picture.

My thought was:

Find a big map picture. (or make it with Photoshop)
Put a grid-layout over that base (this will not be visible to the player).
Put smaller objects (as pictures) on this map using this grid-layout.

Is it possible to make it like this, or are there better solutions?

sentences:
How can I find the position of a corner of a transformed sprite in SFML? I need help with calculating the end points of a stick (a sprite) in my stick game.

First, I set up it's position by some coordinate (x,y) after that I rotate it by theta degrees.

I know the width and height (427, 17), but I can't figure out how to calculate it's end points after the rotation (I need them for intersect detection algorithm).

Moreover, I can't figure out how to detect when I clicked on it with the mouse, because getGlobalbounds.contains(mouse) gives me its bounding box, but I want to detect that I was clicked exactly on the entity..

sentences:
Rotating 2D bone in LateUpdate have jittering issue I made a skinned 2D character and applied IK to each hand and leg.

In my game, player can aim up and down by moving fire joystick up and down. This is implemented by update "chest" bone's rotation in LateUpdate, because it renders after all animation stuffs.

Here'e the code I'm trying:

void Update() {
    // Handle move forward & backward
    ...

    m_FireMovement = new Vector2(m_FireJoystick.Vertical, m_FireJoystick.Horizontal);
    m_DeltaTime = Time.deltaTime;
}

void LateUpdate() {
    float verticalMovement = m_FireMovement.x;
    float horizontalMovement = m_FireMovement.y;

    // Which side facing? Depends on Fire Joystick.
    if (horizontalMovement < 0) {
        transform.rotation = Quaternion.Euler(0, 180, 0);
    }
    else {
        transform.rotation = Quaternion.Euler(0, 0, 0);
    }

    // Rotate chest bone depends on vertical input
    // TODO: Fix jittering issue
    float newRotation = verticalMovement * m_AimAmount * m_DeltaTime;
    m_ChestBone.Rotate(0, 0, newRotation);
}

It works, but there is noticeable jittering issue when aim up and down. Here's the video I recorded for demonstration: https://youtu.be/eYCY0NRG_AA

So I tried with using Coroutine, invoked from "Start" and keep looping and wait until WaitForEndOfFrame, and try rotate chest bone, but that makes it worse.

In 3D project, rotating bone in LateUpdate didn't make any problem. What am I missing?

Using Unity 2019.1.0f2 and 2D Animation Package@2.1.0, 2D IK@1.1.0.

sentences:
How do RPG store and retrieve maps? I'm making a very basic online RPG (2d, and instead of sprites I use characters, like a roguelike) and I still haven't figured out how to store and retrieve maps. Until now I used a text file that are stored on the server.
Should I store the map in the database and retrieve it as the player moves around?
For example, if the player is in the position [x, y], load all the tiles within a 15 tile radius.

Or maybe dividing the map in "sections" and then, depending on the player's location load a given section?
Which is the best option?

Also, if I was to save the map in the database, which is the best data type to store it as a bi-dimensional array? BLOB maybe?

sentences:
Art style for a character that has frequent visual changes during gameplay I'm creating a game with a bodybuilding/fitness theme. The camera will almost always be focused on an inclined front view of a character who will be evolving very frequently during the game as the player 'levels up' the musculature of each part of the character such as arms, legs, chest, etc.

I've been doing some research trying to figure out the most economical yet effective way to incorporate this visual mechanic of letting individual parts of a character independently increase in size and detail and have come up somewhat short, most likely due to my complete lack of experience when it comes to art (my experience is mostly in programming).

I was thinking 2D would be best for this game, however maybe this one character should be in 3D? Would a low poly style fit these requirements, or should I look towards something akin to sprites or hand drawings? The games interactivity will be purely through menus so that doesn't need to be taken into account when dealing with the problem of this character. I would like this character to have some animations, of course, however I'm not sure if that fits the scope of this single question.

sentences:
OpenGL ES draw pre-rendered background onto depth buffer I want to create a scene with 2D pre-rendered background and 3D models for characters (like those classic Final fantasy games).
For the background, I have 2 textures:

one to be displayed, with colors, details...
one to be used as depth buffer (depth value presented as grayscale value maybe)

I want to write a shader program to help me discard all the pixels(frags) which have the depth smaller than current depth.
But then, do the background and the models have to use the same shader?
What value to compare with the depth value?
Is this approach even possible?

sentences:
Orthographic viewport zooming I'm a bit new in opengl so please bear with me. I have a viewport window like this

I have implemented zoom in/out features using the arrow keys. The problem is it zooms in and out with the whole image. Can anyone point me in the right direction as to how I can make the GUI on the sides stay in place while making my viewport (the white rectangle) zoom in and out?

Thank you!

sentences:
In Unity, how do I add a MeshFilter to an empty GameObject to generate a procedural model? My code below is modeled after Unity's documentation.  When I put the script into an empty GameObject, the error I get is:

MissingComponentException: There is no 'MeshFilter' attached to the "myMesh" game object, but a script is trying to access it.

How do I add a MeshFilter (and the other necessary Components) to the empty GameObject in order to generate the model procedurally?

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

public class myMesh : MonoBehaviour  {
    public Mesh mesh;

    void Start(){
        mesh= new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
    }

}

sentences:
Linear color workflow with render to texture - Banding in alpha channel? In OpenGL, I am using GL_SRGB8_ALPHA8 for the OpenGL internal texture format for my textures and render targets. This eliminated some banding I was seeing in dark opaque areas. However, in the following screenshot, you can see there is still some banding in the nearly-opaque black pixels on the left side. The render target is transparent in the areas where you see the checkerboard pattern.

Semitransparent pixels in SRGB formatted textures and render target textures appear too transparent when rendered to the screen, and pixels that are very nearly opaque (254, 253, 252 alpha) show noticeable banding as you can see in the sample image.

I've seen the issue with both SRGB formatted render target textures and ordinary textures with SRGB format.

The banding appears to go away if I don't call glEnable(GL_FRAMEBUFFER_SRGB).

I'm using premultiplied alpha, but I'm pretty sure I've eliminated that as a cause of the issue. I'm not doing anything to the sampled color in the pixel shader.

My blend functions:

// Non-premultipled alpha textures
glBlendFuncSeparate( GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA,
                     GL_ONE,        GL_ONE_MINUS_SRC_ALPHA);

// Premultiplied alpha textures
glBlendFuncSeparate( GL_ONE,        GL_ONE_MINUS_SRC_ALPHA,
                     GL_ONE,        GL_ONE_MINUS_SRC_ALPHA);

I tried exporting my render target to a PNG, and the true alpha values stored in the render target are increasing by 1 at each band. The texture appears much more opaque in image editors than it does in my app.

Any advice as to what could cause this kind of alpha banding?

sentences:
Should my GLSL Shader object/wrapper encapsulate loading/setting a VertexArrayObject? I am working on a 2D game in C++, with a simple rendering layer over OpenGL.

I have a wrapper for GLSL shaders and shader programs, these wrappers encapsulate shader objects into C++ classes and automatically handle loading/compiling/linking and using shader programs.

VertexArrayObjects, it seems to me, are basically a collection of configuration settings to use with a particular ShaderProgram.

My question is: Should I encapsulate VAO's within my ShaderProgram objects, or within the Sprite objects? Does a VAO change on a per-shader basis or do I need a new VAO for every type of drawable object? If the latter, do I need one VAO to draw all Sprites (each containing 4 vertices, a position/orientation etc), or one VAO per sprite object in the game?

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:
Gravity independent of game updates per second Edit

Just for clarification, my sprite's 'movement' isn't the problem. If I set my Time variable to 4 seconds, then it will cross the screen in exactly 4 seconds regardless of logic updates rate per second, rendering rate per second or screen resolution.  So I am pretty sure I'm scaling the sprite's movement correctly.  What I'm pretty sure I'm not doing correctly, is scaling acceleration.

Original Question

I'm trying to implement gravity in my 2d platformer and am having a few problems understanding how to keep it consistent when I change my updates per second.

Here's what I have.

My Gameloop overview

Currently, my gameloop renders at the maximum rate allowed by device and the updates are 'clamped' to an upper limit (At the moment, 60 per second). I am working on the assumption that most of the time, my game will have no problem hitting this, even if the actual rendering dips. Thus I am doing all of my calculations based Delta Time derived from this fixed 'ticksPerSecond' value.

I don't know for sure that this will remain at 60, I may decide at some point during the development to lower this upper limit.

My Gravity - variable declaration and initial values

At the moment, I have:

float spriteYTime=7f;                //This is the (initial) amount in seconds that this sprite will take to move from the top of the screen to the bottom.
float fallAccel=.5;                  //This is the value that will subtracted from he sprite's fall speed (To make it fall ever faster)
float terminalVelocity=1.5f;         //Cap speed at this rate (1.5 seconds)

my sprite's position is worked out on dt as follows:

//Delta time
float ticksPerSecond = 60;
float dt = 1f/ticksPerSecond;
//Velocity
spriteYVel = 1/spriteYTime;
//Update position
spriteYReal = spriteYReal + (spriteYVel * dt);
//Convert to screen coordinates (will be drawn at this Y coordinate)
spriteyScreen=(int) (furmanYReal*height);

My Gravity - code

    //If my sprite's state is 'f' (meaning falling) then apply gravity
    if(sprite.getState('f')==true){
    //Calculate new position
    spriteYReal = spriteYReal + (spriteYVel * dt);
    //Convert to screen coordinates
    sprite.yScreen=(int) (spriteYReal*r.height);
    //Reduce time by fallAccel amount & update velocity value based on new time value (So sprite falls slightly faster this frame compared to the last
    spriteYTime-=fallAccel;
    spriteYVel = 1/spriteYTime;
    //Check that speed isn't faster than terminal velocity
         if (spriteYTime<spriteVelocity)
            spriteYTime=spriteVelocity;
    }

The problem

Now, this does work, but if I change my ticksPerSecond value, it goes wrong (it falls at different rates).

I know that 'Earth Normal' gravity is approximately 9.8 meters per second per second, but this is measured 'per second' whereas I (think) I need to work with 'per frame'. This is where I'm getting confused.

So, take this example:

If set my initial Time value to 4 seconds, then if it remained constant at this speed, it would take 4 seconds to reach the bottom, if I changed my ticksPerSecond, because the time value is worked out using delta, it would still take 4 seconds but if I apply 'fallAccel" to the Time value (i.e. subract it), it goes wrong when I change the ticksPerSecond value - why?

How can I get this to fall at the same rate regardless of the value of 'ticksPerSecond' - any help in understanding this would be appreciated.

sentences:
How to hide a post-processed mesh outline when/where the mesh is hidden I'm working on setting up an active outline in my 3d engine, a highlight effect for selected 3d characters or scenery in the screen. After working with the stencil buffer and getting some unsatisfactory results (issues with concave shapes, outline thickness due to distance from camera, and inconsistencies between my desktop and laptop), I switched to edge detection and frame buffer sampling and got an outline I'm pretty satisfied with.

However, I am not able to hide the outline when the selected mesh is behind another mesh. This makes sense given my process, since I simply render 2d shader outline from a frame buffer after rendering the rest of the scene.

Two screen captures of my results are below. The first is a "good" outline, the second is where the outline is seen over a mesh that blocks the outline source.

The rendering process runs like this:
1) Draw only the alpha of the highlighted mesh, capturing a black silhouette in a frame buffer (framebuffer1).

2) Pass the texture from framebuffer1 to a second shader that performs the edge detection. Capture edge in framebuffer2.

3) Render the entire scene.

4) Render the texture from framebuffer2 on top of the scene.

I have a few ideas on how to accomplish and am hoping to get feedback on their validity, or on simpler or better methods.

First, I've thought of rendering the entire scene to a frame buffer and storing the visible silhouette of the highlighted mesh in the alpha channel (all white save where the highlighted mesh is visible). I would then perform the edge detection on the alpha channel, render the scene frame buffer and then render the edge on top. Resulting in something like this:

To accomplish this, I thought of setting a define only during the render pass of the highlighted object that would draw all black in the alpha for any visible pixels.

My second idea is to use the current render process outlined above, but also store the X, Y and Z coordinates in the R, G and B channels of framebuffer1 when rendering the silhouette of the selected mesh. Edge detections would be performed and stored in framebuffer2, but I would pass on the RGB/XYZ values from the edges of the alpha to the silhouette. Then, when rendering the scene, I would test if the coordinate is within the edge stored in framebuffer2. If so, I would then test the depth of the current fragment to determine if it is in front of or behind the coordinates extracted from the RGB channels (converted to camera space). If the fragment is in front of the depth coordinates, the fragment would be rendered normally. If the fragment is behind, it would be rendered as the solid outline color. This seems like a more convoluted and error prone method...I haven't fully grasped packing and unpacking floats in OpenGL yet, but my feeling is I may run into floating point precision issues when trying to store the XYZ coordinates in the RGB channels.

I'm using LibGDX for this project and would like to support WebGL and OpenGL ES, so none of the solutions involving geometry shaders or newer GLSL functions are available to me. If anyone could comment on my proposed approaches or propose something better I'd really appreciate it.

sentences: How can I create the water-like blur effect in Chameleon Run using SpriteKit and Unity? As the character in Chameleon Run runs, a water-like blur effect is created. I would really appreciate some guidelines on how I could create this effect in SpriteKit and Unity. Please see the image below.

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:
Combining and drawing 2D lights in OpenGL I have progressed to the lighting portion of my little framework and I managed to solve a few initial problems so now I'm left with the subtle weirdnesses.

At this stage I just have 2 lights - the ambient daylight and a hard-coded example light in my fragment shader (ultimately, I want to have multiple lights that I loop through adding together, and shadows would be nice too, but 1 step at a time!):

        uniform sampler2D u_image;

        varying vec2 v_texCoords;
        varying vec4 v_position;

        uniform vec3 ambient_light; // set as (0.3, 0.3, 0.3), night!

        vec2 point_light_pos = vec2(-0.4, 0.3);
        vec3 point_light_col = vec3(0.999, 0.999, 0.999);
        float point_light_intensity = 0.4;

        void main()
        {
            vec4 frag_color = texture2D(u_image, v_texCoords);
            if(frag_color.a < 1.0)
              discard;

            float distance = distance(point_light_pos, v_position.xy);
            float diffuse = 0.0;

            if (distance <= point_light_intensity)
                diffuse =  1.0 - abs(distance / point_light_intensity);

            gl_FragColor = vec4(min(frag_color.rgb * ((point_light_col * diffuse) + ambient_light), frag_color.rgb), 1.0);
        }

Which almost does what I want, but there are 2 problems:

The light has a bright ring in it and the light is squashed on the y-axis. I actually like how it looks squashed at this ratio, but I'd much rather do it deliberately.

I the y-axis squashing is down to the window aspect ratio - if the window is square, the light is circular, but I don't know how to fix this in the fragment shader.

I don't know where the bright ring is coming from.

sentences:
Why should i set glClearColor and setProjectionMatrix in render method many time in LibGDX? import com.badlogic.gdx.Game;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class MyGame extends Game {
    public OrthographicCamera camera;
    public SpriteBatch        batch;
    //..

    @Override
    public void create() {
        //..
        batch = new SpriteBatch();

        Gdx.gl.glClearColor(0, 0, 0, 1);
        batch.setProjectionMatrix(camera.combined);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        //..
    }

In LibGDX Doc
Gdx.gl.glClearColor(0, 0, 0, 1); and batch.setProjectionMatrix(camera.combined);
is setting in render() method at a time.
I use this definitions in create() method at once, and it is running perfect.

So why should i use this definitions in render() method? is't it a performance loss?

sentences:
How to transfer a luabind::object between two lua states I store an object by a function call from Lua to C++ in first script in my application and after that I'll try to pass that object to other scripts and vice versa.

A part of script class in C++:

void script::set_property(lua_State* L, luabind::argument const& value)
{
  this->property_field = luabind::object(L, value);
}

luabind::object script::get_property(lua_State* L)
{
  return this->property_field;
}

Then in my script which is Script1.lua I do this:

script1:set_property(a table or a userdata or a string)
print(type(script1:get_property()))

The problem is, values sent by scripts are distinct in different Lua states because every script in my application has its own lua_State. The above code works fine when I call script::get_property from Script1.lua.

Since all of my scripts have access to other scripts in their contexts when I try to do this in other scripts like Script2.lua or Script3.lua or others:

print(type(script1:get_property()))

It won't print data type here properly and it'll return a number instead, which is a wrong result and the reason is script1:get_property() is returning a value that is only understood by script1 and not in other scripts.

I understand values that have been registered in script1 are only registered into that script's stack and registry table particularly and no one else, but my question is, is there any way to transfer these values between different Lua states?

Thanks.

sentences:
Slick2D - Entities and rendering I have been trying to create my very first game for quite a while, followed some tutorials and stuff, but I am stuck at creating my entity system. I have made a class that extends the Entity class and here it is:

  public class Lazer extends Entity{//Just say that it is some sort of bullet

private Play p;//Play class(State)
private float x;
private float y;
private int direction;

public Lazer(Play p, float x , float y, int direction){
    this.p = p;
    this.x = x;
    this.y = y;
    this.direction = direction;
    p.ent.add(this);
}

public int getDirection(){
    return direction; //this one specifies what value will be increased (x/y) at update
}
public float getX(){
    return x;
}
public float getY(){
    return y;
}
public void setY(float y){
    this.y = y;
}
public void setX(float x){
    this.x = x;
}
     }

The class seems pretty good , after speding some hours googling what would be the right thing.
Now, on my Play class. I cant figure out how to draw them. (I have added them to an arraylist) On the update method , I update the lazers based on their direction:

public void moveLazers(int delta){
       for(int i=0;i<ent.size();i++){
           Lazer l = ent.get(i);
           if(l.getDirection() == 1){
               l.setX(l.getX() + delta * .1f);
           }else if(l.getDirection() == 2){
               l.setX(l.getX() - delta * .1f);
           }else if(l.getDirection() == 3){
               l.setY(l.getY() + delta * .1f);
           }else if(l.getDirection() == 4){
               l.setY(l.getY() - delta * .1f);
           }

       }
   }

Now , I am stuck at the render method. Anyway , is this the correct way of doing this or do I need to change stuff? Also I need to know if collision detection needs to be in the update method. Thanks in advance ~ Teo Ntakouris

sentences:
Event/Trigger System Architecture The Plan

I am up to write write an own Trigger/Event System, an event engine or how you call it. I would like to achive something similar to Blizzard's most level editors, like Starcraft 1-2, Warcraft level editors.
They are all kind of event/trigger based, you can set actions, conditions which actually control the gameplay itself. What do you think, what would be the best architecture for this event/trigger system?

The Architecture

I thought it would look something like this:

EventManager - would handle the events, checking if the conditions
meet for any event,
                  and calls the event if so.
EventHolder - would hold the list of the events.
EventEntity - would have an ID, the actions' ID and the params for
them.

Every entity, enemies, player and other stuff would have an ID in the world, which would help to get the entity itself and fire a trigger on it.
Obviously, there would be finit and pre-set BASIC actions, but that would be stored by the current project itself. The project could pass the EventSet (list of EventEntity) to the EventHolder. Thus this whole event/trigger system would be very flexible, and could compile it as a DLL for use in future projects.
Do you have any better solution for this? Or some pro tips that I could use? Would really appreciate any help! Thanks!

Edit:
This picture shows it quite well:

Edit2:
I have wrote a raw architecture of a possible "engine", but it is missing some MAIN points:

{Initializing}

//in order
[Game]--set event list--[EventManager]--requests list of EventEntity--[Game]--sends list of EventEntity--[EventManager]

{EventManager loop}

[EventManager]--checks if any of the events meet in an EventEntity
[EventManager]--if any meets--[EventManager]--checks if all of the conditions are meeting in the EventEntity
[EventManager]--if all meets--[EventManager]--fires actions of the EventEntity

{Architecture of the Models}

[EventEntity] contains
- [List of Event Models]
- [List of Condition Models]
- [List of Action Models]

[EventModel] contains
//quite similar to the ConditionModel, an event only should fire, aka check the conditions and
//fire the actions, if these special conditions, happenings, events are fired
//like a unit dies, player reaches a specific position, etc.

[ConditionModel] contains
//model must simulate AND, OR logic statements
//model must simulate IF statements

[ActionModel] contains
- [List of Targets]
- [List of Action IDs] //One action per Target, a specific Target can be listed more than once in the [List of Targets]
//something is missing

Trying to write the "system" as standalone as possible, it must not depend on any project's source. Thus I think the best would be to seperate the data from the architecture, could store the event, condition and action datas in another DLL unit, and could read from that.

sentences:
How to reduce the time taken to path-find to an unreachable location? I have a 2048x2048 map and if I path-find to an unreachable location, it makes the pathfinder go through every node on the map which freezes the thread for 4 seconds.

How can I reduce that time?

I'm using JPS
It's a dynamic map (it changes at runtime)

sentences:
Why can a certain DirectX mode produce display lag? I have written two small test games using DirectX 9. One uses

presentParams.Windowed = false;

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

and the other one uses

presentParams.Windowed = false; // same results with true

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

Both use exactly the same window position, size and style. Both are written to cover the screen completely, even when using "Windowed = true".

In the latter game, to vsync and avoid tearing, my code waits until a certain scan line is passed. My tests showed: On different PCs it has to wait for different scan lines to avoid tearing completely. This is a drawback, since it has to be tweaked individually by the user. Is this technique used in any games?

And, compared to this technique, why does DirectX produce a display lag when "Windowed = false" is used with D3DPRESENT_INTERVAL_ONE?

To clarify where the lag occurs:

Windowed = false + INTERVAL_ONE => LAG

Windowed = false + ...IMMEDIATE    => no lag

Not mentioned in the question but tested:

Windowed = true;  + INTERVAL_ONE  => no lag, tearing

Windowed = true; + ...IMMEDIATE     => no lag

sentences:
Can I force a manually created texture to not be divided with low quality? I have a texture that I have created that looks something like this:

.

This is a very low texture map, but it helps me in a shader that I'm making that distinguishes between land and ocean, the ocean tiles do different things than the land. To try and figure out what was going on, I used the shader to turn the ocean, as defined by the mask, black. Note that this image doesn't match the ocean texture example from above, but it's the best I had...

The ocean is a binary color, either it is ocean or isn't, and is set appropriately. But what I'm actually seeing is that if the 2x2 tile area has mixed land/ ocean, the value is averaged.

What I've noticed is that the pixels were combining together, a 2x2 pixel area was averaged. After tracing through this for some time, I discovered that the issue was a quality setting that reduced the resolution of certain images.

There are some images that I don't mind lowering the resolution of, but images such as this one I absolutely don't want to lower the resolution. Is there a setting that I can add to a runtime generated texture to tell it not to reduce it's resolution if requested to by the quality settings?

EDIT: Code fragments to produce the results above. It's kind of hard to pull just the fragments that produce this code and not produce an overwhelming bit, but hopefully this will do.

Code to generate textures:

Color32[] windMask=new Color32[world.width*world.height];
for (int x = 0; x < world.width; x++)
{
    for (int y = 0; y < world.height; y++)
    {
        windMask[x + world.width * y] = world.Tiles(x, y).baseType == Tile.BaseType.Ocean?new Color32(255,255,255,255):new Color32(0,0,0,255);
    }
}

sharedMaterial.SetTexture("_WindMask", TextureUtilities.TextureFromColors(world.width, world.height, windMask, FilterMode.Point));

public static Texture2D TextureFromColors(int width, int height, Color[] colors, FilterMode filterMode = FilterMode.Trilinear)
{
    Texture2D texture = new Texture2D(width, height);
    texture.SetPixels(colors);
    texture.filterMode = filterMode;
    texture.Apply();
    return texture;
}

The Shader code:

o.Albedo *= 1 - tex2D(_WindMask, IN.uv_MainTex).r;

The "Fastest" quality settings that show the issue:

The "Fantastic" quality, which correctly isolates the ocean.

Image of the correctly isolated ocean:

The issue is the "Texture Quality", which you will note for the fastest setting is half resolution. I would really like to keep the ability to use lower resolution in the game, but have a few textures that do not use the lower resolution if the quality settings change.

sentences:
Shooting the bullet out of the gun instead of the camera, yet keeping it accurate with respect to the reticle I'm working on a first person game, and I've ran into a problem. In my game, there's the player's gun being rendered, as well as a reticle in the center of the screen - like this:

First, Let's imagine there was no gun model being rendered. Then firing the bullet is easy - you just spawn the bullet exactly where the player's "eyes" are, and then use trig to calculate the velocity based on whatever direction the player is looking.

But now, when we add the gun model... we can't just spawn the bullet where the players eyes are, we have to spawn it at the tip of the gun (right?). So you do that, but then... how do you move the bullet in a way that it will hit wherever the reticle was pointing?

Keep in mind that the bullet in my game (it's actually a rocket, in this case) will be moving slow enough that its movement can be seen, so some workaround that would usually work if the bullet is too fast to be observed will not work. For example, if you didn't spawn it so it looks like it's coming out of the tip of the gun, the player would definitely notice that.

sentences:
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:
How to set rotation of a projectile in a parabolic arc in Box2D? I have trouble making my projectile - in this case an arrow - rotate as it should when it's travelling in a parabolic arc. It doesn't rotate at all while travelling, only until it collides with something.

Below is the relevant code I'm using.

public class Arrow extends BodyDef{

private Body body;

public Arrow(float x, float y, float halfWidth, float halfHeight, float rotation, float velocity) {
    type = BodyDef.BodyType.DynamicBody;
    position.set(x, y);
    angle = rotation;

    body = Box2DTest.world.createBody(this);
    PolygonShape shapeShaft = new PolygonShape();
    shapeShaft.setAsBox(halfWidth, halfHeight);

    /* Creation of the shaft of the arrow */
    FixtureDef fixtureShaft = new FixtureDef();
    fixtureShaft.shape = shapeShaft;
    fixtureShaft.density = 6.5f;
    fixtureShaft.restitution = 0.4f;
    body.createFixture(fixtureShaft);

    /* Creation of the tip of the arrow, note the higher density */
    PolygonShape shapePoint = new PolygonShape();
    float[] shapePointV = {
            halfWidth, halfHeight * 2,
            halfWidth * 1.5f, 0,
            halfWidth, - halfHeight * 2};
    shapePoint.set(shapePointV);

    FixtureDef fixturePoint = new FixtureDef();
    fixturePoint.shape = shapePoint;
    fixturePoint.density = 26.0f;
    fixturePoint.restitution = 0.05f;
    fixturePoint.friction = 0.5f;
    body.createFixture(fixturePoint);

    body.applyLinearImpulse(MathUtils.cos(rotation) * velocity, MathUtils.sin(rotation) * velocity,
            body.getWorldCenter().x, body.getWorldCenter().y, true);

    //body.applyTorque(-90.0f, true); <-- My attempts to fix this but still doesn't work well
    //body.applyAngularImpulse(-0.5f, true);
    shapeShaft.dispose();
    }

}

The Box2DWorld is initialized as such:

  world = new World(new Vector2(0, -9.8f), true);

Here's a picture explaining how it looks and what I want to achieve (Courtesy of vilbeyli in github):

I have also attempted to apply the initial impulse in the bottom-left corner of the arrow but the resulting spin is very imprecise and random.

Why doesn't the heavier tip make the arrow rotate by itself?
How can this be fixed?

sentences: Get collision time between two moving, non uniform Axis Aligned bounding boxes I have a problem finding the exact time of collision of two possibly moving or static objects. Both objects have AABB data (HalfExtents, Min, Max, Center vector and stuff) and a velocity vector. The objects, as I wrote, can move, but must not to. How can I get the exact collision time from now? Could you give me please a pseudo code, or at least some directions how can be this solved?

sentences:
XMMATRIX performance Dears,
I am facing a performance problem when I try to access cell 42 and 43 in XMMATRIX define in DirectXMath.h. The frames dropped by 100 FPS.

Here is my code:

for (int index = 0; index < m_CopyOfCascadeConfig.m_nCascadeLevels; ++index)
    {
        XMMATRIX mShadowTexture = m_matShadowProj[index] * dxmatTextureScale * dxmatTextureTranslation;

        XMStoreFloat4x4(&mShadowTextureFlt, mShadowTexture);

        // This is the line that cause the performance drop
        pcbAllShadowConstants->m_vCascadeOffset[index] =
            XMVectorSet(mShadowTextureFlt._41, mShadowTextureFlt._42, mShadowTextureFlt._43, 0.0);
}

I also tried to use the folowing but no hope:

pcbAllShadowConstants->m_vCascadeOffset[index] = mShadowTexture.r[3];

Any suggestes will be appreciated.

sentences:
How to zoom randomly generated maps? I made a Java program which generates a random map based on Perlin Noise + Poisson Algorithm + Voronoi Diagram. Here you can see a generated map. White are caves, black is empty.

The problem is that my character will go through this caves so I need to zoom this image to see only a big piece of where I am. But when I zoom in, the image obviously gets pixelated and looks really bad. So I save it as an svg image and the quality now is perfect but as far as I have read svg images are slow to render and 2D Games Engine (like SFML, SDL) can't render them.

The approach I have read about is that maps are tiled based, a tile size depending on zoom level, but this is a randomly generated map and zooming in svg image to generate the tiles and save the tiles to formats like png, jpeg, would be very slow (Or I am wrong?).

What can I do here? I have searched how to zoom the Perlin Noise function but it isn't a fractal noise so I can't.

Thank you in advance for your help! I am new in game development!

sentences: Bitmap to a custom coordinate pair when touched I am completely lost and needed some help.  I have a ontouchListener for a bitmap and know how to check if the touch was within the boundaries of the bitmap. But say I want the center of the image to be at a custom coordinate like [0,0] and the entire image to be in the range of [-319...319] and [-239...239] . Does any one have any thoughts on how to best implement an eventX and eventY to a custom coordinate pair?

sentences:
Using octrees as LOD system I am using an octree to define my 3D voxel world.
And I want to use octree subdivision as a LoD system.
This means, subdivide close to the player, but far away nodes un-subdivided.
But it occurs to me that in some cases, the octree can quickly degenerate to a grid.
To illustrate, see the 2D sample of a quad tree below.

If the player is at location A, no problem, subdivide that cell, done.
If the player is at location B, two cells would require subdivision.
But at location C, all cells are subdivided, causing no reduction in work.
Are octrees even viable approaches to LoD, or do I need something else?

sentences:
How to save a Unity prefab on file? I'm working on a Unity project, and what I'm doing is creating a new scene. In my new scene, I want add some prefabs that there aren't in the project folders, but I can see them in another scene.

So in my new scene I have only few prefabs, and I don't know how to add the prefabs that are present in the other scenes. Is there a way to do it?

sentences:
scale on z axis move At the position z = 0 my box has size on one side 0.2. When, for example, I move it to z = 1.5,  size of it scale up. I've trided to calculate it by using triangle formula z*tan(fov/2), but it does not really work.

Do you know how to get size of one side after primitive moved on z axis ?

(All about in opengl)

sentences:
In FPS's what is the primary reason for unused ammo in a removed magazine returning to the ammo pool? All FPS's I know of return unused ammo in a removed magazine back to the users overall ammo count.

For example, I have 3 magazines with 30 rounds in each, I fire off 25 rounds and do a magazine change. I do this another 2 times so i technically have 3 magazines with 5 rounds in each, but when i reload I have a magazine with 15 rounds, somehow they have all jumped into the one magazine.

Yes, I am overthinking it and it probably wouldn't be fun. I'm just trying to narrow down the reasoning, especially games like modern warfare 2 which in terms of weapons are pretty much accurate in every other regard.

sentences: Unity - Fading mesh particles Is there any ways to fade mesh particles like color over lifetime method with addictive shader. I have little to no understandings of shader coding, and fade rendering issue kicks in even with vertex color shader. Any idea guys?

sentences:
Unity, WaitUntil in a self-made message box class I managed to make a simple message box prefab with a Text and a Button through Canvas, and then instantiate it through the constructor.

public class MessageBox
{
    public MessageBox(string msg)
    {
        GameObject obj = (GameObject)MonoBehaviour.Instantiate(Resources.Load(@"MsgBox"));

        obj.GetComponentInChildren<Text>().text = msg;
    }
}

So when another script needed it, simply do

MessageBox mb = new MessageBox("This is a test message!");

This all worked fine, but then I wish to change it to like normal MessageBox where the code was suspended, but not locked, until the user click the OK or Cancel button.

I managed to do it by calling a coroutine in the calling script.

void Start()
{
    StartCoroutine("Do");
}

IEnumerator Do()
{
    MessageBox mb = new MessageBox("This is also a test message!");

    yield return new WaitUntil(() => GlobalVariables.MsgBoxClicked == true);
    //GlobalVariables is a separate class containing some static variables.
    Debug.Log("Done!");
}

(You have to set the MsgBoxClicked to false when the prefab is created and set it to true when the button is clicked, of course.)

But that means every time I needed to use the message box, I need to call a coroutine!

And that's super inefficient no matter how you looked at it!

So I tried to move the coroutine into the MessageBox class itself.

But now here comes the problem!

The MessageBox does NOT inherit from MonoBehaviour!

And you can't call a coroutine without it!

I had tried to make the MessageBox inherited from MonoBehaviour, but the Unity warned me This is not allowed every time I tried to new it! Even though the game ran smoothly.

I even tried to new the MonoBehaviour itself and call its StartCouroutine, but of course, the same warning popped up! And this time the game won't even run!

I also tried to use the old AutoResetEvent, but it locked the whole thing and crashed my game!

So, could somebody be so kind and teach me how to get around it!?

Much appreciated!

sentences: Is there any opensource game frameworks in browser? I have been looking for and found any.

sentences:
Client/Server Object updates seems to run at different speeds i have been playing around with the NetworkPrediction sample from Microsoft. Trying to adapt it to use gameTime. The client is running without fixed TimeStep and the server is custom C# and updates a lot faster than client.

Both client and server runs this code at update:

protected void UpdateState(ref ShipState state, GameTime gameTime)
    {
        if (turnRightAcceleration)
            state.Rotation += (this.RotationSpeed * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
        else if (turnLeftAcceleration)
            state.Rotation -= (this.RotationSpeed * (float)gameTime.ElapsedGameTime.TotalMilliseconds);

        Vector2 shipForward = new Vector2((float)Math.Cos(state.Rotation),
                                          (float)Math.Sin(state.Rotation));

        if (trustAccelerating)
            state.Velocity += ((shipForward * this.TrustSpeed) * (float)gameTime.ElapsedGameTime.TotalMilliseconds);

        // Update the position and velocity.
        state.Position += (state.Velocity * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
    }

This seems theoretically correct, every time a value is increased or decreased its affected by ElapsedGameTime.

And this is my Server Pump:

    public void Run()
    {
        foreach (GameServerComponent component in this.Components)
            component.Initialize();

        Console.WriteLine("Server running...");

        //DateTime serverStart = DateTime.Now;
        //DateTime lastUpdate = DateTime.Now;

        Stopwatch sw = Stopwatch.StartNew();
        TimeSpan lastTime = sw.Elapsed;
        GameTime gameTime;

        while (!exit)
        {
            TimeSpan currentTime = sw.Elapsed;
            TimeSpan elapsedTime = currentTime - lastTime;
            lastTime = currentTime;

            gameTime = new GameTime(currentTime, elapsedTime);

            foreach (GameServerComponent component in this.Components)
                component.Update(gameTime);
        }

        sw.Stop();
    }

This seems theoretically correct as well. Unless there is something about time management in .NET and XNA, but i cant find anything indicating it.

But the server and client updates at different rates, and the further you get from Vector 0,0 the greater the difference becomes and close to 0,0 it works quite well.
But at Vector2(-1387865f, -1158338f) the "Ship" is barley able to move. I believe this tells me the server "Clock" is running slower than the client (the ship moves slower on server than on client), but i dont understand why it would be more prominent further away from 0,0 (makes me think its the UpdateState() function I need to look at)

I dont know what to test next and I have no idea how to fix this behavior.

Please, i need ideas. Or even better, can you see something obvious wrong with the code i have?

Thank you.

Update:
This are the results from some measurements, recommended from William 'MindWorX' Mariager. Im currently trying to throttle the server to get closer to the clients updates. And i think i need to look at some performance from the client as well (later), since it seems it runs slower than 60fps atm. Ill update with results.

Server
updateCount             252092674

gameTime.TotalGameTime          {00:09:59.9810854}

avgElapsed.TotalMilliseconds        0.0021000000000000003

(float)avgElapsed.TotalMilliseconds 0.0021

Client
updateCount             24027

gameTime.TotalGameTime          {00:09:55.5527941}

avgElapsed.TotalMilliseconds        24.03

(float)avgElapsed.TotalMilliseconds 24.03

sentences:
Help understanding Unity Profiler time in ms I'm a little confused about this column shown in the picture above.

When it shows 0.22 does it mean "22 miliseconds" or does it mean a fraction of a milisecond (i.e. in this case, around 1/5 of a milisecond) ?

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:
Maintaining relative location of objects across different screen resolutions I'm developing a very simple interactive HTML5 game, in which I need to show a room having multiple objects like a cupboard, table, fan etc.

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

sentences:
Saving and loading a GameObject's full state easily in Unity3D? I'm working on placing predesigned tilemap rooms in my procedural dungeons, and I would like to design the items' and monsters' placement in these special rooms as well.

Currently I "compile" my predesigned room scene into a scriptable object, and the map generator loads that tilemap into "gameplay" tilemap.

I already parse the special game objects in the scene (like items and monsters), and store their transforms and prefab paths in the scriptable object.

But this has 2 problems:

Having every item and monster in the resources folder would make my executable huge.

But this could be solved by making a "MonsterPrefabDictionary" on a manager like gameobject, and drop every prefab into this list in the editor. The map generator would simply use this dictionary to find the object's prefab.

The biggest problem is that every variation of monster would need another prefab (or prefab variation). And by variation I mean the little changes as well.

Want a mob to have only 50% health in the room at start? Make a prefab for this?
Want a monster to start with a specific buff in this room? Make a prefab for this?
Want a monster to start in a different stance than usual in this room? Make a prefab for this?
So as you can see, this scales pretty badly.
But this could be solved by storing the MonsterScript's every data in the scriptable object.
But this would scale badly as well, because every new information about a monster would have to be added to this serialization process as well.

Is there a built-in, automatic, easy way to just save a GameObject's full state and just load everything with one line later on?

sentences:
OpenGL approach to depth-testing-like combination of a large buffer of fragments I have a depth buffer and color buffer created by another effect. The buffer is more than double my screen size. It is not rendered from geometry, but as a whole it resembles a rendered scene with an ortho projection. I can't generate this data w/ any other projection. I'm trying to redraw the scene in two-point perspective. This means each fragment from the orthographic data will be skewed and translated based on the depth value.

If I render a fullscreen quad, each fragment will not know how or where to sample from the original buffer. It seems like I the sources have to assign themselves to destinations, rather than a destination gathering sources.

Impractical or incomplete solutions:
- Generate a tri or point for every pixel in the source buffer, and actually rasterize them with depth testing. This is really slow, but it could be possible to generate the vertices in a compute shader or something? We're still dealing millions of tris for an average screen. I'm skeptical that this is the real solution.
- Something with SSBO and atomicMax. It seems like you can only compare your actual data, so I would have to pack my colors with depth values somehow.

This seems like a fairly fundemental operation, so I'm hoping there is some canonical technique or opengl extention that does this sort of thing for me well. Even a name for this operation might help me find existing literature.

The final solution must be realtime for typical screen sizes. C++/OpenGL.

sentences:
Applying "zoom to the exact point" transformations to screen positions I´ve implemented zooming of orthographic camera (just scaling it with its speed value):

viewMatrix = glm::scale(viewMatrix, glm::vec3(_cameraScale, _cameraScale, 1.0f));

And then applied these transformations (also translation by camera position) to the destination point (actually a cursor position vector) so I got its world positions:

void Camera::applyTransformationsToPoint(glm::vec3& pos) {

    pos += _cameraPosition;

    pos /= _cameraScale;
}

It worked fine, i was getting the right world position with diferent scales.
However, this was done with normal scaling - to the origin of the matrix so basically when i scaled the matrix the whole camera moved to its origin and it looked a little bit weird. SO i have decided to imlement zoom to the middle of the screen feature. So basically what I do is (in pseudocode):

translate(screenWidth/2,screenHeight/2);
scaleTranslatedMatrix();
translate(-screenWidth/2,-screenHeight/2);

It works fine but the code above for transformation of screen coordinations to the world is now not working properly(im not getting the right world positions), any suggestions how to correct it? Thanks.

Edit1:
This is how I apply the scaling (if anyone wondered):

void Camera::zoomOut(float dt) {

    _cameraScale -= _scaleSpeed * dt;

    if (_cameraScale < 0.4f) {

        _cameraScale = 0.4f;
    }
}

According to the first answer edit:
As I have 4x4 matrix and using a vec3 for my point representation, i have to use temporary vec4 to perform the multiplication, however, it is not working correctly (even without scaling and just translating the view matrix) - for inverse matrix im using GLM library.

glm::vec3 Camera::applyTransformationsToPoint(glm::vec3 pos) {

    glm::vec4 tmpVec(pos.x, pos.y, pos.z, 1.0f);
    tmpVec = tmpVec * glm::inverse(viewMatrix);

    return glm::vec3(tmpVec.x,tmpVec.y,tmpVec.z);
}

sentences:
beginContact triggered more than once on some objects Short version: It looks like beginContact is detecting continuous collisions. I'd like to avoid that.

Long version : I use Box2Dweb to write a 2D platformer. It's my first game using this lib, and, to be honest, my first game ever.

I've read almost everything on collision detection (with contactListener), but I must have understood something wrong.

When the game starts, my player is spawned a little above the ground. It falls due to gravity, and an event is triggered once when it touches the ground (and my player.canJump property is set to true).

I also added "Bricks" (aka platforms) on the Stage. They are "simple" Polygon shapes (rectangle) attached to staticBodies.

Whenever my player touches a brick, the beginContact event is fired many times, and contact.IsTouching() is true for each instance.

edit: endContact seems to be fired too, the same amount of times.

Here is the (relevant part of the) code that I'm using to instantiate Bricks (it's inside a class "Brick") :

var bodyDef = new box2d.b2BodyDef()
bodyDef.type = box2d.b2Body.b2_staticBody;
bodyDef.userData = this;
bodyDef.position.x = x / SCALE;
bodyDef.position.y = y / SCALE;
bodyDef.fixedRotation = true;
this.view.body = world.CreateBody(bodyDef);

var fixDef = new box2d.b2FixtureDef();
fixDef.density = 1;
fixDef.isSensor = false;
fixDef.friction = 0.5;
fixDef.restitution = 0.2;
fixDef.shape = new box2d.b2PolygonShape();
fixDef.shape.SetAsBox((this.width/2) / SCALE , (this.height/2) / SCALE);
this.view.body.CreateFixture(fixDef);

In my init function (called only one), I'm setting up some listeners :

var b2Listener = Box2D.Dynamics.b2ContactListener;
var listener = new b2Listener;

listener.BeginContact = function(contact) {
    var userDataA = contact.GetFixtureA().GetUserData() || contact.GetFixtureA().GetBody().GetUserData();
    var userDataB = contact.GetFixtureB().GetUserData() || contact.GetFixtureB().GetBody().GetUserData();
    console.log('beginContact fired!');
}

If I jump on a platform, the event is triggered multiple times (something like 30). If I fall back on the ground, it's triggered only once (which is what I want).

(If you need to see what's happening, please have a look at the console there : http://www.enpause.com/plates-formes/ )

Could you please correct my mistake ? Thank you very much!

sentences:
Accesing depth buffer from shader I read this presentation and on 6th slide I found that is not need to use multiple render targets and depth can be taken directly from depth buffer.

From which version of DirectX or OpenGL can be the feature used? How to do that?

sentences:
SAT - penetration and pull out vector based on previous body position I implemented SAT alghorithm that is able to detect collisions and return shortest "pull out" vector.
On the screenshot below this vector is determined by yellow color (P and Q).
If I add Q vector to position of body B, then will be no collision.
However I realized that I can't use this vector to solve collisions, because the body could arrive from completely different direction. I should rather pull out body B by using direction of vector Z.
I already tried to calculate additional overlap by using axis determined by vector Z. However in such case I'm pulling body B too far away from A.
Is there any ellegant solution for that by keep using SAT algorithm?

sentences:
The XNA redistributable isn't in the prerequisites list; how do I include it when publishing? So I created a small project in XNA 4.0, and wanted to try and publish it, and so I did.
Yet when attempting to install it on a different computer it didn't seem to work.

I've read and studied about how the process of publishing works, and I saw someone in a different thread asking the same question as me, then I realized that
inside the prerequisites list which is in PROJECT -> PROPERTIES -> Publish,
the XNA redistributable wasn't there therefore it wasn't checked, and when attempting to install it on a different computer they needed to install redistributable on their own
to make it work.

Any idea why isn't the redistributable in the list? Maybe this isn't even
the problem and if that's case any ideas of what IS the problem? Thanks ahead.

sentences: GTA style camera - Unity I am wanting to make a 3d RPG with unity, and I'm in the planning phase. For the camera I decided to make it GTA style. I want the camera to be rotated around the player without effecting the movement of the player. If anyone can give any pointers on this, I would be very grateful.

sentences:
Is there a way to read a picture pixel by pixel in unity without any distortions In my unity project I have an image file which contains information. I would like to be able to read this .bmp file pixel by pixel. So I tried simply loading a sprite, and then reading its texture. However when I do that, the loaded texture appears to be different than the image I'm using, as if it was compressed. I tried modifying the asset settings (making it an advanced texture with point filter mode, and setting format to argb32bit uncompressed) but it doesn't help. Any ideas?

EDIT: Some additional information,

The code with which I load the image into a pixel array

// sprites from which paths will be loaded
public Sprite[] path_maps;
// Color 24 array which contains the texture bitmap
private Color32[] pixels;
// graph with paths
public Graph[] graphs;

void Start () {
    // I skipped some  code that doesn't matter to the problem

    // go through all path maps
    for (int i = 0; i < path_maps.Length; i++) {
        // load sprite into pixels array
        pixels = path_maps[i].texture.GetPixels32 ();
        // create new graph
        graphs [i] = new Graph ();
        // get graph from path map
        graphs[i].pixels_to_graph(pixels, path_maps[i].texture.width, path_maps[i].texture.height, camera_width, camera_height);
    }

}

The function which reads pixels and creates node for each colored pixel (only relevant part of the function)

public void pixels_to_graph (Color32[] pixels, int width, int height, double camera_width, double camera_height)
{
    // assign pixels width and height
    pixels_width = width;
    pixels_height = height;
    // assign camera dimensions
    this.camera_width = camera_width;
    this.camera_height = camera_height;
    // First create as many nodes as there are colored pixels (simply read the pixel map)
    // Note that pixel map contains the bitmap from bottom to the top (left bottom to top right)
    // create nodes array
    pixel_nodes = new Node[width*height];
    // current position in pixel array. Made for easier calculations
    int carriage = 0;
    // go through all rows
    for (int i = 0; i < height; i++) {
        // go column by column
        for (int j = 0; j < width; j++) {
            // if it's transparent or white - ignore
            if (pixels [carriage].a == 0 || pixels [carriage].Equals (col_white))
                continue;
            // else add node to the node array
            pixel_nodes [carriage] = new Node (j, i, pixels_width, pixels_height, camera_width, camera_height); // note that i is the y position while j is the x position
            // add node to nodes list
            nodes.Add (pixel_nodes [carriage]);
            carriage++;
        }
    }

I detect the problem in the above pixels_to_graph function. When I debug it with a 1680x1050 image, that has pixels in its bottom left corner (three black squares with 1 pixel distance between them, of size 3x3px, 2x2px, 1x1px) it only detects the 3x3 one, the colour value at position of the other 2 squares is white. When I tried other shapes I also discovered other distortions, some 1px wide lines are not there, as well as single pixels.

My current texture settings (though note I tried different options but some of them don't display anything, this one at least displays something):

sentences:
Will using similar/exact name to a current Marvel superhero name for your game be a problem? I have heard that the word 'superhero' is trademarked by marvel and DC and thus we can't use superhero as part of the name of a game we develop. But I wonder do they also have exclusibe rights to all the names of their super hero characters?

For example will people get in trouble if they name their games 'premagneto', 'superwolverine', 'exbeyonder' or 'the cyclop'?

sentences:
Finding pitch/yaw values from lookat vector I have a camera class that contains a position, a pitch, and a yaw (the pitch and the yaw correspond to y and x rotation values). I want to implement a lookAt function that takes a vector and the function changes the pitch and yaw so it's looking at that point in space. However, I cannot seem to find the math equation to do it (various ones online, none seem to work). How would I be able to implement it?

Here's an example of what I mean:

struct Camera
{
    Vec3 position;
    float pitch, yaw;

    void lookAt(Vec3 center)
    {
        //????
    }

    mat4x4 toTransform() //How I convert the values to a matrix (if this is relevant)
    {
        return CreateLookAtMatrix
            position,
            position + Vec3(cos(pitch)*sin(yaw), sin(pitch), cos(pitch)*cos(yaw)),
            Vec3(0.0f, 1.0f, 0.0f)
            );
    }
}

sentences:
OpenGL calculate circle rotation around a given point I'm trying to rotate an object around a certain point. If this point is the center of my world space I use the following algorithm:

glm::vec3 center is the center of the current object. Each frame it will get updated.

glm::mat4 transformationMatrix is the 4x4 matrix I am "uploading" to my shader later on. It will get multiplied by the vertex position.

t_point is the point I'd like to rotate around

t_deflection is the impact for each axis (in order to draw ellipses instead of circles)

t_speed is in my case the current time since the game started (e.g. glfwGetTime())

void rotateByPointY( const glm::vec3& t_point, const glm::vec3& t_deflection, const float& t_speed )
{
    float radius = glm::length( t_point - center );

    glm::vec3 newPosition( glm::sin( t_speed ) * radius * t_deflection.x, center.y, glm::cos( t_speed ) * radius * t_deflection.z );

    translationMatrix = glm::translate( glm::mat4( 1.0f ), newPosition );
    center = newPosition;
}

How can I take into account a point other than the center of my world in the calculation?

EDIT:

So my rotateByPointY calculates the translation around the world center. Therefore I am adding the new center vector to my new position:

translationMatrix = glm::translate( glm::mat4( 1.0f ), newPosition + t_point );
center = newPosition + t_point;

That is working now!

sentences:
Am I going to regret using a color based collision detection system? I'm just getting started build my first game with XNA (I'm experienced with C# but not games).

I'm building a pretty simple top down 2d shooter. I read this tutorial on using a color based collision system and it sounded really cool to me. http://www.xnadevelopment.com/tutorials/theroadnottaken/theroadnottaken.shtml

It means I can quickly make levels just using any graphics program and not have to define my scenery (walls, trees etc) in terms of collision boxes etc right?

However I can see that going down this path means that perhaps the calculation for determining whether fast moving objects like bullets intersect walls etc becomes more difficult potentially because you cant' do basic geometry intersection type calcs.

Is that right? Am I going to regret going in this direction if my game gets more complex over time? Worth just investing in the creation of a level editor to define my scenery in terms of geometry?

Any advice for a noob very much appreciated!

sentences: How to make a market test for the game? I'm making a casual game on iOS platform. But I'm not sure Do the consumers like my game. How can I make a market test for my game?

sentences:
Smooth 1D terrain generation So I'm pretty happy with my terrain, and the progress on my game. I just want to figure out why the terrain is so steep sometimes. Right now to generate my random seed I use this:

seed = (long)(Math.random() * 10000000 + 12345670);

It works, but some of the seeds just make a really steep point hill, while I'm looking for more bumpy-flat maps (similar to Terraria's).

Here's my create terrain loop:

for (int i = minX; i < maxX; i++) {
    int columnHeight = p.getNoise(i, maxY);
    for (int j = 0; j < columnHeight; j++) {
        System.out.println(columnHeight);
        map[i][j] = new Tile(i * 8, j * 8, 8, 8, TileType.Grass);
    }
}

Here's the class I'm using to try to generate terrain. I tried tweaking parameters but nothing works, and I just keep getting crazy random hills.

public class Perlin {
    private long seed;

    // Constructor to create a seed
    public Perlin(long seed){
        this.seed = seed;
    }

    // Fetches a random value
    private int random(int x, int range){
        return (int) ((x + seed) * (x + seed) * 8) % range;
        // o = (int) (((x + seed)*(x + seed))*5) % range
        //return o;
    }

    // Calculates the noise
    public int getNoise(int x, int range){
        int chunkSize = 64;

        int chunkIndex = x  / chunkSize;

        float prog = (x % chunkSize) / (chunkSize * 1f);

        float left_random = random(chunkIndex, range);
        float right_random = random(chunkIndex + 1, range);

        float noise = (1 - prog) * left_random + prog * right_random;

        return Math.round(noise);
    }
}

Here's a picture of the terrain compared to what I want (what I want is in red):

EDIT
So I understand what you guys mean about the previous Perlin class not actually being perlin noise. I fixed it with some tweaking and using actual perlin noise, the only thing I'm partially confused about is the seeds, and how do they work..

for example in Java this is how they do it

x = (x<<13) ^ x;
return (float)( 1.0 - (( (x * (x * x * 1376312589 + 789221) + 1376312589) + 3517) & Integer.MAX_VALUE) / 2543768824f);

if someone could explain what all that really means it'd be great, and why does it use prime numbers?

sentences:
Using versors for movement The context

I was thinking of using a versor + velocity field to implement the "moving" part of a 2D game object. For example, if the player should move right I just set the versor to be: [1, 0] and the velocity to be some variable. Then when the player movement needs to be updated we just multiply the versor to the variable and we get the vector to be summed to the current vector position.

For example if the position p is [12, 45] in the 2D space, the versor vs is [1, 0] and the velocity v is 4 we can easily apply the algorithm above:

new position = p + (vs * v)

which leads to:

new position = [12, 45] + ([1, 0] * 4)
new position = [12, 45] + [4, 0]
new position = [16, 45]

The velocity/speed is a separate field because a versor (of length always = 1) better explain diagonal cases, like we see below.

When the player position is handled by the pressing of WASD keys I'd like to be able to code something like this:

on press W -> add versor [0, +1] to current versor and normalize
on press S -> add versor [0, -1] to current versor and normalize
on press A -> add versor [-1, 0] to current versor and normalize
on press D -> add versor [+1, 0] to current versor and normalize

on release W -> remove versor [0, +1]
on release S -> remove versor [0, -1]
on release A -> remove versor [-1, 0]
on release D -> remove versor [+1, 0]

Adding versors (everything is good)

The cool thing about this is that when both W and D are pressed the player moves diagonally to the top right because we first add the W versor and normalize:

vs = [0, 0]
vs += [0, +1] // W versor
// vs is now [0, +1] which is already normalized

and then we add the D versor:

// vs is now [0, +1]
vs += [+1, 0] // D versor
// vs is now [1, 1] which is not normalized
vs /= magnitude(vs)
// vs is now [0.71, 0.71]

Substracting versors (the problem)

Now the problem is when the user later release the W key for example. We currently have the W and D key pressed (which means the player is moving of [0.71, 0.71] (towards the top right corner) at every update. But if we remove the W versor, the calculus goes as:

// vs is now [0.71, 0.71]
vs -= [0, +1]
// vs is now [0.71, -0.29]
vs /= magnitude(vs)
// vs is now [0.9258, -0.3781]

The versor should be the remaining D versor, instead, ([1, 0]). I understand that this problem is related to the fact that we are normalizing at every operation, otherwise we would have:

vs = [0, 0]
vs += [0, +1] // W versor
vs += [+1, 0] // D versor
// vs is now [+1, +1]
vs -= [+1, 0] // D versor
// vs is now [0, +1]

but if we don't normalize and for some reason two D events are sent, we end up with:

vs = [0, 0]
vs += [0, +1] // W versor
vs += [+1, 0] // D versor
vs += [+1, 0] // D versor
// vs is now [+1, +2]
vs -= [+1, 0] // D versor
// vs is now [+1, +1]

which is not what we want. How can I correctly calculate the player position with versors then?

sentences:
Checking if a click happened "off" an object Having made the first game in Game Maker, Catch the Clown, I realised there was no way to win or lose.

Winning is easy enough, set a maximum score and a test that fires whenever a score increments, but losing has proved challenging. I had an idea; if the player attempts to click on the clown but misses he/she loses a life. I have tested every check, read the manual and looked through forums but I can't find a way to do this.

I also can't figure out where to put the event. I tried on the clown; tests like checking to if there would be a collision between where the click occurred and where the clown is... nothing works. I am at a complete loss so any help would be greatly appreciated.

sentences:
NULL REFERENCE EXCEPTION Object reference not set to an instance of an object So I have 3 scripts:

first for my player movementscript
second for my speed powerup speedscript
third for my obstacle box script i

I'm trying to get the component of box script in speed script, to get the function 'added' (which is in box script) into speed script but it keeps giving me nullreferenceexception error

Here are those scripts:

public class box : MonoBehaviour
{

    [SerializeField]
    GameObject effect;

    public int damage = 1;
    [SerializeField]
    float Speed =10f;
    [SerializeField]
    GameObject audioexplosion;

    void Update()
    {

        transform.Translate(Vector2.left * Speed* Time.deltaTime);

    }

    void  OnTriggerEnter2D(Collider2D col)
    {
        if(col.CompareTag("Player"))
        {
            Instantiate(audioexplosion, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);

            movment tmp = col.GetComponent<movment>();

                tmp.health -= damage;
            Destroy(gameObject);
        }
    }
    public void added(float spd)
    {
        Speed += spd;
    }

}

And here is my speed script.

public class speedscript : MonoBehaviour
{
    [SerializeField]
    GameObject effect;
    [SerializeField]
    GameObject speedaudio;
    //[SerializeField]
   public float speed;
    public float add_v = 5;
    private float timeindue;
    //[SerializeField]
 //  public box io;

    void Start()
    {

     //  io= GetComponent<box>();
       // Debug.Log(io);
    }

    void Update()
    {
        transform.Translate(Vector2.left * speed * Time.deltaTime);
    }

    void OnTriggerEnter2D(Collider2D sp)
    {
        if (sp.CompareTag("Player"))
        {
            Instantiate(speedaudio, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);
            box io = GetComponent<box>();
                Debug.Log(io);
                io.added(add_v);

                Destroy(gameObject);
        }
    }
}

sentences:
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:
Why code reflection became a must in game engines? I'm currently doing some research on programming languages(compile time reflection area, if you ask) and I found that on the game engine area the reflection feature becomes a must, an engine either uses a language which has reflection feature itself(for example uses C#), or implements it for non-reflection languages(for example both UE and CryEngine implement reflection mechanisms for C++).

I'm not a game developer, so I have no experiences on game developing and not familiar with engines, so can anyone tell me in what case the reflection becomes a must? And what's more, does reflection used only in development phase or also used in released production?

sentences:
How can I secure a high score table? Possible Duplicate:
  How can I prevent cheating on global highscore tables?

So, I create a game in Flash and I want to keep a hi-score table for people to compete in.

After a player has finished playing a game, the game needs to transmit the score (& player's name etc) back to a central server, to store the results in a database, probably via a PHP web page for simplicity.

All this is fine, but at this point nothing is stopping some 'clever' individual from sending a their own customised message directly to the PHP page and entering their own values directly into the hi-score tables, therefore cheating the data without even playing!

So, what can I do to ensure that the data being sent is only validated if it comes from the game itself?

sentences: 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:
Enumerating full game tree for small board game I am trying to list all the possible positions in a small board game (nannon) (using C++)

So far I have decided to split it into two parts, the pieces that are in home positions and end positions (which aren't on the board) and the pieces that are in play (on the board).

Now, I can list the positions when the pieces are on the board with the  STL algorithm next_permutation (on a 6 point structure like : point_1 = "White", point_2="empty"......point_5="Black", point_6="empty")

I am left with how to list all the positions of pieces which are off the board.

I have decided to have a set of bins:

white in home position
white in end position
White in play
black in home position
black in end position
black in play

white has three pieces that can be put in any of these bins (e.g 2 in home bin and 1 in play bin), same goes for black, like this:

white in home position = 2
white in end position = 0
White in play = 1
black in home position = 0
black in end position = 1
black in play = 2

Any ideas of how I go about this?

p.s: (i tried just adding the home/end/in-play bins to the "board" structure and running next_permutation but that gives nonsensical positions like black pieces in the home bin. I guess I could just list them ALL and then prune the nonsensical ones but that seems like over kill)

sentences:
Improving SpriteBatch performance for tiles I realize this is a variation on what has got to be a common question, but after reading several (good answers) I'm no closer to a solution here.  So here's my situation:

I'm making a 2D game which has (among some other things) a tiled world, and so, drawing this world implies drawing a jillion tiles each frame (depending on resolution: it's roughly a 64x32 tile with some transparency).

Now I want the user to be able to maximize the game (or fullscreen mode, actually, as its a bit more efficient) and instead of scaling textures (bleagh) this will just allow lots and lots of tiles to be shown at once.  Which is great!

But it turns out this makes upward of 2000 tiles on the screen each time, and this is framerate-limiting (I've commented out enough other parts of the game to make sure this is the bottleneck).  It gets worse if I use multiple source rectangles on the same texture (I use a tilesheet; I believe changing textures entirely makes things worse), or if you tint the tiles, or whatever.

So, the general question is this:

  What are some general methods for improving the drawing of thousands of repetitive sprites?

Answers pertaining to XNA's SpriteBatch would be helpful but I'm equally happy with general theory.  Also, any tricks pertaining to this situation in particular (drawing a tiled world efficiently) are also welcome.

I really do want to draw all of them, though, and I need the SpriteMode.BackToFront to be active, because I use the layering quite essentially.

I don't have any easily digested sample code since the method has become somewhat complicated, but no extra tiles are being "drawn," and all the drawing is inside one SpriteBatch.Begin / SpriteBatch.End call.

sentences:
Vector movement on a circle My progress so far: https://codepen.io/anon/pen/OjxLeO

Currently the player has only x and y coordinates.

I want to change that to vectors, like described in http://natureofcode.com/book/chapter-1-vectors/

Let's say the player should start at 12:00 and move clockwise 1 degree per second.

No clue how to implement it.

Any hints?

sentences:
How should I construct a Facebook Login Flow for a server-less Windows App in Unity? I am game programmer with limited web experience that was tasked to figure out how to make our game interact with Facebook.  We are building a Unity Windows standalone app (maybe MacIntosh later), and our publisher wants us to enable the player to post in-game selfies to their wall in Facebook.  That is all we need to do, we do not need to touch their friends list or anything else like that at all.

I have been digging to find out exactly how to do this, and the available advice online or prebuilt Facebook API Asset Store packages rely on the mobile API which we can't use.  So, looks like we have to roll our own for the time being.  I have been reading the developers.facebook.com section on Login Flow and it says that we should

Request a login dialog for the player with our App ID
Take the Access Token out of the response
Then combine it with our App Secret to make API calls

Facebook also says that for security reasons, we should never embed the App Secret into the source of our client exe, so that hackers can't disassemble the exe and pull our secret out for them to use for their own purposes.  That makes sense.  Instead, they recommend that the App Secret remain on a server and that our client delegate API calls to that server.  Seems like a smart way to do it.

However, we don't have a server, our publisher won't pay us to make a server or maintain the hardware, and even if they did, we don't have time to make one. So, what is the best practice for a client-only native Unity standalone app?

sentences:
Generating Normal map from a Image with a given Albedo map I am working on a research problem part of which involves generating normal map from a given image of a rusted object. I searched the internet for techniques to achieve the above and apparently crazybump is mentioned a lot. I tried it but it didn't produce the desirable effects. Also I am looking for a method which draws inspiration from an existing research paper not some closed source software. I turned my attention to the technique described in the this paper. Results from this technique are satisfactory for normal objects because of bias in the training data but it doesn't work very well in the case of rusted objects.
After this I focussed my attention on generating Albedo map (the above problem would become more solvable if Albedo map is obtained). Fortunately I am able to generate pretty good albedo maps for images of rusted objects. I used this paper's approach to generate Albedo maps. Now I want to know a good technique to get Normal map given an image and it's corresponding Albedo map. To give you an idea of what kind of images I am working with I am attaching a sample.

Links to research material would be really appreciated. Thanks!

sentences:
Coordinate transformation in voxel ray-tracing? I am implementing voxelization. I can't understand the coordinate transformation through shader.

I have read some papers and code, the first step in the geometry shader is project the triangle along its dominant axis.

What's the difference between this method and using projection matrix?

In usual ways, we transform data from local space,world space, view space,
then to projection space.

Does project the triangle means we transform from view space to projection space ?
What should we get after these process, in the end of pixel shader?

sentences:
I wanted to create a simple mobile online game for me and my mates. How should I handle the networking? I've made a few simple games and one multiplayer game where you connect through LAN but for this one I wanted to learn something new. I have the game concept working on my computer, it's just waiting for the networking.

I was looking to create networking similar to mobile online quiz games, where:
- you use your Store account as the game account
- you are not restricted to LAN or same WiFi network, but rather everything goes through an external server
- you have a Friends list,Recently Played list where you can see who's online right now
- you can invite a random player to a match or search for particular player to play with them/add them to your Friends list

Something like that. I don't know if you can host servers for a match on mobile devices, or how feasible it would be, given mobile internet isn't free, but it would make for a nice addition if the external server was only for handling information about who's online.

I'm working in Unity btw. so any recommendation for package from Asset Store is welcomed

Thanks in advance! :)

sentences:
Matrix camera, movement concept Someone told me that the movement concept in my 2D game is bad. When left or right arrow is pressed I'm scrolling the background which makes you feel that player avatar is moving (the avatar's X-position remains the same).

So... he told me something about matrix view. I should create all walls and platforms static and scroll only the camera and move the player's rectangle. I did a little research in Google, but found nothing.

Can you tell me anything about it? How to start? Maybe links, books and resources?

sentences:
Should I be using spritesheets, because of or despite of my vast number of images? I am developing a 2D game, and I have a lot of sprites. I used 3D animations and models to render into 2D, to give them that "Fallout" or "Diablo" look to them. It is also easier than drawing by hand, lol.

I have already had to cut the framerate down to 15fps, which was the lowest I could lower without making them have a choppy look to them. However, it was sad due to how incredibly smooth 24 frames looked.

There are two reasons I did this:

1) Cut down on HDD space. The fewer the images, the smaller my total game will be.

2) Cut down on RAM consumption. The fewer images to load, the more likely I am to avoid issues bloating my RAM limitation.

However, if there was a way to compress the images in both HDD space and RAM, I would do so. I have tested it before, and most do not receive any change in quality when giving from RGBA8888 to RGBA5555 and only a little hit when converting to RGBA4444 in my TexturePacker program. I do not do this currently, because SFML seems to use the same amount of memory regardless of which type of .PNG image it is. I looked into researching how to load it differently, but failed to find anything on the subject.

I have read a lot about how to handle 2D video games. The consensus is overwhelming: Pack your Sprites into a Bigger Texture for great performance! So I pack my tiny sprites into a much larger spritesheet using TexturePacker.

However, I plan to have 10-15 animations per character, 5 directions to move, and 15-40 frames per animation (probably an average of 24). With 15 animations, 5 directions, and an average of 24 frames per animation; That is 1800 individual frames per character.
If packed in a sprite sheet, that is only 75 images instead. (One sprite sheet per Animation, per Direction. 15 * 5)

For the one huge boss character in the game, I cannot use a spritesheet and have to program a way to simply load in one image at a time. I do not know if I can do this for performance yet.

For the characters, I already pack them in a spritesheet. For a single character walking about, this seems to work most of the time, although sometimes it stalls. However, I attribute that to my ill conceived code that swaps out textures instead of preloading all textures for that character.

If I were to preload the textures, it makes sense for sprite sheets. I would only imagine it's a bad idea to preload 1800 tiny images for each character.

However, I imagine streaming them into and out of memory one at a time would be extremely fast, so I would only need to have a single image in memory at one time. Wouldn't this mean that at any given moment I would only have each character consume a few KB instead of 45+MB?

I imagine this would kill my performance, as streaming would need to be incredibly fast (15 images going into and out of memory and rendering, per second) and although the images would be very small- it might be a better idea to load character spritesheets into memory instead. But I will have to code a single-image stream-like render system for my larger boss character anyway.

I have been experimenting, but it is not a simple process. Especially given the fact I am working on other parts of the game engine that do not deal with graphics right now.

sentences:
How to create loading bar for asset bundles on Unity (without changing scene)? So from the official documentation and unity forum now I know that there's async version of LoadFromFile (that I also will probably call UnityWebRequest.GetAssetBundle later for updated asset). Now the problem is where can I call it, and how to get the .progress value, converting from this:

public AssetManager()
{
    if (!useAssetBundle) return;
    foreach (var bundle_name in bundle_names)
    {
        var full_path = Path.Combine(Application.streamingAssetsPath + "/Bundle/", bundle_name);
        var bundle = AssetBundle.LoadFromFile(full_path);
        if (bundle == null) LogHelper.Critical("Failed to load AssetBundle {0}", full_path);
        bundles[bundle_name] = bundle;
    }
}

To this (that obviously wrong):

private List<AssetBundleCreateRequest> loadPro = new List<AssetBundleCreateRequest>();

private IEnumerator<AssetBundle> _loadOneAssetBundle(string full_path)
{
    var creq = AssetBundle.LoadFromFileAsync(full_path);
    loadPro.Add(creq);
    yield return creq.assetBundle;
}

public AssetManager(MonoBehaviour parent)
{
    if (!useAssetBundle) return;
    foreach (var bundle_name in bundle_names)
    {
        var full_path = Path.Combine(Application.streamingAssetsPath + "/Bundle/", bundle_name);
        var bundle = parent.StartCoroutine(_loadOneAssetBundle(full_path)).assetBundle; // NOPE T_T)
        if (bundle == null) LogHelper.Critical("Failed to load AssetBundle {0}", full_path);
        bundles[bundle_name] = bundle; // NOPE 'n')
    }
}

public void Update()
{
    var progress = 0f;
    foreach (var pro in loadPro)
    {
        progress += pro.progress;
    }
    LogHelper.Debug("Progress %f",progress);
}

sentences:
When pressing both the key then releasing any1 key then the anination is not played i give the running animation to the character and created a flip script...when press A then player move and flip to leff and animation is played ....when press D then player move and flip to write and animation is played.. ..when i press both A and B Simultanious then animation is played but when pressing both at the same time and release one key the player moves in that direction but the animation is not playing
Here are the script of the player:
[SerializeField] float _xSpeed = 10f;
[SerializeField] float _jumpForce = 10f;

private Rigidbody2D _rb;
private float _movement;
private float _extraJumps;
private bool _isFacingRight;

void Start()
{
    _rb = GetComponent<Rigidbody2D>();
}

void Update()
{
    _movement = Input.GetAxisRaw("Horizontal");
}

void FixedUpdate()
{
    _rb.velocity = new Vector2(_movement * _xSpeed ,_rb.velocity.y);
    {
        if(_isFacingRight == true && _movement > 0.1f)
        {
            Flip();
        }
        else if(_isFacingRight == false && _movement < -0.1f)
        {
            Flip();
        }
    }

    if(Input.GetKeyDown(KeyCode.Space))
    {
        _rb.velocity = new Vector2(_rb.velocity.x,_jumpForce * Time.deltaTime);

    }

}

void Flip()
{

    _isFacingRight = !_isFacingRight;
    transform.Rotate(0,180f,0);

}

And here is the script for the animation:
[SerializeField] Transform _player;
private Animator _animator;

void Start()
{
    _animator = GetComponent<Animator>();
}

void Update()
{
    transform.position = _player.position;
    if (Input.GetKeyDown(KeyCode.D))
    {
        _animator.SetBool("Running", true);
    }
    else

    if (Input.GetKeyDown(KeyCode.A))
    {
        _animator.SetBool("Running", true);
    }
    else

    {
        _animator.SetBool("Running", false);
    }
}

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:
Game Maker: Is there a faster way to check for collision than this? There are many objects named obj_Cell and obj_Core in the room, each Core has a number (0 to 10) of Cells that belong to it. Each Cell record its corresponding Core with the variable ID_MyCore, which is the id of its Core.

Collisions/overlapping between Cells belonging to different Cores are to be detected. The purpose of this is to know which Cells are overlapping with a "foreign" Cell.

The following code is used, it is run in the step event of every Cell

with(obj_Cell)
{
    if place_meeting(x,y,other)=true
    {
        if other.ID_MyCore!=ID_MyCore
        {
            //do action
        }
    }
}

The annotated version of the above:

with(obj_Cell)  //get every cell in the room to do the following:
{
    if place_meeting(x,y,other)=true  //if you are touching the cell that is runing the script...
    {
        if other.ID_MyCore!=ID_MyCore  //...and your core is not the other cell's core
        {
            //do the thing that should be done when two foreign cells touch
        }
    }
}

My question is, is there a way of doing the same but faster? As it is, the number of times these scripts need to be run is the square value of total number of cells in the room, I intend to have hundreds of cells simultaneously.

sentences:
How to implement a tractor beam? I'm working on a game where the player can pick up objects using something like a tractor beam, and carry them around.

Attracting the object towards the center of the beam is not difficult. But once the object is close enough to the center, I need to keep it there while the player moves, which is what I'm having problems with. I can think of two ways to do it, and both have issues:

Update the object's position whenever the player position changes, keeping it centered on the beam.
Update the object's velocity to point directly towards the center of the beam, the further away, the more velocity.

Moving and rotating works just fine with both approaches, but the physics are wrong when the carried object collides with other objects:

With the first approach, physics are completely ignored. The carried object just pushes anything out of the way. That is because position changes are only supposed to be done as part of the world physics, based on velocity.

With the second approach, physics basically behave how they should, but overreact. The problem is: In order to keep the carried object at the center of the beam even when rotating and moving, I need to use high velocity values. So once the carried object touches another one, it gets way too much velocity from the collision.

How can I implement this properly? My best guess right now is to go with the second approach and add special handling for carried objects to the world physics, reducing the velocity to sane values for collisions or when the player stops carrying them. But that seems like a pretty inelegant workaround.

Edit: Adding some pseudo code to illustrate how it works right now (that'd be the second approach above)

void attract_object(object, ticks) {
    Vector distance = beam_center - object.center;
    // If the object is not close to the beam center, attract it slowly
    if (magnitude(distance) > 10) {
        object.velocity += distance.normalized() * ticks * 0.1;
        return;
    }

    // Here comes the part we're talking about. That magic 0.5 is just high enough
    // that the object isn't lost while moving around. But it's still so high that
    // other objects are repelled with way too much force.
    object.velocity = distance * ticks * 0.5;
}

From what I see, this happens when the carried object pushes another object away:

The carried object collides with another object
The objects' velocities are distributes properly, so the carried object is pushed away from the center of the beam in the process
The code above causes the carried object to return to the center of the beam, with so much velocity that it'll get back there quickly
When the carried object moves back towards the center of the beam, half of its high velocity is transferred to the other object, repelling it violently. Since the initial velocity of the carried object appears to be sane, I can imagine that steps 2 to 4 are repeated multiple times, building up such a high velocity.

That appears to be the cause. I can't think of a nice way to fix it though :(

sentences:
Low complexity shader to indicate the sides of a polyline I have a bunch of polylines that I draw using GL_LINES. They can have thousands of points. They actually represent the separation of land and water on a map. I don't have complete polygons, just the ordered set of points.

I'm looking for a neat but efficient way to visually convey Side A and Side B as being different. For example I could offset the polyline in one direction a few times and fade it out (but every offset is doubling the number of points), or offset it once to make a "ribbon" and give one side a 'glow' like effect to mimic the outer glow or shadow of a polygon).

This is for a mobile application and I'm using OpenGL ES 2. I'd like to keep the effect as simple as possible from a complexity stand point. I'm looking for some additional ideas; maybe there's a clever shader technique out there or a visual effect I haven't considered.

sentences:
How exactly does XNA's SpriteBatch work? To be more precise, if I needed to recreate this functionality from scratch in another API (e.g. in OpenGL) what would it need to be capable of doing?

I do have a general idea of some of the steps, such as how it prepares an orthographic projection matrix and creates a quad for each draw call.

I'm not too familiar, however, with the batching process itself. Are all quads stored in the same vertex buffer? Does it need an index buffer? How are different textures handled?

If possible I'd be grateful if you could guide me through the process from when SpriteBatch.Begin() is called until SpriteBatch.End(), at least when using the default Deferred mode.

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:
If I project a sphere in 3D will it be a circle? Assuming I have infinite vertices to represent the sphere, if I project the sphere from any position/scale in 3D to 2D, will it be a circle?

I know it will not be a circle on the screen, because of scaling and different resolutions. But do field of view and aspect ratio effect the results?

Edit: Sorry yes, I am talking about perspective projection. Seems the answer is no then, perspective will distort the sphere. Thanks!

sentences:
What input and window handler should I learn for complement OpenGL? I have a good base in C++ programming and I did some 2D games using SDL. Now I want to start making 3D games, but as much as posible, I want to learn following the standars of the profesional industry.
I think learning openGL I will have more acuratte skills for programming 3D graphics, so I prefer to study openGL instead of a game engine. But my cuestion is, what library I should choice for complement openGL in the area of the input and windows handler, if posible, following the standars of the industry?

Thanks you in advance for the help! (And sorry for my bad english)

sentences:
Pixel Shader : Backbuffer is 'Black' After Fiddling around I am pretty sure this is not a Shader issue.

Edit 4:
The only diference I can see is that BasicEffect calls these methods before drawing:

 // Make sure that domain, hull and geometry shaders are disable.
        GraphicsDevice.DomainShaderStage.Set(null);
        GraphicsDevice.HullShaderStage.Set(null);
        GraphicsDevice.GeometryShaderStage.Set(null);

So I tried this:

technique
{
pass
    {
    Profile = 11.0;
    // TODO: set renderstates here.
    GeometryShader = NULL;
    HullShader = NULL;
    DomainShader = NULL;
    VertexShader = VertexShaderFunction;
    PixelShader = PixelShaderFunction;

    }
}

Still it doesnt render anything. Maybe this will someone to get a idea.

My matrix is calculated like this :

        Matrix MVP = Matrix.Multiply(Matrix.Multiply(Matrix.Identity, Matrix.LookAtLH(new Vector3(-10, 10, -10), new Vector3(0), new Vector3(0, 1, -0))), Camera.Projection);

        VoxelEffect.Parameters["MVP"].SetValue(MVP);

I am currently Using it with Matrix.Identity.

Visual Studio Graphics Debug shows me that my vertex shader is actually working, but not the PixelShader. I striped the Shader to the bare minimums so that I was sure the shader was correct.
But why is my screen still black?

EDIT: Before people start saying that this is duplicated of

DirectX11 pixel shader in pipeline is missing

I already checked that a few others, and none of the answers solved my issue.

EDIT 2:

RenderDevice.Quad.Draw(MyEffect);

This shows a quad on screen, as it should so the problem is not on my Shader code.
Still I am baffled, I am doing this using another call  which if I use the default BasicEffect class renders fine but if I use mine it doesnt show anything:

        VertexPositionNormalTexture[] QuadsVertices = new VertexPositionNormalTexture[]
        {
            new VertexPositionNormalTexture(new Vector3(-1, 1, 0),Vector3.Zero,new Vector2(0, 0)),
            new VertexPositionNormalTexture(new Vector3(1, 1, 0), Vector3.Zero,new Vector2(1, 0)),
            new VertexPositionNormalTexture(new Vector3(-1, -1, 0), Vector3.Zero,new Vector2(0, 1)),
            new VertexPositionNormalTexture(new Vector3(1, -1, 0), Vector3.Zero,new Vector2(1, 1)),
        };
        Matrix MVP = Matrix.Identity;

  g.Draw(MyEffect); //This renders nothing

Using Quad Render I get a nice Quad on the screen.
So what could possibly be the issue here?

sentences:
C++ glGenBuffers does not return proper VBOID when called in thread I'm currently learning to properly use multithreading in C++ in combination with OpenGL and GLFW, and I encounter a strange bug in my application.
I'm generating a procedurally generated terrain in a sidethread, but everytime I want to create the buffer for the generated terrain(chunk), glGenBuffers() just gives me back the value I put in! It does not create a proper buffer. I even checked with gDEBugger, no VBO's created.

Here's the pseudo code:

void init(){ //This is in the main thread!
    sharedWindow = glfwCreateWindow(1, 1, "shared", NULL, NULL);
    mainWindow = glfwCreateWindow(400, 400, "main", NULL, sharedWindow);
    glfwMakeContextCurrent(mainWindow);
}

void terrainGeneratorLoop() { //This is in another thread!
    glfwMakeContextCurrent(sharedWindow);
    while(running){

        /* Generate vertex data for terrain */

        //Upload generated data into GPU:
        unsigned int m_vbo = -1;
        glGenBuffers(1, &m_vbo); //After this call, m_vbo is still -1 (Well actually 4294967295, but you get the point)
        glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
        glBufferData(GL_ARRAY_BUFFER, data.size() * sizeof(vertex), &data.at(0), GL_STATIC_DRAW);
    }
    glfwMakeContextCurrent(nullptr);
}

I'm pretty sure I'm doing something wrong with my context handling and that shared window. And sorry because of the fact that this is only pseudo code, my structure of the project and classes is way to complex to paste in in here!

EDIT:
When I call the terrainGeneratorLoop() in the main thread, everything works as It should.

sentences:
Component System - Editor Data Management I'm trying to construct an editor in C# that exposes game components to IronPython, so it may create the game object definitions to be used within the editor:

C# Exposes the components to the python script (Spatial, Movement, SpriteView, etc.)
IronPython creates the game object definitions (or templates) by attaching components to a game object.

At the startup of the editor:

The Python script is loaded with all of the game object definitions.
Tools are updated with the new objects (availability for painting).

The problem I'm having lies when I'm saving and opening the editor data:

When saving, I use C# to serialize all of the constructed game objects (including the game object definitions generated from python) to a file.
When opening, I use C# to deserialize the data.  - Since the Python script is not synchronized with the serialized components, I will run into a big problem when I change anything in the script.

One solution I had was to only serialize the definition name of a game object, therefore when I deserialize my data I will have to do a lookup for the target definition (created by the script) and simply clone it. But, it still will not be entirely in sync with the editor data (some data will be changed on each game object like for example the position (note when I say game object I do not mean the definition)).

Another solution might be to use a database and save out all of my editor data to it (perhaps using the entity database in C#). I'm not entirely sure if this will solve my problem.

Any help would be appreciated, 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:
How to add a JSON object / model into your whitestorm world / scene? I am loading the object from my json file.

var loader = new THREE.ObjectLoader();
loader.load("blue-car.json",
function ( car ) {
  car.position.set(2, 0, 0);
  car.addTo(world);
 }
);

How can I add the object to my world? In regular three.js it works when I load the json file, but how do I do it in whitestorm?

Update: I tried using the importScene whitestorm method. No errors but it still doesn't show up. Here is an image of logging out a regular plane in whitestorm and the car that is loaded from the json file.

Thank You!

sentences:
XNA, SpriteBatch: Slow when rendering lots of sprites? I've just now tested rendering a lot of sprites using XNA's SpriteBatch class. What I basically do is this:

Somewhere in the code, I have a list which contains all sprites that have to be rendered. I prefilled this list with 2500 Sprites, all of which have the same rotational angle, texture, position etc.

I then draw them like this:

    spriteBatch.Begin();
    foreach (Sprite spr in sprites)
        spriteBatch.Draw(spr.Texture, spr.Position+spr.Center, spr.SourceRect, spr.Color,MathHelper.ToRadians( spr.Rotation ), spr.Center, spr.Scale, SpriteEffects.None, spr.Depth);

    spriteBatch.End();

and I'm getting really poor performance. I only average about 15FPS with my Radeon HD 6850 graphics card and i5 2500k CPU.

This is very surprising to me, since I average about 70 FPS doing exactly the same thing with my own custom OpenGL engine, which uses old OpenGL rendering (meaning one draw call for every single sprite). I actually expected XNAs rendering to be a ton faster, since it draws everything in one draw call.

Am I rendering this the wrong way? Playing around with SpriteSortMode settings has made almost no difference, some of them just make it a tiny bit slower (depth sorting etc.).

sentences:
How to make an object stay relative to another object In the following example there is a guy and a boat. They have both a position, orientation and velocity.

The guy is standing on the shore and would like to board. He changes his position so he is now standing on the boat.

The boat changes velocity and orientation and heads off. My character however has a velocity of 0,0,0 but I would like him to stay onboard. When I move my character around, I would like to move as if the boat was the ground I was standing on.

How do keep my character aligned properly with the boat? It is exactly like in World Of Warcraft, when you board a boat or zeppelin.

This is my physics code for the guy and boat:

this.velocity.addSelf(acceleration.multiplyScalar(dTime));

this.position.addSelf(this.velocity.clone().multiplyScalar(dTime));

The guy already has a reference to the boat he's standing on, and thus knows the boat's position, velocity, orientation (even matrices or quaternions can be used).

sentences:
Semi-transparent mouse cursor on Windows I want to change the mouse cursor for a desktop game I am writing with libGDX. That is working well under Linux, however, under Windows semi-transparent cursor pixels are not being rendered at all. That means I am unable to anti-alias the cursor image.

For sure there must be a way to render semi-transparent mouse cursors under Windows, like it's possible under Linux. Any ideas what I could do to solve this issue?

sentences:
Is it possible to detect contact with every frame change when using an animation in SpriteKit? Is it possible to detect contact with every frame change when using an animation in SpriteKit? For example, if I have two nodes of a person walking, I want to detect contact with the ground each time the frame changes (the character is walking on a surface). Just can't seem to get it.

I've tried using a for loop to add a physics body and the contact and collision properties to each node, but that doesn't seem to work. It detects contact once, but that's it. Anyone have any ideas?

Thanks in advance!

sentences:
Display image a couple seconds after an enemy spawns? So right now I have enemies that spawn behind objects with a delay.

What I need is to display an image on the screen 5 seconds after each enemy spawns (it's to show the player it has been "attacked") and that image has to disappear after like 2 seconds so.

I know I have to use WaitForSeconds but I don't know how because everything I've tried isn't working.

Here's my code:

 public class TimedSpawn : MonoBehaviour {

     public GameObject spawnee;
     public bool stopSpawning;
     public float spawnTime;
     public float spawnDelay;

     // Use this for initialization
     void Start () {
         InvokeRepeating ("SpawnObject", spawnTime, spawnDelay);
     }

     public void SpawnObject (){
         Instantiate (spawnee, transform.position, transform.rotation);

         if (stopSpawning) {
             CancelInvoke ("SpawnObject");
         }
     }
 }

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

sentences:
Swap between first person and eagle eye view cameras, hiding the FP controller Not sure what has to be done to correctly swap between a generic fps controller camera, to something like an eagle eye view.

The idea is to have the player use the FPS controller, then when he get in a control seat; I want to switch to a larger view; kinda like a RTS view from the top (I call it "eagle eye", not sure about the technical name).

I did check around and from my research, I have to swap active camera parameter; but when I do so, the FPS remain active, while I would like to hide it, and also disable it completely, since the player will use the mouse at that point.

If I destroy the FPS, that works, but when the player leave the control seat, I have to re-create it, which bring a whole level of pain, to restore its state.

How do you disable temporarily a FPS, so it won't be neither visible nor it will interact with anything?

sentences:
How to calculate acceleration and deceleration I have a car with speed x, and can accelerate at a rate of 0.5 m/s^2, and can decelerate at a rate of -0.1 m/s^2. Maximum speed is 20 m/s.
To accelerate the car speed, at each frame I need to do:
car.CurrentSpeed = car.CurrentSpeed + 0.5

To decelerate the car speed, at each frame I need to do:
car.CurrentSpeed = car.CurrentSpeed - 0.1

Is this correct?
I have found this answer which suggest the following speed formula:

Speed += ((MoveDirection * MaximumSpeed) - Speed) * AccelerationFactor
Where:

Speed is the current speed the entity is travelling at on the current
axis.
MoveDirection is the direction the entity is trying to travel in
on the current axis, 1 is forward, 0 is still and -1 is backwards. All
values in between are allowed.
MaximumSpeed is a constant determining
the fastest that the entity can travel on the current axis.
AccelerationFactor is a constant between 0 and 1 that represents the
rate of acceleration and deceleration. 1 is instant, and 0 will never
move.

Using the same formula then:
To accelerate:
car.CurrentSpeed += ((MoveDirection * 20) - car.CurrentSpeed) * 0.5

What would be the move direction? Can it be the heading?

sentences:
Dynamic Crafting Systems I have been toying with the idea of having a game that is based purely around crafting. That on its own is not much of a big deal. The way the crafting would work is the problem.

The idea I have is that there are a certain set of base materials with which the player can use to craft things. But aside from these set materials, anything goes. The player could combine the materials in any way they saw fit to create whatever they wanted. And then, with the new items the player has created, proceed to make more.

To me, this idea sounds very implausible and not able to be created. Is it actually possible?

sentences: Should I put a soundtrack behind my strategy game? Which games need music and sound Shuffling cards and impact noises are cool (it is a card based game), but should I invest the time/effort in hooking up background music?  I have found Play Audio from Stream Using C# which could be used to allow hooking to DI if online or similar code could be used to play local MP3s, but is it worth the effort?  Which game generes need it and which can do without?  Release it without it and add it as a .5 feature?

sentences:
Why do some networked games use interpolation and some use pathfinding for remote movement? This is a bit of an open question but I'd like to see someone contribute a good reasoning for both.

For a quick example of both:

Interpolation Model

Think the Valve model where the client is receiving position updates frequently and the remotes  update their positions using interpolation on this data.

Path-finding

In this model, think the user sends a destination and everyone pathfinds to it.

What types of games are suited to each and when should one use each?

sentences:
Getting Center and Radius of Irregural Object I have drawn an asteroid object manually , and would like to get its center/radius by a specific equation. I think I can get them by calculated and hard-coded values.

The code to draw the asteroid:

float ratio = (float)app::getWindowWidth()/app::getWindowHeight();
gl::pushMatrices();

gl::translate(m_Pos*ratio);

gl::scale(m_size*ratio,m_size*ratio);
gl::color(ci::Color(1,1,1));

    gl::drawLine(Vec2f(20,0),Vec2f(80,0));
    gl::drawLine(Vec2f(80,0),Vec2f(100,20));
    gl::drawLine(Vec2f(100,20),Vec2f(100,50));
    gl::drawLine(Vec2f(100,50),Vec2f(60,100));
    gl::drawLine(Vec2f(60,100),Vec2f(40,100));
    gl::drawLine(Vec2f(40,100),Vec2f(50,70));
    gl::drawLine(Vec2f(50,70),Vec2f(25,90));
    gl::drawLine(Vec2f(25,90),Vec2f(0,70));
    gl::drawLine(Vec2f(0,70),Vec2f(20,40));
    gl::drawLine(Vec2f(20,40),Vec2f(0,20));
    gl::drawLine(Vec2f(0,20),Vec2f(20,0));

gl::popMatrices();

gl::pushMatrices();

float radius = getRadius();

Vec2f center = Vec2f(m_Pos.x+50, m_Pos.y+50);

gl::drawStrokedCircle(center*ratio, 10);
gl::popMatrices();

}

According to the answer I have written that code to calculate the radius, is it correct or not ?

cinder::Vec2f Asteroid::getCenter()
{
    return ci::Vec2f(m_Pos.x, m_Pos.y);
}

double Asteroid::getRadius()
{
    ci::Vec2f  _vec = (getCenter()- Vec2f(15,5));
    return _vec.length()*0.3f;
}

sentences:
Hold and swipe can't work together I Have a character in my game that must go when player hold finger at the screen, but when I swipe character first go, and then do swipe. (for example jumping - character first go, and only then jump).
This my code for touch:

 if (Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            startTime = Time.time;
            startPos = touch.position;
        }
        else if (touch.phase == TouchPhase.Ended)
        {
            endTime = Time.time;
            endPos = touch.position;
            swipeDist = (endPos - startPos).magnitude;
            swipeTime = endTime - startTime;

            if (swipeTime < maxTime && swipeDist > minSwipeDist)
            {
                swipe();
            }
        }
        else if (touch.phase == TouchPhase.Stationary && isTap == 0)
        {
           hold();
        }
    }

This my code for a hold:

  void hold()
{

        moveVelocity = 3f;

}

And for swipe:

void swipe()
{
    Vector2 distance = endPos - startPos;
        if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y))
    {
           if (distance.x > 0)
        {
            Debug.Log("Right swipe");
        }
        if (distance.x < 0)
        {
           Debug.Log("Left swipe");
        }
    }
    if (Mathf.Abs(distance.x) < Mathf.Abs(distance.y))
    {
        if (distance.y > 0)
        {
            Debug.Log("Up swipe");
        }
        if (distance.y < 0)
        {
            Debug.Log("Down swipe");
        }
    }
}

My question is: When player swipe left character first go, and only then do swipe left. I want player swipe, without going forward. How can I do this?

sentences:
Unity - Issue applying Render Texture to object imported from Blender I'm new to Unity and am trying to create a sort of CRT computer monitor/terminal with text. To draw the text, I set up a Text Mesh Pro with its own camera, which renders to a Render Texture.

I then designed a simple computer monitor model in Blender split into two objects: one for the glass part of the screen, and another for the 'rest' of the monitor exterior case.
I saved a copy of the .blend file into the Assets folder and imported this into Unity.

My blender model: (two separate objects, with the separate "screen" piece moved out of the screen)

When I try to apply the Render Texture onto the screen object, the texture is rotated 90 degrees anti-clockwise and is too zoomed in:

I can't seem to rotate the texture so that it is the right way up to read the text, and only some of the text is visible.
I have tried rotating the object 90 deg. clockwise in Blender and "applying" the transform so unity then thinks the object is oriented correctly. this still caused the texture to be rotated.

I also tried exporting as an .obj file, with "Up" set to "Y-Up", but this didn't work.
I then tried applying the Render Texture to a material, which I then applied to the screen object which didn't work either.
If I apply the texture to a standard cube in Unity, it works fine and is rotated and scaled correctly to fit the cube.

How can I get the blender object oriented correctly so that the Render Texture applies in the correct orientation and scales so the whole of the Render Texture fits and is not zoomed in?

I'm using Unity 2019.3 and Blender 2.82.

sentences:
How can i get component script from FirstPersonCharacter? In the Hierarchy i have a FPSController and as child of it FirstPersonCharacter.
I can get script that attached to the FPSController but not from the FirstPersonCharacter.

What i want to get is the Blur script from the FirstPersonCharacter.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public CharacterController firstPersonCharacter;
    public FirstPersonController fpc;
    public float fadeDuration = 5;
    public float speed;

    private Material material;
    private float targetAlpha = 0;
    private float lerpParam;
    private float startAlpha = 1;
    private bool rotated = false;

    void Start()
    {
        material = GetComponent<Renderer>().material;
        SetMaterialAlpha(1);

        fpc.enabled = false;
    }

    void Update()
    {
        lerpParam += Time.deltaTime;

        float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
        SetMaterialAlpha(alpha);

        if (alpha == 0)
        {
            fpc.enabled = true;

            if (rotated == false)
            {
                fpc.GetComponent<FirstPersonController>().enabled = false;
                fpc.transform.localRotation = Quaternion.Slerp(fpc.transform.rotation, Quaternion.Euler(0, 0, 0), speed * Time.deltaTime);
            }

            if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))
            {
                fpc.GetComponent<FirstPersonController>().enabled = true;
                firstPersonCharacter.GetComponent<Blur>
                rotated = true;
            }
        }
    }

    public void FadeTo(float alpha, float duration)
    {
        startAlpha = material.color.a;
        targetAlpha = alpha;
        fadeDuration = duration;
        lerpParam = 0;
    }

    private void SetMaterialAlpha(float alpha)
    {
        Color color = material.color;
        color.a = alpha;
        material.color = color;
    }
}

I can get scripts from the FPSController like this:

fpc.GetComponent<FirstPersonController>().enabled = true;

But i can't get the Blur script from the firstPersonCharacter.
I tried before instead:

public CharacterController firstPersonCharacter;

With GameObject:

public GameObject firstPersonCharacter;

But Blur is not exist. When i make GetComponent The Blur is not exist.

sentences:
Am I experiencing a gimbal lock problem when rotating my cube? So I'm trying to build a simple mechanic where the player see's 3 sides of a cube at a time: top, left and front(I called the front-side "Right" in my code, due to the orthographic view). The player can click on the front side or left side of the cube to rotate the cube so that the side that was pressed moves and becomes the top face. I want to smooth/animate the rotation.

The red faces are the faces that the user can click on.

My Logic seems to work quite well when I click on the left face (Rotating along the x axis), but doesn't seem to work well for the front/right face(It usually works once and then does weird stuff on the next click, this is on the z-axis)

public class CubeRotator : MonoBehaviour
{
    private const float STOP_THRESHHOLD = 0.1f;
    private const float ROTATE_AMOUNT = 90f;

    [SerializeField, Header("Touch Quads Colliders")]
    private Collider touchQuadLeft;
    [SerializeField]
    private Collider touchQuadRight;

    [SerializeField, Space(10)]
    private float timeToRotate;

    private bool mustRotateLeft = false;
    private bool mustRotateRight = false;

    private float targetX = 0.0f;
    private float targetZ = 0.0f;

    private float xVelocity = 0.0F;
    private float zVelocity = 0.0F;

    int layerMask;

    private void Start()
    {
        layerMask = LayerMask.GetMask("Touch Quad");
    }

    void Update()
    {
        ListenForTouch();
        RotateCube();
    }

    private void ListenForTouch()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector2 touchPoint = Input.mousePosition;
            RaycastHit rayCastHit;
            Ray ray = Camera.main.ScreenPointToRay(touchPoint);

            if (Physics.Raycast(ray, out rayCastHit, 150f, layerMask))
            {
                if (rayCastHit.collider == touchQuadLeft)
                {
                    mustRotateLeft = true;
                    targetZ = targetZ - ROTATE_AMOUNT;
                    zVelocity = 0f;
                }

                else if (rayCastHit.collider == touchQuadRight)
                {
                    mustRotateRight = true;
                    targetX = targetX + 90f;
                    xVelocity = 0f;
                }
            }
        }
    }

    private void RotateCube()
    {
        float zAngle = transform.rotation.eulerAngles.z;
        float xAngle = transform.rotation.eulerAngles.x;

        if (mustRotateLeft)
        {
            zAngle = Mathf.SmoothDampAngle(zAngle, targetZ, ref zVelocity, timeToRotate);

            if (Mathf.Abs(zVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateLeft = false;
            }
        }

        if (mustRotateRight)
        {
            xAngle = Mathf.SmoothDampAngle(xAngle, targetX, ref xVelocity, timeToRotate);

            if (Mathf.Abs(xVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateRight = false;
            }
        }

        transform.rotation = Quaternion.Euler(xAngle, 0f, zAngle);
    }
}

Inspector Values:

I've tried several things, the only problem I can think of is, gimbal lock. Thanks in advance.

sentences:
Does changing a Rasterizer State affect every object (model) on the screen? Quick easy question. When setting a Rasterizer State (like for example wireframe).....does that affect every object (model) on the screen?

For example, let's pretend I have 2 cubes. I use:

devcon->RSSetState(pRSWireframe);

Will that affect all the objects on the screen?

sentences:
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:
Translate along local axis I have an object with a position matrix and a rotation matrix (derived from a quaternion, but I digress).  I'm able to translate this object along world-relative vectors, but I'm trying to figure out how to translate it along local-relative vectors.  So if the object is tilted 45 degrees around its Z-axis the vector (1, 0, 0) would make it move to the upper right.

For world-space translations I simply turn the movement vector into a matrix and multiply it by the position matrix: position_mat = translation_mat * position_mat.  For local-space translations I'd think I'd have to use the rotation matrix into that formula, but I see the object spin around instead when I apply a translation over time no matter where I multiply the rotation matrix.

sentences:
Is there a place in games for people with financial engineering or operations research backgrounds? I just started my first year in college in an engineering school. I haven't had any classes about programming, and although I'm in an engineering school I'm not that good at (and don't enjoy) physics or chemistry. For me, the way to go is math related majors, which are Financial Engineering or Operations Research.

Although I believe I will be somewhat good in those areas I definitely don't want to get sucked into the "financial blackhole" with extreme work hours and stress levels. I want to have creativity in my life.

So I am wondering what kind of jobs can I find in the gaming industry with a background of Financial Engineering or Operations Research? Can I join the creative groups of game development companies?

sentences:
Unity highlight/outline mesh edges/border (make them visible) Let's say I create a cube using mesh triangles similar to the graph below. I would like to make those 12 edges visible in play mode so user/player can see them too (but without the diagonals).
What would be the best way to approach this problem in unity? Hundreds of cubes will be created in run time using mesh/triangles and the vertices position (vector3 value) will change at some point, so I am wondering if there's a way that allows those edges to change/move along when the mesh/triangles change and the edges still remain visible the whole time.
The desired outcome should be similar to the shaded wireframe in the scene view. Any help would be appreciated.

sentences:
Why can't I sample a texture in a vertex shader? I'm old in Game Development but very new in shader writing. I just want a shader that transform from 1 texture to another. So I did start learning shader writing and wrote my desired shader. But during writing one thing I cannot understand as I am very dumb in shader writing that if I assign fixed4 color with COLOR semantic in vertex method then compiler gives the following error.

  Shader error in 'Hamza/TwoTextures': cannot map expression to vs_4_0 instruction set at line 39 (on glcore)

  Compiling Vertex program
  Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP UNITY_TEXTURE_ALPHASPLIT_ALLOWED

Here is the not working shader code,

Shader "Hamza/TwoTextures"{
    Properties{
        [NoScaleOffset]
        _Texture1 ("Texture 1",2D) = "white"{}

        [NoScaleOffset]
        _Texture2 ("Texture 2",2D) = "white"{}

        _Mixer ("Mixer", Range(0,1)) = 0
    }

    SubShader{
        Pass{
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            sampler2D   _Texture1;
            sampler2D   _Texture2;
            float       _Mixer;

            struct appdata{
                fixed4 vertex   : POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            struct v2f{
                fixed4 pos      : SV_POSITION;
                fixed2 tex      : TEXCOORD0;
                fixed4 col      : COLOR;
            };

            v2f vert(appdata i){

                v2f o;
                o.pos = mul(UNITY_MATRIX_MVP,i.vertex);
                o.tex = i.tex;

                // Giving error on this line
                o.col = (tex2D(_Texture1,i.tex) * _Mixer) + (tex2D(_Texture2,i.tex) * (1 - _Mixer));
                return o;
            }

            fixed4 frag(v2f v) : COLOR
            {
                return v.col;
            }

            ENDCG
        }
    }
}

And if I write same expression to throw it as return fixed4 value in fragment method then everything is working fine.

Here is working shader code,

Shader "Hamza/TwoTextures"{
    Properties{
        [NoScaleOffset]
        _Texture1 ("Texture 1",2D) = "white"{}

        [NoScaleOffset]
        _Texture2 ("Texture 2",2D) = "white"{}

        _Mixer ("Mixer", Range(0,1)) = 0
    }

    SubShader{
        Pass{
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            sampler2D   _Texture1;
            sampler2D   _Texture2;
            float       _Mixer;

            struct appdata{
                fixed4 vertex   : POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            struct v2f{
                fixed4 pos      : SV_POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            v2f vert(appdata i){

                v2f o;
                o.pos = mul(UNITY_MATRIX_MVP,i.vertex);
                o.tex = i.tex;
                return o;
            }

            fixed4 frag(v2f i) : COLOR
            {
                // It is giving me no error
                return (tex2D(_Texture1,i.tex) * _Mixer) + (tex2D(_Texture2,i.tex) * (1 - _Mixer));
            }

            ENDCG
        }
    }
}

Can anyone explain me that why it is happening? And what is the difference between them?

As I mentioned that I did start learning only two days before. I'm sort of noob in this.

sentences:
Client-Server RTS networking with lockstep and lag The peer to peer lockstep networking model would seem to indicate that everyone's input is delayed the same amount. And so this would indicate that everyone would feel the same lag in response to their input.

But in Warcraft 3 from playing many custom games it is clear that the creator of a custom game has much faster response time to their input. How can this be given the lockstep model?

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:
How to instantiate prefab outside Resources folder? I'm trying to developing a tool to help me "remember" all my prefabs / fbx assets.

My assets are almost in a subFolder (for instnace) "3d models" .

I've developed a routine to get all ".prefab" or ".fbx" files and store it in a List / Array.

Now, in a test scenem, i want to instantiate them (using 2 buttons: previous prefab and next prefab).

Using :

_currentPrefab = Instantiate ( Resources.Load (prefabs [currentPrefabIndex].ToString(), typeof(GameObject)), SpawnGameObject.transform.position, new Quaternion(0,0,0,0)) as GameObject;

Give me an error because (i'm pretty sure) my prefab is outside Resource folder.

So my question is: how can i Instantiate my prefab outside that folder ? Is there a way ?

Thanks

sentences:
How to use large texture atlases in my shaders on mobile devices This is a frustrating discovery. I have ported my desktop game to mobile and discovered that floating point precision in my shaders is not good.

I have large animations which I store per frame on a texture atlas. I try to keep as many non-unique frames in their own sections and piece them together e.g. a sword that doesn't animate for 4 frames is a node that attaches to the hand piece. This preserves memory.

However the texture atlases are so big that, when I use shaders, it breaks the animation completely.

Here's an example of one of the shaders that wraps the animated backgrounds (scrolling clouds)

precision highp float;
precision highp int;
precision highp sampler2D;

varying vec2 vTexCoord;
varying vec4 vColor;
uniform sampler2D texture;

// this script animates and wraps an animated background from one atlas
uniform float x; // frame start x
uniform float y; // frame start y
uniform float w; // frame width
uniform float h; // frame height
uniform float offsetx; // wrap by x amount
uniform float offsety; // wrap by y amount

void main()
{
    vec2 origin = vec2(x, y);
    vec2 size   = vec2(w, h);

    // Get the texture coordinate
    vec2 texCoord = vTexCoord;

    // Make its lower-left be at (0,0) and it's upper right be at (1,1)
    texCoord = (texCoord - origin) / size;

    // Apply the offest
    texCoord = texCoord + vec2(offsetx,offsety);

    // Apply the wrapping
    texCoord = fract(texCoord);

    // Convert back to texture atlas coordinates
    texCoord = (texCoord * size) + origin;

    gl_FragColor = texture2D(texture, texCoord) * vColor;
}

For most backgrounds, the animations are small and don't cause problems. But some backgrounds are large and their texture atlas is large. The floating point precision breaks down and the animation tears.

I don't have much mobile experience. How can I use large textures atlases for animations without the x/y coordinates breaking due to loss of floating point precision?

sentences: Is it possible to load shader files from a DLL? I have a few HLSL files that I'd like to add into a DLL project so that I don't have to keep adding these same shader files into a new Content project every time I want to use them. Is this possible, or does the XNA framework have to compile the shader files beforehand?

sentences:
How to stop sinking bodies in physics engine C++ I'm writing a rigid body simulation in C++, and have come across a problem when an object should come to rest on the ground.

Because gravity is being applied to it's velocity, the object starts sinking through the ground, or whatever else it's resting on.

To combat this, I am adjusting the position of the object, by moving it along the collision normal by the penetration depth. This has the drawback of making the object look like its vibrating, so it never comes to rest.

I read somewhere ages ago, that there is a way to counter this, by generating a force along the normal which will cancel out the force which is causing it to sink. A google search did not return any useful answers however. I suspect this is because I'm not asking the right question, but I don't know a more concise way to word it, so I'd appreciate if someone here has solved this, and could steer me in the right direction.

sentences: Conversion from matrix defining rotation and position to camera matrix I have a matrix that defines the rotation and translation of an object, relative to (0, 0, 0). Assuming that the identity matrix defines the camera to be at (0, 0, 0) pointing at (0, 0, 1), how would I go about constructing the view matrix from the world + rotation matrix?

sentences:
Authentication for LAN Multiplayer Games I'm working on the authentication scheme for a multiplayer game using only C++ and SLD2.

It's an RPG with a kind of complicated character-group/permadeath scheme, and world-instances are intended to be hosted by the players. So it matters that players have exclusive access to controlling their characters. I want players to be allowed to save the current state of a multiplayer world instance, close it, and come back to it later, or set up their own dedicated world instance for them and their friends to join/quit/rejoin at will. Absent player characters will simply not be present in the world until their creator returns

Servers will be hosted by player-computers. I'm not planning to set this up with a dedicated hole-punching or identity server, so players will just be playing with people who they intentionally connect to. I don't want to deal with encryption, so I'm not planning to require passwords to log in. I figure since there's no formal identity server and no encryption, passwords might do more harm than good. Player character names will change over the course of the game, and I don't necessarily mind if two players have the same username.

Here's my current authentication strategy:

When a player creates an account on his/her game instance, the account will just consist of a username and an automatically generated (random) UUID. The username and UUID will be stored in a SQLite file that the user can copy onto any computer with this game installed, and access their unique account. The username and a naively hashed UUID will be stored in a connection log on every server that the player connects to (so the server can assign them to the right character when they log back in). I recognize this means that programmers who know what they're doing will be able to hack each other's accounts, but I'm not convinced that I should really be concerned about that in the case of this particular game.

Here are my questions:

Is copying the file too much to expect from users who want to switch computers?
Can you guys think of any potential issues with this, other than what I've already pointed out?
Is there a better (common) way to achieve what I'm trying to do?

Thanks!

sentences:
XNA 4.0 keeping fonts/sprites without the use of a content project Note: The actual title of my question does not really reflect my problem but is actually one of the possible solutions to my problem. I couldn't find a proper way to express my question so feel free to propose a different title.

So I've recently moved to XNA 4.0 and I'm new to this whole content project idea.
I made a simple component based "engine" as a game library that I reuse over all my projects.

I implemented some basic debugging tools like a frame rate counter which used a SpriteFont, which was stored within the actual engine library.

Now that all the content was moved out of the library with XNA 4.0, I don't know where to put the SpriteFont and all other content used by the engine.

I'd rather avoid having to include both the content project and the engine library every time I start a new program, but is this my only option?

Or is there a way to include content within a library without resorting to content projects?

sentences:
HTML5 - Dynamic canvas grid for scrolling a big map I've been working on different scrolling algorithms for my JS-based game. My main problem is that I need to draw a huge map and also have it scroll smoothly. I've made a few attempts and while they're efficient (code and framerate wise) they still look jumpy and have to redraw constantly (though not each frame, it's still too much redrawing for my taste).

My latest idea is to implement some kind of 3x3 grid around the camera which will scroll with delay. What do I mean "with delay" ? well, if you have played Diablo II before, try to get a Maphack app and enable the Automap Screen Area feature: You see, Diablo II's map is made through a concept of "rooms" and those adjacent to the player in a specific area (usually screen size) are drawn offscreen to allow the scrolling.

I want to implement that in an orthogonal perspective (this is, 2D zelda-like), just like this:

The blue grid is made out of canvases around my camera's position. I know I can position them with the simple x+(floor(camera.x / tile_size) * tile_size) formula and with some offsets have them move around the camera like this:

THE PROBLEM arises when the drawn offscreen areas must remain in the same position to allow the scrolling. I've made a second image which illustrates this:

Notice how the colored tiles (or offscreen areas of screen size) remain in the same position UNTIL they get "too far" from the camera (the red dot). HOWEVER, while they have the same position, notice the Tile # (below each blue grid tile) change. I can't do it that way because it would require to redraw, and my goal is to avoid such redraw if the position hasn't changed.

This means however, that, taking in example blue tile 6 (located at 0,1 at the first animation frame) it changes to tile 5 and then to tile 1. While this is true, the idea is to keep it at tile 6, and only re-use the farthest canvases in the closest ones that need to be redrawn.

I'm illustrating my problem this way because my previous question didn't even get a single comment ( https://stackoverflow.com/questions/22185858/infinite-scroll-a-canvas-with-a-tiled-map-without-redrawing/22277681 ) so I had to work and answer my own question... something that doesn't even help either because someone else might have had a better idea, but nobody did, it seems.

That's why I'm asing here in gamedev, maybe here are some more skilled people who can have an idea or a shot at what I'm attempting to do. Also, please, I'm not interested in using other game or JS engines. If I were I wouldn't be asking this here as I know they implement tile scrolling and such, but this is both for my own learning and for creating a custom engine suited for my own game's needs.

Any help then, is really welcome.

Thanks in advance!
- DARKGuy

EDIT: Well alright, after struggling for like 2 days straight on this issue I finally managed to do it. I didn't want to do it with this kind of coords, so I wonder is there any way to optimize this code or to avoid it to do those increments and instead use a formula that would absolutely position them?

Here's the code I'm using (cv = canvas, cx = context("2d"), grid = 3x3 array of canvases. Also, I'm using a 32x32 "grid" just to see how it works. The size should be screen size (or region size, in my engine's case)):

for(ix = 0; ix < grid.length; ix++)
for(iy = 0; iy < grid.length; iy++) {
    cv = grid[iy][ix];
    if(cam.x - cv.x > 48)
        cv.x += 32 * 3;
    if(cam.x - cv.x < -48)
        cv.x -= 32 * 3;
    if(cam.y - cv.y > 48)
        cv.y += 32 * 3;
    if(cam.y - cv.y <- 48)
        cv.y -= 32 * 3;
    cx.fillStyle = cv.color;
    cx.fillRect(cv.x, cv.y, 32, 32);
}

sentences:
How can I detect handedness of normal maps in a shader? I've implemented normal maps into my game renderer using the formulas by Christian Schuler.

It works OK with most normal maps but some not so much since in some the Y component (green) is reversed. Apparently there is no real standard here and Maya does it one way and Max does it the other way.

I'd like to be able to look at a normal map's values and somehow determine which scheme is being used, if that's possible.

Also, though I have not actually seen any, some normal maps appear to use only two channels and the third channel is left blank and calculated at runtime. Ideally I would be able to detect those, too. I figure maybe the Z channel is all zeros? I am not sure that would save any space though so maybe it is some other scheme.

Seems like an obvious desire, but I don't see any references to this. but then, maybe it's not really possible.

sentences:
Max texture size Android : which settings for 2048x2048? I want to use a texture atlas of 2048 x 2048 in my game, and I would like to warn the users with a "too low" device to not download the game.

With a texture atlas of this size, what requirements should I say, on ANDROID ?

This image (source : https://stackoverflow.com/questions/10392027/recommended-limit-for-memory-management-in-cocos2d ) shows the requirements for IPHONE, what about for ANDROID : 512Mo minimum, with a 1GHz, is a correct requirement ?

Thanks for your answer

sentences:
Is it possible to create accelerated 3D graphics on Windows using one's own API? Say I want to come up with a way to replace what OpenGL and DirectX specifications do: communicate with GPU to get some functions done that help hardware-acceleration and rapid drawing of screen data. Is it possible to write some mock-up copy that can communicate with the GPU the same way that, say, an OpenGL specification could or DX to drive the same functions (or similar ones)?

What I'm saying is, somebody somehow made a way to communicate with a device driver to get acceleration and faster graphics, 3-D functions, etc. Is it possible one can create the same "inbetween" library or software that can do pretty much the same thing -- interact  with the device driver and drive OpenGL/DX similar operations or some other specification, but using my own self-written procedures to do so?

In other words, is it possible to replace OpenGL/DX code that communicates with a graphics driver with your own code that does the same thing, but is instead written by you?

I'm not asking about writing a device driver, but writing something that communicates with it, such as how DX/OpenGL does. OpenGL is 100% open-source and you can see how every single function/operation/line of code works when you link with it and use a debugger, etc.

We know OpenGL usually doesn't directly interact with a GPU most of the time, and although it does sometimes, the identic function can easily be replaced by debugging.

sentences: Creating map files for a 3D game I've created plenty of 2D games and now that I've gotten my hands dirty working with 3D in opengl I want to start a game. The issue is I don't know how I can store all the map data. Not only the terrain but the textures and objects in the world, lighting, what's intractable etc. it seems that it'll get way to big if I don't have an efficient system for storing and loading maps. So what methods or articles can you guys suggest on this?

sentences:
Is SDL2 alone capable of dynamic (or deferred) lighting? I'm talking about JUST SDL2, not OpenGL or DirectX.
Would drawing deferred lighting bulk the CPU up and how would it be done?

sentences:
Collision detection with curves I'm working on a 2D game in which I would like to do collision detection between a moving circle and some kind of static curves (maybe Bezier curves).

Currently my game features only straight lines as the static geometry and I'm doing the collision detection by calculating the distance from the circle to the lines, and projecting the circle out of the line in case the distance is less than the circles radius.

How can I do this kind of collision detection in a relative straightforward way? I know for instance that Box2D features collision detection with Bezier curves. I don't need a full featured collision detection mechanism, just something that can do what I've described.

UPDATE: Thanks a lot for the great answers! I'll have to read up on Bezier curves to fully understand the method you've described. Then I'll get back to you.

sentences:
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:
How to use GLM Simd using GLM version 0.9.8.2? I am new user for GLM, can somebody guide me how to use GLM SIMD using its version 0.9.8.2.

According to its Manual using #define GLM_FORCE_SSE2

For example, if I write:

#define GLM_FORCE_SSE2

#ifdef GLM_FORCE_SSE2

glm::vec3 v(1.0f);

#endif

I am unable to notice any difference if I write this now:

glm::vec3 v(1.0f);

unlike older version of GLM where I can use different function like

#include <GLM\GTX\simd_mat4.hpp>
glm::detail::fvec4SIMD v(1.0f); //for simd
glm::vec3 v(1.0f); //for non simd

but with version 0.9.8.2 I am confused.

sentences:
How to adapt my mobile game for different aspect ratios? Before I start, I'd like to note that I work in the Unity Engine, but the basic theoretical stuff should be similar just about anywhere.

It's not really hard to get the game's camera/World view or UI to scale to many types of devices with different pixel counts as long as they have the same aspect ratio. But devices in general, and especially mobile phones, have all sorts of variables, aspect ratios can be anywhere from 16:9 to 20:9, and there are all sorts of different types of notches too. For this question I'm primarily going to ask about the aspect ratio and not touch on notches for now to stay on topic, but if you could explain how I can handle notches, that would be a good bonus.

So, how do I make a game for a mobile device, that can be played in portrait and horizontal mode, on anything from small 16:9 screens like the Samsung Galaxy S5, to larger 19:9 aspect ratio (A notch) in the Google Pixel 4?

Unfortunately due to IP restrictions, I can't show art, and I can't reveal the core mechanic of the game. but I have created a general mock up of what the ideal world/UI scaling would look like:

The UI needs to be able to scale to the edges of the display like any other game. But the edges of the world need to be the edges of the screen (There needs to be walls that appear at on all 4 edges of the screen), however because the game is physics based, the walls can't actually move else it would cause inconsistencies between in the game from device to device.

I know what I'm talking about here is primarily theoretical, but as someone who doesn't know much about aspect ratios (or notches), how can I ensure my game works consistently on this range of devices?

sentences:
why is my OpenGL texture transparent? I have a terrain in OpenGL, and two textures which I am combining using GLSL mix() function.
Here are the textures I am using.

Now I am able to combine and mix these two textures, but for some reason, when I render the textures on the terrain, the terrain becomes transparent.
I render the LHS texture first, and then I render the RHS texture with alpha channel, I don't understand why it is transparent.

Here is an interesting fact, in the screenshot, you can see the result of the terrain when rendered on Nvidia GPU, when I render the same thing on interl HD 3k, I get different result.
This result is how it is supposed to be, nothing is transparent in this following screenshot.

Here is my fragment shader code..

void main()
{
vec4 dryTex   = texture( u_dryTex, vs_texCoord *1 );
vec4 grassTex = texture( u_grassTex, vs_texCoord *1 );
vec4 texColor1= mix(dryTex, grassTex , grassTex.a);
out_fragColor = texColor1;
}

sentences: How to adjust GUI to screen resolution ? I've created a GUI for my XNA game and now I'm stuck with a problem. My GUI element positions are designed for a max resolution of 1920x1080, and if I try changing it to 640x480 they disappear from the screen. What I can change to keep them there?

sentences: Detect if a sprite has left the camera in libgdx? Is there a method to know if a sprite has left the camera of the stage? or I have to do my operations? :P

sentences:
Platform for DS/Gameboy Dev - Managed Memory, Tools, and Unit Testing I'm interested in dabbling in Nintendo DS, 3DS, or GBA development. I would like to know what my (legal) options for development tools and IDEs are.

In particular, I would not consider moving in this direction unless I can find:

A programming language that has managed memory (garbage collection)
A unit testing tool akin to JUnit, NUnit, etc. for unit tests

I would also prefer if other tools exist, like code-coverage, etc. for that platform. But the main thing is managed memory and unit testing.

What options are out there?

sentences:
Is Scaleform/Flash used in console games for non-UI, game elements? I work for Konami as a Flash developer, and got sent some code for a puzzle mini-game from a new, yet-to-be-released Silent Hill game for PS3/Xbox 360.  It was a windows executable, but it was made in Flash, and I saw some GFX (Scaleform) libraries in the source.  I was very surprised by this, as I thought the extent of Flash's reach into console games was simply for UI.  Granted, this was an essentially 2d, UI-centric puzzle minigame, but nonetheless, this was a gameplay useage of Flash/Scaleform in a "next-gen" console title.

My question is, how prevalent is this?  I really want to get into console programming, and if this is something that appears elsewhere, maybe I can apply my Flash/Actionscript skills to getting a job working on console titles.  Anyone have any thoughts or experiences with this?

Thanks!

sentences:
Keeping over-shoulder camera view consistent at different screen resolutions I have a player GameObject.
There is a character attached to it and a camera (both are children of the player GameObject).

The over-shoulder camera is positioned nicely.
The player should appear on the left edge of the screen.

Now when I change the viewport / screen size and make it larger, the camera doesn't keep it's view. I can see in the Inspector that the camera's view changes.

I don't understand in which way it does that.

What would I need to do to keep the player always on the left edge, no matter what the screen resolution is?

Thank you.

The upper image shows how I have planned / developed the camera view. This is what the camera view should look like.
The lower image shows how the camera changes at larger viewport.

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:
RaycastHit.point to local coordinates I'm trying to detect where approximately an enemy in my game has been hit.
I have added a box collider with a height of 1.8 metres to the enemy.

When the player then shoots, I use a RaycastHit to check if the enemy has been hit.
This works fine.

My code is this:

GameObject nHit = _LaserScript.hit.collider.gameObject;

if (nHit != null)
{
    Vector3 nHP = _LaserScript.hit.point; //"hit" is a RaycastHit
    Debug.Log("hit at x: " + nHP.x.ToString() + ", y: " + nHP.y.ToString() + ", z: " + nHP.z.ToString() + "\n");
}

I can relatively easy determine if the enemy has been hit at the head by checking

if (nHP.y > 1.5f)
{
    //headshot detected
}

However, I'm not sure if these coords have to be converted to "local" coordinates.

I tried to determine if I shot the enemy at the left side of his body or on the right side.

To my surprise, the "x" coord of the raycast was always around 1.2, and I have no idea why. I was expecting the x value of the hit to be somewhat between 0 and 0.5f as the collider is not wider than 0.5f.

Basically, I would like a hit at the left "border" of the enemy to have an x value between 0 and 0.1f.

Do I have to convert these hit coordinates (of which the docs say they're world coords) to "local" coords?

sentences:
Is UI anti-aliasing broken in Unity 5.6? I have a project that was started in Unity 5.5. When I open it in 5.6, most 2D graphics look like they're not anti-aliased: left is 5.6, right is 5.5

What you see there are UI Images in a Canvas. The weird thing is that the red cross image looks OK, but the card with the red outline doesn't.

I've tried setting mipmaps to true, and Anti-aliasing set to 8x or 4x, with no difference. I hoped this was only in the editor, but a build shows the same jaggies.

Has some setting changed in 5.6 that I can edit so my graphics look anti-aliased again, or is this a bug?

sentences: What counts as a "game studio" I am registering a game on a site so that I can sell it, and it needs me to put in my game studio.  I work on my games in c++ and I dont't have a team, or a company.  Can I throw out a name and be done with it? or do I need to have a registered company?

sentences: How can I create a pixellated, limited-palette appearance in modern OpenGL? I wanna get some old art style (256 color, dithering, etc) in modern OpenGL in an effective way. Maybe using a low resolution (320x240) rendered at a bigger space so that the pixels looks "bigger?" I'd just like to fake this old style on modern GPUs.

sentences:
need to create formulas for stat, level progression etc. What tools will help the not-mathematically-literate? I want to create some of the fundamental guideline formulas for a game I am working on. I am following on from sirlin's advice in that I am starting with some assumptions and working back from there.

So let's say that I want to have the player do an average of 1000hp damage at level 100 and 10 at level one. Is there a tool that I could use to draw this (a low exponential curve) and it would spit out a formula based on the curve?

There are some similar questions on here but none that I can find with any advice on the specifics of making the formulas for these progress curves.

thanks

sentences:
Sever Structure for a Turn Based Game (Chess) I am working on a Turn-based Game (Chess)

I have done the client part and single player mode so AI is no problem here. But the only problem is now I want to make my project multiplayer. I have done the part to setting and retrieving high-scores and other Informations. Now I am stuck on server structure since I got no idea on which server to use:

My game Multiplayer structure:

User logs in
Can choose between 3 rooms
each room got 10 levels (rooms) inside
game will automatically send each player to a curtain room based on their rank
players will be assigned to each other and start the game
each player got 30 secs to make a move otherwise they will lose their turn
At the end scores will be sent to the DB

Options suggested by friends:

SmartFox
Google App Engine

Why not using mentioned servers:

some many functions which I will not need (Performance)
MY project is a small project (self study no need ready servers)
Need to do it by myself for educational purposes

Program Languages used:

Clint-> C#
Server -> php, SQL

Questions:

is HTTP good enough to handle 500-1000 users at a time?
can handle this kind of games with WWW and WWWFORM in Unity2D?
if no any options?

Thanks

sentences:
How is a splash screen that is disposed upon user input meant to be implemented? I'm going through Gustavo Steigert's tutorials on libgdx, but I have a feeling that this is more of a design question, rather than specifically regarding libgdx. My question is regarding the splash screen. I can implement what he has in that tutorial without any errors, but I want to add a little extra. In every game I've ever played, the splash screen goes away when the user left-clicks or presses esc, so I'm trying to add that (strangely, I can't find any tutorials with splashes like that). So, I have this method in my SplashScreen class:

public boolean handleInput() {
    if (Gdx.input.justTouched()) {
        game.setScreen(new MenuScreen(game));
        return true;
    } else {
        return false;
    }
}

At first, I tried to make that method return void and simply call splash.handleInput() in the render() method of the main Game class, Tyrian. However, that doesn't work, because once the splash screen has been moved on from, handleInput() will still be called on every render(), and the game crashes if the user clicks a menu button. So, I made handleInput() return a boolean and used this code in render():

if (onSplash) {
    if (splash.handleInput()) {
        onSplash = false;
    }
}

onSplash is a boolean inside the Tyrian class that is true by default.

Something else odd: when using the void version of handleInput(), the game will only crash if a button on the menu (the menu screen is the next screen) is pressed., and not if the screen is pressed. I am worried that the splash screen is never being disposed of (though my current solution does not seem to show that), because I can see from logging messages being printed to the console that the menu screen is being created upon every screen click, which is what handleInput() does. Also, if I put an else to that code above, with splash.dispose(); as a result, the game will crash.

This is such a common action in games, I would be surprised if there was not a common and cleaner accepted way of implementing it that I have missed.

EDIT: I have changed the handleInput() back to void and have used the instanceof keyword in my main game file. It's a cleaner solution, but I'm not sure if it's the best (it's an extra check on every render!).

SplashScreen.java

public void handleInput() {
    if (Gdx.input.justTouched()  ||  Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
        game.setScreen(new MenuScreen(game));
    }
}

Tyrian.java

if (this.getScreen() instanceof SplashScreen) {
    splash.handleInput();
}

sentences:
Handling parametric and reusable sprite animations I'd like to create a simple logic that handles sprite animations in a way that they can be easily reproduced and parametrized.
As example, I want to perform some basics animation like transitions and rotations and I like to have these animations receiving parameters as x, y and angle so that I can just attach the animation to gameObjects and set the parameters to obtain the needed animation.
I'm really new to Unity and I wonder if Controller Animators can handle this behaviour or if I have to go through animations off the Transform component properties. Is there any other way I'm not aware of to parametrize animations?

sentences:
In Unity, I'm trying to understand what code gets generated when I attach scripts to GameObjects I'm trying to observe any file changes that happen when I attach a script to a GameObject.
I am able to attach a script to a GameObject, and verify that it was attached by looking at the console log. (In my case I attached MainPlayer to some random GameObject like WeaponCamera.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MainPlayer : MonoBehaviour
{
    public string myName;
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("I am alive and my name is " + myName);
    }

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

    }
}

However, I don't see any actual code change (eg: line additions) to any files in my unity project (using git status or git diff). I would think that something would get updated in my repo, unless I'm misunderstanding how attachment works? For example, if someone else were to copy my repo and try it on their computer, shouldn't they have the attachment I just made?

sentences:
2D planetary system simulation- how to improve gravity model? How to control simulation speed? I'm making a simple planetary system simulator. I've run into some problems with physics model and simulation speed and I'd like to learn how to fix them.

My main class is Body:

public abstract class Body {

private double x, y; // position
private double w, h; // dimensions for drawing
private double vx = 0, vy = 0; //velocities along x, y axes
private double ax = 0, ay = 0; // accelerations along x, y axes
private double mass = 1;        //default = 1
private boolean stationary = false; //stationary body is centered during simulation

...
}

Then, in this class, the method I'm using to calculate the force of gravity. I decided to have another body as a parameter, so when I call the method it updates both of the bodies. If that's not the best way to do it, please tell me. I also know that using "this" inside a public method is not necessary, but it makes the code more clear for me.

public void interact(Body b2) {
    double x = calculateDistX(b2);
    double y = calculateDistY(b2);
    double r = calculateDistance(x, y);

    double f = (this.getMass() * b2.getMass()) / Math.pow(r, 2); // gravitational
                                                                    // force

    double fx = f * (x / r); // x component of the force - f times cosine of
                                // the angle
    double fy = f * (y / r); // x component of the force - f times sine of
                                // the angle

    /* calculate accelerations for both bodies, set vector orientation */
    if (b2.getX() > this.getX()) {
        this.setAx(fx / this.getMass());
        b2.setAx(-fx / b2.getMass());
    } else {
        this.setAx(-fx / this.getMass());
        b2.setAx(fx / b2.getMass());
    }

    if (b2.getY() > this.getY()) {
        this.setAy(fy / this.getMass());
        b2.setAy(-fy / b2.getMass());
    } else {
        this.setAy(-fy / this.getMass());
        b2.setAy(fy / b2.getMass());
    }

    /* calculate velocities for both bodies */
    this.setVx(this.getVx() + this.getAx());
    this.setVy(this.getVy() + this.getAy());

    b2.setVx(b2.getVx() + b2.getAx());
    b2.setVy(b2.getVy() + b2.getAy());

    /* calculate positions for both bodies */
    this.setX(this.getX() + this.getVx());
    this.setY(this.getY() + this.getVy());

    b2.setX(b2.getX() + b2.getVx());
    b2.setY(b2.getY() + b2.getVy());
}

Now, when I run the simulation it tends to blow up when bodies get too close. I will try to implement the Runge-Kutta or Verlet algorithm in the interact() method to change this, but how do I implement timestep? Should there be some timer that counts time and is used to calculate derivatives? Right now I'm using a Timer in my drawing method:

class DrawingPanel extends JPanel {
DrawingPanel() {
    int step = 15; // milliseconds
    ActionListener taskPerformer = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            repaint();
            }
    };
    new Timer(step, taskPerformer).start();
    Body b0 = new Star();
    addBody(b0);
    Body b1 = new Planet();
    addBody(b1);
    Body b2 = new Planet();
    addBody(b2);
}

List<Body> bodies = new ArrayList<>();

@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    bodies.get(2).interact(bodies.get(1));
    bodies.get(0).interact(bodies.get(1));
    bodies.get(0).interact(bodies.get(2));

    for (Body b : bodies) {
        f.draw(b);
    }
}
public void addBody(Body b) {
    bodies.add(b);
}
}

I feel like calling the interact() method in my paintComponent() method is not the right solution, but I don't know how to do it. Also, how to make the simulation slower? Right now changing the "step" to bigger value slows the simulation down, but it ends up being just low FPS, because it's just the separation between two drawing events. How should I implement the timer to control the simulation and preserve its smoothness?

sentences:
How can I play an animation in response to an event? I've written a script to play an animation, but it starts immediately as my level loads. Instead, I want it only to start when triggered by some event or after a given timeout.

How can I do this?

sentences:
How can I make a 2D Sprite bleed/glow colors at a particular spot? I am trying to make a gauge glow over the color it is at.  For example, in the image below, when the needle is pointing at the red, the red is glowing.  When it is pointing at the green, then the green is glowing.  I want to replicate this:

My gauge will be on a gradient, so I cannot just color a particular segment.  (There are no segments.)  I am working with 2D sprites.  I have looked into the Bloom asset as suggested here, but I have been met with nothing but failures.  (Probably because that guide is for 3D.)

How can I take the color at a particular position and make it bleed/glow like in the images above?

sentences:
SerializedProperty to UnityEvent in a Custom Editor I am making a Custom Editor for a type that includes a UnityEvent property.

I'm currently facing an issue in converting a SerializedProperty to get that UnityEvent.

Here is how I declare the event in the type I want to edit with this custom editor:

public class SomeComponent : MonoBehaviour {

    public UnityEngine.Events.UnityEvent EventToAdd;

    //...
}

And this is my Editor script

[CustomEditor(typeof(SomeComponent))]
public SomeComponentEditor : Editor {

    private SerializedProperty _Events;
    private void OnEnable()
    {
        _Events = serializedObject.FindProperty("EventToAdd");
    }

    public override void OnInspectorGUI()
    {
        TwitchTVGui TGUI = (TwitchTVGui)target;

        this.serializedObject.Update();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("EventToAdd"), true);

        this.serializedObject.ApplyModifiedProperties();
    }
}

And then I need to get the UnityEvent out of the serializedObject _Events somehow

sentences:
JSON deserializing 'nested' Array Greetings!

I'm working on a class that loads and parses .json files and returns information from the loaded .json, but I have problems reading the nested arrays of my .json files.

Turning the serialized object public and looking at the Inspector, the 'Choises' array is not being read at all. It contains four objects, each contain a string and an integer correspondingly.

using SimpleJSON;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

public class JsonParser : MonoBehaviour
{
    private string loadedJson;
    public StoryData storyData;

    [Serializable]
    public struct choice
    {
        public string choiceText;
        public int choicePointer;
    }

    [Serializable]
    public struct storyImage
    {
        public string imagePath;
    }

    [Serializable]
    public struct storyText
    {
        public string text;
    }

    [Serializable]
    public struct placeholderStory
    {
        public string storyText;
        public string storyImage;
        public List<choice> choises;
    }

    [Serializable]
    public struct StoryData
    {
        public placeholderStory[] placeholderStory;
    }

    public void LoadJsonFile(string filename)
    {
        loadedJson = File.ReadAllText(Application.dataPath + filename);
        storyData = JsonUtility.FromJson<StoryData>(loadedJson);
    }

    public string GetChoiceText(int storyPosition, int choiceIndex)
    {
        string choiceString = storyData.placeholderStory[storyPosition].choises[choiceIndex].choiceText;
        Debug.Log(choiceString);
        return choiceString;
    }

    public string GetStoryText(int storyPosition)
    {
        string storyString = storyData.placeholderStory[storyPosition].storyText;
        return storyString;
    }

    public string GetStoryImage(int storyPosition)
    {
        string imageString = storyData.placeholderStory[storyPosition].storyImage;
        return imageString;
    }
}

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

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

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

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

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

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

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

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

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

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

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

sentences:
Creating colour spectrum by light flux values I am using radiosity method to compute the inter-reflected light within a room. The room is gridded into small patches and the light flux in lumen is calculated for each. This part is done. Now I want to change the colour of each patch so that the room surfaces show a continuous colour banding contours like this image, but have no clue how to this.

Update:

Here is a sample data for a room surface. The data is in this format:
(x, y): value

sentences:
What is the optimal way to store customisation options? I am trying to understand the most optimal way of storing customisation options within a game, or to be precise, to store all the possible customisation options for multiple different objects.

For example, assuming we are making a game about tanks and their customisation, there will be several available tanks that the player can choose from and each of the tanks will have multiple different parts available; some parts will be shared across a few tanks, while some will be specific to a tank.

I was thinking about a relational database, but I do not know web development, so I was initially thinking to have a table with all the tanks and a table with all the parts, then create a linking table between the two and load the available parts based on the chosen tank; but I'm not sure if that would work, or if it would be the most optimal way of doing this.

I tried looking for an answer, but I'm not getting any good results. People mention using files, and then parsing the data, but I'm not sure how that will work on a large scale; multiple tanks with hundreds of customisation options.

What is the most optimal way to to do this? If at all relevant, I am using Unity 5.

sentences:
Orthographic camera and z-axis in 3D isometric view game I'm working  on a game in Away3d. I'm using an orthographic camera and I'm attempting to simulate an isometric view (the camera has a 37° angle and the y-axis is up/down, x-axis is left/right, and z-axis is orthographic).

I hit a snag in understanding how to handle the z-axis of the NPC's relative to the player so that, for example, when the player is below an NPC in Y coordinates, it doesn't appear to be "under" the NPC, but "besides/in front" the NPC, as currently all the 3D models in this scene are Z-axis coordinate 0.

My common sense says that there should be a relation in the sense that if the Y axis coordinates of the NPC is lower than the Y axis coordinates of the player, then the z-axis coordinates should update following an allegory is so that the apparent view of the NPC relative to the player is that the NPC is "behind" the player. But as I said, because all the z-axis are zero for all the models, the players' apparent position is "under" the NPC, as opposed to "in front" of the NPC.

sentences:
How to achieve this style of view in XNA? I would like to use a Perspective projection to create the following effect in XNA:

Cubes are simply made up of 8 vertices and drawn using DrawUserIndexedPrimitives().

Any extra suggestions, are also welcome.

sentences:
6DOF camera: inverted yaw and roll when orientation changes Whenever I change the orientation of the camera, yaw and roll become inverted (or correct); the strafing, movement and pitch do remain correct however.

Can you tell what is causing this and how to fix it ?

private Vector3 _cameraOrientation;
private Vector3 _cameraPosition;
private Matrix _matrixProjection;
private Matrix _matrixView;

protected override void Update(GameTime gameTime)
{
    var state = GamePad.GetState(PlayerIndex.One);
    if (state.Buttons.Back == ButtonState.Pressed ||
        Keyboard.GetState().IsKeyDown(Keys.Escape))
        Exit();
    if (state.Buttons.Start == ButtonState.Pressed) _cameraPosition = _cameraOrientation = Vector3.Zero;

    var right = state.ThumbSticks.Right;
    var left = state.ThumbSticks.Left;

    // get position/orientation deltas from gamepad
    var position = new Vector3
    {
        X = left.X,
        Y = state.Buttons.A == ButtonState.Pressed ? -1 : state.Buttons.Y == ButtonState.Pressed ? 1 : 0,
        Z = -left.Y,
    };
    var orientation = new Vector3
    {
        X = -right.Y,
        Y = -right.X,
        Z = state.Buttons.X == ButtonState.Pressed ? -1 : state.Buttons.B == ButtonState.Pressed ? 1 : 0
    };

    // update position according orientation
    _cameraOrientation += orientation;
    var cameraReference = Vector3.Forward;
    var cameraRotation =
        Matrix.CreateRotationX(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.X))) *
        Matrix.CreateRotationY(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.Y))) *
        Matrix.CreateRotationZ(MathHelper.WrapAngle(MathHelper.ToRadians(_cameraOrientation.Z)));
    _cameraPosition += Vector3.Transform(position, cameraRotation);

    // update matrices
    var cameraPosition = _cameraPosition;
    var cameraTransformedReference = Vector3.Transform(cameraReference, cameraRotation);
    var cameraTarget = cameraPosition + cameraTransformedReference;
    var cameraUpVector = Vector3.Transform(Vector3.Up, cameraRotation); // Vector3.Up;
    _matrixView = Matrix.CreateLookAt(cameraPosition, cameraTarget, cameraUpVector);
    _matrixProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45),
        _graphics.GraphicsDevice.Viewport.AspectRatio, 0.01f, 100000f);

    base.Update(gameTime);
}

sentences:
RPG Equipped Item System I'm making a 2d rpg with libgdx and java. I have an Inventory class with an Array of Items, and now I want to be able to equip items onto the player. Would it be more managable to do

have every item have an "equipped" boolean flag
have an "equipped" array in the player class
have individual equipped fields in player class, e.g.

  private Item equippedWeapon;
  private Item equippedArmor;
  public void equipWeapon(Item weapon){
   equippedWeapon = weapon; }

Or just another way completely? Thanks.

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:
Using peer to peer for prediction in a client-server network model By implementing peer to peer connections between clients in a client-server network model I should be able to increase the prediction fidelity as this theoretically would provide the client with other clients commands for a given tick earlier than it would receive the servers game states for the same tick.

One problem I can think of is that clients would have to be able to interpret other clients commands (usually they just have to listen for game states, not commands). This would be a little bit like an RTS model I guess. This should be solvable without any negative effects on gameplay.

Another problem is that clients could cheat by sending fake data to their peers when it is beneficial to them. This can be mitigated by having the client aware of the real commands through the server and have them immediately stop listening to any clients that fed it false data. This should therefore be solvable with different degrees of negative effect on gameplay depending on the design of the game and how impactful a few ticks of wrong command info is at the worst possible moment.

(Unfortunately, you can't have the server punish any client because it has no idea who's lying, it can only help clients themselves understand if they are being lied to by providing them with correct data).

Am I correct in assuming that this would increase prediction fidelity or is there something I'm not accounting for? The idea is that this allows the client access to some information about the other clients faster than in a traditional non peer to peer model where it would base predictions solely on its own commands.

sentences:
How to make a list containing both strings and functions in c#? Whilst it doesn't neccesarily need to be a list, I just need a variable that I can index, and arrive at either a string or a function. I've tried using List and whilst this works for strings, when I try to store a function I get an error message along the lines of "cannot convert from void to object".

Does anyone know how this might be done?

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:
Why does rendering a gradiented shape leave gaps? Sometimes when I am drawing objects that aren't 'linear' (e.g. rounded edges, circles, ellipses, diagonal lines, etc) I this weird effect of some pixels at certain points not getting drawn.

It's easier to show than explain: This image is created by the code below it. It's a block fading from blue to black. The same effect appears when only using one color. (Though it's otherwise obviously equivalent to just drawing a filled rectangle.)

float b = 100;
int steps = 100;
int thickness = 1;
int basex = 10;
int basey = 10;
int lenx = 200;
int leny = 200;
for(int idx = 0; idx < steps; idx++) {
    al_draw_rounded_rectangle(
            basex + thickness * (steps - idx), basey + thickness * (steps - idx),
            basex + lenx - thickness * (steps - idx), basey + leny - thickness * (steps - idx),
            RII, RII,
            al_map_rgba(0, 0, b - idx * (b / steps), alpha(0.0)),
            thickness);
}

Is there a term for this phenomenon? How do I prevent it from happening?

sentences:
How to balance hybrid classes? In RPGs sometimes there will be hybrid-classed characters, ie, characters that can fill the roles of multiple characters. Sometimes they're really weak and useless because despite filling out many roles they're just not good enough to do it, and othertimes they're extremely overpowered because they can do the job of characters with a single dedicated role just as well, while still being able to do other jobs.

This often leads to either using those characters all the time, or avoiding using those characters because they're dead weight. Even just "fine tuning the numbers" doesn't seem to work because the weaker they get in regards to a dedicated role character the less useful they are overall, and then when buffing their numbers to make them more capable of holding their own makes a small reduction in power compared to a dedicated role character a minor tradeoff, because they're doing the roles of two characters in one spot.

Is there a way to actually make hybrid-role characters useful while still making players want to carry single-role characters too?

sentences: What is physically correct lighting all about? I can't find anything comprehensive using Google. I'm wondering what the core concepts of physically correct lighting are, and where I could read up on it. What's physically correct lighting all about? Is Phong illumination generally physically incorrect?

sentences:
How a 3D game map is stored and handled I'm a programmer but have not yet developed any games.

I have played various 3D games and always wondered how the Map of the field is stored and rendered.

I know some acceleration card is a necessary hardware, but how exactly the view is changed without even a single flicker on the screen.

Do you have any online material to help me understand this.

Thanks

sentences:
How were old mobile games (J2ME/MIDP/JAR) monetized? (2000s era) When I was in school, me and my friends were just exchanging *.jar files via IrDA and Bluetooth.
However now I realize, that old phone games were of high quality and whole studios stood behind them.
What was the "official" way of getting a game to your old mobile phone? How did mobile game developers get their revenue those days?

sentences:
DirectoryNotFoundException for an existing file path (continued) DirectoryNotFoundException for an existing file path on Unity startup
I did what TehMightyPotato suggested (see the link above), and managed to solve the issue. However, the next day when i opened up the same project, Unity was unable to find the .asmdef files. It seems like rearranging the .asmdef files deleted them as well.
What can i do to solve this problem?

sentences:
In DirectX 11, batching primitives for performance, how does this actually work? I don't seem to be able to understand this. Microsoft says that one of the possible optimizations of for a Direct3D 11 if to batch primitives draw calls. For example in order to draw say 300 triangles calling the Draw method each time, you would instead pack and Draw them all at once.

The thing I don't get is how you would actually draw them in different locations and everything, because for example, I need one different world transformation matrix for each one. The only thing that comes to my mind is to calculate everything on the CPU and set the values for each vertex manually, however this approach doesn't seem like it would be a very good code optimization to me.

I feel like I'm missing something but I can't find the answer anywhere. The question is: how would you be able to pack things in a draw call without needing a render state change, and still get objects in different locations?

Note that I am not asking for pieces of code here, I'm primarily looking for a theorical answer to this.

sentences:
Game Modeling good practice regarding quads and ngons I'm asking myself if using quads is really the better practice instead of using ngons (for flat surfaces!) when it comes to game modeling.

I often read this and saw models that look like this (96 tris!).

But I can't understand why this should be preferred instead of this model using ngons (60 tris!)

Are there reasons why the quad variant with more tris should be preferred also for a final game model (that also does not use displacement mapping for example) or is the n-gon actually preferred in such cases because of the lower triangle count?

Because it came up in the discussion: This should be of course only valid for static objects that do not deform, my question came up because I saw that models which are most likely not supposed to deform are modelled using the additional quads and I'm wondering if there's really any benefit of doing it (I just see the disadvantage of additional triangles so far).

sentences: iPhone app activated before associated in-app-purchase activated? I recently submitted my iPhone game for review.  I also approved the in-app-purchase for my game (and provided the in-app-purchase screenshot).  It's a few days later and the app status has been updated from "waiting for review" to "in review"... while the in-app-purchase status is still "waiting for review".  Could the app go live in the store before the in-app-purchase?  If so what happens when the user tries to make the in-app-purchase?  Anything the developer can do to remedy this?

sentences:
How to avoid units with different destinations blocking each other in corridors? I'm making a roguelike in which enemies wander around the map until they're detected by the player. They each have random destinations, so sometimes their destinations conflict and they block each other in corridors.

Enemies can't go through each other

Is there any approach that can avoid this issue? Only idea I have right now would be to detect which ones are at the end of the "trafic block" and made them change destination until their path is free... But maybe there's a better design solution for this problem?

sentences: Build-time GLSL syntax validation Is there a way to validate GLSL syntax build-time instead of run-time? My application takes a long time to start and I want to know at the earliest possible stage that my shaders are ok. I'm using Visual Studio/Xcode. The solution probably involves running a tool as a part of build process, but I'm looking for such a tool.

sentences:
Calculating buoyancy force I am trying to simulate a buoyancy force for objects submerged/suspended in a fluid in a 2D environment.

According to Game Physics: Engine Development: How to Build a Robust Commercial-Grade Physics Engine for Your Game by Ian Millington (Chapter 6, page 99) (ISBN 987-0-12-381976-5) AND the wikipedia article on buoyancy the actual calculation is: PVG where P is the density of the fluid. V is the submerged volume (area) and G is the gravitational acceleration (0.00980665 Kilo-Newtons for Earth, but is variable in the code) and always acts in the opposite direction to gravity.

The code I have, below, produces a clean-looking result, but obviously the density of either the object in question or the fluid is not effecting the calculation, only the mass. If I insert the density of the fluid, say, water, at 1000.0 kg/m^3 the whole system explodes.

Is it something simple that I missed or did I screw up entirely?

The code I have so far:

//area_ratio is a scalar ratio of the area inside the defined fluid area (Volume submerged) and the entire object's bounding area (entire volume).
//area_ratio is equal to a value in the interval [0.0, 1.0]
//gravity is a force vector in Kilo-Newtons.
Vector2D current_weight(mass * area_ratio * gravity);

//current_area = The area inside the fluid. (Volume submerged)
Vector2D buoyancy(gravity.Normalize() * -current_weight * current_area);

//Forces and Impulses are automatically converted to Netwons by multiplying the values passed in by 1000.0
object->ApplyImpulse(buoyancy);

sentences:
issue with ray/physics collision detection All,

I am trying to pick object using ray collision and bullet physics

I am initializing my projection and view matrix only once, here is the code

projectionMatrix = glm::perspective(90.0f, 4.0f / 3.0f, 0.1f, 100.0f);

float horizontalAngle = 3.14f;
float verticalAngle =0.0f;/// problems here

glm::vec3 direction(
    cos(verticalAngle) * sin(horizontalAngle),
    sin(verticalAngle),
    cos(verticalAngle) * cos(horizontalAngle)
);

glm::vec3 position = glm::vec3( 0.0, 10.0, 32.0 );

glm::vec3 right = glm::vec3(
    sin(horizontalAngle - 3.14f/2.0 ),
    0,
    cos(horizontalAngle - 3.14f/2.0 )
);

// Up vector
glm::vec3 up = glm::cross( right, direction );

viewMatrix =  glm::lookAt(
                            position,           // Camera is here
                            position+direction, // and looks here : at the same position, plus "direction"
                            up                  // Head is up (set to 0,-1,0 to look upside-down)
                       );

See below screenshot with actual object in the world

when I click on red area - it does not pick up object, but when i am click on green one - it does.

SMALL DETAIL:
I've used this tutorial http://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-a-physics-library. While I've applying constant change to view and projection matrix throug my mouse move and keys - detection work perfect, but once I've stooping doing it - it does not work.

Can someone help me out what I am doing wrong ?

sentences:
Unity detecting edge of mesh or end of mesh I'm trying to create procedurally generated tiles and I've reached a point where I need to figure out the boundaries of the mesh or the outer vertices of the mesh.

    RaycastHit hit;
    if (Physics.Raycast(bound[ i ].v2, Vector3.forward, out hit)) {
    if (hit.distance > 2) {

I've tried raycasting all the vertices, but still can't get the vertices of the edge. The mesh does have a collider. any help on how i would go about this is appreciated, Thanks.

sentences:
Multiplayer game principles I am developing game using libGDX libraries . I want to create multiplayer mode , where several players can play at the same time in the same room , each player can create his own room and other players can connect to the room they want , I thought a mechanism like this
In this mechanism the left client is the one who has created the room and other 3 clients are connected to that room . The game physics runs on the room creator and sends the positions of physical bodies to the server , server sends that positions to other clients , other 3 clients send their input to the server and the server sends that inputs to the room creator and that inputs influence on the physic. But I think this cycle is not good because if the device of room creator runs slow then the game will start lagging and the fps will drop down and other clients will see the game with the same fps which is in the creators device . So can anyone offer me another mechanism for multiplayer game? I am using Node.js for server-side program and Java for client side .

sentences:
Is any data structure more efficient than quad-tree for storing and querying points that lay within an OBB? Is there any method more effective than quad-trees for storing and searching sets of points that are not spread uniformly on the plane?

I need to be able to add, remove and search for points that are within a specified range.

I am currently testing with quad-tree but it seems the results are less than optimal when the points are not spread uniformly enough.

The points are mostly clustered in specific areas:

sentences: Unity3d : Access the OnClick parameters of Button in a script I have a button and I have attached another script "PlaySound" for this button, which plays audio on button click. As soon as the audio gets completed, I want to stop the animation which I am triggering here in OnClick of Button. How do I access the Ellen gameObject and 0 parameter which I set in the Inspector window (check the picture) in the PlaySound script

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

sentences: How to protect Lua scripts in IOS game? I'm developing an iOS game and was considering putting level info and monster info in a Lua script for ease of use. However, since I'm using Game Center for multiplayer I'm concerned users will attempt to change these scripts to cheat. What measures can I take to protect my Lua scripts?

sentences: How is data written from two different gpu cores to the same memory? Does each core’s data get written to the shared memory one at a time or both at the same time? For instance, when two cores that are next to each other need to write to the same memory spot does the gpu write the core from the left first, then the next core or does it happen at the same time? I’m asking because I want to know if I can get the 2nd core to check a value that the 1st core changed before writing the data.

sentences:
Libgdx handle screen resolutions I know there are some questions to this topic, but i didnt find a
satisfying answer for my problem yet.

I'm learning to use libgdx right now, and I'm not sure about handling different screen resolutions. I can use Viewports and a Camera of course, to fit the content
to the screen. But - how do i achieve, that my game doesnt appear kind of stretched if a device has a different resolution?

For example: Do you know the game Clash Royale? It feels like this game looks the same on all devices with every different resolution and screen size.
How do they do this?

Thank you.

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:
How to get the 2d field of view using dot or atan2? I tried to implement from this site linear-algebra on how do I check the field of view using dot product. But when I check the angle to the given fov angle, I am not getting the desired result. Instead of getting the field of view of 45 degree, I am getting 90 degree. What am I doing wrong?

Vector2 start = Mapper.transform.get(owner).position;
Vector2 end = Mapper.transform.get(target).position;
float facingAngleRad = 0;
Vector2 ownerOrientation =
   new Vector2((float)Math.cos(facingAngleRad), (float) Math.sin(ficingAngleRad));
Vector2 targetOffset = tmp1.set(end).sub(start);

float product = ownerOrientation.nor().dot(targetOffset.nor());
float checkAngle = (float) Math.acos(product);
float FIELD_OF_VIEW_ANGLE = 45 * MathUtils.degeeToRadians;
if(checkAngle < FIELD_OF_VIEW_ANGLE) {
    // in the field of view
}

In the below image, green is the desired field of view (45 degree), but I'm getting 90 degree (red)

sentences:
Why are my Player Input Unity Events started twice? I'm using the (new) "Input System" package and the "Player Input" component on my player prefab like this:

public class Player : MonoBehaviour
{
    [UsedImplicitly]
    public void Fire(InputAction.CallbackContext context)
    {
        if (!context.started) return;
        Debug.Log($"Fire!");
    }
}

The odd thing is, this method is invoked twice with context.started == true. What am I missing here? Why is the method invoked twice?
A minimal working example to reproduce the behaviour can be found on GitHub.
EDIT
The player joins automatically through the "Player Input Manager":

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:
Sprite not rotating around its centre after Scaling at its centre If I scale a sprite at its centre, then try to rotate it around its centre as well, the rotation does not occur around its centre.

If you need to rotate, for example a scaled ball,the way its working it is set the scale center at the top left (0,0) set the scale that you want, and then set the rotation center to the middle of the scaled sprite, and then apply the rotation modifier.

blaBloBliSprite.setScaleCenter(0, 0);
blaBloBliSprite.setScale(0.667f);
blaBloBliSprite.setPosition(557, CAMERA_HEIGHT / 2 - blaBloBliSprite.getHeightScaled() / 2);
blaBloBliSprite.setRotationCenter(blaBloBliSprite.getWidthScaled() / 2, blaBloBliSprite.getHeightScaled() / 2);

But I want to scale a sprite at its centre as well.

Is there any way of doing it?

sentences:
Where to start with hardware-specific low-level programming? Seeing as today's machines have insane computing power and near endless memory, it's tough for a hobbyist programmer to actually hit the limits of his machine without doing something totally boneheaded. This raises a question: Is there a machine (be it a computer or a console) from the past that would be a good learning platform for someone that has never touched low-level code? I'm very much looking at this from the perspective of someone that wants to understand exactly how to get the best out of the specific set of hardware a machine has.

I'd imagine that the internet probably has manuals for most well known older machines, and it shouldn't be too hard to find an emulator of some sort either. I'm just at a little bit of a loss when it comes to actually choosing a good platform to go for. Any ideas?

Obviously if someone has ideas that don't fit the exact parameters of the question, I'm open for that as well.

sentences:
How can I use .txt or .xml reference file to slice up spritesheets in Lua? I've been learning to code games in Lua, and I've recently started on my own project. I wanted to use the following spritesheet from Kenney.nl, as well as a few other spritesheets from them

but I'm a little confused as to how to cut it up. Some of the sprites are irregularly sized from the normal 70x70, and there's a 2px gap between each one, so my current understanding of how to generate quads from a spritesheet doesn't seem to apply
Thankfully, the spritesheets each come with an associated .txt or .xml file (it varies, not sure why) that gives the top left x/y coordinates, as well as the width and height of each sprite. This seems like it would make the job of creating a reference table of sprites really easy, but I can't figure out how to include something like
<SubTexture name="box.png" x="0" y="864" width="70" height="70"/>
<SubTexture name="boxAlt.png" x="0" y="792" width="70" height="70"/>
<SubTexture name="boxCoin.png" x="0" y="720" width="70" height="70"/>
<SubTexture name="boxCoinAlt.png" x="0" y="576" width="70" height="70"/>

or
fishSwim1 = 76 0 66 42
fishSwim2 = 73 43 62 43
flyDead = 143 0 59 33
flyFly1 = 0 32 72 36
flyFly2 = 0 0 75 31

as a reference file in my Lua code. Everything I've seen online has been guides on chopping up spritesheets with uniform width and height, or using some website or service to create a spritesheet/reference file, which I don't need to do (and I'd rather do as much as possible within my code)

sentences:
Handle Input Processor in Device Back Button and Button as Actor How to handle a event for both key as well as actor added in the screen? My problem is that at a time only one input processor is available either for button or device back button. How can I set input processor for both back button of device and button which act as actor on the screen.

I implemented following code for button input processor
Gdx.input.setInputProcessor(stage);
button was added in the stage so I implement input processor for the stage.

For device back button
Gdx.input.setInputProcessor(this);
Register actor as input processor

In keyDown event I write
if (keycode == Keys.ESCAPE || keycode == Keys.BACK)
    LevelLoadScreen.flagResume = true;

Other solution also acceptable if it handle both the action listener

sentences:
Why aren't my isometric objects where I think they are? Background
I am creating an isometric RPG using Tiled and Monogame. My goal is to have relatively elaborate terrain and movement, with my vision for the overworld being much like the now-venerable Megaman Battle Network franchise. As such, by world must be 3D and simply drawn on top of an isometric map assembled from tiles.
Quirks
The Monogame.Extended system for drawing Tiled maps does so mostly on its own, though I have elected to draw a layer at a time and render any sprites I need to between the layer draw calls. The layers do not use the SpriteBatch I have configured to draw movable sprites, and just take a translation. I've managed to become decently adept at navigating it to convenient locations.
The Issue
Wikipedia says that for a good isometric scene, you want to rotate 45 degrees around Z and something like 32 degrees around what in my system is X. In my case, the resulting transformation does not seem to match the map image, so I am using an angle of approximately 52 degrees around X, which matches up fairly well. However, while the map itself can be perfectly aligned to the collision system, and I'm able to walk around the edges perfectly, objects within the map seem oddly placed. Some of this may be due to my incorrect handling of the Z (world upward) index, but it seems more than that. When I align the image so that it lines up with them instead of the edges of the map, their sizes seem subtly incorrect - I have found, for instance, that if my X rotation is negative, the objects (which are distant) seem slightly smaller than how they are drawn. I could be misreading that, however.
EDIT: The only distortion, if there is indeed any, seems to be in the viewport's Y direction. I collide where I expect to horizontally.
My Assumption
I believe this may simply be a camera issue - perhaps the default camera is not orthographic or something?  I don't really know the way to fix that if so, and if not, I'm mystified by what is going on.

sentences:
XNA Easy Storage XBOX 360 High Scores To followup from a previous query - I need some help with the implementation of easystorage high scores, which is bringing up some errors on the xbox.

I get the prompt screen, a savedevice is selected and a file are all created! However the file remains empty, (I've tried prepopulating but still get errors).

The full portions of the scoring code can be found here: http://pastebin.com/74v897Yt

The current issue in particular is in LoadHighScores() - "There is an error in XML document (0, 0)." under line data = (HighScoreData)serializer.Deserialize(stream);

I'm not sure whether this line is correct either: HighScoreData data = new HighScoreData();

public static HighScoreData LoadHighScores(string container, string filename)
        {
            HighScoreData data = new HighScoreData();

        if (Global.SaveDevice.FileExists(container, filename))
                {
                    Global.SaveDevice.Load(container, filename, stream =>
                            {
                                File.Open(Global.fileName_options, FileMode.OpenOrCreate,
                                         FileAccess.Read);
                                try
                            {
                                            // Read the data from the file
                                        XmlSerializer serializer = new XmlSerializer(typeof(HighScoreData));
                                        data = (HighScoreData)serializer.Deserialize(stream);
                            }
                              finally
                             {
                                    // Close the file

                                stream.Close();
                             //   stream.Dispose();

                             }

                            });

                }

        return (data);
    }

I call: PromptMe(); when the Start button is pressed at the beginning.

I call: if (Global.SaveDevice.IsReady){entries = LoadHighScores(HighScoresContainer, HighScoresFilename);} during the menu screen to try and display the highscore screen.

I call: SaveHighScore(); when game ends.

I've tried altering the struct code to a class but still no luck.
Any help greatly appreciated.

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:
Flash Professional vs FlashBuilder 4.6 for mobile app development From the marketing materials I see online, it seems to me that FlashBuilder 4.6 is a subset of the functionality available in Flash Professional.  If I understand correctly, mobile app development target iOS and Android started as a plugin for Flash Pro and has since been made a separate product.

But can Flash Pro still do all the multi-platform targeting that FlashBuilder 4.6 can do?  What other considerations are there between the two applications that are critical to understand for mobile app development?

Thanks!

sentences:
SlimDX: Error while loading Effect Im trying to load a effect in SlimDX, but I get a error when I try to get the ShaderSignature.
The error-code:

E_FAIL: An undetermined error occurred (-2147467259)

This is my code:

   EffectTechnique tech = this.effects.GetTechniqueByIndex(0);
   EffectPass pass = tech.GetPassByIndex(0);
   ShaderSignature shaderSignature = pass.Description.Signature;

Any idea?

sentences:
How can I go about learning to write a shader So here's the background:

I'm writing a game, just for my own amusement and education really. I've already come to the conclusion that XNA was the way to go for graphics, I've bought a couple of books, I've gotten basic game graphics going, and that's great.

Now I'm starting to get a little in-depth and I'm starting to need to do stuff not covered in my (beginner) books. In particular, I need to display a sprite using a mask. Actually, what I need to do is display a generic sprite with a different color for each player. After banging around on the web, it seems the way to go is to have a color texture (one for each player) which I display using the mask, then display the generic part of the sprite. This has to be done dynamically, i.e. at runtime because there are too many sprites to keep in memory if I try to generate all the permutations at startup.

So, I need to use a shader. Fine. I've downloaded a sample shader program, and managed to hit it with a hammer until it does something close enough to what I want so that I know I'm on the right track. And here, we come to my problem... I have no friggin' clue what I'm doing. While there are a lot of samples and such about shaders, no one ever actually explains what's going on. For instance, I can't find any real docs on Tex2D. I feel like the guys in Zoolander poking at the computer. So, my question (yes, I have a question) -- where is a good URL or what is a good book to take me from dumskie to reasonably competent to write a basic shader?

sentences:
Combine a light and water shader in libgdx glsl I am trying to combine a light shader with a water shader in libgdx. Shader programming is not one of my strengths at all.

This is the water effect rendering nicely:

And when I have added the flickering light code I am getting this:

The light is meant to be a flickering white circle and the water should show up. It doesn't.
What I have done so far is try to re-arrange texture binding, combine drawing in one pass. I can render the other scene content on top of the water but the water has to be the top-most item. That is what I am failing to do,

Here is my wall of code (just the render function):

public void render() {
    float dt = Gdx.graphics.getDeltaTime();

    // water
    time += dt;
    float angle = time * (2 * MathUtils.PI);
    if (angle > (2 * MathUtils.PI))
        angle -= (2 * MathUtils.PI);

    // light
    zAngle += dt * zSpeed;
    while (zAngle > PI2)
        zAngle -= PI2;

    fbo.begin();
    batch.setProjectionMatrix(cam.combined);
    batch.setShader(defaultShader);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    float lightSize = 140.75f + 0.25f * (float) Math.sin(zAngle) + 27.2f * MathUtils.random();
    batch.draw(lighttex, 400 - lightSize * 0.5f + 0.5f, 300 + 0.5f - lightSize * 0.5f, lightSize, lightSize);
    batch.end();
    fbo.end();

    // draw the actual scene
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.setProjectionMatrix(cam.combined);
    batch.setShader(finalShader);
    batch.begin();
    fbo.getColorBufferTexture().bind(1);
    lighttex.bind(0);
    batch.draw(map1BgTex, 0, 0, 960, 540);
    batch.setShader(waterShader);
    waterShader.setUniformMatrix("u_worldView", cam.combined);
    batch.end();

    Gdx.gl20.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Gdx.gl20.glEnable(GL20.GL_BLEND);
    watertex.bind(1);
    waterdisptex.bind(2);

    defWaterShader.begin();
    defWaterShader.setUniformMatrix("u_worldView", matrix);
    defWaterShader.setUniformi("u_texture", 2);
    defWaterShader.setUniformi("u_texture2", 3);
    defWaterShader.setUniformf("timedelta", -angle);
    waterMesh.render(defWaterShader, GL20.GL_TRIANGLE_FAN);
    defWaterShader.end();

    }

I uploaded a more complete source file and the shaders to my server, I hope it's not too inconvenient - http://agexdev.com/files/shaders.tar.xz

sentences:
Top-down player collision with walls I am having trouble trying to think of how I am going to approach collisions in my game. My idea which sucked in the beginning because it would reduce performance dramatically has failed which was when I was updating the list of walls it would check collision with players but the player would just stop and wouldn't be able to move anymore. Collision not only has to work with player but with at least 15-20 other entities in the game as well. Does anyone have a good idea to check collision with a top down shooter?

Here is my update method with everything being updated:

public void update(float dt){

    inputHandler();

    //Update the player
    player.update(joystick1, joystick2, projectiles, dt);
    updateCamera();

    //Update them zombies
    for(int i = 0; i < enemies.size(); i++){
        Enemy e = enemies.get(i);
        e.update(player, dt);
        if(e.getDistanceFromPlayer() < 60){
            //check collision
            if(e.collided(player)){
                player.hit(e, particles);
            }
        }
    }

    //Update Projectiles
    for(int i = 0; i < projectiles.size(); i++){
        Projectile p = projectiles.get(i);
        p.update(dt);
        //Check if projectile has hit any enemies
        for(int j = 0; j < enemies.size(); j++){
            Enemy e = enemies.get(j);
            if(p.collided(e)){
                p.remove();
                e.hit(p);
                ParticleEmitter.createBloodParticle(particles, e.getX(), e.getY(), 5, 500, 10);
            }
        }
    }

    //Update Items
    for(int i = 0; i < items.size(); i++){
        Item item = items.get(i);
        if(item.collide(player)){
            if(item instanceof Ammo){
                player.getCurrentGun().addAmmo(item.getAmount());
            }
            if(item instanceof Health){
                player.addHealth(item.getAmount());
                if(player.getHealth() >= 100){
                    player.setHealth(100);
                }
            }
            item.remove();
        }
    }

    //Update them particles
    for(int i = 0; i < particles.size(); i++){
        Particle p = particles.get(i);
        p.update(dt);

    }

    int numberOfObjectInGame = 1 + walls.size() + enemies.size() + items.size() + particles.size() + projectiles.size();
    System.out.println(numberOfObjectInGame);

    logger.log();

}

I don't know when to check for collisions. Should it be done in the update method or in the player update method, or at some other point? Really confused at this point.

EDIT:

Ok so added 4 rectangle bounds to my player and had each one checked to see if they have collided with a wall. So right now it is working but i'm pretty sure this is horribly inefficient. Any way to make this more efficient...

Here is the code:

for(int i = 0; i < walls.size(); i++){
        Wall w = walls.get(i);
        if(Intersector.overlaps(w.getBounds(), up)){
            if(velocity.y < 0){
                velocity.y = 0;
            }
        }
        if(Intersector.overlaps(w.getBounds(), down)){
            if(velocity.y > 0){
                velocity.y = 0;
            }
        }
        if(Intersector.overlaps(w.getBounds(), left)){
            if(velocity.x < 0){
                velocity.x = 0;
            }
        }
        if(Intersector.overlaps(w.getBounds(), right)){
            if(velocity.x > 0){
                velocity.x = 0;
            }
        }
    }

It is checked to see if the player is colliding with every wall and the problem is this is only the player. This has to check with every moving entity in the game. Is this a good way to implement this into a game or should I look into something else?

sentences:
Storing and using UV and Normal Data with OpenGL I'm having trouble mapping UV coordinates to vertices in OpenGL. I'm binding my buffers and enabling all of my attrib arrays perfectly well and things are rendering - but what I'm stuck on is how to map UV and Normal data.

You can't just store UV and Normal data with the Vertex data, because obviously you'll be re-using vertices, but not necessarily with the same Normal or UV.

For clarity this is the general flow of what I'm doing at the moment:

I bind my shader program.
I bind my vertex array buffer with GL.BindBuffer
I Bind my element buffer with GL.BindBuffer
I use GL.Uniform (1, 2, 3 or 4) to bind values to my uniform variables
I enable all of my vertex buffer attributes with GL.EnableVertexAttribArrau and then encode their layout using GL.VertexAttribPointer
I draw using GL.DrawElements
I disable all of my vertex attrib arrays again

I'm totally stuck on how to encode UV and Normal data to my vertex attributes. Do I need to use a second buffer? If so; how does OpenGL know to use a different set of indices to find them? I'm totally lost and any help would be greatly appreciated.

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:
Calculating initial velocities given trajectory parabola I'm working on a volleyball game but my maths/physics knowledge isn't quite up to par. I need some help with the following problem:

The player can hit the ball from anywhere on the left of the court into one of three points on the right:

    P    | x  x  x

The ball travels in a parabola defined by the three points, all of which are known:

The players X coord and height (Xp, Yp)
The point just above the top of the net (0, Yn) (assume the left of the court is negative along the x axis)
The point where the ball impacts the ground on the other side of the net (Xi, 0)

I need to calculate the initial X/Y velocities when the player hits the ball so that the ball, affected only by gravity, follows that parabola. EDIT Alternatively, the velocity magnitude and angle from which the X/Y component velocities can be calculated.

I'm able to find the function of the parabola using pen and paper but since this involves "saving" equations with unknown variables I have no idea how to translate that to code (how could you have variable a = 2b for example if b is undefined?). I'm not even sure if finding the function is necessary for this problem.

Any help?

EDIT: I just came to the realisation that if I can calculate the flight time then I can divide the distance traveled each frame along the x axis and just plug that into the parabolic function to get the ball's y coordinate. I guess that's my next avenue of research.

sentences:
How to implement ECS architecture in C#? As C# is a strongly-typed language, I'm  having great difficulties associating all my data types together so that I can have a clean, if not performant, game loop.

Example #1: Keeping Components Together

Keeping components together means I need an interface or base class to store them in an array, which would require keeping track of each type separately so that it can be converted back to the derived type before being consumed. The constant type conversion seems like a bad idea in an ECS?

To compound the problem, I would prefer to use structs instead of classes for my components, which when cast to an interface will cause boxing. In some simple stop watch tests I've run it seems the casting/boxing is 16x slower than just looping over the raw type. (Pseudo code below)

IComponent sprite = new SpriteComponentStruct() // boxing

for(int i=0; i<iComponents.Length; i++)
{
    var type = GetComponentTypeByIndex(i);
    var system = GetSystemWithType(type);
    SpriteComponent sprite = Convert.ChangeType(...);
    system.Execute(sprite);
}

Example #2: Keeping Components Separate

To keep components separately in their own classes/managers/systems I would likely need a generic class to cut down on the code duplication. The problem I run into here is that looping over each class will require a base class or interface, which at the very least would force me to cast the component types again. (Pseudo code below)

ComponentManager<T>() where T : struct
{
    T[] components;

    // can't use with non-generic interface to put manager into a list
    public void AddComponent(T component) {...}

    // won't compile; type "T" will not cast to type "T"
    public void AddComponent<T>(T Component) {...}

    // requires casting and/or boxing, which defeats
    // the purpose of keeping components separate
    public void AddComponent(object component) {...}

}

It seems every which way I try to implement a ECS in C# ends with hacky/non-performant code, that's assuming I can get it to compile in the first place. From studying other ECS systems around the net, it seems some side-step these issues by using void/int pointers or storing component bytes directly in memory (like I believe the new ECS in Unity 2018 does). Either way those are unsafe operations in what's supposed to be a managed memory language.

So is C# the wrong tool for the job? Am I approaching this incorrectly? I'd love to hear some opinions as this just seem impossible...

sentences:
How do I display an image after pressing an UI button in unity3d? I am working on a game in unity3d in which I want to display the details about the players when a button is being pressed.
Suppose there are 12 players so for that I will have to make 12 UI buttons as well and I have done that too but the problem is that how to display image after clicking the buttons?
If anyone knows please sort out my problem, any help would be more appreciated.
Thanks in advance

sentences:
Does GL Memory model guarantees that late Depth Testing accesses depth buffer values in same draw call Suppose I issue a draw command that draws 3 overlapping triangles (T1, T2, T3). Fragment shader assigns Depth = 3 to T1 fragments, 2 to T2 and 1 to T3 fragments. Depth Buffer is cleared to 0 before draw call. GL Test is set to GL_Less.

Now, when pixels for triangle 2 are depth tested by the hardware, is it guaranteed that hardware will read the latest written values i.e 3 (by T1 fragments)?

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:
How to keep Lua bindings from cluttering up C++ code? I'm writing a game engine that uses C++ and Lua (and Luabind).

Currently, I'm writing all the bindings inside the constructor of the class being binded. I really don't like this because it's cluttering up my code.

Where should I put the Lua glue code so that it is out of the way and not cluttering up my codebase?

sentences:
How to implement efficient Fog of War? I've asked a question how to implement Fog Of War(FOW) with shaders. Well I've got this working. I use the vertex color to identify the alpha of a single vertex.

I guess the most of you know what the FOW of Age of Empires was like, anyway I'll shortly explain it:

You have a map. Everything is unexplored(solid black / 100% transparency) at the beginning. When your NPC's / other game units explore the world (by moving around mostly) they unshadow the map. That means. Everything in a specific radius (viewrange) around a NPC is visible (0%transparency). Anything that is out of viewrange but already explored is visible but shadowed (50% transparency).

So yeah, AoE had relatively huge maps. Requirements was something around 100mhz etc. So it should be relatively easy to implement something to solve this problem - actually.

Okay. I'm currently adding planes above my world and set the color per vertex. Why do I use many planes ? Unity has a vertex limit of 65.000 per mesh. According to the size of my tiles and the size of my map I need more than one plane. So I actually need a lot of planes. This is obviously pita for my FPS.

Well so my question is, what are simple (in sense of performance) techniques to implement a FOW shader?

Okay some simplified code what I'm doin so far:

// Setup
for (int x = 0; x < (Map.Dimension/planeSize); x++) {
    for (int z = 0; z < (Map.Dimension/planeSize); z++) {
         CreateMeshAt(x*planeSize, 3, z*planeSize)
    }
}

// Explore (is called from NPCs when walking for example)
for (int x = ((int) from.x - radius); x < from.x + radius; x ++) {
    for (int z = ((int) from.z - radius); z < from.z + radius; z ++) {
        if (from.Distance(x, 1, z) > radius) continue;
        _transparency[x/tileSize, z/tileSize] = 0.5f;
    }
}

// Update
foreach(GameObject plane in planes){
    foreach(Vector3 vertex in vertices){
       Vector3 worldPos = GetWorldPos(vertex);
       vertex.Color = new Color(0,0,0, _transparency[worldPos.x/tileSize, worldPos.z/tileSize]);
    }
}

My shader just sets the transparency of the vertex now, which comes from the vertex color channel

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

So basically:

Name1
960x540

Name2
1280x720

Name3
1024x576

etc

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

Thanks for any help!

sentences:
Top Down bounds of vision Obviously in a first person view point the player sees only what's in front of them (with the exception of radars and rearview mirrors, etc).  My game has a top down perspective, but I still want to limit what the character sees based on their facing.

I've already worked out having objects obstruct vision, but there are two other factors that I worry would be disorienting and want to do right.

I want the player to have reduced peripheral vision and very little view behind them.  The assumption is he can turn his head and so see fairly well out to the sides, but hardly at all behind without turning the whole body.  How do I make it clear you are not seeing behind you?
I want the map to turn so the player is always facing up.  Part of the game is to experience kind of a maze and the player should be able to lose track of North.  How can I turn the map rather than the player avatar without causing confusion?

sentences:
Coloring a Voronoi Graph Intro:

I want to convert a Voronoi Graph made with this awesome library by jceipek on GitHub into something I can work on.

So far so good, this user provides with a demo to start with and shows how to generate the VG.

Question:

How do I convert the VG (made by edges and that dot in the middle) into something that I can work with?

Such as, after you generate some noise and apply to it (height), you colour the polygons based on it.

Thoughts:

Something comes to my mind about instantiating meshes and tiles based on the edges and the position of the dot as a start, but it won't work if I can't "detect" the polygon.

Expected result:

Image from this blog about Voronoi Mapping link

What I have:

It is drawn with Gizmos (for visual debugging in Unity)

I want to know how to color my polygons as in the expected image above. So I thought about doing a mesh or individual tile (and color it based on height afterwards but that is sauce for another question if needed)

Edit of my progress:

To further explain this question I provide the next image.

The image shows that I could use that position data somehow and turn that random polygon shape into a "tile" that will have a colour (mesh?) and possible data in it (script).

I hope this helps otherwise let me know in the comments.

sentences: How to modify Game1.cs out of an object it contains? Assuming I Have a List<SomeClass> myList; in my Game1-class. It also contains an object of SomeOtherClass otherClass;. How would I modify myList (Add/Remove) out of the otherClass's logic? Or in other words how to get access to the Game1-instance in this situation?

sentences:
Trying to subdivide an ISO tile I have code that calculates where the user clicked inside an iso tile in an isometric map. The tile has a width of 1 unit and a height of 0.5 units. My code calculates where they touched inside the tile in these same units. The goal is to then decide where that click falls if you sub-divided the iso tile into a 4x4 grid. The picture below shows how all this is supposed to look.

I have found ascreen co-ordinates to iso formula and it makes sense but for whatever reason, when I try to use it with my data above I get wrong outputs. When clicking from the top corner to the right corner, only the X iso output should change but both the X and the Y change.

I feel like this should be pretty simple but after hours of banging my head against this I can't figure out what I am doing wrong.

Source for screen to iso formula:
How would I translate screen coordinates to Isometric coordinates?

Any help would be greatly appreciated.

float touchedX;
float touchedY;
//below 0.125 represents the tile height because the whole thing
// is 0.5 and its 4 tiles high so 0.125, 0.5 is 2*width which
//is (1 / 4.0) * 2
float gridPointLedftDown = (touchedY / 0.125f) + (touchedX / 0.5f);
float gridPointRightDown = (touchedY / 0.125f) - (touchedX / 0.5f);

sentences:
How should I send large amounts of data from java to c++ (within the same process) I'm writing a game that is mostly in Java (because that's the language I'm most comfortable with) while the graphics are in C++ (because of speed, and because the Vulkan API is hard enough to learn when I'm not using a third-party language binding). I start a thread in Java and have it create a Swing window, it then runs a native method that takes the HWND handle from the window and some other information as parameters. Once in native code it binds the window to a Vulkan surface and from their the graphics engine is it's own independent thread, if possible I don't want to make any more JNI calls (performance concerns).

My issue is, I handle server-client connectivity on the Java end, and my server is responsible for sending the client models and textures when the player needs them. The obvious solution would be to pass these textures and models over JNI so that the graphics engine can  make use of them but I'd REALLY like to not do that.

I've considered using memory mapped files but that would require using boost since there otherwise isn't a cross-platform mmap library, and it also seemed silly to me that I'd get the data over the network, it'd then be stored in RAM, and then I'd allocate it a different area of RAM so that it can be accessed in native.

Other than JNI and memory mapping I, with my limited experience, cannot think of any other possible solution to this problem and am hoping to find some suggestions or perhaps some inspiration. This question isn't strictly related to game development and I considered asking it over at Stackoverflow but their community is really doo doo.

sentences:
Can not change rotation of prefabs var angle = temp.transform.rotation.eulerAngles;
            angle.y = 90;

temp.transform.rotation = Quaternion.Euler (angle);

I have tried this and some other variation to change the rotation of the instantiated prefab but it does not work at all.

How can I fix this?

sentences:
line to point collision without doing three square roots Is it possible to test a point to line collision without doing three square roots? Here's how I'm currently doing it:

I have point P that I want to check is on the line, and point A and B for the two ends of the line. I use the Pythagorean equation to get length PA, PB, and AB. Now I check to see if PA + PB = AB. if PA + PB is larger than AB, the point cannot be on the line.

private boolean PTLCollisionCheck(float px, float py, float ax, float ay, float bx, float by) {
    float PA = (float) Math.sqrt(((px - ax) * (px - ax)) + ((py - ay) * (py - ay)));
    float PB = (float) Math.sqrt(((px - bx) * (px - bx)) + ((py - by) * (py - by)));
    float lineLength = (float) Math.sqrt(((ax - bx) * (ax - bx)) + ((ay - by) * (ay - by)));
    return (PA + PB) <= (lineLength + 1);
}

sentences:
Box2D Bicycle Wheels Motor Problem - Flash 2.1a I have made a bicycle with Box2D using several polygons for the frame at different angles connected using weld joints, and I have revolute joints on the wheels with a motor.

I have made some basic terrain (straight ground and a small ramp) and added keyboard input to control the bicycle with torque to balance it. All of this is done in with Box2D's Debug Draw.

When the bicycle is on its back wheel but diagonally forward (kinda like this position -> /) the motors just cause it go spinning backwards over when in reality it should either stay on its back wheel or go down onto both wheels.

Here's my code the revolute joints:

            //Front Wheel Joint

        var frontWheelJointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
        frontWheelJointDef.Initialize(frontWheelBody, secondFrameBody, frontWheelBody.GetWorldCenter());
        frontWheelJointDef.enableMotor=true;
        frontWheelJointDef.maxMotorTorque=10000;
        frontWheelJoint = _world.CreateJoint(frontWheelJointDef) as b2RevoluteJoint;

        //Rear Wheel Joint

        var rearWheelJointDef:b2RevoluteJointDef = new b2RevoluteJointDef();
        rearWheelJointDef.Initialize(rearWheelBody, firstFrameBody, rearWheelBody.GetWorldCenter());
        rearWheelJointDef.enableMotor=true;
        rearWheelJointDef.maxMotorTorque=10000;
        rearWheelJoint = _world.CreateJoint(rearWheelJointDef) as b2RevoluteJoint;

And here's the relevant part of my update function:

            // up and down control wheels motor
        if (up) {
            motorSpeed-=0.5;
        }
        if (down) {
            motorSpeed += 0.5;
        }
        // left and right control cart torque
        if (left) {
            middleCentreFrameBody.ApplyTorque( -3);
            gearBody.ApplyTorque( -3);
            firstFrameBody.ApplyTorque( -3);
            secondFrameBody.ApplyTorque( -3);
            rearWheelToChainBody.ApplyTorque( -3);
            chainToFrontFrameBody.ApplyTorque( -3);
            topMiddleFrameBody.ApplyTorque( -3);
        }
        if (right) {
            middleCentreFrameBody.ApplyTorque( 3);
            gearBody.ApplyTorque( 3);
            firstFrameBody.ApplyTorque( 3);
            secondFrameBody.ApplyTorque( 3);
            rearWheelToChainBody.ApplyTorque( 3);
            chainToFrontFrameBody.ApplyTorque( 3);
            topMiddleFrameBody.ApplyTorque( 3);
        }
        // motor friction
        motorSpeed*=0.99;
        // motor max speed
        if (motorSpeed>100) {
            motorSpeed=100;
        }

        rearWheelJoint.SetMotorSpeed(motorSpeed);
        frontWheelJoint.SetMotorSpeed(motorSpeed);

Any ideas what might be causing this?

Thanks

sentences:
Realtime rendering using a ray tracing engine I want to render an object that has a mesh with one million hexagonal elements(100 * 100 * 100).

Lights, shadows and textures is not important and each element has a solid color.
and finally, the actions I want to have, is simply rotating the object, zooming and panning.

I am wondering what ray tracing engine is better for my conditions. or, do I have to take another approach?

any help will be appreciated.

sentences:
How can I simulate thousands of things at high frame-rates? I'm working on a simulation game like SimTower where I'd like to keep track of thousands of items at once.

Other games like this, appear to have hundreds or thousands of rooms with elevators with what looks like hundreds or thousands of people. I'm concerned about achieving the same thing in my game.

How can I realistically keep track of each individual person/room/elevator in the game? I assume I can only render what's on the screen, but how can I afford to constantly simulate everything that is off the screen?

sentences: Are there special APIs used to make PS4 games? Game engines can build games for PS4, but how are those engines written to support it? Is there any special kind of support, API or something provided by the PS4? Does it have like a new programming language or new specification like OpenGL or DirectX?

sentences:
Rendering (rasterization / ray tracing / others) I'm completely new to this graphics and game development. I have read about Rendering (drawing a 3D graphic on a display 2D) and there are many ways of rendering, Rasterization, Ray tracing, radiosity, ray casting. And my doubt is if OpenGl implements one of these. I mean with OpenGL I can draw lines, circles and so on, so there should be a rendering algorithm on OpenGL, am I right? Which one is it?

What if I want to implement a different rendering algorithm, does this mean I'm no longer using OpenGL?

sentences:
How can I select an enemy to act next, biased toward smaller enemies? Suppose there are X number of enemies in the game. They all have to attack one by one. Each enemy is picked randomly, and can be of Y size.

How can we attain biased randomness in such a way that small enemies are attacking more often than big ones?

My current algorithm is "pick any random enemy" no matter the size, and I'd like to improve on this.

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

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

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

Applied to my previous digestion example this would mean:

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

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

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

sentences:
Unity not updating sprite animations (possible bug) I have a simple animation of a foot which i want to change sprites from one sprite to another, which is seen in the following two images:

now as one can see in the animation timeline there is a change in sprites of the foot (a slight distortion), however if one looks in the inspector the sprite remains constant. The sprite in the inspector seems to choose whichever sprite was last placed on the animation timeline, until the game is played and at this point it reverts to foot1. The sprite never changes whenever you scrub through the timeline. This is a 2D project and I am running a 64 bit version of windows 8.1 running the most recent version of unity (which has been reinstalled), this looks like a bug to me but if i am doing it wrong then please feel free to tell me so. I am using C# in order to develop my project. I am not using any mods, or anything downloaded from the asset store.

I have tried uninstalling and reinstalling unity, so that is not the problem, my project is available here:

http://www.filedropper.com/newunityproject6-copy

I have tried to give as much information as possible, but please do not hesitate to ask any further questions.

My computers properties:
8gb of ram
64 bit
intel i5-3230M CPU@ 2.60 GHz
Windows 8.1
Lenovo g780

sentences:
What has changed in the lighting systems of Rage, Battlefield 3 to make them so realistic? I've played and completed Rage and currently Battlefield 3 (which looks a lot better with less hype). One thing that is immediately apparent is the lighting, or the bump maps - I can't figure out which it is - makes the experience on a high end PC a lot clearer and better looking.

What is the advancement that these games are making use of in Open-GL/Direct-X or the graphics cards that has increased the realism of the lighting engines so dramatically?

sentences:
What's a way to implement a flexible buff/debuff system? Overview:

Lots of games with RPG-like statistics allow for character "buffs", ranging from simple "Deal 25% extra damage" to more complicated things like "Deal 15 damage back to attackers when hit."

The specifics of each type of buff aren't really relevant.  I'm looking for a (presumably object-oriented) way to handle arbitrary buffs.

Details:

In my particular case, I have multiple characters in a turn-based battle environment, so I envisioned buffs being tied to events like "OnTurnStart", "OnReceiveDamage", etc.  Perhaps each buff is a subclass of a main Buff abstract class, where only the relevant events are overloaded.  Then each character could have a vector of buffs currently applied.

Does this solution make sense?  I can certainly see dozens of event types being necessary, it feels like making a new subclass for each buff is overkill, and it doesn't seem to allow for any buff "interactions".  That is, if I wanted to implement a cap on damage boosts so that even if you had 10 different buffs which all give 25% extra damage, you only do 100% extra instead of 250% extra.

And there's more complicated situations that ideally I could control.  I'm sure everyone can come up with examples of how more sophisticated buffs can potentially interact with each other in a way that as a game developer I may not want.

As a relatively inexperienced C++ programmer (I generally have used C in embedded systems), I feel like my solution is simplistic and probably doesn't take full advantage of the object-oriented language.

Thoughts?  Has anyone here designed a fairly robust buff system before?

Edit: Regarding Answer(s):

I selected an answer primarily based on good detail and a solid answer to the question I asked, but reading the responses gave me some more insight.

Perhaps unsurprisingly, the different systems or tweaked systems seem to apply better to certain situations.  What system works best for my game will depend on the types, variance, and number of buffs I intend to be able to apply.

For a game like Diablo 3 (mentioned below), where nearly any bit of equipment can change a buff's strength, the buffs are just character stats system seems like a good idea whenever possible.

For the turn-based situation I'm in, the event-based approach may be more suitable.

In any case, I'm still hoping someone comes along with a fancy "OO" magic bullet which will allow for me to apply a +2 move distance per turn buff, a deal 50% of damage taken back to the attacker buff, and a automatically teleport to a nearby tile when attacked from 3 or more tiles away buff in a single system without turning a +5 strength buff into its own subclass.

I think the closest thing is the answer I marked, but the floor is still open.  Thanks to everyone for the input.

sentences:
Forward Compatibility of Save Files My game is driven by a scripting language, and the user can save at almost anytime in the middle of the script, so the instruction number of the script engine must be saved. The problem is that the game state breaks when the script is changed. If the script is A B C D E and the player saved at C (the 3rd), and then the script is changed into X Y Z A B C D E, then the player will load at Z. I think my game will be updated infrequently even after release.

I think breaking the script into sections and autosaving in each new section. (in case of incompatibility: restart at autosave) However, are there any other ways to make save files forward-compatible?  I want to hear some examples of especially RPGs with DLCs and patches.

sentences:
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:
How to create a texture SRV with different sRGB format from a render target in DX11? Is it possible to bind a texture with a different format as render target and as shader resource view?
Specifically with a different _SRGB suffix. My goal is to render a shader into an R8G8B8A8_UNORM texture but read the render target in another shader as R8G8B8A8_UNORM_SRGB, or the other way around. Basically controlling on the read and write side whether automatic sRGB conversion should happen. There is no window or swap chain involved.
So far, I get an invalid args exception when I try to create a texture view with a different format. I am using the Stride game engine set to Directx 11 graphics API, which uses SharpDX.

sentences:
How to create communication with node.js server to client browser about monsters(object) First hello and sorry for my English, and now about my problem.
I create node.js server that communicates with the browser-client for player position, life, def, etc ... with sockets.io. And my question is how can i do and communication between server and client about this monster(bot) object?

sentences:
How can I set a system's emission rate using Particle Designer 2.0? In cocos2d-iphone (2.1), CCParticleSystem has a property called emissionRate.

Is there any way to set it using Particle Designer 2.0? I've tried all the various settings but there doesn't seem to be anything achieving that effect. Perhaps I'm overlooking something?

sentences:
Determine the direction of force when ball is moved through pipes I have set of pipes(edge colliders) in my scene, through which I pass the ball.

     ____|  |  <---Edge colliders
   o _______|

How do I move the ball in upward direction. For above this pipe I have to move along the positive x direction first, then positive y direction. How can I detect that.?

mRigidBody.AddForce (new Vector2 (moveSpeed,moveSpeed));

I tried this, but this can be used to move one direction at a time

sentences:
How should I implement hit detection netcode for AI enemies in a co-op first-person-shooter? I'm working on a FPS/sandbox game that has multiplayer but no PvP. Since the game has no PvP, I'm trying to make the networking code favor the player as much as possible.

For example, I allow the game-clients to decide whether a shot hit/missed an enemy, rather than having the game-server verify. I also allow the game-clients to decide where they are on the map -- with no verification from the server.

This opens the doors for cheaters, but in a PvE game I don't care so much.

However, I don't know how to design the enemy AI. If a player is lagging, the server doesn't know that player's real location, so how could I ensure that the player actually saw himself get attacked by an enemy (for example, a Zombie) before the server registered a hit on the player?

sentences: How to 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: Moving object parallel to another on path on 2d space How to Move object parallel to another on curved path on 2d space

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's the best control scheme for an arena shooter on a touchscreen phone? I am developing Android an game. It's going to be a top-down shooter with stealth features. I am now thinking about how to the make controls. Most top-down games are now twin stick (joystick on the left and right sides) but I need more buttons (for choosing weapons, commanding your squad, and using skills).

So here are my ideas:

Two (virtual) sticks like in other games, when you tap somewhere on the display, a circle with buttons appears, where you can choose abilities or weapons.
One stick on the left side for walking, shoot where the second finger is pressed, weapons and skills on the right side.

What do you think is the best? Or do you have any other idea? I want to choose the most intuitive and simplest.

sentences:
Unity keyboard GUI navigation priority I noticed something strange while playing with my menu on keyboard.

I have four items arranged in a square (i.e. the top-left item should be able to navigate to the top-right and the bottom-left). If I hover over top-left, hold the right key, and then tap down, the cursor moves to the top-right and then to the bottom-right.

However, if I hold the down key and then tap right, it moves to the bottom-left and does not move to the bottom-right.

This also happens on the reverse side, so it seems as if vertical navigation is being given preference over horizontal. If a vertical key is being held, horizontal navigation is impossible.

How can I turn this off? My buttons are all set to Automatic navigation, and when I turn Visualize on, they all look like they're connected properly.

sentences:
Creating a database with special items, like in Diablo I am in the middle of creating a browser game. I need to add 'special items' like in Diablo, but simpler. Item names are fixed (e.g. 'ring of power'), so only their attributes change.

In my game there are different towns. Each town may trade a different set of items with randomized characteristics. For instance, in Town A a 'ring of power' will have better attributes than the same item in Town B (and, thus, it will cost more).

My question is how to construct the database to handle this.

After constructing the database I will create a small script that will assign a different subset of items in each town. Each item with random attributes and a price that reflects its value.

I can make the script; what I need help on is creating the database.

sentences:
How can I draw lines and curves on a canvas that's not rendered? I need to draw lines and curves on a canvas that is not rendered on the screen but just updates the array of pixels that would otherwise be rendered. I need this to separate my game engine from my renderer.

This has proven rather difficult for my case because I don't use sprites that are loaded, but I draw lines and curves on a canvas.

I have used the p5.js library to accomplish my game, but p5 doesn't let you work without a "setup()" and "draw()" function. I don't want any draw loop or something because that beats the purpose of separating my game engine from my rendering.

I want to use p5 to render after I have all my game logic separate and I can just call nextFrame() or something from my game logic inside draw() in a constant 60 fps.

In p5 it is possible to createGraphics() which works outside of the canvas and doesn't have to render but again, p5 needs a draw() loop to work.

Does anyone know how I can accomplish this?

sentences:
Detecting a mouse click While in a Trigger Why does the following code not working? (weird, sometimes it works sometimes not )
I want to move player by touching on the screen and change  the color of gameObject when detect trigger and release mouse click.
"Drag and move" script works correctly I just add following code and sometimes it works sometimes not

  private void OnTriggerStay2D(Collider2D colider)
  {

    if (Input.GetMouseButtonUp(0) & colider != null)
    {
      colider.gameObject.GetComponent<SpriteRenderer>().material.color = Color.blue;

    }

  }

There is a full script :

  private Camera _cam;
  private Vector3 _daragOfset;
  [SerializeField] private float _speed = 4.55f;
  private bool isEntered = false;

  void Update()
  {
    if (Input.GetMouseButtonDown(0))
    {
      _daragOfset = transform.position - GetMousePos();
    }
  }

  private void OnTriggerStay2D(Collider2D colider)
  {
    if (Input.GetMouseButtonUp(0) & colider != null)
    {
      colider.gameObject.GetComponent<SpriteRenderer>().material.color = Color.blue;
    }
  }

  void Awake()
  {
    _cam = Camera.main;
  }

  void OnMouseDrag()
  {
    transform.position = Vector3.MoveTowards(transform.position, GetMousePos() + _daragOfset,_speed * Time.deltaTime);
  }

  Vector3 GetMousePos()
  {
    var mousePos = _cam.ScreenToWorldPoint(Input.mousePosition);
    mousePos.z = 0;
    return mousePos;
  }

sentences:
Handling complex selection mechanics in RTS-style game When we look at complex RTSs where a simple left button mouse click can mean twenty or more different things, depending on the game and UI state, the code handling this interaction and assigning the right interaction action to the input can easily end up messy and tightly coupled to everything, creating a ball-of-mud architecture/The Class That Does Everything related to interaction.
How can I deal with this situation?
Here's an example of the complex selection mechanics that I'm looking for:

Single left click to select a friendly unit.

If friendly unit is in a group, the group is selected.

If the group is already selected, select the unit.

Single left click to select an enemy unit.

If friendly unit/group already selected, then issue attack order on unit.

If friendly unit/group already selected and enemy unit is in an enemy group, then issue attack order on enemy group.

Same thing but if target is allied non-controllable, then friendlies move towards target.

Etc.
How can I handle this complex selection system, taking into account complex states?

sentences:
How can I make an infinte terrain with object pooling in Unity? I am currently making a 3D endless runner game in unity in C#. I now need to make the platform(3D Tiles) infinite but I don't know how. I already did some research but I don't find the right tutorial.

I already asked a similar question and I got the answer that I need to do it with object pooling but I don't find any good tutorial for object pooling. Does someone know how to make an infinite terrain with object pooling in unity?

Thanks

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

public class TerrainScript : MonoBehaviour
{
    public GameObject[] tilePrefabs;

    public Transform playerTransform;
    private float spawnZ = 4500.56f;
    private float tileLength = 2.0f;
    private int amtOfTilesOnScreen = 2;

    void Start()
    {
        for (int i = 0; i < amtOfTilesOnScreen; i++)
        {
            SpawnTile(0);
        }
    }

    void Update()
    {
        if (playerTransform.position.z > (spawnZ - amtOfTilesOnScreen * tileLength))
        {
            SpawnTile(0);
        }
    }

    private void SpawnTile(int prefabIndx = 0)
    {
        GameObject go;
        go = Instantiate(tilePrefabs[prefabIndx]) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * spawnZ;
        spawnZ += tileLength;
    }
}

sentences:
How to wisely update body trajectories in a 3D space simulation game? Suppose I have a Spacecraft object in 3D space, controllable by the player. I want it to update its own trajectory, so I give it a function for that (actually it might be inside a controller component associated with it). No problem until this point.

For this function I want to use a scientifically tested, accurate N-body simulation algorithm (like this). It's my field so I already know how to do that.

The challenge is how to make the game activate the function efficiently. This is what I've thought of so far:

The algorithm can calculate a lot of time steps in a short time, so I could activate it in one loop, save the trajectory data, and go on for several game loops using that data. During this time the spacecraft's position is updated every loop, but the algorithm is sleeping.
When the predefined number of loops has passed, or when the user gives a movement command, the algorithm is activated again, producing the new portion of the trajectory to use next.
This might require double-buffering.

The question is: who should be responsible for activating the spacecraft's algorithm? Should I do that directly in the game loop, or perhaps create a "timer object" that keeps track of the number of loops and user input and calls the function when appropriate? Something else?

Note that the same thing would happen for all the other bodies orbiting in space. However the other bodies would simply have to follow predefined trajectories, no need for an algorithm. The timer object could take care of updating all the trajectories at the right times.

Also, if you think there is a totally different and better way to do this, please let me know.

Additional info: the game is in C++, and the graphics engine is Ogre3D.

EDIT: changed the part about the trajectories of the non-interactive bodies, because comments here made me realize that it was plain stupid.

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:
Why some audio files are not working in Unity? I am making a 2D game in which I wanted to attach audio file to a button. I was able to do this successfully. But later I felt like changing that sound. So I simply replaced it with another audio file. Then it stopped working! When I again attached the first audio file instead of second one, it worked again.

My setup is as follows: The file format is wav. I created an empty gameobject and attached an Audio Source component to it. Assigned an audio clip to it. Unchecked "Play on Awake". Went to the OnClick() section of the UI Button. Clicked the plus sign to add an item to the list. Assigned the Audio Source object to the object field. Chose AudioSource.Play in the dropdown.

I wanted to know why is my second audio file of the same format not working!

sentences:
Random point on a square floor I have a flat 10x10 surface (floor) made out of cubes of 1x1x1.

I am spawning objects from the "sky" and I want them to fall on random points of the surface without exceeding the surface limits.

Is there anything similar to Random.onUnitSphere to handle this case?

sentences:
Andengine onAreaTouched TouchEvent not working - ACTION_OUTSIDE & ACTION_CANCEL I have a simple problem. I have a button on the screen. I want isActionDown to push the button down, and isActionUp to push the button back up again and make my character jump. But the problem is if I push the button down and drag away from it, the button stays pushed down. I would like the button to push back up again if the user drags away from it.

How can I create the desired affect? isActionCancel doesn't seem to do the trick.

    private void addButton(){
goB = new AnimatedSprite(240, 364, ResourceManager.getInstance().go_region, vbom){
    @Override
    public boolean onAreaTouched(final TouchEvent event, final float x, final float y){

        if (event.isActionDown()){
            goB.animate(new long[]{ 250 }, new int[] { 1 }, true);
            /*if(event.isActionCancel()){
                goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
            }*/
        }
        if (event.isActionUp()){
            goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
            fresh = true;
            playerBody.applyLinearImpulse(new Vector2(0, 45), playerBody.getPosition());
        }

        if (event.isActionCancel() || event.isActionOutside()){
            goB.animate(new long[]{ 250 }, new int[] { 0 }, true);
        }
        return true;
    }
};
goB.setScale(3);

registerTouchArea(goB);
attachChild(goB);

goB.animate(250);
}

I'm having the hardest time with this, and I've tried all sorts of variations of the code above. Please let me know if you have the solution.

Thanks for your help!

sentences:
Server reconciliation for multiplayer games Reading the usual resources on multiplayer games (1, 2, 3); I have started working on my own multiplayer game.

I used a naïve approach that for every input I receive from a client, I immediately run it on the server.

For simple units (soldiers) everything works well, however I have an issue with "always moving" units (such as jet fighters); They require queuing inputs on the server (small delay, less than 100ms) and performing them in delay - and I read elsewhere (1, 2) that you should allow a window to receive inputs longer than said delay, since latency is variable (and could easily reach over 100ms) and reconcile the player's input.

Now I understand how this works for simple input such as movement, but what about using weapons / more advanced input?

What happens if player input comes with a delay, where he wishes to fire his weapon - what do I do? When do I notify other players of the shot? What about it's result? What if my cool-downs are out of sync due to this reconciliation?

Thanks.

sentences:
What elements make a simple game addictive? Possible Duplicates:
What should a game have in order to keep humans playing it?
How can I make my score-based game addictive
What makes puzzle games addictive?

I am creating simple game for iPhone like "Bubble Explode". Generally, what elements of game make it addictive and exciting for similar simple games.

sentences:
Slick2D: constructor vs. init method What is the difference between the constructor of a BasicGameState and the init method?  It appears that they are both called at the same time when the BasicGameState is registered in StateBasedGame, so what makes them different?

A follow up question to this is how do I run a method only when a state becomes active?  Initially I thought the init method was only called when a new state becomes active, but this is not true.  Note that I'd like to call this method only once at the beginning of the new state, so putting it in the update method seems like the wrong place.

sentences:
Why does Unity Eventsystem lag on first touch? Hi I am making a very simple simple platformer game for android devices. I am using Unity's event system for player movement. The problem is when I touched the button first time there is a lag (hiccup) after then everything is ok. I have profiled my game there is a spike in EventSystem Update method.

here is the simplified code,

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

[RequireComponent (typeof(Rigidbody2D)) ]
[RequireComponent (typeof(BoxCollider2D)) ]
public class PlayerController : MonoBehaviour {

public float movementSpeed = 5f;
public float jumpForce = 5f;
public float distanceToGround = 0.2f;
public LayerMask staticCollider;
public playerState state;

private Rigidbody2D rBody;
public Transform leftmost;
public Transform rightmost;

Collider2D[] platforms = new Collider2D[2];
public int hrInput = 0;

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

}

//FixedUpdate is framerate independent, and therefore completely unrelated to your framerate

void FixedUpdate ()
{
    state.grounded = isGrounded ();

    if (hrInput > 0) {
        MOVE_RIGHT ();
    }
    else if (hrInput < 0) {
        MOVE_LEFT ();
    } else {
        STOP_MOVE ();

    }

}

public bool isGrounded(){
    print ("ground");
    if (Physics2D.OverlapAreaNonAlloc (leftmost.position, rightmost.position, platforms, staticCollider) > 0) {
        return true;
    } else
        return false;
}

public void setHrInput (int h ) {
//    print (h);

    hrInput = h;
}

public void JUMP(){
    if(state.grounded){
        state.onAir = true;
      //  rBody.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
        rBody.velocity = Vector2.up * jumpForce;
    }
}

public void MOVE_LEFT(){
    rBody.velocity = new Vector2 (-1 * movementSpeed * Time.deltaTime, rBody.velocity.y);
}

public void MOVE_RIGHT(){
    rBody.velocity = new Vector2(1 * movementSpeed*Time.deltaTime, rBody.velocity.y);
}

public void STOP_MOVE(){
    rBody.velocity = new Vector2(0,rBody.velocity.y);
    }

} // end

Here is the profiler Image.

Please help me to fix this issue.

sentences:
from unity, how do I set up timer for c# httprequest? so I'm trying to make a internet connection with c# using unity, and what I want to do is make the client to connect to the site, and load the data.

but there are cases there's lag, or weak connection, etc. that prevents you from getting connected, and I want the client to stop attempting to connect and just return connectionError or something like that after certain amount of time.

my code for this so far:

void HTTPRequest_TimeOut ( )
{

    string url = "serverAddress";

    HTTPRequest request = new HTTPRequest ( new Uri ( url ), (req, resp ) =>
        {
            switch ( req.State )
            {
                case HTTPRequestStates.Finished:
                    // utf-8 인코딩.
                    byte [] Bytes_For_Encoding = Encoding.UTF8.GetBytes ( resp.DataAsText );
                    string Encoded_String = Convert.ToBase64String ( Bytes_For_Encoding );

                    // utf-8 디코딩.
                    byte [] Decoded_Bytes = Convert.FromBase64String ( Encoded_String );
                    string Decoded_String = Encoding.UTF8.GetString ( Decoded_Bytes );

                    JsonData getdata = JsonMapper.ToObject ( Decoded_String );
                    DB_INPUT_test ( getdata, "items" );

                    break;

                case HTTPRequestStates.Error:
                    Debug.LogError ( "Request Finished with Error! " );
                    break;

                case HTTPRequestStates.Aborted:
                    Debug.LogWarning ( "Error : Request Aborted!" );
                    break;

                case HTTPRequestStates.ConnectionTimedOut:
                    Debug.LogError ( "Error : Connection Timed Out!" );
                    break;

                case HTTPRequestStates.TimedOut:
                    Debug.LogError ( "Error : Processing the request Timed Out!" );
                    break;
            }
        } );

    request.Timeout = TimeSpan.FromSeconds ( 100 );
    request.DisableCache = true;
    request.Send ( );
}

at first I thought just changing request.Timeout would do the trick, I guess not?

currently if the connection is not strong(making mobile game) it just kinda "hangs" there, waiting for anything to load up.

sentences:
Collision in EdgeCollider Unity I want to make a collider for a line that I've drawn on the screen using mouse. so the detection should be cover the whole line that has drawn.

What I've learned from edge collider is you can have collider if you assign the position of a certain point in col.transform.position (for example I can assign the startpos of my line and the collider works only for that point).

the green line which is drawn by mouse in front of car is using the LineRenderer and requires EdgeCollider to be a road that car can drive on it's surface

and my functions:

private LineRenderer line; // Reference to LineRenderer
private Vector3 mousePos;
private Vector3 startPos;   // Start position of line
private Vector3 endPos; // End position of line
public Material material;

void Update()
{
    // On mouse down new line will be created
    if (Input.GetMouseButtonDown(0))
    {
        if (line == null)
        {
            createLine();
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(0, mousePos);
            startPos = mousePos;
        }
    }
    else if (Input.GetMouseButtonUp(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
            endPos = mousePos;
            addColliderToLine();
            line = null;
        }
    }
    else if (Input.GetMouseButton(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
        }
    }
}
// Following method creates line runtime using Line Renderer component
private void createLine()
{
    line = new GameObject("Line").AddComponent<LineRenderer>();
    line.material = material;
    line.SetVertexCount(2);
    line.SetWidth(1.1f, 1.1f);
    line.SetColors(Color.black, Color.black);
    line.useWorldSpace = true;
}
// Following method adds collider to created line
private void addColliderToLine()
{
    EdgeCollider2D col = new GameObject("Collider").AddComponent<EdgeCollider2D>();
    col.transform.parent = line.transform; // Collider is added as child object of line

    col.points[0] = startPos;
    col.points[1] = endPos;

    Vector3 midPoint = (startPos + endPos) / 2;
    col.transform.position = midPoint; // setting position of collider object
    // Following lines calculate the angle between startPos and endPos
    float angle = (Mathf.Abs(startPos.y - endPos.y) / Mathf.Abs(startPos.x - endPos.x));
    if ((startPos.y < endPos.y && startPos.x > endPos.x) || (endPos.y < startPos.y && endPos.x > startPos.x))
    {
        angle *= -1;
    }
    angle = Mathf.Rad2Deg * Mathf.Atan(angle);
    col.transform.Rotate(0, 0, angle);
}

btw i don't know what that col.points[] used for. I just found it from the unity documentation which won't make any collision

sentences:
Input before or after update/draw? This is how I understood the game loop, and I wanted to know if I'm correct or not:

1) Draw/render -> input
CPU    |    GPU
------------------
Update |
Draw   |
Input  | Rendering

2) Input -> Draw/render
CPU        |    GPU
------------------
Input      |
Update     |
Draw       |
(nothing?) | Rendering

By rendering I mean updating the actual frame. What happens in the second case? Is the CPU doing nothing or is it checking input for the next frame already? Are there any differences from checking input before or after the update/draw part?

sentences:
How can I refactor "attack cooldown" into "attack speed"? I'm building a game where the player's character can attack bad guys and vice versa. I built this with the concept of an "attack cooldown" because I don't want units to be able to attack each other every single frame.  I want there to be some delay between attacks.  Here's roughly how it works:

if unit.ticksUntilAttack <= 0
  unit.attack(target)
  unit.ticksUntilAttack = unit.attackCooldown
unit.ticksUntilAttack = unit.ticksUntilAttack - 1

I also have a page where I show the character's stats and list this as "Attack Cooldown".  I was showing my friend and he said, "Why don't you rename that to 'Attack Speed'"?  I explained that it's not really the speed at which you attack because "smaller is better".  We both agreed that "attack speed" is a more standard way to show this concept and that I should change things the way he suggests.

The problem for me is that "attack cooldown" is a much more intuitive way for me to program the solution.  I'm wondering if there's some "trick" to refactoring the current code I've got.  I'm thinking something like this:

if unit.attackSpeedAccumulator >= SUM_NEEDED_TO_ATTACK //a constant that's the same for every unit
  unit.attack(target)
  unit.attackSpeedAccumulator = 0
unit.attackSpeedAccumulator = unit.attackSpeedAccumulator + unit.attackSpeed

Is there a smarter way to do this?

sentences:
Transform.LookingAt() does nothing To get used to how Godot transforms work, I am attempting to write an orbit control. The goal is for it to behave similarly to the Godot viewport.

So far I have the positioning of my camera working. However, when I try to point it at the center of orbit (0,0,0), the LookingAt() function doesn't seem to work. I have printed the values to the console and just proves beyond a doubt that there isn't any change.

I've tried moving the camera around and using different values for the up-axis, but it still doesn't work.

Here are the pertinent functions from my Camera node's script:

private Vector2 rotateStart;
private Vector2 rotateEnd;
private Spherical spherical = new Spherical();
private Vector3 target = new Vector3();

public void HandleRotation(float delta)
{
    var transform = GetGlobalTransform();
    var viewportSize = GetViewport().GetVisibleRect().Size;

    rotateEnd = GetViewport().GetMousePosition();
    Vector2 RotateDelta = rotateEnd - rotateStart; //Change in rotation
    spherical.SetFromVector(transform.origin); //Spherical = current location

    //Calculate changes to equatorial and vertical rotations.
    spherical.theta += 2 * (float)Math.PI * RotateDelta.x / viewportSize.x;
    spherical.phi += 2 * (float)Math.PI * RotateDelta.y / viewportSize.y;
    var final_transform = new Vector3();

    spherical.CopyToVector3(ref final_transform);
    transform.Translated(final_transform - transform.origin); //Apply position change
    GD.Print(transform);

    //Point at origin (point of orbit)
    transform.LookingAt(target, new Vector3(0, 1, 0));
    GD.Print(transform);
    SetGlobalTransform(transform);

    rotateStart = rotateEnd;
}

public override void _Process(float delta)
{
    if (Input.IsMouseButtonPressed((int)ButtonList.Middle))
    {
        HandleRotation(delta);
    }
    else
    {
        rotateStart = GetViewport().GetMousePosition();
    }
}

sentences: How to detect if game is hidden? I'd like to pause my game when my app is hidden (user pressed home button or changed app). How can I detect that ?

sentences:
Player motion and combo systems Where do you usually implement player motion when going through the state machine of a combo system?

An example, when player presses X+Y it must do an uppercut like movement (Like street fighter) where the player jumps and hits. Another example could be the Devil may cry series where you can press down+sword button and the enemy is thrown up and the player authomatically jumps to let player hit target in the air.

When creating a combo, you have 2 things to take care of. One is the media that will be played when the combo is done (sound, animation, etc...) and the other the movement of the player when doing this combo.

How do you handle the movement of the player? I have 2 posible options:

1) Include the player motion (translation, rotatio, etc...) in the animation

2) Delegate the player motion to the combo nodes while they are being linked.

First option could be the easiest but seems a bit restrictive. For example if you want to let the player do some other action while the current combo node media is playing (ej. jumping) could be tricky (Jump + hit).

Second option would need to have some many diffeernt nodes (We could use some kind of delegates here to minimize the node count(IOC)) to cover all the motion needs of every part of the combo.

What do you think. Am I thinking too much?

Cheers.

sentences:
IntersectMovingAABBAABB weird behavior I'm using the IntersectMovingAABBAABB implementation from the book Realtime Collision Detection and I'm having a little bit of an issue. When I have two AABBs next to each other (not touching), A being stationnary and B moving up or down, I'm getting a result saying there's a collision. Obviously this is wrong.

 _______     _______
|       |   |       |
|   A   |   |   B   |  B moving up/down
|_______|   |_______|

I've rechecked my code multiple times to make sure I had the same thing as in the book. Stepping through the code, I realized that the check for v[i] < 0 and v[i] > 0 will never be true for either X or Z axis when moving straight up or down. Therefor, no checks for intersections on these axis will be done. I find that quite weird, and I was wondering if I was missing something, or if this code is simply bad.

Here's my implementation for reference:

public static bool IntersectMovingAABBAABB(AABB a, AABB b, Vector3 va, Vector3 vb, out float first, out float last, out BlockFace face)
{
    face = BlockFace.None;
    if (TestAABB(a, b))
    {
        first = last = 0;
        return true;
    }

    Vector3 v = vb - va;
    float current;

    first = 0;
    last = 1;

    for (int i = 0; i < 3; i++)
    {
        if (v[i] < 0)
        {
            if (b.Max[i] < a.Min[i]) return false;
            if (a.Max[i] < b.Min[i]) if ((first = Math.Max(current= (a.Max[i] - b.Min[i]) / v[i], first)) == current) face = (BlockFace)(1 << (i));
            if (b.Max[i] > a.Min[i]) last = Math.Min((a.Min[i] - b.Max[i]) / v[i], last);
        }

        if (v[i] > 0)
        {
            if (a.Max[i] < b.Min[i]) return false;
            if (b.Max[i] < a.Min[i]) if ((first = Math.Max(current = (a.Min[i] - b.Max[i]) / v[i], first)) == current) face = (BlockFace)(1 << (i + 3));
            if (a.Max[i] > b.Min[i]) last = Math.Min((a.Max[i] - b.Min[i]) / v[i], last);
        }

        if (first > last) return false;
    }

    return true;
}

sentences:
How to draw the imagebutton and place it in the lower left corner I have the button:

soundBtnStyle = new ImageButton.ImageButtonStyle();
    soundBtnStyle.up = skinBac.getDrawable("on");//
    soundBtnStyle.down = skinBac.getDrawable("off"); //

    soundsButton = new ImageButton(soundBtnStyle);
    soundsButton.setSize(120, 120);

    soundsButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            game.rainMusic.setVolume(0.0f);
        }
    });

call the button in the constructor,I can not figure out how to add a button to the stage.

game.batch.begin();
    game.batch.draw(soundsButton, 0, 0,120, 120);
game.batch.end();
enter code here

It does not work, an error

sentences:
Selecting the entities needed for rendering Currently I'm sorting and looping every entity on my level but I really don't need to. Only a small subset would be on screen.

If I could extract a list of entities from my main list that are on screen (or near the screen), that would be great, but I believe maintaining a different kind of list like a quad-tree or something might be in order, but I have no experience with such things.

How can I do this?

sentences:
How to make bullets follow a rotating sinewave pattern I am trying to replicate the wave gun from Super Metroid where the bullets fly along a sine wave path. The cool part is that you can shoot in 8 directions and the bullet still follows the sine as if the whole sine function is rotated. I've tried using a 2d transformation to allow shooting in every angle but I cant get it to work. Here my code so far (JSFiddle.net). If you uncomment the line "Axis.dir += .02;" in the fiddle to start the rotation you'll notice that the black box doesn't follow it's axis at all.

var canvas = document.getElementById("can"),
  ctx = canvas.getContext("2d"),
  width = canvas.width, height = canvas.height,
  Axis = { x: width / 2, y: height / 3, dir: 0, vx: 0, vy: 0, speed: 4 },
  Sine = { x: Axis.x, y: Axis.y, angle: 0 },
  loop = function() {
      var rotatedX, rotatedY;
      // Draw
      ctx.clearRect(0, 0, width, height);
      ctx.fillStyle = "#F00";
      ctx.fillRect(Axis.x, Axis.y, 5, 5);
      ctx.fillStyle = "#000";
      ctx.fillRect(Sine.x, Sine.y, 10, 10);
      // Apply speed
      Axis.vx = Math.cos(Axis.dir) * Axis.speed;
      Axis.vy = Math.sin(Axis.dir) * Axis.speed;
      Axis.x += Axis.vx;
      Axis.y += Axis.vy;
      Sine.x = Axis.x;
      Sine.y = Axis.y + (Math.sin(Sine.angle) * 30);
      // Apply rotation
      rotatedX = Sine.x * Math.cos(Axis.dir) - Sine.y * Math.sin(Axis.dir);
      rotatedY = Sine.x * Math.sin(Axis.dir) + Sine.y * Math.cos(Axis.dir);
      Sine.x = rotatedX;
      Sine.y = rotatedY;
      Sine.angle += .03;
      Axis.dir += .02;
      // Keep drawn stuff on the screen
      if (Axis.x > width && Axis.vx > 0) Axis.x = 0;
      if (Axis.x < 0 && Axis.vx < 0) Axis.x = width;
      if (Axis.y > height && Axis.vy > 0) Axis.y = 0;
      if (Axis.y < 0 && Axis.vy < 0) Axis.y = height;
      window.requestAnimationFrame(loop);
  }
loop();

sentences:
Is it bad practice to for the server to request data for a client from another client? I'm making a collaborative whiteboard app so that when someone is drawing and uses a rectangle for example, a rectangle packet is sent to the server with parameters like x, y, width, height, color and then that packet is sent to everyone else in the room so that a rectangle is drawn on their screen.

So far everything works perfectly and there's also a stack on each client of all the commands thus far for infinite undo and redo. However, there server does not contain this stack because all it has to do is forward commands to clients in the room.

Everything is working perfectly so far and everyone can see everyone else drawing in real time but I'd like to implement a feature where if someone joins a room late they can see the current whiteboard. That is, the entire command stack would have to be sent to someone. However, this data isn't stored on the server, but each client has their own (identical copy).

Would it be bad for when someone joined to have the server ask one of the clients (which? round-robin?) to send his command stack to the server and have the server forward it to the client? My concerns are the delay and teh amount of data being sent in one go (congestion).

What do you all think? Are there any other options?

sentences:
Bullet softbody nodes messed up positions I recently switched from Havok physics to Bullet because I wanted to have soft body collisions, but I don't have any budget to license the (superior?) Havok solution, I couldn't even try those functions out there so it is completely new to me.
I want to create a soft body from an arbitrary mesh and for that I use the soft body helper:

btVector3* btVerts = new btVector3[vertices.size()];
for(int i=0;i<vertices.size();++i)
    btVerts[i] = (btVector3(vertices[i].pos.x,vertices[i].pos.y,vertices[i].pos.z));
const int iCount = indices.size();
const int tCount = iCount/3;
int* btInd = new int[iCount];
for(int i=0;i<iCount;++i){
    btInd[i] = (int)indices[i];
}

btSoftBody* softBody = btSoftBodyHelpers::CreateFromTriMesh(
        ((btSoftRigidDynamicsWorld*)dynamicsWorld)->getWorldInfo()
        ,(btScalar*)btVerts
        ,&btInd[0],tCount
        ,false
    );

Where vertices and indices are vector references coming from my graphics engine. I fill out the mesh with that information and seemingly I can create it without problem. After I step the physics world I connect my BULLET softbody nodes to my vertices in the graphics engine, then updating the vertex buffer.
I get the information from the softbody nodes by their tNodeArray m_nodes this way:

btSoftBody::tNodeArray&   nodes(softBody->m_nodes);

    for(int j=0;j<nodes.size();++j)
    {
        verticesIn[j].pos=XMFLOAT3(nodes[j].m_x.getX(),nodes[j].m_x.getY(),nodes[j].m_x.getZ());
        verticesIn[j].nor=XMFLOAT3(nodes[j].m_n.getX(),nodes[j].m_n.getY(),nodes[j].m_n.getZ());
    }

The problem: However I do not get correct vertex positions and neither correct normals. I am using a simple quad mesh with 4 vertices (the positions):
{ (-1,0,-1), (1,0,-1), (1,0,1), (-1,0,1) }
But if I get values from the softbody's nodes after creation, but before stepping any physics I don't get back my original values from the nodes (the positions):
{ (-1,0,-1), (0,1,0), (-1,0,1), (0,1,0) }
I even noticed the node vertices kind of resemble the originals, just "overlapped" somehow or not sure how can I describe if it is even the case, but it is like the second vector has an extra zero at the beginning and the whole mesh got screwed up.
Could it be something is not right with my loading? Or do I miss something in the concept of soft body physics?
I have studied the bullet soft body sample which is quite informative and they sure load their meshes like I do (the bunny mesh for instance), at least it seems like it. I don't have any idea and got stuck here for a day now. Without connecting to the softbody, my mesh remains correct.

sentences:
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:
Finite-state machine with more than one concurrent state I am using a FSM for the player entity and it is working fine. Currently the entity has one state and only one (e.g. paralyzed). The entity's state process() method is called every turn.

It is necessary however, that each entity can have more than one state simultaneously (e.g. paralyzed and blinded). Each state affects the entity attributes e.g. paralyzed reduces the walking range to 10% and blindness reduces it to 50%. Vision range is not affected by paralyzed state, but by blindness (set to 0).

Now it is important in which order the states are processed. I either end up with a wrong walking range or a wrong vision range. I could do checks in every state's process() whether the entity has any other states and alter the code accordingly, but this gets very messy the more states I add.

Currently I think it's a better choice to attach only one state to the entity, but to create more states, some of them a combination of two states (e.g. a blindedAndParalyzed). This way I'll and up with a lot more states than I currently calculated with, because ever state has to be combined with other states. I'm wondering if that is the best solution?

A state is a Singleton with an enter, process and exit method. Process is called each turn.
Currently process() for paralyzed looks like this:

public void process(){
   walkRange = 10% * walkRangeBase;
   visionRange = visionRangeBase;
}

and process() for blinded looks like this

public void process(){
   walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

At the moment the result is always fine becvause only the process() method of only one state is executed. If I switch to multiple states both get executed and the result is either walkRange = 50% and visionRange = 0 or walkRange = 10%. THe desired result would be a walkRange of 10% and a visionRange of 0, because the walkRange should be limited to the smallest one.
I could do something like that:

public void process(){
   if(state != paralyzed)
      walkRange = 50% * walkRangeBase;
   visionRange = 0;
}

But i have around 20 different states, so I have to create a lot of if cases. Choosing the smallest value for e.g. walkRange doesn't work either because there are some states with positive effect on walkRange.
So I am wondering if it is better to avoid a state machine with more than one concurrent state and live with a bigger amount of states (about 50), or if there si another solution to this problem.

sentences:
Is drawing an entire game to a render target and then scaling it up a viable solution to a pixel-mismatching problem? To clear up some possible confusion caused by my title, my game is meant to be pixelly. I currently achieve this by multiplying sprite sizes and locations by a constant called World.Scale (currently 8). This means every pixel is now 8x8 on screen, which is what I want.

However, I want an easier way to do game calculations without having to figure out where to fit World.Scale whenever I'm drawing or calculating something. Also, I'm currently having trouble with pixel-mismatching (see image).

To solve this, I thought about rendering everything in the game onto a render target, and then scale that render target up by World.Scale and draw it to the screen but I'm not sure how render targets work so I'm not sure about any possible performance implications of this.

Is it a good idea? Is there a better alternative?

sentences:
Unity 3D [C#] - How to properly reset a scene I have a problem when I try to reset a scene. It doesn't seem to run, I have a script (of all scripts that have Awake and Start methods on that scene) that on the Awake method starts a coroutine, but when reseting the scene it doesn't even run it. I've read that it may be a problem of using the DontDestroyOnLoad method, but that doesn't seem to solve the problem since that script on the start takes a lot of references of objects that are only on the scene that I want to restart. I don't use any static variables on any script.

I made an unitary test trying to restart a scene with just one object and one script attached, on its Start method it also starts a coroutine but even in that test it doesn't even run the coroutine.

Here's the script of the unitary test:

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class LoadingSceneController : MonoBehaviour
{
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
    }
    //Scene scene;
    // Use this for initialization
    void Start()
    {
        //scene = SceneManager.GetActiveScene();
        DontDestroyOnLoad(this.gameObject);
        useStartCoroutine();
    }

    void useStartCoroutine()
    {
        StartCoroutine(loadScene());
    }

    IEnumerator loadScene()
    {
        yield return new WaitForSeconds(3);
        SceneManager.LoadScene("gameplayScene 1");
        //SceneManager.LoadSceneAsync("gameplayScene 1");
    }
}

sentences:
Can I use the default depth buffer when drawing to FBO? How to attach default depth buffer to FBO?
How to use depth renderbuffer buffer attached to FBO (after drawing to it) as a default depth buffer?

Basically I want to use the same depth buffer for both the FBO and backbuffer rendering.

sentences:
Can J2EE be used to implement games ? Is there any connection between J2EE and games? Making an game using applets, but have to implement project using J2EE. Is there any sense in making a game with using J2EE for implementation ?

Our teacher said that we can make games for the java project, now she has put in the requirement that we have to use J2EE, and expects us to make the game. Where does J2EE comes in the picture ?

sentences:
LibGDX Overlay Game with Stage I have been working on a 2d game that is similar to billiards/pool. I've got the basic game down and now I'm working on some visual effects. One of the things I would like to do is have have numbers pop up on the screen where a scoring event occurs and then have that number "swoosh up" to the main score at the top of the screen. To accomplish this I have been trying to overlay a Stage onto my main game area so that I can add score text and then let the LibGDX Scene2d take over. I am adding the text as an actor to the stage and then assigning some actions to it to achieve the desired effect. The problem I'm having is that when I add the object I need to convert from world to stage coordinates. This is because I want to place the score popup where two balls touch, which is in world coordinates. I have tried to use the "project" method of the stage's viewport (it is a FitViewport) but the coordinates never translate correctly.

Now that I've explained what I'm trying to do, I was hoping that someone would know how I could pull this off. I'm sure it isn't difficult and that I'm missing some small detail.

Here is the relevant code:
This is the class that will be used to overlay a stage onto the main game screen.

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.utils.viewport.Viewport;

public class UIOverlay {

    private Skin skin = new Skin(   Gdx.files.internal("skins/gamePlaySkin.json"));
    private Stage stage = new Stage();

    public void init (Viewport viewport) {

        stage.setViewport(viewport);
        stage.getViewport().update(GameWorld.WIDTH, GameWorld.HEIGHT, true);
    }

    public void render () {

        stage.act();
        stage.draw();
    }

    public Stage getStage () {

        return this.stage;
    }

    public void addScorePopup (int score, Vector2 worldPos) {

        Viewport vp = stage.getViewport();
        Vector2 screenPos = new Vector2(worldPos.x, worldPos.y);
        vp.project(screenPos);

        // Some sample vectors after projection:
        // worldPos.x = 0.88585174, worldPos.y = 1.6051532
        // screenPos.x = 0.885849, screenPos.y = 1022.39484
        // Another Set:
        // worldPos.x = 0.63776636, worldPos.y = 0.8991218
        // screenPos.x = 0.63777924, screenPos.y = 1023.1009

        Label popLabel = new Label(String.valueOf(score), skin, "popupScore");
        stage.addActor(popLabel);
        popLabel.setPosition(screenPos.x, screenPos.y);

        float time = 0.5f;
        popLabel.addAction(Actions.delay(1000, Actions.sequence(Actions.moveTo(0.0f, 0.0f, time, Interpolation.sineIn), Actions.alpha(0, 0.1f))));
    }
}

This is where I set up the main game viewport:

public static void init(){
    // GameWorld.WIDTH and HEIGHT are 1280 and 1024
    m_camera = new OrthographicCamera();
    m_camera.setToOrtho(true, GameWorld.WIDTH, GameWorld.HEIGHT);
    m_viewport = new FitViewport(GameWorld.WIDTH, GameWorld.HEIGHT, m_camera);
}

When creating the UIOverlay I pass the game's m_viewport into UIOverlay.init(). I have also tried creating a new FitViewport in UIOverlay with the same dimensions as the game's viewport, but have the same behavior.

sentences:
Physics timestep questions I've got a projectile working perfectly using the code below:

//initialised in loading screen
    60 is the FPS - projectilEposition and velocity are Vector3 types

gravity = new Vector3(0, -(float)9.81 / 60, 0);
//called every frame
projectilePosition += projectileVelocity;

This seems to work fine but I've noticed in various projectile examples I've seen that the elapsedtime per update is taken into account. What's the difference between the two and how can I convert the above to take into account the elapsedtime? (I'm using XNA - do I use ElapsedTime.TotalSeconds or TotalMilliseconds)?

Edit: Forgot to add my attempt at using elapsedtime, which seemed to break the physics:

projectileVelocity.Y += -(float)((9.81 * gameTime.ElapsedGameTime.TotalSeconds * gameTime.ElapsedGameTime.TotalSeconds) * 0.5f);

Thanks for the help

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:
Cocos2d-x : Socket.io-client-cpp crashes after creating scene I'm using https://github.com/socketio/socket.io-client-cpp with cocos, because the built-in socket.io doesn't support callback (http://discuss.cocos2d-x.org/t/doesnt-work-with-socketio-2-0-1-and-failed-calling-back-with-old-version/37225/3)

Everything is fine, until i want to push new scene after receiving server signal
Here is my code

SocIO::SocIO() {

    // client object
    _client = new sio::client();
    _client->connect("ws://localhost:3000");
       ....
       _client->socket()->on("joinedRoom", bind(&SocIO::joinedRoom, this, placeholders::_1));
}

void SocIO::joinedRoom(sio::event &a)
{
    Scene* newScene = PlaygroundScene::createScene(1); // crash on this line
}

I don't know what happened here, didn't get this error with built-in socket.io.
Is it because of threading?

sentences:
How can I perform a deterministic physics simulation? I'm creating a physics game involving rigid bodies in which players move pieces and parts to solve a puzzle/map. A hugely important aspect of the game is that when players start a simulation, it runs the same everywhere, regardless of their operating system, processor, etc...

There is room for a lot of complexity, and simulations may run for a long time, so it's important that the physics engine is completely deterministic with regards to its floating point operations, otherwise a solution may appear to "solve" on one player's machine and "fail" on another.

How can I acieve this determinism in my game? I am willing to use a variety of frameworks and languages, including Javascript, C++, Java, Python, and C#.

I have been tempted by Box2D (C++) as well as its equivalents in other languages, as it seems to meet my needs, but it lacks floating point determinism, particularly with trigonometric functions.

The best option I've seen thus far has been Box2D's Java equivalent (JBox2D). It appears to make an attempt at floating point determinism by using StrictMath rather than Math for many operations, but it's unclear whether this engine will guarantee everything I need as I haven't built the game yet.

Is it possible to use or modify an existing engine to suit my needs? Or will I need to build an engine on my own?

sentences:
Triangle mesh smoothing I have a grid in terms of two arrays:

points: contains 3D coordinates of points.

triangles: contains 3 indices per line for each triangle of the grid.

I would like to interpolate the grid to make it smoother, i.e. add extra points and triangles in such a way that the grid is smoother than it is at the moment. But I found that scipy.interpolate only works if the xy-points are regular, which is not the case here. Any suggestions?

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:
Board-Games Design: Physical vs Digital? Is there any difference when learning the designing of a physical board-game and digital board game, meaning if I watch a tutorial about a physical board-game design is it applicable on a digital one?

Note: I'm focusing only on design process, not the art-design, only on the gameplay-design (rules, levels, obstacles, etc).

sentences:
Will Unity automatically scale everything? I don't have a GUI or anything. Just a bunch of game objects with pictures on them.

I want everything to scale with the size of the screen. So if it's a small screen, the character will take up less of the screen, instead of the screen just cutting off at the edges. If the screen is larger, everything is larger.

Is this something I should do? Will Unity automatically do this?

I've been told that the project should have the following specifications:

"The app should be appropriately scaled to fit the device screen to avoid letterboxing"

Use bg.png as the background of the app. Ideally, the background should be centered to the
app such that the left and right edges go off the screen if the device aspect ratio is less than 16:9.

Is what I'm describing fitting the specifications here? What will Unity do for me? I don't have a phone to actually test this on so I don't know what the app will end up looking like.

sentences:
Black screen after unity updated to 2019.4.17and later on Android I upgraded my app from Unity 2019.4.9 to 2019.4.21.  it seems to work fine in the editor, but on my Android build I just get a blank screen.  No splash screen, no app main window.  I've been able to isolate it to the update from 2019.4.16 to .17 that breaks it.  I can toggle back and forth, build .16 it works, .17 and higher are all black screen.  I tried (.17,.18 and .21)
only thing relevant in the logs seems to be:
03-13 10:49:09.689  1458  7484 I WindowManager: WIN DEATH: Window{378e77 u0 com.mycompany.myapp/com.unity3d.player.UnityPlayerActivity}
03-13 10:49:09.689  1458  7484 W InputDispatcher: Attempted to unregister already unregistered input channel
03-13 10:49:09.689  1458  2335 I ActivityManager: Process com.mycompany.myapp (pid 8851) has died: fore TOP (366,458)

i'm building for Mono, .NET 4.x and Targeting ARMv7
anyone else run into this?  any info on what I should look at next to continue to debug?  anyone know what changed in .17 that might be causing this?

sentences:
Score won't save to Android in Game Maker Studio 1.4 I have oController as the first object to run when the game is opened. In oController's Game Start event
I have the following code:
ini_open(working_directory + "SavedScores.ini");
var highscores = ini_read_real("Highscores", "Score", 0);
ini_close();

global.LastScore = highscores;

When the player has gotten their score, I use this code to save it:
if global.gameOver {

    if global.LastScore == 0 {
        global.LastScore = global.currentScore;

        ini_open(working_directory + "SavedScores.ini");
        ini_write_real("Highscores", "Score", global.LastScore);
        ini_close();
    } else {
        if global.currentScore > global.LastScore {
            global.LastScore = global.currentScore;

            ini_open(working_directory + "SavedScores.ini");
            ini_write_real("Highscores", "Score", global.LastScore);
            ini_close();
        }
    }
}

Whenever I relaunch the game on my phone, it won't load the score I got when I previously launched the game. Idk why it's not saving?

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:
Complex, yet simple crafting system model I'm working on some arcade shooter/slasher, and the main logline is "Kick'em with everything you want". There's not so many enemies in GDD, main focus is on tons of weapons and gadgets to cause mayhem.
To get weapon, you need to craft it, and now crafting system looks simple, like:

1) You got three slots for weapon parts (like A, B, C)
2) You collect misc weapon parts, and when you got atleast one for every slot, you can craft a weapon (for example, if you got A1, B1, B2, B3 and C1, you can craft such models - A1B1C1, A1B2C1, A1B3C1)

As for me, this crafting system is too simple, because weapon parts will just fall from the top of screen, often enough. That's why I'm thinking about adding some more crafting system levels, like resources (collect 10 scrap pieces to make part A1 or C3), etc.

My question is:
How can i add some more complex, still simple, transparent levels in crafting system?

upd. For example, in Minecraft or Terraria, first 5-10 crafting recipies quite transparent and simple IMHO. But then it turns into huge mess to understand, how to craft this or that (for example, fishing rod)

upd. Okay, somehow i've figured out mechanics like this:
1) Player gather resources (while playing game, automatic gathering from loot)
2) When there's enough resources to craft some weapon part, dedicated icon flashes, so player can craft weapon part in one click (automatic crafting)
3) Having several weapon parts, player can adjust different parts to create weapon (manual crafting)

I think, this will be complex and simple enough, now over-weighted by to many buttons and receipes, still, enough of freedom and manual creativity, trying to mix this and that.

sentences:
Animating isometric sprites I'm having trouble coming up with a way to animate these 2D isometric sprites. The sprites are stored like this:

(Game Folder Root)/Assets/Sprites/(Sprite Name)/(Sprite Animation)/(Sprite Direction)/(Frame Number).png

So for example,

/Assets/Sprites/Worker/Stand/North-East/01.png

Sprite sheets aren't really viable for this type of animation. The example stand animation is 61 frames. 61 frames for all 8 directions alone is huge, but there's more then just a standing animation for each sprite. Creating an sf::Texture for every image and every frame seems like it will take up a lot of memory and be hard to keep track of that many images. Unloading the image and loading the next one every single frame seems like it will do a lot of unnecessary work. What's the best way to handle this?

The reason I am not using a sprite sheet is because these sprites are hi-res images with many animations which all have a large quantity of frames. The resulting sprite sheet would be massive. In case you're wondering, here was my implementation of creating animated sprites.

// Animation class declaration
class Animation
{
public:
        Animation(std::string path, int frames);
        ~Animation();
        void nextFrame();
        void gotoStart();
        bool loadFrames();
        sf::Texture& getActiveFrame();

private:
        int frameCount;
        std::string pathToAnimation;
        int currentFrame;
        sf::Texture frame[];
};

// Animation class implementation
Animation::Animation(std::string path, int frames)
{
        pathToAnimation = path;
        frameCount = frames;
}

Animation::~Animation()
{
        // destructor
}

void Animation::nextFrame()
{
        if(currentFrame < frameCount)
        {
            currentFrame = 1;
        }
        else
            currentFrame += 1;
}

void Animation::gotoStart()
{
        currentFrame = 1;
}

bool Animation::loadFrames()
{
        for(int i = 01; i < frameCount; i++)
        {
            if(!frame[i].loadFromFile(pathToAnimation + std::to_string(i) + ".jpg")) return false;
        }
        return true;
}

sf::Texture& Animation::getActiveFrame()
{
    return frame[currentFrame];
}

// Actor class declaration
class Actor
{
public:
        Actor();
        ~Actor();
        void setActiveAnimation(std::shared_ptr<Animation> anim);
        void draw(sf::RenderWindow& win);

private:
        sf::Sprite sprite;
        std::shared_ptr<Animation> activeAnimation;
};

// Actor class implementation
Actor::Actor()
{
    // constructor
}

Actor::~Actor()
{
    // destructor
}

void Actor::setActiveAnimation(std::shared_ptr<Animation> anim)
{
    activeAnimation = anim;
    activeAnimation->gotoStart();
}

void Actor::draw(sf::RenderWindow& win)
{
    sprite.setTexture(activeAnimation->getActiveFrame());
    win.draw(sprite);
    activeAnimation->nextFrame();
}

It's still not 100% where I'd like it to be but it's working and it's pretty easy to use.

sentences:
Eliminate isolated cave in procedural cave generation I've got an algorithm that generates a cave procedurally, the map is modeled in the data as a 2d array of 0s (empty space) and 1s (wall). The algorithm works just fine, but I've got quite some isolated small caves on the scene, which I would like to avoid.

That's how the map looks that gets generated. Is there some efficient algorithm to remove the black holes in the white wall sections? I was thinking of something like:

For every closed cave, check if there is a bigger cave and if so, close it.

But that seems insanely inefficient since I'd have to loop over the map a lot in order to do this for all small caves.

sentences:
How to detect a body between two points on LibGDX I've two Vector2 (A and B), i draw a line between them.

Is there a way to check if the line intersect the Box2D CircleShape?
I need to a boolean output

sentences:
No intellisense on my classes I've been using Monodevelop's current version and Unity 4.
I don't get intellisense on the classes I've created but I do have intellisense on classes that are in Unity's framework. Bug or its just as it is?

I use UnityScript:

class SomeClass extends ScriptableObject{
    public function Test(){return "";}
}

In another class, when I use a variable typed as this class I get no intellisense.

sentences:
Is there a way to blur objects in a 2d game with OpenGL without using shaders? Is there a nice way in OpenGL to blur objects without using shaders?

Currently, I'm accomplishing blur by rendering the object slightly up, down, left, right, and the four diagonals from its original position. It seems like there should be a much better way of doing this. I'm working in a 2d scene.

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:
Use floats or doubles when writing mobile games I know for shaders, floats should be used because they are the optimal choice for performance. Doubles are slow and use more memory which isn't ideal for shaders. While floats are less accurate and are prone to float overlflows, the tradeoff for speed is ideal on mobile hardware.

But what about everywhere else in the code base not related to the shader pipeline? I'm writing an engine and use doubles for the delta update tick and try to keep all units relative to that data type so there's lots of places using doubles. Should I be using floats on mobile in the engine as well?

The engine is written in C++ language

sentences:
How to detect when two bitmaps intersect in Android I made two bitmaps based off of two ImageViews using this code:

playerimage.buildDrawingCache();
Bitmap bplay1 = playerimage.getDrawingCache();
brickimg.buildDrawingCache();
Bitmap bbrick1 = brickimg.getDrawingCache();

I tried getting the height and width of each bitmap for collision detection, but it made the app crash. This is what I used for it:

int w1 = bplay1.getWidth();
int h1 = bplay1.getHeight();
int w2 = bbrick1.getWidth();
int h2 = bbrick1.getHeight();

Is there a different way to get the coordinates of a bitmap to test collision detection?

sentences:
iOS with cocos2d to MVC or not to MVC? I am working with cocos2d.

All my objects are declared on the CCLayer that I'm using, I have the logic of the game there and all the CCSprites.

Should I put the CCSprite for the player and all it's related properties (HP, Velocity, etc) in a Player object and then have that player object in my CCLayer?

But then how to add the CCSprite of the player to the CCLayer? Should I put in the CCLayer this?:

[self addChild:[PlayerObject playerSprite]];

Or should I create a controller?

sentences:
Why does the order matter in multiplication of matrixes? I stumbled on this question because I had the same problem with my camera, and changing the multiplication order worked.

I ran into a similar problem when scaling a model. This code produced the wrong result:

// world is an existing Matrix
var scale = world * Matrix.CreateScale(3.2f);

whereas this worked perfectly (scaled a model to 3.2x it's size):

var scale = Matrix.CreateScale(3.2f) * world;

I don't understand why the order matters though - in "normal" math (that is, 5*3 vs 3*5), swapping the factors yields the same result. I understand differences if there are more than 2 factors (like in this question), but I don't see the issue here?

I don't know much about how Matrices really work and so I don't know if that's an XNA quirk or if it would happen in OpenGL as well?

sentences:
Slow Firefox Javascript Canvas Performance? As a followup from a previous post, I have been trying to track down some slowdown I am having when drawing a scene using Javascript and the canvas element.  I decided to narrow down my focus to a REALLY barebones animation that only clears the canvas and draws a single image, once per-frame.  This of course runs silky smooth in Chrome, but it still stutters in Firefox.  I added a simple FPS calculator, and indeed it appears that my page is typically getting an FPS in the 50's when running Firefox.

This doesn't seem right to me, I must be doing something wrong here.  Can anybody see anything I might be doing that is causing this drop in FPS?

<!DOCTYPE HTML>
<html>
<head>
</head>
<body bgcolor=silver>
<canvas id="myCanvas" width="600" height="400"></canvas>

<img id="myHexagon" src="Images/Hexagon.png" style="display: none;">

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

var animX = 0;
var frameCounter = 0;
var fps = 0;
var time = new Date();

function animate() {

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

    context.clearRect(0, 0, canvas.width, canvas.height);

    animX += 1;
    if (animX == canvas.width)
    {
        animX = 0;
    }

    var image = document.getElementById("myHexagon");
    context.drawImage(image, animX, 128);

    context.lineWidth=1;
    context.fillStyle="#000000";
    context.lineStyle="#ffffff";
    context.font="18px sans-serif";
    context.fillText("fps: " + fps, 20, 20);

    ++frameCounter;
    var currentTime = new Date();
    var elapsedTimeMS = currentTime - time;
    if (elapsedTimeMS >= 1000)
    {
        fps = frameCounter;
        frameCounter = 0;
        time = currentTime;
    }

    // request new frame
    requestAnimFrame(function() {
        animate();
    });
}

window.onload = function() {
    animate();
};

</script>
</body>
</html>

--EDIT--

I did some additional experimentation, and now I'm not sure that this issue really has anything to do with canvas at all.

I added a "frame duration" counter in miliseconds, and neither Chrome nor Firefox ever go above 1 ms, so the code I am running inside animate is certainly not exceeding the 60 FPS frame time.  My current theory is that the Firefox browser just isn't giving me a consistent animation frame that is locked to V-sync; I had read some old posts about Firefox being capped in the 50's, and maybe this is still true?

So I tried a new method to compensate for the problem.  I started "pooling" my update time, and running an updatge step for each 16.6666 milisecond increment in the pool.  Frankly, this looks almost MORE jittery, but I am guessing that it at least maintains a more consistent timeline for a game.  Blech though :(  Is this really the best way to go?

sentences:
Drawing hexagonal grid on Android I'm trying to draw a hexagon grid in my Android application. I don't want to reinvent the wheel here, so I'm looking for some frameworks/libraries or just some basic ideas about how should one do this. Do you have some ideas?

What I found so far:

Some math but not for Android
Nice, but not for Java

sentences:
How AAA games use this texture in the tone-mapping shader? I found that Battlefield 3 as well as Saint's Row the Third use this texture in their final tone-mapping stage. Can anyone share a link to an article about how this texture is used?

UPDATE: As there are hardly any examples of Color Grading implementation on the net, I will post my quick and dirty sample for XNA 4.0. This does nothing but builds the default 2d colormap from scratch on GPU, copies it's contents into a 3d texture on CPU and performs the actual color-correction with the shader code from the article provided in the answer.
XNA 4.0 Color Correction Sample
If you want to know what you can do with this, look here:
http://the-witness.net/news/2012/08/fun-with-in-engine-color-grading/
In short the author explains there, how you can basically make a screenshot of your normal in-game image with the default color grading palette on top, perform screenshot color correction in photoshop, cut and copy the deformed color correction palette into the engine and have that color correction applied for every in-game scene automatically.

sentences:
How do I randomly generate a top-down 2D level with separate sections and is infinite? I've read many other questions/answers about random level generation but most of them deal with either randomly/proceduraly generating 2D levels viewed from the side or 3D levels. What I'm trying to achieve is sort of like you were looking straight down on a Minecraft map. There is no height, but the borders of each "biome" or "section" of the map are random and varied. I already have basic code that can generate a perfectly square level with the same tileset (randomly picking segments from the tileset image), but I've encountered a major issue for wanting the level to be infinite: Beyond a certain point, the tiles' positions become negative on one or both of the axis. The code I use to only draw tiles the player can see relies on taking the tiles position and converting it to the index number that represents it in the array. As you well know, arrays cannot have a negative index. Here is some of my code:

This generates the square (or rectangle) of tiles:

    //Scale is in tiles
    public void Generate(int sX, int sY)
    {
        scaleX = sX;
        scaleY = sY;

        for (int y = 0; y <= scaleY; y++)
        {
            tiles.Add(new List<Tile>());

            for (int x = 0; x <= scaleX; x++)
            {
                tiles[tiles.Count - 1].Add(tileset.randomTile(x * tileset.TileSize, y * tileset.TileSize));
            }
        }
    }

Before I changed the code after realizing an array index couldn't be negative my for loops looked something like this to center the map around (0, 0):

for (int y = -scaleY / 2; y <= scaleY / 2; y++)
for (int x = -scaleX / 2; x <= scaleX / 2; x++)

Here is the code that draws the tiles:

            int startX = (int)Math.Floor((player.Position.X - (graphics.Viewport.Width) - tileset.TileSize) / tileset.TileSize);
        int endX = (int)Math.Ceiling((player.Position.X + (graphics.Viewport.Width) + tileset.TileSize) / tileset.TileSize);
        int startY = (int)Math.Floor((player.Position.Y - (graphics.Viewport.Height) - tileset.TileSize) / tileset.TileSize);
        int endY = (int)Math.Ceiling((player.Position.Y + (graphics.Viewport.Height) + tileset.TileSize) / tileset.TileSize);

        for (int y = startY; y < endY; y++)
        {
            for (int x = startX; x < endX; x++)
            {
                if (x >= 0 && y >= 0 && x <= scaleX && y <= scaleY)
                    tiles[y][x].Draw(spriteBatch);
            }
        }

So to summarize what I'm asking: First, how do I randomly generate a top-down 2D map with different sections (not chunks per se, but areas with different tile sets) and second, how do I get past this negative array index issue?

sentences:
How can I apply a Camera Shader to UI? I am trying to make a shader that applies a black image with 50% transparency to the entire screen, with the exception of a designated area.  I am starting by just trying to apply a shader to the entire screen.  So I am using the default ImageEffect Shader.

This is my before and after when applying my shader, which should invert everything.  It inverts everything except for the Balmer's Peak, which is a Unity Image:

Before:

After:

Example of what I am going for:

I attached a script using OnRenderImage to the Camera, and the attached material is being applied to everything in sight, except the UI.  What can I do to make my material applied to everything on the screen, including the UI?

I am new to shaders, so this may seem like a bit of a dumb question.  But I am not sure what direction I should be headed.  Here are my scripts, although I did not really change anything from what Unity provided me:

Script attached to camera:

using UnityEngine;

public class ButtonHighlight : MonoBehaviour
{
    [Tooltip("Material which is to be applied")]
    [SerializeField]
    private Material material;

    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Graphics.Blit(source, material);
    }
}

Shader attached to material above:

Shader "Magic/Magic Shader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        // No culling or depth
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.uv);
                // just invert the colors
                col = 1 - col;
                return col;
            }
            ENDCG
        }
    }
}

What is the correct approach to apply a shader to the entire screen?  (Keeping in mind, that the purpose is to add a filter to most, but not all, of the screen.)

sentences:
FBX models into Directx 11 I've just ported over and updated a bunch of FBX model loading code I had that worked with Direct X 10 to try and make it work with Direct X 11. Since that time, the FBX SDK I was using has been updated.

In my old program I linked to the following lib:

fbxsdk-2012.2-mdd.lib

Now, clearly I can't link to this as I don't have 2012.2 on my system. So, my thinking would be simply changing 2012.2 to 2014.1, but this didn't work and lead to the following error:

error LNK1104: cannot open file 'fbxsdk-2014.1-mdd.lib'

So I tried to some googleing to see what the updated version of fbxsdk-2012.2-mdd.lib is. But I can't find anything. I tried taking out linking ot the 2014.1 lib but I get the following errors:

  Error 36  error LNK2019: unresolved external symbol "void __cdecl fbxsdk_2014_1::FbxAssert(char const *,char const *,unsigned int,char const *)" (?FbxAssert@fbxsdk_2014_1@@YAXPBD0I0@Z) referenced in function "public: int & __thiscall fbxsdk_2014_1::FbxArray::operatorconst " (??A?$FbxArray@H@fbxsdk_2014_1@@QBEAAHH@Z)

So, looking in the FBX sample directory I opened up the ViewScene sample to see what it lib it linked to and I see that it wanted the following:

libfbxsdk-md.lib

So I did the same. But, my program claims it cannot open the file. And I'm at a loss as to what to do next.

Has anyone successfully managed to load FBX models into a Directx 11 application using 2014.1? If so, what do I need to do to get the correct lib linked?

sentences:
Alternatives to voxel-based terrain Are there any alternatives to voxel based terrains?

Such terrain should be fully destructable, allow for arches, overhangs, preserve sharp features where needed and keep consistent topology.

  Maybe you can explain the problem that makes you ask this question?
  Voxel based terrain is basically just using a 3D grid of data to store
  data. There are lots of ways to render that data, but it doesn't get
  much simpler for storing it. –  Byte56

Current isosurface extraction methods aren't most effective/bug-free.

Cubical Marching Squares seem to solve most of the issues, however it is a relatively new method and there aren't too many resources about it. (I've found single university paper)

Even if we stick to CMS, when we want to add multi-material support, we can either divide surface into multiple meshes, or pass a texture array or texture atlas to shaders, then we are limited to set amount of textures and additionally increase memory-usage alot.

sentences:
Attach (Child)Rigidbody TO (Parent)Rigidbody let it collide with Tilemap We want to attach a (Child)Rigidbody to another (Parent)Rigidbody
so that the (Child)Rigidbody is also transformed on (Parent)Rigidbody transformation.

The other constrain is that the (Parent)Rigidbody contains a tilemap also with collisions.

So we want the (Child)Rigidbody to:

inherits the (Parent)Rigidbody transformation when it is ON the (Parent)Rigidbody
collide with the tilemap ON the (Parent)Rigidbody
be able to leave the (Parent)Rigidbody and move freely in the world space.

During our tests, no game or physic-engine is able to do this.
Eg.

Box2d

is not able to transform a world
applying parent forces to the child gives inacurate results

Unity

"nearly" can do it with (Parent)Rigidbody->Static Tilemap
but transforming the Static Tilemap gives inacurate results.

Godot

"nearly" can do it, the same way as unity, but also gives inacurate results,
when moveing Static Tilemaps. Also some (already reported) physic bugs renders godot unsuited.

We already consider to build a custom physic engine, but this will be a huge task we like to avoid.

We are searching for a way to do this, if you know an physic engine that supports this please speak up :).

sentences: What kind of game is prisonblock? Any open source that I can learn the math behind it? What kind of game is prisonblock?  Any open source that I can learn the math behind it for user actions/gameplay?

sentences:
Is it reasonable to use a 2D texture as a lookup table in GLSL I need a lookup table in a shader. The input values would be color values and the output other color values. Something like:

uniform float lut[256];

color = vec3(lut[int(color.r*255.)], lut[int(color.g*255.)], lut[int(color.b*255)]);

does what I need but certain implementations of OpenGL ES do not allow arrays with variable indexing so finally I've arrived to the conclusion that the most portable way is to have a 2D texture as the LUT. A texture of 256x256 could store many different lookup tables, each one (256 entries) in a single row.

In order to load a row in the texture (c++) I would use:

glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);

to store a table in the first row (I assume that internally in the texture I'd have the value repeated in R, G and B)

To fetch the LUT in the fragment shader I'd use texture2D(lut,vec2(index, constRow))   (index in the range 0-1 and constRow = 0 being the row in the texture where it is stored the lut).

Is that a reasonable way to implement that?

Update:
In order to fetch values in the texture-LUT you need normalized indexes (0.0-1.0), so to access row 7 I have to index it as texture2D(lut, vec2(index, 7./255.)); From what I see the result is (or may be) an interpolation with the two other consecutive rows.

sentences:
Transparent textures being handled oddly In OpenGL why is it that when rendering transparent textures it changes the color values of all the pixels? Ex. when this transparent texture is rendered it comes out as this. Also if I change the texture to not have transparency it still has the same problem of changing pixel values. What causes OpenGL to completely change a transparent texture when it is rendered? (Note: the textures have been created in GIMP and the program is running on a mac (OSX 10.10.3))

EDIT:

Turns out this happens when you load a texture with transparency on the RGB color spectrum instead of the RGBA spectrum.

sentences:
How do I make light objects in XNA? Here's my dilemma : I want to have light sources placeable by the player, in terms of lanterns.

I know the best way to do this is to use pixel shaders, which I have done a lot of research and use on, but it seems so far that the lights are static.

So what would be the best method to create a dynamically lit scene?

I already have to workings of a few classes to make 2d lights (Color, Position, Type, Direction, Power) but it is just rendering that is the problem.

Thanks for your considerations!

sentences:
Achievement / Upgrade / Unlockable Bonus Calculations I'm trying to figure out a good way of handling a system of upgrades in a game where multiple upgrades (including things the player can't directly purchase, e.g. achievement bonuses) can affect the same value (e.g. "+X% more income" or "Y% faster production").

I've seen at least three different approaches and I'm not keen on any of them and was wondering if there was another pattern that would work.

The approaches I know of:

Keep an array of all possible upgrades, loop over them any time the value needs to be retrieved. Computationally expensive, as the value is not cached.
Keep a cached value and recompute only when the upgrades are purchased. Requires having a value for every possible modifier as a variable in the code.
Keep a list of all achievements/upgrades (likely already done) and if-check only the ones relevant. Requires large blocks of code in cases where multiple upgrades affect the same value.

sentences:
What are standard methods for organizing game code? Grouping by standard "kinds" of methods? I've made a few games, and am getting faster and better organized each time. I'm well out of the "just make it work" phase and working on methodology and readability. I need some tips on code organization though.

I don't mean patterns - I'm having great success with MVC - but the organization of methods inside the classes themselves. I've noticed that methods in my state models can usually be grouped into four categories: (1)constructor/destructor, (2)data access (3)actions (4)events.

My controllers usually have c/d and input methods. My views usually have c/d, view updaters, and event listeners.

I feel like I'm reinventing the wheel though; someone must have spelled out "these are the common types of methods" somewhere before, right? Storage has Create, Read, Update and Delete (CRUD), so what are the equivalents for objects?

EDIT:
Found some cocoa-specific advice here:
http://www.mactech.com/articles/mactech/Vol.21/21.07/StyleForCocoa/

and some generic advice here:
https://stackoverflow.com/questions/73045/whats-the-best-way-to-organize-code/73081#73081

I'm going to use that as a foundation, modified for game-specific stuff. More info still appreciated if you have any.

sentences:
3D Animations in XNA 3.1 Well, guys. I'm in a Game Design class at school. Before you ask "WHY ARE YOU USING 3.1 INSTEAD OF 4" -- I would like to point out that C# 2008, and .NET framework 3 is NOT my preferred environment, nor is Blender 2.49.

I have gotten a pretty decent grip on Blender so far, I think. At least, for what I've figured out how to do. ( Applying textures, exporting to .fbx, and bone-weights ).

Now, I've seen various mentions of using "Skinned Models" in xna 4.0, and I've noticed that 3.1 has no such distinction, so I assume anything you do in 4 with skinned models means alternative methods in 3.1. I have also found nearly NO documentation on 3.1. All of them seem to have actually been updated to cover 4.0 ( Seriously, since when do people update their outdated tutorials? ;_; )

I'm asking around to see if there's any way to play animations stored in .fbx files ( if so, how to do it ), so that I don't waste my time understanding the animations and what not in Blender. ( Or better yet, is there something else that I SHOULD be doing instead? )

If it's not achievable, then I can obviously just use a bunch of constants or some work-around system to apply bone transformations, but it would be really nice if I didn't need to do that.

Some other things -
I've noticed that ALL models I load seem to have semi-transparent textures. Can anybody offer an immediate explanation for this? To see what I'm talking about, here's a video.

Also, could somebody give me advice as far as loading an environment and multiple models?
I think I would use the same camera and projection matrix, and then simply give a new "World" matrix to all of the items, but for some reason, I don't think that's quite right. I read somewhere that the purpose of the Matrix type was to avoid storing position information for every individual model, and store it collectively instead. ( Which, makes sense, really. Especially when some games probably load a gajillion models x3 Vector3's. That could add up fairly quickly, I'm sure. )

I know this is fairly generic / vague, but since I haven't written any code with bugs, I can't exactly ask specific questions, I guess.

If you have a resource that is still rele

sentences:
How to run a long task without freezing my game? I have a component that is in charge of generating a level at runtime, and this is an operation that takes quite some time. As a consequence, I experience a hang when this operation is executed (when the scene is loaded).

This problem can be summarized to the fact that SceneManager.LoadSceneAsync in fact is not async at all in its second phase, when it initializes all the objects.

There are three approaches I have searched for and thought about:

Slicing the operation as explained on this video:

This is non-trivial, I would have to rewrite chunks of code for the sake of avoiding a few seconds hiccup at scene load. Furthermore, the person explaining in the video says that they changed Unity source code which I don't have access to.

Running the operation in a background thread:

This is definitely interesting, it would require minimal changes. The only problem is that at some point I have to create Unity objects (GameObject, Mesh etc) and this is not possible when outside Unity thread.

I was thinking more or less of this code to be run on the background thread:

class Builder
{
    public void Build()
    {
        // 1. do something long

        // 2. create Unity object with result from #1
        // something like that
        // await RunInUnitySynchronizationContext(() => new GameObject(...))

        // 3. do extra stuff on the result of #2
    }
}

The thing is I have no idea at all on how that second step should be written, if possible at all.

Use a non-animated Loading screen and wait for it to finish:

This is the simplest and effectively does away with the problem by 'just' hiding it.

Question:

What's an effective approach to solve this problem?

sentences:
How do mipmapping, anti-aliasing and anisotropic filtering contribute to rendering quality? To my understanding, mipmaps exist to save on computations and memory when textures are far away. In an ideal world, we wouldn't want them. We'd just use the same high quality textures far away and not care about wasted resources.

But in reality, we need anisotropic filtering to smooth the disconnect between varying LOD mipmaps (or so I think).

However, do images using mipmaps with anisotropic filtering look better than no mipmaps without anisotropic filtering? See here (the first image looks worse than the third even though the first has no mipmaps). Is it because anisotropic filtering has anti-aliasing built in? And if we didn't have mipmaps, but added anti-aliasing, would the resulting image look better?

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:
Enemy collision detection with movie clips I have created multiple movieclips with animations within them.  It is an obstacle avoidance game and I cannot seem to be able to get my enemies to contact my playableCharacter. The enemies I have created are each embedded on certain levels of my game. I have created an array, enemiesArray to have each of my enemies placed within it. Here is the code for that:

//step 1: make sure array exists
if(enemiesArray!=null && enemiesArray.length!=0)
{
    //step 2: check all enemies against villain
    for(var i:int = 0;i < enemiesArray.length; i++)
    {
        //step 3: check for collision
        if(villain.hitTestObject(enemiesArray[i]))
        {
            //step 4: do stuff
            trace("HIT!");
            removeChild(enemiesArray[i]);
            enemiesArray.splice(i,1);

            removeChild(villain);
            villain = null;
        }
    }
}

What I am unsure of is whether or not my enemiesArray is actually holding the movieclips I have suggested. If it was, this code would be tracing back a "HIT" for every time I ran into an enemy and would kill my character. It is not doing that however.

I am thinking I have to push my movieclips into my array but I don't know how to do that or where for that matter.

Any and all help would be much appreciated.

sentences:
Command Interface design for RTS Commands may have different target type; like NONE, COORD, UNIT.
Some example commands may be: Attack (target UNIT), Move (target COORD), AttackMove (target COORD), Stop (target NONE), UseAbility (target ability.getTargetType).
Commands will be executed by UI or AI.
So in an OOP approach here, what methods should my Command interface have?
For the command execution has access to the target the command wants.

sentences:
JavaScript - 2D Top-down Tile Collision Detection I am developing a small Top-down Game (Much like the old Zelda Games) and I'm having an issue in terms of Collision detection (The actual theory itself rather than assigning Tiles as solid, etc.)

I have a function called "checkTileCollision" which takes two parameters, X and Y, and is called through the Player's Move function. X and Y are the location of the player AFTER they have moved, as it's suppose to check the position the player is moving to for a solid Tile(s), and if it finds any, returns true to stop movement.

My Player is larger than a Tile (For examples sake, let's say each Tile is 32x32 and the Player is 26x60) and I need to know an efficient way to detect whether or not the player is attempting to step on to a Solid tile. The Player doesn't move on the Grid and is free-moving, so X and Y are true positions and not Tile co-ordinates.

Please note; I am aware of things such as Box2D but I'm wanting to do this without the use of third party libraries.

Any help is appreciated!

sentences:
Great realtime shader tool? I often develop 2D games. I would like to know if there's a program like EvalDraw out there, that makes it easy to quickly make (for example) a square, out of a black quad, and then write some shader code, and see how that shader code modifies the square in realtime.

That would be really great for my future development processes.

Edit:
The shader tool must work with HLSL.

sentences:
How do I build a matrix to translate one set of points to another? I've got 3 points in space that define a triangle. I've also got a vertex buffer made up of three vertices, that also represent a triangle that I will refer to as a "model".

How can I can I find the matrix M that will transform vertex in my buffer to those 3 points in space ?

For example, let's say my three points A, B, C are at locations:

A.x = 10, A.y = 16, A.z = 8
B.x = 12, B.y = 11, B.z = 1
C.x = 19, C.y = 12, C.z = 3

given these coordinates how can I build a matrix that will translate and rotate my model such that both triangles have the exact same world space ? That is, I want the first vertex in my triangle model to have the same coordinates as A, the second to have the same coordinates as B, and same goes for C.

nb: I'm using instanced rendering so I can't just give each vertex the same position as my 3 points. I have a set of three points defining a triangle, and only three vertices in my vertex buffer.

sentences:
Complex Models using bounding boxes in xna 4 I'm new to XNA, and have just started looking into collision detection.
I've managed to get a bounding sphere around my first person camera object and i want to check the collision between that and the walls of my cube.
e.g.

this is a cube i have built in Maya and it is 1 combined mesh.
What i want to do i check my bounding sphere against the inside of the walls. and also allow the myself to enter in and out of the holes in the sides and th top.
My first thought would be using each vertex to test against collision but i have no idea how to do this, since this is the first time attempting.
Can anyone point me in the right direction?

sentences:
3D collision for non mathematician I am having an extremely hard time understanding smooth 3D collision. I have spent a month trying to figure out the math and still cannot get perfect collision detection that perform the same way as in games such as Quake.

I've resorted to a virtual 2D rectangle collision model applied to 3D plane, but it's full of bugs and doesn't handle slopes. It seems that very complex math is required like matrices and vectors. There are lots of tutorials online but they are full of mathematical symbols and it's impossible for a math novice like me to understand it, I also don't have time to go through a mathematics basics from the beginning. Is it possible to do collision without vectors or matrices or a guide somewhere that can explain in non mathematical terms how to implement smooth collision? How can a nonmathematician overcome 3D math?

sentences:
How do I generate terrain like that of Scorched Earth? I'm a web developer and I am keen to start writing my own games.

For familiarity, I've chosen JavaScript and canvas element for now.

I want to generate some terrain like that in Scorched Earth.

My first attempt made me realise I couldn't just randomise the y value; there had to be some sanity in the peaks and troughs.

I have Googled around a bit, but either I can't find something simple enough for me or I am using the wrong keywords.

Can you please show me what sort of algorithm I would use to generate something in the example, keeping in mind that I am completely new to games programming (since making Breakout in 2003 with Visual Basic anyway)?

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:
Skysphere to Skybox Texture Conversion I am working on a hobby project and implemented a skybox, no big deal. Now I bought (licensed) a few really nice sky textures. Unfortunately the textures are projected for a skysphere.

I could implement a skysphere handling/rendering, but I figure rendering a box is way more efficient. (That may actually not matter on modern devcies though.) So I decided to transform the textures into 6 textures for a skybox.

My hodge podge solution to convert the textures is I create a scene in blender and render out the appropriate 6 views. If you ask google that is aproptatly the common sollution.

It there a tool that can do the conversion in a more automated way?

sentences:
Can someone provide a simple algorithm for calculating an outcome based on User characteristics? In these online games, say you are a person who has characteristics like:

level
strength
experience
defense
...

And now you walk into a room of 'others' that you want to e.g. recruit, how would you go about calculating this users ability to recruit?

Or any other common action in a online web game like a battle, or looking for items in the grass, or looking for food etc.

i.e. the ability or chances for success depend on the user's characteristics, and they get progressively harder as the user level ups etc.

sentences:
Adding a feedback survey to a game So I am currently making a game that aims to help people with anxiety management. I , however, would like to ask them how they feel before playing the game and then again after playing the game. Would it be possible to do this directly on Unity? I would like for them to be able to log their entries much like an online journal. I have attached pictures from the daylio app. I would like to do something similar. At this point, I really do not know how to begin doing this on Unity. Any advice, or tutorial suggestions would be appreciated.

This far I have managed to do the following (in the picture below):
This is how the survey looks (its pretty rudimentary at this point):

And this is where the information is getting displayed (in the inspector):

So now, what I would like to know, is how would I go about sending this data to somewhere else i.e. as it is in the daylio app?

sentences:
Animation works, but Unity doesn't realize it I have an animation which plays once, and it played once just fine.  I want to Invoke a method as soon as the animation finishes.  I have been researching and experimenting for over an hour now, but without the result I want.  I try to get the animation from the Animator, but Unity says my animation is not attached.  The thing is, I don't care if it's attached...I just want to know how long it is, not actually do anything with it.  How can I achieve this?  Here is the code which results in the error:

CODE:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(PolygonCollider2D))]
[RequireComponent(typeof(Animator))]
public class Construction : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        Invoke("EnableObstacleState", GetComponent<Animator>().animation.clip.length);
    }

    private void EnableObstacleState()
    {
        GetComponent<PolygonCollider2D>().enabled = true;
    }
}

ERROR:

MissingComponentException: There is no 'Animation' attached to the "Barricade(Clone)" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "Barricade(Clone)". Or your script needs to check if the component is attached before using it.
Construction.Start () (at Assets/Scripts/Construction.cs:11)

sentences:
Should I use Events in a XNA Game? I created a button class which draw a button on the screen. When I click on it, I want to see something happening. In WinForm, I would simply use the event OnClick of the button. What about XNA?

Should I add an OnClick event to my button class? Is that a good practice? Otherwise, how do you handle events in your game loop?

sentences: Is it possible to use Metal and SceneKit at the same time? All the tutorials that I've found online speak about using Metal alone, without any other supporting library. But I don't understand if it's possible to create a SceneKit game and then use a Metal layer just to make some optimizations.

sentences: Creating a separate renderer for entities in a 2D game I'm making a 2D shooter game. As of now, every entity "draws itself", meaning every renderable entity has a draw function. I know it is better if rendering is handled separately, but how can I achieve this? What should I put into the Renderer class?

sentences:
Rendering an isometric tilemap I have a tile which is 512x256 pixels and I'm trying to render it in an isometric fashion.

I have this helper function:

Pos cartToIso(Pos p) {
    xa := p.x - p.y;
    ya := (p.x + p.y) / 2;
    return new Pos(xa, ya);
}

And to render I do this:

// note this is smaller than the image since
// it's being scaled down
const tileWidth = 256;
const tileHeight = tileWidth / 2;

for (int y = 0; y < 32; y++) {
    for (int x = 0; x < 32; x++) {
        int ya = y * tileWidth;
        int xa = x * tileHeight;
        Pos p = cartToIso(xa, ya);

        drawImage(grassTile, p.x, p.y, tileWidth, tileHeight);
    }
}

This nearly works but there is a big black gap around the tiles. It's fixed when
I change the rendering to this:

// note this is smaller than the image since
// it's being scaled down
const tileWidth = 256;
const tileHeight = tileWidth / 2;

for (int y = 0; y < 32; y++) {
    for (int x = 0; x < 32; x++) {
        int ya = y * tileHeight; // <- here!
        int xa = x * tileHeight;
        Pos p = cartToIso(xa, ya);

        drawImage(grassTile, p.x, p.y, tileWidth, tileHeight);
    }
}

But why? This seems to be counter-intuitive compared to what the
isometric 2d tutorials I have read have said.

Is there a flaw to my rendering logic?

sentences:
Implementing ClearPath (crowd pathfinding) This is the academic article:

http://gamma.cs.unc.edu/CA/ClearPath.pdf

Here is the confusing part (marked in red):

The first part is the path in which the object will move.

The first part of the formula in the red frame defines the sets of all possible velocities for agent A that will result in collision with obstacle B in the future (a cone).

I don't understand why they XOR the subtraction of A from that formula? I don't understand what it means to do exclusive or a substructed set?I want to understand it better.

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:
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:
Social Network Gaming on Windows, Linux and OS X I'm working on mobile platforms as Android, IOS... Many users of Moblox ask us a windows and an OS X version.
There is no difficulties to provide these versions, because we are developing on OS X C++ code but we miss global scores and social network part (facebook, twitter). Is there any library to implement these functions on Desktops plaforms ?

On mobile platforms, we have many SDK to provide theses functions as OpenFeint, ScoreLoop, Plus+. We have used cocoslive and uploaded scores with libcurl but it's very limited.

sentences:
How can i change the hit distance of RaycastHit? I'm using this script to send a raycast from the center of the camera to objects.
It's working fine but only if i'm getting close enough to objects. But for example if it's npc person i want to be able to detect him as "Interactable" from a more distance. How can i change/set the hit distance ?

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

public class CameraRaycast : MonoBehaviour
{
    public Camera cam;

    void Update()
    {
        Ray ray = cam.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
            if (hit.transform.tag == "Interactable")
            {
                print("I'm looking at " + hit.transform.name);
            }
            else
                print("I'm looking at nothing!");
    }
}

sentences: How to find points of a reflected 2d bezier curve about a line Pardon me if this sounds primitive. I have created a bezier curve with control points A, B, C, D, which are known (see image below). How can I find control points B1, C1, D1 for a new bezier curve reflected in AR1 and A2, B2 and C2 for a new bezier curve reflected in DR2?

sentences:
Unexpected behaviour after adding animator and Unity editor crash I have realy strange problem which accured after adding animator(I suppose) to prefab Object. Situations looks like follow:

I had object which have only sprite renderer, collider2D and script (movement behaviour) attached. It worked perfect on editor mode, ramote or any kind of platform (PC/Mobile).
Then I added animator controller and some animations. Everything looked good until I made build for android.

First problem occured and it manifested as follows: when I spawn prefabObject described above game stuck and reset player position to 0,0 (by the way this object spawn at 0,0). The strange thing is that this bug occur onyl on android build. In editor mode, remote and PC build game works perfect.
First thing first I though that prefabObj is broken or damaged...so I create new one with same settings and components. Nothing has changed. Situation looks the same.

The second strange thing is that I have another objects with animator and they work properly. But is not over...
I updated Unity to newest version to check if its not problem with software. After that it was even worse. Console show me tons of error like: Invalid AABB a and so on. Fortunately I found solution to that. I was problem with particle system attached to some objects. I turn off all particles and I have no more errors...but it makes Unity editor unusalble. Everytime after press play button Unity crash with following message:

  unity the memory file is corrupted  position out of bounds.

Only way to make unity usable again it was to replace project's file with backup one (with particle system turned on).

After all it does change anything. With old or new Unity version, with or without particle system, problem with game build on android stayed unchanged.

I tried several things like:

anmation with exit time and witout
with animation event and without
with script support

It always looks the same: stabile on editor, remote or PC build but stuck on mobile.

At this moment I totally have no idea what is wrong and how to solve it.

I will be very grateful for any advice, or hint

P.S I don't belive it is a problem with performance. There is no more than 10 objects in one time on screen (2D) and animation is like change scale from zero to one.

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:
Unity rigidbody velocity In Unity, what is the correct way to move a game object by modifying the velocity of its rigidbody?
I'm having some issues with stuttering movement, so I just want to make sure I understand the basic idea. Is the following correct for moving an object vertically down the screen? Should this result in smooth, stutter-free movement?
using UnityEngine;

public class MovementTest : MonoBehaviour
{
    private Rigidbody2D rb;

    [SerializeField] private float speedY = -250;

    private void Awake()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void FixedUpdate()
    {
        rb.velocity = new Vector2(
            0,
            speedY *  Time.fixedDeltaTime
        );
    }
}

```

sentences:
Entity system and rendering types I would like to implement entity system in my game and I've got some question about entity system and rendering.

Currently, my renderer got two types of elements:

Current design

Mesh   : A default renderable with a Material, a Geometry and a Transformable
Sprite : A type of mesh with some methods like "flip" and "setRect" methods and a rect member (With an imposed geometry, a quad)

This objects inherit from "Spacial" class.

Questions:

How can I handle this two types in an entity system?
I'm thinking about using "MeshComponent" and "SpriteComponent", but if I do that, an entity could have a Mesh and a Sprite at the same type, it's look stupid, right?

I thought the idea to have a parent "rendering" component : "RenderableComponent" for "MeshComponent" and "SpriteComponent" but it will be difficult to handle "cast" in the game (ex: did I need to ask entity->getComponent or SpineComponent, …)

Thanks a lot for reading me!

My entity system work like that:

---------------------------------------------------------------------------
Entity* entity = world->createEntity();

MeshComponent* mesh = entity->addComponent<MeshComponent>(material);
mesh->loadFromFile("monkey.obj");

PhysicComponent* physic = entity->addComponent<PhysicComponent>();
physic->setMass(5.4f);
physic->setVelocity( 0.5f, 2.f );
---------------------------------------------------------------------------
class RenderingSystem
{
    private:
        Scene scene;
    public:
        void onEntityAdded( Entity* entity )
        {
            scene.addMesh( entity->getComponent<MeshComponent>() );
        }
}

class PhysicSystem
{
    private:
        World world;
    public:
        void onEntityAdded( Entity* entity )
        {
            world.addBody( entity->getComponent<PhysicComponent>()->getBody() );
        }

        void process( Entity* entity )
        {
            PhysicComponent* physic = entity->getComponent<PhysicComponent>();
        }
}

---------------------------------------------------------------------------

sentences:
How to encode a save game / game state as a string? I'm building an HTML game. For this game I want to implement a save-feature that should work like in some already existing games:

The user can chose export, this will create a string, representing the game state (I guess).
This string can be pasted into an import input and will load the save game.

I thought about storing the state in a JSON, minifying it, stringifying and encoding it in Base64.
But I don't think this is a good idea, users could easily cheat in this game by decoding the string, changing whatever they want, encoding it again and loading this string.

I already tried generating save files in games with this feature and decoding them in Base64 which didn't work, so I assume they use a different encoding.

How can I encode the JSON like this?

sentences:
Do inventory items have to live in the game world? I'm trying to create an inventory system. There's a few parts to it:

Item (scriptable Object just the data like name etc of the item)
ItemDatabase which takes array of Item (scriptable object) and then on awake it looks through and populates a dictionary for ID,data
ItemStack - Actual item holds an int for an ID so it can get data from the dictionary from it.

My inventory has a list of ItemStacks, but to be able to populate that array the script needs to be on a GameObject, so with how everything works, is it required for me to always have GameObjects in the game basically representing items? I'm new to inventories so is that how its suppose to be? Or am I missing something here? It seems kinda strange if I have 700 different item in my inventory that would require 700 GameObjects created to represent them.

Or maybe I'm overthinking it... but I feel like the inventory should only have "data" and not a GameObject, the GameObject would be for when you spawn an item in the world.

sentences:
Formula to calculate Level and Current Experience from Total Xp So I'm building a mobile game where I have simple XP progression system that goes like this:
Level1: 0-399 Total XP
Level2: 400-1199 Total XP
Level3: 1200-2399 Total XP
So basically for the first level the player needs 400 XP to level up. Once it reaches that the exp bar goes to zero and then needs 800 XP to level up, the XP bar goes to 0 and needs 1200 and so on.
I was wondering if there is a formula in order to calculate the current level of the player and the current experience (i.e. 400/800 when it has 800 total XP) from the Total XP.
EDIT:
So I found the formula Level = Floor(1/20 (10 + sqrt(2) sqrt(50 + TOTAL XP)))
but I still can't figure out the formula to find the Current XP
Thank you

sentences:
What are the consequences of adding a progress stat to a live Steam achievement? Say I have an achievement in my game, "Collect your first thingamajig", and I publish this to the live version of the game without a progress stat. Later on I decide I want to add some new achievements in an update, including one based on the previous achievement: "Collect 10 thingamajigs".

I create a progress stat for this one which is updated in code, but I also edit the original achievement so that it's unlocked through the progress stat rather than an AwardFirstThingamajigAchievement() function in code.

What are the consequences of this? Will a player that already had this unlocked find the achievement has been relocked because the achievement has been edited, technically making it a new one? Will it remain unlocked, but still cause a little popup for the first achievement on the next Thingamajig collected? Or will Steam simply not touch already unlocked achievements?

sentences:
Could SDL be used to target Xbox 360? We're looking at developing a 2D game that could target Xbox 360.  Ideally, we'd also like to submit the game via the XNA program so that gamers could try out the game over Xbox Live.  We really love the fact that SDL is cross-platform.

Is writing a 2D game in SDL and then also targeting Xbox 360 possible, and if so how difficult might it be?

sentences:
Interactive Controls (switches, knobs, buttons) in Unity I'm working on a puzzle aspect of a game, and wanted to make a section where players relay information to one another, and have to input the correct values.

At its most basic, its a few stored variables that exist only for this, and really don't do anything. i.e. "Turn on shields" would just be a bool. "Set phasers to 5" an int. etc.

I'm trying to figure out the best way for a player to interact with these variables. I've considered GUI elements placed on gameobjects, but I'm not entirely comfortable with Unity's GUI system.

Should i take the time and use the GUI system, or would setting up my own scripts to edit the controls (toggle boxes, sliders, knobs) be a more simple solution?

Thanks in advance!

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

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

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

Attachment:
Alpha_Shader.zip

Any help would be greatly appreciated.

Thanks.

sentences:
Monogame render between constraints I have, in MonoGame, a project for which I require the game to not use the full screen depending on the resolution. The game elements etc all behave as they should (So they bounce off for example between 25% and 75% of the screen, instead of the edges). Yet I'm trying to draw a background between these two constraints, and it doesn't work.

To draw the background I am using the following code

spriteBatch.Draw(Background, new Rectangle(leftEdge,0,rightEdge,top),Color.White);

Yet when running the game, the image starts at "LeftEdge" but goes beyond "rightEdge". How would I go about scaling the image appropriately in this scenario?

sentences:
As an indie game developer, how can I have (quality) music/sound done? Besides the story itself, a game needs code, graphics and music/sound effect. I can program and I knew a few graphics designers in the web app era. However, I don't know whether to find music and sound freelancers/professionals/partners.

So how's music/sound typically done? Do you finish a game and hand it to some musicians? Seek help via Facebook? Call the secondary school music teacher? .. Please advise. Thanks!

EDIT:

I'd like to rephrase the question a bit to clarify the objective. Let's start with example. Say, there is designer which have finish a great UI concept design, and ask: "how can I find programmers to transform this design into an app?"

It won't help him much by telling where github is and how much great codes can be learned from... He needs the judgement of what are good code, in addition to how to use the code, and most importantly, the ability to modify/enhance the code to fit his need.

As a programmer, all I know a game needs some good music. The question is not about where to find music. The question is how to find musician who knows music, the music which fits my game. It's similar to the design is looking for a programmer who can turn Photoshop into .app rather and programming books and code samples.

Simply put, where did you find your game's musician? ;-)

p.s. I found my graphics designer on deviantart.com Where is the deviant music.com? XD

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:
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:
Good Tools & Methodologies for designing Game Arch I'm currently developing a multiplayer and turnbased silverlight card game and using WCF Polling Duplex communication. I've almost finished the game but I'm still dealing with the methods and animations during the game end. Sometimes I'm loosing control and can't even debug and leave it for days to get some more motivation.

What I'm asking is that there should be some methods to design the gameflow on papers such as GameState charts or similar. I did some by myself to track states of some objects but it didn't work out. There should be some tools or methods to do this.

sentences:
How to prepare a rigged character model to be imported as a humanoid in unity? I want to import a character as a humanoid to be able to use masks on animation system. I used proper human structure but unity gives some errors when I want to turn it from generic to humanoid and says some bones are not in the right place or have a wrong name.

The questions is how should a rigged model be prepared in modeling program to be imported in unity as humanoid?

sentences:
How can I register Mouse Events in the Scene window of the Editor? I want to create a custom level editor for the level designers that should allow them to place predefined objects in Unity3d similar to the Terrain wizard.

How can I register Mouse Events in the Scene window of the Editor?

sentences:
joystick movement for Geometry Wars clone I am kinda new in game programming, but I've got a semestral work to make a game, so I decided to do a clone of Geometry Wars. Despite that the game is really simple (in principle), I have ran into a problem I can not solve. I use SDL, OpenGL in C (vanilla C, so no C++/C# and stuff, only procedural ANSI (I think ANSI) C). When I get input from joystick, it is fine in the console (if I flush it to the output, it will make immediate action) but when I draw a simple dot (it shouldn't be that time consuming to draw a dot on screen) it have a slight to severe input lag (up to 3 sec.). But that's only the first part of my problem, because it not only renders slow, the movement is totally different from that I make with joystick. Here is the code:

void pollInput()
{
    SDL_JoystickUpdate ();
    SDL_PollEvent(&event);
    double XYValue;
    if ( ( event.jaxis.value < -3200 ) || (event.jaxis.value > 3200 ) )
    {
        if( event.jaxis.axis == 0)
        {
            XYValue = event.jaxis.value / 2500.0;
            XYValue = floor(XYValue);
            player.playerX += (XYValue);
            printf("X: %.0lf\n", XYValue);
        }
        if( event.jaxis.axis == 1)
        {
            XYValue = event.jaxis.value / 2500.0;
            XYValue = floor(XYValue);
            player.playerY += (-XYValue);
            printf("Y: %.0lf\n", XYValue);
        }
    }
}

I am really stuck here. And another question came to my mind, is it a good idea to add the input from joystick to the XY coords of the player? Shouldn't I make it like acceleration? If yes, would you kindly write a pseudocode for that? Thank you for your replies guys!

sentences:
How does one perform collision detection on objects made of many small triangles? I understand that any shape can be created (or approximated) by smaller triangles.
Any rectangle can be created by 2 smaller triangles.
Any circle can be created by many thin "pizza slice" triangles. How does this translate to collision detection?

I understand how to calculate rectangle overlap using the vertices.
I understand how to calculate circle overlap using the center, radii, and distance.

But, how does one do collision detection on shapes made of small triangles?
Not specifics, but just the general concept....

sentences:
How can I abort the closing of a dialog in libgdx? Dialog dialog = new Dialog("Warning", skin, "dialog") {
    public void result(Object obj) {
        System.out.println("result "+obj);
        if(obj == true) {
            >> abort the dialog closing ? <<
        }
    }
};
dialog.text("Info?");
dialog.button("Yes", true);
dialog.button("No", false);
dialog.key(Keys.Enter, true);
dialog.show();

how to abort the closing of the dialog?

sentences:
Unity - SpriteAtlas memory consumption I'm in the process of optimizing my application memory consumption.
To do so, I'm using Unity profiler while connecting to an Android device, which runs a development build of the application.

The application is using two types of sprite containers:

Sprite sheets created by the Texture packer.
Sprite Atlases created by unity.

Using the profiler, it is observed that while the sprite sheets (created by the Texture packer) take the expected amount of RAM, the sprite atlases created by unity consume DOUBLE the expected amount of RAM.

For example, the sprite atlas UIATLAS, whose size is 4096x4096 is supposed to consume 16MB of RAM:

But looking at the profiler, after running "Take Sample", you see the value 32MB:

My sprite atlas settings are:

Any help is welcome here.

One more comment (please review): UIAtlas belongs to an asset bundle called "atlas_ui". It is defined on several directories containing its sprites, all of which belong to the same asset bundle, atlas_ui. Is that the correct way to define it?

Thanks in advance!

sentences:
Rotating image angle, direction of object that is resting on floor object I have an object, in this case a space ship, resting on a floor or platform object. The bottom of the space ship is flat, and is resting flush with the flat surface of the platform object (due to my collision detection). Now obviously, the player is able to move the space ship by pressing up. The player is also able to turn the ship (image_angle and direction) by pressing left or right, which transfers the speed to that direction if they are flying. However, in the scenario mentioned above where the ship is currently resting flat on a flat surface, if the player presses left or right, the ship still rotates and the sides clip into the surface of the platform, which causes collision detection to essentially glue the ship to the platform. How can I use collision detection to allow the player to still rotate the ship while it is resting on a flat surface, but instead of clipping, have the object perhaps "roll" or fall over?

here is my collision detection:

// Gravity
if (vspeed < 10) vspeed += .02;

// Collision detection
if (place_meeting(x, y + vspeed, obj_block))
{
    while (!place_meeting(x, y+1, obj_block))
    {
        y += 1;
    }
    vspeed = 0;
    hspeed = 0;
}

sentences: Show procedural map without running the game? Currently I have a script that generates prefabs by code and I'm wondering if I could show a certain "seed" of that map without actually running the game. The reason why is that I often want to tweak things, and when I run the game and alter settings for objects like lights they get reset when I stop running the game and perhaps have some kind of button where I can reset the seed and see another generation of the map.

sentences:
How can I support different resolutions with Monogame? I want to support the following 4 resolutions in my Windows Phone 8 game: 480 × 800, 768 × 1280, 720 × 1280, 1080 x 1920.
How can I do that with Monogame? If I draw a sprite with Monogame, the sprite is not drawn on the right place in every resolution. For example, with a resolution of 768 × 1280, the sprite is drawn in the center of the screen, but if I use another resolution, the sprite is no more drawn in the center of the screen.

What should I do so that the sprite is in every resolution on the same place?

sentences:
Unity: How to work with forms Today I learned some cool tricks about sizing containers and its children, I mainly using this, because I need to build some forms.

But now... It is some preffered way how to handle forms? Or some unity component? I imagine something like get values of all InputFields, when the button is clicked.
Originaly I had script, which cycled through all children of container, registered them and I could from the script call method to get values in array. But now I have input fields in the more complex structure, for using of unity scripts for sizing and placement, so the cycle is now not so easy.
So, does unity have some script, or there is some unified way how to do this? How do you handle the forms? And of course, the biggest question, how do you handle standard behaviour as tabing through input fields and submit all on enter press?

sentences:
XNA - Error while rendering a texture to a 2D render target via SpriteBatch I've got this simple code that uses SpriteBatch to draw a texture onto a RenderTarget2D:

private void drawScene(GameTime g)
{
    GraphicsDevice.Clear(skyColor);
    GraphicsDevice.SetRenderTarget(targetScene);
    drawSunAndMoon();
    effect.Fog = true;
    GraphicsDevice.SetVertexBuffer(line);
    effect.MainEffect.CurrentTechnique.Passes[0].Apply();
    GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
    GraphicsDevice.SetRenderTarget(null);
    SceneTexture = targetScene;
}

private void drawPostProcessing(GameTime g)
{
    effect.SceneTexture = SceneTexture;
    GraphicsDevice.SetRenderTarget(targetBloom);
    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null);
    {
        if (Bloom) effect.BlurEffect.CurrentTechnique.Passes[0].Apply();
        spriteBatch.Draw(
            targetScene,
            new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height),
            Color.White);
    }
    spriteBatch.End();
    BloomTexture = targetBloom;
    GraphicsDevice.SetRenderTarget(null);
}

Both methods are called from my Draw(GameTime gameTime) function. First drawScene is called, then drawPostProcessing is called.

The thing is, when I run this code I get an error on the spriteBatch.Draw call:

  The render target must not be set on the device when it is used as a texture.

I already found the solution, which is to draw the actual render target (targetScene) to the texture so it doesn't create a reference to the loaded render target.

However, to my knowledge, the only way of doing this is to write:

GraphicsDevice.SetRenderTarget(outputTarget)
SpriteBatch.Draw(inputTarget, ...)
GraphicsDevice.SetRenderTarget(null)

Which encounters the same exact problem I'm having right now.

So, the question I'm asking is: how would I render inputTarget to outputTarget without reference issues?

sentences:
Puzzled about game mods I'm new to game development. I was thinking of different ways to create a game. I discovered Unity3d as much preferred indie game engine and yet so powerful. Then I read about game mods, which I found pretty exciting too. So, I now have two questions.

Are Mod creation Software/SDKs developed by the same company which made the original game? Are there any custom made (recent) mod sdk? Is it even possible to make one like that?
Is it possible to port a model from one mod sdk (say, Halflife) to another mod sdk (say, Skyrim)?

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:
Can I use someone else's music/midi? The music in question is not exactly owned by the other individual either, as it's simply an arrangement of a game's soundtrack as a midi or music sheet.

Am I allowed to use these in my videogame? Should those persons be given credit or should it go to the original composers of the track in the original video game?

Should I ask for permission for the authors of the rearrange? What if the file and site list no author? What if it lists an author but I have no means to reach and ask?

sentences:
Symbol not found Error in Unity3d - IOS Buid in Xcode I new to IOS build , when  i try to build following error showing

I using Unity 5.2.1f1  and Xcode 7.0.1(7A1001)  . Previous   unity version was 5.0.1  , in that version , same error was found thats why  i updated unity , even though same error is existing

When i taking build Xcode showing  "Buid Succeeded" , when running on simulator , following error is showing .

Warning: Error creating LLDB target at path '/Users/UserName/Library/Developer/Xcode/DerivedData/Unity-iPhone-dzxhzbvzarcxwncwpymwfynqdipi/Build/Products/Release-iphonesimulator/GameName.app'- using an empty LLDB target which can cause slow memory reads from remote devices.

_dyld: Symbol not found: _assignIdentifiersAndCallbackGameObject
  Referenced from: /Users/UserName/Library/Developer/CoreSimulator/Devices/400B12B2-B711-453C-B0E3-7DDF12A770F0/data/Containers/Bundle/Application/E62986EE-618C-4530-B5F8-A09D43162DBD/GameName.app/GameName
  Expected in: flat namespace
 in /Users/UserName/Library/Developer/CoreSimulator/Devices/400B12B2-B711-453C-B0E3-7DDF12A770F0/data/Containers/Bundle/Application/E62986EE-618C-4530-B5F8-A09D43162DBD/GameName.app/GameName
(lldb)

please help me , how to solve this problem

sentences:
What is the difference between a game framework and a game engine? What is the difference between a game framework (for example, XNA with C#, SDL for c++) and a game engine?

Do game frameworks use engines? Does a game engine encapsulate sub-engines like physics engines, particle engines etc? Should they be used together, or are they mutually exclusively?

I take it there are separate engines for both 2D and 3D?

sentences:
Can't render to FBO using a shader I've added functionality so that I can render to a framebuffer (for post-processing and stuff).  I can successfully render to my framebuffer and then render that framebuffer, but anything with a shader does not render to my framebuffer.  Rendering with the same shader worked before I added the framebuffer step.

Here's how I create my framebuffer:

// create the color texture
colorBuffer = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, colorBuffer);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, width, height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

// create the depth texture
depthBuffer = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, depthBuffer);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Depth24Stencil8, width, height, 0, PixelFormat.DepthStencil, PixelType.UnsignedInt, IntPtr.Zero);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);

// create the fbo
GL.GenFramebuffers(1, out fbo);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, fbo);
GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, colorBuffer, 0);
GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.DepthStencilAttachment, TextureTarget.Texture2D, depthBuffer, 0);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);

And this is my shader code:

// VERTEX SHADER
#version 330

uniform mat4 world;
uniform mat3 worldIT;
uniform mat4 view;
uniform mat4 projection;
uniform mat4 textureTransformation;

in vec3 rPosition;
in vec3 rNormal;
in vec2 rTexCoord;
in vec3 rColor;

out vec3 vWorldPosition;
out vec3 vNormal;
out vec2 vTexCoord;
out vec3 vColor;

void main(void)
{
    vec4 tempWorld = world * vec4(rPosition, 1.0f);
    gl_Position = projection * view * tempWorld;

    vWorldPosition = tempWorld.xyz;
    mat3 normalSpace = mat3(world);
    vNormal = normalize(normalSpace * rNormal);
    vTexCoord = (textureTransformation * vec4(rTexCoord, 0.0f, 1.0f)).xy;
    vColor = rColor;
}

// FRAGMENT SHADER
#version 330

uniform sampler2D colorMap;

in vec3 vWorldPosition;
in vec3 vNormal;
in vec2 vTexCoord;
in vec3 vColor;

out vec4 fColor;

const vec3 ambientLight = vec3(0.1f, 0.1f, 0.1f);
const vec3 lightDir = vec3(0.0f, -1.0f, 1.0f);
const vec3 lightColor = vec3(1.0f, 1.0f, 1.0f);

void main(void)
{
    vec4 texel = texture(colorMap, vTexCoord);

    vec3 n = normalize(vNormal);
    vec3 l = normalize(lightDir);
    float nDotL = max(dot(n, l), 0.0f);

    vec4 diffuse = vec4((ambientLight + nDotL * lightColor) * vColor, 1.0f) * texel;

    vec4 specular = vec4(0.0f, 0.0f, 0.0f, 0.0f);

    fColor = diffuse + specular;
}

EDIT:
It seems to be that, for some odd reason, my shader stopped outputting at all when I added the framebuffer support.

sentences:
Blender: Having trouble moving vertices I've been using Blender for two days now, and ran into an issue while following a tutorial.

Before anything else, I'd like to show you all what my problem precisely is. Here is a short video I uploaded: click here. I thought it may be easier for you all to help me identify and solve my problem more accurately with a visual aid.

I would like to emphasize that this issue began to occur after I extruded that trapezoidal region (misstated as a parallelogram in the video). I decided that I did not want the extruded region, and just hit undo. Ever since then, I began to experience the problem you viewed.

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:
Geometric clipping of triangles intersecting near plane I was reading about how rasterization works but there is one topic I can't quite understand.
After perspective projection, our point is in clip space as I understand it.
Now we test all points in a triangle like so
rejected = true
for every point:
   if (abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w)
      point.w > 0) {
      rejected = false;
    }

So the triangle is only rejected if all points are behind the near clipping plane or fall out boundaries, but it can happen that one point is behind the near clipping plane and others are in front.
Now there is a part I don't understand.
To deal with this we somehow clip points in 3d space by constructing new triangles.
So how is this exactly works?
And why we can't just interpolate our z values to test if the point is behind or in front of the near plane?

sentences:
Global keyboard states I have following idea about processing keyboard input. We capture input in "main" Game class like this:

protected override void Update(GameTime gameTime)
{
    this.CurrentKeyboardState = Keyboard.GetState();

    // main :Game class logic here

    base.Update(gameTime);

    this.PreviousKeyboardState = this.CurrentKeyboardState;
}

then, reuse keyboard states (which have internal scope) in all other game components. The reasons behind this are 1) minimize keyboard processing load, and 2) reduce "pollution" of all other classes with similar keyboard state variables.

Since I'm quite a noob in both game and XNA development, I would like to know if all of this sounds reasonable.

UPDATE: If someone is interested, actual utility class, as suggested by David Gouveia, I've created can be found here.

sentences:
What is the name of this game design style? There is a style of game design which is shared by many mobile puzzle games where a game is divided into an small number (3-10) of main chapters and each one has a grid of a larger number of short levels, a famous example is Angry Birds. I would like to know what this style of game design is called.

I don't remember any game with this style from my childhood, this style seems to be relatively new.

Edit: SkyRoads (1993) has a relatively similar level selection menu.

sentences:
Difference between "texture" vs "texture2d" in OpenGL ES? I see many example in shadertoy use texture, but in the cocos2d-x, only texture2d.

Does texture use normalized coordinate and texture2d doesn't?
Because when I use texture2d, it returns wrong result.

sentences:
networking - how to deal with serverside packet arrival delay? Let's assume each client sends a packet every 0.05 seconds. (rate = 20)
Server update tickrate is 60 and it sends data back to client every 1 / 30 seconds.
Now client A has 50ms ping time and it sent each data at [A]5, [B]5.05, [C]5.10 second.
But due to some networking issue, server received each data at [A]5.05(good), [B]5.10(good), [C]5.18(bad! it delayed 0.03 seconds.)
When server get the packet [A] at 5.05 seconds, since each packet contains client data(like commands) for 0.05 seconds, it updates the entity based on this [A] packet for 0.05 seconds. after that, server time is now 5.10. and the next packet, [B] is already arrived so server just can keep updating.
At 5.15, now server has to update the entity with next packet, which is C, but there's no packet! Server has to wait for 0.03 seconds till next packet will be arrived. now, server is behind 0.03 seconds from client. sync failed.

I have two idea for solving this problem.

Server maintains its own client's time and sends back to client. For client side, when there is heavy desync between client and server, the client syncs to the server time.

Solution 1 is still applied. but there is one more. like entity-interpolation, there is packet-interpolation. Client sends each packets every t seconds which is (t = [SEND-TICKRATE + CLIENT-LAG]) . It means server gets next packet after [t + LATENCY] seconds which is always larger than SEND-TICKRATE, 0.05 in this assumption.
So when server gets packet, it doesn't update it immediately but waits for some time (like 0.03 ~ 0.05 seconds). Now server has next packet with a high probability.

I think Solution 2 is good. But the drawback is, client renders other player's data behind [RTT + Entity-Interpolation time + Server packet Interpolation time], so for a fast-paced-game, Shot-behind-the-wall will more happen.
What technique is used in other fast-pace-game like league of legends or overwatch?

sentences:
Difference between reflection mapping and raytracing Both methods involve casting a ray unto the reflecting object. It will be reflected. In reflection mapping - the intersection of this reflected ray with the environment map (texture) will yield the result.

Isn't it the same for ray-tracing, though? Or is ray-tracing classified only as ray-tracing if it works with the real 3D geometry in the scene (not pre-computed images).

sentences:
XNA 4: RenderTarget2D textures getting transparent on fullscreen I'm generating a Texture2D object using RenderTarget2D as in the following code

public static Texture2D GetTextTexture(string text, Vector2 position, SpriteFont font, Color foreColor, Color backColor, Texture2D background=null)
{
            int width = (int)font.MeasureString(text).X;
            int height = (int)font.MeasureString(text).Y;

            GraphicsDevice device = Settings.game.GraphicsDevice;
            SpriteBatch spriteBatch = Settings.game.spriteBatch;

            RenderTarget2D renderTarget = new RenderTarget2D(device, width,
            height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8,
            device.PresentationParameters.MultiSampleCount, RenderTargetUsage.DiscardContents);

            device.SetRenderTarget(renderTarget);
                device.Clear(backColor);
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
                if (background != null) spriteBatch.Draw(background, new Rectangle(0, 0, 70, 70), Color.White);
                spriteBatch.End();
                spriteBatch.Begin();
                spriteBatch.DrawString(font, text, position, foreColor, 0, new Vector2(0), 0.8f, SpriteEffects.None, 0);
                spriteBatch.End();
            device.SetRenderTarget(null);
            ResetGraphicsDeviceSettings();
            return (Texture2D)renderTarget;
}

It's working all fine. But when I ToggleFullScreen() (and vice-versa), the previous textures are getting transparent. However, the new textures after that are being generated correctly.

What can be the reason for this?

sentences:
Physics.IgnoreCollision not working right after invoked When invoking Physics.IgnoreCollision in Unity, it seems work but it still have collision detection right after creation.

I have this issue with ejecting empty case after gun fire, it's spawning position located inside of character controller(collider), so when ejecting case created, it immediately hit to my character controller and makes my character slows.

First I thought that it's coming from something else, but it's not, because when I just not spawning the empty case, it never happens.

This is the code:

GameObject ejectedCase = Instantiate(emptyCasePrefab, caseSpawnPoint.position, caseSpawnPoint.rotation);

Collider caseCollider = ejectedCase.GetComponent<Collider>();
Physics.IgnoreCollision(caseCollider, playerCollider);

Note that playerCollider is Collider. I also tried with CharacterController(because it's extended from Collider class) but result was same.

Why I said something like "it's not working right after invoked" because it's actually working after passed some time. If it's not work, character controller step on the empty case and makes camera jittering issue on vertical axis. This is totally gone after ignoring collision detection with above code, however it still works right after creation and makes my character really slow.

How do I avoid this weird glitch, makes IgnoreCollision works right after it invokes?

In addition: I don't want to fix this issue with using Layer Collision Matrix. I didn't tried but it will work sure, however I don't want to spend Layer for this purpose only, because it's number is limited and already using lots of layers in other logics so it makes game logic more complicated if I use Layer to avoid collision detection. I want to know why "Physics.IgnoreCollision" not works because literally it saids "ignore collision" but it wasn't.

sentences:
Simple mobile multiplayer game. TCP/UDP? I'm tying to dive into multiplayer game programming.

The game is quite simple, it's a 2D scroller mobile game, the player need to touch the screen in order to move 1 step and it could contain up to 4 players at max. 1 of the player could create a room for other players to join.

I was thinking that I would use TCP for this and will only send packets when 1 of the player trigger an event like moving or exiting the game. Is my approach is correct? Since from what I've read, many games are created in UDP instead of TCP.

In case of UDP, what is sent between the clients and the server? The position of each entity in the game at a fix time interval?

I'm really new multiplayer programming. I'd appreciate if someone would share their story.

Thank you.

sentences: Why use compression such as zlib? Compression and encryption are different things AFAIK, so why even use compression if you have to still decompress anyway, is this just to reduce distribution size or is there some other reason?

sentences: Can I use the idea of grappling hook and wingsuit from just cause 3 and use it in my game? I really liked the idea of grappling hook and wingsuit, and I am inspired by it.And I have already created the model,texture,animation,script which are required for it by myself.So,my simple question is that can I use it in my game?

sentences:
3D collision detection with meshes using only raycasting? I'm building a game using WebGL and Three.js, and so far I have a terrain with a guy walking on it. I simply cast a ray downwards to know the terrain height.

How can I do this for other 3D objects, like the inside of a house? Is this possible by casting many rays in every direction of the player?

If not, I would like to know how I can achieve the simplest collision detection possible for other meshes. Do you have to cast a ray to every triangle in every mesh nearby?

sentences:
Tiling perlin noise seamlessly, but without repeating to generate an infinite 3D world I have been working on a 3D game in java using LWJGL for a while now. I am trying to make procedurally generated infinite 3D terrain that is generated around the player.

So far I have:

3D terrain chunks that are loaded and unloaded when the player moves. These chunks are made up of triangles not quads, and are 128x128 vertices.
A Perlin noise class that can successfully generate Perlin noise. (I think it is actually something called value noise, but it works)
A world class that handles loading and unloading of chunks, and applying the height maps to the chunks.

All of this works as it is coded to do, but not how I want it to. I don't know how to tile the noise seamlessly.

How would I make the noise tile, and furthermore, how would I generate large structures such as mountains that occupy probably up to hundreds of chunks.

Here is what is currently happening with the chunks and noise not tiling:

Here is my Perlin noise code:

private float[][] perlinNoise(int width, int height, int octave, float[][] whiteNoise)
{
    float[][] result = new float[width][height];

    int samplePeriod = 1 << octave;
    float sampleFrequency = 1.0f / samplePeriod;

    for (int i = 0; i < width; i++)
    {
        int x1 = (i / samplePeriod) * samplePeriod;
        int x2 = (x1 + samplePeriod) % width;
        float xBlend = (i - x1) * sampleFrequency;

        for (int j = 0; j < height; j++)
        {
            int y1 = (j / samplePeriod) * samplePeriod;
            int y2 = (y1 + samplePeriod) % height;
            float yBlend = (j - y1) * sampleFrequency;

            float top = (float) MathHelper.interpolateLinear(whiteNoise[x1][y1], whiteNoise[x2][y1], xBlend);

            float bottom = (float) MathHelper.interpolateLinear(whiteNoise[x1][y2], whiteNoise[x2][y2], xBlend);

            result[i][j] = (float) MathHelper.interpolateLinear(top, bottom, yBlend);
        }
    }
    return result;
}

public float[][] generatePerlinNoise(int width, int height, Random random, int octaveCount)
{
    float[][] whiteNoise = new float[width][height];
    float[][][] totalNoise = new float[octaveCount][][];
    float[][] perlinNoise = new float[width][height];
    float amplitude = 1.0f;
    float totalAmplitude = 0.0f;
    float persistance = 0.5f;

    for (int i = 0; i < width; i++)
    {
        for (int j = 0; j < height; j++)
        {
            whiteNoise[i][j] = random.nextFloat() % 1;
        }
    }
    for (int i = 0; i < octaveCount; i++)
    {
        totalNoise[i] = perlinNoise(width, height, i, whiteNoise);
    }
    for (int o = octaveCount - 1; o >= 0; o--)
    {
        amplitude *= persistance;
        totalAmplitude += amplitude;

        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                perlinNoise[i][j] += totalNoise[o][i][j] * amplitude;
            }
        }
    }
    for (int i = 0; i < width; i++)
    {
        for (int j = 0; j < height; j++)
        {
            perlinNoise[i][j] /= totalAmplitude;
        }
    }
    return perlinNoise;
}

I think it would also be worth mentioning that I have asked about this on StackOverflow as well.

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:
Circle-Line Collision Detection Problem I am currently developing a breakout clone and I have hit a roadblock in getting collision detection between a ball (circle) and a brick (convex polygon) working correctly. I am using a Circle-Line collision detection test where each line represents and edge on the convex polygon brick.

For the majority of the time the Circle-Line test works properly and the points of collision are resolved correctly.

Collision detection working correctly.

However, occasionally my collision detection code returns false due to a negative discriminant when the ball is actually intersecting the brick.

Collision detection failing.

I am aware of the inefficiency with this method and I am using axis aligned bounding
boxes to cut down on the number of bricks tested. My main concern is if there are any
mathematical bugs in my code below.

/*
 * from and to are points at the start and end of the convex polygons edge.
 * This function is called for every edge in the convex polygon until a
 * collision is detected.
 */

bool circleLineCollision(Vec2f from, Vec2f to)
{
    Vec2f lFrom, lTo, lLine;
    Vec2f line, normal;
    Vec2f intersectPt1, intersectPt2;
    float a, b, c, disc, sqrt_disc, u, v, nn, vn;
    bool one = false, two = false;

    // set line vectors
    lFrom = from - ball.circle.centre;      // localised
    lTo = to - ball.circle.centre;          // localised
    lLine = lFrom - lTo;                    // localised
    line = from - to;

    // calculate a, b & c values
    a = lLine.dot(lLine);
    b = 2 * (lLine.dot(lFrom));
    c = (lFrom.dot(lFrom)) - (ball.circle.radius * ball.circle.radius);

    // discriminant
    disc = (b * b) - (4 * a * c);

    if (disc < 0.0f)
    {
        // no intersections
        return false;
    }
    else if (disc == 0.0f)
    {
        // one intersection
        u = -b / (2 * a);

        intersectPt1 = from + (lLine.scale(u));
        one = pointOnLine(intersectPt1, from, to);

        if (!one)
            return false;
        return true;
    }
    else
    {
        // two intersections
        sqrt_disc = sqrt(disc);
        u = (-b + sqrt_disc) / (2 * a);
        v = (-b - sqrt_disc) / (2 * a);
        intersectPt1 = from + (lLine.scale(u));
        intersectPt2 = from + (lLine.scale(v));

        one = pointOnLine(intersectPt1, from, to);
        two = pointOnLine(intersectPt2, from, to);

        if (!one && !two)
            return false;
        return true;
    }
}

bool pointOnLine(Vec2f p, Vec2f from, Vec2f to)
{
    if (p.x >= min(from.x, to.x) && p.x <= max(from.x, to.x) &&
        p.y >= min(from.y, to.y) && p.y <= max(from.y, to.y))
        return true;
    return false;
}

sentences: How Plants vs Zombies animation is done? I really like the plants vs zombies style of animation and it doesn't look complicated yet the result is really good. I doubt it's made of sprites seeing there's a large number of animations, combinations, distortions, outfits. So how that kind of animation is done?

sentences:
How to setup glOrtho and Viewport When setting up a window I set 6 variables in my render class

int windowWidth;    // the width of the window
int windowHeight;   //the height of the window
int dimL;           // the coordinate of the left side of the display
int dimR;           // the coordinate of the right side of the display
int dimB;           // the coordinate of the top side of the display
int dimT;           //the coordinate of the bottom side of the display

In my initiation routine, i set the displayMode like this:
Display.setDisplayMode(new DisplayMode(windowWidth, windowHeight));

I set glOrtho like this:

GL11.glOrtho(dimL, dimR, dimB, dimT, 1, -1);

now my question is:

Using these variables how can i configure glViewport to have the area defined by the dimX variables fill the display?

thanks!

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

In a vertex shader I have this:

uniform mediump mat4 projectionViewModelMatrix;

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

uniform int channels;
uniform sampler2D hero;

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

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

Using

glGetUniformLocation

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

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

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

sentences:
Clean way to do sprite flashing? In old, 8-bit/16-bit games, sprites flashing every other frame were common. I don't want to use the hacks I've used before. Is there an elegant/clean way to do this? This is how I usually do it:

bool everyother = false;
// update
everyother = !everyother;
// draw
if (flashing && everyother)
    // do nothing
else
    // draw

Seems like a hack to me.

sentences:
Drawing sprites messes up my model in XNA4 I have a model which draws correctly in XNA4.

However if I try to add a background image (or any sprite), the rendering of my model is messed up. There are two problems with the rendering

model is partially transparent
hidden surfaces are visible.

 Above is the 'problem' rendering (the cyan coloured cockpit cover is visible through the bottom of the ship)

 This is how the rendering should look

sentences:
iPhone Game - Sprites I have made games with cocos2d for the iphone however I am looking to move on from that, is there a good direction you could suggest? If not I was planning on using what the SDK gives me, and so for example to make a sprite, say the player on screen, rather than a CCSprite, what would be best to use? What do I need to go and learn?

Thanks.

sentences:
Serializing object members within unordered_map and storing into binary file (C++) I'm making a multiplayer game, the Server stores it's game world state as various std::unordered_map in a class
called ServerWorldState.

The server is composed by a single class called Game, which contains ServerWorldState.

Currently I'm trying to make Save() and Load() functions, which for now will be in the Game class. These functions
are supposed to save certain data from the maps within ServerWorldState into a binary archive, for this purpose, I'm
using Cereal library for serialization and the standard file IO streams.

Cereal requires a serialize method to be present in a class, in order for members to be specified for serialization:

ServerWorldState.h

class ServerWorldState : public World
{
private:
    std::unordered_map<int, ServerProp> props;
public:
    template<class Archive>
    void serialize(Archive& archive);

};

ServerWorldState.cpp

template<class Archive>
void ServerWorldState::serialize(Archive& archive)
{
    archive(props); //Serialize things by passing them to the archive
}

The ServerProp class actually has another serialize method within itself. I'm unsure if this is correct for specifying with further depth what object members should get serialized.

Save function from Game (load works very similar and has same problem, but since I haven't finished it's design I'm only showing save):

Game.h

class Game
{
private:
    std::shared_ptr<ServerWorldState> currentWorld;
public:
    bool Save();
};

Game.cpp

bool Game::Save()
{
    std::ofstream outfile("level.dat", std::ios::binary | std::ios::out);
    if (!outfile) {
        std::cout << "SERVER_WORLD_STATE::SAVE: Could not open world.dat file for saving!" << std::endl;
        return false;
    }

    {
        cereal::PortableBinaryOutputArchive oarchive(outfile); //Create an output archive

        oarchive(currentWorld); //Write data to the archive

    } //Archive goes out of scope, ensuring all contents are flushed

    outfile.close();

    return true;
}

In essence I want to serialize/deserialize and binary save/load the std::unordered_map in ServerWorldState, but I get this link error:

  Error LNK2019 unresolved external symbol "public: void __cdecl ServerWorldState::serialize(class cereal::PortableBinaryOutputArchive &)" (??$serialize@VPortableBinaryOutputArchive@cereal@@@ServerWorldState@@QEAAXAEAVPortableBinaryOutputArchive@cereal@@@Z) referenced in function "public: static void __cdecl cereal::access::member_serialize(class cereal::PortableBinaryOutputArchive &,class ServerWorldState &)" (??$member_serialize@VPortableBinaryOutputArchive@cereal@@VServerWorldState@@@access@cereal@@SAXAEAVPortableBinaryOutputArchive@1@AEAVServerWorldState@@@Z) - Game.obj line 1

I would asume this would show if the serialize method wasn't defined, but it is.
I also thought I might be missing some inclusion, but I seem to have all in order.

sentences: Electricity effect using XNA and Shaders I'm looking for a shader or sample that does an electricity or lines-of-force effect between two points that can be used with XNA 3.1.

sentences:
GLSL light coloring blocked surfaces I have created a very simple lighting shader. It currently only supports point lights, but it lights up surfaces that are completely blocked from the light. I know why, but I want to know how I can fix it. I was thinking of using a form of shadow mapping to darken those areas, but shadow mapping is difficult for me to understand and has very major performance issues. I was hoping for a more elegant and efficient version, even if it is not as nice.

Until something like that exists, I need a nice, efficient way of checking to see if a fragment or vertex is visible and computing things from there. I would also like to add that I intent to support semi-transparent objects, which should block light based on and alpha value.

The things I want:

Fast (25+ fps with the modified shaders, I currently run at 82)
Easily modified to incorporate more lights (three or four at most, probably).
Support for edge smoothing (user can enable it, but will lose performance)

The things I do not want:

Pulling information from the GPU during rendering (view stuttering is always visible when that happens)
Visible/noticeable moving of lighting when scene is stationary (like the light is moving when it really isn't, due to randomizing)
Expensive operations when the scene first renders.

I do not expect anybody to implement these things - just to leave room and maybe a comment where these would be done. I know this is the "holy grail" of rendering when combined with bump maps and such, but if you tone down the quality a bit, I hope it is possible. I may have to do some extra work on the CPU, but that is acceptable.

Now for the shaders I currently have working:

Vertex shader

varying vec4 color;
varying vec3 normal;
varying vec4 position;

void main (void) {
    color = gl_Color; // pass color to the fragment shader
    normal = normalize(gl_NormalMatrix * gl_Normal); // calculate useable normals from the basic normal data.

    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; // set position
    gl_TexCoord[0] = gl_MultiTexCoord0; // set texture coordinates
    position = gl_Vertex; // pass gl_Vertex to the fragment shader for light calculations.
}

Fragment shader

varying vec4 color;
varying vec3 normal;
varying vec4 position;

uniform sampler2D texture;
uniform vec4 light; // position of the light, same coordinate system as non-transformed objects

void main (void) {
    vec3 vector = light.xyz - position.xyz; // get the vector needed to determine length
    float distance = sqrt((vector.x * vector.x) + (vector.y * vector.y) + (vector.z * vector.z)); // determine length
    vec4 final = color; // set color

    final.xyz *= (1.0 / distance); // calculate light intensity on pixel

    gl_FragColor = final * texture2D(texture, gl_TexCoord[0].st); // multiply by texture color
}

I can do a lot of extra cool things with this current code, such as giving lights their own colors and giving objects their own material properties, but that is not the point now. I just want basic code, preferably without needing more buffers and shaders, to determine visibility. From my research, it sounds like the stencil and depth buffers may be of use here, and they already setup, so they may be a better way to do it.

I can not stress enough that I only need the bare essentials here - nothing overly fancy. Thanks in advance for your help.

sentences:
Overlapping surfaces in deferred shader blend through one another I've just finished implementing deferred shading into my engine, and noticed that when a large object overlaps another smaller object, it blends through it.

For example, in this scene I have a large plane floor, and on top of it rests 3 rectangle walls. When looking at these walls anywhere from above the floor, one can see that the floor blends through the walls.

Alternatively, here's a small video clip showing what I mean

I've been following a tutorial series on OGLDev, and have followed the guide very closely, with the sole exemption being that I use a component based system.

The general format of my rendering loop is as follows:

Prepare the GBuffer
Render Pass (render to FBO, output properties as textures)
Stencil Pass (render light object for stencil operations)
Light Pass (sample from previous textures for lighting calculations)
Final Pass (draw back to default FBO)

Specifically, during my rendering pass the lights are rendered using geometrical objects, such as a bounding sphere for point lights (the only light currently implemented).

I believe that the issue is with the function

  glBlendFunc(GL_ONE, GL_ONE);

I may have multiple lights in a scene, so I need to be able to blend them all together, however when I do that I seem to also get surfaces blending together. If I disable the blend function, the problem disappears but then only the last light processed will render.

The blend function occurs in the following function:

Lighting Pass:

void DLightPointComponent::LightPass(DCamera *cam, GBuffer *gbuffer)
{
    // Obtain required objects for lighting pass
    PointLight point = getPointLight();
    BaseLight base = point.getBaseLight();
    Attenuation atten = point.getAtten();
    DModelComponent *BSphere = getSphere();
    DSuperShader *shader = getSuperShaderProgram();
    QMatrix4x4 mat = getModelMatrix(), mat2 = BSphere->getModelMatrix();
    DMeshComponent *mesh = BSphere->getMeshComponent();

    // Scale up bounding sphere
    float BSphereScale = CalcPointLightBSphere(point)*5000000000;
    mat2.scale(BSphereScale);

    // Prepare textures for sampling
    gbuffer->BindForLightPass();

    // Upload uniforms to shader
    shader->bind();
    shader->bindCamera(*cam);
    shader->pushMatrix(mat);
    shader->pushMatrix(mat2);
    mesh->setShaderProgram(shader);
    mesh->bindToShader();

    ... (upload the many light uniforms to shader) ...

    // Specific OpenGL operations
    glStencilFunc(GL_NOTEQUAL, 0, 0xFF);
    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendEquation(GL_FUNC_ADD);
    glBlendFunc(GL_ONE, GL_ONE);
    glEnable(GL_CULL_FACE);
    glCullFace(GL_FRONT);

    // Render the bounding sphere
    mesh->pollWholeMesh();

    //Clean up shader
    glCullFace(GL_BACK);
    glDisable(GL_BLEND);
    shader->popMatrix();
    shader->release();
}

My rendering pass in question:

void oglWidget::RenderPass(QList<DComponent*> *components, DCamera *cam, GBuffer *gbuf)
{
    // Obtain the gbuffer shader, and bind all prerequisites to the shader
    DSuperShader *shader = gbuffer->getSuperShaderProgram();
    gbuf->BindForGeomPass();
    shader->bind();
    shader->bindCamera(*cam);

    // Specific OpenGL functions
    glDisable(GL_BLEND);
    glDepthMask(GL_TRUE);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);

    // Render geometry into GBuffer
    for (int x = 0, total = components->size(); x < total; ++x)
        components->at(x)->pollLocal(shader);

    // Shader Cleanup
    shader->release();
    shader->popMatrix();
    shader->purgeCamera();
    glDepthMask(GL_FALSE);
}

If any further information is wanted, I'll post it.

sentences:
Unity 5 C# - onClick.AddListener in a foreach loop using lambda expressions I'm trying to dynamically create Unity 5 UI buttons that each set a global variable decision_id to a different value when clicked.

The problem I'm having with this implementation is that they all set decision_id to the exact same value right now. That value being the last one in my foreach loop.

Here's my code:

IEnumerator make_decision(XmlNode options_node) {
    // reset decision_id
    decision_id = "nothing";

    // spawn a button for each option_node in options_node
    int i = 1;
    var new_option_1 = Instantiate(option_1);
    var new_option_2 = Instantiate(option_2);
    var new_option_3 = Instantiate(option_3);
    var new_option_4 = Instantiate(option_4);
    foreach (XmlNode option_node in options_node) {
        XmlNode temp_option_node = option_node;
        string option_id = temp_option_node.Attributes["id"].Value;
        Debug.Log(option_id);
        switch (i) {
            case 1:
                new_option_1.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_1.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_1.transform.SetParent(canvas.transform, false);
                break;
            case 2:
                new_option_2.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_2.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_2.transform.SetParent(canvas.transform, false);
                break;
            case 3:
                new_option_3.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_3.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_3.transform.SetParent(canvas.transform, false);
                break;
            case 4:
                new_option_4.GetComponentsInChildren<Text>()[0].text = option_node.InnerText;
                new_option_4.GetComponent<Button>().onClick.AddListener(() => set_decision_id(option_id));
                new_option_4.transform.SetParent(canvas.transform, false);
                break;
            default:
                Debug.Log("Too many option nodes! Should only be four per options section");
                break;
        }
        i++;
    }

    while (decision_id == "nothing") {
        yield return new WaitForSeconds(.5f);
        // the button will change decision_id for us eventually
        // decision_id = "monarchy";
    }

    // despawn each button spawned above
    Destroy(new_option_1);
    Destroy(new_option_2);
    Destroy(new_option_3);
    Destroy(new_option_4);

}

I've searched this issue and have found lots of talk about the lambda's capturing instances instead of values... but I've already gone out of my way to prevent this by capturing both the XmlNode itself AND the id string in local variables.

Is there something super obvious that I'm missing here?

sentences:
Button - change texture after click I need to make a button with texture. After button is pressed I want to change texture of button permanently.
For example on/of sound button.
I tried this but it changes image only while I hold button.

Thanks

mSoundButton  = new ButtonSprite(30, 30,
                    ResourceManager.getSoundButtonTR(),
 //tiled texture region with image for sound on and sound off
                    ResourceManager.getEngine().getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(TouchEvent pTouchEvent,
                                     float pTouchAreaLocalX,
                                     float pTouchAreaLocalY) {
            if(pTouchEvent.isActionDown()) {
                SFXManager.toggleSoundEnabled();
                this.setCurrentTileIndex(1);
            }
            return super.onAreaTouched(pTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
        }
    };
    mScene.registerTouchArea(mSoundButton);
    mScene.attachChild(mSoundButton);

sentences:
Möbius effect in Unity This morning I've seen the following animation on Twitter. It is a kind of Möbius strip effect.

It's cool! Isn't it? So I've decided to build something similar using Unity, just for fun. I want to build the effect using just the cameras, as this way we can use it for any rotating scene. The first step has been to create a circle scene and make it rotate:

Note that the camera uses an ortographic projection so perspective does not deform it. This is important so we can merge different views later.

Then I've replaced the main camera by two different ones, located in opposite positions (horizontal and vertical) and rendering to textures. A simple Canvas with two panels (divided vertically) shows the partial result (one camera texture per panel):

I know this is cool, but not perfect yet, as the center of the rendered output shows clearly where a panel finishes and the other one starts. Look at the center of the rendered output above.

The original inspiration video shows no perspective in the center, and I think that is the trick, but I cannot achieve that with an orthographic camera (or I don't know how).

Do you know any approach to distort the camera or something similar, so the cameras are perpendicular in the middle of the scene (and only in the middle)? Are you able to think a solution to dissimulate the joint of both camera views?

As a first approach (dismissed for the moment) I've tried to add another camera, perpendicular to the scene so there is no perspective in that point. Then I render its output in the UI in another panel on top of the previous ones. And it is not too bad, but again the joint is too obvious and now I have two joints instead of one:

sentences: How to implement mouse based movement in an RPG? (Java) I'm making a 2D rpg and I want the character to move with the mouse, ie the user clicks and then the character moves to that location. How do I accomplish this?

sentences:
XNA 3d model mesh.draw() throws TextureCoordinate0 is missing error I've downloaded a bunch of 3d models from turbosquid.com. The majority of the one's I've downloaded are simply .fbx files. When I load the model into my game and run it, the following error is thrown in mesh.draw():

An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.Graphics.dll

Additional information: The current vertex declaration does not include all the elements required by the current vertex shader. TextureCoordinate0 is missing.

All the answers I've found online seem to tell people to reexport the model, or change something in the shader. I don't have access to these, just the fbx file. What can I do?

sentences:
XNA Textures dissappear when game window is resized [SOLVED] - See linked post in the P.S.

I have a set of Texture2Ds generated in the Load method with this function:

Texture Generation:

private Texture2D[,] createTextureSet(TileInfo[,] map)
    {
        Texture2D[,] texSet = new Texture2D[map.GetLength(0), map.GetLength(1)];

        using (SpriteBatch sprb = new SpriteBatch(GraphicsDevice))
        {
            for (int row = 0; row < map.GetLength(0); row++)
            {
                System.Threading.Thread.Sleep(10);
                for (int col = 0; col < map.GetLength(1); col++)
                {
                    RenderTarget2D renderer = new RenderTarget2D(this.GraphicsDevice, 300, 300);
                    System.Threading.Thread.Sleep(2);
                    GraphicsDevice.SetRenderTarget(renderer);
                    renderer.Name = map[row, col].buildings[0].buildingType;
                    GraphicsDevice.Clear(Color.Transparent);
                    sprb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
                    sprb.Draw(TextureFromFile(resourceDirectory + @"Images\Tile Backgrounds\" + map[row, col].tileType + @"\" + map[row, col].tileBackground + ".png"), renderer.Bounds, Color.White);
                    sprb.Draw(TextureFromFile(resourceDirectory + @"Images\Buildings\" + map[row, col].buildings[0].buildingType + ".png"), (Vector2)map[row, col].buildings[0].pointWithinTile, Color.White);
                    sprb.End();
                    texSet[row, col] = renderer;
                }
            }
        }

        GraphicsDevice.SetRenderTarget(null);
        return texSet;
    }

The tiles are drawn on the screen using the following code:

Texture Rendering

for (int tx = -1; tx < 2; tx++)
        {
            for (int ty = -1; ty < 2; ty++)
            {
                gameSpriteBatch.Draw(mapTextureSet[gameCharacter.characterTile.tileX + tx, gameCharacter.characterTile.tileY + ty], determinePositionToDrawTile(gameCharacter, map[gameCharacter.characterTile.tileX + tx, gameCharacter.characterTile.tileY + ty], tx, ty, resizeX, resizeY), null, Color.White, 0f, Vector2.Zero, new Vector2(resizeX, resizeY), SpriteEffects.None, 0f);
            }
         }

These textures are then drawn on the screen based on where on the map the player is. The game runs fine, until the game window is resized by the user. After that, only the character sprite remains on the screen during the redraws, and the screen remains the default Color.BlanchedAlmond background of my game. Any help is thanked in advance.

[ ! ] P.S. [ ! ]

Before marking this as a duplicate! I have looked at this and tried most of the applicable solutions from it, none of which have worked, so I assume that this error is deeper than that one.

sentences:
Is it a good idea to render many textures into one texture? I'm making a 2D game with OpenGL. In order to avoid changing the state machine and binding at runtime, I want to make consolidate my textures into bigger textures,

for example, taking 4 128x128 textures and making 1 big 512x512. I could then just render part of the texture rather than binding a new one.

Is this a good idea? Could my newly created texture get lost, or are there major faults in doing  this?

Thanks

sentences:
Game Institute Math Courses I'm 21 years old and I suck at math, I mean really bad. I don't have the necessary logic to apply it towards programming. I would like to learn the math and logic of applying it. I found Game Institute (http://www.gameinstitute.com) awhile back and heard a lot of praise about them. Are there Math courses any good?

Thank you.

Edit: My high school was terrible and did not prepare me for any math. I am fairly decent at programming, I just don't have the logic to apply any mathematics to programming, as an example I don't understand the algorithm of finding the size of a user's screen.

Yes I have heard of KhanAcademy (http://www.khanacademy.org/) and I have completed a lot of maths on his website but I still don't have the logic to apply any of it to programming.

sentences:
GLSL shader algorithm to render a sprite map with a single draw call (on a single sprite mesh) I'm trying to render a tile map world on a single sprite mesh (instead of one sprite per tile.) This significantly reduces the array vertex bus labor for extremely large worlds:

In order to do this, you pass two textures to the shader: the sprite sheet itself, and a texture containing tile IDs.

Sprite map (I know some tiles repeat but ignore that, this could be any spritesheet):

Below: Entire tile world represented by a 128 x 128 texture map, where each RGB value holds actual Tile ID for that location on the map. There are more efficient ways to represent the actual tile ID. Here, for the sake of simplicity, it is stored in the R component.

Putting it all together:

The right-most square is the screen output. On the image I just repeat texture... but what should actually happen is a tile world rendered from tiles on the sprite sheet.

I wrote the shader that is supposed to do this, but I'm stuck. I can render the sprite sheet itself, and even scale it on the sprite mesh, but I can't seem to get the tile IDs render at the proper location, matching the tile world data.

I do think I am really close and there are just a couple of modification needed to the shader -- so what am I doing wrong?

The following shader is what I have so far:

tilemap.vs

#version 330 core

layout (location = 0) in vec3 position;
layout (location = 1) in vec3 color;
layout (location = 2) in vec2 texCoord;

out vec2 TexCoord;

uniform sampler2D ourTexture;
uniform sampler2D ourTilemapDataTexture;

uniform mat4 Model;
uniform mat4 View;
uniform mat4 Projection;

void main()
{
    gl_Position = Projection * View * Model * vec4(position, 1.0);

    TexCoord = texCoord;
}

tilemap.frag

#version 330 core

in vec2 TexCoord;

uniform sampler2D ourTexture;
uniform sampler2D ourTilemapDataTexture;

void main() {

    // size of the tile world (128 by 128 tiles on one sprite)
    float cols = 128.0f;
    float rows = 128.0f;

    float tilesPerSide = 8.0f;

    // figure out which tile we´re in from the 3D coordinates
    vec2 tile = vec2(floor(TexCoord.x)/cols, floor(TexCoord.y)/rows);

    // get tile´s texture ID from tile ID texture map
    float tex = texture2D(ourTilemapDataTexture, tile).r;

    vec2 UV = vec2(tex + fract(TexCoord.x), fract(TexCoord.y));

    color = texture2D(ourTexture, UV);

    if (color.a == 0) // remove transparent areas
        discard;
}

PS: I looked at every tutorial I could find on Google, and tried to re-implement it in my shader to no effect. This is as far as I got so far.

Can anyone point out what I'm doing wrong?

Update #1 -- I was able to get position sampling to work.

I painted a bit on the world map:

It's not perfect but definitely a step forward:

Adjustments made to the fragment shader:

float cols = 128.0f;
float rows = 128.0f;

float tex = texture2D(ourTilemapDataTexture, TexCoord).r;
float tey = texture2D(ourTilemapDataTexture, TexCoord).g;

vec2 UV = vec2( (TexCoord.x * (cols) / (tex * 32.0f)),
                (TexCoord.y * (rows) / (tey * 32.0f)) );

color = texture2D(ourTexture, UV);

Sure it's not 100% correct but at least map indexing works now :)

sentences:
Why does glGetString returns a NULL string I am trying my hands at GLFW library. I have written a basic program to get OpenGL renderer and vendor string. Here is the code

 #include <GL/glew.h>
#include <GL/glfw.h>
#include <cstdio>
#include <cstdlib>
#include <string>

using namespace std;

void shutDown(int returnCode) {
    printf("There was an error in running the code with error %d\n",returnCode);
    GLenum res = glGetError();
    const GLubyte *errString = gluErrorString(res);
    printf("Error is %s\n", errString);
    glfwTerminate();
    exit(returnCode);
}

int main() {
    // start GL context and O/S window using GLFW helper library
    if (glfwInit() != GL_TRUE)
        shutDown(1);
    if (glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW) != GL_TRUE)
        shutDown(2);
    // start GLEW extension handler
    glewInit();

    // get version info
    const GLubyte* renderer = glGetString (GL_RENDERER); // get renderer string
    const GLubyte* version = glGetString (GL_VERSION); // version as a string
    printf("Renderer: %s\n", renderer);
    printf("OpenGL version supported %s\n", version);

    // close GL context and any other GLFW resources
    glfwTerminate();
    return 0;
}

I googled this error and found out that we have to initialize the OpenGL context before calling glGetString(). Although I have initialized OpenGL context using glfwInit() but still the function returns a NULL string. Any ideas?

Edit
I have updated the code with error checking mechanisms. This code on running outputs the following

There was an error in running the code with error 2
Error is no error

sentences:
Is there a way to setup a notification from Unreal Engine when it finishes packaging / building my game? In Unity I was able to use a post build script to send myself an email when Unity finishes building a game. Is there a way to make a script run when Unreal Engine is done packaging a game?

Or any other way to set up a notification sound or visual prompt in my Windows PC to alert me when it finishes packaging?

sentences:
How to detect a swipe and make the player GO rotate towards the end of the touch Android Unity I am making a game where the user can swipe on the screen and the player gameobject will turn towards the end of the swipe.

I am using the following to detect the end of the swipe:

        if (touch.phase == TouchPhase.Ended)
        {
            swipeEndPos = touch.position;
            swipeDistance = (swipeEndPos - swipeStartPos).magnitude;
            if (swipeDistance > minSwipeDistance)
            {
                Vector3 swipeEndPoint = mainCamera.ScreenToWorldPoint (swipeEndPos);

                player.Turn (swipeEndPos);
            }
        }

And the following to make the player turn towards the end position:

     public void Turn(Vector3 direction)
     {
       transform.Rotate (new Vector3(0,direction.y,0), Space.Self);
     }

Can someone please explain what I am doing wrong?

Thank you.

sentences:
How do you assign a value of different roles in a game design project? A friend and I are building a game together and having a great time with it, and we hope to sell the product at some point. The prospects for actual earnings maybe be practically nil (and we aren't getting our expectations up), but regardless, we wanted to get some of the hard "profit splitting" questions out of the way.

Originally, my feeling was that we are both putting a full time effort into the game and would split the profits evenly. I am a programming and his role would be art and music/sound. Game design and concept generation is something we are both doing together. This has become complicated, as we are now looking at "hiring" a few other interested parties and we want to split any profit up fairly. We were looking at perhaps hiring another artist, and perhaps a sound person. We are not sure at this point what level of commitment our hired hands will be willing or able to commit.

So:

Our idea was to make a very large list of all tasks that need to be done across all categories (programming, marketing, art, sound, research, design, etc) and assign weighted values to each task based on the time requirement, difficulty/value of skill set required, and importance to the project.

Then, we can assign tasks to our hired hands and as they complete them, they would earn that percent of any profits that came in. My hope is that my original partner and I would divy up the "remaining" profit (the money our hired hands don't earn) equally when all is said and done. There's still a lot of details to work out, but our feelings were to divy things first into broad categories as follows:

14.81% - Marketing (PR, promotional campaigns, website)
 3.70% - Post-release support
18.52% - R&D (programming, tool development, engine development)
 7.41% - HR (hiring, dealing with any legal stuff, registering for digital distribution, etc)
18.52% - Art (all graphics and animations in the game)
11.11% - Sound (music + SFX)
18.52% - Game Design
 7.41% - Production (timesheet management, organizing meetings and project planning)

(The numbers are weird just because the calculated weights worked out that way)

I'm particularly interested in what others who has walked the same path as us feel. For the record, the game is a spin on the real-time strategic genre with a classic 16-bit look and feel.

Is this a sensible approach?
Are the numbers weighted reasonably in your mind? (I'm pushing for more value on game design and a little less on sound, myself)
How should be deal with changing requirements? We are estimating things as best we can currently, but we're all very new at this process, so there are sure to be areas we've over and underestimated.
Any generic advice appreciated!

Thanks everyone!

sentences:
Network without Server: NAT punchthrought How do i make 2 players connect and play together ?

Assumptions:

1) Game has no server.
2) Player only has 1 computer.
3) Player cannot configure his router or open a port.
4) Player does not want to share his PC for multiplayer.
5) Reasonable delay is allowed: up to 1 hour per packet / player action.
6) Ipv4 internet is used
7) Players can connect to any website.

Solutions I considered but cannot get them to work:
1) Posting in a random forum you don't own. Soon the thread that 10 million players use, approaches 60gb data per hour and gets closed by a moderator. Gameover.

2) Sending Data by Email.
  a) I know no email api.
  b) players will risk their email credentials.

3) Having an external server manage the initial connection.
  a) I know none that are free.
  b) I am not paying money.

More specific :
I am using unity, i am willing to port solutions if you find a free site or solution that works.

sentences:
Libgdx: How to replace texture with shaperenderer? I have a method that creates rectangles, it takes a texture

 for (Rectangle rect : rect) {
            game.batch.draw(rectImage, rect.x, rect.y);
        }

The texture is simple, I could just draw it instead. I created for example

shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
shapeRenderer.rect(
        rect.x,
        rect.y,
        rect.width,
        rect.height,
        Color.DARK_GRAY,
);

Now what? game.batch.draw doesn't accept shapeRenderer instead of rectImage and doesn't accept only rect.x, rect.y

I'm just wondering how to call it?

sentences:
Swap Child and Child's Child Is it possible to use swapChildren() with a child and a child's child? Every time I try, I get this error:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

Why can I not compare a child with a child's child? How can I?

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:
Version Not Final, Does Not Represent Actual Game Footage? Just curious about this.  Frequently, a lot of gameplay videos from big studios have small subtitled text at the lower part of the screen, reading something like:

Pre-Alpha Gameplay -- Footage not Final
Game Footage not Final
Pre-Alpha, Game here is not final

Is there some sort of reason they do this?  Is there some sort of legal ramification that they need to go through by adding this?   I have especially seen some gameplay vids whose titles are "Alpha x.x.x", yet still, in the video itself, it always something like "footage not final, game may change".

sentences:
Textured trapezoid in Monogame DirectX I'm working on a 2D game, so most of the graphics are sprites. However, some elements are drawn using trianglestrips in Orthographic projection. The thing is that I can't do a 3D projection because the coordinates of the vertices have to line up with some of the sprites in the game.

I'm running into a problem trying to texture these triangles.
I understand how the texturing works, so I understand that the interpolation causes the effect:

For now I have no idea where to start. I Googled and looked for similar questions, but all seem to deal with fixing this in OpenGL. like this one I have no clue how to apply it to Monogame/DirectX. I also don't know how to start with a shader, as I don't really grasp how to interpolate across two triangles.

If it makes the issue easier, I don't care for accurate perspective, just that the texture is correctly stretched over the two triangles.

So far I have only used a BasicEffect like this:

        checkered = Content.Load<Texture2D>("checkered");

        basicEffect = new BasicEffect(GraphicsDevice);
        basicEffect.VertexColorEnabled = true;
        basicEffect.TextureEnabled = true;
        basicEffect.Texture = checkered;
        basicEffect.Projection = Matrix.CreateOrthographicOffCenter
        (0, GraphicsDevice.Viewport.Width,     // left, right
        GraphicsDevice.Viewport.Height, 0,    // bottom, top
        0, 1);

The draw function is like this (nothing special):

        GraphicsDevice.Clear(Color.Green);

        basicEffect.CurrentTechnique.Passes[0].Apply();

        VertexPositionColorTexture[] vertices = new VertexPositionColorTexture[4];

        vertices[0].Position = new Vector3(100,50, 0);
        vertices[1].Position = new Vector3(200, 50, 0);
        vertices[2].Position = new Vector3(50,200, 0);
        vertices[3].Position = new Vector3(250, 200, 0);

        Color color = Color.White;
        vertices[0].Color = color;
        vertices[1].Color = color;
        vertices[2].Color = color;
        vertices[3].Color = color;

        vertices[0].TextureCoordinate = new Vector2(1, 0);
        vertices[1].TextureCoordinate = new Vector2(0, 0);
        vertices[2].TextureCoordinate = new Vector2(1, 1);
        vertices[3].TextureCoordinate = new Vector2(0, 1);

        GraphicsDevice.DrawUserPrimitives<VertexPositionColorTexture>(PrimitiveType.TriangleStrip, vertices, 0, 2);

sentences: 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:
Calculating the rotational force of a 2D sprite I am wondering if someone has an elegant way of calculating the following scenario.

I have an object of (n) number of squares, random shapes, but we will pretend they are all rectangles.

We are dealing with no gravity, so consider the object in space, from a top down perspective.  I am applying a force to the object at a specific square (as illustrated below).

How do I calculate the rotational angle, based on the force being applied, at the location being applied.  If applied in the center square, it would go straight.  How should it behave the further I move from the center?  How do I calculate the rotational velocity?

sentences:
Conservation of energy of a bouncy ball in Unity3d My problem is that in the project I have a ball with a physicMaterial where:

Dynamic Friction and Static Friction both are 0
Bounciness = 1
Friction Combine is set to Multiply
Bounce Combine is set to Maximum

This ball has a rigid body attached in which:

mass = 1
drag  and angular drag both are 0
useGravity = true

There are some cubes which create a boundary for the ball to bounce inside.
The ball bounces in a closed boundary. The problem is overtime its top velocity keeps on increasing and after sometime it gets out of the boundary.

I want the velocity of this ball to NOT exceed a provided maxVelocity. Here i am sharing my project through google drive  bounceProblem.unitypackage

sentences:
Unity - Sprite vertices in 3D world Rookie here, still learning the basics of Unity.
I've been using a quad as a cursor sitting flat on top of a hilly terrain mesh. I've been getting the terrain angle by raycasting down at all four corners of the quad and finding where it hits the floor, then editing the quad vertices to shape it to the terrain angle. Probably not the ideal way but it works great for what I needed.
So the next step is replacing it with a sprite. I changed from quad to a sprite renderer, and added a little animation to it. I went to edit the vertices and the setup is completely different (it seems to have 20+ vertices now instead of 4).
I did notice the SpriteRenderer has 4 triangles, but the points are Vector2s rather than Vector3, so I guess that won't work either since I'm applying it to a 3d world?
Can anyone with experience point me in the right direction with this?

sentences:
correcting particleSystem speed? When I kill my enemy some kind of gold get out of him. This gold moves forward to the player if he gets close. In my cast it moves very slow. I need it becomes more faster when get close to the player.
Example

using System.Collections;
public class souls : MonoBehaviour {

public Transform _attractorTransform;

private float paticlesFarFrom;

private ParticleSystem _particleSystem;

private ParticleSystem.Particle[] _particles = new ParticleSystem.Particle[1000];
void Start ()

{

_particleSystem = GetComponent<ParticleSystem> ();

}
public void Update()

{

if (GetComponent<ParticleSystem>().isPlaying) {

int length = _particleSystem.GetParticles (_particles);

Vector3 attractorPosition = _attractorTransform.position;

for (int i=0; i < length; i++) {

paticlesFarFrom = Vector3.Distance(_particles[i].position,_attractorTransform.transform.position);

if (paticlesFarFrom <=200) {
 // this line need to fix
_particles [i].position = _particles [i].position + (attractorPosition - _particles [i].position) / (_particles [i].remainingLifetime) * Time.deltaTime;
}

}

_particleSystem.SetParticles (_particles, length);

}
}

}

sentences:
Three js raycaster WITHOUT camera I seem to find only examples to use the raycaster with the camera, but none that just have a raycaster from Point A to Point B.

I have a working raycaster, it retrieves my Helpers, Lines etc. but it seems it does not recognize my sphere.

My first thought was my points are off, so i decided to create a line from my pointA to my pointB with a direction like so:

var pointA = new Vector3( 50, 0, 0 );
var direction = new Vector3( 0, 1, 0 );
direction.normalize();
var distance = 100;

var pointB = new Vector3();
pointB.addVectors ( pointA, direction.multiplyScalar( distance ) );

var geometry = new Geometry();
geometry.vertices.push( pointA );
geometry.vertices.push( pointB );
var material = new LineBasicMaterial( { color : 0xff0000 } );

var line = new Line( geometry, material );

This will show a line from my point (50 0 0) to (50 100 0) right trough my sphere which is at point (50, 50, 0) so my pointA and direction values are correct.

Next i add a raycaster:
To avoid conflicts with any side effects i recreated my points here:

var raycaster = new Raycaster(new Vector3( 50, 0, 0 ), new Vector3( 0, 1, 0 ).normalize());
var intersects = raycaster.intersectObject(target);
console.log(intersects);

Seems pretty straight forward to me, i also tried to use raycaster.intersectObjects(scene.children) but it gives Lines, helpers etc. but not my sphere.

What am i doing wrong? I am surely missing something here.

IMG of the line and the sphere:

sentences:
How to control which polygons get rendered first in a batch (e.g. to draw leaves)? Sorting transparent objects is a well-known problem. If you send a bunch of transparent polygons (e. g. leaves and branches on a tree) into the GPU and render them with alpha blending enabled, the GPU will sort the polygons randomly.

But what I noticed is that although they get sorted randomly, the order of rendering is always the same. If it wasn't the leaves would flicker as their colors change, depending on which layer they are on.

How can I control which polygons get rendered when? Maybe their order depends on the index buffer?

[EDIT] To clarify things: I know that different Draw() calls execute precisely in the order they were issued. I am trying to figure out how to manipulate the polygon order inside a single Draw() call. If a tree has a hundred polygons it is a waste do draw evey single one separately and a pain in the artists'... behind. So what I need is to influence the order of rendering for a bunch of polygons in a single pair vertex and index buffers.

Yes and I am working with XNA 4.0.

sentences:
Deformation of Sphere using Transformations I have a graphic related question. I need to have a transformation matrix that I have no idea about what it is. The problem is to create right image from the right sphere. I created those images in Maya, but I need some matrices for the graphics course. Here is the image:

Our professor told us to use some sine and cosine in our transformations, but I have no idea what he meant. I thought of intersecting a plane from the grid(that is xz plane) and sphere, and then scaling down the resulting circle. Would that work?

I also checked this paper, however it looks like a bit advanced for me. Another thing is I guess that paper is not about the same type of information I was looking for.

It would be great if you could help me.

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:
LibGDX: Making an object move correctly based on real time Below is an image of my gameworld. As we can see, the player starts at position 0. each cell represents 1 game world unit. My goal is to get the player to move 1 unit (the red cell) in 1 second in 'real world' time using the LIBGDX framework.

LibGDX uses something called 'continuous rendering' by default, which means its 'main loop' runs as fast as the underlying OS is able to. The range could be anywhere from 0-80 frames per second. I am capping the FPS to 60 with the below 'main' loop (In LIbGDX the main loop is called render)

@Override
public void render(float deltaTime) {

    /*
     * Get the time it took to render the last frame and make sure our delta
     * time is never larger than 0.0166666666666667 (60 FPS). This will
     * ensure that on fast OS the game at only 60 FPS.
     */
    float dt = Math.min(Gdx.graphics.getDeltaTime(), 1 / 60f);

    // **********************UPDATE*********************

    player.update(dt);

    // ************************RENDER********************

    // clear the screen and set it to cornflower blue
    Gdx.gl.glClearColor(0x64 / 255.0f, 0x95 / 255.0f, 0xed / 255.0f,
            0xff / 255.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    worldRenderer.render();

}

Below is the code for my player object's update method. As we can see it is operating solely on the delta time for now. In a perfect world of 60 FPS, this would work perfectly but unfortunatly FPS dips will always happen (especially on mobile platforms). How can I add a calculation on top of the delta time to move the player 1 unit in real time regardless of framerate?

@Override
public void update(float deltaTime) {

    // handle user input **always should come first**
    if (Gdx.input.isKeyPressed(Keys.SPACE)) {
        position.x += deltaTime;
    }

}

Below shows what is happening with my current code, if we had a perfect 60 FPS the position should = 1, but as we can see it does not because the FPS varies slightly from frame to frame.

sentences:
How to rotate vector A around another vector B? Lets say I know what is directly above a turret. I also know where the turrets gun is currently pointing. I would like to know where will the turret's gun will point if I rotate it.
I suppose I could multiply \$A \cdot B\$, project \$A\$ on the plane \$B\$ is a normal of and then do the rotation in 2D and add back \$A \cdot B\$ but I am sure the math should be simpler than that?

sentences:
Collision detection circle-segment-segment I've already implemented collision detection in my game loosely following this tutorial, which works great, but I realized there's one major flaw.
The player and the enemies are circles, while the obstacles can be either segments or polygons or circles.
Now, let's say I have segment A from point (100, 100) to point (300, 100) and segment B from point (100, 200) to point (300, 100), which means they form an acute angle, and player has it center in point (100, 125), with a radius of 25.
If player starts moving right, it will eventually collide against segment B. My method checkCollisions() will return a vector, but if I apply that vector on player, it will be moved up and left, and will overlap segment A.
If I call checkCollisions() a second time, player will be pushed down and collide again with segment B, so recursive invocations aren't a solution. Any ideas?

Here's a picture to explain:
 The g->n vector direction is along the bisector of the two little vectors, but how do I find the length?

sentences:
how to slide pieces for a slide puzzle game for android(libgdx) I want to make a small one-screen game in which the player has to slide pieces of an image until the image is completed. I used texture regions to create the pieces from an image

int numOfTiles_Horizontal = 5;
int numOfTiles_Vertical = 5;

float tile_width = img.getWidth() / numOfTiles_Horizontal;
float tile_height = img.getHeight() / numOfTiles_Vertical;

TextureRegion[][] tiles = new TextureRegion[numOfTiles_Horizontal][numOfTiles_Vertical];
for(int col = 0; col < numOfTiles_Horizontal; col++) {
    for(int row = 0; row < numOfTiles_Vertical; row++){
        tiles[col][row] = new TextureRegion(img, col * tile_width, row * tile_height, tile_width, tile_height);
    }
}

, but I'm unsure about how to allow the player to move the tiles into a blank space as well as making a "blank space" to allow tiles to move.

The game would look like this:

I followed some tutorials for libgdx but cannot find much on achieving this.

I am new to the engine and Android development so any help is appreciated.

sentences:
Why does my A* implementation overflow the stack? I'm fairly new to game dev and working on my first ever attempt at 2D pathfinding. I'm using the A* algorithm as detailed here.

For the most part, it seems to be working correctly and as intended. However upon attempting to wrap my path around a building in the map, a stack overflow is caused in ClosedList (the list storing coordinates of the path). It appears that at some point in the path, the algorithm is switching back and forth between two tiles, but I cannot work out why.

The code probably isn't the best way to do things but this is my first attempt. Apologies if it offends anyone. :P

void CheckSquare(Vector2 Start, Vector2 End)
{
    //Check for Invalid Start/End Points
    if (Start == End ||
        grid.PTileArray[(int)Start.x, (int)Start.y].CurrentType.Passable == 0 ||
        grid.PTileArray[(int)End.x, (int)End.y].CurrentType.Passable == 0)
    {
        return;
    }

    //Check which adjacent tiles are passable
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y)); //LEFT
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y + 1)); //TOP LEFT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x, Start.y + 1)); //TOP
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y + 1)); //TOP RIGHT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y)); //RIGHT
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y - 1)); //BOTTOM RIGHT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x, Start.y - 1)); //BOTTOM
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y - 1)); //BOTTOM LEFT
        gValues.Add(14);
    }

    //Remove the parent from the Possible choices
    for (int n = 0; n < OpenList.Count; n++)
    {
        if (OpenList[n] == ClosedList[ClosedList.Count - 1])
        {
            OpenList.RemoveAt(n);
        }
    }

        //Calculate H Values
        for (int n = 0; n < OpenList.Count; n++)
        {
            float x = Mathf.Abs(End.x - OpenList[n].x);
            float y = Mathf.Abs(End.y - OpenList[n].y);
            float final = 10 * (x + y);
            hValues.Add((int)final);
        }

    //Calculate F Values
    int lowest = 10000;
    int reference = 0;
    for (int n = 0; n < OpenList.Count; n++)
    {
        int g = gValues[n];
        int h = hValues[n];
        int final = g + h;
        fValues.Add(final);
        if (fValues[n] < lowest)
        {
            lowest = fValues[n];
            reference = n;
        }
    }

    //Add the square with the lowest F Value to the closed list as part of the path
    ClosedList.Add(OpenList[reference]);

    //Clear Lists
    OpenList.Clear();
    gValues.Clear();
    hValues.Clear();
    fValues.Clear();

    //If the final Location in ClosedList is not the end then continue
    if (ClosedList[ClosedList.Count - 1] != End)
        CheckSquare(ClosedList[ClosedList.Count - 1], End);
}

Help or nudges in the right direction would be greatly appreciated.

sentences:
Bizarre Physics FixedUpdate Lag spikes So I have this large forest of around 2M tris:

Same chunk selected with view on the whole level:

It's been generated within Blender and exported as fbx into Unity. Exporting each tree as an individual object is very performance expensive so the whole forest is split into 2 Objects: Treetrunks and leaves. The Treetrunks all have meshcolliders on them, the leaves obviously don't. (However I do split the forest into chunks as seen above, each chunk roughly 400k tris)

When the Player gets outside visible range of the forest it is disabled, and enabled when the Player gets within a certain range. When it is enabled sometimes it causes a massive lag. When looking into the Profiler it shows this:

Physics? FixedUpdate? The leaves have absolutely no colliders on them, why does it take up Physics.Processing? So I wanted to search further what part of Physics.Processing takes up so much processing time but the top process already shows nothing:

I have an 8 year old GTX760 but it still manages to render the entire forest at 200fps so no, the 2 million Tris are definitely not overkill for my computer.

I've tried this and that and 3 things managed to stop the issue (as seen in the profile screenshots above, the Physics processing time significantly reduced a few frames later)

Pausing & Unpausing the game or simply Alt-Tabbing outside the Unity Player and back (not always effective)
Disabling the Player & Reenabling it (almost always effective)
Starting the Scene with the Player (including Rigidbody, Camera and raycasting scripts) disabled and enabling him a few seconds later via script.  (almost always effective) However this only worked if ALL of the forest was set active (roughly 2M tris). If half the forest was disabled on start, and activated after the Player was enabled: LAG.

The Player is the only thing in the game (at this moment) that has a Rigidbody, Raycasting Scripts and a camera.

Things that didn't work:

Waiting a few minutes
Disabling & Reenabling the Players Character Controller at any time
Disabling & Reenabling the camera on the Player at any time.
Disabling & Reenabling the fucking trees

Anyone got an idea? I'm dumbfounded over here.

sentences:
Adding a new highscore before or after an equal score? I'm making a highscores list for my 2048 replica. An entry in the list consists of a name and a score (e.g. "John" and 2100.) When I add a new entry, the code runs through the list and inserts the new entry when the score for the new entry is greater than the currently indexed entry. So imagine this list:

Roman   17000
Sergei  12500
Dean    8000
Andrew  1400

If John was inserted into the list, the new list would look like:

Roman   17000
Sergei  12500
Dean    8000
John    2100
Andrew  1400

The question is, what do I do when inserting the entry for "Steve" whose score is 8000. Does he go before or after Dean? Is there a convention for this?

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

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

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

sentences:
How to access a prefab's boolean property through collision (with the same Prefab but different Instance)? I am a trying to recreate the first stage of Super Mario Brothers, but I am having a bit of trouble with the collision system between Koopa Shells. I have written two different scripts in hopes to achieve this:

This First script is to handle the Basic movement and start shell movement on Player Collision

It's Rather long so I took the liberty of including only parts that were in direct correlation/ causation of the problem

     public class KoopaShell : MonoBehaviour
     {
         //Makes this accessible to other Scripts
         public bool Moving;

         // Boolean Flags to be inherited
         bool shellLeft, shellRight, rightBlocked, leftBlocked;
         public float rayDis;
         public LayerMask enemyMask;
         public Transform rCast;

 [... Rest of the code..]
         void OnCollisionEnter2D(Collision2D coll)
         {
             if (leftBlocked || rightBlocked) // If the either side of the shell is hit
                 if (coll.gameObject.tag == "Player" && Moving == false) // If the player makes contact with a resting shell
                 {
                     MoveShell();
                 }
         }

         public IEnumerator MoveShell() //Courotine for 2D Collision
         {
                     //The Courotine will wait for the end of the frame
                     yield return new WaitForFixedUpdate();
                     //Then set moving to true
                     Moving = true;
         }
     }

The Second Script handles all other collision and inherits from the first in an attempt to simplify the calling from script to script.... Could also be the cause of my problem.

public class MovingShellScript : KoopaShell
{

//This is a continuation of the KoopaShell Script
//Dealing with 2D Collision

void OnCollisionEnter2D(Collision2D col)
{
   if (col.gameObject.tag == "Koopa Shell") //  if contact is made with another shell that is moving
     if(col.gameObject.Equals(Moving) == false) //if the shell is not moving
     {
      {
          Destroy(col.gameObject);  // Then the resting shell is destroyed
          Debug.Log("Looks like another shell is unemployed");
       }
     }

    if (col.gameObject.tag == "Enemy") // If a Enemy is hit by the Shell
       if (Moving == true) // and If the Shell is moving
       {
                     // The GameObject hit is Destroyed
                     Destroy(col.gameObject);
       }
     }
 }

Currently the script above does not destroy the various gameobjects under the Enemy and Player tag. Maybe this could be done implicitly with an associated script to the desired gameobject that correlates with the tag....

Also the script destroys both shells during a collision. I don't understand why my various boolean flags aren't creating the desired result(s)

If both shells are moving then both shells are destroyed.
If only one shell is moving then the resting shell is destroyed.

I am seeking to understand the error in my logic for this to work as desired.

Thank you for your time!

sentences:
SceneKit - Creating a sense of scale I'm experimenting with 3D using SceneKit on iOS.  I'm trying to create a galaxy but would appreciate some guidance on the following things:

I'm having a hard time working out how to make the galaxy seem 'big'.  I've created multiple solar system nodes in a spiral, but the distances between them are hard to get right.  I want to get a sense of scale, but I'm not sure of the best approach.  Do I want to put huge distances between solar systems, and make the objects in the system very large too?  In this case I need to set the camera zFar to be massive.  I feel like I'm missing something.
I've created a cube map for the 'galaxy'.  As I zoom in on a solar system, the cube map seems to come in very close, which breaks the illusion of scale.  How do I make that better?

Thanks for any guidance!

sentences:
Scaling a game world both for realism and for mechanics I am currently working on a turn-based 4X game, and one of the things I quickly ran into was a question of scaling. On one hand, I want things like realistic sizes (having some idea of what each tile represents in terms of area), but on the other hand, doing so would limit me in terms of certain mechanics I want to implement (the size of a realistic city would not even occupy a tile, let alone multiple tiles, a mechanic I want to use).

How would I go about scaling the world so that I can have both realistic scaling AND the mechanics I want?

Some things I have considered:

Changing the size of the world. Nothing says that I have to have this take place on an Earth clone (especially with randomly generated terrain). Smaller worlds might allow the detailing I'd need for the cities without having unrealistic tile sizes.

Foregoing the realism: Something that came up while I was researching was that ancient cities were tiny by today's standards. Ancient Rome (the part encompassed by the Aurelian Walls) was only 5.3 square miles (for comparison, Manhattan is 22.96 square miles- enough to fit four Romes). I could forgo the realistic sizes of cities and make them the size I want for my mechanics.

Not including the entire world: Depending on the time-period I end up basing this off of, it may be pointless to include areas that effectively did not exist.

What is the best way to balance realism and mechanics for the scaling of a game world?

sentences:
How to change colors of texture in lwjgl? I have the following texture:

The black pixels are characters, the background is transparent.
How do I change the black pixels of the characters to another color?
I use this texture as a bitmap for text rendering in lwjgl. For example, is there a way to change the black pixels to red?
I looked to shaders, but I don't know how to use shaders and what they does.
I would appreciate an example.
I also looked at this page.

But I don't really understand how to do it.
I will really vote up your answer.

sentences: 3D Character Animation Effects I'm using blender for the 3d stuff and am trying to make game effects for the character I made, I am using unity. I am not really familiar with creating game visual effects but I do know how to make sprite sheets. How do I create a 3d effect in unity? like a shock wave or an explosion, because I cant do it using a sprite sheet.

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

I have thought of 3 approaches:

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

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

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

sentences:
How do I move the camera sideways in Libgdx? I want to move the camera sideways (strafe). I had the following in mind, but it doesn't look like there are standard methods to achieve this in Libgdx.

If I want to move the camera sideways by x, I think I need to do the following:

Create a Matrix4 mat
Determine the orthogonal vector v between camera.direction and camera.up
Translate mat by v*x
Multiply camera.position by mat

Will this approach do what I think it does, and is it a good way to do it?
And how can I do this in libgdx? I get "stuck" at step 2, as I have not found any standard method in Libgdx to calculate an orthogonal vector.

EDIT: I think I can use camera.direction.crs(camera.up) to find v. I'll try this approach tonight and see if it works.

EDIT2: I got it working and didn't need the matrix after all:

Vector3 right = camera.direction.cpy().crs(camera.up).nor();
camera.position.add(right.mul(x));

sentences:
How do I rotate a sphere so that a position on it comes to a specific location? Sorry for my english. I added a picture to explain what i want.
I want rotate Big Sphere to make the black point locate in front of camera. (to the white point's position)
not black point moving, whole sphere moving.

or is it better to move camera to black point?

which API should i use?

sentences:
xna orbit camera troubles I have a Model named cube to which I load in LoadContent(): cube = Content.Load<Model>("untitled");.

In the Draw Method I call DrawModel:

    private void DrawModel(Model m, Matrix world)
    {
        foreach (ModelMesh mesh in m.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.View = camera.View;
                effect.Projection = camera.Projection;
                effect.World = world;
            }
            mesh.Draw();
        }
    }

camera is of the Camera type, a class I've setup.  Right now it is instantiated in the initialization section with the graphics aspect ratio and the translation (world) vector of the model, and the Draw loop calls the camera.UpdateCamera(); before drawing the models.

class Camera
{
    #region Fields
    private Matrix view; // View Matrix for Camera
    private Matrix projection; // Projection Matrix for Camera
    private Vector3 position; // Position of Camera
    private Vector3 target; // Point camera is "aimed" at
    private float aspectRatio; //Aspect Ratio for projection
    private float speed; //Speed of camera
    private Vector3 camup = Vector3.Up;
    #endregion

    #region Accessors
    /// <summary>
    /// View Matrix of the Camera -- Read Only
    /// </summary>
    public Matrix View
    {
        get { return view; }
    }
    /// <summary>
    /// Projection Matrix of the Camera -- Read Only
    /// </summary>
    public Matrix Projection
    {
        get { return projection; }
    }
    #endregion

    /// <summary>
    /// Creates a new Camera.
    /// </summary>
    /// <param name="AspectRatio">Aspect Ratio to use for the projection.</param>
    /// <param name="Position">Target coord to aim camera at.</param>
    public Camera(float AspectRatio, Vector3 Target)
    {
        target = Target;
        aspectRatio = AspectRatio;
        ResetCamera();
    }

    private void Rotate(Vector3 Axis, float Amount)
    {
        position = Vector3.Transform(position - target, Matrix.CreateFromAxisAngle(Axis, Amount)) + target;
    }

    /// <summary>
    /// Resets Default Values of the Camera
    /// </summary>
    private void ResetCamera()
    {
        speed = 0.05f;
        position = target + new Vector3(0f, 20f, 20f);
        projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 0.5f, 100f);
        CalculateViewMatrix();
    }

    /// <summary>
    /// Updates the Camera.  Should be first thing done in Draw loop
    /// </summary>
    public void UpdateCamera()
    {
        Rotate(Vector3.Right, speed);
        CalculateViewMatrix();
    }

    /// <summary>
    /// Calculates the View Matrix for the camera
    /// </summary>
    private void CalculateViewMatrix()
    {
        view = Matrix.CreateLookAt(position,target, camup);
    }

I'm trying to create the camera so that it can orbit the center of the model.  For a test I am calling Rotate(Vector3.Right, speed); but it rotates almost right but gets to a point where it "flips."  If I rotate along a different axis Rotate(Vector3.Up, speed); everything seems OK in that direction.

So I guess, can someone tell me what I'm not accounting for in the above code I wrote?  Or point me to an example of an orbiting camera that can be fixed on an arbitrary point?

sentences:
How to convert linear lerp to non-linear using animation curve? I have some code I run when I fell a tree in my game. Basically it picks a random direction and then falls. However atm it linear and doesnt look very realistic. What Id want is for it to start slow, then speed up the more it's fallen.

I've been experimenting with animation curves but none of the material I can find works with my code:

public void FellTree()
{
    // pick a random point on the circle to match the up vector
    Vector2 pointOnCircle = UnityEngine.Random.insideUnitCircle * transform.localScale.y;

    // find the fall point, assuming the pivot of the object is at the bottom
    Vector3 fallPoint = transform.position +
        pointOnCircle.x * transform.right +
        pointOnCircle.y * transform.forward;

    // find the target up vector
    Vector3 updatedUpVector = Vector3.Normalize(fallPoint - transform.position);

    // Start the coroutine to tilt the up vector to the desired target
    StartCoroutine(UpdateUpVector(updatedUpVector, 1, 0.001f));
}

IEnumerator UpdateUpVector(Vector3 upVector, float speed, float threshold = 0.001f)
{
    // the target vector and up vector would get closer to each other until the threshold is hit
    while (Vector3.Distance(upVector, transform.up) > threshold)
    {
        transform.up = Vector3.Lerp(transform.up, upVector, speed * Time.deltaTime);
        yield return new WaitForEndOfFrame();
    }
}

Using animationCurve.Evaluate(float t) in the lerp should be what I need to do, but not working. How can I add an animation curve to my lerp?

sentences:
What C++ features should I know about for a graphics programming job interview? I really don't want to be boring, I searched a lot but didn't found a focused answer to this question. I wanted to focus on the role of C++ in graphics programming.

Can  somebody explain, which are most likely/ most often used  C++ features (such as data structures), which are used in graphics programming? I am supposed to have an interview on this topic, so please shed some light on the features I should emphasize for an interview specific to C++ graphics programming.

sentences:
windows phone 7 apps marketplace paid to free I have question about paid and free + ad-based apps/games in wp7 marketplace, can I publish my app as paid version initially and later(after a month or so) can i publish the same app/game as free + ad based version? Is there any such rule/policy in wp7 marketplace.
I could not find proper answer on the net not lucky enough. And i hope this is not off topic question.  - Thanks

sentences:
How to prevent the "Too awesome to use" syndrome? When you give the player a rare but powerful item which can only be used once but is never really required to proceed, most players will not use it at all, because they are waiting for the perfect moment. But even when this moment comes, they will still be reluctant to use it, because there might be an even better moment later. So they keep hoarding it for a moment which will never come.

In the end, they will carry the item around until it is outclassed by other, more readily available resources, or even until the very end of the game. That means that such one-shot items don't provide any gameplay-value at all. They are simply too awesome to use.

What can you do to encourage the player to make use of their one-shot items and not hoard them?

sentences:
Controls for physics-enabled game object I'm trying to put together 2D game on Flash ActionScript. Game objects positions are updated by physics library and I'm trying to control them applying forces and updating these forces every frame.

Right now I'm pondering how to control a helicopter. I'm using concept of throttle and target height. To make heli float on constant height, I'm applying force of

F0 = -m * gy

which negates gravity for it. To make it move up or down, target height is used - it is increased with up key and decreased with down key, then the heli should ascend or descend to it. The problem is transitional process - right now the heli misses target height and then oscillates around it.

In short: how to control body with forces to make it move from point A to point B and stop there?
Here's how I'm controlling it now:

    public function update(time:int):void
    {
        lastUpdate = time;
        var deltaY:Number = targetHeight - body.graphic.y;
        throttleMark.y = targetHeight;
        //force for stable floating
        var antigrav:Number = -body.gmass * body.space.gravityy;
        //made-up damping factor
        //   (in fact, too small, but higher scale make heli move very slowly)
        var damping:Number = -body.vy * body.vy * body.vy * 0.5;
        var attraction:Number = deltaY * 1000.0;
        var totalForce:Number = antigrav + attraction + damping;
        body.applyRelativeForce(_strafe, totalForce, 0.0, 0.0);
    }

sentences:
Navmesh bound in ue4 topdown and third person template The Topdown template has a navmesh volume to build walkable area, if remove that volume, the character will be unwalkable. However, the third person template has no such thing, but the character movement is OK.
What's the difference between them? Why third person template don't need a navmesh volume?

sentences:
How do Idle games progress while not active? A hallmark of many idle games is the ability to still progress (or at least regain resources) while the game isn't active. The device can even be off.

Initially I figured they just calculated progress off system time next time it was started, but they do not appear fooled by messing with the clock.

How do they manage this specific feat?

sentences:
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:
About to release a free game on Google Play Store, any legal considerations I should take into account? I will release in the next few weeks a small free game on the Google Play Store. I was wondering if there was any important legal aspects I should consider before release.

Here's a few infos:

I'm doing this alone.
There's no code/graphic assets/gameplay concepts I would like to protect in particular. I don't have any issues with people copying something from my game.
I'm not sure right now, but maybe I'll add the possibility to make a small donation (so there will be IAP in a sense).
I'm using a music track from http://opengameart.org/. The author has specified that it wasn't necessary to credit him, though I would like to.

sentences:
NoSQL (CouchDB) database design for MMORPGs Are there any pratical examples of database implementation for an MMORPG in CouchDB? Even a detailed thesis? I've looked but found very little on practical examples and not even find any good UML examples and plus I see a little bit of an issue with the lack of schema and design by UML. Maybe It's more of a paradigm change but I'm ideally looking for something that has things like:

Users
Quests (multipart states)
Characters
NPC states
Items

Just to get started...regards

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:
LWJGL 3 - problem with flickering when rendering terrain with colors For while now I m trying to built a terrain generator for my game engine and again I'm stuck with problem.

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

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

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

When I add height generation, there is no flickering.

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

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

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

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

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

sentences:
Creating the “game space” for a 2D game How does one setup the game space for a game so that obstacles can be spawned?

Examples would be ice climber or the iphone doodle jump. Tile maps are limited in size and would need to change often if the user jumps a lot.

How would this be done in another way than tile maps.

How or what is used to create the notion of a game world where these spawned ledges/obstacles are placed as the user progresses through the stage?

What is actually moving if the user jumps from ledge to ledge, what are the ledges based on in terms of the game world/space. What data structure or representation could the game use to reference and manage the spawning of these obstacles/ledges?

How is a continuous environment created which creates collision objects as the user progresses?

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:
Implementing proportional navigation in 3D Good afternoon guys,

a = N * λ' * V

is the formula for the commanded acceleration required to hit the target,
where N is the proportionality constant, λ' is the change in line of sight and V is the closing velocity.

Data I natively have:

[x,y,z] position of both missile and target;
[vx,vy,vz] velocity vector of both missile and target;
[x,y,z] vector which points from missile to target and opposite;
This is set by me but still: maximum speed of missile.

Data I can get with some calculations:

Vertical angle between missile and target (and opposite)  ;
Horizontal angle between missile and target (and the other way around).

That's the reference system of the game:

λ' or the derivative with respect to time of the Line of Sight it's a concept I really didn't understand...  its unit should be, in theory, Hz or (s^-1) since m/s^2 = λ' * m/s -> λ' = 1/s
V should be pretty easy to calculate: V = v(missile) - v(target) OR
Vx = (v(missile) - v(target)) * cos (x0y)
Vy = (v(missile) - v(target)) * sin (y0z)
Vz = (v(missile) - v(target)) * cos (y0z)
N well it's a scalar number, usually 3.

The computed acceleration will then be passed to a RK4 integrator which will move the interceptor towards its target.
To steer the missile, I will simply change its velocity vector at every update (every 1/60th of a second) and its orientation accordingly. For example: if the missile has a velocity of [0,100,0], he's going 100 m/s due y+ axis. If at the next frame it should slightly turn right, then he'll be going to have a velocity of [10,99,0] and so on.

That's the only thing left to finish off my little thesis and unfortunately I'm stuck here. In the meantime,  thank you very much!

Here's a video I made, but it doesn't still actually use the Proportional Navigation law: it checks if the missile is "aligned" to its target and eventually correct its route.
That's my actual code: pastebin

That's what i've come up with but sadly doesn't work as expected:

params ["_n","_missile","_target"];
private "_a";

_vm = velocity _missile;
_rm = getPosASLVisual _missile;

_vt = velocity _target;
_rt = getPosASLVisual _target;

_vr = _vt vectorDiff _vm;
_r = _rt vectorDiff _rm;

_omega = (_r vectorCrossProduct _vr) vectorMultiply (1/(_r vectorDotProduct _r));

_a = (_vr vectorCrossProduct _omega) vectorMultiply _n;

_a

Similar questions:
Finding the components of Proportional Navigation in 2D

sentences:
Multiple Input.GetKeyDown happens in low frame rate There is a code that needs to be invoke each time user pressed specific button in my game. So I used Input.GetKeyDown to achieve that, but some reason, that code invokes multiple times even I keep pressing the button.

After some tests, I figured out this happens a lot when the game has low frame late. In a very laggy moment, GetKeyDown returns true very many times.

void Update() {
    if(Input.GetKeyDown(KeyCode.RightArrow)) {
        print("Pressed");
    }
}

I saw a similar issue in here but couldn't find any related information.
https://forum.unity.com/threads/problems-with-input-at-low-framerates.16828/

My game is a very input sensitive game, so my code when the user each time pressed a specific button always invoke when they pressed.

I checked my keyboard is something wrong, but there was no problem with my keyboard.

Why does this happen? According to the Unity doc, it said:

  Returns true during the frame the user starts pressing down the key identified by name

If I used wrong way, then how do I check each time user pressed a button?

Using Unity 2019.1.0f2.

sentences:
Handle states in character in functional programming way How to handle any change of state of a character with functional programming?

If I'm using functional programming the character should be stateless, in my understanding. With that said, I should instantiate a new character every time a position, for example, is changed. Is this correct? This doesn't sound very efficient, but I might be wrong. I'm tinkering before start implementing and wanted to be sure this is the right way.

Thanks.

sentences: Best 2d AI movement system I'm creating a top-down rpg (no tile-based) using libgdx. Now I need to make enemies move on map with obstacles. What is the best approach to realize that? A*(I think, if enemy see player, he should turn to Pursue+Raycasting, because A* is bad for following moving targets) or just combining steering behaviors Seek+Raycasting?

sentences:
Update TTF Texture for Score I have a little problem with Updating my Score with TTF.
Im a neewbie so dont blame me :P

I Try to Update my Score But the Buffer Get too small after a while and my Game Crashes.

    void CText::Init(const string &_text, int xPos, int yPos, int Width, int Height)
{
    m_Text = _text;
    Font = TTF_OpenFont("arial.ttf", 30);

    SDL_Surface *pTempt = TTF_RenderText_Solid(Font, m_Text.c_str(), color);
    Texture = SDL_CreateTextureFromSurface(m_Renderer, pTempt);

    m_xPos = xPos;
    m_yPos = yPos;

    m_Rect.x = xPos;
    m_Rect.y = yPos;
    m_Rect.w = Width;
    m_Rect.h = Height;
    SDL_FreeSurface(pTempt);
}

void CText::RenderScore(int Score)
{
    sprintf_s(Buffer, "Score: %i", Score);
    SDL_Surface *pTempt = TTF_RenderText_Solid(Font, Buffer, color);
    Texture = SDL_CreateTextureFromSurface(m_Renderer, pTempt);
    SDL_RenderCopy(m_Renderer, Texture, NULL, &m_Rect);
    SDL_FreeSurface(pTempt);
}

//Game Loop
if (lastscore != currentscore)
        {
            m_Text->Destroy(); //<-- This is SDL_DestroyTexture(Texture);
            lastscore = currentscore;
        }else{
        m_Text->RenderScore(currentscore);}

It shows my score and Updetes it too but I have my char Buffer[50] and after a while it runs out of memory. And i free my font and texture in the destructor.

I thank everybody who helps me out there

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:
Realtime Goal Oriented Action Planning I've recently discovered GOAP and interested in implementing it for the AI in a game I'm developing. Something I'm stuck on at the moment, is determining when to plan. I've read through an MIT paper on it:

http://alumni.media.mit.edu/~jorkin/GOAP_draft_AIWisdom2_2003.pdf

It mentions real-time planning and specifically:

  The character follows this plan to completion, invalidation, or until
  another goal becomes more relevant

Should I then be planning every frame until a new plan is deemed better (lower cost)?

And if not, if I have multiple goals but pre-requisites for one goal are only met in the middle of a plan for another goal, when would be appropriate to re-evaluate?

sentences:
Why won't my Box2d bodies collide? I'm doing something wrong when trying to get bodies to collide using jBox2d & Slick2d. Here is have just my basic init, update, and render methods. Render and update seem to work fine for drawing (gravity effectively pushes the ball down, and will rotate if I apply an impulse).

I have a feeling I'm overlooking something when creating the edge, but I have no idea what. My shapes/bodies work fine in the testbed, but I'm having no luck in my standalone application. I have experimented with moving the edge body / ball body around, but it doesn't seem to have any effect.

    @Override
public void init(GameContainer gc, StateBasedGame sbg)
        throws SlickException {
    world = new World(new Vec2(0F, 9.8F), false);
    windowCenter = new Vec2(gc.getWidth() / 2, gc.getHeight() / 2);

    circleShape.m_radius = CONSTANTS.BALL_RADIUS * CONSTANTS.SCALE_FACTOR;
    circleFixtureDef.shape = circleShape;
    circleFixtureDef.density = 1f;
    circleFixtureDef.restitution = .6f;

    circleBodyDef.type = BodyType.DYNAMIC;
    circleBodyDef.bullet = true;
    circleBodyDef.position.set(windowCenter);
    circleBody = world.createBody(circleBodyDef);
    circleBody.createFixture(circleFixtureDef);

    bottomEdge.setAsEdge(new Vec2(0, gc.getHeight()), new Vec2(gc.getWidth(), gc.getHeight()));
    bottomEdgeDef.position.set(0f, gc.getHeight());
    bottomEdgeDef.type = BodyType.STATIC;
    bottomEdgeFixtureDef.restitution = .6f;
    bottomEdgeFixtureDef.density = 0f;
    bottomEdgeBody = world.createBody(bottomEdgeDef);
    //bottomEdgeBody.createFixture(bottomEdgeFixtureDef);

    ball = new Image("src/main/resources/bball.png");
    float shapeToImageFactor = ball.getWidth() / circleShape.m_radius;
    ball = ball.getScaledCopy(1 / shapeToImageFactor);
    circleBody.setUserData(ball);

}

@Override
public void render(GameContainer gc, StateBasedGame sbh, Graphics g)
        throws SlickException {
    Vec2 ballBodyPos = circleBody.getPosition();
    ball.draw(ballBodyPos.x, ballBodyPos.y);
}

@Override
public void update(GameContainer gc, StateBasedGame sbg, int delta)
        throws SlickException {
    world.step(delta, 10, 10);
    ball.setRotation((float)Math.toDegrees(circleBody.getAngle()));
    System.out.println(world.getBodyCount());
    if (world.getContactCount() > 0) {
        System.out.println("thank god, something hit another thing");
    }
}

Also, the commented out bottomEdgeBody.createFixture(bottomeEdgeFixtureDef) throws a NullPointerException, and I have no idea why. Could this be related to the body not being created properly?

The world body count is at 2 as I think it should be. I was also thinking that when setting the vector's Y position at my screen height, it's actually getting set at screen height meters rather than pixels. Am I overlooking something obvious?

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

sentences:
How to use multiple custom vertex attributes in OpenGL My code currently uses glBindAttribLocation and glVertexAttribPointer to specify two custom vertex attributes in indices 6 and 7. This seems to work fine, but I wish to add another attribute and no index other than 6 or 7 will work - the shader instead acts like the attribute is always set to a value of 0.

I'm using gl_Vertex, gl_Normal, gl_Color and gl_MultiTexCoord0, and apparently some nVidia thing means indices 0, 2, 3 and 8 are off limits, but that should still leave other indices. I don't use gl_SecondaryColor or gl_FogCoord anywhere in my code or shaders for example, but indices 4 and 5 still don't work.

If I change graphics cards for an ATI one which supports more than 16 attributes, then indices 16+ work fine, but I want to support cards with only 16 attributes.

sentences:
Loading animation from server? As android app that will be playing animation online, it will be connected via web-socket to a server.

The question is, what is the recommend way to store animation that will be loaded by the android app?
I can send JSON formatted messaged via websocket, but as I am new to 3D animation, what format is advised for my case using LibGDX?

sentences:
How do I spawn more than one spawnpoint in my scene in Unity? I have different enemy AIs and two spawn-points in a scene, so far. The problem I am having is that only one enemy AI spawns, and the other enemy AI won't spawn, in that scene. How can I fix this problem?

Here is my code:

using UnityEngine;
using System.Collections;

public class EnemiesSpawner : MonoBehaviour
{
    public GameObject [] enemy;
    public Transform [] spawnPoints;
    public float spawnTime = 5f;
    public Vector3 spawnValues;

    void Start ()
    {
        //Call the "Spawn" function every 10 seconds.
        InvokeRepeating("Spawn", spawnTime, spawnTime);
    }

    void Spawn ()
    {
        int spawnPointIndex = Random.Range (0, spawnPoints.Length);

        Instantiate(enemy[Random.Range(0, enemy.Length)],
            spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);

        Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x),
            1, Random.Range (-spawnValues.z, -spawnValues.z) );
    }
}

sentences:
How can I extrude a regular, grid-based 2D shape to 3D? I have a list of vertex coordinates which encircle several 2D areas. Orthogonal lines only, but not necessarily convex areas... similar to PCB traces of conductive copper areas. I want to draw them like solid objects in 3D using OpenGL, but I'm still very new to 3D and struggling.

Please point me how to do this. I've managed to draw the outline only using GL_LINE_STRIP, but when I try GL_QUAD_STRIP or GL_TRIANGLE_STRIP, the list of coordinates is not properly ordered for triangle strip and the fact the areas are not convex prevent me from doing a simple triangular tessellation.

These are the 2D shapes:

I'd like to render them like this:

sentences:
Correct Rotation and Translation with a 4x4 matrix I am using a 4x4 matrix to transform verts in a shader. I multiply an identity matrix by a rotation matrix by a translation matrix. I am trying to first rotate the verts and then translate them, however in my result, it appears that the verts are being transformed and then rotated.

My matrix looks something like this:

m00 m01 m02 tx
m10 m11 m12 ty
m20 m21 m22 tz
--- --- --- 1

I am not using OpenGL's fixed function pipeline, I am multiplying matrices on the client side, and uploading the matrix to a GLSL shader.

If it helps, I am using my own matrix multiplication code, but I have recreated this problem using matrices on my graphing calculator, so I don't believe my matrix code has errors..

I'll include a visual aid if needed.

sentences:
Create a new Surface type with SDL_Texture So I started using Awesomium, and I'm experiencing some difficulties.

I want to create a new type of Awesomium::Surface and implement it in my custom Awesomium::SurfaceFactory to render Awesomium::WebView->surface as SDL_Texture.

I'm currently stuck at the Paint function which is supposed to update some pixels, so I have this (in the project it's separated in header and definitions):

class AwsSurface {

    public:
    AwsSurface(int w, int h) : public Awesomium::Surface {
        // _renderer is my global renderer, on Awesomium DOCs it says that pixels are
        // "in 32-bit BGRA format" so I guess the format is right...
        texture = SDL_CreateTexture(
            _renderer,
            SDL_PIXELFORMAT_BGRA8888,
            SDL_TEXTUREACCESS_STREAMING,
            w,
            h
        );
        dst_rect = {0, 0, w, h};
    }

    void Paint(unsigned char* src_buffer,
             int src_row_span,
             const Awesomium::Rect &src_rect,
             const Awesomium::Rect &dest_rect) {
    }

    protected:
    SDL_Texture* texture;
    SDL_Rect dst_rect;
};

I'm not sure if I get it right, but fromwhat the DOCs say if I'm given a src_rect={2, 1, 2, 3} and src_row_span=20 I am in this situation, right?

Now, I understood how the buffer works (more or less), but I don't know how to copy the pixels from it onto my texture (in the given position).

Edit: I came up with this paint function:

void AwsSurface::Paint(unsigned char* src_buffer,
                       int src_row_span,
                       const aws::Rect &src_rect,
                       const aws::Rect &dest_rect) {
    Uint32* src_buffer_i = (Uint32*)src_buffer;
    src_row_span /= 4;
    int dest_row_span;
    Uint32* dest_buffer;
    SDL_Rect r = AwsRectToSDL(dest_rect); // Custom function to convert the rect
    SDL_LockTexture(
        texture,
        &r,
        (void**)&dest_buffer,
        &dest_row_span
    );
    dest_row_span /= 4;
    for (int x = 0; x < src_rect.width; x++) {
        for (int y = 0; y < src_rect.height; y++) {
            Uint32* s = src_buffer_i + (src_rect.y + y) * src_row_span + src_rect.x + x;
            Uint32* d = dest_buffer + (dest_rect.y + y) * dest_row_span + dest_rect.x + x;
            *d = *s; // Here happens the exception
        }
    }
    SDL_UnlockTexture(texture);
}

But I get an "access violation on writing" exception on the line above, this happens after some successful executions (usually 6/7) and every time on the same rectangle {0, 0, 466, 26}.

sentences:
Play Audio After Countdown In JavaScript Is there a way I can have an audio sample play after a certain amount of time, like 3 seconds in JavaScript? I've looked everywhere and can't seem to find what I'm looking for! I'm very new to this type of stuff, so apologies for the kind of daft question...

Thanks

sentences:
Can I embed a game in a PDF document? I was thinking that it could be cool to have an interactive game in a digital resume. For the sake of this question, and scope of this site, let's ignore whether or not this is a good idea.

Is it possible to embed a game or some sort of interactive window inside of a PDF document? This could be using any sort of language or framework. For example, having a small area of the PDF with a CAPTCHA in it.

sentences:
Pseudo-magnet implementation with chipmunk How should I go about implementing "natural" magnet on a certain body in chipmunk space? Context is of simple bodies lying in the space (think chessboard). When one of the figures is activated as a magnet - others should start moving towards it.

Currently I'm applying force (cpBodyApplyForce)to the other figures with vector calculated towards the activated figure. However this doesn't really feel "natural". Are there any known algorithms for imitating magnets?

sentences:
Shadow-casting through time acting in "reverse" before next notciable shadowmap update question was re-written to better explain the problem

I have a scene of big thin parallelepiped, small cube, and a light source, all aligned on Y axis, like so:

 _
| |
| |----[ ]----Light
|_|

Both objects are static and light is sliding on Y axis only.

Also, a tiny (32x32) depth texture from Light's PointOfView is being rendered off-screen and then applied to both cube and parallelepiped on on-screen rendering stage, making effect of a shadow being casted by a small cube on a big parallelepiped.

The problem i am experiencing is that when light moves away from cube, such low-res depth texture is getting updated only 6-7 times, but it's projection on surfaces updates constantly and wrongly: while shadow is supposed to shrink when lightsource moves away and grow when lightsource moves closer, it is in fact doing the reverse between updates of texture projection! In other words, between two updates of texture, it's projection on a parallelepiped grows when light moves away and shrinks when light moves closer and then "jumps" when texture updates, which is looking very wrong.

To better show the problem, i've made this video: http://www.youtube.com/watch?v=XOraTZimmUU (the square in right-upper corner is the depth texture, made from light's POV).
As you can see, at first i am moving light out (decresing negative Y) and you can notice projection growing between "jumps" of texture updates. Then i am moving light in and you can notice projection shrinking between the same "jumps".

My question is: how to reverse this shrinking-growing behavior without increasing shadowmap texture resolution (which only make problem less noticable, but not completly solved)?

Shaders used to map texture on:

Vertex:

#version 120
struct light_t {
  vec3 spot_dir;
  vec3 position;
  mat4 MVP;
  mat4 V;
  mat4 P;
};
attribute vec4 in_position;
uniform mat4 MVP;
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
uniform light_t light;
varying vec4 shadowcoord;
void main() {
  gl_Position = MVP * in_position;
  mat4 bias = mat4(0.5, 0.0, 0.0, 0.0,
                   0.0, 0.5, 0.0, 0.0,
                   0.0, 0.0, 0.5, 0.0,
                   0.5, 0.5, 0.5, 1.0);
  shadowcoord = bias * light.MVP * in_position;
}

Fragment:

#version 120
varying vec4 shadowcoord;
uniform sampler2D shadowmap;
void main() {
  vec4 color = vec4(0.5);
  float factor = 1.0;
  float z = texture2DProj(shadowmap, shadowcoord.xyw).z;
  if (z < (shadowcoord.z-0.0005)/shadowcoord.w) factor = 0.2;
  gl_FragColor = factor * color;
}

The full self-contained source of minimal (~900 lines, meh) example (extracted from full-scale project) is here (glm math library, C++ compiler and glut is needed):

Compile line:

g++ -g -o example main.cpp  -lGL -lGLU -lglut -lGLEW

Actual source:
http://paste.eientei.org/show/287/

WebGL playground: webglplayground.net/saved/NAfoKmQqJb

sentences:
Marching squares: Finding multiple contours within one source field? Principally, this is a follow-up-question to a problem from a few weeks ago, even though this is about the algorithm in general without application to my actual problem.

The algorithm basically searches through all lines in the picture, starting from the top left of it, until it finds a pixel that is a border. In pseudo-C++:

int start = 0;
for(int i=0; i<amount_of_pixels; ++i)
{
   if(pixels[i] == border)
   {
      start = i;
      break;
   }
}

When it finds one, it starts the marching squares algorithm and finds the contour to whatever object the pixel belongs to.

Let's say I have something like this:

Where everything except the color white is a border.

And have found the contour points of the first blob:

For the general algorithm it's over. It found a contour and has done its job. How can I move on to the other two blobs to find their contours as well?

sentences:
Right-To-Left Text Direction in Cocos2dx I want to use Persian/Arabic text beside English in whether Label or ui::Text.

Persian is a Right-to-Left and English is a Left-to-Right language and so I have problem to combine them in one string.

Scnario:

I want to show this text: 1."من1" then 2."emadpres2" and finally 3."3هستم".

If I write this text in a Left-to-Right editor it show as : ( Wrong Direction:  =====>  )

  1من emadpres2 هستم3

But actually it should be shown as : (  Correct Direction:  <=====  )

  هستم3 emadpres2 من1

This is my code :

auto rtl = Label::createWithSystemFont("سلام emadpres چطوری", B_NAZANIN, 25, Size(480, 100));
// The string here is also in wrong direction because the Visual Studio editor is Left-to-Right.
rtl->setColor(Color3B(0, 0, 0));
rtl->setPosition(...);
rtl->setHorizontalAlignment(TextHAlignment::RIGHT);
this->addChild(rtl, Z_NORMAL);

and this is the screenshot of this code:

As you see, I tried to use TextHAlignment but It doesn't help. I need something to change Direction not Alignment .

How should I make it Right-to-Left ?

PS: Cocos2dx v3.3

sentences:
How to implement a mechanic of entering a town I am planning a game played on a 2-D map, where some spots are "towns". When the player walks into a town, he enters a high-resolution map of this town; when he exits the town, he returns to the low-resolution map of the world (as in e.g. Ultima 4). My question is how to implement this enter/exit mechanism in Unity? I thought of two approaches:

The world map and each of the town maps is a different scene. Entering/exiting a town is implemented by loading the appropriate scene using the scene manager.
There is a single scene, but the maps are geographically separted. For example, the world map is in coordinates 1...256, town A map is in coordinates 301...364, town B map is in 401...464, etc. Entering/exiting a town is implemented by moving the player and the camera to the appropriate map.

Is there a better approach? What approach is commonly used to implement this mechanism?

sentences:
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:
LibGDX: ActorGestureListener after change position I have this code to get pan touch inside an Image and it works fine, but when I uncomment this line

img.setPosition(100, 100);

it doesn't work anymore, why?

Texture tex = new Texture(Gdx.files.internal("square.png"));
        final Image img = new Image(tex);
        //img.setPosition(100, 100);
        img.setSize(157,45);
        img.setColor(0,0,0,1f);

        img.addListener( new ActorGestureListener(){

            @Override
            public void pan(InputEvent event, float x, float y, float deltaX, float deltaY) {
                super.pan(event, x, y, deltaX, deltaY);

                int minX = (int)img.getX();
                int maxX = (int)img.getX()+(int)img.getWidth();
                int minY = (int)img.getY();
                int maxY = (int)img.getY()+(int)img.getHeight();

                if ((x>minX && x<maxX)&&(y>minY && y<maxY)){

                    Utils.print("PAN");
                }
            }
        });

        stage.addActor(img);

sentences:
Problem using glm::lookat I am trying to rotate a sprite so it is always facing a 3D camera.

Object

GLfloat vertexData[] = {
    //  X     Y     Z       U     V
    0.0f, 0.8f, 0.0f,   0.5f, 1.0f,
    -0.8f,-0.8f, 0.0f,   0.0f, 0.0f,
     0.8f,-0.8f, 0.0f,   1.0f, 0.0f,
};

Per frame transform

glm::mat4 newTransform = glm::lookAt(glm::vec3(0), gCamera.position(), gCamera.up());
shaders->setUniform("camera", gCamera.matrix());
shaders->setUniform("model", newTransform);

In the vertex shader:

gl_Position = camera * model * vec4(vert, 1);

The object will track the camera if I move the camera up or down, but if I move the camera left/right (spin the camera around the object's y axis), it will rotate in the other direction so I end up seeing its front twice and its back twice as I rotate around it 360.

If I use -gCamera.up() instead, it would track the camera side to side, but spin the opposite direction when I move the camera up/down.

What am I doing wrong?

sentences:
Replacing 4 additive sprite layers with a single shader. Just can't get it right I'm using directx9 and have 4 textures I want to draw on top of each other. if I do this:

PDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
PDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE);

SetTexture(0,texture1);
DrawSprite();

SetTexture(0,texture2);
DrawSprite();

SetTexture(0,texture3);
DrawSprite();

SetTexture(0,texture4);
DrawSprite();

I Get EXACTLY the cool effect i want. but I suspect this level of blatant overdraw is inefficient. I'm sure this can be compressed into a single draw call somehow, and run faster. The trouble is, everything I try does not look the same, whether I try a fixed-function muyltitexturing approach setting the 4 textures as different texture stages, or whether I try to implement it inside an fx file as a shader. Nothing has the same effect.

Is it even possible?
I'm guessing within a shader it could be done by just mulitplying the sampled texture at each stage with the current screen value, but tbh I'm not sure if that is accessible to the shader (or how).
My current code works, but it bugs me I'm drawing 4 huge textures separately :D

sentences:
Why doesn't my computer paddle move in my Pong game? I'm making a pong game and I can't figure out why the computerPaddle won't move up or down when it's supposed to to hit the ball automatically!

Please help me.

Here's code:

<html>
<h3>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PONG- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</h3>

<canvas id="gameCanvas" width="800" height="600"></canvas>

<script>
var canvas;
var canvasContext;
var ballX = 50;
var ballY = 50;
var ballSpeedX = 11;
var ballSpeedY = 5;

var playerPaddleY = 240;
var computerPaddleY = 240;
const paddleHeight = 120;
const paddleThickness = 12;

function calculateMousePos(evt) {
    var rect = canvas.getBoundingClientRect();
    var root = document.documentElement;
    var mouseX = evt.clientX - rect.left - root.scrollLeft;
    var mouseY = evt.clientY - rect.top - root.scrollTop;
    return {
        x: mouseX,
        y: mouseY
    };

}

window.onload = function() {

    canvas = document.getElementById('gameCanvas');
    canvasContext = canvas.getContext('2d');

    var framesPerSecond = 30;

    setInterval(function() {
        moveEverything();
        drawEverything();
    }, 1000 / framesPerSecond);

    canvas.addEventListener('mousemove',
        function(evt) {
            var mousePos = calculateMousePos(evt);
            playerPaddleY = mousePos.y - (paddleHeight / 2);
        });

}

function ballReset() {
    ballX = canvas.width / 2;
    ballY = canvas.height / 2;
    ballSpeedX = -ballSpeedX;

}

function computerMovement() {
    if (computerPaddleY < ballY) {
        computerPaddleY += 5;
    } else {
        computerPaddleY -= 5;
    }
}

function moveEverything() {

    ballX += ballSpeedX;
    ballY += ballSpeedY;

    if (ballX > canvas.width) {
        if (ballY > computerPaddleY && ballY < computerPaddleY + paddleHeight) {
            ballSpeedX = -ballSpeedX;
        } else {
            ballReset();
        }
    }

    if (ballX < 0) {
        if (ballY > playerPaddleY && ballY < playerPaddleY + paddleHeight) {
            ballSpeedX = -ballSpeedX;
        } else {
            ballReset();
        }

    }

    if (ballY > canvas.height) {
        ballSpeedY = -ballSpeedY;
    }

    if (ballY < 0) {
        ballSpeedY = -ballSpeedY;
    }

}

function drawEverything() {

    canvasContext.fillStyle = 'black';
    canvasContext.fillRect(0, 0, canvas.width, canvas.height);
    canvasContext.fillStyle = 'white';
    canvasContext.fillRect(2, playerPaddleY, paddleThickness, paddleHeight); //
    player

    canvasContext.fillRect(786, computerPaddleY, paddleThickness, 120);
    //computer player

    canvasContext.beginPath();
    canvasContext.arc(ballX, ballY, 12, 0, Math.PI * 2, true); //ball
    canvasContext.fill();

}

</script>

</html>

sentences:
Are there any frameworks that allow me to write games in C# on Linux? I'm looking for something like an alternative to XNA - I don't care whether it's a 2D or 3D engine. It's not because I dislike Windows or am anti-Microsoft; it's because I like running Linux, code in Linux completely (for C# I use Mono, obviously), and by no means have any hardware to actually support programming in XNA, simply because my video card is 6 years old. I also don't have a Windows 7/Vista CD for DirectX 10.

Thus, for game development I'm kind of stuck in the stone age. Yet, I like C# very much and would hate to have to drop it as a language due to this.

Is there anything I can do?

sentences: Does every Entity in an XNA game need it's own BasicEffect instance? From what I see, the position/matrix is stored in the BasicEffect instance, so it makes sense to me that every object has it's own position matrix, but I'm not 100% sure it's correct to let every Entity have it's own BasicEffect instance, so I'm asking here.

sentences:
Connect camera class to game I've been following a tutorial on making a free camera for a 3D model. What the camera class does is allow the player to move and rotate in respects to the model's current position using the right thumbstick of an XBox360 controller.

Here is the code:

http://pastebin.com/xb4eznMi

Can someone explain to me how to connect this to my model in my Game class?

sentences:
How to make a joystick follow the touch around a starting point using atan2? I would like to move a joystick, and be able to go beyond the limit of the circle, and the joystick should follow the angle from the touch (the touch is moving), but it should stay on the circle. It should not go beyond the circle.

I calculate the angle with atan2, then place the joystick at a specific radius from a starting point.

The problem is that the values are positive only, so the joystick only stays in the top right quarter : when the touch goes down, the joystick goes until y=0, then it goes up, whereas the touch is still going down.

Would you know how to fix this? The joystick should follow the same angle as the touch, around a starting point :

Here is the code :

func moveJoystick(touch:CGPoint){
    let invY : Float = Float(self.view!.frame.size.height) - Float(touch.y)
    let dy : Float = Float( fabs( invY - Float(startPosFrontJoystick.y) ) )
    let dx : Float = Float ( fabs( touch.x - startPosFrontJoystick.x ) )

    //find angle when more than limit of radius //** HERE **
    let radWhenBeyondLimit = atan2(dy, dx)
    let newX : Float = cos(radWhenBeyondLimit)
    let newY : Float = sin(radWhenBeyondLimit)

    //place front joystick on circle
    let yPos : Float = Float(newY) * radiusForFront + Float(startPosFrontJoystick.y)
    let xPos : Float = Float(newX) * radiusForFront + Float(startPosFrontJoystick.x)
    frontJoystick.position = CGPoint( x:CGFloat(xPos), y:CGFloat(yPos) )
}

Thanks

sentences:
DirectX9 fullscreen, render immediately? Is it possible, somehow to avoid the single frame of black that appears before a DirectX9 window is displayed in fullscreen? My code looks like this.

INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT )
{
WNDCLASSEX wc = { sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0L, 0L, GetModuleHandle( NULL ), NULL, NULL, NULL, NULL, L"D3D", NULL };
RegisterClassEx( &wc );
LPDIRECT3D9         pD3D = NULL;
LPDIRECT3DDEVICE9   pd3dDevice = NULL;
int                 windowWidth = 1280;
int                 windowHeight = 1024;
int                 adapter = 3;
bool                fullscreen = true;

if( NULL == ( pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
    return E_FAIL;

HWND hWnd = CreateWindow( L"D3D", L"D3D Test", WS_VISIBLE | WS_POPUP, 0, 0, windowWidth, windowHeight, NULL, NULL, wc.hInstance, NULL );

D3DDISPLAYMODE d3ddm;
pD3D->GetAdapterDisplayMode( adapter, &d3ddm );

D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );

d3dpp.Windowed               = !fullscreen;
d3dpp.SwapEffect             = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat       = d3ddm.Format;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.PresentationInterval   = D3DPRESENT_INTERVAL_ONE;
d3dpp.BackBufferCount        = 1;
d3dpp.BackBufferWidth        = windowWidth;
d3dpp.BackBufferHeight       = windowHeight;
d3dpp.hDeviceWindow          = hWnd;

if( FAILED( pD3D->CreateDevice( adapter, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ) )
{
    return E_FAIL;
}

MSG msg;
ZeroMemory( &msg, sizeof( msg ) );
while( msg.message != WM_QUIT )
{
    pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB( 255, 255, 255 ), 1.0f, 0 );
    pd3dDevice->Present( NULL, NULL, NULL, NULL );

    if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
    {
        TranslateMessage( &msg );
        DispatchMessage( &msg );
    }
}

if( pd3dDevice != NULL )
    pd3dDevice->Release();

if( pd3dDevice != NULL )
    pd3dDevice->Release();

UnregisterClass( L"D3D", wc.hInstance );
return 0;

}

sentences:
How can I compare two quaternions for logical equality? I'm trying to write some unit tests and realize I don't know how to compare quaternions. I need to know if two quaternions represent the same orientation (the object would be facing the same way). With a vector like position I'd simply compare the parts and check they are close enough, but for quaternions the values can be very different.

How can I compare two quaternions?

sentences:
How to sort tiled decal list? I have a tiled forward render pipeline (also called forward+). It assigns a list of lights for every 16*16 block of pixels (tiles) on the screen. Lights are accumulated additively so their order doesn't matter inside the list.

The problem comes when I add decals to the light list. Decals need to be evaluated before the lights (because they can modify surface properties), and even their order among themselves matter because their texture is alpha blended on top of each other.

Because the lights and decals are culled in parallel, and added to the list by keeping a shared pointer to the end of the list which is incremented atomically when a light is added, the order of them can not be guaranteed. This is how I add a light to the tile's light list from a thread:

// I have a [numthreads(16,16,1)] thread group
for (uint i = groupIndex; i < g_nNumLights; i += 16 * 16)
{
  Light light = GlobalLightArray[i];
  if(IsLightVisible(light))
  {
    uint index;
    InterlockedAdd(LightCount, 1, index); // LightCount is a groupshared uint (the whole threadgroup can see it)
    LightArray[index] = i; // A light is always added to the back of the per tile light array
  }
}

I thought I should try to sort the light list after the culling and the creation of the list has ended, but I have no experience with highly parallel sorting algorithms. I however came across a nice presentation: Holy smoke! Faster Particle Rendering using Direct Compute by Gareth Thomas
. From the 8th slide it has a brief explanation of the bitonic sort algorithm with pseudocode and nice pictures. I get the idea, but I have no idea how to implement it or if it could be even done efficiently for my case because my light list is variable in size for each tile. Maybe it could be done in the same dispatch when the culling occurs, on this array (which hold a variable amount of light indices <= 1024):

groupshared uint LightArray[1024]

I have also seen a DirectX11 example of the algorithm of this kind of sorting, but on a different kind of dataset and across multiple dispatches and other post-processing transposing which is not clear to me at all.

Or maybe there is a completely different approach that I should take which doesn't involve sorting? Maybe when adding lights to the back of the array, the order of addition could be enforced somehow?

I have also learnt that the new Doom game also renders its decals this way.

sentences:
How to set the force applied to RigidBody2D depending on the time user holds touch on screen? I trying to make an object jump from 1 point to another point. How far it jumps depends on how long the player holds the touch anywhere on the screen. It jumps when player releases his touch.

At the code below,I able to detect the moment player release his finger.

if (Input.touchCount > 0) {
    Touch touch = Input.GetTouch(0);

    // Handle finger movements based on touch phase.
    switch (touch.phase) {
        // Finger start touching the screen
        case TouchPhase.Began:
            print("Start tapping");
            break;

        // Finger leaving the screen
        case TouchPhase.Ended:
            //when finger release, the object jump
            float rightForce = Time.deltaTime * 10000 / 2;
            float jumpForce = Time.deltaTime * 30000 / 2;
            box2D.AddForce(new Vector2(rightForce, jumpForce), ForceMode2D.Force);
            break;
    }
}

As you can see I able to get the Time.deltaTime which is I assume is how long the player hold the screen.

What I want to do is calculate the rightForce and jumpForce added to the object depending on the Time user hold the touch.

float rightForce = Time.deltaTime * 10000 / 2;
float jumpForce = Time.deltaTime * 30000 / 2;

Because if I use the 2 line of code above, the result will be almost the same everytime.

So what is the correct way to determine the rightForce and jumpForce depending the time user hold touch?

sentences:
Path finding for Vector Based System I understand that typical path algorithms are based on nodes in a graph (not tiled nodes or whatever), but i can't get my head around to find an idea how to implement a path finding algorithm for a grid with endless possibilities (my mapdata is based on vectors so for example an rectangle could be the 1000th of one unit wide but still an obstacle).
I basically have a map with 1 or more fixed sized units and need them to travel the shortest path through a field of rectangles and circles which are not passable.
The question is is there a way to use normal pathfinding algorithms with that mapsceme (how do i calculate the nodes then?) or do i have to use a special one?

sentences:
How can I make an object move in a certain direction depending on its spawning point? I'm currently developing a 2D game and I couldn't find a way to figure this out. In the game, I have 4 different balls and 4 different spawning points. Every 2 seconds, a random ball spawns at a random spawning point.

What I want to achieve is, as I tried to describe above, lets say a ball spawns on right side, I want it to move towards left, if it spawns upside, I want it to go downwards etc.
Here is my spawner code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Game : MonoBehaviour {

    public Transform[] spawnPoints;
    public GameObject[] balls;

    public float timer = 2.0f;

    void Update()
    {
        timer -= Time.deltaTime;
        SpawnBalls ();
    }
    void SpawnBalls()
    {
        int spawnPoints_num = Random.Range (0, 4);
        int balls_num = Random.Range (0, 4);

        if (timer <= 0)
        {
        Instantiate (balls [balls_num], spawnPoints [spawnPoints_num].position, spawnPoints [spawnPoints_num].rotation);
        timer = 2.0f;
        }
    }
}

And here is my ball movement code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Balls : MonoBehaviour {

    public Game game;
    public float speed = 0.25f;

    void Start ()
    {
        game = FindObjectOfType<Game> ();
    }

    void Update ()
    {
    //Some if statement
    //transform.Translate (Vector3.left * Time.deltaTime * speed);
    //else if
    //transform.Translate (Vector3.up * Time.deltaTime * speed);
    //else if
    //transform.Translate (Vector3.right * Time.deltaTime * speed);
    //else if
    //transform.Translate (Vector3.down * Time.deltaTime * speed);
    }
}

I've tried giving spawnpoints tags and creating if statements with gameObject.tag and stuff but couldn't find a way to work it. How can I make it check which spawnpoint the ball spawned at so I can make it move accordingly?
Thanks for help.

sentences:
How to add a nice looking muzzle flash to the tip of my guns I am making a top down shooter and would like to add a muzzle flash to the tips of my guns. So I have an idea of what I want to do which would be just a circle that would fade from yellow to white or from white to yellow, don't really know yet. I actually have know clue how to fade in and fade out colors in libgdx so don't know how to do that. I guess I could also pass in a texture that I can color yellow and append that to the tip of the gun but still would like to add a color fade. Of course, these are just my crappy little ideas. Anyone else have a better idea that would look better graphically and if so could you try to describe it in some detail that would be great.

Thanks!

sentences:
My Earthbound-like Movement Script works in Unity Gameview, but runs differently in Gamebuild First programming question I've ever made in my short journey. I'm trying to create a script which moves members of your party in a line behind you (think Chronotrigger or Earthbound). Here's a clip of what I want it to look like.
Problem:
Everything looks fine in the Game window when I play, but when I build the game to test, the characters begin to stack one on top of each other. I assume it has something to do with Update() frames dramatically increasing the frequency with which I enqueue the positions of the leading character (although I'm not experienced enough to say for sure, clarification on this would be helpful).

I've tried increasing the offset, but this solution is variable
depending on the players computer fps so that wont work.
I've tried running both scripts in FixedUpdate() but a lot of my other
systems run on Update() and so everything stutters.
I've tried enqueue'ing from an IEnumerator and waiting for .1 second
between each enqueue but that stutters as well..

What I'm doing:
The leading character has a script called PlayerTrail which creates a Queue of Vector3s. In Update the game object's transform.position is enqueued. The following character has a script called PlayerFollower which looks at the Queue and Vector3.MoveTowards the position, then dequeues that position and repeats. Each character only looks at the trail of the character in front of it.
Everything seemingly works fine and well in the Unity program, this issue only arises once I build the actual game.
Code Supplied Bellow:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerTrail : MonoBehaviour
{
    public Queue<Vector3> LeaderTrail;
    public Vector3 LastMovement;

    private void Start()
    {
        LeaderTrail = new Queue<Vector3>();
    }

    private void  Update()
    {
        if (this.transform.position != LastMovement)
        {
            LastMovement = transform.position;
            LeaderTrail.Enqueue(this.transform.position);
        }

    }
}

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

public class PlayerFollower : MonoBehaviour
{
    public GameObject leaderObject;
    public int Offset;
    public int moveSpeed;

    private PlayerTrail leaderTrail;
    private Animator animator;

    void Start()
    {
        animator = gameObject.GetComponent<Animator>();
        leaderTrail = leaderObject.GetComponent<PlayerTrail>();
    }

    void Update()
    {
        if (leaderTrail.LeaderTrail.Count < Offset)
        {
                animator.SetBool("isMoving", false);
                return;
        }
        else
        {
            Vector3 direction = (leaderTrail.LeaderTrail.Peek() - transform.position).normalized;
            this.transform.position = Vector3.MoveTowards(this.transform.position, leaderTrail.LeaderTrail.Peek(), moveSpeed * Time.deltaTime);

            animator.SetBool("isMoving", true);
            animator.SetFloat("moveX", direction.x);
            animator.SetFloat("moveY", direction.y);

            Debug.DrawRay(this.transform.position, direction);

            leaderTrail.LeaderTrail.Dequeue();
        }
    }
}

sentences:
Whats an elegant implementation for 2D collision detection in a block based game? to make things clear, i do not want to know HOW to implement collision detection mathematically. What i am looking for is an elegant way to check for collisions without having to manage seperate lists of objects, maybe for example implementing a ICollidable interface.

currently i have a simple gameloop

while(runGame){ handleInput(); update(); render(); }

So there are two possibilities which come straight to my mind. First, ill add an extra call to a method or class handling collisions.

while(runGame){ handleInput(); update(); checkCollisions(); render(); }

Second, every gameobject gets a list of nearby other objects in its update method. so it can do the collision on its own

while(runGame){ handleInput(); update(otherNearShapes); render(); }

i dont like both of these for two reasons.

in the first, i have to manage a seperate list of objects which implement an ICollidable interface.

in the second, the update method handles more logic than it should in my opinion.

so, is there an elegant way of integrating collision detection in my game (loop)? searching the net always only results in how to calculate stuff, but thats not what i want to know.

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:
Replacement for XNA Lobby? I am looking to implement with the Microsoft Windows Live game lobby. Since Microsoft has deprecated XNA, I am wondering if it is still possible to interact with the game lobby they provided in XNA (assuming it is not deprecated as well?).

I am doing this for an engine written in C++

In other words, I am wondering if Microsoft is still offering a game lobby system for developers (for indie developers that is). I am trying to track down the documentation for a possible replacement but I can only find resources for XNA.

If not, are there any good, possibly free alternatives? I have no problem writing my own lobby service but I would rather save the time with an already existing solution.

sentences: How to use XNA in WPF? How can I render some graphics using XNA to a widget/control in a WPF app? Specifically, I don't need any WPF controls inside the XNA graphics window, I just want to put some controls around it for a level editor.

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:
Normal Mapping space confusion I've been reading today about normal mapping. Up to now, the only normal mapping I encountered was with maps already in world space so I just extracted the info from the texture and transformed them with the normal matrix.

Now I wanted to try to use a normal map that is in tangent space, but I immediately became really confused.

What I've in my code up-to-now is

Vertex Shader

 ...
passedPosition = modelViewMatrix*vec4(vertexPosition,1.0);
 ...

Fragment Shader

 vec3 V = normalize(-passedPosition .xyz);   // Eye vector
 ...
 vec3 L_dir = passedPosition .xyz - lights[i].lightPosition.xyz;
 vec3 L = normalize(L_dir);
 ...

And then proceed with my lighting calculations.

All the tutorial I came across change all the light directions and the view vector into tangent space (in the vertex shader) and then extract the normal from the texture and keep going (in fragment).
My issue here is that I'd like to avoid to access all my lights informations in the vertex shader, so my questions are:

Does make sense to pass to the fragment shader the t,b,n vectors so that I transform the light directions there? Should I consider access all my lighting informations in vertex shader (I have an array of Light struct which has more than just the position) and then passed them on to the fragment shader? Is something I'd like to avoid, but if is much better I can think of it.
There is a way to perform normal mapping that is  more compatible with what I've now (snippets above posted).
Should I consider change my calculations from view space to world space? In that case, how can I perform normal mapping?

Thanks

sentences:
Agent taking different paths? I don't know of this is possible or not. I was following Unity - The NavMesh Agent tutorial.
What I'm thinking on how to make the agent take's different path ? example, if i have two agents, how to make both of them taking different paths ?

sentences:
UDP vs TCP in multiplayer mobile game I'm working on a networked multiplayer game, initially for iOS.

Even with TCP_NODELAY there are large fluctuations in latency. I can't be sure of the reason, but I would not be surprised if it was resends on packet loss due to flaky connections.

Having done no real life server work with UDP as opposed to TCP (which I have lots of experience with), I wonder if there are any significant gains to trying a UDP-based architecture.

Client packets are typically only a few bytes, sent rarely, except when moving, when the player might issue 2-8 commands/s. Server packets are slightly larger and mostly sent as response to a client command.

Connections need to be reliable and ordered.

ADDITIONAL INFO

Very early on I did some exploratory tests with TCP versus UDP. I would run connections Phone -> 3G -> External static IP of router -> Wifi -> Development computer and Phone -> Wifi -> Router -> Wifi -> Development computer.

What I wanted to improve was mainly the very uneven lag one would experience moving around on the map with a non-local connection.

Obviously starting animations can help, but there are (rare but valid) reasons why a move command might be rejected that the client have no way to predict. In addition, much data is hidden from the client, which again gives very little room for predictive responses.

Anyway, my results was the UDP and TCP gave pretty much the same average latency when sending data.

What I didn't look at was the actual spread - for example the maximum TCP latency in face of packet loss. I would have have needed to do some packet recovery mechanism in UDP to figure out if UDP could do better.

So again the results I see today with TCP is that usually it works fine, then suddenly a slowdown and a burst of movement as all the other buffered packets are more or less executed at the same time.

sentences: Unity IOS game restart when you press the home button Why does my unity IOS game restart when i press the home button on the device? The same game worked fine on Android device and did not restart on pressing the home button. Thanks

sentences:
Invoking a common method after a button press I want to implement a common method that handles several numeric values and performs and action based on those values. So I have buttons with specific methods to change this values without affecting the rest. However I want to link them all to a final method that runs right after the press of a button, so this way the game will change only when the player chooses to change it and changes according to the players decisions. How can I implement this in my script?
Most of my methods are like this:

public void "ButtonIDGoesHere" (int "SpecificVariable"){
//Add, Sub, Multiply, etc.

}

What can I add so that it goes to a common method right after it executes its instructions?

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:
Rendertexture skips channels sometimes When rendering a camera to a render texture (for a portal effect), it seems to under certain circumstances skip rendering the red channel entirely.
I cannot put my finger on why this might be happening at all. It seems to depend on the angle of the camera, as it stays color-shifted (or not) if I keep the camera in the same position/rotation.
As can be seen in the below pictures, the camera preview does in fact pick up on the full color.
If it is perhaps relevant, I am working in the URP with HDR enabled.
EDIT: Upon further investigation, it seems it can actually skip any channel, it just does red far more often. I just ran into a case where only the green channel was rendered...
It appears to be linked to being forced to render HDR color, for whatever reason?

sentences:
Libgdx 2D Game, Random generated World of random size, how to get mouse coordinates? I'm a noob and English is not my mothertongue, so please bear with me!

I'm generating a map for a Sidescroller out of a 2D-array. That is, the array holds different values and I create blocks based on that value.

Now, my problem is to match mouse coordinates on screen with the actual block the mouse is pointing at.

public class GameScreen implements Screen
{
    private static final int WIDTH = 100;
    private static final int HEIGHT = 70;

    private OrthographicCamera camera;
    private Rectangle glViewport;

    private Spritebatch spriteBatch;

    private Map map;
    private Block block;

...

@Override
public void show()
{
    camera = new OrthographicCamera(WIDTH, HEIGHT);
    camera.position.set(WIDTH/2, HEIGHT/2, 0);

    glViewport = new Rectangle(0, 0, WIDTH, HEIGHT);

    map = new Map(16384, 256);
    map.printTileMap(); // Debugging only

    spriteBatch = new SpriteBatch();
}

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

    GL30 gl = Gdx.graphics.getGL30();
//    gl.glViewport((int) glViewport.x, (int) glViewport.y, (int) glViewport.width, (int) glViewport.height);

    spriteBatch.setProjectionMatrix(camera.combined);
    camera.update();

    spriteBatch.begin();

    // Draw Map
    this.drawMap();

//    spriteBatch.flush();
    spriteBatch.end();
}

private void drawMap()
{
    for(int a = 0; a < map.getHeight(); a++)
    {
        // Bounds check (y)
        if(camera.position.y + camera.viewportHeight < a)// || camera.position.y - camera.viewportHeight > a)
            break;

        for(int b = 0; b < map.getWidth(); b++)
        {
            // Bounds check (x)
            if(camera.position.x + camera.viewportWidth < b)// || camera.position.x > b)
                break;

            // Dynamic rendering via BlockManager
            int id = map.getTileMap()[a][b];
            Block block = BlockManager.map.get(id);

            if(block != null) // Check if Air
            {
                block.setPosition(b, a);
                spriteBatch.draw(block.getTexture(), b, a, 1 ,1);
            }
        }
    }
}

As you can see, I don't use the viewport anywhere. Not sure if I need it somewhere down the road.

So, the map is 16384 blocks wide. One block is 16 pixels in size.

One of my naive approaches was this:

if(Gdx.input.isButtonPressed(Input.Buttons.LEFT))
{
    Vector3 mousePos = new Vector3();
    mousePos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
    camera.unproject(mousePos);

    System.out.println(Math.round(mousePos.x)); // *16); // Debugging
    // TODO: round
 //   map.getTileMap()[mousePos.x][mousePos.y] = 2; // Draw at mouse position

 }

I confused myself somewhere down the road I fear. What I want to do is, update the "block" (or rather the information in the Map/2D-Array) so that in the next render() there is another block. Basically drawing on the spriteBatch g

So if anyone could point me in the right direction this would be highly appreciated.
Thanks!

sentences:
Experienced coder/designer moving into game development - what's involved? I am interested in moving into game development once my current project is done, as it's nearly at a point where it will pay my bills and allow me to hire someone else to take the driver's seat, meaning that, for the first time in my working life, I'll be in a position to devote a proper amount of energy to getting into game development, which has been something I've wanted to do for a long time but forced myself to wait on, as there are only so many hours in the day to devote to projects.

I am an experienced web developer (12 years) with most of my experience programming in C# and .Net (8 years). I am also a capable graphic designer. I have a surface knowledge of C++, though it's been 10 years since I wrote any C++ code. I also played with the DirectX 5 API back then as well.

I am happy to outsource graphics and sound, leaving me with coding, game design, level design and so forth.

Do I need to learn C++ properly, or can I rely on my C# and .Net knowledge?
If I'm going to leave C++ out of the equation, am I seriously limiting myself with regards to platform agnosticism?
Given that my memory of mathematics (high school level) is hazy at best, how much time I do I need to devote to pure maths self-education, or can I pretty much figure it out as I go?

In a nutshell, I'd love to get some idea of what the best approach for me would be, including DO's and DON'T's that might slow me down. I know that baby steps will be required at first, but it would be nice to get some advice as to what path I should follow to get myself up to speed quickly so that I am able to create decent indie games with nice looking 3D graphics, AI, particle effects and so forth.

sentences:
Distinction between constant and changeable game objects in save/load game? Do you distinguish constant and changeable game objects when you save/load game? If yes, how do you do it?

If not to save constant objects (for example, mountains and trees), we optimize memory usage and save/load time. But functional requirements for the game can change. Now you want trees to be mutable and destroyable. It can screw up all previous game states. Trees were not saved => saved game map is interpreted as the prairie without trees.

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:
Rendering performance for Flash games I was reading on SO about native flash rendering vs building a custom BitmapData frame buffer and some of the answers were a bit conflicting, so I was wondering:

Is it generally best practice to go the custom Bitmap buffer route or is it best to leave rendering to the flash engine?
If you're using vector animations (MovieClips) as opposed to sprites, does that change the answer to the above?
If so is it best practice to use sprite based animations?

(I'm targeting Flash 10 if that makes any difference)

sentences:
glColor3f() 0.0 = no intensity 5.0 = full intensity? I have a very weird behavior of openGL's glColor right now.

I've wasted hours to detect why my line colors acting so weird until I found out that 0.0 rgb values is zero intensity and 5.0 lead to full intensity (yes NOT 1.0 it's not clamping!)

If I color a line with 1.0, 1.0 1.0 I get very dark grey instead of white.
If I color a line with 5.0, 5.0 5.0 I get white.
Here is my code:

gl.glDisable(GL2.GL_BLEND);
gl.glDisable(GL2.GL_TEXTURE_2D);

/* We need to disable any shaders to get colored lines */
gl.glUseProgramObjectARB(0);

gl.glColorMaterial(GL2.GL_FRONT_AND_BACK, GL2.GL_AMBIENT_AND_DIFFUSE );
gl.glEnable(GL2.GL_COLOR_MATERIAL);

gl.glBegin(GL2.GL_LINES);
for (int lineIndex = 0; lineIndex < lineSegments.getNumberOfLines(); lineIndex++) {
  gl.glColor3d(5, 0, 0);
  //gl.glColor3dv(lineSegments.getLineColor(lineIndex).data(), 0);
  gl.glVertex3fv(lineSegments.getLineStartPoint(lineIndex).floatData(), 0);
  gl.glVertex3fv(lineSegments.getLineEndPoint(lineIndex).floatData(), 0);
}
gl.glEnd();

gl.glEnable(GL2.GL_TEXTURE_2D);
gl.glEnable(GL2.GL_BLEND);

Why is OpenGL acting so weird on glColor? Did I miss a gl state or something?
I could scale up the colors so I bypass this, but I want to find out whats wrong here.

(The code example leads to a line that ist 100% red)

sentences: How to manage the lifetime of Ogre3D objects? I haven't found tutorials that are concerned about deleting scenenodes and entities. I assume that the scenemanager will take ownership of them when they are attached (am I right?). However, I can imagine many situations where I would like to deterministically and selectively terminate objects, for example if I were to use OGRE to display a huge open-world level, I would like to dynamically load and unload parts of the world. How can I do this while also telling the scenemanager that his pointer is no longer valid?

sentences:
mat3x4 in webGL shaders I am porting the IQM bone animation format to Javascript and have run into a problem...

The vertex shader is failing to compile and the only error message I get out is 'mat3x4' : syntax error on the first occurance of mat3x4 in the file.  Its the very data-type name itself that is unsupported, it seems.

This happens on all machines I have access to for testing, which have a variety of Intel and ATI cards and run Linux with Firefox.  (Chrome is not available.)

If I change all mat3x4 to, say, mat3 then my shader compiles fine.

does webGL support mat3x4?  (I can find nothing via Google)
how can I work around this?  How can I package the bones into mat4, for example, and keep the code working correctly?

sentences:
Large Scale GIS in a AAA-Quality Game Engine? (Unreal, Cryengine, Unity, Etc.) I am working on a new simulation project that requires large scale, real-world terrain and imagery (GIS).  By large scale, I mean that I would like to support databases that cover something on the order of 10,000 square miles that include at least height data and satellite imagery.  Using data of this size also means that the engine must be capable of managing the coordinate systems/projections such that some reasonable precision can be maintained.

To my knowledge OpenSceneGraph is the only graphics engine out there that makes this easy (via paged terrain support, osgEarth, etc.)  However, it would be nice to be able to leverage many of the other great features AAA-quality game engines bring to the table.  (OSG is just a graphics engine, really.  I've been using it for over a decade, but I don't want to be fixed only to what I know.)

I've seen many tutorials online for importing small postage-stamp sized bits of terrain into Unreal.  I haven't seen anything on this scale.

Asked here: "Very large terrains in Unreal-4" there is a link to Unreal's "World Composition" feature.  This seems to shift coordinates around and also doesn't seem geared towards using real-world data.

How can I represent real-world terrain data on these scales in a mainstream game engine?

sentences:
How can I structure my ASCII terrain object? So I have this object which represents a simple ASCII "overworld". Note the code is broken, but it's for demonstration purposes...

var TerrainObj = {
    w: { name: 'water', glyph: 'w' },
    g: { name: 'ground', glyph: 'g' },

    terrain: [[w, w, w, w],
              [w, g, g, w],
              [w, g, w, w],
              [g, g, w, w]],

    generate_display: function(terrain) {
        ...
        Code that returns an array the same as terrain but containing
        the glyphs from the objects in terrain
        ...
    }
}

So as you can see, the object contains the data for different types of terrain cell, the overworld itself, and a method to covert the terrain info into an array of glyphs for printing to the screen. But of course the problem with this code is that in the terrain array, there will be an reference error to each object.

I want to be able to write out the terrain array without using more than a one-letter name, because presumably to get this to work I'd have to do something like

terrain: function() {
    var map = [[this.w, this.w, this.w, ...],
               ...
               ...
               ];
}

So is there a nicer way I can produce my "semantic" terrain layer that references objects but without me having to write lengthy references to them in my array declaration?

sentences:
Making a parenting system Each Entity can have one parent and any number of children. They have a position vector and a quaternion orientation.

I know that I can make objects look like they're in a hierarchy by multiplying parent transforms all the way to the root, but how to I get the canonical coordinates out of those transformations? I need to have the real position of every Entity in the world in order to update their bounding meshes.

I would like to keep my drawing code for everything as just this:

XMMATRIX transform = XMMatrixRotationQuaternion(orientation);
transform = XMMatrixMultiply(transform, XMMatrixTranslation(position));
transform = XMMatrixMultiply(world, transform);
model->Draw(context, *states, transform, view, projection);

Eg. without relying on visual tricks to get the hierarchy looking right, so no multiplications with parent transforms while rendering.

How do I properly change a child's position and orientation with respect to the parent?

sentences:
MMOFPS Player Positions I'm working on a MMO game project. I have a question about MMOFPS game architecture. (I have basic network knowladge)

(MMOFPS) I want to send player position to other players(clients) and other players will render the player. Namely this is the base of the game world. I have read some article about positioning and somebody says "use inputs for movement update" and others says "use  position posting". That's the first problem. What is better? input or position based movement posting? What is more suitable for a MMOFPS game? (And how to do it?)

SUMMARY: I need to learn "how real multiplayer games work?" (but basically). In my first project I have used TCP protocol for posting position (not inputs) and I have sent position data 4 times per second. Server delivered them to other clients and other clients handled this data and maked a smooth movement. This is a very basic method to do it but I know that isn't MMO! Can anybody help me about understanding MMO game architecture?

sentences:
Unity: Terrain Texturing Roads The way I would texture a road within a given terrain is with a seperate mesh and a horizontally tileable texture such as this:

Then make sure the texture on the edge of the road and the terrain bordering the road looked kind of similar. That would however always create a visible seam such as in the image below taken from half life 2 episode 2:

Now the same game seems to blend in a horizontally tileable texture (the road) with a terrain made up of horizontally and vertically tileable textures (grass & dirt). How is this possible without a seperate mesh/material and without any visible seams, especially since the road is twisty meaning the texture has been rotated. I am completely baffled as to how this has been created, this is clearly beyond standard blend maps.

sentences:
Most efficient way to calculate angle between two line-segments that do not necessarily touch each other Although I found answers on calculating angles from vectors, I didn't find a specific way to calculate angles between line-segments that do not necessarily touch each other (I say "not necessarily because I will apply to different cases).

See the figure below:

Consider that I know the 2D position of all 4 red points. I am using C# here. What would be the cheapest way of calculating the angles formed by line-segments that do not touch each other, such like the ones above?

sentences:
How can I make a self-updating game launcher? I have been creating a game with java, and before I release it I wanted to make a launcher that is connected to the game's website.

Basically I need to make a launcher that updates itself when I have changed the content.

Unfortunately I have no idea on how to do this. There would be a description in the main launcher which only I can change, and a large play button that will close the launcher and run the game. If I have changed the description, then it will change on the website download, and on the copy that anyone else owns (anywhere).

So, because of my lack of knowledge on this topic, does anyone know how I'm supposed to do this, and how it would work?

sentences:
UE4 tips how to handle Minigolf Multiplayer Heyo!

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

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

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

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

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

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

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

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

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

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

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

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

sentences: How to disable spring joint in unity 3d How can I disable Spring joint in unity 3d, since disabling feature only available in 2d mode, I am not able to find any way to disable it via script

sentences:
Should I use "conventional" colors to represent item rarity? I'm making a new RPG that has loot. In fact, a majority of the game is based around loot. It's going to have colored borders to denote the rarity of the loot as it's drawn.

WoW uses Grey, White, Green, Blue, Purple, Orange and some others. GW2 uses Gray, Black, Blue, Green, Yellow, Orange, Pink, Purple. The colors don't match but you can see some distinct overlap.

I'm wondering if those colors are important or intuitive to users understanding of the rarity or if they can be messed with? If they can be changed how do you determine what colors to put in what order?

For instance, if I went with White, Blue, Green, Yellow, and Red, would that be fine as long as I made it clear in other ways or would those colors be confusing?

sentences:
Unreal Engine 4: Help with multithreading and accessing render target images I am working on an application where I need to record images seen from an in-game camera. Initially, the method was to set up a TextureRenderTargetResource from the in-game capture component, and subsequently call ReadPixels to access the frame data and save that data as an image. (code flow below)

bool saveImage() {
  USceneCaptureComponent2D* capture = getCaptureComponent(camera_type, true);
  FTextureRenderTargetResource* RenderResource = capture->TextureTarget->GameThread_GetRenderTargetResource();
  width = capture->TextureTarget->GetSurfaceWidth();
  height = capture->TextureTarget->GetSurfaceHeight();

  TArray<FColor> imageColor;
  imageColor.AddUninitialized(width * height);
  RenderResource->ReadPixels(bmp);
}

This approach was slowing the game thread down significantly, so I am trying to move the screenshot saving procedure to its own thread. My approach now is inspired by the article at https://wiki.unrealengine.com/Multi-Threading:_How_to_Create_Threads_in_UE4. I access the *AActor object from this separate thread and subsequently its camera, and then I call the saveImage() function from the thread: but this is resulting in a crash with no additional information (just "UE4Editor.exe has triggered an exception") at the call to ReadPixels(). So essentially, calling saveImage() and thereby ReadPixels() from the game thread works perfectly, and it fails when I call it from a different thread. Am I doing something wrong in my process here?

sentences:
Create rotation in random direction from existing rotation I am working on a game in Unity, and I currently have a game object (object A) located at the origin. I have a child of this game object (object B), that is 10 units back on the z-axis. When I rotate object A, it causes object B to orbit at 10 units from the origin.

With that being said, I have many game objects that orbit this same way. I want (at any point in time) to be able to spawn a new game object a certain distance away from object B. This certain distance is really going to be something like 60 degrees around the sphere in any random direction from object B. So when I create a new game object, I will create a new pivot point object (object C) and a new child of that pivot point (object D) at 10 units away on the z-axis.

I know I need to create a new rotation from the current rotation of object A, but this needs to be in a a random direction and the new rotation should be 60 degrees in that direction.

Let me know if that doesn't make sense, or if you need any other information.

I am not really sure how to even go about determining these rotations, but I am currently trying to use Unity's Quaternion class which I believe will work, but I think I need to step back and see if anyone else has a better way to go about this.

Appreciate the help!

sentences:
Alert Dialog Box font color in AndEngine I am developing an app using AndEngine and I am using my own custom theme to use white background theme. My styles.xml file looks like this:

<resources>

<color name="white_opaque">#FFFFFF</color>
<color name="pitch_black">#000000</color>

<style name="AppTheme" parent="android:Theme.Light">
  <item name="android:background">@color/white_opaque</item>
  <item name="android:windowBackground">@color/white_opaque</item>
  <item name="android:colorBackground">@color/white_opaque</item>

</style>
</resources>

Everything is working fine except in the dialog box the font color is white and it looks like this:

How can I change the font color to black for the text?

sentences: Unity3d: keep working on the project in the editor while building for Android in command line Is it possible to keep working on the project in the editor while it's being built for Android in command line?

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:
Drawing slope lines in a confined space This isn't a game development question per se, but here goes...

I have a 50x50 pixel space in which I need to draw five lines: X and Y axes, and one line for each of a steepest, average, and flattest slope.

I'm working with (Java) code that was handed down to me with no documentation or commentary and I've never worked with drawing on a canvas before. Here's the code for a box that measured 175x75 px. This needs to be adapted for a 50x50 area as described above.

    DrawingArea canvas = new DrawingArea(175, 75);
    canvasContainer.add(canvas);
    Rectangle rectangle = new Rectangle(0, 0, 174, 75);
    canvas.add(rectangle);
    Line slopeMainLineX = new Line(5, 70, 170, 70);
    slopeMainLineX.setStrokeOpacity(0.5);
    canvas.add(slopeMainLineX);
    Line slopeMainLineY = new Line(40, 70, 40, 0);
    slopeMainLineY.setStrokeOpacity(0.5);
    canvas.add(slopeMainLineY);
    steepestLine = new Line(40, 70, 0, 0);
    steepestLine.setStrokeWidth(3);
    canvas.add(steepestLine);
    avgSlopeLine = new Line(40, 70, 0, 0);
    avgSlopeLine.setStrokeWidth(2);
    canvas.add(avgSlopeLine);
    flattestLine = new Line(40, 70, 0, 0);
    flattestLine.setStrokeWidth(1);
    canvas.add(flattestLine);

    int steepestAngle = Math.round(site.getSlope().getMax());
    int averageAngle = Math.round(site.getSlope().getAvg());
    int flatestAngle = Math.round(site.getSlope().getMin());

    double xPointSteepestAngle = 40 + 120 * Math.cos(steepestAngle*0.0174532925);
    double yPointSteepestAngle = 70 + 120 * Math.sin(steepestAngle*0.0174532925);
    double xPointAverageAngle = 40 + 120 * Math.cos(averageAngle*0.0174532925);
    double yPointAverageAngle = 70 + 120 * Math.sin(averageAngle*0.0174532925);
    double xPointFlatestAngle = 40 + 120 * Math.cos(flatestAngle*0.0174532925);
    double yPointFlatestAngle = 70 + 120 * Math.sin(flatestAngle*0.0174532925);

    steepestLine.setX2((int) xPointSteepestAngle);
    steepestLine.setY2(70 - ((int) yPointSteepestAngle - 70));

    avgSlopeLine.setX2((int) xPointAverageAngle);
    avgSlopeLine.setY2(70 - ((int) yPointAverageAngle - 70));

    flatestLine.setX2((int) xPointFlatestAngle);
    flatestLine.setY2(70 - ((int) yPointFlatestAngle - 70));

I'm completely lost here, so any help would be greatly appreciated.

sentences:
Top-Down Tilemap Rendering and Collisions in Libgdx I'm sorry if this question has been previously answered, but I was unable to find an answer here or through google. I'm trying to make a simple roguelike-like that would feature a top-down tile map, a player, AI controlled enemies, and various items. I'm having trouble understanding how I can properly have the tilemap interact with the player and enemies through both collision detection and rendering.

It seems that the two main options for collision detection are 1)to specify if a tile is collidable in Tiled Map Editor, and then check tile by tile in the game code to see if the player's position overlaps that of a nearby collidable tile, or 2)integrate the tilemap with box2d physics. Admittedly, I do not understand any part of using tilemaps with box2d.

Additionally, I am unsure of how to properly draw the tilemap in reference to the player and enemies. Say I had a tree tile that I would like to always draw on top of/in front of the player. What is the best practice for accomplishing this in libgdx? I was thinking assign such tiles a certain ID and then render them after the player is rendered.

sentences:
How can I set a ui image canvas to be in front of anything else? In the Hierarchy I have a Canvas set to Screen Space - Overlay the canvas name is Scene Fader. and a child disabled ui Image and also a child name Scene Fader Child that is a gameobject with a script attached to it name Scene Fader :

The script that attached to Scene Fader Child is :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class SceneFader : MonoBehaviour
{
    #region FIELDS
    public GameObject fadeOutUIGameobjectImage;
    public float fadeSpeed = 0.8f;
    //public SaveLoad saveLoad;

    private Image fadeOutUIImage;

    private void Start()
    {
        SceneManager.sceneLoaded += SceneManager_sceneLoaded;
    }

    public enum FadeDirection
    {
        In, //Alpha = 1
        Out // Alpha = 0
    }
    #endregion

    #region FADE
    public IEnumerator Fade(FadeDirection fadeDirection)
    {
        fadeOutUIGameobjectImage.SetActive(true);

        float alpha = (fadeDirection == FadeDirection.Out) ? 1 : 0;
        float fadeEndValue = (fadeDirection == FadeDirection.Out) ? 0 : 1;
        if (fadeDirection == FadeDirection.Out)
        {
            while (alpha >= fadeEndValue)
            {
                SetColorImage(ref alpha, fadeDirection);
                yield return null;
            }
            fadeOutUIGameobjectImage.SetActive(false);
        }
        else
        {
            fadeOutUIGameobjectImage.SetActive(true);
            while (alpha <= fadeEndValue)
            {
                SetColorImage(ref alpha, fadeDirection);
                yield return null;
            }
        }
    }
    #endregion

    #region HELPERS
    public IEnumerator FadeAndLoadScene(FadeDirection fadeDirection, string sceneToLoad)
    {
        yield return Fade(fadeDirection);

        SceneManager.LoadScene(sceneToLoad);
    }

    private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
    {
        if (MenuController.LoadSceneForSavedGame == true)
        {
            var saveLoad = GameObject.Find("Save System").GetComponent<SaveLoad>();
            saveLoad.Load(null, null);
        }

        if(MouseHover.loadingwithfolder)
        {
            var saveLoad = GameObject.Find("Save System").GetComponent<SaveLoad>();
            saveLoad.Load(MouseHover.folder, MouseHover.savedGameFName);
            MouseHover.loadingwithfolder = false;
        }
    }

    private void SetColorImage(ref float alpha, FadeDirection fadeDirection)
    {
        if(fadeOutUIImage == null)
        {
            fadeOutUIImage = fadeOutUIGameobjectImage.GetComponent<Image>();
        }

        fadeOutUIImage.color = new Color(fadeOutUIImage.color.r, fadeOutUIImage.color.g, fadeOutUIImage.color.b, alpha);
        alpha += Time.deltaTime * (1.0f / fadeSpeed) * ((fadeDirection == FadeDirection.Out) ? -1 : 1);
    }
    #endregion
}

When in this script I'm enabling true the fadeOutUIGameobjectImage I want that this Image will become in front of anything else all the ui elements and other stuff.
Now there is some ui elements that are in front of it.
This screenshot show the default main menu when running the game :

Then when starting a new game everything is fade out the screen get black using the Scene Fader script but the left ui element is in front of the image in the scene fader script :

sentences:
Code vs. Configuration in Unity I know a thing or two about Unity at this point, but I've still lots of subjective, best practice questions, Such as:
How do you decide what values are obtained via Start/Awake initialization, and which values are explicitly serialized into the scene? In my current project, game objects and behaviors reference each other in a complex graph. Initially, I did this on Start(), programmatically, with lots of raycasts and GetComponent<>() and such. Now though, I just declared stuff public (violating encapsulation?), to simply serialize this information to the scene once generated by an Editor script... Which is more correct? Should my methodology be that anything that can be serialized should be serialized? Or is it better to write more initialization code which conveys some explanation why the values are what they are?

sentences:
Why do I get these "Invalid command android" errors trying to build for Android in Unity? Trying to move a unity project over to android using gradle as the build system. I get the following 3 errors:

Error:Invalid command android

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]
exit code: 64
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

and

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]

It turns out a lot of people have been having this problem and the most common solution is to move to an earlier version of the apk. When I tried that, I still received the same three errors. I moved down to api level 23 from the most current. I am one a mac.
    exit code: 64

sentences:
How do I do random isometric paths? I'm working on an isometric city generator, and I am looking for a little push in the right direction. I'm looking to randomly generate roads on an isometric plane. I have never done path making before, and I've Googled it and didn't find any articles relating to what I am trying to do.

Basically, my program generates a random isometric city and I am hoping to add roads to that.

sentences: How to access triangulates in a 3d model that was imported in Unity? I have a 3d model of a city. It is in collada format and ina dae file. I imported 3d model to unity but I don't know how can I access the objects of this 3d model with c# script.Because I am new with coding stuff. I am trying to learn bot unity and c# at the same time and I think this is a painful process.I want to access and manipulate the triangles in this 3d model. You can see the model in the attaching picture

sentences:
Using circles to create a sphere I've been working on creating spheres in a 3D space recently, and have successfully created cylinders. I've just run into a little problem. For some reason, my "Spheres" end up looking like very thick star shapes. I can't seem to figure out what's wrong, and I could not really find any algorithms to reference off of. My code:

public static void createCircle(int xoff, int yoff, int zoff, int FOV, ArrayList<Point3D> Points, int radius) {
    for(int j=0;j<Math.PI*2;j++) {
        int x = (int) (radius * Math.cos(j));
        int y = (int) (radius * Math.sin(j));
        Points.add(new Point3D(x+xoff, y+yoff, zoff, FOV, 900, 600));
    }
}
public static void createSphere(int radius, int height, int FOV, ArrayList<Point3D> Points, int posx, int posy, int posz) {
    for(int z=0;z<height;z++) {
        createCircle(posx, posy, posz+z, FOV, Points, (int) (radius*(Math.sin(z)*2)));
    }
}

Here's what it ends up looking like:

sentences:
Math major as a viable degree While I realize there are many topics about CS vs software engineering vs game school programs, I haven't found anything relating to whether pure math degrees (with CS minor and electives) would also be a viable program. By this I mean: Would having a math major, CS minor put one at competitive disadvantage as compared to a pure CS program?

This relates specifically to game engine programming, more on the graphics side.

Background (for those who care): Currently a math major, CS minor at school and looking to land a career doing graphics engine programming. Admittedly, I love math and if at all possible would like to stay my current program as long as it doesn't put me at a competitive disadvantage trying to land a job post-graduation. That being said, I'm strong in the traditional C/C++ languages, strong concurrent programming skills, and currently produce self-made games for iOS. As an employer, how badly is the math major hurting me? Just want to get some advice from people already in the field!

sentences:
How to manipulate browser pixels on different mobile devices I'm creating a board game using HTML5, CSS3 and JavaScript. It's working fine on Desktop browsers properly. But when i load it on Windows phone it's not behaving properly. The resolutions and the game board are not matching. I'm targeting Windows and Android platform.

Game Board is 1050x650 px which is implemented using HTML and css3.
now what i want to know is most browsers don't support certain CSS3 features like rotations and key-frames animations so will it be better if i use photoshop to make the board for different resolutions or is it possible to do the same as i did using HTML5 and CSS3.

And in the above image, let's say distance between B and a red dot is 200px and i use JS to manipulate the movement of B from one point(red dot) to another point(red dot), now will the distance 200px be the same in all the devices? If not how to write a proper code to manipulate the movement in all mobile devices?

sentences:
From Core Java Graphic Dev To JOGL I've been a java developer for 3 years, and I got one opportunity to explore  JOGL.

Is it a good idea to move into JOGL from being a core java developer  ?

sentences:
What is the easiest and shortest way to draw a 2d line in c/c++? I am fairly new to c/c++ but I do have experiance with directx and opengl with java and c#. My goal is to create a 2d game in c with under 2 pages of code. Most of what I have seen requires 3 pages of code to just get a window running.

I would like to know the shortest code to get a window running where I can draw lines. I believe this can be done in less lines with opengl versus directx. Is there maybe an api or framework i can use to shorten it more?

Also, it would be nice if the solution were cross platform compatible.

sentences: Feasibility of nested voxels Out of curiosity, does anyone know how feasible it would be to have a voxel engine that allowed for voxels within other voxels? For example, you would have the usual chunks filled with voxels, but instead of stopping there each voxel could become a chunk of it's own to store more, smaller voxels. The first use case that comes to mind would be for showing damage to voxels, but there could be others, such as smoother terrain. Thoughts?

sentences:
Do I require a game engine  when I want to make a game? I started making a 2D game in C# and realized that I could also use a game engine or XNA. For the moment everything works fine but I'm afraid I will have problems in the future.

So do I actually need a game engine or XNA? Or will it also works without.

PS: I don't know anything of XNA so I would learn it.

sentences:
How to normalize angles from points in java Previous thread on projectile slopes

What is the velocity of a translating projectile in 2D?

What I'm trying to do

Get the slope at a constant speed for both X & Y Coordinates though I don't have an understanding on how to use Vectors in programming so I'm going off this guys equations but with both X & Y since I don't understand vectors. I can't tell at this point if there a direction or coordinate.

What I've done so far

Got everything ready

What I need help with

What do I have to put in as Syntax to normalize these 2 points even though their coordinates (Based off the answer on the given thread)

sentences:
Using raycast to detect whether a wall immediately blocks a player in Unity C# I am working on a game project of which involves a procedurally generated maze.
Within this maze, there are different types of tiles, such as walls and gates.
I want to program the player so that it cannot move through a tile that is tagged as a "wall", and I am hoping to use ray casting to detect item tags.
Now, you may think it would be simpler to use rigid bodies, but the game is set up so that the player moves 1 unit per movement, instead of being able to move at any randomly input distance, in order to keep the game adhering to a "grid" for the sake of other events that happen within the game.

So, for this reason, i wish to detect if a wall is north of the player (let's call "north" as "up", as I have an "up blocked" boolean to state if a wall is directly "north" of the player)
but, my code doesn't always recognise walls that are immediately north of the player, and instead sometimes the "up blocked" boolean becomes activated as "true" when a wall is left, right, or "below" (down) of the player, irrespective of whether or not there is a wall "above" or down.

here is my code:

Vector2 vUp = new Vector2(transform.position.x, (transform.position.y + 0.05f));

    RaycastHit2D hitUp = Physics2D.Raycast(transform.position, vUp);

    if (hitUp.collider != null && hitUp.collider.tag == "wall")  {
        upBlocked = true;
    } else {
        upBlocked = false;
    }

I have spent many hours looking for a solution for this problem, but most mediums provide information that either didn't work, wasn't applicable or simply was grossly out of date.

sentences:
Moving a sprite along a circle given by an implicit equation I’m trying to create a hyperbolic version of Pong in a Poincaré disk, using C++ and SFML.
Here is my problem: when the ball rebounds on a paddle, I deduce two coordinates allowing me to recover the equation of the hyperbola (as a circle in the Poincaré disc), in implicit form:
$$x^2 + y^2 + ax + by + 1 = 0$$
So, I have my equation, and I can only move my sprite using its x and y Cartesian coordinates - I don’t know how to do it differently.
How can I move my sprite following this circle equation?
Moreover, I would like to represent the Poincaré metric, so the ball's velocity will also vary as a function of the metric and its position (slowing down on the screen as it gets closer to the edge of the disc where space is compressed)…

sentences:
How do I apply different probability factors in an algorithm for a cricket simulation game? I am trying to write the algorithm for a cricket simulation game which generates runs on each ball between 0 to 6. The run rate or runs generated changes when these factors come into play like skill of the batsman, skill of the bowler, target to be chased. Wickets left.

If the batsman is skilled more runs will be generated.
There will be a mode of play of the batsman aggressive, normal, defensive. If he
plays aggressive chances of getting out will be more.
If the chasing target is more the run rate should be more.
If the overs are final the run rate should be more.

I am using java random number function for this.
The code so far I've written is

    public class Cricket {

public static void main(String args[])
{
    int totalRuns=0;
  //i is the balls bowled
     for (int i = 1; i <= 60 ; i++)
       {
        int RunsPerBall = (int)(Math.random()*6);
        //System.out.println(Random);
        totalRuns=totalRuns+RunsPerBall;
       }
    System.out.println(totalRuns);
}

    }

Can somebody help me how to apply the factors in the code. I believe probability will be used with this. I am not clear how to apply the probability of the factors stated above in the code.

sentences:
How to place grass on custom terrain mesh I made a custom terrain mesh and textured it, now I want to place grass on it, but I don't know how. I only find info about grass with the unity terrain.
I am not even sure what exactly to look for.

What is the best/easiest way to place grass on a terrain?
I'd like to do it in the shader if possible, but I guess I will need additional geometry if I want it to "stick out"?

(Random example picture
http://www.beamng.com/attachments/stuff-png.16516/)

I'd appreciate a general outline on how to tackle this problem and maybe some links for further reading.

Thanks.

sentences:
Indoor 3D game worlds I'm looking for a little direction.

I'm building a game engine as a part of my university project, and I'm having a little trouble about what to look for when it comes to indoor 3D game worlds.

Now I say indoor specifically because I have already set up an outside environment with heightmaps and skyboxes, so I'm roughly in the know with that.

What I'm struggling with is what I should be looking at to help me build an indoor level of my game, for instance on board a spaceship.

So my question is, how would I go about building an indoor world with walls, doorways, windows etc?

I'm using C++ OpenGL and SFML to build the engine, and the game levels in mind will be fairly big, so it would be appreciated if this was kept in mind whilst answering my question.

Any tutorials or guides will also be appreciated.

sentences:
Unity 2D Problem: Tilemap Tearing ONLY in Scene View Facing an annoying problem with unity, googled to no avail. Basically I was having tilemap tearing so I created a sprite default material with pixel snap on. This fixed the tearing when running the game, but caused massive tearing in just my scene view. This does not affect gameplay but is very annoying when trying to create backgrounds and stuff.
Pic of scene view: https://media.discordapp.net/attachments/810052982220652577/836562483883016192/tilemaptearing.PNG
My problem is identical to the one asked in this thread here but the solution this person came up with was to not use pixel snapping, but I need that to prevent tearing in the actual game. Anyone know what could be causing this and how could I fix?
Edit: Current version 2019.5.0a5, currently updating to most recent version

sentences:
ImpactJS and Construct 2 I'm interested in HTML5 game development and I found about this 2 game engines, I already know ImpactJS requires more programming experience and that Construct 2 has its own event and action system that can be extended with plugins made with JavaScript.

I want to know what are each engine's primary focus, when would someone choose one over the other assuming programming knowledge is not a concern.

Is it a matter of taste, features available, type of game or is it that each tool serves better for some kind of games or development process?.

I'm not looking to know which is better, just in which situations works better each tool, so people can have an idea of what's better for building the game they have in mind.

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:
Get the player front position at specific distance The simple way to get player front position at specific distance

     Vectro3 forward = player.transform.forward * distance;
     Vector3 newPlayerFronPosition= player.transform.position + new Vector3(forward.x, forward.y, forward.z);
     newPlayerFronPosition= new Vector3(newPlayerFronPosition.x, newPlayerFronPosition.y - 4f, newPlayerFronPosition.z);
     navigationCanvas.transform.position = newPlayerFronPosition;
     navigationCanvas.transform.rotation = camRotationToWatch.transform.rotation;

its actually working fine but the problem is as my player move up or down the navCanvas become appear ver near to my player. How to mainitain spcific distance all the time.?? that no matter player look above or down the navcanvas display at specfic distance.(position)

disatnceUICam = Vector3.Distance(newPlayerFronPosition, player.transform.position);

I also logged the distance and surprisingly it the distance is changing when i am moving up or down. its changing from 6 to 12 as i am looking up to down.

sentences:
What is the standard C# / Windows Forms game loop? When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured?

A canonical Windows Forms application has an entry point that looks like

public static void Main () {
  Application.Run(new MainForm());
}

and while one can accomplish some of what is neccessary by hooking the various events of the Form class, those events don't provide an obvious place to put the bits of code to perform constant periodic updates to game logic objects or to begin and end a render frame.

What technique should such a game use to achieve something akin to the canonical

while(!done) {
  update();
  render();
}

game loop, and to do with minimal performance and GC impact?

sentences: How can I implement a global high score ladder? Are there any existing frameworks I can build on?  Should I build my own?  How can I prevent fake scores from being posted to it?

sentences:
unity apply item animation to character I'm trying to change the attack animation of my player in relation to the attack animation for the item he has in his hand.

For example, the default attack animation of my player is puching and once he picked up a sword I want his attack animation to be sword attack, for a hammer a hammer attack, etc ..

I searched a lot on the internet but didn't find much, I saw a few post talking about AnimatorOverrideController but I'm not sure if it's what I need because it overrides every animation clip of the AnimatorController. In my case I just want to change the attack Animation Clip.

So if you cloud give me some tips about the right way to do it, I would really appreciate because I'm a bit confused.

Thanks

Edit : BTW, I'm in Unity 3d

sentences:
Smoothly extend eased animation to new target value I am implementing animated double property from scratch, currently with SmoothStep easing, however when new target value is set, there is visible "jump" in animation speed (probably due to applied easing). I would like setTarget to smoothly extend currently ongoing animation.
I have tried to calculate originalValue_ and remaining_ based on current t (offsetting those correctly, I think, will solve the problem), but haven't managed to find the correct formula.
How do I smoothly extend ongoing smoothstep animation to new target value?

void setTargetValue(double value, double duration = 1.0)
{
   originalValue_ = currentValue();
   targetValue_ = value;
   remaining_ = duration;
   duration_ = duration;
   t = 0.0;
}

double currentValue() const {
   return SmoothStep(originalValue_, targetValue_, t); //x*x*(3 - 2*x)
}

void update(double deltaT) {
   remaining_ = fmax(0.0, remaining_ - deltaT);
   t = clamp(0.0, 1.0, 1.0 - remaining_ / duration_)
}

sentences: LibGDX - Show a minimap I've started to develop a small roguelike game in LibGDX. I've also made a minimap class, which creates and updates the minimap as the player explores the dungeon, by using a Pixmap. The minimap class has an OrthographicCamera (currently unused), which will be used for centering the minimap on the player. The minimap is currently rendered with it's own SpriteBatch. Now I'd like to put the minimap on the upper right corner, and clip it, because it is so big, that it'd obscure the half of the screen. I'm not really sure how to do this clipping part. I assume I should use the ScissorStack class, but the LibGDX wiki is a bit uninformative for me.

sentences:
Special moves using mouse movement? Recently, I accidently broke my PC controller and I was forced to play Skullgirls using the keyboard. Needless to say, it sucked. Fighting games are the kind of games where a controller is (almost objectively) better to use than a keyboard, just like how keyboard + mouse is better to use for FPS games than a controller. Keyboards just don't allow the same freedom a controller offers for fighting games, especially because of the analog stick.

So while I was getting my *** kicked and (of course) blaming only my keyboard instead of myself, I had an idea: why don't fighting games use the mouse, too? Couldn't the mouse movements be used as the directional input for the special moves instead of the arrow keys? Examples:

Hadouken - quick flick with the mouse into the direction you're facing
Shoryuken - a steep upward curve towards the direction you're facing
Roundhouse kick - a quick circle motion

What are the advantages and limitations using the mouse in such a way? Are there any examples out there? Maybe there are some limitations I'm not seeing right now? To me, this looks like a way to give players the same freedom in fighting games with keyboard + mouse as a controller would provide, so I'm surprised I don't see more fighting games with that control option.

sentences:
Water/Ocean simulation and physics I'm looking for some references about water simulation, and how to model it's interaction with bodies (like boats, ships, submarines).

I've found a lot of references on the visual aspects of water (waves, reflection, etc), but very little about how to deal with the way it should interact with bodies. My experience with game development is very limited, and I'm really stuck here.

Bascally I would like to be able to make the position of a ship variates according to the waves. How can I do this?

I'm using Panda3D, but hope to hear about techniques and implementations used in any available technology.

sentences:
Huge 2d pixelized world I would like to make a game field in a indie-strategic 2d game to be some a-like this popular picture.

So every "pixel"(blocks) changes it's color slowly, sometimes a bright color wave happens, etc, but the spaces beetwen this pixels should stay dark (not to count shades, lightning and other 3rd party stuff going on). Units are going to be same "pixelized" and should position them-selfs according those blocks.

I have some experience in game-developing, but this task seems not trivial for me. What approaches (shader, tons of sprites or code-render, i don't now) would you recommend me to follow?
(I'm thinking of making this game using Unity Engine)
Thanks everyone! :)

sentences:
Is good idea to use single threaded server for games? Also can it handle multiple clients? I was developing an game. I using single threaded nodejs(socket.io) server. It is good for simple games or games like basic 3d world? Usually game will have 10-20 players(clients).
Also is single threaded server can handle multiple clients same time?
like player 1 walks player 2 jumps same time.

sentences:
Colliders along the edge of the sprite I am trying to make a collider along the edges of my sprite, something like what an outline shader does. I tried adding a polygon collider 2D as you can see below but it doesn’t take the shape of the sprite. Any help is appreciated

https://imgur.com/a/LVsmNli

sentences:
Am I allowed to make my Minecraft clone open source? I'm developing in my spare time a game like Minecraft. In fact, it isn't "like Minecraft", because I'm trying to make it a close as possible copy of it (meant as exercise for myself at the age of 16 and simply because of it is fun to me). Of course, I'm not copying the code using the Minecraft Coder Pack (MCP). I started the game from scratch in Java using OpenGL.

So, my question is: am I allowed to put my source code online on a public source code versioning host like GitHub, Google Code, et cetera (which makes my code open source, because I don't want to pay to use a private host)? Of course, I don't want to sell the game, because the game is from Notch.

A detail which might be important is that I'm using a custom texture pack (so, not the one that is shipped with the real Minecraft).

If it is allowed, are there any rules? I took a look to this page, but it seems that he doesn't say anything about this: http://www.minecraft.net/terms

Edit: There is the game called Terasology (started under the name Blockmania) from Begla. That is a nice project, but it is not meant to be as close as possible to Minecraft. That project is open source.

sentences:
issue with Compute Shader macbeth chart I'm trying to generate a macbeth chart using the compute shader, but there seems to be an issue with the output image.

here is the glsl code:

#version 430 core

layout (local_size_x = 32, local_size_y = 32) in;

layout (rgba32f, binding=0) uniform image2D data;

uniform int factor = 2;

const float colorMatchingFunc[3][72];
const float spectralData[24][36];
void spectrumToXYZ(uint colorIndex, out vec3 XYZ);

const mat3 XYZ_TO_RGB;
const float gamma = 1;

void main(void){

    uvec2 dim = gl_NumWorkGroups.xy/factor;
    uvec2 ij = gl_WorkGroupID.xy/factor;
    uint i = ij.x + dim.x * ij.y;

    vec3 xyz;
    spectrumToXYZ(i, xyz);

    vec3 rgb =  max(vec3(0), XYZ_TO_RGB * xyz);
    rgb = pow(rgb, vec3(1/gamma));

    imageStore(data, ivec2(gl_GlobalInvocationID.xy), vec4(rgb, 1));
}

and here is the c++ setup

static int factor = 4;
static int patchSize = 32;
int width = 192 * factor;
int height = 128 * factor;
glActiveTexture(TEXTURE(_id));
glBindTexture(GL_TEXTURE_2D, _buffer);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, width, height);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glDispatchCompute(_width / (patchSize), _height / (patchSize), 1);

This setup and glsl code makes sure I get a 6 * 4 macbeth chart.

I'm assuming regardless of which invocation/workgroup I end up in I should always generate the correct color for the patch I'm currently on. but I seem to have som aliasing especially on the bottom row and its very noticable all rows on lower resolutions.

Low resolution image:

sentences:
Collision detection: Swinging bat/racket and ball I am programming a side-view tennis game, inspired by an old arcade game,
using Javscript and HTML5 canvas elements. The player can move left and right and holds a racket at arms length which can be rotated 360 degrees around the shoulder joint.

I am quite happy with the collision detection and resulting deflection angle between the racket and the ball in the case where the player stands still and the racket does not move. I use a ray-casting approach for this collision detection between the vector that represents the racket and the trajectory vector for the ball as proposed here.

However, I am having trouble implementing the collision detection between the rotating racket and the ball. When the racket is swung, the area in which a collision would apply has a shape similar to a circular segment , but the racket rotates rotates to fast and the collision detection does not pick it up in most cases.
The image bellow illustrates the problem, the red arrow indicates the direction of the swinging racket.

The following code snippet from the player entity's update function shows how the racket is updated. arcmx and armcy is the location of the shoulder joint, rstart_ and rend_ are the beginning and end of the racket.

  if(KEY_STATUS.rleft || KEY_STATUS.rright) {
    if(KEY_STATUS.rright) {
      this.rangle += this.rspeed;
    } else if (KEY_STATUS.rleft) {
      this.rangle -= this.rspeed;
    }
  }

  this.armcx = this.x + this.width/2;
  this.armcy = this.y + 46;
  this.rstartx = this.armcx + Math.cos(this.rangle)*40;
  this.rstarty = this.armcy + Math.sin(this.rangle)*40;

  this.rendx = this.armcx + Math.cos(this.rangle)*71;
  this.rendy = this.armcy + Math.sin(this.rangle)*71;

I am pretty lost on this problem and appreciate any hints on how to approach it.

sentences:
In Unity, does a reference delegate clear out when its parent GameObject is destroyed? If I have a GameObject with a component like some:

class SomeComponent : MonoBehaviour
{
    System.Action DoStuff;
}

class SomeOtherComponentInAnotherGameObject
{
    public GameObject ObjectWithThatComponent;
    void Start()
    {
        ObjectWithThatComponent.GetComponent<SomeComponent>().DoStuff += SomeFunc;

        Destroy(ObjectWithThatComponent);

        // is there still a reference to SomeComponent somewhere?
    }
}

I'm getting some odd behaviour/random crashing when deleting this stuff but I'm not sure if it's being caused by these delegates.

sentences:
Unity UI - Make text come out and go back in In Unity UI I have a TextMeshPro Button and some TextMeshPro Text like in the following image:

Is there any function in a Tween Library like DOTween that could make the text look like its coming out from the left side then going back in? (not scaling). Or without a tweening library how could this be done?
Something like:

As @DMGregory pointed out, this could be understand in two ways

coming out and in letter by letter or
smooth transition, cutting the letters.

My aim was to achieve 2) - a smooth transition.

sentences:
How to "reset" velocity.y when entering water? I'm using a raycast controller and kinematic ridigbody.

The way I've got my project set up is that I have a set of default values, such as gravity, jump height, etc., and when I enter a certain trigger, such as water, these values change (or, more specifically, I override these values temporarily).

My velocity.y += gravity * time.deltaTime, but there are some bugs if I jump into the water. For example, if I jump in from above then the velocity.y does not change in the water until I collide with the bottom of the water. Essentially it looks like I'm performing a normal jump, and only once I land will the changed gravity in the water trigger affect my movement. Also, if I jump in the water trigger from the side it sometimes propels me very high in the air.

When I print out the gravity value it does change immediately when I enter the water, but it seems the downward force from falling is never changed until I hit the bottom of the ocean floor.

public ControllerParameters2D Parameters { get { return overrideParameters
   ?? defaultParameters; } } //Returns updated parameters, or default
                             //parameters if overrideParameters is null

public void LateUpdate()
{
    JumpInSeconds -= Time.deltaTime; //Calculates how long until the player can jump again

    velocity.y += Parameters.gravity * Time.deltaTime; //Adds the force of gravity to the character's y velocity, scaled per time

    Move(Velocity * Time.deltaTime); //Moves the character per its velocity, scaled by time
}

public void OnTriggerEnter2D(Collider2D other)
{
    var newParameters = other.gameObject.GetComponent<ControllerPhysicsVolume2D>();

    if (newParameters == null)
    {
        return;
    }

    overrideParameters = newParameters.NewParameters;
}

public void OnTriggerExit2D(Collider2D other)
{
    var newParameters = other.gameObject.GetComponent<ControllerPhysicsVolume2D>();

    if (newParameters == null)
    {
        return;
    }

    overrideParameters = null;
}

sentences:
Terrain Rendering/Update Failure Python 3.x I have begun to create a procedurally generated RPG using Python, and I am having trouble with rendering the terrain.
What is happening:
I generate some terrain from some files, or create/save new terrain, and display it on the screen as a 2D B&W heightmap; black = low elevation, white = high elevation. The data are stored in .txt files, formatted as a series of arrays populated with floats.
When the game loads, the terrain is displayed properly, however, once you begin to move around, the terrain begins to act funky.

If you move far from where you start, the terrain becomes gridlike.
If you move horizontally, the terrain becomes somewhat vertically offset.
If you move vertically, the terrain does not update.
Even if you DO move horizontally before/after moving vertically, the terrain will not update vertically, only horizontally.

What I just said, but with images/video.
EDIT: I think the problem occurs in this block of code, but I can't be sure. This is taken from grid_generator.py. It returns a merged grid from the 3x3 area around a given point, where merge, loadGrid, and findAdjFnames are custom functions within grid_generator.py.
def threeBYthree(x,y):
    g = []
    for gy in range(-1,2):
        g.append([])
        for gx in range(-1,2):
            adj = findAdjFnames(x + gx,y + gy)
            print(adj)
            shouldSave = not os.path.isfile('./assets/grids/' + str(x + gx) + '_' + str(y + gy) + '.txt')
            print(shouldSave)
            g[gy + 1].append(loadGrid(str(x + gx) + '_' + str(x + gy) + '.txt', adjF = adj, andSave = shouldSave))

    #merge upper four
    g3a = merge(g[0][0],g[0][1],g[1][0],g[1][1])

    #merge bottom-left two
    g3b = []
    for y in range(len(g[2][0])):
        g3b.append(g[2][0][y] + g[2][1][y][1:])

    #merge top-right two
    g3c = []
    for y in range(len(g[0][2])+len(g[1][2])):
        if y < len(g[0][2]):
            g3c.append(g[0][2][y])
        elif y == len(g[0][2]):
            pass
        else:
            g3c.append(g[1][2][y-len(g[0][2])])

    #merge all
    g3d = merge(g3a,g3c,g3b,g[2][2])

    return g3d

The problem may occur somewhere else, but this bit is what I most recently worked on before the code stopped working.
Pastebin files:
Terrain functions: grid_generator.py
Main game loop: main_test.py
Terrain file for coordinate (0,0): 0_0.txt
NOTE: irrelevant, and some necessary, functions have been removed for privacy and security reasons. If you feel that this includes information required for a fix, please comment.

sentences:
What are 3D textures? Google has failed me, I could not find anything informative. So perhaps GameDev can :).

What are 3D textures?
When are they
used?
Performance costs?
How are they stored?

I have many vague ideas, but no 'definitive' definition.

Any references to examples or tutorials is appreciated, especially in rendering particle systems via 3D textures.

sentences:
Correct way to set up camera buffer [DirectX] I would like to play with two different implementation of particle system in my project (ok, actually not mine, but I am working on it).
I copied the particle system successfully, however, faced the camera buffer initialization problem, highlight this code:
bool ParticleShader::Render(Direct3DManager* direct, ParticleSystem* particlesystem, Camera* camera)
{
    bool result;

    result = SetShaderParameters(direct->GetDeviceContext(), camera, direct->GetWorldMatrix(), camera->GetViewMatrix(), direct->GetProjectionMatrix(), particlesystem->GetTexture());
    if (!result)
        return false;

    RenderShader(direct->GetDeviceContext(), particlesystem->GetVertexCount(), particlesystem->GetInstaceCount(), particlesystem->GetIndexCount());
    return true;
}

If I just call SetShaderParameters with the same args, there is a bug obviously: particle system scene sticks to the camera (originally, it looks like this).
I checked the params in debug mode and found out that the difference is in the World matrix. The DXUT CFirstPersonCamera is used in my project and it changed the World matrix while moving around the scene whereas in the original particle system project it's constant (identity matrix).
I understand that there is a difference between DXUT camera and the default project camera at the ideological level. Nevertheless, I am a newbie in Graphic it's too difficult to realize how to change the code in a proper way.
Thank you in advance

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

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

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

sentences:
Incosistent jump, stuttering I've written this C# code to handle movement in my testing project. The game is supposed to be 2D, some kind of a platformer, just to get me started with Unity. However, it seems there's something odd going on. The movement isn't particularly smooth (especially in Editor, it's a bit better when built and ran as .exe file) and jumping is very inconsistent, meaning sometimes it jumps to a certain height and sometimes it jumps ridiculously high. Seems random.

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    public float MaxSpeed = 10f;
    public float JumpForce = 700f;
    public Transform GroundCheck;
    public LayerMask WhatIsGround;

    bool facingRight = true;
    bool isOnGround = false;
    float groundRadius = 0.2f;

    void FixedUpdate()
    {
        isOnGround = Physics2D.OverlapCircle(GroundCheck.position, groundRadius, WhatIsGround);
        if (isOnGround && Input.GetAxis("Jump") > 0)
        {
            rigidbody2D.AddForce(new Vector2(0, JumpForce));
        }

        float move = Input.GetAxis("Horizontal") * MaxSpeed;
        rigidbody2D.velocity = new Vector2(move, rigidbody2D.velocity.y);

        if ((move < 0 && facingRight) || (move > 0 && !facingRight))
            Flip ();
    }

    void Flip()
    {
        Vector3 scale = transform.localScale;
        scale.x *= -1;
        transform.localScale = scale;

        facingRight = !facingRight;
    }
}

Can anyone tell me what's wrong? There are just two simple platforms and one character, everything done in 2D mode with 2D psychics. The funny thing is that every tutorial handles movement differently and as a beginner in game development I'm kinda baffled by it.

Oh, and the version of Unity is 4.5.3f3, if that changes anything... I'm considering trying the newest beta of 4.6 to see if it is any better, because they're bragging about the new GUI and better 2D physics..
Also, I'm using Windows 8.1.

sentences:
Top-down 2D push angle velocity I'm trying to determine the angle NPCs are pushed in when the PLAYER collides with them, like how 'Retro City Rampage' and 'Shakedown Hawaii' do when you bump in pedestrians.

Here the PLAYER (green) is coming in at an angle of -45, what's the math or formula I need to be looking at to decide the new angle each NPC (red) should adopt?

sentences:
Character on Moving Platform Shaky. How to Fix? I have an elevator (rigid body platform) that is meant to transport a character. The character (RigidBodyFPSController) shakes while platform descends.

What is an elegant way to fix their relative motions while the elevator is in motion, still allowing the character to move around in it?

NOTE: I tried parenting the character but that flips him on his side.

sentences:
Sphere and AABB intersection I'm looking for an algorithm that will determine if a sphere is in any way touching an AABB or contained within it. Profile results indicate that this specific use is taking up a large percentage of my time, so it would be nice if it was as efficient as possible.

Edit: ATM, I've got this:

        bool IntersectsAABBWithSphere(Math::AABB rhs, Physics::Sphere sphere) const {
            // http://www.gamedev.net/topic/335465-is-this-the-simplest-sphere-aabb-collision-test/
            auto aabbcenter = (rhs.BottomLeftClosest + rhs.TopRightFurthest) / 2.0f;
            auto SepAxis = sphere.origin - aabbcenter;
            auto Dist = Math::Length(SepAxis);
            SepAxis = Math::Normalize(SepAxis);
            if( SepAxis.x >= SepAxis.y && SepAxis.x >= SepAxis.z )
                SepAxis /= SepAxis.x;
            else if( SepAxis.y >= SepAxis.x && SepAxis.y >= SepAxis.z )
                SepAxis /= SepAxis.y;
            else
                SepAxis /= SepAxis.z;

            auto extents = (rhs.TopRightFurthest - rhs.BottomLeftClosest);
            SepAxis.x *= extents.x / 2.0f;
            SepAxis.y *= extents.y / 2.0f;
            SepAxis.z *= extents.z / 2.0f;

            return Dist <= (sphere.radius + Math::Length(SepAxis));
        }

My AABB's are currently represented as min/max, and my spheres as origin/magnitude.

sentences:
What does the identity matrix really do? I understand that multiplying by the identity matrix is like multiplying by 1. Why would you multiply a matrix that will only contain the same result?

Also, I'm experimenting with some OpenGL code and found some very interesting things. Like for example:

When you use setIdentity(), the image rotates slower:

Matrix.setIdentityM(mProjectionMatrix, 0);
Matrix.rotateM(mProjectionMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);

But if you try to remove the setIdentity(), the image will rotate so fast...
first it will rotate clockwise so fast, and then it will become slower until it stops and then it will begin to rotate counter clockwise, and then will stop again, then rotate clockwise.

I really don't understand how the identity matrix affects them despite multiplying by 1.

Can someone explain to me what's going on?

Here is the tutorial I am following.

sentences:
How do I destroy a Box2D body on contact without getting an IsLocked assertion error? I get this error when attempting to remove a body from the world:

  java:
  /var/lib/hudson/jobs/libgdx/workspace/trunk/gdx/jni/Box2D/Dynamics/b2World.cpp:134:
  void b2World::DestroyBody(b2Body*): Assertion 'IsLocked() == false'
  failed.

What am I doing wrong?

sentences:
Trying to find a function to calculate attribute changes in a game I'm coding a game where after every year depending on results the attributes of characters change. The game is a movie business simulator and here is a example of the ugly code I have in place now:

        if (movie.Reviews.Avg > 8.5f)
        {
            movie.Producer.Reputation += 6f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 7.5f)
        {
            movie.Producer.Reputation += 5f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 6.5f)
        {
            movie.Producer.Reputation += 4f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 5)
        {
            movie.Producer.Reputation += 1f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 4.5)
        {
            return;
        }
        else if (movie.Reviews.Avg > 4)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 6f;
            return;
        }
        else if (movie.Reviews.Avg > 3)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 5f;
            return;
        }
        else if (movie.Reviews.Avg > 2)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 4f;
            return;
        }
        else
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 3f;
            return;
        }

Few problems I have with this code:
1. Reputations balloon. Good AI producers make good choices so their movies get good reviews and their reputation goes even higher.
2. Because reputations keep growing the absolute changes in attributes get smaller and moving up in ranks gets way too slow and hard.

What I am looking from the function:
1. Range is 0-10.
2. At the top of the range growth is slow even with great reviews, but if your movie gets bad reviews the decline is sharp. And the opposite for the bottom of the range.

sentences:
2D game world engine I'am starting to develop a 2D game with snake or worm.

My question now is: When my snake reaches the right edge the world should move. (Like in this game) My first thought was to implement a camera and to create a huge image for the world. (e.g 4096 x 512). So I only have to move the camera to solve the problem.

Is that a good solution?

sentences: Which c/c++ model animation library for OpenGL I'm fairly new to game development, played around with xna before and just learning OpenGL & c now and I'm interested to know which c/c++ based model animation libraries are out there and which you would recommend? I don't have any particular model format in mind yet but probably a format that is supported by a free modelling tool like Blender.

sentences:
How can I improve the "smoothness" of a 2D side-scrolling iPhone game? I'm working on a relatively simple 2D side-scrolling iPhone game.  The controls are tilt-based.  I use OpenGL ES 1.1 for the graphics.  The game state is updated at a rate of 30 Hz... And the drawing is updated at a rate of 30 fps (via NSTimer).  The smoothness of the drawing is ok... But not quite as smooth as a game like iFighter.  What can I do to improve the smoothness of the game?

Here are the potential issues I've briefly considered:

I'm varying the opacity of up to 15 "small" (20x20 pixels) textures at a time... Apparently varying the opacity  in this manner can degrade drawing performance
I'm rendering at only 30 fps (via NSTimer)... Perhaps 2D games like iFighter are rendered at a higher frame rate?
Perhaps the game state could be updated at a faster rate?  Note the acceleration vales are updated at 100 Hz... So I could potentially update part of the game state at 100 hz
All of my textures are PNG24... Perhaps PNG8 would help (due to smaller size etc)

sentences:
Jmonkey loading texture from fails I have the following basic code:

public void simpleInitApp() {
    Box b = new Box(1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Texture cube1Tex = assetManager.loadTexture(
    "/home/glados/codes/3/assets/Textures/map/oldParchment.jpg");

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", cube1Tex);
    geom.setMaterial(mat);

    rootNode.attachChild(geom);
}

which is supposed to simply attach a texture to the cube loaded from Textures/map/oldParchment.jpg

My resource setup is as following:

running this gives the following error:

com.jme3.asset.AssetNotFoundException: /home/glados/codes/3/assets/Textures/map/oldParchment.jpg (Flipped) (Mipmapped)
    at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:283)
    at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:346)
    at com.jme3.asset.DesktopAssetManager.loadTexture(DesktopAssetManager.java:356)
    at mygame.Main.simpleInitApp(Main.java:27)
    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
    at java.lang.Thread.run(Thread.java:744)

Anybody know what I'm doing wrong?

sentences:
What is the most efficient technique for range detection? I have a bunch of patrolling enemies that fire projectiles when the player is in projectile range - a specific radius. Which method is the most efficient and elegant?

overlapSphere
sphereCast
triggers
square magnitude
anything else?

I am using Unity.

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:
How can I do real-time mesh deformation? I have a very simple problem: I have a icosphere mesh rendered with OpenGL and I want to deform/stretch it. But it has to be a real-time process because the deformation is generated when user drag'n drop a part of the mesh. The idea is to let the user models the shape like a ball of play dough.
I already tried the biharmonic deformation functionality of libigl. The results are good but the performances are terrible, far from real-time.
I also look into Bullet Physics and its soft bodies but it seems they are just elastic and return to their initial shape when you release them. I need to keep the deformed shape.
How do I  achieve this result? (I just thought of replacing my mesh with a group of rigid spheres stick together and spawning new spheres when user drag'n drop the 'volume' to extend it)
Thank for your help

sentences:
Is there a typical career path to learn game development "on the job"? The extended version of the question is: what is the typical career paths that a developer without specific experience in game development should take if he/she wishes to work in the game development industry? In other words, what are the positions such a programmer might aspire to get hired for, in the game industry?

I am asking because it seems to me that - even without direct experience with 3D modelling, physics engines, shaders, etc... - for as much complex as these topics might be - they are still "just" top layers one can learn "on the job" if he/she has already good programming skills and experience in software design (for example during peer-programming sessions).

I have no knowledge whatsoever of the game industry, so maybe I am being naïve here, but for all the other programming jobs I previously took, I learned most of the specificics while working on concrete projects... so I wonder if there is a chance to do the same with game development.

Thanks for your time and advice! :)

PS: I don't know if this is important or not for answering the question, but scripting languages are the languages I am more proficient in.

sentences:
How to convert 3D coordinates to 2D Isometric Coordinates? I wanted to make an isometric game which has a bouncing ball.

I assume that there is a way I can "show" a jumping motion in isometric, since it has been done before, but I was unable to find the maths/formulae which will help me depict this (Z-axis)motion.

If you know how i could do this please share.

Thank you :D

PS: If this sounded a bit confusing to you, just ask me in the comments.

sentences: What happens in pre production of a game? I see a lot of games in "pre-production" and was just wondering what actually happens in this stage. Is it just planning or does a prototype get made or what?

sentences:
What data structure should I use for a 3D platformer game? I am developing a platformer game with the XNA framework, like "Metroid", but in 3D. I have to draw models, and I have the question of the title. I read many posts, and I know that the main data structures for draw polygons are octrees, quadtrees, BSP and Portals; but I read and read, and I don't know what is best.

What data structure should I use for a 3D platformer game?

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:
How to rotate a direction I'm working a spotlight for my deferred renderer and I'm having trouble with matching the mesh to the visual representation of the light. Right now my mesh is a cone, the apex of the cone is at (0,0,0), it has a height of 1 and a radius of 1. The direction of this cone is (0,-1,0) when the rotation is (0,0,0).

The relevant GLSL code:

float spot_alpha = dot(-l,normalize(vec3(0,-1,0) )); // <------
float inner_alpha = cos(light.falloff);
float outer_alpha = cos(light.radius);
float spot = clamp((spot_alpha - outer_alpha) / (inner_alpha - outer_alpha),0.,1.);

As you can see, the GLSL code uses a direction to define the area to be lit, so I could get this direction as a uniform, but I would need to find a rotation from that for the mesh to follow, or I can get the rotation and find a direction, but I don't know how to do either of these things.

Can I rotate a direction? How do I do it? If I can't, is there another solution for this problem?

sentences:
.md5mesh normals are not smooth I'm currently working on a project that requires me to load .md5mesh format and draw it.

Following this link I've managed to load the mesh into the engine successfully, but a problem arises when calculating normals; they just don't seem to smooth.

To clarify that it was not my rendering or shader code that was the problem, I loaded a model of .OBJ format, and that lights smoothly.

The mesh is calculated correctly too, as I am able to load in complex models with multiple joints and mesh parts.

Here's a screenshot of the lighting.

And here is how I currently calculate the normals (All normals are set to zero before computing):

EDIT Amended the psuedo-code to be more accurate to what I have. The original may have been confusing.

for (unsigned int i = 0; i < NumberOfTriangles; i++)
{
    Math3::vec3 r, s, result;
    Math3::vec3 p1, p2, p3;

    p1 = Triangle[i].Vertex[0];
    p2 = Triangle[i].Vertex[1];
    p3 = Triangle[i].Vertex[2];

    r = p2 - p1;
    s = p3 - p1;

    result = Math3::Cross(s, r);

    // Add the triangles face normal to each vertex
    // The Vertex's are not local to the triangles.
    // Triangle[i].Vertex[j] is just an index.
    Vertex[Triangle[i].Vertex[0]].normal += result;
    Vertex[Triangle[i].Vertex[1]].normal += result;
    Vertex[Triangle[i].Vertex[2]].normal += result;
}

After the loop I normalise each vertex normal to find the average normal.

EDIT Here is how I find the average normal:

for (unsigned int i = 0; i < NumberOfVerts; i++)
{
    float nx = Vertex[i].normal.x;
    float ny = Vertex[i].normal.y;
    float nz = Vertex[i].normal.z;

    float len = sqrt(nx * nx + ny * ny + nz * nz);

    Vertex[i].normal.x /= len;
    Vertex[i].normal.y /= len;
    Vertex[i].normal.z /= len;
}

As you can see in the image the .md5mesh model is shading flat instead of shading smoothly like the .OBJ model.

So what am I missing?

sentences:
MMO, server-side line of sight I am working on a simple tile-based multiplayer game. I am rather experienced programmer, but not so experienced game developer.

The players will see each other depending if there is a blocking object between them or not. The objects can be moved around, so the map is not static.

If A moves (or performs other action) and B sees that (LOS is not blocked) then B client will be notified and will update it's view. If B does not see A, then B will not be notified.

Question:

Should I notify client A about B's movement regardless of LOS, perform all the LOS checking on the client-side and update the view accordingly, or...
should I do all the LOS server-side and notify client A only in case of visible movement?

I know than, in principle, I should not trust client-side and not send anything to the client that is not necessary (client code can be hacked and show movement out of LOS). But, if there is a significant number of players at once, then I am afraid than the server will not cope with tracking all LOS for all the events and all the players.

How to cope with this problem? Is there some "standard" solution here?
I know that it might be a premature optimization (I don't have this problem yet), but protocol and map data structure will depend on that.

P.S.

The client and the server will be open source, so hacking the client will be easy

sentences:
Game logic in mvc: model or controller? Sorry if the title is too broad, I'll try to explain this in a more specific way down here.

We need to create a board-game in Java for an University project and we have to use the mvc pattern for it.

We found helpful to view this board game as a Finite State Machine, so we implemented a slight variation of the State pattern, where the context is the Controller and each state manipulates the model in different ways using commands from the Command pattern.

The states are also responsible to get the user input needed to perform their logic from the view, by displaying widgets and getting the user selection.

So for now, the Model is just a "box", a stateless container of data without any game-logic in it. We had a discussion with our tutor and he frowned us upon because he said we were deviating from the OOP approach.
For example, we have cards in the game which give different effects; in our implementation, we have an "Effect State" which is handling the different effects by controlling their type:

if (effect.type == RESOURCE){
    Command c = new GiveResources(player, effect.resources);
    c.execute();
}else if (effect.type == BONUS_ACTION){
    controller.state = BONUS_STATE;
}...

Whereas he would so something like:

effect.execute(controller);

By passing the controller as a "callback" (forgive me the improper usage) to get inside the effect the input needed to perform its execution.

Now, I understand that our approach is violating in some way the Separations of Concerns principle, by putting game logic in the controller and outside the effects. But, considering that the set of effects is limited (that's why we chose the enum approach), isn't going back and forth between model and controller introducing way too much overhead? Or should the model "own" the game-logic (relating to this question, substituting the boolean with a State field) and call the Controller every time it needs user input?

sentences:
Collision Filtering in Box2D I have four bodies in my Box2D World.  Each are polygon shape, with some physics parameters.

Now when the game start, I need one of the bodies from the World (BodyA) to not be allowed to collide with another (BodyB).  It should be allowed to collide with others.

To clarify, BodyA and BodyB cannot collide with each other, but can collide with rest of the bodies in the Box2D world.

How could make this kind of mechanism in Box2d ?

Please help me about this query.
Thanks & Regards,

sentences:
Grouping entities of the same component set into linear memory We start from the basic systems-components-entities approach.

Let's create assemblages (term derived from this article) merely out of  information about types of components. It is done dynamically at runtime, just like we would add/remove components to an entity one by one, but let's just name it more precisely since it is only about type information.

Then we construct entities specifying assemblage for every of them. Once we create the entity, its assemblage is immutable which means we cannot directly modify it in place, but still we can obtain existing entity's signature to a local copy (along with contents), make proper changes to it, and create a new entity out of it.

Now for the key concept: whenever an entity is created, it is assigned to an object called assemblage bucket, which means that all entities of the same signature will be in the same container (e.g. in std::vector).

Now the systems just iterate through every bucket of their interest and do their job.

This approach has some advantages:

components are stored in a few (precisely: number of buckets) contiguous memory chunks - this improves memory friendliness and it is easier to dump whole game state
systems process components in a linear manner, which means improved cache coherency - bye bye dictionaries and random memory jumps
creating a new entity is as easy as mapping an assemblage to bucket and pushing back needed components to its vector
deleting an entity is as easy as one call to std::move to swap the last element with the deleted one, because order doesn't matter at this moment

If we have a lot of entities with completely different signatures, benefits of cache coherency kind of diminish, but I don't think it would happen in most applications.

There is also a problem with pointer invalidation once vectors are reallocated - this could be solved by introducing a structure like:

struct assemblage_bucket {
    struct entity_watcher {
        assemblage_bucket* owner;
        entity_id real_index_in_vector;
    };

    std::unordered_map<entity_id, std::vector<entity_watcher*>> subscribers;

    //...
};

So whenever for some reason in our game logic we want to keep track of a newly created entity, inside the bucket we register an entity_watcher, and once the entity has to be std::move'd during removal, we lookup its watchers and update their real_index_in_vector to new values. Most of the time this imposes just a single dictionary lookup for every entity deletion.

Are there any more disadvantages to this approach?

Why is the solution nowhere mentioned, despite being pretty obvious?

EDIT: I'm editing the question to "answer the answers", since comments are insufficient.

  you lose the dynamic nature of pluggable components, which was created
  specifically to get away from static class construction.

I don't. Maybe I did not explain it clearly enough:

auto signature = world.get_signature(entity_id); // this would just return entity_id.bucket_owner->bucket_signature or so
signature.add(foo_component);
signature.remove(bar_component);
world.delete_entity(entity_id); // entity_id would hold information about its bucket owner
world.create_entity(signature); // automatically assigns new entity to an existing or a new bucket

It's as simple as just taking existing entity's signature, modifying it and uploading again as a new entity. Pluggable, dynamic nature? Of course.
Here I'd like to emphasize that there is only one "assemblage" and one "bucket" class. Buckets are data-driven and created at runtime in an optimal quantity.

  you'd need to go through all buckets that might contain a valid
  target. Without an external data structure, collision detection could
  be equally as difficult.

Well, this is why we have the aforementioned external data structures.
The workaround is as simple as introducing an iterator in System class that detects when to jump to next bucket. The jumping would be purely transparent to the logic.

sentences:
How to mix pixel colors in Shader? I have a pixel that have a colour RGB. This color is calculated by the shader and can be anything.

How can I override this color by a colour I choose. If my pixel is white it's simple, I can do this:

half3 original = half3(1, 1, 1);
half3 mycolor = half3(1, 0, 0);
half3 result = original * mycolor;

But what can I do if:

half3 original = half3(0.36, 0.74, 0.18);
half3 mycolor = half3(1, 0, 0);
half3 result = ?;

What operation or function should I apply to my original pixel color to override it ?

sentences:
Child GameObject doesn't follow parent's transform Look at this picture first:

I have model that has sword in his hand. I added a cube named "Attack Collision" and located to blade position. And then set the hand to parent.

But when the game starts, sword moves but it's children "Attack Collision" doesn't move at all.

The funny thing is in the scene, I tried to move the "sword", but only it's children "Attack Collision" was moved.

Seems like the sword is somekind of locked, because it's transform can be change but not applied at all, it's just stand still there and only it's children that made from Unity was moved like this:

I made this model and animation by Blender and imported to Unity as .FBX file.

What am I missing?

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:
Checking if player is grounded using tilemap collision detection beginner here just trying to learn the basics. I was following this tutorial but I ran into some trouble. Heres a screenshot of unity

So the tutorial calls for tagging the terrain with "Grounded" and essentially checks if the 2D collision box for GroundCheck collides with anything with a "Grounded" tag using the Move2D and Grounded scripts below. Note that the Move2D script is a component of the Player gameobject.
Move2D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Move2D : MonoBehaviour
{
    public float movespeed = 5f;
    public float jumpforce = 10f;
    public bool isGrounded = false;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        Jump();
     Vector3 movement = new Vector3(Input.GetAxis("Horizontal"),0f, 0f);
     transform.position += movement * Time.deltaTime * movespeed;
    }
    void Jump(){
        if (Input.GetButtonDown("Jump") && isGrounded == true){
        gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, 5f), ForceMode2D.Impulse);
        }
    }
}

Grounded.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Grounded : MonoBehaviour
{
    public GameObject Player;
    // Start is called before the first frame update
    void Start()
    {
         Player = gameObject.transform.parent.gameObject;
    }

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

    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        if(collision.collider.tag == "Ground")
        {
            Player.GetComponent<Move2D>().isGrounded = true;
            Debug.Log("test");
            print("GROUNDED");
        }
    }

    private void OnCollisionExit2D(Collision2D collision)
    {
        if(collision.collider.tag == "Ground")
        {
            Player.GetComponent<Move2D>().isGrounded = false;
        }
    }
}

The error I'm running into is that it appears unity isn't recognizing that the player has collided with the tilemap collision box, so the bool isGrounded is just perpetually false and the player is unable to jump. Any help would be appreciated!
EDIT: below are screenshots of configs of Grid, gound, and GroundCheck in that order

sentences:
3D Texture Mapping (Atlas) This is a pretty simple question. If I was to use multiple images in a single texture for a 3D cube, how would I go about re-using each vertex (having 8 total vs 24)?
With a single buffer of 8 vertices, I don't see how I'd properly reuse the UV values.
Any help on that? I know it's not terribly clear, but I figured it was a simple question.
The 2D method is pretty easy, the next coordinates would be the same as the first (0,0 and 0,1 respectively).

However, the above 3D version has me quite befuddled.

sentences:
Physics for Android Game I'm making a 2D game for the Android phone, one that involves falling balls. I want to use a physics engine to properly simulate the balls falling and hitting other objects. I'm currently using Phys2D, but when the game runs in the emulator it doesn't look natural; slow and rough. Course, I don't know if this is because of the emulator or Phys2D seeing as how I don't own an Android phone (A real drawback not being able to test on the actual phone, I know, but I can't afford a smartphone).

Anyways, do you think the game would run faster and smoother on an actual android phone, or is it the engine I'm using, or how I'm using it. If it's the engine, any recommendations on Java physics engines?

UPDATE: If you want to test the game yourself, you can find the rough prototype here: http://bpcp.angelfire.com/BallDrop.apk

sentences:
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:
How to achieve variable jump height in an elegant and natural way I am making a platformer, with a methodical approach to player physics. This is how I do variable jump height:
if not btn() then
   g_fall *= 1.5
end

if (not is_grounded) then
   // fall gravity
   p.ay = g_fall
end

p is the player, p.ay is the acceleration.
g_fall is the constant falling gravity, which I apply to the player's acceleration if it's not on the ground. If the player isn't pressing the jump button I increase g_fall so player falls down quicker thus achieving variable jump height.
This is somewhat ok, but I have a spring where player can jump and it bounces player to the air.
hit.y = ispring.y - 2
hit.dx *= 0.2
hit.dy=-v0_jump * 1.5

hit is the player, v0_jump is the constant initial velocity I give to the player to jump.
When the player presses jump while on the spring, it jumps higher because the fall gravity is lower. But I want spring to give you the same jump height whether you press jump or not.
Now I could put a flag for spring jump and an if condition to test for spring jumps and adjust the fall gravity, but I am looking for a more elegant solution.
So what are some professional techniques for variable jump height that can solve my problem out of the box.

sentences:
How to deal with large open worlds? In most games the whole world is small enough to fit into memory, however there are games where this is not the case, how is this archived, how can the game still run fluid even though the world is so big and maybe even dynamic? How does the world change in memory while the player moves?

Examples for this include the TES games (Skyrim, Oblivion, Morrowind), MMORPGs (World of Warcraft), Diablo, Titan Quest, Dwarf Fortress, Far Cry.

sentences:
Smoothly resize minimap camera rect width and height I have an orthographic camera that is working as a mini-map. Now I want to make it resizeable using mouse drag. I have applied some UI beside my minimap camera rect and those UI resizing perfectly with this code. But I have no clue that how to resize my camera rect with mouse drag:
 void Awake()
    {
        rectTransform = transform.GetComponent<RectTransform>();
    }

    public void OnPointerDown(PointerEventData data)
    {
        if (!resizePanelFeatureActive) return;
        rectTransform.SetAsLastSibling();
        RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, data.position, data.pressEventCamera, out previousPointerPosition);
    }

    public void OnDrag(PointerEventData data)
    {
        if (!resizePanelFeatureActive) return;

        if (rectTransform == null)
            return;

        Vector2 sizeDelta = rectTransform.sizeDelta;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, data.position, data.pressEventCamera, out currentPointerPosition);
        Vector2 resizeValue = currentPointerPosition - previousPointerPosition;

        sizeDelta += new Vector2(resizeValue.x, resizeValue.y);
        sizeDelta = new Vector2(
               Mathf.Clamp(sizeDelta.x, minSize.x, maxSize.x),
               Mathf.Clamp(sizeDelta.y, minSize.y, maxSize.y)
               );

        rectTransform.sizeDelta = sizeDelta;

        previousPointerPosition = currentPointerPosition;
    }

sentences:
Drawing over objects occasionally leaving relics behind I'm drawing a large number of bouncing shapes similar to an old 1990s screensaver.  I'm just doing this to study (but not hopework)  For some reason my object clearing (simply blitting a black shape over the prior position) is missing parts of the shapes and leaving fragments behind.  I could just black the whole screen between each draw cycle and avoid this, but I want to draw over the individual shapes.  Why is this periodically missing parts of the shapes?

    from pygame.locals import *
    import pygame as pg
    from random import randint as ri
    import time

    pg.init()
    display_size = (800, 600)
    canvas = pg.display.set_mode(display_size)

    canvobj = []
    running = True

    class circle:
        def __init__(self, xpos, ypos, rad):
            self.type = 'circle'
            self.color = (ri(1,255),ri(1,255),ri(1,255))
            self.posit = (xpos, ypos)
            self.radius = rad
            self.speed = (ri(-5,5),ri(-5,5))
            self.bounce = 0
        def topygame(self):
            return (self.color, self.posit, self.radius)
        def clearit(self):
            return ((0, 0, 0), self.posit, self.radius)
        def moveit(self):
            self.posit = (self.posit[0]+self.speed[0], self.posit[1]+self.speed[1])
            return (self.color, self.posit, self.radius)

    class rect:
        def __init__(self, x, y, width, height):
            self.type = 'rect'
            self.color = (ri(1,255),ri(1,255),ri(1,255))
            self.posit = (x, y, width, height)
            self.speed = (ri(-5,5),ri(-5,5))
            self.bounce = 0
        def topygame(self):
            return (self.color, self.posit)
        def clearit(self):
            return ((0, 0, 0), self.posit)
        def moveit(self):
            self.posit = (self.posit[0]+self.speed[0], self.posit[1]+self.speed[1], self.posit[2], self.posit[3])
            return (self.color, self.posit)

     def addobjs(num, iterable):
        for x in range(num):
            iterable.append(circle(ri(1,800),ri(1,600), ri(1,50)))
        for x in range(num):
            iterable.append(rect(ri(1,800),ri(1,600), ri(1,100), ri(1,100)))

    def clearobjs(obj):
        if obj.speed[0]==0 and obj.speed[1]==0:
            obj.speed=(ri(10,20),ri(10,20))
            obj.bounce=0
        if obj.posit[1] < -100 or obj.posit[1] > 650:
            obj.bounce += 1
            obj.speed = (obj.speed[0], -obj.speed[1])
        if obj.posit[0] < -100 or obj.posit[0] > 850:
            obj.bounce += 1
            obj.speed = (-obj.speed[0], obj.speed[1])
        if x.type == 'circle':
            pg.draw.circle(canvas, *(x.clearit()))
        if x.type == 'rect':
            pg.draw.rect(canvas, *(x.clearit()))
        if x.bounce > 4:
            canvobj.remove(obj)

    def moveobjs(obj):
        if x.type == 'circle':
            pg.draw.circle(canvas, *(x.moveit()))
        if x.type == 'rect':
            pg.draw.rect(canvas, *(x.moveit()))

    starttime = time.time()

    while running:
        pg.display.flip()

        if time.time()-starttime > 1:
             starttime = time.time()
             addobjs(ri(1,3), canvobj)

        for x in canvobj:
             clearobjs(x)

        for x in canvobj:
             moveobjs(x)

        for event in pg.event.get():
            if event.type == QUIT:
                running = False
                break
            else:
                pass

        pg.time.delay(30)

    pg.quit()

sentences:
Corrupt Save File Problem Csharp Opentk I am trying to save player's objects but my loaded result is corrupt and placed in weird shapes like 3D arrows.
Weirdly enough when terrain is saved, the terrain is fine but objects added later cause the problem.
I am using OpenTK for OpenGL.
What I expect:
What I get:

The file seems to contain some repeated parts? Here is a part of the (large) file I end up with:
(0; 0; 0),(0; 0; 0),(0; 0; 1),(0; 1; 0),(1; 0; 0),(0; 0; 2),(0; 2; 0),(2; 0; 0),(0; 0; 0)

Here is my loading code:
void MapLoad(string filelocation)
{
    string[] map_;
    string line = File.ReadAllText(filelocation);//
    map_ = line.Split(new char[] { ',', ';', '(', ')' }, StringSplitOptions.RemoveEmptyEntries);

for (int xj = 0; xj < line.Split(',').Length; xj += 3)
        {
            // Here xj is an index of a X coordinate, xj + 1 is an index of a Y coordinate, xj + 2 is an index of a Z coordinate
//copied pasted for suring answer will work
         block_file.Add(new Vector3(Int32.Parse(map_[xj]), Int32.Parse(map_[xj + 1]), Int32.Parse(map_[xj + 2])));
        }

}

The Vector3 is from OpenTK.
Here is my writing code:
if(key.KeyCode == Keys.F7)
{
    File.WriteAllText("usermap.txt", String.Join(",",block_file));//new char[] { ',', ';', '(', ')'
}

sentences:
Shadow Mapping and Transparent Quads Shadow mapping uses the depth buffer to calculate where shadows should be drawn.

My problem is that I'd like some semi transparent textured quads to cast shadows - for example billboarded trees. As the depth value will be set across all of the quad and not just the visible parts it will cast a quad shadow, which is not what I want.

How can I make my transparent quads cast correct shadows using shadow mapping?

sentences: Do Google/Apple provide the multiplayer servers for an app themselves? I have an app that I have been working on and I was wondering does Google/Apple host the server requirements for the multiplayer aspects of an app?

sentences:
2d grappling hook for platformer? What are the options and mechanics for creating a grappling hook in a 2D game?

In the prototype for this feature, the person runs around in a platformer world and can throw the hook at any wall, where it sticks and shows a line to the player sprite. So that part (the easy part) is solved. But what options are available now for getting a rather good looking (not necessarily "correct") Tarzan-style grappling hook going, e.g. one allowing some kind of neat-looking swings?

(I understand several different approaches of how the mechanics could work are available; I'm looking for a simple one that may make some compromises and not be entirely physical, e.g. perhaps something which attracts the player to the hook center for a while or so while keeping to a certain rope min distance or such.)

I'm using JavaScript/ ImpactJS, by the way. Thanks!

sentences:
How do I control which calculations are done on the CPU and which are done on the GPU? My current understanding is that anything done in a shader file is done on the GPU, and anything done in my (Java, in my case) code is done on the CPU.

Is this an accurate description?

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:
High-resolution VR with tethered smartphone display I have an Android SmartPhone with a fairly high resolution + USB-C port, a USB-C-to-USB-A cable, and a Google Cardboard headset.

Is it possible to develop a VR app running on a PC game engine (such as Unreal) but stream the output to the Cardboard headset by using the phone as a display? (rather than running the app entirely on the phone). For instance, if I wanted to render using a beefy NVIDIA GPU and stream the graphics over USB.

What are the options here? I'm aware of this guide, which seems reasonable: https://uploadvr.com/budget-vr-101-get-pc-vr-streaming-phone/

Is this a use case supported by any Game Engines like Unreal/Unity?

sentences:
Box2D collision between dynamic body I'm implementing Box2D for my 2d top down LIBGDX game and i have some struggle with two dynamic body.
Currently, my two bodies are created that way :

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyType.DynamicBody;
    bodyDef.position.set(this.x, this.y);
    this.body = world.createBody(bodyDef);
    PolygonShape collider = new PolygonShape();
    collider.setAsBox(16, 16);
    FixtureDef fDef = new FixtureDef();
    fDef.density = 0f;
    fDef.friction = 0f;
    fDef.restitution = 0f;
    fDef.shape = collider;
    body.createFixture(fDef);
    body.setUserData(this);
    collider.dispose();

So basicly, no rotation, no friction and no restitution. Also, my world have a gravity of 0 (since it's a 2d top down game, i don't that want them to fall). When player 1 collide with player 2, player 2 is moved backward like it was push but i don't want that. I want it to stay where he is, blocking the path to player 1 but he can also move.

Is there a way to do that ?
I have looked for some tips like catching collision with the contact listener but i don't know what to do in the preSolve method.

I'd like some help, thanks !

sentences:
Character permanently disappears when camera zooms in I am using ThirdPersonController and FreeLookCameraRig, both from the standard assets package. The camera generally follows the player fine but there is an issue when I move the camera very close to the player. When I do this, the character disappears, though it still behaves as though it is in the scene. For example, the xyz coords still show it as being in the scene and when it jumps, the camera still follows it.

Here's a visual explanation. Notice how the character disappears after about 5-10 seconds and doesn't come back.

(Note: the gif is too large to display here, so please see it on imgur. http://i.imgur.com/PbMDlXD.gifv).

The ThirdPersonController has Transform, Animator, CapsuleCollider, Third Person User Controller, and Third Person Character

The FreeLookCameraRig has Transform, Free Look Cam, and Protect Camera From Wall.

I have tried messing with many of these settings, but nothing has worked.

By the way, some of the course was created in Sketchup.

sentences:
How do I create a 3rd person camera? I currently have a camera class set up and have my model/player loaded but I can't get my camera in the correct position by changing the x,y,z coordinates.

I have set up my "game" with a separate class for the model/player and a class for the camera. I am fairly new to XNA and most of what I have already got is from a tutorial from my lecturer.

Here is my player/model class:

public class Player
{
    public Model model;
    public Matrix world = Matrix.Identity;
    public Vector3 position;
    public Vector3 direction;
    public Quaternion rotation = Quaternion.Identity;
    public BoundingSphere collision;
    public float speed = 2f;
    public float moveForwards;
    public float moveLeft;
    public float forward;
    Matrix[] transform;

    public Player(Model m, Vector3 iPos)
    {
        model = m;
        position = iPos;
        direction = new Vector3(0, 0, 1);
        transform = new Matrix[m.Bones.Count];
        m.CopyAbsoluteBoneTransformsTo(transform);

        foreach (ModelMesh mesh in m.Meshes)
        {
            collision = BoundingSphere.CreateMerged(collision, mesh.BoundingSphere);
        }
    }

    public Player()
    {

    }

    public BoundingSphere getSphere()
    {
        return collision.Transform(world);
    }

    public void sampleInputMovement(GamePadState player)
    {
        moveForwards = (player.ThumbSticks.Left.Y / 5);
        moveLeft = (player.ThumbSticks.Left.X / 32) * -1;
    }

    public void update()
    {
        rotation *= Quaternion.CreateFromAxisAngle(new Vector3(0, 0, -1), moveLeft) * Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), moveForwards);

        Vector3 motion = Vector3.Transform(direction, rotation);
        position += motion * forward;
        world = Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(position);
    }

    public void Draw(Matrix projection, Matrix view)
    {
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.Projection = projection;
                effect.View = view;
                effect.World = transforms[mesh.ParentBone.Index] * world;
            }
            mesh.Draw();
        }
    }
}

And here is my camera class:

 public class Camera
{
    Vector3 position;
    Vector3 newposition;
    Quaternion cameraRotation;
    Vector3 targetOffset = new Vector3(0, 1f, -6f);

    public Matrix view = Matrix.Identity;
    public Matrix projection = Matrix.Identity;

    public Camera(Game game, Vector3 xPostion)
    {
        position = xPostion;

        projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, game.GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000000f);
    }

    public void update(Matrix targetWorld)
    {
        Quaternion rotation;
        Vector3 target;
        Vector3 scale;

        targetWorld.Decompose(out scale, out rotation, out target);
        cameraRotation = Quaternion.Lerp(cameraRotation, rotation, 0.15f);
        newposition = Vector3.Transform(targetOffset, targetWorld);
        position = Vector3.SmoothStep(position, newposition, 0.8f);

        Vector3 cameraup = Vector3.Transform(new Vector3(0, 1, 0), Matrix.CreateFromQuaternion(cameraRotation));
        view = Matrix.CreateLookAt(position, target, cameraup);
    }
}

Could someone help me get my camera in the correct position?

sentences: Smooth movement in a tile based game How can we make our character move smoothly across tiles? He moves tile by tile, but that looks unprofessional. In addition, when you hold down the arrow keys he zips across the screen. How can we prevent that from happening?

sentences:
Libgdx: Am I abusing Vector2? Is there a better way to do my position updates and rendering? I'm simulating hair in a game.  Currently I have a HairField object, which has a position defined by a Vector2.  Each HairField has multiple Hair objects in a list, each with a position defined by a Vector2.  Each hair has multiple HairParticle objects in a list, each with a Vector2 position.  Like so:

HairField class
    Vector2 pos;  //  In world coords
    List<Hair> hairs;

Hair class
    HairField hairField;
    Vector2 pos;  //  Relative to parent HairField
    List<HairParticle> hairParticles;

    public Vector2 getWorldPos() {
        return pos.cpy().add(hairField.getWorldPos());
    }

HairParticle class
    Hair hair;
    HairParticle parent;
    Vector2 pos;  //  Relative to parent HairParticle

    public Vector2 getWorldPos() {
        return pos.cpy().add(hair.getWorldPos());
    }

My hair physics/rendering loop looks like the following:

for each (Hair h : hairField):
    HairParticle parent = null;
    for each (HairParticle p : h):
        if (parent==null) continue;
        //  get position info from each HairParticle's getWorldPos()
        //  update p, constraining to certain distance from parent
        //  render line from parent --> p

You can see that I'm calling a metric buttload of getWorldPos() methods on the particles, all so I can have information for updating/rendering the particle.  Each of these calls involves multiple Vector2.cpy() calls and some vector math.

My question is, am I abusing Vector2's?  They make for easy math, but I'm wondering if there's some more primitive (but faster) way I should be doing things.  I've heard about transformation matrices, but don't know much about them yet (been reading).  Does Libgdx expose some quicker way to be doing this math for updating/rendering that I should be using instead?

sentences:
Cocos2D: Change animation based on joystick direction I'm trying to get my figure to look in the right directions, based on the input of the joystick. So if I tilt left it looks left and the left animation is used, if I used right, it looks right and right animation is used, if up, then up, down, down and so on. I just get animation for front and back. Also if I press up I see the back of the figure correctly, but it won't go back into the original state when I don't press up anymore.

-(void)applyJoystick:(SneakyJoystick *)aJoystick forTimeDelta:(float)
deltaTime {
    CGPoint scaledVelocity = ccpMult(aJoystick.velocity, 128.0f);
    CGPoint oldPosition = [self position];
    CGPoint newPosition =
    ccp(oldPosition.x + scaledVelocity.x * deltaTime,
    oldPosition.y + scaledVelocity.y * deltaTime);
    [self setPosition:newPosition];
    id action = nil;
   int extra = 50;
if ((int) aJoystick.degrees > 180 - extra && aJoystick.degrees < 180 + extra) {
action = [CCAnimate actionWithAnimation:walkingAnimLeft restoreOriginalFrame:NO];

} else if ((int) aJoystick.degrees > 360 - extra && aJoystick.degrees < 360 + extra) {
    action = [CCAnimate actionWithAnimation:walkingAnimRight restoreOriginalFrame:NO];
}

else if ((int) aJoystick.degrees > 90 - extra && aJoystick.degrees < 90 + extra) {
    action = [CCAnimate actionWithAnimation:walkingAnimBack restoreOriginalFrame:NO];

}
 else if ((int) aJoystick.degrees > 270 - extra && aJoystick.degrees < 270 + extra) {
action = [CCAnimate actionWithAnimation:walkingAnimFront restoreOriginalFrame:NO];
}

if (action != nil) {
[self runAction:action];
        }
    }
}

sentences:
Unable to open project from a scene.unity file The tutorial I'm following has provided its project files, and I'm trying to open them in Unity. Here is the project download link. You can also go to the tutorial webpage and scroll down to download.

I can't figure out how to do it. Here is what I've done.

a) Extract zip to my Unity Scenes/ folder.

b) Open Unity, create a new project called tutorial

c) File -> Open Scene -> navigate to Unity Scenes/voxeltut3/scene.unity

d) Click Open

It opens.. but then I don't see any of the tutorial's files in my project. There's none of the c# scripts, no art, no prefabs... It's just the original empty project that I created.

I also tried importing it as a new package:

e) Assets -> Import New Asset... -> select Unity Scenes/voxeltut3/scene.unity

f) Click Import

And nothing happens. The Import New Asset dialogbox is still open with the scene.unity selected. It's like it's telling me that I've selected an invalid file. So I guess this is wrong?

How do I open this tutorial project? I'm using unity 5.3.2

This is the folder structure the new Unity project that it created for me:

C:\Users\me\Documents\Unity Scenes

tutorial/
    Assets/
    Library/
    ProjectSettings/

I unzipped the tutorial files in

C:\Users\me\Documents\Unity Scenes

voxeltut3/
    Materials/
        tiles.mat
        tiles.mat.meta
    Block.cs
    BlockAir.cs
    BlockGrass.cs
    scene.unity
    ... (other files)

sentences:
Implementing Customizable Input I am trying to brainstorm how to create customizable input.  Any help would be greatly appreciated, but here's my best guess so far.

I could create a custom 'Input' class, with Methods to call for each input.  Like public bool IsRight()", "public bool IsJump()", etc.  Then I could call these methods from any other class.

However, I cannot figure how I would assign these different methods to different keys such that:

public bool IsRight(){
    if (keyboardState.IsKeyDown(Keys.Right)){
        return true;
        }
    return false;
}

works, but I could change the input from 'Right' to 'D', or so on.

sentences:
Drag & Drop with a verifying system with BoxCollider2D I'm really struggling to create a decent Drag & Drop system. The game idea is that the player would drag images (at the left side of the screen) to different slots (at the center) to create an allegorical car, and then the game would give a score to what the player created.

But the problem is: the gameObjects have BoxCollider2D components (both of them have the IsTrigger on) and they don't interact with each other. The item slot doesn't detect that something has been dragged into it and which image was dropped.
This is the script of the gameObjects that are being dragged:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class DragDrop : MonoBehaviour, IPointerDownHandler, IPointerClickHandler,
                    IPointerUpHandler, IPointerExitHandler, IPointerEnterHandler,
                    IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler {

[SerializeField] private Canvas canvas;
private RectTransform rectTransform;
private CanvasGroup canvasGroup;
float spawnPositionX;
float spawnPositionY;
float spawnPositionZ;
float scaleX;
bool dragging = false;

private void Awake() {

    rectTransform = GetComponent<RectTransform>();
    canvasGroup = GetComponent<CanvasGroup>();
    spawnPositionX = transform.position.x;
    spawnPositionY = transform.position.y;
    spawnPositionZ = transform.position.z;

    scaleX = transform.localScale.x;
}

public void OnBeginDrag(PointerEventData eventData) {

    Debug.Log("Drag begin!");
    canvasGroup.alpha = .6f;
    canvasGroup.blocksRaycasts = false;

    dragging = true;
}

public void OnDrag(PointerEventData eventData) {

    Debug.Log("Dragging.");

    Vector3 screenPosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, canvas.planeDistance);
    Vector3 worldPosition = Camera.main.ScreenToWorldPoint(screenPosition);
    transform.position = worldPosition;
}

public void OnEndDrag(PointerEventData eventData) {

    Debug.Log("Drag ended!");
    canvasGroup.alpha = 1f;
    canvasGroup.blocksRaycasts = true;

    dragging = false;
}

public void OnDrop(PointerEventData eventData) {

    Debug.Log("OnDrop");
}

public void Update() {

    if (dragging) {
        if (Input.GetKeyDown(KeyCode.R)) {
            scaleX = -scaleX;
            this.gameObject.transform.localScale = new Vector3(scaleX, 1f, 1f);
        }
    }
}

void OnTriggerEnter2D(Collider2D other){

    Debug.Log("Test 1.");
    if(other.gameObject.tag == "GameSlot"){
        Debug.Log("Test 2.");
        GameObject iconClone = Instantiate(gameObject, new Vector3(spawnPositionX, spawnPositionY, spawnPositionZ), Quaternion.identity, GameObject.FindWithTag("Canvas").transform);
    }else{
        Destroy(this);
    }
}

And this is the script of the slots which the images will be dragged into:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class ItemSlot : MonoBehaviour, IDropHandler {

public void OnDrop(PointerEventData eventData) {

    Debug.Log("OnDrop");

    if (eventData.pointerDrag != null) {

        eventData.pointerDrag.GetComponent<RectTransform>().anchoredPosition = GetComponent<RectTransform>().anchoredPosition;
        gameObject.GetComponent<Image>().color = new Color32(255,0,0,100);

    }
}

How do I solve this problem?

sentences:
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:
What is the integrator used in PhysX? What type of integrator is used in the PhysX engine? Euler? Runge-Kutta?

I tried to look through the comments in the SDK header and source files. But, could not find any information about this.

sentences: Altering Physics Property of a Shape in Unity I want to create say 4 blocks, and each block will dictate how e.g. the bounciness of an object landing on it will behave. So if the block is made of sand, I don't want bounciness, if the block is wood I want it to bounce, if it's ice block i want it to bounce a bit and then slide for X amount of time. How can I adjust the physics of the object landing on that block based on what block it is?

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 do you incorporate cocos2d with regular iPhone UI widgets? I want to build a sprite based game using cocos2d. I will be mostly drawing everything in code. I also want to incorporate iPhone UI widgets such as buttons and such. Can these be created to appear on top of the cocos2d canvas? Will this affect the performance of what is drawn/animated?

sentences:
Lagging problem with chunk creation in Godot We are developing a 2D game in Godot and we are stuck while trying to divide the map in chunks. Namely, the scene is a forest, where trees spawn positions were generated by noise: since the trees are too many to be loaded altogether, we created a Chunk node, which only instances trees contained in it, and gets instanced and deinstanced according to player's position. Though, this does not seem to be enough: each time a new chunk is to be instanced, we get a lag spike. How can we improve this?
This is the script attached to Chunk:

extends Node2D

var noise

func _ready():
    randomize()
    self.name=str(global_position)
    noise=get_node("/root/global").noise
    LoadTrees()

func LoadTrees():
    var x=-38
    while x<39:
        var y=-14
        while y<15:
            if noise.get_noise_2d(global_position.x+float(10*x),global_position.y+float(12*y))>0.07:
                InstanceTree(Vector2(10*x+rng.randi_range(-3,3),12*y+rng.randi_range(-3,3)),self)
            y+=1
        x+=1

func _on_Exit_body_exited(body):
    if body.name=="Player":
        call_deferred("free")

func _on_AreaLeft_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position-2*Vector2(380,0)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaRight_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position+2*Vector2(380,0)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaDown_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position+2*Vector2(0,170)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaUp_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position-2*Vector2(0,170)
        get_parent().InstanceChunk(NewChunkPos)

The functions the script calls from its parent's script go as follows:

func InstanceTree(pos,Parent):
    var tree=Tree.instance()
    tree.position=pos
    tree.name=str(global_position)+"_tree_"+str(pos)
    Parent.call_deferred("add_child",tree)

func InstanceChunk(NewChunkPos):
    if not self.has_node(str(NewChunkPos)):
        var NewChunk=Chunk.instance()
        NewChunk.global_position=NewChunkPos
        NewChunk.name=str(NewChunkPos)
        call_deferred("add_child",NewChunk)

sentences:
How to setup a particular blend state where the alpha channel is additive? I would like to set a blend state to be "additive" and do the following:

Result.R = Source.R + Destination.R;
Result.G = Source.G + Destination.G;
Result.B = Source.B + Destination.B;
Result.A = Source.A + Destination.A;

So I've tried setting a blend state to:

IsBlendEnabled = 1;
SourceBlend = BlendOption.One;
DestinationBlend = BlendOption.One;
BlendOperation = BlendOperation.Add;
SourceAlphaBlend = BlendOption.One;
DestinationAlphaBlend = BlendOption.One;
AlphaBlendOperation = BlendOperation.Add;

I was thinking it would do:

Result = Source*BlendOption.One + Destination*BlendOption.One;

But I doesn't work (I've tried so other combinations as well). The color (RGB) channels are adding up correctly but the alpha channel is not (it's not affected by the blend finally, but still not adding up). I'm drawing three overlapping quads with different colors (red, green, blue) and alpha of 0.1. But result alpha is not 0.0-0.3 (0.0 = no overlap, 0.1 = one quad, 0.2 = two quads overlap, 0.3 = three quads overlap) as I would expect.

Is it even possible to setup blend state to accumulate alpha on render target?

Note: I would like to have a color map (RGB) being mixed and alpha channel indicating how many quads are overlapping (0-3 quads => 0.0-0.3 alpha value).

sentences:
Question about Target parameter of Matrix.CreateLookAt I have a newbie question that's causing me a little bit of confusion when experimenting with cameras and reading other peoples implementations - does this parameter represent a point or a vector?

In some examples I've seen people treat it like a specific point they are looking at (eg a position in the world), other times I see people caching the orientation of the camera in a rotation matrix and simply using the Matrix.Forward property as the "target", and other times it's a vector that's the result of targetPos - camPos and also I saw a camPos + orientation.Forward

I was also just playing around with hard-coded target positions with same direction eg 1 to 10000 with no discernible difference in what I saw in the scene.

Is the "Target" parameter actually a position or a direction (irrespective of magnitude)? Are there any subtle differences in behaviors, common mistakes or gotchas that are associated with what values you provide, or HOW you provide this paramter? Are all the methods I mentioned above equivalent? (sorry, I've only recently started and my math is still catching up)

sentences:
Unity Animation (2D) - Cannot drag sprite into animation I am trying to create animations for my sprite which are configured to the "Multiple" option. When I try to drag the sprite into the timeline for the animation it won't do anything. It will just go back into the folder like nothing happened. I don't know if this is normal or there is a problem.
Thank You.
EDIT - First I created a 2D animation, I gave it a name, docked and locked the animation then tried to drag the sprite into the timeline and didn't let add components nor drag the sprite i spliced.

sentences:
Performance Issues Using Lua in C++ I'm making an engine in C++ with Lua for its scripting language (using LuaBridge as the binding).
I have a lot of entities and those entities have components. One of the components on those entities is a script component. Every time I want to call a different function from a Lua script, I always have to call luaL_dofile. If I call this with more than 20 scripts, my game takes too much time per frame reducing it to 5 FPS on my machine. Every script has an Init, FixedUpdate, Update, and Shutdown function. For every script, I call all of these functions in order.
Is there a way to reduce the latency introduced in each frame from using Lua?

Some pseudo code of my usage of LuaBridge:

    // In Update function:
    for (int i = 0; i < scripts.size(); i++)
    {
        luabridge::LuaRef func = luabridge::getGlobal(L, "Update");
        if(func.isFunction())
          func(dt);
    }

sentences:
Nvidia Nsight 4.6 VS Edition. The Graphics debugger can't find glew32.dll I'm trying to debug some textures and FBO's with Nvidia Nsight 4.6 VS Edition.
But when I select either "Start CUDA debugging" or "Start graphics debugging" I get an error.

"The program can't start because glew32.dll is missing for your computer. Try reinstalling theprogram to fix this problem"

The application runs just fine when I'm not using Nsight. What might be my problem?

My system;
Windows 7 x64 bit.
Nsight 4.6 x64 bit.
GTX 580 with lastest drivers.
OpenGL version 3.3.
Building a Win32 application. (Tried to change the build target to x64 but that just resulted in a bunch of linking errors for glfw and glew)

sentences:
Can an application break the graphics card? Quick note: I know this is a game development Q&A site but I guess you guys most of all know and have experience with graphics cards so I address this question to you. If you think this is completely off-topic, please refer me to a proper site/forum. Edit: Actually, it is gamedev-related: if a bad code can result in card overheating or breaking then game developers should be aware of that and make sure their applications don't do that.

This might seem like a weird or stupid question but is it actually possible to write such a graphics rendering application that can break the graphics card (in any way)?

The immediate reason that made me ask this question was (no surprise) my own broken graphics card. After having it repaired the serviceman said that they tested various apps (games) on it and it worked fine. But when I launched my own app (deferred shading demo) it heated it to over 100 degrees Celsius. So my card didn't turn out to be fixed after all but what's important here is that the problem seemed to only occur when running my own app.

I've played various GPU-demanding games on it (like Crysis) and often pushed it to the limit and more (had settings so high that the games ran at 5 FPS), some benchmarks as well... So I've given my card, many times, so much work-load that it couldn't catch up (hence low FPS) but it never reached dangerous temperatures. But my own application managed to achieve that (at least when the v-sync was off). :P Since it was only my own app, I don't think a bad cooling system was the culprit.

So I ask - do you think (or maybe know) whether or not it is possible to break the graphics card (in any way, not just by overheating) by some vicious code?

Update:

Joe Swindell said that overheating may be the problem (well, it definitely can break the card). But shouldn't a proper cooling system prevent that from happening (under any circumstances)?

Boreal pointed out another problem. If I understand correctly, FPS is bound by both CPU and GPU (is that right?). So low FPS might signal either high CPU load or high GPU load. But again - shouldn't a proper cooling system prevent GPU from overheating even if the card is "used at 100% all the time"?

sentences:
Unity3D - Change player input axes on trigger Hope someone can help me with this, it seems like it should be a simple problem but that only makes it more frustrating!

I have a simple game where you roll a ball around by applying force to the horizontal and vertical axes. What I want to happen is, on a trigger, the axes switch from say the X and Y, to the X and Z, changing the way the player controls without changing the input buttons... The script I use to move the player is below:

{
  float moveHorizontal = Input.GetAxis ("Horizontal");
  float moveVertical = Input.GetAxis ("Vertical");

  Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
  rb.AddForce (movement * speed);
}

(Where rb is the player ball object) - I'm thinking I'm going to have to change the way the player is controlled as I can't any reference to a 3rd axis in the Input.GetAxis documentation... any help with this would be great!

Thanks!

sentences:
Coroutine stops when Time.timeScale = 0 I have a coroutine that smoothly changes a variable in my UI, but when I pause the game, the coroutine pauses too. How can I fix that?

Code:

using UnityEngine;
using System.Collections;

public class HUDController : MonoBehaviour {
    public void PauseGame() {
        FreezeTime();
        StartCoroutine(ShowPauseMenu());
    }

    private void FreezeTime() {
        Time.timeScale = 0;
    }

    private IEnumerator ShowPauseMenu() {
        var pauseMenuCanvasGroup = GameObject.FindWithTag("PauseMenu").GetComponent<CanvasGroup>();
        var alphaValue = 1f;
        var velocity = 0f;
        var time = 0.15f;

        while (!Mathf.Approximately(pauseMenuCanvasGroup.alpha, alphaValue)) {
            pauseMenuCanvasGroup.alpha = Mathf.SmoothDamp(pauseMenuCanvasGroup.alpha, alphaValue, ref velocity, time);
            yield return null;
        }

        pauseMenuCanvasGroup.alpha = 1; // Since float is not accurate, manually set the alpha to 1
        pauseMenuCanvasGroup.interactable = true;
    }
}

sentences:
What is the difference between Quaternion.Euler and transform.Rotate? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotateObjects : MonoBehaviour
{
    public GameObject[] objectsToRotate;
    public Transform to;
    public float speed = 0.1f;
    public Vector3 spinDirection;
    public bool useMouse = false;
    public bool useQuaternion = false;
    public bool nonstopSpin = false;

    float x;

    // Use this for initialization
    void Start()
    {
        if (objectsToRotate.Length > 0)
        {
            if (useQuaternion == true)
            {
                for (int i = 0; i < objectsToRotate.Length; i++)
                {
                    objectsToRotate[i].transform.rotation = Quaternion.Lerp(objectsToRotate[i].transform.rotation, to.rotation, Time.time * speed);
                }
            }
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (objectsToRotate.Length > 0)
        {
            for (int i = 0; i < objectsToRotate.Length; i++)
            {
                x += Time.deltaTime * speed;
                objectsToRotate[i].transform.rotation = Quaternion.Euler(x, 0, 0);

                if (useMouse == true)
                {
                    if (Input.GetMouseButton(0))
                    {
                        Rotate(i);
                    }
                }
                else
                {
                    Rotate(i);
                }
            }
        }
    }

    private void Rotate(int i)
    {
        if (useQuaternion == true)
        {
            objectsToRotate[i].transform.rotation = Quaternion.Lerp(objectsToRotate[i].transform.rotation, to.rotation, Time.time * speed);
        }

        if (nonstopSpin == true)
        {
            objectsToRotate[i].transform.Rotate(0, 1, 0);
        }
    }
}

In the Update for testing I'm using Quaternion.Euler to spin the object.
In the bottom I'm using transform.Rotate.

In both cases I'm getting the same results the object is spinning around it self.

Then what is the difference between them and what should I choose when I want to spin an object ? And maybe there are more way to make an object to spin around it self. But I wonder what is the difference.

sentences:
How to disable animation root motion I downloaded some animations with root motion from Mixamo and the corresponding character model.

After created an animator with those animations and added it to the character game object, the root motion was causing the transform to move around, which was not supposed to happen.

I tried to uncheck "Apply Root Motion", and set "Motion - Root Motion Node" to "None", but neither of them worked.

The only thing that worked is checking "Loop Time - Loop Pose", but it doesn't make much sense to mess with root motion, someone even proposed it shouldn't disable root motion.

So, how to disable animation root motion?

Also I'm confused, is root motion optional? Must I get animations without root motion if it's not needed?

sentences:
Construct flow field cost map from polygon geometry I'm looking into implementing flow fields for pathing large numbers of units across a map. From what I can find, flow fields are always constructed as a grid, and require building a cost map of obstacles and terrain levels.
Edit: Pathing cost will ultimately come from a variety of sources, not only the map geometry. However, map geometry was the only piece that comes from existing geometry, as opposed to being calculated on the fly. Other sources include:

Walkable areas of the map (including slopes but excluding cliffs and canyons)
Player-constructed buildings (which must be pathed around)
Range limits (remote-control units can not stray outside the range of the nearest control tower)
Enemy attack range (resource gathering units may want to try to steer clear of the attack range of enemy towers, if possible)
Player-created waypoints (influencing the route units will take to get to a particular destination, to avoid enemy defenses or perform patrolling)

Assuming I start with map geometry (not a grid), this would seem to mean that I would need some way of rasterizing my map polygons into the cost map.
But is rasterization the best way to accomplish this? I'm assuming this is a solved problem, but have been unsuccessful in finding other options.

sentences:
Open CryEngine console from lua script Is there a function in the CryEngine Lua API to open the ~ Console?
I cannot find it in the Lua (ScriptBind) API reference.

sentences:
XNA hlsl tex2D() only reads 3 channels from normal maps and specular maps Our engine uses deferred rendering and at the main draw phase gathers plenty of data from the objects it draws.

In order to save on tex2D calls, we packed our objects' specular maps with all sorts of data, so three out of four channels are already taken. To make it clear: I am talking about the assets that come with the models and are stored in their material's Specular Level channel, not about the RenderTarget. So now I need another information to be stored in the alpha channel, but I cannot make the shader to read it properly! Nomatter what I write into alpha it ends up being 1 (255)! I tried:

saving the textures in PNG/TGA formats.
turning off pre-computed alpha in model's properties.

Out of every texture available to me (we use Diffuse map, Normal Map and Specular Map) I was only able to read alpha successfully from the Diffuse Map!

Here is how I add specular and normal maps to my model's material in the content processor:

if (geometry.Material.Textures.ContainsKey(normalMapKey))
{
    ExternalReference<TextureContent> texRef = geometry.Material.Textures[normalMapKey];
    geometry.Material.Textures.Remove("NormalMap");
    geometry.Material.Textures.Add("NormalMap", texRef);
}

...

foreach (KeyValuePair<String, ExternalReference<TextureContent>> texture
in material.Textures)
{
    if ((texture.Key == "Texture") ||
        (texture.Key == "NormalMap") ||
        (texture.Key == "SpecularMap"))
        mat.Textures.Add(texture.Key, texture.Value);
}

In the shader I obviously use:

float4 data = tex2D(specularMapSampler, TexCoords);

so data.a is always 1 in my case, could you suggest a reason?

sentences:
How to "mark" a track/ road? I'm developing a simple racing game, using Unity.
I've created a road simply applying a texture (asphalt) to a terrain .
Is it possible (and how to do) to mark that roard with an invisible marker to identifiy that as a road (so i can make appears bonus, or others similar things) ?
Which is the approach used in a racing game to accomplish that task ?
Please, don't tell me "buy a Roads assets" because i want to understand the basics, the main concept.

Thanks

sentences:
Problem with sprite direction and rotation I have a sprite called Tool that moves with a speed represented as a float and in a direction represented as a Vector2. When I click the mouse on the screen the sprite change its direction and starts to move towards the mouseclick. In addition to that I rotate the sprite so that it is facing in the direction it is heading. However, when I add a camera that is suppose to follow the sprite so that the sprite is always centered on the screen, the sprite won't move in the given direction and the rotation isn't accurate anymore. This only happens when I add the Camera.View in the spriteBatch.Begin(). I was hoping anyone could maybe shed a light on what I am missing in my code, that would be highly appreciated.

Here is the camera class i use:

    public class Camera
{
    private const float zoomUpperLimit = 1.5f;
    private const float zoomLowerLimit = 0.1f;

    private float _zoom;
    private Vector2 _pos;

    private int ViewportWidth, ViewportHeight;

    #region Properties

    public float Zoom
    {
        get { return _zoom; }
        set
        {
            _zoom = value;
            if (_zoom < zoomLowerLimit)
                _zoom = zoomLowerLimit;
            if (_zoom > zoomUpperLimit)
                _zoom = zoomUpperLimit;
        }
    }

    public Rectangle Viewport
    {
        get
        {
            int width = (int)((ViewportWidth / _zoom));
            int height = (int)((ViewportHeight / _zoom));
            return new Rectangle((int)(_pos.X - width / 2), (int)(_pos.Y - height / 2), width, height);
        }
    }

    public void Move(Vector2 amount)
    {
        _pos += amount;
    }

    public Vector2 Position
    {
        get { return _pos; }
        set { _pos = value; }
    }

    public Matrix View
    {
        get
        {
            return Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
                Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
                    Matrix.CreateTranslation(new Vector3(ViewportWidth * 0.5f, ViewportHeight * 0.5f, 0));
        }
    }

    #endregion

    public Camera(Viewport viewport, float initialZoom)
    {
        _zoom = initialZoom;
        _pos = Vector2.Zero;
        ViewportWidth = viewport.Width;
        ViewportHeight = viewport.Height;
    }

}

And here is my Update and Draw-method:

protected override void Update (GameTime gameTime)
    {
        float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
        TouchCollection touchCollection = TouchPanel.GetState ();

        foreach (TouchLocation tl in touchCollection) {
            if (tl.State == TouchLocationState.Pressed || tl.State == TouchLocationState.Moved) {

                //direction the tool shall move towards
                direction = touchCollection [0].Position - toolPos;

                if (direction != Vector2.Zero) {
                    direction.Normalize ();
                }

                //change the direction the tool is moving and find the rotationangle the texture must rotate to point in given direction
                toolPos += (direction * speed * elapsed);
                RotationAngle = (float)Math.Atan2 (direction.Y, direction.X);
            }
        }

        if (direction != Vector2.Zero) {
            direction.Normalize ();
        }

        //move tool in given direction
        toolPos += (direction * speed * elapsed);
        //change cameracentre to the tools position
        Camera.Position = toolPos;
        base.Update (gameTime);
    }

        protected override void Draw (GameTime gameTime)
    {
        graphics.GraphicsDevice.Clear (Color.Blue);
        spriteBatch.Begin (SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Camera.View);
        spriteBatch.Draw (tool, new Vector2 (toolPos.X, toolPos.Y), null, Color.White, RotationAngle, originOfToolTexture, 1, SpriteEffects.None, 1);
        spriteBatch.End ();

        base.Draw (gameTime);
    }

sentences:
How to make prefabs independent? I'm working on a Unity's Project and I want to modify a prefab, more precisely I want to change the texture of a prefab. The problem is that my modification is applied also to other prefabs. I read on the documentation how each of the buttons labeled Select, Revert and Apply works, and what I understood is that the modification should update only the selected prefab.

Here is the Prefabs' Manual which I read.

What am I missing?

PS: I'm not the author of the project, I have to apply some modifications only.

sentences:
Mesa: Howto enable OpenGL 3.x functionality via extensions? How can I enable OpenGL 3.x functionality via extensions? I'm new to OpenGL development under Linux. Currently I have:

#define GL_GLEXT_PROTOTYPES
#include <GL/osmesa.h>
#include <GL/glu.h>

My problem with Mesa and OpenGL 2.x is that I get an OpenGL "invalid value" error here:

glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, width, height, 0, GL_RGBA, GL_FLOAT, NULL );

because of GL_RGBA32F_ARB, it seems.

Background: I need the texture for a framebuffer object, and GL_RGBA32F_ARB for float data without clamping. My program works well using OpenGL 3.0 if I create the context with GLX.

sentences:
What scoring system should I use in my game? I'm trying to determine how good a player is getting throughout his gameplay and hopefully adapt the level of the game to his expertise.
Currently I have a scoring system. For example, if the player collects tokens he gets scores, if he's hit by a monster he looses score etc.

I'd like to log this score based on time(time = the amount of time passed since player started playing), and compare previous plays to the current gameplay score at any given time. If i see that the player's score is much higher than usual I'll adapt the gameplay to challenge him, and the other way around of course.

As to the question. I'm trying to understand what module would be best for:

Building the previous score per time values. For each gameplay I'll have to update the previous score per time with the new score with some mean. I'm just not sure which one I should use? (should I keep separate values of last two game plays and all the rest, and then give more weight for last games when calculating the means?)
How should I detect significants? What would be the best way to detect player is playing much better or worse?

Also, if anyone could refer me to good tutorials, essays, etc. I will be very greatful.

Thanks

sentences:
Why are my sprite outlines partially rendering in the wrong place? I've been trying to draw an outline around a sprite using the code from this answer.

Details

My sprite is called Ship2Sprite.

This is how I create the rectangle:

 rectangle = New Rectangle(backgroundPos.X + NPCAI.enemyPosistion.X,
                           backgroundPos.Y + NPCAI.enemyPosistion.Y,
                           Ship2Sprite.Width, Ship2Sprite.Height)

This is how it looks without any rectangle drawn:

If I use this line of code

hudSpriteBatch.Draw(t, rectangle, New Rectangle(0, 0, 0, 0), Color.Red,
                    NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)

the following is the result in game

hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Top, 2, rectangle.Height), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Right, rectangle.Top, 2, rectangle.Width), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, 2), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, 2), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)

However, when trying to use the code from the linked answer, this is the result:

The first and third lines produce the correct lines, however the other 2 are in the correct orientation but not the correct position

Am I missing something somewhere?

EDIT

Based on Blau's answer, I have updated my code to this:

 Public Shared Sub DrawOutline(ByVal t As Texture2D, ByVal sprite As Texture2D, ByVal pos As Vector2, ByVal graphics As GraphicsDevice)

    Dim spriteBatch1 As New SpriteBatch(graphics)
    Dim rectangle As New Rectangle(Game.backgroundPos.X + pos.X, Game.backgroundPos.Y + pos.Y, sprite.Width, sprite.Height)
    Dim w = rectangle.Width
    Dim h = rectangle.Height
    Dim x = rectangle.X + w / 2
    Dim y = rectangle.Y + h / 2
    Dim transform As Matrix = Matrix.CreateRotationZ(NPCAI.enemyAngle) * Matrix.CreateTranslation(x, y, 0)

    spriteBatch1.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Nothing, Nothing, Nothing, Nothing, transform)
    x = -w / 2
    y = -h / 2

    spriteBatch1.Draw(t, New Rectangle(x, y, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y + h - 2, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y, 2, h), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x + w - 2, y, 2, h), Nothing, Color.White)
    spriteBatch1.End()

End Sub

However the rectangle is rendering in the wrong position, which is slightly ahead of the sprite. Like this

EDIT 2, with the following code

 Public Shared Sub DrawOutline(ByVal t As Texture2D, ByVal sprite As Texture2D, ByVal pos As Vector2, ByVal graphics As GraphicsDevice, ByVal angle As Single)

    Dim spriteBatch1 = New SpriteBatch(graphics)
    Dim rectangle As New Rectangle(Game.backgroundPos.X + pos.X, Game.backgroundPos.Y + pos.Y, sprite.Width, sprite.Height)
    Dim w = rectangle.Width
    Dim h = rectangle.Height
    Dim x = rectangle.X + w / 128
    Dim y = rectangle.Y + h / 128

    Dim transform As Matrix = Matrix.CreateRotationZ(angle) * Matrix.CreateTranslation(x, y, 0)

    spriteBatch1.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Nothing, Nothing, Nothing, Nothing, transform)
    x = -w / 128
    y = -h / 128
    ' spriteBatch1.Draw(t, rectangle, Color.Red)
    spriteBatch1.Draw(t, New Rectangle(x, y, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y + h - 2, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y, 2, h), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x + w - 2, y, 2, h), Nothing, Color.White)
    spriteBatch1.End()

End Sub

sentences: Eliminate unwanted "hills" in navmesh over a flat floor So in the image below you can see that my navmesh has these weird hills being formed in it. Any way to remove these? My AI gets stuck on them.

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:
JFrame launcher stays open when I'm finished with it I have written a launcher that prompts the user for their name then starts the game when they hit enter. The launcher looks like this:

But when the user hits enter, this happens:

The launcher stays open.

This is the relevant code in the launcher class:

    public void actionPerformed(ActionEvent evt) {
        String text = textField.getText();
        System.out.println(text);
        entered=true;
        Game game = new Game();
        game.start(text);
    }

    public void Launch() {
        //Create and set up the window.

        JFrame frame = new JFrame("Login");
     // maximize the jframe here
        frame.setSize(800,600);
        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Add contents to the window.
        frame.add(new Launcher());
        //Display the window.
        frame.pack();
        frame.setVisible(true);
        while(entered==true){}
    }

And this is for the main method in the game:

    public static void main(String[] argv) {
        Launcher launcher = new Launcher();
        launcher.Launch();
    }

So how would I go about closing the launcher when the user has no use for it?

I am using a JFrame for the launcher and Lwjgl for the actual game window.

sentences:
Good example of a multi-pass effect? In XNA (and Direct3D in general AFAIK), rather than creating individual vertex and fragment shaders, you bundle potentially many related shaders into 'Effects'. When you come to use an effect you select a 'technique' (or iterate through all of them) and then each 'technique' has a number of 'passes'. You loop through the each pass it selects the relevant vertex and fragment shader and you draw the geometry.

What I'm curious about though is what you would need multiple passes for? I understand in the early days of 3d you only had one texture unit and then you had 2 and that often still wasn't enough if you also wanted to do environment mapping. But on modern devices, even in the mobile class, you can sample 8 or more textures and do as many lighting calculations as you'd want to in a single shader.

Can the more experienced here offer practical examples of where multi-pass rendering is still needed, or is this just over-engineering on the part of XNA/Direct3d?

sentences:
Use different values for Depth Test and Depth Write in OpenGL Is there a way to use something similar to PolygonOffset to make a depth test more permissive (move fragment depth towards eye) but still write the original depth value to the depth buffer? The only thing I can come up with is a tricky two pass solution using a stencil buffer, but I'd like to avoid that if possible.

Context of my question: We have an entity with a particle based smoke plume that is often in front of a semi-transparent building. Do to some constraints with batching, the building gets drawn after the smoke plume. Originally the smoke plume particles were rendered with a depth test but no depth write. This caused the building to be drawn on top of the smoke.

Turning the depth write on for the smoke particles fixes the building, but now the smoke particles interfere with each other. Ideally, I'd like to find a way for them to stop interfering while still writing to the depth buffer.

sentences:
SDL2 application occasionally refuses to close I've been working on a sliding puzzle/game of fifteen clone in SDL recently. A problem I've had is that when I close the game the app isn't always removed from the dock and I can't force quit it. It shows up in task manager, but doesn't show up in Activity Monitor so I can't quit the game from there and end up having to hard reboot.

I can't find any pattern as to why it happens some times and not others. I thought there might be something wrong with my cleanup of SDL but I can't find any problems, although I'm honestly not sure what to look for. The full source code for this project can be found here. Thank you

sentences:
Can I create a "Multiple" Sprite in C#? In the import settings for my sprite image I can select a dropdown box titled "Sprite Mode" and I can change it from Single to Multiple.

Is there any way to select "Multiple" if I'm creating a Sprite within a C# script with Sprite.Create()?

sentences:
unable to use two gestures simultaneously I have a class implementing gesture listener in libgdx. I want to use longpress gesture in one half of the screen and fling gesture in other part of the screen simultaneously.

public class FlingHandler implements GestureDetector.GestureListener{

GameWorld world;
Bmw bmw;
private float  w,h,xunit, yunit;
private float spd = 1;
private float xtouch = 0, ytouch = 0;
private float xVel = 0, yVel = 0;
private int p = 0;

public FlingHandler(GameWorld world) {
    this.world = world;
    w = SS.WIDTH;
    h = SS.HEIGHT;
    xunit = SS.x;
    yunit = SS.y;
    bmw = world.getBmw();

}
public void update(float delta){
    updateLongpress(delta);
}

public void updateLongpress(float delta){

    if(longPress(xtouch,ytouch)==true && world.getBmw().isDead()==false) {
        if(spd <1600 && Gdx.input.isTouched()){
            spd += 0.9f*delta;
            Gdx.app.log("speed ","increasing"+spd);
        }
    }

    else if(longPress(xtouch,ytouch)==false && world.getBmw().isDead()==false){

            if(spd > 1 ){
                spd -= 8f*delta;
                Gdx.app.log("speed ","decreasing"+spd);
            }
    }
    else{

    }
}

@Override
public boolean fling(float velocityX, float velocityY, int button) {
    xVel = velocityX;
    yVel = velocityY;
    xtouch=Gdx.input.getX();
    ytouch=Gdx.input.getY();
    p = button;

    if(xtouch > SS.WIDTH/2 && world.getBmw().isDead()==false) {
        if (Math.abs(xVel) > Math.abs(yVel)) {
            if (xVel > 0) {
                if (world.getBmw().getPosition().x < 8 * xunit) {
                    world.getBmw().getPosition().x += 4 * xunit;
                }
            } else if (xVel < 0) {

                if (world.getBmw().getPosition().x > 7 * xunit) {
                    world.getBmw().getPosition().x -= 4 * xunit;
                }

            } else {}

        }
        return true;
    }
    else
    return false;
}

@Override
public boolean longPress(float x, float y) {
    xtouch = Gdx.input.getX();
    ytouch = Gdx.input.getY();

    if(xtouch < SS.WIDTH/2 && world.getBmw().isDead()==false){
        return true;
    }
    else if (xtouch > SS.WIDTH/2){
        return false;
    }
    else
    return false;
}

sentences:
Should I use one line per .wav or one scene per .wav for character speech? I'm building a game in XNA and I wanted to know how I would organize the character speech portions of the game. These would include both cutscenes and anything else where characters interact.

I wanted to know if it would be more efficient to use sound file (.wav) per character line, such as:

SCENE 4: ENTERING THE CAVE

PLAYER1: Wow, this is going great! } One file called "04_PLAYER1_01.wav"
PLAYER2: I know! } A file called "04_PLAYER2_01.wav"
PLAYER1: Let's get going! } A file called "04_PLAYER1_02.wav"

I wanted to know if that would be better opposed to:

SCENE 4: ENTERING THE CAVE

PLAYER1: Wow, this is going great! }
PLAYER2: I know!                   } One file called "scene_04.wav"
PLAYER1: Let's get going!          }

I am aware that by going with option 2, you'd probably save a bit more space because you have less files (but they might be larger) but it poses the problem of coordinating it all.

I was thinking maybe XML for coordinating the speech and cutscenes, but am open to other suggestions. :)

P.S. This not intended to be a "DIALOG-TREE". These are actual models moving their lips in accordance with sound!

sentences:
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:
Increase sound tempo in Unity when new player joins in Kinect game I'm using Unity to create a Windows-build game with Kinect.

I have some drum beats, which can either be used as single sound effect or be edited to be a piece of continuous music. I want these drum beats to be the background sound of my game.

I want the drum beats to go at a constant pace, but when new users join, the beats go faster without changing its pitch.

Can I achieve this Unity with either plugin or code? Or do I need to use stuff like Max/MSP to run with Unity at the same time?

sentences:
Efficient way to avoid shadow "streaks" beyond bounds of shadow map BACKGROUND INFO:

Using MonoGame.

To maximize shadow resolution, I've got a shadow map that covers only the area closest to the camera. (I am aware of Cascading shadow maps, but for now, I am willing to simply lose shadows far away, in exchange for higher resolution near the camera.)

Specifically, I am rendering shadows of tree billboards, that are then cast on to a ground terrain.

First version worked great except for one issue. If a shadow is drawn that touches an edge of the shadow map, then that final row (or column) of pixels is REPEATED by the "Clamp" setting of the sampler. Result is a shadow "streak" that continues from the edge of map into the distance on the ground.

To eliminate those streaks, give full illumination when "outside" of shadow map,
I added test to my lookup function to return full illumination (1.0) if UV outside of valid range:

if (texCoord.x < 0 || texCoord.x > 1 || texCoord.y < 0 || texCoord.y > 1)
    return 1.0f;

... followed by the code that looks up in shadow map, returns an illumination in range 0..1.

This works.

I have two questions about this:

Is there a more efficient way to test these 4 conditions, or to avoid the need to test?
Is there an efficient way to solve this when the shadow map is created?
The sampler is set to "clamp", so if the first and last row and column of map were all "untouched" (held the default depth value or illumination value, depending on the shadowing technique), then I would not need to do any special tests when using the map; "clamp" would retrieve an edge pixel, so if those all were "untouched" by shadows, I would get the desired result.

2.b. It just occurred to me that one solution to (2) is to write the default value back into the four edge rows/columns. [after all shadows are rendered]  What is an efficient way to do that?

sentences:
Should the camera's rotation value be clamped? I noticed that when writing a camera for my 2D game that the camera rotational value of -6 and 6 is equivalent to 0.

That is, -6 = -12 = -18 = -24 = 6 = 12 = 18 = 24.

I was wondering if it was considered good practice to always keep the rotational value between -6 and 6, like so:

    public float Rotation
    {
        get
        {
            return rotation;
        }
        set
        {
            rotation = value;

            if (rotation <= -6 || rotation >= 6) rotation = 0;
        }
    }

Does it matter either way?

sentences:
Nestling into contact with a group of physics objects without exerting forces on them I'm making a pool game, and would like the circle (imaginary) to be in contact with the table and balls, and to fit perfectly as a ball would.

Now I thought I would use Rigidbody and lerp the position of the circle to the raycast hit, and its collider it would force it into a fitting position.

The problem I encountered is that since it has a collider, it also pushes the balls, which I do not want.

So my question is, how do I make an object act like it's touching & blocked by other GameObjects with Colliders and Rigidbodies, without pushing them?

sentences:
How should I resolve saved game(cloud saved progress) conflict with local game progress? I am using play game services and decided to create a small progress manager which will protect user progress. Now consider this, Player launches the game and sign in to cloud service (play game services or whatever) and sign out by mistake or intentionally. Then make some good progress as a guest player and then later choses to sign in to loud again. Should I overwrite local progress (with more coins and scores) with cloud or do vice versa? I am confused. What should I do?

The solution I came up with to ask user if they want to overwrite the data or save the current local progress to cloud but this seems more ui work and user might find it less like a game and more like a boring software.(no offence to them).

Thanks.

sentences:
Visual Design for AI i'm developing an editor for a game...

and tonight i have been thinking about implement a visual ai designer...

this is how i think it should be:

What kind of visual components are used in theses tools? (Timers, Counters, Conditionals,...)
About implementation, i'm using C# and xna, how can i save/load this graphs?

sentences:
Google play services error DEBUG: Application is pausing, which disconnects the RTMP client I am having this issue from past day with Google Play Services & Unity.

What happens is, when I install app directly ot device via Unity, the Google Play Services work fine but when I upload it as beta to play store console and install it via that then it starts to give " DEBUG: Application is pausing, which disconnects the RTMP client" error.

I have a proper SHA1 key.

sentences:
If a MMORPG does not have a limit on the number of players, will all players eventually focus on the same server? Consider a WOW-like MMORPG game. The only difference between it and WOW is that there is no limit on the number of players (Suppose that there is no limit on hardware performance and network bandwidth).

For such a game, developers can still open multiple servers for players to play.

My question is:

Assuming that the game can run steadily over a long period of time, will it eventually lead to the concentration of all players on the same server?

Whether the answer is yes or no, is there a corresponding economic, sociological and ecological model behind it?

(This may be an open question, I am not sure if I should ask questions here, but there seems to be no better place to ask. I hope that I can get some inspiration through discussion)

Thanks.

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:
How can I load and store data for a large map in Unity I'm working on a tower defense game. I have this structure:
int array (public int[,,,] gridArray = new int[2000, 2000, 9, 9];)
that I'm using as a map-bible; by map-bible I mean that the array holds all the cell data that the game uses to build its map form.
What I am specifically asking for is a way to store that data in any file format without needing to massively rework my game.
The first two dimensions of the array store x and y, while the last two dimensions hold cell-specific data. In most cases, this cell-specific data stores building health or ammo. But the vast majority of the 81 cells are empty to accommodate more things down the line. It should be noted that all this data is simply integers that are passed on to game objects, for example: newbuilding.health = gridArray [x,y,0,1];
It should be noted I am a novice level programmer and in way over my head, so detail would be appreciated.

sentences:
Where do you put assets on iOS 5.1 apps? I'm starting with iOS 5.1 and I'm trying to figure out how to download/and load asset files to the iPad, such as sprites and sounds.

Previously I think I packed them into a .xib file for iOS 3, (wasn't .xib for general user interfaces?) but I'm not sure if this practice is outdated with the new GLKit package.

sentences:
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: Keep gravity velocity the same all the time I have 2D rigidbodies that fall to the ground, however they speed up while falling. Also, when they freeze in the air and then unfreeze, the velocity is set to 0 and they gradually start speeding up again. How can I keep the velocity constant at all times, until they hit the ground?

sentences:
XNA draw texture/font and DrawIndexedPrimitives at the same time When i Draw a texture2d or a font with spriteBatch and also draw GraphicsDevice.DrawIndexedPrimitives, the frame is draw weird

SpriteBatch  spriteBatch = new SpriteBatch(GraphicsDevice);
BasicEffect basicEffect = new BasicEffect(GraphicsDevice);

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.LightSteelBlue);
    RasterizerState rasterizerState = new RasterizerState();
    rasterizerState.CullMode = CullMode.None;
    GraphicsDevice.RasterizerState = rasterizerState;

    //for(...) {
    GraphicsDevice.SetVertexBuffer(vertexBuffer);
    GraphicsDevice.Indices = indexBuffer;

    foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
    {
        pass.Apply();
        GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 8, 0, 20);
    }
    // } end for

    spriteBatch.Begin();
    spriteBatch.DrawString(MainFont, "FPS: " + Math.Round(1 / (float)gameTime.ElapsedGameTime.TotalSeconds, 2), new Vector2(200, 10), Color.Red);
    spriteBatch.End();

How can i solve this ?

sentences:
SpriteFont not found in Nuclex Framework I am using MonoGame to port my XNA Windows Phone app to iPhone. All is well except that my fonts look distorted/smudged on the iPhone.

Turns out this is due to the way that MonoGame builds the content fonts. They basically let XNA compress them, then MonoGame uncompresses them and re-compresses them again in PVRTC, this causes the distortion. The MonoGame team is aware of that, however no solution out from them yet. Other users have suggested using the Nuclex spritefont processor to bypass compression as shown here, however am unable to do that since I get the following error on build:

Error   1   Building content threw Exception: Font could not be found
   at Nuclex.Fonts.Content.FreeTypeManager.OpenWindowsFont(String searchedFaceName, FontDescriptionStyle style)
   at Nuclex.Fonts.Content.FreeTypeManager.OpenFont(String pathOrFaceName, FontDescriptionStyle style)
   at Nuclex.Fonts.Content.FreeTypeFontProcessor..ctor(FontDescription fontDescription, FontHinter hinter)
   at Nuclex.Fonts.Content.NuclexSpriteFontDescriptionProcessor.Process(FontDescription input, ContentProcessorContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
   at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings)   c:\users\ramsay\documents\visual studio 2010\Projects\MonogameContent\MonogameContent\MonogameContentContent\BoldFont.spritefont    MonogameContent

The author of the Nuclex framework explains the error

  There's no well-defined API for looking up the font names in Windows,
  so I'm checking the names embedded in the *.ttf files in the Fonts
  directory to find "Courier New" with the appropriate style flags.

So am now I have no idea how to fix this problem and am looking for any advice. It impossible to release an app with all the text looking smudged. However other MonoGame iOS apps are out there with undistorted text, so I am sure there is a solution, but I could not find it anywhere.

sentences:
Design Pattern for "Default Object" I'm making a first person dungeon crawler like Eye of the Beholder.

During execution, I have a Map object. It contains Cell objects. Anc each Cell contains, at most, four Wall objects.

The Wall object has data for it's texture, and special elements like a door, a switch, etc. But most walls will end up being empty, boring walls.

My idea is to make this "boring wall" a single instance, that is referenced by all the cells that need it. Is there any design pattern or recipe in how to work with this? Or do you have any ideas?

I would like the entity's usability to be the same as the remaining entities (although I realise the default instance must be immutable).

I don't know if it helps, but I'm working with Lua.

Thanks in advance.

sentences:
How can I remove inventory items in a Bukkit plugin? I am making a Bukkit plugin that takes the player to a "FunZone" and allows them to do just about anything. I don't want data transferred between the two worlds. So far I have got most everything stopped. Here's the problem code:

            Integer normInvSize = player.getInventory().getSize();
            Integer i = 0;
            for (i=0; i<normInvSize; i++) {
                ItemStack item = player.getInventory().getItem(i);
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".amount", item.getAmount());
                Short durab = item.getDurability();
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".durabillity", durab.intValue());
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".type", item.getTypeId());
                player.getInventory().removeItem(new ItemStack(item.getType(), item.getAmount()));
            }

I have everything set up how I want it but I get stray items following me between the worlds. The line

player.getInventory().removeItem(new ItemStack(item.getType(), item.getAmount()));

does not remove all of the inventory. I want some code that will remove all inventory items (I've handled armor already). I already have a way to restore the inventory later, but my code currently won't remove everything. For example I can end up transfering some stone tools from the "FunZone" to the normal world, which I don't want.

sentences:
Game Design Issue: Special items implementation I have a Match Two game similar to the bejeweled board. I am rewarding the player on speed of score. If he scores X in Y time , he gets a bomb. The time window is not rolling but discreat.

I check what the users score was in last X seconds after every Y seconds and reward him. The issue is the reward is a bomb which explodes 9 tiles. (I've dumbed down the score of the tiles exploded by bombs) Now that score will be counted in the next user score check and if the user made of more pair he will be given another bomb and this continues.

So once the user gets a bomb it's very easy to get it again and keep getting it. Which ruins the uniquness of the bomb. If I say hey let's not count the score because of the bomb that way the user will have to start all over again to get a bomb and if we have Z types of bombs one better than the other it would be impossible for the user to get all the bombs. If the score keeps on restarting.

I'm having a hard time finding the middle ground in it. Any ideas?

Also for special items, what seems to be better roll over time windows or static time windows?

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:
HTML5 Canvas: Get rect coords after rotation (relative to screen) update: function(delta) {
    for (var i = 0; i < this.bullets.length; i++) {
        this.bullets[i].velocity = this.bullets[i].speed * delta;
        this.bullets[i].contextX += this.bullets[i].velocity;
    }
},

draw: function(ctx) {
    for (var i = 0; i < this.bullets.length; i++) {
        ctx.save();

        // Move the context to where the player is then make it face the target degree
        ctx.translate(this.bullets[i].startX, this.bullets[i].startY);
        ctx.rotate(this.bullets[i].rotation);

        ctx.fillRect(this.bullets[i].contextX, -5, 10, 10);
        ctx.restore();
    }
}

The code above contains two methods that describe a class that manages the drawing and updating of bullets. The update method moves a bullet along and the draw function then draws it to the screen.

The canvas does the following:

Saves the current canvas context state
Moves the context to where the bullet originated from
Rotates the canvas to the way the bullet was facing when shot
Draw the rectangle
Restore the canvas context to original state

Here is an image I have made that better describes what the canvas context is doing:

So we know the x position of the bullet but this is relative to the context as it's been rotated. What I need to know is the bullet's X and Y properties in relation to the actual screen. Any ideas as to how I can do this?

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

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

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

sentences: Essential knowledge for making HTML/JavaScript-based games I was wondering if any experts out there could share the knowledge and resources of what is necessary to start making games with the latest HTML standards and JavaScript (or what some like to call HTML 5). Are there JavaScript libraries that are essential to the process? Aside from the <canvas> tag, what other pieces of HTML do we need to be aware of?

sentences:
Lateral Friction Phisics I am trying to create a physics engine for my game, and need to cancel out any lateral velocity for when entities turn. I have tried to mimic this page's example, but it is not working. I have objects sliding sideways, as if they continued to have no friction.

Could you please check my friction equation below and make sure I have the proper variables plugged into the right places? If everything checks out I can do some more intensive debugging.

Vector2d lateralnormalized = new Vector2d(1, new Angle(heading));
lateralnormalized.invert();
double dot = Vector2d.dotProduct(lateralnormalized, velocityvector);
Vector2d lateralvelocity = new Vector2d(lateralnormalized);
lateralvelocity.multiplyInline(dot);

// Multiply by mass to get impulse
lateralvelocity.multiplyInline(-1 * getMass());
applyImpulse(new Vector3d(lateralvelocity));

Vector2d(int, Angle) creates a new vector of magnitude int at angle Angle.

Vector2d.invert() rotates the vector pi/2 radians (90 degrees).

sentences:
Rotate 2d sprite towards pointer I'm using Crafty.js and am trying to point a sprite towards the mouse pointer.

I have a function for getting the degree between two points and I'm pretty sure it works mathematically (I have it under unit tests). At least it responds that the degree between { 0,0} and {1,1} is 45, which seems right.

However, when I set the sprite rotation to the returned degree, it's just wrong all the time. If I manually set it to 90, 45, etc, it gets the right direction..

I have a jsfiddle that shows what I've done so far.

Any ideas?

sentences:
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:
Unity custom font all glyphs on top of each other I'm trying to create a custom font to use (just for numbers). I've divided a 1280x512 file into a 5x2 grid of 256x256 spaces, put my custom drawing into the boxes through 0 to 9, saved it as transparent PNG. Here is a screenshot from Photoshop:

I've created a custom font, made the ASCII start offset 48, left everything default, created 10 character rects from index 0 through 9. Here is a screenshot showing everything clearly instead of writing everything one by one:

On the sixth element UV Y becomes 0, the rest goes the same.

I create a default GUI text, select my font and write 0123, but here is the result:

All the characters are on top of each other. The font is not obeying the Advance property. I've tried different values but it doesn't work for any positive value for the advance property. If I give a negative value, it works (e.g. puts the character at the right, as if I'm using a RTL language like Arabic) but of course, this is not what I want. If I type just one character it displays perfectly at the right place so I don't think there's any UV issue here. It really looks like I'm doing something wrong with the Advance value, but whatever I've tried (positive, negative, zero, huge numbers, fractions etc.) it doesn't work (with the exception of negatives that I've explained) I'm on Unity Personal 5.4.3f1.

What am I doing wrong?

UPDATE: Just updated to the new 5.5 version, still the same.

sentences:
Unity animations - Is the animation component really deprecated? I was looking for a way to create simple transform animations for 2d objects. As example, I wanted to animate all the objects of the scene when the game is paused (i.e. I just want to move the objects outside the screen boundaries with a nice animation). I think that creating an Animator Controller for something like this is not really useful for two reasons:

I don't know where the objects are at runtime. Please correct me if I'm wrong,
I think I cannot dynamically change the value of a keyframe attached to an animation controller, so if I just start a transform animation the sprite will jump at the first keyframe value and then performs the animation. Terrible result.
If I have 200 objects I should create 200 animation controllers with 200 animations.

Creating animation programmatically would be great, but I read on forums and here on stackexchange that you cannot dynamically handle keyframes... and that I HAVE to use the Animation Controller, otherwise I can use the Legacy animation system (that to me sounds so... deprecated :P)

Then I checked this page of the documentation: http://docs.unity3d.com/ScriptReference/Animation.html

They talk about the "Animation" component... and they don't say this element is Legacy/Deprecated. Looking at this page it seems that I have a lot of control over Animation actually... but know I'm completely confused! Is this component deprecated or not? Should I always use the Animation Controller instead?

sentences:
At same positioned game objects collision detection In my game, I am creating two game objects at same position using Instantiate statement. Each generated object has box collider attached.

So I want to detect collision between them so I write following code.

void OnCollisionStay(Collision collisionInfo){
   print("on collision stay");
}

But this statement not called. I generate two object using following code.

BallUtility.AddNormalCommonBall (normalBallPref, Vector3.zero);
BallUtility.AddNormalCommonBall (normalBallPref, Vector3.zero);

I need help in collision detection. I already post question in unity forum but I didn't get any reply from there.

sentences:
How do I reference a particular UI Image or Sprite in my assets folder? I have an Item class, and I want to associate an Image class with it. How do I get a reference to the intended Image, from my assets folder, in order to provide it as a reference to a constructor for Item?

Here is my code:

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

public class ItemData : MonoBehaviour
{
    private List<Item> items;

    void Start()
    {
        items = new List<Item>();

        Item sword = new Item(0, "Sword", /*What goes here?*/);
        items.Add(sword);

        Item hammer = new Item(0, "Hammer", /*What goes here?*/);
        items.Add(hammer);
    }
}

public class Item
{
    public int itemID;
    public string itemName;
    public Image itemImage;

    public Item(int newItemID, string newItemName, Image newItemImage)
    {
        itemID = newItemID;
        itemName = newItemName;
        itemImage = newItemImage;
    }
}

sentences:
How to load a simple minimap, and hide the background? I developed a small and simple 3D games minecraft style. I would add a "MiniMap". Until here everything is fine. I had the idea to load the entire map in the background, and then I added the edge of the minimap over. So I can move the map when the player moves. My problem is that I do not know how to make hidden anything above the minimap.
Have you any idea?

I'm stuck in my development

Here is a schematic of what I would do with my minimap. And hide all that is striped in red, outside the minimap.

Thank a looooot ;-)

sentences:
Implement spherical mapping for texture coordinates I am using a texture of a world map and I am trying to put that image on a sphere made up of many triangles. Each triangle has points a,b,c with their own (x,y,z) coordinates.

I am trying to use the coordinate system conversions formula from Wikipedia. This is my world to spherical coordinates function:

function worldToSpherical(p) {

  const r = Math.sqrt(Math.pow(p[0],2)+ Math.pow(p[1],2) + Math.pow(p[2],2));
  const u = Math.atan2(p[1],p[0]);
  const i = Math.atan2(Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2)),p[2]);

  const s =  r * Math.sin(i) * Math.cos(u);
  const t =  r * Math.sin(i) * Math.sin(u);
  return [s, t];

}

But this is what my output looks like:

It seems to be wrapping around twice. Am I using the wrong formula, or using it wrong?

sentences:
Zoom Layer centered on a Sprite I am in process of developing a small game where a space-ship travels through a layer (doh!), in some situations the spaceship comes close to an enemy space ship, and the whole layer is zoomed in on the two with the zoom level being dependent on the distance between the ship and the enemy. All of this works fine.

The main question, however, is how do I keep the zoom being centered on the center point between the two space-ships and make sure that the two are not off-screen?

Currently I control the zooming in the GameLayer object through the update method, here is the code (there is no layer repositioning here yet):

-(void) prepareLayerZoomBetweenSpaceship{
    CGPoint mainSpaceShipPosition  = [mainSpaceShip position];
    CGPoint enemySpaceShipPosition = [enemySpaceShip position];

    float distance = powf(mainSpaceShipPosition.x - enemySpaceShipPosition.x, 2) + powf(mainSpaceShipPosition.y - enemySpaceShipPosition.y,2);
    distance = sqrtf(distance);

    /*
        Distance > 250 --> no zoom
        Distance < 100 --> maximum zoom
     */
    float myZoomLevel = 0.5f;
    if(distance < 100){ //maximum zoom in
        myZoomLevel = 1.0f;
    }else if(distance > 250){
        myZoomLevel = 0.5f;
    }else{
        myZoomLevel = 1.0f - (distance-100)*0.0033f;
    }

    [self zoomTo:myZoomLevel];
}

-(void) zoomTo:(float)zoom {
    if(zoom > 1){
        zoom = 1;
    }

    // Set the scale.
    if(self.scale != zoom){
        self.scale = zoom;
    }
}

Basically my question is: How do I zoom the layer and center it exactly between the two ships? I guess this is like a pinch zoom with two fingers!

sentences:
Reading and writing components from multiple systems in ECS As a learning exercise, I'm building my own ECS. I've got a situation where two separate systems want to query and possibly update a Transform component - input handling and collision detection.

Given that each system operates in isolation, as if it were running in its own private thread, I'm effectively doing a concurrent update, but don't really want to block. I'm also concerned that one system might update the transform and then the next system is operating on different data.

Are these valid concern, or are the periods between updates so small that this is negligible and not worth worrying about? If valid, what are some other possible options for solving?

sentences:
Unity - Duck volume of audio source inside a boxed area I'm trying to lower the volume of an outside ambient wind sound while the player is inside a building or room. Is there any way in Unity to do this without scripting? Or would I have to script this to check whether the player is in a certain collider to duck (or lowpass filter) the sound?

The room is seamlessly in the scene's outside environment.

Any ideas on this?

sentences:
Subclasses of GameInfo and Input in UDK We have two main subclasses of GameInfo for the two game types we have. I'm wondering if it's possible to get one of these to read a different .ini file because we'd like to move a few of the controls to different buttons for that mode.

It looks to me like it's just going to read Input.ini for this, regardless of the game type.

sentences:
How do I export my Blender model to OGRE XML format for jMonkeyEngine 3? I'm an amateur software engineer with several simple 2D-game projects under my belt. I'v recently turned my attention towards creating a basic 3D game, nothing too fancy, just to get a grip on things.

I used jMonkeyEngine 3 (RC 2) because I'm interested in Java, and open-sourced games. Unfortunately, being an independent project, jME3 is not as complete as other Game Engines, and its community is not as large.

I've followed most of their basic how-to tutorials to get me started on jME3, but one area always escapes me; the use of models in a game. jME3 recommends Blender, and also recommends exporting the models as OGRE XML files.

In my experience, jME3 can import .blend files directly, but at the loss of anything other than the very basic model itself. No bones, no animation, and so far, my attempts at giving it a solid color failed as well.

I'm only interested in using and seeing my model in game, with bones, if at all possible. Animations an come later. I've followed their tutorials on how to import models here:

http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_asset

But I get stuck on "Open the menu File > Export > OgreXML Exporter to open the exporter dialog."

For one, there IS no Export to OgreXML (in Blender). I've fiddled around in the preferences and still found nothing. I've installed the required 'stuff' by going through jME3 and clicking 'install OGRE plug-ins.'

I've also tried to download a converter from Ogre itself, but all I get are some command line parameters that open CMD and close it way too fast for me to do anything.

Am I missing something?

My experience with Blender and modelling is even more limited than my experience in programming, so I don't really understand scripts, and python and whatever it is I found on the net in my research.

I used:

Blender 2.65
JMonkeyEngine 3.0 RC 2
Windows 8 (ick)

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:
What pattern is used to render tiles? I want to render a tile-based map and I am not sure which class structure to use to keep logic and rendering separeted.

My class structure so far on the logic side: One abstract parent class Tile with an attribute int tileType and one class extending Tile for every kind of tile. Every of the extending class defines the value, for example in the class Tree extends Tile I have tileType = 2 and in the class Wall extends Tile I have tileType = 3.

When I render a map, I go through the array of tiles and do something like this:

switch (tileType) {
...
case 2: texture = treeTexture; break;
case 3: texture = wallTexture; break;
...
}
draw(texture, x, y);

I wonder if the class structure makes sense and if this is a good solution to render tiles? Or what other solutions are there to render tiled maps while keeping logic and rendering separated?

sentences:
Identify objects of the same type from each other, even between game restarts? So I have a simple Character class:

class Character:

    def __init__(self, type, level, health, items=None):
        self._type = type
        self.level = level
        self.health = health
        self.items = items if items is not None else []

    def __getattr__(self, attr):
        return getattr(self._type, attr)

And a CharacterType:

class CharacterType:

    def __init__(self, name, max_level, max_health):
        self.name = name
        self.max_level = max_level
        self.max_health = health

    def new(self, *args, **kwargs):
        return Character(type=self, *args, **kwargs)

This allows me to easily spawn multiple instances of the same character type:

t_dragon = CharacterType('Dragon', 30, 2080)
t_mage = CharacterType('Mage', 100, 610)

dragon0 = t_dragon.new()
dragon1 = t_dragon.new(health=437)  # Damaged one
mage0 = t_mage.new(level=50)

But now I need to store these into a database table, and be able to somehow identify the character's type. I can't create a separate table for each type, since these types will be manageable by designers through JSON and thus new types can be added dynamically and old types be removed. So as it stands now, the above characters would populate the character table like so:

 id | level | health | type_identifier
----+-------+--------+-----------------
 0  | 0     | 2080   | ????
 1  | 0     | 437    | ????
 2  | 50    | 610    | ????

I would highly prefer if there's a solution which doesn't require the designers to have to come up with an unique ID themselves, so while something like this would work, where the designer comes up with an unique ID:

{
    "name": "Dragon",
    "max_level": 30,
    "max_health": 2080,
    "unique_id": "#dragon_2017-04-12"
}

and keeps it even if they change the character's name, it's very bothersome to have to maintain something like this in the JSON itself.

How can I get a string/integer/value to identify the character types (Python objects) from each other, in a consistent manner between server restarts, without the designer having to manually come up with an unique ID?

sentences:
PHP Browser Game Private Messages? First off, I'm asking this question here because gaming and messaging are intimately connected.  Why win if you can't gloat?  Nevertheless, I won't be offended if this needs to be moved to overflow.

I need a PM system for my browser game, which already has a user and authentication system (To clarify: the game already has a user system).  Specifically, I'm wondering if a PHP library already exists that I can use to save some time.  Better yet, if anyone knows of a nice Codeigniter library for messaging, that would be perfect.

I already have a good idea on how I would approach this if I have to write my own, but it seems like something that would already exist in a robust form (despite my failed Google searches).

Requirements:

Messages can be sent to individuals,  multiple users, and guild mates (which is essentially just multiple users with server-side selecting who to target).
Users can reply to individual or all recipients
Messages appear in sender's outbox and receiver's inbox.
Utilizes some 2-table design to handle marking read / deleting messages on a user-by-user basis
Messages are semi-threaded.  I.e. I won't necessarily have them appear in the GUI as threaded, but previous messages should be included at the bottom of a reply.  Maybe better to say, previous messages are identifiable and accessible.  (This, I'm not yet 100% sure how I would design if I write my own.  I.E. whether to include the text of the previous message into the new message or somehow remember the previous message's database ID to link later)

Technology in Use: PHP, Codeigniter, Javascript, JQuery, Ajax, Sqlite

Note:
I have seen that there are some similar questions on overflow, but they were very little help in the answer department. Otherwise, people were looking for either chat boxes or more umm.. like social media site threads, which I find a bit different than something you would find in a game.

sentences:
Why Are These 3D Square's Pixels Spaced? So i'm currently attempting to write a 3D renderer. From no prior knowledge because I want to challenge myself. But I'm stuck here, and thought I'd bring it to StackExchange because I always see brilliant solutions! If more code is needed please just ask!

This Is My Square Render Code:

public void renderSquare(int xPos, int yPos, float zPos, int width, int height, int color) {
    clearArray();

    for(int y = 0; y < height; y++ ) {
        int yy = y + yPos;

        for(int x = 0;x  < width; x++) {
            int xx = xPos + x;

            float xS = -1f, yS = -1f;

            if(xx < centerX ) {
                xS = ((xx / zPos)) + centerX;
            }else {
                xS = ((xx / zPos)) - centerX;
            }

            if(yy < centerY) {
                yS = ((yy / zPos) - 0.5f) + centerY;
            }else {
                yS = ((yy / zPos) - 0.5f) - centerY;
            }

            setPixel((int)xS, (int)yS, color);

        }
    }
}

Plus How I Set Pixels:

public void setPixel(int xPix, int yPix, int color) {
    if(xPix < 0 || xPix > width || yPix < 0 || yPix > height)
        return;
    try {
        render_buffer[xPix + yPix * width] = color;
    }catch(Exception e) {
        return;
    }
}

Any help is appreciated]1

sentences:
Implementing Achievement System in Javascript I understand that for more complex achievements, specific code can't be avoided, but for simple ones like (player clicked 100 times) or (player earned 30 bajillion cookies) or (player played for 1 hour) it should be as simple as abstracting the achievements to something like a list of properties/values and having some event handler.

My problem is that since I'm using Javascript and there's no really clean way to do pointers, how am I supposed to create an achievement class that can be iterated through procedurally?

Ideally I'd like something like this:

Achievement class:

function Achievement(name, property, value, text, points){
  this.name = name;
  this.property = property;
  this.value = value;
  this.text = text;
}

And then I'd add an achievement like so:

achievements.push(new Achievement("Clicktastic", &numClicks, 1000, "You clicked 1000 times!");

And have some kind of function bound to a Window.setInterval that was constantly looping through all achievements and for these simple types doing something like:

for (var i = 0; i < achievements.length; i++){
  if (*achievements[i].property >= achievements[i].value){
    //deal with earning achievement
  }
}

I'm just using some C style pointer/dereferencing notation here.

Basic idea is that I'm not sure how to create a generic achievement that can arbitrarily care about specific properties without pointers.

sentences:
Problems with gravity and box colliders in Unity 3D I have a game character that can jump or roll in order to avoid obstacles. He is able to roll while on the ground and he can also roll while he is in the air after jumping. Everything was working fine when I made him roll. I want to make it so that when he rolls while he's in the air after jumping, he would fall at a faster pace than if he was just falling normally. So I did this in my c# script:
IEnumerator IncGravAcc()
{
    Physics.gravity = new Vector3(0, -50f, 0);
    yield return new WaitForSeconds(2f);
    Physics.gravity = new Vector3(0, -9.8f, 0);
}

I call this coroutine in the function that runs when the down arrow is clicked. Everything is working fine. When he rolls while in the air, he falls at a faster than normal rate. However he doesn't land properly and he just falls right through the platform like it's not even there. Here's a video to show what I mean:
https://youtu.be/sirc4L3MnqM
I have a box collider, not set to isTrigger, on the player (you can see it, the green box, right underneath him in the video) and the player's also a rigidbody. The platforms don't have rigidbodies on them but they do have box colliders set to trigger. You can see the platform's box collider in the relation to player's box collider in the picture provided (the platform's box collider is the larger one of course)
How do I get it so that the character doesn't fall through? Please let me know if there's anything else you need to know about the project. Thank you for helping me!

sentences:
Reconciling Flocking and A* (Theory) For my RTS game I have got A* pathfinding working, and that's fine.  Basic collision detection exists too.  When a unit is moving it checks if the position it will occupy next move is a node occupied by another unit, and if so it finds another way to the destination.  I also think I understand the basics of flocking; that during movement it's just making sure that boids are checking the distance to their flock friends, and then correcting for this.

But I am a little confused.  Right now my pathfinding system works on a square grid of nodes, but if I'm to create a flocking system which works by taking a boid's circular footprint into account then this complicates matters, because in a tightly packed flock, or indeed a flock with a number of members with various footprint sizes, then their placement won't always match the square node grid designed for A*.

In theory, how then do a bunch of boids pack together in a ball, or flow through terrain bottlenecks (some nodes flagged unwalkable, etc) in an orderly manner?  Is this sort of behaviour emergent from a functional flocking system?

But I'm sure I'm misunderstanding this system and would like someone who understand how to implement it to explain the theory so that I can implement this myself.  I assume flocking isn't really congruent with A*: that's just used to find a path, and during movement flocking is the only way it manages collision detection and avoidance for units?  But then what about obstacles which can create bottlenecks?  How is A* and flocking reconciled?  Avoiding boids and terrain obstacles are different systems.

sentences:
Entity/Component based engine rendering separation from logic I noticed in Unity3D that each gameObject(entity) have its own renderer component, as far I understand, such component handle rendering logic.

I wonder if it is a common practice in entity/component based engines, when single entity have renderer components and logic components such as position, behavior altogether in one box?

Such approach sound odd to me, in my understanding entity itself belongs to logic part and shouldn't contain any render specific things inside.

With such approach it is impossible to swap renderers, it would require to rewrite all that customized renderers.

The way I would do it is, that entity would contain only logic specific components, like AI,transform,scripts plus reference to mesh, or sprite.
Then some entity with Camera component would store all references to object that is visible to the camera.
And in order to render all that stuff I would have to pass Camera reference to Renderer class and render all sprites,meshes of visible entities.

Is such approach somehow wrong?

sentences:
HDRP project error - unity i just created a new HDRP project and my scene is blank. Pls Help!!!
Unity view:

Error: RenderTexture.Create failed: format unsupported for random writes - RGBA16 SFloat

sentences:
iOS 9.3.5 WebSocket connection always closes with code 1006 I'm working on an app that uses a LabVIEW implemented server on the backend that is proxied via apache. It works great on desktops and android devices but on iPhone and iPad the websocket connection always fails and provides code 1006 in the close event. (No reason)

The request as received in LabVIEW:

GET /r9000_ws HTTP/1.1
Host: localhost:54663
Origin: http://192.168.1.191
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: ucoJ2G1XNSntZAOBCfG+uQ==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1
X-Forwarded-For: 192.168.1.193
X-Forwarded-Host: 192.168.1.191
X-Forwarded-Server: localhost
Upgrade: WebSocket
Connection: Upgrade

And the response I'm sending back:

HTTP/1.1 101 Switching Protocols
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Accept: NUDL0C4/691VkogIvxQRHM1xJA8=

I have tried this in both google chrome and safari on an older iPad. Unfortunately due to the fun of WebSocket security I can't get any useful information on where the failure resides. Thanks to anyone that can see what I'm missing!

sentences:
Can state setting warnings be ignored? If I am running DirectX 11 in debug mode (D3D11_CREATE_DEVICE_DEBUG), I am constantly getting these warnings:

D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM DepthStencil is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD]
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 6 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD]

It is because I am setting a resource as a render target while it is currently bound to the PS. However, my rendering flow is set up such as it relies on the api to force the resource slot to null, and it works.

Is there any reason I should be bothered with these warnings or I can rely on the api to enforce this every time? I only tested on 2 GPU-s: Intel HD 3000 and Nvidia GT525m.

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: How do I make one ui slider control all of the game audio? I use the ui slider to control how loud is the game, what I want to know is how to make one ui slider control all of the game audio?

sentences:
Avoiding particle "pop in" affect for Unity2D starfield I've adapted a 3D starfield particle system for top-down 2D use. I'm aiming for what's shown in this video, which was based on this tutorial.

I've managed to reproduce the 3D particle system and I have a top-down view working correctly.

However, I'm trying to figure out what needs to change to achieve the effect in the first video. The difference for me is that this logic randomly spawns new particles within a radius around the camera, which in 3D seems fine, as if the stars are appearing as you travel towards them. But in "2D" this breaks because the player/camera can only move in two dimensions.

I need to find a way for stars to spawn off-screen, they can't "pop in" randomly as the player moves. Unfortunately I'm not sure how the developer of that video achieved it.

using UnityEngine;
using System.Collections;

public class Starfield : MonoBehaviour {
    private Transform tx;
    private ParticleSystem particleSystem;
    private ParticleSystem.Particle[] points;

    public int starsMax;
    public float starSize;
    public float starDistance;
    private float starDistanceSqr;

    void Awake() {
        particleSystem = GetComponent<ParticleSystem>();
        tx = transform;
        starDistanceSqr = starDistance * starDistance;
    }

    void Start() {
        points = new ParticleSystem.Particle[starsMax];

        for (int i = 0; i < starsMax; i++) {
            points[i].position = Random.insideUnitSphere * starDistance + tx.position;
            points[i].color = Color.white;
            points[i].size = starSize;
        }
    }

    void Update() {
        for (int i = 0; i < starsMax; i++) {
            if ((points[i].position - tx.position).sqrMagnitude > starDistanceSqr) {
                points[i].position = Random.insideUnitSphere.normalized * starDistance + tx.position;
            }
        }

        particleSystem.SetParticles(points, points.Length);
    }
}

sentences:
What should I do when a VBO becomes too large in OpenGL? Currently I have one buffer for my vertex data and one buffer for normals data. I fill them and then pass them to OpenGL for rendering.

The problem is when I load too large mesh file like "Lucy" from Stanford

The program stops responding or the computer freezes. I allocate my buffers like that:

Vector* vertData = new Vector[numVertices];
// then fill the array with data

where numVertices = 14 027 872 in this case. That allocation doesn't throw bad_alloc exception so I guess there is nothing wrong with the allocation of memory.

I am testing the program on a x64 windows 7 platform with 4GB RAM and GTX 470 which has 1280MB of memory. Windows task managers shows that the program uses about 2GB ram when I run it.

Note that when I choose to render not all the voxels of the mesh - every 2nd for example, then I have no problems.
Maybe the GPU runs out of memory and that's why the program hangs ?

Shoud I split my mesh data into more vertex/normal buffers and then pass them to OpenGL one at a time or there is a better way to do this ?

sentences: Unity max scene limit I want to model the earth 1:1 in unity, but I can only zoom to a certain value in the scne window of unity

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:
Game Clock Precision I'm reading a fantastic article about game timer precision and here is a quote about 2/3 of the way into the article:

  If you start your game clock at about 4 billion (more precisely 2^32,
  or any large power of two) then your exponent, and hence your
  precision, will remain constant for the next ~4 billion seconds, or
  ~136 years.

He doesn't give a concrete example of this though.  Does this mean I would want to add 2^32 to the game clock value that I store at the beginning of each frame?  Or is there a way to actually set the clock in Windows so that the numbers start at 2^32?

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:
How to calculate gravity vector based on device rotation? I have basic scene where the cube sits on platform

What I want is if the device is rotated 90 degrees to the left, cube should fall down as shown below

I came up with a solution to tackle that by modifying the Physics2D.Gravity vector so it should be like following

Device rotation 0, vector(0, -9.81).
Device rotation -90, vector(-9.81, 0).
Device rotation 180, vector(0, 9.81).
And so on (Rotation would be anything between 0 to 360 degrees).

I don't know how to calculate that vector based on rotation degree.
Any suggestion is much appreciated.
Thanks

sentences:
Why is the Hiero font not coordinated to fit neatly in the display window? I imported a font with Hiero and I draw the font like:

font.draw(batch, "1", 0, 48);

This is the resultant image:

So the font it moved up to hit the bottom perfectly, but it doesn't touch the left side perfectly. Why does this happen? Is there a way I can fix this? It seems like if I set the x coordinate to -3 it works, but this seems somewhat arbitrary. Any ideas?

sentences:
How can I make a 32-bit render target with a 16-bit alpha channel in Direct3D? I want to create a render target that is 32-bit, with 16 bits each for alpha and luminance. The closest surface formats I can find in the DirectX SDK are:

D3DFMT_A8L8    // 16-bit, 8 bits each for alpha and luminance.
D3DFMT_G16R16F // 32-bit float, 16 bits for red and 16 bits for green.

But I don't think either of these will work, since D3DFMT_A8L8 doesn't have the precision and D3DFMT_G16R16F doesn't have an alpha channel (I need a separate blend state for alpha).

How can I create a render target that allows a separate blend state for luminance and alpha, with 16-bit precision on each channel, that doesn't exceed 32-bits per pixel?

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:
Unity tiles with wierd border flickering when moving horizontal 2D I recently made some Tiles using a program called Pyxel Edit to create some placeholder graphics. The problem I'm having is that when I move the camera horizontal the edge of the tiles starts to flicker, however if I move the camera vertical it wont.

This is my settings for the Tilemap, I have sliced them up inside the sprite editor.

This is a gif of what I'm talking about:

The image maybe isn't that clear but if you watch closely you can see some borders appear when I'm moving.

Do anyone know what could have caused this and what could be done to fix it?

EDIT: Second image for clarity:

sentences:
Deploying GWT application / LibGDX and TextureAtlas problem I encountered with a little problem. After GWT (and LibGDX) deployment I got an error:

  GwtApplication: exception: Couldn't load image '/images/objects.png',
  file does not exist Couldn't load image '/images/objects.png', file
  does not exist

This error throws when TextureAtlas tries to load the image from settings.text file:

  images/objects.png
  format: RGBA8888
  filter: Nearest,Nearest
  repeat: none
  hills
  rotate: false
  xy: 0, 0
  size: 1024, 146
  orig: 1024, 146
  offset: 0, 0
  index: -1

I tried to use any type of path

"/assets/images/object.png"
"/clutchkick/assets/images/object.png"
"/public_html/clutchkick/assets/images/object.png"
and so on..

Any suggestions?

By the way there are no any problems on android or desktop deployment.

EDIT:
The same problem occurs when trying to load a Tmx map.

sentences:
Is information about game assets copyrighted? Let's say I extracted some assets from a closed source game.

Am I allowed to publish information (something like a list of filenames, sizes, duration, dimensions...) about those assets?

sentences:
Keep cube spinning after fling So I've been trying to get started with game development for Android using Unity3D. For my first project I've made a simple cube that you can spin using touch. For that I have the following code:

using UnityEngine;
using System.Collections;

public class TouchScript : MonoBehaviour {

float speed = 0.4f;
bool canRotate = false;
Transform cachedTransform;

public bool CanRotate {
    get { return canRotate; }
    private set { canRotate = value; }
}

void Start () {
    // Make reference to transform
    cachedTransform = transform;
}

// Update is called once per frame
void Update () {
    if (Input.touchCount > 0) {
        Touch touch = Input.GetTouch (0);

        // Switch through touch events
        switch (Input.GetTouch (0).phase) {
        case TouchPhase.Began:
            if (VerifyTouch (touch))
                CanRotate = true;
            break;
        case TouchPhase.Moved:
            if (CanRotate)
                RotateObject (touch);
            break;
        case TouchPhase.Ended:
            CanRotate = false;
            break;
        }
    }
}

bool VerifyTouch (Touch touch) {
    Ray ray = Camera.main.ScreenPointToRay (touch.position);
    RaycastHit hit;

    // Check if there is a collider attached already, otherwise add one on the fly
    if (collider == null) gameObject.AddComponent (typeof(BoxCollider));

    if (Physics.Raycast (ray, out hit)) {
        if (hit.collider.gameObject == this.gameObject)
            return true;
    }
    return false;
}

void RotateObject (Touch touch) {
    cachedTransform.Rotate (new Vector3 (touch.deltaPosition.y, -touch.deltaPosition.x, 0) * speed, Space.World);
}

}

The above code works fine. However, I'm wondering how I can keep the cube spinning after the user lifts his finger. The user should be able to "fling" the cube, which would keep spinning and after a while would slowly come to a stop due to drag.

Should I do this using AddForce or something? I'm really new to this stuff so I'd like it if you guys could point me in the right direction here :) .

sentences:
Can one build a game based on something that already exists and make money off of it? Possible Duplicate:
  Is it legally possible to make a clone of the game?

I was planning on producing a game but then I had to stall. I have an idea to make a game, but its very similar to a game already out there. If I made my own graphics, audio and use my own code, would I be allowed to sell it?

sentences:
How do I make TextMesh Pro go invisible when at a distance from the camera? I'm building a 4x game. I've rendered the galaxy, and I want the text below each star to disappear when I'm zoomed out, so it looks nicer.

My stars are Prefabs with a star sprite and a 'UI' gameobject with TextMeshPro underneath the 'UI' gameobject.

I've put this as the script on the TextMeshPro object, but it says there is no renderer for TextMeshPro:

    Vector3 viewPos = Camera.main.WorldToViewportPoint(transform.position);
    if (viewPos.z > 100F)
    {
        this.gameObject.GetComponent<Renderer>().enabled = false;
    }

sentences:
Per instance world matrix is 0.0f/NaN I'm trying to draw some cubes with Hardware Instancing.

However they don't get displayed. So I debugged my code, and found the source of the problem:

In my VertexShader, the var that has the per instance world matrix has a value of:

{ 0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, NaN, NaN, NaN }

The weirdest thing is that it outpus NaN (Not a Number). Here's how I create my instanced buffer:

XMMATRIX trans[4];

trans[0] = XMMatrixTranslation(0.0f, 0.0f, 0.0f);
trans[1] = XMMatrixTranslation(0.5f, 0.5f, 0.5f);
trans[2] = XMMatrixTranslation(-0.5, -0.5, 0.5);
trans[3] = XMMatrixTranslation(0.5, -0.5f, 0.5);

//Store world matrices
for (int i = 0; i < 4; i++)
    XMStoreFloat4x4(&mIV[i].world, trans[i]);

D3D11_BUFFER_DESC instDesc;
ZeroMemory(&instDesc, sizeof(D3D11_BUFFER_DESC));
instDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
instDesc.Usage = D3D11_USAGE_DYNAMIC;
instDesc.ByteWidth = sizeof(XMFLOAT4X4) * 4;
instDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;

//Create instanced buffer
HR(mDevice->CreateBuffer(&instDesc, NULL, &mBoxInstB));

Here's how I map the instanced data to my buffer:

D3D11_MAPPED_SUBRESOURCE mapSub;
mContext->Map(mBoxInstB, 0, D3D11_MAP_WRITE_DISCARD, NULL, &mapSub);

VertexI* idata = reinterpret_cast<VertexI*>(mapSub.pData);

idata = mIV;

mContext->Unmap(mBoxInstB, 0);

Thanks for the help!
If you need some more info, write it in the comments!

sentences: What language was used to write Starcraft II? Total newbie question , but what language was used by blizzard to crate the Starcraft II game play? I've been playing it for the last couple of days , and I'm constantly astonished by the complexity and the performance of the game. Is it an in-house language , or do they use some flavor of a know language?

sentences:
Ambiguation between multitouch geistures tap and free drag in Windows Phone 8 Emulator (Monogame) I am making a 2d tile based tactic game. I want the map to be slided around (because it's bigger than the screen) with FreeDrag (It's perfectly done, the map can moved around, that's not the problem).

And then, I want to display the character's actions, everytime it's tapped.

The problem then appeared. Everytime I want to FreeDrag the map, the Tap trigger always fired first before the FreeDrag one. Is there any way to differ the map sliding than the character tapping? Below is my code.

while (TouchPanel.IsGestureAvailable)
{
    GestureSample gesture = TouchPanel.ReadGesture();
    switch (gesture.GestureType)
    {
        case GestureType.FreeDrag:
            {
                //a
            } break;
        case GestureType.Tap:
            {
                //b
            } break;
    }
}

Every time I first want to free drag (at the first touch), it always goes to "b" first (see commented line above), and then to "a" rather than immediately goes to "a".

I've tried flick, but it seems the movement produced by flick is too fast, so freedrag fits the most.

Is there any way or workaround to perform FreeDrag (or similar) without firing the Tap trigger?

Thanks in advance.

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:
Phaser Pulling Data from Firebase and Loading it as a sprite I am trying to pull img data from database to replace it with player sprite url.

    ionViewDidLoad() {
        this.profileData = this.fire.authState.switchMap(auth => this.db.object(`profile/${auth.uid}`).valueChanges());
        this.profileData.subscribe(profile =>{
        this.avatar = profile.avatar;
        console.log(this.avatar);//i got data(its an url string)

        });

        console.log('ionViewDidLoad ZombiePage');
        this.game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, 'game', { preload: this.preload.bind(this), create: this.create.bind(this),update:this.update.bind(this),render:this.render.bind(this) });
    console.log(window.innerHeight);

      }

    preload(){
    console.log(this.avatar); //Undefined
this.game.load.image('player', this.avatar);

Why i cant reach data from preload function ? btw im using ionic/angular framework.i combined it with phaser.

sentences:
How do I determine the distance between two points in tilemaps in unity? If I have a tilemap with multiple layers, is there any way that Unity offers to help me infer the distance between the two points?

Also, as a related question: Are there any libraries written in C# that might also perform this logic, but without coupling to anything that might exist in Unity?

I'm specifically interested in specialized types or operations that can be performed on some kind of three dimensional array that I've loaded ahead of time.

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:
Wall detection in maze game - On the fly or precomputed? I've been a programmer for over a decade, professionally for the last five years, but I've never really done any games programming. I've had a look at some tutorials but most of what I've found is geared towards people with no programming experience, so I've tended to get bored and moved on. So, after grasping the basics of the game loop, I've decided to dive right in.

As my first project I am programming a basic 2D top down maze game (a Pac Man clone). I've got all the basics working fine, and am now thinking about optimizations. I have an idea to improve the performance of my wall collision detection but I'm interested to know the 'proper' way of doing it.

At the moment my algorithm is basically:

Check direction player wants to move in
Loop through all walls and see if any are at that position
If there are no walls, move the player

This is working fine, but I imagine if I scale it up that the act of looping through all the walls each time will become an issue. Due to the simplicity of the game and the speed of modern computers, it might not ever be noticeable, but I'd rather be using the cycles for something else.

So it occurs to me that as this data is never changing, I could just build a lookup table as part of my map creation within my level editor. I've heard about similar things being done for more complex 3D games. I would then have a lookup table that stored each possible player position, each possible direction, and whether the player can move there. This means that on each move, I can just do a quick check to the lookup table to see if the move is possible, rather than repeatedly looping through a load of static data every single frame.

Is this a common thing to do? Or are neither of these approaches any use, in which case what is the best way to handle this?

sentences: What AI modding is possible in Civ 5? I'm interested in tinkering with the AI in Civ 5.  I know there are XML files that can adjust the AI's strategies, but are there other easily moddable AI components?  The XML files contain comments that reference some CPP files, are those available to end users or are those comments just aimed at internals?

sentences:
UE 4.25 - Can't create EQS assets Like the title says I am unable to create EQS assets. I am running 4.25 and there is no option in the BT details panel, nor under "Add assets -> AI". AND there is no option to activate it. Neither under settings or under plugin. Nothing.
What am I doing wrong? See screenshots and thanks in advance

sentences:
Make a background Image to fit multiple objects? In the Hierarchy, I have a GameObject named "Buttons" to which I added an  Image component.

I would like that the ok sprite to cover (be background of) all the buttons: START GAME, OPTIONS, CREDIT and EXIT.

But the ok sprite is somewhere in the top left corner behind the START GAME button on its left side and is very small.
This happened when I clicked in the Inspector in Image on Set Native Size.

I want to make it big enough to cover all the buttons but I'm not sure how.

sentences:
How do I load chunks of data from an assest manager during a loading screen? I'm developing an Android game.  Basically I want to pre-load all graphics/sounds when the app is first loaded.  But I also would like to show a progress bar as this is happening.  Here is a snippet of Java/Android code to display a progress bar while doing some work:

public class LoadingScreen extends Activity {

private static int progress = 0;
private ProgressBar progressBar;
private int progressStatus = 0;
private Handler handler = new Handler();

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.loadingscreen);

    progressBar = (ProgressBar) findViewById(R.id.progress);

    //---do some work in background thread---
    new Thread(new Runnable()
    {
        public void run()
        {
            while (progressStatus < 100)
            {
                progressStatus = doSomeWork();

                //---Update the progress bar---
                handler.post(new Runnable()
                {
                    public void run() {
                        progressBar.setProgress(progressStatus);
                    }
                });

            }
            //---hides the progress bar---
            handler.post(new Runnable()
            {
                public void run() {
                    progressBar.setVisibility(8);
                }
            });
        }

        private int doSomeWork()
        {
            try
            {
                //---simulate doing some work---
                Thread.sleep(50);
            } catch (InterruptedException e)
            {

            }
            return ++progress;
        }

    }).start();

}

My question is: how do I design my Asset Manager to load "chunks" of data (bitmaps and sounds/music) in the doSomeWork() function?  Would it be some sort of stack that I keep popping off the next asset to load?  How do I determine how much of the progress bar I should increment after loading a "chunk" of data?

Is there a better way to approach this or is this the correct way?

sentences:
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:
How can I make a sprite based animation using Cocos2d JS? I am learning Cocos2d JS, but I can find very few tutorials and I find the documentation very vague. I can put a simple image on a layer like this:

var sprite = new cc.Sprite(res.my_image_png);
sprite.setAnchorPoint(0.5, 0.5);
sprite.setPosition(cc.winSize.width / 2, cc.winSize.height / 2);
this.addChild(sprite);

I can also move it like this:

var actionTo = cc.moveTo(2.5, cc.p(100, 100).easing(cc.easeInOut(1));

sprite.runAction(
    new cc.Sequence(
        actionTo,
        new cc.CallFunc(
            function() {
                cc.log("Animation complete");
            },
            this
        )
    )
);

How could I improve this code to also show some sprite-based animation? I would like to exchange the sprite image every 0.25 seconds. What is the designed way to do that in Cocos2d JS?

sentences:
Audio Engines , do they work on CPU, GPU or DSP I have been reading design specifications of the audio engines. What I am trying to achieve requires performance and I want to parallelize.

Only and only while reading openAL specification it was mentioned very very shortly that if hardware supports than openAL will use DSP as well.

But I am curious for other engines as well and couldn't find information for wwise for example.

In general do audio engine takes advantage of DSP or even GPU maybe ?

sentences:
How do I make my character slide down high-angled slopes? I am currently working on my character's movement in Unity3D. I managed to make him move relatively to the mouse cursor.
I set a slope limit of 45°, which does not allow the character to walk up the mountains with higher degrees. But he can still jump them up.

How do I manage to make him slide down again when he jumped at places with too high slope?

Thanks in advance.

edit: Code snippet of my basic movement.
    using UnityEngine;
    using System.Collections;

public class BasicMovement : MonoBehaviour {
    private float speed;
    private float jumpSpeed;
    private float gravity;
    private float slopeLimit;
    private Vector3 moveDirection = Vector3.zero;

    void Start()
    {
        PlayerSettings settings = GetComponent<PlayerSettings>();
        speed = settings.GetSpeed();
        jumpSpeed = settings.GetJumpSpeed();
        gravity = settings.GetGravity();
        slopeLimit = settings.GetSlopeLimit();
    }

    void Update() {
        CharacterController controller = GetComponent<CharacterController>();
        controller.slopeLimit = slopeLimit;

        if (controller.isGrounded) {
            moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
            moveDirection = transform.TransformDirection(moveDirection);
            moveDirection *= speed;

            if (Input.GetButton("Jump")) {
                moveDirection.y = jumpSpeed;
            }

        }
        moveDirection.y -= gravity * Time.deltaTime;
        controller.Move(moveDirection * Time.deltaTime);
    }
}

sentences:
Can applications using old versions of Opengl still run on newer cards? OpenGl 3.0 and up has a quite big difference from the older versions like OpenGl 2.x and opengl 1.x in terms of implementation, does that mean applications which are written with the old versions of opengl won't run on computers having video cards supporting Opengl 3.x and up?

Sorry, if this is not the right place to ask this.

Thanks.

sentences:
How to get an affect for balloon bursting in XNA? I am a noob in XNA. I want to create an effect which shows a balloon bursting?

Any pointers would be highly appreciated.

sentences:
Disable audio listener warnings? "There are no audio listeners...", "There are 2 audio listeners..." The scene I'm working in constantly spams the message There are no audio listeners in the scene. Please ensure there is always one audio listener in the scene. If I add a dummy camera with an Audio Listener, I then get There are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.

I know this happens because our camera is created programmatically, with an audio listener.  I also realize this will not affect the non-development build in any way.

Is it possible to disable these warnings completely?

sentences:
how taxes work on steam? I have been developing a game for some time thinking of distributing it on steam.

I had a question about taxes. And is that since I am not a resident of the United States, I made my tax questionnaire and I have a 10% rate for the sale of video games due to the treaty with my country.

And was I reading that every country has a tax? special? (VAT) or something like that, for example United Kingdom 20%

Which means that if I sell a game of 10 (€) I think this should happen

Scenario 1:

1 Unit Sale  ---  10.00 €
- (VAT)            1.66 €
-------------------------
Sale w/o VAT       8.33 €
- Steam 30%        2.50 €
-------------------------
S w/o Steam cut    5.83 €
- ISR USA (10%)    0.58 €
-------------------------
Sale revenue       5.25 €  (Less taxes from my country later calculated, this amount is the one deposited by steam)

Scenario 1 considers that each subtraction is made on a non-total balance

Or

Scenario 2:

The percentage is fixed on the total sale

1 Unit Sale  ---  10.00 €
- (VAT)            1.66 €
- Steam 30%        3.00 €
- ISR USA (10%)    1.00 €
-------------------------
Sale revenue       4.33 € (Less taxes from my country later calculated, this amount is the one deposited by steam)

Does anyone know how this situation is handled ?, or where could I get more information?

sentences:
How to remove fragment from VAO? I have the OpenGL VAO object (~40K) to draw the 3D scene

glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 4, GL_UNSIGNED_BYTE, nullptr);
glBindVertexArray(0);

To add some data I can use glMapBuffer:

GLuint buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, (2 * steps) * sizeof(float),
     NULL, GL_STATIC_DRAW);
float *data = (float *) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
myFuncAddingData(data,{2.4f, 40.0f, 19.0f});
glUnmapBuffer(GL_ARRAY_BUFFER);

Can I to remove (hide/mask) some verteces (3 from 40K) directly from the located in the grafical memory VAO without full complete replacement all of the 40K?

sentences:
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:
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:
How to animate the sprite along with action in Cocos2d? Cocos2d-android - I have an animation which has 5 Frames they are close cropped images. Now I want Sprite to do animation as well as Move in X direction.i.e. I have a player running which gets collided with obstacle and falls down .. Now I want sprite to run animation as well as moveBy in -ve x direction

gameOverAnimation =CCSprite.sprite("gmovr00")
gameOverAnimation.setAnchorPoint(0, 0);
gameOverAnimation.setPosition(340.0f, 200.0f);
addChild(gameOverAnimation,10);
CCIntervalAction action1 = CCAnimate.action(mEndAnimation, false);
action1.setDuration(1.0f);
CCIntervalAction delay = CCDelayTime.action(0.68f);
CCMoveBy actionBy = CCMoveBy.action(1.0f, CGPoint.ccp(-340,0));
CCIntervalAction seq1 = CCSpawn.actions(action1,actionBy);
//CCSpawn spawn = CCSpawn.actions(action1, actionBy);
                CCSequence sequence1 = CCSequence.actions(seq1,CCCallFuncN.action(this,"gameOver"));
                gameOverAnimation.runAction(sequence1);

Above code makes animation run first then moved in y direction

Thanks for the help..
And can some one explaing me the concept of time with frame Animation or good example ?

sentences:
How to hide player when in Shadow using Unity 2D Light System? I have been looking for this for a couple of days now and cant find an answer; how can I hide a player when they are in the shadow when am using Unity 2D Light System? I know I can choose not to cast light on objects, but when I do it still shows the object in the shadow. What am looking for is hiding the player completely when they are in shadow, and when the light hits them it would reveal the player. This effect is in the game Among Us, I know that they are using some sort of shaders and they didn't have 2D light when they were developing it.
So am assuming this would be a shader as well where it would reveal the player when they are in the light and hide them when they are in the shadow. Below are pictures of what I have and what I want it to look like.
This is what I have in Unity

So you can see that the player is not hidden in the shadows, but rather its blacked out.
But this is what am looking to recreate:

You see how the top half of the body which is in the shadow is hidden while the bottom half is revealed because its in the light? This is the effect that I want to recreate.
Is there some sort of Shader or code that can do this? I really been looking for something like this for so long and couldn't find it. Any help will be really appreciated.

sentences:
How do I convert screen coordinates to between -1 and 1? I'm writing a function that allows me to click on my tiles. The origin for my tiles is the center, however, the mouse's origin is the top left. I need a way to transform my mouse coordinates into my tile coordinates.

Here is what I already have (but is not working):

void mouseClick(int button, int state, int x, int y)
{
    x -= 400;
    y -= 300;
    float xx = x / 100; // This gets me close but the number is still high.
    float yy = y / 100; // It needs to be between -1 and 1
}

sentences:
Is there algorithm for boxcasting or thickray casting? I am not sure what the correct name is called but here is my problem: I have implemented a casting ray function that works as expected. However, because I am using a loose grid structure, (ie, objects that overlap multiple grids are only put into one grid), the ray cast may miss certain objects. What I need, I think is a box casting where I need to get every grid the box hits from its initial position to final position. Does anyone have such algorithm? Or pointing out to a solution to this problem, thanks!

This pic from N tutorials is a nice summary of this problem:

My ray cast implementation only hit the blue cells but as you can see, it may miss certain objects. They are only put into the grid where the x is.

Just to add I will be using this in a heated loop and so I have the additional requirement that this must be done efficiently.

EDIT: this picture illustrates why I think a box casting would work for loose grid: (The box must be bigger than the objects contained in the grid.)

sentences: What is "pixel art"? I'm interested in working as an artist in the game industry.  Many job postings contain the phrase "pixel art".  What exactly is pixel art?

sentences:
2D object-aligned bounding-box intersection test I have two object-aligned bounding boxes (i.e. not axis aligned, they rotate with the object).  I'd like to know if two object-aligned boxes overlap.  (Edit: note - I'm using an axis-aligned bounding box test to quickly discard distant objects, so it doesn't matter if the quad routine is a little slower.)

My boxes are stored as four x,y points.  I've searched around for answers, but I can't make sense of the variable names and algorithms in examples to apply them to my particular case.

Can someone help show me how this would be done, in a clear and simple way?  Thanks.  (The particular language isn't important, C-style pseudo code is OK.)

sentences:
GLSL vertex shaders with movements vs vertex off the screen If i have a vertex shader that manage some movements and variations about the position of some vertex in my OpenGL context, OpenGL is smart enough to just run this shader on only the vertex visible on the screen?

This part of the OpenGL programmable pipeline is not clear to me because all the sources are not really really clear about this, they talk about fragments and pixels and I get that, but what about vertex shaders?

If you need a reference i'm reading from this right now and this online book has a couple of examples about this.

sentences:
Knowing state of game in real time I'm trying to code a tic tac toe game in java and I need help figuring out how to efficiently and without freezing the program check if someone won the game.

I'm only in the design stages now, I haven't started programming anything but I'm wondering how would I know at all times the state of the game and exactly when someone wins?

Response to MarkR: (note: had to place comment here, it was too long for comment section)

It's not a homework problem, I'm trying to get more practice programming GUI's which I've only done once as a freshman in my second introductory programming course. I understand I'll have a 2D array. I plan to have a 2D integer array where x would equal 1 and o would equal 0. However, won't it take too much time if I check after every move if someone won the game? Is there a way or a data structure or algorithm I can use so that the program will know the state (when I say state I mean not just knowing every position on the board, the int array will take care of that, I mean knowing that user 1 will win if he places x on this block) of the game at all times and thus can know automatically when someone won?

sentences:
How to find the source of a memory leak in a Blockchain + Node.js game We have been working in a Node.js game, part of a game network, which seems to be working slower and slower as you keep it open, as well as it seems to increase the RAM and CPU usage over time.

We are assuming it's a memory leak issue/improper use of the data structures within the application.

The question is, how could I detect the source of this type of issue?

sentences:
Launching a projectile and landing it in a specific spot with different elevations? I have a starting position for a projectile and a target position I want it to land on given an initial x and y velocity.

Doing this on a level field is fairly straightforward but I'm struggling to figure out how to do it on two different levels.

I've crudely illustrated what I'm trying to accomplish:

sentences:
Unity3d select empty gameobjects in scene I have a pathing system that I am creating in Unity. When you add nodes to denote the path, I create a empty GameObject and render it in OnGUI as a square. The problem that I have is clicking on the object in the scene view. I am trying to figure out what would be the best way to click the Node, so that I can move and rotate the Node.

I had some ideas, like:

Creating a Cube or some other GameObject with a mesh, and change the layer to Node. Then make the camera cull out the Node layer.
Only in editor mode, create a temp asset and delete it before runtime.
Do a raycast and see what objects are near the click, then pick the closest one.

I have a feeling that I am putting to much thought into it, and suggestions would be greatly appreciated!!

sentences:
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 i get the X,Y and Z of the way my unit is facing? I have the yaw and pitch of my unit at my disposal, I know if I use polar to cartesian conversion I'll get the X and Y of each one of those two, but I need them combined to give me the x,y and z of the direction I'm facing.

sentences:
How to find resources location regardless of working directory? I am working on a resources loader for my personal C++/OpenGL ES engine. My resources are in a resources folder separated trough different sub-folders (shaders, textures, etc).

I am currently giving a path to this folder when I want to load a file. My code looks like this:

texture.load("../../resources/textures/dirt.png");

The problem is - in addition to not be gracious - it depends of the current working directory and of the final binary location when I execute it.

How can I store the complete path to the resource when I call the load function to be able to load it regardless of working directory? I would like to be able to use the following line:

resourcesManager.loadTexture("dirt.png");

Regardless of where I am compiling nor executing my game, as long as I told to the texture manager where is the resources folder.

I tried to find a solution using __FILE__ macro, because I can get the complete path to the compiling file with it, but it would be the path to the source file, not the path to the binary.

I'm trying to make it cross-plateform, so I would prefer a solution not working through an external editor or IDE.

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:
Techniques for displaying vehicle damage I wonder how I can displaying vehicle damage.
I am talking about a good way to show damage on screen. Which kind of models are common in games and what are the benefits of them? What is state of the art?

One way I can imagine is to save a set of textures (normal/color/lightmaps, etc.) to a state of the car (normal, damage, burnt out) and switch or blending them. But is this really good without changing the model?

Another way I was thinking about is preparing animations for different locations on my car, something like damage on the front, on the left side/right side or on the back, and start blending the specific animation. But is this working with good textures?

Whats about physics engines? Is it useful to use it for deforming vertex data? I think losing parts of my car (doors, sirens, weapons) can looks really nice.

My game is a kind of RTS in a top down view. vehicles are not the really most important units (its no racing game), but I have quite a lot in.

sentences:
Game loop delta, factoring execution time? Was thinking this morning, I 99.9% of the time, only see a main game loop, looking like this, just as much so where the delta is passed into update():

while running
getDeltaTime()
...
f(deltatime)
---

Now the question I was thinking to myself was what if between getDeltaTime() and f(deltaTime), the code in the middle took 1 second (large value to be easy). That means f(deltaTime) would have moved whatever object less distance than it was supposed to. This would of course be solved by grabbing the delta time directly before it is used.

Should this be a factor to be concerned with in any case?

sentences:
Convert Tris to Quads or Polygons Im working on a ledge climbing system in Unity. I am coding a method that takes a mesh and tries to generate a bunch of connected nodes that will help the player detect ledges that can be climbed.

This is what I have made so far:

The thing I need to do now is to remove connections that are not ledges (sorry if that doesn't explain much). This is the desired result:

So, basically, I need to convert those Tris to Polygons. I have no idea of how to do this. Each node stores its position, its normal, and what nodes it is connected to.

Thank you for reading!

sentences: How to get an autotile in Godot 3.1? I wonder if there's a way to get an autotile just like a single tile using a get_autotile() GDScript function or something like that.

sentences:
Synchronizing actions with animations across network I'm working on a project which allows players to take actions in time-limited turns. All players are connected to a central server, which is authoritative. That means the server sends info that a turn for given player has started and the time remaining to take an action. This leads to problems when client-side animations are involved. Each action has an associated animation, which takes some time to complete. The player should be able to initiate the action within given time, and the next player show start his turn when any animations complete. Obviously, the server has no notion of animations, but still needs to take them into account and start the next turn at proper time point. I'm not sure how to solve this problem. Possible solutions I came up with:

Constant animation time and built-in delay

The server will have a built-in delay after an action has been taken, before starting the next turn. Problems:

seems an artificial construct
animation times need to be exact

Not waiting for animations

The server can simply broadcast action effects without any delay, and go to the next turn. Problems:

will look very strange for the players since the effects will become visible before the animation completes
possible overlapping animations across turns

Sending actions along with animation times

The client can send the animation time for given action, which the server will use as a delay for the next turn. Problems:

obvious cheating possibility (players can use the delay for "extra time")

So, given above, all my ideas are simply bad. Therefore the question remains: is there an existing solution for such class of problems?

sentences:
2D side scroller - How to implement X/Y movement? I'm currently writing a small 2D, side-scroller-ish kind of game.

I have a simple camera that follows the player around and the physics are ready.

I'm using 32x32 tiles that build out the world, they are all stored in a 2D array, something along this:

[ 0, 0, 0, 0,
  0, 0, 0, 0,
  1, 1, 0, 1,
  1, 1, 1, 1  ]

The 1s are land and 0s are air.

Now the world is dynamic and I want it to be quite large (1 big world) around 1000x800 tiles total.

My biggest issue atm is how to implement the "scrolling effect".
Also keep in mind that the player can go in any direction (up/right/left/right).

Thanks

sentences:
Export Spriter animations to Unity I want to use bone animations in my 2D game for Unity (5.0 beta). I am trying Spriter. Apparently, it has no official Unity support. There was some guy, back in 2014, who posted a plugin to convert Spriter files to Unity prefabs here: http://brashmonkey.com/forum/index.php?/topic/3365-spriter-for-unity-43-updated-integrated/.

However, the plugin does not seem to work (perhaps it is because I am using 5.0 beta).

There are deprecated lines, like

AnimationUtility.SetAnimationType(animClip, ModelImporterAnimationType.Generic);

Or

 UnityEditor.Animations.AnimatorController.AddAnimationClipToController(controller, animationClip);

If you remove them, of course it won't be able to properly export your files.

So my question is: is there a reasonable to use Spriter animations in Unity? I know I could just export to a spritesheet, but I was hoping to use bones for super fluid animations (I have several characters so I don't really want to make lots of spritesheets). Or perhaps there is a better bone-based solution for 2D animation in Unity?

sentences:
Check bounds in 2d platformer level transition I have asked How camera works in 2d platformer in level transitions about camera transitions,
in the process I am stuck somewhere else.
I have a targetRoom that is 32 by 32 tiles:
// [x, y, w, h]
let mb = [0, 0, 32, 32];

// bounds
let targetRoom = {
  minX: mb[0] * bs.pxTileSize,
  maxX: (mb[0] + mb[2]) * bs.pxTileSize,
  minY: mb[1] * bs.pxTileSize,
  maxY: (mb[1] + mb[3]) * bs.pxTileSize
};

I have a player object:
let p = {
    x: 0,
    y: 0,
  onEdgeX: (p, bx) => {
    p.x = bx;
  },
};

I allow the player to move within these bounds:
this.checkEdgeX = (p) => {
  let { minX, maxX } = targetRoom;
  let cbox = absCBox(p);

  if (cbox[0] < minX) {
    p.onEdgeX(p, minX - p.cbox[0]);
  }
  if (cbox[0] + cbox[2] > maxX) {
    p.onEdgeX(p, maxX - p.cbox[0] - p.cbox[2]);
  }
};

p.cbox is players local collision box [x,y,w,h]. eg: [-6, -6, 12, 12];
absCbox returns the collision box in world coordinates:
const absCbox = p => {
  let cbox = p.cbox;
  return [
    p.x + cbox[0],
    p.y + cbox[1],
    cbox[2],
    cbox[3]];
};

In checkEdgeX when the collision box exceeds the limit,
p.onEdgeX is called which puts the player inside the bounds again.
The problem is, when I want player to go beyond the edge to the other level.
How do I check if the player is allowed to pass beyond the edge to the next level?
When player goes to the next level, how do I make sure it is within the bounds again?
Because player might go just a little bit to stand in between two levels, never meeting inside the bounds of either level.
I want the transition to be in the image in my linked question above.

sentences:
Issue with Button component When I add a Button component, it looks like this:

Normally, it should look like this:

How can I fix this issue?

sentences:
AndEngine Box2d game I'm developing a 2d survival shooter using Box2d extension and I've got some questions:

I have two AnalogOnScreenControls. Their listeners modify both
sprites and bodies. I receive TouchEventPool was exhausted and as
their number grows the game crashes accidently. I've tried to put
the modification of the bodies and sprites on the UpdateThread but
that does not solve the problem. What could be the cause?
I have a class that at the beginnig of the game loads all the
textures. After I relaunch the game activity several times I receive
Unable to find Phys Addr for and "green color" interface. But that
doesn't happen if I clear the memory manually through the Task
Manager before relaunch What could be the cause? I unload my atlas
at the end of the game.
The game sometimes crashes at start with NullPointerException in
onResumeGame. The solution suggested is to set
android:configChanges="orientation|screenSize" but my device is API
10 so it doesn't have screenSize property and orientation only does
not seem to help, because the game starts in portrait mode at times
(though landscape is set in the code)

sentences:
Find angle (slope) of collision plane? I have implemented a collision and response system based on the famous "Improved Collision detection and Response" paper. However I'm having an issue with objects sliding backwards on slopes. I believe I could circumvent this issue if I understood how to find the angle of the plane of which my object is colliding with. Take the below screenshot as an example of the situation:

I know the following data:

Position of player object (the ellipsoid at the bottom of the ramp)
Vertices of the collision triangle
Normal of the collision triangle
Intersection point between player object and collision triangle
Penetration distance between player object and collision triangle

How can I use this information to determine the angle of the collision triangle?

sentences:
No output to screen using Multiple Render Targets and multisampling I'm having a little trouble with XNA, but I doubt it's specific to the framework.

I draw a few 3d models to 1 rendertarget with multisampling turned on, and it works fine. If I draw the same scene to 2 rendertargets (of course the second one gets a different output (configured this in HLSL shaders)) with multisampling turned on, I get absolutely no output. Nothing. Blank. Also, when I render to both outputs but turn off multisampling, it works perfectly (but looks hideous due to a lack of antialiasing).

The strange thing is: This happens on my desktop (Nvidia GTX 560 Ti), but not on my laptop (Intel HD Graphics 4000, which sits on the CPU). On my laptop, it outputs just fine to both rendertargets and multisampling turned on.

Can anybody explain what could be wrong?  I won't copy all my code here but just to clarify:

graphics.PreferMultiSampling = True
RT_Light = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents)
RT_Scene = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents)
device.SetRenderTargets(RT_Scene,RT_Light)
'Draw

Works but looks hideous

graphics.PreferMultiSampling = True
RT_Light = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
RT_Scene = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
device.SetRenderTarget(RT_Scene)
'Draw

Works but obviously only draws to one rendertarget

graphics.PreferMultiSampling = True
RT_Light = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
RT_Scene = New RenderTarget2D(device, ClientWidth, ClientHeight, False, SurfaceFormat.Color, DepthFormat.Depth24, 4, RenderTargetUsage.PreserveContents)
device.SetRenderTargets(RT_Scene,RT_Light)
'Draw

Works on my laptop, but not on my desktop.

Again, to clarify: The top picture is what my laptop shows (with multisampling and multiple render targets), and the bottom picture is what my desktop shows with the same settings:

sentences:
On button click wait I have a button I got from google material design asset pack which has a ripple animation when pressed. I'm using the button's click option in the inspector that calls a method that switches scenes. But when I tap the button it switches the scene immediately and feels unnatural since the animation hasn't finished the button ripples animation.

I tried using co-routines. Made the button call a method in which I call a IEnumerator method (since the button can't directly call a co-routine) and then switch the scene. But that doesn't work since it starts the co-routine and switches the scene, the co-routine never pauses the code and never finishes (probably because I loaded a new scene and the object that carries the script isn't transferred).

Code example:

The method that gets called when I tap a button:

 public void OnButtonTap()
 {
     StartCoroutine(Wait(0.2f));
     SceneManager.LoadScene("OnePlayerGameIntro");
 }

The wait coroutine:

 public IEnumerator Wait(float seconds)
 {
     yield return new WaitForSeconds(seconds);
 }

sentences:
Algorithm that cover one mesh by another mesh Suppose I have two meshes (Let call me  first MeshShirt and second - MeshBody)
Meshes are aligned (if i render both MeshShirt "covers" MeshBody). But some parts of the body are not "under" the MeshShirt (because MeshShirt shape differs from MeshBody)

How can i "pull up" parts of MeshShirt which are under MeshBody and hold other parts in their places? Of course i want  save shape of MeshShirt if it possible

I think about following algorithm

mark all points of MeshShire which under MehsBody by tracing
intersection of its normals and MeshBody.

But if MeshShirt "hidden" parts have complex shape normal tracing will not work. So some way to detect bad points is needed
move every marked
point to the plane of its nearest triangle of MeshBody.

But i afraid
that these algoritm may produce significant  deformation of MeshShirt.
So some shape preserved deformation is needed too.

Sorry for my poor English and fuzzy problem definition

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:
View Space From gl_FragCoord Trying to get the example code for CalcEyeFromWindow() (first one on the page) to work in WebGL, but having no luck.

Paired down the code to the following with some explicit values just in case something is amiss with parameter passing.  Visualizing the output on a sphere of unit radius, centered in the view and 3 units from the camera.  Using step() in the output to provide sharp color transitions on the sphere.

The current output is black.  If I set the step to 0 for X and Y, the transitions for X and Y are centered on the sphere, so it would seem that the problem is at least in part due to the calculation of clipPos.w.

Vertex shader:

precision highp float;

attribute vec3 a_position;

uniform mat4 u_modelMatrix;
uniform mat4 u_viewMatrix;
uniform mat4 u_projectionMatrix;

void main()
{
    gl_Position = u_projectionMatrix * u_viewMatrix * u_modelMatrix * vec4(a_position, 1.0);
}

Fragment shader:

precision highp float;

uniform mat4 u_inverseProjectionMatrix;
uniform mat4 u_projectionMatrix;

vec3 CalcEyeFromWindow(void)
{
    vec3 ndcPos;
    // Hard code window-space position at gl_FragCoord
    // Hard code viewport dimensions
    ndcPos.xy = (2.0 * gl_FragCoord.xy) / vec2(1000, 500) - 1.;
    // Hard code clipping depths
    ndcPos.z = (2.0 * gl_FragCoord.z - 1. - 4.) / (4. - 1.);

    vec4 clipPos;
    clipPos.w = u_projectionMatrix[3][2] /
       (ndcPos.z - (u_projectionMatrix[2][2] / u_projectionMatrix[2][3]));
    clipPos.xyz = ndcPos * clipPos.w;

    return (u_inverseProjectionMatrix * clipPos).xyz;
}

void main() {
    // Step to clarify position
    gl_FragColor = vec4(step(vec3(.5, .5, 2.2), CalcEyeFromWindow() *
         vec3(1,1,-1)), 1.);
}

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

Below is the code

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

using namespace std;

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

//The frame rate
const int FRAMES_PER_SECOND = 20;

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

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

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

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

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

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

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

   Timer fps;

   bool quit = false;

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

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

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

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

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

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

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

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

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

     apply_surface(flag_x, flag_y, flag, screen);

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

  }

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

return 0;
}

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

sentences:
Highlighing and hit detection on a geographic game I'm developing a geographic game where you select a country and it highlights. At first I thought about using 196 images (1 for the world, 195 for each country highlight) with the same size, and the country images would only have the country drawn and the rest is transparent. That way they'd overlap perfectly.

This design doesn't feel quite right, and it would cause trouble doing hit detection on cases where a country is inside another one.

What's the best approach for this situation?

sentences:
How was the world game market segmented in 2011? Is there a source (or perhaps several) presenting how was the world game market segmented in 2011 (or does anybody know themselves)? For example:

How many casual gamers there are? What is the total business, of which how much in virtual item sales?
How many console gamers there are? How much is spent in hardware, how much in software?
How many mobile gamers there are? How much is spent in hardware, how much in software?

And how all above is in different regions / countries?

sentences:
How can I use the colours of a swatch in a script? In Unity's editor I have set a swatch with some colours that are used throughout our game:

This swatch is saved in a file in the project's Assets folder:

\ProjectFolder\Assets\Editor\Main Colors.colors

I would like to use the colours in this swatch somewhere in a script:

GetComponent<Graphic>().color = SomethingHere.MainRed;

What is the best way to do this? Or is it not possible?

Reflection

I also think that I'm doing something really strange? I couldn't find any answer to this question online. But having the same colour library in the scripts as I use in the editor would be really nice.

sentences:
How to inflate geometry? I have a shape containing vertices and triangles

I want to inflate that geometry using some radius to get something like that

I should move each point along vector center-vertex. I suppose each point should be moved using quadratic function (closer to center, further it will be moved)

How should I calculate the offset of each point?

sentences:
Basic rigidbody movement This is a noob question but, what is the rigidbody movement equivalent of:

transform.position += transform.right * speed * Time.deltaTime;

sentences:
How to match UI background size with text length in Unity? I am making an FPS game in which when you are near an item a UI Text appears at the bottom center of the screen indicating the name of the item and the button to pick it up (let's say [E]).

It works fine but since I couldn't get a clear contrast between the text and the game area (like if the player's standing in front of an egg and the color of the text is white, you can't see the text), I decided to add a black background image to the text.

Now since the item names are of different lengths, I need the image length to match the text length. The background image should just be enough to fit the text
How can I go about doing this? Or is there a better way to show a message to the player?

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: 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:
How to implement scripted events? I'm building a game in C++ (using SDL) for a college project, I'm trying to figure out how to script events that happens when a player does something, or some time passes etc.

I have a and idea of how to do it but I don't want to go against how it's commonly done.

Right now I have a class called Obj from where enemies, items and the player are child classes, my idea is to add 3 public variables to it like this:

class Obj{
    int eventDeath,eventTouch,eventTalk,eventMeet;
}

Then I could create an Obj with eventDeath=1 and when it died it would fire event(1). event() would be something like this:

void event(int n){
   switch(n){
   case 1:
      dialog("I'm dying");
      break;
   }
}

I could also add invisible "Obj" in specific places for when a player walks over a certain place. I don't know if this is a good idea but I can't think of other means to do it. How is it commonly done? Also how do I keep track of events that already happened?

sentences:
changing color of sprite not every frame So I have been trying making this game, which changes color of sprites in it.
It should only happen when OnMouseDown().
but it is executing every frame and cannot go out of the couroutine.
I want the color change to be slower. Please mark the colors should still change.

Please Help,

public class control : MonoBehaviour
{
    public bool startstop = false;
    SpriteRenderer m_SpriteRenderer;
    private void Update()
    {
        StartCoroutine("Changecolor", 3f);
    }
    IEnumerator Changecolor()
    {
        yield return new WaitForSeconds(3);
        if(startstop == true)
        {
            int random = Random.Range(1, 4);
            if (random == 1)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.blue;
            }
            else if(random == 2)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.red;
            }
            else if(random == 3)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.green;
            }
            else
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.yellow;
            }
        }
    }
    private void OnMouseDown()
    {
        startstop = !startstop;
    }
}

sentences:
Player wont rotate properly So Small problem. I'm able to rotate my camera around my player AND rotate the player when the camera moves around it, but the controls don't seem to move with it. Example: W moves forward. If I look right then W should move forward in that direction. It doesn't, instead it will go left (the forward as it was before).

[SerializeField] GameObject GameCamera;

private void PlayerRotateWithCamera()
    {
        Quaternion CharacterRotation = GameCamera.transform.rotation;

        transform.rotation = CharacterRotation;
    }

private void FixedUpdate()
{
    PlayerRotateWithCamera();
    MovePlayer();
}

I only think the player is rotating cause it looks like it is, but if you look at the move tool the axis dont seem to move with the Player

Just in case my movement isn't getting along with the rotation:

private void MovePlayer()
    {
        moveHorizontal = Input.GetAxis("Horizontal");
        moveVertical = Input.GetAxis("Vertical");

        // more realistic ball movement
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * moveSpeed);
    }

I also have Tool handle rotation set to global because it's a ball, and well, those axis obvious go crazy while rolling around.

Any help at all would really be appreciated!

sentences:
Black areas on different screen sizes I'm currently facing some problems with sprites/images on different screen sizes. For now the game stage is stretched to maximum width and height of the screen.

In Samsung Galaxy S2, SGS3 and SGS4 the game is working as normal as expected:

But... yesterday I tested it on GT-P5110 android tablet.. and the result was:

The screen background and car sprite was replaced by black rectangles...

Does somebody know what's happening?

The same result occurs on sgs2/sgs3/sgs4 when any of the sprite image has more than ~4100px of height. Maybe it's something with image limits? If yes... how to know that limit? Currently (working on sgs2, but not on tablet) the background image size is 3117x480. It's so wide because it used for parallax background. If it exceeds the limit how should I handle this (join two images)?

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:
What are the fundamentals of game development? I completely do not understand how a video game can be coded.

I'm a beginner programmer and only have experience writing console applications that do math and what not. I do not understand how these logical processes can make images move on the screen (video games). Obviously if I jumped into a game development book or something like that I would understand but I am currently still getting a grasp of the fundamentals of programming in general. Could anyone give a simple explanation, coding wise, on the jump between making a computer do simple math to making a computer produce amazing graphical programs such as video games? Maybe there are some introductory videos someone can point me to?

sentences:
reading input from multiple mice in QB64 in Windows 10? I am looking to write a non-network multiplayer game for Windows 10 with QB64 that accepts input from 2 or more USB mice plugged into the system. Like a simple Pong game where additional players plug mice into a USB hub to use as game controllers.
I have been googling this and found some older threads

Is it possible to detect two different mice at the same time, and have their movements recorded seperately? Asked 8 years, 9 months ago
How do I read input from multiple keyboards/mice on one computer? Asked 7 years, 6 months ago

however these are pretty old threads from before Windows 10, also they seem to be more oriented towards C++ or .NET.
Can anyone provide some example how it might be done with QB64 under Windows 10?
Thanks

sentences: What solutions are available for 3d character creation/editing in games? Many RPGs and MMOs offer a system for creating a character model, with varying levels of customization. Are there any open source libraries for this? Any libraries which can be licensed? Has anyone built anything related to this themselves?

sentences:
Using A*Pathfinding on terrain created by scripts? I'm looking to use A* Path-finding as a method of navigating my game terrain. Trouble is, my terrain is built upon play using a script and A* grid does not detect this, therefore marking all nodes as "un-walkable".

I'm wondering if anyone knows a solution for this or an alternative path finding method. I have tried enabling the terrain to spawn on edit more using ExexcuteInEditMode, but this does not seem to work either.

The terrain was generated through a fantastic guide called Procedural Terrain Tutorial.

Would greatly appreciate any help I'll be able to get.

I've attached some screenshots for clarity :

sentences:
A pattern for a contextual InputState in a Game State Management architecture Context of the question :

When developing a game using Game State Management I came across a problematic when it came to handling user input : I want my game to retrieve user input a single way, but to handle it in a completely different way, depending on the context.

For example, the [Up] key will always mean "Menu Up" when you're in a menu, but if you're in the game, it might do different things, depending on the key bindings. Another difference would be, for example, that in a menu, a .5sec KeyDown on a key should be interpreted as a single command, but when you're in game, a .5sec KeyDown should often be seen as a .5sec movement / burst / charge shot / etc...

Then way I though about to achieve this result is the following :

Have an InputState class that keeps the current and previous Keyboard/Gamepad input states, just like the usual InputState class. Have this InputState class implement all the methods I would need in all the different contexts.
Create an Interface per context. For example, IMenuInputState, IGameInputState, ICutsceneInputState, etc. These interfaces would only contain the method definitions related to the context.
Have the InputState implement all the I[...]InputState interfaces. If two or more context need the same method, the same implementation would be used.
In the ScreenManager's Update method, the InputState would be Updated, but depending on which screen must handle the InputState, a different I[...]InputState would be sent. Even though the screen could access the other methods by casting the interface, only the contextual methods would directly be usable.

My question is the following : Is my idea a proper / common way of handling this issue?

If it is, could you tell me the name of that "pattern" or direct me to some online resources so I can read on that and avoid the known pitfalls. If it's not, how would you suggest I handle the problem?

Note: I know this question is borderline since the answer is partially subjective but I'd appreciate some help on this issue since I think it's a critical decision in my project.

sentences:
Simulating air pressure I am working on a space orientated game, and I have done some research on the best way to simulate gas with traditional physics technologies (Creating a lots of circles)

The only obstacle I have is how to simulate pressure. For example, if one corner of the room has lots of these little circle physics bodies, how can I make them evenly distribute? If I have a huge vacuum, what is the best way to have the particles get sucked out through the corridors etc of a room into space?

I can't think of any way to do this without iterating over every single particle against every singe other particle. Obviously, I cannot do this in a real-time simulation.

Maybe I could do this on a tile-based level?

The specific technologies I am using are Java and Dyn4j.

Thanks,

sentences:
How can I get the instantaneous volume level of a sound at a particular playback point? How can I go about getting the current volume output of an audio file in libGDX? By that I mean of the actual file at its current play position.

Essentially I want to write my own version of a plugin I was using in Unity for basic lip syncing. Depending how loud the audio is, a different mouth shape sprite will be shown.

So for example if there was a sound with a sentance "what is that?" you would expect the "that" to be a different shape than the "what is," as it's louder. Is there a way to do this, to get the volume at a certain point?

sentences:
Communication in a simple GUI (C++ / SDL2) I've spent a few months now working on a fairly simply 2D game engine with SDL and C++. I'm now trying to develop a simple but well-featured GUI suitable for most games.

Right now I'm really struggling on figuring out how I should handle communication between the GUI and the other parts of the game / engine that might want to use it.

For example, the "shop" game state may have a list of items that I want to display on a shop GUI, along with their prices and quantities, i.e "Wooden sword / 30GP / 5". Obviously I need to get this information to the GUI in order for it to be useful, along with a way of notifying the shop component which item has been clicked/given focus. Seeing as the internal representation of an object such as an "item" or an "inventory" can vary wildly, how do I get the data I want to/from the GUI in a way that doesn't require excessive coupling between the two components?

I'd really appreciate anyone's advice on how to approach this issue, and I fully appreciate that my understanding is flawed.

Finally, I'm set on developing it from the ground up as a learning exercise, so I'm not really interested in GUI libs for SDL (it seems none of them are updated for SDL2 anyway).

Thanks in advance

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:
Error binding indices to device context [ STATE_SETTING ERROR #241: IASETINDEXBUFFER_INVALIDBUFFER] This is how i initialized the D3D11_BUFFER_DESC for my indices. When i go to bound it to the deviceContext i get this error.

D3D11 ERROR: ID3D11DeviceContext::IASetIndexBuffer: The Buffer trying to be bound as an IndexBuffer did not have the appropriate bind flag set at creation time to allow the Buffer to be bound as an IndexBuffer. [ STATE_SETTING ERROR #241: IASETINDEXBUFFER_INVALIDBUFFER]

And is kinda of strange becouse i setted the bindFlags to "D3D11_BIND_INDEX_BUFFER"

   D3D11_BUFFER_DESC buffDescIndices;

    ZeroMemory(&buffDescIndices, sizeof(D3D11_BUFFER_DESC));
    buffDescIndices.MiscFlags = 0;
    bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
    buffDescIndices.Usage = D3D11_USAGE_DEFAULT;
    buffDescIndices.ByteWidth = sizeof(UINT) * ARRAYSIZE(indices);
    buffDescIndices.StructureByteStride = 0;
    buffDescIndices.CPUAccessFlags = 0;

    D3D11_SUBRESOURCE_DATA subResData2;
    subResData2.pSysMem = indices;
    HRESULT hr=device->CreateBuffer(&buffDescIndices, &subResData2, &mBoxIB);

And this is the deviceContext call

    deviceContext->IASetIndexBuffer(mBoxIB, DXGI_FORMAT_R32_UINT, 0);

sentences: Game thread, render thread, animation/inverse kinematics, and synchronization In a multithreaded setup with a game logic thread and a render thread, with some kind of skin mesh animation with inverse kinematics plus etc how does animation work? Does the game logic thread just update a number saying time T in the animation and then the render thread infers Who owns the skin mesh animation, the game logic thread or the render thread? How is it stored in the scene graph if it is stored there at all? When the game logic updates does it do the computation of the skin mesh animation and the computation of the inverse kinematics and then store the result directly in the scene graph or is it stored indirectly and the render thread does the computation?

sentences:
Who does the AI calculations in an MMO? I am building an MMO and want to add NPCs. The thing is I don't know the basic design. What does the calculations, the clients or the server? I would understand the server calculating events and reactions, but when it comes down to pathfinding and position and movement of player, who calculates that?

Who calculates the AI the server or client? I couldn't imagine the server calculating the pathfinding, position, movement and so on. Please I need help understanding this, thanks, anything will help.

sentences:
Making an efficient collision detection system I'm very new to game development (just started 3 months ago) and I'm learning through creating a game engine. It's located here. In terms of collision, I know only brute-force detection, in which case, the game slows down if there are a number of objects. So my question is How should I program the collisions?

I want them to happen automatically for every object and call the object's collision(GObject other) method on each collision.

Are there any new algorithms which can make this fast?
If so, can anybody shed some light on this topic?

sentences:
Where to store persistent player data? I'm working on a 2d game, where the player can take damage and die. And upon death, player object gets destroyed.

However, some attributes of player shouldn't be affected by his death, such as lives, ammo, current weapon and so on. I'm wondering where to store these values.

I'm using c++.

sentences:
How can I avoid a stack overflow when recursively checking adjacent game objects? I am building a simple game on Unity to learn the system. I am using C#.

The game is a basic "blocks" game, whereby when the player clicks on a block, the block and its neighbours of the same colour all disappear (get destroyed).

My process is this:

To keep a track of which blocks are neighbours of the same colour, on each refresh each block checks their details on the event OnCollisionEnter and adds these collision neighbours to a List of valid neighbouring gameobjects.
When a block is clicked, this list is checked and each neighbour has its own neighbours list checked, after list checking each block is distroyed.

Somehow, this process is causing a StackOverflowException

  StackOverflowException
  UnityEngine.GameObject.GetComponent[setupscript] () (at
  C:/buildslave/unity/build/artifacts/generated/common/runtime/GameObjectBindings.gen.cs:35)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:86)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  ....

Here is my script, first my List establishment:

 private List<GameObject> neighbours = new List<GameObject>();

Next, here is how the neighbours list is populated:

void OnCollisionEnter (Collision other)
{
    Rigidbody other_rb = other.rigidbody;
    if(rb.velocity.magnitude < 1f && other_rb.velocity.magnitude < 1f
        && other.gameObject.tag == tagName && !neighbours.Contains(other.gameObject)) {
    /***
     * Same tag so add to list of valid neighbours
     ***/
        neighbours.Add(other.gameObject);
    }
}

Now, there are four conditions [above] to check when adding to the list:

Is the current block stationary.
Is the "other" colliding block stationary (so they're at rest next to each other).
do these blocks have the same tag (so they're the same type/colour)
does this block not already exist in this list.

So once all four conditions are met, the block GameObject is added to the List.

( On conditions of OnCollisionExit blocks are removed from the List in a  similar fashion.  )

Now, my CheckNeighbours() script:

public void checkNeighbours(){
    if (neighbours.Count > 0) {
        foreach (GameObject othercube in neighbours) {
            setupscript otherCubeScript = othercube.GetComponent<setupscript>();
            otherCubeScript.checkNeighbours();
        }
    }

    Destroy (gameObject);
}

This should, as far as I understand it, run once through each List element and check that element for any neighbours who match.

As I write this question out I think I'm realising that the issue is that we're in a loop as block 1 references neighbour block 2, which references neighbour block 3, which references neighbour block 1, etc. etc.

But my StackOverflow exception occurs when there are only two blocks, so one refers to the other, refers to the first, etc. But as they should destroy after running the reference, this shouldn't (ideally) be an issue? Do I need to make the checkNeighbour() a Corountine to allow it to not hold up destroying the GameObject?

If this [repetition cycling] is indeed what's going on, what would be the best way of getting each neighbour to be checked only once? Or checking that the GameObject referenced in the List still exists in the game itself?

I have a quick edit here:

foreach (GameObject othercube in neighbours) {
    if (othercube != null){
        setupscript otherCubeScript = othercube.GetComponent<setupscript>();
        otherCubeScript.checkNeighbours();
    }
}

But I'm not sure this will work as I feel this List will purely be a reference rather than the actual GameObject in the level?

sentences:
Embed Unity3D and load multiple games from a single app Is is possible to export an entire unity3d project/game as an AssetBundle and load it on iOS/Android/Windows on an app that doesn't know anything about such game beforehand? What I have in mind is something like the web plugin does - it loads a series of .unity3d files over http, and render inline in the browser window.

Is it even possible to do something closer for iOS/Android?

I have read a lot of docs so far, but still can't be sure:

http://floored.com/blog/2013/integrating-unity3d-within-ios-native-application.html
http://docs.unity3d.com/Manual/LoadingResourcesatRuntime.html
http://docs.unity3d.com/Manual/AssetBundlesIntro.html

The code from the post at http://forum.unity3d.com/threads/112703-Override-Unity-Data-folder-path?p=749108&viewfull=1#post749108 works for Android, but how about iOS and other platforms?

sentences:
How to make borders glow in a 2D game? How can I make the borders (stationary / non moving) of my 2d Unity game glow?
I need a method that is not so expensive. I've read that post processing is very expensive, but I quite liked adding bloom to my scene. It was pretty straight forward.
But now I'm reading that one shouldn't use it, it's expensive, not so good etc.

sentences:
geometry shader shim for opengl es 2.0 I just have a few months of OpenGL experience, just starting to get the hang of it.

I find geometry/vertex/fragment shaders to be very powerful. You have a few parameters that translates into a complex representation. One layer of your program can compute these parameters, the "model" only, and sharers can do the "view" part. That gives you a good separation of concerns and a lot of flexibility.

It's a pity that OpenGL ES 2 doesn't have geometry shaders. I think the CPU could totally take over this part in case the GPU doesn't support it and if proper shim libraries were present.

Is there any library that helps unfolding a model into vertexes / vertex attribute parameters / uniques, etc? Maybe one that uses the language of the geometry shaders?

sentences: Creating Unity games for older versions of Android? In the Unity editor, the lowest available Android version for debugging is Android 2.3.1 In my case, I have a phone running an older version of Android and I intend to publish my game to a wide audience. With the lowest version being 2.3.1, I see a problem publishing my games to older smartphones which still occupy a considerable size of the market share. My question is: Is there a way to publish my game to older versions of Android? Or is it impossible?

sentences:
Image won't scale after click Despite being a long-time developer I've never played with JavaScript libraries or any sort of graphics development.  With my son we're trying to create something interesting and are using createjs/easeljs as our vehicle of choice.

That said, we are going through a number of tutorials and can't determine why this isn't working.  The ball image does display but the on-click method code does not cause the image to scale.  The onBallClick method is being called so we suspect the reference is simply wrong somehow.

        var preload = new createjs.LoadQueue();
        var stage = new createjs.Stage("demoCanvas");

        function loadImage() {
          preload.addEventListener("fileload", handleFileComplete);
          preload.loadFile({id:"ball", src:"assets/ball.png"});
        }
        function handleFileComplete(event) {
          document.body.appendChild(event.result);
          event.result.addEventListener("click", onBallClick)
        }
        function onBallClick(event)
        {
            var ballImage = preload.getResult("ball");
            var bitmap = new createjs.Bitmap(ballImage);
            bitmap.scaleX = 0.5;
            stage.update();
        }

There are no errors in the developer console so we're trying to determine what is the correct reference to the bitmap.

We tried to do createjs.Bitmap(event.result) in handleFileComplete but event.result has a type of [Node] so we're not sure what to do with that but it doesn't appear useful for purposes of the createjs.Bitmap() statement.

sentences:
Error once unity got updated to 2017.1 I am working on a 2D platformer and I decided to update unity to the lastest version. Everything went well but once I got the project updated I got 2 error that I am not sure how to fix. Some help would be greatly appreciated!!!

Here is what the console is saying

Assets/Scripts/GameMaster.cs(148,112): error CS0039: Cannot convert type UnityEngine.Transform' to UnityEngine.GameObject' via a built-in conversion

Assets/Scripts/GameMaster.cs(111,96): error CS0039: Cannot convert type UnityEngine.Transform' to UnityEngine.GameObject' via a built-in conversion

Here are the lines that it is pointing to

GameObject clone = Instantiate (spawnPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;

GameObject _clone = Instantiate(_enemy.deathParticles, _enemy.transform.position, Quaternion.identity) as GameObject;

Thanks!!!!

sentences:
Can't Transform.SetParent in Unity i have a problem that i don't understand why is happenning and it's driving me mad.
I'm trying to code a script to put the player in the car by disabling the third person controller and then Transform.SetParent.
Here's the code:

  public ThirdPersonCharacterControl Controller;
  public GameObject Player;
  public GameObject Car;

 public void PutWheel()
    {
        if(isInteractive)
        {
            if(isCar)
            {
                PlacePlaceables();
                Controller.enabled = false;
                Player.transform.SetParent(Car);
            }
        }
    }

The error is:

Assets/Scripts/Player/Interactible.cs(361,34): error CS1502: The best overloaded method match for `UnityEngine.Transform.SetParent(UnityEngine.Transform)' has some invalid arguments

Assets/Scripts/Player/Interactible.cs(361,44): error CS1503: Argument `#1' cannot convert `UnityEngine.GameObject' expression to type `UnityEngine.Transform'

Why is that happening? It doesn't make sense to me because everything seems correct.

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:
Any tips for aligning existing sprite sheets to a grid? I've been dabbling with sprites, and I've found most sprite sheets that have been posted for existing games (for example, Sonic & Knuckles) are not aligned to a grid.

I've found this frustrating when trying to use these sheets to set up animations in Unity. I managed to align the spritesheet above manually, but it took a while and I'm wondering if anyone has tips on how to make this process easier/faster?

sentences:
In Unity, can I make a GameObject within a prefab disabled by default? If I create a simple object hierarchy in my scene...

-ExampleGameObject
--Child1 [is active]
--Child2 [is not active]

...how can I accurately store this as a prefab? If I drag ExampleGameObject to a new prefab, then instantiate that prefab, both Child1 and Child2 will be active, which isn't what I want.

sentences: 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:
How to cause delay of 1 second of bullets when space pressed I was wondering how to cause the bullets to delay since at the moment, they fire pretty much one after another. So I was wondering how to make each bullet be delayed by one second when the space bar is pressed/held down.

public class TheGun extends GunType{

  private Rectangle bullet;
  private final double speed = 3d;

  public TheGun(double xPos, double yPos, int width,int height){
    this.setxPos(xPos);
    this.setyPos(yPos);
    this.setWidth(width);
    this.setHeight(height);

    this.bullet = new Rectangle((int) getxPos(),(int) getyPos(), getWidth(), getHeight());
  }

  @Override
  public void draw(Graphics2D g) {
    if(bullet == null)
      return;

    g.setColor(Color.YELLOW);
    g.fill(bullet);
  }

  @Override
  public void update(double delta, BlockyBlocks blocks) {
    if(bullet == null)
      return;

    this.setyPos(getyPos() - (delta * speed - 1));
    bullet.y = (int) this.getyPos();
    wallCollide(blocks);
    isOutofBounds();
  }

  @Override
  public boolean collisionRect(Rectangle rect) {
    if(this.bullet == null)
      return false;

    if(bullet.intersects(rect)){
      this.bullet = null;
      return true;
    }

    return false;
  }

  @Override
  public boolean collisionPoly(Polygon poly) {
    // TODO Auto-generated method stub
    return false;
  }

  @Override
  public boolean destroy() {
    if(bullet == null)
      return true;

    return false;
  }

  @Override
  protected void wallCollide(BlockyBlocks blocks) {
    for(int i = 0; i < blocks.wall.size(); i++){
      if(bullet.intersects(blocks.wall.get(i))){
        blocks.wall.remove(i);
        bullet = null;
        return;
      }
    }
  }

  @Override
  protected void isOutofBounds() {
    if(this.bullet == null)
      return;

    if(bullet.y < 0 || bullet.y > Sea_InvadersDisplay.HEIGHT || bullet.x < 0 || bullet.x > Sea_InvadersDisplay.WIDTH){
      bullet = null;
    }
  }
}

sentences:
XNA 3D custom shader/effect gives shakey rendering in the distance I am rendering a simple flat plane + texture to use as the floor for a game. I'm rendering it using  a custom effect I've written.

The problem I have is that the ground in the distance gets a bit distorted and shakey when the camera moves forwards and backwards.

If I render the same model + texture using the BasicEffect instead of a custom shader it appears smooth and works correctly.

Here's the XNA code setting up the custom effect:

Matrix worldMatrix = Matrix.CreateScale(0.2f);
_floorEffect.CurrentTechnique = _floorEffect.Techniques["Textured"];
_floorEffect.Parameters["World"].SetValue(worldMatrix);
_floorEffect.Parameters["ViewProjection"].SetValue(camera.view * camera.projection);

_floorEffect.Parameters["diffuseTexture"].SetValue(_diffuseTexture);

foreach (EffectPass pass in _floorEffect.CurrentTechnique.Passes)
{
     pass.Apply();
     device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, meshPart.NumVertices, meshPart.StartIndex, meshPart.PrimitiveCount);
}

Here's the shader code:

float4x4 World;
float4x4 ViewProjection;
Texture diffuseTexture;

sampler TextureSampler = sampler_state { texture = <diffuseTexture>; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = wrap; AddressV = wrap;};

struct TexturedVertexToPixel
{
    float4 position : POSITION0;
    float2 textureCoords : TEXCOORD0;
};

TexturedVertexToPixel TextureVertextShader(float4 inPos : POSITION, float2 inTextureCoords : TEXCOORD0)
{
    TexturedVertexToPixel output;
    float4x4 preWorldViewProjection = mul (World, ViewProjection);
    output.position = mul(inPos, preWorldViewProjection);
    output.textureCoords = inTextureCoords;

    return output;
}

float4 TexturePixelShader(TexturedVertexToPixel input) : COLOR0
{
    return tex2D(TextureSampler, input.textureCoords);
}

technique Textured
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 TextureVertextShader();
        PixelShader = compile ps_2_0 TexturePixelShader();
    }
}

Videos to demonstrate what I mean:

Using the BasicEffect http://www.youtube.com/watch?v=matmrIZH-pU
Using the Custom Shader http://www.youtube.com/watch?v=Fu9P4D-UCTc  (see it clearest in 1080p full screen)

Notice the difference when looking at the ground in the distance.

sentences:
How can I build Goal Oriented Action Planning within an Entity Component System? I've been creating an interactive fiction game in javascript that uses an entity component system as described here. The problem I've encountered is in developing the AI system for the game. Ideally, I'd like to use Goal Oriented Action Planning (GOAP) for the AI. Unfortunately, this seems to be at odds with using an ECS, largely because the state pattern doesn't seem to work with such entity frameworks.
Here's a simple example of a series of actions that might be taken to achieve the goal of answering a phone within the game.
Goal: answer the phone when it rings
Walk to desk -> sit on chair -> pick up phone
The route taken to answering the phone might end up differing based on the presence of numerous other preconditions. Maybe there's an obstacle in the way, or perhaps the actor no longer has a chair to sit on. In addition to this, the actor may be given other priorities in a queue.
At the moment, even simple goals are causing headaches with a lot of conditional checks.
I'm wondering, it it possible to implement something like GOAP within such a game, and how would I go about accomplishing this? Or should I give up on using GOAP for some alternative AI system?

sentences:
Realistic angular velocity for rolling sphere in Unity 5.1 I'm trying to make a small 2D game with a rolling ball/sphere using Unity 5.1, but if find the angular velocity of the ball weird.

On this first image (http://imgur.com/8wBoGms), you can see the sphere in 2D and in its initial position. On this second image (http://imgur.com/ArCRSZn), the sphere was moved by rolling until it made a 90° turn.

But the distance traveled by the sphere is greater than it should, if you wanted to be to be realistic :
you can see that the radius of the circle is equal to the size of the squares' sides, so the circle circumference should be equal to ~6.28 (in square side size). If the sphere was traveling realistically, it should travel ~1.57 (in square side size) to turn 90°.
But in the second image, we can see that it take 3 and not 1.57 .

The controller of the sphere is simply adding a force when a left or right button is pressed :

public class PlayerController : MonoBehaviour
{
    public float speed;
    private Rigidbody2D rg2d;

    void Start()
    {
        rg2d = GetComponent<Rigidbody2D>();
    }

    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxisRaw("Horizontal");

        Vector2 movement = new Vector2(moveHorizontal, 0.0f);
        rg2d.AddForce(movement * speed * Time.deltaTime);
    }
}

So my question is : how can I make the angular velocity realistic in this situation? Or am I doing something wrong?

Thanks for taking the time, I really appreciate !

sentences:
Should I always be checking every neighbor when building voxel meshes? I've been playing around with Unity3d, seeing if I can make a voxel-based engine out of it (a la Castle Story, or Minecraft).

I've dynamically built a mesh from a volume of cubes, and now I'm looking into reducing the number of vertices built into each mesh, as right now, I'm "rendering" vertices and triangles for cubes that are fully hidden within the larger voxel volume.

The simple solution is to check each of the 6 directions for each cube, and only add the face to the mesh if the neighboring voxel in that direction is "empty". Parsing a voxel volume is BigO(N^3), and checking the 6 neighbors keeps it BigO(7*N^3)->BigO(N^3).

The one thing this results in is a lot of redundant calls, as the same voxel will be polled up to 7 times, just to build the mesh.

My question, then, is:

Is there a way to parse a cubic volume (and find which faces have neighbors) with fewer redundant calls? And perhaps more importantly, does it matter (as BigO complexity is the same in both cases)?

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:
Collision Between SKSpriteNode and SKShapeNode I'm trying to create a collision between two objects. One is a SKSpriteNode and the other is a SKShapeNode. The code I have so far for determining contact is:

 func didBeginContact( contact: SKPhysicsContact) {
        let firstBody  : SKPhysicsBody = contact.bodyA
        let SecondBody : SKPhysicsBody = contact.bodyB

        if ((firstBody.categoryBitMask == PhysicsCatagory.Orange) && (SecondBody.categoryBitMask == PhysicsCatagory.Red)) || (firstBody.categoryBitMask == PhysicsCatagory.Red) && (SecondBody.categoryBitMask == PhysicsCatagory.Orange) {

            CollisionWithRed(firstBody.node as! SKSpriteNode, Red: SecondBody.node as! SKShapeNode)
        }

    }

    func CollisionWithRed (Orange: SKSpriteNode, Red:SKShapeNode){
       Orange.removeAllChildren()
       Red.removeAllChildren()
    }

The problem is that after the collision, the Orange and Red are not removed from the screen. They are still there.

The code for Orange is :

 func SpawnOranges () {
        let Orange = SKSpriteNode(imageNamed: "Orange.png")
        Orange.size = CGSize (width: 80, height: 80)
        let MinValue = self.size.width / 8
        let MaxValue = self.size.width - 20
        Orange.zPosition = 7
        let SpawnPoint = UInt32 (MaxValue - MinValue)
        Orange.position = CGPoint (x: CGFloat(arc4random_uniform(SpawnPoint)), y: self.size.height)
        Orange.physicsBody = SKPhysicsBody(rectangleOfSize:Orange.size)
        Orange.physicsBody?.categoryBitMask = PhysicsCatagory.Orange
        Orange.physicsBody?.affectedByGravity = false
        Orange.physicsBody?.dynamic = true
        Orange.physicsBody?.contactTestBitMask = PhysicsCatagory.red
        let action = SKAction.moveToY(-150, duration: 2.0)
        let actionDone = SKAction.removeFromParent()
        Orange.runAction(SKAction.sequence([action, actionDone]))

        addChild(Orange)

The code for Red is :

class Red: SKShapeNode{
    convenience init(path: UIBezierPath, color: UIColor, borderColor:UIColor) {
        self.init()
        self.path = path.CGPath
        self.fillColor = color
        self.strokeColor = borderColor

        Red = Red(path: projectilePath, color: UIColor.redColor(),
          borderColor: UIColor.blackColor())
        Red.position = Settings.Metrics.projectileRestPosition
        Red.zPosition = 7
        Red.name = "Square"
        Red.physicsBody = SKPhysicsBody()
        Red.physicsBody?.categoryBitMask = PhysicsCatagory.Orange
        Red.physicsBody?.affectedByGravity = false
        Red.physicsBody?.contactTestBitMask = PhysicsCatagory.Orange
        Red.physicsBody?.collisionBitMask = PhysicsCatagory.Orange
        Red.physicsBody?.dynamic = true
        Red.physicsBody?.affectedByGravity = false
        addChild(Red)

Any help would be extremely appreciated!

sentences:
Pathfinding with MicroPather : costs calculations with sectors and portals I'm considering using micropather to help me with pathfinding. I'm not using a discrete map : I'm working in 2d with sectors and portales. However, I'm just wondering what is the best way to compute costs with this library in this context.

Just to be more clear about geometrical shapes I'm using : sectors are basically convex polygons, and portals are segments that lies on sector's edge.

Micropather exposes a pure virtual Graph class that you must inherate and overrides 3 functions. I understand how pathfinding works, so there's no problem in overriding those functions. Right now, my implementation give me results, i.e I'm able to find a path in my map, but I'm not sure I'm using an optimal solution.

For the AdjacentCost method : I just take the distance between sector's centers as the cost. I think a better solution should be to use the portal between the two sectors, compute its center, and then the cost should be : distance( sector A center, portal center ) + distance ( sector B center, portal center ). I'm pretty sure the approximation I'm using with just sector's center is enough for most cases, but maybe with thin and long sectors that are perpendicular, this approximation could mislead the A* algorithm.

For the LeastCostEstimate method : I just take the midpoint of the two sectors.

So, as you understand, I'm always working with sectors' centers, and it's working fine.  And I'm pretty sure there's a better way to work.

Any suggestions or feedbacks? Thanks in advance!

sentences:
In Unity for Android, how do I create touchable buttons? I'm making a test game for Android in Unity 5, and I want to add left-right control buttons like the circles below, to move an object left or right.

(source: raywenderlich.com)

How can I do this?

Sorry if this question is basic. I'm new to Unity and I don't understand the methods of existing tutorials.

sentences:
For voxel rendering, what is more efficient: pre-made VBO or a geometry shader? Given a fairly static voxel array, what is more efficient: using the CPU to pre-generate a VBO to render the voxel faces (ignoring more advanced forms of rendering like marching cubes for now) or using a geometry shader on the GPU to generate the faces on the fly?

I'm not that worried about updating changing voxels but of course that is a benefit of the GPU-version since you don't have to rebuild the VBOs. Also, the GS approach feels a bit more modern :)

On the other hand, I haven't looked at the details on how a GS actually works with the rasterization pipeline in modern GPUs. Does it output the vertices into a sort of stream-cache or is the vertices written to the normal GPU memory in between? If it's the latter, then on-the-fly generating could reduce the available bandwidth and processing power from the rest of the GPU tasks I guess and then it would be more beneficial to do it on the CPU..

sentences:
Random move to certain points? I want my enemy to move randomly to certain points on the scene. It moves to one point and then stops! It does not continue to the other points!

Here is my script:

using UnityEngine;
using System.Collections;

public class emove: MonoBehaviour {

NavMeshAgent ePath;
public GameObject[] POINT;

void Start () {
    ePath = GetComponent<NavMeshAgent>();
}

void Update () {

    foreach (GameObject waypoint in POINT) {
        ePath.SetDestination(waypoint.transform.position);
        ePath.speed = 2;

      // I write this, if you have different idea tell me please
        if (waypoint.activeSelf == false) // waypoint had it own script, when enemy touch any point it set off
        {
            ePath.SetDestination(waypoint.transform.position); // move to any other active waypoint.
            ePath.speed = 2;
        }
    }
}

What am I doing wrong?

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 to rotate a character according to the body alignment of the ragdoll to fit the 'getting up' animations? I'm trying to make a character rotate in the right direction so that when the character gets up from a ragdoll state, the animation would closely match the initial lay down position of the ragdoll.
The character has a third person controller and when I move it around, it rotates according to the directions from the joystick. So when it falls it usually gets up in the right direction but sometimes, when the character falls from a cliff, the animation doesnt match the ragdoll orientation.
I'm using this method to calculate whether the hips are pointing upward or downward so I can trigger the right animation.
        wasRootBoneFacingUpward = Vector3.Dot(bones[0].forward, Vector3.down) < 0;

How can I rotate my character so that it fits the body alignment of the ragdoll ?

sentences:
Model too small in Orthographic view This must be super-basic, but I don't know where the problem is, since I just started with 3D-Programming.

Why is my model "ballTest" so small on the screen?

private Model _model;
private Matrix view, proj;

//Initialize()
_model = Content.Load<Model>("ball test");
view = Matrix.CreateLookAt(new Vector3(0, 0, 10), new Vector3(0, 0, 0), Vector3.Up);
proj = Matrix.CreateOrthographic(800, 480, 0.1f, 30.0f);

//Draw
_model.Draw(Matrix.Identity, view, proj);

sentences:
How to keep server-client clocks in-sync for precision networked games like Quake 3? I'm working on a 2D top-down-shooter and doing my best to copy concepts used in networked games like Quake 3.

I have an authoritative server.
The server sends snapshots to clients.
Snapshots contain a timestamp and entity positions.
Entities are interpolated between snapshot positions so movement looks smooth.
By necessity, entity interpolation occurs slightly "in the past" so that we have multiple snapshots in which to interpolate between.

The problem I'm facing is "clock synchronization".

For simplicity-sake, let's just pretend for a moment that there is zero latency when transferring packets to and from the server.
If the server clock is 60 seconds ahead of the client clock, then a snapshot timestamp will be 60000ms ahead of the client local timestamp.
Therefore, entity snapshots will collect and sit for about 60 seconds before the client sees any given entity make his moves, because it takes that long for the client clock to catch up.

I've managed to overcome this by calculating the difference between the server and client clock each time a snapshot is received.

// For simplicity, don't worry about latency for now...
client_server_clock_delta = snapshot.server_timestamp - client_timestamp;

When determining how far along into the interpolation the entity is, I simply add the difference to the client's current time.
The problem with this however, is that it will cause jerkiness because the difference between the two clocks will abruptly fluctuate due to snapshots arriving quicker/slower than others.

How can I synchronize the clocks closely enough that the only perceivable delay is that which is hard-coded for interpolation, and that which is caused by ordinary network latency?

In other words, how can I prevent interpolation from starting too late or too soon when clocks are significantly desynchronized, without introducing jerkiness?

Edit: According to Wikipedia, NTP can be used to synchronize clocks over the internet to within a matter of a few milliseconds. However, the protocol seems complicated, and perhaps overkill for use in games?

sentences:
Creating force shields: the most efficient way of deforming/reshaping a simpler convex mesh so it envelopes a complex mesh? So, the best way I can think of how to explain what I need is the following (images used here are just random images found trough google image search).

What I am trying to create during run-time is pretty much the same as a force shield that envelopes a robot or a space ship in many different futuristic types of games.

However, considering that these robots or ships have a shape that is unknown in advance, I don't want to just use a sphere-mesh around the ship or just assign a shield-shader directly to the ship mesh like in the pictures below:

I want to end up with a shield that is formed by a mesh that loosely represents the shape of the ship. Something like what can be seen in the pictures below:

However, I don't need those shields to be concave like in that pictures. It can be a convex mesh.

So far, what I've tried was to generate a sphere or a cylinder around the complex mesh (robot/ship), loop trough each vertex and try to approximate to the complex mesh. However, that is severely inefficient and gives non-smooth results.

Would you happen to have any idea, code sample, tutorial links, article references or anything on how can I proceed to get what I want in an efficient manner? The shields do not have to very detailed in terms of polygons. In fact, the less the better.

I am currently using C#, but I can handle C++ as well. Thanks in advance.

sentences:
Unity Mirror can't reflect another mirror across from it I created a mirror in Unity using the FX/MirrorReflection and the script that comes with it.
http://wiki.unity3d.com/index.php/MirrorReflection4

One mirror at a time works perfectly fine, but as soon as I add another mirror in front of the other mirror it starts bugging out.

See image below for the result I'm getting.

Does anyone know how to fix this so that both mirrors can reflect off each other?

sentences:
Unreal Crashing just by me adding components I have created an actor cpp class called gun base.  for some reason it is causing a perpetual crash in unreal.
this is its header file.
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "GunBase.generated.h"

UCLASS()
class GIZMOSHOOTER_API AGunBase : public AActor
{
    GENERATED_BODY()

public:
    // Sets default values for this actor's properties
    AGunBase();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:
    // Called every frame
    virtual void Tick(float DeltaTime) override;
    //virtual void PullTrigger();

private:

    UPROPERTY(EditDefaultsOnly)
    USoundBase* FireSound;
    UPROPERTY(EditDefaultsOnly)
    UParticleSystem* MuzzleFlash;

    UPROPERTY(EditDefaultsOnly)
    USceneComponent* RootSceneComponent = nullptr;
    UPROPERTY(EditDefaultsOnly)
    UStaticMeshComponent* GunMesh = nullptr;
    UPROPERTY(EditDefaultsOnly)
    USceneComponent* BulletSpawnPoint = nullptr;
};

and this is the cpp file.
// Fill out your copyright notice in the Description page of Project Settings.

#include "GunBase.h"
#include <Components/StaticMeshComponent.h>
#include <Components/SceneComponent.h>

// Sets default values
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->SetupAttachment(GunMesh);  //This is the line its complaining about
}

// Called when the game starts or when spawned
void AGunBase::BeginPlay()
{
    Super::BeginPlay();

}

// Called every frame
void AGunBase::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

}

The crash is saying something about an exception access violation, and in particular is referencing line seventeen  on the cpp file which has a comment on it.  Just in case this means something, I have tried several things to get this code to work, I then builded it, and tried to open the project in unreal again but i always got a crash.  thanks.
Edit:  I had a function in the header file (pulltrigger its commented out) that was causing me errors but I commented it out and the crash is still occuring.

sentences: How to collide with a 45degree wall in XNA I want to make a PAC MAN imitation game to start working on AI, and while my first version will feature rectangles with widths or heights of 1 to makes walls for collision detection, I want to eventually make walls that are at 45 degree angles. I have found no guides out there to do this, only that rectangles can't be rotated apparently.

sentences:
Slick2d font rendering makes all other drawings vanish I'm converting a java game to lwjgl and slick-utils. I've followed the slick2d examples for font loading/rendering but I found that the font shows as a solid box of color unless I add the following glBlendFunc code:

GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
head_font.drawString( (float)(x + 20), (float)(y + 80), "Title Here", org.newdawn.slick.Color.green);
GL11.glDisable(GL11.GL_BLEND);

I've tried leaving this code as-is, I've tried leaving the blend function on, but any other drawing methods I have vanish when that blendFunc line is left in.

For example, here's a basic rectangle drawing method. The rect drawn here, only shows when I leave out the blend func. Is there a different blend func I need to constantly switch to?

GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f( r_f, g_f, b_f, a_f );
GL11.glRecti(x1, y1, x2, y2);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);

Update: Setting the blendFunc back to default values for the drawRect method I have works, but I'm not sure yet if it's the right solution.

GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);

sentences:
Approaches to draw multiple objects I'm looking for an efficient way to render multiple object with unique texture sets each.

Right now I combine multiple objects into a single static vertex and index buffers in the way like this:

std::vector<Verts> v(m_vsize);
std::vector<uint32_t> ind(m_isize);

// SKIPPED: adding vertex and index data to "v" and "ind" vectors

D3D11_BUFFER_DESC vertexBuffer_desc = {};
vertexBuffer_desc.Usage = D3D11_USAGE_IMMUTABLE;
vertexBuffer_desc.ByteWidth = sizeof(Verts) * m_vsize;
vertexBuffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBuffer_desc.CPUAccessFlags = 0;
vertexBuffer_desc.MiscFlags = 0;
vertexBuffer_desc.StructureByteStride = 0;

D3D11_SUBRESOURCE_DATA vertexData = {};
vertexData.pSysMem = &v[0];
vertexData.SysMemPitch = 0;
vertexData.SysMemSlicePitch = 0;

HRESULT hr = m_d3dDevice->CreateBuffer(&vertexBuffer_desc, &vertexData, &m_vertexBuffer);
if (FAILED(hr))
    return;

D3D11_BUFFER_DESC indexBuffer_desc = {};
indexBuffer_desc.Usage = D3D11_USAGE_IMMUTABLE;
indexBuffer_desc.ByteWidth = sizeof(uint32_t) * m_isize;
indexBuffer_desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
indexBuffer_desc.CPUAccessFlags = 0;
indexBuffer_desc.MiscFlags = 0;
indexBuffer_desc.StructureByteStride = 0;

D3D11_SUBRESOURCE_DATA indexData = {};
indexData.pSysMem = &ind[0];
indexData.SysMemPitch = 0;
indexData.SysMemSlicePitch = 0;

hr = m_d3dDevice->CreateBuffer(&indexBuffer_desc, &indexData, &m_indexBuffer);
if (FAILED(hr))
    return;

After that I pass my buffers to Render() method and render everything with a single DrawIndexed() call:

// some stuff
m_d3dContext->IASetVertexBuffers(0, 1, m_vertexBuffer.GetAddressOf(), &stride, &offset);
m_d3dContext->IASetIndexBuffer(m_indexBuffer.Get(), DXGI_FORMAT_R32_UINT, offset);
// some more stuff
m_d3dContext->DrawIndexed(m_isize, 0, 0);

Where m_isize is a count of total indices.
So what I'm looking for is how do I draw multiple objects separately?
 - Create individual buffers per each object (object count is unknown at startup)?
 - Create dynamic buffers and use those?
 - Keep using static buffers with re-assigning pointers to new objects and call DrawIndexed() per object instead of per frame?
 - A common solution? (Obviously unknown to me).

Basically all I need to find out is the name of pattern/technique commonly used to draw unknown amount of objects effectively.
My approach doesn't work because I merge all groups into single vector variable and so I can't give various texture sets to various objects.

sentences: XNA Why is Texture.GetData one dimensional? This is question has been really killing me. In XNA when you want to convert an image to color data using Texture.GetData, it only lets you make it a one dimensional array instead of a 2D one. This makes it much more difficult to work with. Is there a specific reason it's like that?

sentences:
Rendering Performance: num Draw Calls == num Texture Bindings I'm making a game with Libgdx 1.6.4 and experience some lag issues on iPhone 4 and then discovered:

// in the constructor
GLProfiler.enable();

...

// in the render method
Gdx.app.debug("draw calls: " + GLProfiler.drawCalls);
Gdx.app.debug("texture bindings: " + GLProfiler.textureBindings);
GLProfiler.reset();

What the log shows is that the number of draw calls is always equal to the number of texture bindings. Do you know if this is ok?

It seems strange because I have all images as TextureRegion in only one TextureAtlas with size 1024x512. Isn't it supposed to be that I will have for example 50 draw calls and only 1-2 texture binding instead of 50 draw calls and 50 texture bindings. Can this be the source of the lag?

Another clue may be, that I use a SpriteBatch and Scene2d Stage at the same time, but they both use the same TextureAtlas. The Scene2d Skin is loading the TextureAtlas and SpriteBatch draws TextureRegions from the skins' regions.

Thank you for any help.

--- Update ---

The main SpriteBatch (it's only one) is making 9 totalRenderCalls. The value of maxSpritesInBatch is 26. These values seem normal from what I read in the Docs and the FPS during rendering with the SpriteBatch is 60 FPS. Which is ok, no problem there.

The problem with the lag is when I use a Scene2D Stage to display a Dialog above the GameScreen. The Stage has it's own batch which I don't manipulate directly. When the Dialog is displayed the frame rate drops to 49-50 and the Animations in the Dialog are crappy. I guess the problem has something to do with Texture Binding of the main SpriteBatch and the Stage's SpriteBatch.

sentences:
What type of network design should be used for my game? Okay, so I am trying to design a multiplayer only game. Here is the gist of my multiplayer gameplay structure,

When a player starts up the game and clicks Play, he will be send to a map with 7 other players (i.e only total 8 players per map) who also just started the game like him.
It's basically like a deathmatch round. The last man standing is the winner.
The winner of the map will be transferred to another map which will consist of 7 other players like him who won their previous matches.  Note, the 7 losers of a match will be bought back to the main menu. When they click Play, they will start from the case mentioned in my first point.
And for the winners they will continue to play against winners from different maps.

So, my question is how to implement this network? Do I just need one main server? I am new to this so sorry if this question is very crude or stupid. Note, I just need a very high level network design considerations and suggestions.

sentences:
Unity: Animate Sprite Shape Sprite? Is it possible to animate a sprite shape?  I don't see the Sprite Shape Profile in the animator properties, so I was just wondering if there's another way to do that.
To clarify:
Our game is 2D animated by hand, and one level has conveyor belts that span the level.  We can animate it normally, but that will end up taking more video memory than if we were able to animate the conveyors as tiled sprite shapes.  It may not end up being worth the effort to save the memory, but I figured it was worth a shot.  Because the sprites span the level, they end up taking up lots of space in a sprite atlas.

sentences:
Component based entity system API naming problems My engine uses a component-based entity system internally, and I want to bind it to Lua for scripting.

Now, I want to save people who write scripts for it typing work. In C++, to set the position of an entity, you'd do the following:

pEntity->GetComponent< CPoint >()->SetPos( Vector( X, Y ) );

That means, if I'd bind it to Lua 1:1 you'd also have to:

ent:GetComponent( CP_POINT ):SetPos( 123, 456 )

But let's be honest, would you want to type so much just to set an entities' position?

I don't think so, that's why I "hid" the component system from Lua:

Right now, what you do is

ent:SetPos( 123, 456 )

The component stuff is handled internally. You can still manually add and remove components from Lua with ent:AddComponent and ent:RemoveComponent, etc.

Now, this doesn't seem perfect either:

The Entity metatable gets cluttered because it has to take all functions of all components
Naming problems: ent:SetJointMotorEnabled() again seems kind of bad

Do you have any ideas how I could find a better naming scheme for component functions, without risking the scripting comfortability?

sentences:
Creating a UI health bar image for each enemy object I would like to create a small health bar on top of each enemy in my game. I know how to do this for one enemy, but I'm not completely sure how best to expand it to work for each enemy in the game. I'm guessing I should instantiate the UI health bar prefab somewhere, each time an enemy is spawned maybe? Currently, I don't even have an enemy spawner, I'm just testing by dragging enemy prefabs into the scene. I'll post the relevant scripts.

public class EnemyHealthBarController : MonoBehaviour
{
    private Image remainingHealthImage;

    private EnemyHealth enemyHealth;

    void Start()
    {
        remainingHealthImage = transform.Find("Remaining Health Image").gameObject.GetComponent<Image>();

        enemyHealth = GameObject.FindGameObjectWithTag("Enemy").GetComponent<EnemyHealth>();
    }

    void Update()
    {
        remainingHealthImage.fillAmount = enemyHealth.currentHealth / enemyHealth.maxHealth;

        if (enemyHealth.isDead)
        {
            gameObject.SetActive(false);
        }
    }
}

and

public class ClampEnemyHealthBar : MonoBehaviour
{
    private GameObject enemyHealthBar;

    private Vector3 offset;

    void Start()
    {
        enemyHealthBar = GameObject.Find("Enemy Health Bar");

        offset = new Vector3(0f, 30f, 0f);
    }

    void LateUpdate()
    {
        Vector3 desiredPosition = Camera.main.WorldToScreenPoint(transform.position) + offset;
        enemyHealthBar.transform.position = desiredPosition;
    }
}

Right now, I'm using GameObject.Find to set a reference to the preexisting enemy health bar in the scene. Also, I'm only finding the EnemyHealth component of one of the enemies. How might I better structure this in order to do the kind of thing I'm trying to do?

sentences:
Good ways to implement cutscenes in 2d RPG I want to know of some different ways to implement cutscenes in a 2D RPG game with SDL2 and C++.

My current idea is creating different functions in different files for different cutscenes and running them whenever I need to show a cutscene.

However, this doesn't seem like a very easy or simple way to render cutscenes. How would I effeciently implement cutscenes?

sentences:
Need help with rotating sword around player (Unity 2D) I'm having an issue with rotating an object around another object in my top-down roguelike in Unity 2D. My goal is to rotate a sword around a player based on joystick input from a controller (as shown in this image).

I have looked around online for any answers, but nothing has helped. All I have so far that is remotely close to what I want is code that keeps the sword attached to the box even when the box moves.
void Update()
{
    transform.localPosition = new Vector3(0, 1.5f, 0);
}

It might be necessary to note that the sword object is a child of the box object. I would appreciate it if anyone could point me in the right direction. Thanks!

sentences:
Costs for developing an Iphone physics game? I recently made a game demo inspired by a wooden board game where you drop the ball trying to make a score, is fully playable so take a look (Works best on firefox):
https://dl.dropbox.com/u/62131673/LuckyBall-Chrome/index.html

I want to build this game for the Iphone's App Store, add accelerometer features, menus, unlockable levels, best scores, etc. I'm a graphic designer so I prefer to keep working on the presentation (graphics, assets, sound, music) and leave the rest to the programmer.

I want to know how much this game would cost for a programmer to be developed, so I can make a video at kickstarter.com and sell the idea, with luck this game will see the light.

I don't want to open a debate on the subject, I just need advice on the costs so I can hire someone.

sentences:
Drawing order of 2D tiles with 3D bounding volume I'm wondering which algorithm was used to draw the sprites of the video game Commandos in the correct order. Each sprite has a 3D bounding volume (either a polygon or a cylinder), this is how the developers stored the information:

POLY "NONAME",73,987,0,54,7,1   ;Name,CenterX,CenterY,CenterZ,Height,#Vertices,#Tiles
POINT        0,-37              ;Coord. X, Coord. Y
POINT        36,-18
POINT        36,-1
POINT        28,28
POINT        -21,37
POINT        -36,1
POINT        -36,-9
TILE          37, 581,  74,  83,   0,   0, 0,"ROC10010.RLE","   "   ;PosX,PosY,Width,Height

POLY "NONAME",70,816,0,120,4,1
POINT        0,-8
POINT        8,6
POINT        0,10
POINT        -8,-3
TILE          48, 434,  50,  98,   0,  41, 0,"POST0001.RLE","   "

POLY "NONAME",1557,4094,0,44,0,1
RADIO       17
TILE        1539,2588,  37,  55,   7,   0, 0,"DEPT0000.RLE","   "

POLYRAMPA "NONAME",626,952,0,48,40,4,1  ;Name,CenterX,CenterY,CenterZ,Height,HeightOff,#Vertices,#Tiles
POINT       43,-8
POINT       2,29
POINT        -36,-7
POINT       1,-45
TILE         590, 515,  85, 111,   0,   0, 0,"CASA0003.RLE","   "

The last object named 'POLYRAMPA' is used for stairs and ramps.
Edit: All bounding volumes are convex and don't overlap each other.

And here are some in-game screenshots:

The first three screenshots show the same map. Of course it's possible to fake the drawing order of this 'flat' map by sorting the sprites by their y-value.

But this approach won't work if the map is more complex, like the one at the bottom right.

So my question is: Which algorithm did the developers use?
Bonus question: Is there some source code available? (pseudocode or any object-oriented programming language would be great)

Edit: Sorting by the XYZ-coordinates of the bounding boxes center point doesn't work.For example:

The objects on the left side have the same center points as the objects on the right. The cylinder on the left should be in the background but the one on the right in the foreground.

sentences:
How to Destroy an Instance of a Prefab Without Removing the Prefab? I'm making a simple runner game where obstacles spawn off in the distance and move towards the player. I want to remove them after they're invisible to the player.

I made an Obstacle prefab and a SpawnObstacles.cs script, which I added to an empty game object. In it, I call

Instantiate(obstaclePrefab, xLocation, yLocation, zLocation, Quaternion.identity);

a set number of times per second.

In the Update() method of the obstacle prefab, I have

if (transform.position.z < -20){
    GameObject.Destroy(gameObject);
}

so each obstacle will destroy itself automatically.

When I run the game, I get a:

MissingReferenceException: The object of type 'GameObject'
has been destroyed but you are still trying to access it.

error on the Instantiate call in SpawnObstacles.cs

Before the game starts:

As the game is running:

How can I have a single instance of a prefab destroy itself without destroying the entire prefab? I think I need the obstacles to be inside the Obstacle Prefab. Perhaps I could loop through all obstacles and delete the ones invisible to the player?

sentences: Game Website Wrapper I am looking to make a simple program (in any language) then when you run the .exe the only thing it does is display a website (the whole website is my game) without any navigation buttons as they are integrated into the pages.

sentences:
Creating a rotation offset based on camera position with XNA I have an XNA project where characters have the ability to pick up and move objects around (in 3d). When an object is picked up by a character, I want ithe objects position to always be out in front of the character (as if the character was holding it in their arms). I'm having trouble creating the offest using the charactors forward vector. The main issue is that I don't know how to properly incorporate the characters rotation into the objects position. I'm hoping somebody can give me an example of how to accomplish this to help point me in the right direction. Thanks!

Currently I'm just matching the held object's world matrix with the characters as a work around:

grabbedSceneObject.World = Matrix.CreateScale(20F) * Matrix.CreateTranslation(viewPosition);

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:
Changing scene while joining room and RPC buffer problem I have a button on my main menu that creates and has the player join a random room. After the client joins this room, I change the scene to the game (main) scene in the OnJoinedRoom method. This works well, until I use the RPC call with buffers.

There are 5 spawn points in the game scene, and every time a player joins the room, they occupy a spawn point, so no-one else can spawn at that point.
So, I have list of spawn points in my code, and every time a player joins, it randomly picks a point from that list and "removes" it from the list. It does this via RPC call, so if a player joins the game late, it removes that point, too.

There is a problem with that RPC's buffer because of the "scene change". After OnJoinedRoom, the RPC buffers are called only when the player joins the room, and before the scene change. Because the scene hasn't changed yet, it has trouble finding the buffered photonview, and it throw outs an error. It doesn't update the list.

Can I delay the buffer calls, is there a better way to change my scene while joining a room?

sentences:
File Path Characters I have a simple question that I can't find a answer to:

With the .NET Framework what is the difference in saying "folder1/folder2/file" and "folder1\\folder2\\file" in a file directory? Is there even a difference?

Also what does the "@" character do? I'm not sure if this is XNA specific or .NET specific but here is an example: ContentManager.Load<Texture2D>(@"SpriteSheets/Tile");

Thanks.

sentences: How to hide fbx files for commercial release I see that all commercial games I've played never expose their fbx files - usually, they archive the fbx files into PAK file or BIN file. For example, Torchlight 2 use  OGRE3D for their Graphic Engine, and at the loading screen, they un-pack the PAK file. How do they do that?

sentences:
How to build a math module and simulate a system? For example, in the classical game SimCity:

an economic model to simulate the supply and demand of the city, then calculate how many people live in each building, how many people work there.
a traffic model to simulate the commute time of the citizens,
in another game, there'd be a whole stock market, where the player and sim-citizens can buy and sell.

Obviously, we cannot simulate every single citizen, every single car, every single trader in the market, we need some math modules and formulas.

I'm making a fake SimCity and almost finished the graphics parts. Now I'd like to know how to do the math parts, or how to build such math modules.

sentences:
Poor CUDA performance, raytracing I use CUDA 7.5 to learn the basics of raytracing. So far I've done nothing but constant color no-lighting spheres-only raytracing. But my delta time is already 14 - 16 ms for 800x600 resolution - 1 ray for each pixel.

Some pc specs, if needed:
GPU - nvidia titan black,
CPU - intel core i7...,
enough RAM.

Here is the kernel:

__global__ void runKernel(Camera* cam, SphereData* objs, uint* size, uchar* out_img)
{

vec3 pos = cam->getPos();
rs::Rectangle rec = cam->genNearPlaneRectangle();
vec3 start = rec.center - rec.right - rec.up;
float pixelsizex = 1.0F / cam->getWidth();
float pixelsizey = 1.0F / cam->getHeight();
uint width = cam->getWidth();

uint id = threadIdx.x + blockIdx.x * blockDim.x;
uint i = id % width;
uint j = id / width;

vec3 pixelW = start + rec.right * 2 * (pixelsizex / 2 + pixelsizex*i) + rec.up * 2 * (pixelsizey / 2 + pixelsizey*j);
vec3 dir = (pixelW - pos).normalize();

Ray ray = Ray(pos, dir);

vec3 resColor = Tracer::rayTraceSpheres(ray, objs, *size);

out_img[4 * width * j + 4 * i + 0] = 255 * resColor.x();
out_img[4 * width * j + 4 * i + 1] = 255 * resColor.y();
out_img[4 * width * j + 4 * i + 2] = 255 * resColor.z();
out_img[4 * width * j + 4 * i + 3] = 255;

}

I have a really basic standart setup for OpenGL, I use it to render a fullscreen texture of raytracing results.

Main loop's update and render functions:

void Graphics::update()
{
cameraUpdate();

//println(camera.genLookingRay().dir.toString());

uint objSize = objs.size();
cudaMemcpy(cudaData.d_cam, &camera, sizeof(Camera), cudaMemcpyHostToDevice);
cudaMemcpy(cudaData.d_objs, objs.getArray(), sizeof(SphereData)*objs.size(), cudaMemcpyHostToDevice);
cudaMemcpy(cudaData.d_size, &objSize, sizeof(uint), cudaMemcpyHostToDevice);

uint threadsPerBlock = 128;
uint blocks = ((uint)(width*height) + threadsPerBlock - 1)/threadsPerBlock;

runKernel <<< blocks, threadsPerBlock >>>(cudaData.d_cam, cudaData.d_objs, cudaData.d_size, cudaData.d_out_img);

// Check for any errors launching the kernel
cudaError cudaStatus = cudaGetLastError();
if (cudaStatus != cudaSuccess) {
    fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
}

cudaStatus = cudaDeviceSynchronize();

cudaMemcpy(image, cudaData.d_out_img, sizeof(uchar)*4*width*height, cudaMemcpyDeviceToHost);

RenderFullScreen::setupTexture(width, height, image, 0);
RenderFullScreen::build();

}

void Graphics::render()
{
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Shader::setCurrent(Shader::SHADER_HUD);
Shader::getCurrent().enable();
Shader::getCurrent().setUniformMat4f("P", camera.getMatOrthographic());
RenderFullScreen::render();
Shader::getCurrent().disable();

glfwSwapBuffers(window);
}

Function "rayTraceSpheres(...)":

__CUDA__ vec3 Tracer::rayTraceSpheres(Ray& ray, SphereData* objs, uint size)
{
    vec3 color(0,0,0);
    float tmin = INFINITY;

    for(size_t i = 0; i < size; i++)
    {
        Sphere obj = Sphere(objs[i]);

        float ct = tmin;
        vec3 cc(0,0,0);
        bool res = obj.hit(ray, ct, cc);

        if(ct < tmin) {
            color = cc;
            tmin = ct;
        }
    }

    return color;
}

__CUDA__ bool Sphere::hit(Ray& ray, float& tmin, vec3& color)
{
    float t;
    vec3 temp = ray.start - center;
    float a = ray.dir * ray.dir;
    float b = temp * 2 * ray.dir;
    float c = temp * temp - radius * radius;
    float disc = b * b - 4 * a * c;

    if(disc < 0){
        return false;
    }
    else
    {
        float e = sqrt(disc);
        float denom = 2 * a;
        t = (-b - e)/denom;
        if(t > 0){
            tmin = t;
            color = this->color;
            return true;
        }
        t = (-b + e)/denom;
        if(t > 0)
        {
            tmin = t;
            color = this->color;
            return true;
        }
    }
    return false;
}

What could be the issue ?

sentences:
How to manipulate 2d image as different objects Hello Im very new to this so I don't even know what this process is called exactly.
Im posting image of flappy bird here in which it consist all the objects day, night, birds, font etc Here :

So how to use them in 2D game? this is just example i have used. How to manipulate different objects at different coordinates ? Thanks.

sentences:
Method subscribed to an event is called twice for every time the event is raised I am trying to make an inventory system in Unity with ScriptableObjects and a text driver that displays the contents of an inventory. So far the code looks like this:
-An InventoryObject is defined as having a "Container" List of ItemObjects (simple scriptable objects, they just have a little information on the object as its sprite, its name, and whether or not it is stackable) and some methods to properly add or remove items (taking item stacking into account) from that list. https://pastebin.com/t4P3aGmi
-A PlayerInventory is a script that will be carried by the player's character. It contains a method for adding items collided with to its assigned InventoryObject instance. It also contains an OnItemPickedUp event that takes its InventoryObject instance as a parameter and passes it to listeners like UpdateDisplay. OnItemPickedUp is raised whenever a collision with a compatible item happens. https://pastebin.com/RsV7XYPp
-An UpdateDisplay script that listens to the OnItemPickedUp event and subscribes the
ProcessInventoryToSingleString(InventoryObject _inventory) method, that subsequently calls several methods to transform the contents of the InventoryObject's Container list into a single, formatted string. https://pastebin.com/N0nsvcWH
-The items are represented by giving a GameObject with a collider2D, aSpriteRenderer and script that contains the particular ItemObject's data and sets its SpriteRenderer's sprite to the ItemObject's.
The problem I'm having is that the method subscribed to the event is being called more than once for each time the event is raised. as shown by the debug logs. Sometimes it's called twice, sometimes even four. This results in my UI display showing more items than there are.
https://files.catbox.moe/afa467.mp4
https://files.catbox.moe/6oxh9b.mp4
Here are pictures of the console debug logs:

I appreciate any help.
EDIT: These errors also appear. I'd like to believe that they're unrelated.

sentences:
How to prepare a game for localization? Many projects don't think about localization until the game is done. Then localization is done as a hack, and it's obvious that it was added on later. Some specific areas of concern:

Text strings (obviously)
Audio clips such as music and/or narratives
Text rendered on textures (e.g. a label on a crate)
Text rendered in frames in pre-rendered movies
Fonts/Character sets for different languages
Etc.

What are some good ways to prepare for these challenges in the initial development stages, so you can make it easier without incurring too much cost up front?

sentences:
Bullets Stop when Shooting Unity 2D using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Makarov : MonoBehaviour
{
    public GameObject Bullet;

    public float BulletSpeed;

    public Transform ShootPoint;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0))
        {
            shoot();
        }
    }

    void shoot()
    {
        GameObject BulletIns = Instantiate(Bullet, ShootPoint.position, ShootPoint.rotation);
        BulletIns.GetComponent<Rigidbody2D>().AddForce(BulletIns.transform.forward * BulletSpeed);
    }
}

When I shoot the bullets just stop right in front if the gun.
This is for a top down shooting.

sentences: Way to Round Numbers I have it when the player clicks the mouse they can move the peice aoround the board. I am trying to have the chess pieces snap to a grid after the mouse has been released. Is there any way to round numbers so that I can round the X and Y coordinates so that it will snap to the grid?

sentences:
How can I apply Perlin noise to generating an asteroid from cubic voxels? I know I can use Perlin noise to generate randomised terrains, but for my current project i want to generate random asteroids of non-uniform length, width depth etc.

My first thought was to apply Perlin noise to a sphere, but i do not know how i would apply this with cubes space in a grid nor did i know whether it would make the asteroids appear random enough, my current assumption was they would all be relatively spherical still.

Is Perlin noise still the best method to be using for terrain not on a single plane?

sentences:
Stopping Animations For Player In Java Using Slick2D I have a problem with stopping animations for a player in Slick2D. I have tried many solutions to the problem and have looked up a couple of resources but I am still stumped by the fact that it is not working. Here's the code I have for my class:

public SpriteSheet playerSS = null;
protected InputHandler inputHandler;
public float playerX, playerY = 250f;
private Animation sprite, runningAnimationLEFT, runningAnimationRIGHT, runningAnimationUP, runningAnimationDOWN;
private int duration = 200;

public Game (int stateID) {

}

@Override
public int getID() {
    return Main.game; //GAMESTATE = 1
}

@Override
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    playerSS = new SpriteSheet("res/player_sprite_sheet.png", 50, 75);

    // ANIMATIONS
    runningAnimationDOWN = new Animation();
    runningAnimationDOWN.setAutoUpdate(true);
    runningAnimationDOWN.addFrame(playerSS.getSprite(1, 0), duration);
    runningAnimationDOWN.addFrame(playerSS.getSprite(0, 0), duration);
    runningAnimationDOWN.addFrame(playerSS.getSprite(2, 0), duration);

    runningAnimationLEFT = new Animation();
    runningAnimationLEFT.setAutoUpdate(true);
    runningAnimationLEFT.addFrame(playerSS.getSprite(1, 1), duration);
    runningAnimationLEFT.addFrame(playerSS.getSprite(0, 1), duration);
    runningAnimationLEFT.addFrame(playerSS.getSprite(2, 1), duration);

    runningAnimationRIGHT = new Animation();
    runningAnimationRIGHT.setAutoUpdate(true);
    runningAnimationRIGHT.addFrame(playerSS.getSprite(1, 2), duration);
    runningAnimationRIGHT.addFrame(playerSS.getSprite(0, 2), duration);
    runningAnimationRIGHT.addFrame(playerSS.getSprite(2, 2), duration);

    runningAnimationUP = new Animation();
    runningAnimationUP.setAutoUpdate(true);
    runningAnimationUP.addFrame(playerSS.getSprite(1, 3), duration);
    runningAnimationUP.addFrame(playerSS.getSprite(0, 3), duration);
    runningAnimationUP.addFrame(playerSS.getSprite(2, 3), duration);

    sprite = runningAnimationDOWN;
}

@Override
public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int delta) throws SlickException {
    inputHandler.updateKeyboardRelay(gameContainer);
    if (inputHandler.keyUP) {
        sprite = runningAnimationUP;
        sprite.update(delta);
        playerY -= delta * 0.1f;
    } else {
        // Stopping Animation goes here.
    }
    if (inputHandler.keyDOWN) {
        sprite = runningAnimationDOWN;
        sprite.update(delta);
        playerY += delta * 0.1f;
    } else {
        // Stopping Animation goes here.

    }
    if (inputHandler.keyLEFT) {
        sprite = runningAnimationLEFT;
        sprite.update(delta);
        playerX -= delta * 0.1f;
    } else {
        // Stopping Animation goes here.

    }
    if (inputHandler.keyRIGHT) {
        sprite = runningAnimationRIGHT;
        sprite.update(delta);
        playerX += delta * 0.1f;
    } else {
        // Stopping Animation goes here.

    }
}

@Override
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
    sprite.draw(playerX, playerY);
}

How would I go about stopping the animation from playing over and over again once the movement key is lifted? i.e. If someone presses the 'W' key the player does an animation going upwards, but if the user stops using the 'W' key how would I make it so that the animation stops playing as well?

sentences:
How can I find a free or cheap redistributable font supporting runic characters? I've been looking around for a font to include in my game which supports rune characters, specifically this Unicode block.

All the sites I go to don't demonstrate what Unicode characters that font contains, so I cannot gauge their usefulness for me.

I've been using the Segoe UI Symbol font, but it is only available on Win 7 & 8, and as far as I can tell, costs far too much to redistribute as part of a game.

Anyone know where I can go to find a font with my requirements?

sentences:
How to convert Maya shaders and Renderman shaders to GLSL? I know this 2 products but i have never used them for production, since I have a bunch of cool shaders i would like to use them under OpenGL with GLSL but i don't know where to start.

If it's not possible to convert them directly, where i can learn the Renderman syntax for the shaders?

sentences:
How do I prevent receiving data from the network from dropping rendering frames in a multiplayer game? I'm building an HTML5 massively multiplayer online game. I've been working on this project for awhile, but am having some trouble sorting through a couple of performance issues.

Since this is a multiplayer game, information is sent to and received from the network. When a client needs to know about new entities on the screen, the server must stream this data.

Unfortunately, one big problem I'm having right now is that sometimes either a) a lot of data needs to be streamed or b) lots of small pieces of data are streamed in a short amount of time. Both scenarios currently cause the client to drop rendering frames as the client spends its time receiving packets and processing the data.

What is the best way to prevent the networking data from causing frame rate problems? I am particularly interested in approaches to this kind of system that minimize frame drop issues, though suggestions tailored to my specific situation are welcome.

Update: To elaborate on the type of information sent in my particular case, my client does minimal interpolation and receives updates anytime the state of an entity changes on the server. The client also receives large packets with the entire state of an entity the first time the client needs to know about that entity.

sentences:
Issues with character controller (unity 4 project in unity 5) I'm having the weirdest issues with a game me and a mate have been working on. They came up immediately after moving from the last version of Unity 4 to Unity 5.

The two objects (player and enemy) return an error "Character Controller Settings are invalid" both on starting and stopping the game.

The enemy settings are:

Slope Limit:        50
Step Offset:        60
Skin Width:         0.003
Min Move Distance:  0
Center:            (0, 0, 0)
Radius:             0.01
Height:             0.01

some of the values have had to be scaled down to accommodate for the scale of the actual model.

Then, whenever the "Move" function calls (which use to have the enemy move towards the player), I get

CharacterController.Move called on inactive controller

which I have located to come from this code:

_controller.Move(moveDirection * Time.deltaTime);

where moveDirection is just a Vector3 co-ordinate of where to move too.

as I said, this was all working before I converted to the new version of Unity. I have checked and confirmed that the Character Controller is both correctly linked and enabled. I have not found anything useful looking up problems others have had with a similar error, and it's pretty much got me stumped.

sentences:
How to compress game frame by frame animation to a minimum on disk I developing a game like Age of empire (buildings on map) and for every building I have a sprite sheet for its animation. I am using frame by frame animation to animate the building ( not aware of any other method anyways). I am noticing that my resources folder is going extremely large due to the images I am putting in it.

How do games like CoC and Age of Empires keep their apk size under 50 Mg? Am I missing something here when it comes to game development

Thank you

EDIT: More info to the problem I am facing

I have a  LOT of animations drawables objects. I chose this way because it was the quickest and it was yielding the results the I want. Basically every building is an animation drawable in which its xml file refers to 8 drawables (8 images = 8 files). All of them are PNG due to transparency. Since I have over 200 images, the apk size is 120 MB ( And I am not done copying half of the files yet). That's what prompt, there has t o be a way to solve it. Please assist a fellow developer

sentences:
Love2D game and editor in two separate programs I'm building an engine in Love2D and I need to build an editor who will create scenes with game objects I wrote in lua.

The thing is that there's this guy in my team who said : "Don't include the editor within the game, make it separate from it so you won't load the whole editor with the game itself"

So I'm asking how could I achieve this type of structure, because I want my libraries to be shared between the game and the editor.

- MAIN FOLDER
    | - core
    |   | core features of the engine
    | - editor
    |   | main.lua
    | main.lua

I can't see how I'll be able to require files with this structure, is there a specific way to do this kind of thing in lua ?

What I'm trying to do now is this :

main.lua (game)

require "core/engine"

function love.load()  -- This works
    print("Loaded")
end

main.lua (editor)

require "../core/engine"

function love.load() -- Won't work
    print("Loaded")
end

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:
How (if possible) would I change the BasicEffect Matrix mid draw Say, for example, I have a list of enemies.  Each enemy is a textured quad which is the stored in a singular shared VertexBuffer and IndexBuffer with the buffer usage set to BufferUsage.WriteOnly (static buffers essentially).  Then only one call to DrawIndexedPrimitives would be needed to draw all enemies.  The problem is enemies have to move around at some point.  It is quite easy to change the BasicEffect Matrixes to get the desired result of enemy movement.

My question is how can I change the BasicEffect Matrixes after each Quad using only one static VertexBuffer and IndexBuffer?

Changing the Matrixes for movement is normal, right?

I thought about using a DynamicVertexBuffer instead, is this more effcient for my case?

What about 4.0 streaming?  Would a call to GraphicsDevice.SetVertexBuffers(array);  (where array is whatever you send it that frame) be a better idea?

I know this question may seem silly for quads considering SpriteBatch is pretty good at doing this already for sprites.  But, I am going to add in my own dazzling effects and want to draw textured quads this way. Plus, I'm also OCD and want this to be organized and efficient.

Any help on the matter is appreciated.

sentences:
Map Engine Rendering Broken So I've been making my own tile map engine in LibGDX as the one currently implemented doesn't support collision detection with scaling. So I've come up with my own Layer and Map class and a drawing function for the map. Currently this is what it produces:

Here's the rendering code:

public void draw(SpriteBatch batch) {
    for(Layer layer : layers) {
        for(int x = 0; x < layer.getTileMap().length; x++) {
            for(int y = 0; y < layer.getTileMap()[x].length; y++) {
                batch.draw(layer.getTiles()[layer.getTileMap()[x][y]],
                        xOffset + (x * ((layer.getTileWidth() * scale))), yOffset + (y * ((layer.getTileHeight() * scale))),
                        (layer.getTileWidth() * scale), (layer.getTileHeight() * scale));
            }
        }
    }
}

EDIT: Yes, I'm aware the map looks weird, it's just random textures thrown in from a tile-sheet.

sentences:
What is a good algorithm to detect collision between moving spheres? If (for the purpose of collision detection) 3D objects are represented in a game by spheres, what is a good algorithm to detect a collision between spheres?

If each object has a position as of the last frame and a new (desired) position, what is a good algorithm that will identify collisions where the spheres didn't intersect in the previous frame, and they may not intersect in the second frame, but they did intersect somewhere in between?

sentences:
What's an optimal procedure to create a connected cyclic grid of nodes and edges for A* pathfinding like the title says, I'm trying to create a grid of nodes that hold edges or connections to each other so I can perform A* algorithm to have objects traverse across them as seen in your standard RTS.

I want to know if there is a general structure and algorithm for this node grid data structure as I can't find a good resource online. For instance, I will be moving my objects via position (Vector3) so I will have to calculate my edge weight to be the magnitude between two nodes. Is this a standard practice?

Could anyone perhaps guide me to the rough basics on how this is achieved in a standard RTS? I would greatly appreciate any information!

sentences:
Whats the most efficient method for controlling entities? I'm creating a tower defense game and I'm having logistical issues trying to figure out how to best have all of the enitites do their apporiate task.

I have considered just constantly looping through a list of all the game entities calling a onAction() method, but I'm not sure if that is effective.

I have also considered having each entity be a thread, but when I am dealing with hundreds of entities, some of which don't need thread time, I'm back to square one.

Can I get any suggestions on a solid approach? Am I on the correct track with my first idea?

Thanks for any help ~Aedon

sentences:
How to handle player slowness while moving up and down in a Top Down game with angled ortho camera and angled sprite due to stretching of ground? So i'm making a 2D top down game setup in 3D using tilted Sprites and angled orthographic camera.
My camera setup is as shown.
In my game I have the floor flat on the X/Z plane with walls/characters rotated +45 degrees about the X axis. The orthographic camera is pointing down also at 45 degrees about the x axis, parallel with my walls/characters.
As a result, I dont see any distortion for players/characters since they face the camera directly on, while the ground however sees a distortion of sqrt(2) shorter. This makes sense considering how an orthographic camera works. To fix this, I've made my Tilemap set up with X:1 Y:1 Z:Sqrt(2) so that each tile is stretched on the Z axis by Sqrt(2) to compensate for this distortion.
All looks well with only one problem now... foreshortening with regards to movement: Forward and backwards movements of objects/characters along the z axis are perceived to be slower than movements left/right on the x axis. This makes sense because while each tile is perceived to be a square in the camera view thanks to scaling Z on the tilemap by sqrt(2), the real world tile is, well, sqrt(2) times taller than its width, so obviously it takes longer to travel forwards / backwards.
How do i correct this?

sentences:
How to avoid many import iterations while generating sub assets? I have a ScriptedImporter that generates other assets in the same directory.

Whenever it happens, import progress bar pops in again, this time like Importing (iteration N).

I've tried to use AssetDatabase.DisallowAutoRefresh to circumvent this behavior but that failed.

Question:

How to prevent subsequent import iterations and rather group them to happen all at once ?

sentences:
How to use GdxAI with libgdx ashley ecs framework? I'm planning to use GdxAI Telegraph in GdxAshley ecs framework, my problem is how I'm gonna create a telegraph component if I wanted to dispatch a message? I have created AIComponent and AISystem.

class AIComponent implements Component{
    StateMachine<Entity, EntityState> fsm;
}

class AISystem extends IteratingSystem {

    public void processEntity(Entity entity, float deltaTime) {
         AIComponent ai = Mappers.ai.get(entity);

         ai.fsm.update();
    }

}

For example I wanted to dispatch a message using space input.

if(Gdx.input.isTouched()) {

     MessageManager.getInstance().dispatchMessage(
                0.0f, // no delay
                entitySender, entityReceiver,
                MessageType.SAYHELLO, null);

}

I'm thinking of creating a class that extends Entity and implement it to Telegraph. But the ashley ECS approach will be disregard here.

class EntityAI extends Entity implements Telegraph {

     StateManager fsm;

     public EntityAI (StateManager fsm) {
          this.fsm = fsm;
     }

     @Override
     public boolean handleMessage(Telegram telegram) {
         return fsm.handleMessage(telegram); // In this part, the logic exists. Im thinking of creating a System that will handle message? but how
     }

}

Question How do I properly convert the this EntityAI to entity-componentbased-system approach? In the below code is not tested but it was the idea entered my mind.

class Script implements Telegraph {

     StateManager fsm;

     public Script (StateManager fsm) {
          this.fsm = fsm;
     }

     @Override
     public boolean handleMessage(Telegram telegram) {
         return fsm.handleMessage(telegram);
     }
}

class ScriptComponent implements Component {
     Script script;
}

 ScriptComponent script
 AIComponent ai
 ai.fsm = new StateMachine();
 script.script = new Script(ai.fsm); // as you can see here the fsm is used twice in component

 // AIComponent has StateMachine
 // ScriptComponent need StatMachine
 // do you in the above code is a good idea?

MessageManager.getInstance().dispatchMessage(
                0.0f, // no delay
                scriptSendeer, scriptReceiver,
                MessageType.SAYHELLO, null);

sentences: Convert Flash game to work on Android devices Is there any way to convert a Flash games(file with .swf extention) to work with android devices? I want the game to use Android device native controls like sensor, accelerometer, etc.

sentences:
How to avoid Singleton/Statics/Injection in my puzzle game I am developing a puzzle game in java with swing.
Purpose of the game to find the  all the correct pairs on the board without ur lifes reaching 0 , preety simple etc.

I have a class My_Button which extends JButton.
My game consists of 6 type of Tiles (square , circle etc)
All these type of tiles extend My_Button class and implements my_Actions interf.
my_actions interface has some methods, not crucial for the question.
I have my_board class which holds arraylist with buttons , initializes buttons, fills the array , checks for validity between pairs , delete pairs etc.
It contains all the game functions in a way.

Now my main problem is the actionListener implementation and logic.
In my ActionListener in simple words i add the button that got clicked to a temp array and when 2 buttons got added to this array i do certain actions.
for example: (pseudo)

ActionListener{
my_board.posible_pair.add(this);
my_board.click_counter++;
my_board.check_game_state();
}

!check_game_state() runs if's and updates all the info of the game like: tries,score,check_valid_pair,delete etc.!

Now my thinking and my  question laid out:

First case:
If i make every Tile class implement actionListener like the example above ill have to make my_board singleton to be able to have acess to all this variables outside of the my_board class.

Second case:
even if i implement actionListener inside the my_board class and add the actionlistener through anonymous classes to my button after i add them to the board it gives error ofc because the scope gets weird.

Third case:
full static class and variables, its really bad programming so id like to avoid.

QUESTION:

--How i can reconstruct my project to manage these problem without singletons/static ?

--How i can avoid putting the check_game_state() inside the ActionListener which also is a bad practice?

I checked infinite number of qestions on this forum , google , stackoverflow but nothing really helps on the specifics.
I have developed simmilar games before but i always follow the singleton tecqniques and id like to change that.

sentences:
Java and Eclipse setup properly, how do I install JOGL or LWJGL? I have my Java environment installed alongside Eclipse, and I was successfully able to create and run a new project (simple System.out.println("Yay I work!");

I have the OpenGL SuperBible, and I primarily want to code 3D things (I'll take my time using the book to learn how to draw shapes in 3D space, etc..)

Can you help me get setup with OpenGL in Java? I dont really need LWJGL, although I WILL make games eventually. I just can't even figure out with all of these terrible (and old) tutorials floating around on the net how to install either JOGL or LWJGL.

If you can give me a hand with that, I'd appreciate it. I'd like to feel I contributed by having this page show the answer to the question, so that other poor souls googling for this same information can benefit.

sentences:
Anchoring a sprite to a specific x & y on another, regardless of rotation [Gamemaker] I have a sprite, sDetritus, with a corresponding object, oDetritus, and an sTurret and oTurret.

If I apply no rotation (i.e. changing the image_angle) to oDetritus, I can anchor the oTurret to a specific position on the ODetritus, using its sprite as a guideline. In this case, the desired x and y for the oTurret, in relation to the oDetritus's x and y origin, are x - 37 and y + 192.

I can make the oDetritus the Owner of the oTurret, and make sure that the oTurret 'sticks' with the following in its Step event:

if instance_exists(Owner) {
x = Owner.x - 37
y = Owner.y + 192
}

However, how would I adjust this to account for rotating the image_angle of the oDetritus object underneath? Obviously then the x and y values would be wrong. I have tried using lengthdir_x and lengthdir_y, but this doesn't seem to be the correct function here.

sentences:
Where is XNA headed? I love XNA. I really do. As president of the Game Development Club at my school, we use it and I teach it. But I'm worried about it.

I've always wondered, are there any signs that XNA will ever become more than just a prototyping/arcade game language? I've always gotten the feeling that Microsoft is on the cusp of abandoning it, like they did Managed DirectX. The Xbox Live Arcade is an amazing idea but it's shoved off to the side, well overshadowed by the "real" Xbox games when I feel like it would've had so much more potential, had Microsoft given it more emphasis.

Now with XNA 4.0 CTP for Windows Phone 7 only, it seems to be morphing into some sort of phone-only thing. I'm really unsure about exactly why they are doing that.

What's the current state of XNA, and where is it headed? Is it going into mobile-only, or will 4.0 eventually be released for Xbox and desktop usage?

In other words, is it a language to invest time and money into, or should it be only tentatively developed on, with the constant fear of abandonment? And when I ask this, I'm talking about desktop and Xbox games, as I can pretty clearly see that it is the game framework of choice for the Windows Phone 7 platform.

Since this question is somewhat subjective (but I'm really looking for facts alongside your opinions!) I am making this a CW.

sentences:
Unity - Understanding the SRP batcher Im trying to understand the SRP batcher. I have a scene with 300 fairly low-poly models.
These are my rendering stats with SRP Batcher:

And this is without SRP Batcher:

Some observations (This is all with dynamic batching enabled, models share a GPU instanced material):

With SRP Batcher the Tris and Verts seem to lower almost impossibly low, sitting at the low thousands, while without the SRP Batcher they are almost 5 million.
With SRP Batcher the draw calls are at almost 3000, with none being batched. On the other hand, without SRP Batcher the draw calls are at 103, with almost 2500 being batched.

I cannot really make sense of this. I see no noticable effect on the FPS. I have no idea which is actually better for performance. The stats above make no real sense to me, seems strange that enabling SRP batcher removes all batched calls... Can someone help me understand which is better and when to use what?
Everything is tested on latest unity and URP versions.

sentences:
Unity LWRP Sprite Renderer Sorting incorrectly after upgrading I'm making a project where every tile is a sprite renderer, this would work fine in the old unity system (from the fact that it used it until recently), but upgrading to the LWRP broke the sorting of the sprite renderers. Previously, I didn't have to change the order at all, but now they phase in and out of each other based on the position of the camera, like the picture shown below. They all use LWRP/2d/Sprite-Lit-Default, as any other of the LWRP materials do not use the texture from the sprite renderer and instead make it all black.

I do not want to use sorting layers because I have meshes sprinkled in, and what i have seen there is no way to control if the mesh is on anything but order 0, besides some hacky way. Even using a box mesh it gets cut off when the floor is closer to the camera.

Here is what it looks like far away, the floor should be there the entire time and not have the darkness of the walls seeping down into them.

I don't think I can use mesh renderers either, as I want a way to control the texture from each individual object, and share a material through all of them. I think if I used a mesh renderer I would have to use a material for each different tile, and I would not be able to tile them like I am doing now.

sentences:
Unity C# Object Scaling when parenting by script How do I make it so an object doesn't scale with another object that I parented it with by script? If anyone knows how to get around this I would really appreciate it.

This is the part of the script I used for parenting:

arrowToObjAnchor.transform.parent = hitTransform;

sentences:
Smooth Camera Movement Java So, I'm making a platformer game from scratch in Java and I am trying to make the camera movement smoother. Here is what it currently is

public class Camera {
    private int x, y;

    public Camera(int x, int y) {
        super();
        this.x = x;
        this.y = y;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

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

    public void tick (GameObject player) {
        setX((int) (-player.getX() + Reference.WIDTH / 2 + 16));
        setY((int) (-player.getY() + Reference.HEIGHT / 2 + 64));
    }
}

It moves too strictly and it always centres the player to the screen, I don't like it.

I tried watching this video, but it's in GameMaker. Any way to translate this to Java?
https://youtu.be/6cIN6iW5ois

Any help would be appreciated,  thanks! :)

sentences:
How do I roll a ball with a Rigidbody? I have a ball in a game that rolls around just fine with Rigidbody.AddForce().  I have other non-physics balls, however, that I control directly with Rigidbody.MovePosition().

It seems that no matter what I do, no matter how interpolation and collision detection are set, the ball does not "roll" when moved with Rigidbody.MovePosition(). It teleports, but IsKinematic is not set , as instructed by the documentation.

How do I get the ball to roll properly with Rigidbody.MovePosition()? Alternatively, if that's not possible, how do I calculate the rotations manually?

sentences:
How do I calculate normals correctly for dynamic terrain (DX11, C++)? I am currently looking for some guidance on how to correctly calculate my normals on the CPU for my terrain as the results I'm getting seem to be incorrect. Eventually I will attempting to calculate them on the GPU as I'm aiming for terrain deformation in real-time.

These are the results

The different colours on the image represent different normal values.

Here is the code I'm using to generate them.

for (int i = 0; i < width; i++) {

    for (int j = 0; j < height; j++) {
        int index1 = (j * width) + i;
        int index2 = (j * width) + (i + 1);
        int index3 = ((j + 1) * width) + i;

        int index4 = ((j + 1) * width + i);
        int index5 = ((j * width + (i + 1)));
        int index6 = ((j + 1) * width + (i + 1));

        //vertices of triangle
        Vertex vertex1 = vertices->at(index1);
        Vertex vertex2 = vertices->at(index2);
        Vertex vertex3 = vertices->at(index3);

        Vertex vertex4 = vertices->at(index4);
        Vertex vertex5 = vertices->at(index5);
        Vertex vertex6 = vertices->at(index6);

        //each vertex as XMVECTOR
        XMVECTOR point1 = XMVectorSet(vertex1.Pos.x, vertex1.Pos.y, vertex1.Pos.z, 0.0f);
        XMVECTOR point2 = XMVectorSet(vertex2.Pos.x, vertex2.Pos.y, vertex2.Pos.z, 0.0f);
        XMVECTOR point3 = XMVectorSet(vertex3.Pos.x, vertex3.Pos.y, vertex3.Pos.z, 0.0f);

        XMVECTOR point4 = XMVectorSet(vertex4.Pos.x, vertex4.Pos.y, vertex4.Pos.z, 0.0f);
        XMVECTOR point5 = XMVectorSet(vertex5.Pos.x, vertex5.Pos.y, vertex5.Pos.z, 0.0f);
        XMVECTOR point6 = XMVectorSet(vertex6.Pos.x, vertex6.Pos.y, vertex6.Pos.z, 0.0f);

        //lines to compute the cross product
        XMVECTOR line1 = XMVectorSubtract(point2, point1);
        XMVECTOR line2 = XMVectorSubtract(point3, point1);

        XMVECTOR line3 = XMVectorSubtract(point5, point4);
        XMVECTOR line4 = XMVectorSubtract(point6, point4);

        //cross product to get our unnormalized normal
        XMVECTOR cross = XMVector3Cross(line1, line2);

        XMVECTOR cross2 = XMVector3Cross(line3, line4);

        //normalize to get our normal value
        cross = XMVector3Normalize(cross);
        cross2 = XMVector3Normalize(cross2);

        vertices->at(index1).Normal = Operations::vectorToXMFLOAT3(cross);
        vertices->at(index2).Normal = Operations::vectorToXMFLOAT3(cross);
        vertices->at(index3).Normal = Operations::vectorToXMFLOAT3(cross);

        vertices->at(index4).Normal = Operations::vectorToXMFLOAT3(cross2);
        vertices->at(index5).Normal = Operations::vectorToXMFLOAT3(cross2);
        vertices->at(index6).Normal = Operations::vectorToXMFLOAT3(cross2);
    }

}

Edit: I have made some changes to the code to account for the second triangle in the triangle pair but still produces similar results.
The green (grass) represents a normal value of 0. The pink represents a normal value of 1. The red represents a normal value of -1

Why is the majority of the mesh 0, and where the normals are calculated, they are incorrect?

Edit 2

I have removed the use of the indices array in this loop and now the whole plane is processed, but results are still incorrect.

Edit 3

I did not realise I was referencing the indices array in more than one place. When I corrected this, I am now seeing better results. Although there is a slight problem of the normal that is being calculated is -1 instead of the expected +1

Edit 4:

Normals are calculated per vertex and don't take other touching faces into account, that is the next step. I'm guessing some parts of the texturing/terrain look a little weird due to this.

At the moment my terrain is just a flat plane, so all of the normals should be the same, right? However the values seem to be different when rendering/printing out.

There are some values that are 0, some are -1 and the rest are +1. Does anyone know where I'm going wrong?

sentences:
Can anyone recommend a 3D model viewer with shading? I am looking for a simple real-time OpenGL based render engine to show a 3D model on screen.

I prefer using 3DS Max's 'shader' materials (real-time materials) for editing.

Do you know any good simple API to include it in an OpenGL screen? Is there a simple tool to export from 3DS Max to that tool?

sentences: Changing motion clips via script in Unity is there a way in Unity to access the Motion clip of an Animator State and change it at runtime via script? I am trying to do a character shop in my 2D game. My idea is, when i click a GUI button it would just select different motion clips but the states would stay the same. It's just a simple Jump and Idle state, parameters dont change. I just want to feed in different animation clips for different characters.

sentences:
How do I flip Player in 2D Touch Movement? How do i flip my Player in 2D when i got touch movement?
I got Buttons to move but how do I flip the player now if i walk to the right cause my player faces to the left..?

here is my Player Script:

using System.Collections;

public class PlayerController : MonoBehaviour {

    public float speed = 10, jumpVelocity =  10;
    public LayerMask playerMask;
    public bool canMoveInAir = true;
    Transform myTrans, tagGround;
    Rigidbody2D myBody;
    bool isGrounded = false;

    // Use this for initialization
    void Start ()
    {
        myBody = this.GetComponent<Rigidbody2D>();
        myTrans = this.transform;
        tagGround = GameObject.Find (this.name + "/tag_ground").transform;
    }

    // Update is called once per frame
    void FixedUpdate ()
    {
        isGrounded = Physics2D.Linecast (myTrans.position, tagGround.position, playerMask);

        #if UNITY_ANDROID && !UNITY_IPHONE && !UNITY_BLACKBERRY && !UNITY_WINRT
        Move(Input.GetAxisRaw("Horizontal"));
        if(Input.GetButtonDown("Jump"))
           Jump();
        #endif
    }

    public void Move(float horizontalInput)
    {
        //Er klebt nicht mehr an den Waenden
        if (!canMoveInAir && !isGrounded)
            return;

        Vector2 moveVel = myBody.velocity;
        moveVel.x = horizontalInput * speed;
        myBody.velocity = moveVel;

    }

    public void Jump()
    {
        if(isGrounded)
            myBody.velocity += jumpVelocity * Vector2.up;
    }

}

sentences:
Ordered dithering between "discrete" colors? I want to achieve color dithering between discrete colors like this:

As you can see, there is no gradient, or technically there is, but very discrete as it's only a 3 color image (right bar).

So I want the same results applying ordered dither (or at least try it and see if it works).

I have this test sample:

And this is teh function where i do the dithering:

// OrderedDither applies a Bayer matrix to dither.
func OrderedDither(img image.Image, palette []color.Color) image.Image {

rImage := image.NewRGBA(img.Bounds())

matrix := [][]float64{
    {0, 4, 1, 5},
    {8, 12, 9, 13},
    {2, 6, 3, 7},
    {10, 6, 11, 15}}

for j := 0; j < img.Bounds().Max.Y; j++ {
    for i := 0; i < img.Bounds().Max.X; i++ {
        m := matrix[i%4][j%4] / 16
        oldPixel, _ := colorful.MakeColor(img.At(i, j))
        oldPixel.R = oldPixel.R*m + oldPixel.R
        oldPixel.G = oldPixel.G*m + oldPixel.G
        oldPixel.B = oldPixel.B*m + oldPixel.B
        newPixel := GetClosestColor(palette, oldPixel)
        r, g, b, _ := newPixel.RGBA()

        rImage.Set(i, j, color.RGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: 255})
    }
}
return rImage

}

I get this:

As you can see, there is not dithering in the borders and the dithering inside the boxes is awful.

Any recommendations?

Edit: I implemented the average distance in the 16 color palette:

r := AverageColorDistance(palette)

for j := 0; j < img.Bounds().Max.Y; j++ {
    for i := 0; i < img.Bounds().Max.X; i++ {
        m := matrix[i%4][j%4]/16 - 0.5
        oldPixel, _ := colorful.MakeColor(img.At(i, j))
        oldPixel.R = oldPixel.R + r*m
        oldPixel.G = oldPixel.G + r*m
        oldPixel.B = oldPixel.B + r*m
        newPixel := GetClosestColor(palette, oldPixel)
        r, g, b, _ := newPixel.RGBA()

        rImage.Set(i, j, color.RGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: 255})
    }
}

And the result was not satisfactory neither:

The average color was 0.4792891. (got 256 values in a 16 color palette).

But in either case i still got no blur between the boxes. Should i stop trying to make Ordered work and go Floyd-Steinberg? I want to get some blur between the hard edges.

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:
Correct rotation with Quaternion I have some problems with a rotating marble.
I've tried it with Matrix.CreateFromYawPitchRoll and Matrix.CreateRotation but there were some problems, I think it's due to the Gimbal lock effect.

So, I've tried using quaternions instead, but nothing changed.
When moving on only an axis it works fine, but when the rotation occurs on two different axes the marble still rotates on wrong axes.

Here's my code:

// declarations
Vector3 Position = Vector3.Zero;
Vector3 Rotation = Vector3.Zero;
Quaternion qRotation = Quaternion.Identity;

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

In the Update method:

Position += speed;
Rotation = speed * MathHelper.ToRadians(-1.5f);

Quaternion rot = Quaternion.CreateFromAxisAngle(Vector3.Right, Rotation.Z) *
                Quaternion.CreateFromAxisAngle(Vector3.Backward, Rotation.X);

qRotation *= rot;

And in the Draw method:

effect.World = AbsoluteBoneTransforms[mesh.ParentBone.Index] *
  Matrix.CreateFromQuaternion(qRotation) * Matrix.CreateTranslation(Position);

What's wrong?

EDIT

I've tried calculating directly the axis of rotation of my marble, instead of using combination of multiple axes:

angle += speed.Length() * angularVelocity;
qRotation = Quaternion.CreateFromAxisAngle(Vector3.Cross(speed, Vector3.Up), angle);
qRotation.Normalize();

angle is a float that keeps track of the current movement.
This solution doesn't seem to create Gimbal lock, but marble rotations aren't correct, it seems that the rotating speed is not constant, but became faster and slower over time, I can't understand why.

sentences:
How to take a screenshot with java from directX I'm looking for a way to take a screenshot with a Java application of any running directX game. I use the following code

Robot robot = new Robot();
GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
BufferedImage screenshot = robot.createScreenCapture(config.getBounds());
ImageIO.write(screenshot,"png", file);

This one works perfectly anywhere but in directX games. I'm not that familiar with Java and even less with DirectX, I'm just trying to adjust this code. I googled very much, but everything just leads to the same code I already have.

Do you know of another way to take a screenshot of DirectX games?

Thanks.

sentences:
Why table in libgdx game give wrong position Can anybody guide me, I am creating a table in libgdx game on menu screen to set different buttons on my screen. here is the code for table draw

 table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

and here is the code for background for this menu screen

batch.draw(bckTexture, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

My bcktexture image size is 600 by 400.

Now this table draws in the middle of the screen. I dont understand this why. it should be drawn by 0 , 0 corner and fill the whole screen.
I have checked table by table.debug();

what I want is that the table should cover the whole screen so that I can adjust my buttons anywhere on the screen i want especially at the corners.

sentences:
Drawing a dynamic indicator for a field of view My goal is to draw a dynamic indicator for a cube, which represents the field of view. The ideal indicator would look the same as in Metal Gear Solid(the blue ones):

From what I have gathered, I need an angle and a length for the indicator as such for a 50° FoV:

Now my issue is what method should I use to draw the indicator? A procedural mesh or is there a less demanding way of doing this?

sentences:
Cocos2d-x 3.0 animation frame by frame As I know animations are actions. Now I need to play animation frame by frame. Say I have an animation from N frames. each frame should be played after t delay. Now I want to play animation frame by frame, each frame advance the animation's state. How I can do this?

And what about playing actions frame by frame advancing the state in general.

I ask because I use ECS, and I deal with frames.

P.S. I want to do something like this:

Action * a = MoveTo(initialPoint, finalPoint, durationOfAnimation);

a->play(0.001 seconds);
a->play(0.003 seconds);
a->play(0.02 seconds);
a->play(0.67 seconds);
a->play(0.06 seconds);

And see the animation.

sentences:
Where can I share my game? I am looking for places on the web to share my game.

I'm relatively new to game development. Not looking to 'promote' my game or sell it. Just want to share it in places where there is a possibility people will download and play it.

Are there any sites that are meant to share indie games? And in general any site where I can post a download to my game will be great.

Thanks

sentences:
Shader authoring/editing tools for GLSL ES Since Render Monkey has been discontinued (perhaps due to the complexity of today's shading languages), there are few successors that can match its functionality. Is there any useful tool for material editing aimed at developers and artists alike, but concentrated (or with substantial support for) on embedded GLSL shaders?

Render Monkey itself wasn't that flexible (I'm not aware if it allowed the usage of several textures, each with its own set of texture coordinates - plus, it didn't seem to be that intuitive either).  Apart from complete engines, is there such a stand-alone tool that can be used together with a stand-alone engine (able to interface with a custom application)?

sentences:
Find x and y position with angles in 3D world I'm actually creating a Tracking Camera (or 3rd person camera), and to do so, I used two angles (X and Y) for the rotation of the camera and an other floating value for the distance between the target and the camera.

The camera system works fine, but I am searching a way to calculate the position of the correct position of the camera (for debug purpose only)

Do you have an idea of how I can do to figure it out?

This is the camera update function:

public void Update(GameTime gameTime)
{
  this.View =
    Matrix.CreateTranslation( 0, 0, 0 ) *
    Matrix.CreateRotationY( MathHelper.ToRadians( this.RotationAngle ) ) *
    Matrix.CreateRotationX( MathHelper.ToRadians( this.ArcAngle ) ) *
    Matrix.CreateLookAt(
      new Vector3( 0, 0, -this.Distance ),
      this.TrackingPosition,
      Vector3.Up );

  Viewport _viewport = this.graphicsDevice.Viewport;
  Single _aspectRatio = (Single)_viewport.Width / (Single)_viewport.Height;

  this.Projection = Matrix.CreatePerspectiveFieldOfView(
    MathHelper.PiOver4,
    _aspectRatio,
    NEAR_PLAN, FAR_PLAN );

  // Find x and y
  this.Position = new Vector3( 0, 0, -this.Distance );
}

sentences:
Canvas slowly degrades in performance after a while I was creating a simple game and was shocked to see how the performance started to degrade. It never happened to me before, most probably because I use images and not the context drawings. So I used this function and the whole game becomes so slow, it just cannot be played after 30 seconds.

Office.prototype.draw = function(){
 for(var i = 0; i < this.tables.length; i++){
  for(var j = 0; j < this.tables[i].length; j++){
   Canvas2D.ctx.rect((373 * j) + 75, (370 * i) + 250, 170, 20);
   Canvas2D.ctx.fillStyle = 'green';
   Canvas2D.ctx.fillRect((373 * j) + 75, (370 * i) + 250,
    this.moneyBar[(i*4)+j], 20);

   // Draw the experience bar.
   Canvas2D.ctx.rect((373 * j) + 75, (370 * i) + 270, 170, 20);
   Canvas2D.ctx.fillStyle = 'yellow';
   Canvas2D.ctx.fillRect((373 * j) + 75, (370 * i) + 270,
    this.expBar[(i*4)+j], 20);

   // Draw the tables.
   Canvas2D.drawImage(sprites.items[0], new Vector2(
    (250 * j) + 50, (250 * i) + 200));
  }
 }
}

So as you can tell from the code, there is the multidimensional array table which has bars on top displaying moneyBar and expBar.
If I am to use Canvas2D.ctx.stroke() inside the for loop, the game performance drops right away. Outside of the loop, it keeps up a bit, then it degrades. If I don't use stroke at all, works better, but degrades anyway. So I am really confused as to why this degrades so fast. Also am using requestAnimationFrame and have used the same engine in previous games and performance never degraded.

If I was to remove fillStyle, keeps up 3-4 seconds more.
There are 8 tables in all, which means the for loops run 8 times per draw.

Vector2 function.

function Vector2(x, y) {
    this.x = typeof x !== 'undefined' ? x : 0;
    this.y = typeof y !== 'undefined' ? y : 0;
}

sentences:
Looking for a clever way to differentiate objects I have a lot of cubes in my game (2d squares) and I decided to add some skins to them. However the colors that they have don't really make them look appealing.

For example, I have this sprite:

Here is how the squares look with that particular sprite:

As you can see, they don't really look that great with all these bright colors.

Is there any way that I can make this look better, but for the users to still be able to differentiate between the different cubes?

sentences: Defining a projectiles speed and angle before Instantiating I have a 360 degrees shooter object and a projectile to shoot. My projectile has a Rigidbody2D with zero gravity scale. I want it to bounce off of colliders when it gets hit, but when I instantiate it from my shooter I have to write the velocity value in update so it keeps going against the colliders when shot. I figured that I should assign it a velocity in start function, but then it only goes in one direction. How do I fix this?

sentences:
What is the difference between framerate independent vs framerate dependent? What is the difference between framerate independent vs framerate dependent?
Can you please give an example.

sentences:
How to have an AI controlled GameObject naively avoid another one? I have an idea of an AI controlled game which the gameobject will follow a path but it will change its path if I put another gameobject in front of it. For instance, if the moving game object is moving horizontally, and I put a static game object on its path, I want it to turn and continue its progression vertically just before it hits it.

How can I achieve this?

sentences: Simulated 3D hit point from surface normal Here is an illustration describing what I'm trying to do...

sentences: Capture High Resolution Screen Shot for Unity Game I'm working on a mobile game. We need some HD screen shot to use in our press kit. I'd like to know, how do we capture HD screen shot of games inside unity's editor. Resolution must support printing quality of banners that we would use to showcase our game in local game expo.

sentences:
Unreal Engine: Object Reference is not compatible with pawn Object Reference Hello I am a beginner Unreal Engine developer learning with Blueprint and I am trying to take an imported FBX model and put a pawn control on it. Below is what I am trying to do. By the way, FbxScene_Test_Character is an actor.

What can I do to get around this error? Do I need to add extra information?

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:
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:
How can I toggle between single shots when clicking the mouse left button and automatic none stop shooting when clicking the mouse right button? I'm talking in build not in editor !

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

public class Shooting : MonoBehaviour
{
    [SerializeField]
    private Transform[] firePoints;
    [SerializeField]
    private Rigidbody projectilePrefab;
    [SerializeField]
    private float launchForce = 700f;
    [SerializeField]
    private Animator anim;
    [SerializeField]
    private bool automaticFire = false;
    [SerializeField]
    private bool slowDownEffect = false;

    private void Start()
    {
        anim.SetBool("Shooting", true);
    }

    public void Update()
    {
        if (isAnimationStatePlaying(anim, 0, "AIMING") == true)
        {
            if (Input.GetButtonDown("Fire1")/*automaticFire == false*/)
            {
                automaticFire = false;

                if (anim.GetBool("Shooting") == true)
                {
                    anim.Play("SHOOTING");
                    LaunchProjectile();
                }
            }
            else
            {
                if (/*automaticFire == true &&*/Input.GetButtonDown("Fire2"))
                {
                    automaticFire = true;
                }
            }
        }

        if(automaticFire == true)
        {
            anim.Play("SHOOTING");
            LaunchProjectile();
        }
    }

    private void LaunchProjectile()
    {
        foreach (var firePoint in firePoints)
        {
            Rigidbody projectileInstance = Instantiate(
                projectilePrefab,
                firePoint.position,
                firePoint.rotation);

            projectileInstance.AddForce(new Vector3(0, 0, 1) * launchForce);

            projectileInstance.gameObject.AddComponent<BulletDestruction>().Init();
        }
    }

    bool isAnimationStatePlaying(Animator anim, int animLayer, string stateName)
    {
        if (anim.GetCurrentAnimatorStateInfo(animLayer).IsName(stateName))
            return true;
        else
            return false;
    }
}

I tried to do it in the Update using the automaticFire variable but it's not working fine.

When clicking first the left mouse button it's shooting singles but then when clicking the mouse right button it's shooting automatic but then when clicking the left mouse button again it's not back to single shots again it's staying on automatic.

The idea is right click mouse button automatic fire left button each time clicking the left mouse button the automatic should stop and then single shots with the left mouse button. And this way to toggle between the Fire1 and Fire2.

Fire1 = left mouse button click Fire2 = right mouse button.

sentences:
How do I allow a player to build a dedicated server, but prevent them from cheating? Instead of maintaining a central server, many games allow players to build their own server, like Minecraft.

But if you give them the server-side program, how could you prevent them from cheating? I thought it's impossible, but Team Fortress 2 seems doing that. Usual TF2 servers are built by players. But Valve sells the items in TF2, so they must have a way to prevent server owner generating these items.

sentences:
Spider physics to patrol on platform smoothly when changing direction I have a 3 tile wide platform. I want my spider to hang from the ceiling and patrol this platform left and right.
I have dx property for velocity. I want a physics code that shows how to achieve this.
I tried this but it is too harsh:
  if (dx < 0 &&
      !base.isSolid(-16, -1)) {
    dx *= -1;
  } else if (!base.isSolid(16, -1)) {
    dx *= -1;
  }

What I want spider is to slow down on edges change direction and speed up.

sentences:
Where to put rigidbody on a car model ? I have a GameObject car like this:

MyCar

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

Where I have to put rigidbody ?

Thanks

sentences:
How can I use multiple meshes per entity without breaking one component of a single type per entity? We are just switching from a hierarchy based game engine to a component based game engine. My problem is that when I load a model which has a hierarchy of meshes, and the way I understand, is that an entity in a component based system can not have multiple components of the same type, but I need a "meshComponent" for each mesh in a model. So how could I solve this problem.

On this site they implemented a Component based game engine:
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

sentences: When should rendering be performed during a frame? When working with OpenGL or DirectX, should draw calls be done all at once, at the end of the update loop, or is it better to have draw calls occur during the update loop rather than just at the end?

sentences:
Can problems arise in client-server network games due to the permanent sending of messages? I'm my Client-Server-based game I'm using the following stack:

libGDX (Engine)
Ashley (ECS)
KryoNet (Networking)
Box2D (Physics)

Server =========> Client
I've got a Box2DSyncSendingSystem on server-side and a Box2DSyncReceivingSystem on client-side.
This will create a list of all body-values from every entities with a BodyComponent in its update()-method and till than send this list via a BodyUpdateMsg to the clients. The client therefore receiving it and adjust all the values to the local bodies.
Client =========> Server
On the other Hand the clients will keep sending their Input values to the server via a InputSendingSystem so the server can adjust the velocities.

The problem that concerns me is that these steps happen every time the update methods are run. So several times a second. Somehow it doesn't seem very well resolved to me.
Sure: You could only send body updates if values have changed. But even if you follow this approach, you could not do without the repeated and permanent sending of the input update messages from the client to the server.
It is also clear to me that there are topics where client-side prediction should compensate for the high latencies, but the problem with the input updates is still there.
I don't want to implement a rocket science like high-end solution (the project is not big enough for that), but rather to implement a good and classic approach, which is typical for network games.
My previous approach may also not be wrong and absolutely common.
Thanks in advance!

sentences:
Divert gameobject around mesh surface I am trying to find a way to divert a vector3 position around the surface of a mesh which doesn't have a collider. I have a function (found online) that calculates the closest position on the surface of the mesh but it only works if the position is outside the mesh.

In the diagram below, the red arrow represents whats currently happening. It works great when it's outside the mesh and will give a position on the surface of the mesh, but once it moves forward and enters the mesh, it just keeps walking straight. The green line shows what i would like to happen.

sentences:
How to restrict the players movement win relation to screen bounds in Unity? (Without colliders) I am really enjoying making the switch to Unity. But here I have found one of those rare moments where it appears to make things more difficult (at least it is for me as I am crap at understanding the actual manual)

Basically my 'player' is a space ship. It starts life at 0,0,0 world coordinates and I have been doing all the movement based off of that. (ie. Add force X to move left or right, and there is a constant Z speed which is done via rb.transform.Translate().)

I want to restrict the movement on the X Axis, so in Libgdx id use something like:

if (player.position.x <= 0){ player.position.x = 0;}
if (player.position.x >= viewport.getX()){ player.position.x = viewport.getX();}

The thing is that wont work for me in Unity for several reasons (1. I dont know much about the viewport as I didnt create it. 2. the player.position is being affected by the rigidbody forces. AND i am working in world coordinates with the players position).

As I said, the player is constantly moving forward on Z axis, so making colliders doesnt seem like the right choice for me.

I'm pretty sure Unity devs would of put this in Unity v0.001 but I just cannot for the life of me find how to actually do it. (Any info I can find seems from like 2011 and also is pretty badly written code making this simple matter takes dozens of lines of code and some methods - I'm hoping there is  a Unity method already made, like player.transform.ScreenPosition or something but yeah I cannot find it!?

Any help would be massively appreciated as always.

sentences:
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:
In glsl, how do indices work? I have made a vertex shader and fragment shader and kind of know how they work, and I know that you specify what index you want your vertices to be in inside the shader program. So if the vertex was at index 0, does each vertex take up 1 index? If each one took up an index, than how many indices would a matrix 4x4 take up? Sorry if thats confusing but I'm just starting and I don't really know how the indices within the shader works. So:

#version 140
in vec3 position; //This could be located at index 0
in mat4 randomMatrix; //If this came right after position, what index is it located at??
void main() {
    gl_Position = vec4(position.x * 0.5, position.y * 0.5, position.z * 1, 1);
}

Tell me if I have this all wrong.

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:
Why isn't OnCollisionEnter being called? I have a hammer and an object to be hit in my scene. I put this line
Debug.Log("Collided with" + collision.gameObject.name);
to debug whether the function OnCollisionEnter(Collision collision), was being called. On my hammer, there is a box collider (not trigger), and on the object to collide, it has a rigidbody (non-kinematic), and a mesh collider (convex). I've tried with various objects but it won't call oncollisionenter. They're all the same tag and layer. I made the box collider way bigger and it pushes me back when I try running into an object so it is colliding, but not calling oncollisionenter.

I've heard that it won't work with dynamically instantiated objects, and my player is instantiated at runtime. Could that be it, and are there any fixes? EDIT: I tried disabling the script that instantiates the player (with the hammer on them), and then just having the player in the scene. and it still doesn't recognise any collision from oncollisionenter

sentences:
How would I go about creating dynamic weapons using EC architecture? I currently have a weapon component that contains common functionality across weapons  (mainly guns).

class Weapon : Component
{
    float fireRate;
    float reloadTime;

    void Reload() // Implements reload logic since it is common across all guns
}

The main thing that differentiates guns is firing (some deal splash damage, some fire in a cone, etc.)

The problem I am facing is how to implement the unique firing functionality? Should I make a ConeDamage component, a LinearShot component? If so how will it work?

Keep in mind I am using an EC architecture not ECS.

sentences:
More smaller maps among which player can travel I am developing 2d game, where maps are tile based, small about 20x20 tiles and player can travel between a lot of maps (in my game rooms) like this. The maps are connected sometimes verticaly and sometimes horizontaly and together they make one big cave.

Should I create a class where one 2d array holds all the maps (another 2d arrays), or is there any other way? Whats the most efficient way to create them in this class? Thank you for your help.

sentences:
Problem with Unity APK Build : Default Activity (Android) There was a project developed in Unity 4.5. I successfully updated it to Unity 2018.2.3f1 version without any error. Runs perfectly in Editor.
When I create an APK (internal). I just get this screen when I open it on a mobile.

But when I make a Windows/Mac Build, it runs perfectly.
I've also tried on another Editor (version 2017.3.x) and APK built from this is also good.
I've re-installed Unity, nothing... Also updated the SDK but still a problem.

Some other projects' APK is built successfully with the scenes and everything but they also have some strange problems.
Note: I cannot shift back to 2017.3.x.
Is it a problem the latest Editor? OR Is it a problem with my machine?
What possibly could that be?

sentences:
XNA 4.0 - container with content, that can slide (C#) I got an idea, but I got no idea on how to make it.
Okay, so here is the deal.

I want a container which can contain certain objects (These objects will draw the sprites/graphics).
But because of different screen sizes, I want to be able to scale the containers width and height. But I do not want the objects in the container, that go outside of the container, because of the scaling to be visible.

Because I want the objects all to be positioned horizontaly to eachother and I want a horizontal sliderbar, so I can slide from left to right within the container.

I wonder if anyone could point me in the right direction.

Thanks in Advance,
Mark

sentences:
Instantiated Different player objects in multiplayer game in unity I am using two different objects for player in network multiplayer game. Two different kinds of gameobject will be instantiated by unity network behavior but the problem is there is only single property of playerprefab. How can i set two different objects even i tried to change it on run time but its giving me error.

  Failed to spawn server object,
  assetId=4d293c8e162f3874b982baadd71153d2 netId=1
  UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

  Failed to spawn server object,
  assetId=4d293c8e162f3874b982baadd71153d2 netId=7
  UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

sentences:
Java/LibGDX Self made Input Field I want to create an Inputfield from Scratch in Java and LibGDX, my Question is:
How can I display only certain Parts of a String in a specific width?

For example:
My Input field GUI is 200 pixels wide. But I can write like 500 Letters maximum in my Input field. When I display this 500 letters all at once. It would be bigger than the GUI. So I want when I wrote down the first 100 letters and then write the next one that the first one disappears and the displayed text starts from the 2 Letter and then goes to the 101. And so on. Much like the Minecraft Chat Input field.

sentences: Android Cocos2DX using C++ in Eclipse Helios Windows XP I have used Eclipse Helios 3.6.1 for Java development. I wanted to start C++ development in the same IDE so I installed Autotools Support For CDT, C/C++ Development Tools, C/C++ Library API Documentation Hover Help plugins.I have included #include "cocos2d.h" in my HelloWorldScene.h file now when writing the below statement cocos2d::CCSprite * ccSprite; I am not getting auto completion bar(template proposals) on writing like coco and pressing Ctrl + Space from my keyboard. What can be the problem?This might help you solve my problem. Please check here. This is what I got after clicking Right Click Project -> Index -> Search for Unresolved Index. But I have added all includes check here. I think this is causing problem in Content Assist. What should I do in this case? Inclusion seems proper.

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: What kind of gaming platforms for Linux are available? Which libraries/platforms are available on Linux to start game development?

sentences:
OpenGL color overlay I want to create a pause menu where everything in the background gets darker. I've looked up a bunch of possible solutions (even the second page on google) but it doesn't seem to work. I do already have something in my code that makes a single texture darker when hovered over, by calling: GL11.glColor3f(alpha, alpha, alpha); before drawing vertices. What I want to achieve is everything getting darker, so when hovering over a texture it should be even darker than before so it is still darker than the rest in the background when that has been made darker because of a pause menu that pops up.

Another thing I noticed is that glColorMask(true, false, false, true); does not get overridden and blends colours everywhere, so I was wondering if there is a version of this method that puts a transparent black overlay so everything becomes darker. I have enabled blending.

-Edit-

One solution I came up with (not just now) is multiplying alpha in every glColor3f function with a variable that is smaller than 1 so everthing gets relatively smaller, but I worry about this being uneffective and badly mantainable

sentences:
UDK Fixed AIController / Pawn Height [I already asked this question on the UDK forums, without much success though.]

I'm using a class derived from AIController to control my pawn in RTS-style. My problem is that the pawn does not have a fixed Location.Z so if his Velocity in X and Y direction changes the Velocity.Z also changes (for whatever reason). I have tried nulling the Velocity.Z in the tick method, using Move to move the character back to a constant height and some other things of which nothing had worked. How can I solve this?

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:
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:
Ball bouncing and throwing, how to? I was given a task to make a 3D game for Android, but since I never programmed games and opengl until now I'm totally lost on how and where to start.
Right now I'm using libgdx framework to ease my development or at least I thought it would.
I looked into invaders libgdx demo, but everything is so confusing and not consistent with latest version of framework, and it also looks that it's not very clean and scalable approach.

I have two 3D models, ball and basket. Now I need to animate ball throwing with all the math for hitting the basket, bouncing from basket and floor etc.
So my question is can somebody please help me out or direct me to some useful resources about those kind of games.

I somehow managed to get ball moving by rendering ball model and calling glTranslatef to move it, but that's it, all it do is just moves constantly in same direction. I would like to pick it and throw it in arc to hit the basket.

sentences: POST & push for turn-based network? Can you create a viable two player turn-based networking implementation using only REST API for outbound and push for inbound data? If a game is comprised of, on average, 30 moves, is it a bad idea to just send 15 push notifications to each user? If hosting expense is less than income for each DAU, is this perfectly acceptable, or an abuse of what push is intended for?  ...Why or why not?

sentences:
How to tap a square and draw "Cross (X)" on tic-tac-toe for iibGdx I am having much difficulty trying to figure out how to draw the cross in the square of where the person just touched.

I have made a class called 'CellPositions', by making 9 invisible squares around my board Texture; Example of CellOne...

public CellOne cellOne;

public CellPositions(Board board) {
    load(board);
}

public void load (Board board) {
    cellOne = new CellOne(board);

}

public class CellOne {
    public Rectangle square = new Rectangle();

    public CellOne (Board board) {

        square.x = board.boardRect.x;
        square.y = (board.boardRect.y + board.boardRect.height) - (board.boardRect.height / 3);
        square.width = board.boardRect.width / 3;
        square.height = board.boardRect.height / 3;
    }
}

I have made a 'Controller' class to handle my input and a 'Renderer' class to handle rendering images to the game.

What I want to do is draw the "Cross" on the square the person touched. For eg. if he/she touches the first square - cellOne - how would i render my "cross" to that specific square.

I've tried making a class called "Cross" and made the x and y coordinates Gdx.input.getX() and Gdx.input.getY(), but the 'cross' was not in the square, but intersecting the lines.

Please help! I am trying to get used to libGdx by making a simple game like tic-tac-toe, but it's really not so simple when trying to draw your cross on a certain square.

Here is my board class for further info

private TextureRegion reg;
public Rectangle boardRect;

public Board () {
    init();
}

private void init () {
    reg = Assets.instance.board.boardRegion;
    boardRect = new Rectangle();
    boardRect.set((Constants.SCREEN_WIDTH / 2) - (340 / 2), 15,
            340, 340);

}

public void render (SpriteBatch batch) {
    batch.draw(reg, boardRect.x, boardRect.y,
            boardRect.width, boardRect.height);
}

I have made my screen width and height be 480x480.

sentences:
Collision not working in phaser node multiplayer I'm writing a tank trouble clone just for fun using phaser and node, so this is my tank instantiation

tank = game.add.sprite(Math.random() * 800, Math.random() * 640, 'tank');
tank.anchor.setTo(0.5, 0.5);
tank.scale.setTo(0.5, 0.5);
game.physics.arcade.enable(tank);
tank.body.immovable = true;
tank.body.collideWorldBounds = true;

This is how an enemy tank is defined at the client

var Enemy = function (game, id, x, y, angle) {
    this.id = id;
    this.x = x;
    this.y = y;
    this.angle = angle;
    // set the tank properties
    this.tankEnemy = game.add.sprite(this.x, this.y, 'enemy');
    this.tankEnemy.anchor.setTo(0.5, 0.5);
    this.tankEnemy.scale.setTo(0.5, 0.5);
    // game.physics.arcade.enable(this.tankEnemy)
    // this.tankEnemy.body.immovable = true;
    // this.tankEnemy.body.collideWorldBounds = true;
}

The problem is in the above case I have enemy tank at the client as a non body (which means I'm checking the collision between a "body" and a "non body") and when I try to check collision

game.physics.arcade.collide(tank, enemies[i].tankEnemy);

It doesn't work.

So I tried making it a body by un-commenting the code, now the enemy tank behaves more weirdly than before. Whenever a client moves, it gains velocity for other clients, making it go beyond the map and becoming invisible. Whereas I'm just changing the coordinates for other clients -

function tankUpdate (data) {
    // when the update event is fired
    var moveTank = findTank(data.id);
    if (!moveTank) {
        console.log('tank not found');
        return;
    }
    // update the tank location
    moveTank.tankEnemy.x = data.x;
    moveTank.tankEnemy.y = data.y;
    moveTank.tankEnemy.angle = data.angle;
}

This is how a client emits update event -

socket.emit('update location', {x: tank.x, y: tank.y, angle: tank.angle});

The server in turn broadcasts this update, which leads to the calling of tankUpdate.

What is the right way to implement this? I just want to prevent the collision between tanks.

EDIT

After a long discussion with @Hexus on slack we concluded with these points which solved the issue -

I was not sending the velocity to the server. (@Hexus mentioned it in his answer).
I was setting the sprite.x property which was conflicting with the position of body. sprite.body.x is the right property to set.
I was updating the position and velocity as soon as I received from the server which leads to a shaky and not-so-smooth movement. The idea is to create a buffer and then update.
Lastly but the most important, if you are testing the game without two instances running on the same machine/browser make sure you set game.stage.disableVisibilityChange = true; in your create method.

Again thanks a lot to @Hexus for helping!

sentences:
How to use XML files as content files in XNA? I have an XML file representing different car manufactures that will be available in my game. The file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="List[string]">
    <car>Audi</car>
    <car>BMW</car>
    <car>Nissan</car>
    <car>Volvo</car>
  </Asset>
</XnaContent>

When adding it into my content folder, the compiler return this error:

There was an error while deserializing intermediate XML. Cannot find type "List`1"

How can I create a list of strings, put it into XML and read it from XNA?

sentences:
Approaches for a clickable map of nations (such as a Risk game) with Spritekit I would like to create a political map where each country is clickable by tapping but I'm not sure the best way to determine which nation was selected.  Imagine Risk where each country can be individually clicked to bring up additional information.

My current approach is to make a sprite for each nation where every image is the size of the screen   The images are mostly transparent except for the country, that way when all of the images are displayed the countries are in the correct place relative to one another.  To determine if a click occurs on an individual country I look to see if the tapped location is a non transparent pixel and check that the sprite's name is one of the countries.  Additionally the nation needs to glow or something when tapped as an indicator, however my current solution is yet another sprite that is displayed.

This seems like a terrible approach and I was wondering what other solutions might achieve the same results.  I'm pretty new to SpriteKit so I'm not entirely sure.

The other idea I had was creating a single texture where each country is a different shade of gray, then when I get the tap location I do a lookup on the color at that location and get the corresponding country.  However, I'm not sure how to create a hilight or glowing country effect with that method.

sentences:
What's the difference between Mathf.Lerp and Mathf.SmoothDamp I want to smoothly go from one value to a new one (moving a slider or changing color). I tried using both functions and they all basically give the same result. What is the difference between them and which one should I use?

How I used SmoothDamp:

    // Show the HUD
private IEnumerator ShowHUD() {
    var HUDCanvasGroup = GameObject.FindWithTag("HUD").GetComponent<CanvasGroup>();
    var alphaValue = 1f;
    var velocity = 0f;
    var time = 0.30f;

    yield return new WaitForSeconds(1.5f);

    // Gradually fade in the canvas
    while (!Mathf.Approximately(HUDCanvasGroup.alpha, alphaValue)) {
        HUDCanvasGroup.alpha = Mathf.SmoothDamp(HUDCanvasGroup.alpha, alphaValue, ref velocity, time);
        yield return null;
    }

    HUDCanvasGroup.alpha = 1; // Since float is not accurate, manually set the alpha to 1 after
    HUDCanvasGroup.interactable = true;

    var blur = GameObject.FindWithTag("BlurryCamera").GetComponent<BlurOptimized>();
    blur.enabled = true;
}

How I used Lerp:

public static IEnumerator Dim() {
    while (t < 1) {
        t += Time.deltaTime / 0.4f;
        dimRend.material.color = Color.Lerp(undimColor, dimColor, t);
        yield return null;
    }
}

sentences:
Maya 3D model to iOS OpenGL ES I need to display, rotate, and zoom a 3D model in OpenGL ES (iPhone/iPad).  The 3D graphic artists are using Maya (on OS/X).  What export format should I be looking at to use their 3D models in the app?

Also, a number of Maya plug-ins don't work on the Mac (apparently it doesn't handle plug-ins the same way as Windows and Linux), so I may need an external tool to handle the conversion.

I'm still learning my way around the 3D dev-world, so any advice is appreciated.

Thanks!

sentences:
Is it a good idea to implement a MVC pattern into my LibGDX 2D RPG-style game? For example I currently have a Player object that contains it's textures/animations and how to render these (I'd consider this as the view). Player also has an update() method which controls where the player is going to move, if it's going to lose health etc. (controller). Finally Player also has all it's attributes like runspeed, health, max health, inventory items etc.

The Player class is starting to look very cluttered and unorganized and serializing the complete Player class isn't really possible, so I made a separate PlayerState class which basically contains all it's attributes that could be changed while playing (This could actually be turned into the PlayerModel). I was wondering if it would be a good idea to split the Player up using a MVC pattern. I would have a Player, PlayerController and PlayerRenderer. Serializing the Player would be easy and it would be easier to keep the rendering separate from the updating and make sure rendering only happens when everything for the next frame has been updated.

This seemed like a good idea, however then I would also want to do this for GameMap. A GameMapRenderer that renders the map and it's textures to the screen. A GameMap model that contains what animals and hostiles are in the map and other various attributes the map might have. And of course a controller that controls everything that happens in that map.

I could go even further and say a Pig may need a model since it has attributes that can change, a renderer to render it's texture and a controller to control movement etc. but this seems a bit excessive. However, I don't like only implementing the MVC pattern to the player and then ignoring it for other classes like Pig. But the way I'm working currently is very badly structured imo and it's frustrating to work with.

sentences:
Switching camera position on collision I'm trying to switch the camera to another object on collision.

This is what I've tried to do:

    public Camera switchCamera1;
public GameObject player2;

private Vector3 offset;

void Start () {
    offset = transform.position - player2.transform.position;
}

void OnCollisionEnter (Collision col) {
    if (col.gameObject.name == "triggerCube") {
        //SceneManager.LoadScene ("test2");
        Debug.Log ("HIT SOMETHING");
        setWinText ();

        switchCamera1.transform.position = player2.transform.position + offset;

    }
}

However it simply doesn't work. I've set my camera to switchCamera1, I've set the other object to player2. The script is assigned to the collider object.

sentences: Anyone know of an online resource with spritesheets from classic games? I'm looking for spritesheets for classic retro games, and old home computer games (c64, amiga etc.) Does anyone know of a source online?

sentences:
Sign APK of several games with same or different key? When you choose a key for signing your APK for publishing in GooglePlay, you need to care of this key for the next 25 years if you want to do updates.

The key should not be shared with anyone.
The key should not be lost.

If you do several games, you face the question of having your key DeveloperName and sign all games with it, or have multiple keys like DeveloperName_GameOne for one game, DeveloperName_GameTwo for another, and so on.

Google says here http://developer.android.com/intl/es/tools/publishing/app-signing.html that if you sign several APPs with the same key, they may talk to each other. So it seems that having all with one key will allow future interoperability between games easier.

Instead, if at some point someone wants to buy you one of your games, but not the other, you don't want to give the keys to the non-sold games but still you don't want the buyer to break the update-flow. So it seems that having each game with a different key is better.

Question 1

What exact benefeits will one have if one signs 2 games with the same key? Is that necessary? Is that worth for future interop between games?

Question 2

What is the correct practice for an indie doing several games regarding the signature of them?

sentences: What are useful server metrics to gather for a table card game? When building a game server intended to accomodate large numbers of simultanous games (e.g. table card games), where the server manages lots of tables and each table has up to a small handful of users, what metrics are most useful to collect and why?

sentences:
fbx material show correctly in unity but import to maya show wrong material see my gif, fbx material work well in unity preview, but when import it in maya, face material show wrong

here is my fbx

I use unitychan material in this unity asset

in unity

in maya

the strange thing is in maya I use eye image material but show pure color material

sentences:
How to put triangle information into a glsl shader for dynamic shadows? I am experimenting with how much I can push the GPU with clever optimizations and correct use of hardware, so I know this may lag my computer a lot, that's not the issue.

Currently my goal is as follows:

Define a variable size structure (i.e an array) that contains floats, every 3 floats define a position vector, every 9 define a triangle.

I need to create an array of these structures (the array of all shadow casting objects currently loaded) and pass the array to the GPU (the glsl shader).

If I follow a couple of conventions when putting my data into this format I can use hashing to get an amortized constant search time for the shadow casting triangles,

The issue is to get the data into the format that I need. If this was C++ the format would be an array of vectors and we're done, but GLSL is not as good at managing memory, does somebody know a way to pass the information in the fashion I described, or am I trying to do something that can't be done?

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:
Adjust Line Renderer start position to follow bone rotation I'm trying to make my first game in Unity and I want a line renderer to draw from the end of a turret's gun barrel. The problem is I'm rotating 2 bones in the turret to make it look at the enemy. I've used the bounding box of the turret to calculate the offset from the turret's origin to the end of the gun barrel. But when the turret rotates this position is obviously wrong. How can I calculate the correct starting point for the line renderer after performing a rotation?

Here is the code for the rotation and the line renderer:

void Start () {
    enemyManager = GameObject.Find("EnemyManager").GetComponent<EnemyManager>();
    lazerLine = GetComponent<LineRenderer>();

    platform = transform.root.Find("Armature/BaseBone/PlatformBone"); //Get the root transform of this turret (I.e. the turret itself, not the gun barrel)
    gunBox = transform.root.FindChild("Armature/BaseBone/PlatformBone/LowerArmBone/UpperArmBone/GunBoxBone");

    gunBounds = transform.parent.GetComponent<SkinnedMeshRenderer>().bounds.size; //Get the bounding box of the turret
}

void LateUpdate()
{
    Vector3 lookAt;
    Quaternion platformRotation;
    Vector3 gunLookAt;
    Quaternion rotation;

    if (enemiesInRange.Count > 0)
    {
        //Rotate Platform (The silver platform at the base of the turret)
        lookAt = enemyManager.activeEnemies[enemiesInRange[0]].transform.position - platform.position;
        lookAt.y = 0; //0 the Y axis to stop the turret tilting up or down

        platformRotation = Quaternion.LookRotation(lookAt);

        float rotateSpeed = 10.0f * Time.deltaTime;
        platform.rotation = Quaternion.Lerp(platform.rotation, platformRotation, rotateSpeed);

        //Rotate GunBox
        gunLookAt = enemyManager.activeEnemies[enemiesInRange[0]].transform.position - gunBox.position;

        rotation = Quaternion.LookRotation(gunLookAt);
        gunBox.rotation = Quaternion.Lerp(gunBox.rotation, rotation, rotateSpeed);

    }

    if (timer <= effectsDisplayTime)
    {
        Vector3 lazerStart = transform.position;
        //Adjust the lazer to draw from the default position of the top gun barrel (using the bounding box of the turret to calculate the position)
        lazerStart.y += (gunBounds.y * 0.85f);
        lazerStart.z += (gunBounds.z / 2) + 0.05f;

        //Adjust the lazer to follow the current rotation of the gun
/* ##### This is the part I need to add ##### */

        //Draw the lazer
        lazerLine.enabled = true;
        lazerLine.SetPosition(0, lazerStart);
        lazerLine.SetPosition(1, enemyManager.activeEnemies[enemiesInRange[0]].transform.position); //Of the enemies in range, shoot the first enemy that entered the turrets range

        effectsEnabled = true;
    }
}

Here are 2 picture to give you a better idea of what's happening.

This is with the rotation code commented out.

This is with the rotation code running.

sentences:
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: Is there a specific library to handle the collision system of a big game world like WoW, or any physics library will work? Nothing else to add. Is there a specific library to handle the collision system of a big game world like WoW, or any physics library like ODE will work?

sentences:
OpenGL Shading Program Object Memory Requirement gDEbugger states that OpenGL's program objects only occupy an insignificant amount of memory. How much is this actually? I don't know if the stuff I looked up in mesa is actually that I was looking for but it requires 16KB [Edit: false, confusing struct names, less than 1KB immediate, some further behind pointers] per program object. Not quite insignificant.

So is it recommended to create a unique program object for each object of the scene? Or to share a single program object and set the scene's object's custom variables just before its draw call?

sentences: Alternative to entity system in a game engine? I have been developing a game engine. I was wondering what I should use for a component system. I've read up on entity component systems, but what other alternatives are there? The idea of searching through a "master list" of all entities in the entire game world seems inefficient and slow. I need the most efficient one possible (3D and 2D, if that matters). Using object oriented programming (C++)

sentences: 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:
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:
Grab depth buffer with unlockable D3DFORMAT I'm currently piggy backing on a mod framework (Multitheft Auto) and trying to read the depth buffer in D3DFMT_D24S8 (DirectX9). I can read it if I change the format to D3DFMT_D32F_LOCKABLE and then lock the rectange but this causes the render to be blurred like so:

I'm currently open to hacky methods like finding the pointer to the buffer and reading the depths without properly locking and/or using CUDA. Any advice would be greatly greatly appreciated. Thanks!

sentences:
How do I stop my game from Skipping Screens? I used the code from this - http://www.xnadevelopment.com/tutorials/thestateofthings/thestateofthings.shtml (The second method using enumerations)

I modified it to add a 3rd screen for gameplay and it functioned like the previous screen. The issue is that since the Controller Detect Screen and Title Screen both use the A button to advance. Because of this, it advances through both at the same time, going straight to the gameplay screen. I changed the code (as seen below) so that the Title Screen uses a different button. However, I want to have it so it uses the same button, but not advance at the same time.

Hopefully I explained it correctly.

        private void UpdateControllerDetectScreen()
    {

        //Poll all the gamepads (and the keyboard) to check to see

        //which controller will be the player one controller

        for (int aPlayer = 0; aPlayer < 4; aPlayer++)
        {

            if (GamePad.GetState((PlayerIndex)aPlayer).Buttons.A == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.A) == true)
            {

                mPlayerOne = (PlayerIndex)aPlayer;

                mCurrentScreen = ScreenState.Title;

                return;

            }

        }

    }

    private void UpdateTitleScreen()
    {

        //Move back to the Controller detect screen if the player moves

        //back (using B) from the Title screen (this is typical game behavior

        //and is used to switch to a new player one controller)

        if (GamePad.GetState(mPlayerOne).Buttons.B == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.B) == true)
        {

            mCurrentScreen = ScreenState.ControllerDetect;

            return;

        }

        if (GamePad.GetState((PlayerIndex)mPlayerOne).Buttons.A == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.C) == true)
        {

            mCurrentScreen = ScreenState.GamePlay;

            return;

        }

    }

    private void UpdateGamePlayScreen()
    {

        //Move back to the Controller detect screen if the player moves

        //back (using B) from the Title screen (this is typical game behavior

        //and is used to switch to a new player one controller)

        if (GamePad.GetState(mPlayerOne).Buttons.B == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.B) == true)
        {

            mCurrentScreen = ScreenState.Title;

            return;

        }

    }

sentences:
How can I animate characters' static-geometry eyes? Here's a Nintendo example:

Specifically, the animation of the pupils seems not to animate the geometry.

How is this done?

sentences:
How would I go about programming atmosphere for a game? I've recently started making a 2D game, and I want to implement an atmosphere.

My plan is to include many in-game compartments, such as tubes and ventilation. If I open an airlock from a room with zero pressure to a room with high pressure, I should feel a heavy knock back. If I mix gases in a room, and players both human and alike would not be able to breath, they would die.

I have idea of how to do it, but it won't be that sufficient and real. I don't need an real atmosphere; it just needs to feel real.

This is the small list of what I want to implement:

Gas pressure that effects the environment, such as moving objects and causing damage to objects.
Simple gas mixing, where I would like to implement 4-5 different gasses.
Some sort of in-game device to affect atmosphere and check its state.

How would I go about programming atmosphere for a game?

sentences:
Visual effect with dark overlay gradient surrounding the center of the screen How is it called, what is it used for, and what is the most common way to implement it?

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

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

sentences:
Write depth buffer to texture I need to read depth buffer from GPU and write it to texture. How this can be done?
Here is how texture for depth buffer is created:

depthBufferDesc.Width = screenWidth;
depthBufferDesc.Height = screenHeight;
depthBufferDesc.MipLevels = 1;
depthBufferDesc.ArraySize = 1;
depthBufferDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
depthBufferDesc.SampleDesc.Count = 1;
depthBufferDesc.SampleDesc.Quality = 0;
depthBufferDesc.Usage = D3D10_USAGE_DEFAULT;
depthBufferDesc.BindFlags = D3D10_BIND_DEPTH_STENCIL;
depthBufferDesc.CPUAccessFlags = 0;
depthBufferDesc.MiscFlags = 0;

m_device->CreateTexture2D(&depthBufferDesc, NULL, m_depthStencilBuffer);

Also, I've got another question: is it possible to bind depth buffer texture as sampler to the pixel shader?

sentences: How to orbit an object around another object in an oval path in Unity? I would like to create kind of planetary orbit structure for my game. I was used transform.RotateAround(Vector3.zero, Vector3.forward, RotationAngle * Time.deltaTime); and it rotates in a circular shape. But I would like to do it in an oval (Ellipse) shape.

sentences:
What is the logic behind the 'Loading' scenes in games? I'm making my first game, it's a tower defense type of game, using Unity game engine and taking Fieldrunners as a reference. I would like to know more about the functionality behind 'Loading' scenes in games.

Until now I am instantiating/creating objects at run time and I'm not facing any delay or similar issues doing so. So what are 'Loading' scenes in other games used for? Is there some functionality or instantiation of specific objects for the next round or stage? If yes why do I need them if I'm not getting any delays?

sentences:
Interpolation using cubic Bezier curves I am trying to create an interpolate function for an animation library to achieve a tweening effect between frames.

I want this to work with Bezier curves. I have created a jsFiddle (here) of my progress so far.

I am trying to create a linear tween using this bezier definition:

{
    p0: new Vector(0,0), //Start point
    p1: new Vector(0,0), //Control point 1
    p2: new Vector(1,1), //Control point 2
    p3: new Vector(1,1)  //End point
}

I have implemented the interpolation function from this tutorial.

var u = 1 - t;
var tt = t*t;
var uu = u*u;
var uuu = uu * u;
var ttt = tt * t;

var p = p0.multiply(uuu);
p = p.add(p1.multiply(3 * uu * t));
p = p.add(p2.multiply(3 * u * tt));
p = p.add(p3.multiply(ttt));

The problem I am having is that when I run the function, the animation does not appear to be linear, but rather like 'ease-in-out'.

Ideally I would like the linear animation to work the same as this CSS transition.

Can anybody see why it is not animating in a linear fashion?

sentences:
Blender multiple animations and Collada export Say I have a simple mesh in Blender, with two keyframes, like so:

Then, another animation for the same mesh, also with two keyframes:

Theese animations worke fine in Blender and I can switch between them in the Dopesheet, where they are called "actions":

The problem arises, when i try to export this to the Collada format, for use in my game engine. The only animation/action that seems to be carried over, is the one currently associated to the mesh. Is it possible to export multiple animations/actions for the same mesh, to the Collada format?

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:
Does StreamPeerTCP guarantee received packet is same from server? I'm making simple Godot project that works with Node.js server. To receive and send packet to Node.js server, I used StreamPeerTCP.

First seems works, but after 2nd transmission from server, extract data from packet were broken and mess all other logics.

This wasn't happened when same logic tested with Unity C#:
https://github.com/rico345100/unity-multiplayer-with-nodejs/blob/master/Assets/Scripts/Network/NetworkManager.cs

Here's the repo I'm currently developing:
https://github.com/rico345100/godot-multiplayer-with-nodejs
https://github.com/rico345100/nodejs-tcp-server-for-godot

Used Godot 3.1.2 but also works with 3.2.rc6. Tested with Godot 3.1.2 and macOS 10.13.6.

sentences:
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:
Algorithm for exploring/filling grid map I'm working on a small game that takes place on a grid map. I'd like to write an AI that is able to explore the grid map by filling as much of its available space as possible.

From any given position there are four possible moves (north, south, east, west), but some of these may be blocked by walls. Also, once I visited a cell I don't want to visit it again. What's more, I want to avoid getting stuck: if moving in one direction means I'm going in a dead end, I'd rather not fill out that part of the grid.

Can you please help me with some pointers as to how I can do this?

sentences:
Android Jump&Run - Random map generation I'm pretty new to game development but I work on an android app.
It's a 2D Jump and Run game.

I do it in Eclipse and the map is readed out of a txt file right now.
But I want to do a Jump and run game, where the player must jump over holes in the ground.
Theses holes should be created randomly. So I want an infinite map, which is created randomly.
Can somebody give me tips how to begin with this? How can I do a randomly generated map?
I don't want the full code or something else, just a little tip how to start because I don't know how I can do this randomly generating.

Thanks in advance! Hope u know, what I mean!

sentences: Bubble Shader in Babylon.js Can anyone think of an approach to creating a bubble-like material in babylon.js? I imagine a good starting point would be with using the Fresnel shader.

sentences:
Font rendering, how do you align glyphs of a font? I'm trying to render text quad using texture generate by BitmapFontWriter of libgdx.
For the font I can get size, PaddingTop, PaddingRight, PaddingBottom, PaddingLeft, LineHeight, CapHeight, Baseline, Ascent, Descent.

For each glyph I can get u, v, width, height, x offset, y offset, x advance

The chars rendered are OPQZ[\\]^_`abcdefg你好,. If I just render the quad. I get:

Q, g and the `are definitely incorrect. The brackets and notdef are a little large.
The only thing that I find meaningful for me is y offset. If I shift the quad with it, I get:

Q is not changed at all. g gets slightly better. Lots of them get worse.

sentences:
Rotate mesh to normal I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with.
So head pixel in my texture is a normal and I want to rotate each instance with the corresponding normal in a shader. How can I achieve that in a shader only?
Unless I am mistaking, there should only be a rotation around the X and Z axes.

sentences:
What is the purpose of integration in physics engines? All online resources seem to assume that you know what this means and/or state that this is related to object movement in some way.

How does this differ than just position.x++ and position.y++ and how does integration allow us to simulate movement? (calculus integration?)

I understand there are a few different methods, namely Euler explicit, RK4, and Verlet. These methods I read are meant to solve ODE's, what are we solving for when we solve these equations?

sentences:
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:
Best way to initialize values on 32-bit FP framebuffer in OpenGL I have a framebuffer bound to 32-bit FP texture:

glGenTextures(1, &texColor);
glBindTexture(GL_TEXTURE_2D, texColor);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, w, h, 0, GL_RGBA, GL_FLOAT, (GLvoid*)NULL);
glBindTexture(GL_TEXTURE_2D, 0);

glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texColor, 0);

What's the best way to initialize framebuffer to a value 1000.0?

The problem is that

glClearColor(1000.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);

clamps values to [0,1] interval, and clearing the texture texColor would require memory allocation of w * h * sizeof(float) bytes of memory and manual filling of that buffer with value 1000.0 which is slow (I would inject it using glTexImage2D).

I'm using OpenGL 3.2 Core profile.

Thanks,
Josip

sentences:
Best way to handle movement input? I'm currently developing a RPG movement system in c++, and tried to use the State Pattern/State machine for this, but AFAIK I would have to check each movement key in every state.(right?)

Is there a better design for this?, because the states have no restriction, the player can switch to any move state at any time.

can anyone help

sentences:
OpenGL shaders messed up So after a long attempt at DirectX I switched back to good old OpenGL. Now I'm running into this weird problem. My code involves shaders, of course, and drawing a basic cube. But I'm getting this weird shape. I've never seen this before. I was just wondering what could possibly be causing this? Thanks very much!

Initialization:

lightingShader->GenerateVAO();
lightingShader->GenerateVBO();

lightingShader->SetVertices(vertices, sizeof(vertices), GL_STATIC_DRAW);

lightingShader->BindVAO();
{
    lightingShader->AddAttribute(0, 3, GL_FLOAT, GL_FALSE, 3, 0);
}
lightingShader->UnbindVAO();

Rendering:

lightingShader->Use();

GLint objectColorLoc = lightingShader->GetUniformLocation("objectColor");
GLint lightColorLoc = lightingShader->GetUniformLocation("lightColor");

glUniform3f(objectColorLoc, 1, 0.5f, 0.31f);
glUniform3f(lightColorLoc, 1, 0.5f, 1);

GLint modelLoc = lightingShader->GetUniformLocation("model");
GLint viewLoc = lightingShader->GetUniformLocation("view");
GLint projLoc = lightingShader->GetUniformLocation("projection");

glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->View()));
glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->Projection()));

lightingShader->BindVAO();
{
    glm::mat4 model;
    glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));

    glDrawArrays(GL_TRIANGLES, 0, 36);
}
lightingShader->UnbindVAO();

Result:

As you can see, position and color is set fine, but I still get that weird shape.

sentences:
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:
Drag 3D camera with mouse cursor I have a camera that is moved by changing its X and Z coordinates. However, the camera is rotated, so when an object moves by 1 unit in the world, the number of pixels it moves by isn't trivial to determine.

How could I move the camera so that if the pointer is at a set point, that point will be under the cursor after the cursor moves?

I have a PerspectiveCamera and the number of pixels that the pointer was dragged in each direction (X and Y) on the screen.

sentences:
Best way to add and remove quads in a VBO? What's the best way to handle adding and removing 2D sprites (quads) in a VBO?

I am working on a mobile board game and sometimes game pieces (represented by quads graphically) need to be added to or removed from the screen. Currently, I store all of my quad vertices in an array. When I need to add new quads to the screen, I append this list with the new vertices. However, removing quads is more cumbersome. I track the positions of each quad in the VBO array with a dictionary, and when I comes time to remove it, I remove that block of four vertices from the array. I then have to update the values stored inside the dictionary since the VBO array has been resized.

I am not satisfied with this solution, and I feel like there could be a better way to achieve what I want. I couldn't find any related questions about storing 2D sprites which need to be added or removed during runtime like this. Since the game is really simple graphically, I am thinking it may be easiest to make a draw call per sprite. I can't use instancing since I am restricted to OpenGL ES 2.

sentences:
Physics movement prediction is way off I'm making a simple, non-networked game. There are two players and a ball. In implementing the AI for the second player, I've run into a huge problem predicting where the ball will hit the ground. Either I've made a mistake in the physics engine or in implementing the prediction itself. I wrote the physics engine, and while it works visually as I expect it to, I won't rule it out as a suspect. First I'd like to make sure I haven't made a mistake in the prediction code. Here's what I have found so far:

I print the predicted time to impact and the accumulated time in each frame. The time predicted for impact is way off.

tti: 0.678233
total time: 0
.
.
tti: 0.0108339
total time: 0.94969
[ball] ground collision

The code for predicting is in two functions.

double nextBallCollisionWithGround(Ball *ball, double groundHeight) {
    double timeToImpact = quadraticSolver(kGravity, ball->velocity().y, ball->position().y - ball->radius() - groundHeight);
    std::cout << " tti: " << timeToImpact << endl;
    double groundPos = -3.;
    if (timeToImpact > 0) {
        groundPos = ball->velocity().x * timeToImpact + ball->position().x;
    }
    return groundPos;
}

double quadraticSolver(double a, double b, double c) {
    double ans = -1.;
    double det = (b*b) - (4.*a*c);
    double t1, t2;
    if (det > 0.) {
        t1 = (-b + sqrt(det)) / (2. * a);
        t2 = (-b - sqrt(det)) / (2. * a);
        if (t1 > 0.)
            ans = t1;
        if (t2 > 0.)
            ans = t2;
    }
    return ans;
}

If there's no problem in these functions, I can include the relevant parts of the physics engine to see if the problem is there.

sentences:
Find grandchildren with specific tag I have an empty object that contains multiple children each containing their own child objects. I want to get a list of all the objects containing a specific tag but i don't know the depth of each child object.
The following solution only returns the children that have the tag.

foreach (Transform child in city)
        {
            if (child.CompareTag("Zone"))
                buildings.Add(child);
        }

sentences:
What version of Java should I target for applets? I recently deployed an applet that seems to require Java 6 Update 24. I assume the reason for this requirement is the matching JDK version I used to create the applet (I am new to Java).

The fact that my applet requires a Java download/update for users who already have some version of Java installed is a big concern for me; the applets I'm creating slip into a web comic, so it's very disruptive. Having used the most recent version of Java, it seems as though I am able to assume that most of the readers I get will have to update Java to continue reading/playing.

Is there a best practice concerning which version of Java to use to make the process of using an applet easy for end-users? Any reading material on this would be very helpful. Should I be using an older version of Java if I don't require new features? I am using Slick for 2D games.

sentences:
What's the "right way" to open a websocket connection inside WebGL? The official Unity documentation says that, to run websockets in the WebGL player, you should use this plugin on the Asset Store.  Unfortunately, following that link leads to a notice that this asset has been deprecated and is no longer available, with no explanation as to why or what should be done to replace it.

With that unavailable, how should I implement WebGL websockets in my game?

sentences:
Single Letter/ Alphabet recognition in AR I am developing an AR game with unity where I need to recognize alphabets in runtime. I have tried vuforia but it does not support single letter recognition. OpenCV is an alternative solution, but I don't understand how to detect text in Runtime with OpenCV.

I have also tried object recognition, NFT and markerless tracking. But all of these failed because a single letter does not have enough feature to get detected.

I am really new in Augmented reality and image processing. Can anyone give me a guideline or plan what I should do?
I am using this letter blocks from amazon https://www.amazon.ca/gp/product/B0006MU23W/ref=s9u_simh_gw_i1?ie=UTF8&pd_rd_i=B0006MU23W&pd_rd_r=22ef1e20-b08e-11e7-91cc-bbe5f37c0d0f&pd_rd_w=wCg3M&pd_rd_wg=NG8Lg&pf_rd_m=A3DWYIK6Y9EEQB&pf_rd_s=&pf_rd_r=TH85A9MZFVDZPD8YYR5P&pf_rd_t=36701&pf_rd_p=09a46553-65cf-45b2-8aaa-e9bb559981ab&pf_rd_i=desktop

sentences:
OpenGL ES Framebuffer creation problem I'm having some problems porting my D3D code to OpenGL ES. I have a Graphics Device class that encapsulates all rendering commands. The code below is in an ObjC++ file.

The problem code is the called to get the render buffer width and height. It doesn't actually return any value in the w or h GLints.

It should be noted that the code below is from an older iPhone project, and it works there. Am I missing something really stupid?

Checking the framebuffer status returns a value of complete, since OpenGL ES seems quite happy to initialize a depth buffer with the garbage w and h values I pass to it!

bool GraphicsDevice::Initialize(id<EAGLDrawable> eaglLayer)
{
   EAGLContext *context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
   if(context == nil)
   {
      return false;
   }

   [EAGLContext setCurrentContext:context];

   this->eaglContext = context;

   glGenFramebuffers(1, &frameBuffer);
   glBindBuffer(GL_FRAMEBUFFER, frameBuffer);
   glGenRenderbuffers(1, &renderBuffer);
   glBindBuffer(GL_RENDERBUFFER, renderBuffer);
   [eaglContext renderbufferStorage:GL_RENDERBUFFER fromDrawable:eaglLayer];

   GLint w, h;
   glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &w);
   glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &h);

   SetWidth(static_cast<unsigned int>(w));
   SetHeight(static_cast<unsigned int>(h));

  glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,    renderBuffer);

   glGenRenderbuffers(1, &depthBuffer);
   glBindBuffer(GL_RENDERBUFFER, depthBuffer);
   glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, w, h);

   glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer);

   GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
   if(status != GL_FRAMEBUFFER_COMPLETE)
   {
      System::Log("Framebuffer not complete");
      return false;
   }

   return true;
}

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:
How can I change the color of an object at runtime? I wish to have the shader effect as in the game 'The stack' by ketchapp

https://play.google.com/store/apps/details?id=com.ketchapp.stack&hl=en

As you can see, the color of the objects as well as the skybox keep changing.

I'm completely c# noob and trying my best to find  shaders to replicate the effect. But I can't find anything.

How can I change the color of an object at runtime?

sentences:
How do I account for the velocity difference between a ship and it's fired projectile? In my project, I have a ship that moves and increases it's movement speed with respect to time and how long the acceleration button is being pushed(just like the way a real life car works), now as expected, the ship fires projectiles when I press the fire button.

The problem here, is that at a point in the game, the ship reaches it's highest speed/terminal velocity, and now it's faster than the projectile it fired which is not what I want, so, how do I create a realistic projectile movement based on the ship's velocity?
This is so that if the projectile is fired when the ship is moving slowly through the game scene, it doesn't move so fast that we can't see it travelling in the forward direction, and at the same time if it is fired when the ship is moving at top speeds, the ship is not seen to be faster than or as fast as the projectile's speed.

I want to keep the code as optimized as possible, so I am using this line for the projectile's movement:

public float velocity = 100f;
void Update() {
transform.position += transform.forward * Time.deltaTime * velocity;

}

sentences:
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:
How can I rotate a camera on the X and lookat target and once looking at the target to stop slowly the rotation? This is a screenshot showing the camera position.
I want it to rotate slowly smooth to the left and once looking at the soldier to stop rotating.

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

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;

    // Use this for initialization
    void Start ()
    {

    }

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

    }
}

The script is attached to a empty gameobject.
What I want to do is once the camera stopped rotating and looking at the soldier to make the soldier start moving to the right and camera should follow the soldier rotating and keep follow the soldier moving.

The main idea is to create a cut scene. The camera is position at this point just to display the cut scene.

To make the first rotation to the target I tried this:

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

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;
    Quaternion targetRotation;

    // Use this for initialization
    void Start ()
    {
        targetRotation = target.rotation;
    }

    // Update is called once per frame
    void Update ()
    {
        Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime * speed);
    }
}

But the camera is not rotating at all.

This is screenshot of the Hierarchy and Inspector:

The script is attached to GameObject: SoldierNaviFight
The camera that I want to move is the child of SoldierNaviFight: SoldierNaviFightCamera

UPDATE:

This will rotate the camera but it's rotating it to the right instead to the left to the soldier. Not sure why:

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

public class SoldierNaviFight : MonoBehaviour
{
    public Camera fightCam;
    public Transform target;
    public float speed = 2f;
    Quaternion targetRotation;

    // Use this for initialization
    void Start ()
    {
        targetRotation = target.rotation;
    }

    // Update is called once per frame
    void Update ()
    {
        fightCam.transform.rotation = Quaternion.RotateTowards(fightCam.transform.rotation, targetRotation, Time.deltaTime * speed);
    }
}

sentences:
XNA's GameTime.ElapsedGameTime.TotalSeconds isn't working as expected As I've seen at quite a few website, the best way to handle variable frame rate and movement (moving projectiles, monsters, swinging swords)... looks something like this:

//This
position += TotalSpeed * (float)gt.ElapsedGameTime.TotalSeconds;

//Or this (direction is being normalized)
position += direction * (float)(TotalSpeed * gt.ElapsedGameTime.TotalSeconds);

And then in the Game's main constructor (Game1.cs):

        IsFixedTimeStep = false;
        TargetElapsedTime = TimeSpan.FromSeconds(16.666); //16.666 milliseconds, or about 60 FPS.

        graphics.SynchronizeWithVerticalRetrace = true;

I started to notice that whenever my FPS was at 30, my projectiles (in this case, arrows) would move slower than when at full speed. Turning V-Sync to false above unlocked the frame rate so then I'm going around 120 FPS. Projectiles are going much faster.

Unfortunately, this applies to everything else.

Am I doing something wrong, or is TotalSeconds just that unreliable/broken? I plan to switch over to Monogame eventually, but I'm not sure if that would fix the issue.

An additional note that may or may not be related: changing 'IsFixedTimeStep' to true causes my game to not run -- no errors, just a blank window-colored (beige-ish) screen.

Thanks in advance.

EDIT: projectile movement code

        direction = new Vector2((float)Math.Cos(rotation),
                                (float)Math.Sin(rotation));

        if (direction != Vector2.Zero)
            direction.Normalize();

        position += (direction * TotalSpeed) * (float)gt.ElapsedGameTime.TotalSeconds;

Pretty normal movement code. 'rotation' is just the direction the player is looking. 'TotalSpeed' is 2300f.

sentences:
Faking a 3D object to decrease number of polygons I'm making a game in unity and I'm building a fence in blender but I want it to be as low poly as possible. My original design was too high poly so I thought, what if I could simply use a cube with some cleverly arranged textures. Like so:

You can see the edges are all looking good but the inside sections are not, i.e there's nothing there... so does anyone know if it's possible to fake those faces that would make it look as though it were a complete mesh. Here's what I'm tring to achieve:

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:
rendering a spritebatch to a temporary buffer and then offset that to the main screen I've been trying to figure out how to do this but I have a bunch of screens, each with their own Draw method. However, I'd like to render all sprites offset by the screen position without altering their locations before I do the drawing.

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

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

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

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

sentences:
How do I draw shape distortion with a Texture2D in XNA? Say I have a rectangular Texture2D object in XNA, and I draw it on the screen.
How can I animate it so it slowly changes to a trapezoid shape, and then to a pentagon, etc.

I have no idea what this technique is called, so I couldn't find anything on Google.

sentences:
Using collectable items to change a gameobject Unity I’ve been working on a 2D platform side scroller. I’m rather new to Unity and C#.
Basically what I’ve achieved so far is a character which can collect Logs throughout the game and those logs are stored in an inventory (a simple count variable). Those logs can then be used to increase the values of Campfires. This is where the problem starts, I’m trying to figure out how to check the currentValue of the campfire and show a different sprite animation of the fire. (As shown below)

In short:

  Player gathers log (count += 1) -> if ( count > 0 && Player collides
  with (or in range of) Campfire && presses E -> Player is able to use
  log  { call throw_log_animation; count -= 1; currentValue +=25%; call
  new fireAnimation; }

  if Fire = 100% -> Player CANNOT use log. If Fire = 0% -> Game Over.

Collectable items code:

using UnityEngine;
using System.Collections;

public class CollectableItems : MonoBehaviour {

    private int count;
    public GUIText countText;

    // Use this for initialization
    void Start () {
        count = 0;
        setCountText ();
    }

    // OnTriggerEnter 2D
    void OnTriggerEnter2D(Collider2D other) {
        // If gameObject comes in contact with player
        if (other.gameObject.tag == "WoodStumps") {
            other.gameObject.SetActive (false);
            count += 1;
            setCountText ();
        }

        // If player comes in contact with gameObject
        if (other.gameObject.tag == "CampFire") {
            if (count > 0) count -= 1;
            else gameObject.SendMessage("No logs");

            setCountText ();
        }

    }

    void setCountText() {
        countText.text = "Count: " + count.ToString();
    }
}

If anything is unclear, don’t hesitate to ask. I’m looking forward to your solutions and idea’s!

sentences:
Best way to store a word list in Java/Android I'm building a game where I form words (think Scrabble) and I need to have them validated in real-time, meaning that I need to have some sort of word list loaded where I can check if the word made exists or not.

I was wondering what would be the best way to store that list, should I just create an Array or use some sort of database (sqlite3 in this case).

Thanks

sentences:
How to smooth rotations? I have a semi-regularly (15fps to 60fps) sampled source of position and orientation to which I am using dead reckoning to fill in gaps.

However, I would like to smooth it further to eliminate any steps due to dead reckoning error.

The x,y,z can easily be smoothed with a small (3pts?, 5pts?) moving average filter. However, I am unsure of how to approach smoothing the orientation.

I have access to Axis angle representations and a decent Quaternion class that I could possibly build a moving average filter with. It has multiply (operator *) and power (operator ^) which in theory would allow me to effectively average a set of rotations.

Would filtering an axis angle representation work if I simply filtered the 'x','y','z' and 'a' channels and then normalized it?

sentences:
How are these physics formulas translated to this code? So how exactly does something like \$v_f = v_i +a*t\$
translate to something like self.vel += self.acc in code?
or \$d=v_i*t+\frac{a*t^2}{2}\$ translating to self.pos += self.vel + 0.5 * self.acc there seems to be variables missing, and summations happening that aren't part of the formulas.

sentences:
LibGDX: How to make an object falls with random speed I'm trying to make an object (ball) fall into position Y and when the ball collides with the base. The sprite changes and along with the change I want the speed of the fall to change according to the sprite

public void create () {
    circleBall = new Circle();
    rectangleBase = new Rectangle();
    ball = new Texture("ball.png");
}

public void render () {
    spriteBatch.begin();
    fallBall();
    rand();
    spriteBatch.end();
}

void fallBall(){
    fallSpeed++;
    if(posYBall > 0){
        posYBall -= fallSpeed * 2 / 2;
    }
}

void rand(){
    int rand1 = random.nextInt(15 - 1) + 1;
    int rand2 = random.nextInt(10 - 1) + 1;
    int rand3 = random.nextInt((55 - 35) + 1) + 35;
    collisionBallBase(rand1, rand2, rand3);
}

void collisionBallBase(int rand1, int rand2, int rand3){
    if(Intersector.overlaps(circleBall, rectangleBase)){
        if(rand1 <= 5){
            ball = new Texture("ball.png");
        }else if(rand1 <= 10){
            ball = new Texture("ballb.png");
        }else{
            ball = new Texture("ballc.png");
        }

        if(rand2 >= 5){
            ballDirection = 4;
        }else{
            ballDirection = -4;
        }
        fallSpeed = -rand3;
    }
}

sentences:
Storing and sending English word list using trie data structure I was planning on making a word based game something like Scramble or Boggle. I searched on the internet and found that one of the best way to store the Word List is by using a trie.

My question: Is there a way I can pre-make and populate a trie data structure and send it to the user rather than sending him the whole word list and then creating the trie data structure at run-time?

sentences:
Advance efficient water physics simulation Summary: I am looking at creating a large(ish) ocean which multiple ships will be present in doing their own thing. I want the ocean to be a life like as possible but without compromising too much on rendering speeds.

A Little more detail: I am using Unity to create the game in and ultimately I will need to be able to release the game as a web player to there lies my limitations of the water simulation.
For the actual simulation of the ocean I will need it to be able to react to the ships movement and vice-versa. The end product of the simulation I want to be able to look like this simulation of a ship in water (if possible) to be done efficiently. http://youtu.be/H4ACKAUU3O0?t=3m51s

I have started reading up on other information and looked at the other similar questions to mine:
1) Water/Ocean simulation and physics
  - I have read this question fully, am looking at not using wind as said in this question but will use this as a reference when creating the final product. (I would like to add to the information from that question with the answers on this question.)

2) Resources of realistic water simulation?
  - I have started going through the tutorials that the answer linked to and so far they seem good but do not look like they will answer my question.

The water will have splashes in reaction to the objects in the water (particle effects I believe) and small waves will come off the objects in the water e.g. ripples. Also if you are a smart cookie that wants to be awesome you should include in your answer about putting a shader on the water.

Also since the ships will be moving all at independent speeds and traveling through the sea, for efficiency I don't want to just make the water massive so is there a way to only render/simulate the water within a certain radius from each of the ships?

What I am looking for in an answer:

I would like to know the what tricks for making this type of simulation light-weight can be used for these types of water simulations and specifically in unity.
What limitations will I encounter when creating this and why they are limitations
The basic work flow of creating something like this step by step. (e.g. step 1: to make the object that will be in the water)
Are there any open source projects for these types of simulations?

sentences:
Why do my velocity estimates have such a large margin of error I am writing a script in unity that applies a force to the object to advance it a set distance in an environment without friction or drag, producing a cosine force curve.

However, as the target approaches the destination, the force to apply is less than the value specified by the curve as the time unit is too large and will cause the object to reverse direction.

To resolve this, I estimate what the speed will be after applying this frames force and, if that reverses the direction, we take a proportion of the force.

It is working well around 4 times out of 5, but every so often it will not detect the reverse in direction and will apply the force for an extra frame or 2, causing the object to back up.

Closer investigation revealed that basically the problem stems from my estimate being significantly (some times up to 0.05) different from the velocity the next frame. I compute it as follows:

Vector3 currentVelocity = ship.rigidbody.velocity;
Vector3 direction = ship.transform.right;

// this is the value I use for the "actual" speed
float velocityAlongDir = Vector3.Dot(currentVelocity, direction);

// this is my estimate
float estimatedVelocity = velocityAlongDir + (applyingForce * lDeltaTime);

Where the applyingForce is applied thus:

ship.rigidbody.AddForce((applyingForce * ship.rigidbody.mass) * transform.right);

Some sample data:

Predicted velocity: 0.3048308
Actual velocity: 0.2880591
Predicted velocity: 0.2068605
Actual velocity: 0.1900333
Predicted velocity: 0.09798826
Actual velocity: 0.1900333
Predicted velocity: 0.1082982
Actual velocity: -0.007007703

As you can see by the last entry, the predicted value doesn't change sing, but the real value does. Trying to work around this using does it go below a small value get different problems where the current velocity is too small etc.

Any idea why my calculation for next frame velocity seems so wrong and is there anything I can do about it?

Update

As pointed out in the comments, I needed to apply the force in the FixedUpdate and calculate my next frames velocity using Time.fixedDeltaTime. However, the following can happen, presumably in adverse frame conditions:

Predicted Velocity: 15.67547
Actual Velocity: 15.67547
Predicted Velocity: 17.54726
Actual Velocity: 15.67547 // note the same as the previous update, there has been no physics step!
Predicted Velocity: 17.51759 // estimate is subtly different, because my own timer has advanced

I fixed this by using fixedTime as opposed to fixedDeltaTime. However, then when I do a double update I am wrong for that frame, its like the physics step is trying to make up for the lost time:

// all going well...
Predicted Velocity: 52.25977
Actual Velocity: 52.25977
Predicted Velocity: 52.40138

// the estimate is wrong, we are moving at the same speed => no physics update
Actual Velocity: 52.25977
// we predict the same velocity for next frame
Predicted Velocity: 52.40138
// but we are wrong, like it is trying to catch up for lost time
Actual Velocity: 52.543

// then after that point we are precisely right
Predicted Velocity: 52.66479
Actual Velocity: 52.66479

This wouldn't be an issue except in the edge case where we do this double step precisely at the point we need to detect when the speed will change and apply the ratio. Since the physics step seems to play catch up, I miss the fact we changed speed.

sentences:
color individual triangles on a mesh in Unity? I am trying to use Unity to display a model and color some triangles on the model to high light those parts of the model.

I have created a scene, with a camera, a light source and a cube.
After the scene loads I have a script on the cube where I am importing a new mesh and replacing the cube mesh with the new mesh. I am also giving each triangle a random color.

    void Update () {
    if (Time.time > 10 && newShapeLoaded)
    {
        System.Collections.Generic.List<facet> newModel = readStl(@"C:\testing1\stls\sphere.stl");
        System.Collections.Generic.List<Vector3> vertices = new System.Collections.Generic.List<Vector3>();
        foreach (facet f in newModel)
        {
            vertices.Add(f.vecA);
            vertices.Add(f.vecB);
            vertices.Add(f.vecC);
        }
        Mesh mesh = GetComponent<MeshFilter>().mesh;
        mesh.vertices = vertices.ToArray();
        int[] t = new int[vertices.Count];
        Color32[] colors = new Color32[vertices.Count];
        Color32 currentColor = new Color32();
        for (int i = 0; i < vertices.Count; i++)
        {
            t[i] = i;
            colors[i] = currentColor;
            if (i % 3 == 0)
            {
                currentColor = new Color(
                                    Random.Range(0.0f, 1.0f),
                                    Random.Range(0.0f, 1.0f),
                                    Random.Range(0.0f, 1.0f),
                                    1.0f);
            }
            colors[i] = currentColor;
        }
        mesh.triangles = t;
        mesh.colors32 = colors;
        mesh.RecalculateBounds();
        mesh.RecalculateNormals();
        mesh.UploadMeshData(true);
        newShapeLoaded = false;
    }
}/* Update() */

This was not working and searching I found I needed to change the material type to a material that uses vertex color shading. I found the Particles>VertexLit Blended Shader colors the triangle but then the triangles are drawn in the wrong order so the shape appears inside out.

Is their anyone that knows more about Unity and 3D that could give me some advice or let me know where I have gone wrong with this?

(edit)
So I have investigated this further and I believe the comment made about the particle material being the reason for the shape appears inside out is correct.

I also noticed that the original cube has this problems before I change the mesh as well.
So I have tried to find a material with a shader that will still let me color the triangles but not break the render order of the triangles. Unfortunatly I haven't been able to get anything to work.
I have found a thread here where several people have tried to create a shader to do this and I have downloaded their projects and run them and tried to get them to work with very limited success. This lead me to also find several tutorials on shader programming to try and understand what was happening, but these have not given me any better understanding of how to get vertex coloring working.

I am now wondering if I have gone off track because all I really want to do is to make a simple model and change the color of some triangles on the model. I though this would be like a simple hello world exercise for 3D graphics, but I have put over a week into this now and tried several different approaches and still have not been able to get this working.

I would be very grateful if someone could show me an example of changing colors of triangles on a mesh? Or if someone that understands 3D graphics could just point me in the right direction to a tutorial or guide that will help me learn what I need to know to get this working and let me know if this is the correct way to try and be able to change colors on a mesh?

sentences:
cocos2dx - Custom Fragment Shader and CCRenderTexture I have a CCRenderTexture that is filled with a sprite when the scene is loaded, as follows,

canvas = CCRenderTexture::create(this->getContentSize().width, this->getContentSize().height);
canvas->setPosition(data->position);
canvas->beginWithClear(0.0, 0.0, 0.0, 0);
this->visit();
canvas->end();

The above code is written within a class, which derives from CCSprite (Hence this).

Then, in another function applyShader(), I create a sprite named splat, from the texture of CCRenderTexture *canvas. Thus splat will contain the whole texture of canvas.

Now I apply a custom fragment shader to the splat by calling the function splat->renderShader(), which will modify some small portion of the whole  texture.

Then I draw the modified texture back to the CCRenderTexture *canvas.

Hence, applyShader() will
 * take a texture from CCRenderTexture,
 * create a sprite based on it,
 * apply a fragment shader to it
 * and draw the modified texture back to CCRenderTexture.

This applyShader() will be called repetitively and its code is as follows:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->renderShader();
art->canvas->begin();
splat->visit();
art->canvas->end();

My shader code is (nothing fancy)

precision mediump float;

varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform sampler2D u_colorRampTexture;
uniform float params[5];

void main() {
    gl_FragColor = texture2D(u_texture, v_texCoord);
    return;
}

So, with the above code I expect the original sprite this to get rendered over and over again without any visual changes. But on each call to applyShader(), the texture is getting stretched a little and the stretched image is getting rendered. After some 10 calls, the image gets so distorted.

Can someone please tell me where I am going wrong?

Thanks :-)

PS: All code shown here is partial, not complete code.

Edit: Adding Screens

Update:
The problem has nothing to do with shaders it seems. It happens even when I dont call renderShader(). The actual lines of code is:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->setPosition( ccp( art->getContentSize().width * 0.5, art->getContentSize().height * 0.5 ) );
splat->setFlipY(true);
art->canvas->begin();
splat->visit();
art->canvas->end();

sentences:
How to port a game from IPad to Iphone I just finished developing a 2D side scroll game for the IPad using Cocos2d and Box2d.
Now we want to make an IPhone 4 version of the game, but I'm still not sure what is the best way to do it.

I was thinking to just create a new target on my project, remove all the current resources from the Build Phases and create a new Resources folder with all the assets of the game scaled to the new resolution.

Of course this approach would take a lot of work, specially from the designer, since there are a lot of images on the game, 30 levels with 3 layers of parallax, and over 100  animations between all the elements, plus the SVG levels that map physics world (we are using level SVG parser).

I would also have to check all the touch functions and the sprites with a hard coded position (mostly Hud and the Menu). I did tried to use the win Size for this, but I'm pretty sure there are sprites with fixed positions.

I know that checking the Menu and Hud position should not take much time, but I'm worried about the time it could take to scale all the images, and specially the SVG files that map the physics of the game.

I would like to know if I'm in the right path regarding the porting of the game or if there if someone have though of a better easy solution.

I tried modifying the gluLookAt eye z parameter, but this didn't work really well. I haven't work with OpenGL since college around 3 years ago, and I don't remember very well   the math behind the low level pipeline of it. Anyway, I don't think that modifying the Cocos2d rendering steps could work for my problem.

sentences:
Unity - Permanent force when a rigibody without gravity hit a collider I'm actually working on a 2D game, and stumbled upon something rather strange in Unity. The issue occurs pretty specifically, so the description will be long:

In the scene, I have a flying object, controlled by the player. It has a rigidbody set as follows: Mass=1, Drag=0, Angular Drag=0.05, Gravity=false, Kinematic=false. So far, so good, the script worked flawlessly, and collide as expected in other physical objects.

Our client asked us to create platforms upon which the enemies could walk, but the player would fly through. A simple collider with IgnorePhysics(GameObject with Player tag) did the trick. The script still worked, no issue until then.

I added a cube on the platform, to test if it would fall through or not. The cube effectively collide with the platform, just as usual, and rest upon it.

But now, as soon as the player hit the cube, it get pushed back in the opposite direction until it hit another surface. It happens like when a non-gravity object is pushed by something: a force is applied and continue forever without friction. (But it does not bounce the same way on other objects. I can only suppose it comes from the force inputed to the objects during the collision, but I can't know for sure)

Example: if I hit the underside of the cube, my avatar will drift towards the ground until I hit it, no matter its speed in other direction. If I hit the upperside, it'll just fly out of the screen, towards the y-infinite.

The script is a classic gameobject.transform.position = Vector3.MoveTowards, so it input no forces whatsoever. Thus, I can't counter the inverse force.

The thing bothering me is that the avatar never had this kind of drift before, even though it collided other objects.

My question is: How can I negate the new force input from the collision for the avatar? (optionnaly: why does it occurs only in this case? I'm puzzled by this case)

sentences:
algorithm to "explode" mesh i have a simple triangle mesh which i want to explode.
so i am looking for an algorithm that makes every triangle to move outwards from the centerpoint.
is there already something premade like this?

thanks!

sentences:
How 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:
What is the best way to check lists of objects that collide I am making a top down shooter in XNA. I have a player, a list of enemies, a list of world objects like crates, trash cans, etc. and the map which has walls.  Is there a better way to check for collisions than,

for (all enemies)
  for (all world objects)
    check for collision between enemies and world objects
for (all players bullets)
  for (all enemies)
    check for collisions between players bullets and enemies
and so forth.

What I mean is, I have a few lists of a bunch of objects and they all need to be checked for collisions.  What is the most resourceful way to do this?
Thanks for your help in advance.

sentences: Updating the position of a prefab in Unity for A* pathfinding I am trying to use Aron Granberg A* pathfinding project in my game. I am very new to Unity, so I am having some trouble figuring out how to instantiate multiple enemies from a prefab that will seek out my player. I am unable to set the player object from the scene as the target, since prefabs cannot take in scene objects. However, if I use the player prefab as the target, the enemies will only go toward the starting position of the player. Is there any way to update the prefab position as the player instance moves? Or is there a better way of doing this? I want this to be a top-down shooter style game (2D) with constant enemy spawning, so it doesn't make sense to set the target for each individual enemy instance. Any help would be greatly appreciated. Thank you!

sentences: moving box2d bodies in an arc or curved path How can I make a b2Body move in a arc-like or curved path? I have heard about cocos2d Bezier curve function (ccBezier) but this is for moving cocos2d sprites. Or can it be modified to move box2d bodies? Any help is appreciated. Thank you.

sentences:
What behaviors should go into making a "non-perfect" AI combatant? When making an npc combatant, it's easy obvious what to do to get a robot deathmachine by optimizing combat tactics, timing and attack types, but harder (and more interesting in a fight) to get an idiosyncratic, inpredictable enemy.  What behaviors (algorithms?) are useful for creating a more organic, unconventional enemy?

Edit: My specific use case is with MMO-like enemies, e.g. World of Warcraft, although with less graphics involved.  Note that that means both human and inhuman enemies (animals, monsters, etc)

sentences:
Do you need resource manager for HTML5 games? Usually, resource manager is needed for desktop/mobile games. But is it needed for HTML5 (browser) games?

Resource manager's main responsibility is to make sure there is no clone of a resource in memory. But in browser, when you request something, the request is usually cached. So when you make another request to the same resource, the resource is not loaded anymore. You immediately get it. (CMIIW).

So, do you need resource manager for html5 browser games?

Thanks.

sentences:
Get distance between two objects from an ortographic point of view I want to be able to measure the distance from one object to another through the camera's orthographic projection.

As shown here, the objects are away from each other

When I move the camera, they "appear" to be closer together:

I want to be able to measure that blue line. How can I make this possible?

sentences:
Changing contents of level depending on which character was selected I'm trying to create a character selection menu in Unity, where each character has their own version of the level that follows.

There are about 10 characters. Each character has a different location where they spawn in the level, and each enemy has a different spawn position as well, depending on which character was selected.

What I have been doing is to create separate levels (scene files) for each character. Then in the character selection menu, I load the level depending on the level selected by the user.

This seems to be a lot of code and data repetition, as the scene is the same in all levels; it's just that the spawn positions and enemies are different.

Is there any way have only one level scene, and get the spawn position and enemy spawns based on the character?

This is the code I have so far in GameManager.cs:

public GameObject enemy;
public Transform enemySpawnPoint;

public GameObject player;
public Transform playerSpawnPoint;

public static GameManager instance;

private void Awake()
{
    if (instance == null)
    {
        instance = this;
    }
}

void Start()
{
    StartCoroutine("SpawnEnemies");
    SpawnPlayer();
}

IEnumerator SpawnEnemies()
{
    while (true)
    {
        yield return new WaitForSeconds(1.0f);
        SpawnEnemy();
    }
}

public void SpawnEnemy()
{
    Vector3 enemySpawnPos = enemySpawnPoint.position;

    Instantiate(enemy, enemySpawnPos, Quaternion.identity);

}

public void SpawnPlayer()
{
    Vector3 playerSpawnPos = playerSpawnPoint.position;

    Instantiate(player, playerSpawnPos, Quaternion.identity);

}

...and the character selection script:

public void Level1()
{
    SceneManager.LoadScene(1);
}

public void Level2()
{
    SceneManager.LoadScene(2);
}

// ...

public void Level10()
{
    SceneManager.LoadScene(10);
}

Now the issue is, if I want to make any changes in one scene, like the skybox or background color, I will have to open all the other level scenes and make the changes.

Another thing is that if I want to add new levels, I will have to do the same thing, which seems like a lot of repetition.

Is there some way to set the enemy prefab, enemy spawn positions, player prefab and player spawn position once the character has been selected?

For example, if the user clicks on level1, all the preceding variables are set automatically and so on.....

sentences:
Why does a translation matrix need extra row? Following recommendation of this answer I've recently read the series of articles of Wolfire about linear algebra. I'm somewhat familiar with matrices and I came to a conclusion that vector and a matrix multiplication is in fact multiplication of 2x2 and 2x1 matrices:

\begin{equation*}
\begin{bmatrix}
a & c \\
b & d
\end{bmatrix}
\qquad
\begin{bmatrix}
x \\
y
\end{bmatrix}
\end{equation*}

In the article the author reveals that to accomplish translation in addition to rotation we need to add a row and a column to the translation matrix:

  If we want to translate by a vector (e,f), we can just tack it onto our change-of-basis matrix like this:
  \begin{bmatrix}
a & c & e\\
b & d & f\\
0 & 0 & 1
\end{bmatrix}
  And then we add an extra 1 to the end of each position vector like this:
  \begin{bmatrix}
x\\
y\\
1
\end{bmatrix}

P.S. I edited the direction of the vector to make it comply with matrix multiplication conditions.

The 1 at the third row of the vector is totally understandable: to multiply 2x3 matrix we need a 3-row matrix.

What I didn't get here is why we need extra row for translation matrix? I can't see any difference in multiplication (except for the useless 1):

\begin{equation*}
\begin{bmatrix}
a & c & e\\
b & d & f\\
0 & 0 & 1
\end{bmatrix} *
\begin{bmatrix}
x\\
y\\
1
\end{bmatrix} = \begin{bmatrix}
ax + cy + e\\
bx + dy + f\\
0 + 0 + 1
\end{bmatrix}
\end{equation*}

\begin{equation*}
\begin{bmatrix}
a & c & e\\
b & d & f\\
\end{bmatrix} *
\begin{bmatrix}
x\\
y\\
1
\end{bmatrix} = \begin{bmatrix}
ax + cy + e\\
bx + dy + f\\
\end{bmatrix}
\end{equation*}

So the same question for 3D matrices, just it's easier to convey with a 2D case

sentences:
gluLookAt on OpenGLES2 gluLookAt is not available in OpenGLES 2.  OpenGLES 2 is also using floats not doubles.

Taking the description on the gluLookAt man-page, I have implemented it like this:

void graphics_t::set_mvp_look_at(const vec_t& eye,const vec_t& centre,const vec_t& up) {
#if !defined(GL2) && !defined(NDEBUG)
    matrix_t check;
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(pimpl->mvp.f);
    gluLookAt(eye.x,eye.y,eye.z,centre.x,centre.y,centre.z,up.x,up.y,up.z);
    glGetFloatv(GL_PROJECTION_MATRIX,check.f);
#endif
    const vec_t f((centre-eye).normalised()),
        s(f.cross(up.normalised())),
        u(s.cross(f));
    const matrix_t m = {{
        s.x, s.y, s.z, 0,
        u.x, u.y, u.z, 0,
        -f.x, -f.y, -f.z, 0,
        0, 0, 0, 1
    }};
    set_mvp_matrix(matrix_t::translation(-eye).transposition() * (m.transposition() * pimpl->mvp)); // setter notifies shader
#if !defined(GL2) && !defined(NDEBUG)
    if(pimpl->mvp != check)
        std::cout << "WARNING! Error setting look-up: " << std::endl << pimpl->mvp << std::endl << " != " << std::endl << check << std::endl;
#endif
}

As you can see I have some inline unit-testing when building for a non-OpenGLES 2 target (that's my own GL2 define).

Now the code seems to work, although it feels somehow slightly wrong depth but I can't put my fingers on that.

However, the code is printing warnings all the time, e.g.:

  WARNING! Error setting look-up:
  matrix_t<[4.79627,0,0.424102,-261.019],[0.243815,5.79255,-2.75737,51.5329],[0.158943,-0.862347,-1.79752,269.079],[0.0794715,-0.431174,-0.898762,350.119]>
  !=
  matrix_t<[5.31579,0,0.470039,-289.291],[0.270225,6.41998,-3.05604,57.1149],[0.158943,-0.862347,-1.79752,269.079],[0.0794715,-0.431174,-0.898762,350.119]>

As you can see, the numbers are very nearly the same but not-quite.

My comparision function for my matrix class is fuzzy with if(fabs(f[i]-rhs.f[i])>0.001) return false;.

Is this error within expected bounds when using float precision instead of doubles?  Or is there a bigger bug in my translation?

sentences:
how can i make a sprite from a spritesheet increase its size? I want to be able to increase the size of a sprite to give the illusion that it is walking towards you (or decrease in size to move away).
how do i manipulate the size of a loaded sprite off a sprite sheet (png format, if that matters)?

sentences:
Amazon IAP V1 not working on unity I've been following the tutorial for amazon iap v1 (because it seems a lot easier than amazon iap v2) but when I built the android app and went onto the shop screen the app just force closed. Here's all the code:
For CurrencyAmount.cs:

    using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;
    using System;
    using System.Collections.Generic;
    using AmazonCommon;

    public class CurrencyAmount : MonoBehaviour {

        public Text coinText;
        public Text diamondText;
        public int coins;
        public int gems;
        public string[] items;
        // Use this for initialization
        void Start(){
            AmazonIAP.initiateItemDataRequest(items);
        }
        void Update () {
            coins = PlayerPrefs.GetInt("CoinAmount");
            gems = PlayerPrefs.GetInt("DiamondAmount");
            coinText.text = coins.ToString ();
            diamondText.text = gems.ToString ();

        }
        void itemDataRequestFailedEvent()
        {
            // If you get this response, either retry or stop purchase attempt.
            Debug.Log( "itemDataRequestFailedEvent" );
        }
        void itemDataRequestFinishedEvent( List<string> unavailableSkus, List<AmazonItem> availableItems )
        {
            // Do not continue with the purchase attempt if the your SKU is in the list of unavailable SKUs!
            Debug.Log( "itemDataRequestFinishedEvent. unavailable skus: " + unavailableSkus.Count + ", avaiable items: " + availableItems.Count );
        }

        void purchaseFailedEvent( string reason )
        {
            // The reasons for failure on a Consumable are:
            // INVALID_SKU
            // FAILED
            // You should log the reason, but in every case, do not entitle content
            Debug.Log( "purchaseFailedEvent: " + reason );
        }
        //This is connected to the buttons
        public void BuyGems(string nameOfPackage){
            AmazonIAP.initiatePurchaseRequest( nameOfPackage );
        }

        void purchaseSuccessfulEvent( AmazonReceipt receipt, int GemsToBuy )
        {
            // On successful purchase, you may entitle content
            Debug.Log( "purchaseSuccessfulEvent: " + receipt );

            // You should preserve the token for use with
            // Receipt Verification
            string purchaseToken = receipt.token;
            gems = gems + GemsToBuy;
            PlayerPrefs.SetInt ("DiamondAmount", gems);
            PlayerPrefs.Save ();
        }

    }

here's the link for amazon sdk

sentences:
Deterministic Multiplayer RTS game questions? I am working on a cross-platform multiplayer RTS game where the different clients and a server(flash and C#), all need to stay deterministically synchronised.

To deal with Floatpoint inconsistencies, I've come across this method: http://joshblog.net/2007/01/30/flash-floating-point-number-errors/#comment-49912 which basically truncates off the nondeterministic part:

return Math.round(1000 * float) / 1000;

Howewer my concern is that every time there is a division, there is further chance of creating additional floatpoint errors, in essence making it worse?

.

So it occured to me, how about something like this:

function floatSafe(number:Number) : Number
{return Math.round(float* 1024) / 1024; }

ie dividing with only powers of 2 ? What do you think?

.

Ironically with the above method I got less accurate results:

trace(  floatSafe(3/5) ) // 0.599609375

where as with the other method(dividing with 1000), or just tracing the raw value I am getting 3/5 = 0.6

or Maybe thats what 3/5 actually is, IE 0.6 cannot really be represented with a floatpoint datatype, and would be more consistent across different platforms?

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:
How to Create a Game? I'm a newbie. I like to play games, but I'd also like to program them too. I know it's difficult to create a game, but please share the basic info I need to get started creating my first game. What do I need to study to become a game developer? What is
game AI? What is a Game Engine? What are the different types of game engine?

sentences:
Calculating up-vector to avoid gimbal lock using euler angles I wish to orbit a camera around a sphere, yet the problem is that when the camera rotates so that it is at the north pole (and pointing down) or the south pole (and pointing up) of the sphere the camera doesn't handle itself very well. It spins rapidly until arriving 180 degrees in the opposite direction. I believe this is known as gimbal lock.

I understand you can avoid this problem using quaternions. But I also read in another forum that it's possible to avoid this easily using euler angles as well. Which I would prefer to do. It was said that all you need to do is "calculate a proper up-vector every frame, and that avoids the problem entirely."

Well, I tried aligning the up-vector with the vertical axis of the camera whenever the camera changed orientation, but this didn't seem to work. Meaning that the up-vector followed exactly the orientation of the camera's y-axis (or it's up vector), instead of using a constant up-vector aligned to the up-vector of the world (0, 1, 0).

How exactly do I go about calculating a proper up-vector as my camera orientation changes to avoid the gimbal lock problem mentioned above?

sentences:
Prefab not working when I import maps form Tiled using Tiled2Unity I have correctly created the map using Tiled with no errors or warnings, then i imported the package from tiled2unity, imported the map then waited few seconds and the prefab from tiled2unity appears only after some minutes but not working.
the tiled to unity package imported

The error
the map

Basically i dont see the tiled map in unity after it's imported.

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:
Multiple ( V- / I- ) Buffers, is it sane? Currently I am developing an RTS game using XNA ( / ANX.Framework ).
There is one thing bothers me. I am not sure in what way or how to organise Buffers.
Should I use a new Vertexbuffer for any object ( e.g. a Char, a Table, an model ) or is it better to use ONE HUGE/ BIG Buffer to store any geometry in?

I am still new to 3D Programming though I finished yet couple games using DirectX 9.

Well, I hope this question qin't a duplicate and I appreciate any answer leading me into the right direction.

sentences:
How to convert a rotation around an axis into pitch and yaw rotation So i want to rotate particles towards a point and i've already figured out how to calculate the angle and the rotation axis.

Currently what i do is simply use a 3 dimensional matrix, apply the rotation and then extract the euleric angles from the matrix using joml.

Now using the result i have the problem that the particle is also using the z rotation, messing up the orientation of the particles texture. The easiest way to fix this would be to only use yaw and pitch, but how do i convert the roation to just a rotation around the x and y axis?

sentences:
What kind of hardware would be required to render an Earth sized minecraft like map? I have been thinking about this problem. Is it possible with current technology to create a 1:1 replica of the earth in voxel based game? What's the best data structure to store this giant map? Which algorithm should be used to render this data structure in real-time?

These questions make these assumptions:

Each voxel has a resolution of 1 cubic meter.
For simplicity sake,
each voxel requires only 1 byte of metadata information. This information
will be used to store the identify the "type" of the voxel (earth,
water, rock, etc).
The earth volume is 1 * 10ˆ21 cubic meters.
By "current technology" I include anything that is commercially available, but not super computers.
Only the Earth topography and bathymetry will be used to generate the map. Human building, plants or caves are excluded. The underground blocks will be chosen based on geological studies e.g.:  if depth is greater than 3000km render a 'magma' voxel.
Just like in Minecraft, the map is not static, it can be modified in-game.
A 'infinite' draw distance is a big plus, what's the point of having the whole earth in a map if you can't fly up and watch the whole planet?

The first conclusion that I came when I thought about this problem is that storing the Earth data in a linear way is infeasible, assuming that each voxel occupies only 1 byte of memory this would still require 1 zettabyte to store the map. So some kind of compression is required.

I think that a voxel octree could compress the map, but I am not sure by how much. The entropy of this voxel map is probably very low, so I guess that a very high level of compression can be achieved.

Disclaimer

This is a theoretical question, I have no intentions of writing a voxel earth

EDIT

The ESA GOCE has already mapped the Earth geoid with a 1cm-2cm precision. I believe that this information could be used to generate a very precise heightmap of the Earth. This would exclude the need to use an algorithm to fill gaps in the Earth topography.

sentences:
Export "Lite" and "Full" versions with different package names for Google Play Console On the Google Play Console, you can't have two games with the same package name.
Is there a way to have two of the same game with different package names, exported from the same Unity project? For example, a "lite version" with ads and a "full version" without ads.

sentences:
Fading in and fading out animations This is how I'm creating my player. Is there any way to start fading in and fading out for an amount of time when I get hit?

private Texture tex = Game.res.getTexture("player");

public Player(Body body) {
   TextureRegion[] sprites = new TextureRegion[1];
   sprites[0] = new TextureRegion(tex, 0, 0, 70, 96);
   sprites[1] = new TextureRegion(tex, 69, 193, 68, 93);
   animation.setFrames(sprites, 1 / 6f);
}

sentences:
Mode 7 in xna/monogame I want achieve a view like Mode 7 from snes games where the closer textures get stretched out more and more far away textures look smaller. Something like this:

What I have in my project at the moment is a flat 2d floor made from multiple textures aligned next to each other, but I'm not sure on how to add perspective to it. I'm using a matrix to transform the view, but when I tried using Matrix.CreatePerspective I only got an empty view. Is this effect possible to achieve using matrices? Or do I have to use the billboard effect on every texture that I'm drawing? And if so, how do I make it so that it's still possible to rotate the camera in every direction? I'm new to matrices and 3d in Monogame, so this is still confusing to me.

sentences:
Why when using editor script with handles with DrawSolidArc it's not drawing any arc over the object? This is the editor script is in the Assets/Editor
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(DrawSolidArc))]
public class DrawSolidArcEditor : Editor
{
    public float arrowSize = 1;

    void OnSceneGUI()
    {
        DrawSolidArc t = target as DrawSolidArc;

        Handles.color = Color.blue;
        Handles.Label(t.transform.position + Vector3.up * 2,
                             t.transform.position.ToString() + "\nShieldArea: " +
                             t.shieldArea.ToString());

        Handles.BeginGUI();
        GUILayout.BeginArea(new Rect(Screen.width - 100, Screen.height - 80, 90, 50));

        if (GUILayout.Button("Reset Area"))
            t.shieldArea = 5;

        GUILayout.EndArea();
        Handles.EndGUI();

        Handles.color = new Color(1, 1, 1, 0.2f);
        Handles.DrawSolidArc(t.transform.position, t.transform.up, -t.transform.right,
                                180, t.shieldArea);

        Handles.color = Color.white;
        t.shieldArea = Handles.ScaleValueHandle(t.shieldArea,
                        t.transform.position + t.transform.forward * t.shieldArea,
                        t.transform.rotation, 1, Handles.ConeHandleCap, 1);
    }
}

And the mono script for example this script is attached to a simple 3d cube :
using UnityEngine;

[ExecuteInEditMode]
public class DrawSolidArc : MonoBehaviour
{
    public float shieldArea = 5;
}

but there is nothing around the cube. not also near it nothing.
it should draw arch in the editor.
Later I want to be able to use the mouse with a click down and drag to be able to change the arc size but for not it's not drawing any arc.
I took the example from the unity official docs :
https://docs.unity3d.com/540/Documentation/ScriptReference/Handles.DrawSolidArc.html
I noticed now also for example that I don't see the gui button in the inspector of the object that the mono script is attached to :
if (GUILayout.Button("Reset Area"))

not sure what's wrong with the editor script.
This is working. I still wonder why the unity docs example didn't work but this is working and I don't need the editor script. The problem with this script is that I must to turn on the Gizmos in the editor and I don't want to make it turned on all the time. So it's working but not as I wanted.
I want to draw the arc without the gizmos.
using UnityEngine;

[ExecuteInEditMode]
public class DrawSolidArc : MonoBehaviour
{
    public Vector3 offset = Vector3.one;
    public float fieldOfViewAngle = 20;
    public float viewDistance = 4;
    public bool usePhysics2D = false;

    public void OnDrawGizmos()
    {
        DrawLineOfSight(this.transform, offset, fieldOfViewAngle, viewDistance, usePhysics2D);
    }
    public static void DrawLineOfSight(Transform transform, Vector3 positionOffset, float fieldOfViewAngle, float viewDistance, bool usePhysics2D)
    {
#if UNITY_EDITOR
        var oldColor = UnityEditor.Handles.color;
        var color = Color.yellow;
        color.a = 0.1f;
        UnityEditor.Handles.color = color;
        var halfFOV = fieldOfViewAngle * 0.5f;
        var beginDirection = Quaternion.AngleAxis(-halfFOV, (usePhysics2D ? Vector3.forward : Vector3.up)) * (usePhysics2D ? transform.up : transform.forward);
        UnityEditor.Handles.DrawSolidArc(transform.TransformPoint(positionOffset), (usePhysics2D ? transform.forward : transform.up), beginDirection, fieldOfViewAngle, viewDistance);
        UnityEditor.Handles.color = oldColor;
#endif
    }
}

sentences:
2D game level progression I'm creating a 2D game similar to Mario. What is a best practice to allow the character to move through the level given a limited screen size?

The way I have it now is the Player moves across the screen, and when they reach the far right edge, you reset them to the far left of the screen (basically teleport them back to the left side...). And if they're at the far left edge, keep resetting them to the far left side (to simulate a wall)

Check Player Bounds:

public void checkPlayerBounds (Player player) {
    if (player.getY() >= height-(playerHeight+25)) {
        player.reset("down");
    }
    else if (player.getY() < 0) {
        player.reset("up");
    }
    else if (player.getX() > width-(playerWidth)) {
        player.reset("right");
    }
    else if (player.getX() < 0) {
        player.reset("left");
    }

Reset:

public void reset(String val) {
    if (val.equals("down"))
        yLoc = gameboard.getHeight()-(height+30);
    if (val.equals("up") )
        yLoc = 0;
    if (val.equals("left"))
        xLoc = 0;
    if (val.equals("right"))
        xLoc = 0;
}

So I'm basically just either teleporting them when they get to the far right to simulate them (moving forward), at which point I would draw the applicable background and items (each time person reaches far right side, have a counter that is associated with the correct things to load on the screen)...

Or, should it be that the actual Player character doesn't move when you press right... it's actually the background items and map that moves (loads)?

If so, how would that look from a pseudocode/design perspective?

Thank you

sentences:
Playing animation on button press with a condition I want to do menu animation. In the animator, its contain 2 animations. One is opening animation, the other is closing animation. I set the opening animation as default state and added condition between of them. The condition contains one parameter, it is a bool type parameter. I drag the script which controls they behaviours on gameobject and animator component, but when the opening animation plays and player clicks the play button the parameter turns into true but it doesn't play.

 Animator canvasAnim;

 public Button lvlSelector;
 Button lvlSelector_A;

 // Use this for initialization
 void Start () {
     canvasAnim = GetComponent<Animator>();

     lvlSelector_A = lvlSelector.GetComponent<Button>();
     lvlSelector_A.onClick.AddListener(LevelSelector);

 }
 IEnumerator SlideLevelSelectMenu()
 {

     yield return new WaitForSeconds(1f);
     SceneManager.LoadScene("LevelSelectMenu");
 }

 void LevelSelector()
 {
     canvasAnim.SetBool("clickedclose", true);
     StartCoroutine(SlideLevelSelectMenu());
 }

sentences:
Is caching tiles like this a good idea? I have a 2d int array which represents tiles on level like this:

0000000000000000000000
0000000000000000000000
0000000000000000000000
1111111111111111111111

I have a tileset vector, where each element has it's own tileX and tileY value(position of a tile in a tileset image), collision data etc. So, when I draw a level each time I draw a tile, I ask about them like this:

draw(tileset[currentTile]->tx, tileset[currentTile]->tY, tileWidth, tileHeight);

But, as you can see, there will be lots of the same elements when I iterate through for loop, so do I need to keep lastCollisionData variable in level class to reduce time used to access each tile separately?

sentences:
To what extent it is legal to declare support of third party commercial products' assets? Is it legal to say that MyGame supports other (specific) games' textures, sounds and models?

I'd like to get involved into an open source game project and implement support for Quake's weapon models (for example), but the owners of the project don't know about the legal aspect of it, so I'm asking here.

sentences:
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:
How do we generate overhangs with simplex noise 3d? Now I use a simplex noise 2d function with x( voxel's x location ) and y(voxel's y location) to generate heightmap. How do we use simplex noise 3d to generate overhangs? What should the x y z inputs be?
Pseudo code would help a lot.

sentences:
Most efficient way to detect and act upon collision (Specific for my 2d game) Currently, mainly just for fun, I'm working on a 2d game where I have all collide-able blocks (background) assorted into an array when its loading, along with the player put into a different part of the 3d array. The player object gets put in with the AI array. It looks like this -->

    var world_objects = [
  [], //All 'background' collide-able objects. Such as stones and the border ~~ Code name: bg
  [], //All AI ~~ code name: ai
  []  //Projectiles ~~ Code name: ps
];

The map is set up into a bitmap that I've made using another 3d array, that currently is made into a 15x15, but that is subject to change. The brown border is included in the bitmap and world_objects array. And when the blocks/ai/projectiles are inserted, they all will have a basic object properties of:

x, y(2 variations, one with just normal x,y according to the exact pixel in the canvas, and the other is according to which cell its in for the bitmap)

Width, height (Both width and height for ai and projectiles are recorded as percentages according to the size of each cell, because the size is made to change depending on screen size)

Along with other properties not related to collision. What would be the most efficient way of detecting all objects and whether they collide or not? If needed, I could add additional properties to each object if that would make it easier and more efficient.

Click to see all of the code

sentences:
since unity upgrade, OnSceneLoaded not getting called on scene start I upgraded my unity project to 2018.3.11f.  Since that upgrade, the OnSceneLoaded event is not getting called, even though I am registering the event handler.

Here's the class:

public class SceneSwitcher : MonoBehaviour
{
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        print("scene loaded: " + scene.name);
    }

    void Start()
    {
        print("SceneSwitcher.Start() called");
        print("adding event handler to SceneManager");
        SceneManager.sceneLoaded += OnSceneLoaded;
    }
}

here's the console output:

SceneSwitcher.Start() called
UnityEngine.MonoBehaviour:print(Object)
SceneSwitcher:Start() (at Assets/Scripts/SceneSwitcher.cs:45)
adding event handler to SceneManager
UnityEngine.MonoBehaviour:print(Object)
SceneSwitcher:Start() (at Assets/Scripts/SceneSwitcher.cs:46)

scene loaded: 3 is never in the console output.

I see others have had this problem, with no answers.

This code worked before the upgrade.  Now I am stuck.  Not sure what I can do.  Any help is appreciated.

Thnx

sentences:
Genetic Algorithms - Fitness Function simple maze game Trying to lay out the best fitness function for my simple game. I'm just trying to make bots go through a bunch of obstacles in order to reach a point. If they touch an obstacle, they die, they have 10 seconds max to solve the parkour.

I'm wondering which data I should track to make the best fitness function possible.

I thought of tracking:

Time

Distance to exit from position of death or timeout

And my Fitness score would be:

Fitness = Time / (Distance + 1)

But if a bot manages to get to the end of the maze in 10s, I'm scared the following generations will all take 10s or close to it to go through the maze and not try to do it in 3 or 4s for instance.
Because he'll get the best fitness score, so he'll be the parent of most cross-overs.

Yet I didn't manage to get a working example so perhaps I'm worrying for nothing but I'd like some advice on generally how to determine such fitness functions.

sentences:
Controlling Constantly Running AIs So, I'm not really sure where to start with this question. Feel free to tell me I'm stupid and Off Topic but I'd also like you to tell me why.

So, the maps in the game I am designing will consist of lots and lots and lots of voxels. Most of the voxels will just sit there and some of them will have methods run when they are touched or something happens around them. However, some blocks will constantly being doing something. Now, I'm not sure if I should have a array in every chunk (Group of voxels) that contains all the 'active' blocks or if there is another way. I know that some voxels will run code when they are loaded that makeup for all the time that they hadn't been doing anything but I may need to constantly run some voxels. (Machine that overheats or powers something can't just be loaded in 20 minutes after it blew up; or can it?)

So, now that that basic background is over, here is my question: Will an array storing all active entities in an area suffice as a way to run all the frame by frame methods of the blocks? Or is there a "normal" way to do this that I am unaware of?

EDIT: I just realized that the client that does rendering will not do a majority of the operations for the game engine. I will have a server that does it. The answer to this question is still largely relevant and helpful though. I just thought I'd mention my change.

sentences:
Animation inside GUI Good day.
I would like to create a "rich" GUI for my game.

How can i add a 3d model to a GUI Button (with continous rotation ) ?
If I can't add a 3d model to a GUI button, what is the best way to visualize a 3d model rotating ?

Maybe creating a video file or animated gif and adding it to my button ?

Thanks

sentences:
Fixed texture size (Pixel) libgdx, java If I resize the window (e.g. fullscreen) the texture size also changes!

I want that behaviour: If I change to fullscreen you will see more of the game world. The size (Pixel) of the texture stay the same. Not a scaling.

Thanks.

Regards,
Matthias

sentences:
How can I prevent players from reading a puzzle solution out of the game's code? I'm sure you know of the part in Five Nights at Freddy's 3 where you input the reverse of the hex code for purple into a wall and something happens (I forget what).
I want to implement something similar in a game I'm making, but I'm worried about people looking at the code for the game or hacking into it to figure out what to do.
I wonder whether fnaf somehow prevented people from just decompiling the code and seeing what code to enter. How could I do something similar?

sentences:
MMORPG game balancing I've seen a couple of examples of some game balancing techniques in books yet they are not comprehensive and not particularly aimed at MMORPGs but I'm looking for practical examples of game balancing techniques for MMORPGs. I am interested to know if anyone has documented the techniques used in popular games with proven success in this area. Ideally, any resource would cover most common types of stats and include layman mathematical models or techniques used to balance game mechanics found in advanced MMORPGs (I know it's a cliché, but WoW style)

Any help would be great!

sentences:
How to devise an algorithm for a person being on a walk? The game is an isometric RPG. The map is tile based.

I'm creating a town for this game. And I want one of the characters to roam the town randomly, because she is on a walk with her children.

I tagged the tiles she can go on. And I created a simplistic algorithm that I, in my naiveness, thought would be enough. Here it is:

If the character is blocked out and can't move in any direction she waits 1s before checking this again. If she can move in only one of the 4 directions, she moves that direction. If there is more than one possibility: If she can go forward, she always has 50% chance of going forward; if she can go both to her left and to her right there is an equal chance she chooses either of those two directions; and finally, if she can turn back, that chance is 2x smaller than turning to her left and 2x smaller than turning to her right. So, if she can choose from all 4 directions, she will have 50% chance to go forward, 20% chance to go to her left, 20% chance to go to her right, and 10% chance to go back. Repeat the above every step.

This algorithm fails beautifully. The character mostly moves randomly in one place. If she gets on a square she almost can't leave it.

I thought the solution would be to increase the chance of her moving forward. So I made the chance to go forward 5 times bigger than doing anything else. But this proved to hardly improve things.

COuld you give me some hints, point me to the correct direction? Or at least tell me that this is not worth it and I should instead resort to giving her a predefined path? (Are there no algorithms to make a character roam a given set of walkable tiles?)

sentences:
javascript game character mouse movement When a mouse button is pressed, coordinates are stored and character begins to move towards that point.

I do a check each frame if my character reached the destination, but because of the nature of how it all works, it can never be perfectly accurate. When I normalize my vector and multiply it by speed, I will always end up around that point but never directly at it. The bigger the speed, the more distance is passed in one frame and the further I get from where I wanted to be.

let startX = 110;
let startY = 110;
let endX  = 400;
let endY = 200;
let speed = 5;

let dx = endX - startX;
let dy = endY - startY;

let length = Math.sqrt(dx*dx+dy*dy);

dx /= length;
dy /= length;

dx *= speed;
dy *= speed;

So this gives me a dx:4.775320684056187 and dy:1.4819960743622644, so that is the value that is added each frame, so in the end it gets to coords 399:191 next one is 404:193 etc. I have to pick a close one, or force object to move to the one I wanted, it never reaches exactly 400:200.

It becomes a problem when path finding and collision comes to play, because I can get 2 pixels on an obstacle etc.

How is this solved? What am I doing wrong?

sentences: Unity Erase Image from mouse pointer I want to erase the image for mouse pointer in unity. My pointer should be as a eraser. What is I do create the eraser? My sprite is always change because it provide from the server. Please help me.

sentences:
How can I calculate the angle and proper turn direction between two 2D vectors? I am working on some movement AI where there are no obstacles and movement is restricted to the XY plane. I am calculating two vectors, v, the facing direction of ship 1, and w, the vector pointing from the position of ship 1 to ship 2.

I am then calculating the angle between these two vectors using the formula

arccos((v · w) / (|v| · |w|))

The problem I'm having is that arccos only returns values between 0° and 180°.  This makes it impossible to determine whether I should turn left or right to face the other ship.

Is there a better way to do this?

sentences:
Infinite terrain shadows I'm creating an infinite terrain engine, which generates the terrain either with fractals or noise. How can I make dynamic shadows for the sun on this terrain, if I don't know in advance what will be rendered in front of the sun.

My terrain:
The sun is the only light, it is directional, my terrain is generated on a plane which is positioned before the camera, frustum culled and fits the size of the viewing frustum.
It is height mapped with generated noise texture, and using tessellation shaders on it.

Video:http://www.youtube.com/watch?v=tk6yFwYusOs
Dynamic shadows with the infinite terrain.

sentences:
How to deal with corner collisions in 2D? I'm writing a top down 2d XNA game. Since its my first I'm trying to write the physics and collision stuff myself to learn it.

Whenever my player sprite character attempts to move into a position where its bounds intersect with the edge of a wall, I figure out a bounce angle (angle of incidence = angle of reflection) and I make the player bounce off the wall and avoid the collision.

I'm having trouble figuring out how to deal with the situation of my sprite intersecting with two wall edges simultaneously though e.g. it hits a corner.

My code currently tells me that two wall edges have been intersected but not which edge it would have hit first and therefore which edge to bounce off.

What is the mathematical test to pick which edge to bounce off? It's plain to see when looking at it but I'm struggling to figure out the math test for it.

sentences:
Rotating a gameobject in the Inspector doesn't change direction When I add a Cube to a scene, the blue axis (=forward) of the cube points into a certain direction.

When I now change the Y rotation of the cube to 90 in the inspector, the blue arrow doesn't rotate.

I would have expected it to rotate with the rotation that I have defined for the cube.

What is happening here?

To explain more in detail why this is bothering / confusing me:

I want to rebuild the RE4 inventory (which is actual 3D). The items in this inventory can be moved within the "grid":

To do that I have created a suitcase and then I added a gun to it:

As one can see, I have assigned the facing direction properly: The blue axis (=forward) points into the direction of the gun.

Now I wanted to rotate the gun in such a way that it is shown like in the original RE4 inventory.

To do that, I apply a rotation of Y = -90.

The gun looks correctly now:

However, the blue axis now faces the wrong direction in my opinion. Why does it not rotate along with the rotation of the gameobject?

This really confuses me because now when I want to move the gun left or right, I have to change its X position value instead of changing the Z position value.

This just seems wrong to me.

Can somebody tell me what I'm missing here?

Thank you.

sentences:
How do I draw a rectangle in Pygame? I am getting the error "AttributeError: 'Rect' object has no attribute 'draw'" with this code:

import pygame
import sys

def terminate():
    pygame.quit()
    sys.exit()

pygame.init()

black = (0,0,0)
white = (255,255,255)

clock = pygame.time.Clock()
fps=30

screen_height = 520
screen_width = 650
screen = pygame.display.set_mode((screen_width,screen_height))

class Rect(pygame.sprite.Sprite):
    def __init__(self,width,height,color,value):
        super().__init__()
        self.image = pygame.Surface([width, height])
        self.image.fill(color)
        self.rect = self.image.get_rect()
        self.value = value
    def change_value(self,color,value):
        self.image.fill(color)
        self.value=value

rects = pygame.sprite.Group()

rect = Rect(100,100,black,1)
rects.add(rect)

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            terminate()

    screen.fill(white)
    rect.draw(screen)

    pygame.display.flip()

    clock.tick(fps)

Why is this?  How do I render a rectangle?

I am trying to render and save 8 rectangles which are clickable to turn them on or off. I am trying to render the rects as objects to later use their collision for mouse clicks.

sentences:
OpenGL geometry shader 2d rectangle extrusion has weird angles I have a geometry shader that extrudes lines to rectangles in 2d (by outputting triangle strips). When the lines are not parallel to the X or Y axis, I'm getting parallelograms instead. Also, when the line is parallel to the X axis, it appears thinner.

Here's what my result looks like, drawing 4 lines at different angles:

Here's the geometry shader:

#version 150 core

layout(lines) in;
layout(triangle_strip, max_vertices = 4) out;
in vec3 Color[];
smooth out vec3 FColor;

void main() {
  vec3 g1 = gl_in[0].gl_Position.xyz;
  vec3 g2 = gl_in[1].gl_Position.xyz;
  vec3 v1 = normalize(g1 - g2) * 0.1;
  vec3 v2 = normalize(g2 - g1) * 0.1;

  FColor = Color[0];
  gl_Position = vec4(-v2.y + g1.x, v2.x + g1.y, 0.0, 1.0);
  EmitVertex();

  FColor = Color[0];
  gl_Position = vec4(v1.y + g2.x, -v1.x + g2.y, 0.0, 1.0);
  EmitVertex();

  FColor = Color[0];
  gl_Position = vec4(v2.y + g1.x, -v2.x + g1.y, 0.0, 1.0);
  EmitVertex();

  FColor = Color[0];
  gl_Position = vec4(-v1.y + g2.x, v1.x + g2.y, 0.0, 1.0);
  EmitVertex();

  EndPrimitive();
}

To test out the calculation, I ran the same set of vertices through the same calculation in GLM, took the results times 10.0 and plotted them using a web tool. Here's what I got:

So it looks to me like the basic calculation is correct. Can anyone help me understand what I'm doing wrong?

sentences:
creating a UI menu in c++ Im currently working on a 2D Game where the users can interact with specific nodes and are able to edit certain bits of information and I also plan for the users to be able to click buttons to set specific information.

My problem is that I do not know how to write code to create a side menu/UI system where information can be passed to it and displayed and also be edited by the system.

If anyone has any tutorials or material that they would be able to point me towards that they think would be helpful with this would be very appreciated as I do not know where to begin with this. Note that at the moment I am willing to swap from DirectX to OpenGL if that would be easier though I would prefer to stick to DirectX if possible

Thanks

sentences:
How to instantiate new GameObject at position of old GameObject onAnimationComplete I have a GameObject that is a Farmer that plants Seeds. The Seeds will animate into Plants. Once that animation is complete, I'd like to replace my Seed with a Plant. This happens hundreds of times per game at arbitrary positions. I've tried this as something I built off of this question: Unity: detect animation's end

public class SeedScript : StateMachineBehaviour {
[SerializeField] private GameObject seed;
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    Destroy(this);
    animator.GetComponent<TreeScript>().GrowTree(seed);
    Instantiate (tree, this.position,  this.rotation);
}

}

Obviously, this doesn't work at all. Doesn't even compile.

I've also looked at these co-routines: https://answers.unity.com/questions/981948/statemachinebehaviour-startcoroutine.html but again, I need to get position data from the animating object.

Yes, I could just merge my Seed and Plant classes together, let's pretend I cannot do that and MUST instantiate some arbitrary new object at the position of another object on some animation completion.

sentences: Changing Yaw, Pitch And Roll OpenGL I'm using LWJGL and OpenGL 1.1 at this time and I was wondering what command is used to change the yaw, pitch and roll?

sentences:
Constantly interpolated splines Trying to implement a movement through a curve - I'm trying to find a type of curve/spline that interpolates constantly. What I mean: when I interpolate from t=0 to t=0.1, I want it be the same distance as when interpolating from t=0.1 to t=0.2. And I want it to happen for every delta t on the spline.

I dont' want to make lookup tables that map the interpolated values to distances in order to save the memory. Does anybod knows are there any kind of such mathematical constructs?

I could do a in depth research, but as far as I can, I dont wan go to deep into details. It would be great having some simple formula.

sentences: How can I prevent the knob from resizing when I use the Slider? I am using the Unity Slider component.  I have a custom background and custom knob.  But whenever I move the slider, my knob's size becomes distorted.  It is 100x100 pixels, and when I set it to its native size, it does so.  But I soon as I move the slider, it cuts its height in half.  How can I prevent this from happening?

sentences:
iOS build size is too large in Unity I have finally completed my game and ready to upload my game to the App store, but my build size is too large.

I have checked log statement and it is roughly 13.3 mb but when i build my game and test on iOS device it is 80.0 mb.

Also

Scripting Backend is 'Mono2x'

Stripping Level is 'use micro mscorlib'

Script Call Optimisation is 'Fast but no Exception'

My Game size must be around 15 to 20 mb why it is too large?

What i am missing?

sentences: Sounds to describe the weather? I'm trying to think of sounds that will help convey the time of day and weather condition. I'm not even sure of all the weather conditions I would consider, and some are obvious. Like if it's raining, the sound of rain. But then I'm thinking, what about for a calm day? If it's morning time, I could do birds chirping or something. Night time could be an owl or something. What are some good combinations of sounds/weather/time to have a good effect?

sentences:
Phaser Game not rendering on normal page I made a game with the Phaser game framework on a course, and now I want to add features and build upon that game.  The only problem is that I built the game with the course on webpack, which served the game on localhost:8080  I want to now stop using localhost and put the game on a normal website, but for that, I need to get it off localhost.  I think the problem is in the index.html file where I render the game.  Here is the index.html code:
<head>
 <style>
  body {
    padding: 200px;
  }
 </style>
 <script type="text/javascript
  src="https://cdnjs.cloudflare.com/ajax/libs/phaser/3.52.0/phaser.min.js"></script>

</head>
...
<script type="text/javascript" src="src/index.js"></script>

Please tell me how I can put my game on a normal website.  Thank You!

sentences:
What is a right datatype in C++ for OpenGL scene representation with use of GLSL I am programming in C++ OpenGl with GLSL. Until now I have been using a data structure that is composed of std::vector filled with structures of vertexes and with their parameters (position , normal, color ...) as a global variable for all the code.
My question is, as I am using VBOs for drawing - is this a good approach to this problem?

I am asking because I happen to have a lot of memory related trouble with this structure.  I am trying to generate a terrain with a lot of vertices - more than 1 million. This seems to work, but as I refill the buffer I get memory related issues (crushes that occur, more or less randomly).

So again the question is, is this a good data structure to use / and look for the faults in my code, or should I change to something else? Or what data structure would be advisable?

sentences:
XNA help - too much memory used? I'm writing code in XNA 4.0, and part of my game entails drawing a textured grid of cubes. It is working, but the problem is the memory usage is growing way too rapidly. Each cube has 8 points, and each point is a VertexPositionTexture. A 16x9 grid takes 50MB memory, and that is just the grid and lines, no textures or anything else. Doubling the grid to 32x18 makes the memory jump to 150MB....I don't understand what is taking up so much room. I draw the grid using DrawUserIndexedPrimitives. The cubes can move around and be different sizes so I can't consolidate them to one set of vertices. What is the proper way to render a few thousand vertices without using so much memory?

These are all the members for my Cube class so far:

GraphicsDevice graphicsDevice; // for drawing this cube
Tileset tileset; // reference to parent object
VertexPositionTexture[] pointList; // the list of 8 vertices
BasicEffect basicEffect; // effect to draw using a shader
Vector3 localTranslation; // just 3 floats
VertexBuffer vertexBuffer; // for sending the vertices to the GPU

There are also a few functions that allocate memory for the pointList...but nothing out of the ordinary...

sentences:
How to show the bow string stretching animation (?) I was wondering how the animation in the angry birds of pulling the slingshot is done. One similar animation is available in this game but with a bow and arrow. I think both of them use the almost similar technique for it.

I tried to search for this on Google and all I got was the trajectory related stuff like calculating the trajectory of object once it is thrown. I could not find anything related to how the animation (?) for stretching the slingshot/bow string with respect to the force applied by user the bow string is achieved.

Can anybody point me in right direction in how to achieve that effect. Tutorials are welcome!

sentences:
Tools for creating 2d tile based maps What are some tools I can use to create 2d tile based maps?

Please provide the information below, and try to limit to one tool per answer.

Name
Link to website
General features
Export format
Anything else you deem noteworthy

sentences:
Rendering Textured Terrain With SharpDX Toolkit So i recently moved from XNA to SharpDX Toolkit and started with some basics. The 2d part was easy since nearly nothing has changed but im really struggeling with the 3d part. For example i wanted to render a heightmap based on riemers terrain tutorial however came along the following issue:

I have a little map (or terrain) class that contains the index and vertex arrays as buffer like so:

private SharpDX.Toolkit.Graphics.Buffer<VertexPositionNormalTexture> _mesh;
private SharpDX.Toolkit.Graphics.Buffer _indexBuffer;
private readonly static VertexInputLayout InputLayout = VertexInputLayout.New<VertexPositionNormalTexture>(0); // copied from the basic geometry

this get filled in propertly and render fine with VertexPositionColor.
rendered the common XNA way:

//set effect parameters and resources
foreach (EffectPass pass in _effect.CurrentTechnique.Passes) {
    pass.Apply();

    //Globals.DefaultGraphicsDevice.SetRasterizerState(CullNone);

    Globals.DefaultGraphicsDevice.SetVertexBuffer(0, _mesh);

    // Setup the Vertex Buffer Input layout
    Globals.DefaultGraphicsDevice.SetVertexInputLayout(InputLayout);

    // Setup the index Buffer
    Globals.DefaultGraphicsDevice.SetIndexBuffer(_indexBuffer, true);

    // Finally Draw this mesh
    Globals.DefaultGraphicsDevice.DrawIndexed(PrimitiveType.TriangleList, _indexBuffer.ElementCount);
}

Now with my own half converted half remade shader i get

a) a black terrain or

b) HRESULT: [0x80070057] (wrong parameter)

and i cant figure out why (most likely since i never done much with 3d shaders)

the shader:

struct VertexShaderInput {
    float4 Position     : SV_Position;
    float3 Normal       : NORMAL;
    float2 TextureCoords: TEXCOORD0;
};

struct VertexShaderOutput {
    float4 Position     : SV_Position;
    //float4 VPosition      : SV_Position; //im not used to SV_Position and SV_Target so this could be the main problem
    float LightingFactor: TEXCOORD0;
    float2 TextureCoords: TEXCOORD1;
};

struct PixelShaderOutput {
    float4 Color        : SV_Target;
};

//------- Constants --------
float4x4 xView;
float4x4 xProjection;
float4x4 xWorld;
float3 xLightDirection;
float xAmbient;

Texture2D xTexture;
sampler TextureSampler = sampler_state {
    texture = <xTexture>;
    magfilter = LINEAR;
    minfilter = LINEAR;
    mipfilter = LINEAR;
    AddressU = mirror;
    AddressV = mirror;
};

VertexShaderOutput TexturedVS(VertexShaderInput VSin) {
    VertexShaderOutput Output = (VertexShaderOutput)0;
    float4x4 preViewProjection = mul(xView, xProjection);
    float4x4 preWorldViewProjection = mul(xWorld, preViewProjection);

    Output.Position = mul(VSin.Position, preWorldViewProjection);
    Output.TextureCoords = VSin.TextureCoords;

    float3 Normal = normalize(mul(normalize(VSin.Normal), xWorld));
    Output.LightingFactor = dot(Normal, -xLightDirection);

    return Output;
}

PixelShaderOutput TexturedPS(VertexShaderOutput PSIn) {
    PixelShaderOutput Output = (PixelShaderOutput)0;

    Output.Color = xTexture.Sample(TextureSampler, PSIn.TextureCoords);
    Output.Color.rgb *= saturate(PSIn.LightingFactor) + xAmbient;

    return Output;
}

technique Textured {
    pass p0 {
        Profile = 9.1;
        AlphaBlendEnable = false;
        CullMode = None;
        PixelShader = TexturedPS;
        VertexShader = TexturedVS;
    }
}

im thankfull for any help

(Disclaimer: i moved this from stackoverflow to here since i think it was missplaced and didn't got any attention)

sentences:
Fire an event while the mouse is down within my box 2d collider in Unity The method OnMouseDown() is called once when the mouse presses my box 2d collider.

Is there a method that keeps firing while the mouse is still holding the button down inside the collider? Something like WhileMouseDown().

I could use Input.GetMouseButton(0) in the Update() method. However, this does not check if the mouse is pressing the collider.

sentences:
Unity custom shaders and z-fighting I've just readed a chapter of Unity iOS Essential by Robert Wiebe.

It shows a solution for handling z-figthing problem occuring while rendering a street on a plane with the same y offset.

Basically it modified Normal-Diffuse shader provided by Unity, specifing the (texture?) offset in -1, -1.

Here's basically what the shader looks like:

Shader "Custom/ModifiedNormalDiffuse" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {
        Offset -1,-1   //THIS IS THE ADDED LINE
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _MainTex;
        fixed4 _Color;

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D (_MainTex, IN.uv_MainTex) *_Color;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Ok. That's simple and it works.
The author says about it:

  ...we could use a copy of the shader that draw the road at an Offset
  of -1, -1 so that whenever the two textures are drawn, the road is
  always drawn last.

I don't know CG nor GLSL, but I've a little bit of experience with HLSL. Anyway I can't figure out what exactly is going on.

Could anyone explain me what exactly Offset directly does, and how is solves z-fighting problems?

sentences:
Character Controller + Lag = Massive Teleportation Through Walls I'm working on a fairly robust game with another developer and we've been having a really serious issue with (I believe) the character controller. Specifically, if there's ever a large lag spike (as there are somewhat frequently - the code's not well optimized in some parts) there's a chance that the character controller will wing right through all nearby colliders and fall out of bounds.

It happens pseudo randomly, but I've noticed that it seems to be somewhat predictable, such as standing next to certain objects (nothing weird about them - just tables with colliders).

The lag often is a cause of large chunks of a level having SetActive(true) called on them in one frame or multiple objects being instantiated in one frame. These objects sometimes have colliders/rigidbodies attached but don't seem to be in any direct contact to the character controller.

I can very consistently make it happen by moving towards certain walls (again, very normal walls) and alt-tabbing while my character is still moving also seems to cause the issue predictably, which is VERY strange.

Has anyone ever experienced anything like this with the character controller? I'd give a code sample but honestly not even sure where from the codebase would be pertinent other than

if (Time.deltaTime < 0.15f)
{
    if (applyGravity && noClip == false)
        moveDirection.y -= gravity * Time.deltaTime;

    controller.Move(moveDirection * Time.deltaTime);
}

Which seems awfully straightforward to me. Obviously moveDirection gets changed elsewhere in the function too but it's all similarly bland. I'm pretty experienced with this sorta' stuff and it doesn't ring wrong to me at all.

Some other stuff.

Checked that moveDirection isn't a huge number

Tried eliminating Time.deltaTime from the equation

Fairly sure colliders aren't ending up inside of the player while a lag spike happens (again, alt-tabbing will do it too)

Geometry surrounding the player is clean (box colliders, mesh colliders on well-developed meshes)

Nothing strange like rapidly setting any components on or off is happening to my knowledge.

Anyone have any experience with this sort of issue?

sentences:
Unity3D and Photon Networking RPG Good time of the day.
My question might sound stupid, due to the knowledge you might have, but here it is.

I've purchased Diablo 3 a long time ago and been enjoying it since then. Since many of my friend are playing other Blizzard titles, i tried to convince them to purchase Diablo and to play all together. However, they don't want to invest money in the game they don't understand (yet).

So i've decided to write a game, which will be similar to the Diablo in the way of interaction and gameplay, but will (obviously) have some unique points in it (since i'm not only doing this for them, but also to educate myself in the game development area). Other this is, i've decided to take Masters in the Game Development (later this march, just got my bachelors in computer security) and wanted to have some basic knowledge about game development.

I used to make "RPG" games before, tho only browser style ones using LAMP stack, and have some basic knowledge on storing/retrieving data to/from server.

In order to implement multiplayer part of the game, i've decided to use free package PUN (Photon Unity Networking). Had no problem with creating my first room and spawning a player prefab for every new connection (tho they all move no matter on which client action is performed).

Now to the question(s):

By using PUN, i'm able to create new room for players (limited to 5), is it possible to set room names BEFORE they are actually initialized by the player? (set of rooms might be stored on MySQL server and retrieved by the API call)
Is it possible to save progression of the player on the server, and later pass it back to the spawned player (by PUN). This is my main concern, since i've no actual access to the data processed by the server. (Solution is to create another connection to the "storage" server, and keep both of them "online"?)
Does PUN allows you to select which scene should be loaded upon first player entering the room, if so, a bit of pseudo code might be helpful.
What will happen to the player, if there is no spots left to join the server (this is just theoretical question, since i'm not going to publish this game, and amount of friends playing games is less than 20)
How would one deal with the item equipped, which is received during the gameplay? (This one links to the second question) What i'm talking about is, is it possible to restore player object with the set of data received form the server (if possible, ofcourse)

I know, the first suggestion will be to go and to read documentation (i'm in the process of reading it, don't worry). But i've decided to write here, since there are many skilled people out there in this area, who can give me basic understanding on how this whole PUN system works.

I would like to thank you for all of the responses, which you are about to post (or maybe not), and again, have a great day.

sentences:
Libgdx Do a fixed rotation for orthographic camera I'm trying to rotate my OrthographicCamera in the render loop to a fixed angle, but I can only make the camera spin. This is the code that I have:

in create():

OrthographicCamera camera = new OrthographicCamera();
camera.setToOrtho(true, 100, 100);
camera.position.set(50, 50, 0);
camera.update();

in the render loop:

camera.rotate(30);
camera.update();

The camera keeps spinning each frame. But I'd like the camera to stay at 30 degrees.

I have already seen this answer:

https://stackoverflow.com/questions/16509244/set-camera-rotation-in-libgdx

But I don't like it because this code is too drastic.
I wonder if there is a more "common" way to do this.

sentences:
Setting adaptive icon for Android from script(C#) Want to set adaptive icon for Android from script. I am using Unity example: https://docs.unity3d.com/ScriptReference/PlayerSettings.SetPlatformIcons.html
so, what am I doing:

     void Start()
    {
        Texture2D[][] jaggedArray =
         {
             new Texture2D[] { (Texture2D)AssetDatabase.LoadAssetAtPath(pathToTexture, typeof(Texture2D))},
             new Texture2D[] { (Texture2D)AssetDatabase.LoadAssetAtPath(pathToTexture, typeof(Texture2D))}
         };

        SetIcons(jaggedArray);
    }

void SetIcons(Texture2D[][] textures)
{
    var platform = BuildTargetGroup.Android;
    var kind = UnityEditor.Android.AndroidPlatformIconKind.Adaptive;

    var icons = PlayerSettings.GetPlatformIcons(platform, kind);

    //Assign textures to each available icon slot.
    for (var i = 0; i < icons.Length; i++)
    {
         icons[i].SetTextures(textures[i]);
    }
    PlayerSettings.SetPlatformIcons(platform, kind, icons);
}

What am I doing wrong, coz I am getting InvalidOperationException?

sentences:
What's the fastest way to copy a texture to another texture in OpenGL? Here's the options I've found:

glBlitFramebuffer: Create framebuffers for the textures, bind textures as GL_READ_FRAMEBUFER and GL_DRAW_FRAMEBUFFER, call glBlitFramebuffer().
glCopyTexImage2D: My research so far says this method is probably slow.
Shaders: Make a framebuffer and render target, render the source texture to the dest texture.

sentences:
How do I export an XNA crossplateform project to Nintendo 3ds or Nintendo Switch? I would like to document my self a bit about 3ds and switch game creation. I know that modern game engine have builtin tools to export games to these platforms, but I could not find - in google research - an article or a website talking about this. Any time I searched "Xna Export to nintendo 3ds" I ended up with "getting 3ds max files into an XNA game" stuff.
I'll be highly grateful to anyone that could help me find a way to export my games to these,

sentences:
Why is my Direct3D 9 floating point texture clamping values 0–1? I'm using Direct3D 9 to draw some primitives into a texture. The format used at texture creation is D3DFMT_A16B16G16R16F, and the primitives are drawn using additive blending. The additive blending works as expected provided the result is <= 1. If it is greater than 1 then it seems to be clamped to 1.

This question includes a comment stating that COLOR0 output semantics for a pixel shader automatically clamp the output values. I can't ask for elaboration there due to low SE rep. Is there anything else that I need to do on top of changing the texture format that I pass in to CreateTexture, in order to use the full range of 16-bit floats? Given that I can otherwise draw primitives with shading (aside from the clamping issue) fine, is there any other setup that needs to be done?

To illustrate my issue, I'm doing two passes of the following shader (ping-ponging between two textures in the aforementioned format):

texture tex;

sampler2D sam = sampler_state {
    texture = <tex>;
    minfilter = none;
    magfilter = none;
    mipfilter = none;
};

float4 main(float2 uv : TEXCOORD) : COLOR0 {
    float4 cin = tex2D(sam, uv);
    float4 cout = cin;

    cout.g = 10;
    if (cin.g > 1)
        cout.b = 1;

    return cout;
}

The output (starting from black) is a green screen. If I change:

cin.g > 1

To:

cin.g >= 1

Then I get a cyan screen.

I'm working from a modified version of SDL2's Direct3D 9 driver if that helps.

sentences: Changing texture offset in unity by script I am trying to change texture offset in a material by a script to create a parallax effect, but it doesn't move a bit no matter what I am trying. Any tips for this case? Or am I missing something?

sentences:
pause Menu only working in one scene and not in others Hi I'm working on a game for a school project but I'm still pretty new at game dev, I decided to add a pause menu to my game but for some reason, it only works in one of the scenes in unity, and I can't tell why it won't work on any of the other ones
Here is a video showing the problem: https://youtu.be/28fD9UEtfpg
and here is my script just in case
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PauseMenu : MonoBehaviour
{
public static bool GameIsPaused = false;

public GameObject PauseMenuUI;

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        if (GameIsPaused)
        {
            Resume();
        }
        else
        {
            Pause();
        }
    }
}

public void Resume()
{
    PauseMenuUI.SetActive(false);
    Time.timeScale = 1f;
    GameIsPaused = false;
    Cursor.lockState = CursorLockMode.Locked;
    Cursor.visible = false;
}

void Pause()
{
    PauseMenuUI.SetActive(true);
    Time.timeScale = 0f;
    GameIsPaused = true;
    Cursor.lockState = CursorLockMode.None;
    Cursor.visible = true;
}
}

sentences:
Check if 2 objects with multiple colliders overlap using bounds I'm writing a script which instantiates buildings in a scene, but in such a way that 2 buildings don't overlap with each other. Every building consists of approx. 10 parts, of which each has a box collider.
The way I do this is by first instantiating the first building and adding it to a list. In this example I instantiate 2 buildings.
By the way, this doesn't need to run in real-time, my intention for this is to press a button in the editor and have a lot of buildings instantiated at once.
        for (int j = 0; j < 2; j++)
        {

            if(j == 0)
            {
                _buildingList.Add(GameObject.Instantiate(GetBuilding(Vector3.zero), _parent));
            }

Now in this same for loop, I instantiate the next building, add it to the list and check if it collides with the previous building in the list, like so:
            else
            {
                _buildingList.Add(GameObject.Instantiate(GetBuilding(Vector3.zero), _parent));
                if (_buildingList.Count > 1)
                {
                    int amountOfRepositioningAttempts
                    while (AreObjectsIntersecting(_buildingList[_buildingList.Count - 1], _buildingList[_buildingList.Count - 2]) && amountOfRepositioningAttempts < 10000)
                    {
                        amountOfRepositioningAttempts++;
                        GameObject buildingToMove = _buildingList[_buildingList.Count - 1];

                        buildingToMove.transform.Translate(Vector3.right);

                    }
                }
            }
        }

As you can see I have a few helper methods, which look like this
public GameObject GetBuilding(Vector3 position)
{
    GameObject buildingToInstantiate = _buildingPrefabContainer.GetRandomBuilding();

    Vector3 lookDirection = Vector3.zero - position;
    Quaternion lookRotation = Quaternion.LookRotation(lookDirection);

    buildingToInstantiate.transform.position = position;

    return buildingToInstantiate;
}

And the method from which I get unexpected results:
public bool AreObjectsIntersecting(GameObject object1, GameObject object2)
{
    BoxCollider[] _collidersObject1 = object1.GetComponentsInChildren<BoxCollider>();
    BoxCollider[] _collidersObject2 = object2.GetComponentsInChildren<BoxCollider>();
    for (int i = 0; i < _collidersObject1.Length; i++)
    {
        for (int j = 0; j < _collidersObject2.Length; j++)
        {
            if (_collidersObject1[i].bounds.Intersects(_collidersObject2[j].bounds))
            {
                return true;
            }
        }
    }
    return false;
}

The intention here is that I go over each buildings collider, and if one of those colliders overlaps with one of the colliders of another building, then the building gets repositioned, and the check happens again.
But the method AreObjectsIntersecting() seems to always return true, and I don't see why.
I know this because
    int amountOfRepositioningAttempts

Always ends up being 10000, while the 2 objects should have stopped intersecting with each other after only a few iterations of moving them.
Can anyone help me out here?
Thanks in advance!

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:
OpenGL noob: Using VBO to draw a colored triangle I tried using straight vertex arrays to draw a triangle with different colors for each vertex and it works fine, but when I use VBO it won't work, so I'm doing something wrong.

// point 1
side_1.push_back(-2.0f); //x1
side_1.push_back(-2.0f); //y1
side_1.push_back(0.0f); //z1

// side color
side_color_1.push_back(0.8f); //r1
side_color_1.push_back(0.0f); //g1
side_color_1.push_back(1.0f); //b1

// point 2
side_1.push_back(2.0f); //x2
side_1.push_back(-2.0f); //y2
side_1.push_back(0.0f); //z2

...etc

// init code
////////////
glGenBuffers(2, &m_vertexBuffer[0]); //Generate a buffer for the vertices

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_1.size(),
                 &side_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_color_1.size(),
                 &side_color_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

// render code
////////////
glEnableClientState(GL_VERTEX_ARRAY);   // enable vertex array
glEnableClientState(GL_COLOR_ARRAY);    // enable color array

// bind the buffer to the VBO
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]);

glVertexPointer(3, GL_FLOAT, 0, 0);
glColorPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(sizeof(GLfloat) * side_1.size()));

glDrawArrays(GL_TRIANGLES, 0, 3);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

sentences:
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:
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: Rotate a 3D object in Unity3D on button click There is a 3D character in my application developed using Unity3D.  Now I want to rotate this 3D character when the user press the rotation button. I tried several ways, but didn't work. How can I rotate a character when the player presses the rotation button?

sentences:
How to get the center of a rotated rectangle regardless of point of rotation I need help working out the centre coordinate of a rotated rectangle regardless of the point of rotation (i.e. the rectangle doesn't rotate around its center). I do not know the coordinates of the corners, so it's not a simple case of dividing those.

It's easier to show than tell, so here's example 1:

http://gametest.mobi/rotate/index.php?f=point1.js&d=tests

Click to start/stop the rotation.

In this example I've got my sprite with the rotation point set to the bottom-right corner of it. If you click you'll see it rotate around that. I need to find a way to work out the coordinates of the center of the rectangle (represented by the middle red cross-hairs.)

Here is another example, this one is set to rotate at 0.3 x 0.8 into the rectangle:

http://gametest.mobi/rotate/index.php?f=point3.js&d=tests

You can see I added the circle into each demo, this is positioned on the sprites x/y coordinate and the radius was calculated from the distance of the center of the rectangle to the rotation origin.

I can visually see the correlation between the point of rotation and the circle, and I can see it tracks the centre of the rectangle beautifully on the circles perimeter! But I'm falling at the last hurdle in trying to calculate the actual value, so desperately need a fresh set of eyes on it please.

sentences:
Raymarching artifacts I was playing with raymarching using distance fields in GLSL sandbox and got stuck with a strange problem with artifacts.

Click here and take a look at the spheres generated in corners, they have strange artifacts plus they "flicker".

Is the mod operator, for domain repetition the culprit here?

sentences:
RayCast seems to ignore some objects? I'm currently using a Raycast both for my movement check aswell as a focus-setting check, both checks use pretty much the same code.
The problem i'm having is that the Raycast goes through some objects and targets the background no matter what i've tried to far. As you can see in this screenshot, I first clicked on the black sphere (Just a 3D Sphere in my 2D world with a default Sphere Collider) and the Log shows so aswell, however when i click on the white box which the second Debug Log is supposed to be, it just ignores the box collider and goes straight to the Background (the green sprite). The same problem with the Interactable check, code works completely fine with the Sphere but not with the box. Here's the Code i currently use:

    //Movement
    if (Input.GetKeyDown(KeyCode.Mouse0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100))
        {
            Debug.Log("We hit " + hit.collider.name + " " + hit.point);
            RemoveFocus();
            targetPosition = hit.point;
        }
    }
    if(targetPosition != (Vector2)transform.position)
        transform.position = Vector3.MoveTowards(transform.position, targetPosition, maxSpeed * Time.deltaTime);

    //Check for Interactable, pretty much same code...
    if (Input.GetKeyDown(KeyCode.Mouse1))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 200))
        {
            Interactable interactable = hit.collider.GetComponent<Interactable>();
            if(interactable != null)
            {
                SetFocus(interactable);
            }
        }
    }

sentences:
SDL, SFML, OpenGL, or just move to Java I recently started a new project, and I'm wondering if I should change the technology now before it's too late.

I'm using SDL with C++, I have around 6 classes, and the game is going alright, but I got to this point where I have to rotate my sprite to make it point to the coordinates of the mouse.

It's a 2D topdown game, so if I pre-cached the images, I'd have to load 360 images, which is bad for memory. If I used SDL_glx, I could do the rotation real time, but I heard it'd drop my frame rate very drastically, and I don't want my game to be slow.

I also read I could use OpenGL, which is faster at these things. The problem is, how much would I have to change my code if I moved to OpenGL with SDL.

So, I considered moving to a completely different language - Java - which is much simpler, and would allow me to focus on the game and handle networking much more easily than with C++.

I am very confused, and would like to hear your opinion - thank you!

sentences:
Save game statistic in simple method? I wrote a script to save and load game statistic. It works fine. In this script, two levels have it own score and timer. So, I have to write level by level it own score and timer. The issue is if I have 100 or 200 levels in my game. I have to write for every level. Yes will work, but will take time. So, I was thinking if there any simple method to shift the number of lines like use List or anything else ?

public gameStatic dr;

void Awake()    {
    Load_game_end();
}

   public void Save_game_end()  {
    BinaryFormatter bf = new BinaryFormatter();
    FileStream data_file = File.Create(Application.persistentDataPath + "/WarWorld.datt");

    level_static data = new level_static();
    data.level1tv = dr.level1t; // level one
    data.level2tv = dr.level2t; // level two
    //
    data.timer1 = dr.finalTime1; // level one
    data.timer2 = dr.finalTime2; // level two
    //
    data.total_money = dr.total_money;

    bf.Serialize(data_file, data);
    data_file.Close();

    Debug.Log("Game full saved");

}

public void Load_game_end() {
    if (File.Exists (Application.persistentDataPath + "/WarWorld.datt"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream data_file = File.Open (Application.persistentDataPath + "/ballworlds.datt", FileMode.Open);
        level_static data = (level_static)bf.Deserialize(data_file);
        data_file.Close();

        dr.level1t= data.level1tv;
        dr.level2t = data.level2tv;
        //
        dr.finalTime1 = data.timer1;
        dr.finalTime2 = data.timer2;
        //
        dr.total_money = data.total_money;

        Debug.Log("Game full loaded");
    }

    else {
        Debug.Log("save not found");
    }

}

public void delete_save_file() {
    File.Delete(Application.persistentDataPath +"/WarWorld.datt");
    Debug.Log("delete save file");

}

[Serializable]
class level_static
{
    public float total_money;
    //
    public float level1tv; // height score level 1
    public float level2tv;

    //
    public float timer1; //  level 1 timer
    public float timer2;

}

sentences:
Multiplayer (Database, Users,etc) for game I'm am looking to add multiplayer into my game (2D Platformer in XNA C#) My worlds are quite large (Up to 30 Million tiles max, Average 20 million maybe. 2000x10000). You could say the game is quite like Terraria.

I have been using Player.IO, It has everything I could need, Except for the fact that I will easily run out of bandwidth with such large worlds.

So I have been experimenting with the Lidgren Networking Library, Its okay, But not having to port forward for users would be nice, But Minecraft and terraria still get away with it.

So if I have serverside Code figured out (Lidgren). Now I just Need unique usernames, and possibly a Database for them (as player.io has PlayerObjects), a way to make a server list would also be a plus.

Almost something such as The way minecraft does it would be fine, Players have accounts, but they also have to make a server.

So how should I go about adding,

Unique Usernames (Login and registration)
Database for players acheivements and stats
A way to easily intergrate it with a server ran by players (Unless the service
includes this)

By the way, We are Indie, So if we can do users through SQl and a site it would be cheap, or a cheaper multiplayer service would be cool

sentences:
Smooth behaviours at high Time.timeScale When I set the Time.timeScale in unity very high, many scripts seem to do werid things (because of the high deltaTime they use for their logic).

Is there an option to let unity split up one update - call with a high deltaTime to multiple calls per frame, each with a lower deltaTime?

sentences:
Libgdx Actions interpolation Fadeout In libGDX there is a simple fade Interpolation that speeds up towards the end of the action animation. But what I am looking for is the reversed of it, it needs to start fast and slow down near the end. Is there a Interpolation function for that or how can I create this effect myself?

Currently i'm directly just initiating the action from the actor.

actor.addAction(Actions.moveTo(currentTouch.x - actor.getWidth() / 2,
 currentTouch.y - actor.getHeight() / 2,
 .2f,
 Interpolation.fade));

sentences:
How do I smooth out latency jitter in my netcode? I'm developing a multiplayer game and I'm following some articles I've found online to create an authoritative client-server model.

Reading this article, Valve says that every time a message is received, the client assumes the "current" time is the time in the latest packet, in the article they state it:

  It is assumed in this paper that the client clock is directly synchronized to the server clock modulo the latency of the connection. In other words, the server sends the client, in each update, the value of the server's clock and the client adopts that value as its clock. Thus, the server and client clocks will always be matched, with the client running the same timing somewhat in the past (the amount in the past is equal to the client's current latency). Smoothing out discrepancies in the client clock can be solved in various ways.

And interpolation of remote entities:

  Each update contains the server time stamp for when it was generated
  From the current client time, the client computes a target time by subtracting the interpolation time delta (100 ms)
  If the target time is in between the timestamp of the last update and the one before that, then those timestamps determine what fraction of the time gap has passed.
  This fraction is used to interpolate any values (e.g., position and angles).

Now obviously due to jitter, my interpolation looks terrible as I will receive time + latency jitter. So my question is, is on this part: "Smoothing out discrepancies in the client clock can be solved in various ways."

What would be a good way to smooth out any discrepancies?

sentences:
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:
How can I export a 3D model with keyframes to use in Blender? I'm currently trying to export some 3D data and load it into Blender, but I've encountered some problems at the time of processing the meshes. They all have keyframes (nothing too complex, just texture change and rotation) but I cannot use traditional Wavefront Obj to export it, because it does not support this data.

How can I export this keyframe information in a way Blender will understand?

sentences: How does Unity's multiplayer support stack up compared to other engines? I am currently starting development on a FPS game. I haven't decided on a developement tool. I am really drawn to Unity 3D but not sure how good the software is compared to others (the game has to have smooth multiplayer). Does Unity have multiplayer support? I couldn't really tell from the website.

sentences:
How do I make camera move at same speed when rotating and moving forward I made a camera in DX9. To move forward I press the Up arrow. To rotate on the Y axis I use the mouse. When I perform these movements on their own the camera moves at the speed I want.

However, if I hold down Up and move the mouse at the same time then the camera moves a lot faster than it should. I want it to move at the same speed as it does when only the Up arrow is pressed.

I think I need to normalize something somewhere but not sure what and not sure where. Have tried various combinations without success so if anyone can point me in the right direction that would be great. Thanks.

I've post code below.

#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)

LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    if( KEY_DOWN(VK_UP))    MovePlayer(D3DXVECTOR3(0, 0, -1.0f));
    if( KEY_DOWN(VK_DOWN))  MovePlayer(D3DXVECTOR3(0, 0, 1.0f));

    switch( msg )
    {
        case WM_MOUSEMOVE:
        ProcessMouseInput();
    }
}

void  MovePlayer( D3DXVECTOR3 in_vec )
{
    D3DXMATRIX CameraRot;
    D3DXMatrixRotationY(&CameraRot,D3DXToRadian(AngleY));
    D3DXVECTOR3 CameraRotTarget;
    D3DXVec3TransformNormal(&CameraRotTarget,&in_vec,&CameraRot);
    CameraPos +=  (m_timeElapsed * CameraRotTarget);
}

void ProcessMouseInput()
{
    GetCursorPos( &CurrentMouseState );

    if ((CurrentMouseState.x != GameMouseState.x) || (CurrentMouseState.y != GameMouseState.y))
    {
        int dx = CurrentMouseState.x - GameMouseState.x;
        int dy = CurrentMouseState.y - GameMouseState.y;
        AngleY+=m_timeElapsed*dx*7.0f;
    }
    GameMouseState = CurrentMouseState;
    // Set back to window center in Render function
}

VOID UpdateCamera()
{
    D3DXVECTOR3 CameraOrigTarget(0, 0, -1);
    D3DXVECTOR3 CameraOrigUp(0, 1, 0);

    D3DXMATRIX CameraRot;
    D3DXMATRIX CameraRotX;
    D3DXMatrixRotationX(&CameraRotX,D3DXToRadian(AngleX));
    D3DXMATRIX CameraRotY;
    D3DXMatrixRotationY(&CameraRotY,D3DXToRadian(AngleY));
    CameraRot = CameraRotX * CameraRotY;
    D3DXVECTOR3 CameraRotTarget;
    D3DXVec3TransformNormal(&CameraRotTarget,&CameraOrigTarget,&CameraRot);

    D3DXVECTOR3 CameraTarget;
    CameraTarget = CameraPos + CameraRotTarget;

    D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
    D3DXMatrixLookAtLH( &matView, &CameraPos, &CameraTarget, &vUpVec );
    g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

    D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI / 4, 1.0f, 1.0f, 100.0f );
    g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
}

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:
How could I render a star like those in Elite Dangerous - coronas and some sort of 3D "plasma" effect on the surface? Lets assume I wish to render a large, 3D, star object in a game engine using OpenGL. I can use a few different meshing methods: this includes mapping a cube to a sphere (with better subdivision to reduce distortion), a primitive lattitudional/longitudional based "globe" mesh, or a selectively subdivided icosphere. I would choose whatever would be easiest to apply the 3D effect to: I'm guessing an isocahedron, since it doesn't distort as much and the issues with mathematical discontinuities (when finding the Tangential, Normal, and Binormal) vectors should not be a worry (unless rendering the following effect would use a bump/normal mapping technique with a GPU-generated texture?)

Further, lets assume I wish to render a boiling, roiling, or vaguely evolving surface. The diamond-square algorithm could generate the proper effect, but how could this be used in 3D to generate something that looks vaguely like the surface of a star? Could I use the GPU to generate a texture that is then evolved with time, and use a procedural noise algorithm that includes the analytical derivatives to do so(for acquiring normal/bump map components to add "depth")? Should the noise algorithm be in 2D or 3D?

Lastly, what if I want to render the corona of the star in some volumetric fashion as well? Corona's created with billboards work well enough, but rapidly fall apart in appearance once the viewpoint gets closer to the star (as is common with sprite-based techniques).

Example images:

sentences:
How to get samsung gear vr controller rotation & position in unity I am trying to get Samsung Gear VR(Oculus) rotation & position so when I turn the samsung controller left or right(like a magic wand)...it should give me rotation(Quaternion) & position(Vector3) readings?

How can I do that? I'm using Mobile version of Oculus Gear VR not the PC one. Also, GetLocalControllerRotation() returns void and doesn't return me a Quaternion

Does the controller come with a Gyroscope with the help of which I can the rotation or position readings?

sentences:
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:
How can "Box Collider is trigger" apply to the Player, not the enemies (make them collide, not pass through)? So, in my game, the Powerup (capsule) has a RigidBody and a Box Collider.  I’ve set the Box Collider to «is trigger». When the player hits the powerup, it disappears - just as it’s supposed to.

Is it possible to let the enemies collide with the powerup (bump into it) instead of just passing through it? From the Enemy script:

    void Start()
{

        enemyRb = GetComponent<Rigidbody>();
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        player = GameObject.Find("Player");

}

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

    if (player != null && gameManager.isGameActive)
    {
        enemyRb.AddForce((player.transform.position - transform.position).normalized * speed);
    }

    if (transform.position.y < -4)
    {
        Destroy(gameObject);
        gameManager.UpdateScore(pointValue);
    }
}

From the PlayerController script:

private void OnTriggerEnter(Collider other)
{
        if (other.CompareTag("Powerup"))
        {
            hasPowerup = true;
            Destroy(other.gameObject);
        }
}

sentences:
Unable to list target platforms. Please make sure the android sdk path is correct For some reason, I am unable to test my android program because of this error.
Here are some pictures of the errors. This error is not allowing me to test my app on my test Android device, I have tried uninstalling and reinstalling, checking if it is acatually the root folder, everything, PLEASE HELP!

1st error

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
C:/Users/jayso/AppData/Local/Android/sdk\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunAndroidSdkTool (System.String toolName, System.String arguments, Boolean updateCommand, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.ListTargetPlatforms (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.AndroidSDKTools.GetTopAndroidPlatformAvailable (UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKPlatformDetector.GetVersion (UnityEditor.Android.AndroidSDKTools sdkTools)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK+SDKComponentDetector.Detect (UnityEditor.Android.AndroidSDKTools sdkTools, System.Version minVersion, UnityEditor.Android.PostProcessor.ProgressHandler onProgress)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (System.Version minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.EnsureSDKComponentVersion (Int32 minVersion, UnityEditor.Android.PostProcessor.Tasks.SDKComponentDetector detector)
UnityEditor.Android.PostProcessor.Tasks.CheckAndroidSDK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

2nd Error

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct.
C:/Users/jayso/AppData/Local/Android/sdk\tools\bin\avdmanager.bat list target -c

stderr[

]
stdout[

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
]
exit code: 1

sentences:
Should I bother merging faces in my 3D block-based game? Okay, so I have a bunch of cubes in a 3d-world. I already implemented face culling, so that when a cube is next to another cube, their touching faces won't be drawn, or even sent to the buffer. However, a while back when I was still researching how to make a 3d block-based game, I came across a stack overflow question where the asker posted an image of their cubes, which had not only been culled but they had also merged the faces of adjacent cubes into larger rectangular faces. Like this:

My question is, should I do this? Will the drawing time be saved enough to justify the longer update time? And if so, I'm not even sure if it would work some of the time. The cubes aren't textured, they're coloured, so I'm not entirely sure if it would work with multiple colours of cubes.

sentences: How are multiplayer mods created? How do you make a single player game into a multiplayer one? For example: SA-MP San Andreas Multiplayer and the new Just Cause 2 Multiplayer. Before making the mod, did they need permission? How did they even know what to code without having the games source code? I have some ideas but I have no idea where to really start.

sentences:
Load game data via ajax what are The Best practies To load game data that are Stored in a mysql database?

I'm using ajax request. But The async Call is a problem because i can't sync The game level with The data load. And game does Not start because the variable is  not defined. If i use sync Call, The loop wait The result And all the entities are blocked on The screen.

How Can i resolve?

sentences:
Why doesn't my texture display with this GLSL shader? I am trying to display a DXT1 compressed texture on a quad using a VBO and shaders, but I have been unable to get it working. All I get is a black square.

I know my texture is uploaded properly because when I use immediate mode without shaders the texture displays fine but I will include that part just in case. Also, when I change the gl_FragColor to something like vec4 (0.0, 1.0, 1.0, 1.0) then I get a nice blue quad so I know that my shader is able to set the colour. It appears to be either the texture is not being bound correctly in the shader or the texture coordinates are not being picked up. However, I can't find the error! What am I doing wrong?

I am using OpenTK in C# (not xna).

Vertex Shader:

void main() {
    gl_TexCoord[0] = gl_MultiTexCoord0;
    // Set the position of the current vertex
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Fragment Shader:

uniform sampler2D diffuseTexture;
void main() {
    // Set the output color of our current pixel
    gl_FragColor = texture2D(diffuseTexture, gl_TexCoord[0].st);
    //gl_FragColor = vec4 (0.0,1.0,1.0,1.0);
}

Drawing Code:

int vb, eb;
GL.GenBuffers(1, out vb);
GL.GenBuffers(1, out eb);
//                      Position        Texture
float[] verts = {   0.1f, 0.1f, 0.0f,  0.0f, 0.0f,
                    1.9f, 0.1f, 0.0f,  1.0f, 0.0f,
                    1.9f, 1.9f, 0.0f,  1.0f, 1.0f,
                    0.1f, 1.9f, 0.0f,  0.0f, 1.0f
                };
uint[] indices = {
                   0, 1, 2,
                   0, 2, 3
                 };

//upload data to the VBO
GL.BindBuffer(BufferTarget.ArrayBuffer, vb);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, eb);

GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts.Length * sizeof(float)), verts, BufferUsageHint.StaticDraw);
GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(uint)), indices, BufferUsageHint.StaticDraw);

//Upload texture
int buffer = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, buffer);

GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (float)TextureMinFilter.Linear);

GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate);

GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, texture.format, texture.width, texture.height, 0, texture.data.Length, texture.data);

//Draw
GL.UseProgram(shaderProgram);

GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);

GL.VertexPointer(3, VertexPointerType.Float, 5 * sizeof(float), 0);
GL.TexCoordPointer(2, TexCoordPointerType.Float, 5 * sizeof(float), 3);

GL.ActiveTexture(TextureUnit.Texture0);
GL.Uniform1(GL.GetUniformLocation(shaderProgram, "diffuseTexture"), 0);

GL.DrawElements(BeginMode.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0);

sentences:
Unity Animator not animating player, but following transitions perfectly in Animator Window I am trying to animate a model in my project, and although I have been successful doing the same in other projects, I am not succeeding in this one.
The model does not seem to animate, although in the Animator window, everything looks fine, transitioning from one state to the other and going back.

I have followed the tutorials to import animations from the site where I downloaded the animation, and each animation is the same as other working animations in other projects:

The animations play as expected in the inspector window.
I have tried modifying the "Apply Root Motion" in my character and it does not work either way. My Player model has these properties:

And I have tried adding a Rigid Body but it didn't work neither. I have spend several hours trying to solve this issue and I am running out of ideas to try. How can I make the animation work as expected?
Cheers!

sentences:
How to implement auto-aiming / auto-targeting We all know how auto-aiming or auto-targeting works in games.

Now, I need to find how to implement it in my game.

In fact I should implement it in UDK and I would be glad if anyone gave me more specific explanation for UDK. But conceptual explanation is also enjoyable and I'll implement it myself in my way.

sentences:
Instancing with empty data, or varying vertex counts? I am new to game development, having only developed a few games before, in 2D space, but with 3D rendering.

I have implemented instancing before, but this is only my 2nd time doing it. I have a question regarding instancing.

To do instancing, I have a geometry buffer having a vertex declaration (for instance) 32 VertexPositionColor elements. This is because I have a few elements with 32 vertices in them.

I am rendering all elements as linelists. However, there are some elements in the list that doesn't have 32 vertices. I would like to include these in the instancing render process too.

So my final question is, what happens if I (for instance) fill out 8 of the vertices with their indexes, but then still send all the 32 vertices into the instancing shader? Is it possible?

Is there a better approach to be able to instance all kinds of elements, with various vertex counts?

sentences:
WebGL Primitive Batching unexpected performance I'm kinda new to WebGL in general, I've started to make some batching experiences on primitives (just drying a bunch of rectangles by using a combination of two triangles repeatedly).

I've started by implementing Direct Drawing that draws a rectangle (TRIANGLE_STRIP like) as soon it is requested:

  var colorArr = new Float32Array(<color values here>);

    var vertices = [
        rectangle.x, rectangle.y, 0.0,                                              // TOP LEFT
        rectangle.x, rectangle.y + rectangle.height, 0.0,                           // BOTTOM LEFT
        rectangle.x + rectangle.width, rectangle.y, 0.0,                        // TOP RIGHT
        rectangle.x + rectangle.width, rectangle.y + rectangle.height, 0.0        // BOTTOM RIGHT
    ];

    _this.game.getShaderManager().useShader(_this.primitiveShader);

    // position buffer
    gl.bindBuffer(gl.ARRAY_BUFFER, _this.vertexBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);

    gl.enableVertexAttribArray(_this.primitiveShader.attributes.aVertexPosition);
    gl.vertexAttribPointer(_this.primitiveShader.attributes.aVertexPosition, 3, _this.gl.FLOAT, false, 0, 0);

    // color buffer
    gl.bindBuffer(gl.ARRAY_BUFFER, _this.colorBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, colorArr, gl.STATIC_DRAW);

    gl.enableVertexAttribArray(_this.primitiveShader.attributes.aColor);
    gl.vertexAttribPointer(_this.primitiveShader.attributes.aColor, 4, _this.gl.FLOAT, false, 0, 0);

    // set uniforms
    gl.uniformMatrix4fv(_this.primitiveShader.uniforms.uMatrix._location, false, _this.game.getActiveCamera().getMatrix());

    gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);

But then I wanted to go one step further and I've implemented a simple batcher (mostly by common sense, which is probably where I started wrong).

Basically the batcher does the same thing has the code above, the difference is that I concat all the vertex and color data into a big array of data and then draw everything:

    // position buffer
        gl.bindBuffer(gl.ARRAY_BUFFER, _this.vertexBuffer);
        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(_this.rectangleVertexData), gl.STATIC_DRAW);

        gl.enableVertexAttribArray(_this.primitiveShader.attributes.aVertexPosition);
        gl.vertexAttribPointer(_this.primitiveShader.attributes.aVertexPosition, 3, _this.gl.FLOAT, false, 0, 0);

        // color buffer
        gl.bindBuffer(gl.ARRAY_BUFFER, _this.colorBuffer);
        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(_this.rectangleColorData), gl.STATIC_DRAW);

        gl.enableVertexAttribArray(_this.primitiveShader.attributes.aColor);
        gl.vertexAttribPointer(_this.primitiveShader.attributes.aColor, 4, _this.gl.FLOAT, false, 0, 0);

        // set uniforms
        gl.uniformMatrix4fv(_this.primitiveShader.uniforms.uMatrix._location, false, cameraMatrix);

        gl.drawArrays(gl.TRIANGLES, 0, 6 * _this.rectangleCount);

For my surprise, the second attempt is getting worst results. Using the first approach I get a solid 60 fps on a 320 rectangles drawing and on the second only 40 fps.

So, my questions specifically are:

Why is the batcher having worst results?
What can be optimized to have an optimal drawing performance?

Best Regards.

sentences:
Animations / OpenGL (ES 2) in game menu (I am specifically asking for Android)

If you look at Angry Birds (and in fact many other games), you can already see a lot of animations & effects going in the main menu and in other places even before starting to play. I assume they are done with OpenGL, more precisely a FrameLayout is used and inside it a GLSurfaceView is somewhere at the bottom of the hierarchy; above the GLSurfaceView you have regular Android buttons and texts.

Is this how it's done*? Also would you reuse the same GLSurfaceView when running the actual game or should another one be created?

*I am aware an alternative approach would be to make absolutely everything in OpenGL. Of these two I prefer the FrameLayout one, but I don't know whether other developers agree.

sentences:
Placing sprites properly to form an object I'm working with XNA in Visual Studio, and I'm trying to draw this sprite:
https://i.imgur.com/Dy5nSuG.png

Only using this sprite:
https://i.imgur.com/6T8TeTQ.png

My current attempt relies on a matrix boolean, which then gets drawn in a foreach loop:

//Variable
 bool[,] centerPiece = new bool[,] { { false, true, false }, { true, true, true }, { false, true, false } };

//Loop
 foreach (bool b in centerPiece)
            {
                if (b == true)
                {
                    spriteBatch.Draw(squareTex, screenView(), null, Color.White, 0f, IMGCenter(), 1f, SpriteEffects.None, 0f);
                }
            }

While this draws all 5 squares, it doesn't place them as desired (because of they're all being drawn in the screenView() method placement(The center of the screen):

public Vector2 screenView()
        {
            Viewport viewport = GraphicsDevice.Viewport;
            Vector2 screenCenter = new Vector2(viewport.Width / 2f, viewport.Height / 2f);
            return screenCenter;
        }

How do I modify my loop to place the squares correctly, and/or do I need to change my implementation completely to achieve my desired goal?

Note: I need to both be able to access the object as a whole, and also access each individual square, in each individual object.

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:
Pitch (X-axis) rotation problem Situation:
From a first person perspective (camera position) I want to be able to grab an object and have it fixed to the center center of the screen while looking up-down (pitch) and looking left-right (yaw). The yaw works fine. The pitch only works facing the object head on when camera position z > object z. Turning 180 degrees the pitch rotation is opposite. How do I compensate for this. This is what have:

double yawRadians = Math.toRadians(yaw - oldYaw);
double pitchRadians = Math.toRadians(pitch - oldPitch);

//center position of object, minus camera position
double x = grabbedObject.x0 - position.x;
double y = grabbedObject.y0 - position.y;
double z = grabbedObject.z0 - position.z;

double sinX = Math.sin(pitchRadians);
double cosX = Math.cos(pitchRadians);

double sinY = Math.sin(yawRadians);
double cosY = Math.cos(yawRadians);

double sinXY = sinX * y;
double cosXZ = cosX * z;

double newX = cosY * x + sinY * sinXY - sinY * cosXZ;
double newY = cosX * y + sinX * z;
double newZ = sinY * x + cosY * -sinXY + cosY * cosXZ;

grabbedObject.addTranslation(newX - x, newY - y, newZ - z);

sentences:
Packet/Event-Based Entity-Component-System I know what one of the big commonalities I see in ECS projects is that there is a main game loop that iterates through systems and calls their respective update methods (for example, RenderSystem).

I'm a bit stumped on how this applies to an event-based game where the client sends packets of information and you update from there. For example:

MovementPacket

Read incoming movement packet and send to appropriate packet handler, which makes changes to appropriate components regarding entity through systems.
Packets are then sent back through the systems (which work with components to access the data needed to write these packets).

Now, I'm not sure where a game loop really comes in here, since everything seems to be event-based. I'm scared that most of the work I'm doing ultimately for ECS just isn't being done right. My systems are typically becoming "containers that do logic and stuff, but don't operate within a game loop."

In fact, the game itself doesn't have a game loop, since we haven't really found an area to insert it in.

Is the approach just wrong? Is my approach towards interweaving ECS with this packet-based game for the most part incorrect?

sentences:
Why does collision only work when keys are being pressed? My player object containing a rigidbody that is controlled using Input, is not colliding with an enemy unless keys are pressed. When no keys are pressed, the enemy simply goes through the player without collision. I'm using Unity 5.6.1f1.

I figured the problem is in the Patrol class because when I don't attach the script to the enemy object the collision appears to take place fine.
But I don't know what I'm doing wrong in this script because I seems to do it's task well. I wrote this script to make the enemy object move between points in patrolPoints which are just some empty's in the game world.

So, I would like to know if I'm doing it right or is there another way to do it.

Patrol.cs

public class Patrol : MonoBehaviour {
    public Transform[] patrolPoints;
    public float speed;
    private int currentPoint;
    private bool forward;

    // Use this for initialization
    void Start () {
        transform.position = patrolPoints [0].position;
        currentPoint = 0;
        forward = true;
    }

    // Update is called once per frame
    void Update () {
        if (transform.position == patrolPoints [currentPoint].position) {
            if (currentPoint < patrolPoints.Length - 1 && forward) {
                currentPoint++;
            } else {
                currentPoint--;
                forward = false;
            }

            if (currentPoint == 0)
                forward = true;
        }

        transform.position = Vector3.MoveTowards (transform.position,
            patrolPoints [currentPoint].position, speed * Time.deltaTime);
    }
}

sentences: How can I run my XNA demo straight from a CD? I was told by a company that better than putting an installer on a CD would be allowing the user to run the demo directly from the CD. Is this even possible when the demo might require things such as the XNA framework to run? Are they actually wrong and an installer is in fact necessary for the dependencies?

sentences:
Dynamic Terrain Triangulation Is there someone who know/have an algorithm which can perform terrain triangulation like on the example image right under (there is a secondary image as well).

The reason I say "Dynamic" is because I want it to support Dynamic changes to the terrain, like if one was to dig into the ground or into the side of a mountain, then it should be capable of triangulating the new changes without destroying the old terrain which doesn't need changes.

Ignore the things like the trees, etc. This is only about the style of the terrain itself.

Click here for fullscreen picture
Secondary Image

I've tried using the Marching Cubes Algorithm, though it didn't give me that triangle'ish feeling, like in the image(s) above (While ignoring the normal rendering in my example).

Bottom Line

Does anybody know/have an algorithm, or any idea of how to...

Triangulate terrain so it have that style like in the above example image(s).
Support dynamic changes like Marching Cubes does, but with this triangle'ish style.

Note: All the "points" would be in an unsorted list, where the "points" of course is all the vertices, which should be used to generate all the triangles from.

  Disclaimer: I usually answer and sometimes ask question on Stack Overflow, so if anything is wrong with my question here I apologize, though comment and I will fix whatever is wrong.

sentences:
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:
differences betwen game resolution in a different display resolution my game is not supported on the other devices with a different resolutions. for example may character is 140w X 55h pixels which is ok on a 4 inch display but it goes wide when i tested my game on a device with 4.7 inch display. how can i make a correct character for 4.7 or more inch displays?
i am using cocos2d-x engine. i want to see if it has a automatic synchronize tool or no. i my self must do it manually ?

sentences:
How to handle font loading? I need to display text in my game, who doesn't.

I had originally thought that I could just statically render all the text I would need to images and use those.  I'm starting to think that is a bad idea.  I figure I'll have to internationalize it in the future, and the game has score counters and such which cannot be statically rendered.  It looks like I'll need to use a more dynamic approach.

So my question.

How do games usually handle font loading?

Load the TTF directly and render it to a texture atlas.
Pre-bake the TTF into an image with a configuration file storing locations and kerning.

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

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

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

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

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

sentences:
AI parameters for Tetris like game I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. Also, a line is removed once it is full (all 10 cells contain some block). I was trying to figure out which parameters I might choose in order to optimise how the game is played. Some obvious parameters which I thought of:

a) A piece should be placed in a position where it forms the maximum number of full lines, as they can be removed in the next step.

b) A piece should be placed to minimise the 'bumpiness' or roughness of the topmost surface, i.e, it should be as level as possible.

c) This is arguable, but the AI should try to keep as minimum height as possible.

d) The number of columns containing atleast one block should be minimised.

But the AI is still not playing good enough and keeps getting stuck. I would like to know if there are some other important parameters which I may be missing?

sentences: how do i convert my pygame games to executable I have a lot of python games I made in pygame and want to compile them so I can distribute them on sites like itch.io and gamejolt.com, the thing is, when I try to my executable game it says "fatal error detected" and "failed to execute script Pong". I was using pyinstaller to create a standalone file.

sentences:
LWJGL glRotatef() without rotating axes? Okay so, I noticed when you rotate around an axis, say you do this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

That will rotate things 90 degrees around the x-axis. However, it also sort of rotates the y and z axes as well. So now the y-axis is pointing in and out of the screen, instead of up and down. So when I try to do stuff like this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
glRotatef(whatever, 0.0f, 1.0f, 0.0f);
glRotatef(whatever2, 0.0f, 0.0f, 1.0f);

The rotations around the y and z-axes end up not how I want them. I was wondering if there is any way I can sort of rotate just the axes back to their initial position after using glRotatef(), without rotating the object back. Or something like that, just so that when I rotate around the y-axis, it rotates around a vertical axis.

EDIT: After further research, it appears I will have to learn quaternions.
EDIT2: Wait, I don't think that's right. Does anyone know? I saw this thread on another site: http://java-gaming.org/index.php?topic=24177.0 but I don't understand what he did.

sentences:
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:
ECS - System calling other systems I'm trying to build my first (2D) game with ECS but I always end up with some system calling other systems. Here's an example.

There is a RegionSystem that manages RegionComponents. On each frame, this system loops through all the RegionComponents and checks if the player is inside any of them.

When the player enters the water, the player's sprite must be changed from PLAYER_RUNNING to PLAYER_SIWMMING.

When the player steps onto a teleporter, an animation will play around the player, he'll be rotating and a new level will be loaded.

When the player steps into a hole, he will lose some health and will be repositioned in the level.

So, first of all, it needs the coordinates of the player's body to check if it is in a region (check point in rectangle). Hence it will ask the RigidbodySystem to get the coordinates.

Then if the player is inside a region, it will call PlayerSystem_OnInsideRegion(regionInfo).

In turn this function, PlayerSystem_OnInsideRegion must react differently depending on the type of the region:

for the water case, it needs to call the SpriteSystem to change a sprite, the PlayerSystem to set a boolean (m_inWater = True;) and the RigidBodySystem to get the coordinates of the player's body;
for the teleporter case, it needs to call the LevelSystem and tell him to switch to another level on the next frame;
for the hole case, well, simply descrease the member m_health of the player component, so no need to call another system here.

I have the feeling this is a horrible design and does not fit the ECS architecture. I read that people use a message system where systems can subscribe and unsubscribe to particular type of message. But I also read that it can be tricky to react to them in a proper order.

sentences:
Connecting a model's joint to the joint of another model I am trying to figure out the math behind orientating and translating a model so that a specified point on the model will connect with a specified point on another model. For example, given the following objects and respective "joints":

Where a joint is defined (relative to the model's untransformed position) as something like:

struct Joint
{
    Vector3 position;
    Vector3 normal;
}

I would like a function that can take a base model and a connecting model that modifies the "world" matrix of the connecting model. Something like:

public void ConnectModels(Matrix baseModelWorld, Joint baseJoint, Matrix connectingModelWorld, Joint connectingJoint)
{
    //Code to re-orient and re-position the connecting model's world matrix
    //Note: The joint position/orientation/normal need to be transformed by
    //      the model's current world matrix

    //1. Transform the baseJoint/connectingJoint by the baseModelWorld/connectingModelWorld
    Vector3 baseJointPos = Vector3.Transform(baseJoint.position, baseModelMatrix);
    Vector3 connJointPos = Vector3.Transform(connectingJoint.position, connectingModelMatrix);

    Vector3 baseJointNorm = Vector3.Transform(baseJoint.normal, baseModelMatrix);
    Vector3 connJointNorm = Vector3.Transform(connectingJoint.normal, connectingModelMatrix);

    //2. Orient the connecting model to match (opposite directions) base joint's normal

    //3. Translate the connecting model such that the connecting joint connects
    //        to the base joint.

    //4. ????

    //5. Profit
}

But, I'm not very good at matrix math and I'm not sure what this actually translates to in code (or if this is correct/the best way).
Also, I'm wondering if there is a better way to define a joint (i.e. just a Matrix, would that be possible?). Any help is appreciated!

sentences: Google Web Toolkit: Ever used for making games? I've recently come across GWT (Google Web Toolkit) and have been amazed by it. I was wondering if anyone has ever put it to use making a video game? And if they did, what their experience was, whether it was worth it and whether the game was any good.

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:
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:
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:
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:
What would be the easiest way to keep objects at a constant point on a 2D map, even when off-screen? Like in Starcraft, where your army units stay put even though your view is moving around the map.

I have a static tiled map that I made using Mappy and I can display that fine, I just want my off-screen objects to stay put while I am moving my view around. At the moment everything is drawn relative to my view instead of at a global (x, y) position and I would like to change this but I am not sure how.

Would I need another array aside from the one to create my map? That seems like a terrible idea to me.

sentences:
Should I have an upper limit to the number of update cycles per second in a JS game? I'm making a JavaScript game engine for fun and one thing I noticed was that my laptop runs super hot with the simplest game mechanics and that my game is doing about 600 updates per second.

The graphics is already capped at 60 fps, but I'm wondering if I should limit the update cycles so my processor doesn't get owned on the simplest games.

I think the answer is yes, it is just that I've never heard of anyone doing this before, so I wanted others opinions.

sentences:
What is the difference between "stealth" and "social stealth?" I was recently researching the stealth mechanics of several games and I stumbled across the distinction of "stealth" (eg. Splinter Cell series) vs "social stealth" (eg. Assassin's Creed series).

What exactly is the difference between these two terms?

sentences:
How to do perspective projection “parallax” but without changing the scale or offset of objects? Hello everyone I have this problem that I have tried everything I could think of. The problem: I am making a 2D game with parallax effect but I am using 3d space so am not simulating the parallax but letting the perspective projection take care of it for me. now the problem i have my own game editor where I design the levels, in this editor I use just images and I set a Z value for each layer. however I want the layers to show in the game engine exactly as I set them in the game editor, in short I want perspective projection to do parallax but without changing their scale or offset/position.

obvious solution is to scale them up and offset them but the problem how to calculate their offset? with scaling I tried object->Scale(object.Z/view.Z) and seems to return them to their real size but their positions are still wrong. I tried object->setPositionX(object->getPosition().x*(object.Z/view.Z)) and seems to be aligned except they all seems shifted.

I have tried unprojecting and tried to convert from world matrix to screen matrix and find some ratios and so on.

If anyone have any idea or anyway how this could be done in an elegant/mathematical way , I will be most grateful.

Thank you all in advance.

sentences:
How to get object or its index from mouse coordinates? Basically, I have a NumPy array of rectangles that store their colour and position.
I want to be able to compare my mouse position and clicked on the rectangle's position and get the index or the object itself from the array.
Do I have to iterate through every square in the array and compare item's coordinates?
The structure looks like:
Cube[Face][Horizontal-Line][Square] = np.array([colour, coordinates])
What's the most efficient way to do it? I'm thinking of using colliderect() method, but I don't know how to implement it.

sentences:
Looking for the reference tutorials for the joints in the Box2D for iphone I can't find the tutorials of joints class in the Box2D for iPhone. I am unable to run a Testbed for iPhone Box2D.

(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
       if (_mouseJoint!=NULL)return;
       UITouch *mytouch=[touches anyObject];
       CGPoint location=[mytouch locationInView:[mytouch view]];
       location=[[CCDirector sharedDirector]convertToGL:location];
        b2Vec2 locationWorld=b2Vec2(location.x/PTM_RATIO,location.y/PTM_RATIO);
 //ristrict the player within the ground limit  keep stucking the player with grounditself.....
if (_playerFixture->TestPoint(locationWorld))
{
    b2MouseJointDef md;
    md.bodyA=groundBody;
    md.bodyB=_playerBody;
    md.target=locationWorld;
    md.collideConnected=true;
    md.maxForce=100.0f*_playerBody->GetMass();
    _mouseJoint=(b2MouseJoint *)_world->CreateJoint(&md);
    _playerBody->SetAwake(true);
}
}

-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_mouseJoint == NULL) return;
UITouch *myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView:[myTouch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
if (location.y<240.00&&location.y>=20.0f)
{
    b2Vec2 locationWorld = b2Vec2(location.x/PTM_RATIO, location.y/PTM_RATIO);
    _mouseJoint->SetTarget(locationWorld);
}
}

- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (_mouseJoint)
{

 _world->DestroyJoint(_mouseJoint);
    _mouseJoint = NULL;

  }

}

sentences:
Get Prefab Asset From Gameobject in Edit Mode I want to get a prefab asset (that resides in Project Window) and assign it to a field like the one you get when you manually drag the prefab asset from Project Window to GameObject field:

But when I try to do the same thing in code (and in Edit Mode) with this function:

GameObject prefab_instance = PrefabUtility.GetNearestPrefabInstanceRoot(gameobj) as GameObject;

I get a prefab instance but not a prefab asset:

How do I get a reference to prefab asset from the gameobject that was created from it?

sentences:
Building a simple bomberman game with Node.js and Socket.io I'm building this game mostly because I want to experiment with Node.js and Socket.io, and the game is more like a proof of concept.

To start with, I have a 2D grid system as the game map.

_________________________________________.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|
.
|____|____|____|____|____|____|____|____|____|.

Each position with values:

0: empty
1: wall - can not be destroyed by explosion
2: obstacles - can be destroyed by explosion
3: bomb
4-9: some powerups
10>=: the id of player

CLIENT-SIDE

I'm not planning to have any game logic happen on the client side, so the client simply send left, right, up, down and plant a bomb command to my server. There is however, some simple check that happen on the client side - 1. check that there's no wall at the direction the client is moving to; 2. the client didn't plant a bomb in the last 3 seconds.

The client also receives the state of the map as a 2d array and knows how to draw everything using that info.

SERVER-SIDE

Main game logic happen on the server side, which includes updating the position of player, calculating the damage of bomb explosion - destroy stuff in the range, except walls and space behind walls

Questions:

When the player is moving, he won't see himself moved until he gets the data back from server that updates his position. So I worry this delay may affect user experience, is it better that I move his position on his browser right away, and only update other players' position using info received from server, that means his own movement is rendered away, while his position info is sent to server.
When rendering everything, it's simple to implement that whenever anything on the map move or change, redraw everything with the new data. Is that a waste? Can I only update things that change, for example, a player move right 1 position, nothing else changed on the game map, do I still have to redraw everything? I think I'm going to use Canvas to render.
Please feel free to comment or answer if you think there are places I can improve or I simply thought wrong, thanks!

sentences:
How can I scale up sprites but maintain visual quality? I am using WebGL. I have an isometric grid which contains tiles. Some have 'tree' sprites on them. If I have my tree sprite loaded from a texture with a fixed resolution, when I zoom into the grid (scale things up), the sprite texture looks poor. How can I render sprites such that quality is maintained when the player zooms in?

Some provisos:

I can't use vector graphics, as the textures are far too detailed.
The scaling needs to be smooth.

sentences: How to script enable VR in Unity 5.1 Unity 5.1 has integrated VR, its in the Build Player Settings as a checkbox. I want a startup scene that is not VR, then when the user starts it enables the VR camera. Can I do that?

sentences:
Which tools are artists using out there and how for game development to produce the material used by game programmers? What processes, tools, methods are used by game artists to prepare materials for the programmers?

I am interested in tools (ie: photoshop, pixelmator, etc for drawing) and also how they are used together to produce texture atlases or individual images for the programmers.

Methods or way of working (tool-chains maybe), which can be used by the artist to

Present ideas (sketches)
Mesh up game images (photosop: front menu, in-game)
Cut up images/layers into (ie: copy paste?)

smaller individual pieces
texture atlases (some other tool)

Generate coordinates ie: (xywh) for button "Options" on the main screen which is stored as main_options.png or (uvhw, xywh) for in-game HUD which is in a texture_atlas.png.
Any way to automate some of the steps above?

============ before edit ============

The artist(s) might use hand drawings-scanner/sketch pad for illustration.
These are then imported and further improved in some other image manipulation tools.
The result then can be used to produce both preview of the game (menu, in-game meshups) and final elements which will be used by the programmer(s): individual images or texture atlases.

Which tools are artists using out there and how for game development to produce the material used by game programmers?

I am particularly interested if there are automated tools where a small change at the illustration part can be propagated to produce final production images/textures without the need for the artist to cut/merge them.

sentences:
Calculate velocity to hit the target on flat 2d surface I am creating a game using Python and Pygame.

I have used this function before (with JS with p5.js and Java with libwjgl, but for some reason it does not work with pygame (I am not sure if it matters here).

I'm trying to hit a static target shot from a moving object.

This is how I am doing this:

def shoot(self):
  posX, posY = 100, 100 # Static target coordinates

  diffX = self.player.x - posX
  diffY = self.player.y - posY

  distance = math.sqrt((diffX * diffX) + (diffY * diffY)) # Calculate the distance

  velX = float((-1 / distance * diffX * 6))
  velY = float((-1 / distance * diffY * 6))

  # Bullet(x, y, width, height, velocityX, velocityY)
  # Will be rendered on the screen
  self.bullets.append(Bullet(self.player.x, self.player.y, 10, 10,  velX, velY))

Updating bullet location:

  def update(self):
    self.bullet.x += self.velX
    self.bullet.y += self.velY

This works perfectly with other languages I have mentioned, but in Python the launched projectile is off...

Here is how it looks. The red square is the target.

THANK YOU, EVERYONE, FOR THE HELP. I really appreciate it :)

sentences: 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:
Text tool for designing gameplay elements I'm still in the design phase of my game and I'm realizing that there are too many elements to keep track of and it just looks like a mess in the plain text that I created it in. My notes are basically going to translate to the classes and subclasses that'll make up the objects within my game, but I'd like to find a tool that will make it simpler to keep track of. Here's an example of the structure of my notes:

NPCs:
    - Humans:
        - Human A: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
        - Human B: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
    - Elves:
        - Elf A: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
        - Elf B: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
    [...]
World:
    - Continent A: overall description
        - City A: city description
            - Building A: description
            [...]
        [...]
    [...]
Items:
    - Melee: overall description
        - Melee Weapon A: description
            - Damage: X
            - Damage Type: some type
            [...]
        [...]
    - Ranged: overall description
        - Ranged Weapon A: description
            - Damage: X
            - Damage Type: some type
            [...]
        [...]

And so on...

Even this simple list is starting to look messy, and once you have pages of classes and multiple subclasses for each class along with lengthy descriptions, it gets really jarring when you view it.

What I would really like is a way to expand and collapse these elements so I can either view the big picture or go down to details, and maybe be able to set some groups a different color or make them bold, etc. for better viewing and categorization. It's basically a class diagram but with more game-world-related descriptions rather than function/method descriptions. I'm currently using Sublime for this, so either a plugin or a different tool that accomplishes this would really help. Thanks!

sentences:
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:
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:
Reference to a particular Prefab clone I am developing a simple 2D game. In game, I've created a prefab for charcaters. and I am changing sprite of prefab runtime. This all execute fine.
Now I want to apply click event on a particular prefab clone and want to increase scale of prefab. I am attaching a c# script what I have did till now.

[System.Serializable]
public class Shopping
{
    public string CharacterName;
    public Sprite CharacterSprite;
}

public GameObject CharacterPrefab;
public Transform CharacterSpacer;

public List<Shopping> ShoppingList;

private CharacterScript NewCharacterScript;

/*********************************************Awake()******************************************/
void Awake()
{
    MakeSingleton ();
}

/******************************Create object of the script**********************************/
void MakeSingleton()
{
    instance = this;
    DontDestroyOnLoad (gameObject);
}

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

void LoadCharacters()
{
    foreach (var characters in ShoppingList) {
        GameObject NewCharacter = Instantiate (CharacterPrefab) as GameObject;

        NewCharacterScript = NewCharacter.GetComponent<CharacterScript> ();
        NewCharacterScript.CharacterName = characters.CharacterName;
        NewCharacterScript.Charcater.GetComponent<Image> ().sprite = characters.CharacterSprite;

        NewCharacterScript.GetComponent<Button> ().onClick.AddListener (() => CharacterClicked (NewCharacterScript.CharacterName, NewCharacterScript.Charcater));

        NewCharacter.transform.SetParent (CharacterSpacer, false);
    }
}

void CharacterClicked(string CharacterName, GameObject Char)
{
    StartCoroutine (IncreaseScale (Char));
}

IEnumerator IncreaseScale(GameObject TempCharacter)
{
    int i = 5;
    while (i > 0) {
        yield return new WaitForSeconds (0.1f);

        Vector3 TempVector = TempCharacter.GetComponent<RectTransform> ().localScale;
        TempVector.x = TempVector.x + 0.2f;
        TempVector.y = TempVector.y + 0.2f;
        TempCharacter.GetComponent<RectTransform> ().localScale = TempVector;

        i--;
    }
}

This code triggers click event and also it increases scale but of last clone, not of clicked prefab clone.
What I am missing, I can't understand. What should I correct in this.
and Yeah! I am also attaching code of a script that I've added on prefab.

public class CharacterScript : MonoBehaviour {

public string CharacterName;
public GameObject Charcater;
}

sentences:
How to make a simple dialog system with yes/no options and pages? I recently made dialogues. Now I want to add the option to choose yes/no when the dialogue is finished (if it has a choice).

Adding buttons to the dialogue is no problem, the problem I'm having is that I want a "generic" dialogue system. By that I mean, I might have 200 NPCs, and depending on which NPC I am talking to, the yes/no buttons will react differently. This is where I'm stuck. How will the buttons know which methods to call?

Say I have one NPC that offers to sell me an item for 100 gold, and another NPC that offers to show me around the village. How will my system know which functions to call when I press "Yes"?

All I can find on this subject is really complicated using trees and things I don't fully understand yet, and don't really need, since my system is very simple.

sentences:
Camera Math for Directions I have a Camera object that has the variables:

class Camera : Object
{
    public:
        float positionX, positionY, positionZ;
        float directionX, directionY, directionZ;
        int speed;
}

The positions are what I will draw my scene's position based on, the direction is a value between 0 and 1 that I will multiply for the speed to get the next position:

if(keyboardInput.GetKeyState(Key::ArrowUp) == KeyState::Pressed)
{
    _viewCamera.positionX = _viewCamera.directionX * _viewCamera.speed;
    _viewCamera.positionY = _viewCamera.directionY * _viewCamera.speed;
    _viewCamera.positionZ = _viewCamera.directionZ * _viewCamera.speed;
}

The problem is the rotation direction, which I'm calculating with:

if(mouseInput.GetButtonState(Button::RightButton) == ButtonState::Pressed)
{
    //Here I get how many pixels the mouse moved between the X and Y axis with mouse sensitivity accounted for
    float rotationX = mouseInput.GetMouseMoveX();
    float rotationY = mouseInput.GetMouseMoveY();

    _viewCamera.directionX = sin(rotationX * 3.1415/180);
    _viewCamera.directionY = sin(rotationY * 3.1415/180);

    _viewCamera.directionZ = cos(rotationX * 3.1415/180);
}

There is something missing here, but I can't get it right.
The direction when I'm looking to the left or right works fine, but when I look up or down I'm not taking into account the rotationY for calculating the Z direction.

This means, if I'm looking straightly down, I'm not supposed to move forward or backwards, just down along the Y axis. But I'm going forward/backward because I'm not calculating the rotationY in the directionZ.

I tried subtracting the cos(rotationY) to directionZ, but the movement didn't felt right (was pretty weird actually).

What's the proper math so I get the correct movement along all axis?

sentences:
Godot C++ NativeScript version not rendering multimesh instance whereas GDScript version does I am new to Godot. I am aiming to create a RTS game with 10's of thousands of units and for it to run smoothly. So I'm looking to use GDNative C++ with the Visual Server to handle updating and moving the units and GDScript for everything else.
The following script in GDScript successfully renders a single multi mesh cube at the center of the screen.
extends Spatial

func _ready():

    var meshRid=preload('res://new_cubemesh.tres').get_rid()
    var multimesh = VisualServer.multimesh_create()

    VisualServer.multimesh_allocate(multimesh, 1, VisualServer.MULTIMESH_TRANSFORM_3D,
    VisualServer.MULTIMESH_COLOR_NONE, VisualServer.MULTIMESH_CUSTOM_DATA_FLOAT)
    VisualServer.multimesh_set_mesh(multimesh, meshRid)

    var instance = VisualServer.instance_create()
    var scenario = get_world().scenario

    VisualServer.instance_set_scenario(instance, scenario)
    VisualServer.instance_set_base(instance, multimesh)

I have implemented the alternative In GDNative (C++) and while it doesn't crash and does run the code, it does not render the cube. Camera is in correct position to observe the cube at 0,0. I've just re-purposed the GDNative C++ tutorial for now.
I really like the community here and the engine so far, so hopefully I am just misunderstanding something here and it is possible what I am trying to achieve.
Thank you for your time, c++ scripts below.
gdexample.cpp
#include "gdexample.h"

using namespace godot;

void GDExample::_register_methods() {
    register_method("_process", &GDExample::_process);
    register_method("_ready", &GDExample::_ready);
}

GDExample::GDExample() {
}

GDExample::~GDExample() {
    // add your cleanup here
}

void GDExample::_init() {
    // initialize any variables here
    base=5;
}

void GDExample::_ready(){

    visual = VisualServer::get_singleton();
    loader = ResourceLoader::get_singleton();

    Ref<Resource> meshResource = loader->load("res://new_cubemesh.tres");
    RID meshRid = meshResource->get_rid();

    multimesh = visual->multimesh_create();
    visual->multimesh_allocate(multimesh, 1, visual->MULTIMESH_TRANSFORM_3D, visual->MULTIMESH_COLOR_NONE, visual->MULTIMESH_CUSTOM_DATA_FLOAT);
    visual->multimesh_set_mesh(multimesh, meshRid);

    RID instance = visual->instance_create();

    Ref<World> world = get_world();
    RID scenario = world->get_scenario();

    visual->instance_set_scenario(instance, scenario);
    visual->instance_set_base(instance, multimesh);

}

void GDExample::_process(float delta) {
    return;
}

Let me know if you need gdexample.h or gdlibrary.cpp and I can add, the formatting gets messed up if I include them here for some reason. It's basically just the tutorial stuff though.

sentences:
How to make far block graphically better? What calcules can I do to make far objects looking better?

My game

Here's what I see if I go back with the camera in my test-rendering scene:

As you can see the result is not one of the bests: borders are not defined well and the texture itself is not nice to see.

Minecraft

Here's for example an image of Minecraft far blocks rendering:

As you can see the result is better than mine. Minecraft seem blurring far blocks or something like that.

Trove

This is another game cube-based called Trove.

Here I appreciate how it defines block borders by treading them with a black line.

TO MAKE IT SHORT:

EXCLUDING LIGHTS!!!

(I know that lights make their part in graphical improvement but I think that there is something more in mc and trove shaders)

1) How can I blur texture like Minecraft does? (I don't know actually if its a blur)

2) How can I highlight borders of the block like Trove does?

P.s: I'm using OpenGL 3.1+!

sentences:
How can I make video games if I don't like programming? I am studying C++ code in my school (my major is computer programming). Honestly, my grades are not so good, and assignments are really hard. Sometimes I feel sad that I will spend 8-10 hours per day coding (which is stressful) in the future for my job.

But I still want to make video games. Maybe this is the only reason why I am taking all of these stressful courses. I always write down plots, stories, characters, fictional gaming worlds... Once, I thought I should study artistic technology such as game design and not computer technology such as C++, C#, etc.

However, most of popular game designers (or directors) such as Kojima, Miyamoto, etc. used to be good programmers. Companies actaully assign programmers to directors because they understand how to make a game.

I've try to find other colleges or universities where they teach game design programs. However, one article that lists rank 10 game design schools in North America seems untrustful because the survey company only scores it from intervews of students.

Once, I tried to attend Art Institute of Vancouver which is rank 7 according to that article. However, one programmer who used to be an instructor in there told me the truth: the employement rate of graduated students is low.

How can I have a future making games if I don't like programming?

sentences:
Pseudo random number generation in compute shader Using a C# script in Unity3D to control a HLSL compute shader, I'm trying to generate pseudo random numbers on the gpu. Following along with
GPU Gems 3 Hybrid Tausworthe method
and another thread Pseudo Random Number Generation on the GPU, I've come across an issue.
The problem:
the resulting texture appears to be one solid color. If I run the shader multiple times, I get a different solid color texture result every time, but the entire texture is the one color.
Compute shader code
#pragma kernel CSMain

RWTexture2D<float4> result; // 256 resolution texture to write to
uint4 randSeed;  //four uniform random numbers generated in C# script

struct RandomResult
{
    uint4 state;
    float value;
};

uint TausStep(uint z, int S1, int S2, int S3, uint M)
{
    uint b = (((z << S1) ^ z) >> S2);
    return ((z & M) << S3) ^ b;
}
uint LCGStep(uint z, uint A, uint C)
{
    return A * z + C;
}
RandomResult HybridTaus(uint4 state)
{
    state.x = TausStep(state.x, 13, 19, 12, 4294967294);
    state.y = TausStep(state.y, 2, 25, 4, 4294967288);
    state.z = TausStep(state.z, 3, 11, 17, 4294967280);
    state.w = LCGStep(state.w, 1664525, 1013904223);

    RandomResult rand;
    rand.state = state;
    rand.value = 2.3283064365387e-10 * (state.x ^ state.y ^ state.z ^ state.w);

    return rand;
}

[numthreads(8, 8, 1)]
void CSMain(uint3 id)
{
    result[id.xy] = HybridTaus(randSeed).value;
}

Do I need to save the state on the gpu? If so, how would I do that? Do I need to deallocate the memory afterwards?
I did try to assign the result of the HybridTaus() function to randSeed in hopes that it would use the new value in the following HybridTaus(randSeed) call, like this:
[numthreads(8, 8, 1)]
void CSMain(uint3 id)
{
    RandomResult rand = HybridTaus(randSeed);
    randSeed = rand.state;  // re-assign randSeed with the new state

    result[id.xy] = rand.value;
}

but to no avail.

sentences:
Enable/Disable an image inside an if statement Basically i have a code that changes the skybox after killing x amount of enemies, and i want to enable and disable four pictures inside the two if statements. I tried making three public images, set them to false and then enable them inside the every if statement but i'm pretty sure that's not how it works. I'm a noob. Here's the code:

public class enemyCount : MonoBehaviour {

    public static int enemiesCount = 15;
    public Material mat1;
    public Material mat2;
    public Material mat3;

    void Start () {
    }

    void  Update (){
        print("Enemy Count is " + enemiesCount);

        if(enemiesCount <= 10)
        {
            Debug.Log("Level 2!!!");
            RenderSettings.skybox = mat2;
            //Heres should display image number 1
        }

        if (enemiesCount <= 5) {
            Debug.Log ("Level 3!!!");
            RenderSettings.skybox = mat3;
            //Here should display image number 2
        }

        if (enemiesCount <= 0) {
            Debug.Log ("YOU WON");
        }
    }
}

sentences:
Rotation pitch/yaw reverse problems when picking a tile (2.5D) Set-up: 3D world, isometric sprite rendering (4 fixed angles).
This transform matrix is used as camera:

 _transform =
            Matrix.CreateRotationZ(Roll) *
            Matrix.CreateRotationX(Pitch) *
            Matrix.CreateTranslation(new Vector3(-cameraPosition.X , -cameraPosition.Y, -cameraPosition.Z))* //this matrix controls camera position
            Matrix.CreateScale(new Vector3(_zoomScale)) * //scale representing zoom level. This one applies to the textures too
            Matrix.CreateScale(new Vector3(_textureScale)) * //world scale to fit current texture pixel size.
            Matrix.CreateTranslation(new Vector3((_port.screenWidth / 2) - TileOffset, _port.screenHeight / 2, 0)) //offset for having focus in center of screen instead of top left corner + little offset so it will be a tile center
            ;

Roll=-45, Pitch=60. Result:

I've hoped to find a quick picking solution in the inverse matrix:

_inverseTransform =
           Matrix.CreateTranslation(new Vector3(-(_port.screenWidth / 2) + TileOffset, -_port.screenHeight / 2, 0))*
            Matrix.CreateScale(new Vector3(1/_textureScale)) *
            Matrix.CreateScale(new Vector3(1/_zoomScale)) *
            Matrix.CreateTranslation(new Vector3(cameraPosition.X, cameraPosition.Y, cameraPosition.Z))*
            Matrix.CreateRotationX(-Pitch)*
            Matrix.CreateRotationZ(-Roll)
            ;

It doesn't work as expected.
If i remove rotation from matrix build, everything works. The interesting part is if i leave roll component only, everything works too.
I've tried transposed matrices, inverted matrices, rotating on -angle, FromPitchYawRoll matrix (inverted/transposed/-angles). Every time roll works, pitch and yaw aren't.
Pitch only/yaw only can't be inverted too.

It's probably something basic in the matrix math/rotation principles, but i'm failing to grasp it. Any help would be appreciated.

--code removed, not relevant to the case--

Some gifs for better understanding.
Current implementation do this:

If we switch the pitch off, inverse matrix work as intended (white dots mark real tiles grid. Graphical tiles aren't rotated, of course.)

EDIT:
After some matrix calculations i've realised simple thing. Let's point the mouse on the tile (0,2). If i dump all transformations but pitch by several degrees, then tile (0,2) will be drawed somewhere on (0, 1.25).

But if i'll apply inverted (or transposed, or "rotate by -value") matrix to the mouse position (0,2), i'll get same (0, 1.25), which means that the mouse is pointing at (0,1) tile. While it should point at (0, 3). And i don't know how to invert this correctly.

I've also discovered this. But, as you can see in the first answer, knight666 is using scale instead of pitch rotation.

sentences:
A canvas to let through a given layer I have two canvases, both of them having a UI element on them.
At some point, both canvases will be active in the game (I just act like so, I want to make sure that my game works even if that's the case) and I want one of them to never block the other canvas's layer.

These two, let's say Canvas1 is on layer UI and is responsible for character jumping.
Canvas2 is on layer toggle time scale and it's job is to switch between timescale 0 and 1.
I want Canvas2 to be ALWAYS accessible, so its layer, toggle time scale is NOT blocked by the first canvas.
I tried messing around with the Blocking Mask but that didn't help, sometimes the ray still gets blocked out. How to set up those Blocking Masks for my canvases to work?

sentences:
Which Terrain LOD algorithm should I use for super large terrain? My game needs a terrain, the requirements are:

Freely Zoom in & zoom out, like GoogleEarth. Max resolution when zooming in ~100 meter, Max range when zooming out ~2000km (a whole country scale).
Freely fly over to any direction with any height; Freely rotate camera; Framerate should not a bottleneck for all those basic camera movement.
Support large heightmap data. I got mine real world elevation data from NASA with 7.5arc resolution, around 30k * 15k for a whole country.
Also I need to consider the spherical earth surface curvature other than using a planar map. But this should be easy if I just map each vertex into spherical coordinates. I am not build the whole planetary LOD so it's not even a problem.

I noticed there are many different LOD algorithm out there. For example:

ROAM: very classic algorithm, most done on CPU;
Geomipmapping: store the whole heightmap with best resolution as vertex buffer, with different LOD in vertex index. Then determine LOD and draw range in vertex index at runtime.
CDLOD:
Geo Clipmapping: I am feeling excited about this one since it claims to load all 200k * 100k US heightmap into video card memory and compressed ~300M, it seems to meet all my requirements. see source paper. And this is paper in 2004 and think about the video card at that time!

That's pretty much all I know about terrain LOD.
I am not familiar recently study/research in this area.
Is Geo clipmapping my best option? What else algorithms are also useful to consider?

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:
Random 100x100 map using all levels from 1 to 100 I'm developing a game where players walk though a 100x100 grid of different rooms.
Each room has a level associated with it starting from lvl 1 to lvl 100.
The map is divided into 10x10 areas and in the middle of each area there's a 2x2 "castle" which players must conquer in order to access next levels castles (so if players start off at lvl 1 they need to conquer the lvl 1 castle before being able to enter lvl 2 castles).
Each room in a castle (2x2 area in the middle of each 10x10 area) has the same level and there must be a castle for each level from 1 to 100.
As for now I was generating the whole map "statically" and use the matrix blur to interpolate room levels between castles.
What I would like to achieve is having a seeded function f(x,y) that returns the level of the room at position (x,y) without pre-defining the matrix.
I checked out Perlin Noise functions, but it doesn't guarantee each level between 1 and 100 is taken nor the right position of the "castles".

The image above is the starting point of the game map, lower levels of green represent lower room levels, the blue squares in the center are the castles. This image is then blurred preserving just the castles level.
Players can move around the map and will meet harder challenges in higher level rooms. The goal is reaching level 100 by spotting and conquering each castle in sequence.

sentences:
Problem with rendering multiple textures from same image (LWJGL 3) I have started with LWJGL3 and trying to built game engine. I'm stuck on generating terrains.
I have one image that contains two textures.

So now for example I want to generate terrain with only texture 2, so my texture coordinates looks something like this :
textures :
(0.6f,0f)
(0.9f,1f)
.....

Everything is fine if terrain is not long, but if I stretch terrain on z-axis, terrain is using texture 1.
As you can see on image.
I just can't understand why is doing that ?

sentences:
Transparency on pixel level? I'm using java and I do pixel-by-pixel rendering (a pixel array from an ARGB BufferedImage). So a color is 0xAARRGGBB. Now how can I render a transparent color? I guess that I should manipulate the existing pixel and not overwrite it. I can make color addition simply:

public static int additiveColor(int c1, int c2) {
        int red = (c1 & 0x00ff0000) + (c2 & 0x00ff0000);
        int grn = (c1 & 0x0000ff00) + (c2 & 0x0000ff00);
        int blu = (c1 & 0x000000ff) + (c2 & 0x000000ff);
        return 0xff000000 + (red > 0x00ff0000 ? 0x00ff0000 : red) + (grn > 0x0000ff00 ? 0x0000ff00 : grn) + (blu > 0x000000ff ? 0x000000ff : blu);
    }

So to set a pixel to a sum of two colors I just do this:

pixels[i] = additiveColor(c1, c2);

How can I do transparency?

sentences:
Is there any simple game that involves psychological factors? I need to find a simple game in which several people need to interact with each other. The game should be simple for an analysis (it should be simple to describe what happens in the game, what players did). Because of the last reason, the video games are not appropriate for my purposes. I am thinking of a simple, schematic, strategic game where people can make a limited set of simple moves.

Moreover, the moves of the game should be conditioned not only by a pure logic (like in chess or go). The behavior in the game should depend on psychological factors, on relations between people. In more details, I think it should be a cooperation game where people make their decisions based on mutual trust. It would be nice if players can express punishment and forgiveness in the game.

Does anybody knows a game that is close to what I have described above?

ADDED

I need to add that I need a game where actions of players are simple and easy to formalize. Because of that I cannot use verbal games (where communication between players is important). By simple actions I understand, for example, moves on the board from one position to another one, or passing chips from one player to another one and so on.

sentences:
Draw line inwards in Unity using Line Renderer Is there a way to draw the line inwards instead of from the center using Line Renderer in Unity?

Another option would be to move the Vector points inwards by half the width of the line, but If I have a complex polygon how do I do it uniformly?

EDIT: Found this https://stackoverflow.com/questions/1109536/an-algorithm-for-inflating-deflating-offsetting-buffering-polygons which may be useful

sentences:
Can I use PBOs for textures in iOS? As far as I can see, there is no GL_PIXEL_UNPACK_BUFFER. Also, the OpenGL ES 2.0 specification (and as far as I know, no iOS device currently supports OpenGL ES > 2.0) states that glMapBufferOES() can only use GL_ARRAY_BUFFER as a target, yet glTexImage2D() and glTexSubImage2D() only seem to use PBOs if GL_PIXEL_UNPACK_BUFFER is bound.

The OpenGL documentation for glBindBuffer() also states that:

  GL_PIXEL_PACK_BUFFER and GL_PIXEL_UNPACK_BUFFER are available only if the GL version is 2.1 or greater.

So, can I use PBOs for textures? Am I missing something obvious?

sentences:
How to handle tiles on top of players I am creating an 2d bird view tile game using the pixijs render framework.
Like pokemon or oldtime zelda.

In those games you sometimes walk behind buildings where the tile would be drawn on top of the player.

I am using an multidimensional array for each tile properties.
Where you can set ground level images and level on top of ground level images.

The 'z-index' can be changed.

Should I create an new property to flag it as an tile that can be on top of the player? Where all those tiles with that property are drawn on top of the player.
But there is an possibility that you can climb/walk on the building and the player should than be drawn on top of the tiles.

You should take the following into consideration

the game is an multiplayer game.

This could be an conflict if all the players/characters (the player,npc, cpu) are one layer and the tiles that can be drawn on top of the player are one layer. Because for example: one player is walking on top of the building and one is behind the building. You cant change the z-index of the player one lower. Because the player behind the building wil look like he is on top of it because the player is drawn on top of it by the changed z-index.

you can be drawn on top of the tile level (like walking om top of the building or mountain)
tiles can change (a building that is going to be destroyed for example) thus are not fixed

So how can I handle tiles on top of a player which can be also beneath one player but not the other?

sentences:
NGUI sprites become blurry on android I have this screen in the editor made with NGUI and 8 sprites:

But when I build it for android and open the game the same sprites on the screen looks blurry

I don't know what could be causing this, I have all the sprites in Point(no filter) mode, no mip maps and in True Color. Their Max Size is according to each sprite size.

I haven't touched anything strange in the atlas maker(it's only one big atlas), so it should have all default settings. What could possible be the cause of this? I have been searching but I haven't found anyone who had the same problem. Is there a setting I could be missing?

sentences:
Rotation and translation like in GTA 1 OpenGL Okay, so I have a figure in XZ plain. I want to move it forward/backward and rotate at it's own Y axis, then move forward again in the rotation's direction, like the character in GTA 1.

Code so far:

Init:
  spaceship_position = glm::vec3(0,0,0);
  spaceship_rotation = glm::vec3(0,0,0);
  spaceship_scale = glm::vec3(1, 1, 1);

Draw:
  glm::mat4 transform = glm::scale<float>(spaceship_scale) *
                        glm::rotate<float>(spaceship_rotation.x, 1, 0, 0) *
                        glm::rotate<float>(spaceship_rotation.y, 0, 1, 0) *
                        glm::rotate<float>(spaceship_rotation.z, 0, 0, 1) *
                        glm::translate<float>(spaceship_position);
  drawMesh(spaceship, texture, transform);
Update:
   switch (key.keysym.sym) {
   case SDLK_UP:
       spaceship_position.z += 0.1;
       break;
   case SDLK_DOWN:
       spaceship_position.z -= 0.1;
       break;
   case SDLK_LEFT:
       spaceship_rotation.y += 1;
       break;
   case SDLK_RIGHT:
       spaceship_rotation.y -= 1;
       break;
    }

So this only moves on the Z axis, but how can I move the object on both Z and X axis where the object is facing?

sentences:
Custom shadowmapping in Unity not working properly To experiment with a certain technique, I'm implementing my own shadow mapping in Unity. I'm using a camera for the light "view", which is rendered to a RenderTexture after being post-processed with the following shader:

Shader "Custom/DepthGrayscale" {
  SubShader {
     Tags { "RenderType"="Opaque" }

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

        sampler2D _CameraDepthTexture;

        struct v2f {
           float4 pos : SV_POSITION;
           float4 scrPos:TEXCOORD1;
        };

        //Vertex Shader
        v2f vert (appdata_base v){
           v2f o;
           o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
           o.scrPos=ComputeScreenPos(o.pos);
           //for some reason, the y position of the depth texture comes out inverted
           o.scrPos.y = 1 - o.scrPos.y;
           return o;
        }

        //Fragment Shader
        half4 frag (v2f i) : COLOR{
           float depthValue = tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.scrPos)).r;

           return fixed4(depthValue, 0.0, 0.0, 0.0);
        }
        ENDCG
     }
  }
  FallBack "Diffuse"

}

With a width and height of 2048 for the Render Texture and the color format R Float for 32-bit precision.

The objects in the scene then have the following shader that takes the projection * view matrix of the light and "depth" texture as input. (Basic shadow mapping with bias)

Shader "Tutorial/Display Normals" {
    Properties {
        _CameraTex ("Camera texture", 2D) = "white" {}
    }
    SubShader {
        Pass {

            CGPROGRAM

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

            uniform float4x4 lightMatrix;

            struct v2f {
                float4 pos : SV_POSITION;
                float3 worldPos : COLOR0;
                fixed3 color : COLOR1;
            };

            v2f vert (appdata_base v)
            {
                v2f o;
                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
                o.worldPos = v.vertex.xyz;
                o.color = v.normal * 0.5 + 0.5;
                return o;
            }

            uniform sampler2D _CameraTex;

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 coords = mul(lightMatrix, fixed4(i.worldPos, 1.0));
                coords /= coords.w;

                coords.x = (coords.x + 1.0) / 2.0;
                coords.y = (coords.y + 1.0) / 2.0;
                coords.z = (coords.z + 1.0) / 2.0;

                //return fixed4(coords.z, 0.0, 0.0, 1);
                float lightDepth = tex2D(_CameraTex, fixed2(coords.x, 1.0 - coords.y)).r;
                float depth = coords.z;

                if (depth < lightDepth + 0.005) {
                    return fixed4(1.0, 1.0, 1.0, 1.0);
                } else {
                    return fixed4(0.1, 0.1, 0.1, 1.0);
                }
            }
            ENDCG

        }
    }
}

The result of this is perfect with a plane and cube:

The red plane displays the shadow map and the camera represents the light.

However, when using a more complex model like Sibenik, the following happens:

When I move it slightly, the shadow on the plane is suddenly correct, but the shadow on the church model itself is still wrong:

What could be the problem?

sentences:
Sniper aim prediction I'm trying to make a sniper aim prediction for an Unreal Engine 4 game. I've found this interesting question Projectile Aim Prediction with Acceleration, and I tried to implement in C++ what DMGregory said. The result I got isn't bad at all, but I've some doubts about something in his explanation.
First, what does he mean with v_T? Should I calculate it as FVector v_T = targetVelocity - myVelocity; or as FVector v_T = targetVelocity - myPosition;? The vectors myVelocity and myPosition are respectively the velocity and the position of the shooter (me).
Then, I noticed that the sniper projectile trajectory doesn't seem to be a perfect parabola, so I avoided the v_p calculation, and I've simply calculated the predicted target position as

FVector predictedTargetPosition = targetPosition + targetVelocity * deltaTime + targetAcceleration * deltaTime * deltaTime * .5f;

where the 3 vectors targetPosition, targetVelocity and targetAcceleration are relative to the game world axis.  After that, I simply added to the Z component of the predictedTargetPosition the following amount:

recalculatedTargetPosition.Z += fabs(bulletAcceleration.Z) * deltaTime * deltaTime * .5f;

in order to compensate the loss of height of the projectile in time.

What do you think about it?

Thanks in advance.

sentences:
Include a custom font when publishing in Visual Studio XNA I have a custom font called "Gold Box Games" that I want to use in a game I'm making. I have the font installed on my computer and it works just fine in the program when I run it in test. However, when I examined the publish settings I noticed I could not include that font with the things the publish-created installer makes.

How do I include a custom font to be pushed along with the rest of my files built with the Publish Wizard? This font will also need to be installed when another user runs my program (installed during that first 'setup' phase when they run the game the first time.)

sentences:
Good design for skills (heal,dmg etc) I'm trying to create a good designed "skill system" for my game, but curious if anybody knows a good design?

Skills can Heal,Damage ofc, they can be single target,multiple(chain), AOE.
Instant dmg/heal or overtime. some skills can do damage and heal together and so on.

Maybe a little bit to complex for me to start, but can anybody help me?

Update:

lets say i have a Character class, and each character ofc has hitpoints and also a method TakeDamage(float amountOfDmg,Character damage_causer);

should this TakeDamage(..) method be used inside each Skill class e.g.?:

class AnySkill
{
 public:
 void Execute()
 {
   *(somehow get the character who takes damage)*->TakeDamage(damage, *(somehow get the causer)*)
 }

 private:
 float damage;
}

Would this be a good design?

class Character
{
 public:
 void SetTarget(Character* target)
  {
    target_ = target;
  }
 void TakeDamage(float damage, Character* causer)
 {
   hit_points_ -= damage;
 }
  void UseSkill1()
  {
    skill1->Execute(this,target);
  }

private:
 Character* target_;
 AnySkill* skill1;
 float hit_points_
}

class AnySkill
{
 public:
 void Execute(Character* causer,Character* taker)
{
  taker->TakeDamage(damage_value,causer);
}

 private:
 float damage_value_;
 Character* target_;
}

And somewhere:

player->SetTarget(enemy);

if(skill1_key_pressed)
{
  player->UseSkill1();
}

sentences:
How do I program procedural generation with objects that must fit together in specific ways? I'm working on a game where I have to procedurally generate a large open room building. I'm using Unity, but I think this applies to any engine. The room is made up of different wall segments. What makes this difficult for me is the ends of the segments have to join with a similar end of another segment. There are 2 types of ends. Flat and angled. The purpose of the angled ends is to create an outside corner. Meaning for example a flat wall then turns into a hallway it would use angled ends to make the transition.
The method I tried initially was to define each segment type and what the follow up modules could be. Meaning SegmentA can be followed by: SegmentB, SegmentC, and SegmentD. Then I would randomly select which  of those to add and place it, then move on and repeat. It works ok, but I feel like there is a better way to do it. It's pretty unwieldy and is kind of prone to bugs. I also run into issues trying to close the loop and return to the original segment.

sentences:
How to detect when client state drifts from server state? I'm obviously talking about an authoritative server to which client sends commands and gets state updates.

My question is when I get a position update and know how many milliseconds ago it was generated on the server how do I detect and fix the drift?

I'm currently just blocking the client from going too far away from the last update position by smoothly moving him towards that position. Which works fine on connections with low ping, but wont work with 200+ ping.

sentences:
How do I translate a spherical coordinate to a Cartesian one? Could someone point me in the right direction as to how this might be achieved? 3D math / geometry often throws me.

I'm looking for something like this (ideally in C#):

public Vector3 getCartesianFor(float elevation, float asimuth, float polar)
{
   return ????;
}

sentences: Is there an easy way to create an AI opponent for the Othello game? Is there a well known AI technique to create an opponent in the game Othello (aka Reversi)?

sentences:
Java 2D Game: Collision help Ok, so in my Java2D Game, using swing/awt (I hear it is not the best to combine those), I am trying to finish collisions.

So, the problem is, the "if (player.xvel < 0) { }" and the "if (player.xvel > 0) { }" in the Block class are still being executed even though the player hasn't run into the block horizontally. How can I make it so the code is executed when the player runs/walks into the block horizontally?

My code for the collide function is below, in
Block.java:

    void collide(Player player) {
        Rectangle player_hb = new Rectangle((int) player.x, (int) player.y, (int) player.width, (int) player.height);
        Rectangle block_hb = new Rectangle(x + Display.graphics_panel.WorldX, y, width, height);

        if (player_hb.intersects(block_hb)) {
            Rectangle intersection = (Rectangle) player_hb.createIntersection(block_hb);

            if (player.yvel > 0) {
                player.jumping = false;
                player.y -= intersection.getHeight();
            }
            if (player.yvel < 0) {
                player.yvel = 0;
                player.y += intersection.getHeight();
            }
            /* Execute this code ONLY if player is intersecting a block HORIZONTALLY!! */
            if (player.xvel > 0) {
                System.out.println("You shouldn't see this unless you run into a block!" + i++);
            }
            if (player.xvel < 0) {
                System.out.println("You shouldn't see this unless you run into a block!" + i--);
            }
        }
    }

sentences:
changing a sprite width when playing a reel using Crafty.js can anyone help me with this : http://jsfiddle.net/B5UsC/20/

you can see that the sprite animation is not rendering correctly when the reel is in the last frame when animating Hardpunch is it possible to change the character width when playing a specific frame ? like you see my spritesheet does not contain a static width and height so it's a bit confusing for me

THE CODE :

// initialize the sprite
Crafty.sprite("http://i.imgur.com/bkYVEe5.png", {
    Ryu: [0, 0, plrw, plrh]
});

// initialize the component
Crafty.c("RyuAnimation", {
    init: function () {
        this.requires("SpriteAnimation,Keyboard")
        .addComponent("Ryu")
        .reel('idle', 300, [
            [0, 0],
            [plrw * 1, 0],
            [plrw * 2, 0],
            [plrw * 3, 0]
        ])
        .reel('punch', 300, [
            [plrw + 12, plrh],
            [plrw * 2 + 15, plrh]
        ])
        .reel('Hardpunch', 300, [
            [plrw * 3 - 25, plrh],
            [plrw * 4 + 32, plrh],
            [(plrw + 19) * 5 - 38, plrh]
        ]); //
        this.animate("idle", -1);

    }

    // creating the player
    plr1 = Crafty.e("2D,Canvas,RyuAnimation")
    .attr({
    x: 15,
    y: ch - 100
})
.start(3);
this.bind('KeyDown', function () {
    if (this.isDown('A')) {
        if (!this.isPlaying("Hardpunch")) {
            this.pauseAnimation().animate("Hardpunch", 1);
        }
    } else {
        this.stop();
    }

});

I read about handling complex sprite sheet with different width and height and all the answers was about creating evenly sized boxes for all sprites like this example here : How do I support animation with frames of different sizes?  but i actually couldn't understand what the mean by that and how would i do it they didn't provide an example . what is evenly sized boxes?

sentences:
What is the bare minimum I need to set up the Android SDK for Unity development? I want to import my Unity project to Android, and I need to download the Android SDK, but I do not want to download any unnecessary components.

Do I need to download all platforms, or just the latest one? I am worried about the size of Android 7.1.1 (API Level 25); the SDK Manager reports this as the latest version, but I am not sure.

I only want to import my project for Android smartphones, with no plan of publishing it. I do not want to build to Android TV or Android Wear, for example. Do I need to download all of the contents under the specific platform? I ask because there are Android TV and Android Wear system images, and the files can get quite large.

sentences: I can't import player relative controls in unity I'm developing a mobile game in Unity 5 but I can't find player relative control asset anywhere.Can you help me with this?

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:
Depth Buffer not working in XNA? I'm stumped.  I have been fighting this for about 2 hours now.

Here are the interesting parts of my code:

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    var time = gameTime.TotalGameTime.TotalSeconds;
    this.position = new Vector3(
        2.0f * (float)Math.Sin(time),
        2.0f * (float)Math.Cos(time),
        2.0f * (float)Math.Cos(time / 4));

    effect.World = Matrix.Identity;
    effect.View = Matrix.CreateLookAt(this.position, Vector3.Zero, Up);
    effect.Projection = Matrix.CreatePerspectiveFieldOfView(1.5708f, (float)this.Window.ClientBounds.Width / this.Window.ClientBounds.Height, float.Epsilon, 500.0f);

    base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
    var count = this.SetUpVertices() / 3;

    this.GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.CornflowerBlue, 1.0f, 0);

    this.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
    this.GraphicsDevice.BlendState = BlendState.Opaque;
    this.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;

    foreach (var pass in this.effect.CurrentTechnique.Passes)
    {
        pass.Apply();
        this.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, count, VertexPositionTexture.VertexDeclaration);
    }

    base.Draw(gameTime);
}

sentences:
Matrix for 2D perspective I'm trying to determine whether what I'm attempting to achieve is even possible mathematically. I'm obviously not a seasoned game developer so I'm having trouble even coming up with the terminology to pose this question.

My 2D game (and I must stress that it is 2D) has a perspective such that the "camera" looks down at the game world from 45 degrees. Here's a rough sketch describing the look I'm trying to achieve:

As objects move from foreground to background (such as the red box pictured), they not only get smaller but are moved towards the center of the screen. So whilst the on-screen representation is rectangular, the actual game world has this shape:

Now I suspect I can do all this without using a matrix. I've already got the scaling working and don't think it would be too difficult to offset on the x axis objects according to their distance from the camera.

However, what I'd really like to know is whether I can encompass this perspective inside a simple matrix. I've had a look around the web but have got lost in a sea of nomenclature that I don't understand and information that doesn't appear to be relevant to me (such as 3D camera positioning, etcetera).

Can anyone tell me whether I'm barking up the wrong tree? If it is possible, can someone point me towards some articles or blog posts that describe this in detail?

sentences:
Create a WebGL native plugin I am trying to create a WebGL plugin and I read in the docs here:
http://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html

But I'm not sure I understand.

I created a file in Assets/Plugins/WebGL called DomPlugin.jslib:

var DomPlugin = {
    ReadFromDom: function()
    {
        var mapStr = document.getElementById('my-elm').innerText;
        var buffer = _malloc(mapStr.length + 1);
        writeStringToMemory(mapStr, buffer);
        return buffer;
    }
};
mergeInto(LibraryManager.library, DomPlugin);

Within one of my C# scripts, I created a method declaration like so:

[System.Runtime.InteropServices.DllImport("__Internal")]
private static extern string ReadFromDom();

Then I call this external method like so:

private string ReadData()
{
    if (Application.platform != RuntimePlatform.WebGLPlayer)
        return testData.text;

    return ReadFromDom();
}

My WebGL Template page has an element with ID my-elm defined above %UNITY_WEBGL_LOADER_GLUE%

When I deploy I find this error:

Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)

sentences:
How fill gutter using ID3DXTextureGutterHelper interface? Using UVAtlas (Direct3D 9) Packed charts are separated by a
  user-specified gutter width. The gutter width is the amount of
  separation between charts, and allows for bilinear interpolation and
  mip-mapping to avoid rendering artifacts at chart boundaries. D3DX
  provides an interface for automatically filling in these gutters - see
  ID3DXTextureGutterHelper for more information.

How I can do that? I call ApplyGuttersTex, after calling ResampleTex but nothing changed.

sentences:
How do I get my polygons to be lighted by either side? Okay, I am using Ogre3D and Gorilla(2D library for ogre3D) and I am making Gorilla::Screenrenderables in the open scene.

The problem that I am having is that when I make a light and have my SR(screenrenderable) near it, it does not light up unless the face of the SR is facing the light...

I am wondering if there is a way to maybe set the material or code(which would be harder) so the SR is lit up whether the vertices of the polygon are facing the light or not. I feel it is possible but the main obstacle is how I would go about doing this.

sentences:
How to iterate tiles around an index tile? I am not exactly sure how to state this question, what I basically want to do is to seed a tile based map with some values. So I asked myself how I could spread some values outgoing from a start tile, with values being reduced the further I get away from that start tile. Does that make any sense? What algorithms are there to calculate spreading of fire for example, or pollution?

[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,S,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,0,
 0,0,2,3,3,3,2,0,
 0,0,2,3,X,3,2,0,
 0,0,2,3,3,3,2,0,
 0,0,2,2,2,2,2,0,
 0,0,0,0,0,0,0,0,]

And what if I have another starting tile,
can the values be added?

[2,3,3,3,2,0,0,0,
 2,3,Y,5,4,2,2,0,
 2,3,5,6,5,3,2,0,
 2,2,4,5,X,3,2,0,
 0,0,2,3,3,3,2,0,
 0,0,2,2,2,2,2,0,
 0,0,0,0,0,0,0,0,]

Maybe it's like an explosion. Not sure what to look for though, I cannot find anything in my endless searches on tile based games.

sentences:
Loading and using an HLSL shader? I've been looking everywhere and all I can find are tutorials on writing the shaders. None of them showed me how to incorporate them into my scene.

So essentially:

Given an hlsl shader, if I were to have a function called drawTexturedQuad() and I wanted the shader to be applied to the result, how exactly could I do this?

Thanks

sentences:
Reading XML working in my computer but not in my Android phone Following code works perfect in my computer but when I try to run it in my Android Phone, it does not work.

string path = @"Assets\Layout\XML\file" + select.ToString() + @".xml";
XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<Name>));
StreamReader sr = new StreamReader(path);
List<Name> listnames = (List<Name>)xmlSerializer.Deserialize(sr);

How can I make the code work in my Android Phone?

PS: It is C# , Unity.

sentences:
Math question: How to move/extrude a cube's face in Unity? The short question is: What's the math to move the face of a cube? I.e. how to stretch (or shrink) a cube in the direction of one of its faces?
Here's a picture:

The camera shows a cube (left). When the user clicks and drags on one of the faces (yellow), the face (it's vertices) should follow the mouse and as a result expand (or shrink) the cube in the given direction (like the right cuboid in the picture above).
Please note that this should be done ingame, by moving the vertices, not by scaling the object.
Now, I already have the selected face and all the vertices of its four corners. Further, the distance how far it should be moved is also known.
The question is, what needs to be done with the vertices to pull the face out (or push it in)? Whats the math?
Your help is very much welcome. Thank you.

sentences:
As a client, trying to get a coder/programmer to develop my ideas into a functioning program, what should I be providing to my developer(s)? I am the director of a start-up game development group (I say "group" because it is not yet an official company). I have recently gained the willingness of a few coders who are willing to help me with the project, but they are asking for documentation.

I understand the need for documentation, and I have a lot of our ideas in a few different documents, but I imagine that I will want to organize it in some way that the developers can understand individually as well as collectively.

Is there anything I should leave out of such a document; if so, what kind of things? Is there an appropriate template for this kind of document; if yes, where can I find it? Is there anything else that I should know to offer the coders before they begin their work?

I know that I have many questions being asked here. I hope that isn't a problem. Thank you in advance for any guidance!

sentences: Dynamically Deformable Terrain In Game Engine I am looking for a game engine that is open to the public for free or at a payed price that allows for any reasonable way of doing deformable terrain over a network. The closest I have found to this is in udk where one can build a terrain in 3ds, cut it up, and import different chunks into udk, and fracture them. Unfortunately after a few hours work I discovered that this doesn't seem to work too well for what I am trying to do. Can anyone recommend a game engine, or even a rendering engine that supports this? Programming other features into a rendering engine is not an issue for me.

sentences:
Making a text only console game in C#. Can't figure out a way to organize states When I say states I mean like what you would call scenes in unity. As in each phase of the game. But in straight up code for a console application in C#.

Example:
Name select.
Race Select.
Store.
Help Screen.

I've tried organizing each phase by methods, and while loops, but i've run into a lot of trouble these ways. How should I do it?

sentences:
Projective texturing in DirectX11 I'm trying to implement reflections on flat surfaces and render a simple scene with a reflection. So I'm rendering the scene from the point of view of a camera symmetrical to the reflection plane and then I pass the resulting rendered scene as a shader resource to the shader that renders the quad and I use projectiv texturing by sampling the texture using the quad screen space coordinates mapped to 0 - 1:

Texture2D quadTexture;
SamplerState textureSampler;

struct PS_Input
{
    float4 pos : SV_Position;
    float2 texCoords : TEX_COORDS;
    float4 clipPos : CLIP_POS;
};

float4 main(PS_Input input) : SV_Target
{
    float2 projectiveCoords = (float2)0;
    projectiveCoords.x = (input.clipPos.x / input.clipPos.w + 1.0) / 2.0;
    projectiveCoords.y = (-input.clipPos.y / input.clipPos.w + 1.0) / 2.0;
    float4 color = quadTexture.Sample(textureSampler, projectiveCoords);
    color.a = 0.2;
    return color + float4(0.0, 0.01, 0.01, 0.0);
}

I assume that since the y and the v axis are inverted with respect to each other that I need to negate the second texture coordinate (and all the code I saw on the net do so).  But my code only works if I DON'T negate the second coordinate. If I negate the second coordinate the reflection is upside down:

The way I compute the reflected camera is I calculate the symmetric direction vector and use it in XMMatrixLookAtLH(). So when I calculate a new direction vector with a horizontal plane I should get a symmetric direction vector and the same right vector so my image is non mirrored on the horizontal axis. All works well when I don't invert the sign which is strange.

EDIT

I was not considering the fact that when rendering reflection on an horizontal plane, I have to take into account that the image being rendered is upside down with respect to the image I need to render on the surface. Not inverting the second projective texture coordinate has the effect of inverting the image (DirectX's v axis goes downwards, while projective texture coordinate y goes upwards). So when rendering a reflection on an horizontal surface I need not negate the coordinate. I need to negate both when rendering on a vertical surface (I always compute the symmetric camera direction vector and use the same world Up vector to compute the "reflected" view matrix):

float4 main(PS_Input input) : SV_Target
{
    float2 projectiveCoords = (float2)0;
    projectiveCoords.x = (input.clipPos.x / input.clipPos.w + 1.0) / 2.0;
    projectiveCoords.y = (input.clipPos.y / input.clipPos.w + 1.0) / 2.0;
    if (normal.y == 0)
    {
        projectiveCoords.x = -projectiveCoords.x;
        projectiveCoords.y = -projectiveCoords.y;
    }
    float4 color = quadTexture.Sample(textureSampler, projectiveCoords);
    color.a = 0.2;
    return color + float4(0.0, 0.01, 0.01, 0.0);
}

Now I have a new question:
everything is fine if I want to render a reflection on an horizontal plane or a vertical one. How can I render a reflection on an (arbitrarily) incined surface? using the same calculations doesn't work anymore.

sentences:
Dealing with multiple prerequisites in goal orientated action planning using A* I'm currently having difficulty reasoning about how multiple prerequisites are satisfied using the A* algorithm during planning.

Assuming the following actions (with prerequisites in brackets):

Get Material

Make Gloves (need material)

Get Iron

Make Axe (needs iron)

And the following goal (prerequisites in brackets):

Chop Tree (needs gloves, needs axe)

Now, assuming I am doing a backward search from the goal, as I understand it, I would start considering actions that have effects that directly correspond to the prerequisites of the node (this is where I think I'm going wrong).

The problem with that is, the first 2 actions to consider are Make Gloves and Make Axe. However, for this goal to be satisfied they both need to be done. If I only build my graph by linking effects to prerequisites, I only consider each of those actions once, and only choose one.

I.e. if I arbitrarily choose Make Axe that leads me to Get Iron, I don't have anything making me reconsider Make Gloves as Get Iron has no prerequisites.

For the actions and goal I had above there are many routes to solving it, below I have highlighted one to illustrate my point. As you can see, in this case I would need Get Iron to be done after Make Gloves even though their effects/prerequisites don't match in any way.

Can someone tell me where I'm going wrong in my thinking?

sentences:
For a custom game engines, what should I do if my core data is malformed or missing? I'm writing a custom engine for a game. I started this game well before I understood why I should use middleware, instead, and it's too far along to rewrite.

The vast majority of my data comes from external files, and I don't just refer to assets; I define all of my game objects through .JSON.  But, alas, I am human; occasionally my data files are invalid, or I change the format but forget to update the file, or the loader itself is flat-out buggy.

If, for whatever reason, an attempt to load some form of asset in a custom engine fails, what options do I have?

This is not a duplicate of How should I handle missing resources?, as that question is about user-facing assets like models or textures.  Bad textures can be replaced with a checkerboard, bad sounds with silence, and bad text with "ERROR".  My problem lies with data that's critical to the game even running, such as levels, game object definitions, and GUI layouts.

sentences: Different OnMouseDown functions based on where an object is clicked So my problem is I'd like to have one GameObject with multiple "OnMouseDown" functions. I have a target (classic looking bullseye) and I'd like to award a player say 10 points if they click on it, but 100 points if they click the center. Because the "OnMouse" functions don't pass in a collider I'm not sure how to go about doing this. I had an idea (which I think is a bad one) which would be to attach a small "empty" gameobject to my target prefab and give it a smaller hitbox with code that spits out 100 points instead of 10 and place that object "in front of" the other one while being attached. Again, seems wrong. Anybody else have to do this before or have a more elegant solution?? Thanks!

sentences:
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:
Ways to describe resouces I have one way - xml and code like this:

<Texture file="file_name.jpg">
  <Sprite id="ID_SPRITE_1" coordinates="0 0 64 64"/>
  <Sprite id="ID_SPRITE_2" coordinates="64 0 64 64"/>
  <Sprite id="ID_SPRITE_4" coordinates="128 0 64 64"/>
</Texture>

then parse and load it, when application starts, then use resources by id.

What another ways to describe paths and propeties of resources used by developers and why?

sentences:
Limit rotation angle I am currently trying to rotate the weapons of a spaceship towards the mouse position, but in order to avoid the collision of projectiles with the ship I want to limit the angle the weapon can turn.

I've tried doing this:

    Vector3 mousePos = Input.mousePosition;
    float range = 100.0f;
    float rotStep = 0.1f;

    Vector3 positionOnScreen = Camera.main.ScreenToWorldPoint(mousePos + Vector3.forward * range);

    Vector3 targetDir = positionOnScreen - transform.position;
    Vector3 newDir = Vector3.RotateTowards(transform.forward, targetDir, rotStep * Time.deltaTime, 0.0f);

    Quaternion lookRot = Quaternion.LookRotation(newDir);

    float xAngle = lookRot.eulerAngles.x;
    if (xAngle > 10 && xAngle <= 180)
    {
        xAngle = 10;
    }
    else if (xAngle < 350 && xAngle > 180)
    {
        xAngle = 350;
    }

    float yAngle = lookRot.eulerAngles.y;
    if (yAngle > 10 && yAngle <= 180)
    {
        yAngle = 10;
    }
    else if (yAngle < 350 && yAngle > 180)
    {
        yAngle = 350;
    }

    float zAngle = lookRot.eulerAngles.z;
    if (zAngle > 10 && zAngle <= 180)
    {
        zAngle = 10;
    }
    else if (zAngle < 350 && zAngle > 180)
    {
        zAngle = 350;
    }

    lookRot.eulerAngles =new Vector3(xAngle, yAngle, zAngle);
    transform.rotation = lookRot;

The problem here is that I don't know how to limit the rotation angle since it's not the same depending on the ship rotation (for example if it's (0, 0 , 0) or (-90, -90, -90)). I've tried using transform.localRotation too, but still happens the same.
Do you how could I limit the rotation regardless of the ship rotation?

sentences: MMO Player Position Update I have been looking at the development of MMO games for a while and have got stuck up on one thing. Player Movement. If we have an area with 10 players, each player needs to be able to see the orientation and position of other players. But when players start moving I need to update the ten players locations simultaneously. If I were to use an MYSQL database it would be slow and laggy to send coordinates and get coordinates from the database everytime a player moved. What would be the professional and proper (more efficient) way of doing this?

sentences:
How can I dissolve using dynamic mask objects? I want to Implement dissolve shader like this youtube video

as you can see minions projected light on house to burning it out.

I like to know how to make a similar effect.

sentences:
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:
What is the purpose of the directory Packages in my Assets directory? So far I used EditorWindow script but few minutes ago without and alert I have strange stuff in the Assets in the Editor.
I see now a new folder name Packages I can't figure out where it came from but for 100% I didn't import any packages at all.

Second when I put the mouse on it and right click I can't delete it:

This is how the Packages looks like, Very strange thing:

Another strange thing but maybe it's connected to this Packages is that in the Scene view window I have this blue thing like a line or something that if I click on it it will be blue if not clicking on it it's black. Not sure what it is. It's not an object in the Hierarchy. Not sure where it came from.

I tried to restart the Unity over again but nothing same strange stuff.

I'm using unity3d 2018.2.5f1 Personal. And windows 10 home 64bit version 1803.

I see the Packages folder on the Hard disk now but when I make double click to get inside I see only one small file: manifest.json

And I was working and working with json file format to save and load but I can't figure out what is going on in the scene view and in the assets.

sentences:
Are random events beyond players' control necessary for "strategy" games? By "random event" I mean critical hits, misses, random variation in some kind of result etc. Examples of these include the accuracy mechanic in XCom; critical hits and accuracy chance in Darkest Dungeon; misses and fire/breech chance in FTL.

Something in common about these examples is that they are all games in which players have an indefinite amount of time to decide on actions. So, could it be that by adding random, RNG-based events, the game relieves the players' burden of feeling compelled to predict every possible outcome in the future? Could a game similar to the example do away with the randomness? If so, how could that change the experience?

sentences:
How to bind std::map to Lua with LuaBind Is this possible in lua to achieve?

player.scripts["movement"].properties["stat"] = "stand"
print (player.scripts["movement"].properties["stat"])

I've done getter method in c++ with this approach:

luabind::object FakeScript::getProp()
{
    luabind::object obj = luabind::newtable(L);

    for(auto i = this->properties.begin(); i != this->properties.end(); i++)
    {
        obj[i->first] = i->second;
    }

    return obj;
}

But I'm stuck with setter. The first line in lua code which I'm trying to set value "stand" for key "stat" is not going to work and it keep redirecting me to the getter method. Setter method only works when I drop ["stat"] from properties.

I can do something like this for setter in my script:

player.scripts["movement"].properties = {stat = "stand"}

But this isn't what I want because I have to go through my real keys in c++ to determine which key is placed in setter argument table value.

This is my map in class:

std::map<std::string, std::string> properties;

sentences:
Best practice to use Sprites in a game using AndEngine GLES2 Currently I am having static reference to all my sprites and loading and initializing them in my OnCreateResource mthod of SimpleBaseGameActivity, But now I have to override onAreaTouched listener on spirtes and the way I can override it while Initializing the Sprite. But I have a static method creating Atlas and Texture Region for every sprite. And I am using these sprites in my scene class and I want to override onAreaTouched there. I can registerTouchArea for that specific sprite in my scene so that can be done But I want to Override OnAreaTouched in a way so that Code reusability can be done. Here is how I am currently creating and loading sprites.

defualtCageSprite = createAndLoadSimpleSprite("bg.png", this, 450, 444);

And this is my Method createAndLoadSimpleSprite.

public static Sprite createAndLoadSimpleSprite(String name,
    SimpleBaseGameActivity activity, int width, int height) {

BitmapTextureAtlas atlasForBGSprite = new BitmapTextureAtlas(
        activity.getTextureManager(), width, height);
TextureRegion backgroundSpriteTextureRegion = BitmapTextureAtlasTextureRegionFactory
        .createFromAsset(atlasForBGSprite, activity, name, 0, 0);
Sprite sprite = new Sprite(0, 0, backgroundSpriteTextureRegion,
        activity.getVertexBufferObjectManager());
activity.getTextureManager().loadTexture(atlasForBGSprite);

return sprite;

}
Now How Can I override onAreaTouched for some sprites while not losing the code reusability.

sentences:
Unity - Syncing/Downloading/overwriting files to a local folder accessed by the game when offline? I currently have a game/application (PC/Standalone only) made in Unity which features a multitude of buttons which all link to external webpages which open up in the user's browser window.
Recently my client expressed an interest in having an offline version, where all the online content is available locally offline, as their users regularly go offsite to areas without an internet connection and the buttons are then useless.
I have done a new version which has all the webpages, PDFs and videos saved off as local files and placed in a folder within the build folder, the buttons now use the following script to read the files from there instead -

public class URLOpener_OFFLINE : MonoBehaviour {

    public void relativeURL(string url)
    {
        Application.OpenURL(url);
    }
}

This works perfectly on a basic level.
However my client has expressed an interest in being able to update the offline content without having to make a new build each time or manually go and update the folder content.

So basically what I need is to be able to store all the offline files somewhere online, which can be overwritten as and when is needed.
Then I need some way of syncing the game with this online location (when the user is online), to pull down the latest files into the offline folder and overwrite the files in there, so the latest offline files are included when they go offsite to an area without internet.

Is this possible at all?  I am more than happy to pay for a plugin or service that would provide this sort of feature.

I already have a plugin for translated languages which essentially does this (https://www.assetstore.unity3d.com/en/#!/content/14884) - changes to the online spreadsheet containing all the text is pulled down when the game syncs.  But this is obviously a bit different to downloading actual files and placing them in a specific folder.

Any help or advice would be appreciated.

Many thanks in advance

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

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

I am using this code to draw:

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

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

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

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

sentences:
Set up UnityEvent in script with string method name? I'm making a game that I'd like to be data driven. I've got a designer that can make levels using unity and saving them as a unity scene. What we're doing is exporting those levels as XML and loading them from a website into a single scene. This allows for rapid prototyping on devices; the designer does not need to wait for me to push builds out or push his own out.

Many of the scripts on the prefabs we're loading use UnityEvents, so I can allow my designer to trigger anything he wants in a given script. It gives him more freedom to design and stops my scripts from being too specific.

Currently, I'm reducing these UnityEvents down to the object they are referencing and the function they are calling and storing them as string attributes in the XML. However, I'm unsure how to convert from the string function name into an actual function pointer for the UnityEvent, nor do I know how to set up a UnityEvent the way the inspector allows me to. See here you can attach an object and select a function to trigger, then simply call Invoke() on the UnityEvent, but the only documentation I can find on UnityEvent scripting only allows you to add listeners with methods within the script.

Here I am getting the Type from a string and the MethodInfo from a string, but am unsure of how to set up the UnityEvent with this information

Type type = Type.GetType("ScriptName");
MethodInfo theMethod = type.GetMethod("FunctionName");
UnityEvent myEvent = new UnityEvent();
myEvent.AddListener(); //Reference to Method goes here
//reference to the script goes where?

sentences: Having Your Own Copyrighted App Automatically After Publishing I have a question regarding for the game app and in business. You see, I decided to publish an app to Google Play. When I published it, does this app automatically declared that this app is copyrighted or copyright protected by the publisher and creator like me itself or not? If not, does it have to seek something or required to register this app for copyright authentication via online or at office or not?

sentences:
Help implementing virtual d-pad Short Version:

I am trying to move a player around on a tilemap, keeping it centered on its tile, while smoothly controlling it with SneakyInput virtual Joystick. My movement is jumpy and hard to control. What's a good way to implement this?

Long Version:

I'm trying to get a tilemap based RPG "layer" working on top of cocos2d-iphone. I'm using SneakyInput as the input right now, but I've run into a bit of a snag.

Initially, I followed Steffen Itterheim's book and Ray Wenderlich's tutorial, and I got jumpy movement working. My player now moves from tile to tile, without any animation whatsoever.

So, I took it a step further. I changed my player.position to a CCMoveTo action. Combined with CCfollow, my player moves pretty smoothly. Here's the problem, though: Between each CCMoveTo, the movement stops, so there's a bit of a jumpiness introduced between movements.

To deal with that, I changed my CCmoveTo into a CCMoveBy, and instead of running it once, I decided to have it CCRepeatForever. My plan was to stop the repeating action whenever the player changed directions or released the d-pad.

However, when the movement stops, the player is not necessarily centered along the tiles, as it should be. To correctly position the player, I use a CCMoveTo and get the closest position that would put the player back into the proper position. This reintroduces an earlier problem of jumpiness between actions.

What is the correct way to implement a smooth joystick while smoothly animating the player and keeping it on the "grid" of tiles?

Edit:

It turns out that this was caused by a "Bug Fix" in the cocos2d engine.

sentences:
OpenGL: strange thing with depth and text rendering TL;DR I render a scene with M,V,P matrices as always. Than I render something (in this case - text) without any matrices and using separate shaders pair on coordinates with Z = -1. Somehow it's rendered closer to the camera than something on coordinates with Z = 0.9. I can't understand why.

Here is something I can't figure out.

Consider this vertex shader which is used for text rendering:

#version 330 core

layout(location = 0) in vec2 vertexPos;
layout(location = 1) in vec2 vertexUV;

out vec2 fragmentUV;

void main() {
    fragmentUV = vertexUV;

    gl_Position.x = vertexPos.x*2 - 1;
    gl_Position.y = vertexPos.y*2 - 1;
    gl_Position.z = -1.0;
    gl_Position.w =  1.0;
}

When text is rendered with Z  = -1 everything looks fine:

And if I change Z to 0.9 scene looks like this:

According to this tutorial perspective matrix modifies the scene so that all visible objects are in cube where -1 <= {X,Y,Z} <= 1. Also by default camera looks "down" towards Z axis.

So shouldn't it be conversely: larger Z - closer to the camera?

Full source code is on GitHub. Here is a code which renders text. And this code fills corresponding VBO.

sentences: XNA Texture2D storage question Are Texture2D objects stored on the graphics card or on system memory? I am thinking that the backbuffer is located on the graphics card (by default) and that the textures are on the system memory. I am using a spritebatch class that writes the textures to the backbuffer which are then rendered when the Present() function is called. Is this how XNA does it or am I completetly off?

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:
Is jButton in Java suitable for a Game GUI? Recently I have encountered the issue of trying to add a GUI into my game using Swing. The game will randomly & infrequently flash the jButton or Swing component when I add it to my jFrame. I'm not sure if this is because Swing is not double buffered like the rest of my graphics or something is interfering with Swing (The game is in a barebone state, so I'm not sure what in the game would cause this).

I noticed that Minecraft has it's own custom GUI components, should I do a similar system, or is there an alternative to Swing?

EDIT: Figured I should add the initialization code for the component.

@Override
public void init(Main main) {
    playButton = new JButton("Test", new ImageIcon(this.getClass().getResource("gui/BlankButton.png")));
    playButton.setLocation(main.getW() / 2, main.getH() / 2);
    main.add(playButton);
}

sentences:
Libgdx and ParticleEffect with scene2d not showing the same way as in the Particle Editor I am developing a new game with libgdx and trying to implement ParticleEffect in scene2d (using actor). I am creating a ParticleEffect with Particle Editor in which I would like to
add to a stage.

From some reason, the effect appears horizontally only (objects appear from left to right but not up and down) and is not appearing the same as in the Particle Editor (X and Y axis).
Does anyone have an idea what could be the reason for that?

Snapshot of the horizontal effects (desktop run):

Particle Editor effect:

sentences:
Download and open an zip file ingame on unity for android I would like to know if it is possible to have a game that would download a rar or zip file from a website and extract it to the internal storage for use, and if it is a good option since i have to use a directory structure to open fbx models that have the texture on a folder with the same name of the fbx.

The App is made for android and the files should not be bigger than 30mb.

sentences: How do I get light to go through a window texture in Unity? I'm having trouble with the lighting (I have windows and the light wont go through). How do I get the light to proceed through the glass?

sentences:
What web technology could I use which would support a decision tree? I am a big game development fan but I haven't done any commercial work in the past. I have been asked by a non-profit to look at developing a game similar to the award-winning www.playspent.org

They want the following features:

support 5 scenarios
mobile isn't important but compatibility with older browsers would be a big bonus
they want it to be visual and audible
bonus is to have it easily modifiable
support 4 languages

I don't have much knowledge of Flash and would rather avoid using it as a solution. I started breaking down the problem into segments that I will need to examine, they are as follows:

ability to read the game flow from a file that they can produce (xml, etc.)
db design to store decision tree
language challenge
browser compatibility

I am leaning towards an Google app engine/GWT solution but I am not sure what technology is best for this.

I am really hoping to get your opinion/recommendation on my approach and on what technology is best. A special thanks (and beer if you live in Toronto) will be awarded to anyone who can help give me a ballpark estimate on how much such a game should go for. I know it's tough to estimate but any rough figure will help (how much would you charge for building something like playspent.org?)

Thanks in advance

sentences:
What does linearDamping mean in Box2D? If I set linearDamping on a body, it's velocity will be decreased slowly, until it stops.
The documentation says, that the units are 1/time, which is unclear for me.

If the velocity of a body is 10 m/s, and the linearDamping is 0.5, then how can I calculate that when will the velocity be decreased to 1 m/s ?

sentences:
How to make a proper release build - Unity Android - x86, ARM32, ARM64 I'm trying to create a release on Google Play.

I currently have Build App Bundle checked in the build settings, and it helps decrease the build size.

In player settings I've IL2CPP set as the scripting backend, and  x86 + ARM32 + ARM64 checked as target architectures.

Once built it creates *-symbols.zip in addition to just
aab.

My questions are,

Do I need x86 + ARM32 + ARM64 all checked? (I want to comply with Google's new 64-bit requirement)
Can I build split aab's similar to 'split APKs by target architecture'? If so can I have the same version code for aab's which targets different architectures? Is there any advantage of doing so?

sentences:
Gunfire Sound Gets Cut Off When I Release the Aim Button. Help? So for my game you have to hold down right mouse click to aim and then simultaneously click the left mouse click to shoot. When the gun is fired, I'd like the gunfire sound to play. Currently, I have this working, but I have a problem. When I let go of the aim button, the gunfire sound immediately stops playing (if it hasn't already played through).

I understand this is happening because of the placement of my PlayShootSound method call, but what I can't figure out is where to put it so that I don't have this problem.

Any pointers/ideas?

public class Weapon : MonoBehaviour {

 public float fireRate = 0;
 public float damage = 10;
 public LayerMask whatToHit;

 public Transform BulletTrailPrefab;
 public Transform MuzzleFlashPrefab;

 float timeToFire = 0;
 float timeToSpawnEffect = 0;
 public float effectSpawnRate = 10;
 Transform firePoint;

 public AudioClip shootSound;
 private AudioSource gunFire;

 bool isShooting = false;

 // Use this for initialization
 void Awake () {
     gunFire = GetComponent<AudioSource>();

     firePoint = transform.Find("FirePoint");
     if (firePoint == null)
     {
         Debug.LogError("No fire point...Please make an empty object named FirePoint and attach to end of gun. :)");
     }
 }
 void Update () {
     CheckIfShooting();
 }

 void CheckIfShooting()
 {
     if (Input.GetButton("Fire2")) // Holding right click
     {
         if (fireRate == 0)
         {
             print("fire rate is 0");
             if (Input.GetButtonDown("Fire1")) // Left click while holding right click
             {
                 Shoot();
                 PlayShootSound();
             }
         }
         else
         {
             if (Input.GetButton("Fire1") && Time.time > timeToFire) // For automatic guns
             {
                 timeToFire = Time.time + 1 / fireRate;
                 Shoot();
                 PlayShootSound();
             }
         }
     }
 }

 void Shoot()
 {
     Vector2 mousePosition = new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y);
     Vector2 firePointPosition = new Vector2(firePoint.position.x, firePoint.position.y);
     RaycastHit2D hit = Physics2D.Raycast(firePointPosition, mousePosition - firePointPosition, 100f, whatToHit);

     if (Time.time >= timeToSpawnEffect)
     {
         Effect();
         timeToSpawnEffect = Time.time + 1 / effectSpawnRate;
     }
     // Debug.DrawLine(firePointPosition, (mousePosition - firePointPosition) * 100, Color.cyan);

     if (hit.collider != null)
     {
         // Debug.DrawLine(firePointPosition, hit.point, Color.red);
         Debug.Log("We hit " + hit.collider.name + " and did " + damage + " damage.");
     }
 }

 void PlayShootSound()
 {
     gunFire.PlayOneShot(shootSound, 1f);
 }

 void Effect()
 {
     Instantiate(BulletTrailPrefab, firePoint.position, firePoint.rotation); // Fire Bullet

     Transform muzzleFlashClone = Instantiate(MuzzleFlashPrefab, firePoint.position, firePoint.rotation) as Transform;
     muzzleFlashClone.parent = firePoint;
     float size = UnityEngine.Random.Range(6f, 9f); // Randomize size of muzzle flash
     muzzleFlashClone.localScale = new Vector3(size, size, size);
     Destroy(muzzleFlashClone.gameObject, 0.05f);
 }

sentences:
understanding image rotation XNA C# I do not understand how the rotation of the image i have works. Is it something to do with the ThumbSticks on the Xbox Pad? or properties of a float? if someone could explain to me what is actually happening here i would be very greatful.

The image is of a Gun. I would like to add in shooting guided by the thumbsticks for enemies above the player, so understanding this is crucial.

The image and coding has its own class. So in Game1.cs only initialised, WMpos set to the character and update and draw methods referenced, so does not affect rotation.

This is all the relevant code for it here:

public Texture2D WMtxr;
public Vector2 WMorigin;
public float WMrotation;

public void UpdateMe(GameTime gameTime)
    {
        WMorigin = new Vector2(WMtxr.Width - 100, WMtxr.Height - 36);
        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);
    }

sentences:
Children of canvas objects do not register OnMouseUpAsButton Objects I create inside my canvas do not register the OnMouseUpAsButton() event. I tried doing it on an empty project and it doesn't work so I guess I'm misunderstanding how something works. That being said, objects inside game world register event properly. I tried reading documentation but I still don't get why this is happening.

My code (the only code used in the project)

using UnityEngine;
using System.Collections;

public class test_click : MonoBehaviour {

void OnMouseUpAsButton()
{
    Debug.Log("Mouse up test click");
}

public void Thisworks()
{
    Debug.Log("yes");
}

void Start () {}
void Update () {}
}

My project objects:

I have spent the last 12 work hours searching for causes of this problem so I'm sure it is something absolutely obvious yet I just can't see it.

sentences: Windows Phone XNA guarding storage data For a typical windows phone game where storage files could contain high scores or in-game currency data, how does one go about protecting these files from user tampering?

sentences:
Started game development no idea of computer graphics. Should I learn tools or concepts? I am in 6th semester of my Computer science bachelor degree program, Working as Intern in a start up company. I started game development using AndEngine, things are going good because I have good hold on OOP and Java.

But I don't have any experience in OpenGL programming and neither studied a course of computer graphics. I want to develop 3D games and there are tools available like Unity3d etc.

My question is should I master tools or take online lectures of computer graphics to get started on basics. I want to continue game development as my profession. So what should I do? start learning from scratch or Learn already built tools and just dive into development?

I see successful designers with no background of academic study, just did a photoshop course and now they are in the softwarehouse and making websites, sprites etc.

sentences:
Enable/ Disable Line Renderer points I have a Line Renderer component with 4 points, I would like to disable and enable the last 2 points at a certain time. My question is, how would I in code (C#) enable and disable individual Line Renderer points?

Thanks in advance!

sentences:
Using RPC's for movement of an object across a network I've been building upon http://www.gamasutra.com/blogs/DarrelCusey/20130221/187128/Unity_Networking_Sample_Using_One_NetworkView.php At the moment when I spawn a sphere on the server it spawns on the clients aswell. On the server side I have two buttons, move left and move right. Ive been trying to get the movement to go across to the clients aswell but to no avail. The sphere moves on the server but nothing on the clients. Below is the code I have attempted, where have I went wrong with this? The debug line in SendSpherePosition outputs the spheres position perfect, but the position is not updating on the client, so is it a problem with the line below it "spawnedSphere.transform.position = spherePosition;"?

 if (Network.isServer && isSphereSpawned==true && closeOutExtras==false)
     {
         Debug.Log("the position of the sphere is: " + spawnedSphere.transform.position );
         //If called here sphere's continuously spawn on the client
         networkView.RPC("TellClientsToSpawnSphere", RPCMode.Others, null);
         //put this bool in just to have one spawn on the client, bad code, will need to change
         closeOutExtras = true;
     }

     if (Network.isServer && isSphereSpawned==true)
     {
         Debug.Log("the position of the sphere is: " + spawnedSphere.transform.position );
         if (lastLocalSpherePosition != spawnedSphere.transform.position)
         {
             networkView.RPC("SendSpherePosition", RPCMode.Others, spawnedSphere.transform.position);
             lastLocalPlayerPosition = spawnedSphere.transform.position;
         }
     }

 }

 [RPC]
 void SendSpherePosition(Vector3 spherePosition)
 {
     Debug.Log ("The sphere position is: " + spherePosition);
     spawnedSphere.transform.position = spherePosition;
 }

 [RPC]
 void TellClientsToSpawnSphere()
 {
     Instantiate (spawnedSphere);
 }

sentences:
How do I make the player gun stop firing when sprinting I am trying to get the players gun to fire when the player is walking and the stop firing when the player starts to sprint. The gun will work just fine and ire when the player is walking, but it will continue to fire when they start running and they can also start firing when they are running. I have been trying or most o the day and have not been able to figure out how to fix this.

The top script is obviously the script or the gun firing and whatnot and the bottom script is the controller or movement as well as the animation for the gun.

EDIT: Still no luck.

public class Shooting : MonoBehaviour
{
    private float NextTimeToFire = 0f;
    public bool AllowedToShoot = true;

[Space(10)]
    [Header("Floats")]
    public float Damage = 10.0f;
    public float Range = 100.0f;
    public float ImpactForce = 60f;
    public float FireRate = 15f;

    [Space(10)]
    [Header("Others")]
    [Space(5)]
    public Camera FPSCamera;
    public ParticleSystem MuzzleFlash;
    public GameObject impactEffect;

void Start()
    {
    }

    void Update()
    {
            if (AllowedToShoot == false) return;
            {
            if (Input.GetButton("Fire1") && Time.time >= NextTimeToFire)
                {
                    NextTimeToFire = Time.time + 1f / FireRate;
                    Shoot();
                   }
            }
    }

    void Shoot()
    {
        MuzzleFlash.Play();

            RaycastHit hit;
            if (Physics.Raycast(FPSCamera.transform.position, FPSCamera.transform.forward, out hit, Range))
        {
            Debug.Log(hit.transform.name);
            Objects enemy = hit.transform.GetComponent<Objects>();
            if (enemy != null)
            {
                enemy.TakeDamage(Damage);
            }

            if (hit.rigidbody != null)
            {
                    hit.rigidbody.AddForce(-hit.normal * ImpactForce);
            }
            GameObject ImpactGo = Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(ImpactGo, 2f);
        }
    }
}

///

public class WeaponMovement : MonoBehaviour
{
    public GameObject CameraAnimations;
    Animator anim;

    private void Awake()
    {
        anim = CameraAnimations.GetComponent<Animator>();
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
        {
            if (Input.GetKeyDown(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
                anim.SetBool("Sprint", true);
            }
        }

        if (Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.UpArrow))
        {
            anim.SetBool("Sprint", false);
        }

        if (Input.GetKeyUp(KeyCode.LeftShift) || Input.GetKeyUp(KeyCode.RightShift))
        {
            anim.SetBool("Sprint", false);
        }
    }
}

sentences:
How to get point depth in shadow space for point light? I'm implementing exponential shadow maps, and so far I have directional lights and spotlights working perfectly.  Currently I'm trying to apply this technique to point lights with cubemapped shadows.

The theory is, the visibility factor should be computed as a product of two exponentials:

visibility = exp(k*occluderDepth) * exp(-k*receiverDepth)

So the shadow map, instead of storing depth, stores exp(koccluderDepth), and the lighting pass multiplies this value by exp(-kreceiverDepth).

My shadowmap renderer looks like this:

//vsh
#version 410

uniform mat4 viewProjectionMatrix;
uniform mat4 modelTransform;

in vec4  position;

void main (void) {
    gl_Position = viewProjectionMatrix * modelTransform * position;
}

//fsh
#version 410

float lightExponentialConstant = 200.0;

layout (location = 0) out float exponentialMapVaule;

void main (void) {
    exponentialMapVaule = exp(lightExponentialConstant * map_01(gl_FragCoord.z, lightNearPlane, lightFarPlane));
}

The visibility for spot and directional lights is computed like so and it works perfectly:

uniform sampler2D shadowmapSampler;
uniform mat4 shadowSpaceProjection;

float map_01(float x, float v0, float v1) {
  return (x - v0) / (v1 - v0);
}

float computeVisibility(vec3 position) {

    mat4 shadowBias = mat4(
        0.5, 0.0, 0.0, 0.0,
        0.0, 0.5, 0.0, 0.0,
        0.0, 0.0, 0.5, 0.0,
        0.5, 0.5, 0.5, 1.0
    );

    vec4 shadowCoord =  shadowBias * shadowSpaceProjection * vec4(position, 1.0);
    float occluder = texture(shadowmapSampler, shadowCoord.xy/shadowCoord.w).r;
    float reciever = map_01(shadowCoord.z/shadowCoord.w, lightNearPlane, lightFarPlane);
    float visibility = clamp(occluder * exp(-lightExponentialConstant * reciever), 0.0, 1.0);

    return visibility;

}

So basically the receiver value is the depth of the world position projected into shadow space, and then mapped to the range [0, 1] according to the offset of that point from the shadow projection's near plane and far plane.

I have tried to apply the same logic to the cubemap shadowmap for my point light:

float map_01(float x, float v0, float v1) {
  return (x - v0) / (v1 - v0);
}

uniform samplerCube shadowCubemap;

float computeVisibility(vec3 position, vec3 lightPosition) {

    vec3 ray = position - lightPosition;
    float distance = length(ray);
    float occluder = texture(shadowCubemap, normalize(ray)).r;
    float receiver = map_01(distance, lightNearPlane, lightFarPlane);
    float visibility = clamp(occluder * exp(-lightExponentialConstant * reciever), 0.0, 1.0);

    return visibility;

}

So here, if I understand correctly, distance should be the length of the vector between the world position and the light position (which should be equivalent to the reprojected depth from the 2D example).  But everything is occluded when I use this method.

What am I missing?  In particular, I'm not sure if I am not confident about the cubemap sampling, or if I'm missing some step to ensure that the distance value used to compute the receiver value is actually being transformed correctly to shadow space.

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

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

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

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

It would be nice to have similar plugins for Unity

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

sentences:
Is there a simple way to stop enemies standing in the same spot? So: top-down game, my enemies chase the player, when they get within a certain distance they stand still and fire. If they're all coming from the same direction they all end up standing in the same spot (i.e. standing "within" each other), as I'm not currently doing collision detection between enemies - they are free to pass over each other.

What's a simple way around this? Either some form of collision detection or some ai?

sentences:
different Scenes but each of them loads per frame well i want to have something like restaurant that divided in 3 sections.and the user can switch between these but every Scene loads every frame.for example the character is in the first section and the player goes to second section and touch a customer and the character starts to go to the second section or have a button for kitchen but when the character goes to kitchen the costumers still load.i don't think that Application.LoadLevel (); could help.
thanks.

sentences:
How can I convert this 2D pixel array into a 1D pixel array? I have this 2D array that works like this, and I made this image to help illustrate what my 'Screen' class's array represents.

Basically, the first part [x][] is how many scan-lines there are. And then, [][x] is how many pixels long that particular line is.

Now, I've researched 'flatting 2D arrays' or '2D to 1D array conversion' - and yes, they 'work', but they seem to just break it... What I mean is, have the screen goes a certain color, then crashes by going out of bounds. Then, other times, it just goes out of bounds, and nothing happens.

I've tried the following, which is what caused it to crash:

final int[] PIXEL_BUFFER = game.getPixelBuffer();

    int pixel = 0;
    for (int j = 0; j < SCANLINE_COUNT; j++)
    {
        for (int i = 0; i < SCANLINE_LENGTH; i++)
        {
            PIXEL_BUFFER[pixel] = this.PIXEL_BUFFER[j][i];
            pixel++;
        }
    }

I've searched high and low, but I can't figure this out. If anyone knows how, it'd be greatly appreciated if I could gain some insight. Until then, I'm going to keep trying.

Many thanks.

sentences:
Game engine for "racing" game I've been planning for a long time to mix data from OpenStreetMap, some digital elevation model (heightmap), satellite imagery for textures, and cook a racing/cruising game where I could drive around familiar parts of the city.

OpenStreetMap contains very nice and detailed maps of all the locations I've checked, so I imagine it won't be so hard to download data for a specified region, like Boone County, Nebraska and stuff them into the game. I could generate buildings in 3d somewhat, as they have defined contour in OpenStreetMap. Roads would be the easiest thing to do as they are the core part of OSM.

What I'm worried about is the game/"simulator" part. I don't know where particularly to start. I suppose I would have to generate a lot of this world during the loading / on the fly. I don't even know if there is anything racing/vehicular-like out there available to use, except for the XNA Racing Game. I'm employed as C# developer, so I'm skilled in that language, but I'd be willing to venture into Python or something similar, if it would increase productivity in this hobby project.

Can you recommend me some engines worth looking into?

sentences:
Java game object pool management Currently I am using arrays to handle all of my game objects in the game I am making, and I know how terrible this is for performance.  My question is what is the best way to handle game objects and not hurt performance?

Here is how I am creating an array and then looping through it to update the objects in the array:

public static ArrayList<VboCube> game_objects =  new ArrayList<VboCube>();
/* add objects to the game */

while (!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
        for (int i = 0; i < game_objects.size(); i++){
            // draw the object
            game_objects.get(i).Draw();
            game_objects.get(i).Update();
            //world.updatePhysics();
        }
}

I am not looking for someone to write me code for asset or object management, just point me into a better direction to get better performance. I appreciate the help you guys have provided me in the past, and I dont think I would be as far along with my project without the support on stack exchange!

sentences:
How do I publish a game written for Graal Online to Facebook? I made an MMORPG game using the Graal Online game engine. I hosted the game with their engine and servers, and it was fairly successful. Recently, they stopped hosting my game. The game is still fully functional, but with nowhere to host it, I am unsure of my next move.

The game was on Facebook before the hoster decided to not host it, anymore. We have 4,800 images for the game, 350 scripts that were coded in a language very similar to HTML5 and Java, and over 1,000 animations.

My goal is to have the game playable on Facebook and iOS/Android platforms. I do not know if I can use the old gaming engine or not, but I should be able too. If not, I hope that I still have options; I do not want to let all of this development go to waste.

How do I publish a game written for Graal Online to Facebook?

sentences:
MultiTexturing by neighbouring points textures Visual example:

I've been trying to understand multitexturing for a while now, I've created a terrain generator but have no need for height just yet and I still want one texture to blend over to another texture nicely.

I think Blau said that you only need 4 textures per vertex. My only guess then is that each point in a terrain has 4 neighbours - right? And that point is the main texture to sample from / blend from. Because it can't mean that 4 textures are all you get on a whole map in a game.

My idea is to have an "TextureID" for each point and whenever this point comes up, you load the textures in the effect with that neighbours textures.

Example (for each point):

effect.Parameters["MainTexture"].Setvalue(Content.Load<Texture2D>("MainTexture"))
effect.Parameters["TextureTopOfPoint"].SetValue(Content.Load<Texture2D>(textureID));
effect.Parameters["TextureRightOfPoint"].SetValue(Content.Load<Texture2D>(textureID));
effect.Parameters["TextureBottomOfPoint"].SetValue(Content.Load<Texture2D>(textureID));
effect.Parameters["TextureLeftOfPoint"].SetValue(Content.Load<Texture2D>(textureID));

/*
   Now the Pixel and Vertex Shader can calculate a blend effect
   from Center point to it's neighbouring points
*/

and somehow in the Effect file, blend from "Center point" to all it's neighbours. I also guess this would be a "slow" process.

Problems are:

Is this possible? I can't accept 4 textures for a whole map, so how do I manage to have multiple textures at the same time? And I don't want a solution with colors (like this) or heightmap, because I want it to be possible to have 4 or more textures on a flat surface.
How do I access each point's neighbour and when do I know when to set them?

My map contains Areas, each Area has it's own VertexBuffer and IndexBuffer.

(Example: MapWidth=4096, MapHeight=4096, each square = 128x128 = (32 * 128 x 32 * 128 grid)

public class Area
{
    public VertexPositionTexture[] Vertices { get; set; }
    public int[] Indexs { get; set; }

    public VertexBuffer GetVertexBuffer() { /* create a vertexbuffer */ }
    public IndexBuffer GetIndexBuffer() { /* creates a indexbuffer */ }
}

Edit (still not optimal)

Implemented some kind of method, but this method still relies on colors and I have no blendmap. I just use the color in the Vertex to check for a value (r, g, b, a)

Effect Code:

float4 PixelShaderFunction(VS_OUTPUT input) : COLOR
{
   float4 colour = float4(0,0,0,0);

   colour += tex2D(GroundText0Sampler, input.TexCoord) * input.Color.r;
   colour += tex2D(GroundText1Sampler, input.TexCoord) * input.Color.g;
   colour += tex2D(GroundText2Sampler, input.TexCoord) * input.Color.b;
   colour += tex2D(GroundText3Sampler, input.TexCoord) * input.Color.a;

   return colour;
}

sentences:
Purchasing a TV show adaptation rights, how does it work? Basically, I was thinking about a game based on a TV show, just for fun, and ended up thinking "well, it's not like it can be made anyway". Or can it?

In the present situation, developing a game by myself/ourselves on my/our free time, and then using crowdfunding to purchase the rights is not that crazy, if the show is really popular... and the rights not too expensive.

Purchasing the rights of the whole show is obiously a sh!tload of money, but what about adaptation rights? What is the range of price it can be? Is it a percentage of the full rights? Does it depend on the kind of adaptation (novel vs. toy vs. game)?

ps: if it can help answer, I was thinking about a MLPFIM retro RPG. Please don't laugh at me.

sentences:
Unity Assets folder is empty after opening package from the asset store I downloaded the following Survival Shooter Tutorial from the Asset Store :
https://www.assetstore.unity3d.com/en/#!/content/40756
I was prompted to open it in Unity so I did and began following this tutorial :
https://www.youtube.com/watch?v=_lP6epjupJs
I am only 2 minutes into the first video and am stuck. In the tutorial there are lots of folders in the assets folder. I took a screenshot of what my screen looks like to show that it is empty.

sentences:
Component-wise GLSL vector branching I'm aware that it usually is a BAD idea to operate separately on GLSL vec's components separately.
For example:

//use instrinsic functions, they do the calculation on 4 components at a time.
float dot = v1.x*v2.x + v1.y * v2.y + v1.z * v2.z; //WRONG
float dot = dot(v1, v2); //RIGHT

//Multiply one by one is bad too, since the ALU can do the 4 components at a time.
vec3 mul = vec3(v1.x * v2.x, v1.y * v2.y, v1.z * v2.z); //WRONG
vec3 mul = v1 * v2; //RIGHT

I've been struggling thinking, are there equivalent operations for branching?

For example:

vec4 Overlay(vec4 v1, vec4 v2, vec4 opacity)
{
    bvec4 less = lessThan(v1, vec4(0.5));
    vec4 blend;
    for(int i = 0; i < 4; ++i)
    {
        if(less[i]) {
            blend[i] = 2.0 * v1[i] * v2[i];
        } else {
            blend[i] = 1.0 - 2.0 * (1.0 - v1[i]) * (1.0 - v2[i]);
        }
    }
    return v1 + (blend - v1) * opacity;
}

This is a Overlay operator that works component wise. I'm not sure if this is the best way to do it, since I'm afraid these for and if can be a bottleneck later.

Tl;dr, Can I branch component wise? If yes, how can I optimize that Overlay function with it?

sentences:
C++&SFML Moving Sprites Smoothly in Tiles As a student, I've always wanted to become a game developer. So far I've managed to learn the basics of C++ and SFML 2.1

For my first project, upon deciding to make a 2D RPG-ish game, I encountered a problem that the game loop refreshes so quickly that if I move them by 1 pixel per frame, the sprite will move more quick than I intended to.

I implemented a frame-determined movement system(not sure what it's called) that whatever the fps is, the character moves at same speed.

However, I couldn't solve the problem(which is what I'm asking) that the sprite won't move smoothly. What's happening in my build is that the player will move about 1px per frame, and can be interrupted by other inputs. What I want the sprite to do is move horizontally 32px per second. How can I do this?

Edit: wasn't being clear enough. What I want the program to do is when I press 'Right' key once, sprite moves towards the positive side of x-axis, for 32px. What's currently functioning in my program is the sprite will move only once, 1px

TL;DR : I want to move my sprite like old-school RPG games, moving predetermined pixels(or tiles) smoothly.

sentences:
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:
Finding cubes in frustum Working with an infinite set of cubes, is there a way of detecting which cubes exist within a frustum?

Most frustum culling seems to work along the lines of running through all objects and seeing if they intersect - this is ok with a finite set of objects, or something like Octrees.

I'm currently finding all cubes within the frustum's bounding box - but that's far more than I really need.

I could then test these all against it, but I was wondering if I could skip a step.

sentences:
Multipass shaders and switching between passes As mentioned here Effects should be avoided in DX11. If I understand correctly, that includes techniques and passes defined in *.FX files. So when doing a multipass shader (like the always-mentioned toon shader) I should create 2 separate shaders (for 2 passes), set the first one, render geometry, set the second one, render the geometry again. Correct so far?

But what I'm concerned about is that whether or not the technique/passes in Effects are just a syntactic sugar and offer no performance improvement whatsoever. Or the whole Effects in general. Do they?

GLSL version 4.20 or sth about that has subroutines which allow to switch the function in the shader and avoid changing the shader which does improve performance. Is there anything similar in DX?

Edit: Here [link] it says:

  Since performance is crucial in shader programs, avoiding a conditional statement or a shader swap can be very valuable. With subroutines, we can implement the functionality of a conditional statement or shader swap without the computational overhead.

Also this post seems to confirm it.

sentences:
How to make noise-generated terrain more square? I use a perlin noise generator to create a map. All works fine and dandy. It uses the following formula:

Generate perlin noise
Posterize the height values to be an integer between 0 and 5.

What I get works well. Just, the terrain is TOO organic for my purposes. Is there a way to make it a little more square and chunky?

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:
Change item rotation axis in inventory item visualization I'm learning unity and i'm trying now make an inventory, i made a simple interface, and now i'm trying to make a item visualization. I look for some codes from web and i found this one:

using UnityEngine;

public class TurnObject : MonoBehaviour
{
    protected Vector3 posLastFame;
    public Camera UICam;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0)) {
            posLastFame = Input.mousePosition;
        }

        if (Input.GetMouseButton(0)) {
            var delta = Input.mousePosition - posLastFame;
            posLastFame = Input.mousePosition;

            var axis = Quaternion.AngleAxis(-90f, Vector3.forward) * delta;
            transform.rotation = Quaternion.AngleAxis(delta.magnitude * 0.1f, axis) * transform.rotation;
        }
    }
}

I know some code, but I'm not good with geometrics. In this code when I move my mouse horizontal way, my object turn in the Y axis. And that's good. But when I move my mouse vertical the object move in the X axis instead of Z axis.

Is there a way in this code for change this? I really have difficulty to understanding geometrics in Unity.

sentences:
Tank movement based on track speeds I want a system, where a tank moves and rotates based on the speeds I give him for the two tracks, for example, if I give the left track a speed of 1 and the right one a speed of -1, then I want the tank to stay still and rotate right, while if I give the left track 1 and the right track -0.5, I want it to rotate, but at the same time move forward

Of course the speeds will be between -1 and 1

sentences:
Choosing a draw call when not reusing vertex data Up until now I've always used glDrawElements, and have my vertex and index buffers bound. From what I've read, glDrawElements is generally the way to go, and it works fine. However, I'm starting a new project and am questioning whether this is still the best fit.

For the current project, I'm recomposing a 2D scene from scratch every frame. The player's character runs around, and I only draw the part of the world that is visible, generating 2D quads from the map tiles and building the vertex/index buffers.

Given that (from my understanding) glDrawElements works best when you upload your VBOs and make multiple draw calls against them, wouldn't it be better to use something else in this case, such as glDrawArrays? I've generally read that glDrawArrays is slower, but given that I'm having to push the vertex data every frame anyway, that might not be true here.

I don't want to switch draw calls and assume I made the right choice when I could in fact be using it improperly to begin with, invalidating any performance improvements I see.

sentences:
Class design for a risk-like game I'm currently coding a AI for a risk-like game, but I'm not sure how I put even the base classes together. I've read a lot about game design patterns, entity component designs and such, but I've trouble translating it to an actual architecture of my own.

My original layout feels weird, I have too many reference cycles and store most objects in multiple places. I know how to remove those, but that would make it (in my mind) a lot more complicated to get simply lists, for example the amount of Units a player possesses, or which units are in Zones next to the current one.

I had a bit more classes and something that kinda worked, but it was a mess and worse than this design. I wanted to start over and design it right. I feel really dumb having problems that should be much more easier to solve. And I wouldn't even know how to begin plugging in the AI.

sentences:
Combining mesh on the fly without using gameObject I procedurally generate chunks and use the marching cube algorithm to create meshes in 3D.
At first, I just created a gameObject for each cube (of course, I knew it was not optimized, but I wanted to see if the algorithm worked).
For now I stock all gamesObject in child of "blocks" but it would be much more optimized to directly merge the meshes between them and only create a single gameObject.
However, i did not find any way to directly merge the meshes between them.
So my question is: is there a way to directly merge meshes between them without having to use gameObject? (don't worry about texturing)

Here's the code:

    public static GameObject GenerateChunk(int[,,] map, int chunkSize, Vector3 chunkPosition)
    {
        GameObject blocks = new GameObject("BlockList");
        GameObject newMesh;
        int[] cubeVertices = new int[8];

        // create each mesh in a gameObject as child of "blocks"
        for (int x = 0; x < chunkSize; x++)
            for (int z = 0; z < chunkSize; z++)
                for (int y = 0; y < chunkSize; y++) {
                    /*
                    define the vertices (cubeVertices)
                    */
                    Vector3 cubePosition = new Vector3(chunkPosition.x + x, chunkPosition.y + y, chunkPosition.z + z);
                    newMesh = GenerateCube(cubePosition, cubeVertices);

                    if (newMesh != null)
                        newMesh.transform.parent = blocks.transform;
                }

        //combine every children of "blocks" and delete them
        MeshFilter[] filters = blocks.GetComponentsInChildren<MeshFilter>();
        List<CombineInstance> combine = new List<CombineInstance>();
        for (int i = 0; i < filters.Length; i++) {
            if (filters[i].sharedMesh == null)
                continue;
            for (int j = 0; j < filters[i].sharedMesh.subMeshCount; j++) {
                CombineInstance ci = new CombineInstance
                {
                    mesh = filters[i].sharedMesh,
                    subMeshIndex = j,
                    transform = filters[i].transform.localToWorldMatrix
                };
                combine.Add(ci);
            }
            Destroy(filters[i].gameObject);
        }

        //create the chunk and set the final mesh with the CombineMeshes function
        GameObject chunk = new GameObject("Chunk", typeof(MeshFilter), typeof(MeshRenderer));
        chunk.GetComponent<MeshFilter>().mesh.CombineMeshes(combine.ToArray(), true, true);
        Destroy(blocks);
        return chunk;
    }

sentences:
GJK point-in-tetrahedron - capping the number of searches? The very informative mollyrocket video has given me quite a lot to work with, but one thing that the video seems to suggest is that the algorithm should ideally run until it definitely determines whether or not there's a hit.

I was of the idea that if there's no collision, it would be obvious by testing the dot product of the latest point against the search direction; if it is not positive, then we did not pass the origin, so a tetrahedron which encloses the origin simply cannot be built.

In cases where there is a hit OR a clear miss, the routine typically picks up less than 11 loops through. However, as I tend towards 'questionable territory' and the definitive hit/miss is visually less distinct, there are times when the method apparently continues to pass the origin yet construct unsuccessful simplexes.

Is it common to cap this kind of function at a max number of tries? Right now I am somewhat arbitrarily using the number of points in one shape times the number of points in the other shape; in other words:

max_tries = len(shape1.pts) * len(shape2.pts)

It feels a bit hacky and I have to assume that the routine is geared towards simply running ad nauseum until it smacks into a clear hit/miss situation.

Has anyone experienced this before? Is this a problem or an anticipated safety measure in such an algorithm? If it needs to be done I'll gladly share some code, but I think it stands as self-evident that it is kind of a longer read than most code snippets so I've abstained for now.

sentences:
How do I start and stop a GLSL shader? Is there a way to start and stop a shader?.

I want to use this shader to sweep once over my texture and then stop. Does anybody know how to do that?

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    vec2 r = fragCoord.xy / iResolution.xy;
    r.y = 1.0 - r.y;

    vec4 tex = texture2D(iChannel0,r.xy);
    tex += vec4((sin((r.y)+r.x + iGlobalTime*3.)) + tex)/2.;

    fragColor = tex;
}

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 you implement input handling in a C game engine? I am starting to learn C programming, though I have a lot of experience using higher-level languages. I want to write a game engine using C and OpenGL. I think I understand the graphics rendering part, but now I'm curious about how to receive and process keyboard, mouse and controller input. How does one implement this sort of thing in C?

sentences: why are texture atlases called texture atlases and not image atlases More specifically, is there anything about texture atlases specific to textures? From what I've read of them, they might just as well be called image atlases. Images are not the same as textures, but textures can be created out of images.

sentences:
Rect transform stretch of a child object is set to 0 after instantiation I have the following hierarchy of my prefab:
-PopupParent
--Popup
---ScreenDim

They all have Rect Transform set to Stretch. Anchor mins are set to 0 and Anchor maxes to 1. Left, top, right and bottom are set to 0. When I pull this prefab to a Canvas manually, all works as expected.
When I instantiate the prefab the problem I am encountering is, that the PopupParent is stretched as expected, to the full screen, but all its children are not.
PopupParent looks like this:

Children Popup and ScreenDim look like this:

The instantiation I am doing using the Spawn Prefab Node in the Event editor provided by the ORK Framework. I am Mounting the PopupParent to my UICanvas.
It could be, that the issue is caused by some Framework settings, but it might very well be related to how Unity works in general. I am not sure and can't find a way to figure it out.
SOLUTION: I got ORK support to reply and solve the issue for me: http://forum.orkframework.com/discussion/6465/spawning-a-prefab-with-a-stretch-property#latest
TL;DR: Regular mounting and UI mounting works slightly different.

sentences:
When entities don't draw themselves, who actually does? There are countless questions here about whether entities should draw themselves or not. The answer is almost universally no, there should be a renderer. And I do see a point in having a single place where everything is rendered. Makes asset management easier and the code less convoluted.

However, I'm struggling to find a good approach to implement this in my 2D game. Currently, every entity is told to draw itself, and I pass the renderer object to it. Now, I want the renderer to draw each entity, but I don't want the renderer to actually know about entities, so I need a more generic class, e.g. RenderObject, and a way to construct render objects from entities.

One obvious approach would be to have a GetRenderObject() method on each entity. However, some of my entities actually draw multiple textures, relative to their position, so I'd probably need a GetRenderObjects() function instead.

But that wouldn't really remove any rendering logic from my entities. I'd still have to refer particular assets and their positions relative to the entity position in the render objects I create.

So my question is: Doesn't having a renderer mean that my entities don't have any drawing logic anymore? If so, who will generate these render objects? Does it even make sense to take the render objects detour?

And, bonus question: How can this work together with a UI system? I'd rather not have the renderer know about widgets and containers and such, so my hunch so far is to have widgets stick to drawing themselves.

sentences:
How do I test for collisions between two concave shapes decomposed into collections of convex polyhedra? I am using convex decomposition with SAT (separating axis theorem) and I generate two arrays of convex pieces, How do I submit my arrays to my collision detection method which only takes two arguments.

public MTV testCollision(BroadPhasePair pair) {
    Entity entity = pair.getBody();
    Entity id1 = pair.getBody();

    List<Convex> entityConvex = ConvexDecomposer.decompose(entity);
    List<Convex> id1Convex = ConvexDecomposer.decompose(id1);
    return null;
}

private MTV testCollision(Convex body,Convex id1) {
    float overlap = Float.MAX_VALUE;
    Vector3f smallest = null;
    Vector3f[] axis1 = body.getAxis();
    Vector3f[] axis2 = id1.getAxis();

    for(Vector3f axis : axis1) {
        Projection p1 = body.project(axis);
        Projection p2 = id1.project(axis);

        if(!p1.overlapps(p2)) return null;
            float o = p1.getOverlap(p2);
            if(o < overlap) {
                overlap = o;
                smallest = axis;

        }
    }

    for(Vector3f axis : axis2) {
        Projection p1 = body.project(axis);
        Projection p2 = id1.project(axis);

        if(!p1.overlapps(p2)) {
            return null;
        }else {
            float o = p1.getOverlap(p2);
            if(o < overlap) {
                overlap = o;
                smallest = axis;
            }
        }
    }

    MTV mtv = new MTV(smallest, overlap);
    return null;

}

I want to be able to somehow submit my array into the testCollision method.

sentences:
Why aren't tangent space normal maps completely blue? Why aren't normal maps just blue? I would think that normal maps should be predominantly blue in color because the Z component of the normal is represented by blue. Normals point out of the surface in the Z direction so we should see blue as the predominant colour since the Z component is dominant.

By definition tangent space is perpendicular to the surface. At any point we should have the normal always pointing in the Z (blue direction) with no X (red direction) or Y (green direction). Thus the normal map (since it is a "normal map") should have the colour of the normals which is just blue (R = x = 0, G = y = 0, B = z = 1) with no shades in between.

But normal maps are not so, and they have gradients of shades in them. Why is this so?

sentences:
Raycast doesn't point on the right direction The raycast line im rendering is acting weird, it doesn't point where I want it to.

I want it to point from the yellow object to the selected one but it draws it at another position.

Here is my script:

    #pragma strict

var player : Transform;
var turret : Transform;

var bullet : Transform;
var barrelEnd : Transform;

var shootRate = 0.3;

var canShoot : boolean = true;

var soundEffect : AudioClip;

function Update()
{
    shoot();
}

function shoot()
{
    turret.LookAt(player);
    var hit : RaycastHit;
    var fwd = turret.forward;
    if(Physics.Raycast(turret.position, player.position,hit, Mathf.Infinity))
    {
        if(hit.collider.transform.gameObject.tag == "Player")
        {
            if(canShoot == true)
            {
                var bulletInstance : Transform;
                bulletInstance = Instantiate(bullet, barrelEnd.position, transform.rotation);
                bulletInstance.LookAt(player.position);
                audio.PlayOneShot(soundEffect);
                w();
            }
        }
    }

    Debug.DrawRay(player.position, transform.position);
}

function w()
{
    canShoot=false;
    yield WaitForSeconds(shootRate);
    canShoot=true;
}

Thank you! I hope someone can help

sentences:
Get relative angle to collision Unity I want to get the angle between the rotation (euler Angles) of the camera (V1 : Vector3) and the collision point of my character, when it hits a wall, to determin, if it was left, right, or in front of it.I tried to use Vector2.Angle with V1 and V2 (ControllerColliderHit.moveDirection as a Vector2) to get the difference between them.

However I get a different value (0, 90, 180) when running into the wall depending on the world direction. (left wall, right wall, etc.)

How can I get the angle of the collision point relative to the direction the camera is facing?

sentences:
How do I make my game connect to a server without real IP address? I'm making an XNA game. When I started, I had a broadband connection with real IP, so I could host servers of any kind without any problem, but now I don't have that connection any more and I want to be able to let players from outside my local network connect to my server again. How do I do that? How do big guys at studios do that?

UPD: I guess it isn't fair to ask two questions in one, I just wanted to know if it's still possible for me to host a server on my connection, and if it's not an option, then how to do it without it (my connection). I believe I got my answers, though.

If I had an external dynamic address, I could use dynamic DNS service, but I don't, so I'll have to host my server on another machine (probably rent a server).

sentences:
Vulkan rendering of Minecraft-like world in C++ I decided on using 16x16x16 (4096 total) chunks of blocks.

Problem is with textures.
First idea was about texture atlas but it would require a lot of calculation and possible problems in dividing UV (1) by atlas size (power of 2).
Then I was thinking about using array of textures or sampler2darray.

I do not have fixed amount of textures and I reserved uint16 (65,535) for block-only textures (those textures are not used anywhere else, even items have their own item-only textures).
All those textures are loaded before the world (based on loaded "mods").

I got so far that array of textures should be best solution because they support different resolutions (8x8, 16x16, 32x32, 64x64...) without duplicated pixels (which sampler2darray would require when even 1 texture has higher resolution because all textures would be re-scaled to fit it).

Problems I found with array of textures are:

the length must also be defined in shader (which I would need to recompile at runtime)
limited length (256 to 2048 based on vulkan.gpuinfo.org but even Minecraft has 229 block types, some with multiple textures)

Advantages are:

possible "greedy" mesh optimization reducing number of vertices utilizing VK_SAMPLER_ADDRESS_MODE_REPEAT (GL_REPEAT in OpenGL)

Which type of storage for textures is best in this case?

Or should I separate faces by textures, create VkPipeline for each texture and render them one by one?

EDIT:
Each block has at least 1 texture (most time unique) but can be higher then 6 (different texture for each face) when 1 block is made of multiple cubes = non-solid.

sentences:
Jumping to land x pixels ahead while not really moving (2D) The player object in my game has its x-axis locked. It can only jump on Y. It's the ground that constantly moves to the left so that it appears like the player is moving to the right.

The ground is moving left at a speed of 240 pixels per second.

Whenever the player falls and hits the ground, I want it to jump so that it hits the ground again when it has gone 180 pixels to the left.

So, it should jump, the ground should get to move 180 pixels and then the player should hit the ground at that moment and jump. Then repeat. 180 pixels each time.

Oh and, the jump height may be variable. Specifically, there will be two jumps: a small jump and a big jump. Both need to land after the ground has moved 180 pixels.

I'm bad at math, so I can't figure it out. I would appreciate any help!

sentences:
Adding lighting to custom vertex shader in Unity What's the simplest way to add shadow functionality based on the modified vertices, nothing I've found online seems to work
 Shader "Unlit/HyperUnlit"
 {
     Properties
     {
         _MainTex ("Texture", 2D) = "white" {}
         _Color("Color", Color) = (1,1,1,1)
     }
     SubShader
     {
         Tags { "RenderType"="Opaque" }
         LOD 100

         Pass
         {
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag

             #include "UnityCG.cginc"
             #include "Complex.cginc"

             struct appdata
             {
                 float4 vertex : POSITION;
                 float2 uv : TEXCOORD0;
             };

             struct v2f
             {
                 float2 uv : TEXCOORD0;
                 UNITY_FOG_COORDS(1)
                 float4 vertex : SV_POSITION;
             };

             sampler2D _MainTex;
             float4 _MainTex_ST;
             fixed4 _Color;

             //Params
             float Tscale;
             float3 Tpos;
             float klein;
             float Rscale;

             //Mobius Transformation (a,b,c,d)
             float2 a;
             float2 b;
             float2 c;
             float2 d;

             v2f vert (appdata v)
             {
                 v2f o;
                 //Reduce to float3
                 float3 worldPos = mul(unity_ObjectToWorld, float4(v.vertex.xyz, 1)).xyz;

                 //2. Apply linear transformations
                 worldPos *= Tscale;
                 worldPos += Tpos;

                 //3. Apply mobius transformation
                 worldPos = MobiusXZ(a,b,c,d, worldPos);

                 //4. Klein?
                 if (klein==1)
                 {
                     worldPos = PoincareToKlein(worldPos);
                 }

                 //5. Scale to disk radius
                 worldPos *= Rscale;

                 //Convert back to ? space
                 o.vertex = mul(UNITY_MATRIX_VP, float4(worldPos, 1));

                 //transform position to clip space
                 //o.vertex = UnityObjectToClipPos(v.vertex);
                 o.uv = TRANSFORM_TEX(v.uv, _MainTex);

                 return o;
             }

             fixed4 frag (v2f i) : SV_Target
             {
                 // sample the texture
                 fixed4 col = tex2D(_MainTex, i.uv) * _Color;
                 return col;
             }
             ENDCG
         }
         UsePass "Legacy Shaders/VertexLit/SHADOWCASTER"
     }
 }

sentences: Unity 2d - rigidbody rotating Z axis if hit something I have problem with my player. I use rigidbody2D on my player and I had fixed rotation on Z, but now i need use rotation with some of my root animation. Ok, i enabled it, but when my player hit something (for example NPC, wall, ...), rotates on the Z axis and falls off. Can you help me? Thanks and sorry for my mistakes.

sentences:
Bullet physics with OpenGL I have got some problem implementing bullet physics into my opengl game. The thing is that it doesn't want to update my translatef value continously but only at the end.
The code for bullet looks like this:

void CGL::initPhysics( void ) {
broadphase = new btDbvtBroadphase();
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
solver = new btSequentialImpulseConstraintSolver;
dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);

dynamicsWorld->setGravity(btVector3(0,-10,0));

ballShape = new btSphereShape(1);
pinShape = new btCylinderShape(btVector3(1,1,1));
pinShape->setMargin(0.04);

fallMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,10,0)));
btScalar mass = 1;
btVector3 fallInertia(0,0,0);
ballShape->calculateLocalInertia(mass,fallInertia);

btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),1);

btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(0,groundMotionState,groundShape,btVector3(0,0,0));
btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
dynamicsWorld->addRigidBody(groundRigidBody);

btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass,fallMotionState,ballShape,fallInertia);
btRigidBody* fallRigidBody = new btRigidBody(fallRigidBodyCI);
dynamicsWorld->addRigidBody(fallRigidBody);

for (int i=0 ; i<300 ; i++) {
    dynamicsWorld->stepSimulation(1/60.f,10);

    btTransform trans;
    fallRigidBody->getMotionState()->getWorldTransform(trans);

    fallY = trans.getOrigin().getY();
}
state_list.remove( STATE_FALL_BALL );
printf("stoped\n");

}

And the drawing function which is called at the beginning looks like this:

void CGL::fallingBall( void ) {
glPushMatrix();

float colBall2[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
glMaterialfv( GL_FRONT, GL_AMBIENT, colBall2);

glTranslatef(0.0f,fallY,0.0f);

printf("fallY: %f\n",fallY);

glutSolidSphere(1.0f,20,20);

glPopMatrix();

}

The thing is that it shows correct value in this function's printf but translation is called only at the beginning I mean I can only see the last state.

Can anyone help me, please?

sentences:
Texture not visible on particles This is the first time I am working with particles (GL_POINTS) I am using kinematic equations and controlling their movement in vertex shader.

I am following an example given in OpenGL 4.0 Cookbook by David Wolff.

I am not able to see the texture which I am loading in the particle.
However, I can see the texture if I put it to some other object, say quad.

I have increased the size of POINT using glPointSize just so I can see if the texture is really visible.

In the image above you can that I am loading and rendering the same texture for quad, but when I use the same texture for particles, I get different results.
PS: The color which you're seeing for the particles is from the texture itself. If i choose a texture having white color, the same is seen for the particles.

Here is a code from my fragment shader.
I figured if the texture is being displayed correctly for quad, then the issue may not be with the loading of the texture.

if(rendPlane == false)
{
    //vs_fragColor = vec4(.3f,.3f,0.6f,1.00f);
    vs_fragColor = texture(u_particlesTex, gl_PointCoord);
    vs_fragColor.a *= vs_transp;
}
else
{
    //plane...
    vs_fragColor = texture(u_particlesTex, vs_texCoord);
}

sentences:
How to Ignore Raycast for Boxcollider2D by layer or boolean? How do I ignore raycasts for specific objects?  I want a filter, to ignore raycasts for some objects. As an example, when my player selects the ground, I do not want them to accidentally select bullets.

Is it possible to add boolean to the BoxCollider2D component, to identify raycast targets? I want to make it similar to the Image component.

My problem is that when several objects overlap, I need some of the objects to ignore the raycast.

I can't use Queries Hit Trigger or disable the collider component, because I need them to enter the OnCollisionEnter and OnTriggerEnter methods.

Here is my Update method:

void Update ()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity,
                1 « LayerMask.NameToLayer("Object"));

        if (hit)
        {
          Debug.Log(hit.collider.gameObject.name);
        }
    }
}

sentences:
Compute shader: Property at kernel index is not set I am trying to follow this excellent Coding Adventure: https://www.youtube.com/watch?v=lctXaT9pxA0 in order to get a very simple mesh deformation on a mesh using a compute shader.
I'm getting an error that reads:

Compute shader (NewComputeShader): Property (vertices) at kernel index (0) is not set
UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
MoonShader:runShader() (at Assets/MoonShader.cs:27)
MoonShader:Update() (at Assets/MoonShader.cs:15)

I'm calling runShader() in Update (maybe that's a terrible idea, but I don't think it's contributing to this specific problem yet).
Do I need to somehow pass my mesh's vertices into StructuredBuffer<float3> vertices;? If so, how am I supposed to do that?
This is the call to the compute shader in my .cs file.
void runShader() {
    int kernelHandle = computeShader.FindKernel("CSMain");
    computeShader.Dispatch(kernelHandle, 512, 1, 1); //this is the line it appears to be complaining about
}

This is my .compute file.
#pragma kernel CSMain
StructuredBuffer<float3> vertices;
RWStructuredBuffer<float> heights;
uint numVertices;
float testValue = 20;

[numthreads(512,1,1)]
void CSMain (uint id : SV_DispatchThreadID) {
    if(id >= numVertices) {

    } else {
        float3 vertexPosition = vertices[id];
        heights[id] = 1 + sin(vertexPosition.y * testValue) * 0.05;
    }
}

Link to repo if it's helpful: https://github.com/glenpierce/proceduralPlanets

sentences:
Top Down 2D Collision C# I know this has been asked before, but I don't understand why my code isn't working.

I'm doing top-down collision with no gravity.

Here is my code :

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

public class TankBodyControls : MonoBehaviour {

public KeyCode Foward = KeyCode.W;
public KeyCode Backward = KeyCode.S;
public KeyCode TurnLeft = KeyCode.A;
public KeyCode TurnRight = KeyCode.D;

public const float MaxSpeed = 6.0f;
public const float RotSpeed = 4.0f;

private Rigidbody2D TankBody;

void Start () {
    TankBody = GetComponent<Rigidbody2D>();
}

void OnCollisionEnter2D(Collision2D coll)
{
    print("called");
    if(coll.collider.CompareTag("wall"))
    {
        print("collided!");
        var P = transform.position;
        P.x -= TankBody.velocity.x;
        P.y -= TankBody.velocity.y;

        transform.Translate(P);
    }
}

private void MoveTank()
{
    var Vel = TankBody.velocity;

    if(Input.GetKey(Foward)||Input.GetKey(Backward))
    {
        float VelMag = (Input.GetKey(Foward) ? MaxSpeed : -1.0f * MaxSpeed/2.0f);
        float VelAngle = transform.eulerAngles.z * ((float)Math.PI / 180f);
        Vel = new Vector2((float)Math.Cos(VelAngle), (float)Math.Sin(VelAngle));
        Vel *= VelMag;

        var rot = TankBody.rotation;

        if (Input.GetKey(TurnRight))
        {
            rot -= RotSpeed;
        }

        if(Input.GetKey(TurnLeft))
        {
            rot += RotSpeed;
        }

        TankBody.rotation = rot;
    }
    else
    {
        Vel = Vector2.zero;
    }

    TankBody.velocity = Vel;
}

void Update ()
{
    MoveTank();
}
}

The idea was : if I detect a collision, shift the player out of the wall, the distance (velocity) they intersected it. My problem right now is, the OnCollisionEnter2D function doesn't even get called when they intersect (hence not console prints). Any idea what I'm doing incorrectly?

sentences:
Send OpenGL video flux via UDP It is possible to send the video flux of an OpenGL desktop app via UDP on Linux ? I looked up FBO and off-screen rendering but I still can't figure out how to extract the video flux and send it.

I'm working with C++ but if you have explanations in others langages go ahead.

Thanks.

My original post on stack overflow.

sentences:
What is an achievable way of setting content budgets (e.g. polygon count) for level content in a 3D title? In answering this question for swquinn, the answer raised a more pertinent question that I'd like to hear answers to. I'll post our own strategy (promise I won't accept it as the answer), but I'd like to hear others.

Specifically: how do you go about setting a sensible budget for your content team. Usually one of the very first questions asked in a development is: what's our polygon budget? Of course, these days it's rare that vertex/poly count alone is the limiting factor, instead shader complexity, fill-rate, lighting complexity, all come into play.

What the content team want are some hard numbers / limits to work to such that they have a reasonable expectation that their content, once it actually gets into the engine, will not be too heavy. Given that 'it depends' isn't a particularly useful answer, I'd like to hear a strategy that allows me to give them workable limits without being a) misleading, or b) wrong.

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: Temporarily ignore collision? Same premise as this question. When the ball bounces off of a wall, I want the ball to temporarily ignore all further collision events of the wall it just collided with, for three seconds for example. What's the best way to accomplish this?

sentences:
What technology is best for building my first game I have started a few game projects in the past, but have never finished anything.  I decided that it was probably because I was writing everything thing from scratch, and just ended up dropping the project once development started taking too long.

I've decided that I want to finish my first game now, and needed some opinions on what sort of middleware would be good to use.  I was hoping that with an engine provided for me, I'd be able to finish the game.

I am most familiar with C++, but do know quite a few other languages as well.

sentences:
Paint with soft brush (logic) During the last few days I was coding a painting behavior for a game am working on, and am currently in a very advanced phase, I can say that I have 90% of the work done and working perfectly, now what I need to do is being able to draw with a "soft brush" cause for now it's like am painting with "pixel style" and that was totally expected because that's what I wrote.

My current goal consist of using this solution :

Import a brush texture
Create an array that contain all The alpha values of that texture
When drawing use the array elements in order to define the new pixels alpha

And this is my code to do that (it's not very long, there is too much comments)

//The main painting method
//theObject     = the object to be painted
//tmpTexture    = the object current texture
//targetTexture = the new texture
void paint (GameObject theObject, Texture2D tmpTexture, Texture2D targetTexture)
{
    //x and y are 2 floats from another class
    //they store the coordinates of the pixel
    //that get hit by the RayCast
    int x = (int)(coordinates.pixelPos.x);
    int y = (int)(coordinates.pixelPos.y);

    //iterate through a block of pixels that goes fro
    //Y and X and go #brushHeight Pixels up
    // and #brushWeight Pixels right
    for (int tmpY = y; tmpY<y+brushHeight; tmpY++) {
        for (int tmpX = x; tmpX<x+brushWidth; tmpX++) {
           //check if the current pixel is different from the target pixel
           if (tmpTexture.GetPixel (tmpX, tmpY) != targetTexture.GetPixel (tmpX, tmpY)) {
               //create a temporary color from the target pixel at the given coordinates
                Color tmpCol = targetTexture.GetPixel (tmpX, tmpY);
                //change the alpha of that pixel based on the brush alpha
                //myBrushAlpha is a 2 Dimensional array that contain
                //the different Alpha values of the brush
                //the substractions are to keep the index in range
                if (myBrushAlpha [tmpY - y, tmpX - x].a > 0) {
                    tmpCol.a = myBrushAlpha [tmpY - y, tmpX - x].a;
                }
                //set the new pixel to the current texture
                tmpTexture.SetPixel (tmpX, tmpY, tmpCol);
            }
        }
    }
    //Apply
    tmpTexture.Apply ();
    //change the object main texture
    theObject.renderer.material.mainTexture = tmpTexture;
}

Now the fun (and bad) part is the code did exactly what I asked for, but by asking to draw anytime with the brush alpha I found myself create a very weird effect which is decreasing the alpha value of an "old" pixel, so I tried to fix that by adding an if statement that check if the current alpha of the pixel is less than the equivalent brush alpha pixel, if it is, then augment the alpha to be equal to the brush, and if the pixel alpha is bigger, then keep adding the brush alpha value to it in order to have that "soft brushing" effect, and in code it become this  :

if (myBrushAlpha [tmpY - y, tmpX - x].a > tmpCol.a) {
  tmpCol.a = myBrushAlpha [tmpY - y, tmpX - x].a;
} else {
  tmpCol.a += myBrushAlpha [tmpY - y, tmpX - x].a;
}

But after I've done that, I got the "pixelized brush" effect back, am not sure but I think maybe it's because I'm making these conditions inside a for loop so everything is executed before the end of the current frame so I don't see the effect, could it be that?

Am really lost here and hope that you can put me in the right direction.

sentences:
Shortcut for NodeJS server I am tired of typing  "cd c:\socket\nodejs"
                      "node testserver.js"

Into the command promt..

How do I create a shortcut or bat for it?

sentences:
Stereo 3D: drawing 2D elements at apparent screen depth I'm developing an application making use of DirectX11's stereoscopic features. At such I am not relying on nVidia's automatic implementation. That means I have to replicate a way to render 2d elements in clip space at an user-defined depth.

According to their 3d vision automatic best practices whitepaper, they suggest scaling the clip position by the chosen depth factor:

pClip *= depth/pClip.w

This works because the shader "footer" they add to the intercepted draw calls does:

pClip.x+= eye * separation * (pClip.w - convergence)

Where eye is the sign which alternates between left and right draw calls. This produces offsetted 2d renderings that when fused make 2d elements appear at the chosen apparent depth. Any .w greater than convergence appear beyond the screen and vice versa. I have replicated this functionality (for regular 3d drawing I am using two projection matrices) but since I need these elements to be rendered in orthographic mode I am not entirely sure if it is correct.

I am using a value of 1.25" as the interocular distance and 24" as the viewer distance (or convergence). If I plug those values in the equation above then it produces an offset that is too great to be fused. I have eyeballed a value of 0.015 that appears to produce correct positioning. So the equation becomes:

pClip.x+= +/-1 * .015 * (pClip.w - 24)

What is the correct math to use to calculate the correct offset in clip space so that two 2d ortho renderings result in a user chosen apparent screen depth?

sentences:
Generate road mesh from a graph I want to generate a mesh for the entire road network(later I'll probably want to split it into chunks but for now this will do).

My road network is stored as a TArray of pointers to a struct that contains the node location and pointers to each connected road(it's up to 4 nodes, each one has a direction).

struct FRoadNode
{
    int radius;
    float angle;
    TWeakPtr<FRoadNode> topNode;
    TWeakPtr<FRoadNode> bottomNode;
    TWeakPtr<FRoadNode> rightNode;
    TWeakPtr<FRoadNode> leftNode;
}

The road is following a polar grid. (see Frostpunk for example, it's almost exactly like that)

Each arc will be divided by its length to have as little vers as possible while keeping a nice curve.
If 2 line segments get too close the will be merged at the intersection point. (3rd example below, still not sure about this one...)
If 2 intersections are too close together they will be merged.

Here's the general idea of how I was thinking of generating the mesh:

I'm pretty new to generating mesh programmatically and to UE C++... so..
1. Is there a nice algorithm out there that will make my life a little bit easier?
2. How should I approach it?
3. Should I connect the road segment verts with the intersections verts?
4. Are there some advanced techniques that I need to know about?

BTW I saw somewhere a way to generate the road mesh by connecting all the nodes then extrude the edges, but I can't find it and I have no idea how this method called, If you know what I'm talking about, please tell what it's called\provide links.

sentences:
Particle system appear inside UI? How to make the particle system appear inside the Canvas ? No need for unity store assets.
I'm using Unity 5.5.0

sentences:
GUI rendered into texture(s) or not? I am eyeing OpenVG and cairo as rendering libraries for my pet game GUI. You can use both to render either into a texture or issue GL commands to draw directly onto the display. If I would use them directly, there are the following issues:

they will mess with GL state, which can be a problem, if it happens every frame,
their code will be executed every frame, if the GUI is drawn directly, but the GUI textures would be updated only when game state changes.

For this reasons I think I should be rendering the GUI into texture(s), but I'm asking here just to be sure.

sentences:
How do I create the visual effect of transitioning between night and day? I am making an open-world project in Unity 4.5.5 and I want to create a visual effect of transitioning from day to night? The Legend of Zelda: Wind Waker HD has a great example of such a transition.

How can I achieve this? Can I use a script or do I need to create multiple scenes with different skyboxes to make this possible?

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:
SFML - Moving a sprite on mouseclick I want to be able to move a sprite from a current location to another based upon where the user clicks in the window. This is the code that I have:

#include <SFML/Graphics.hpp>

int main()
{
    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

    // Load a sprite to display
    sf::Texture Image;
    if (!Image.LoadFromFile("cb.bmp"))
        return EXIT_FAILURE;
    sf::Sprite Sprite(Image);

    // Define the spead of the sprite
    float spriteSpeed = 200.f;

    // Start the game loop
    while (App.IsOpened())
    {
        if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Escape))
            App.Close();

        if (sf::Mouse::IsButtonPressed(sf::Mouse::Right)) {
            Sprite.SetPosition(sf::Mouse::GetPosition(App).x, sf::Mouse::GetPosition(App).y);
        }

        // Clear screen
        App.Clear();

        // Draw the sprite
        App.Draw(Sprite);

        // Update the window
        App.Display();
    }

    return EXIT_SUCCESS;
}

But instead of just setting the position I want to use Sprite.Move() and gradually move the sprite from one position to another. The question is how? Later I plan on adding a node system into each map so I can use Dijkstra's algorithm, but I'll still need this for moving between nodes.

sentences:
How to make a triangle pixellated with GLFW? How can one make a triangle look pixelated without modifying the size of the window in GLFW3?

Preferably, I'd like to accomplish this without the use of shaders. For example, by setting the size of the frame buffer to be 1/8th the size of the window.

I've created an Xcode test project for this and tried setting a small window size to create a small framebuffer, then changing the window size to be big afterwards, but the framebuffer size always changes to match the window size.

Example project output:

Desired output:

sentences:
How can I tell Unity to use specific frames for animation? So I have made a set of animations in a one file in Blender. For example, frame 0-20 idle animation, 30-60 walking animation, 70-120 jumping animation.

How can I tell the program to separate the animations by selecting those frames, cutting them or something and this way I could have a set of animations without needing to save .blend files separately with the animations?

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:
Monogame working with Krypton I am trying to make a simple 2D game engine using Monogame and the Krypton 2.0 lighting engine. So far I have succeeded in rendering a light but I am unable to generate any shadows from any hull's. Does anyone know if this can be done using Krypton with Monogame? If this cannot be done does anyone know of any other lighting engines that work with Monogame. I just need to draw one light from the center of the view port.

As a side note I was able to get proof that the hull is in the correct position because I can see a grey outline of the hull at the correct position. My creation code for the light and the hull is the following:

        var texture = LightTextureBuilder.CreatePointLight(this.GraphicsDevice, 512);

        Light2D light = new Light2D()
        {
            Texture = texture,
            Range = 700,
            Color = Color.White,
            Intensity = 0.5f,
            Angle = MathHelper.TwoPi * 1f,
            X = 0,
            Y = 0,
        };

        var hull = ShadowHull.CreateRectangle(new Vector2(1,1));
        hull.Scale = new Vector2(50, 50);
        hull.Position = new Vector2(75,0);

        _krypton.Lights.Add(light);
        _krypton.Hulls.Add(hull);

As for drawing krypton I use the following code:

            _krypton.Matrix = ActiveRoom.Camera.GetTransformation();
            _krypton.SpriteBatchCompatablityEnabled = true;
            _krypton.CullMode = CullMode.None;
            _krypton.Bluriness = 1;
            _krypton.LightMapPrepare();

            _spriteBatch.Begin(/*camera transform and blending. Nothing special*/);
           //draw code is here
            _spriteBatch.End();

            _krypton.Draw(gameTime);

The only changes that I made to krypton itself was to replace the XNA references with Monogame and I had to comment out all of the ColorWriteEnable lines from the KryptonEffect.fx file so that the Monogame content pipeline would compile the shader. Is there something that I have missed or will I have to find a new lighting engine?

Thanks for your help in advance. Any advice is much appreciated.

sentences:
Shader Maker version 130 is not supported I am trying to compile a vertex shader with Shader Maker and if I try to use the version 130 it says:

  Compiling Vertex Shader
  ERROR: 0:3: '' :  version '130' is not supported

  Compiling Fragment Shader

I need to use the version 130. Now I installed Shader Maker from it's site. I wonder if there is a way to use the version 130, what should I do?

sentences:
C++ property system interface for game editors (reflection system) I have designed an reusable game engine for an project, and their functionality is like this:

Is a completely scripted game engine instead of the usual scripting languages as Lua or Python, this uses Runtime-Compiled C++, and an modified version of Cistron (an component-based programming framework).to be compatible with Runtime-Compiled C++ and so on.

Using the typical GameObject and Component classes of the Component-based design pattern, is serializable via JSON, BSON or Binary useful for selecting which objects will be loaded the next time.

The main problem: We want to use our custom GameObjects and their components properties in our level editor, before used hardcoded functions to access GameObject base class virtual functions from the derived ones, if do you want to modify an property specifically from that class you need inside into the code, this situation happens too with the derived classes of Component class, in little projects there's no problem but for larger projects becomes tedious, lengthy and error-prone.

I've researched a lot to find a solution without luck, i tried with  the Ogitor's property system (since our engine is Ogre-based) but we find it inappropiate for the component-based design and it's limited only for the Ogre classes and can lead to performance overhead, and we tried some code we find in the Internet we tested it and worked a little but we considered the macro and lambda abuse too horrible take a look (some code omitted):

   IWE_IMPLEMENT_PROP_BEGIN(CBaseEntity)
     IWE_PROP_LEVEL_BEGIN("Editor");
       IWE_PROP_INT_S("Id", "Internal id", m_nEntID, [](int n) {}, true);
            IWE_PROP_LEVEL_END();
            IWE_PROP_LEVEL_BEGIN("Entity");
              IWE_PROP_STRING_S("Mesh", "Mesh used for this entity",
         m_pModelName, [pInst](const std::string& sModelName) {
           pInst->m_stackMemUndoType.push(ENT_MEM_MESH); pInst->m_stackMemUndoStr.push(pInst->getModelName());
           pInst->setModel(sModelName, false); pInst->saveState();
         }, false);
       IWE_PROP_VECTOR3_S("Position", m_vecPosition,
  [pInst](float fX, float fY, float fZ) {
    pInst->m_stackMemUndoType.push(ENT_MEM_POSITION); pInst->m_stackMemUndoVec3.push(pInst->getPosition()); pInst->saveState();
    pInst->m_vecPosition.Get()[0] = fX; pInst->m_vecPosition.Get()[1] = fY; pInst->m_vecPosition.Get()[2] = fZ;
    pInst->setPosition(pInst->m_vecPosition);
  }, false);
       IWE_PROP_QUATERNION_S("Orientation (Quat)", m_quatOrientation,
  [pInst](float fW, float fX, float fY, float fZ) {
    pInst->m_stackMemUndoType.push(ENT_MEM_ROTATE); pInst->m_stackMemUndoQuat.push(pInst->getOrientation()); pInst->saveState();
    pInst->m_quatOrientation.Get()[0] = fW; pInst->m_quatOrientation.Get()[1] = fX; pInst->m_quatOrientation.Get()[2] = fY; pInst->m_quatOrientation.Get()[3] = fZ;
    pInst->setOrientation(pInst->m_quatOrientation);
  }, false);

     IWE_PROP_LEVEL_END();
    IWE_IMPLEMENT_PROP_END()

We are finding an simplified way to this, without leading confusing the programmers, (will be released to the public) i find ways to achieve this but they are only available for the common scripting as Lua or editors using C#. also too portable, we can write "wrappers" for different GUI toolkits as Qt or GTK, also i'm thinking to using Boost.Wave to get additional macro functionality without creating my own compiler.

The properties designed to use in the editor they are removed in the game since the save file contains their data and loads it using an simple 'load' function to reduce unnecessary code bloat may will be useful if some GameObject property wants to be hidden instead.

In summary, there's a way to implement an reflection(property) system for a level editor based in properties from derived classes?

Also we can use C++11 and Boost (restricted only to Wave and PropertyTree)

sentences:
What's a good entity hierarchy for a 2D game? I'm in the process of building a new 2D game out of some code I wrote a while ago.

The object hierarchy for entities is like this:

Scene (e.g. MainMenu): Contains multiple entities and delegates update()/draw() to each
Entity: Base class for all things in a scene (e.g. MenuItem or Alien)
Sprite: Base class for all entities that just draw a texture, i.e. don't have their own drawing logic

Does it make sense to split up entities and sprites up like that? I think in a 2D game, the terms entity and sprite are somewhat synonymous, right?

But I do believe that I need some base class for entities that just draw a texture, as opposed to drawing themselves, to avoid duplication. Most entities are like that.

One weird case is my Text class: It derives from Sprite, which accepts either the path of an image or an already loaded texture in its constructor. Text loads a texture in its constructor and passes that to Sprite.

Can you outline a design that makes more sense? Or point me to a good object-oriented reference code base for a 2D game? I could only find 3D engine code bases of decent code quality, e.g. Doom 3 and HPL1Engine.

sentences:
Why does my shader's Texture become unselected when I run my game? I'd like to add a custom material to a line that I'm drawing in Unity (using Vectrosity).  I'm using Unity's built-in "Unlit/Texture" shader.  When I drag a texture from my Resources directory into the "Texture" slot in my shader, everything looks good:

But when I click play, the texture disappears:

and my line doesn't show up in my game.  However, if I drag the texture to the shader's texture slot after I click play, the texture seems to "stick" and my line renders as expected:

But once I stop and start the game, the texture again disappears.

Why is Unity kicking out my texture when my game starts?  Is there something wrong with my texture?  I don't see any warnings or errors in the console.  I've tried with numerous different textures, and they all do the same thing.

I'm using Unity 5.6.1f1.

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:
Make player to always move along the terrain I'm working on a 2D platformer side scroller game. I am giving high impulse to player, the player starts moving and if it hits a slope on terrain, it gets a vertical movement and starts to fly over (Box2D physics).

What I need is that the player should always be on the terrain and move along the ground.

I would like to know if it's possible using Box2D engine.

sentences:
Is a HashTable the best way to store replay data in C#? I'm looking to make a deterministic replay in my 2D game. I want to follow a similar approach to braid in storing the relevant information every frame (at 60 frames per second).

I wanted to know what the best way to store this information is. My friend suggested using a hashtable and being new to C# I'm sort of leaning towards just using an array, but I wanted to see if there were other schools of thought.

I've read posts like this How to design a replay system and this "Super meatboy"-ish replay which were very informative, but not very specific to C# and XNA.

My game is 2D and does not have all that many moving parts. At any given time there is probably less than 50 bodies I would need to track the position/rotation of.

Curious to hear your thoughts.

sentences:
Maya Animated Character export for XNA 4.0 problem To begin with, I'm trying to export an animated character in .fbx format from Maya 2013 to XNA 4.0

In Maya, The Model has a basic rig and the animations are in clips made in the Trax editor.

so the issue i'm having is after selecting the model and the root joint and then hitting export in .fbx format, for some reason when i open the exported .fbx file the joint system is detached from the model with no animation.

Btw, i have the animations in clips so that they can be called in code, for example "run","walk","attack".

So, what can i do to solve this problem?

Thank you.

sentences:
processing request in order on game server I am creating a simple multiplayer puzzle game in which multiple players can join a lobby and compete with each other. the player that submits the answer first gets the highest point, the player that submits the answers second gets the second highest point and so on..

How do I maintain the order of request on the server side?

I assume i cannot use an event-based server as it would become impossible to process requests in order.

a simple multithreaded server would be an ideal choice in this case as the requests will be short-lived.

initially, I was thinking to create the server in python but since it has not so good support for "real threads" it would mean compromising on performance.

My two main questions are:

how is this scenario generally handled?
how is this scenario
    generally handle if the language of choice is python?

sentences:
Particles to Denote Movement in Space I'm currently working on a WebGL project to realise an idea I've had for some years. On my desk is book on making a space sim written 15 years ago.

There I found some algorithm for particles in space. The idea is simple: A cloud of particles that stay in place so they fly past the player, but reset to be in front of the player when they move past the ship. This shows the player they're moving while there's nothing else around. For this, I reworked the algorithm found in the book a little:

ParticleField.prototype.updateCloud = function(frustum, position, direction) {
  var s = this.size, s2 = s * 2;

  for (var i = 0; i < this.vertices.length; i++) {
    if (!frustum.containsPoint(this.vertices[i])) {
      this.vertices[i].set(
        (position.x + s - Math.floor(Math.random() * s2)) + (s * direction.x),
        (position.y + s - Math.floor(Math.random() * s2)) + (s * direction.y),
        (position.z + s - Math.floor(Math.random() * s2)) +
                         ((s + Math.floor(Math.random() * s2)) * direction.z)
      );
    }
  }
};

Where s is the size of cloud. I played around with the sizes, but this simple function has several weaknesses.

The particles 'pop up' in front of the player when they're moving.
If the player backs up and moves backwards, the particles won't reset, leaving the cloud visible popping the illusion.
Particles appear to be flying through the player.

Without regard of how the particles look (they're simple points right now), how can I make this look more natural? I've seen the effect in games like Elite: Dangerous and Freelancer, and I'd like to be closer to them, and I'd appreciate any hint on the topic.

sentences:
What should audio programmers know? I'm a music composition student also getting a minor-plus-some in computer science. I love writing music and making sound effects and want to write music for games. But, I also realize everyone and their mother wants to do that. With that in mind, and since I'm already equally in love with programming, I'm interested in looking at focusing some aspects of the computer science portion of my education towards audio implementation for games.

What I've done/am doing:

Wrote "MusicManager" classes that are aware of musical timings and a small amount of automated mixing based on game events
Reading Who is Fourier? as I work my way toward understanding Fourier analysis and implementing the FFT
Learning FMOD Designer and using the designer API in a game (of course not taking a class specifically on this, I'm good for learning APIs on my own)

With that background, I've got a two-part question.

So aside from the things I list above, and the good ole fundamentals of computer science (data structures and algorithms, discrete math, OO/structured design), what are studios looking for in audio programmers?

Also, G.A.N.G. and Audio Engineering Society lecturers speak as though audio programmers are the next hot thing in games, but do many studios even have or think to hire dedicated audio programmers?

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

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

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

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

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

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

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

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

sentences:
Enemy mathematical behavior I'm really trying to up my game in game mathematics and now I'm working on enemy movement and a bit of AI. I have an enemy with two modes attack and avoid, based on an integer avoid variable that's either 1 or 0.

On avoid I want it to hover by the player, moving back and forth at a distance until it is set to avoid.

On attack I want to go close at a steady pace say an x and y velocity of 12, then once it reaches a certain distance to gain speed.

I have disx and disy variables that have the distance from each other for each coordinate. I also have a totDis variable with the normal a^2 + b^2 = c^2 formula. I'm pretty sure I'll need another variable that I'll have to change depending on the distance that effects the speed.

It kinda feels like I have all the pieces to the puzzle, I just don't know how to put them together though lol.

I'd like to be able to do this as mathematically as possible and I don't want anyone to give the the answer or do it for me. I was hoping if anyone could give me pointers or tips or just ideas on the directions I can go myself because I really want to have an understanding of this. I hope this is specific enough, if not I'll try to edit my question for you.

sentences:
Handling keyboard input in SDL2 I'm using SDL2 with .NET bindings. Keyboard handling is encapsulated in static class, and keyboard handling code part looks like this:

// class members
private static int _numkeys;
private static IntPtr _keysBuffer;
private static byte[] _keysCurr = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];
private static byte[] _keysPrev = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];

// called once, to get buffer pointer
_keysBuffer = SDL_GetKeyboardState(out _numkeys);

// update keyboard state each frame
var tmp = _keysPrev;
_keysPrev = _keysCurr;
_keysCurr = tmp;
// copy new state
Marshal.Copy(_keysBuffer, _keysCurr, 0, _numkeys);

all is workig as expected mostly, however once in while one of the following behavior occurs:

Physical key is pressed, but no key press is detected. Keypress is detected after key repeat interval.
Physical key is pressed, but no key press is detected. Lasts for infinite amount of time.

For example, I press Right (D), the movement to right starts, shortly after I press Fire (SPACE), movement is stopped, no firing occurs, then after key repeat interval firing starts, but movement to Right is stopped despite key is also still pressed.

Unfortunatelly I have both 1) not discovered 100% reproducible pattern for the bug yet (seems like it happens on burst sequental presses), 2) have no ideas what is the cause.

For now I just want, a fresh view on my code (is it solid?) and maybe some ideas on what to check. Thanks!

sentences:
Shader and Custom Vertex Format Errors I am creating an editor of sorts that allow you to create 3D voxel models. I just got started and have ran into a few errors. Here is what it is producing:

I think the problem has to do with the way I am handling my vertex format (VertexPositionNormalColor) shader or the way either of them are written:

    struct VertexPositionNormalColor {
        Vector3 position;
        Vector3 normal;

        Color color;

        public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration(
            new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
            new VertexElement(sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementUsage.Normal, 1),
            new VertexElement(sizeof(float) * 6, VertexElementFormat.Vector4, VertexElementUsage.Color, 0)
        );

        public VertexPositionNormalColor(Vector3 position, Vector3 normal, Color color) {
            this.position = position;
            this.normal = normal;
            this.color = color;
        }
    }

Shader code:

struct ColoredVertexToPixel  {
    float4 Position     : POSITION;
    float4 Color        : COLOR0;
};

struct ColoredPixelToFrame  {
    float4 Color        : COLOR0;
};

ColoredVertexToPixel ColoredVertexShader(float4 inPosition : POSITION, float3 inNormal : NORMAL, float4 inColor : COLOR0)  {
    ColoredVertexToPixel Output = (ColoredVertexToPixel)0;

    float4 worldPos = mul(inPosition, World);
    float4 viewPos = mul(worldPos, View);

    Output.Position = mul(viewPos, Projection);
    Output.Color = inColor;

    // TODO: Implement basic lighting

    return Output;
}

ColoredPixelToFrame ColoredPixelShader(ColoredVertexToPixel PSIn)  {
    ColoredPixelToFrame Output = (ColoredPixelToFrame)0;

    Output.Color = PSIn.Color;

    return Output;
}

technique ColoredBlock  {
    pass Pass0  {
        VertexShader = compile vs_2_0 ColoredVertexShader();
        PixelShader = compile ps_2_0 ColoredPixelShader();
    }
}

I also tryed the object creation code in another project with a different effect file and vertex format and it worked fine. This is defiantly a shader/vertex format error as I set each vertex with the exact same color, so maybe the color and position data in the shader is getting with each other?

Any ideas?

Thanks

sentences:
What is the highest quality way to render warped text on Windows? I need to render highly readable text, on par with DirectWrite+Cleartype+Truetype. The Cleartype system uses sub-pixel anti-aliasing. DirectWrite takes things a step further and moves letters around slightly (sub-pixel positioning, pixel snapping, etc.) to maximize readability and minimize distortions. This was important enough that every major web browser uses DirectWrite on Windows.

The obvious plan (with major shortcomings) is to render DirectWrite to a texture with cleartype disabled (because sub-pixel AA doesn't lend itself to transforms) and pixel snapping disabled (because that pixel "grid" is meaningless after transformation.) Unfortunately the text will look worse than it could if glyphs are enlarged or shrunk, and of course the lack of pixel snapping will hurt readability.

Ignoring performance, is there a higher quality way to draw warped text in Windows?

Edit: removed comment about disabling AA (DWRITE_RENDERING_MODE_ALIASED).

sentences:
How do I implement "prewarming" in particle engines? How is prewarming in particle engines made?

I have a particle engine and need to support this, which is a feature I have already seen in Unity.

Is it done at compilation, like informations stored somewhere? or pre-processed at launch? or is there a way to simulate a particle system when it is created?

Considering it is time based, I don't see how I could for example simulate 15 seconds of life for a particle system without actually using 15 seconds

sentences: How do games such as aa Game have high levels in the structure of their code How do games such as aa Game have high levels in the structure of their code? I mean if we want create a game with high levels, should we create and use a class for each level? I do not want code from you. only I want know for creating a game with high levels in android, What we should do in coding? Is it good if we create and use a class for each level?

sentences:
glm direction vector rotation I'm working on a flight simulator, but I'm stuck with my airplane orientation. I tried some things but noone worked correctly. This is what I have :

To be able to move it and roll it around himself, I need two vectors, forward and up, and use them to create quaternions I need for the rotation :

void Plane::Update()
{
    m_position += ( m_forward * m_speed );

    mat4 translation = translate( mat4( 1.0f ), m_position );

    float angle = dot( vec3( 1.0f, 0.0f, 0.0f ), m_forward );
    quat direction = angleAxis( acos( angle ), cross( vec3( 1.0f, 0.0f, 0.0f ), m_forward ) );

    m_matrix = translation * mat4_cast( direction );
}

vec3( 1.0f, 0.0f, 0.0f ) is my model orientation. Note that in this code, I don't have quaternion for rolling the plane, because I first want to have a correct direction.

This works great, what doesn't work is when I want to make him taking off. To do that, I first get the right vector, then use it to create my quaternion with the angle I need, and I apply the rotation to the forward and up vector.

void Plane::FlyUp()
{
    vec3 right = cross( m_forward, m_up );

    quat temp = angleAxis( radians( 1.0f ), right );

    m_up = temp * m_up;
    m_up = normalize( m_up );

    m_forward = temp * m_forward;
    m_forward = normalize( m_forward );
}

Using debugger and an online vector visualizer, It seems to give me the good vectors, but the plane is rotating weirdly ( in fact, that's not even only rotating, he's scaled too for some reasons... ).

What am I doing/understanding wrong?

Edit :

To be more precise, here is screenshoots of what I have :

And what I'm trying to have, whatever the m_forward vector is pointing to :

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:
Unity and arduino processing This question relates to this link:
https://www.freetronics.com.au/blogs/news/6537043-experimenting-with-unity-processing-and-arduino#.W2-SFs4zbIU
Does anyone have any idea how I would begin doing this? I cannot find the tutorial or code that relates to this. I have a cube on unity that changes colour and texture according to the input from a force sensing resistor. How would I get the cube to react in this way (as in the video)? Any assistance will be appreciated

In this video, a flexiforce sensor is housed in a cube. When the user presses the sensor, a cube on Unity reacts in the same manner that the real cube is squeezed; its basically a virtual version of what is happening to the cube in real life

sentences:
Typical Method Of Building Puzzle Levels I am designing a puzzle game for the iphone and was wondering as most puzzle games consist of the player progressing through multiple levels. You see for example Angry Birds has over 100 levels.

Once the basis of the game is made, how do developers typically go about building their levels?

Do they generally build them from scratch each one more or less, or work of their own template or have some other method which they use to tailor these levels?

I imagine building so many levels is a long process, certainly if building each one individually. Do they do this, or have a method which speeds it up once they have their basis?

sentences:
Loading sprite resources from nested folders This is how I try to load my sprite images:

 sprite Sprites[];

 void Start() {
    ...
    Sprites = Resources.LoadAll<Sprite>("Card/AnimalImages");
    Debug.Log("Sprite name: " + Sprites[8].name);
    ...
 }

But it gives me the error that you can see in the picture below. Note that in the same figure there is a hierarchy of folders on the right side. I put two ellipsis in the code because it is actually much longer than what I posted, but I assure you that the script is correctly attached to the object and it generally works.

The problem is that it doesn't load the sprites as I expect: the debugger hangs at the point where the Debug.Log(...); is executed (precisely when it tries to access the Sprites vector which is probably empty).

It's the first time in Unity3D where I need to load the sprites in that way. I tried to look in some previous posts, probably I will have missed someone, but in those found until now no one has helped me.

Can someone help me to understand how to load the sprites and especially where is my mistake?

  Update

I tried to check if could be a problem of static/dynamic arrays, but it seems not to be a problem of this type, in fact following code:

    Sprites = new ArrayList(Resources.LoadAll<Sprite>("Card/AnimalImages"));
    Debug.Log("Size of dynamic array: " + Sprites.Count);

prints:

Size of dynamic array: 0

sentences:
Separating logic and data in browser game I've been thinking this over for days and I'm still not sure what to do. I'm trying to refactor a combat system in PHP (...sorry.) Here's what exists so far:

There are two (so far) types of entities that can participate in combat. Let's just call them players and NPCs. Their data is already written pretty well.
When involved in combat, these entities are wrapped with another object in the DB called a Combatant, which gives them information about the particular fight. They can be involved in multiple combats at once.
I'm trying to write the logic engine for combat by having combatants injected into it.
I want to be able to mock everything for testing.

In order to separate logic and data, I want to have two interfaces / base classes, one being ICombatantData and the other ICombatantLogic. The two implementers of data will be one for the real objects stored in the database, and the other for my mock objects.

I'm now running into uncertainties with designing the logic side of things. I can have one implementer for each of players and NPCs, but then I have an issue. A combatant needs to be able to return the entity that it wraps. Should this getter method be part of logic or data? I feel strongly that it should be in data, because the logic part is used for executing combat, and won't be available if someone is just looking up information about an upcoming fight. But the data classes only separate mock from DB, not player from NPC. If I try having two child classes of the DB data implementer, one for each entity type, then how do I architect that while keeping my mocks in the loop? Do I need some third interface like IEntityProvider that I inject into the data classes?

Also with some of the ideas I've been considering, I feel like I'll have to put checks in place to make sure you don't mismatch things, like making the logic for an NPC accidentally wrap the data for a player. Does that make any sense? Is that a situation that would even be possible if the architecture is correct, or would the right design prohibit that completely so I don't need to check for it?

If someone could help me just layout a class diagram or something for this it would help me a lot. Thanks.

edit

Also useful to note, the mock data class doesn't really need the Entity, since I'll just be specifying all the parameters like combat stats directly instead. So maybe that will affect the correct design.

sentences: Game networking topology - dealing with host leaving I am working on a P2P game in Flash and I'm wondering what network topology would be most robust for dealing with people randomly joining/leaving. I was thinking the first user to join could be the host, but if the host leaves the whole session would be killed. I am looking for a way to deal with this with no (or little) disruption.

sentences:
Unity's LODs by distance to the orthographic camera I'm trying to do something that I thought was simple, but seemingly it's not that easy.

I understand that Unity's LOD system works by refering to a percentage of screen size that objects occupy. That's not fit for the isometric 3D game I'm trying to make.

I'd like to have my LODs match the distance from the orthographic camera, as perceived from the viewer. Or, to put it otherwise, that the LODs are set according to their distance from the plane of the camera (and not the camera object itself) multiplied by the orthographic factor. Thus, when the ortho camera zooms out, all objects should swap LODs at the same time.

Is there a simple (or less simple) way to do that ?

Thanks

sentences:
How do I communicate with an IronPython component in a C#/XNA game? My XNA game is component-oriented, and has various components for position, physics representation, rendering, etc, all of which extend a base Component class. The player and enemies also have controllers which are currently defined in C#. I'd like to turn them into Python scripts via IronPython (a .NET implementation of Python). My problem is that I'm not sure how to interact with those scripts.

The examples in Embedding IronPython in a C# Application suggest I'd have to create something like a Script component which compiles a Python script and calls the controller's Update method via Python - essentially, it'd be a wrapper class for C# to interface with Python.

I feel that I'm missing something in my research. There must be a way to load up a script, instantiate a Python object (either in the Python script or in C#) and then then have a direct reference to that Python object in my C# code.

Is there a way to work with an IronPython object directly, or is a wrapper required?

sentences:
How do I make a resolution independent system? I'm blanking on this one. I can anchor stuff on edges of course, that would make my UI resolution independent...until it changes so much that the graphics are too small. How do I scale appropriately whenever needed? How do I keep my graphics at the right proportion while scaling? I don't want them stretched if the resolution has a different proportion like 16:10 as opposed to whatever else.

Is there a true and tested approach to this? Video players show black borders because of this problem, is this not properly solvable?

sentences:
How do I convert from the global coordinate space to a local space? Given an entity named EntityA, I want to define a local coordinate space, where the position of EntityA is the origin, its heading vector is the X axis, and the normal of the heading vector is the Y axis:

Given their global coordinates, how do I find the position of another entity in EntityA's local space?

An example: EntityA's global position is (50,50), and that of EntityB is (80,90). What is then the position of EntityB in EntityA's local space?

EDIT: Please go easy on the math.

sentences:
How to draw multiple large background images using libgdx? I have developed a basic lunar lander-style game using Slick2D and dyn4j and am now redeveloping it using libgx for various reasons.  I am having problems drawing the background (i.e. everything, but the main spaceship) using libgdx and am not sure if I am doing this correctly.

In the Slick2D version of the game I have 3 layers to the background, which are all 4096 by 1440 pixel Image objects (this to allow for suffient variety in layers 2 and 3 as per below).  The layers are:

Layer 1 = stars (black background, with white pixels that vary in
brightness so that they appear to twinkle)
Layer 2 = mountains (black
background with deep blue filled landscape) (static image)
Layer 3 =
foreground (black background with foreground landscape, a simple line
drawing, with landing sites that vary in brightness over time)

I map where the ship (and therefore the screen) sits within the background images and then extract portions of the images to paint on the screen (this allows for wrapping across the top, the sides or the corners of the background images (note only the stars wrap across the top/bottom – the mountains and foreground only need to wrap side-to-side and across corners).  I then extract a portion of the image using the getSubImage() method and draw this to the screen using the draw() method, e.g. as follows:

stars.getImage().getSubImage(x1, y1, width, height).draw(0, 0);

In separate method calls in each update() loop I update the star and foreground images so that the stars and landing sites vary in intensity.  This is done by drawing directly to the background Images.

Using this approach the game performs at over 400FPS using Slick2D and dyn4j if I allow it to run unrestricted.

In the libgdx version I have created the backgrounds as Pixmap objects and then extracted portions by drawing a subsection to a new Pixmap object, which is the same size as the screen.  I then convert this to a Texture and draw it to the screen using a SpriteBatch.  Having read the documentation, it seems like this might be a very inefficient way to do things and, in practice, is too slow using just the star background (layer 1) without either of the other two layers.

There doesn’t appear to be a way to do this using Textures since I want to be able to draw to these to vary star and landing site intensity over time (unless I fundamentally re-write the game and use Sprites to draw the flashing stars and landing sites and just use a flat, static background Texture for everything else...)

So, my question is what is the correct way to do this using libgdx so that I get an effective level of performance?  Can I replicate the logic that I have used in the Slick2D version of the game or do I need to do a fundamental re-think?

Note the game is designed for the desktop only and is not intended to be run an Android or iOS.

sentences:
How can I make my sprite jump up and move forward at the same time? I'm trying to make a sprite's movements work. For some reason, he can only jump and then move, or move and then jump, but never at the same time.  I'm using InputProcessor and a TiledMap system.  Here's some code :

@Override
public boolean keyDown(int keycode) {
    switch(keycode) {
    case Keys.W:
        if(canJump) {
        velocity.y = speed;
        canJump = false;
        }
        break;
    case Keys.A:
        velocity.x = -speed;
        break;
    case Keys.D:
        velocity.x = speed;
        break;
    }
    return true;
}

@Override
public boolean keyUp(int keycode) {
    switch(keycode) {
    case Keys.W:
        velocity.y = 0;
        break;
    case Keys.A:
        velocity.x = 0;
        break;
    case Keys.D:
        velocity.x = 0;
        break;
    }
    return true;
}

sentences:
PC game update systems I've almost finished a PC game (I'm releasing it in a day or two). I'd like a way to easily release patches over the net in case I find a bug in the game right after release, or in case I want to add features later on.

I am using InstallJammer as my install system. Are there good update/patch programs (preferably free) which can check for and send updates to players over the Internet?

For instance, if a player opens my game, the game first starts the update program that checks for updates. If updates are available, it will let the user know where to get it. I can modify the source code to the game engine I own, but I'd prefer not to re-invent the wheel.

sentences:
How to avoid movement speed stacking when multiple keys are pressed? I've started a new game which requires no mouse, thus leaving the movement up to the keyboard. I have tried to incorporate 8 directions; up, left, right, up-right and so on. However when I press more than one arrow key, the movement speed stacks (http://gfycat.com/CircularBewitchedBarebirdbat). How could I counteract this?

Here is relevant part of my code:

var speed : int = 5;

function Update () {
    if (Input.GetKey(KeyCode.UpArrow)) {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    } else if (Input.GetKey(KeyCode.UpArrow) && Input.GetKey(KeyCode.RightArrow)) {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    } else if (Input.GetKey(KeyCode.UpArrow) && Input.GetKey(KeyCode.LeftArrow)) {
        transform.rotation = Quaternion.AngleAxis(315, Vector3.up);
    }
    if (Input.GetKey(KeyCode.DownArrow)) {
        transform.Translate(Vector3.forward * speed * Time.deltaTime);
    }
}

sentences:
How can I find the opposite angle and position of the camera? In this project I have a character and a camera that follows it.

The camera has a position relative to the character that was defined as (x = 0, y = 0, z = 0) and also its rotation:

I found a value close to its position and opposite angulation, but not really the correct value:

By pressing the Q key, the camera shifts to the position and angulation that I have discovered. Releasing the Q key, the camera returns to its initial position:

IN GAME:

As you can see, the inversion is not 100% correct.

One of the ways I thought, is a way where I take this relative value from the camera (x = 0, y = 0, z = 0) and with that:

I put the character's mesh at the location (x = 0, y = 0, z = 0) at the level and so, as the camera will be (for example) x = -250, y = 0, z = 300, it's just I invert the value of x. The angulation is simpler to deduce, but it would be interesting for me to also derive its relative value (0, 0, 0).

EDIT 1 (Attempt that I did and that almost worked out)

By clicking the down arrow to the left of the values, you can select whether you want the variable to be Relative or World (I did not know that):

Before it was all 0, it now has a value:

Taking the minus sign, I was able to figure out the opposite position:

New position:

It happens that at the time of changing the angulation from relative to absolute, a conversion is not made:

I can not get absolute value equivalent to relative. What happens is that the value 0, 0, 0 is also defined for the absolute rotation. In the image below the camera was exactly in the same position as the VR camera:

I discovered by trial and error the equivalent angulation between relative and absolute:

BLUEPRINT:

The code works correctly, but I feel that again I did not get exactly the position and opposite angles.

Here are some screenshots of the game:

Local X with NORMAL CAMERA:

Local X with OPPOSITE CAMERA:

Local Y with NORMAL CAMERA:

Local Y with OPPOSITE CAMERA:

Note that in the opposite camera you can see the end of the world (sky) from wherever you are, which is not the case with the normal camera. I noticed this, and so, I think once again I did something wrong.

sentences:
How to optimize Floor Meshes with different material in unity I have several meshes (floor tiles) that consist of unique materials as they have different textures. I see that it is taking too many batches and it has around 100m vertexes.
Is there any way to improve it through programming? The long way, it should be ported to 3d modeling and combine.
I also see the mesh combine but it requires the same material.
Edit:

Around 17k Floor tiles (LoD 9) with details
around 5 or 6 large tiles (Floor LoD 7) with fewer details that are placed beneath the LoD 9 tiles
lod9 tiles are display-based camera culling otherwise LoD7 floor shows all the time.

Here are some of the screenshots:
Lod 7 Tile example (there total 16 tiles)

sentences:
Determine facing direction mecanim 2d movement I'm using this script to move my character in my 2d world:

    public float speed;   //Movementspeed

public Rigidbody2D rbody;
Animator anim;

void Start () {

    rbody = GetComponentInChildren<Rigidbody2D> ();
    anim = GetComponent<Animator> ();
}

void FixedUpdate () {

    Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

    if (movement_vector != Vector2.zero) {
        anim.SetBool("iswalking", true);
        anim.SetFloat("input_x", movement_vector.x);
        anim.SetFloat("input_y", movement_vector.y);
    } else {
        anim.SetBool("iswalking", false);
    }

    rbody.MovePosition (rbody.position + movement_vector * speed * Time.deltaTime);

}

}

What I want is to somehow register where my character is facing/walking towards to be able to Instansiate a gameobject infront of it.

How do I do that?

sentences:
Tips and Tools for creating Spritesheet animations I am looking for a tool that I can use to create sprite sheet easily.

Right now I am using Illustrator, but I can never get the center of the character in the exact position, so it looks like it is moving around(even though its always in one place), while being loop through the sprite sheet.  Is there any better tools that I can be using?

Also what kind of tips would you give for working with a sprite sheet?  Should I create each part of the character in individual layers (left arm, right arm, body, etc.) or everything at once?  any other tips would also be helpful! thank you

sentences:
Random Ghost Behavior in PacMan Clone Not Random? I'm currently programming a PacMan clone as my first ever game with the XNA Game Studio before eventually going to DirectX.

As a first ever game, lots of things have given me great headaches, especially collision detection with the walls.

The problem I have now is the "AI" I have implemented for the ghosts. It's wish-wash, really. The basic method is that, if the Ghost runs into a corner, it will change its speed vector, and ultimately its direction.

However, the seed seems to be giving me the same pattern. If I launch them from the same corner multiple times, they keep taking the same direction. They have only rarely ever not taken the same route before getting stuck.

I'm not sure how much code can be posted here, but this is my current algorithm. Beware, it's not very pretty at the moment. It was implemented just to see if it's viable. Now I just want it to work properly before refactoring it and making it more intelligent.

        // OMG! Is the ghost trying to hit a wall? Ha! No wall-hacking for you!
        if (!wall_.Collides(frameSize_, pos_, direction_))
            pos_ += direction_;
        else
        {
            // a and b will change speed.
            // if a and b are both 1 (diagonal vector), then c will determine
            // which value a or b shall be taken.
            // d negates the values for reversed direction.
            Random rand = new Random();
            int a, b, c, d;
            a = b = 0;
            while (0 == a && 0 == b)
            {
                a = rand.Next(2);
                b = rand.Next(2);
            }

            if (1 == a && 1 == b)
            {
                c = rand.Next(2);
                if (0 == c)
                    spd_ = new Vector2(a * 2, 0);
                else
                    spd_ = new Vector2(0, b * 2);
            }
            else
            {
                d = rand.Next(2);
                if (1 == d)
                {
                    if (1 == a)
                        spd_ = new Vector2(a * 2, 0);
                    else
                        spd_ = new Vector2(0, b * 2);
                }
                else
                {
                    if (1 == a)
                        spd_ = new Vector2(-a * 2, 0);
                    else
                        spd_ = new Vector2(-b * 2, 0);
                }
            }
        }

Addendum: What I also meant to add is that the ghosts get stuck eventually. They stop taking corner with a different direction. I've waited for about 20-40 tries, but they simply reversed direction. This happened repeatedly with several restarts of the game.

sentences:
How to detect collision direction in Phaser 3 Please consider this scene. Developed using PhaserJS 3.

I want to make the slider move left when the player touches the right hand side of it, and move right when the player touches the left hand side of it.

This is the code I'm currently using in the collision callback to decide what to do:

  hitSlider: function (player, slider) {
    // ...
      if (player.body.touching.left) {
        slider_actions.moveSliderLeft(slider)
      } else if (player.body.touching.right) {
        slider_actions.moveSliderRight(slider);
      }
  // ...
  }

This works in most cases, EXCEPT that it doesn't check if the player is touching the slider on the left, just that they're touching something on the left.

My screenshot contains an example. If the player stands on top of the slider, and walks left, they are both colliding with the sider and touching something on the left. So the slider moves left.

How can I detect the direction of the collision event itself instead?

sentences:
How to reference a GameObject from the Scene Hierarchy in C#? I am a novice in Unity. I have a Game Object named 'courtsuit'; you can see it in my Scene Hierarchy panel here:

I added that object instance to my scene by dragging an OBJ file from my Project Assets folder into the Scene Hierarchy panel.

Now I want apply a material man to the game object at runtime. That is, when I click a button, that game object needs to change its material.

I tried and succeed by attaching a script to game object itself:

Material SphereMaterial;

// Use this for initialization
void Start()
{
    SphereMaterial = Resources.Load<Material>("Materials/man");
    if (SphereMaterial == null) Debug.Log("mat null");
    else Debug.Log("mat not null");
    Debug.Log("new Material: " + SphereMaterial.name);
    MeshRenderer meshRenderer = GetComponent<MeshRenderer>();

    // Get the current material applied on the GameObject
    Material oldMaterial = meshRenderer.material;
    Debug.Log("Applied Material: " + oldMaterial.name);
    // Set the new material on the GameObject
    meshRenderer.material = SphereMaterial;
}

But I don't know how to do this from an OnClick script on a different object, because I don't know how to locate the object in my Scene Hierarchy using C# script.

I want to do something like this:

public class ButtonHandler : MonoBehaviour {

    public void ButtonInteract()
    {
        Debug.Log("changing matriel ");
        // Change the material of the game object here

    }
}

How can I change the Game Object courtsuit's material to a material named 'man' from my Resources/Material folder using C#?

sentences:
"StrictMode policy violation" warning occurring in my game after upload When I upload my game to my Android device, I get the following warning:

StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V
    at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
    at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
    at java.lang.Class.getDeclaredConstructorInternal(Native Method)
    at java.lang.Class.getConstructor0(Class.java:2325)
    at java.lang.Class.getDeclaredConstructor(Class.java:2166)
    at bitter.jnibridge.JNIBridge$a.<init>(Unknown Source:25)
    at bitter.jnibridge.JNIBridge.newInterfaceProxy(Unknown Source:8)
    at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
    at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:193)
    at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)

What causes this, and how can I resolve it?

sentences: Using ColorFill on a depth buffer I'm trying to implement a render abstraction over Direct3D9, and one of the functions I'm implementing is clearing a render target, which includes a depth buffer. However, the IDirect3DDevice9::ColorFill method I've been using doesn't seem to be able to clear depth buffers. Is the only means to clear depth buffers to use Clear() to clear depth buffers which have been bound to the rendering pipeline?

sentences:
Libgdx Box2D random positions and intervals falling bodies I need to make that objects fall from the top of the screen random intervals and positions. Here's my code where I create lot of objects and add them to ArrayList

private void createBalls() {
        BodyDef ballBodyDef = new BodyDef();
        ballBodyDef.type = BodyDef.BodyType.DynamicBody;

        CircleShape shape = new CircleShape();
        shape.setRadius(10/Constants.PPM);
        shape.setPosition(new Vector2(w/4/ Constants.PPM, 5));

        FixtureDef fd = new FixtureDef();
        fd.density = 1;
        fd.friction = 0.5f;
        fd.restitution = 0.5f;
        fd.shape = shape;

        do {
            float rand = MathUtils.random(-2.0f, 2f);
            shape.setPosition(new Vector2(w/4/ Constants.PPM + rand, 5));
            fd.shape = shape;

            bodyArrayList.add(world.createBody(ballBodyDef));
            bodyArrayList.get(bodyArrayList.size() - 1).createFixture(fd);
        } while (bodyArrayList.size() < 100);

        shape.dispose();
    }

this code works fine (except that all objects fall at single time). So is it possible to make that objects would fall at different time?

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: What is the best way to make a main menu system? I know that's it's easy to make buttons that highlight when you move your mouse over them, but when it comes to sub-menus I'm kinda stuck. Anyone got some tips on the best way to have a main menu with sub-menus? (like Singleplayer -> Load Save -> Save 1-5? -> Start game etc.)

sentences:
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:
How can determine the number of instances of an object in Game Maker? I am making a small puzzle based game.  I want the number of instances of an object to be equal to the ammo count plus 2.

Each time a new room is loaded, the main object's creation method with run this script:

var ammo = instance_count(jellyfish)+2;

Then each time a bullet is fired, I subtract one. When there is no ammo left, the player goes to the 'failure' room.

However, I get the error: Unknown function or script: instance_count.

I have see this script on Google, but am not sure if it has deprecated or not. Is there a way I can do this?

sentences:
UNITY || How to access the "exit transitions" of the current played clip from the animator? So, I have an animator , i can access it.
But from there I have no idea how to access the clips inside.
I need to access the transition of the clips.

I got as far as accessing the object of the "Animator" class.

EDIT:

It appears The TransitionInfo datatype doesnt provide conditions.
I need the conditions!

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

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

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

Update 1:

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

Update 2:

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

Update 3:

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

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

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

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

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

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

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

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

Any ideas?

sentences:
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:
"Video system not initialized" error I always get the error message "video system not initialized"

I don't get where I went wrong with the code below:

import pygame
pygame.init()

display_width = 800
display_height = 600

gameDisplay = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('4 pics 1 word: ASTRONOMY VERSION')

black = (0,0,0)
white = (255,255,255)
red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)

answered = False
satImg1 = pygame.image.load(r'C:\Users\andrea\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.7\img\satellite.png')

def satImg(x,y):
    gameDisplay.blit(satImg1,(x,y))

x = (display_width * 1.0)
y = (display_height * 1.5)

while not answered:
    if pygame.mixer.get_busy() != None:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                answered = True
    gameDisplay.fill(white)
    satImg1 = (x, y)
    pygame.quit()
    quit()

sentences:
Fastest approach to 3D animation I'm currently tasked with designing a small HTML5 game.
Having done everything by myself so far (3D models, codebase, game design, etc) I'm now at a point where I'm running out of time.

I've less than a day to animate and bind everything together. However, that's exactly my problem.

I was under the naive impression that everything would be easier if I went with pre-rendered 3D models. However, I didn't consider the most difficult part. Animation.

After having spent over an hour trying to figure out messiahStudio, I figured it's time to ask for outside help.

Is there any easier solution to 3D animation than 3D rigging? What I'm basically looking for is some sort of tool that allows me to simply grab and move/deform select polygons.

It doesn't have to be as life-like and accurate as rigging, just efficient enough.

Were the circumstances any different, I might just learn how to rig. But that's sorely out of scope right now.

PS:The models were created in Sculptris but are fairly low-poly.

sentences:
How display path ball will bounce? I'm trying to figure out a way to show the path a ball will travel, so that the player can line up a shot before they fire the ball.

I can't think of a way to calculate this path in advance and show it to the player, especially if it involves collision detection. At first I thought I would run the game at a super high speed for one update, plot the path with some dotted lines where the ball bounced, and then in the next frame hide the 'tracer' ball. This seems to have two issues - Calculating collision detection without actually updating the frames and collision detection getting less reliable at high speeds.

If they were straight lines I think I could figure this out in a while loop, but trying to take into account the speed of the ball, the curve of the path, the reflecting from other objects..it all seems a bit much.

I'm not looking for any code and this isn't a platform specific question, more just help trying to figure out conceptually how this would work. Can this be done? Are there techniques to achieve this?

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

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

How does the Screen Space projection work exactly?

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

sentences:
Do opengl games tend to use multiple shaders? For any given object that you want to render, there may be a whole bunch of things that need to be considered for rendering (Material, Texture, Lighting, Blending etc). But, you may also have some objects which are very simple, and do not have a Texture or material or require any blending and ignore lights.

So, how do people approach this. Do you write one GLSL shader that has various booleans and checks that need to be set as vertices are pumped through, or do you write separate shaders for each general category of object, and switch between these as your render?

sentences:
Multiple Texture Coordinates Per Vertex (DirectX11) The models my artists are making in maya have multiple different texture coordinates per vertex depending on what face the vertex happens to be a part of.

Originally, to fix this problem, I duplicated each vert every time it appears in a face so each vert can have its own texture coordinates / face normals. This worked out well for a while until I started working on skinned skeletal animation.

I could not seem to get skinned skeletal animation working with this duplicate vertex method. There would be serious gaps in the mesh as it animated. In order to try and fix this, I switched back to indexed drawing, where faces share verts instead of each face having its own unique copy of a vert.

This fixed my skinned animation but now I'm at a loss as how to encode the multiple texture coordinates / face normals that are associated with verts. I was hoping there might be a way to use the index buffer and an array of face normals / uvs to fix this issue. Basically, I figure I can easily add an array of normals/tex coords to each vert but I have no idea how to instruct the gpu to properly index into it.

sentences:
glm::perspective() with wide field of view I'm still pretty new to this GL stuff, but I've managed to put together some C and C++ code that allows me to construct simple 3D objects consisting of line segments and display them on my laptop using GLFW and the glm library. I've hooked in enough keyboard callbacks to allow me to navigate the position and orientation of an observer via glm::lookAt(). A couple of the keys allow me to grow or shrink the field of view value that gets passed to glm::perspective(), like so:
float field_of_view; // degrees, not radians

        glm::mat4 proj = glm::perspective(
            glm::radians(field_of_view),    // field of view
            1920.0f / 1080.0f,      // aspect ratio
            0.0f, 100.0f            // near and far clipping planes
        );

From my experience as an amateur photographer, I know that if one takes a photo with a camera with a wide angle lens of a scene that contains straight line near the periphery of the field of view, the physically straight lines will appear bent in the photo. They bow outward so as to create a more circular shape around the center of view.
But when I modify the field of view that gets passed to glm::perspective() such that it is a high value (approaching 180 degrees), with an orientation such that the straight line segments appear near the edges of the field, the rendered line segments never bend like I'd see with a real camera and wide angle lens. Instead, the lines remain straight but appear to get very long.
This creates very unnatural looking images.
Is there some other glm function that I should call instead in order to make the rendered lines curved like I'd expect to see in real life?
Thanks

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:
Multiple overlapping rectangles I have a collision method where the parameters for the method are the rectangle of the player and a list with the rectangles of the tiles.

I work with booleans like bLeft, bRight,... and this creates a problem if my player collides with two tiles at the same time, then one tile may say True while the other says false.

This is my collision method (NOTE: Very buggy and incomplete collision detection, this is because the reason above)

public override void Collision(Rectangle collisionRect, List<Rectangle> tileCollision)
{

    foreach (Rectangle rect in tileCollision)
    {
        if (collisionRect.Intersects(rect))
        {

            rect2 = Rectangle.Intersect(rect, collisionRect);

            collision = true;
            stopping = true;
            walking = false;

            if (collisionRect.X < rect.X && !(collisionRect.Y <= rect.Y - 50))
            {
                bLeft = true;
            }

            if (collisionRect.X > rect.X && !(collisionRect.Y <= rect.Y - 50))
            {
                bRight = true;
            }

            if (collisionRect.Y <= rect.Y - 50)
            {
                bUp = true;
            }

            if (collisionRect.Y >= rect.Y + rect.Height)
            {
                bDown = true;
            }

            if (bLeft && !bRight && !bUp && !bDown)
            {
                fallingTest = false;
                stopping = true;

                if (left)
                {
                    stopping = false;
                    fallingTest = false;
                }
            }

            if (bRight && !bLeft && !bUp && !bDown)
            {
                fallingTest = false;
                stopping = true;

                if (right)
                {
                    stopping = false;
                    fallingTest = false;
                }
            }

            if (bUp)
            {
                ground = true;
                fallingTest = true;
                stopping = false;

                if (moving)
                {
                    walking = true;
                }

                if (bLeft && bUp)
                {
                    stopping = true;

                    if (left)
                    {
                        stopping = false;
                    }
                }

                if (bRight)
                {
                    stopping = true;

                    if (right)
                    {
                        stopping = false;
                    }
                }
            }

            if (bDown && !bRight && !bLeft && !bUp)
            {
                stopping = true;
                fallingTest = false;

                if (moving)
                {
                    walking = true;
                }
            }
        }

        if (!(tileCollision.Any(c => collisionRect.Intersects(c))))
        {
            collision = false;
            fallingTest = false;
            stopping = false;

            ground = false;

            if (moving)
            {
                walking = true;
            }
        }
    }
}

So I basically need a line of code that counts the colliderboxes that the player collides with at the moment of collision. I tried doing this by adding 1 to the variable collisionBoxes but this results in doing +1 each frame (because this collision method is called in  Update)

I also use rect2 for visual overlapping of the player collision box and the tile collision box, but when the player touches more than one tile, then the rect2 only shows on one tile. This is because I use the foreach but I tried using a list to store the overlapping rectangles in but it didn't work.

One more question, should I use all these booleans? Because I don't know how to handle them if more than one block touches the player (all the tiles are checking for the booleans, resulting in bugs).

sentences:
Making a physicalized melee weapon The short version, is that I was asked to look into the feasibility of making a melee weapon, that one could swing at another object in the game, and have it interact physically. I completed the tutorial here http://www.mavrikgames.com/tutorials/melee-weapons, and proved that indeed it is.

The thing is, that only for a brief period in the swing is the sword capable of knocking things around. I've looked through the editor and code for awhile now, and I'm still not sure how to do this.

I was able to lengthen the amount of time it takes the animations run for, but not the length of time with which the sword can bash the barrel around.

sentences: GraphicsAdapter lacks a definition for CheckDeviceMultiSampleType The MSDN is really confusing about this, with all their different versions of XNA jumbled together for my google results. All I want to do is find out, in XNA 4.0, what antialiasing modes are supported by the display adapter. Supposedly, this involves calling GraphicsAdapter.CheckDeviceMultiSampleType(), but that function isn't defined. What should I be using in its place?

sentences:
SetBase with a KActor descendant does not appear to function I have a KActor descendant, which is a carging shot, kind of like in R-Type. When it starts charging, I do projectile.SetBase(Pawn) in the PlayerController where it is spawned. I've checked in the debugger, and its base is in face the pawn.

But it does not move with the pawn.

I have done this before, where I base KActors on a moving entity, and it moved with them. I must have done something differently, but I can't figure out what it was. Looking at the old code, I just did SetBase like I am now.

Any ideas where I might be going wrong?

sentences:
Too slow for cycle in Pygame I'm using Pygame for Python 2 and I have the following code:

self.radius = 100
self.light = pygame.Surface((2*self.radius, 2*self.radius), pygame.SRCALPHA)
self.light.fill((0, 0, 0, 0))
pygame.draw.circle(self.light, (255, 255, 255), (self.radius, self.radius), self.radius)
alphas = pygame.surfarray.pixels_alpha(self.light)
for x, col in enumerate(alphas):
    for y, pixel in enumerate(col):
        pixel = 255 - f.distance(pygame.Rect(x, y, 1, 1), pygame.Rect(self.radius, self.radius, 1, 1))

Basically this code creates a new surface, makes it transparent so that it doesn't interfere with the background, draws a circle on it, and then makes two nested for cycles, going through all of the pixels. The problem is, these fors are too slow. How can I improve their performance?

sentences:
How 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:
How to make a text box where text "types" smoothly I want to create a textbox that behaves like most textboxes seen in other games where the text appears gradually. So far this has been my attempt at it but unfortunately, the text appears very unevenly and slow even when changing the letter pause to an insanely low amount.

public float letterPause = 0.1f;

IEnumerator TypeText()
{
    //number of char typed per loop
    int len = 3;
    for (int i = 0; i < text.Length; i += len)
    {

        if (i + len > text.Length)
        {
            ibubbletext.text += text.Substring(i, text.Length - i);
        }

        else
        {
            ibubbletext.text += text.Substring(i, len);
        }
        yield return new WaitForSeconds(letterPause);
    }
}

sentences:
How to measure time interval (different languages) What is the recommended way to measure time intervals for a game loop?

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

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

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

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

This is a community wiki.

sentences: JigLibX collision detection only once I'm trying to implement collision detection using the latest JiglibX. I am working off of this example. I chose creating a callback. I'm trying to detect a collision only once. When the object falls through, the callback is invoked multiple times, not only once. Is there any way how to ignore other calls? Thanks for advice.

sentences: How can I make a coroutine run for a specific number of times in Unity? I use coroutines in unity, with while(true) condition, which runs it indefinitely. I need to make the coroutine run for a specific number of times, let's say 10 times. Any pointers will be much appreciated!

sentences:
UV Texture coordinates out of [0,1] (WebGL) I'm creating a 3D game with WebGL and i'm using Wavefront Objects as a base model format.
I recently found some models, their texture coordinates of which are out of the typical [0,1] range and i really don't know how to handle them (in code).

I know of course this is a known issue, texture coordinates can be outside of [0,1] and the solution is to use GL_REPEAT wrap mode.

But this is no solution to me since i have a lot of non-powered-by-2 textures and i need to use CLAMP_TO_EDGE wrap mode (the solution to non-pow-2 textures).

I tried to bypass this issue by coding, so to convert [0-,1+] ranges into [0,1] but with not much of success (although somewhat). Here's what i did:
I looped "vt" entries (from my parser) and the cases i'm checking are these (pseudo):

U,V = texture coordinates as they come from file

if (U<0) {
   U = U + Math.abs( Math.floor(U) );
}
if (U>1) {
   U = U - Math.floor(U);
}
if (V>=0) {
   V = Math.ceil(V) - V;
}
if (V<0) {
   V = Math.abs( Math.floor(V) - V );
}

The above fragment will take a U,V of unknown range and will convert it into [0,1], taking also care the WebGL texture coordination system (0,0 buttom-left for WebGL but 0,1 for Wavefront, the 3rd case above)

The numbers are calculated correctly but the result is not the expected and i'm afraid there is a misunderstanding by my side on how the GL_REPEAT mode works.

So my question(s)

Can this be solved by code, so i can use CLAMP_TO_EDGE?
In case there's no way, is there any program than can take a model of REPEAT-ed coordinates and produce one in [0,1] range? I'm already using Blender but could not find a setting for this in exporter.

sentences:
How can I make the ui text child to be ignored from the raw image trigger event? I have a rawimage prefab and one of his childs is a ui text :

And the script that use the event trigger :
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using UnityEngine;
using UnityEngine.UI;

public class MouseHover : MonoBehaviour
{
    public SaveLoad saveLoad;
    public SceneFader sceneFader;

    private bool loadGame = false;

    public void OnHover()
    {
        Debug.Log("Enter");

        loadGame = true;
    }
    public void OnHoverExit()
    {
        Debug.Log("Exit");

        loadGame = false;
    }

    private void Update()
    {
        if(loadGame)
        {
            if (Input.GetMouseButtonDown(0))
            {
                StartCoroutine(sceneFader.FadeAndLoadScene(SceneFader.FadeDirection.In, "Game"));

                loadGame = false;
            }
        }
    }
}

The problem is that even if there is a space between each of the raw images when I move the mouse over the raw images in the game view window when the mouse pointer is on the ui text at the bottom or on the same line of the ui text it's still showing "Enter" and it's showing "Exit" only when the mouse pointer leave the ui text.
Is there any way to keep the ui text child of the raw image but to ignore the ui text in the event trigger ?

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:
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:
Move rigidbody using WASD keys but rotate it based on camera/mouse movement I am very new to unity and my scripts are based on some scripts found on the web.

I want to make a first person view so the camera is attached to my rigidbodys head. Then i want to move my rigidbody based on keyboard input (wasd) and rotate it using the mouse movement.

Until now, i used the following code for moving my rigidbody:

void Update() {

    /* calculate rigidbody movement */
    movement = new Vector3( Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized;

    /* calculate mouse look to rotate the rigidbody*/
    mouseDelta = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
    mouseDelta = Vector2.Scale(mouseDelta, new Vector2(sensitivity * smoothing, sensitivity * smoothing));
    smoothV.x = Mathf.Lerp(smoothV.x, mouseDelta.x, 1f / smoothing);
    smoothV.y = Mathf.Lerp(smoothV.y, mouseDelta.y, 1f / smoothing);
    mouseLook += smoothV;

}

void FixedUpdate() {

    /* apply rigidbody movement from Update() */
    transform.Translate( movement * moveSpeed * Time.deltaTime );
    /* apply rigidbody rotation from Update() */
    transform.localRotation = Quaternion.AngleAxis(mouseLook.x, transform.up);
    /* apply camera rotation from Update() */
    Camera.main.transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);

}

I learned today that i dont have to move a rigidbody's transform but now i am totally confused and it seems i have to restart my whole (first!) project.

So when i use MovePosition and MoveRotation, how do i rotate it based on the camera perspective/mouse movement?

I think the movement Vector is ok so i can simply rewrite the FixedUpdate to something like

rigidbody.MovePosition(movement * speed * Time.deltaTime)

but i am totally stuck on how to apply the camera rotation to my rigidbody to use it like

void FixedUpdate() {
    /* move the rigidbody */
    rigidbody.MovePosition(movement * moveSpeed * Time.deltaTime);
    /* rotate the camera */
    camera.transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);

    /* but how can i rotate the rigidbody based on the cameras rotation??? */
    rigidbody.MoveRotation(?????);

}

I hope its clear what i want, thank you!

sentences:
Unity: How do I fix the players model rotation in a NetworkManager to spawn properly? How do I fix the players model rotation in a NetworkManager to spawn properly?

I created a game with the NetworkManager code.
Player Model is a cone I made and imported.

all works fine but when the NetworkManager spawns the player model it is sideways.
I have tried turning it in 3ds but the player remains sideways when it is spawned by NetworkManager on run, Ohterwise the model is fine in unity, and no matter how I rotate it, in or out of unity , The NetworkManager Rotates it.
All other objects attached to the main object remain with proper orientation all, All other objects including instantiated ones appear properly.

sentences:
Unity: Assigning a key to perform an action in the inspector I am trying to write a simple piece of code in JavaScript where a button toggles the activation of a shield, by dragging a prefab with Resources.load("ActivateShieldPreFab") and destroying it again (Haven't implemented that yet).

I wish to assign this button through the inspector, so I have created a string variable which appears as intended in the inspector. Though it doesn't seem to register the inspector input, even though I changed the value through the inspector.

  It only provides the error: "Input Key named: is unknown" When the
  button name is assigned within the code, there is no issues.

Code as follows:

var ShieldOn = false;
var stringbutton : String;

function Start(){
}

function Update () {
    if(Input.GetKey(stringbutton) && ShieldOn != true)
    {
        Instantiate(Resources.load("ActivateShieldPreFab"), Vector3 (0, 0, 0), Quaternion.identity);
        ShieldOn = true;
    }
}

sentences:
Peculiar problem rendering specific triangles I've encountered a strange problem with a peculiar [not quite] solution. This problem is that certain polygons aren't rendered unless I run 'fraps'. Needless to say, I would much rather my program to run without 3rd party programs. So I was wondering what part of my directx 11 code would be the cause of this.

Thanks in advance, please ask for code fragments if they're needed!

sentences:
How to display height information in tilemap I want to create a hexagonal tilemap and show regions of different height in the same screen. What ways can you think about to indicate which height a tile is on. (current, lower, higher?)

Several tilemap games avoid this by having special mountain tiles, but that allows for ~2 heights and I would like for more differentiation.

Another approach is to just draw the tiles of current height, but this does look very strange if the map is very bumpy (lot's of holes).

I have not found a nice way to whiten or blacken tiles that are lower or higher than the current viewpoint.
Any ideas?

sentences:
Unity3D Sprite tearing on Android Smartphone The game was running on Samsung Galaxy Trend 2.

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

Sprites import settings are following:

Could someone explain why this happens?

sentences: Android game programming seperate game logic thread from drawing thread Ok so I want to know what is a proper way to create a multi threaded game. What I have tried is implement a wait and notify between the game logic thread and the drawing thread, but I believe this is a very bad way to do it because one thread waits for the other to finish what it is doing before it can continue to do it`s own task. I mean, I think this kind of beats the whole point. So a better way I am thinking of would be to have blocking queues(I would need more than one for all the different types of data in my game) and the updating thread would put all of the updated/processed values into it and if it was full, the updating thread would block. The drawing thread would then read all of those values and if the queues were empty it would block. This way both the threads are fully utilized. But I don't know if this would be the professional or good way to do it, which is why I am posting this so I can get a little guidance. Thanks!

sentences:
How can I convert between float3 and float2 in HLSL? I want to offload some 3D calculations to the GPU without raising my requirements to DX10.  Specifically, I am generating densities in 64x64x64 3D blocks, which fit nicely into 512x512 2D textures.  I would like to be able to convert my float2 texture coordinates to float3 values, so I can offset them, convert back to float2, perform lookups against my randomness texture, and interpolate the results manually.

This has been easy to do with integer values on the CPU side, but the GPU's texture coordinates are all floating points.  Is there an easy way to do this?  Or is there a way to coax pixel shader 3.0 into using something similar to 3D textures, so I can take advantage of automatic interpolation?

Another caveat is that I am using the Vector4 image format for my render targets (need better resolution in each channel) in XNA, so I am restricted to Point sampling.

sentences: How to scale bitmap font without having it pixelated How do i increase the size of a bitmap font without having it get pixelated, in libgdx?

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:
Management of objects as targets of other objects I have started my first game three years ago and learned a lot during that process. Now I would like to rewrite it to incorporate my "lessons learned" or try out new ideas.

My game consists of space ships that can target other space ships either for combating, trading or communicating. When they have no current target, they look for other ships in their area, lock them as target (by keeping a pointer to them as member variable) and do some stuff. After a ship is destroyed, its pointer used by other ships as a target becomes invalid. To avoid any dangling pointers and crashes, I add the to be destroyed Ship's id to a cleaning list. During the next World's update, I go through all of these to be destroyed ids and remove them as potential targets. See this pseudo code to demonstrate this:

class Ship
{
public:
    Ship();
    Ship::destroy(){
        // set to be destroyed flag
        _world.pointersToDelete(_id);
    }

private:
    void        destroy();

    int         _id;
    Ship*       _target;
    World*      _world;
    bool        _to_be_destroyed;

};

// in World::update
World::update()
{
    for (auto ship: all_ships)
    {
        for (auto id_to_delete: ids_to_delete)
        {
            if(ship._target != nullptr && ship._target->_id == id_to_delete)
            {
                ship._target = nullptr;
            }
        }
    }

    // now trigger the actual final destruction of the ships
    // ...
}

Question: Is this a good design in general?
I ran into some problems when I used it in practice:

There are more objects that communicate, combat and trade with ships like Space Stations, Planets, etc.. I would need to go through all of them every update loop to check whether they have no dangling pointers. I am concerned about the performance since my game allows space battles of thousands of ships at the same time.

I thought about using an id approach instead: the _target variable is not a pointer but an id that I can look up in an unordered_map of Ship objects. If the id is not found anymore, the target is not valid any longer. But this could lead to performance issues as well if every object has to check this during every update multiple times.

sentences:
Calculating the inverse mesh of a 2D mesh inside a bounding box If I have a mesh (drawn in red below)

How can I calculate the inverse of the mesh (drawn in red below), given that the mesh is always constrained by the same four vertices of the encompassing bounding box?

My mesh is drawn using a series of clockwise wound triangles.

Is there possibly any easy way to do this in a shader?

I wish to draw the triangles, and therefore each pixel, of the inverse mesh rather than draw the original mesh with color of the mesh and the background swapped to give an inverse effect.

sentences: vuforia unity how to detect that we have " lost track of" an object I'm working on a vuforia project and would like to be aware when vuforia can no longer detect the object in unity. Is there an easy way to write a script that is executed opon loosing track of an object for a given time?

sentences:
How much a scene would be done in 3D modelling program before exporting? What I am trying to work out is, when creating a level, or section of a level, how much is created in the modeling package before it is exported, take the scene in the link. Would this whole scene be created in Max first, if so what is the point of a level editor, where does that come into play.

Basically how are levels made, how much of a whole level, or section of a level is created in the modeling software, how can multiple people work on the same level at once, what is the relationship of a level editor to modeling package like 3ds max?

I would be using Unreal 4 and 3ds Max.

sentences:
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:
Prevent Unity from crashing your computer? Recently, I made a very dumb mistake that caused Unity to crash my computer. I could move the mouse sometimes, but everything else became completely unresponsive, leading to me having to shut off my PC.

What happened: I had an object, let's say an arrow, that could collide with another object, let's call it spawner. When the arrow collides with the spawner, it's supposed to destroy the arrow that activated the spawner. The spawner would then, as the name might imply, spawn more arrows. The problem was that I forgot to temporarily disable to collision on the newly spawned arrows, meaning that as soon as they would spawn inside the spawner's collision box, they'd spawn more arrows, and those arrows would spawn more arrows, and those arrows would... you get the idea. It was a very stupid mistake I realized the moment I hit play, but it was too late.

Now, I know that was entirely my fault, but I was wondering if you could prevent Unity from sending your PC into a coma like that? (Besides not making a dumb mistake like that, of course...) I'll be honest, I kind of expected Unity would have some sort of fail safe for this kind of error. Is there a way to limit the object count for example?

sentences:
How can I generate terrain like SimCity 3000 does? Are there any tips anywhere on generating terrain such as is used in SimCity 3000? I have used World Machine before, but I want something low-fidelity. I think there are only a few allowed vertical "steps" in SC3K, as well as a maximum slope. Thanks.

[edit]

Here are some screenshots.

Several more pics here.

sentences:
What is an actor in game development? I am reading a book about game development (Game Coding Complete, Fourth Edition) and there is an "Actors" topic which just explains how to use them briefly instead of explaining what it is.

Here's how the book introduces these actors:

  Games are full of objects that bring your world to life. A World War
  II game might be full of tanks and planes, while a futuristic science
  fiction game might have robots and starships. Like actors on a stage,
  these objects are at the heart of the gameplay. It seems fitting that
  we call them “game actors” because that’s exactly what they are.

  A game actor is an object that represents a single entity in your game
  world. It could be an ammo pickup, a tank, a couch, an NPC, or
  anything you can think of. In some cases, the world itself might even
  be an actor. It’s important to define the parameters of game actors
  and to ensure that they are as flexible and reusable as possible.

  There are as many ways for defining a game actor as there are games.
  Like everything else in computer programming, there is rarely a perfect solution.

I could only understand a very few things: it is an abstraction of everything in the game which can perform actions; it has it's own state; it's behaviour is usually implemented as a state machine. This is it. I am coming with systems programming background to the game development, and so I would like to know in general, what the actor is in game development meaning, how to use it, how it is used in general, what problem it solves, how and why. I would like the explanation to be such that a kid could understand.

I have tried to find this information on google but it heads me to another "actors" instead: concurrent programming most of the time or game actors but without a good explanation of it.

sentences:
Making a DX9 game resolution independent How can I change the resolution and stretch my entire game to the new resolution? I want my game to have a base resolution, and when I change it to stretch to that new resolution. I saw a few similar questions but all the answers suggested that i should change the presentation parameters. If i do that, my screen resolution changes, but all my other objects remain the same size and draw in the wrong position.

I use a LPD3DXSPRITE object to draw the textures to the screen, some DirectX text, and vertices defined as this:

#define D3DFVF_VERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

I tried to put D3DXSPRITE_OBJECTSPACE at sprite->Begin() and play with the projection, view and world matrices but without success.

Can someone tell me if this method is possible and how should I do it? I also read about another method that suggested rendering to a surface, and then stretching the surface, but i don't know how to implement that. I am a beginner in DirectX. I googled the second method, but I couldn't find someone explaining it, and I don't think I can draw from a sprite to a surface.

sentences:
Can I release any sort of app or game on the PlayStation Store? I'd like to develop a game, and try it out mainly on the Playstation 4.

Can I build any game, or app, and release it on the Playstation Store? Or does Sony only allow what it wants in the store, much like Apple and the AppStore? Note that I'm not asking how to build a game, but whether or not there are restrictions that would prevent me from releasing certain kinds of games or applications to the Store.

sentences:
Building a visual scripting component (like Kismet) I'd like to know how can one get started building a visual scripting component (or what is the more accurate term for this type of component?) such as UDK's and Unreal Engine's Kismet.

For those who are not familiar, the system allows connecting various pieces of logic visually, creating a possibly complex component out of smaller building blocks.

While the underlying data model may be (perhaps) something i can figure out for myself, it is the visual part that i am not sure of how to work out.

Are there any libraries that facilitate writing something like this? Where can i get started on thsi ?

sentences:
2D Collision detection for Pinball Game So far in previous games I have used simple 2D collision with boxes then checking at pixel level for a collision.

If making a pinball game in nearly a lot of frames the ball will be in contact with a wall or another surface so is there another approach?

sentences: Gamemaker Key Press Duration I am looking for a way to track the duration of a key press in gamemaker. I was looking into alarm functions, but I figured there's a more elegant way. How can I track the duration of a keypress?

sentences:
Changing the texture in a Sprite I'm a bit new to libGDX. My problem is ,in my code, only if I set the texture in the constructor of the Sprite instance, it will draw anything. My question is shouldn't it be working when I only call setTexture() when rendering? Or is there another way to render while changing the texture?

Following code doesn't draw anything.

public Sprite getSprite() {
    if (this.sprite == null) {
        this.sprite = new Sprite();
    }
    return this.sprite;
}

public void render(final float deltaTime, final SpriteBatch batch) {
    this.getSprite().setTexture(this.getCurrentTexture());
    this.getSprite()
            .setPosition(this.getPosition().x, this.getPosition().y);
    this.getSprite().setRotation(this.getRotation());
    this.getSprite().draw(batch);
}

Following is the working code.

public Sprite getSprite() {
    if (this.sprite == null) {
        this.sprite = new Sprite(this.getCurrentTexture());
    }
    return this.sprite;
}

public void render(final float deltaTime, final SpriteBatch batch) {
    this.getSprite().setTexture(this.getCurrentTexture());
    this.getSprite()
            .setPosition(this.getPosition().x, this.getPosition().y);
    this.getSprite().setRotation(this.getRotation());
    this.getSprite().draw(batch);
}

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:
When the player collides with an entity, the player can no longer move Here is my collision code, any ideas on how I can improve it to fix the problem?

    public void collide(Entity entity){
    if(x + width >= entity.x && x <= entity.x + entity.width && y + height >= entity.y && y <= entity.y + entity.height){
        setShouldCollide(true);
    }else{
        setShouldCollide(false);
    }
}

sentences:
How to calculate “real” distance between cursor and distant object? I don't really know how to formulate the title, but the problem is the following:

I'm using a scripting language called "SQF" which has been created by a company named "Bohemia Interactive" (no, I do not work for them) and it's for modding their games. So I won't fill up these lines with code. If somebody else knows it and wants to see, comment and I'll add what I've tried so far.

The issue anyway is rather abstract, so I'm going to explain it with an archer and his target. Ratios may not be correct as they are only for explanation.

Say I (as the player) am the archer (first person), the target is 10m away, has a diameter of 2m and appears 200px in diameter on the screen. Now I aim 50px left of the target edge, execute my desired function and and get the info that this is 1m away from the target (2m from its center).

Now, I move 90m back, so the target is 100m away and appears 100px in diameter (don't know if that's correct, but you get the idea). Now I am aiming 25px left of the target and again, execute my desired function and it should tell me again that the distance is 1m.

Now, the "real" distance was 1m in both cases, but on my screen it was 50px at the first aim and 25px at the second.

So, what I am looking for is a (mathematical/programmatical) model to get the "real" distance between the target and where I aimed, no matter how far away I was from the target. I do have the positions of both archer and target in 3D coordinates. Though SQF is a very special language, it does provides a function to calculate the distance in meters and to dertermine certain geometrical values:

https://community.bistudio.com/wiki/Category:Command_Group:_Math

... so there's no need for that.

I know, this is very abstract, but I am hoping, somebody could give a hint or knows a mathematical procedure to do that.

If somebody knows how to do it in C, C++ or Java, I can write these languages, so that would be great!

sentences:
how do I set an int to the scroll wheel data in unity i need to set an int to data from the scroll wheel so I can have the script use this int to display an item attached to a number from that int. i'm using c#

i set up my scroll wheel input, what am i doing wrong?

here is the script;

  counter = Mathf.RoundToInt(Input.GetAxis("ScrollWheel"));

    Items.text = counter.ToString();

sentences:
Unreal C++ Detecting new Key Down during current Key Hold I am currently working on a combat system and I wanted to be able to have key combos to execute combat moves and such, and I am detecting key input type as well for example, if the key is tapped, or long pressed.

I use this line below to record the time a key is pressed, and time when the same key is released, so I can differentiate whether the key is just a quick tapped or long pressed.

  FPlatformTime::Seconds();

and when the the game detected a key press, it will execute the function below, using a timer and stopped on released.

//Long Press
void ABasePlayerController::StartRepeat(UFunction* FunctionNamesToCall, FKey KeyInput)
{
  //Execute if Timer is still active
  if (IsKeyDown != false && GetWorld()->GetTimerManager().IsTimerActive(RepeatTimerHandle) && WasInputKeyJustPressed(KeyInput))
  {
     CalledFunction.Broadcast(FunctionNamesToCall, KeyInput);
  }
}

The problem is when I wanted to make a key combination, and I stopped this function, whenever a new Key is pressed, the new key will be considered as a Long Pressed as well. My current codes only able to register input types after the key is released, and I wanted to be able to make a charging combo as well.

For example when I'm holding a Tab and I tap a new different key, both keys will be considered as a Long Pressed, while the expected result supposed to be Long Pressed Tab key, and the new pressed key is a simple quick tap.

Any ideas? Thanks!

sentences:
Is reinforcement learning overkill for a vehicle steering bot? I'm slightly familiar with the reinforcement learning (through this edx.org MOOC). Also I'm aware of reactive planning technique. I want to write a vehicle bot for a racing game, where cars have to complete laps and avoid collisions.

Is it sensible to use reinforcement learning for steering? Or should I stick with reactive planning?

sentences:
OpenWorld SceneGraph management and optimization I have a SceneGraph class which for now is just a simple list implementation, and the only optimization I've planned so far is a check is something like this:

//GetDistance returns the distance between 2 objects
float maxViewDistance = 10.0f;

for(int i = 0; i < sceneList.count; i++)
{
    if(GetDistance(sceneList[i], playerObject) < maxViewDistance)
    {
        Renderer.Draw(sceneList[i]);
    }
}

I plan on filling the SceneList when loading the game from a file which has a bunch of objectIDs and their positions, and then loading each object data (like .FBX, .BMP) somewhere (in another file).
But since I don't intend on having loading screens (except when the game starts), wouldn't it become too much to iterate when drawing? For example if I have a sceneList with a million objects for the entire game, even if it's just checking an if for each objects, wouldn't that hurt performance?

I was thinking in making a sublist that will get populated only for the objects I'm currently drawing (that are less than the maxDistance I set), but then I'd need to update this subList everytime the player takes a step, and I'd need to check for all objects in my entire objectList to see which are going to be draw next, so I don't think it'll help anyhow.

Also, for physics, I was also iterating through my sceneList and forcing every object to my physics rules (only gravity for now), but if I add for collision checks, what's the best way to do it?

//Inside my game update function
for(int i = 0; i < sceneList.count; i++)
{
    UpdatePhysics(sceneList[i]);
}

[...]

void UpdatePhysics(Object* object)
{
    //I'd need to check for collisions against **all** objects inside my sceneList again? Isn't there a better way to do this?
}

How games such as WoW (open world with no loading screens between large amounts of zones) do?
And for Physics, such as Deus Ex, where any object you throw in the air will be affected by gravity and will have collision against wherever is in it's path?

sentences:
IsoSurface Normals\Texture Coords Problems(DX11\SharpDX) Hi and thanks for your time!

So over the past few days I have been playing with isosurface construction from volume textures, I have it running on the cpu and all is well from a "just got it working" stand point eg. surface reconstruction works and I have my really cool voxel mesh drawing.

I have based my code(converted to VB.net) on Paul Bourke's work here: Polygonising a scalar field
and like I said it works well apart from the fact that my normals are wrong and I have these strange fully black on both sides triangles, I think I'm doing my normals wrong but the way they are now is the beast I can get, I tried a few ways to build the normals and this one is the only way I could get smooth normals.

Here you can see how my normals are wrong, green should be up, gray\dark should be unlit and the hay'ish colour is the lit side.

I have tried to flip and invert them but as you can see they are not wrong all the same way.

HLSL Normals 1st try:

float3x3 cotangent_frame(float3 N, float3 p, float2 uv)

// get edge vectors of the pixel triangle
float3 dp1 = ddx(p);
float3 dp2 = ddy(p);
float2 duv1 = ddx(uv);
float2 duv2 = ddy(uv);

// solve the linear system
float3 dp2perp = cross(dp2, N);
float3 dp1perp = cross(N, dp1);
float3 T = dp2perp * duv1.x + dp1perp * duv2.x;
float3 B = dp2perp * duv1.y + dp1perp * duv2.y;

// construct a scale-invariant frame
float invmax =   -sqrt(max(dot(T, T), dot(B, B)));
return float3x3(T * invmax, B * invmax, N);

HLSL Normals 2nd try:

NormalData CalcWS_Normal(float2 WS_TexCoord, float3 WS_Pos)

NormalData dout;

float3 dp1 = ddx(WS_Pos);
float3 dp2 = ddy(WS_Pos);
float2 duv1 = ddx(WS_TexCoord);
float2 duv2 = ddy(WS_TexCoord);

float3x3 M = float3x3(dp1, dp2, cross(dp1, dp2));
float2x3 inverseM = float2x3(cross(M[1], M[2]), cross(M[2], M[0]));

float3 t = mul(float2(duv1.x, duv2.x), inverseM);
float3 b = mul(float2(duv1.y, duv2.y), inverseM);
float3 normal = normalize(cross(normalize(b), normalize(t)));

dout.Normal = normal;
dout.Tang = t;
dout.BiTang = b;

return dout;

Heres is how I'm doing it now, takes a vertex and then samples the volume texture

VB.net

   Private Function vGetNormal(fX As Single, fY As Single, fZ As Single, fScale As Single) As Vector3
    Dim rfNormal As Vector3
    rfNormal.X = fSample1(fX - fScale, fY, fZ) - fSample1(fX + fScale, fY, fZ)
    rfNormal.Y = fSample1(fX, fY - fScale, fZ) - fSample1(fX, fY + fScale, fZ)
    rfNormal.Z = fSample1(fX, fY, fZ - fScale) - fSample1(fX, fY, fZ + fScale)
    Return Vector3.Normalize(rfNormal)
End Function

Private Function vGetNormal(fX As Single, fY As Single, fZ As Single, fScale As Vector3) As Vector3
    Dim rfNormal As Vector3
    rfNormal.X = fSample1(fX - fScale.X, fY, fZ) - fSample1(fX + fScale.X, fY, fZ)
    rfNormal.Y = fSample1(fX, fY - fScale.Y, fZ) - fSample1(fX, fY + fScale.Y, fZ)
    rfNormal.Z = fSample1(fX, fY, fZ - fScale.Z) - fSample1(fX, fY, fZ + fScale.Z)
    Return Vector3.Normalize(rfNormal)
End Function

Volume sampling code:

VB.net

Public Function GetVolumeData(_pos As Vector3) As Half
    Dim x2 As Single = Math.Abs((_pos.X / CellsPerPatch * 32) Mod mWidth)
    Dim y2 As Single = Math.Abs((_pos.Y / CellsPerPatch * 8) Mod mDepth)
    Dim z2 As Single = Math.Abs((_pos.Z / CellsPerPatch * 32) Mod mHeight)

    Return mScalars(CInt(Math.Truncate(x2)) + (CInt(Math.Truncate(z2)) * mWidth) + (CInt(Math.Truncate(y2) * mWidth * mWidth)))
End Function

The rest of the isosurface construction code is just a copy-> convert-> paste of Paul Bourke's c code.

Just to makes sure everyone knows what I'm asking: Can anyone tell me what I'm doing wrong? Is it a problem with my normals or the isosurface stuffs or both?

All of the above is just so u have some context, I'm happy to post more code if ppl need to see it

[EDIT]: Black squares come from having no depth info at that point so my deferred render hates those spots, this is leading back to maybe a problem with the surface reconstruction? But why its only happening in those spots, one would think that it would happen everywhere?

sentences:
2D Skier physics looks very artificial I am creating a ski slalom game and I coded a new physics routine, because I was told the rigidbodies are pure "not overly good thing" to use by my boss. With my physics routine it indeed looks much better, but I have no idea how could I make the skier look less plastic. Which means I want to achieve similar level of control like in Skiing Yeti Mountain, because there the physics is quite enjoyable, though still arcade. Basically the requirements are that I need to set up acceleration, top speed and the amount of grip to use when turning, but it somehow bites me back

    [SerializeField]
    private Vector2 slopeDirection = -Vector2.up;

    var dt = Time.fixedDeltaTime;
    var dirVector = Vector2.zero;

    dirVector.x = Mathf.Cos( radianOrientation );
    dirVector.y = Mathf.Sin( radianOrientation );

    float actualAcceleration = Mathf.Abs(Vector2.Dot(dirVector, slopeDirection));
    actualAcceleration = Mathf.Lerp(maximumAcceleration, 0, actualAcceleration) * Mathf.Pow(maximumAcceleration, accelerationSmoothing);

    velocity.x += actualAcceleration * dirVector.x * dt;
    velocity.y += actualAcceleration * dirVector.y * dt;

    Vector2 velocityDirection = velocity;
    velocityDirection.Normalize();

    float actualFriction = Mathf.Abs(Vector2.Dot(dirVector, slopeDirection));
    actualFriction = Mathf.Lerp(minimumFriction, maximumFriction, actualFriction) * Mathf.Pow(actualFriction, frictionSmoothing);

    // Simulate friction
    velocity *= actualFriction;
    Debug.Log(velocity);

    if(!_isFinished)
    {
        this.transform.position += new Vector3(velocity.y, -velocity.x, 0);
    }

why it is overly odd is that when I turn to the side it has a very abrupt power loss and when I turn the skis to 45 degrees to the slope. how could I achieve that the skier will slow down when he turns his skis, but after a little while it will accelerate again like in Skiing Yeti Mountain?

sentences: What is the game development market shifting towards? Aimed at the professionals who are there in the industry, what is the game development market shifting towards? Web-based or Mobile or Consoles/PCs. I have developed a decent knowledge of JavaScript and html5, so I want to know if this is entirely useful(on a game development perspective) or maybe I should learn some other language from scratch?

sentences:
Collision detection problems using AABB's I implemented a simple collision detection routine using AABB's between my main game sprite and various platforms (Please see code below).  It works great, but I'm now introducing gravity to make my character fall and it's shown up some problems with my CD routine.

I think the crux of the matter is that my CD routine moves the sprite back along the axis in which it has penetrated the least amount into the other sprite. So, if it's more in the Y axis than the X, then it will move it back along the X Axis.

However, now my (hero) sprite is now falling at a rate of 30 pixels per frame (It's a 1504 high screen - I need it to fall this fast as I want to try to simulate 'normal' gravity, any slower just look weird) I'm getting these issues.  I will try to show what is happening (and what I think is causing it - although I'm not sure) with a few pictures: (Code below pictures).

I would appreciate some suggestions on how to get around this issue.

For clarification, in the above right picture, when I say the position is corrected 'incorrectly' that's maybe a bit misleading.  The code itself is working correctly for how it is written, or put another way, the algorithm itself if behaving how I would expect it to, but I need to change it's behaviour to stop this problem happening, hope that clarifies my comments in the picture.

My Code

public boolean heroWithPlatforms(){

    //Set Hero center for this frame
    heroCenterX  = hero.xScreen+(hero.quadWidth/2);
    heroCenterY  = hero.yScreen+(hero.quadHeight/2);

    //Iterate through all platforms to check for collisions
    for(x=0;x<platformCoords.length;x+=2){

    //Set platform Center for this iteration
    platformCenterX = platformCoords[x]+(platforms.quadWidth/2);
    platformCenterY = platformCoords[x+1]+(platforms.quadHeight/2);

    // the Dif variables are the difference (absolute value)
    // of the center of the two sprites being compared (one for X axis difference
    //and on for the Y axis difference)
    difX = Math.abs(heroCenterX-platformCenterX);
    difY = Math.abs(heroCenterY-platformCenterY);

    //If 1
    //Check the difference between the 2 centers and compare it to the vector (the sum of
    //the two sprite's widths/2.  If it is smaller, then the sprites are pverlapping along
    //the X axis and we can now proceed to check the Y axis
    if (difX<vecXPlatform){

    //If 2
    //Same as above but for the Y axis, if this is also true, then we have a collision
    if(difY<vecYPlatform){
        //we now know sprites are colliding, so we now need to know exactly by how much
        //penX will hold the value equal to the amount one sprite (hero, in this case)
        //has overlapped with the other sprite (the platform)
        penX = vecXPlatform-difX;
        penY = vecYPlatform-difY;
        //One sprite has penetrated into the other, mostly in the Y axis, so move sprite
        //back on the X Axis
        if (penX < penY){hero.xScreen-=penX*(heroCenterX-platformCenterX>=0 ? -1 : 1);}
        //Sprite has penetrated into the other, mostly in the X asis, so move sprite
        //back on the Y Axis
        else if (penY < penX) {hero.yScreen-=penY*(heroCenterY-platformCenterY>=0 ? -1 : 1);}
        return true;
        }//Close 'If' 2
        } //Close 'If' 1
    }
    //Otherwise, no collision

    return false;
    }

sentences:
How to use the Vulkan graphics backend in the Stride game engine? What do I have to do in order to run my Stride game on the Vulkan graphics platform?

The documentation section seems to be outdated, the drop-down doesn't exist anymore:
https://doc.stride3d.net/latest/en/manual/platforms/index.html#set-the-graphics-platform

sentences:
Unity5 build won't run on android 2.3.3 I made a game using one of the Unity tutorials on their site and now would like to run on my phone (LG P500). But when I try to run it on the device, it says:

  Failure to initialize: Your hardware does not support this application, sorry!

What can I do in this case?

sentences:
How 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:
How to convert OpenCV camera capture to Irrlicht texture without killing fps? I am looking to include images captured from the users webcam into my application so I've been looking into using OpenCV to capture from the webcam and then render it in Irrlicht. I've created a basic app to test and I'm doing this in my main loop to capture and convert to ITexture* to render onto a cube.

    if( cv::waitKey(50) >= 0 ) break;
    capture >> camera_frame;

    if( ! camera_frame.empty() )
    {
        unsigned char *tex_buf = (unsigned char*)frame_tex->lock();
        unsigned char *frame_buf = camera_frame.data;
        // Convert from RGB to RGBA
        for(int y=0; y < camera_frame.rows; y++) {
            for(int x=0; x < camera_frame.cols; x++) {
                *(tex_buf++) = *(frame_buf++);
                *(tex_buf++) = *(frame_buf++);
                *(tex_buf++) = *(frame_buf++);
                *(tex_buf++) = 255;
            }
        }
        frame_tex->unlock();

        //cube->setMaterialTexture(0, driver->getTexture("../../media/t351sml.jpg"));
        cube->setMaterialTexture(0, frame_tex);
        cube->setMaterialFlag(video::EMF_LIGHTING, false);

    }

...

It works.... BUT... the framerate drops to about 4fps.

Yes, it probably could have been done slightly more efficiently, but it's a massive drop in framerate for something so simple.

Is there another way to do this that won't kill the framerate?

sentences:
how to reset etsa function GetJoystickNames in unity? the problem is that if I connect a command the array
GetJoystickNames increases an index but if you disconnect it does not reduce the index and continues counting as if it were connected

sentences:
Packaging JARs for Linux I realise that this question exists but the answer doesn't explain how to create DEB packages and whether they're suitable.

I'd like to package my Java 8 game for Linux. Most people don't have Java 8 (and some don't even have Java), so including the JRE in the package would be great.

The package should also have a logo that shows up on most desktop environments.

Lastly, the package should be cross distro (or cover a large number of distros), if possible, because there are simply so many distros.

How would I go about achieving this?

sentences:
SpriteKit tunneling when user moves node I have a question about (continuous) SpriteKit collision detection.
I have a SwiftUI/SpriteKit project in which balls fall from above and the user tries to catch the balls with a cup.
The user moves the cup horizontally by dragging their finger.
The physics work well with one exception -- the balls properly collide with each other, and with the cup, except when the cup is being moved.
When the cup is being moved by the user, the balls that had fallen into the cup tunnel right through the side of the cup.
Again, the balls collide with the cup correctly, and settle in the cup, except when the cup is moving.
The collision types:
enum CollisionTypes: UInt32 {
    case ball = 1
    case cup = 2
}

The cup:
func cup() -> SKSpriteNode {
        let screenSize = UIScreen.main.bounds
        let cupNode = SKSpriteNode(imageNamed: "cup2.png")
        let cupOutline = SKSpriteNode(imageNamed: "cupOutline.png")

        cupNode.position = CGPoint(x: screenSize.width*0.5, y: MainData.cupY)
        cupNode.size = CGSize(width: screenSize.width * 0.25, height: screenSize.width * 0.35)
        cupNode.name = "cup"
        cupNode.zPosition = 1.0

        cupNode.physicsBody = SKPhysicsBody(texture: cupOutline.texture!, size: CGSize(width: screenSize.width * 0.25, height: screenSize.width * 0.35))
        cupNode.physicsBody?.isDynamic = false
        cupNode.physicsBody?.usesPreciseCollisionDetection = true
        cupNode.physicsBody?.categoryBitMask = CollisionTypes.cup.rawValue
        cupNode.physicsBody?.collisionBitMask = CollisionTypes.ball.rawValue

        return cupNode
    }

The balls:
func initializeBalls(screenWidth: CGFloat, screenHeight: CGFloat) {
        for i in 0..<numOfBalls {
            let radius = screenWidth * 0.02
            let x = screenWidth * CGFloat.random(in: 0...1)
            let y = screenHeight
            let ballNode = SKSpriteNode(imageNamed: "ball.png")

            ballNode.position = CGPoint(x: x, y: y)
            ballNode.size = CGSize(width: radius*2, height: radius*2)
            ballNode.name = "ball\(i)"

            ballNode.physicsBody = SKPhysicsBody(circleOfRadius: radius)
            ballNode.physicsBody?.usesPreciseCollisionDetection = true
            ballNode.physicsBody?.mass = 5.0
            ballNode.physicsBody?.isDynamic = true

            ballNode.physicsBody?.categoryBitMask = CollisionTypes.ball.rawValue
            ballNode.physicsBody?.collisionBitMask = CollisionTypes.cup.rawValue

            ballNode.physicsBody!.contactTestBitMask = ballNode.physicsBody!.collisionBitMask

            ballNode.physicsBody?.restitution = 0.1
        }
    }

Here's how I move the cup, in my GameScene:
func touchMoved(toPoint pos : CGPoint) {
     let action = SKAction.move(to: CGPoint(x: pos.x, y: MainData.cupY), duration: 0)

     cupNode?.run(action)
}

Why is this tunneling happening, and how do I avoid it?

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 should I design my particle system to make it easy to add new particle effect types? Recently I started designing a particle system for a game I develop. But I have some issues with it. I mean, it works but I have a feeling that my design isn't good enough.

So, basically I have a Particle class which contains the particle's vars and couple of functions:

class OBJECTATTRIBUTE_API Particle
{
protected:
     Vector3d position;
     Vector3d direction;
     Vector3d gravity;

     float life;
     float fade;

     float red;
     float green;
     float blue;

     bool isActive;
     bool isInit;

public:
     void Deinitialize();

     void SetPosition(Vector3d position);

     bool IsActive();
};

And I derive from that class the types of particles. Like this:

class OBJECTATTRIBUTE_API ParticleExplosion : public Particle
{
public:
    void Initialize();

    void Update();
    void Render();

    void Rejuvenate();
};

And at the end is the emitter. This is actually where I think my design fails. I make an emitter for every particle system and, at some point, I may have too much different emitters.

Here is an example of the particle emitter realisation:

// The base class
class OBJECTATTRIBUTE_API ParticleEmitter
{
protected:
    Vector3d emitterPosition;

    unsigned int particleTextureID;
    unsigned int particleCount;
    bool isEmitterStopped;

public:
    ParticleEmitter();
    ParticleEmitter(Vector3d emitterPosition);
};

// The derived emitter.
class OBJECTATTRIBUTE_API ParticleEmitter_Explosion : public ParticleEmitter
{
private:
   ParticleExplosion *particles;

public:
   void AddParticles(unsigned int particleCount);

   void Initialize();

   void Start();
   void Stop();

   void Reposition(Vector3d newPosition);
   void SetParticleTextureID(unsigned int particleTextureID);
};

And the question - Is my particle system design good? If not, what can I do to improve it?

EDIT : I was told that the question was too subjective, so I will try to add couple of specifications.

Firstly, I started making the particle system for explosion simulation and also some attack animations in my game. It works very well with that, so I think this goal is achieved.

Secondly, the performance hit is acceptable and I am OK with that.

And finally, the question was about is this design good for flexible adding of new particle effects implementation?

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:
How can I acheive a smooth 2D lighting effect? I'm making a 2D tile based game in XNA.

Currently my lightning looks like this.

How can I get it to look like this?

Instead of each block having its own tint, it has a smooth overlay.

I'm assuming some sort of shader, and to pass the lighting values for the surrounding tiles to the shader, but I'm a beginner with shaders so I'm not sure.

My current lighting calculates the light, and then passes it to a SpriteBatch and draws with the tint parameter. Each tile has a Color that is calculated before draw in my lighting algorithm, which is used for the tint.

Here is an example on how I currently calculate lighting (I do this from left, right, and bottom too, but I got really tired of doing this frame by frame...)

So actually getting and drawing the light so far is no problem!

I have seen countless tutorials on fog of war and using gradient circular overlays to create smooth lightning, but I already have a nice method to assign each tile a lightning value, it just needs to be smoothed between them.

So to review

Calculate Lighting (Done)
Draw Tiles (Done, I know I will need to modify it for the shader)
Shade tiles (How to pass values and apply "gradient)

sentences:
pick up material from another object is it possible to obtain a material from another object?
I'm trying everything and nothing, the only thing I could get was just the color of another object
public MeshRenderer takematerial;
public GameObject[] Objects;
for (int i = 0; i < Objects.Length; i++) {
    Objects [i].GetComponent<Renderer> ().material = takematerial.material;
}

sentences:
How to avoid duplication using client-server model I am using a client-server model to write a multiplayer-capable game (in Java). Currently the clients and the server are using the same code to run the game logic, in order to enable client-side prediction. This makes sense to me, since I don't want to have to duplicate my entire codebase to make this work.

However, there are certain things that should only be done by the clients (e.g. send user input to the server, update camera position, play sounds, etc.) and certain things that should only be done by the server (e.g. send messages to the clients, remove entities, etc.).

How can I share the same code between my client and server without peppering it with "if client", "if server", etc.?

EDIT: It has been suggested that I should extract all common code into a library and have 2 separate projects - the client and the server - each of which should extend the common code to include custom functionality. But won't this still result in a lot of duplication?

To take an example: let's say I have an Entity class. Whenever an Entity moves, it should play a sound if it's on the client, and send a TCP message if it's on the server. Therefore I create 2 other classes, ClientEntity and ServerEntity, both of which extend Entity. Now all of a sudden my Zombie class, which previously extended Entity, needs to be duplicated across the client and server projects so that the client version can extend ClientEntity, and the server version can extend ServerEntity.

If I have a lot of classes that all extend Entity, then this results in a lot of duplication. What am I missing here? :)

sentences:
Unity GameView Differrent with CameraView - Dont have 3D environments Now on my existing project, if i create new scene, automatically i got my gameview like below :

above game does not have 3d environments outlook, i'm expecting like below (my old existing scene) :

Any Idea to solve this ?

thanks

sentences:
Unity 3D Slow car (wheel colliders) My car is moving very slowly even though I apply high amounts of torque to the wheel colliders. The only thing I found to be helpful was to increase the wheel's friction stiffness, but that really messes up the braking and makes the car shake.
The values I use for setting up the car and torque are realistic (1500 kg car, 20 kg wheels, a realistic torque value accounting for gear ratios etc.), so I don't understand the problem.

sentences:
How to properly simulate object aproximation towards camera in 2D? I'm trying to make some objects come towards the camera but it just doesn't feel right... you can check the progress here:

http://testing.fyrastudio.com/lab/tweetOlympics/v0.005/

You run by repeateadly hitting the letter Q, and around position 700 the first hurdle appears. But it just doesn't look right. I think that on real life, the hurdle would go slower when it's further away, and when it's closer to the camera, it would go real fast... and now it's doing it the other way around...

Here's the code handling the hurdle movement:

hurdle.scaleX = hurdle.scaleY = (athlete.position - hurdle.position_initial) / 1000;
hurdle.y = bg.image.y + (athlete.position - hurdle.position_initial) * 0.4;

Any ideas??
Thanks!!

sentences:
Why does my SDL code crash when I move the mouse over the window? Whenever I move my mouse below where the image renders in my game, the SDL window crashes and closes down.

I have narrowed the crash down to the bit of code where I check to see if the Escape key was pressed and quit my game; the relevant part of my event loop is:

while (SDL_PollEvent(&e))
{
  if (e.type == SDL_QUIT)
  {
    quit = true;
  }
  if (e.key.keysym.sym == SDLK_ESCAPE)
  {
    quit = true;
  }
}

I found that if I remove the if(e.key.keysym.sym... check, the crashing stops. What is wrong with my code?

sentences:
Where can I find sales figures for PSN Minis? I work for a small game studio that develops games for iOS and Android currently. The engine we are building will be portable and our upcoming game is quite ambitious. Therefore we are considering porting it to PSP also, making it available at the PSN as a mini. I have been searching for days now but I am having trouble finding any numbers of what an average PSN mini game can sell. What a hit or a bad game could sell is also really interesting.
As we are trying to calculate if it is worth going into this market any clue would be helpful!

sentences:
Unity WebGL Build: Why it shows only Empty Folder? i'm trying to built my game, made in Unity 2018.3, and i'm trying to built it in WebGL, but the problem is this: built was succeeded, but the Folder is still Empty, and here is the problem occured:

This was never happened to me before. anybody know how to fix it?

sentences:
Opening an XML in Unity3D when the game is built At the moment, my game can open up an XML file inside the editor when I run it. In my XMLReader.cs I'm loading in my file like so:

_xmlDocument.Load(Application.dataPath + "\\HV_Settings\\Settings.xml");

This class also deals with what the XML should do once it has been read in.

However, when I build the game and run the exe, this file isn't called. I know that I can store this file in the C drive, but I want to keep everything in one place so when I start to release what I'm working on, the user doesn't need to do anything.

Am I doing something silly which is causing the XML not to be read?

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:
Minecraft/OpenGL - Create Multiple viewports I'm working on a project for the game and i have been trying to draw a second smaller "window" that would act like a second camera, independent from the player.

I have looked into glViewport however i keep running into issues where the second viewport is the only one being drawn (the first one gets covered  by the second and has a blank screen where the first viewport should be:

So i guess the question is: How can i have multiple windows on screen and make it so it plays nice with the game's default rendering system?
I know it is possible since the game uses OpenGL, and maybe its just a simple case of putting the code in the right class.

sentences:
Possible / How to render to multiple back buffers, using one as a shader resource when rendering to the other, and vice versa? I'm making a game in Direct3D10. For several of my rendering passes, I need to change the behavior of the pass depending on what is already rendered on the back buffer. (For example, I'd like to do some custom blending- when the destination color is dark, do one thing; when it is light, do another).

It looks like I'll need to create multiple render targets and render back and forth between them. What's the best way to do this?

Create my own render textures, use them, and then copy the final result into the back buffer.
Create multiple back buffers, render between them, and then present the last one that was rendered to.
Create one render texture, and one back buffer, render between them, and just ensure that the back buffer is the final target rendered to

I'm not sure which of these is possible, and if there are any performance issues that aren't obvious. Clearly my preference would be to have 2 rather than 3 default render targets, if possible.

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:
Visual Basic PictureBox A description of my game:

When you start the game, you have a few seconds to memorize the arrangement of the grids. By the arrangement, I mean each grid is one of two colors. After the time is up, all the grids are set to the 'off' color. The player must click on the grids to toggle them and put them in their correct color assignments as they were seen before.

Okay so this is part of a game I am developing.Instead of using solid colors, I want use background images but I don't know how to edit the code to do so.
Any help would be welcome.

Dim GridOn As Color = Color.LightBlue
Dim GridOff As Color = Color.DarkBlue
Dim MaxTime As Integer = 40

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    For Each pic As Control In Me.Controls 'For every picture in form1's controls...
        If TypeOf pic Is PictureBox Then   'Then, only picks the pictureboxes, not the buttons, labels, etc.
            AddHandler pic.Click, AddressOf PictureBoxClick 'For each picturebox (grid), add an event handler (PictureBoxClick) to avoid
        End If                                              'typing 16 of them ourselves
    Next
End Sub

    Private Sub PictureBoxClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
    If AllowEdit = True Then
        Dim ctrl As PictureBox = DirectCast(sender, Control)
        If ctrl.BackColor = GridOn Then
            ctrl.BackColor = GridOff 'Set the backcolor to either GridOn or GridOff
        Else : ctrl.BackColor = GridOn
        End If
    Else
        'Do not allow the user to change the colors
    End If
  End Sub

sentences:
What are the basics in game architecture? How do you create your game skeleton such that it doesn't stay in your way? There must be some best practices on how you create your game architecture/skeleton.
One of the best resources that I found is:
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/
My primely focus is for iOS games using cocos2d.

What is your know how on this topic?

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:
Shaders wont bind to the uniform block I'm having an issue with interface block binding.

Example shader:

const char* vertexShader =
        "#version 330 core\n"
        "uniform globalMatrices"
        "{"
        "   mat4 vPMatrix;"
        "};"
        "layout(location = 0) in vec2 vPosition;"
        "layout(location = 1) in vec4 vColor;"
        "out vec4 color;"
        "void main()"
        "{"
        "   color = vColor;"
        "   gl_Position = vPMatrix * vec4(vPosition, 1.0, 1.0);"
        "}"

After creating the shader program i call functions:

    //this is done once per shader
    void BindShaderToMatrixBlock(unsigned int program)
    {
        GLuint globalUniformBlockIndex = glGetUniformBlockIndex(program, "globalMatrices");
        glUniformBlockBinding(program, globalUniformBlockIndex, 0);
    }
    //this is done once
    void BindUniformBlockMatrix()
    {
        glGenBuffers(1, &uniformBlockMatrix);
        glBindBuffer(GL_UNIFORM_BUFFER, uniformBlockMatrix);
        glBufferData(GL_UNIFORM_BUFFER, sizeof(glm::mat4), NULL, GL_DYNAMIC_DRAW);
        glBindBuffer(GL_UNIFORM_BUFFER, 0);
        glBindBufferRange(GL_UNIFORM_BUFFER, 0, uniformBlockMatrix, 0, sizeof(glm::mat4));
    }

And this is how i update the matrix:

inline void SetVPMatrix(const void* data)
{
    glBindBuffer(GL_UNIFORM_BUFFER, uniformBlockMatrix);
    glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(glm::mat4), data);
}

I tried to debug as much as i could and confirmed that the data gets delivered to the uniform block but for some reason the matrix in the shader stays unchanged.

sentences:
Painter algorithm vs. 3D rendering with Z-buffer when drawing 2D Sprites I'm currently developing a tile base engine. I want it to look like your average old school tilebased RPG like Zelda - Link to the past (orthographic projection, squared tile texture, textures overlapping each other, alpha channels, etc.). The twist is that the world is internally 3d meaning that every tile has an elevation and entities are moving in a 3d space. Reason for this is beyond the scope of this question but I'm struggling on comparing the follow two ideas for the rendering. I'm using OpenGL with libGDX in Java but wouldn't mind writing my own code to interface OpenGL. That's also why I didn't tag it.
A screenshot of "Zelda - Link to the past" in case you don't know what it looks like.

Painter algorithm
Disable Z-Buffer and use painter algorithm to draw from back to front in the appropriate order with some overdraw and a lot of texture rebinding. I know a texture atlas can minimize the texture rebinding but the engine is supposed to act more like a sandbox so I don't want to rely too heavily on assumptions like a efficient texture atlas that I might not have all the time.
Pro: Easy to implement and very straight forward.
Con: I've no idea how big the impact will be since almost every sprite will cause a texture rebinding. And I don't know how to predict the performance costs of that many texture bind calls.

Full blown 3D
Rotate the camera 45 degrees up around the x axis with an orthographic projection matrix. Then use the 3d information from the game world to draw the tile textures with billboarding at the real position in the worlds 3d space. Same for entities and such. This way I can gather all sprites and then render them sorted by their texture which means one texture bind per texture and reduced overdraw due to usage of the Z-buffer
Pro: I can use a freecam to debug render problems. I assume it's significantly faster that the painter algorithm.
Con: Some sprites might share the same place which could lead to Z-fighting. I'm thinking about how to use multiple layers on a tile. For instance you may have a bridge tile with a railing where the railing is always overlapping an entity on the bridge but the floor of it is always overlapped by the entity. So I would have to add a little offset to different layers in the 3d space. I'm not really sure how that would work out and to be honest had a hard time figuring out how old games did it so maybe I'm overthinking it.

I guess I have a very rough idea of how each method will work out but I don't know how much the texture rebinding (or sorting and preparing the sprites for the 3d approach) is affecting the performance and while it's easy to find information regarding large 3D scenes I found it difficult to get information about 2D scenes with way less polygons.I hope this question is not too much a subject of personal preference. I know that Premature optimization is the root of all evil but due to how the decision is affecting almost the entire rendering process I don't want to make the wrong call.
I deliberately didn't mention any OpenGL functions mainly because I've mostly used the libGDX API which hides the function calls behind it's wrappers but generally I know how the internals work and just got into the internals and how the OpenGL API works. I don't think specific OpenGL calls do matter for the question but feel free to use them for your answer I'll just look them up.

sentences:
shadow mapping with directional light and octree i am about to add shadow mapping to my simple game, i have a map level structured in an octree the camera culls out the octree nodes out of the vieweing frusutm and everything runs smooth. Now i want shadows and i have a doubt , the directional light runs is set at an infinite distance so basically it encompasses all the octree destroying the purpose of node culling. How can i add a directional shadow map and cull nodes outside the light frusutm if it is at an infinite distance ?
thanks in advance

sentences:
Center directional light shadow to the cameras eye I'm currently drawing my directional light shadow using this view and projection:

XMFLOAT3 dir((float)pitch, (float)yaw, (float)roll);
XMFLOAT3 center(0.0f, 0.0f, 0.0f);

XMVECTOR lightDir = XMLoadFloat3(&dir);
XMVECTOR lightPos = radius * lightDir;
XMVECTOR targetPos = XMLoadFloat3(&center);
XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);

XMMATRIX V = XMMatrixLookAtLH(lightPos, targetPos, up); // This is the view

// Transform bounding sphere to light space.
XMFLOAT3 sphereCenterLS;
XMStoreFloat3(&sphereCenterLS, XMVector3TransformCoord(targetPos, V));

// Ortho frustum in light space encloses scene.
float l = sphereCenterLS.x - radius;
float b = sphereCenterLS.y - radius;
float n = sphereCenterLS.z - radius;
float r = sphereCenterLS.x + radius;
float t = sphereCenterLS.y + radius;
float f = sphereCenterLS.z + radius;
XMMATRIX P = XMMatrixOrthographicOffCenterLH(l, r, b, t, n, f); // This is the projection

Which works prefect if the center of my scene is at 0.0, 0.0, 0.0. What I would like to do is move the center of the scene relative to the cameras position. How can I do that?

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:
2.5D platformer how to darken building edges? I was wondering how I could go about creating a vignette type effect / some sort of volumetric shadow for the 'cross section' parts of a 2.5D level. The effect I'm going for can be seen in 'This war of mine' where the edges of the rooms and walls / floors that are facing the camera have been darkened and blurred. (see below).

I thought about creating the edges in photoshop and then blurring them and putting them in, however the blur scales weirdly as I'm re scaling the sprites so it looks really fake and not like a visual effect. Is there perhaps a 2d shader I could use or make?

Any help on this would be appreciated!

Cheers

My photoshop attempt to recreate

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: How to load unity scenes asynchronously? If i am playing scene 1, i want to load the scene2 in parallel, so after the completion of scene 1 i will smoothly transition to scene 2 without loading, is there is any option for this?

sentences:
Shader effect similar to Metro 2033 gasmask I was thinking about effects in games the other day and I was reminded of the Gasmask effect from Metro 2033. Once you put the gasmask on it blurred a bit in the corners and could ice up and even get cracked.

I assume that something like that is done using a shader. I have been experimenting a bit with game development, so far mostly playing with existing rendering engines and adding physics support etc.

I would like to learn more about this sort of effect. Can someone give me a simple example of a shader that would alter the entire scene like this. Or if not a shader then an idea on how it would be done. Thanks.

Edit : Include screenshot of the metro 2033 gasmask effect.

sentences: Can I use glTranslate and glRotate when my GLSL Version over (#version 120)? I was using "GLSL Version #120". But now i am trying to do one tutorial and it is using "gl_ClipDistance[0]" inside of vertex shader. And "GLSL Version #120" doesn't support "gl_ClipDistance[0]". Now i need to change GLSL Version with over #120 for example #330 . I also have to change "gl_ModelViewProjectionMatrix" inside vertex shader. But my question is i need to change glTranslate,glRotate,glLoadIdentity etc ?

sentences:
Player moves in a jerky way when riding on a moving platform I have a moving platform script that travels between three positions. This works fine.

I have a script that holds the player to a platform, and this works fine too.

But when I parent my platform that holds my player to an object with the moving platform script, the player's movement is jerky and uneven.

Here are the scripts I'm using:

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

public class MovingMultipalPoint : MonoBehaviour
{

    public Vector3 pointB;
    public Vector3 pointC;
    public float Second = 5.0f;
    public float Speed = 3.0f;
    //public float HoldSecond = 5.0f;

    IEnumerator Start()
    {
        Vector3 pointA = transform.position;
        while (true)
        {
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointA, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointC, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointC, pointB, Speed));
            yield return new WaitForSeconds(Second);
            yield return StartCoroutine(MoveObject(transform, pointB, pointA, Speed));
        }
    }

    IEnumerator MoveObject(Transform thisTransform, Vector3 startPos, Vector3 endPos, float time)
    {
        float i = 0.0f;
        float rate = 1.0f / time;
        while (i < 1.0f)
        {
            i += Time.deltaTime * rate;
            //newRotation *= Quaternion.Euler(0, 90, 0);
            //transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, 20 * Time.deltaTime);
            thisTransform.position = Vector3.Lerp(startPos, endPos, i);
            yield return null;
        }
    }
}

This script holds the player to the platform.

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

public class HoldPlayer : MonoBehaviour
{
    private GameObject target = null;
    private Vector3 offset;
    void Start()
    {
        target = null;
    }
    void OnTriggerStay(Collider col)
    {
        target = col.gameObject;
        offset = target.transform.position - transform.position;
    }
    void OnTriggerExit(Collider col)
    {
        target = null;
    }
    void LateUpdate()
   {
        if (target != null)
        {
            target.transform.position = transform.position + offset;
        }
   }
}

(1st Image) Here is how the moving platform is configured in the Inspector:

(2nd Image) And the holding script:

Also here recorded video of issue

Any ideas how I can keep the movement smooth in this case?

sentences:
Unity: Interrupting Animations When I interrupt an Animator Controller during an Animation and reopen it the Armature gets stuck (more or less) at the point where the previous Animation was interrupted. How can I safely and instantly quit an animation without destroying it?

Please watch the Video to fully comprehend the problem: https://youtu.be/O9X5SBATHRw

Screenshot of Problem:

Screenshot of Animator Controller:

Part of the Weapon Switch Script:

disableWeaponModel(weaponNameList[activeWeapon]); //Disable active Weapon Model

if (holsteredWeapon == -1) //If player carries only 1 weapon
    holsteredWeapon = activeWeapon; //Active Weapon is holstered
else //Player already carries 2 weapons
    actionDropGun(); //Active Weapon is thrown (New LOD generated)

activeWeapon = getWeaponIDfromLOD(targetName); //Active Weapon is set to Target LOD

setWeaponVars(activeWeapon); //Set all variables to the active Weapon
setWeaponModel(weaponNameList[activeWeapon]); //Set Weapon Model to the active Weapon
setAnimator(weaponNameList[activeWeapon]); //Set Animations to the active Weapon

setAnimator(string name) Function from above (last code line):

void setAnimator(string name)
{
    //Add new guns here
    if (name == "MP5A3")
        currentWeaponAnimation = MP5A3_Animation;
    else if (name == "Rpk-74")
        currentWeaponAnimation = Rpk74_Animation;
    else if (name == "Skorpion")
        currentWeaponAnimation = Skorpion_Animation;
}

Variables from setAnimator(string name):

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:
Using pixel art on small high resolution screens I'm making a game and I would like to utilize pixel art as my style. But I faced a problem, modern displays on my target platform (iOS) have extremely high resolution.
So if my artist makes me some sprites in 1 to 1 pixel resolution, each character sprite will look like 2x3 millimeters, and that's not what I want.

How do I fix this problem? Do i just use 4 pixel blocks as 1 pixel in my art, or there is some other way?

Another question, is how do I utilize high-crisp display of those devices with pixel art?

How do I go with using images on older devices? Do I have to make double assets or downscale/upscale some images?

sentences:
Separation of axis theorem implementation at normals This might be more of a math question, but it relates to the development of a simple physics engine I am trying to create.

I have been stumped on this for about a week now, and have been unable to find an answer in any of the SAT tutorials. (http://www.metanetsoftware.com/technique/tutorialA.html#toc, http://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169, etc.)

I understand how SAT is supposed to work, however I am little confused on the math. First, I am finding my normals like so:

Block.prototype.findNormals = function () {

        var axisVectors = new Array();
        var vertices = this.Properties.Vertices;
        var keys = Object.keys(vertices)

        for( var i = 0; i < keys.length; i++) {
            var last = {x: 0, y: 0};

            axisVectors.push({xComponent: -(vertices[keys[i]].y - last.y), yComponent: (vertices[keys[i]].x - last.x) });

            last = {x: this.x, y: this.y};
        }

        return axisVectors;
    }

I am then precede to project each vertex of the shapes I am testing on those normals.

The problem occurs, and the part of the math that I am not fully understanding, is when I have a situation like so:

axis = (-5, 6)
vertex = (6, 5)

math.dot(vertex, axis)

This results in 0.

Thus my min value for shape1 is always 0. And this results in a false collision.

Can anyone explain the math a little better?

sentences: How do I disable texture filtering for sprite scaling in XNA 4.0? I have a sprite that I'm trying to scale up in XNA, but XNA is applying some sort of texture filtering that smooths it and makes it look ugly. I'd like it to just do pixel doubling instead of interpolation. How would I accomplish that?

sentences:
Migrating from OpenGL to XNA (MonoGame)? I just started working in MonoGame with 3D code.  I've used OpenGL before in the past, and I've also built engines with 2D Sprites/SpriteBatch's in MonoGame.

However, I'm getting extremely stumped with going from GL to XNA, likely due to the fact that I believe XNA is no longer a "state" machine like GL is.

I've looked thru the tutorials by RB Whitaker and Riemers -- but most of the stuff they have written covers models, etc.  I've already migrated some of my code to build procedural meshes into a VertexBuffer.  I'd like to test it now, but I'm getting very confused as to how to setup the World, View, Projection matrices, etc.

Are there any good tutorials that either show how to move from GL to XNA -- or optionally -- any good tutorials that assume you're not using Models, etc?  I'm looking to write something fairly low-level when it comes to primitives.

sentences: How to Change default Mouse pointer on emulator in Android? I want to change default mouse pointer in Android emulator. I want to change it for my game to use different type of cursor.I am using AndEngine for my game development. Is there nay way to change default mouse cursor for my Application. Thanks in Advance

sentences:
How to only render fragments with Z from 0 to 1 in OpenGL? I have been using OpenGL for a year now, but I just recently found out that OpenGL only clips vertices when the absolute value of the x,y or z coordinate is less than the absolute value of w coordinate. Previously I had assumed that the z coordinate would have to be 0 < z < w to be rendered. Is there any way to clip vertices with z less than 0, without a performance hit?

I am using OpenGL 4.4

sentences:
Does using LWJGL and Slick2D yield promise for the future of my project? I've been looking around the net for months now in an attempt to find the most appropriate tool for my needs. I haven't had a lot of time to devote to the creation of systems that could possibly already exist, however, now I do.

That being said, I've been drawn to 2 or 3 APIs/Engines thus far. The bulk of my experience lays with Java due to the exposure during my time in high school and college (of which I am currently a senior in, if any of you are wondering!) but I have used Python, C, C++, C#, and even a little Ruby and PHP for site needs.

Now, I've sought the power of OpenGL and LWJGL because of the platform independence and the obvious success of things such as Minecraft being used in a Web, Linux, Mac, and Windows environment. This is all due to Java, LWJGL, and a very interesting game concept. I've used the Slick2D API which is built upon LWJGL and I would like to continue with it if there is promise of no limitations on what I intend to create. I need a powerful, platform-independent 2D/3D graphics library, an input-monitoring system with perhaps even controller support, and networking capabilities beyond that of the standard (Java, or other language) library.

I've also looked into both the Torque Game Engine as well as the UDK and, to be honest, the UDK looks quite perfect. However, my goal for the end of this project is for the user to be able to host a multiplayer session which other players can join via IP or hostname, the world be a unique generation for each "new game", but still not limit the game in such a way that would not allow complex system to be implemented. Now, nothing would be limited if I simply used the UDK source, but I will not make such a commitment without first consulting the experts.

TL;DR - This is not intended to be a, "Which engine should I use? I like Java but wahhh I'm scared to write real code!" I have written my own engine (2D) and it has not been as successful as current ones, but it's done what I wanted it to. My only question is: Is the UDK sufficient for my needs; if not, I believe that the Slick2D API could be. I'm an aspiring Computer Science major from Michigan Tech, so learning and developing something new would not crush my world, haha. I would just like to hear what the beating heart of SE has to say on such topics. My plan for this project was 2D purely to control scope creep and not overwhelm myself.

Thanks!

PS - Also, I've done research on all programming topics associated with this development: creating standalone listening servers, PCG, complex item/inventory/reward systems, advanced dynamic RPG level systems and dynamic storyline systems. I'm not a super-noob. Just a curious individual.

sentences:
How do I use threads together with DirectX11? I have only found the documents on MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476884(v=vs.85).aspx Although it doesn't say anything about creating them, it mentions that device is thread-safe while device context is not.

Does the framework use threads by itself (if driver supports it) when it thinks it's more optimal? Or do we have to use some external library like BOOST to play around with threads?

sentences:
How do I delete all saved preferences in my libgdx project? I want to delete the preferences that saved my last highscore. How can I do this?

Here's how I am saving preferences at the moment:

prefs = Gdx.app.getPreferences("ZombieBird");
if (!prefs.contains("highScore")){
    prefs.putInteger("highScore", 0);
}

public static void setHighScore(int val) {
   prefs.putInteger("highScore", val);
   prefs.flush();
}

sentences:
How to set the camera projectionmatrix so that it's 4 rays always exactly hit the corners of a defined plane? I have a camera, and I have a plane.
The plane has 4 corner points.
I need to find out how to change the projection-matrix of the camera so that the projection-rays of the camera always hit the corners of the plane.

The camera and the Plane are supposed to be movable rotateable (if possible)
The Plane is also supposed to be scaleable.

Usage:

I am making a Stereo-3D-Game with Eyetracking where my 2 Eye-Vectors hit the exact same paralax-plane.

That paralax-plane is defined.
So we have the Corner-positions of the Plane.

sentences: Rounded corners in XNA? Is there any way that I can make rounded corners on a rectangle rendered in XNA through primitives (line-strips)? I want to make my UI a bit more fancy than it is already, and I would like the code to be flexible, without too many textures involved.

sentences:
Strange mesh import problem with Assimp and OpenGL Using the assimp library for importing 3D data into an OpenGL application. I get some strange problems regarding indexing of the vertices:

If I use the following code for importing vertex indices:

for (unsigned int t = 0; t < mesh->mNumFaces; ++t)
    {
        const struct aiFace * face = &mesh->mFaces[t];
        if (face->mNumIndices == 3)
        {
        indices->push_back(face->mIndices[0]);
        indices->push_back(face->mIndices[1]);
        indices->push_back(face->mIndices[2]);
        }
    }

I get the following result:

Instead, if I use the following code:

for(int k = 0; k < 2 ; k++)
    {
        for (unsigned int t = 0; t < mesh->mNumFaces; ++t)
        {
            const struct aiFace * face = &mesh->mFaces[t];
            if (face->mNumIndices == 3)
            {
            indices->push_back(face->mIndices[0]);
            indices->push_back(face->mIndices[1]);
            indices->push_back(face->mIndices[2]);
            }
        }
    }

I get the correct result:

Hence adding the indices twice, renders the correct result?

The OpenGL buffer is populated, like so:

glBufferData(GL_ELEMENT_ARRAY_BUFFER,
             indices->size() * sizeof(unsigned int),
             indices->data(),
             GL_STATIC_DRAW);

And rendered as follows:

glDrawElements(GL_TRIANGLES,
               vertexCount*3,
               GL_UNSIGNED_INT,
               indices->data());

sentences:
Dynamic character in UE4 I've been creating simple characters in Blender for a while, and now I want to add dynamic details to them. I managed to make a cloak with using UE4 cloth physics.

However I have trouble with smaller things. As english isn't my primary language, I don't even know how to name this issue properly. Example of things I want to achieve:

Simple polygon ponytail that bounces while running
Edges of clothes, like shorts are loose and also move while running
Accessories like bracelets or dangling keys on wrists / hanging from clothes which also move a bit while walking

Is this something I do in Blender and export, or is it something I add in Unreal?
What should I look for?

EDIT:
So far I found this thanks to a comment:
https://docs.unrealengine.com/en-US/Engine/Animation/NodeReference/SkeletalControls/AnimDynamics/index.html

But if anyone else has suggestions, please keep them coming.

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:
Why the Render texture is not working when trying to preview a camera on a object? In the editor in Assets right click Create > Render Texture
Then changed the Render Texture name to: SecurityCameraTexture

Dimension 2D size 480 x 256

Then created a new material Assets right click Create > Material
Then changed the material name to: SecurityFootage

Then changed the material shader from Standard to Mobile/Diffuse

Then dragged the render texture(SecurityCameraTexture) to the top right image place of the SecurityFootage(material)

Next I have a tv object in the scene.
In the tv screen I dragged the new material:

The SecurityCamera. On the SecurityCamera I attached the script that rotate the camera from side to side:

And the script:

using UnityEngine;
using System.Collections;

public class scr_camera : MonoBehaviour {

    public float rotate_amount;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        transform.rotation = Quaternion.Euler(transform.eulerAngles.x, (Mathf.Sin(Time.realtimeSinceStartup) * rotate_amount) + transform.eulerAngles.y, transform.eulerAngles.z);
    }
}

Last step I did was to drag the render texture(SecurityCameraTexture) to the camera Target Texture.

When running the game and watching the tv I don't see the camera preview in the tv. It should the show the camera preview the camera moving from side to side and what the camera is showing.

The camera preview was working fine before I started working with the render texture. But it's not showing the preview in the tv.

sentences:
Shadow mapping with directional light? I'm doing shadow mapping in my OpenGL 4.3 deferred renderer, and I'm starting with directional lights believing it to be the easiest.

What I do not understand is how the view projection matrix is to be constructed for the shadow mapping depth pass. I mean, all I have is the lights direction, and it affects the entire scene - so how do I construct the view matrix from only the direction, and what of the projection matrix?

Thanks

sentences:
Simple thruster like behaviour when rotating sprite I'm prototyping some 2D game concepts with XNA and have added some basic keyboard inputs to control a triangle sprite.

When I press key up the sprite accelerates in it's current facing direction, when I release the key it brakes down.

For rotation, when I press left/right keys I rotate the sprite.

Currently the sprite immedately changes direction when I rotate it. What I want is for it to keep moving in the same direction when I rotate, until I hit key up, adding thrust in whatever direction the sprite is pointing at.

This would simulate thrusters on a classic space shooter like Asteroids.

I'm adding an image to describe the behaviour I'm after and some code samples of how I'm doing things at the moment.

This is my player struct, holding information of the sprite.

    public struct PlayerData
    {
        public Vector2 Position;  // where to draw the sprite
        public Vector2 Direction; // travel direction of sprite

        public float Angle;       // rotation of sprite

        public float Velocity;
        public float Acceleration;
        public float Decelleration;
        public float RotationAcceleration;
        public float RotationDecceleration;

        public float TopSpeed;
        public float Scale;
    }

This is how I'm currently handling thrusting / braking (when pressing/releasing key up) (simplified, removed some bounds checking etc):

player.Velocity += player.Acceleration * 0.1f;
player.Velocity -= player.Acceleration * 0.1f;

And when I rotate the sprite left and right:

player.Angle -= player.RotationAcceleration * 0.1f;
player.Angle += player.RotationAcceleration * 0.1f;

This runs in the update loop, keeps the direction updated and updates the position:

Vector2 up = new Vector2(0f, -1f);
Matrix rotMatrix = Matrix.CreateRotationZ(player.Angle);
player.Direction = Vector2.Transform(up, rotMatrix);

player.Direction *= player.Velocity;

player.Position += player.Direction;

I am following along various beginner tutorials and haven't found any describing this, but I have tried some on my own without success. Do I need to change my velocity and acceleration fields to Vectors instead of floats to accomplish this type of movement? I realise my Angle and the Direction vector is currently tied together and I need to disconnect these somehow to be able to rotate freely without changing the direction of the movement, but I can't quite figure out how to do this while keeping the acceleration/decceleration functional.

Would appreciate an explanation rather than pure code samples.

Thanks,

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:
Problems Animating Texture in OpenGL I'm trying to animate a texture to scroll a static screen for a television, however I'm having some issues.

Just translating within the texture matrix animates all textures in the scene which is obviously a problem. However when trying to push and pop the matrix the texture matrix seems to keep getting reset. So rather than a scrolling texture, the texture just stays at the same translation.

Here's the code snippet.

glMatrixMode(GL_TEXTURE);

glPushMatrix();

glTranslatef(0, 0.03 * dt, 0);

glBindTexture(GL_TEXTURE_2D, staticTexture);

RepeatTexture();

glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glNormal3f(0, 0, 1);
glVertex3f(0.49, 0.205, 0.461);
glTexCoord2f(0, 1);
glNormal3f(0, 0, 1);
glVertex3f(0.49, 1.204, 0.461);
glTexCoord2f(1, 1);
glNormal3f(0, 0, 1);
glVertex3f(-.80, 1.204, 0.461);
glTexCoord2f(1, 0);
glNormal3f(0, 0, 1);
glVertex3f(-.80, 0.205, 0.461);
glEnd();

glPopMatrix();

glMatrixMode(GL_MODELVIEW);

sentences:
Should the networking of my game be a component or a service? I am working on a windows game and I am trying to understand the  XNA GameComponents and GameServices classes and use. From what I understand about a component is that it has an Update method that gets call in every frame, and a service can be referenced from other components if needed.

So the way I think a network component would work is that in its Update method it would receive and send data. It probably makes sense to receive the network data once per frame, but it doesn't for sending it. Shouldn't the game send its own updates to others the moment it has it to cut down on lag?

sentences:
Multiplayer platformer I'm considering building a multiplayer game having a central server handling the game and keep clients updated. I was checking various examples of ".io" games styles of implementation and seems pretty straight forward that the logic is on server and clients are mostly dummy.

Now the question that I have is .. how dummy should be the client? Where do you draw the line?

To give more context, I was thinking of building a platformer with 2 players on it, a few obstacles on the way etc.

What is clear for me is:

any input the characters receive needs to be sent to the server and updated the other client.
any map event logic will stay on the server and update clients when happening

What is not clear for me is:

where do you place basic physics? like keeping the character on the map
how about a simple movement like Jumping? should it be like a state sent to the server?
what about the whole map? should the server know the entire map?
what if I want to destroy one tile of the map?

I would appreciate your point of view or if you know some examples / links where I can find more info about these things.

Cheers!

sentences:
Framerate independence I'm building a physics engine in OpenGL, and I'm a little bit confused on how framerate independence is achieved.

At the moment I'm using glutTimerFunc to cap the framerate at 30 FPS. Is there a way to do this without capping it but not have my objects running around like crazy when I run the application at a higher framerate?

I'm thinking that I need some sort of measure of distance relative to the rendering speed. Are there any articles/tutorials you may know that would help me out?

sentences:
Creating Dynamic Weapons in Unreal Engine? Back Story: Learning Unreal Engine 4 from scratch, I am making a fantasy Darksouls-ish Game.

I am Having trouble understanding Creating a weapon and allowing the character to hold it with added Functions.
For example, I want to have a working torch, lights, flame, stick, to appear in his hand at the press of a button.

I do not know if I am going about this in the correct way, but this is what I did:

Created a Static Mesh (Torch Stick)
Added The Flame and Light Source to it (Emitter & Point Light)
Put the Emitter and Point Light into the Torch Tree
Created a Socket in "Persona" in the left hand

At this point I got stuck, because the third person Blueprint. Doesn't Register my amateur Torch as an "Asset".

I watched some "Equipping Weapon tutorials" But the problem is they don't explain where their weapons came from Ex (Rifle), or if they are dynamic  (Lights or laser sights)

How am I supposed to go about this? Thanks

sentences:
How does my program know which variables to link to the shader? I am using DirectX and C++. I never understood how my VertexDeclaration knew what variables were the UV map and which were linked to the position. I have in my shader Position : POSITION and Texture : TEXCOORD1

In my variables for vertex format I have int X, Y, Z, U, V.

In my declaration I have

    D3DVERTEXELEMENT9 Decl[] =
    {
        {
            0,
            0,
            D3DDECLTYPE_FLOAT3,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_POSITION,
            0
        },
        {
            0,
            0,
            D3DDECLTYPE_FLOAT2,
            D3DDECLMETHOD_DEFAULT,
            D3DDECLUSAGE_TEXCOORD,
            0
        },
      D3DDECL_END()
   };

My FVF is D3DFVF_XYZ | D3DFVF_TEX1

How does it know to link X, Y, Z with position? and U, V with the first texcoord? What would the variables for the second texcoord be? Is there some pattern?

sentences:
Get component that has specified method by Reflection API Let's say that I have a component like this:

public class MyComponent: MonoBehaviour {
    public void MyMethod(int param1, int param2) {
        Debug.Log(param1 + " " + param2);
    }
}

And I have a string variable that has method name from that class.

string methodName = "MyMethod";

I need to invoke MyComponent.MyMethod with reflection api, however I don't know how to distinguish component that has "MyMethod".

MonoBehaviour[] scripts = target.GetComponents<MonoBehaviour>();

// Find the component that has method
for(int j = 0; j < scripts.Length; j++) {
    ... ??? ...
}

methodInfo.Invoke(target.gameObject, parameters);
hasFound = true;

If I just invoke with gameObject, of course it fails. So I have to get the component to use Invoke. In this case, how do I get the component that has specified method by Reflection?

sentences: concerns about android apk compatibility Hi everyone =) i'm planning on making a game on Unity, the idea is that my friends could play the game, as mostly of them do not own a computer, it should be developed for android. Two of my biggest concerns are about the compatibility (we all have different versions of android) and about the final APK size. That being said, I don't have plans for it to be on play store (I know google does a thing that split one big apk into multiple APK that solve the compatibility/APK size issue). So the questions are: if i built it to be compatible with an older versions of android (android 6.0 as an example) will it be compatible with newer versions of it?

sentences:
OpenGL 2.1 rotation , Gimball lock I'm working on a little app for a school project , which should be manipulating 3D objects. And i'm stuck with the rotation , as i'm facing what i think is called the gimball lock ?
here's a video I uploaded that clarifies my problem :
https://youtu.be/MT8nTAkvD6k

Now , from what I have understood , multiple rotations change the orientation of the object , but keep the X , Y , Z axis fixed , is that it ? Without knowing a lot about openGL , i thought that some projections like these would be enough :
say Alpha is the angle following the rotation around X; The new Y and Z (let's Call them Y' and Z')axis would have this equation :

Y'=cos(Alpha)Y+sin(Alpha)Z

Z'=-sin(Alpha)Y+cos(Alpha)z

Based on this , i wrote this code (this method displays the teapot)

void Teapot::PrintObj()
{
        glLoadName(_NameStack);
        glPushMatrix();
        Translated();
        RotatedX();
        RotatedY();
        RotatedZ();

glColor3ub(_Color.red,_Color.green,_Color.blue);
glutSolidTeapot(2);

if(_Selected){WiredTeapot();Guizmo();}

        glPopMatrix();
};

Now this is the RotatedX method :

void Object3D::RotatedX()
{
rotY.x=0;
rotY.y=cos((angles.x/180.0f)*3.141592);
rotY.z=sin((angles.x/180.0f)*3.141592);

rotZ.x=0;
rotZ.y=-sin((angles.x/180.0f)*3.141592);
rotZ.z=cos((angles.x/180.0f)*3.141592);

glRotated(angles.x,rotX.x,rotX.y,rotX.z);
}

all the variables are declared within the class : the rotX , rotY and rotZ are the 3 vector axis , every time the object undergoes a rotation , these axis are modified;

The RotatedY method now :

void Object3D::RotatedY()
{
rotX.x=cos((angles.y/180.0f)*3.141592);
rotX.y=0;
rotX.z=-sin((angles.y/180.0f)*3.141592);

rotZ.x=sin((angles.y/180.0f)*3.141592);
rotZ.y=0;
rotZ.z=cos((angles.y/180.0f)*3.141592);
glRotated(angles.y,rotY.x,rotY.y,rotY.z);
}

Same thing , if this method is called it means that the object is rotated around the Y axis , hence the modification of the X and Z axis position.

and now the RotatedZ :

void Object3D::RotatedZ()
{
rotX.x=cos((angles.z/180.0f)*3.141592);
rotX.y=sin((angles.z/180.0f)*3.141592);
rotX.z=0;

rotY.x=-sin((angles.z/180.0f)*3.141592);
rotY.y=cos((angles.z/180.0f)*3.141592);
rotY.z=0;
glRotated(angles.z,rotZ.x,rotZ.y,rotZ.z);

I'm really struggling to make this work ; I've looked on the net and saw things like Quaternions (i don't even know what that is).

Thanks for helping me !

sentences:
Improving the monster tamer battle mechanics: 2 choices I'm developing a new monster taming/hunting game and I wanted to make some changes to the battle mechanics.  Which would you find more fun and can you offer any suggestions to improve on what I've done.  I'm leaning more to just option 2 although it will be a bit more difficult to deal with the AI.

Current base for the mechanics:

2 monsters face off head to head
They use different moves to damage
each other trying to kill the other.
Various non damaging moves can
be used to (increase/decrease stats, cause poison, paralyzing
effects)
There are different types of attacks that can be resisted or
more effective against certain types of monsters (eg. Holy attacks do
extra damage to Demons).

Basically, I'm starting with the simple Pokemon style battle.  I would like to add either one or both of these changes:

Option 1: Add in a recovery stat for moves so that the "turns" are based on how much the monster has to recover.  When a monster uses a move, the move's recovery stat is added to the monster's. When a monster's recovery stat reaches 0 it can perform a move.
     Explode - A high damaging move requires 50 recovery after being used.
     Poke - A smaller damaging move requires 20 recovery after being used.
     (Both start at 0 recovery, A goes first just because)

Monster A uses Explode (its recovery is at 50)
Monster B uses Poke (its recovery is at 20)
a check is done to see which has lower recovery and they go next
   (20 "time units" goes by and A now has 30 recovery, B is down to 0 and can perform a move again.
Monster B uses Poke again (recovery at 20) (A is still at 30)
Another 20 "time units" goes by and A is at 10 and B is at 0 again.
Monster B can attack again

This adds a timing element to the battle.  Instead of each monster being able to attack once a turn, you can use smaller attacks or status changing moves quickly before your opponent recovers from their attack.  Status effects may cause a monster to require more recovery each turn (like a slowing effect) or a hasting effect could be applied.

Option 2:  Use 2 monsters in the same battle with a forward and rear position.  Moves have a range value that determines if you can hit the forward, rear, or both monsters.

I think generally, melee style attacks would be higher damage but only affect the forward monster.  You would often want a tank (high defense) monster to take these hits with a ranged attacker in the rear position like an archer or mage.  Certain moves could damage both positions and you could have the option of having the monsters switch positions.

I think the strategy wouldn't be limited to a melee tank in the front with ranged in the back, as a melee tank may be susceptible to special attacks and certain monsters would do more damage in the front while being vulnerable to attack.

Example moves that take advantage of this mechanic:

Intercept - forward monster takes the next attack aimed at the rear position.
Force switch - forces the opponent monsters to switch positions
Pierce - 1/2 damage is done to the rear position if an attack on the front is successful.
Dragon's breath - all monsters (including your forward position if you are the rear) in front of you are hit with fire damage. (this would be a good move to switch your positions prior to using)
Goblin Mortar - fires 3 spaces away (requires the attacker to be in the rear to hit the rear opponent)

sentences:
Ruby: implementing alpha-beta pruning for tic-tac-toe So, alpha-beta pruning seems to be the most efficient algorithm out there aside from hard coding (for tic tac toe). However, I'm having problems converting the algorithm from the C++ example given in the link: http://www.webkinesia.com/games/gametree.php

Players are either 1 or 0, so doing 1 - player will switch the player

  WIN = 1
    LOSS = -1
    DRAW = 0
    INFINITY = 100
    def calculate_ai_next_move
        best_move = -1
        best_score = -INFINITY

        cur_player = COMPUTER
        self.remaining_moves.each do |move|
          self.make_move_with_index(move, cur_player)
          score = -self.alphabeta(-INFINITY,INFINITY, 1 - cur_player)
          self.undo_move(move)

          if score > best_score
            best_score = score
            best_move = move
          end
        end

        return best_move
    end

    def alphabeta(alpha, beta, player)
      best_score = -INFINITY
      if not self.has_available_moves?
        return WIN if self.has_this_player_won?(player) == player
        return LOSS if self.has_this_player_won?(1 - player) == 1 - player
      else
        self.remaining_moves.each do |move|
          break if alpha > beta

          self.make_move_with_index(move, player)
          move_score = -alphabeta(-alpha, -beta, 1 - player)
          self.undo_move(move)

          if move_score > alpha
            alpha = move_score
            next_move = move
          end
          best_score = alpha
        end
      end
      return best_score
    end

currently, the algorithm is playing terribly. It will initially pick the last space, and then choose the first (from left to right) available space after that.

Any idea with whats wrong with it?

Also, I've been doing TDD, so I know that self.has_this_player_won?, self.undo_move and self.remaining_moves is correct.

sentences:
Child object free movement on Parent object Just to be straightforward, I am completely new to many aspects of coding and am searching for different specs and guidelines to aid me on my journey to crafting a wonderful game in Epic Games' Unreal Engine 4.

Okay, I know upon viewing this, some may have little to no clue what I mean, so I'll put it like this to explain what I mean :

Imagine a third person game with a simple model of a character. Now, say I have an object as a torso of a character in a game. Now Say I have an object as a head of the character. How could I keep the head as a child of the torso, but at the same time, allow it to move with the camera angle.

sentences:
Generate random point inside Perlin noise? I’m working on terrain generation for a game of mine and has run into a slight problem. The terrain itself within the game procedurally generates as your character moves around. This means that all the world generation needs to somehow be based off of the position a certain tile—or region (chunk)—has in the world.

The world generation is rock solid so far and looks quite gorgeous! But I require one more component to make it complete—I need to somehow retrieve a random point within a piece of Perlin noise.

Let’s assume we had something like this:

int scale = 100;
float noise = perlinNoise.noise3(x / scale, y / scale, z / scale)

if(noise > .2f)
    setPixel(x, y, 0xffffff);

We’re drawing the result to the screen in form of pixels to try and see what happens. This way, we achieve regularly spaced out areas of noise. Now, what I would like to do is randomly generate one point located somewhere within a chunk of noise following the above “schematic”.

The above might look something along the lines of this:

xxxxxxxxxxxxx
xxxxxxxxxxxxx
xxxxxoooxxxxx
xxxxoooooxxxx
xxxxxoopooxxx
xxxooooooxxxx
xxxxxoooxxxxx
xxxxxxxxxxxxx

Where the x’s are what is not affected by the perlin noise in the above code example and o’s are affected—the o’s are plotted out on the screen by it—they’re the white pixels in the above example.

The little p as opposed to from the o’s and x’s, is the random point I’d like to have randomized inside every chunk of randomized Perlin noise, without having to pre-generate the world.

Is there a way in which this can be achieved? I’ve wrapped my mind inside out thinking of potential solutions—I’ve searched the web, but as though in vain. There appears to be nothing written on the subject.

sentences:
How can I procedurally render irregularly shaped health bars? The issue of the traditional rectangular or heart-based health bar is something well-understood and easily solved. But what is the accepted solution for more "creatively-shaped" health bars, like the mockup I've made below?

The obvious way to do this would be to have "in-between" sprites, so the third image would be its own sprite, along with many other transitions for different levels of health. But that seems really inelegant and the number of in-betweens needed to create a smooth transition between health states would be large.

The only other idea I can come up with is to overlay the "full health" sprite on top of the "empty health" sprite and pre-bake sets of pixel coordinates to represent each tick of health and then make them opaque or transparent as health goes up or down.

I intend this question to be language and platform agnostic but feel free to provide a concrete sample in any language/library/framework if it helps the answer.

sentences:
User vs Player Model A lot of the online games out there have this concept of "User" or "Profile", and the concept of "Player". The "User" has username, password, lifetime stats, ... etc. The player concept is per game basis, and holds volatile information around the currently played match. That's how I picture it, at least.

I am puzzled about how is that usually implemented? Does the player class hold a pointer to the User object, or does it inherit from user? or maybe something else?

I can't completely decouple the two, since during the match, I need to send messages back and forth between "user" and "player" (e.g. update achievements)

sentences: Alternative Font loaders in Monogame Framework While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer/sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?

sentences:
C++ MMO: Best approach to store creatures in a multi-level world map for the purpose to find spectators I'm developing a game which is a multi-level game, my game can have a maximum of 15 floors, and a fixed amount of tiles width/height.

Each tile in the map can have a creature. All fine until here;
I need to find spectators within a range / radius of the map, and sometimes within specified floor ranges, this can happen multiple times per second (players interacting with the world)

Currently this is how I search for lets say all spectators in all floors:

for (int floor = 0; floor != 15; floor++)
{
    for (int x = posx - range; x != posx + range; x++)
    {
        for (int y = posy - range; y != posy + range; y++)
        {
            Tile* ....
            Spectators.Add(Tile->GetCreature());
        }
    }
}

As you can tell, this isn't the best approach, I've thought about using a hash / chain of creatures on which each hash entry points to a X-Y coordinate in the world map, this would take a lot of trouble to worry about floors, and it's also more performance-friendly.

How can I achieve this?

sentences:
How to calculate the Screen Position of a bounding sphere/box? Synopsis:  What I have is an object rendered on the screen.  I need to calculate the top-left / bottom-right of it's location on the screen in Screen Coordinates.

Explanation:  The object is basically a box that I'm trying to draw sprite textures into at specific locations, but due to the screen resolution being a variable (dependent on player settings), I can't hard-code in these translations.  So what I need to do is find out what the bounding box of the object is in Screen-Coordinates.  Once I know the bounding box, I can calculate the offsets to the positions within it.

I can calculate the center position of the box already with a function I scavenged:

public Vector2 GetScreenPoint(Matrix objMatrix)
{
    Matrix mat = objMatrix * mCamera.mViewMatrix * mCamera.mProjMatrix;
    Vector4 v4 = Vector4.Transform(new Vector3(0, 0, 0), mat);
    return new Vector2((int)((v4.X / v4.W + 1) *
        (pGame.GraphicsDevice.PresentationParameters.BackBufferWidth / 2)),
        (int)((1 - v4.Y / v4.W) *
        (pGame.GraphicsDevice.PresentationParameters.BackBufferHeight / 2)));
}

But now I need to go from that to the actual extents of the bounding box.  I've tried converting the BoundingSphere of the model into a BoundingBox and then translating the object matrix by the BoundingBox.Min values, but I'm nowhere near the left side of the object.

Am I going about this backwards, or what am I not seeing?  This would seem a simple enough thing to do, but I just can't figure it out.  Or is there a complete different way I should be approaching this?

sentences: How can I use a bounding sphere for intersection? How can I use a bounding sphere for intersection, like on a statue? Would I use the radius to detect intersection?

sentences:
Deactivate current object in array and activate next one by using button click? How to deactivate current object in array and activate next one by using button click?

public GameObject[] gameObjects;
private int numOfgameObjects;

void Start()
{

  //current object
  gameObjects[0].SetActive(true);

  int numOfgameObjects = gameObjects.Length;

  for (int i = 0; i < numOfgameObjects ; i++)
  {
      gameObjects[i].SetActive(false);
  }

}

public void NextPrefab_ButtonClick()
{
  // Some Code to deactivate current object and activate next one
}

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: Different types of memories which a graphics card has I've been googling this around and yet nothing showed up but some articles from middle ages which were talking about Gforce mx and ... . My question is just this: what are the different memories in a high-end graphics card and what is their size and usage?

sentences:
Unity 2D Player Shoots at my joystick position Hi I am new to unity and have only a little coding knowledge.
Right now I have made my character shoot at my touch position on mobile but when ever I touch the joystick, whick I use to move my character, he shoots there, what should I do to make him not shoot at the joystick when i hold the joystick, any suggestion... heres my code.
Shooting code
public class Shooting : MonoBehaviour
{
    public GameObject shot;
    private Transform playerPos;

    void Start()
    {
        playerPos = GetComponent<Transform>();
    }
    void Update()
    {

            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
             Instantiate(shot, playerPos.position, Quaternion.identity);
            }
            else if (Input.GetTouch(1).phase == TouchPhase.Began)
            {
                Instantiate(shot, playerPos.position, Quaternion.identity);
            }
        else if (Input.GetTouch(2).phase == TouchPhase.Began)
        {
            Instantiate(shot, playerPos.position, Quaternion.identity);
        }

    }
}

Projectile Code
public class Projectile : MonoBehaviour
{
    private Vector2 target;
    public float speed;
    private Shake shake;
    void Start()
    {
        shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent<Shake>();
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(1).position);
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(2).position);
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = Vector2.MoveTowards(transform.position, target, speed * Time.deltaTime);

        if(Vector2.Distance(transform.position, target) < 0.2f)
        {
            Destroy(gameObject);
        }

    }
    void OnTriggerEnter2D(Collider2D other)
    {
        shake.CamShake();
    }
}

Thanks in advance

sentences: Pixmaps, ByteBuffers, and Textures....Oh my My ultimate goal is to take a specific region of the screen, and redraw it somewhere else. For example, take a square from the upper left hand corner of the screen and redraw it on the lower right hand corner, so that it is basically a copy of that screen section; kind of like a minimap, but at the same scale as the original. I have looked in to pixmaps and bytebuffers. Also maybe copying that region from the backbuffer somehow. Wondering the best way to go about this. Any help is appreciated. I am using opengl es and libgdx for what it's worth.

sentences:
Finding the closest point on a concave mesh (Unity C#) One of my game systems requires that I find the closest point on a generalized mesh, which more often than not will be concave. This prevents me from just using Unity's built in ClosestPoint function, and all other alternatives have some other caveat which prevents me from using them so far.

The meshes are dynamically generated, pretty complex, and altered often, so it would be computationally unreasonable to split it into multiple convex meshes, unless there's some way I don't know about which allows fast splitting/reattachment of said meshes.

I considered checking a sphere around the point, and increasing the size of that sphere until I get a collision, but OverlapSphere and CheckSphere don't give any means to check the point of collision, only to check whether there was a collision at all.

Continuing with that train of thought, I tried a Spherecast with the same method and the maximum distance set to zero, but that didn't work either. Spherecasts don't detect any objects which are inside of the starting sphere location, so setting the distance to zero will result in no collision every time.

As a workaround to that, I tried setting the distance to a small positive number, equal to the step size which the Spherecast increases by each pass (in my case, 0.2). This almost works, but causes the cast to only detect collision points if I have a general direction to give it. There are two ways I tried to resolve this:

The first is by just passing in the direction from the point towards the center of the mesh I am trying to find collisions with, and although this works for a sphere, it breaks down for most of my other test cases, and just in a lot of different scenarios (Very concave polyhedra and shapes such as torii being two examples of situations where this method does not work.)

The second method I tried was to just take the direction to the closest point on the last frame, and pass that into the Spherecast. Again, works in some situations, but breaks down on large dihedral angles. Neither of these are really sufficient for what I need them for.

In terms of the constraints which I have to work under, the point should always be on the outside of the mesh, and the point should never be too far away from the mesh, but other than that there isn't really much else I can guarantee. Both the shape and the topology of the mesh are subject to change over time.

Any help would be greatly appreciated, thanks in advance!

sentences:
Change color of bitmap I am attempting to understand the easeljs ColorFilter and its use with cache.  There is quite a bit of information at the easeljs site but it's not clear based upon the examples and documentation.

Draws the display object into a new canvas, which is then used for subsequent draws.

cache (x, y, width, height, [scale=1])

For example if you defined a Shape that drew a circle at 0, 0 with a radius of 25:

var shape = new createjs.Shape();
shape.graphics.beginFill("#ff0000").drawCircle(0, 0, 25);
myShape.cache(-25, -25, 50, 50);

Using that example I loaded an image/bitmap ("ball") and am trying to apply a transformation to change the color.

ball.filters = [
    new createjs.ColorFilter(0,0,0,1, r(255),r(255),r(255),0)
];

ball.cache(-50, -50, ballImage.width, ballImage.height);

You can see from the before and after images below the results I've generated.

The documentation states that the new cache object is written into another canvas "off screen" but the transformation appears to only be applied where the cache overlaps the image.  The image below represents my understanding of this.

Can someone clarify how the ColorFilter and cache are to be used?  Ultimately I'm only trying to apply a color change to a bitmap.

sentences:
How do I animate a tilemap in Flixel? I am trying to animate a tilemap using Flixel 2.55. I found this code that apparently enables the use of sprites as tiles.

To my understanding, this loops over the tilemap's graphic and replaces the tile's pixels with the sprite's pixels each time they change. I have implemented the class and it's working, but not completely; the tiles get replaced, but do not animate unless the camera moves. Here's is the relevant part from LevelLoader.as, which only instantiates the AnimatedTilemaps (piece of code from forum) and pushes sprites into an array:

// AnimatedTile is just an extended FlxSprite
private var _waterTop1:AnimatedTile;

// Create ground tilemap
_groundTilemap = new AnimatedTilemap();
_groundTilemap.loadMap(_rawXML.Ground, Assets.OverworldGround, 8, 8);
FlxG.state.add(_groundTilemap);

_waterTop1 = new AnimatedTile(8, 8, Assets.WaterTop, 100);
// .Animate only adds and plays an animation, with a startAtFrame param.
_waterTop1.Animate('run', [0...47], 10, true, 0);

It seems as though the sprites are updating. I tried tracing the update()s, and they are running for both the sprites and the tilemap. The sprites are even changing frames. Using only AnimatedTiles and hard-placing them (giving a x and y) works and animates. What troubles me is that they only update when the camera moves.

I've been stuck on this for a week now. I am also open to other solutions for animating tilemap tiles.

sentences:
What is a fragment in 3D graphics programming? What is a fragment in a fragment shader? Wikipedia says that:

  In general, a fragment can be thought of as the data needed to shade the pixel, plus the data needed to test whether the fragment survives to become a pixel (depth, alpha, stencil, scissor, window ID, etc.)

So is it textures, vertices or something else?

sentences:
How do I run my XBOX XNA game without a network connection? I need to demo my XBOX XNA game in college. The college doesn't allow this type of device to connect to the network. I deployed my game to the Xbox and it is sitting in the games list along with my other games. It runs fine with a network connection but when its offline it comes up with an error message saying its needs a connection to run the game.

This makes no sense, the game is deployed on the Xbox memory, it must be some security policy or something!

Is there any way around this? The demo is on monday!

sentences:
share assets beetween platforms What is the good way to share assets between platforms (android, desktop, etc) ?

by default there is an assets folder in each platform folder.

sentences:
Box-box contact information I have two colliding boxes, How i can calculate contact information like (contact normal, contact point and penetration) .

Is there any simple algorithm .

Note: i'm using XNA .

sentences:
Multiplayer Synchronization I am developing multiplayer game in unity. For multiplayer i am using photon networking library. I created room and join client successfully.

But Problem is I am doing gameobject movent by this code:

public GameObject player;
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

DoMoveis library here.

Problem is player movement is not synchronized.

For Synchronization I add photonview component to player gameobject.

And i call coroutine though RPC like this.

player.GetComponent<PhotonView>().RPC ("Moving", PhotonTargets.All, "temp");

Accordingly i changed coroutine like this:

[PunRPC]
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

I got this error

Illegal view ID:0 method: Moving GO:player
UnityEngine.Debug:LogError(Object)

sentences:
1D vs 2D vs 3D texture performance I'm working on a 3D game with large blocky untextured, but individually colored, voxels (similar to CubeWorld). For rendering, right now I naively convert online all visible faces ahead of time to triangles with the color information stored in the vertex attributes. The screenshot below is an example of what I'm currently doing. There's a lot of room to improve here and I want to switch to a system that uses fewer vertices and stores color information in a texture.

What I'd like to do is combine adjacent triangles with the same normals and simplify the mesh so I'm left with a fraction of the vertices. My big hangup is color information. It's easy to add UVs, but the correct choice for texturing isn't obvious. I'm trying to figure out the relative performance of these options:

Use a 1D texture. This is compact but I'm concerned that large 1D textures won't play nicely with texture mapping units optimized for 2D textures.
Use a 2D texture. Simple, but it'll end up with gaps.
Use a 3D texture with the full set of voxels.

Does anyone have insight as to the relative performance of these options? No mipmapping or other filtering is needed here, so all three options should be viable.

For reference I'm making this in C++ using OpenGL on Windows. My target GPU architectures are GTX 780 Ti and higher or AMD equivalent.

sentences:
Is there any reason not to make all my components a single class? What would be the downside to using a generic all-encompassing Component class versus specific classes (PositionComponent, InputComponent, et cetera) for each component in an entity/component system?

By 'generic' I mean:

class Component {
  String name; // component name, like "position"
  Map<Key, Object> attribs; // Attributes like "x" and "y" stored here.
}

Where a 'specific' component might be:

class PositionComponent {
  int x, y;
}

I feel like creating a separate class for each component means tons of 3-5 line classes in my code-base.

sentences:
Unity and Chartboost loading problems I implemented chartboost in my ios game and locally it wors great.

I can receive ads.

Now my game is online but in the google analytics I get only error messages from
the game, meaning the chartboost ads fail to load.

Here:
https://www.dropbox.com/s/cft98lk27mt7p3s/cb.jpg?dl=0

The iage show google analytics registering only failed loads and
there is no single successfull ad load?

What could be the problem here?

sentences:
Is it possible to somehow change the collider points to match sprites during the animation in Unity? Is it possible to somehow change the collider points to match sprites during the animation in Unity?
I am using the Unity built in animtion recording feature. I would like to change the points of some of my colliders as animation goes, while at the same time I am changing the respective sprites. I was not able to find any solutions so far.
Any ideas how I could do that?
I have a few attempts to overcome the problem.

Create a few game objects with the different preset points for the colliders. The solution will work. But it is crazy hard to develop and maintain resources wise. I will have to spend an immense amount of time creating a separate game object with a collider for each frame. And also the maintenance will be very lame. Because I will need to add a wrapper around all the places where I access collider. So that the wrapper would return the currently enabled collider.

I can buy the 2DColliderGen. But I do not want to spend money on that. And also it is not completely what I am looking for, because even with it I will have significant difficulties developing my animations, maintaining my game and extending it.

sentences:
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:
Inverse Explosion with Unity2d I am currently trying to make all other objects push away from the player when the player explodes. It currently works, but it pushes close objects a little and far objects very far. What I want is for close objects to get pushed back more than far objects.
Here is the current code:

function explode () {
var all_rigidbodies = FindObjectsOfType(Rigidbody2D);

for (var r : Rigidbody2D in all_rigidbodies) {
    if (Vector2.Distance(r.transform.position, transform.position) < 6 && r.tag != "Player") {
        var px : float = r.transform.position.x - transform.position.x;
        var py : float = r.transform.position.y - transform.position.y;

        r.AddForce((Vector2(px, py) * 200), ForceMode2D.Force);
    }
}

Any ideas on how to inverse the vector or force, or better ways to achieve 2D explosions?

EDIT: Ended up just normalizing force so its all the same knockback

sentences:
Non-GPU Noise for 2D side-view terrain generation? I really couldn't find a correct answer while scowering all the forums for Noise Generation.

My goal is simple, I really want to have two distinct layers for my terrain, a white layer representing air, and a black layer representing earth. An algorithm will pick up from there.

Most noise I found generated "Cloudy" textures, where I am looking for something along the lines of:

So far I have worked with Perlin Noise but adjusting my values yields no useful results.

Does anyone have any ideas?

sentences:
HDRP Decals, how to fix streching decals Is there a quick way to fix strenched decals when they don't quite perpend. to the normals in it's entirety?

What I do now is to get the normal of the surface and rotate decal accordingly, but with extreme angled corners it gets streched as a result.

sentences:
Drawing an arrow using the LineRenderer in unity I'm trying to draw an arrow using a LineRenderer in Unity, using the code suggested here.

Based on the UI it all seems good, yet it draws a pin needle, rather than the arrow I would expect from the UI. If I understand the UI right, it should thicken 60% into the line and then become thinner again towards the end.

Any idea what might be going wrong?

sentences:
Fading previous frame doesn't fade all the way to black? I'm working on a 2D OpenGL program. It'll be a fairly simple fireworks visual.

So far what I have is that I draw a circle with a gradient "glow" to it and move it around on the screen. I want it to have a tail behind it as it moves so instead of calling glClear between each frame, I'm drawing a black quad over the whole screen with transparency in hopes of darkening the previous frame before drawing the next frame. I've got a decent tail on it but I've noticed the tail doesn't completely blend to black.

Currently the red glow moves up the screen and when it goes off the top it instantly moves back down to the bottom to make another pass. You can see that there's a "shadow" of where the ball has been before and it never gets darker.

I have a feeling it has something to do with the blend function. Here's what I currently have:

gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)

I'm using go-gl but it is equivalent to

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

Here's the shader that draws the circle and the quad:

#version 430 core

layout(location = 0) out vec4 color;
uniform float radius;
uniform vec2 center;
uniform float windowHeight;
uniform vec4 in_color;
uniform int gradient;

void main()
{
  if (gradient == 1) {
    vec2 correctedCenter = vec2(center.x, windowHeight - center.y);
    vec2 p = (gl_FragCoord.xy - correctedCenter) / radius;
    float r = sqrt(dot(p, p));

    if (r < 1.0) {
      color = mix(in_color, vec4(0, 0, 0, 0), r);
    } else {
      color = vec4(0, 0, 0, 0);
    }
  } else {
    color = in_color;
  }
}

For the circle I use gradient = 1 but for the quad I use 0.

sentences: What is the point in using API such as Open GL or DirectX when there are game engines? I was wondering why  today programmers place so much emphasis on API like DirectX, and even OpenGl. As far as I know, you'd need thousands of lines of code to make a simple 3D game using one of the aforementioned. But with game engines like Unity, the process is simplified and you can pretty much drag around shapes to create the graphics in lieu of programming it. So what I wanted to know: why is knowing APIs DirectX more preferable than being knowledgeable in Unity, other than the fact that with an API you can code it to be portable on other systems. To me it's like choosing Assembly over a high level language like C. Sure, with assembly I'll really understand what's happening at machine level, but it's take a lot longer to write programs using it and it would be a lot harder to debug.

sentences:
Time Required for Animation to Finish Using a tutorial found on the AppHub, I've been attempted to add controls to a sample sprite sheet. I am able to get all the animations working, but for stuff like punching or stabbing, the animations require a timer to stop them from playing repeatedly. XNA uses a default framerate of 60, but I have the animations running at 10 FPS using the following code:

int punchIndex = walk.GetIndex("obj_Walk000");

punchIndex += (int)(time * animationFPS) % punchFC;
batch.Draw(punch.Texture, position, punch.SourceRectangle(punchIndex), Color.White, rotation, origin, 1.0f, SpriteEffects.FlipHorizontally, 1.0f);
break;

Where animationFPS = 10 and punchFC is 6, which is the number of frames in the animation. Using this data, I have calculated a required time of 0.5 seconds for the animation to complete, but that seems to be incorrect, so I'm looking for someone to show me how to do the math properly.

sentences:
How to improve Batch Rendering to work with 3D skeletal animation data I've implemented a batch rendering technique that is described in detail here: http://www.gamedev.net/page/resources/_/technical/opengl/opengl-batch-rendering-r3900

I'd like to extend it now to support 3D skeletal animation data, but I'm not sure what is the best way to do that so that the bone transformation can happen on the GPU rather than on the CPU.  The Batches as they are defined right now depend on a transform matrix but that means that if I try to render a human, each limb would go into its own Batch, which means I would not get any performance gain by using the BatchManager as described in the article above.

Can someone suggest how to do batch rendering that works with 3D skeletal animation data?

sentences:
How can I get accurate collision resolution on the corners of rectangles? I have a working collision system implemented, and it's based on minimum translation vectors. This works fine in most cases except when the minimum translation vector is not actually in the direction of the collision.

For example:

When a rectangle is on the far edge on any side of another rectangle, a force can be applied, in this example down, the pushes one rectangle into the other, particularly a static object like a wall or a floor. As in the picture, the collision is coming from above, but because it's on the very edge, it translates to the left instead of back up. I've searched for a while to find an approach but everything I can find deals with general corner collisions where my problem is only in this one limited case.

Any suggestions?

sentences:
Unity 2D: Inconsistent jump height in game window Whenever I start the unity editor and play it in the Game windows, sometimes the object can jump higher sometimes it is just small jump. I didn't change any value in my script nor changed it in inspector window.

It usually happens when I restart the unity editor or having my computer shutdown / restart and reopening the project.

Here are the jump code

void jump() {
     if (isInGround) {
         float currentJumpForce = jumpForce * Mathf.Abs(rigidBody.velocity.x) / 3.53f;
         rigidBody.AddForce(Vector2.up * currentJumpForce);
         animator.SetTrigger("isJump");
     }
}

I place the code inside the FixedUpdate method, for what I have read the physics calculation should be inside FixedUpdate right?

private void FixedUpdate() {
    if (Input.GetKeyDown(KeyCode.UpArrow)) {
        jump();
    }
}

I have read many are having similar problem, but it really doesn't answer this question.

UPDATE:

I forget to explain it in the question. The jumpForce is calculated based on the velocity of the gameObject has. I capped the velocity to certain speed based on this code

void accelerate() {
     if (rigidBody.velocity.x <= maxSpeed) {
         rigidBody.AddForce(Vector2.right * acceletateForce);
     }
}

where maxSpeed is a constant. I know this is probably not the accurate way to cap the velocity, or is it? Maybe this is where it gets messed up?

I just kinda assume the velocity is the capped from the camera movement and the 'display' or the movement of the screen. It seems the same to me.

sentences:
Should a 4x game use one class per planet type? I'm try to make a small 4x game for my own educational purposes.

Currently I have interfaces like IStarSystem which contains a list of IPlanets. My next step was to make classes implementing those interfaces. Is it better to make classes like BarrenPlanet, GasPlanet, et cetera or is it better to make a single Planet class and define the different types in a XML file?

sentences:
Decaying velocity for simple ball physics I am writing a little experimental 2D program in Java to understand the basics of physics in games. I read this article on game physics to get me started and want to implement the simple Euler method (it is discouraged in the article, but this is just an experiment). My "Ball" class looks like this:

public class Ball {
    double x, xv, fx; //position, velocity, force
    int xdir = -1;
    double rad = 20;
    double mass = 1;

    public void tick(){
        x = x + (xv*xdir) * STEPTIME;
        xv = xv + (fx/mass) * STEPTIME;
        fx = 0;
    }
//STEPTIME is 0.02

For now, I want to focus on horizontal movement. In the end, I want to be able to drag the mouse in the window and have a bawn spall with force applied to it depending on the distance of the drag.
The tick() function implements the following equations (from the article):

acceleration = force divided by mass
change in velocity = acceleration * delta time
change in position = velocity * delta time

My problem is, that I do not know how to decrease the velocity again. When force is applied in a single frame, velocity will then ben constant. If force is applied continuously, velocity will become infinite.
Since the ball is supposed to return to an idle state after it force has been applied to it in a single frame, the velocity has to decay over time.
If I apply a constant negative velocity (to simulate drag), then velocity will soon be negative and the ball will move in the opposite direction.

What is a good way / best practice to decay the velocity of an object over time ?

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: 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:
Move Player on Mouse click in update loop I'm trying to move my player when clicking the right button on the mouse. The problem is that my player is just standing and "shaking" in the top left corner.

Any idea?

package game;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;

import javax.swing.JLabel;

public class Player {
    private Rectangle playerRec;
    float x, y;
    PlayerJLabel playerJLabel;
    int worldX = 800;
    int worldY = 600;
    int targetX, targetY;

    public Player(int posX, int posY, int size){
        playerRec = new Rectangle(posX, posY, size, size);
        x = posX;
        y = posY;

        playerJLabel = new PlayerJLabel();
        playerJLabel.setBounds(0, 0, 800, 600);

        Game.screen.add(playerJLabel);
    }

    public void update(float timeSinceLastFrame){

        if (Mouse.isMouse(MouseEvent.BUTTON3)) {
            targetX = Mouse.getX();
            targetY = Mouse.getY();
        }

        if ((targetX != 0 && targetX != x) && (targetY != 0 && targetY != y)) {
            float dx = (float) (targetX-x);
            float dy = (float) (targetY-y);

            // normalize
            float length = (float) Math.sqrt(dx*dx+dy*dy);
            dx/=length;
            dy/=length;

            // add speed
            x = dx * timeSinceLastFrame * 300;
            y = dy * timeSinceLastFrame * 300;

            // Move the player
            playerRec.x = (int) x;
            playerRec.y = (int) y;

        }

    }

    private Rectangle getRec(){
        return playerRec;
    }

    public class PlayerJLabel extends JLabel{
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.setColor(Color.RED);
            g.fillRect(getRec().x, getRec().y, getRec().width, getRec().height);
        }
    }

}

Edit: I have a GameState method which calls the player update() method and a repaint() method which repains the whole scene.

GameState update method:

@Override
public void update(float lastFrame) {
    player.update(lastFrame);
}

Game repaint method:

public void repaint() {
            // screen is a JFrame Object
    screen.repaint();
}

Main class

package game;

public class Main {

    public static void main(String[] args) {
        Game game = new Game("Mein erstes Spiel", 800, 600);

        long lastFrame = System.nanoTime();

        while(game.isRunning()) {
            long thisFrame = System.nanoTime();
            float timeSinceLastFrame = ((float)(thisFrame-lastFrame))/100000f;
            lastFrame=thisFrame;

            game.nextState();
            game.update(timeSinceLastFrame);
            game.repaint();
        }

    }

}

Update 2:

I updated my code to:

        // Move the player
        x = playerRec.x += (int) (dx * timeSinceLastFrame * 500);
        y = playerRec.y += (int) (dy * timeSinceLastFrame * 500);

My player is moving, but not at the same speed and not very smooth: http://screencast.com/t/pv5M9Un4QhFR

sentences:
2d camera shaking back and forth I'm trying to create a smooth moving 2d camera but the camera is shaking back and forth 1 pixel.

Player camera rectangle:

public Rectangle recCamPosition(Global global)
{
  return new Rectangle((int)Position.X, (int)Position.Y , 320, 240);
}

Camera rectangle:

public Rectangle recCamera(Global global)
{
  return new Rectangle((int)_pos.X / global.zoom, (int)_pos.Y / global.zoom, 320, 240);
}

The move method:

public void physic(Vector2 position, Player player, GameTime time, Global global)
{
  if(player.recCamPosition(global).X!=recCamera(global).X)
  {
    _pos.X+=(player.Position.X-160-recCamera(global).X)/16;
  }
}

sentences:
Recognize hand drawn shape I want to ask player to replicate a simple shape (triangle, square, star, anything that can be done in single stroke) with mouse or on a touchscreen.

Orientation matters, size does not.
Example:

Can anyone give me directions to what techniques can be used?

sentences:
Directx: HLSL Texture based height map. (Shader 5.0) I'm trying to implement a GPU based height map the simplest (and fastest) way that I know how. I passed a (.png, D3DX11CreateShaderResourceViewFromFile()) texture into the shader, and I'm attempting to sample it for the current pixel value. Seeing a float4, I'm currently assigning a color value from a channel to offset the y value.
Texture2D colorMap : register(t0);
SamplerState colorSampler : register(s0);

...

VOut VShader(float4 position : POSITION, float2 Texture : TEXCOORD0, float3 Normal : NORMAL)
{
    VOut output;

    float4 colors = colorMap.SampleLevel(colorSampler, float4(position.x*0.001, position.z*0.001, 0,0 ),0);
    position.y = colors.x*128;

    output.position = mul(position, WVP);
    output.texture0 = Texture;
    output.normal = Normal;

    return output;
}

The texture is imported correctly, and I've inserted another texture and was able to successfully blend the texture with another texture (through multiplication of values), so I know that the float4 struct contains values of a sort capable of having arithmetic performed on it.
In the Vertex function, attempting to extract the values yields nothing on a grid:

The concept seemed simple enough on paper...

sentences:
How should I load/change/activate scenes? Scenes are confusing the hell out of me and I'm pretty sure they should be simple to understand.

When the game loads, only the current scene has a buildIndex != -1. In order give it a 'real' build index I need to load it by path or name (because there's no build index).

The scenes are ten game scenes, one title scene and one persistent scene (which has the player and the status bar with the score etc.).

Should I load a scene every time I change scene and then load additive afterwards or should I be using Set Active Scene?

All the scenes are ticked in the Build Settings.

I'm looking at the index with this:

private void Start()
{
    var sceneName = "Persistent";
    var sceneBeforeLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneBeforeLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
    SceneManager.LoadScene(sceneName);
    var sceneAfterLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneAfterLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
}

Which outputs:

----------------------------------------------
Scene , BI = -1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:10)
----------------------------------------------
Scene Persistent, BI = 1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:13)
----------------------------------------------

sentences:
How to render rounded shape perfectly? I'm having issues rendering rounded shape figures.
I have a Texture with different images in it and I get this whale figure from it with TextureRegion but the stroke of it looks pixelated.

The original whale image is 357x721 px and the program scalate it up or down depending on the device.

And I use TextureFilter to Nearest but it doesn't solve problem as I thought it would.

Does someone knows a bit about this issue?

    texture = new Texture(Gdx.files.internal("texturepack_nuevo.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);

    pilar = new TextureRegion(texture,591,0,357,721);

    whale_1 = new TextureRegion(texture,0,0,591,323);
    whale_1.flip(false, true);

    whale_2 = new TextureRegion(texture,0,323,591,323);
    whale_2.flip(false, true);

    whale_3 = new TextureRegion(texture,0,646,591,323);
    whale_3.flip(false, true);

    TextureRegion[] whales = {whale_1,whale_2,whale_3};
    whaleAnimation = new Animation(0.15f, whales);
    whaleAnimation.setPlayMode(Animation.PlayMode.LOOP_PINGPONG);

sentences:
Is it possible that elements in the StreamingAssets folder are not read in build? I'm making a 2D game. In my StreamingAssets folder I have a JSON file with some info about inventory items (id, description, rarity, name, is stackable or not) and a png file which contains a pixel map (128x32) of the level I want to load after a first scene (this is from Quill18's tutorial: https://www.youtube.com/watch?v=5RzziXSwSsg , basically a specific color corresponds to a specific prefab. An object reads through all the pixels and then spawns the level). The fact is that I have issues with both these elements when the game is built (everything works perfectly in the game window in Unity): the inventory items don't collide with the player and the level is not loaded.

This is the code that gets the image name

public string levelFileName;
string filePath = Application.dataPath + "/StreamingAssets/" + levelFileName;
byte[] bytes = System.IO.File.ReadAllBytes (filePath);
Texture2D levelMap = new Texture2D (2, 2);
levelMap.LoadImage (bytes);

And the pickable objects basically have a collision detection script and have a specific ID, so that when they collide with the player, the inventory adds in a free slot an image with the specs correspondant to that ID (i.e. ID=1 then it's an health potion, is stackable, it's not rare and so on). Everything else works fine in the game.
Do you think that the issue is linked to the StreamingAssets folder (first time using it) or is it just a coincidence? And also could you help me solve the problem?
Thank you in advance for any kind of help.

Edit: my Player logs:

sentences:
Prevent movement cheating in MP games I have read a lot about movement in multiplayer games, but not so much on preventing cheating.

Let's say a client sends moves packets whenever the player press a movement button, then the server checks if that move is valid (that is, if the player is not colliding with anything).

At the same time, there must be some speed check, like dropping packets if the client is sending too many in a short period of time. But the server has no guarantees whether the packets received were sent at the same time or just received at the same time. Client could include a timestamp, but there are 0 guarantees it was crafted by a malicious client.

In short, how can i validate movement speed?

sentences:
Inverse kinematics behaving weirdly/ I have been trying to figure out why my player character crouches like this when I use inverse kinematics on it. I followed this tutorial:

https://docs.unity3d.com/Manual/InverseKinematics.html?_ga=2.157285243.1916573353.1569208906-694809292.1561053348

but then the weirdness in the picture above happens. What is going on?

In case It helps, I used makehuman to make the player model, and used its "Game Engine" rigging option.

EDIT: Here are some additional pictures after I remade the project:

I left look obj blank because all it does is makes the player's head look a certain direction.

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:
DirectX11 - Color Interpolation Along Quad Diagonal Imagine that we have a vertex structure that looks like this:

struct Vertex
{
    XMFLOAT3 position;
    XMFLOAT4 color;
};

The vertex shader looks like this:

cbuffer MatrixBuffer
{
    matrix world;
    matrix view;
    matrix projection;
};

struct VertexInput
{
    float4 position : POSITION;
    float4 color    : COLOR;
};

struct PixelInput
{
    float4 position : SV_POSITION;
    float4 color    : COLOR;
};

PixelInput main(VertexInput input)
{
    PixelInput output;

    input.position.w = 1.0f;

    output.position = mul(input.position,  world);
    output.position = mul(output.position, view);
    output.position = mul(output.position, projection);

    output.color = input.color;

    return output;
}

And the pixel shader looks like this:

struct PixelInput
{
    float4 position : SV_POSITION;
    float4 color    : COLOR;
};

float4 main(PixelInput input) : SV_TARGET
{
    return input.color;
}

Now let's create a quad consisting of 2 triangles and the vertices A, B, C and D:

// Vertex A.
vertices[0].position = XMFLOAT3(-1.0f,  1.0f,  0.0f);
vertices[0].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// Vertex B.
vertices[1].position = XMFLOAT3( 1.0f,  1.0f,  0.0f);
vertices[1].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// Vertex C.
vertices[2].position = XMFLOAT3(-1.0f, -1.0f,  0.0f);
vertices[2].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// Vertex D.
vertices[3].position = XMFLOAT3( 1.0f, -1.0f,  0.0f);
vertices[3].color    = XMFLOAT4( 0.5f,  0.5f,  0.5f,  1.0f);

// 1st triangle.
indices[0] = 0; // Vertex A.
indices[1] = 3; // Vertex D.
indices[2] = 2; // Vertex C.

// 2nd triangle.
indices[3] = 0; // Vertex A.
indices[4] = 1; // Vertex B.
indices[5] = 3; // Vertex D.

This will result in a grey quad as shown in the image below. I've outlined the edges in red color to better illustrate the triangles:

Now imagine that we’d want our quad to have a different color in vertex A:

// Vertex A.
vertices[0].position = XMFLOAT3(-1.0f, 1.0f, 0.0f);
vertices[0].color    = XMFLOAT4( 0.0f, 0.0f, 0.0f, 1.0f);

That works as expected since there’s now an interpolation between the black color in vertex A and the grey color in vertices B, C and D. Let’s revert the previus changes and instead change the color of vertex C:

// Vertex C.
vertices[2].position = XMFLOAT3(-1.0f, -1.0f, 0.0f);
vertices[2].color    = XMFLOAT4( 0.0f,  0.0f, 0.0f, 1.0f);

As you can see, the interpolation is only done half of the way across the first triangle and not across the entire quad. This is because there's no edge between vertex C and vertex B.

Which brings us to my question:

I want the interpolation to go across the entire quad and not only across the triangle. So regardless of which vertex we decide to change the color of, the color interpolation should always go across the entire quad. Is there any efficient way of achieving this without adding more vertices and triangles?

An illustration of what I'm trying to achieve is shown in the image below:

Background

This is just a very brief explanation of the problems background in case that would make it easier for you to understand the problems roots and maybe help you with finding a better solution to the problem.

I'm trying to texture a terrain mesh in DirectX11. It's working, but I'm a bit unsatisfied with the result. When changing the terrain texture of a single vertex, the interpolation with the other vertices results in a hexagon shape instead of a squared shape:

As the red arrows illustrate, I'd like the texture to be interpolated all the way into the corners of the quads.

sentences:
Do I really need an engine to make a great game? I made one simple game, and now I'm working on a second version. I make games in Java, but everyone around me uses tools and engines. I do not understand some of the stuff that is in Unity.

In Java, I write all the code. I understand how it works, and I know how to make the code do what I want.

Is it true that I cannot make a great game without a tool?

sentences:
ECS component dependencies / sharing and cache locality I have been trying to wrap my head around how ECS works when there are components which are shared or dependent. I've read numerous articles on ECS and can't seem to find a definitive answer to this.

Assume the following scenario:

I have an entity which has a ModelComponent (or MeshComponent), a PositionComponent and a ParticlesComponent (or EmitterComponent).

The ModelRenderSystem needs both the ModelComponent and the PositionComponent.

The ParticleRenderSystem needs ParticlesComponent and the PositionComponent.

In the ModelRenderSystem, for cache efficiency / locality, I would like run through all the ModelComponents which are in a compact array and render them, however for each model I need to pull the PositionComponent. I haven't even started thinking about how to deal with the textures, shaders etc for each model (which will definitely blow the cache).

A similar issue with the ParticleRenderSystem.. I need both the ParticlesComponent as well as the PositionComponent, and I want to be able to run through all ParticlesComponents in a cache efficient / friendly manner.

I considered having ModelComponent and ParticlesComponent each having their own position, but they will need to be synched every time the models position changes (imagine a particle effect on a character). This adds another entity or component which needs to track and synch components or values (and potentially negates any cache efficiency).

How does everyone else handle these kinds of dependency issues?

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:
Collision detection logic Edit 2

In the following picture sprite1 (the red square) is hitting the platform from the left, so:

 sprite1_rightEdge>platformSprite leftEdge

would be true, so I can simply reposition sprite1 to align it with the left edge of the platform. So....

sprite1X=platformSpriteX-platformSpriteWidth

This is fine, however, lets say that sprite1 hits from the right, the problem I have here is that the first condition (above) is still true. So....

sprite1_rightEdge>platformSprite leftEdge

So my sprite1 still gets positioned at the left edge of the platform......

The same also happens in reverse....

Using velocity

I've had some success with velocity, but again I'm not clear on how this works properly.

For example, if I say something like:

if (Sprite1 moving right at time of collision)

Then I can assume it's hit the platform from the left.  This works, but what if the sprite is 'falling' from the top and lands on the platform while also moving right?  It will again get re-positioned at the left edge of the platform.

partial sucess

So far, I managed to get this working (although not fully implemented yet), by saving the old position of Sprite1, repositioning it and checking the old position, so if  the old position was to the left of the platform, then I can assume it came in from  the left.

If someone could let me know the best way to proceed it would be much appreciated.

Just to clarify what I'm asking - I have 2 objects - 1 is a platform and the other is the main character, I wish to make the player stop regardless of which side he hits the platform (from the top, bottom, left or right) - I will definitely be moving at distances of more than 1 px at a time).

I've attempted using velocity but this doesn't seem to work correctly as well as double checking x/y positions once a collision has happened but again I get some very off results.  Some pseudo code of how to detect which side a sprite has hit would be much appreciated :-)

I have researched this and have seen pretty much every Q&A on this site regarding this subject (as far as I know) but the answers are either not relevant to my particular query or I simply don't understand them.

Original question

I understand the basic principles of collision detection for squares / rectangles

i.e.,

(Pseudo code)

public boolean testCollision(){

if (bottom of sprite1<top of sprite2)
return false;

if(top of sprite1>bottom of sprite2)
return false;

if(left edge of sprite1 > right edge of sprite2)
return false;

if(right edge of sprite1 < left edge of sprite2)
return false;

return true;
}

I also know that I can stop my sprite going off the edge of the screen like so:

if(spriteX<0){spriteX=0};

However using something akin to the first method above for detecting collision between 2 specific objects, how can I make my 1st sprite actually stop so he can't pass through it?

At the moment, although I can detect when the two are touching, I'm unsure how to make it so that they can't actually pass through each other.

A push in the right direction would be a great help - thanks!

sentences:
Pygame Collision | Why do I slide up walls in my tile based game? My player if in contact with a wall either left/right/top(head) they will be able to just continue in the Y direction if you press jump as if you were flying. This is for all walls and invisible walls that work as boundaries on the side of the stage, if you're touch it on your left or right side you can press up and move up it.

def wall_collision(sprite, group, dir):
    if dir == 'x':
        collide = py.sprite.spritecollide(sprite, group, False, collide_hit_rect)
        if collide:
            if collide[0].rect.centerx > sprite.hit_rect.centerx:
                sprite.pos.x = collide[0].rect.left - sprite.hit_rect.width / 2
            if collide[0].rect.centerx < sprite.hit_rect.centerx:
                sprite.pos.x = collide[0].rect.right + sprite.hit_rect.width / 2
            sprite.vel.x = 0
            sprite.hit_rect.centerx = sprite.pos.x
    if dir == 'y':
        collide = py.sprite.spritecollide(sprite, group, False, collide_hit_rect)
        if collide:
            if collide[0].rect.centery > sprite.hit_rect.centery:
                sprite.pos.y = collide[0].rect.top - sprite.hit_rect.height / 2
            if collide[0].rect.centery < sprite.hit_rect.centery:
                sprite.pos.y = collide[0].rect.bottom + sprite.hit_rect.height / 2
            sprite.vel.y = 0
            sprite.hit_rect.centery = sprite.pos.y

This is the collision code and below is the update for the player:

def update(self):

self.rect = self.image.get_rect()
self.rect.center = self.pos
self.pos += self.vel
self.hit_rect.centerx = self.pos.x
wall_collision(self, self.game.walls, 'x')
self.hit_rect.centery = self.pos.y
wall_collision(self, self.game.walls, 'y')
self.rect.center = self.hit_rect.center

# Apply Friction
self.acc.x += self.vel.x * PLAYER_FRICTION
# Equation of motion
self.vel += self.acc
self.pos += self.vel + 0.5 * self.acc

def jump(self):

self.rect.x += 1
collision = py.sprite.spritecollide(self, self.game.walls, False)
self.rect.x -= 1
if collision:
    self.vel.y = -10

If you jump and your head touches a wall and you keep hold of the up arrow it keeps adding to your vel.y even though the wall is blocking you.

sentences:
How to manage game components and their attributes? Currently I am working with cocos2d for the iPhone. I want to make my game structured and  consequential. How to manage all the game components?

What do I mean with game components? A game component is e.g. the terrain or any other object like a character that is drawn on the scene. These components have attributes and duties like "let's clean up that place" or something similar.

So actually I want to wrap a component with all its attributes to make the code reusable. E.g. think of terrain. There may be a terrain in the front. Behind this terrain there is another terrain, e.g. hills, it's still terrain but just with maybe another color.

How do I accomplish that in cocos2d? In my scene there is a draw method where I normally would draw the terrain. But if I would put everything that is drawn in that method it would get confusing.

It would be cool to create an object of a terrain class and add this to the scene which would draw the terrain automatically. How do I do that? What would be the parent class of the terrain class?

sentences:
Unity2D: Delete spawn objects once it exits camera's view does anyone know how to delete/destoy a spawn object when it exit out of the camera view. I tried using:

   void OnBecameVisible() {
      Destroy (gameObject);
     }

But it didn't work. Maybe I'm doing something wrong, I don't know. Oh just a friendly advice my spawned object may enter form any point of the screen. Thank you :).

sentences: What exactly is a physics engine? A program should take input, process it and give output. So what exactly does a physics engine take as input and provide as output?

sentences:
How can I pass messages from multiple components to another? I want to start with an (easy) Entity Component System. I have a question regarding the messaging between Components.

Let's say I have a RenderComponent. This component needs 2 integer values x and y and probably a Sprite to render.
Now I have 3 other Components:

TransformComponent with 5 doubles: x, y, width, height and rotation.
MovementComponent with 2 doubles: velX and velY.
AnimationComponent with an array of Sprites.

Now I want to render my Entity.

How do I collect the Data from the different Components to render my Sprite?
All these informations have to enter the RenderingComponent at the same time.
Does someone have an idea on how to accomplish an efficient ECS?

sentences:
how change branching logic to math equivalent glsl? im totally newbie and this just for fun

afaik lot of best practice suggest to minimize usage of branching.

can you help me optimize below glsl especially on branch part?  ( target 120 )

the bgcolor used for minimum color level,  what i want is alpha outcome become 0.1 if the bgColor choosen on the current fragment otherwise it will get the data from uniform.

bgColor n uLightIntensity will same value for all fragment aplied within this shader.

the texcolor will be varies for each fragment ( depend on texture pixel presentation)

    varying  vec3 v_fragmentColor;
    varying  vec2 v_texCoord;

    uniform sampler2D u_texture;
    uniform  float u_lightIntensity;
    uniform vec4 u_bgColor;

   void main()
{

    vec4 texColor = texture2D(u_texture,  v_texCoord);

    // TODO POSIBLE OPTIMIZE FOR NON BRANCHING
    if(step( u_bgColor.r, texColor.r) == 0.0)
    {
        texColor.a = 0.1;
    }else
    {
        texColor.a =  u_lightIntensity/10.0;
    }
    texColor.rgb = max(texColor.rgb, u_bgColor.rgb);

    gl_FragColor = texColor;

}

sentences:
How to stop an animation on last frame until condition is met in Unity? I have an animation (fishing) I want to play backwards when the player catches something or cancels the action.

Playing the animation backwards is as simple as setting the speed to -1, ie:

anim.SetFloat("direction", -1.0f);

However, my fishing animation keeps playing until I have caught something, or cancel the animation. This means that the last frame of the animation is showing, but the time of the animation is still going.

So

the animation reaches the last frame
then I stand there for 8 seconds,
I catch something, so I change anim speed to -1
anim will now reverse those 8 seconds I was "standing still" first, before it even reaches the actual animation.

I need to stop the animation time on the last frame (without leaving the animation), so that reverse will be instant. And to not exit the animation until the reverse is finished. Maybe there is some other way to do it, but I can't figure it out.

I could create a seperate animation for when I want it to go backwards, but that seems sloppy.

sentences:
How to scale a sprite on x axis to touch the point without changing pivot? I have a sprite. The pivot is at random point.

I want to increase the sprite's scale on the x axis, without moving the pivot, until its edge touches a point at right.

I have a method to set/add size. I calculate a distance from the sprite's edge to the point at the right and add it as a size.

The problem is the sprite scale increases its size in both directions of the x axis (left and right), considering the pivot is not at the left edge of the sprite.

How can I scale the sprite while keeping the left edge where it is?

I have:

I want to get:

sentences: Why did the old 3D games have "jittery" graphics? I've been playing "MediEvil", lately, and it got me wondering: what causes some of the old 3D games to have "flowing" graphics, when moving? It's present in games like "Final Fantasy VII", "MediEvil", and I remember "Dungeon Keeper 2" having the same thing in zoom mode. However, examples like "Quake 2" didn't have this "issue", and it's just as old. The resolution doesn't seem to be the problem, everything is rendered perfectly fine when you stand still. Is the game refreshing slowly, or is it something to do with buffering?

sentences:
How to make an arrow land at a specific position in 3D world space In my game when I click with the mouse on the terrain somewhere, I'd like the player to fire an arrow to that position in a parabolic fashion.

The arrow has a position, acceleration and velocity all using 3D vectors. I looked at the Trajectory of a projectile article on wikipedia, but I don't know how to apply it in my situation as it explains 2D mathematics. I was wondering if there's a solution for 3D vectors? Any good resources perhaps related to the 3D situation?

sentences:
Game Make Studio 2 - Grid snap x, snap y I'm following a GM tutorial that was given in 1.4 but I'm using 2, and there's a feature that I can't seem to get working. The developer is basically changing two settings (Snap X and Snap Y) which are located right on the top bar when editing a room. Changing them from 32 to 16 allows him to have a lot more precision when placing objects using grid snapping.

I can't make this work in GMS2. I have found the grid settings under Preferences and can turn grid snapping on and off from there. But the 'Grid Horizontal Spacing' and 'Grid Vertical Spacing' settings don't seem to do anything, I had assumed they would change the snap settings.

Am I doing something wrong or has this functionality changed?

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

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

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

sentences:
Rotate Sprite towards mouse cursor SDL I have trouble to make my sprite(Arrow) to point at the position of my mouse cursor but i don't get the Right results. I've tried this:

SDL_Point Center{ 40,40 };
int Delta_x; int Delta_y;
int mouse_x, mouse_y;
double Result;
SDL_GetMouseState(&mouse_x, &mouse_y);
Delta_x = xPos - mouse_x;
Delta_y = yPos - mouse_y;

Result = (atan2(Delta_x, Delta_y) * 180.0000)/ 3.14159265;
m_Sprite->Render(Result, Center);

RendercopyEx:

SDL_RenderCopyEx(m_Renderer, m_Texture, NULL, &m_Rect, Angle , &Center, SDL_FLIP_NONE);

This is the result I get (in the original picture, the arrow is pointing up):

sentences:
How to retrieve the coordinates of an animated object? On Unity, I created a script in C # to animate a cube.
I am trying to create a script in C # which, once the animated object and in support of a key of the keyboard (for example F) returns to me the coordinates of the object at the moment when I pressed F

Can you give me this script?

Thank you for your help

sentences: What is the lowest-level way of making graphics from scratch? I am currently trying to get into game development and trying to understand 3D games. I would like to learn to code from scratch without any 3D engines. Some of the things I found was libraries like SDL and graphics.h in C. How does a game actually access the screen at the lowest-level? So how would one move a square rightwards on the screen on say Windows. Is the lowest level OpenGL and Direct3D or is there lower-level ways of doing it?

sentences:
Getting correct angles between Vector3s I'm working on a project where you can draw lines between points. You select one point and drag the mouse onto another point and a line is drawn between them.

The line itself is a 3d object which is scaled to match the length between points. Currently you can draw lines that are horizontal or vertical. But drawing a line that starts and ends on a different level fail.

Horizontal and vertical work well.

Here the lines should go like indicated by the grey lines. But it adds the Z-rotation(Up/down) to the Y-rotation(direction) - (Setting the Y-rotation by hand to match the horizontal line results the line being drawn correctly).

            Vector3 dir = junctionFinderHit.transform.position - startPos;  /// Direction vector
            float angleY = Vector3.Angle(dir, new Vector3(1, 0, 0));
            float angleZ = Vector3.Angle(dir, new Vector3(0, 1, 0));

            //Debug.Log(angleY + " - " + AngleDir(new Vector3(0, 1, 0), dir, Vector3.up));

            Vector3 rotationVector = new Vector3(0,0,0);

            if (AngleDir(new Vector3(1, 0, 0), dir, Vector3.up) < 0)    /// 360 movement instead of 180
                rotationVector.y = 360-angleY;
            else
                rotationVector.y = angleY;

            /// -90 degrees to make it horizontal by default, negative to make it point to the right direction
            rotationVector.z = (angleZ-90f)*-1;

            activeStick.transform.eulerAngles = rotationVector;

What do I need to do to get the rotations correct?

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:
Should I implement Entity Component System in all my projects? I'm not here to ask for any specific code implementation, I'm here just to make my ideas clearer. But let me explain the situation:

I have already developed some little and amatorial game projects (never published tho) but I recently found some interesting articles about ECS and I began to read more about it. I found the whole ECS concept every interesting and I thought I could implement it in a very tiny game I'm working on in my free time.
The problem is: should I implement this pattern on a every little project with simple game mechanics and poor gameplay ?
The 2D game I'm working on will be entirely developed by me, so I do not actually need to make the code easier to mantain by other people. This game will basically have just 2 players, some weapons and a large variety of bullets and superpowers. No IA enemies, no vehicles, static and tiny maps and.. Just that.
It will have, of course, a simply physics system (just to make players fall and bullets move, for example), and a tiled but very little map which is editabile by players (destroying tiles).

So the point is: why should I actually write an ECS for such a basic game ? Do I really have any real advantage considering the game design ?
I mean, I know it is very good to make your code very flexible and easy to mantain even in the future, but I also know that this pattern was invented to avoid some limitations and the code duplication which the old hierarchical game structure provides, but this game doesn't have a wide hierarchical structure, as far as I can see.

I started coding it, but I discovered some aspects which, to be honest, scare me. Like having all the components talking to each other through a reference of their owner (the entity they are bound to), which as far as I know, is not very good to avoid cache misses.
The last thing is that I have the feeling that I won't write more than 2 components of the same type, and this would make the ECS less useful.

I know I don't have the whole ECS concept really clear in my mind, this is the first time I implement it, by the way, but I hope you got the point of my problem.

sentences:
Overcoming fill rate and generation bottlenecks in voxel engine I decided to make a voxel engine using octrees. I am instancing entire cubes and sending the sizes and positions to the vertex shader.

I currently have 2 major problems:

Problem 1 - Because the cubes are instanced I can't remove hidden faces which means that some pixels are being overwritten lots of times. I have backface culling enabled but it doesn't fully help - also I noticed depending on the direction I look the lag is more / less which means sorting it might help, but then I don't really want to be sorting my cubes every frame.

Problem 2 - A 64*64*64 octree takes around 1/2 a second to fill and compress which is too slow, probably needs to be 1/10th of that speed. My method for that is as follows:

I have a generation function bool isCube(glm::vec3). Then, I create a full octree and fill up the base nodes with 0 or 1 depending what isCube returns for that given position. Finally, I compress it by checking if all leaves are the same, remove them, and store that value in the node above.

For reference the current isCube function looks like this:

bool isCube(glm::vec3 pos)
{
    if (glm::length(pos) < 300)
        return true;
    return false;
}

What sort of measures can I take to reduce fillrate?

What is the best way to go about generating landscape with octrees?

sentences: Does installing the DirectX SDK add project templates to Visual Studio? I have Visual Studio 2013 installed on my machine, and I have installed the latest DirectX SDK, but it doesn't seem to have added any DirectX project templates to VS. Should it have? Or do I need to get them separately?

sentences:
How to compute acceleration by using Kinect device joint positions I have an application which uses the Microsoft Kinect camera device.

At each point I can obtain the position of my hand in the 3 Dimensional space ( X - Y - Z ) and I want to compute acceleration of my hand over each second on each axis.

Basically, I can obtain the coordinates at each frame(where 1 sec = 30 frames), and I want to compute the acceleration of my hand in 1 sec.

StartPoint - (x1, y1, z1)

EndPoint after 1 sec from StartPoint ( 30 frames ) - (x2, y2, z2)

Acceleration between StartPoint and EndPoint = ?

Also I can obtain all the other coordinates of my hand over time, but I want to compute the acceleration in the period of time between start point and end point.

Could you please explain or show me how?

sentences:
Real-Time Speech & Verbal Communication with a Mecanim Character What would be the simplest method of integrating real-time verbal communication within a mecanim character that is already being used in a Unity app/project? Something like an SDK or toolkit?

I have such a character that is animated by a motion-capture device, so the user puts on the suit and the Unity character is driven by receiving live motion data. This is the non-verbal part for research in Social Sciences & Psychology.

I tried integrating the Virtual Human Toolkit into my Unity app to use its real-time speech & lip sync & facial gestures, but their character is set up in a complicated way, so I still cannot animate it by using my motion-capture device.

So, now I am thinking what is the next best thing to do with a Unity mecanim character to make it say something, etc...?

sentences:
Rotation matrices from Quaternion.Identity and -Quaternion.Identity are the same? If I create a rotation matrix from an identity quaternion then it is the same as a creating it from a negative identity quaternion

        Matrix m0 = Matrix.CreateFromQuaternion(Quaternion.Identity);
        Matrix m1 = Matrix.CreateFromQuaternion(-Quaternion.Identity);

        Console.WriteLine(m0);
        Console.WriteLine(m1);

        Console.WriteLine(m0.Forward);   // {X:0 Y:0 Z:-1}
        Console.WriteLine(m1.Forward);   // {X:0 Y:0 Z:-1}

Why is this the case?

If I use a negative identity matrix

        Quaternion q0 = Quaternion.CreateFromRotationMatrix(Matrix.Identity);
        Quaternion q1 = Quaternion.CreateFromRotationMatrix(-Matrix.Identity);

the orientation will be rotated 180 degrees as expected.

sentences:
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:
Implementations for storing entities in an ECS system I'm restructuring my model of entities, components and systems, where entities are:

const createEntity = (name, components) => ({
    id: genUniqueId(),
    name: name,
    components: components
});

And I came across a question, and would like to hear someone's experience about it. The question is what are the advantages and disadvantages of each of the following implementation approaches:

1 - Implement all entities in a single global object, and traverse this object by applying the systems in each entity, example:

const entities = {};
for(let key in entities)
    for(let system of systems)
       system(entities[key]);

2 - Create several global variables for each group that the systems serve, example:

const players = {};
const monsters = {};
const clouds = {};

for(let key in players)
       systems['input'](players[key]);

for(let key in monsters)
       systems['simpleAI'](monsters[key]);

for(let key in clouds)
       systems['wind'](clouds[key]);

3 - Create local variables within the systems to store the entities, and functions for each system to add and remove entities from their internal objects, example:

const windSystem = () => {
    const clouds = {};
    for(let key in clouds)
       ...
};

const addEntityInWindSystem = () => {...};
const delEntityInWindSystem = () => {...};

My intention with the question is just to look for other solutions or even understandings about the cons and advantages that each implementation can bring me during development.

sentences:
Value of the Game Institute Courses I'm considering purchasing courses from Game Institute, specifically, the Foundation Studies Package. Has anyone here taken their courses? If so, do you feel they are a good value? If you can, please be specific as to what you benefited from them, and their strengths and weaknesses.

Though I am most interested in reinforcing computer science fundamentals with respect to game development, I would also like to know if the material is relevant to today's technologies.

I'm especially interested in responses from working professionals who have taken their courses or reviewed their materials.

Background: My work week is spent mostly with SQL Server ETL and some C# web forms development. I have ideas for 2D and 3D platformers, but I don't have the skills to build them to completion yet.

TIA!

sentences:
XNA/Monogame inverting a BoundingBox I have a box that is drawn around my game that I want to check collisions with. Currently my BoundingBox is made in a way that whatever is inside the box is colliding with it:

BoundingBox bb = new BoundingBox(new Vector3(position.X - 0.1f, position.Y - 0.1f, position.Z - width - 0.1f), new Vector3(position.X + width + 0.1f, position.Y + width + 0.1f, position.Z + 0.1f));

(Note: the +0.1f is added so that it doesn't cause collision when an object is touching it, only when it passed through)

What I want is the inverse. I want a BoundingBox around this box so that only objects outside of the box will cause collision.

Is there an easy way of doing this or am I supposed to make different BoundingBoxes around this existing one? Thanks

sentences:
Libgdx unable to enter input in TextFields Hello I am trying to make login screen for my game, I use TextField's.

1. I am not satisfied with how they look I want it to look like this but simpler - basically to have a white field next to the name of the field.

2. When I run the game it shows just 2 labels, and I can't edit them or anything.

3. Here is my code:

public class FirstTime implements Screen {
private Stage stage;
private UVeggFruit uVeggFruit;
private Music music;
private MenuStage menuStage;
private TextField.TextFieldStyle textFieldStyle;
private OrthographicCamera camera;
private float densityT = 60 * Gdx.graphics.getDensity();
private BitmapFont bitmapFont;

public FirstTime(UVeggFruit uVeggFruit,Music music){
    this.uVeggFruit = uVeggFruit;
    this.music = music;
}

@Override
public void show() {
    stage = new Stage();
    camera = new OrthographicCamera();
    Viewport vp = new StretchViewport(1280, 720, camera);
    stage = new Stage(vp);
    Gdx.input.setInputProcessor(stage);
    ButtonClickListener buttonClickListener = new ButtonClickListener();
    SceneLoader sc = new SceneLoader();
    CompositeItemVO sceneComposites = new CompositeItemVO(sc.loadScene("Login").composite);
    CompositeActor UI = new CompositeActor(sceneComposites, sc.getRm());
    music.setLooping(true);
    music.play();
    stage.addActor(UI);
    UI.getItem("regisbutton").addListener(buttonClickListener);
    UI.getItem("loginbutton").addListener(buttonClickListener);
    FreeTypeFontGenerator FTFG = new FreeTypeFontGenerator(Gdx.files.internal("Karmakooma.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter FTFP = new FreeTypeFontGenerator.FreeTypeFontParameter();
    FTFP.color = Color.WHITE;
    FTFP.size = Math.round(densityT);
    bitmapFont = FTFG.generateFont(FTFP);
    FTFG.dispose();
    textFieldStyle = new TextField.TextFieldStyle();
    textFieldStyle.font = bitmapFont;
    textFieldStyle.fontColor = Color.WHITE;
    TextField username = new TextField("Username",textFieldStyle);
    TextField password = new TextField("Password",textFieldStyle);
    password.setPosition(400, 400);
    username.setPosition(400, 500);
    stage.addActor(username);
    stage.addActor(password);
}

@Override
public void render(float delta) {
    camera.update();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.act(delta);
    stage.draw();
}

@Override
public void resize(int width, int height) {
    stage.getViewport().update(width, height, true);
}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {
    bitmapFont.dispose();
    music.dispose();

    }
 }

I will be happy if you can answer both of my questions.

sentences:
Does an inventory limit in an MMORPG make sense? I am currently developing a simple 2d MMORPG. My current focus is the inventory system.

I am currently wondering if I should implement a limit on what a player character can carry. Either in form of a maximum weight, a limited number of inventory slots, or a combination of both. Almost every MMORPG I ever played limits inventory space. But plausibility aside, is this really necessary from a gameplay point of view? Maybe it would in fact improve the game experience when I just let the players carry as much stuff as they want.

tl;dr: What is the game development rationale behind limiting carrying capacity of player characters?

Edit:
Thanks for all the answers so far. They all were very insightful. After your input I decided to go for a limited inventory to prevent people from carrying too many healing items and too much specialized equipment into dungeons. To avoid the problem of loot overload and having to return to the town all the time, I plan to give players the ability to send items from their inventory directly to their storage (but not the ability to retrieve them in the field). I accepted the answer by Kylotan for now, but do not let this discourage you from posting additional answers, when you feel that some interesting aspect wasn't covered yet.

sentences:
delta_time with discrete movement I have a basic snake game movement system with Pygame:
clock = pygame.time.Clock()
if timer == MOVE_TICK_INTERVAL:
    timer = 0
    move_snake()

timer += 1
clock.tick(MAX_FPS)

The issue is that the higher MAX_FPS is, the faster timer iterates and thus the faster the snake moves. I'm aware of using some form of delta_time variable to calibrate and adjust the velocity of an object moving continuously but I don't know how to implement this method with discrete, grid-based movement.
In short,
I want to move my snake the same amount of units in a direction every interval with frame rate considered but I don't want to modify said distance.

sentences:
How to draw a rectangle with a border pixel over a camera/viewport? With this code I intended to visually delimit the complete view of the circuit and the two controlled cars:

draw_rectangle(0,0,1279,719,true);
draw_rectangle(0,720,639,1079,true);
draw_rectangle(640,720,1279,1079,true);

It turns out that only the complete view of the circuit that is drawn directly in the room is correctly delimited (observe the black line of a thick pixel):

Where there should be the rectangle strokes (red line, not necessarily at this thickness):

This happens because of this camera/viewport:

I believe the rectangle is being drawn under the camera/viewport.

What do I need to do to make this rectangle draw over the camera/viewport?

sentences:
DirectX 10 - determining if hardware device is available I am writing an offline renderer using SlimDX and Direct3D 10 that will need to be run on machines without graphics cards (servers). On these machines, I'll be using the WARP software renderer.

Is it possible to tell if a hardware device is present without throwing an exception in SlimDX? Currently I'm having to do this:

            try
            {
                Device device = new Device1(DriverType.Hardware, deviceCreationFlags,
                    FeatureLevel.Level_10_1);

                return device;
            }
            catch (Direct3D10Exception)
            {
                return null;
            }

And then create a WARP device if null is returned.

However, each time the exception is thrown, it breaks Visual Studio, which is annoying, and it doesn't seem like I should be catching an exception to determine if a feature is available.

Any way to do this?

sentences:
install unity package in to iphone? HI All,
 what is the steps of to install the unity package in to iphone and create a build (app file )that my client can also able to install in his iphone .

Thanks,
balraj.

sentences:
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:
Python/Kivy game for steam I'm developing a game in Python with Kivy as the gui. I've heard a few programs mentioned that compile python files to .exe's. However, I cant seem to find any that mention compiling .py and .kv files.

I wish to eventually publish my game to Steam Direct but i would like to know if my current approach to coding the game will hinder me doing so.

My actual question is, is there a way to compile a Python game with Kivy to an .exe file?

sentences:
Is it worth planning to be cross-platform in mobile game development? Disclaimer: my goal is not to use cross-platform frameworks like Unity.

I am currently planning a mobile game which I intend to first launch on iOS.  However, I am wondering if it is better to write everything in Objective-C, thus locking the code into the platform, and to do a complete rewrite for other platforms (ie: Android).  The other option would be to write the game logic in C or C++ and to only write the code that interfaces with each OS in the preferred language (Objective-C(++) or Java).

I understand that this must depend on the size of the code base, so what program size should mark the separation?
Finally, if I write cross-platform code, should I stick to C (since Objective-C is a superset of C, making it easy to use C and to use the code samples and because the NDK and the JNI interfaces are more C oriented)? The only advantage I see with C++ in that case is the fact that it is object-oriented and thus it is easier to represent game entities).

sentences:
A specific but basic tutorial for Corona SDK? I have been looking at Corona SDK and it would be helpful if I could see a tutorial/example to accomplish the following:

Load an image as a background/map
Draw a circle on the screen
user can tap elsewhere and the circle moves to that location (this can be repeated)

Does anyone know of any examples out there?

sentences:
Dynamic audio score/music I'm interested in developing a game who's background music changes with the mood and scenario of the game's action. Of course many existing games do this (halo for example), but I was interested in any resources/papers/articles talking about the techniques to develop a system like this.

I have some ideas, and I understand that this will be equally challenging to implement at the code level as it will be to come up or acquire music that fits this model. Any links or, answers with ideas in them would he appreciated.

Edit: this is the kind of info I'm looking for :)
http://halo.bungie.org/misc/gdc.2002.music/

sentences:
How can I scroll sprites when swiping using Cocos2D? I'm adding 3 sprites (layers) to CCParallaxNode:

BGLayer = [CCSprite spriteWithFile:@"Layer.png"];
[_backgroundNode
    addChild:BGLayer
    z:2
    parallaxRatio:layer1Speed
    positionOffset:ccp(screenSize.width/2,screenSize.height/2)
];

How can I create the scroll when swiping?

sentences:
How to benefit from cpu cache in a entity component system game engine? I often read in the ECS game engine documentations that is a good architecture for using cpu cache wisely.

But I can't figure how we can benefit from cpu cache.

If components are saved in an array (or a pool), in contiguous memory, it's a good way to use cpu cache BUT only if we read the components sequentially.

When we use systems, they need entities list which are list of entities that have components with specific types.

But these lists give the components in a random way, not sequentially.

So how to design a ECS to maximize the cache hit ?

EDIT :

By example, a Physic system needs an entities list for entity that has the RigidBody and Transform components (There is a pool for RigidBody and a pool for Transform components).

So its loop for updating entities will be like this :

for (Entity eid in entitiesList) {
    // Get rigid body component
    RigidBody *rigidBody = entityManager.getComponentFromEntity<RigidBody>(eid);

    // Get transform component
    Transform *transform = entityManager.getComponentFromEntity<Transform>(eid);

    // Do something with rigid body and transform component
}

The problem is that the RigidBody component of entity1 can be at the index 2 of its pool and the Tranform component of entity1 at the index 0 of its pool (because some entities can have some components and not the other and because of adding / deleting entities / components randomly).

So even if components are contiguous in memory, they are read randomly and so it will have more cache miss, no ?

Unless there is a way to prefetch the next components in the loop ?

sentences:
Varying framerate (FPS) In my game-loop, I am using fixed time step for physics and interpolation for rendering as suggested on Gaffer on Games | Fix Your Timestep!

However, when the framerate is varying between 30-60fps during the game, the game looks jumpy. For example, balls suddenly look accelerated when the frame rate increases from 35 to 45 suddenly.

Is there a way to make the game look smooth while framerate is varying?

Here is my game loop:

protected void update(float deltaTime) {
    //do some pre stuff

    deltaTimeAccumulator +=deltaTime; //deltaTimeAccumulator is a class-member holding the accumulated frame time
    while(deltaTimeAccumulator>FIXED_TIME_STEP) {
        world.step(FIXED_TIME_STEP, 6, 2);  //perform physics simulation
        deltaTimeAccumulator-=FIXED_TIME_STEP;
    }
    // world.step(deltaTime, 6, 2);

    destroyBodiesScheduledForRemoval();
    render(deltaTimeAccumulator /FIXED_TIME_STEP); //interpolate according to the remaining time
}

Here is the part related to the interpolation (related inner works of render() method) :
        this.prevPosition = this.position; //get previously simulated position

    this.position = body.getPosition(); //get currently simulated position

    //interpolate
    Vector2 renderedPosition = new Vector2();
    if (prevPosition != null) {//&& !isFloatApproximatelyEquals(this.prevPosition.x, this.position.x) && !isFloatApproximatelyEquals(this.prevPosition.y, this.position.y)) {
        renderedPosition.x = this.position.x * interpolationAlpha + this.prevPosition.x * (1 - interpolationAlpha);
        renderedPosition.y = this.position.y * interpolationAlpha + this.prevPosition.y * (1 - interpolationAlpha);
    } else {
        renderedPosition = position;
    }

    //Draw the object at renderedPosition

sentences:
Gerstner wave function simplified? The gerstner wave function is a commonly used method to calculate waves and simulate water in video games and movies or most 3d simulations. It is however quite complex so it is very hard for young developers such as myself to understand and implement it into code.

Would it be possible to simplify the formula:

A = amplitude of wave (Float)
W = wave number (Vector)
D = direction (Vector) how do i know what to set the direction to?
S = Speed
L = wave length
phase-constant = S x 2* pi/L.

According to the article Q = 1/(W * A)

Issues and Questions:

Why are all three lines of the formula seperated by commas?
D refers to a directional vector (i think)
Q = 1/(W * A) but W is a vector and A is a float?
What does this line mean: wiDi.(x,y) is that reffering to w * dot product of(d , (x,y))

sigma returns the sum of what exactly?

Here is my attempt to implement it into java code:

float yPos = (float) ((steepness * amplitude) * direction.y * Math.cos(wavenumber.y * (direction.dot(position)) + phase_const * time));

Dont know if its correct

This may help:

https://github.com/armanuguray/water-surface/blob/master/src/engine/waterengine.cpp

sentences:
Smooth Sprite Movement - Don't Add Velocity to Position? I am trying to figure out if there is a way to move a sprite smoothly on the screen at different speeds without stuttering, but keeping the effect that it's moving smoothly; especially at faster velocities.

Below is a basic version of what I have with all of the object specific logic stripped out for readability.

void MoveableGameObject::update(double time)
{
    //maxVelocity is 10
    currentVelocity = min<float>(currentVelocity + acceleration * time, maxVelocity);
    location.x += currentVelocity;
}

void MoveableGameObject::draw()
{
    sprite->draw(location.x, location.y)
}

The part that I do not like is that the next time the frame renders and max velocity has been achieved, the sprite jumps 10 pixels and looks stuttery. If I tone down the numbers then it is of course smoother, but also slower.

I need to find a way to still have the speed, but give a smooth transition somehow. I am having a hard time wrapping my head around trying to implement movement speeds. Am I just using the wrong scale in terms of velocity to pixels?

My brain hurts, but I am still having a blast tinkering around with this and is a nice change of pace from doing nothing but business applications for the past 7 years.

I do have the ability to say run the game logic 20 times a second while rendering at 60 frames a second. Figured I would mention that in case that helps with an answer. Currently they are both just set to 60 since I am only running a single sprite and wanted to test the movement and check the sprite location on update() vs. draw().

Thanks in advance for any help.

EDIT: I forgot to mention and not sure if it matters or not, but I am currently using SDL to render.

sentences:
Why do my images take 200 MB of RAM when they are ~20KB on disk? I am creating an Android game using libGDX. When I load my nine images it takes 200 MB of RAM. But the images are 10 to 17 KB each. Why the discrepancy? Here is where I create textures from those images:

public static HashMap<String, Texture> ground = new HashMap<String, Texture>();
for (int i = 1; i < 10; i++) {
  ground.put(
  "ground" + i,
    new Texture(Gdx.files.internal("groundImages/ground" + i + ".png"))
  );
}

sentences:
Triangulating a partially triangulated mesh (2D) Referring to the above exhibits, this is the scenario I am working with:

starting with a planar graph (in my case, a 2D mesh) with a given triangulation, based on a certain criterion, the graph nodes are labeled as RED and BLACK. (A)
a subgraph containing all the RED nodes (with edges between only the directly connected neighbours) is formed (note: although this figure shows a tree forming, it may well happen that the subgraph contain loops) (B)

Problem: I need to quickly build a triangulation around the subgraph (e.g. as shown in figure C), but under the constraint that I have to keep the already present edges in the final result.

Question: Is there a fast way of achieving this given a partially triangulated mesh? Ideally, the complexity should be in the O(n) class.

Some side-remarks:

it would be nice for the triangulation algorithm to take into account a certain vertex priority when adding edges (e.g. it should always try to build a "1-ring" structure around the most important nodes first - I can implement iteratively such a routine, but it's O(n^2) ).
it would also be nice to reflect somehow the "hop distance" when adding edges: add edges first between the nodes that were "closer" to each other given the start topology.

Nevertheless, disregarding the remarks, is there an already known scenario similar to this one where a triangulation is built upon a partially given set of triangles/edges?

sentences:
Efficient way to implement a lot of singletons I just came upon programming patterns and learned about singleton. I'm in the process of creating my first game and it contains several managers:

I wanted to implement singleton on each of the managers,but the only way I can think is copy pasting the singleton pattern on each awake method script attached to each manager.
Is there a more efficient way to do it rather than pasting the pattern on each awake method?

sentences:
Animating a jellyfish hardcoding? I have drew a hemi-sphere by myself, and would like to do basic jellyfish animation by animating the vertices of the hemi-sphere. I tried a lot of experiments but it seems I'm doing it wrong. I need hints or idea on about doing it.

This is the code on how to draw a hemi-sphere. I don't know what values actually to play with to animate the sphere as a jellyfish.

for(float phi = 0.0; phi < 1.567; phi += factor) {

        glBegin(GL_QUAD_STRIP);

        for(float theta = 0.0; theta < 2*3.14 + factor; theta += factor)
        {
            x = rh * sin(phi) * cos(theta);
            z = rh * sin(phi) * sin(theta);
            y = -rh * cos(phi);

            gl::vertex(Vec3f(x, y, z));

            x = rh * sin(phi + factor) * cos(theta);
            z = rh * sin(phi + factor) * sin(theta);
            y = -rh * cos(phi + factor);

            gl::vertex(Vec3f(x, y, z));

        }
        glEnd();
    }

sentences:
How can I clear the animations associated with bones in 3DS Max 2009? I was given a model by an artist and it was boned and skinned for me. The .max file that he provided also included an animation to show what he would be able to do. (A basic running animation.)

However, this was the last I heard from him and I want to construct my own animation. I was wondering if there was any quick and easy way of removing the rotation animation on the bones, back to default values. (i.e., 0 on all axis or to the default biped positions.)

I have removed all the keyframes and the default pose seems to be the first frame of the animation that was created by the artist. I have tried setting the values in the X, Y, Z boxes at the bottom, nothing happens, I think its relative to the current position?

I have also tried setting the biped to figure mode, copying the pose and pasting the pose back to the original biped. That only seemed to work in bits and pieces, some of the bones didn't seem rotate, like the pelvis and the spine bones, and also after a while the bones seemed to revert back to the default running stance, or some bones would just take on a weird, random rotation.

Any ideas?

sentences:
OpenGL strange rendering problem when buffers have different sizes I have encountered a very odd error in my program, "odd" in the sense that everything the API says suggests that the error should not occur.

I have a bunch of 2D un-indexed vertex data, and I want to render it as lines. So far, so good. Then, I wanted to make each vertex have its own (RGB) color, so I generate a color for each vertex. For simplicity, I chose red. Works fine, except now only 2/3 of the points are being rendered! The problem arises from the fact that each vertex's position data consists of only 2 numbers, whereas the color data consists of 3 numbers. So, the "position" buffer has 2 elements per vertex while the "color" one has 3 elements per vertex. I thought that using glVertexAttribPointer to tell this information to OpenGL would be enough, but turns out it's not. In fact, if I say that the color data has only 2 elements per vertex, using

glVertexAttribPointer(vertexColorID2,2,GL_DOUBLE,GL_FALSE,0,(void*)0);

(as opposed to 3), it renders all the points - except now I can only specify two numbers for the RGB color, so I can't get the right color. The full code of the issue is below:

    glUseProgram(programID2); //draw the graph
    graph_data = graphData();
    std::vector<double> graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graph_data.size(); i += 3) graphcolordata[i] = 1;
    glEnableVertexAttribArray(vertexPosition_modelspaceID2);
    glBindBuffer(GL_ARRAY_BUFFER, graphbuffer);
    glBufferData(GL_ARRAY_BUFFER, graph_data.size()*sizeof(GLdouble), &graph_data[0], GL_STREAM_DRAW);
    glVertexAttribPointer(vertexPosition_modelspaceID2,2,GL_DOUBLE,GL_FALSE,0,(void*)0);
    glEnableVertexAttribArray(vertexColorID2);
    glBindBuffer(GL_ARRAY_BUFFER, colorbuffer2);
    glBufferData(GL_ARRAY_BUFFER, graphcolordata.size()*sizeof(GLdouble), &graphcolordata[0], GL_STREAM_DRAW);
    glVertexAttribPointer(vertexColorID2,3,GL_DOUBLE,GL_FALSE,0,(void*)0);
    glDrawArrays(GL_LINES, 0, graph_data.size()/2);
    glDisableVertexAttribArray(vertexPosition_modelspaceID2);
    glDisableVertexAttribArray(vertexColorID2);

Note: programID2 is my basic shader program, and the following variable definitions were previously used:

GLuint vertexPosition_modelspaceID2 = glGetAttribLocation(programID2, "vertexPosition_modelspace");
GLuint vertexColorID2 = glGetAttribLocation(programID2, "vertexColor");

Edit: Incredibly stupid error, figured it out immediately after posting when it had previously stumped me for half an hour.

    std::vector<double> graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graph_data.size(); i += 3) graphcolordata[i] = 1;

should be
        std::vector graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graphcolordata.size(); i += 3) graphcolordata[i] = 1;

When this initialization is fixed, it works fine. I would delete this, but I do not see how.

sentences:
Design/Architecture of a game waiting room I have some experience in creating singleplayer games, but for a new project I want to implement also a multiplayer.

I can imagine what kind of information (position, textureId, ...)  i have to send over the network. But hey, I can't figure out how I "could" represent a game waiting room. Which means :

One player creates a new game (What happens here?Does the server code calls a new instance of the game, but does not start the game yet???)
The player, who created the game then either waits for additional players(in maximum 4) or he starts a solo game (Should my game has something like a value for currentPlayers ? Or is this managed by server code?)
Also can you explain what exactly server code means? Which common functions should it handle (in context of creating a game room)?
How can I make sure, that other players can also start new games

As you can see I am a complete beginner to networking, but i do know about TCP and UDP, but the only thing i have done with it was a simple echo server...
What am i looking for are simple pseudocodes oder examples, but please explain briefly.

sentences:
Update variable before building the unity build Before building the standalone build I want to update one of the variables in the script using this.

class MyCustomBuildProcessor : IPreprocessBuild
 {
      public int callbackOrder { get { return 0; } }
      public void OnPreprocessBuild(BuildTarget target, string path) {
        // Do the preprocessing here
        CopyRightCls.buildDateTime = System.DateTime.Now;
        Debug.Log("+++++++++++++++++++++++++++++++++++BuildDateTime" + CopyRightCls.buildDateTime);
      }
 }

But the problem is my date variable is not updating its showing 1 january 0001.

sentences:
Has google increased apk limit from 50mb to 149? I recently seen Angry Birds GO has apk size of 149 on google play, https://play.google.com/store/apps/details?id=com.rovio.angrybirdsgo&hl=en

Yet google says apk size limit is 50 mb.So my question is,has google increased apk size limit from 50 mb?

sentences:
Random Object in Array I am using Unity. I have created eight different types of objects, stored in an array, and I am displaying them on the scene in a grid pattern with random order.

The first four objects in the array are red. The player needs to destroy all four red objects to go to the next level.

The code I've writted so far uses the Random.Range method, which chooses objects completely randomly. Sometimes it generates a grid that doesn't contain four red objects, so my player can't destroy them and proceed to the next level.

How do I randomly generate this grid so that it is guaranteed to have exactly four red objects?

Here is my code.

public int gridWidth = 0;
public int gridHeight = 0;
public GameObject[] facePrefab = new GameObject[8];

void Awake()
{
    gridHeight = Random.Range (3, 5);
    CreateGrid(gridWidth,gridHeight);
}
void CreateGrid(int numX, int numY)
{
    for (int x = 0; x < gridHeight; x++) {
        for (int y = 0; y < gridWidth; y++) {
            GameObject go = Instantiate (facePrefab[Random.Range(0,facePrefab.Length)]) as GameObject;
        }
    }
}

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

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

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

sentences:
Efficient structure for representing a transform hierarchy Can anyone suggest a memory efficient way to represent a tree of matrices, for example in a hierarchy model?

I'm particularly keen to preserve data locality, and I suspect a structure-of-arrays (matrices & indices to matrices) type approach might be suitable.

As well as many chained matrix computations, this structure will probably be copied around in memory a fair bit, so having contiguous storage would be a big bonus.

sentences: How to solve the overlap between a rectangle and a circle that collide I have two figures - a circle and a rectangle and i have a method that checks whether the two figures collide. How to prevent them  from overlapping during collision?

sentences:
Is SharpDX mature enough to adopt yet or should I just start using SlimDX right now? I'm about to stop my game-project in XNA because from what I can gather it's development is coming to an end (and it's already behind current technology). Therefore, I need to adopt a new framework or API.

I have just spent 2 days looking at C++ and decided it's really not for me - however I do find the raw access to DirectX appealing. SharpDX sounds like a good place to start, but it has no documentation and no code comments. I feel like it's not quite ready for use.

I'm interested in the opinions of people that have used either or both of these frameworks, to help me decide for sure which one I should learn? Thanks for any advice.

sentences: Android build has white image over game In unity when I am playing my game it displays fine, but when I build and run it to my nexus 5 there is this white something I don't even know over my game. Any suggestions for fixes?

sentences:
Can various browsers be assumed to maintain predictible state accurately in multiplayer online gaming? With many games it is said that server will assume that clients keep track of the world accurately. Assuming this is true, for a browser based multiplier space invaders game you would only tell the client when new bullets or the players ship moves and everything that behaves in a predetermined manner in the js client.

It would be expected that positions would be the same in the browsers. Do you think you could trust browsers to do this? I feel that timings could differ between rendering loops and cause positions to get out of sync and might just get the server to maintain all the positions to make sure.

sentences:
How many triangles should I expect to be able to render in a second? Assuming that I'm doing everything right and all I'm doing when I render my scene is going through all the vertex arrays that I want to render, how many triangles should I expect to be able to render compared to the FLOPS of the GPU I am using?

In my particular case, I'm trying to asses if my OpenGL pipeline is entirely crap or somewhat decent. This requires benchmarks but also something to actually benchmark against.

My benchmark machine is based on a Ryzen 5 2400GE with an onboard Vega 11 GPU that has a Tpeak performance of 1.746 TFLOPS for 32 bit floats[1].

On my benchmark machine I am able to push about 33000000 triangles per second, with a vertex shader that does one 4x4 matrix multiplication and a fragment shader that simply sets a colour. The triangles are defined using vertex with a 3d position, a 2d texture coordinate (unused in this benchmark, but still part of the data) and an RGB colour. This result is based on rendering VBAs with 40000 triangles, 500 times per frame. Rendering a frame takes about 0.5 seconds.

[1] https://www.techpowerup.com/gpu-specs/radeon-rx-vega-11.c3054

sentences:
Get back or delete an existing OpenGL object, then change it and draw at new. How? With OpenGL i'm drawing for example a circle.

Can i take this drawn circle back out of the window and change something and then draw it back on the window?

Or can i /have to delete it and then draw it new with other properties?

Do someone have me a link etc how to do something like this?

edit
it is just about 2D objects

sentences:
Rendering a model with transparent or translucent uv map applied doesn't work Before I try to make anything transparent, the model renders nicely. When I change the uv layout so that one piece of the model will be transparent, it renders horribly. This is the result with a translucent green texture:

I did transparency with OpenGL when I did 2D games and everything worked nicely because of these two lines:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Now, I fear, this won't be enough, right? Or maybe I should use some other technique?

sentences:
Is it possible to use absolute input device like a pointer or VR headset for peeking(looking) in non VR FPS or 3rd person games? Assume I have a VR headset, which has absolute orientation as output and this orientation is input to a game.
In VR Games, your character looks wherever you look by using your headset's absolute orientation(right?) Everything is OK for VR games
Coming to the point for non VR games;
Normally, when you tilt a joystick to a direction and hold it at that position, your character always turns relative to the direction until you released your finger. For example if you tilt the joystick to rightest and hold it at there, your character starts rotationg around itself to the right until you release joystick.
Can I do the VR rotating thing with a standart game controller joystick? Do games (or game engines) allow this type of control? I mean when I tilt my stick to rightest position, my character peeks to rightest, but when I release the stick, character peeks to default(front).  If it is possible, could you give name of games that suppport this control type? What is the technical name for this control type and maybe some resources or keywords for my research?

sentences:
Simple 2.5D flight movement I'm building a simple 2.5D Dogfighting game, kinda similar like this one: https://gfycat.com/PleasantDeterminedArcherfish for the moment my movement works like this:

    if (Input.GetKey("left"))
    {
        transform.Rotate(0, 0, rotation);
    }

    if (Input.GetKey("right"))
    {
        transform.Rotate(0, 0, -rotation);
    }

    if (Input.GetKey("up"))
    {
        if (speed <= maxspeed)
            speed += speedIncrease;
        if (gravity > 0)
            gravity -= speedIncrease;
    }

    if (Input.GetKey("down"))
    {
        if (speed > 0f)
            speed -= speedIncrease;

        if (speed <= 0f)
            speed = 0;

        if (gravity < 1.0f)
            gravity += speedIncrease;
    }

    transform.Translate((Vector3.down * gravity), Space.World); //This is for the fake gravity
    transform.Translate(new Vector3(0, 1 * speed, 0)); //This applies the forward speed

I tried to create the gravity by myself, so that I would be able to lower the gravity, at higher speeds, so that I can achieve an "uplift" effect, like in reality. But now I wanted to let my model face the movement direction and all solutions, I found to solve this problem use the rigidbody.velocity, which is zero in my case. Is there another case to solve this problem? Or maybe even a better solution to achieve a similar movement like in the gif than mine? Maybe adding force instead of Translate?

sentences:
2d map: how to manage it? i'm developing a 2d game (top down), and i'm a beginner.
Now, i've to create a map, with object (to interact with) ...
I don't know how to .. manage the problem !
Does anyone can help me ? What are the methodology used ?
Thanks

sentences:
How to make the camera follow the mouse in first or third person camera I currently I have a game made of a few small scripts, the PlayerController, PlayerStats, and CameraChange (each below).

My question is how do I get the camera to follow the mouse movement? I want the player to be able to switch between each camera and look around with the mouse.

Any idea as to how I'd go about doing this? My current theory is I would some how have to access the current active camera and make it follow the mouse but not sure how to do that.

PlayerController-

using UnityEngine;

public class PlayerContorller : MonoBehaviour

{

    // Update is called once per frame
    void Update ()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;

        var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

            transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
    }
}

PlayerStats-

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

public class PlayerStats : MonoBehaviour {

    public int Health = 100;
    public int Stamina = 100;
    public int magic = 100;

    // Use this for initialization
    void Start () {

    }

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

        }
    }
}

CameraChange-

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

public class CameraChange : MonoBehaviour {

    public GameObject ThirdCam;
    public GameObject FirstCam;
    public int CamMode;

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

        if (Input.GetButtonDown("Camera"))
        {
            if (CamMode == 1)
            {
                CamMode = 0;
            }
            else
            {
                CamMode += 1;
            }
            StartCoroutine(CamChange());
        }
    }
    IEnumerator CamChange()
    {
        yield return new WaitForSeconds(0.01f);
        if(CamMode == 0)
        {
            ThirdCam.SetActive(true);
            FirstCam.SetActive(false);
        }
        if(CamMode == 1)
        {
            FirstCam.SetActive(true);
            ThirdCam.SetActive(false);
        }
    }
}

sentences:
Ensuring a Recursive method completes in one update tick? OK so I have a method that calls itself as this was the only way I could think to get the behaviour I needed. Its a tetris clone i am making and this method is for checking for full lines across X axis.

    void CheckForFullLine(int starting_Y)
{
    for (int y = starting_Y; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (!frozenCells[x, y].isFilled)
            {
                CheckForFullLine(starting_Y + 1);
                return;
            }

            if (x == CELL_COUNT_X - 1)
            {
                tetrisLinesThisTick++;
                Debug.Log("lines this tick: " + tetrisLinesThisTick + "on tick: " + tick);
                ClearLine(y);
            }
        }
    }
}

but when i test the game, most of the time (more than 9/10 times) when you get multiple lines, the debug log says we only got 1 line in that 'tick'.

Here is the update method where at the top I set tetrisLinesPerTick to 0 at the start of each frame.

    private void Update()
{
    tick++;
    // reset the tetris-lines this tick value:
    tetrisLinesThisTick = 0;

    ClearScreen();
    CheckForFullLine(0);
    HandleMovementAndBlockCreation();
    DrawFallingPiece();
    DrawFrozenBricks();
}

For example if I get 2 lines in one go, I get the debug log saying '...linesPerTick 1' twice in quick succession.

Strangely , occasionaly  I do get the 2 or even 3 lines and it says the correct amount, but this is rare and i don't know how i  reproduce that yet.

Another very strange thing (the relevant code might not be here for this part..) ...quite rarely one of the frozen blocks will turn grey after falling, then I can still 'use' it in game to make more lines, but it doesnt disappear like the others, then make a couple more lines using this grey block and it disappears as normal :S  (well just in case you feel like helping me with this part, he is more code :P):

    void ClearLine(int line)
{
    // TODO: Add score

    // remove complete line
    for (int x = 0; x < frozenCells.GetLength(0); x++)
    {
        frozenCells[x, line].isFilled = false;
    }

    //shift all lines down        // todo: figure out if its a multi-line tetris to give better scores...
    for (int y = line; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (frozenCells[x, y].isFilled)
            {
                if (y > 0)
                {
                    frozenCells[x, y].isFilled = false;
                    frozenCells[x, y - 1].isFilled = true;
                }
            }
        }
    }

}

For some reason, I feel it may be the recursive method i made  and the fact that 'linesPerTick' value is getting set back to zero prior to the other lines being removed (in the same move), is what is causing my problem but i could be completely wrong about it!

The whole project is just one .cs file and a block texture i made in GIMP, I could paste the whole script here if you want to try it please let me know. Cheers for any help!

sentences:
Is it a good idea to use the RDM socket type for multiplayer games? I am currently developing a MOBA/RTS style game with an authoritative networking structure. Of course, the server needs to send a big number of packets every second, answering requests from the clients. The packets are split into commands and states. Commands contain all the actions a unit has performed since the last send-procedure, and states include the position and rotation data about a unit.
Commands are sent over TCP because they need to be in the right order and reliable for synchronized gameplay, individually to every client, states over UDP through a multicast group that consists out of the player clients because I interpolate, and a lost packet will not create any damage then.

Today i came across the RDM socket type, selectable through the C# Socket constructor, and I thought that this maybe is what I really want? My TCP connections currently do not make use of the seamless streaming of bytes as I wrap my data into packets and send them in constant intervalls. is the RDM socket type what I want? Having reliable connection-less packets send over PGM sounds really promising to me.

sentences:
How to perform collision detection in 3D space? I've got to write, what can be summed up as, a complete 3D game from scratch this semester. Up until now I have only programmed 2D games in my spare time, the transition doesn't seem tough, the game's simple. The only issue I have is collision detection. The only thing I could find was AABB, bounding spheres or recommendations of various physics engines. I have to program a submarine that's going to be moving freely inside of a cave system, AFAIK I can't use physics libraries, so none of the above solves my problem.

Up until now I was using SAT for my collision detection. Are there any similar, great algorithms, but crafted for 3D collision? I'm not talking about octrees, or other optimizations, I'm talking about direct collision detection of one set of 3D polygons with another set of 3D polygons. I thought about using SAT twice, project the mesh from the top and the side, but then it seems so hard to even divide 3D space into convex shapes. Also that seems like far too much computation even with octrees.

How do professionals do it? Could somebody shed some light.

sentences:
What is the difference between genre and game mechanics? In some local vacancies I read something like "a genre = match3", or like "a game mechanics = adventure". I thought, a game mechanics is match3, or any sequences of operations that do something to solve something. A verb. For example, to connect three candies of one color in a line.

And genre is just a structure about what elements should be in a story. Like in "The Hero with a Thousand Faces". For example, an adventurer + an artifact + a map (or any key) to find it + competitor (or a let) = adventure.

Am I wrong?

sentences:
How to randomize Motion/animation without create a state for each animation? I'm using Animator and state for animating my charachter.

So, i've (example) an Idle state, associated to an Idle motion animation , and a Death State, associated to a Death animation.

But I've 5 possible animation for death so i would like to randomize death animation without create a state for each animation.

My State "Death" has a "Motion" variable. I would like to change at runtime this  "motion" variable. Is it possible ?

Thanks

sentences:
How to draw stencil ref value hi i am currently implementing UI screen that shows Depth Complexity of scene,
so that we can figure out how many time each pixels work for same pixels.

for this i need to render stencil ref value.
i successed to READ stencil ref value of each pixels using staging texture.
but i couldn't figure out how to pass this data to pixel shader, so that i can render 'Depth complexity'.

brief code that i have tried now.

//initializing Depth Stencil buffer-----------------------------------

D3D11_TEXTURE2D_DESC ds_desc;
    ds_desc.Width = SCREEN_WIDTH;
    ds_desc.Height = SCREEN_HEIGHT;
    ds_desc.MipLevels = 1;
    ds_desc.ArraySize = 1;
    ds_desc.Format = DXGI_FORMAT_R24G8_TYPELESS;
    ds_desc.SampleDesc.Count = 1;
    ds_desc.SampleDesc.Quality = 0;
    ds_desc.Usage = D3D11_USAGE_DEFAULT;
    ds_desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
    ds_desc.CPUAccessFlags = 0;
    ds_desc.MiscFlags = 0;
    Create DepthStencil Texture ...

    D3D11_DEPTH_STENCIL_VIEW_DESC dsv_desc;
    dsv_desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    dsv_desc.Flags = 0;
    dsv_desc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
    dsv_desc.Texture2D.MipSlice = 0;
    Create DepthStencilView

    DX_DContext->OMSetRenderTargets(1, rtv.GetAddressOf(), dsView.Get());

// process to create SRV--------------------------------------------------------
D3D11_TEXTURE2D_DESC desc;
    desc.ArraySize = 1;
    desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
    desc.CPUAccessFlags = 0;
    desc.Format = DXGI_FORMAT_X24_TYPELESS_G8_UINT;
    desc.Width = SCREEN_WIDTH;
    desc.Height = SCREEN_HEIGHT;
    desc.MipLevels = 1;
    desc.MiscFlags = 0;
    desc.SampleDesc.Count = 1;
    desc.SampleDesc.Quality = 0;
    desc.Usage = D3D11_USAGE_DEFAULT;
    Create StagingTexture2D...

DX_DContext->CopyResource(copyTex->Get(), graphic->DepthStencilBuffer());

    D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
    srvDesc.Format = DXGI_FORMAT_X24_TYPELESS_G8_UINT;
    srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    srvDesc.Texture2D.MipLevels = 1;
    srvDesc.Texture2D.MostDetailedMip = 0;
    Create SRV for binding to pixel shader...

//

and i bind this srv into this pixel shader
and just always showing BLACK

Texture2D<float4> uiTexture : register(t0);

float4 main(PS_INPUT input) : SV_Target
{
    int2 idx = int2(0, 0);
    return uiTexture[idx];

}

any advice or alternative would be really appreciated.

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:
Why is my enemy object shaking in my AI code? My script here is attached to an 'enemy' object. My enemy walks to certain "points" if the player is far away from him. If the player gets close to him, the enemy follows the player. The problem is that after chasing the player, when he escapes, the enemy should walk back to the "points".

Now I see the enemy object shaking and walking far away from the expected direction?!

public class enemyscript: MonoBehaviour {

    public Transform target;
    public Transform[] waypoint; // points
    NavMeshAgent ePath;
    private int farPoint = 0;
    public float elife = 100f,distance,look_range = 20.0f;

    // Use this for initialization
    void Start () {
        ePath = GetComponent<NavMeshAgent>();
        ePath.speed = 2;
    }

    // Update is called once per frame
    void Update () {
        distance = Vector3.Distance(gameObject.transform.position, target.transform.position);

        if (ePath.remainingDistance < 0.5f)
        {
            nextpoint();
        }

        if (distance < look_range)
        {
            attack();
        }
    }

    void attack() {
        ePath.SetDestination(target.position);
        ePath.speed = 6;
    }

    void nextpoint() {
        if (waypoint.Length == 0)
            return;
        ePath.destination = waypoint[farPoint].position;
        farPoint = Random.Range(0, waypoint.Length);
        ePath.speed = 2;
    }
}

sentences:
Object oriented approach to debug mode I'd like to introduce a way to turn off/on debug messages and in-game tooling (tweak menus, for example) without non-game related branches, e.g:

if(DEBUG_MODE) {
    // show tweak menu

    // some message
    console.log("In this function");
}

Is there a more reusable approach to this problem?

sentences:
Can't make sprite collide with tilemap made with Tiled I'm a newbie who just started learning phaser.

I have created a tile map with Tiled.

It is composed of two tiled layer: background & collision.

In collision layer I put some walls.

And in the game code,

I have loaded tilemaps, create them, and they shows perfectly.

Then I set the collision, and sense the collision in update();

I think it should make the sprite collide with wall, but it didn't..

I tried adding "collison" properties in Tiled as I found from some tutorials, but it didn't work either..

Can someone help me?

Below is the critical part of the collision code.(And Also I have all my codes packed and you can download with below hyperlink.)

//load tilemaps in preload.
this.load.tilemap('zombieset', 'assets/tilemaps.json', null, Phaser.Tilemap.TILED_JSON);
this.load.image('tiles', 'assets/tileset.png');

//start physic systems
this.physics.startSystem(Phaser.Physics.ARCADE);

//create tiles, and it shows perfectly.
this.map = this.add.tilemap('zombieset');
this.map.addTilesetImage('tileset1', 'tiles');

//set collision.
this.map.setCollision(1);
this.layer = this.map.createLayer('background');
this.layer = this.map.createLayer('collision');
this.layer.resizeWorld();

//sensor collison in update()
this.physics.arcade.collide(this.asuna, this.layer);

PS. I have my all code & img & json packed here... Thanks~

https://db.tt/AAdpu3zd

sentences:
How to make the main menu screen fade out when the game starts in libGDX? I am creating the main menu of my game, and I want the main menu screen to disappears with a fade out. I thought that if I used a Stage to make the menu and added buttons as actors, the menu would work...

But I get the following problem: If I add the fadeOut(1) in the click event of the button used to start the game, instead of having the whole screen fade out, only the buttons of the menu disappear. Probably using Stage is the wrong way to make menus, and I do not know the right way ...

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.phillips.mrbulb.MrBulb;

public class MenuState extends Estado {
    private Stage menu;
    private Texture fondo;
    private Drawable empz, instr, acrc, slir;
    private ImageButton empezar, instrucciones, acerca, salir;
    public MenuState(GameStateManager gsm) {
        super(gsm);
        fondo = new Texture("fondo_temp.png");
        empz = new TextureRegionDrawable(new TextureRegion(new Texture("Empezar.png")));
        instr = new TextureRegionDrawable(new TextureRegion(new Texture("Instrucciones.png")));
        acrc = new TextureRegionDrawable(new TextureRegion(new Texture("Acerca.png")));
        slir = new TextureRegionDrawable(new TextureRegion(new Texture("Salir.png")));
        empezar = new ImageButton(empz);
        empezar.addCaptureListener(new ClickListener(){
            public void clicked(InputEvent event, float x, float y){
                menu.addAction(Actions.fadeOut(1));
            }
        });
        empezar.setPosition(MrBulb.ANCHO/2 - 90,MrBulb.ALTO/2);
        instrucciones = new ImageButton(instr);
        instrucciones.setPosition(MrBulb.ANCHO/2 - 80,MrBulb.ALTO/2 - 90);
        acerca = new ImageButton(acrc);
        acerca.setPosition(MrBulb.ANCHO/2 - 62,MrBulb.ALTO/2 - 180);
        salir = new ImageButton(slir);
        salir.setPosition(MrBulb.ANCHO/2 - 33,MrBulb.ALTO/2 - 267);
        menu = new Stage();
        menu.addActor(empezar);
        menu.addActor(instrucciones);
        menu.addActor(acerca);
        menu.addActor(salir);
    }

    @Override
    public void update(float dt) {
        Gdx.input.setInputProcessor(menu);
        handleInput();
    }

    @Override
    public void handleInput() {

    }

    @Override
    public void render(SpriteBatch batch) {
        batch.begin();
        batch.draw(fondo,0,0,MrBulb.ANCHO, MrBulb.ALTO);
        batch.end();
        menu.act(Gdx.graphics.getDeltaTime());
        menu.draw();
    }

    @Override
    public void dispose() {
        fondo.dispose();
    }
}

What would be the correct way to make a menu for the game? Or, if using Stage, what would be the right way of coding it?

sentences:
Restricting body movement withing a specific length while dragging a gameobject in unity private void OnMouseDrag()
{
    Vector3 screen_sp=new Vector3(Input.mousePosition.x,Input.mousePosition.y,screen_space.z);
    Vector3 cur_pos=Camera.main.ScreenToWorldPoint(screen_sp)+offset;
        if(pendulum_object.gameObject != null && pendulum_object.gameObject.rigidbody!=null)
        {
                transform.position=cur_pos;
                    Debug.Log ("Pendulum is being dragged left"+transform.position);
                    Debug.Log("Mouse position is:"+Input.mousePosition);
                    Debug.Log("Current position is:"+cur_pos);
        }
}

The problem is:The dragging of game object must be restricted to the length of string.
The pendulum is joint using hinge joint to the world.

sentences:
"Invalid call. Nonexistent function 'travel' in base 'Nil'."? I was perfect as I could possibly be with this code but for some reason every time I try to play the game it just breaks. It says "Invalid call. Nonexistent function 'travel' in base 'Nil'." So I'm pretty sure I gotta reinstall Godot because there's legit nothing wrong with the code. I triple checked and it should be working just fine. The issue is with the onready var animationState but that doesn't make sense because there's nothing wrong with that line of code. No typos, no anything. I just want the animations to play when they are moving and not moving. Can someone please tell me what the heck is wrong with this before I throw my computer out the window? Thanks.
extends KinematicBody2D

const ACCELERATION = 500
const MAX_SPEED = 80
const FRICTION = 500

var velocity = Vector2.ZERO

onready var animationPlayer = $AnimationPlayer
onready var animationTree = $AnimationTree
onready var animationState = animationTree.get("perameters/playback")

func _physics_process(delta):
    var input_vector = Vector2.ZERO
    input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
    input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
    input_vector = input_vector.normalized()

    if input_vector != Vector2.ZERO:
        animationTree.set("parameters/Idle/blend_position", input_vector)
        animationTree.set("parameters/Walk/blend_position", input_vector)
        animationState.travel("Walk")
        velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELERATION * delta)
    else:
        animationState.travel("Idle")
        velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)

    velocity = move_and_slide(velocity)

sentences: Radiosity lightmap generation Is there any working C++ source code for a lightmap generation algorithm using Radiosity or any other GI system? I've found technical papers only, but I can't really find any implementation.

sentences:
Unity blocked after changing Time region I reinstalled Windows then Installed Unity. Then I changed my timezone from US Pacific to Europe where I actually live. Unity got blocked: "Expired licence" even though I use the free version. https://forum.unity.com/threads/expired-license-on-free-version.90072/

If I change my timezone back to US Pacific Unity works (Took me 2 hours to figure out it was the timezone btw). I tried reinstalling Unity from scratch, didn't work. How can I change timezone back to Europe without locking up my Unity licence?

sentences:
C# 2D Game Design/Architecture Question I am developing a 2D game for windows phone using C# and XNA. I have a list of screens managed by an engine. each screen has a list of components like 'camera', 'skyBackground', 'landBackground', 'units' and so on. All those components inherit from an interface 'IComponent' which has the following:

public interface IComponent
{
    void Initialize();

    void Update();

    void Draw(Camera camera, Color tint);

    BoundingBox BoundingBox { get; }
}

This has it advantages and disadvantages. It unifies all game objects so i can treat them the same, but creates some harmless but still annoying issues like having plenty of empty initialize functions, or a camera with an empty draw method, or a UI class that doesn't need the camera as a passed in parameter to draw in the 'Draw' function but takes it anyways and so on.

I then thought of creating a number of interfaces like 'IUpdate', 'IInitialize', 'IDraw', 'IBoundingBox' and having my screens store a list of 'object' rather than a list of 'IComponents', and then in the update method i would do as follows:

foreach object obj in objects
    if(obj is IUpdate)
        ((IUpdate)obj).Update();

But I don't know how the 'is' command works behind the scenes, maybe its a costly feature which shouldn't be called each frame for all objects in each loop.

So am not sure what to do here, should I accept a unified interface with the few currently harmless kinks it introduces or use my 2nd idea? or maybe you could suggest another alternative?

Thanks a lot

sentences:
A system that figure out the fastest (not shortest) navigation method between points for 2D spaceship with 2 axes propulsion I am working on a space themed game with space being a 2D pane. The player issue order by clicking on the coordinate for his/her ship to navigate to a certain point on the  pane.
The player ship can:

Propel forward and backward
Strafe starboard and port
Yaw starboard and port

The ship's performance on each direction varies greatly depending on configuration. Some may move faster on sides and back directions than they do forward direction.
I have combined A* and PID control for navigation but couldn't help but noticed that in many occasions where the ship could have accelerate to the full speed and turn towards the target to reach the target faster, it instead turns in place while strafing slowly until it faces the destination before accelerating.
I would like to add another calculation that let the ship knows which navigation approach it should take to minimize the time to reach the target but I have no idea which field of study I should look into or if there is a quick win scenario I could use to achieve an expected outcome.
Please kindly recommend and thank you very much in advance.

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:
How do I determine the position of one vector relative to another? I'm making a game for Kinect in Unity which tracks hand movements. I have the player's root position and the position of their fist stored as 3-dimensional vectors (Vector3 in Unity), but they're both in world space.

How can I determine the location of the player's fist relative to their root position?

sentences:
How to make a moving platform in Godot not be affected by collisions? I am trying to make a moving platform in Godot (for a 2D platform game, but I suspect the issue would be similar in 3D).
Basically, both my player and my platform are KinematicBody2D, and they move via the move_and_slide() method. The documentation says:

You can use this to make moving or rotating platforms, or to make nodes push other nodes.

This seems to fit my use case. However, when the player collides with the platform, the latter will be affected. For example, if the player stands on top of the platform, it will slowly start going down. I don't want that, I want the platform to move in a fixed fashion no matter what is throw at it (and if the player stands in the path of the platform for example, the player should be pushed).
How can I solve this? I was thinking about using a StaticBody2D for the platform, but the documentation says:

A StaticBody2D is a body that is not intended to move.

So I am not sure if this is the correct solution. It seems that the move_and_slide() method has some additional parameters, such as infinite_inertia, but the documentation is not very clear to me as to what they do exactly.

sentences:
libGDX: Linking 3D scene from 2D screen Using libGDX I have created a few 2D screens, such as a splash screen and a main menu, and also created a 3D scene which I want to be able to load when clicking a button on the main menu.
I know how to add a listener but I don't know what command to use to show the 3D scene on the screen. If I use setScreen(new World3D) (or other similar extended methods) it gives me:
 World3D cannot be cast to com.badlogic.gdx.Screen

What I want to know is how to get from the 2D screen to the 3D scene. Do I wrap the 3D scene inside the screen or am I doing it right but my World3D class is not set up properly?
Here is a pastebin of my World3D class in case that is the problem.

NOTE: The classes are in separate sub-packages but the proper imports have been added in the required classes.

sentences:
Transparency problem, phong model It's the first time I'm trying to implement the Phong lighting model. I'm pretty sure everything is working fine.

I was experimenting using different materials, meaning I played with Kd,Ks,Ka and Ns values when I came across this problem.

Whenever I use a material with alpha value less than one I get this weird result :

At first I thought it has to do with the normals of the model since they are all supposed to point away from the model but it doesn't seem to be the case.

Any ideas?

sentences:
What are some low-level performance tweaks for iPhone games written in c? I'm interested in some performance tweaks for a relatively simple OpenGL ES based 2D iPhone game.  What performance tweaks have you found?  The performance of the game is pretty good on most devices (3G, 2nd gen touch, and iPhone 4)... But I still want to give the user the best experience possible.

p.s. I'm still using OpenGL ES 1.1

sentences:
Create an 2d Isometric map with tiles? I'm creating a 2D Tower Defense game and I want it to be isometric. I'm creating it on the XZ plane in Unity(3D mode). I need the map to be based on tiles so I can seperate the monsters' path and the tiles where the player will build the towers on because they will have different scripts attached to 'em. My game will just need one map so I dont need any functionalty like randomizing tiles etc. I've tried using Tiled however, the Tiled2Unity converter doesn't support Isometric maps.

With that said, how do I create a isometric map? Is there any program other than Tiled? Is there any guides or scripts that explain how to create one with different tiles etc, so I can create a path. I've tried looking for something that works but with no results/I dont understand what do do.

This is basicly the look(the angle/path) I want to achieve:

sentences:
Managing Game Entity coordinates In my Game I'm currently have "Scene Coordinates" which are the X,Y coordinates relative to a Game Scene.

In that Scene there are Game Entities, let's say there's a GameEntity A in x=100.0, y=100.0 ( scene coordinates )

Which is the best way to have "Entity Coordinates" so that from GameEntity A point of view, he's standing at x=0.0, y=0.0 with OpenGL transformations?

In that way if I apply something like

glRotatef(angle, 0, 0, 1)

The entity will rotate around it's own origin and not the scene "global" origin.

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:
Rotating certain particles in a particle system in Unity I'm working on a visual effect using particle systems.
I'm trying to rotate newly created particles according to some object's velocity at that time.
Currently, I'm rotating the entire particle system and I use the "Align To Direction" option in the "Shape" options.
It works fine, until I change the velocity of the object - then it rotates every existing particle too.
How can I rotate particles when they are created?

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:
Unity's 'Ambient' Occlusion occludes everything. How to do it better? I'm experimenting with custom AO solutions for Unity. While looking at the source for their built-in SSAO effect, I noticed the shader is doing this:

half ao = tex2D (_SSAO, i.uv[1]).r;
ao = pow (ao, _Params.w);
c.rgb *= ao;

So basically it's darkening the whole image as a post-process where the AO term is <1, specular and diffuse components included. I'd like my version to only attenuate the ambient component while leaving the direct lighting untouched.

So how to go about this? One option would be to go to the full on deferred renderer (not legacy light pre-pass), compute the AO texture after the G-buffer pass, and incorporate it into a custom shader to do the final lighting pass. But are there simpler options that would work with light pre-pass or even forward rendering?

sentences:
Multilevel 2D grid graph and A* I've coded up a little grid based dungeon game. Everything working quite nicely in a Tile[,]. The AI uses basic GOAP for tasks and A* for moving around. Tile reachability is done using a floodfill.

Thinking about what my next step would be, I decided to change the art style from being the typical dungeon to a more sci-fi approach and thought it'd be great to have multiple levels.

This is where I ran into a problem because A* in a 2d grid I understand. But adding extra levels makes it a wee bit harder. My initial thoughts would be to add connections to the next levels in 'stairs' or 'elevator' tiles and adding these to the neighbor list of a Tile for evaluation by A*.

But this throws my heuristic for a loop. I'm using Manhattan distance.

TL;DR: How should I improve my heuristic for multi level path finding?

sentences:
Maintaining facing direction at the end of a movement I want to make my 2D top-down walking animation stop and revert to the idle animation while continuing to face in the same direction as the previous movement.
For example, when I go up then stop, my character should continue to look up. If I go down, it should continue to look down.
I use lastmoveX and lastmoveY floats for idle and for walking I use moveX and moveY floats. moveX and moveY change when I move with the joystick, but lastmoveX and lastmoveY do not change, and I don't know how to fix this.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody2D myRB;
    private Animator myAnim;
    public Joystick joystick;
    public MoveByTouch controller;

    [SerializeField]
    private float speed;

    // Use this for initialization
    void Start ()
    {
        myRB = GetComponent<Rigidbody2D>();
        myAnim = GetComponent<Animator>();

    }

    // Update is called once per frame
    void Update ()
    {
        myRB.velocity = new Vector2(joystick.Horizontal, joystick.Vertical) * speed * Time.deltaTime;

        myAnim.SetFloat("moveX", myRB.velocity.x);
        myAnim.SetFloat("moveY", myRB.velocity.y);

        if(joystick.Horizontal == 1 || joystick.Horizontal == -1 || joystick.Vertical == 1 || joystick.Vertical == -1)
        {
            myAnim.SetFloat("lastMoveX", joystick.Horizontal);
            myAnim.SetFloat("lastMoveY", joystick.Vertical);
        }

    }
}

sentences:
Difficulty understanding integration of Lua with C++ Game Engine I'm starting work with the Allegro C++ library to get some lower level game development experience after working mostly with Unity. I've read about how Lua is a popular scripting language choice for game developers, but I have never used it before. I've been trying to work through how Lua might be integrated with a game engine in my head, and I've ran into some conceptual problems.

I imagine the simple scenario where I have a block that I want to move to the left at a certain speed for 2 seconds. I imagine that something like the Draw() method would sit nicely in the game engine in C++, where the actual command to move the block, being a fairly specific one, would originate in Lua.

I have trouble imagining where the transition between the languages is. I've read that calling to Lua every frame of the Game Loop isn't very performant, so that means that unless Lua can keep track of the movement timer asynchronously and interrupt C++ execution when the timer runs out, I would have to track the timer in the C++ engine. I would need a method like MoveForSeconds(direction, time) implemented in C++. At that point, Lua calling my MoveForSeconds() method is little more than a passthrough, and seems to defeat the purpose of using a scripting language.

What am I misunderstanding here? Or is my example too myopic, and the uses of Lua become more evident on a larger scale?

Thanks

sentences:
What AI algorithm to use to find hidden shapes in a Battleships-like game I'm developing a game similar to Battleships, only using different shapes. A single type of shape will be used within a game session, by both the human player and AI. There will be several objects spread out on the map (10x10 grid).

I want to find a way to guess the location and position of the human player's "ships" after I have one or more hits.

I'm aware that there will be a lot of randomness involved, but I want the AI to be smart enough to pose a challenge to the human player.

I'm thinking about having the AI "sweep" the map and evaluate each possible shape, somehow assign a probability to a certain position and maybe refine the guess by additional sweeps (thus a higher difficulty). But I need some ideas on what logic to use, I don't want to check every possible combination.

Thank you.

sentences:
Why does the Debug.DrawRay return these weird lines I am working on a small feature of a 2D mobile game where a indicator points towards a object in 2D space. I am trying to make the indicator turn towards the object, however the vector I am trying to construct that points towards the object is off a bit.

When I decided to draw a debug ray from the indicator position to the objects position it was also off a bit. I then decided to draw the debug ray the other way around which gave me a different line. If my understanding is correct, if you switch the starting point and the end point of a ray the line should stay exactly the same right?

using UnityEngine;
using System.Collections.Generic;

public class Tracker : MonoBehaviour {

public GameObject goToTrack;
private List<Renderer> renderers = new List<Renderer>();

void Start(){
    foreach (Transform child in transform) {
        renderers.Add (child.gameObject.GetComponent<Renderer>());
    }
}

void Update () {

}

void OnGUI(){
    Vector3 v3Screen = Camera.main.WorldToViewportPoint(goToTrack.transform.position);

    // if the target is within the viewable screen the indicator shouldn't be rendered)
    if (v3Screen.x > -0.01f && v3Screen.x < 1.01f && v3Screen.y > -0.01f && v3Screen.y < 1.01f) {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }
    }
    else
    {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }

        v3Screen.x = Mathf.Clamp (v3Screen.x, 0.01f, 0.99f) -0.04f;
        v3Screen.y = Mathf.Clamp (v3Screen.y, 0.01f, 0.99f) -0.04f;
        transform.position = Camera.main.ViewportToWorldPoint (v3Screen);

        Debug.Log ("Target planet position: " + goToTrack.transform.position.ToString());
        Debug.DrawRay(Camera.main.ViewportToWorldPoint (v3Screen), goToTrack.transform.position, Color.red, 5.0f);
        Debug.DrawRay(goToTrack.transform.position, Camera.main.ViewportToWorldPoint (v3Screen), Color.green, 5.0f);

        //Debug.Log ("Tracker angle: " + angle);
        //transform.Rotate(0,0, angle, Space.Self);
    }

}
}

Output:

UPDATE:
I have noticed that when i substract the second vector with the first vector of the Debug.DrawRay it draws the ray like i want it to.

From this I am taking that the Debug.DrawRay function draws the second vector on top of the first vector. (kind of like the the first vector is Vector(0,0,0) and the second vector is the actual ray you want to draw)

sentences:
Pixel Picking vs Raycasting I was recently introduced to a way of picking in OpenGL known as pixel picking (or color picking).

From my understanding, how this is done is that the scene is rendered to the back buffer with a different rgb color representing each object. By reading the color of the pixel clicked by the cursor, the relevant object can be picked. The immediate issue I can think of when using this method is that during the picking process, the scene have to be rendered 2 times, once for picking and another time for display. Additonally this also limits the it to 256^3 unique objects for picking.

With this, I would assume this is a much more accurate way of "raycast" than to use physics raycast. By placing a camera at the raycast source, render once for "raycast" picking, and resetting the camera to the original position for normal render. This would reduce issues of "bullet hitting invisible walls" as its not dependent on physics collision, which can be affected by convex hulls for complex meshes.

Is there any reason why this method is not used? Could it be over complication? Or perhaps it is what is happening behind the scenes in raycasting?

As an example where pixel picking might be better would be when raycasting through a wire fence. Most wire fence models are just textures with a transparent channel, giving the illusion of a wire fence while saving on geometry by having 1 single plane. Using color picking, what the player see is what the camera picks. Whereas in raycast, the raycast will not shoot through the plane unless it doesnt collide with the plane at all.

sentences:
PyGame QIX clone, filling areas I'm playing around with PyGame.

Now I'm trying to implement a QIX clone.

I have my game loop, and I can move the player (cursor) on the screen.

In QIX, the movment of the player leaves a trace (tail) on the screen, creating a polyline.

If the polyline with the screen boundaries creates a polygon, the area is filled.

How I can accomplish this behaviour ?

How store the tail in memory ?

How to detect when it build a closed shape that should be filled ?

I don't need an exact working solution, some pointers, algo names would be cool.

At start, there is only the gray border, where the player can move his cursor around.

First scenario:

The user moves his cursor from point A trough point B, drawing the red multiline until point C. At this point, because of crossing the border, the point A should be connected with point C automaticaly, creating a polygon, which should be filled (that orange stuff on my drawing). Filling the polygon is damn simple in PyGame, because I provide the sequence of points,and PyGame cares of the rest.

Second scenario:

The user moves on the border to point D, from where he draws a line to point E. Because he is crossing the line of the previous polygon, and with his lines and the border another polygon can be created, it should be filled too. (the green one).

Third scenario:

The player moves further on the polygon (he can move on existing polygon lines), and draws a line from point G to point F. Here again, because of the border and the existing lines, another polygon should be filled (the blue one).

sentences:
Unity Mirror Network Transform not working I am having an issue with Mirror's network transform component in unity. Players cannot see each other move, and in the inspector window only the host's player moves (this is not updated to the connected player though). In the inspector window you see a sphere moving and facing in the direction of the connected player (I did not program this so it must be Unity trying to tell me something) as per the picture below.

Any help is much appreciated as there doesn't seem to be anybody that I can find online with a similar problem.

Thank you!

sentences: Scripts enable and disable on Random time unity? In unity game I've put two scripts in single object i want to these scripts are enable and disable on random time so how can do?

sentences: How do I get started making Android games? I am new to game development. I am interested in developing 2D games for the Android platform. What is the best place to start with (i.e) What are the basics and how to proceed? I already have programming experience in Java but don't have any experience with graphics or animation.

sentences:
'Unblock' / 'Yellow Out' game questions I would very much like to build a game that is known as 'Unblock' or 'Yellow Out'. It is a puzzle game in which the task is to move a car out of a parking space by moving other cars in certain directions.

These are links where the game can be played:

Yellow Out
Unblock

My questions concerning this game are:

Is this game actually licensed? I see it's available under two names (perhaps even more). Does this mean the game idea can be used freely?
Is there an article about it? I have not been able to find it on Wikipedia. I would like to gather some information about the game so as to understand more details of it.
Is there some database with puzzles available? I can just check the puzzles of existing games, but that's a pain because I have to finish a level to get on to the following one. I was wondering whether there is a general list of puzzles somewhere.

Thanks!

sentences:
How to render gameobjects with same size and same position in unity canvas can be fixed for all screen sizes but I want to fit  gameobjects which is not in canvas, for all sizes of screen.

This is the transform of my game object

The game object's size and position variation

My question is how to render the gameobject with same size and same position for all screens

sentences:
How to write "Hello World" for N64 purely from scratch? As an experiment I want to code a "Hello World" program for N64 using only assembly code, using no headers, tools, helper files, etc.

I just want to write the assembly code bare bones from absolute scratch, assemble it and have it run through a demanding emulator that can show me the output.

I can't find enough info on how to send the correct data to the RSP for video output though. Can anyone offer me a hand here? Not on helping me program, but with information regarding N64's RSP and how to program it to display text, etc.

sentences:
HTML5 game obfuscation HTML5 games have viewable source code. Is there a way to make them like swf file?

How to hide the game algorithm?

What do you think of the Firefox JavaScript Deobfuscator Plugin and obfuscation?

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:
Drawback of using multiple bind flags As far as I understand Direct3D 11 I have to specify certain BindFlags in order to use a resource in a specific stage of the pipeline.

From my experience some combinations are more common like BindFlags.RenderTarget | BindFlags.ShaderResource for post processing effects. And I guess it could also be quite handy sometimes to set the ShaderResource flag for DepthStencilBuffers.

So I would like to know what is happening behind the scenes. What is the drawback of simply setting all of them? Would it be a minor performance hit? Or is as bad as an individual copy of the resource for every different flag?

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:
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: Transparency issues Unity5 I made a potion that displayed and rendered perfectly in 3DS max. When I imported it to Unity it didn’t render correctly as the transparency was all over the place. I first imported it with a png texture with a separate png map for the alphas. I then tried using a .tga and a .psd file with alpha channels set up within the file but I got the same issues happen with both file formats. Does anyone know how to fix this I cannot seem to work it out.

sentences:
How to rotate a skybox cubemap using Unity Shadergraph @Seyed Morteza Kamali solved his own problem of rotating a mesh cubemap with shadergraph here: How can I rotate cubemap in shadergraph?
However, I have a starry night cubemap inside my Skybox shader done in Unity Shader Graph, and as there is no way to directly attach a script to a Skybox material, I've been accessing the skybox material and the shader via external script. I've been using the Bolt visual scripting, and with this script, it is fairly easy to access other properties of the skybox but not the rotation (4x4 matrix). It is possible to access floats, vector2's, texture maps and even the Cubemap, but even if I have set the cubemap rotation, which to my knowledge has to be done with a Matrix 4, as an Exposed property, when trying to access it, e.g with FindPropertyIndex it gives the value -1, indicating that the property is not found.
Edit: ok, I found this in the Unity documentation:

Matrix parameters are not exposed in the material inspector, but can be set and queried with SetMatrix and GetMatrix from scripts.

As far as I understand the documentation, the example assumes a mesh renderer, which the skybox doesn't have. Another idea would be to use 3 vectors, which could be exposed and then apply the rotation somehow to them at the same time, I did some tests in this, but all I managed to create was to distort the cubemap.
Again I am not trying to rotate the entire skybox, but just a cubemap inside the skybox shader – this would allow different rotations to daytime clouds and nighttime stars.
Would be best if everything could be done inside ShaderGraph, with the speed and axis values published as properties. A custom function perhaps? I am using URP 7.2.0 and Unity 2019.3.0f6.

sentences:
In Inform 6, what is LibSerial and how does it factor into action-based dispatching? By no small amount of pain, I have discovered that the following  Inform 6 source doesn't work as expected: instead of calling the right branch of Bar.after based on the current action, it always prints Called from Foo:

Global action;

[ R_Process a;
    action = a;
    indirect(#actions_table-->a);
];

Verb 'foo' * -> Foo;
Verb 'baz' * -> Baz;

Object Bar "bar"
  with after [;
    Foo: "Called from Foo";
    Baz: "Called from Baz";
    ];

[ BazSub;
    print "[Baz]^";
    Bar.after();
];

[ FooSub;
    print "[Foo]^";
    Bar.after();
];

[ Main;
  <foo>;
  <baz>;
];

Running it produces the following output:

[Foo]
Called from Foo
[Baz]
Called from Foo

However, if I prepend the following three lines to the Inform script above, then it works as expected:

Constant LibSerial "foo";
Global reason_code;
Property additive life;

Now the output becomes:

[Foo]
Called from Foo
[Baz]
Called from Baz

The three lines are all important:

Omitting the definition of the LibSerial constant (i.e. keeping the other two lines only) causes Called from Foo to be printed from both callbacks.
Omitting the declaration of the (as far as I can see, unused) variable reason_code gives the following compile-time error:

"<constructing output>", line -65535:
Error:  No such constant as "reason_code"

Omitting the declaration of the life property causes a similar compile-time error:

"<constructing output>", line -65535:
Error:  No such constant as "life"

So basically my question is, what is going on here? What is the effect of defining LibSerial and why does it need the life property and the reason_code global variable to be declared?

sentences:
How do I simulate the mouse and keyboard using C# or C++? I want to start develop for Kinect, but hardest theme for it - how to send keyboard and mouse input to any application. In previous question I got an advice to develop my own driver for this devices, but this will take a while.

I imagine application like a gate, that can translate SendMessage's into system wide input or driver application with API to send this inputs. So I wonder, is there are drivers or simulators that can interact with C# or C++?

Small edition: SendMessage, PostMessage, keybd_event will work only on Windows application with common messages loop. So I need driver application that will work on low, kernel, level.

sentences:
Only do 1 SphereCastAll in Unity3D? I just want to make one SphereCastAll with a center and a radius.

I don't want unnecessary sweeping in a desired direction with a desired length. How is this achievable? My solution is pretty unreliable, I think.

var hits = Physics.SphereCastAll(center, radius, forward, 0.0001f, mask);

sentences:
Playstation 4 OpenGL ES support (or Xbox) I know that the Playstation 3 supported at least OpenGL ES 1.0, and the Vita OpenGL ES 2.0. But what about the Playstation 4 (and/or the new PS4 Pro)? Does anyone know for certain if it has native support for OpenGL ES (that is, without using a compatibility/translation layer like ANGLE)?

Because it isn't backwards compatible with regular OpenGL, it'd be helpful to know if this platform supports any version of the OpenGL ES API.

I'm also curious about the Xbox One/Scorpio, although I'd be surprised if they had nativesupport for OpenGL at all.

sentences:
When importing a character to Unity, textures and meshes don't appear I'm relatively new to Unity, and I'm left with doing this as my last step towards my task - importing my animated character to a game engine and program the movements.

The problems that I have noticed are the missing textures and meshes, you can see in the first picture how it should look like in Blender, and what results I get in Unity:

The apple here doesn't have any holes, I think only one material got imported, and it doesn't look right. Textures are missing, the leaf near the stem is completely filled with gray texture. At least the animations work perfectly...

Download link to my .blend file - https://pasteall.org/blend/6c14ec0d9446404b81251585f83f3551

sentences:
How to control a spaceship near a planet in Unity3D? Right now I have spaceship orbiting a small planet. I'm trying to make an effective control system for that spaceship, but it always end up spinning out of control. After spinning the ship to change direction, the thrusters thrust the wrong way.

Normal airplane controls don't work, since the ship is able to leave the atmosphere and go to other planets, in the journey going "upside-down". Could someone please enlighten me on how to get thrusters to work the way they are supposed to?

sentences:
Rotating hitboxes in PyGame? I'm using pygame.rect.colliderect() to check hitbox collision between sprites in my game, but now that I'm rotating the sprites, I'm realizing I can't do this because there's no way to rotate a PyGame rect, so the hitboxes are way off now.

How should I handle collision in a game with rotating sprites if I don't want to use masks or pixel perfect collision? Is there a way to make a hitbox that rotates with the sprite?

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:
Unity: Adjusting the camera so that the scene view and the game view look same when I make any object I'm able to see that by other side in the game view. And this troubles me in adjusting the objects.

So can anyone help me to adjust the main camera in such a way that views of both game and scene look the same?

Thanks in advance.

sentences:
Unity3d UnityWebRequest EscapeURL standard does not match Swift url encoding. How to decode it? How should I decode escaped URL by unity in Swift?

I am developing a game with Unity3d. Something MMORPG. With server implemented by me in Swift under Kitura framework
A framework doesn't matter that much. It is more about swift and Unity itself.

Let me describe the problem here.

Unity

UnityWebRequest.EscapeURL("First Last")

Escapes string with encoding used in the application/x-www-form-urlencoded content-type: https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
Which produce string First+Last where + maps to " " space.

Swift:

import Foundation

var str = "First+Last"
print(str)
print(str.removingPercentEncoding)

The character used on this string + isn't considered as a percentage encoding in the standard used by swift. It would be if the character escaped as this would be represented by %20.

So my server and client ended up with different string values.
Later on returned from one to the other weren't equal. Which ended up considering them as two different clients.

sentences:
Handling player logoff and logon in a persistent world without breaking immersion One problem I've never seen fixed in any persistent online game is how to handle player logon and logoff without the characters just popping in and out of the world.  My first thought is to simply make a player's offline state as their character being asleep, but that doesn't make sense in the event of a disconnect and not an intentional logoff.

How would you fix this, if you would even bother fixing it at all?

sentences:
Detect which monitor an SDL window uses I have some SDL code that, before creating a Window and a Renderer, detects the display DPI using SDL_GetDisplayDPI, to properly scale textures late on for different types of monitors (for instance my MacBook Pro's monitor returns a DPI of 258, while my external Dell monitor returns 93).

When I use 2 monitors, SDL_GetNumVideoDisplays properly returns 2, but I couldn't find any function in SDL that would get me which monitor the window is running in, to call SDL_GetDisplayDPI with the correct index, nor any way to detect when the window is dragged from one monitor to the other.

Is there a way to do those things in SDL, or is there a tutorial somewhere that would explain how to do that (hopefully in a platform-independent way)?

sentences:
How to make a game object scale up from another game object I have a GameObject. I'm trying to make another GameObject grow in scale from touching this GameObject, and when a set amount of scale is reached, destroy this GameObject. My problem is that when I access ScaleUp, it dosn't add any scale to the other GameObject.

How do I scale another GameObject? Here is my ScaleUp script:

using UnityEngine;
using System.Collections;

public class ScaleUp : MonoBehaviour
{

    public GameObject Player;
    public PlayerMovement PlayerScript;

    private float playerScaleX;
    private float playerScaleY;

    public float scaleUp = 10.0f;

    void Start()
    {
        Player = GameObject.FindGameObjectWithTag ("Player");

        PlayerScript = Player.GetComponent <PlayerMovement>();

        playerScaleX = Player.transform.localScale.x;
        playerScaleY = Player.transform.localScale.y;
    }

    void OnTriggerEnter2D (Collider2D other)
    {
        if (other.tag == "Player")
        {
            playerScaleX += scaleUp;
            playerScaleY += scaleUp;

            Debug.Log ("GROW");
        }
    }
}

sentences:
Orthogonal projection matrix affecting z-buffer on one device I am experimenting using Matrix.orthoM for a isometric projection, rather than Matrix.frustumM.

On one device, the z buffering does not appear to be working correctly and I get a cut away effect seen below on the wheels in particular. Both devices work fine with frustum projection.

Sorry not much to go on, just hoping someone will just be able to take one look and recognise the problem.

Sony Xperia Z:

LG P920:

Sony Xperia Z:

LG P920:

sentences:
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:
How to fix this elbow issue when converting to humanoid Good day, how can I fix this? it looks fine in Blender and generic but not when I switch to humanoid. There is no error on rig tab but there are in animation tab under the import message that say "is in between humanoid transforms and has rotation animation that will be discarded" and I can't seem to fix it.
Here are the things I've tried so far:

Put the right bones to the right slots.

Enforce T-pose.

Translation DoF.

Clicked Generate Retargeting and applied it.

sentences:
Clipping a SpriteBatch Draw() in XNA Is there any way to enable a temporary clipping mask in XNA while using a SpriteBatch? I'm drawing a bunch of Texture2D objects and Sprites in a given rectangle, and I want to make sure that said objects aren't drawn outside of that rectangle. If it's of any help, I'm already drawing my content within a Viewport, I'm not sure if I can draw, for instance, in another Viewport within that Viewport.

Illustrative image of what I'm trying to accomplish:

sentences:
How to calculate a direction vector for camera? I have a vector that describes change in movement, and I have a 3d-vector, m_rot, that describes a rotation given to an object.
I want to calculate a direction vector using both this data.
How to achieve that?

I tried to multiply the components of a direction vector onto sin and cos of m_rot values, but that gave me nothing.

direction.x = direction.x * ::cosf(m_rot.x);
direction.y = direction.y * ::sinf(m_rot.y);
this->camera_world_pos += direction;

But after that my camera still walks into a simple directions, and not a direction that it looks at.

sentences:
How do I add an "offset" to LookAt? I have created a Third Person Controller.
The camera is behind the player:

I would like to make it so that the player aims at the mouse pointer position.
To do that, I use the following code to rotate the chest towards the position:
        var mousePos = Input.mousePosition;
        mousePos.z = 10; // Make sure to add some "depth" to the screen point
        var aim = Camera.main.ScreenToWorldPoint(mousePos);
        Chest.LookAt(aim);

The hands do not perfectly straightly point forwards, so I need to add an "offset" to the LookAt.
I tried this approach:
var mousePos = Input.mousePosition;
mousePos.z = 10; // Make sure to add some "depth" to the screen point
var aim = Camera.main.ScreenToWorldPoint(mousePos);
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Chest.LookAt(aim);

Of course I do all rotation patching in LateUpdate(). In Update(), it would simply be erased by the animation itself.
It does work, but when the model is rotated around the Y axis, something goes wrong: The offset is "wrong", it doesn't have the same effect.
This surprises me because all I do is rotate the entire model.
So I think this line is not correct:
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Is this not the way to offset the LookAt results?

sentences:
Unity Guitext object always triggering a collision - 2D I have a guitext object which I can drag.  I have attached a 2d rigid body.  I have also attached the collider with the following code:

void setCollider()
    {
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        var boxX = box.width;
        var boxY = box.height;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

I have a sprite with a collider set as trigger.  However, it triggers as soon as the game starts and is not anywhere near the trigger sprite.  It will only trigger the one time when it starts.  My Trigger on my sprite is as follows:

void OnTriggerEnter2D (Collider2D other){
        Debug.Log ("Order Right Arm");
        Debug.Log (other.bounds);
    }

EDIT: based on answer I have changed the size of the collider to account for the pixel/unit difference:

void setCollider()
    {
        float pixelRatio = (Camera.main.orthographicSize * 2) / Camera.main.pixelHeight;
        Debug.Log ("Pixel Ratio "+pixelRatio);
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        float boxX = box.width * pixelRatio;
        float boxY = box.height * pixelRatio;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

Any ideas on how I can get this to trigger only when I drag the guitext over the sprite?

sentences:
How can I write a terrain into a .raw file? I want to generate a terrain through Perlin noise and store it into a .raw file.

From Nehe's HeightMap tutorial I know the .raw file is read like this:

#define MAP_SIZE        1024

void LoadRawFile(LPSTR strName, int nSize, BYTE *pHeightMap)
{
    FILE *pFile = NULL;

    // Let's open the file in Read/Binary mode.
    pFile = fopen( strName, "rb" );

    // Check to see if we found the file and could open it
    if ( pFile == NULL )
    {
        // Display our error message and stop the function
        MessageBox(NULL, "Can't find the height map!", "Error", MB_OK);
        return;
    }

    // Here we load the .raw file into our pHeightMap data array.
    // We are only reading in '1', and the size is the (width * height)
    fread( pHeightMap, 1, nSize, pFile );

    // After we read the data, it's a good idea to check if everything read fine.
    int result = ferror( pFile );

    // Check if we received an error.
    if (result)
    {
        MessageBox(NULL, "Can't get data!", "Error", MB_OK);
    }

    // Close the file.
    fclose(pFile);

}

pHeightMap is one-dimensional, so I don't understand how I would write the x,y correspondence to a height value.  I was planning to use either libnoise or the noise2 function on Ken Perlin's page, to make each value in a 1024x1024 matrix correspond to the height for the point, but the .raw file is stored in a single dimension, how can I make x,y correspondence work there?

sentences:
XNA a Simple 2D Point Light I want to make a 2D Point Light in XNA, I was able to find some helpful information but it is too advance for me, since i know nothing about Shaders

http://www.soolstyle.com/2010/02/15/2d-deferred-lightning

So my best aproximation is use a texture and use alpha blending, but im not happy with this result.

So I was wondering, what is the most simple method to make a simple 2d point light? I'd rather code examples.

sentences:
Should larger Unity Projects use Visual Studio I've worked with several engines and I'm most comfortable with a mature engine, world editor and C++ codebase.

I'm now looking at Unity as a side-project and have mostly been working in Javascript.

Has anyone done a large scale project with Unity and does it require Visual Studio or is sticking to the Javascript approach best?

Are there any big pitfalls with large scale Unity projects or with working with Visual Studio?

Most the stuff I've seen has been focused at smaller Indies or people with little experience.

I should have phrased this as an external IDE, Visual Studio is just my IDE of choice

sentences:
2D Skeletal Animation Transformations I have been trying to build a 2D skeletal animation system for a while, and I believe that I'm fairly close to finishing. Currently, I have the following data structures:

struct Bone {
    Bone *parent;
    int child_count;
    Bone **children;
    double x, y;
};

struct Vertex {
    double x, y;
    int bone_count;
    Bone **bones;
    double *weights;
};

struct Mesh {
    int vertex_count;
    Vertex **vertices;
    Vertex **tex_coords;
}

Bone->x and Bone->y are the coordinates of the end point of the Bone. The starting point is given by (bone->parent->x, bone->parent->y) or (0, 0). Each entity in the game has a Mesh, and Mesh->vertices is used as the bounding area for the entity. Mesh->tex_coords are texture coordinates. In the entity's update function, the position of the Bone is used to change the coordinates of the Vertices that are bound to it. Currently what I have is:

void Mesh_update(Mesh *mesh) {
    int i, j;
    double sx, sy;

    for (i = 0; i < vertex_count; i++) {
        if (mesh->vertices[i]->bone_count == 0) {
            continue;
        }

        sx, sy = 0;
        for (j = 0; j < mesh->vertices[i]->bone_count; j++) {
            sx += (/* ??? */) * mesh->vertices[i]->weights[j];
            sy += (/* ??? */) * mesh->vertices[i]->weights[j];
        }

        mesh->vertices[i]->x = sx;
        mesh->vertices[i]->y = sy;
    }
}

I think I have everything I need, I just don't know how to apply the transformations to the final mesh coordinates. What tranformations do I need here? Or is my approach just completely wrong?

sentences:
Xna rotate around world axis? I want to make it so that either the pitch yaw or roll rotates around the world axis and not the local axis, but I'm not sure how, I've got.

Vector2 mouse_change = new Vector2(mouse_previous.X - mouse_new.X, mouse_previous.Y - mouse_new.Y);
camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), mouse_change.X / 800f);
camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), mouse_change.Y / 800f);

Updating every frame, then I've got.

view_matrix = Matrix.Invert(Matrix.CreateFromQuaternion(camera_angles) * Matrix.CreateTranslation(camera_position));
projection_matrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 0.2f, 500f);

The problem is that if I e.g. change the pitch then change the yaw then the yaw changes through the local axis, I need it to turn around the world axis so that it doesn't matter what the yaw is :/.

sentences:
Invisible mesh. Are my normals, normal? I'm creating this mesh during runtime in Unity3D.

The mesh shape is ok, but as you can see on this screenshot, the mesh is not correctly rendered: it's only rendered when the camera is looking back at the mesh, but I don't want to rotate the mesh or modify the camera position.

I know I can create a simple shader to activate backface culling... But I don't need a custom shader. I want to understand what I do wrong.

All my normals are set to -Vector3.forward:

        normals[vert_idx] = -Vector3.forward;
        normals[vert_idx + 1] = -Vector3.forward;
        normals[vert_idx + 2] = -Vector3.forward;
        normals[vert_idx + 3] = -Vector3.forward;

Are normals the only things involved in this problem? Or should I look to triangles order, vertices order or something?

Thanks.

sentences:
Problem with shooting So what I am trying to achieve is have the player shoot toward the mouse positiion and I have that working but I want the player to have to charge their shot. So if the player just presses the button it only goes a certain distance but if the player holds the button down for a bit it goes farther.

I tried to make a video that kinda explains what I am going for.

This is the code that controls the shooting

public class BowController : MonoBehaviour {

    public GameObject arrow;
    public Transform shootLoc;

    public float force;
    public Camera cam;

    public float chargeMin;
    public float chargeAmount;
    public float chargeMax;

    public bool charging;

    void Start () {

    }

    void Update () {

        Ray cameraRay = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        Vector3 pointToLook;

        if (Physics.Raycast(cameraRay, out hit, 50))
        {
            pointToLook = hit.point;
            Debug.DrawLine(cameraRay.origin, pointToLook, Color.blue);

        }
        else
        {
            pointToLook = cameraRay.origin + (cameraRay.direction * 50);
        }
        transform.LookAt(pointToLook);

        if(Input.GetMouseButtonDown(0))
        {
            charging = true;

        }
        if (charging)
        {
            Charging();
        }

        if (Input.GetMouseButtonUp(0))
        {
            GameObject tempArrow;
            tempArrow = Instantiate(arrow, shootLoc.position, shootLoc.rotation) as GameObject;

            tempArrow.transform.LookAt(pointToLook);

            Rigidbody tempBody;
            tempBody = tempArrow.GetComponent<Rigidbody>();

            tempBody.AddForce(transform.forward * force, ForceMode.Impulse);

            force = 100;
            charging = false;
        }
    }

    void Charging()
    {
        force += Time.deltaTime * chargeAmount;

        if (force >= 500)
        {
            force = 500;
        }
    }
}

And this is the code that is on the arrow

  public Rigidbody rBody;
  public float speed;

    void Awake () {
        flying = true;
    }

    void Update () {
        if (flying)
        {

            //rBody.velocity = rBody.velocity.normalized * speed;
            transform.LookAt(transform.position - GetComponent<Rigidbody>().velocity);
            transform.Rotate(0, 180, 0);
        }
    }

    void FixedUpdate()
    {

        /*
        if (flying)
        {
            transform.rotation = Quaternion.LookRotation(rBody.velocity);
        }
        */
    }

    void OnCollisionEnter(Collision collision)
    {
        flying = false;
    }
}

I am still pretty new to coding so any help is appreciated. Thank you all very much in advance for the help!

sentences:
2d starship combat, hit chances based on bearing and speed (vector)? Thinking about a 2d strategy game, where you move your starships turn by turn and fire guns at each other.

Instead of the traditional approach of "range" lowering hit chances, im thinking about some sort of system that throws vectors at each other to calculate relative bearing and speed to calculate hit chances.

I.e. a fast, small ship is harder to hit than a slow, big chip, but in addition the relative bearing (im thinking: is the target flying straight towards your X/Y = good hitchance, or is it strafing very narrowly, low hitchances depending on speed).

Getting the relative the bearing (angle) on an approaching vessel would be easy using atan2, but how could this be translated it into a hitchance that goes up if the angle is like 330 to 30 degree and goes down if its different (as an example) ?

sentences:
Overuse of Canvas in Unity3D I'm currently trying a new approach on a Card Game in Unity.

To capsuling my Card Prefab i have a root GameObject with the Canvas Component.

I'm highly count on the Canvas behavior which should render things after the main scene rendering.

  Elements on a canvas are rendered AFTER scene rendering, either from an attached camera or using overlay mode.

Before i further proceed, i want to know if there are any disadvantage of this, when my Game Logic approximately generate 100-200 of this GameObjects?

Should the Canvas Component not be overused in Unity?

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:
Can't refer mesh size after using .BakeMesh() in Unity I can't figure out how to refer to the size of a particular mesh.

The mesh is created through .BakeMesh(), then a box collider is added. Unfortunately the box collider has a scale of 1 by 1 by 1, regardless of how big the mesh I'm adding it to seems to be.

This doesn't match my understanding of how creating a box collider should work, so I've set up a Debug.Log that outputs the mesh size.

Here the plot thickens. The mesh's size just comes back at 0, 0, 0.
My attempts at getting the size of the object are as follows:

objectToMeasure.GetComponent<Renderer>().bounds.size;

objectToMeasure.GetComponent<MeshFilter>().mesh.bounds.size

objectToMeasure.GetComponent<MeshFilter>().sharedMesh.bounds.size;

Assuming I'm referring to the size of the object in the correct way, this seems like it must be an issue created by baking the object. Do I need to wait a frame (via starting a coroutine) before trying to access the size of the object, or am I referring to the wrong component of the object, or is the BoxCollider setting it's size based on objectToMeasure's scale rather than it's size in the world?

I feel sure that
objectToMeasure.GetComponent().mesh.bounds.size;
should be right, since the script I use to bake to the mesh is:
meshToBake.BakeMesh(meshToMeasure.GetComponent().sharedMesh);

I've been driving myself to the edge of sanity for 24 hours with this script not working, so advice is greatly appreciated.

sentences:
Incrase framerate in XNA I'm trying to increase the frame rate of my game from 60FPS to 100 FPS because of reasons. But i can't seem to get it higher than 60 frames. This is the count I'm using. I can slow down the frame rate by setting TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);

to a higher value, but settings it lower won't increase the frame rate, according to the counter. Anyone have any idea what's going on?

sentences:
Creating a seamlessly looping 2D multiplayer level? A discussion came up recently about how to create a 2D side-scrolling multiplayer game that can have an looping level design (Think of Starbound and how their worlds are looping).

I thought the simplest way would be to have a rectangular map with trigger zones which could teleport players from one side to another. However the obvious issue with this approach is the case of having multiple players at edge of the map at once. You don't want to just teleport players in front of each other and you would need a way to transport players without having other players disappear.

To append this idea and fix the issue I came up with the following:
have a trigger zone (red square in image) where players will be able to see a "clone zone" (green square). In this green square, objects from the opposite side of the trigger zone would be copied into its corresponding clone zone (can be seen with A & B shapes). When a player gets to the starting edge of the "clone zone" they are teleported to the other side of the map.

In this example Player 2 would think they are seeing Player 1, however they would actually be seeing his clone and vice versa.

This seemed a bit extreme and complex for the problem at hand. My question now is to know if this solution is a good approach to tackling the issue, or is there a simpler way to solve this problem?

sentences:
Is there no UI culling for unity? I don't understand, am I missing something?
I have hundreds of moving images on screen that only need to render and do their logic/physics when they are in the canvas.
Otherwise they can just deactivate to save on performance and there is a very big fps difference when they are deactivated vs activated outside the canvas.
RectMask2D on the canvas does barely anything.
Checking the bounds for hundreds of UI elements seems like madness.
So what are you supposed to do?

sentences:
Rule based procedural terrain generation How one generates procedural terrain is pretty straight forward. But once you setup your terrain you don't really have a fine level of control where which details will go.

One solution I can think of is to store rules as functions, i.e. Square, circle, etc., which will override rules in the area. For example, in mountains terrain we could place a function which will make them flat or terraced.

What I have trouble figuring out is how to store those functions (assuming terrains can be in principle infinite or at least planetary scale). Should they be placed within existing coordinate system, or stored locally to terrain ?

I seen something like that done in Star Wars Galaxies, but it's really hard to find any details about implementation of system.

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 do I apply A* to a complex and dynamic 3D environment? I've looked a bit at Breadth-First and Depth-First search algorithms and I think I've got a pretty good idea of how they work.

Now I am here : http://www.policyalmanac.org/games/aStarTutorial.htm

The problem is I don't see how a 2D grid can help with a 3D game. I suppose that wouldn't be a problem if the 3D game didn't have the AI explore multiple levels of a building, but since that is most often what occurs, I am not sure how I would "simplify" my static level geometry and my physics-dynamic changing scene into a structure that can be easily be traversed to determine a path to a goal node.

sentences:
Instantiate from two values, each in separate array I have a problem with Instantiating GameObjects from floats in arrays, which I have to merge into one Vector2 (or Vector3). I have only two values in arrays:
GameObject = somePrefab
float[] = value1
float[] = value2

First I have to combine them into a vector, then Instantiate as many prefabs as the combined vector number is...
Can anybody help me with how to merge these floats into a vector and instantiate?

sentences: 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:
Making isKinematic false when OnCollisionEnter()? I have an issue with my script, I want to make rb.isKinematic go from true to false when collision is detected. With this script, nothing happens when a supposed collision is happening which means that rb.Kinematic = false does not work... The problem is that collision CANNOT be detected in the first place because rb.isKinematic is initially true (in my other script)! I checked this using Debug.Log to detect collisions. How can I fix this problem?

string lastTagCollided = "";
public Rigidbody rb;

void OnCollisionEnter(Collision col)
{
    if(col.gameObject.tag == "Pentagon" && lastTagCollided == "Pyramid")
    {
    rb = GetComponent<Rigidbody>();
    rb.isKinematic = false;
    transform.DetachChildren();
    Destroy (GameObject.FindWithTag("Sphere"));
    }

if(col.gameObject.tag == "Pyramid" && lastTagCollided == "Pentagon")
{
    rb = GetComponent<Rigidbody>();
    rb.isKinematic = false;
    transform.DetachChildren();
    Destroy (GameObject.FindWithTag("Sphere"));
}

lastTagCollided = col.gameObject.tag;
}

My other script if you are curious:

void OnCollisionEnter(Collision col)
{
if (col.gameObject.tag == "Pyramid" || col.gameObject.tag == "Pentagon")
    {
        rb = GetComponent<Rigidbody>();
        rb.isKinematic = true;
        gameObject.transform.SetParent (col.gameObject.transform);
    }
}

sentences:
Open GL polygons not displaying I have tried to follow nehe's opengl tutorial lesson 2. I use sfml for my window creation. The problem I have is that both the triangle and the quad don't show up on the screen:

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream>

void processEvents(sf::Window *app);
void processInput(sf::Window *app, const sf::Input &input);

void renderCube(sf::Window *app, sf::Clock *clock);
void renderGlScene(sf::Window *app);

void init();

int main()  {
    sf::Window app(sf::VideoMode(800, 600, 32), "Nehe Lesson 2");

    app.UseVerticalSync(false);

    init();

    while (app.IsOpened())  {
        processEvents(&app);

        renderGlScene(&app);

        app.Display();
    }

    return EXIT_SUCCESS;
}

void init()  {
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);

    // Enable z-buffer and read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perpective projection
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluPerspective(45.f, 1.f, 1.f, 500.f);

    glShadeModel(GL_SMOOTH);
}

void processEvents(sf::Window *app)  {
    sf::Event event;

    while (app->GetEvent(event))  {
        if (event.Type == sf::Event::Closed)  {
            app->Close();
        }

        if (event.Type == sf::Event::KeyPressed &&
            event.Key.Code == sf::Key::Escape)  {
            app->Close();
        }
    }
}

void renderGlScene(sf::Window *app)  {
    app->SetActive();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  // Clear the screen and the depth buffer
    glLoadIdentity();                   // Reset the view

    glTranslatef(-1.5f, 0.0f, -6.0f);   // Move Left 1.5 units and into the screen 6.0

    glBegin(GL_TRIANGLES);
        glVertex3f( 0.0f, 1.0f, 0.0f);  // Top
        glVertex3f(-1.0,-1.0f, 0.0f);  // Bottom Left
        glVertex3f( 1.0f,-1.0f, 0.0f);  // Bottom Right
    glEnd();

    glTranslatef(3.0f, 0.0f, 0.0f);

    glBegin(GL_QUADS);  // Draw a quad
        glVertex3f(-1.0f, 1.0f, 0.0f);
        glVertex3f( 1.0f, 1.0f, 0.0f);
        glVertex3f( 1.0f,-1.0f, 0.0f);
        glVertex3f(-1.0f,-1.0f, 0.0f);
    glEnd();
}

I would greatly appreciate it if someone could help me resolve my issue.

sentences:
Cocos2d-x: Differences between applying shader to child node and entire scene? I'm beginning with shader.
I wonder what if i apply shader for single node, what'll happen?

The gl_FragCoord = (0.5,0.5) is the bottom left of the screen or the bottom left of the node?

I get some wrong caculations while wanting to draw something in the center of the node (not the screen).

Many shader tutorias with sample code to draw at center using gl_FragCoord.xy / resolution.xy, if it's 0.5, it's center. In this case, it might be wrong because i want to draw in center of the node.

Finally, how's about texture2D i use texture2D instead of texture, are they the same?

I've applied this code on the node and it prints out the whole screen with stretch version (resolution = device resolution)

vec2 xy = gl_FragCoord.xy / resolution.xy;
vec4 texColor = texture2D(CC_Texture0,xy);
gl_FragColor = texColor;

sentences:
How to do Digital Painting type of graphics art like in Braid? I'm wanting to create the digital painting type of effect that you see in Braid for a game I'm creating. I was wondering if someone can point me in the right direction? I'm most familiar with OpenGL ES 2.0.

I'm wanting to have the background move like Braid does as well.

If anyone can get me started I would really appreciate it.

sentences:
How can you represent equip-able items in a 2d game? I've been working on an item system for a post-apocalyptic RPG, with diablo as inspiration, and it would be awesome if I could visually represent an item that can be equipped on the player sprite. I was thinking you could have a player sprite with certain animations, then the equipped item would be drawn as if it was on the player with the same animations, so it syncs with the player animations but that couldn't work very smoothly, I imagine there's a better system.

How can you graphically represent an item worn on the player, which moves like he does, and looks as if he's wearing it? I'm not asking you how to do it in framework X or platform X (altho if you REALLY need it, I'm using Allegro 5 with codeblocks on win XP) but instead I'm asking you how to generally program such an idea.

sentences:
Top down 2d orthogonal view with 3D elements (Unity) I've decided to give Unity a go with my project. I want to create a 2d RPG perspective world, but with elements of 3D mixed in.
So for instance, I think I might make trees and grass 3D, for this to work, the grass would have to realistically blend with the character (a 2d sprite) as they walk through it.
To be clear, I'm thinking of grass like you would see in a fully 3D game (like this).

As I understand it, the sprite objects (characters and whatnot) would need to maintain their rotation values whatever the rotation of the camera is. I don't plan on rotating the camera, the game would appear like a 2d game (2.5d is perhaps a more appropriate term) but in order to achieve the effect I want they would not be allowed to rotate in the camera's view.

I'm very new to Unity so I'm not quite sure where to start. I should also note I don't plan on making everything 3d, just particular objects like the ones mentioned.

Edit 06.05.16:

I'm not sure why I can't find anybody else with this problem solving it the way I am.
Here's a diagram of what I've implemented and it seems to work well:

The camera's Y axis is set to 45 degrees.
I'm not sure why but the number 1.418 works as the scaleY value for the camera's projection matrix. for making both sides appear as equally proportioned squares.

I don't see any distortion of textures, shadowing looks ok, the whole distorited 2d rpg perspective feels just right.

I'm a bit confused as I've seen some overly complex suggestions and solutions to this problem on google, but this seems to me to be the simplest and most appropriate solution, and I've not found anyone suggest it. Everything appears in proportion.
I assume I'm not aware of an important flaw in the solution because otherwise it would seem absurd other people wouldn't arrive at the same solution.

Regarding billboaridng - billboarding 3D movable sprites doesn't work well in 3d environments IMO, as they often will be tilted at a 45 degree angle and risk intersecting 3d objects:

http://answers.unity3d.com/questions/582680/billboard-issue-in-front-of-3d-object.html

Particularly tall sprites would be very problematic, unless the scenery was also tilted, like this screenshot from a Zelda game demonstrates:

sentences:
Size of an image imported with FreeImage I'm having abit of a brainfart and I can't quite grasp what I'm doing wrong.
It's quite simple, I am importing an image with FreeImage (http://freeimage.sourceforge.net/) which has a method FreeImage_GetBits that returns a pointer to the first byte of the image data. I then try to load all the data into memory using (bitsperpixel / 8) * pixelsWidth ' pixelHeight, like this:

uint32_t bitsPerPixel           = FreeImage_GetBPP(bitmap);   // resolves to 24
uint32_t widthInPixels          = FreeImage_GetWidth(bitmap);  // resolves to 1024
uint32_t heightInPixels         = FreeImage_GetHeight(bitmap);  // resolves to 1024

// container is a std::vector<uint8_t>
pkgMaterial.mTextureData.insert(pkgMaterial.mTextureData.begin(), FreeImage_GetBits(bitmap), FreeImage_GetBits(bitmap) + ((bitsPerPixel/8) * widthInPixels * heightInPixels));

I have a jpg which is 31 kilobytes in size on disc. Yet when I load it using the above formula, I see the vector is then filled with 3145728 bytes, which is approx 3145 kilobytes. What am I doing wrong?

sentences:
How to get chunks in a sphere rather than cuboid I have a chunk system to load stars around the player. It takes a given "real" loading range (aka Unity-units of range), calculates the necessary chunk loading range (as integer), creates star GameObjects within the loading range on screen, and stores stars in cache which are within chunk loading range but outside of real loading range.
Chunks are stored in a dictionary with the key being a struct consisting of x,y,z integer coordinates. Available data are:

Real position of the player
Current chunk of the player
Center point and size of each chunk (same size for all)
I know when the player steps into another chunk

A quick calculation revealed that if I'd be able to load chunks spherically instead of cubically, I would be able to load ~40% less chunks. The amount of chunks I have to grab (currently) can vary, ranging from a range of 3 to ~8 (meaning minimum of (2*3+1) 7*7*7=343 to (2*8+1) 17*17*17=4913). Current Code:

    public Chunk[,,] GetChunksInCuboid (Coordinate coords, int range)
    {
        return GetChunksInRectangle (new Coordinate (coords.x - range, coords.y - range, coords.z - range), new Coordinate (coords.x + range, coords.y + range, coords.z + range));
    }

    public Chunk[,,] GetChunksInCuboid (Coordinate min, Coordinate max)
    {
        int xLen = max.x - min.x + 1;
        int yLen = max.y - min.y + 1;
        int zLen = max.z - min.z + 1;

        Chunk[,,] A = new Chunk[xLen, yLen, zLen];

        for (int x = 0; x < xLen; x++)
        {
            for (int y = 0; y < yLen; y++)
            {
                for (int z = 0; z < zLen; z++)
                {
                    A[x, y, z] = GetChunk (x + min.x, y + min.y, z + min.z);
                }
            }
        }

        return A;
    }

My question is the following: Is it possible, and if yes, how can I performantly load chunks in a sphere?

sentences:
How do I access a Unity class from an Android Activity? I have made my own C# classes in Unity. How can I access them from the Android Activity that starts the UnityPlayer?

Example: I have a C# class called testClass in Unity:

class testClass {
    public static string myString = "test string";
}

From the Android activity in Java, I want to access a member of that class:

string str = testClass.myString;

Is this possible? If so, how? Is there another way to do this? In the end, I basically want to communicate between my Android activity and the UnityPlayer object.

Edit: I found a solution.

I looked at building Android plugins for Unity but this wasn't satisfactory to me.

I ended up building a socket client-server interface in Unity with C# and another one in Java for the Android app: Unity listens on port X and broadcasts on port Y. The Android activity listens on port Y and broadcasts on port X. This is necessary as both interfaces are running on the same host.

So that's how I solved my problem, but I'm open for any suggestions if anyone knows a better way of communicating between the Unityplayer and your app.

sentences: Unity using Animation and Ragdoll The question is simple, but I can't resolve it for a couple of days. I have an enemy model with ragdoll attached and also a couple of animations(e.g. idle, walk, run). It seems that ragdoll work only when animator is stopped and vice versa. What I want is when the animation is playing all the forces are applied too, e.g. when I shoot enemy he still walking by animation and and ragdoll corresponds with AddForce(). I tried to find appropriate tutorial for that, watched ton of youtube videos and read a lot of unity forums, but no success. Any help is appreciated. Thanks in advance.

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:
Unity C# 2D Platformer Enemy Patrolling I'm setting up a basic mario-like 2D platformer and I'm trying to give 'enemies' a patrolling path on a platform. (just like the turtles in Super Mario Bros). All they do is patrol from left to right and back. <--->

Currently my game object is walking to left and right in the middle of my scene.
Despite me positioning my game object as far left as I can, at first it walks to the center of the scene and continues acting out his patrol in the center of my scene.

What I can't seem to figure out is adjusting the position where he patrols. I don't want him to patrol in the center of the scene.

I think I should use the originalX position in the Update function but I'm not sure how (I could be wrong)?

This is the script that is linked to my enemy gameobject.

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
    public float walkSpeed = 1.0f;      // Walkspeed
    public float wallLeft = 0.0f;       // Define wallLeft
    public float wallRight = 5.0f;      // Define wallRight
    float walkingDirection = 1.0f;
    Vector2 walkAmount;
    float originalX; // Original float value

    void Start () {
        this.originalX = this.transform.position.x;
    }

    // Update is called once per frame
    void Update () {
        walkAmount.x = walkingDirection * walkSpeed * Time.deltaTime;
        if (walkingDirection > 0.0f && transform.position.x >= wallRight) {
            walkingDirection = -1.0f;
        } else if (walkingDirection < 0.0f && transform.position.x <= wallLeft) {
            walkingDirection = 1.0f;
        }
        transform.Translate(walkAmount);
    }
}

sentences: How do I create a save file for a C++ game? I am coding my final for a Video game Programming  course, and I want to know how to create a save file for my game, so that a user can play, and then come back later. Any idea how this is done, every thing I have done before has been single run programs.

sentences:
Bubble shooter falling algorithm To complete this question about the same color search algorithm, I would like to know if someone knows which is the best implementation for making other bubbles fall when they are no longer attached. More precisely, how can I detect islands of isolated bubbles.

My data structure is a NxM matrix.

sentences:
Default mipmap level & elements to use for CopyTexture in Unity Scripting? I want to make a tiled map. I want to use the function CopyTexture to copy from a Texture2D (where is stored my tileset) to a RenderTexture.

I want to use the third overloading (with all the arguments) which allow me to choose from where in the source texture and where in the render texture I will copy. But I need to specify mipmap levels and elements.

I don't know what to use as mipmap levels and elements in this function. Thanks to everyone who can help me :)

sentences:
How do I snap the Unity camera to a 2D, tile-based map? I have a 2D, tile-based map. I want to be able to control the number of visible tiles on the screen vertically and horizontally, regardless of resolution. I want the player to be able to move the camera one tile width at a time until it hits the edge.

I do not understand how to manipulate the Unity camera in order to accomplish this. I have read the documentation, and Googled, but there is just something that is not clicking for me.

So, let's say I have a 100x100 map. A 32x24 portion of the map is shown at a resolution of 1024x768, each tile has a size of 1x1 Unity unit. The bottom-left of the visible area of the map starts at the bottom-left of the map (0, 0). The player then clicks the right arrow key and the map moves one tile to the right (1, 0).

How do I accomplish this, given that I am using the latest version of Unity in 2D mode?

sentences:
How to check version of Unity package in project through script I'm writing an asset that will be used by many people, but it depends on TextMeshPro (TMP). I ran into a bug in TMP that can only be fixed by upgrading to a preview version. I want to warn users that install my asset that they need to upgrade their TMP version if they are using a prior version. Surprisingly, I can't find this anywhere online or in the docs.

just something like

if (TextMeshPro.version < MyAsset.RequiredTMPVersion) {
    Debug.LogError("Need to upgrade TMP");
}

sentences:
Visitor-pattern vs inheritance for rendering I have a game engine that currently uses inheritance to provide a generic interface to do rendering:

class renderable
{
public:
    void render();
};

Each class calls the gl_* functions itself, this makes the code hard to optimize and hard to implement something like setting the quality of rendering:

class sphere : public renderable
{
public:
    void render()
    {
        glDrawElements(...);
    }
};

I was thinking about implementing a system where I would create a Renderer class that would render my objects:

class sphere
{
    void render( renderer* r )
    {
        r->renderme( *this );
    }
};

class renderer
{
    renderme( sphere& sphere )
    {
         // magically get render resources here
         // magically render a sphere here
    }
};

My main problem is where should I store the VBOs and where should I Create them when using this method?
Should I even use this approach or stick to the current one, perhaps something else?

PS: I already asked this question on SO but got no proper answers.

sentences:
How do I make this block go back to the left with another click? This is the script I've written so far which makes the block move from the left of the screen to the right on a mouse click. What I want to achieve is for the block to move back to the left when I click the mouse again. So I can have a back and forth movement with each mouse click. Thank you for any help it's much appreciated.

public class PlayerControls1 : MonoBehaviour  {

private bool hasBeenTapped = false;
private bool control = false;
public float speed = 20f;

void Update () {
    if (Input.GetMouseButtonDown (0)) {
        hasBeenTapped = true;
            }

    if (hasBeenTapped && transform.position.x < 4 && control == false){
        transform.Translate (Vector2.right * speed * Time.deltaTime);
    }

    if(transform.position.x > 4.0f) {

        control = true;

        hasBeenTapped = false;
    }

    if(hasBeenTapped && transform.position.x == 4 || transform.position.x < 4 && control == true) {
        transform.Translate (-Vector2.right * speed * Time.deltaTime);

    if(transform.position.x < -4){

            control = false;

            hasBeenTapped = false;
        }
    }
  }
}

sentences:
My Single Pass Gaussian Blur Looks Awful I've based my shader on this single pass shadertoy here:
https://www.shadertoy.com/view/XdfGDH

I applied the same shader and it looks like this:

Scaled up so you can see the faint tears in the texture. They look grid-like and not smooth at all.

When it should be looking like this:

Source image:

Here's my shader. Translated the shadertoy to GLSL 110

#version 110
uniform sampler2D texture;

float normpdf(float x, float sigma)
{
  return 0.39894*exp(-0.5*x*x / (sigma*sigma)) / sigma;
}

void main()
{
  vec3 c = texture2D(texture, gl_TexCoord[0].xy).rgb;

  const int mSize = 11;
  const int kSize = const int((float(mSize) - 1.0) / 2.0);
  float kernel[mSize];
  vec3 final_color = vec3(0.0);

  // Create the kernel
  float sigma = 7.0;
  float Z = 0.0;
  for (int j = 0; j <= kSize; ++j)
  {
    kernel[kSize + j] = kernel[kSize - j] = normpdf(float(j), sigma);
  }

  //get the normalization factor (as the gaussian has been clamped)
  for (int j = 0; j < mSize; ++j)
  {
    Z += kernel[j];
  }

  //read out the texels
  for (int i = -kSize; i <= kSize; ++i)
  {
    for (int j = -kSize; j <= kSize; ++j)
    {
      final_color += kernel[kSize + j] * kernel[kSize + i] * texture2D(texture, (gl_TexCoord[0].xy + vec2(float(i), float(j)))).rgb;
    }
  }

  gl_FragColor = vec4(final_color / (Z*Z), 1.0);
}

sentences:
Why does order matter in constant buffers? I have a rather peculiar question remaining after solving most of my own question on StackOverflow. When creating the constant buffers used by my shaders, I've learned that the order of variables between the cbuffer and the struct representing it have to be an accurate match. I am still unsure as to why this is such an issue, and that's why I'm here.

When creating a cbuffer to hold object data, I create the cbuffer and struct like so:

cbuffer ObjectBuffer : register(b0) {
    float4x4 World;
    float4x4 WorldViewProjection;
    float4x4 WorldInverseTranspose;
}
public struct ObjectBuffer {
    public Matrix World;
    public Matrix WorldViewProjection;
    public Matrix WorldInverseTranspose;
}

This way works just fine, but if I reorder the cbuffer variables, or the struct variables and do not reflect the changes in the other, issues arise and I can't even create the buffer.

cbuffer ObjectBuffer : register(b0) {
    float4x4 WorldInverseTranspose;
    float4x4 WorldViewProjection;
    float4x4 World;
}
public struct ObjectBuffer {
    public Matrix World;
    public Matrix WorldViewProjection;
    public Matrix WorldInverseTranspose;
}

In this case, the types are exactly the same and given the fact that HLSL expects constant buffers to be in 16 byte chunks; why does the ordering matter so much?

Aren't float4x4 types the same as Matrix types where it's essentially an array of arrays?

[ 0, 0, 0, 0 ] = 16 bytes
[ 0, 0, 0, 0 ] = 16 bytes
[ 0, 0, 0, 0 ] = 16 bytes
[ 0, 0, 0, 0 ] = 16 bytes
[    TOTAL   ] = 64 bytes

Since a float is 4 bytes on its own, this would mean a float4 is 16 bytes, and thus a float4x4 is 64 bytes. So why does the order matter if the size remained the same?

Update

So I've re-visited the issue and turns out I was wrong about the issue given above. This does allow the objects to be compiled correctly but presents grotesque effects in the shaders since the variables are in the wrong order which is expected.

However, this issue came up because I misread which buffer was causing the issue initially. It was all related to my material buffer in which I have a bool and a float. When I swapped the two on either side without reflecting the changes in the other it failed to create. I presume this is due to the difference in expected types. The cbuffer is in bool-float order while the struct is the opposite. This I expect to cause an issue, but it would still be nice to know what's happening under the hood to cause it to break. Is it because bool is a single byte but perhaps allocated into a chunk of 4 bytes?

sentences:
How to rotate CharacterController on slope I'm trying to rotate my characterController player on a slope on the 'x' and 'z' axises, however things aren't going so well.

The player does rotate, but if I move and look in another direction, the characterController will still be on the same axis, and won't look down an up slope, and instead will be looking up a down slope.

void Update ()
{
   Vector3 rotateDirection = (camera.forward * Input.GetAxis("Vertical"))
                           + (camera.right * Input.GetAxis("Horizontal"));

   Quaternion newRotation = Quaternion.LookRotation(
                               new Vector3(rotateDirection.x, 0f, rotateDirection.z));
   transform.rotation = Quaternion.Slerp(
                               transform.rotation, newRotation, rotSpeed * Time.deltaTime);
 }

private void OnControllerColliderHit(ControllerColliderHit hit)
{
      transform.rotation = Quaternion.Euler(hit.transform.rotation.eulerAngles.x,
                   transform.rotation.eulerAngles.y, hit.transform.rotation.eulerAngles.z);
}

Also, it doesn't work at all with spheres and terrain since their rotation is zero. Anyone know how to achieve what I am talking about? Also, the goal is to allow for the 'y' axis to be free and do what it needs to in void Update().

sentences:
MUD programming: socket handling I'd like to build a multi user dungeon in Java/C# (also open to other suggestions).  Below I have listed two ways of handling connections, and would like to know which would be the recommended way?
I think a good way to build it would be something like this:

Currently, I'm working on the connection handling portion (shown in the picture on the left, heavy black rectangle). It would take care of the connection handling between multiple clients and basically shove commands received from clients (denoted by newline char) into a queue, which the game engine can then pull off of and process. If there is a reply, the game engine would shove it into another queue so the connection handler can send it back to the client.
I see two ways to work this part:
Thread per connection
class Server {
    public void Listen() {
        // configure
        final int portNumber = 81;

        try {
            ServerSocket serverSocket = new ServerSocket(portNumber);

            while (true) {
                Socket socket = serverSocket.accept();
                new ProcessThread(socket).start();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

class ProcessThread extends Thread {
    protected Socket socket;

    public ProcessThread(Socket clientSocket) {
        this.socket = clientSocket;
    }

    public void run() {
        try {
            OutputStream os = socket.getOutputStream();
            PrintWriter pw = new PrintWriter(os, true);

            while (true) {
                BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                String str = br.readLine();

                // do processing here
            }
        }
    }
}

Pros:

Easier implementation

Cons:

Thread per connection not scalable
Multithreading = potential yuckiness

Async socket
public class Server {
    // use hashmap to keep track of current input
    private HashMap<SelectionKey, StringBuilder> strings = new HashMap<>();

    public void Listen() {
        // configure
        Selector selector = Selector.open();
        ServerSocketChannel serverSocket = ServerSocketChannel.open();
        serverSocket.bind(new InetSocketAddress("localhost", 5454));
        serverSocket.configureBlocking(false);
        serverSocket.register(selector, SelectionKey.OP_ACCEPT);
        ByteBuffer buffer = ByteBuffer.allocate(256);

        while (true) {
            selector.select();
            Set<SelectionKey> selectedKeys = selector.selectedKeys();
            Iterator<SelectionKey> iter = selectedKeys.iterator();
            while (iter.hasNext()) {

                SelectionKey key = iter.next();

                if (key.isAcceptable()) {
                    // register new connection
                    register(selector, serverSocket);
                }

                if (key.isReadable()) {
                    // process input
                    // add input to hashmap, if not newline terminated
                    process(buffer, key);
                }
                iter.remove();
            }
        }
    }
}

Pros:

Will definitely process in order received
Less resource intensive (?)

Cons:

Handling readline is more difficult

What would be the recommended way?
I'm leaning towards the thread per connection, as it seems to be slightly easier to implement. For a MUD, I would expect less than 200 simultaneous connections (50 might be a more accurate estimate), which would not be too resource intensive.

sentences:
How to change the intensity of a light I just want to change the intensity of a light.

The script is already in the light object, but I can't turn it up or down to save my life, and wherever I look, no one has the answer.

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

public class Flashlight : MonoBehaviour
{

    public bool flashOn;

    void Update()
    {
        if (flashOn)
        {
            light.intensity = 0;

            if (Input.GetKey("q"))
            {
                flashOn = false;
            }
        }
        else
        {
            light.intensity = 1;

            if (Input.GetKey("q"))
            {
                flashOn = true;
            }
        }
    }
}

sentences:
3d bounding Box border xna So, I'm trying to develop a 3d table tennis game, and I'm having problems when it comes to colliding the ball with the table. I have a bounding sphere for the ball and bounding box for the table, but the intersection isn't that accurate, and I'm guessing that the bounding box is incorrect since colliding the ball with the racket is good.

I'm trying to display the bounding box so that it would be easier to see where the error is, but I cant seem to implement the tutorials I've found with my code, or just don't know how. And, I'm I right in creating an AABB since my table isn't moving? If anyone could help, it would be greatly appreciated, or if anyone could suggest a better way to collide a ball with a box (if there is) thanks. I've pasted my bounding box detection, and the collision between the sphere and box. If more code is needed I'll post it. Thanks

http://pastebin.com/NDYmhXCh

http://pastebin.com/47vwJWSc

sentences:
Unity Android game all squashed in center of screen (portrait layout), help I'm developing a demo for Android game in Unity with portrait layout. I used the ViewportHandler script found here (How do you handle aspect ratio differences with Unity 2D?) and it worked well. Yesterday I updated Unity (foolish move I know, two days before deliver of a project!!) to 5.4.2f2 (was using 5.4.1f1). I don't know if that is the reason but now I can in no way get my correct layout again. Sure, it is portrait but all squashed in the center and taking about one-third of the screen, rest just background camera-colour. Things looked well yesterday but now I'm in big trouble :(

Any help would be greatly appreciated!

sentences:
First Minecraft mod not working: make a new sword I am making my first mod and cannot see what is wrong with it. I am using MCP and Modloader.
For my first mod I was going to make swords.

I started with making a new EnumToolMaterials

WOOD(0, 59, 2.0F, 0, 15),
STONE(1, 131, 4.0F, 1, 5),
IRON(2, 250, 6.0F, 2, 14),
LAPIS(3, 750, 7.0F, 2, 14),
OBSIDIAN(3, 1000, 7.5F, 3, 12),
EMERALD(3, 1561, 8.0F, 3, 10),//diamond
GREEN(3, 2000, 9.0F, 4, 10),//emerald
GOLD(0, 200, 12.0F, 0, 22);

then here is the mod class

public class _Mod_Yamiko extends BaseMod{

    /* mod itemts */
    public static final Item swordLapis = (new ItemSword(600, EnumToolMaterial.LAPIS)).setItemName("swordLapis");
    public static final Item swordObsidian = (new ItemSword(601, EnumToolMaterial.OBSIDIAN)).setItemName("swordObsidian");
    public static final Item swordGreen = (new ItemSword(602, EnumToolMaterial.GREEN)).setItemName("swordGreen");

    public void load(){
        //set images
        swordLapis.iconIndex = ModLoader.addOverride("/gui/items.png","/gui/swordLapis.png");

        ModLoader.addName(swordLapis, "Lapis Sword");
        //craft
        ModLoader.addRecipe(new ItemStack(_Mod_Yamiko.swordLapis, 1), new Object[]{
            " X ", " X ", " Y ",
            'X', Block.dirt,
            'Y', Item.stick
        });
    }

    public String getVersion(){
        return "0.1";
    }
}

Then I made a 16×16 .png image. I am not sure where to save it so I recompiled and reobfuscated, took the mod files and put it in my local Minecraft install, added the image where it be should be. No problems when playing but I cannot make the new sword.

sentences:
Game server position tracking How would you go about determining a players position server side based off player input?

The Setup:
Player sends packet to server containing the command and view angles. Server takes the direction and multiplies it by speed.

Say a player is going up a hill. How would the server make the players position reflect that the player is going up a hill.

The way i see doing is taking the ground height under the player and calculating if the height change in direction x is too high. However calculating that info for n players say 1000 would be very intense. So what is the proper way of determining a players position based on input with a client/server setup with the server being authorative. There is 10 updates per second.

sentences:
How many datapoints are there generally in terrain height maps? I've created my own heightmap with data from USGS. The heightmap is pretty large, but the point density is low, resulting in a low-poly terrain.

While performance is excellent, the physics engine I'm using doesn't particularly like how much distance is between each point, resulting in clipping.

Regardless, what is the point density like for games like H1Z1 or any other game that uses a height map on a large world?

sentences:
Rotate a point in 3D space with sine and cosine I got my camera controlled by the mouse. Now I want a sphere to be always in the center of my view(just for testing). I tried that by assigning the sine of the Y rotation of the camera times 10 as the X coordinate and the same for the Y coordinate but with cosine:

SphereX = 10 * math.sin(YRotation)
SphereY = 10 * math.cos(YRotation)

But now I would like to know how to set the Z position. I can set the proper height of the sphere by doing that:

SphereZ = 10 * math.sin(XRotation)

But the problem is, that the sphere is only moving up and down and the moving towards the camera is ignored. How can I fix that?

sentences:
Minecraft - How do I check if someone has a clear inventory How do I check if a player has a clear inventory?
I'm making a PvP arena plugin but I need it so when someone types /pvp join, it checks if they have a clear inventory. If they do have a clear inventory, it lets them join, if they don't, it asks them to.

I tried this but it's not reliable as there are more slots:

if(p.getInventory().getArmorContents() == null
    && p.getInventory().getItemInHand() == null
    && p.getInventory().getItemInHand() == null) {

Then I tried this but it did not work:

if (p.getInventory().getContents().length == 0) {

sentences:
Unity: how to update only the Windows executable? Suppose I made a small changes to the source code of my game. No assets, textures or sounds are changed.

How can I create a "patch" or "update" for the Windows build of my game so my customers don't need to re-download everything?

sentences:
Was my horizontal drag performed from left to right or from right to left? I want to determine if a horizontal drag was performed from left to right or from right to left.
In addition, I want to do the same with the vertical drag.

How can I do that?

How can I check if the horizontal drag was performed from left to right or from right to left?

protected override void Update(GameTime gameTime)
    {
        while (TouchPanel.IsGestureAvailable)
        {
            GestureSample gs = TouchPanel.ReadGesture();
            switch (gs.GestureType)
            {
                case GestureType.HorizontalDrag:
                //from left to right
                Count += 1;
                //from right to left
                Count -= 1;
                break;
                case GestureType.VerticalDrag:
                //downwards
                Count += 1;
                //upwards
                Count -= 1;
                break;
            }
        }
        base.Update(gameTime);
    }

sentences:
How to add a constant horizontal force just like gravity? I want to add a constant horizontal force, just like gravity to a projectile or a sphere moving in 3d space, which will make the projectile or ball or sphere or whatever be influenced by this force so that it will curl in the direction of the constant horizontal force.
I have this code which will add force to the object on swiping the screen, but it doesnt drift/curl or whatever you may call it:

var anglex : float;
var angley : float;
var elevationAngle : Vector3;

function FixedUpdate () {
    if(Input.touchCount>0 && Input.GetTouch(0).phase == TouchPhase.Ended)
               {
                    var touchdeltaposition: Vector2 = Input.GetTouch(0).deltaPosition;
                    anglex = touchdeltaposition.x * Time.deltaTime *2.0;
                    angley = touchdeltaposition.y * Time.deltaTime *5.0;
                    Debug.Log(angley);
                    elevationAngle = Vector3(anglex,angley,0);
                    rigidbody.velocity = transform.TransformDirection(Vector3(anglex,angley,angley ));
                    var elevation : Vector3 = Quaternion.Euler(elevationAngle) * transform.forward;
                    rigidbody.AddRelativeForce(elevation);
                  }
           }

I feel this is simple, but I'm just not able to turn the crank.

sentences:
Java, spawn algorithm that gets harder each level I am currently in the process of making my 3rd Java game (everything I have learned is from YouTube videos, so I may be doing some things wrong) named "Blocked". But I have run into a problem: how do I make an algorithm that gets progressively harder each "level". but first let me briefly explain the game, so you are a small human and blocks are falling from the sky, and you try to avoid them, there are 5 types of blocks: Basic, fast, shop, killer, safe. So I want my game to start with very few (basic only) tiles to fall, while the game is going (infinitely) I want it to get harder but not just unlocking new blocks, but also changing the frequency the more difficult blocks spawn (up to a certain threshold of course).

P.s. pseudo code is fine by me.
P.s. (2) if you need any clarifications ask me!

sentences:
how to check mouse is not over any object in unity Im working on a way to check mouse is not over any object on scene to put my object in there. i know i can use OnMouseOver function but i have to add it on all objects script. Is there any other way to check my mouse position is not on any object collider?
Its a 2d project.
thank you for helping

sentences:
LibGDX getting model roll I'm working on a 3d game in LibGDX, got help on here with my model rotation. Worked great. But now I'm dealing with the model's roll, and it's not behaving as expected. It's controlled by:
handPos.set(cam.position);
        handPos.add(forwardTemp.set(cam.direction).scl(2.5f));

        handInst.transform.setToRotation(Vector3.Z, cam.direction);

        handInst.transform.getRotation(handRot, true);
        handAngle = handRot.getRoll();

        camAngle = getCameraRotation();
        float h = (camAngle-handAngle);
        handInst.transform.rotate(Vector3.Z, h);

        handInst.transform.setTranslation(handPos);

Moving it works great, and I've had no difficulty getting my camera roll - I've made a method to do that. I have a label onscreen that shows current camAngle, and current handAngle. CamAngle looks right, but the handAngle doesn't match what I'm seeing, and so my math to keep hands stationary in the view isn't working. I've tried getting the yaw or pitch instead, in case the axes are messed up, but it isn't better.
I'm trying to keep the roll of the model in front of the camera to match the roll of the camera - so if you look around, your hands don't spin. Any ideas on what's wrong here?
Edit, here's my getCameraRotation method
public float getCameraRotation()
    {
        Quaternion p = new Quaternion();
        cam.combined.getRotation(p);
        float cammy = p.getRoll();
        return cammy;
    }

The camera can look in full 3d space, controlled by touch gestures. When doing so, it rolls around. I'm fine with that, kinda like the effect, but I want to match the hands model in front of the camera to it. The number I get from this method seems to match visually what I'm seeing pretty well.
Edit again - had code trying to getYaw. I want getRoll, that was just there from me experimenting with different axes to fix the problem.

sentences:
Monogame 3.3 SoundEffect play Freezes After using Monogame 3.3 with Xamarin Android, SoundEffect.Play method freezes the game. I try to convert wav files 8bit mono, 16bit mono no changes. This error on Samsung T101 android 4.0.3 but SoundEffects works with another android device which has 4.2.2.

I don't have this problem with Monogame 3.2. Any suggestion?

Thank you!

Android debug log below.

The thread 'Unknown' (0x4) has exited with code 0 (0x0).
Failed to generate OpenAL data buffer:
04-22 23:34:04.380 I/mono-stdout(10068): Failed to generate OpenAL data buffer:

Failed to get buffer bits: , format=Stereo16, size=73632, sampleRate=44100
04-22 23:34:04.380 I/mono-stdout(10068): Failed to get buffer bits: , format=Stereo16, size=73632, sampleRate=44100
04-22 23:34:04.390 D/Mono    (10068): DllImport searching in: 'openal32.dll' ('./libopenal32.so').
04-22 23:34:04.390 D/Mono    (10068): Searching for 'alDistanceModel'.
04-22 23:34:04.990 D/Mono    (10068): Image addref System.Runtime.Serialization[0x28084d0] -> System.Runtime.Serialization.dll[0x27ef090]: 1
04-22 23:34:04.990 D/Mono    (10068): Assembly System.Runtime.Serialization[0x28084d0] added to domain RootDomain, ref_count=1
04-22 23:34:04.990 D/Mono    (10068): AOT module 'System.Runtime.Serialization.dll.so' not found: Cannot load library: load_library[1091]: Library '/data/data/com.homemadegames.exterminator/lib/System.Runtime.Serialization.dll.so' not found
04-22 23:34:04.990 D/Mono    (10068): Assembly Ref addref MonoGame.Framework[0x1c80558] -> System.Runtime.Serialization[0x28084d0]: 2
04-22 23:34:04.990 D/Mono    (10068): Assembly Ref addref System.Runtime.Serialization[0x28084d0] -> mscorlib[0x1c66118]: 9
04-22 23:35:31.110 D/dalvikvm(10068): GC_CONCURRENT freed 159K, 5% free 8403K/8775K, paused 5ms+1ms
04-22 23:38:12.350 D/dalvikvm(10068): GC_CONCURRENT freed <1K, 2% free 8905K/9031K, paused 5ms+1ms

sentences:
Isometric Tile Selection with rectangular bounding boxes I am having problems trying to determine which tile I have selected with the mouse.

Currently it selects two tiles, rather than one. Producing the following results:

My tiles height, is half their width, and all tiles have the same dimensions.

The tiles are rectangles and their Cartesian position has been translated to a relative isometric position.

Because I am checking the mouse position with the sprites bounds, it will select two tiles, as demonstrated in the image below:

I suppose my question is, how to I determine that my mouse x/y is within the 'diamond' of the rectangle?

sentences:
How do you create multiple blocks with minecraft addons? I've seen a question like this and I followed the directions they gave (Adding a blocks folder into behavior pack etc.), but I can't seem to get a result, it could be because I want to make 2 blocks (slime_cyan and  slime_purple), OR it could also be because they weren't doing the right version because they said to add the component: "Register To Creative Menu" and on bridge it doesn't even suggest that component (I know I said bridge but I'm not looking for a bridge tutorial).
I just want to create 2 new blocks for Minecraft bedrock with only add-ons, no special modding app, could anyone help me with this?

I'm on Windows 10 edition.
I'm using Minecraft Bedrock 1.16

sentences:
Scale texture at runtime in unity I need to scale the texture in unity3d.In unity we are able to adjust the scale using the option in the toolbar

How will I scale the texture at runtime using the mouse pointer.

the texture should scale when i click and drag on the any four corners of the image as shown in the below image

Can anybody please help me in solving this.

sentences:
HTML5 canvas screen to isometric coordinate conversion I am trying to create an isometric game using HTML5 canvas, but don't know how to convert HTML5 canvas screen coordinates to isometric coordinates.
My code now is:

var mouseX = 0;
var mouseY = 0;
function mouseCheck(event) {
    mouseX = event.pageX;
    mouseY = event.pageY;
}

which gives me canvas coordinates. But how do I convert these coordinates to isometric coordinates? I am using 16x16 tiles.

sentences:
Suitable Client Server setup for Network Game testing I want to test my Client/Server game for which, currently, I am using localhost for both Client and Server.

Obviously I'm not getting any fluctuation in data and measure idea of performance, and in other parameters, what I wanted to ask how I would test a real world scenario:

if i create a little network with two computers or

if check that on LAN on which i am or

Are these cases (localhost included) equivalent?

or do I really need to test my game on different LANs to have reliable and realistic testing data?

How these different network setups influence the testing process?

Can somebody please suggest methods for testing the effect of network latency and packet loss on my game?

which above setup will give me more up and downs in number with LEAST setup/implementing efforts.

The game is supposed to be played on a LAN but it IS capable of more.

sentences:
Animation confusion - Unity Im pretty new to game dev in Unity, and thought I'd start off with a relatively simple game:

Im planning to make a game where 3 cups are shown on a table, and a ball is placed beneath one, the cups go down (concealing the ball) and move around. If the player selects the right cup, they win.

Not sure if I'm jumping in the deep end, but I'd like to make this dynamic in the sense that the animation shouldn't dictate the place of the cup on the table, as I want to code it so that the amount of cups can be set (as a difficulty).

After looking into the state machine stuff behind Unity's AnimationController but not sure how I should go about it.

I've identified various states as below:

A cup can be down on the table
A cup can be lifted
A cup can be moved to a different position on the table (?)

You can see from the above that I dont know if I should include that as a state. When moving 2 cups, one cup should move forward to it's new position, and the other should move behind it as not to cause them to collide, but would also like to be able to code this in a way where cups on the far ends can be swapped as well.

Any advice?

sentences:
What is GLEW and how does it work? I am looking for a beginner-friendly explanation. The official website's explanation is too short and lead me to more questions than answers:

What is GLEW?

GLEW developer's page says:

  The OpenGL Extension Wrangler Library (GLEW) is a cross-platform
  open-source C/C++ extension loading library. GLEW provides efficient
  run-time mechanisms for determining which OpenGL extensions are
  supported on the target platform.

But what is an extension loading library?

OpenGL's wiki says

  An OpenGL Loading Library is a library that loads pointers to OpenGL
  functions at runtime, core as well as extensions.

What does it mean to load pointers to OpenGL functions?
What is an extension?
What does it mean by "core as well as extensions"?

sentences:
How are potentially visible sets (PVS) determined in state of the art games? As I understand it,  potentially visible sets (PVS) are used to determine 2 things;
1. which objects are inside the camera's view volume
2. which objects are not occluded (hidden) from the camera's point of view.

I understand that things like octtrees & BSP trees have been used for PVS calculation in the past, but how are PVSs calculated in today's AAA titles?

sentences: Can I pause Unity Setup download and continue it whenever possible as per convenience(using Unity Hub)? Actually I get only 1.5GB data daily. So it's not possible for me to download the whole Unity setup in a day. So I wanted to know if I can pause and resume download process as per convenience. I am downloading using Unity Hub.

sentences:
My sprite is not listening to any keyboard keys First time ever creating html canvas game. Once I finally got my sprite ant tiles drawn on the canvas, now I want to make my sprite interactive. Unfortunately, for some reason it is not working. I get a message in console when the certain key is pressed but the sprite is not changing its position. I wonder why?  The code:

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

var mapArray = [
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 2, 2, 0],
  [0, 0, 1, 1, 1, 0, 0, 2, 0, 0],
  [0, 0, 1, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
]

var StyleSheet = function(image, width, height) {
  this.image = image;
  this.width = width;
  this.height = height;

  this.draw = function(image, sx, sy, swidth, sheight, x, y, width, height) {
      context.drawImage(image, sx, sy, swidth, sheight,x, y, width, height);
  }
  this.drawimage = function(image, x, y, width, height) {
    context.drawImage(image, x, y, width, height);
  }
}

/* Initial Sprite Position */

var boatPosX = 230;
var boatPosY = 200;

var Loader = function(src) {
  this.image = new Image();
  this.image.src = src;
  this.image.onload = function() {
  var sprite = new StyleSheet(background, 36, 36);
  var ship = new StyleSheet(boat, 90, 100);
  for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {
      if (mapArray[i][j] == 0) {
        sprite.draw(background, 190, 230, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 1) {
        sprite.draw(background, 30, 30, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 2) {
        sprite.draw(background, 200, 20, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
    }
  }
  ship.drawimage(boat, boatPosX, boatPosY, 50, 50);
}
  return this.image;
}

/* Sprite controls */

function move(e) {
  if (e.keyCode == 39) {
    boatPosX += 2;
    console.log("works");
  }
  if (e.keyCode == 37) {
    boatPosX -= 2;
  }
}

  document.onkeydown = move;

var background = new Loader("ground.png");
var boat = new Loader("ship.png");

console.log(background);

sentences:
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:
Problem modifying GameObject in list of GameObjects Unity So I've been working on a little project that involves Valve's "Portal" style portals, the type where you can seamlessly see what's on the other side and walk through. I've run into a problem when it comes to teleporting an object to it's new location upon hitting the portal. I have a List<GameObject> that contains all the objects that are in close enough range to feasibly travel through the portal, but when I try to modify the transform.position of one of these GameObjects, nothing happens, no error messages.
So I've been going through my script line by line and writing little dummy functions to test different parts of it to see where the problem lies, and everything seems to work up until I index the list and try to modify a value, nothing happens. So was thinking that perhaps the List doesn't actually contain a reference to the GameObject in the scene, but simply a copy of the GameObject's data at the time it was passed into the list. So I checked this by making the list public so that I see it in the inspector, and when I click on an item in the list it highlights that same GameObject in the hierarchy, which suggests it is actually a reference. See bellow...

I am at a loss as to what's happening here and would really appreciate if anyone could offer a suggestion, Here is the dummy function where I try to arbitrarily modify the GameObject data from the List...
        if (Input.GetKeyDown("k"))
        {
            for (int i = 0; i < trackedTravelersObjects.Count; i++)
            {
                trackedTravelersObjects[i].transform.position += new Vector3(0, 30, 0);
                Debug.Log("K");
            }
        }

You'll notice a Debug.Log("k"), this is just to check that the code is actually being called, which it is.
Thanks.

sentences:
How important is a single-player mode in a 2-player game? So say you have a 2 player game, taking Chess as an example (except it's an original game with no ready-to-go AI available).

Let's say there's also a social-aspect to the meta-game, so let's say it's a Chess game on Facebook where you can challenge your friends.

How important is it to have a single-player mode, knowing that an AI will need to be created (I've done minimax AI for tic tac toe, but nothing too sophisticated)?

Is it important enough that it should be in the initial launch of the game?

Can it wait for a future iteration (knowing that being hosted on the web means the game can be updated at any time)?

sentences:
Converting UnityScript code to C#: What is the alternative for .ToBuiltin? I'm trying to convert this code from UnityScript (Unity's version of JavaScript) to C#:

var polys = new Array(); // array to collect vertex locations
polys.Push((scanpoint + padding) + Vector2(0.5, 0.5) * Pixel_vs_Unit_Scale);
var poly:Vector2[] = polys.ToBuiltin(Vector2);

I converted the first two lines like so, with no errors:

var polys = new List<Vector2>();
polys.Add((scanpoint + padding) + new Vector2(0.5f, 0.5f) * Pixel_vs_Unit_Scale);

But when I try to adapt the last line like this:

Vector2[] poly = polys.ToBuiltin(Vector2);

I get two errors:

  ToBuiltin does not exist.

And also an error on the Vector2 inside the ():

  Vector2 is a type which is not valid in the given context.

How can I convert this code to C# correctly?

sentences:
How to avoid checking the same triangle twice in collision detection with spatial hashing I'm implementing a spatial hashing system to speed up my collision detection, but I've run into a problem. Since a triangle can be hashed into multiple buckets, how do I ensure that I don't check the same triangle multiple times?

I've though about having each struct Triangle have a list of pointers to each triangle it has been checked against, as well as a double lastTimeChecked. That way, if the lastTimeChecked was less than the current time, I would know all that data was invalid. This seems inefficient because I am guessing I would have to have this list be a std::vector since I won't know ahead of time how big the list should be.

Then, each time I want to check one triangle against another, I check each triangle's list of triangles it has been checked against to see if either has been checked against the other. Is this the most efficient way to do it?

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:
In OpenGL, what does it mean to make a context current? I have a few questions :

1 - What does it mean to make a context current? Does it mean that all subsequent OpenGL calls will apply to that context/window?

2 - With GLFW3, how to use multiple windows (say, 2)? Is it enough to create 2 windows/contexts, make the context current on the first one, draw things, then make the context current on the second window, and draw things?

3 - How does it all fit together with an OpenGL loading library (like gl3w)? When I initialize gl3w once after creating the contexts, will the OpenGL calls work on the context that is current even if I change it alot or will I have to re-initialize gl3w each time I make another context current?

sentences:
Mental Ray render loss in Maya? The option in the rendering menu of Maya doesn't say "Mental Ray" anymore.
Please help me to get it back, or even a better plugin for Maya game quality rendering.

sentences:
How to damp the velocity of an object only in one axis in Box2d? I want to damp the velocity of a ball linearly on the x-axis. but when applying linear damping on the ball, the damping also applies in the y-axis which makes it look like its floating.

I tried to refer the Manual but it says: "Damping parameters should be between 0 and infinity, with 0 meaning no damping, and infinity
meaning full damping. Normally you will use a damping value between 0 and 0.1. I generally do not use
linear damping because it makes bodies look like they are floating."

So how can I damp the ball in the axis while there is no damping in the y-axis

sentences:
Unity and lots of objects. Can this way of designing levels bring problems? Ok, question.

I've been fiddling for Unity for a while and now trying to make a cohesive game.

Up until now I've found the quickest way to design levels for me is to create a block of wall/floor to work as a "unit", and copy it lots of times.

The result is something like this

The blocks are basically just a transform + a sprite renderer + a box collider.

Now my question is: Can this approach bring problems given that it basically creates lots and lots of objects? If so what alternatives there are? Creating bigger blocks?

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

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

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

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

sentences:
Implementing getters for a singleton script in unity Ok the title might be a bit confusing but what I want to do is make a getter that returns the class, exactly like unity does with the camera.current.

You should just be able to go class.current and get the running instance of the class but I have no idea how to do this as it would most likely be a static method but how would you return the class form a non static class without some sort of out of class variable? or do you have to make the class static?

sentences:
How to prevent "underwater sight" in games In many games where the player can go underwater, it seems like when you look where the top half of the screen is in the air, and the bottom half the screen is in the water, it's almost like the water doesn't exist and the player is... flying slowly with water sounds?

Is  there a logical way to solve this? An algorithm? Doesn't seem like any solution has come up yet since many games still have this. I don't want to make the same mistake.

sentences:
How do I draw 2D textures with Direct3D 11.1? I'm running into trouble trying to figure out the best way to draw textures to the screen using Directx 11.1 (for Metro apps).

In XNA, I used SpriteBatch. Is there something partially comperable?

In the Win8 SDK examples, they used WIC and Bitmap, although it suggests that that is not the best way to draw 2D graphics with the best performance.

sentences:
How to limit camera pitch (x rotation) between two angles I use this script rotate the camera on its local X axis:

 float v = verticalSpeed * Input.GetAxis("Mouse Y");
 transform.Rotate(-v, 0, 0);

Right now this lets the player look up & down without limit, wrapping around a full 360 degrees. How can I limit this so they can look only 90 degrees up or 90 degrees down from the horizon?

sentences:
missiles skip in collision detection I'm trying to work on spaceinvader. I have problem that missiles or the bullets skip frames due to its fast speed. I tried to use the previous position of the bullet in the collision check, but still, the collision does not work. it's pretty working on bullets with slow speed. Kindly see the attached video.
https://www.youtube.com/watch?v=jOVc-HGNI9Q&feature=youtu.be

  void Bullet::Update(float dt)
{
    Position.y -= 0.50 * dt;

    Vel = (Position - prevPosition).GetNormalised();

    if (Position.y < 0)
    {
        IsDestroyed = true;
    }
    else
        IsDestroyed = false;

    prevPosition = Position;

}

and for collision check:

// if there is intersection
        if (IntersectsWith((*it)->BoundingRect, barrierRect))
        {

            // subtract (*it) bullet position from barrrier's rect
            int normX = (*it)->prevPosition.x + (*it)->Vel.x - barrierRect.x;
            int normY = (*it)->prevPosition.y + (*it)->Vel.y - barrierRect.y;

            // barrier image pixels
            uint32* ptr = (uint32*)pixels;
            // height of the barrier

            int pixelOffset = normY*51 + normX;
            unsigned int color = ptr[pixelOffset];
            // look up the color if its not black, it should be green
            if (color != 0xFF000000)
            {
                // delete the bullet
                Bullet *bullet = *it;
                it = ship->Bullets->erase(it);
                delete bullet;
                ship->Canfire = true;
                isCollision = true;

                // blast a circle around that bullet hit position
                int radius = 9;
                for (int y = -radius; y <= radius; y++)
                {
                    for (int x = -radius; x <= radius; x++)
                    {
                        if (x*x + y*y <= radius*radius)
                        {
                            int j = x + normX;
                            int i = y + normY;
                            int pixelOffset = i*51  + j;
                            ptr[pixelOffset] = 0xff000000;
                        }
                    }
                }

            }

sentences:
Why is the button's code not running? My script for a slot machine isn't working. When the button in the Bilboard GUI is clicked, the below dosen't run. I am new to scripting and this is mostly based on wiki/stack exchange/ Dev page info.

local player = game.Players.LocalPlayer
local textLabel = script.Parent
local toggled = false
local button = script.Parent

textLabel.Text = "Click to Play for 5 Cash!"
slot1Combos = {"Bar", "Seven", "Seven", "Seven", "Cherry", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana"}
slot2Combos = {"Bar", "Seven", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange","Orange","Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana", "Banana"}
slot3Combos = {"Bar", "Seven", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange","Orange","Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana", "Banana"}

local function onButtonActivated()
    if toggled == false then
        toggled = true

        x = math.random(1,23)
        y = math.random(1,23)
        z = math.random(1,23)
        g = false
        player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value - 5
        if slot1Combos[math.floor(x)] == "Bar" and slot2Combos[math.floor(y)] == "Bar" and slot3Combos[math.floor(z)] == "Bar" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 60
            textLabel.Text = "You Got 3 Bars. You won 60 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Seven" and slot2Combos[math.floor(y)] == "Seven" and slot3Combos[math.floor(z)] == slot2Combos[math.floor(y)] then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 40
            textLabel.Text = "You Got 3 Sevens. You won 40 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == slot2Combos[math.floor(y)] and slot3Combos[math.floor(z)] == slot2Combos[math.floor(y)] then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 10
            textLabel.Text = "You Got 3 of a Kind. You won 10 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"

        elseif slot1Combos[math.floor(x)] == "Cherry" and slot2Combos[math.floor(y)] == "Cherry" and slot3Combos[math.floor(z)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 20
            textLabel.Text = "You Got 3 Cherries. You won 20 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Cherry" and slot2Combos[math.floor(y)] == "Cherry" or slot3Combos[math.floor(z)] == "Cherry" and slot1Combos[math.floor(x)] == "Cherry" or slot2Combos[math.floor(y)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 3
            textLabel.Text = "You Got 2 Cherries. You won 3 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Cherry" or  slot2Combos[math.floor(y)] == "Cherry" or  slot3Combos[math.floor(y)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 3
            textLabel.Text = "You Got 1 Cherry. You won 3 cash"
        else
            textLabel.Text = "Sorry, you didn't win"
            wait (5)
            textLabel.Text = "Click to Play for 5 Cash!"

        end
    end
button.Activated:Connect(onButtonActivated)
end)

This is the explorer tree with the script highlighted

sentences:
Problem drawing text in a for loop for (int i = -5; i < 5; i++)
{
    Rectangle screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);
    spriteBatch.Draw(foregroundTexture, screenRectangle, Color.White);

    Rectangle backGroundRectangle = new Rectangle(x + screenWidth * i, 0, screenWidth, screenHeight);
    spriteBatch.Draw(backgroundTexture, backGroundRectangle, Color.White);

    spriteBatch.DrawString(font, "Variable i:  " + i, new Vector2(0, 0), Color.Brown);
}

I want to show on the screen when I'm running the game the counting of i
like: -5 , -4 , -3...but not in a line, just like a timer. -5 then overwrite it and show -4 overwrite it and show -3 and so on...like seconds of a clock.

The problem is I'm getting a strange painting near the numbers like its repeating and painting something there all the time.

sentences:
Chromium Embedded Framework and Unity3D? I have recently heard about the Chromium Embedded Framework and was over-joyed as I want to use html as my GUI source.

I did find a C# version but it seems to be for Windows Forms.

I'm not too terribly well versed but I was under the impression that it may cause it to be unavailable for cross-platform use.

Can anyone provide and insights? And if this will not work, any free alternatives?

sentences:
Flowfield density conversion I'm trying to implement flowfield navigation, as described in http://grail.cs.washington.edu/projects/crowd-flows/
but I can't understand how the Density Function in Figure 4 of the paper is supposed to handle unit radius.

Has anyone ever implemented that and can provide more information?

This is the part in question:

Their algorithm seems to be using only 4 cells, pointing to the lower left of the unit, so is this some kind of kernel that needs to be applied multiple times?

Thanks.

sentences:
How can I access a GameObject variable in mono script from editor script? In the mono script :
using UnityEngine;

public class TileTest : MonoBehaviour
{
    public GameObject prefabPathOnTerrain;

Then in the editor script at the top :
private SerializedProperty prefabPathOnTerrain;

Then inside OnEnable()
private void OnEnable()
    {
        prefabPathOnTerrain = serializedObject.FindProperty("prefabPathOnTerrain");
    }

And then inside a method I want to use it as a GameObject :
And instead using CreatePrimitive to use Instantiate :
But doing :
GameObject go = Instantiate(prefabPathOnTerrain);

Will not work.
public void TerrainObjects(GameObject gameobject)
    {
        Terrain terrain = Terrain.activeTerrain;
        var cube = GameObject.Find(string.Format("Terrain_{0}_{1}", gameobject.transform.localPosition.x, gameobject.transform.localPosition.y));
        if (cube != null)
            return;

        if (cube == null)
        {
              GameObject go = Instantiate(prefabPathOnTerrain);

            //cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
        }

        cube.transform.localPosition = new Vector3(terrain.transform.localPosition.x + gameobject.transform.localPosition.x, 0, terrain.transform.localPosition.z + gameobject.transform.localPosition.y);
        cube.transform.localScale = new Vector3(gameobject.transform.localScale.x, gameobject.transform.localScale.y, 1);
        cube.transform.parent = GameObject.Find("Terrain Map").transform;

        cube.name = string.Format("Terrain_{0}_{1}", gameobject.transform.localPosition.x, gameobject.transform.localPosition.y);
        cube.tag = "Terrain Map";
    }

sentences:
How to create a character animation where the parts of the sprite change? Let's say I'm creating a game (in Java or C++). In this game I have a character that can do a sword swing animation, but the character can equip different swords.

Do I have to make an animation for each individual sword, or is there another way? I Like if a character can equip different armors, do I create a new sprite for each armor, or is there a way to have, say a base character that can perform all the animations with different swords and can have different armors on the same image?

sentences: Is a simple PolygonCollider2D really worse than several BoxCollider2Ds? In my scene I have very simple quadrilateral blocks, which I'm considering using PolygonCollider2D for. These blocks will be the building blocks of the scenery so there will be a lot of them, and I'd like to use the most efficient technique for them. Now, since I don't really know what kind of optimization Unity does for collisions, I was wondering: would rotating and combining several BoxCollider2Ds be more efficient? And is a quadrilateral BoxCollider2D even worse than a rotated BoxCollider2D (which from a mathematical point of view wouldn't be able to apply an AABB collision scheme either) in the first place?

sentences:
Why is the alpha value of a Sprite in LibGdx 0.99607843 and not 1? I'm developing a game in LibGDX and one of my problems is related to the alpha value of a Sprite object.

If I create a new Sprite sprite object then sprite.getColor().a is equal to 0.99607843 and not 1. If I try to set sprite.setAlpha(1) it still sets it to 0.99607843. I also tried doing sprite.getColor().a = 1; but it still didn't work. My question is why is that? Is this just a limitation in LibGDX or am I doing something wrong?

(I put an issue on the official lib gdx github page. As of now the issue has been solved just because it was a duplicate of another issue, from what I get this problem is because of lib gdx, but the alpha still gets corrected on the shader side.)

sentences: Any problems with flipping a sprite by scale? (2d Platformer) I am wondering if there are any problems with flipping a sprite on the x-axis using vector2 to tell which direction it is facing/flip. Though doing this helps me write less code for Ray-cast direction and creating single states with a single animation (using 1 animation player facing right than using 2 animation facing left and right). If there is a better solution please tell me and thanks. Btw I am still pretty new and learning.

sentences: How do I determine which side of the player has collided with an object? I have some static bodies (platforms) and a dynamic body (the player) in my world. The collision between them works great, but I would like to know which side of the player (rectangle) collides with the platform. How do I get this information?

sentences:
How to set speed based on screen size I am making a breakout clone for mobile and was wanting to make the ball speed to be related to the screen size.  Larger screen would mean faster speed.

Right now I have it set like so:

dirx=math.random(-5,5)*(maxx/320)
diry=math.random(3,7)*(maxy/480)

My reasoning for this is that 320x480 is iPhone resolution so I figured it would be a good base to start at.  For the record, it actually runs pretty well on iPhone setting.

Then for the actual movement I just add dir to the appropriate direction.

ball.x=ball.x+dirx
ball.y=ball.y+diry

The problem is if I change to a device with a larger screen resolution, the ball is crazy fast and is very jumpy.

Is some kind of formula that I can use to multiply to the random that will make the speed appear uniform across devices?

sentences: camera.render reads a file in the middle of a gameplay Why does camera.render read a file in the middle of a gameplay? This causes a lag in my game:

sentences:
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 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:
Is Frustum culling still needed today? I'm reading about efficient Frustum culling algorithms. I found an article about a smart method that first use the Frustum AABB (Axis Aligned Bounding Box) to eliminate most of the scene before check again against the actual frustum representing the camera.

I didn't do any performance test yet, but maybe somebody else did and can answer this question.

Let's say I'm using an Octree to quickly check again the camera bounding box. But I do not want to do a second pass again the camera planes. If I simply render everything so far, isn't that actually faster than do the second pass?

Assume object geometry is loaded into VRAM using hardware vertex buffers.

sentences:
XNA 2D Collision Detection with Rectangles: Helper Objects? Per this excellent question, and excellent answers, I am attempting to write a breakout clone.

Regarding the collision detection against the walls, does XNA provide a set of helper methods/objects to determine which side of the rectangle was hit? I'd like to use the Vector2.Reflect method to properly create a new velocity vector, but it requires the proper normal. I can write the methods to figure out which side was hit, and thus which normal to use, but I wanted to know if XNA provided code to handle this already.

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:
Why aren't resources such as Pixmap disposed on finalization in LibGDX? I've been looking at the LibGDX framework, and certain classes such as Pixmap require to be disposed manually when you are no longer using them (call the dispose method).

I'm wondering, since this is Java, why did they not choose to dispose the resources on Pixmap finalization? That is, override the finalize method to automatically call dispose. If an object is finalized, then that means that the Garbage Collector determined no hard references to it, so clearly no one is using the Pixmap and it is fine to dispose it.

What particular advantages are there to calling it manually rather than use the finalization method?

sentences:
Moving unit along a computed path I am generating a path using pathfinding.js. This returns a path of node coordinates from a matrix. Example:

var matrix = [[0,0,0,0], //0 are passable, 1 are obstacles
              [0,1,1,0],
              [0,1,1,0],
              [0,0,0,0]]

var path = [[0,0],[0,1],[0,2],[0,3],[1,3]] etc.

I now wish to convert this to path to something like, takeoff(), turnLeft(), forward(4) etc.

What this process called, I have had a look at many programming books and guides but they seem to ignore this method or miss it out. I also had a go at it myself but can't figure out the direction of unit that is being moved along the path.

sentences:
How do I prevent a Box2d dynamic body from sticking to static body walls in zero gravity? I'm still making this air hockey game. I have it mostly there now, but the dynamic body which is the puck always sticks to the walls (static body rectangles that form the border of the table).

I read on box2d forums that there is a setting called b2_velocityThreshold, which needs to be set to 0 for games like billiards. I'm assuming that would help me, here, but I can't find any such setting in libgdx box2d.

Is there any setting which I can change to allow the puck to bounce off the walls? If not, how should I go about making such a game in libgdx?

sentences:
Animate Gradient Material Offset in Babylon.js I'd like to create an animated gradient material in babylon.js. I set up my gardient mateiral like this:
   var gradientMaterial = new BABYLON.GradientMaterial("grad", scene);
   gradientMaterial.topColor = new BABYLON.Color3(0, 0, 1);
   gradientMaterial.bottomColor = new BABYLON.Color3(0, 0, 0);
   gradientMaterial.offset = 0.8;
   gradientMaterial.offset = test;
   gradientMaterial.smoothness = 1;
   sphere.material = gradientMaterial;

I render my scene in the render loop:
    engine.runRenderLoop(function () {
    scene.render();
    }); code here

I'd like to animate the gradientMaterial offset so that every 5 seconds it repeats. I'm just not sure where to iterate the .offset value.

sentences:
Using a JS Query to work as an HTML Anticheat? So, I have a project, its a "cookie clicker" by definition, and I wish to work out how I can protect the game from users being able to edit <button id="cooker" onclick="cookieClick(1)"></button> and setting (1) to like (123129).

I tried a few things first:
JQuery:
I tried using an old on() function with a dom searching function, and then to run an alert saying "Dumb Hacker! Im corrupting your save data" and then of course it would run Function clearDat() then function corrupt() which clears the localstorage data and sets it to an invalid value (usually wounds up as NaN) which prevents them from Playing.

Unfortunately the cookieclicker was editing the program so hastily, that it was "changing" the button above, and I wound up getting a million alerts
(And because I was using a windows based HTML editor, I was getting WINDOW alerts, which i had to spam esc and try to delete the alert function and rerun the whole game, it was a pain)

I also tried a similar method using an old JS function, but it wound up not working.

I think you may see where im getting at, I'm really stuck in a pickle.

Heres the current code: https://hatebin.com/tgsdqzhzlc

sentences:
Problem with FPS camera in Software Renderer I am currently creating a software renderer (I know they aren't particularly useful anymore, it is purely from a knowledge and learning standpoint). I am using GLM and following OpenGL rules(as GLM is designed for OpenGL).

It's currently pretty basic, just a cube being rendered as either a pixel for each vertex or as a wireframe. Everything was going fine with it till I implemented camera controls. The camera works fine until there is a model directly behind it in the world space. The model behind the camera will be rendered, but flipped (hard to tell which axis it has been flipped on due to it being wireframe). The controls for moving forward and back become inverted. If I put one object in front of the camera and one behind, they are both visible but when the camera moves forward one model moves closer while the other moves further away.

I am not sure if this is a bug or a limitation of the mathematics involved. From what I can tell it is a problem with the perspective division (which is being handled by GLM). It seems that when the camera crosses the Z of an object, it gets flipped. If I spin the camera around the object everything is fine, this only happens when the object is behind the camera. Is this likely to be a bug in my code, or is this normal and anything not in the camera's field of view needs to be culled to stop this happening? (I know things will need to be culled at some point for performance anyway).

The code is a mess at the moment so I am just cleaning it up so it is readable, in case this is likely a bug in my code.

sentences:
Monogame - All effects in one file? I am successfully drawing all of my geometry with an AlphaTestEffect and would like to apply shaders. I've built a shader Effect from a tutorial and can't seem to find anything on the web that answers my question:

Does monogame support passing separate effects with the same geometry to the Graphics Device, or do you have to perform all Techniques you intend to apply to a model in the same effect?

sentences:
OpenGL - have object follow mouse I want to have an object follow around my mouse on the screen in OpenGL. (I am also using GLEW, GLFW, and GLM). The best idea I've come up with is:

Get the coordinates within the window with glfwGetCursorPos.

The window was created with

window = glfwCreateWindow( 1024, 768, "Test", NULL, NULL);

and the code to get coordinates is

double xpos, ypos;
glfwGetCursorPos(window, &xpos, &ypos);

Next, I use GLM unproject, to get the coordinates in "object space"

glm::vec4 viewport = glm::vec4(0.0f, 0.0f, 1024.0f, 768.0f);
glm::vec3 pos = glm::vec3(xpos, ypos, 0.0f);
glm::vec3 un = glm::unProject(pos, View*Model, Projection, viewport);

There are two potential problems I can already see. The viewport is fine, as the initial x,y, coordinates of the lower left are indeed 0,0, and it's indeed a 1024*768 window. However, the position vector I create doesn't seem right. The Z coordinate should probably not be zero. However, glfwGetCursorPos returns 2D coordinates, and I don't know how to go from there to the 3D window coordinates, especially since I am not sure what the 3rd dimension of the window coordinates even means (since computer screens are 2D). Then, I am not sure if I am using unproject correctly. Assume the View, Model, Projection matrices are all OK. If I passed in the correct position vector in Window coordinates, does the unproject call give me the coordinates in Object coordinates? I think it does, but the documentation is not clear.

Finally, to each vertex of the object I want to follow the mouse around, I just increment the x coordinate by un[0], the y coordinate by -un[1], and the z coordinate by un[2]. However, since my position vector that is being unprojected is likely wrong, this is not giving good results; the object does move as my mouse moves, but it is offset quite a bit (i.e. moving the mouse a lot doesn't move the object that much, and the z coordinate is very large). I actually found that the z coordinate un[2] is always the same value no matter where my mouse is, probably because the position vector I pass into unproject always has a value of 0.0 for z.

Edit: The (incorrectly) unprojected x-values range from about -0.552 to 0.552, and the y-values from about -0.411 to 0.411.

sentences:
How would I translate screen coordinates to Isometric coordinates? I have a function isoToScreen(x, y) that converts Isometric coordinates to Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how would I make a function that converts screen coordinates back to Isometric coordinates?

var pos = screenToIso(16, 8);
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y

sentences:
Methods for generating a map I'm looking to create a simple, "randomly" generated map for a small game.

The game consists of a top-down view of a world, with land-mass and ocean areas.  Think of a simple outline map of the world for example.

The closest thing I can think of that I've seen before was the level-generator for the old SimCity games, or the Civ series, where you can set a preference for single continent versus many islands, etc.

What sort of algorithm would be suitable?  The map will need to be moderately zoomable, so I can have a "whole world" view, and also a more zoomed-in local view, but I think I'll sort that out later.

Initially I don't need any concept of heights, just two areas - land and sea, although I might extend it later.

sentences:
How do I configure a joint for a sliding door in Unity? I have this sliding door where i want to use a joint to limit its motion:

...but I am confused about how to configure a joint to provide this sliding motion.

I've found the Hinge Joint component, but the comments below say this is for rotating motion. What kind of joint do I use to create a sliding motion?

sentences:
Simulate dirt spread (Normal distribution?) -This question is technically more math related, but it has to do with a simulation so I am here first. I can post this in the math SE instead if needed.

I am in the process of trying out some mesh deformation simulating the effect of sand/dirt being poured in a pile (Think hourglass sand) and I am trying to determine the best way to calculate the spread instead of becoming increasingly taller. I don't intend on actually matching sand/dirt physics, I just want to get my mesh to be somewhat close to the shape that pile would make as it grows.

I'm pretty sure that Normal Distribution is what I want, so in my desmos graph below, think of f(x) -green line- as the current dirt/sand piling up (where I am at in my code) and f1(x) -purple line- as the spread version (what I want to happen instead).

f1(x) is not correct but I think it is pretty close. Essentially i need the area of f1(x) to always equal the area of f(x) but as f(x) gets taller, f1(x) gets wider and taller, but not as tall as f(x).

https://www.desmos.com/calculator/ir8if2u8qq

I hope this makes sense to you gurus. If not, I can try to clarify more.

Edit: Also, if you open that graph, the slider for variable 'h' is the one im essentially trying to work with.

sentences: Would it be possible to randomize LOD distance in unity like in BOTW grass I was studying the BOTW grass shader and noticed how the grass appears uniform at a distance but complex up close. From watching gameplay it appears the LOD is randomized to make the transition between the two types of grass smooth. I can't find any way to do something like this in unity and am wondering if anybody has advice, or can guess as to how they did it. Thanks!

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:
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:
Unity 3D rotating object around 2 axes rotates it around 3 I am developing a 3D space shooter and I've fount that when triying to rotate the ship using X and Y axes it also rotates on the Z axe.

The answer
here helped me a lot, but now when I try to rotate on 3 axes I have the same problem on the 2 axes sharing local space.

The code I have right now is this:

    float rotZ = 1;
    float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
    float rotUpDown = Input.GetAxis("Mouse Y") * mouseSensitivity;
    transform.Rotate(0, rotLeftRight, 0, Space.World);
    transform.Rotate(-rotUpDown, 0, 0, Space.Self);
    transform.Rotate(0, 0, -rotZ, Space.Self);

Anybody knows how to make all 3 rotations independent from each other? Thanks!

sentences: What are good solutions for serialization in C++? I'm curious what solutions game developers have come up with for serializing the different types of data that they deal with for their games. Do you guys use some monolithic GameObject hierarchy that houses a serialization interface for derived types, use sort of custom RTTI-based solution, perform explicit stream serialization for certain classes, or use some of the open source solutions (boost::serialization, s11n, etc).

sentences:
What is Vector Projection and what is it's use in games? Couldn't find a clear enough answer on Google.

I know what vectors are. But what does it mean to project a vector onto another, and what is it used for in games?

sentences:
In Unity, my joystick button only works a few times, why? My part of the input code looks like this:

void Update()
{
    y_input = Input.GetButtonUp(StaticStrings.Y);

    delta = Time.fixedDeltaTime;
    states.Tick(delta);
    ResetInputNStates();
}

void GetInput()
{
    vertical = Input.GetAxis(StaticStrings.Vertical);
    horizontal = Input.GetAxis(StaticStrings.Horizontal);
    b_input = Input.GetButton(StaticStrings.B);
    a_input = Input.GetButton(StaticStrings.A);
    y_input = Input.GetButtonUp(StaticStrings.Y);
    x_input = Input.GetButton(StaticStrings.X);
    rt_input = Input.GetButton(StaticStrings.RT);
    rt_axis = Input.GetAxis(StaticStrings.RT);

    if (rt_axis != 0)
        rt_input = true;

    lt_input = Input.GetButton(StaticStrings.LT);
    lt_axis = Input.GetAxis(StaticStrings.LT);

    if (lt_axis != 0)
        lt_input = true;

    rb_input = Input.GetButton(StaticStrings.RB);
    lb_input = Input.GetButton(StaticStrings.LB);

    rightAxis_down = Input.GetButtonUp(StaticStrings.L) || Input.GetKeyUp(KeyCode.T);

    if (b_input)
        b_timer += delta;

    d_x = Input.GetAxis(StaticStrings.Pad_X);
    d_y = Input.GetAxis(StaticStrings.Pad_Y);

    d_up = Input.GetKeyUp(KeyCode.Alpha1) || d_y > 0;
    d_down = Input.GetKeyUp(KeyCode.Alpha2) || d_y < 0;
    d_left = Input.GetKeyUp(KeyCode.Alpha3) || d_x < 0;
    d_right = Input.GetKeyUp(KeyCode.Alpha4) || d_x > 0;
}

The problem is that my Y button is connected with the function of changing from one hand weapon to two hand weapon, but the Y button only works a few times in game!

e.g., I have to press about 3 times then it works.

How do I solve this?

sentences:
Simplyfing/dissolving octree to simple boxes by adjacent octants with similar traits I am looking forward to create a navigation volume to be utilized by AI actors.

The approach I am trying to tackle here is to first generate an octree and associate with respectable flags/data (type, what's contained for now). The octree is going to be fairly deep (up to 0.1 units).

This is the scene I am using for testing purposes:

results in 1947817 nodes in 9 levels. (22 x 9 x 22)

I am looking for an algorithm/concept/pseudo-code that would transform this octree into non-uniform, axis-aligned boxes derived from octants that match certain flags/data, that would, for instance, help me determine the navigation volume similar to what can be seen here (Havok):

With "I am looking for" - I have a feeling of such an algorithm/concept already existing, though, I am not sure. The feeling drives me towards this being a fairly mathematical problem that resides behind a common name.

The other approach would be to utilize a non-uniform grid (creates 4356000 cells) for the detailed shape to then be expanded (simplified) down to some boxes. Which my feeling tells, would utilize the same algorithm.

As for the "what have you tried part" - well... I have googled for some time with various combinations from keywords grid, merge, cell, flags, occupied, gamedev, octant, grow, largest space, adjacent and maybe some others to no avail.
Well, before pushing the Post button, I did try some more keywords and ended up with this answer: https://gis.stackexchange.com/questions/23365/how-to-combine-adjacent-polygons-sharing-similar-trait-into-single-polygon which appears to be close to what I am looking for, except that it's 2D (though, I gave the keyword "polygon" for this query). Having learned that the process is called "dissolve", I made some more attempts with various combos with added word "dissolve". And through my findings some more searches and so on... Well... nothing.

If the answer wont yield any results, I know that I could attempt this by raying the hell out of the graph by starting at either corner and flooding through it all, basically, brute forcing my way.

So...

Is the common algorithm/concept already out there, that I could be pointed towards?;
or - what guidelines should I follow to produce such a product?

sentences:
Changing color of only one gameobject So i have this script the checks if my mouse cursor is over the block and if it is i want the block to change color

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

public class BasicBlockFunction : MonoBehaviour {

public GameObject Block;
public Color StartingColor;
public Color HighlightColor;
Color color;
Ray ray;
RaycastHit hit;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    MouseOver();
}

void MouseOver()
{
    ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    if (Physics.Raycast(ray, out hit))
    {
        print(hit.collider.name);
        Block.GetComponent<Renderer>().material.color = HighlightColor;
    }
    else
    {
        Block.GetComponent<Renderer>().material.color = StartingColor;
    }

 }

}

I want to change the color only for the gameobject i have my mouse on.

sentences:
How to move a object to a target point like sine wave in 2D world I want to move my gameobject to move point A to target point B like sine wave, I have used Vector2.Lerp but its just straight line.
so far I tried many ways and I managed this

//sine wave
vLastPos = new Vector2(transform.position.x , Mathf.Sin(Time.time)*2f+2f);
transform.position = vLastPos+Vector2.right*Time.deltaTime;

but the problem is its moving the gameobject left to right not to target position. the gameobject shold reach the target position and stop. please help me.

sentences:
Diamond Square Algorithm - How to fix horrible diamond shaped artefacts and spikes? I was attempting to follow this article explaining the implementation of a wrapping version of the diamond square algorithm.

I tried running it with dimensions of 128x128 and a "feature size" of 16, like in the article, but the resultant terrain is this monstrosity:

I read through past questions on this topic and am aware that there can be some issues with somewhat noticeable diamond or square shaped artifacts when using this algorithm, but this is definitely beyond that.

Here is my code:

private float GetHeightAtPoint(int x, int z)
{
    if (x < 0) { x = width + x; }
    if (z < 0) { z = height + z; }

    return fractal[(x % (width - 1)) + (z % (height - 1)) * width];
}

private void SetHeightAtPoint(int x, int z, float value)
{
    if (x < 0) { x = width + x; }
    if (z < 0) { z = height + z; }

    fractal[(x % (width - 1)) + (z % (height - 1)) * width] = value;
}

private void SquareStep(int x, int z, int size, float value)
{
    int halfSize = size / 2;

    float a = GetHeightAtPoint(x - halfSize, z - halfSize);
    float b = GetHeightAtPoint(x + halfSize, z - halfSize);
    float c = GetHeightAtPoint(x - halfSize, z + halfSize);
    float d = GetHeightAtPoint(x + halfSize, z + halfSize);

    float meanHeight = (a + b + c + d) / 4.0f;
    float adjustedHeight = meanHeight + value;

    SetHeightAtPoint(x, z, adjustedHeight);
}

private void DiamondStep(int x, int z, int size, float value)
{
    int halfSize = size / 2;

    float a = GetHeightAtPoint(x - halfSize, z - halfSize);
    float b = GetHeightAtPoint(x + halfSize, z - halfSize);
    float c = GetHeightAtPoint(x - halfSize, z + halfSize);
    float d = GetHeightAtPoint(x + halfSize, z + halfSize);

    float meanHeight = (a + b + c + d) / 4.0f;
    float adjustedHeight = meanHeight + value;

    SetHeightAtPoint(x, z, adjustedHeight);
}

private void DiamondSquare(int stepSize, float scale)
{
    int halfStep = stepSize / 2;
    for (int z = halfStep; z < height + halfStep; z += stepSize)
    {
        for (int x = halfStep; x < width + halfStep; x += stepSize)
        {
            SquareStep(x, z, stepSize, Random.Range(-1.0f, 1.0f) * scale);
        }
    }

    for (int z = 0; z < height; z += stepSize)
    {
        for (int x = 0; x < width; x += stepSize)
        {
            DiamondStep(x + halfStep, z, stepSize, Random.Range(-1.0f, 1.0f) * scale);
            DiamondStep(x, z + halfStep, stepSize, Random.Range(-1.0f, 1.0f) * scale);
        }
    }
}

/*
 * Generate a fractal map using diamond square algorithm and store in fractal[]
 */
private void GenerateFractal(int featureSize)
{
    fractal = new float[width * height];

    for (int z = 0; z < height; z += featureSize)
    {
        for (int x = 0; x < height; x += featureSize)
        {
            SetHeightAtPoint(x, z, Random.Range(0.0f, maxHeight));
        }
    }

    int sampleSize = featureSize;
    float randomScale = 1.0f;

    while (sampleSize > 1)
    {
        DiamondSquare(sampleSize, randomScale);

        sampleSize = sampleSize / 2;
        randomScale = randomScale / 2.0f;
    }
}

Could anyone give me any guidance here? One thing that was a bit suspect was that I had to make slightly different wrapping array access functions in order to make this run as I was getting negative values. You can see that my functions have the if statements checking for negatives, whereas the original implementation does not.

Thanks in advance

sentences:
Is XNA for iOS overkill? I'm working on iPAD game using MonoTouch which is similar to an IQ testing game. At the moment, I can write some simple games using basic UIImages and animations.

I'm wondering if I should learn XNA to create a game where people can throw a ball against a wall and see it bounce.

Has anyone seen any good examples of tutorials using XNA for simple 2d games?

sentences:
Clearing a gizmo list (OnDrawGizmos) I have a list of gizmos in a simple gizmo drawing manager. This list is updated from different parts of the codebase, usually from Update() methods. It goes something like this:

public class RenderGizmos : Singleton<RenderGizmos>
{
    private List<GizmoData> gizmos = new List<GizmoData>();

    public void AddNewGizmo(GizmoData[] gizmos)
    {
        this.gizmos.AddRange(gizmos);
    }

    public void AddNewGizmo(GizmoData gizmo)
    {
        this.gizmos.Add(gizmo);
    }

    void OnDrawGizmos()
    {
        if (gizmos == null) return;
        for (var i = 0; i < gizmos.Count; i++)
        {
            //draw gizmos
        }
    }
}

Can you advise me on when to clear the gizmo list? Ideally I would like to clear it every frame. However:

Clearing it at the end of the OnDrawGizmos() method will render no gizmos (as I suspect this method might be called several times a frame).
Clearing it in an LateUpdate()/Update() method is dependent on execution order, sometimes it draws gizmos, sometimes it doesn't
Clearing it in a Coroutine has rendered no gizmos (but it might just be dependent on the execution order as well)

I would like not to be dependent on the execution order so I prefer not to use the Script Execution Order system.

sentences:
How should I handle collectable/droppable/stackable items in an inventory? I am working on a game with an inventory system, but am trying to figure out the best way of doing it. I have read the post about adding WorldItems or InventoryItems to a list, which is fair enough and I figured that out myself anyway.

However, perhaps I add two SwordItems to this list (for example). I want the game to show that I have quantity 2 of these, not two individual items. What is the best way to achieve this with a List based inventory structure. I think I saw a GroupBy method, where I could GroupBy item type Sword. Is this a good way to achieve this? Or can you suggest a better alternative?

sentences:
Best way to keep track of game objects I'm not exactly sure how I should ask this question, and so the title may be misleading - I am not asking if I should use a list or a stack or a vector or a queue - but how I should go about keeping track of said storage object.

For example, let's say I have some object that would represent the game itself, and the game used state objects to tell what state it was in(IE, playing, paused, titlescreen, gameover screen, etc etc):

class Game
{
    //Constructors and what not
    private:
    stack<States*> states;
};

And then each state would keep track of the objects that it contained.

class States
{
    //Constructors and whatnot
    private:
    list<Mob*> listOfMobs;
    list<Bullet*> listOfBullets;
};

Now, what if I have a Mob spawn new Mobs, or have a Mob fire a bullet? I definitely don't want to pass the State itself down to all Mobs - I'd have dozens(or more) of copies of the State wandering around, which does not seem very wise. In the same sense, passing down the list of Mobs or bullets does not seem like the best idea either.
So, how should I handle this? I don't want to use global variables, and in the same way I wouldn't like to use a singleton pattern to keep track of it all - but I don't see very many other options. I might just be stuck thinking inside the proverbial box, though. How does everyone else handle tracking the objects in their game?

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:
How to make an object jump an equal height whenever it hits the ground? So, I want to make an object jump an equal height whenever it touches the ground. Something like a bouncing ball. But I can't use Physics Materials. Here are some ways that I tried:
Used Physics.CheckSphere:
isGrounded = Physics.CheckSphere(rayPoint.position, grounDistance, groundLayer);

if(isGrounded )
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

Used Raycast:
bool groundHit = Physics.Raycast(rayPoint.position, -transform.up, rayDistance, groundLayer);

if(groundHit)
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

In each cases, the object jumps a different amount of height each time it reaches the ground. How can I make it jump an equal height each time?

sentences:
Can Flash games packed for iOS and other mobile devices achieve reasonable performance? I was thinking of developing a game in Flash, as a hobby/educational project.

However, I was hoping I could make it run on a smartphone, but a friend who develops in Flash says that in their experience things will move really slow on the likes of an iPad when the Flash packager is used. So slowly that you can't use it commercially for fast-moving games.

Has anyone else experienced this slowness? Is there a way around it or is the technology just not there yet?

sentences:
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:
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 can I develop my Android game for different phone resolutions? For instance, the Motorola Droid is as wide as the G1, but has more height.

Should I try to spread the UI out across the extra height found on the Motorola Droid?  How do others handle this problem?

I'm not using OpenGL, but a SurfaceView for a 2D game.

sentences:
Is it possible to render / project / flatten a 3d model onto a 2d plane in Unity? If I have a 3d Object (character) could I use a renderer / shader / camera mode to essentially render the 3d object as a 2d sprite?
Not looking for a full tutorial on this one, I realize its a large question; just looking for a direction to head in.
My thought on this one is that it would be easier to create a 3d model and move it to a position for a book-style game. The character could be posed in a number of different positions. I'd add some sort of outline and Cel shader and outline to get the affect, but in order to get it to view properly on my otherwise 2d game, I would need it to be in a panel or something that could have a "Sorting Layer" added to it.

sentences:
Animate Using setScale() I want to animate my player from bigger size to smaller size and then smaller size to bigger size continuously.
We can use setScale() method to re-size any sprite but is there any way to animate with it?

And one more thing, if I scale any sprite after creating it's physics body, the sprite is visually scaled but the physics body does not scaled.

So is there any optimum solution to animate the physics body from bigger to smaller and then smaller to bigger?

sentences:
Fps independent rotation I'm trying in my game to have camera rotation speed idependent of fps. For keyboard it works without problems but not for mouse movoment. At 60 fps it works good but at 200 for example rotation is to slow.

mouse_dif is difference since last frame in pixels. Maybe thats a problem too, bigger screen resolution will rotate faster then smaller.

My code:

const float rot_speed = u.GetRotationSpeed(); // returns 5.f
float val = 0;

if(allow_input == ALLOW_INPUT || allow_input == ALLOW_MOUSE)
    val += float(mouse_dif.x)/200;

if(val > rot_speed*dt)
    val = rot_speed*dt;
else if(val < -rot_speed*dt)
    val = -rot_speed*dt;
u.rot += val;

How can I make it fps independent?

sentences:
Required number of images for octagonal tiles I'm planing to write a game based on octagon tiles. Currently I'm wondering how many images I really need. That is something about graph theory, I know that, but not only.

I want to connect each side of the eight sides, but in some cases I also want to connect all eight sides or just two so the complexity grows immense. If I'm not totally confused that ends in 88 which is 2048. Well of cause there are already many dublicated e.g. left to right is equal with right to left. When I'm very tricky I can rotate the image of left to right which I rotate by 90° to get top to buttom. I'm sure there are quiet more things like like mirroring.

My question is now how many images do I really need?

Here is my basic idea as image, of cause it still has some problems, as you can see on my image too but I think it should not be too hard to find a simple solution for such cases.

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:
What's an appropriate difficulty scale for weapon efficacy vs difficulty to obtain? I'm writing up a design document for a voxel based adventure game, similar to minecraft, but fixing a lot of fundamentally broken game mechanics, or at least updating those mechanics to be more suited to an adventure game.

I'm considering creating a weapon scale from 1-10, where weapons at 1 are least powerful, and weapons at 10 are most powerful. I was considering making the materials to make the weapon most common for the level 1 weapons, and 10x less common for the most powerful weapon, but if you look at minecraft, diamonds only occur in 0.1% of blocks and they still feel too common, unless you're prone to dying of course.

In keeping with the adventure focus, would it be better to have the higher tiers of weapons only come from monster drops, or from a combination of a rare monster drop and a mineable item, or are there other common game mechanics I could use to have a super powerful weapon that's also hard to get, but worth your time to get?

To state the question another way, for the time investment, should a weapon that's 10x as powerful take 10x as long to obtain, or 20x or higher? Are there any studies that show any correlation between "fun" in how long players will grind for an item and an appropriate time investment scale for obtaining equipment?

sentences: How to interact spheres with random walls I have a physics problem to deal with, I am asking here because a game developers often uses the efficient method. I have randomly distributed circles interacting to through Lennard-Jones potential or simply with a bounce back boundary condition to wall of random shape, as of know I am taking a V shaped wall. Please help me to understand an efficient algorithm the game developers uses for bounce back interaction.

sentences:
HLSL Triplanar texturing and multi texturing performance I'm stuck for my terrain rendering shader code for DX9. I'm looking to implement triplanar texturing, a texture atlas, and blending between different textures. Right now it's working. The problem is that it requires a total of 18 Tex2dLod calls and that is killing my frame rate. Also blending only works between textures which are next to each other in the texture map, if they are further apart it would go through all the different textures between them. Below is the relevant code from the pixel shader.

PSO PS(VSO input)
{
PSO output;
float4 texWeights = input.TexWeights;

int tile1 = clamp(floor(texWeights.x),0,1);
int tile2 = tile1 + 1;
float blendMultiTexture = max(0,texWeights.x - tile1);

float3 blendWeights = abs( input.TBN[2].xyz );   // Tighten up the blending zone:
blendWeights = (blendWeights - 0.2) * 7;
blendWeights = max(blendWeights, 0);      // Force weights to sum to 1.0 (very important!)
blendWeights /= (blendWeights.x + blendWeights.y + blendWeights.z ).xxx;
float2 coord1 = input.WSPosition.yz * TexScale;
float2 coord2 = input.WSPosition.zx * TexScale;
float2 coord3 = input.WSPosition.xy * TexScale;

TileTexCoords texCoords;
float2 texSize = float2(480,480);
float MIP = min(GetMipLevel(coord1, texSize),4);
texCoords = GetTextureCoordinates_Gutter(coord1 ,tile1,tile2);
float4 col1 = lerp(tex2Dlod(AlbedoSamplerX,float4(texCoords.UVA,0,MIP)),tex2Dlod(AlbedoSamplerX,float4(texCoords.UVB,0,MIP)),blendMultiTexture);
float2 bumpFetch1 = lerp(tex2Dlod(NormalSamplerX,float4(texCoords.UVA,0,MIP)).xy,tex2Dlod(NormalSamplerX,float4(texCoords.UVB,0,MIP)).xy,blendMultiTexture) * 2.0f -1.0f;
float3 bump1 = float3(0, bumpFetch1.x , bumpFetch1.y);
float2 specFetch1 = lerp(tex2Dlod(SpecularSamplerX,float4(texCoords.UVA,0,MIP)).xy,tex2Dlod(SpecularSamplerX,float4(texCoords.UVB,0,MIP)).xy,blendMultiTexture);
float3 spec1 = float3(0, bumpFetch1.x , bumpFetch1.y);

texCoords = GetTextureCoordinates_Gutter(coord2 ,tile1,tile2);
float4 col2 = lerp(tex2Dlod(AlbedoSamplerY,float4(texCoords.UVA,0,MIP)),tex2Dlod(AlbedoSamplerY,float4(texCoords.UVB,0,MIP)),blendMultiTexture);
float2 bumpFetch2 = lerp(tex2Dlod(NormalSamplerY,float4(texCoords.UVA,0,MIP)).xy,tex2Dlod(NormalSamplerY,float4(texCoords.UVB,0,MIP)).xy,blendMultiTexture) * 2.0f -1.0f;
float3 bump2 = float3(bumpFetch2.y , 0, bumpFetch2.x);
float2 specFetch2 = lerp(tex2Dlod(SpecularSamplerY,float4(texCoords.UVA,0,MIP)).xy,tex2Dlod(SpecularSamplerY,float4(texCoords.UVB,0,MIP)).xy,blendMultiTexture);
float3 spec2 = float3(specFetch2.y , 0, specFetch2.x);

texCoords = GetTextureCoordinates_Gutter(coord3 ,tile1,tile2);
float4 col3 = lerp(tex2Dlod(AlbedoSamplerX,float4(texCoords.UVA,0,MIP)),tex2Dlod(AlbedoSamplerX,float4(texCoords.UVB,0,MIP)),blendMultiTexture);
float2 bumpFetch3 = lerp(tex2Dlod(NormalSamplerX,float4(texCoords.UVA,0,MIP)).xy,tex2Dlod(NormalSamplerX,float4(texCoords.UVB,0,MIP)).xy,blendMultiTexture) * 2.0f -1.0f;
float3 bump3 = float3(bumpFetch3.x, bumpFetch3.y, 0);
float2 specFetch3 = lerp(tex2Dlod(SpecularSamplerX,float4(texCoords.UVA,0,MIP)).xy,tex2Dlod(SpecularSamplerX,float4(texCoords.UVB,0,MIP)).xy,blendMultiTexture);
float3 spec3 = float3(specFetch3.x, specFetch3.y, 0);

Are there ways to reduce the number of tex2Dlod calls here while retaining all the features? Is there a way to cheat and only sample the textures twice instead of three times for triplanar texturing? Is there any way to get a non interpolated value from each of the surrounding vertexes so that any 2 textures can be blended together? Are there methods to approximate the specular map from the normal and diffuse maps so that I can do without the specular map sampling?

Thanks!

sentences:
In 2D, how do I efficiently find the nearest object to a point? I have a sizable game engine and I'd like a feature for finding the nearest of a list of points.

I could simply use the Pythagorean theorem to find each distance and choose the minimum one, but that requires iterating through all of them.

I also have a collision system, where essentially I turn objects into smaller objects on a smaller grid (kind of like a minimap) and only if objects exist in the same gridspace do I check for collisions. I could do that, only make the grid spacing larger to check for closeness. (Rather than checking every single object.) However, that would take additional setup in my base class and clutter up the already cluttered object. Is it worth it?

Is there something efficient and accurate I could use to detect which object is closest, based on a list of points and sizes?

sentences:
Are the Marek-knows tutorials any good or still relevant? Anyone have any experience with this? This hasn't been refereed as mush as it 'looks/sound' like.

https://www.marekknows.com/

Among many other products, the site provides game engine development video, which is around 45hours long. Starting from context creation, model loading, scene graph, animation. But it looks like a little old. Is it still useful?

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

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

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

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

sentences:
How come the 3d graphics and animations of MMORPGs are usually worse than non-online 3d games? I have noticed that in general it seems like the 3d graphics and animations for MMOs and MMORPGs seem not as seductive and polished as the graphics for normal, non-online 3d games.

How come this is the case?

or
Is my judgement inaccurate?

If my judgement is inaccurate please provide examples of MMORPGs that render 3d graphics and animations that are superior to normal, non-online 3d games.

sentences:
Optimizing UV Map Sheet Based On Surface Area? I am trying to get my UV Map Sheets Optimized Based On Surface Area , I need Them optimized cause my scene area is huge and i want to use them in UDK so i am trying to get maximum possible optimization and i am running out of time

Here is What i Try TO Achieve :

Default 3DS Max :

Optimized By HAND THIS IS WHAT I WANT  Or Even Better If There Is Automated Intelligence Tool

Also I know this Tools Flatiron , UVPacker But They Are No Use

sentences: How to remove a node from a scene imported with Assimp? I need to remove one object from the scene graph imported by Assimp and I can't.  I've tried to change aiScene.h including a method called DelNode and I can´t. How can I do it - is it possible?

sentences:
Why is my Unity camera chasing player script running slow? I have a camera class, that is suppose to chase my player, which works, but its really really slow. It only has this line of code, which makes sense to me, player moves, camera moves.  Any idea of why my game runs slower.

void Update()
{
    transform.position= new Vector3(player.transform.position.x, player.transform.position.y, -10);
}

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:
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:
Would like some help in understanding rendering geometry vs textures So I was just pondering whether it is more taxing on the GPU to render geometry or a texture. What I'm trying to see is whether there is a huge difference in rendering two scenes with the same setup:

Scene 1:
Example Object: A dirt road (nothing else)
Geometry: Detailed road, with all the bumps, cracks and so forth done in the mesh

Scene 2:
Example Object: A dirt road (nothing else)
Geometry: A simple mesh, in a form of a road, but in this case maps and textures are simulating cracks, bumps, etc...

So of these two, which one is likely to tax the hardware more? Or is it not a like for like comparison?

What would be the best way of doing something like this? Go heavy on the textures? Or have a blend of both?

sentences:
XNA renderTarget, how to convert mouse coordinates to world position when upscaling I'm currently developing a monogame game with a tile engine.

I have been experimenting with different tiles and sprites sizes : 16px, 32px, 64px
I have settled for 32x32 pixels tiles rendered at a 64x64px size on screen.

I have read that a good way to do so is to use a RenderTarget2D. I've done so. It works well. I'm using
SamplerState.PointClamp to keep the pixel aspect clean.

So for a 1440x900 resolution I use

 renderTarget = new RenderTarget2D(graphics.GraphicsDevice, 720, 450);

My question : when using the RenderTarget2D to upscale the screen, it logically messes up the camera I had working, and even more so the conversion of mouse coordinates to world coordinates.
How should I modify the camera and the "mouse coordinates" to world position function. Is it even possible to convert properly mouse coordinates when you are upscaling everything with a renderTarget ?

Screenshot

This answer hints that it may be problematic, can somebody explain to me why ?

From the link :
so if your graphics aren't dependant on other graphical features like a mouse, then I would use a RenderTarget

I can't find any resources about this. I always find a solution by myself, but this one is too much for me. Linear algebra is not my strong suit. Thank to anybody who can help.

My transform Matrix and Worldposition conversion

public Matrix Transform(GraphicsDevice graphicsDevice)
{
    m_Transform =

      Matrix.CreateTranslation(new Vector3(-m_CameraPosition.X, -m_CameraPosition.Y, 0)) *
         Matrix.CreateRotationZ(Rotation) *
         Matrix.CreateScale(new Vector3(Zoom, Zoom, 0)) *
         Matrix.CreateTranslation(new Vector3(ViewportWidth * 0.5f, ViewportHeight * 0.5f, 0));

    return m_Transform;
}

public Vector2 Worldposition(GraphicsDevice graphicsDevice, Vector2 position)
{
    //Invert camera
    Matrix m_InvertTransform =
    Matrix.CreateTranslation(new Vector3(-(m_CameraPosition.X + ViewportWidth * 0.5f), 0, -(m_CameraPosition.Y + ViewportHeight * 0.5f))) *
    Matrix.CreateRotationZ(Rotation) *
    Matrix.CreateScale(new Vector3(Zoom, Zoom, Zoom)) *
    Matrix.CreateTranslation(new Vector3(ViewportWidth * 0.5f, 0, ViewportHeight * 0.5f));
    m_InvertTransform = Matrix.Invert(m_InvertTransform);
    //Transform the position
    Vector3 newPos3 = Vector3.Transform(new Vector3(position.X, 0, position.Y), m_InvertTransform);
    return new Vector2((newPos3.X - 720) , (newPos3.Z - 450) );
}

Edit :

In my Update() method :

Vector2 vector = new Vector2((int)player.X, (int)player.Y);
camera.ChangePosition(GraphicsDevice, vector);

The ChangePosition function in my Camera Class
    public void ChangePosition(GraphicsDevice graphicsDevice, Vector2 newposition)
    {
     m_CameraPosition = newposition;
    }

sentences:
Should I create a Lua wrapper classes for my C++ classes, or should I bind them directly? I have a fairly standard architecture like this:

GameObjects have Transform, and can have Renderer, Rigidbody, Camera, LightSource, etc, and all of these classes have their corresponding methods.

GameObject has GetName, SetName, etc. and its own Transform.
Transform has GetPosition, SetPosition, etc.
Renderer has SetTexture, SetMaterial, etc. and references a Transform/GameObject.

If I want to implement Lua scripting using LuaBridge, and I would like to achieve an API similar to this...

function update()
    local gameObject = this()
    local renderer = gameObject:GetRenderer()
    renderer:SetTexture("Brick")
    local rigidbody = gameObject:GetRigidbody()
    rigidbody:SetMass(10)
    local transform = gameObject:GetTransform()
    transform:SetPosition(1, 10, -5)
end

...then which of these should I choose?

Solution A:

I bind every C++ class directly to Lua classes.

In this way I have to implement some extra scripting quality-of-life methods for the classes, so no big deal.
But it's not so easy to see whether a method is callable in Lua script, or is only available in native code. (for example I need to name method XYZ as LuaXYZ)
Methods which are only created so that scripting is made easier, are mixed with core functionality.

Solution B:

I create a wrapper class for every required class, like: Renderer->RendererHandler, Transform->Transform Handler, GameObject->GameObjectHandler, etc.

Lua and core functionality is separated, much easier to see what is the scripting API and what is not.
For every class I have to create another similar class which got a lot of methods, which are just calling the calling the same method in the wrapped class. Like GameObjectHandler->GetName() just calls GameObject->GetName()

Thanks in advance.

Summary:

In my opinion, Solution B is the best. That is the easiest to handle, the most transparent, and the most separated.
But I got lots of new classes and new dependencies, which messes up my clean architecture. Solution A makes expanding functionality much easier to handle (I dont have to create a lua interface class for new components).
But error handling is worse, because I don't have to care about if a scripter uses a NULL pointer (like a non existent component)
But if that happens due to my engine implementation I'll have to handle it seriously. (And how can I signal whether a NULL pointer in a method is "don't care type" or "serious problem" type?)
So currently I think that the best solution is this:

class GameObject {
   ...

   GetName()
   SetName()

   Lua_getName()
   Lua_setName()

   ...

I don't have to create "Lua interface" classes, and handle that mess that comes with it.
I directly bind the Lua functions to the classes, but I create new methods in that class for scripting purposes.
For example I implement GetName() for "InEngine" functionality, and a Lua_getName() which is bound to Lua functions and used only in scripts.
The problem here is that, yeah you can't call InEngine methods from Lua because it's not bound. But what about calling Lua_getName() instead of GetName()?

There is no compile check for that, and if the developer is tired and makes this mistake, it will be hell to debug that.

sentences:
Box2D: Efficient method to create b2Chainshapes for a tile-based map? I'm working on a platforming game with tile based levels. I store the collision model for my tileset in an array.

This is how the collision model for a 4x4 tilesheet would look like (I can't post pictures yet so this link will have to suffice: Tileset example). The red dots are the vertices of the b2ChainShape.

When I load a level, I look up the collision model for each tile and create a b2Body at the corresponding place. The problem is that between the tiles, my character can experience a "bump" because it gets stuck on the edge of the shape of the next tile's body.

Is there an existing algorithm to connect the bodies of neighbouring tiles to a single b2ChainShape? Or should I ditch the idea of tile-based collision models all together and simply create the collision model for the whole map with the Tiled map editor? I don't create the the collision map with the Tiled map editor at the moment, because it is very time consuming for slopes and hills.

sentences:
How to orient a hexagonal tile on a geodesic sphere (Goldberg polyhedron)? I've recently ported the hexasphere implementation by Rob Scanlon at https://github.com/arscan/hexasphere.js to objective-c for use in a project I'm exploring.

As a port, it works very well, and I can render the hexasphere using SceneKit on iOS however it's terribly inefficient.  Because I want to dynamically animate individual facets of the hexasphere, I originally implemented each facet as a single SCNNode with it's own SCNGeometry object.

This produces a very slow rendering, with frame rates well below 30fps because of the high draw count.

Here is an image of the output after the original port:

With some advice from another developer, I've improved the rendering by creating a single SCNGeometry object that represents a single hexagon, and then using that single geometry multiple times, once for every hexagon in the hexasphere.

Whilst this brought down the draw count to an amazing 8 draws, it introduced a new problem.

By taking the multiple geometries generated by the original hexasphere code, each hexasphere was oriented in 3D so that they fit into the hexasphere appropriately.

Moving to the new design where I am positioning each SCNNode on the centrepoint of each hexagon, left me with a single geometry, correctly position in 3D, but incorrectly oriented, as this image shows:

After some experimentation I worked out that if I use the latitude and longitude of each hexagon, these would appear to give the correct orientation in the X and Y axes.

Applying this, I got a much better result:

But there is still a problem.  The hexagons, whilst correctly positioned, are not oriented correctly on the face of the hexasphere.

So, finally, my question.

I'm trying to work out how to rotate those hexagons on the surface of the hexasphere, but I can't see how to.  I had thought it was about rotating it on the Z axis, but that doesn't appear to work.  I think I somehow need to calculate a set of 3 angles, 2 of which much be close to the latitude and longitude.

My current thought is that given that I have the boundary points of the original hexagon generated by the original code, I should be able to calculate (somehow) a 3D vector that represents the slope/orientation of the plane formed by those points, and use that to get the hexagons looking the way they are supposed to look.

Can someone help me get this right.  Now I know I'm working with SceneKit and Objective-C, but I'm open to solutions in other languages.  What I'm hoping is that I don't just get told to read a site with arcane maths because believe me, I've tried, and I just don't get it.

[UPDATE] I've completed my project now, and have made my Objective-C implementation of the hexasphere public on git at: https://github.com/pkclsoft/HexasphereDemo

sentences:
Texture mapping on gluDisk I'm trying to map a brick texture on the edge of a fountain and I'm using gluDisk for that. How can I make the right coordinates for the disk? My code looks like this and I have only found a function that takes the texture along with the camera.

I want the cubic texture to be alongside of the fountain, but gluDisk does a linear mapping. How do I get a circular mapping?

void Fountain::Draw()
{
    glPushMatrix(); // push 1
    this->ApplyWorldMatrixGL();
    glEnable(GL_TEXTURE_2D); // enable texturing
    glPushMatrix(); // push 2
    glRotatef(90,-1,0,0); // rotate 90 for the quadric

    // also drawing more here...

    // stone texture
    glBindTexture(GL_TEXTURE_2D, texIDs[0]);
    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_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    glPushMatrix(); // push 3
    glTranslatef(0,0,height);

    // spherical texture generation
    // this piece of code doesn't work as I intended
    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
    glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
    glEnable(GL_TEXTURE_GEN_S);
    glEnable(GL_TEXTURE_GEN_T);

    GLUquadric *tub = gluNewQuadric();
    gluQuadricTexture(tub, GL_TRUE);
    gluDisk(tub, radius, outerR, nrVertices, nrVertices);
    gluDeleteQuadric(tub);
    glDisable(GL_TEXTURE_GEN_S);
    glDisable(GL_TEXTURE_GEN_T);

    glPopMatrix(); // pop 3
    // more drawing here...
    glPopMatrix(); // pop 2
    // more drawing here...
    glPopMatrix(); // pop 1
}

To refine my question a bit. This is an image of what it is at default (left) and of what I want (right). The texture should fit in the border of the disk, a lot of times. If this is possible with the texture matrix, than that's fine with me as well.

sentences:
Unity Tile pallete isn't appearing in window tab I'm trying to add a tile pallette to my scene in Unity. But when I go to

Window - 2D there is no tile pallette option

I'm using

v2019.2.11f1 (Personal)

sentences:
DirectX11 - AlphaBlending Rendering problem So.. I completed this tutorial on the following site rastertek.com/dx11tut12.html. The tutorial is all about rendering Text in an orthographic space. Basically just 2D rendering on DirectX 11.

Now that I finished i wanted to experiment with it. In the original tutorial he uses a Black background texture with the different letters in white, then he uses AlphaBlending to make the pipeline omit the background when drawing to the backbuffer saying that the alpha value for when the sample color is black is 0.

//Initializing the AlphaEnabledBlendingState
D3D11_BLEND_DESC blendStateDescription;
ZeroMemory(&blendStateDescription, sizeof(D3D11_BLEND_DESC));

blendStateDescription.RenderTarget[0].BlendEnable = TRUE;
blendStateDescription.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blendStateDescription.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
blendStateDescription.RenderTarget[0].RenderTargetWriteMask = 0x0f;
blendStateDescription.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;

result = this->m_device->CreateBlendState(&blendStateDescription, &this->m_alphaEnableBlendingState);
if (FAILED(result))
{
    return false;
}

_

//Setting the AlphaEnabledBlendingState as the active AlphaBlendState
float blendFactor[4];

blendFactor[0] = 0.0f;
blendFactor[1] = 0.0f;
blendFactor[2] = 0.0f;
blendFactor[3] = 0.0f;

this->m_deviceContext->OMSetBlendState(this->m_alphaEnableBlendingState, blendFactor, 0xffffffff);

And the PixelShader I'm using to render the Text.

Texture2D shaderTexture;
SamplerState SampleType;

cbuffer PixelBuffer
{
    float4 pixelColor;
};

struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : TEXCOORD0;
};

float4 main(PixelInputType input) : SV_TARGET
{
    float4 color;

    color = shaderTexture.Sample(SampleType, input.tex);

    //If the color is black on the texture then treat this pixel as transparent
    if (color.r == 0.0f)
    {
        color.a = 0.0f;
    }
    //If the color is other than black on the texture then this is a pixel in the font so draw it using the font pixel color
    else
    {
        color.a = 1.0f;
        color *= pixelColor;
    }

    return color;
}

This is the result

So i said, let's change the background of the texture to green, (0, 255, 0). So i did and changed the shader to look for a green color to set his alpha value to 0.

Looking for Green instead of black

//If the color is green on the texture then treat this pixel as transparent
if (color.r == 0.0f && color.g == 1.0f && color.b == 0.0f)
{
    color.a = 0.0f;
}

But the result is not what i expected. There's also the prove that the texture background is green.

This is the result

So, the question is... What am I doing wrong? what step am I skiping? I see that the color is totally transparent, as it should be.

Thank you for the time and help you can provide!

sentences:
Multi-platform multi-threading: What are the real challenges? While a library like SDL provides a cross-platform wrapper API for threading, I think it would be naive to assume that this leads directly to easy development of games across vastly different platforms (desktop / mobile).

What is the best way to tackle developing in this way (given any cross-platform threading API) considering the following:

different numbers of cores
vastly different processing capabilities per core
A generally different systems architecture with eg. different latencies for cache, RAM , and I/O access

I get the feeling that the only way to do this is evaluate how many threads may be run per each device you intend to support, and find out what the lowest common denominator is. However, this still leaves me in the dark as to the total amount of processing throughput available. Am I right in assuming the only way to do this effectively is to actively develop for the lowest spec mobile device I intend to support, throughout development? -- i.e. the lowest common denominator? Should this roughly be sufficient? Or is there more to it than this?

EDIT: Please could others offer further experience on this as I don't feel my question has been answered fully yet.

sentences: Can geometry grass shaders be painted to a terrain or are they limited to meshes? So I was follow the roystan grass shader tutourial and although it works well I don't understand the use for it. From what I understand the shader is basically just a flat plane that calculates grass on top of it. If I wanted to apply this grass to a terrain and place it on uneven ground would I have to manually add in a "grass plane" all over the environment and at different angles or am I missing something? Thanks.

sentences: Importing FBX model with updated textures into unity creating duplicate textures when using "Extract Textures" I am trying to figure out the best way to update models, textures and materials. I have a city model (city.fbx) that comes into unity with baked textures and materials from C4D. I bring it in to unity, extract the textures into a local folder called  "Textures" and extract the materials into a local folder called "Materials". Everything is remapped automatically by Unity. Let's say I then update the model using a file syncing program which replaces city.fbx with the same model, but with updated textures. In this case, the textures have been updated to green, where as before they were blue textures. when I extract the textures into the local "Textures" folder, unity creates duplicate textures instead of replacing the old ones. So we now have buildingtexture (the old blue texture) & buildingtexture 1 (a new green texture) - what is the  correct way to import the updated model so as to avoid this?

sentences:
Vertexquads are not being drawn in 2D space I started teaching myself DirectX a short time ago and have come across a problem which I can't figure out by myself unfortunately.
I'm trying to build my own font system, so I can draw strings in 2D screenspace. Until now Until now I have managed to create a function to which I just have to pass the string and the screenspace-positions., and it generates all vertices for / sets up the buffers etc (quads that i draw a certain portion of the font texture on).
When I draw these vertices in 3D space, everything looks like it works like it should be.

(Forgot to hide the cube) As soon as I try to switch to 2D, I just get a window filled with the blue backgroundcolor. To switch to 2D I do the following things:

graphics.context->ClearDepthStencilView(graphics.depthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
context->OMSetDepthStencilState(depthDisabledStencilState, 1);

WVP = XMMatrixOrthographicLH((float)mWidth, (float)mHeight, 0.0f, 1.0f);
cbPerVert.WVP = XMMatrixTranspose(WVP);
cbPerVert.World = XMMatrixTranspose(World);

context->UpdateSubresource( cbPerVertexBuffer, 0, NULL, &cbPerVert, 0, 0 );
context->VSSetConstantBuffers( 0, 1, &cbPerVertexBuffer );

My Question is now what I am doing wrong here. If the vertices are being genrated and drawn correctly, afaik all I have to do is project them into screenspace and disable the depth buffer, which I did here..  BTW: I randomly tried drawing the cube with my 2D settings and it was properly drawn..  Help is much appreciated :)

sentences:
Unity Sound effect playing too many times In the class PlayerControl I have this

if (Input.GetKey("space"))
    {
        soundManager.PlayBleep();
        sword.SetActive(true);
    }

In my soundmanager I have this

   public void PlayBleep()
{
    if (!audio.isPlaying) {
        audio.PlayOneShot(SwordWhip2);
    }
}

At the moment I am getting the sound like 10 times each time I press space creating horrible soundeffects. How could I get it not to play until the sound has finished?

sentences:
What's the best way to handle numerous recurring log entries in game loop? I have a custom logging system, use of which is scattered all over the engine and game. The system is linked to a "LogStore" that has an std::vector<string> logs[NUM_LOG_TYPES] - each vector corresponds with it's log type (info, error, debug, etc.). There's one extra std::vector that has "coordinates" to all log entries in the order they were received.

Now, all the logging output is also displayed inside my development console in the game. The game console is handled by HTML-type GUI and therefore requires a new <p> element being added for each log output.

My problem is that the log entries that are generated in the main loop each frame freeze the engine, because they continue to add elements to the in-game console, and if the console or guy generates a warning - that creates an infinite logging loop.

I want to solve it by handling the recurring log entries in an elegant way that lets you know that something is critically wrong, but won't freeze the engine - like displaying the count of errors in the last 60 frames instead of displaying errors themselves. But how do you guys handle this? Does anyone know any nifty tricks to do this?

I understand the question may sound vague, but if someone came across this type of issue I'm sure they would know exactly what's happening.

Example problematic log entries:

OpenGL warnings (I actually do check for errors every frame in many
places)
Really any prints anywhere in the main loop (may be debugging, may
be warnings)

sentences:
How to achieve smooth sprite movement with a scaled up canvas? I'm developing a simple 2d platformer using haxe & openfl (currently targeting flash). To achieve the old school pixelation effect I draw 16x16 sprites over a 4x scaled up canvas. With this approach character movement is very jerky since it seems to consist of a sequence of 4px jumps.

So my question is: how to be smooth & old school at the same time? Thank you for your time.

sentences:
How can I evaluate varying conditions in a Scriptable Object? I'm new to using Scriptable Objects, so this might just be a bit of confusion.

Let's say we have a Scriptable Object that defines the abilities a character might have in the game, and a character class that triggers these abilities:

public class Ability : ScriptableObject
{
    public string Name = "New Ability";
    public int ManaCost = 10;
    public Sprite AbilitySprite;

    public void Execute(ref Character character)
    {
        if (character.Mana < ManaCost)
        {
            return;
        }

        // Do something, like instantiating and moving the sprite

        character.Mana -= ManaCost;
    }
}

public class Character : Monobehaviour
{
    public int Health = 100;
    public int Mana = 100;

    public List<Ability> AbilityList = new List<Ability>();

    private void Update()
    {
        // Crude implementation for example purposes
        if (Input.GetKeyDown(KeyCode.Alpha1)) Abilities[0].Execute(ref this);
        if (Input.GetKeyDown(KeyCode.Alpha2)) Abilities[1].Execute(ref this);
    }
}

Obviously we can make numerous abilities with different mana costs, and add them to each character in the scene as needed; some characters may have a "Bolt" ability, while others might have an ability that casts "Fire." The Execute() method will then evaluate whether or not the character can use these ability based on the character's current mana.

But what if some of these abilities, all of which have similar effects, needed to also check the character's health, or perhaps a collision state, like isGrounded? For instance, maybe a certain ability can only be executed when the character has the appropriate mana value, and is also airborne. Would it be necessary to make many different subclasses of the Ability class to accommodate these different conditions, each with its own logic?

At first I tried changing the Execute() method to take in a bool, like this:

public void Execute(ref Character character, bool canExecute)
{
    if (!canExecute || character.Mana < ManaCost)
    {
        return;
    }
}

The problem with this is that I have to hard code the conditions for canExecute and compare the current ability against its Name, and that sort of defeats the purpose of Scriptable Objects. My goal is to be able to create abilities that might need to check varying conditions while performing the same functionality, and assign them in the inspector to each character as needed.

sentences:
Recognizing a hexagonal clickbox I'm working on a game that is going to involve gasp hexagons.

At present, I have a hexagon image that I am using (all sides are the same length...it fits into a 50px by 50px image).

I am somewhat new to C# and really new to XNA, but is there some sort of easy method that I can call rather than doing a convoluted if statement based on points and angles?

sentences:
problem adding bumpmap to textured gluSphere in JOGL I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well.
The bumpmap resides in "res/planet/earth/earthbump1k.jpg".Here is the code I have for the regular texture:

    gl.glTranslatef(xPath, 0, yPath + zPos);
    gl.glColor3f(1.0f, 1.0f, 1.0f); // base color for earth

    earthGluSphere = glu.gluNewQuadric();

    colorTexture.enable(); // enable texture
    colorTexture.bind(); // bind texture

    // draw sphere...
    glu.gluDeleteQuadric(earthGluSphere);
    colorTexture.disable();

// texturing
public void loadPlanetTexture(GL2 gl)
{
    InputStream colorMap = null;

    try
    {
        colorMap = new FileInputStream("res/planet/earth/earthmap1k.jpg");
        TextureData data = TextureIO.newTextureData(colorMap, false, null);
        colorTexture = TextureIO.newTexture(data);
        colorTexture.getImageTexCoords();
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
        colorTexture.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
        colorMap.close();
    }
    catch(IOException e)
    {
        e.printStackTrace();
        System.exit(1);
    }
    // Set material properties
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
    gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);

    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S);
    colorTexture.setTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T);
}

How would I add the bumpmap as well to the same gluSphere?

sentences:
Alpha interpolation in a pixel shader How does the interpolation in a fragment shader work when it comes to the alpha parameter?

I'm programming a shader with SharpDX, DirectX11. My idea is to interpolate 2 3d points of a segment, so that I'll have the position interpolated in between in the pixel shader. But I want to know what happens with the alpha parameter when that position is blocked by another polygon.

For instance, if alpha is 1.0 at the left end of my segment and 0.0 at the other one. What is the value of alpha in the middle, 0.5? Or does it depend on the visibility at that point (meaning it could be, for instance, 1.0 OR 0.0 depending on if that part of the segment is hidden by a poolygon?

sentences:
How would I make my position interpolation stop once the destination is reached? I would like to implement tile-based grid movement and I've heard that linear interpolation comes handy in the implementation process. I've tried to use it but I'm not sure how to make it stop once the target position is reached. I can't find a way to check that on the interpolation. Here's the code I'm using:

function movePlayer(deltaTime) {
    if buttonUp then
       velocity.add(0, speed);
    if buttonRight then
       velocity.add(speed, 0);
    if buttonSouth then
       velocity.sub(0, speed);
    if buttonLeft then
       velocity.sub(speed, 0);

    velocity.scl(deltaTime);

    if (targetPosition.isZero()) {
        targetPosition.add(getNextPosition());
    }

    position.lerp(targetPosition, speed * deltaTime);

    float distance = position.dst(targetPosition);
    if (allowMovement && distance < 0.1f) {
        position = targetPosition;
        allowMovement = false;
        targetPosition.set(0, 0);
    }
}

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:
How to convert a Maya object to a VBO? I'm currently trying to teach myself OpenGL... and quickly discovering that the Immediate Mode taught in old OpenGL tutorials is basically obsolete... which leads me to VBO's... which I kind of get but would like to start learning them in context.

What is the workflow involved in taking a 3D object from Maya or 3DS Max and converting it to something that can be turned into a VBO?

On that token, do these export workflows also deal with materials and textures, or is that handled in an entirely different manner?

sentences:
Resolving collisions with float precision errors I'm facing a problem when I try to resolve the collision between two units using floats as positions of the units in my game.

I am detecting the collisions using the SweptAABB algorithm and if there is a collision I fix it by using the normalized collision time that the SweptAABB function returns. Something like this:

collisionTime = SweptAABB(unitA, platform)
fixedPosition = (currentPos - previousPos) * collisionTime;

This generally works fine but not always, due of the floats precision errors the fixedPosition can result in a VERY SMALL overlap.
For example: suppose that the fixedPosition for the Y axis should be 12.345234 to avoid the collision but instead of getting that value (after multiplying by the collisonTime) I get something like 12.345239 (a difference of 0.000005) and when eventually the overlap method is executed it will still detecting the overlap:

public boolean overlap(AABB b) {
    Vector2 distance = new Vector2(b.position).substract(position);

    return Math.abs(distance.x) < (extents.x + b.extents.x)
        && Math.abs(distance.y) < (extents.y + b.extents.y);
}

So I decided to start changing the code so that I can get the face of the box that collides and use simple arithmetic addition of the positions instead of multiplication but this also fails for the same reason. For instance, suppose this:

// unitA collides with unitB at this point in the X axis:
float unitB_Face_X = 0.7466669f;
// since position is defined at the center of the unit I move unitA to the right:
float unitA_Fix_X = unitB_Face_X + 2;

But unitA_Fix_X will result in a slightly different value (2.746667) that will eventually be detected as an overlap.

Just a clarification: My game is like Super Mario Bros, a 2D platform. I dont need fine precision, two decimals places (or one) is more than enough for my game world (each unit character has 1f for width and 2f for height).

I think that there must be a correct way to deal with this kind of problem (every 2d platform game out there has solved this problem). I have only think in one solution: Use integers instead of floats for the position of every unit in my game. I cannot avoid floats completly  because of deltaTime (also libgdx uses them for the sprites positions and rendering), but I think I can make the integer conversion at the begining of each frame by doing something like this:

float fPos = unitA.velocity * deltaTime;
int intPosition = (int)(fPos * 1000);

And use the intPosition for detecting and resolving the collisions. After that I will have to convert it back to float for rendering the sprites.

Is this a bad approach? I dont want to shoot my self in the foot.
Thanks in advance.

sentences:
Stop player following cameras cameras direction Okay I'm not going to go to much into it but this is what I need my script to do. The way I have my controller set up is that the camera looks to the side of the player a little bit. I use this for aiming attacks, bullets and what not. The problem is that it follow the camera when it looks up causing my character to slightly jump ever time I aim and look up. So i want the player to move with the camera while ignoring its y axis. and i need my character to jump so i cant just make the players y movement = 0.

Here's the code I've been using:

transform.position += Time.deltaTime * cameraMain.forward * Input.GetAxis("Vertical") * speedWilAim;

and I am trying to avoid separating the mouse look script into x and y pivots but if there is no alternative I will do that.

sentences:
How should I show shared resources during a Shared Resource game in the Galaxy Editor? One of my favorite ways to play the original StarCraft was in a "Team" game.  In this game type, multiple players on the same "team" would share control, resources, supply, and even the same starting location.  It was like playing as 1 player, only 2 humans were controlling it.  It was a lot of fun.

I want to do something very similar in StarCraft 2, but I need to create a custom map in the Galaxy Editor to do it.

I found the editor can quite easily emulate this behavior.  There is a Trigger action "Set Alliance for Player Group" to "...treat each other as Ally With Shared Vision, Control, And Spending."  To use this, I create units for only 1 of the players, and then set all players to be allied with each other in this way.  All the other players get no units and no resources.  This makes it so 1 player is the actual owner of all the units and everyone else is tagging along with full control.

This nearly works! The problem is that if I am not the actual owning player, I can't actually see how many minerals/gas/supply the team has.  This makes it pretty difficult to build stuff.

What would be the best way to display to the other players how many Minerals/Gas/Supply the team has?

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

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

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

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

Here is a chunk of relevant code:

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

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

...

if (FlxG.mouse.pressed()) {

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

sentences:
How can a single script attached to multiple enemies provide separate behavior for each enemy? I am making a TD game and now stucked at multiple enemies using same script. All is well with scripts attached with one enemy only. Problem is in running multiple enemies.

Here is the overview. I have a Enemy object with which I have attached a 'RunEnemy' script. Flow of this script is:

RunEnemy.cs:

PathF p;
p = gameObject.GetComponent<PathF>();     //PathF is a pathfinding algo which has     'search; function which returns a array of path from starting position
PathList = p.search(starting position);
//-------------------------------

if(PathList != null) {                               //if a way found!
if(moving forward)
     transform.Translate(someXvalue,0,0);  //translates on every frame until next grid point

else if(moving back)
   transform.Translate(0,someXvalue,0);

    ...and so on..

      if(reached on next point)
         PathList = p.search(from this point)   //call again from next grid point so that if user placed a tower enemy will run again on the returned path
}

Now I have attached this script and "PathF.cs" to a single enemy which works perfect. I have then made one more enemy object and attached both of these script to it as well, which is not working they both are overlapping movements. I can't understand why, I have attached these scripts on two different gameobjects but still their values change when either enemy changes its value. I don't want to go with a separate script for each enemy because there would be 30 enemies in a scene. How can I fix this problem?

sentences:
Adding components to a GameObject referenced within code So in my project, I have a class called ComponentRegistry. The idea of this class is to store a dictionary of components and their names. For example:

    public Dictionary<string, MonoBehaviour> registry;
    public MonoBehaviour testComponent;

    void Start(){
        registry = new Dictionary<string, MonoBehaviour> ();
        registry.Add ("TestComponent", testComponent);
    }

    public MonoBehaviour GetScript(string name)
    {
        return registry[name];
    }

Then in a separate class, I will access this dictionary using a string in order to retrieve the associated component, subsequently adding the associated component to the gameObject.

    foreach (string comp in blockInfo.components) {

    //For each of the components that need to be added

        gameObject.AddComponent(ScriptMaster.compReg.GetScript(comp));

        //I know this is incorrect, but the idea is there
}

Just for understanding, compReg is an instance of the ComponentRegister class stored as a static variable within my ScriptMaster class.

But no matter what I try, I have not been able to get this to work. I have switched endlessly between different formatting of adding components to gameObjects, alternating between using Components and MonoBehaviours, adding by type.

Thank you for any insight.

sentences:
Diagonal symmetry across a filtered array? I wrote this code to randomly generate a square terrain that somewhat resembles an island. First, I randomly populated a square with grass tiles (1s) on a plane of water tiles (0s):

Then, I looped through each tile and changed its tile type according to its neighboring tiles(if a tile is surrounded by 4 or more water tiles, it becomes a water tile, otherwise it becomes a grass tile):

The results don't seem all that pleasing; not only is the terrain filled with holes and lack overall "togetherness", it is also weirdly symmetrical diagonally.

Here's the code:

private void SmoothMap (Chunk chunk)
{
    for(int row = 1; row < chunk.rows-1; row++)
    {
        for(int col = 1; col < chunk.cols-1; col++)
        {
            //if current tile is not null
            if(chunk.GetTile(row, col) != null)
            {
                //Check its neighboring tiles
                int neighboringTiles = GetSurroundingTiles(row, col, chunk);
                //System.out.println("Position: " + row + ", " + col);
                //System.out.println("Current tile type: " + chunk.GetTile(row, col).type);
                //System.out.println("Neighboring water tiles: " + neighboringTiles);

                if (neighboringTiles > 4)
                {
                    if (chunk.GetTile(row, col) != null)
                    {
                        chunk.GetTile(row, col).texture = GetRandomWaterTexture();
                        chunk.GetTile(row, col).type = Enums.tileType.Water;
                    }
                }
                else if (neighboringTiles < 4)
                {
                    if (chunk.GetTile(row, col) != null)
                    {
                        chunk.GetTile(row, col).texture = GetRandomGrassTexture();
                        chunk.GetTile(row, col).type = Enums.tileType.Grass;
                    }
                }
            }
        }
    }
}

private int GetSurroundingTiles(int r, int c, Chunk chunk)
{
    int surroundingTiles = 0;

    for(int x = c-1; x <= c+1; x++)
    {
        for(int y = r-1; y <= r+1; y++)
        {
            if (x != c || y != r)
            {
                if(chunk.GetTile(x, y) != null)
                {
                    if (chunk.GetTileCode(x, y).equals("0"))
                    {
                        surroundingTiles++;
                    }
                }
            }
        }
    }
    return surroundingTiles;
}

Does anyone know why it is the way it is? Or a better way to approach generating an terrain like this?

Here's the GetTile() code:

public String GetTileCode(int r, int c)
{
    Tile tile;
    ArrayList<Tile> chunk_row;
    if(tiles.size() > r && r >= 0){
        chunk_row = tiles.get(r);

        if(chunk_row != null && chunk_row.size() > c && c >= 0){
            tile = chunk_row.get(c);
            return tile.isGrass() ? "1" : "0";
        }
    }
    return "0";
}

1 is grass, and 0 is water.

sentences:
How does Against The Wall create an infinite wall? There is a game called Against The Wall, developed by Michael P. Consoli. It's a fantastic game, as I've always been stumped at how the game creates an infinitely spanning wall.

In the game, you can fall forever, and the wall will keep spanning. I can fall as long as I like, and still be able to climb back to where I was before. The game is developed in Unity.

How can a game do this without crashing, or creating some kind of memory overload?

sentences:
Optimising Voxel World Rendering There are a couple of questions like this already. This one is different because it is specifically about rendering, as opposed to navigation and generation. I've implemented suggestions from here already.

The current optimisations are:

Only render block faces that aren't adjacent to another face
Render blocks in chunks, each chunk as one mesh (VAO)

According to the NetBeans profiler, 96% of time is spent on the glfwSwapBuffers(long window) method, which is when OpenGL renders the scene. This implies that my other operations are efficient enough, compared to rendering.

What else can I do to improve rendering performance?

The chunk size is 16x16x16 voxels. Sample renders and FPS:

64 chunks : 500 FPS
125 chunks : 300 FPS
1000 chunks : 45 FPS
4096 chunks : 12 FPS

sentences:
How to rotate a sprite in 2D with LWJGL3 and GLSL I have all the basic rendering already set up, with translation, scaling etc. What matrix(s) and/or vector(s) do I need to multiply/add with my existing code to rotate an object.

Preferably around a point given by a vector2fa, also only in degrees because quaternions aren't implemented and its only 2D not 3D.

Snippet of the vertex shader:

gl_Position = transformation * vec4(position, 1.0) + translation

Where transformation is done in java as (Note not actual code as * is replaced with .mul()):

Matrix4f transformation = ortho * scale

And translation is given by a method:

Vector4f translation = new Vector4f(x , y , 0f, 0f).mul(gc.getOrtho());

All the code listed before works as expected. It is just lacking the rotation feature mentioned at the top.

How can I add rotation to my code?

sentences: Efficiently tracking active instances I'm creating a game with lots of instances. On each iteration of the game loop, I only want to deal with the ones that are near the player. Currently, I do this by constructing a list of all the existing instances within a rectangle surrounding the player every few iterations. However, this takes far too long. How could I speed it up?

sentences:
Detecting wins in peer to peer RTS games like Starcraft A typical RTS game is implemented with the standard networking model: peer to peer lockstep.

Consider Starcraft 2, given that Battle.net presumably doesn't know anything about the state of game given that there is only communication between the two players in a peer to peer model, how does Battle.net know who was the winner in the end. Relying on the two peers to not try to cheat and report accurate results is naive.

sentences:
Unity: RaycastHit2D continually returns point (0,0) firstly I'm a bit of a Unity noob so sincere apologies if I've done something dumb.

I'm attempting to use a RaycastHit2D to detect when the player is on a platform. If he is, the point it returns should be passed back and used to set the player's rigidbody transform y coordinate so he sits on top of the platform.

The problem appears to be that the RaycastHit2D is continually returning a point of (0,0), so the player keeps getting reset to (x,0) - which causes an amusing bouncing effect, but not the desired effect.

Here's the code:

if (onPlatform) {

  RaycastHit2D walkingOnPlat = Physics2D.Raycast(rb.transform.position,Vector2.down,Mathf.Infinity,8);
            platYCollision = walkingOnPlat.point.y;
            rb.transform.position = new Vector3(x, platYCollision,-5f);

        }

If I can clarify anything please do let me know, and thanks in advance for your help!

sentences:
Alpha blending works when rendering to an FBO, but not when rendering to the screen buffer My rendering pipeline goes something like this-

Bind multisampled FBO

Render GameObjects

Render Transparent Objects

Blit multisampled FBO to normal FBO

perform any Post processing

Render a quad with the result

Render GUI

I've found I can render transparent objects in the "Render transparent Objects" function, but alpha blending against the post processing quad doesn't work. Is there any reason why this would be? This draw call is used regardless of whether it is being rendered to the FBO, or to the screen buffer
It is a button in particular I'm trying to render, here is the draw call:

glEnable(GL_BLEND);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glFrontFace(GL_CW);

glUseProgram(thisConfig.guiShaders->getProgramID());

//Bind uniforms..... code skipped

glBindVertexArray(VAO);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);

glDrawArrays(GL_QUADS, 0, 4);

glFrontFace(GL_CCW);

Let me know if there is anything I need to provide to help. Again, same shaders are used in both cases, so I don't think the shaders are the problem, but here they are anyway:

#version 330
uniform sampler2D textureImage;

// input packet

in packet{
    vec2 textureCoord;
} inputFragment;

// output packet
layout(location = 0) out vec4 fragmentColour;

void main(void) {

vec3 gamma = vec3(1.0 / 2.2);
vec4 tempFragmentColour = texture2D(textureImage,     inputFragment.textureCoord);
    fragmentColour = vec4(pow(tempFragmentColour.xyz, gamma),     tempFragmentColour.a);
//  fragmentColour = vec4(tempFragmentColour.a);

}

I have tried writing in the alpha values manually in the shaders and I get the same effect.

Working with OpenGL 4.6 on PC with c++

sentences:
Getting a 3d mouse position I've looked at a few tutorials about picking and the method Unproject, so I have an idea of how getting the mouse in 3d space is done. The code I have does display a mouse position, but it is way off of the actual position the mouse is at.

    public Vector3 FindWhereClicked(MouseState ms)
    {
        Vector3 nearScreen = new Vector3(ms.X, ms.Y, 0);
        Vector3 farScreen = new Vector3(ms.X, ms.Y, 1);
        Vector3 nearWorld = device.Viewport.Unproject(nearScreen, cam.proj, cam.view, Matrix.Identity);
        Vector3 farWorld = device.Viewport.Unproject(farScreen, cam.proj, cam.view, Matrix.Identity);

        Vector3 direction = farWorld - nearWorld;

        float zFactor = -nearWorld.Y / direction.Y;

        Vector3 zeroWorldPoint = nearWorld + direction * zFactor;

        return zeroWorldPoint;
    }

This code is from another thread I found on here. I'm guessing the problem is the near and far world variables.

    public ThirdPersonCam()
    {
        proj = Matrix.CreatePerspectiveFieldOfView(0.78f, 1.7777f, 1f, 10000f);
    }

    public void CameraUpdate(Matrix objectToFollow)
    {
        Vector3 camPosition = objectToFollow.Translation + (objectToFollow.Backward * 10) + (objectToFollow.Up * 2);
        Vector3 camTarget = objectToFollow.Translation;

        view = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up);
    }

The variables are grabbed from my camera class, but I don't know why it isn't working. A point that's supposed to be at 0, 0, 0 ends up being at something like 36, -1, 57

sentences:
UnassignedReferenceException : The variable player of FollowPlayer has not being assigned My current task is to make the camera follow the moving cube in a stable way where the camera won't get locked in the center of the object so it won't get dizzy once the cube starts to collide or fall down.

I have done the parenting right, I have named the cube as the player and then selected it as the Transform reference in the new component that I have created for the camera to follow.

But it just says:

  UnassignedReferenceException : The variable player of FollowPlayer has not being assigned.

and I am unable to get the right results. What should I do ?

Here is the C# script that I wrote:

using UnityEngine;

public class FollowPlayer : MonoBehaviour {
    public Transform player;
    public Vector3 offset;

    void Update() {
        transform.position = player.position + offset;
    }
}

My scene setup looks like this:

So I have un-parented the main camera from the player and it works perfectly fine but I still get the error, Have any ideas why?

sentences:
How to structure a simple game server for a multiplayer game? I would like to create a simple multiplayer game server for a simple game:

The game is supposed to be similar to Command & Conquer, you have a few tanks and a few soldiers. You can select one soldier and than click on the map, to where the soldier should go. If the soldier comes to an area where he could not go, he walks around. And soldiers can be shot down by enemies.

How should I structure the game server, and what should be done at the client?

I.e if a soldier moves from X to Y but around building Z, I guess the server has to be able to calculate exactly where the soldier is located (in case an enemy shot at him), and the client also has to know the position for painting the soldier.

What should be done at the server and I think I have to desing a protocol for this. I think the server has to keep track of the game state and the time. Is anyone having suggestions on how to do this? or could recommend some reading?

sentences:
How to make my simple round sprite look right in XNA Ok, I'm very new to graphics programming (but not new to coding). I'm trying to load a simple image in XNA which I can do fine. It is a simple round circle which I made in photoshop. The problem is the edges show up rough when I draw it on the screen even with the exact size. The anti-aliasing is missing. I'm sure I'm missing something very simple:

        GraphicsDevice.Clear(Color.Black);

        // TODO: Add your drawing code here
        spriteBatch.Begin();
        spriteBatch.Draw(circle, new Rectangle(10, 10, 10, 10), Color.White);
        spriteBatch.End();

Couldn't post picture because I'm a first time poster. But my smooth png circle has rough edges. So I found that if I added:

spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied);

I can get a smooth image when the image is the same size as the original png. But if I want to scale that image up or down then the rough edges return. How do I get XNA to smoothly resize my simple round image to a smaller size without getting the rough edges?

sentences:
Smooth out movement of the snake in a 2d Snake game I am working on a 2-D snake game in C++ with the SFML library. I would like to smooth out the movement of my snake as it looks extremely choppy currently.
How the Snake moves
The snake is made up of a list of parts. If I want to move the snake, I simply remove one part from the back (.pop_back()) and then add a new part in the front accrding to the velocity. This works perfectly. The speed of the snake must be the same as the distance between the parts.  So if the distance is 15, the will be 15. But a speed of 15 is extremely high, so I need to only update the snake every few frames or use sf::Sleep(). Since the snake moves such a high distance every frame, the movement doesn't look smooth at all. And since the speed must be equal to the distance between the parts, reducing the speed doesn't work too. How can I come about tackling this?

sentences:
How can I customize Unity editor controls? I have been using blender for quite some time so I know pretty much how it works, and I have just recently started using Unity.

I find the unity UI to be very confusing and hard to use, and I was wondering if there was a way to change the controls to be more blender-like. what I mean is, "shift + scroll" to pan, or just "scroll" to orbit.

sentences: How to place same canvas on multiple cameras in Unity? I know how to do It on one, but I don't know how to do it using multiple cameras, 3 of them are important, i want to show the whole UI except for the minimap. I need to change the camera angle on some spots, while keeping the same canvas for displaying the number of coins XP and the current level.

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:
Comments getting executed as command I have a script to edit my world on run time and a script to generate a world. When i tried to place a block, something wrong happened, so I tried to make my script into command until I find which line was wrong. However, my comments still seem to execute. I made all the lines of update into comments, I still detect my mouse click, and it is the only script to use mouse click.
Infos:
-using IEnumerator to generate world.
-using /.../ for comments
-if I try to put a Debug.Log("..."); in the comment part, it doesnt show up in the console, which is even weirder.

sentences:
How do I get the areas enclosed by an arbitrary 2D shape? In my game I want users to be able to draw arbitrary 2D shapes of any length around game objects. The shapes must be closed and drawn with a single stroke that does not overlap.

For example:

I want to detect the presence of any game object in the green areas above.

I know how to detect whether a point is within a given polygon, but how do I tell where the polygons (green areas) are from just the points in the line?

sentences:
Spaceship Shield Flare I'm trying to implement a system whereby a "shield flare" will be shown whenever a projectile impacts the shield. The shield itself is one like in Star Wars, where it's more like a skin around the spaceship, rather than a simple bubble.

The problem I'm having is determining how to draw a simple flare effect where the projectile impacted the shield. I can determine the Vector2 point where the shield was hit. Right now, I'm able to show the whole shield whenever it's hit just fine.

The problem as I see it, is that I somehow need to mask out the shield, except for a few pixels around the point of impact. Either that, or I'm going about this the completely wrong way.

What I can do so far is draw the whole shield:

What I need is to be able to draw a piece of the shield on the point of impact:

Any help would be appreciated.

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:
How to add all MonoBehaviours of Scene into the List? I've read an article 10000 UPDATE() CALLS.
Author uses UpdateManager. It has Update method which calls Update method in all of other MonoBehaviours of objects. It works faster than calling Update method from each MonoBehaviour separately.

This Manager looks like:

private ManagedUpdateBehavior[] list;

private void Start() {
    list = GetComponents<ManagedUpdateBehavior>();
}

private void Update() {
    var count = list.Length;
    for (var i = 0; i < count; i++) {
        // UpdateMe
        list[i].UpdateMe();
    }
}

And every objects now contains component with the code:

public class ManagedUpdateBehavior : MonoBehaviour {
    // some variables

    public void UpdateMe() {
        // some logic
    }
}

It's okay if 5-6-7-8- objects will be have that component.

But what if I have 100 objects? 1000? 10000?

How to find and add all ManagedUpdateBehaviors from all objects of scene? Should I use some recursive method on On Start? Cause every object may contain other objects with the script, they may contain the other objects etc...unlimited nesting

Also some objects can be instantiating dynamically...How to add their mono to manager? What is the right way?

sentences: Logic behind a checkers game? I'm starting to make a checkers game and I've got all my graphics + the board drawn. Before I moved on to creating the pieces I was wondering what an easy way to tackle the logic side of the movement of pieces.. Should I make a table of every square, detecting if it has a piece and if so, what color? (i.e 0=empty, 1=red, 2=black) or do you guys have a better idea to this issue? Thanks in advance.

sentences:
How to rotate multi-tile structure on grid? I need to be able to place structures in my game that span multiple tiles and can also be rotated.
My idea on how to solve this would be to use 2D arrays that hold data about the structure.
EXAMPLE: (simplified)
Crafting table layout: XOX
X - data
O - data, but also used as a pivot point
If we were to rotate it clockwise, it'd look like this:
X
O
X

My problem lies in that these positions have to be real-world coordinates, so here's the above example again but in a way that makes sense for my actual grid in-game. (replacing the X and O with coords):
(0,1)(1,1)(2,1)

And now, rotated clockwise (around the pivot point, which is (1,1)):
(1,2)
(1,1)
(1,0)

Another example purely for more information, but more complex (2x3 array):
Complex workstation ((6,4) IS THE PIVOT!):
(5,5)(6,5)(7,5)
(5,4)(6,4)(7,4)

Rotate it counterclockwise and we should get this:
(5,5)(6,5)
(5,4)(6,4)
(5,3)(6,3)

I have tried and succeeded in doing it only on a conceptual level with the "X" and "O"s, but I don't know how to implement actual coordinates.
I've never dealt with rotation matrices before so any advice, suggestion or solution on how to implement this is appreciated.

sentences:
Is there an IDE that can simplify the process of creating a game matchmaking website? Yes, I'm an old guy. And I'm well versed in "C" and have written several games which I have been selling on the web for a number of years. And now, I would like to adapt one of my games to be "online". Sounds simple. I'm sure I can use the thousands of lines of "C" code that I've already written. Right?

So my initial investigation begins. First, I think I'll need a server program that lives on a dedicated server (or a VPS probably) that talks to a bunch of client applications that live on individual devices around the world. I can certainly handle that! (I think to myself). I'll break up my existing game into two pieces, a client piece that is just the game displays and buttons, and a server piece that does everything else. Piece of cake, right?

But that means that the "server piece" must be executed on a remote machine somewhere and run 24/7. Can I do that? [apparently, that question is so basic, so uneducated, and so lame, that nobody has ever posed it before. Because hours of Googling does not yield an answer. Fine. I'll assume I can do that and move on.]

I'll need a "game room", which to me means a website where you log in and then go to a lobby of some kind where you can setup your preferences, see if any of your friends are connected, and create or join games. Should be easy, but it's not. No way. Can I do all this with my local website builder? (which happens to be 90 Second Website Builder, a nice product, btw). It turns out, I can not. I can start with that, but must modify each page, so I can interact with my sql database. So I begin making each page a "PHP" page and dynamically modifying the HTML code with PHP code.

I'm already starting to get a headache.

Because the resulting web pages looked terrible, I began looking at using JQuery. I want to user a JQuery dialog on my website to display a list of friends and allow the user to select one to invite to the game. [google search for "how to populate a JQuery dialog from a sql database" yields nothing but more confusion.]

Javascript? Java? HTML? XML? HTML5? PHP? JQuery? Flash? Sockets? Forms? CSS? Learning about each one of these, and how they interact with each other and/or depend on each other is too much for my feeble old brain.

Can anyone simplify this process for me? Is there an IDE that will help me do all this without having to go back to college for a few years?

Thanks,
Scott

sentences:
GL.BlendFuncSeparate(ArbDrawBuffersBlend) Enum has no members? I want to use the function GL.BlendFuncSeparate but it seems that one of the enums used has no members.

    public enum ArbDrawBuffersBlend
    {

    }

Is there another function to call or is this a bug?

sentences:
Everything "invisible" when launching map from launcher I downloaded the CryENGINE SDK, and I tried the map Forest from within the editor and it worked fine. However, if I launch it from the Launcher using the console it looks like this:

I can use the weapons (although they are invisible) and interact with objects despite not seeing them.  I also did my own map and had the same problem. What am I doing wrong?

sentences:
How can I use shaders to make a square have a waving effect? I'm new to using shaders to do some fancy effects and I'm struggling with them. I'm using DirectX 11 and HLSL. I have this square in the middle of the screen:

It's just a square that I've created using 4 vertices. I want to give it this waving effect on the sides, but I don't know how to do it.

This is for a little 2D game I'm making, so I have an orthogonal projection matrix which is the one I use. View matrix is set to identity.

DirectX::XMMATRIX view = DirectX::XMMatrixIdentity();
DirectX::XMMATRIX projection = DirectX::XMMatrixOrthographicOffCenterLH(0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, 0.0f, 1.0f);

This is the constant buffer I set each frame, so I can pass a float time variable to the shader:

struct constant_buffer {
    DirectX::XMMATRIX  WVP;
    // this value starts in 0 and increases by 1 each frame until 359 degrees
    float time;
};

constant_buffer cbuffer;

The shader that I'm currently using is very simple, it just applies the matrix to each vertex to transform it.

struct in_pshader
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

cbuffer constant_buffer
{
    float4x4 WVP;
    float time;
};

in_pshader vshader(float4 position : POSITION, float4 color : COLOR)
{
    in_pshader output;

    output.position = mul(position, WVP);
    output.color = color;

    return output;
}

float4 pshader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

I'm guessing there's some sine function involved around, so that's why I decided to pass angles per frame as input. I tried many combinations, but I'm such a newbie and can't get it right. :( Any help on this would be very appreciated.

sentences:
What version of Marching Cubes bring "ambiguities" I am reading Eric Lengel’s paper about the Transvoxel algorithm.

In an early part describing the classical Marching Cubes (3.1.1), he talks about ambiguous cases. From what I understand, these can result from grouping the cases into “equivalence classes”.

However, in the Marching Cubes paper I read (is this the one he is referring to ?), there does not seem to be any grouping done, and each of the 256 cases produces its own triangulation. For example, taking the case of Lengyel’s figure 3.2 (on page 12 of the first document), the left cube has index 189 (vertices 0 2 3 4 5 7) and the right cube index 24 (vertices 3 and 4), which gives non “equivalent” triangulations: 4 triangles for the left cube, and 2 for the right cube.

To phrase this as a question: are there different versions of Marching Cubes, and could Lengyel be referring to a different one than Paul Bourke's ?

sentences:
Python:Adding enemies and weapons in game (Text-based adventure game) I'm a beginner in coding and game-design also and try to make text-based adventure game, where player should move between rooms, fight with zombies and pick up weapons. Any help, namely tips and pieces of advise regarding the direction are really appreciated.

How can I add more zombies in the game except those which are in room?

For now code is organized as follows:

def position():
# player's position
    print("You are in  : " + rooms[currentRoom]["name"])
# inventory
    print("Inventory" + str(inventory))
# weapon
  if "weapon" in rooms[currentRoom]:
      print("Pick up " + rooms[currentRoom]["weapon"])

inventory=[]

#dataset
rooms = {
    1 : {"name" : "entrance",
         "info":"Start of the game",
         'N': 2 ,
         'E': 3 ,
         'S': 'no such directory' ,
         'W': 'no such direction' },
    2:  {"name" : 'kitchen',
         "info" :'Here is a zombie! Use frying pan to fight against him',
         'N': 'no such directtory',
         'E': 4 ,
         'S': 1 ,
         'W': 5 ,
         "weapon" : "frying pan"},
    3 : {"name":'livingroom',
         "info":'Here is another zombie who likes to play golf. Give him
         golf clubs and run',
         'N': 4 ,
         'E' :'no such directory',
         'S': 'no such directory',
         'W': 1,
         "weapon" : "golf clubs"}
    ...
        }
currentRoom = 1

displayIntro()

while True:

    position()

    moving = input (">>").lower().split()

    if moving[0] == "go":
        if moving[1] in rooms[currentRoom]:
            currentRoom = rooms[currentRoom][moving[1]]
        else:
            print("There is no such direction")

    if moving[0] == 'get':
        if "weapon" in rooms[currentRoom] and moving[1] in
            rooms[currentRoom]["weapon"]:
            inventory += [moving[1]]
            print(moving[1] + "got!")
            del rooms[currentRoom]["weapon"]
        else:
            print("can't pick up " + moving[1] + "!")

By running the code, only first word of weapons is added to inventory. Can you please explain what is a reason?

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:
Moving while doing loop animation in RPGMaker I made a custom class to display character portrait in RPGMaker XP
Here is the class :

class Poser
  attr_accessor :images

  def initialize
    @images = Sprite.new
    @images.bitmap = RPG::Cache.picture('Character.png') #100x300
    @images.x = 540 #place it on the bottom right corner of the screen
    @images.y = 180
  end
end

Create an event on the map to create an instance as global variable, tada! image popped out. Ok nice. But Im not satisfied, Now I want it to have bobbing-head animation-like (just like when we breathe, sometimes bob our head up and down) so I added another method :

  def move(x,y)
    @images.x += x
    @images.y += y
  end

  def animate(x,y,step,delay)
    forward = true
    2.times {
      step.times {
        wait(delay)
        if forward
          move(x/step,y/step)
        else
          move(-x/step,-y/step)
        end
      }
      wait(delay*3)
      forward = false
    }
  end

  def wait(time)
    while time > 0
      time -= 1
      Graphics.update
    end
  end

I called the method to run the animation and it works, so far so good, but the problem is, WHILE the portrait goes up and down, I cannot move my character until the animation is finished.

So that's it, I'm stuck in the loop block, what I want is to watch the portrait moving up and down while I walk around village, talk to npc, etc.

Anyone can solve my problem ? Or better solution ? Thanks in advance

sentences:
Actions abstraction in Goal Oriented AI I am back with another question about Goal Oriented AIs.

To explain my problem, I will use a specific example.

In my game, population nodes are spawned on a world map, and important characters called "Migration leaders" can spawn, take in migrants, lead them to a good spot, and then establish a new population node there and finally despawn as they have served their one-time purpose.

What I want to achieve is having only one action called "MoveToTarget" which has no pre-conditions apart from having a target location, and has the effect of setting the fact "Reached target location" to true, which itself is the precondition for other actions. Not sure this is the right way to structure that in the GOAP but that's not exactly my problem, at least I do not think so.

My problem is that, since you can't work with actions that take in an argument, I have little notion of how the AI should determine the location which it will move to when the "MoveToTarget" action triggers, for the following reasons :

Depending on the character type and generally what is happening, each character will think differently about where they're interested in going. Furthermore, what happens when I have to interrupt the AI's "plan" for some reason ? The original target location for, say, transporting migrants is lost !
I do not which to make different actions like "MoveToMigrationTarget" because then I'll have to make many MANY more actions, like "MoveToCombatTarget" or "MoveToRessources" and I do not think that will work as that will make me have to keep a "Migration target", a "Combat target".. in memory even for characters that have nothing to do with either of those.

So my question exactly is, where is the AI supposed to do the "practical thinking" in a GOAP ? The Actions themselves must be abstract, and can't take in any argument so I have to somehow have target location(s) in memory and have the GOAP planner know which target corresponds to which action.

I could also extend that question to basically any action that need a specific target / object to work.

sentences:
InvalidCastException in Farseer's raycasting when trying to use the built-in explosion class? I'm trying to create an explosion at the point that two entities collide, but whenever explosion.Activate() is called, it causes an InvalidCastException to be thrown in Raycast(), on the line that returns the callback.

return callback(fixture, point, output.Normal, fraction);

Is this a bug in Farseer, or am I doing something wrong? It doesn't appear to be a known issue.

sentences:
Trouble creating fog and lighting in unity I am trying to create a model in unity that looks like this picture by Escher

I can create the lattice, however, I can not create the fog and background/lighting effect. When I adjust the fog in Lighting the cubes just get more of the supposed fog color. Also I don't know how to eliminate the sky and make the lighting more like it is in the picture. Does anybody know how to great the fog and lighting effect I am looking for Thanks
I previously posted this on unity Q and A and got no answer

I can not post my other image with no fog because i do not have enough reputations. It is basically the image I posted just with more shadow and gray cubes.

sentences:
Client side prediction physics I'm trying to build a simple networked game and I'm having trouble keeping a jump in-sync on the client and server.

I've read the free gaffer on games articles and it's helped somewhat but I'm still not completing grasping the theory behind how to keep physics in sync.

Right now I have a character that can move right and left. This is kept in sync perfectly by sending all of the inputs and then relaying them to the clients.

For the jump command..

- I send a packet indicating that i'm jumping.
- The client then predicts the jump
- The server begins to simulate the jump and tells the other clients that client X is jumping
- that then gets simulated on their clients

The issue is that if I keep on jumping on the spot eventually the jumps will begin to overlap. I came up with some makeshift solutions to that, but realized that if I started moving and jumping at the same time it wasn't simulating everything perfectly and sometimes the player would land on the tip of a platform on one client and miss it on the server/other client.

Right now everything is being done locally so there's virtually no lag. I figured the reason it's becoming out of sync is because of jitter.

I'm just a little confused in figuring out how to fix this. How do I get it so the client side prediction is 100% perfect in a local environment when incorporating physics?

sentences:
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:
Why do SDL_Textures need to be created with a renderer? I know how to create textures in SDL, but I don't get why they need to be created with a renderer:
 SDL_CreateTexture(SDL_Renderer* renderer, ...)

When it comes to rendering, I can render my texture on every renderer, regardless from which renderer it was created on. Then why does SDL_CreateTexture require me to pass in a renderer?

sentences: What is the order of execution of OnClick and PointerUp in Unity? I have an UI element in Unity with a Button and a Event Trigger component. The Button component calls a method when the OnClick event is triggered, and the Event Trigger component calls another method when the PointerUp event is triggered. I need the OnClick event to be triggerd always after the PointerUp event is triggered. This seems to be the case, but I'm not sure if I can assume this order of execution is what Unity actually uses. Is this the case or Unity uses a random order of execution?

sentences:
Where are all the tutorials for libGDX? I've searched online for help and tutorials on LibGDX but I couldn't really find any, except and the wiki for asking questions on stackexchange. Besides the source (demos) and wiki, is there any other tutorials online that's hidden or indirect?

From what I read, there isn't much documentation for LibGDX, so there's only two options I see

Give up move to a different framework.
Ask people a lot of questions.

sentences:
Unity joystick input acting strange After setting up my joystick axes in Unity and sweeping them around I find that the Y-axis jumps to the opposite direction in certain positions.

So, when I press up on the joystick, the input will often indicate that it's pointing down. It will also sometimes do this in the opposite direction. It's somehow tied to the x-axis position, making it especially weird.

sentences:
Orienting a model to face a target I have two objects (target and player), both have Position (Vector3) and Rotation (Quaternion).  I want the target to rotate and be facing right at the player.  The target, when it shoots something should shoot right at the player.

I've seen plenty of examples of slerping to the player, but I don't want incremental rotation, well, I suppose that would be ok as long as I can make the slerp be 100%, and as long as it actually worked.

FYI - Im able to use the position and rotation to do plenty of other things and it all works great except this last piece I cant figure out.

Code samples run in the Target's class, Position = the targets position, Avatar = the player.

EDIT

Im now using Maik's c# code he has provided and it works great!

sentences:
What exactly causes a surface to overlap another? I cannot really figure out what causes one surface to overlap another. In a 3D engine I'm creating, my technique is failing in edge cases.

My method is sorting the surfaces to be painted from the furthest to the closest. To determine the closeness, I'm comparing the average z values. Sometimes, however, an overlapping surface has a higher average z value than the one it is overlapping. Thus, the surface further away is painted over the closer one - resulting in bizarre rendering like this:

What one is meant to see is the purple front surface of the cube only, whilst the red side surface is painted over the purple one. The average z value of the purple surface is higher, and therefore 'further away'. So I'm having some doubt as to whether this technique is correct.

What I also tried is getting the distance from the camera (i.e. origin) to the surface, but then I needed a point. I chose the middle of each surface but also this doesn't always seem to work because not all surfaces are as large as each other.

Therefore, what is a reliable way to determine the order of closeness of surfaces towards the origin?

sentences:
What part of my engine should load images and fonts? Right now, I have an AssetLoader interface, which has one implementation per platform. There can only be one instance of it, because it has some state (e.g. the path to the APK on Android).

It has two methods (the game doesn't have sound):

Pixmap loadImage(String path)
Pixmap loadText(String text, String fontFamily, int fontSize)

While that works well enough in practice, I feel this is bad design. In particular, I have two issues with it:

I have to duplicate image and font loading. It's not exactly the same code, because there are different methods used for loading from the file system and loading from a ZIP file, but I could certainly just load a font or an image into memory and return that.
loadText does a bit much at the moment: It loads a font from the disk, renders each glyph of the text onto a pixmap and returns that. More unnecessary code duplication.

What do you think, is this as bad as I think it is? How would you address it?

I don't insist on having a single AssetLoader with one implementation per platform, so please don't hold your suggestion back because it would get rid of that. In fact, I'm not perfectly happy with the beast, but can't think of a nicer approach.

sentences:
Constant 2D Bullet movement in a shmup I've been following the pixelnest tutorial to make a 2D shmup (http://pixelnest.io/tutorials/2d-game-unity/player-and-enemies/).

While working on this I've experimented with increasing the firing rate to get a continuous stream of bullets, and I've noticed that bullets are more spaced apart if the ship is moved backwards, and they get clumped up when the ship is moved forwards. Is there a way to maintain constant distance between bullets no matter the movement of the player?

Should I even care? I get the feeling that if the player moves backwards then the firing rate is essentially slower (at least until they reach the edge of the screen) and vice versa if you move forwards.

sentences:
How to manage all the NPC/AI objects on the server? I'm writing a simple MMO, and currently have the the server-client architecture in place for multiple users to see each other and be able to move around together...now its time to add enemies.

Was wondering if anyone had links to articles that discussed how to best handle the hundreds of NPC objects that need to be managed in the world. I've done some searching and couldn't find much info about how this is typically done.

The two methods of structuring the implementation I can think of:

Holding all the instantiated NPC objects in a list, and having an NPC Thread loop through them sequentially and see if each has any logic that needs to be processed and perform necessary actions. I'm not sure if the performance of this design would be sufficient?
Event based system. Create a method in the NPC class that processes AI/Logic on it, have this method be called when an associated event is signaled, either on a timer for non interacted AI functionality (such as wandering), or signal the event externally from the packet handler (player moving nearby, or player attacking within range).

Is either of these approaches the correct way? What other methods of doing this exist?

sentences:
Pre-calculate physics in unity I have a self contained physics simulation (eg fragments of a building crumbling) which is known to be the same, excepting floating point precision errors, every time it is run.

Is there a way to improve performance by pre-calculating/recording the simulation?

It would seem that the build in physics engine does not support this, but are there other engines that do?

Or alternatively, would recording the transformation of each Rigidbody in the simulation, and then playing back those transforms, be a sensible approach to increase performance?  It would remove a lot of Rigidbodies, joints and enable flattening the hierarchy.

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:
Why does changing the diffuse color of my model's effect change it for all models? I want to change color of individual model in my game. But when I use

  effect.DiffuseColor = newColor

then all of models which were loaded from same model file change color too.

How can I do ?

sentences:
How can I customize scrollbar sensitivity in editor property drawers in Unity3D? A custom property drawer, in my Unity 2017.3 project, has code like this in its OnGUI implementation:

public void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
    ...
    EditorGUI.BeginDisabledGroup(maxX == 0);
    scrollX = (uint)GUI.HorizontalScrollbar(new Rect(xyPos + new Vector2(slHeight, normalizedSize), new Vector2(normalizedSize, slHeight)), scrollX, 1, 0, maxX + 1, GUI.skin.horizontalScrollbar);
    EditorGUI.EndDisabledGroup();
    EditorGUI.BeginDisabledGroup(maxY == 0);
    scrollY = (uint)GUI.VerticalScrollbar(new Rect(xyPos, new Vector2(slHeight, normalizedSize)), scrollY, 1, maxY + 1, 0, GUI.skin.verticalScrollbar);
    EditorGUI.EndDisabledGroup();
    ...
}

But these scrollbars have a sensitivity of 10 (pressing the up/down, or left/right, buttons will change the current value by 10 in the respective direction). I need them to have a sensitivity of 1. How can I do it?

sentences:
Vulkan am I creating too many graphics pipelines? I have the situation in which I require different VkPrimitiveTopology's for different models, which requires me to have a unique pipeline's that render the different models, but now I require multiple windows open at the same time. Is there any way to use the pipelines for multiple windows or will I require a different set for the new window?

The secondary windows could be a different size to the main window, that's why I ask because I know when a window resizes you require to rebuild the pipeline.

sentences:
UE4 - Want my landscape to be unlit BUT catch shadows from objects Here is my problem, I have a landscape that was created through photogrametry. I already has strong shadows on it's diffuse texture so I don't want it to be affected by my virtual sun. What I do want though is for objects added in my scene to receive shadows from the landscape, and for the objects to cast shadows onto the landscape. To do that I matched my virtual sun as close as I could with the shadows on the diffuse texture of the landscape.

How do I keep my landscape unlit yet able to receive and cast shadows from and to other objects?

sentences:
OpenGL global/local states OpenGL has so many APIs which can modify different states. It's not so obvious whether an API has global effect or local effect.

For example, rumour says glTexEnv has global effect while glTexParameter has local effect (it only affects the current bound texture). Is this true? How to determine whether an API has global or local effect?

sentences:
Realistic 2D air friction in unity I want to make an evolution games similar to this old games that was generating cars.
Except I want it to be more realistic.

So I want air friction to impact the speed of my cars, but how do I do that? wind will always be blowing at the same speed and in the same direction.

But my car chassis are random and their angle of attack can change due to the terrain shape (which is also random)

So I cannot apply a drag value, because this drag value change for the angle of attack. instead I must compute a new drag value for each frame.

Using real world physics might be to much to let the game run smoothly (10-20 cars running at the same time) How would you do it?

Thanks.

sentences:
LibGDX - Move camera not working I'm starting with LibGDX and I loving it so far, but I have found some troubles and I'm getting a little frustrated. I've searched a lot for a solution and tried many things, but nothing seems to work. What I want to accomplish is basically a 2d map with a rts-like camera, in other words, a map/world bigger than the viewport where I can move the camera freely. The problem is I can't make the camera move, and I'm not even sure if my world is bigger than my viewport. How can I get these two things done? I'm sure I'm doing something wrong, but I can't figure what it is. Any help would be really appreciated.

These are my classes:

GameMain

public class GameMain extends Game {

private SpriteBatch batch;

@Override
public void create () {
    batch = new SpriteBatch();
    ScreenManager.getInstance().initialize(this);
    ScreenManager.getInstance().showScreen(ScreenEnum.WORLD);
}

@Override
public void render () {
    super.render();
}

public SpriteBatch getBatch() {
    return this.batch;
}
}

AbstractScreen

public abstract class AbstractScreen extends Stage implements Screen {
protected AbstractScreen() {
    super(new ScreenViewport(new OrthographicCamera()));
}

// Subclasses must load actors in this method
public abstract void buildStage();

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

    // Calling to Stage methods
    super.act(delta);
    super.draw();
}

@Override
public void show() {
    Gdx.input.setInputProcessor(this);
}

@Override
public void resize(int width, int height) {
    getViewport().update(width, height, true);
}

@Override public void hide() {}
@Override public void pause() {}
@Override public void resume() {}
}

ScreenEnum

public enum ScreenEnum {

WORLD {
    public AbstractScreen getScreen(GameMain game, Object... params) {
        return new WorldScreen(game);
    }
};

public abstract AbstractScreen getScreen(GameMain game, Object... params);
}

ScreenManager

public class ScreenManager {

// Singleton: unique instance
private static ScreenManager instance;

// Reference to game
private GameMain game;

// Singleton: private constructor
private ScreenManager() {
    super();
}

// Singleton: retrieve instance
public static ScreenManager getInstance() {
    if (instance == null) {
        instance = new ScreenManager();
    }
    return instance;
}

// Initialization with the game class
public void initialize(GameMain game) {
    this.game = game;
}

// Show in the game the screen which enum type is received
public void showScreen(ScreenEnum screenEnum, Object... params) {

    // Get current screen to dispose it
    Screen currentScreen = game.getScreen();

    // Show new screen
    AbstractScreen newScreen = screenEnum.getScreen(game, params);
    newScreen.buildStage();
    game.setScreen(newScreen);

    // Dispose previous screen
    if (currentScreen != null) {
        currentScreen.dispose();
    }
}
}

WorldScreen

public class WorldScreen extends AbstractScreen {

private GameMain game;
private Texture map;

public WorldScreen(GameMain game) {
    this.game = game;
    map = new Texture("sprites/maps/map.jpg");
}

@Override
public void buildStage() {

}

@Override
public void show() {

}

@Override
public void render(float delta) {
    super.render(delta);

    game.getBatch().begin();
    game.getBatch().draw(map, 0, 0);
    game.getBatch().end();
    this.getCamera().translate(+500, +500, 0);
    this.getCamera().update();
}

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

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {

}
}

I debugged the camera and it's changing its value position, but it's not being reflected in the screen.

Also, is there a way to prevent the map texture from being scaled when resizing?

sentences:
Clone gameobject on drag without having to click a second time I have a standard Cube gameObject (with a BoxCollider and my CubeController.cs script) in my scene and I want to be able to click and drag on it to instantiate a new cube prefab (with a BoxCollider and my DragController.cs script) which then follows the mouse.

I have it nearly working but when the new cube prefab is instantiated at the same position as the clicked cube (but 10% bigger) you have to then click the new instantiated object again to begin dragging it. I have a debug line printing 'Prefab created' in DragController.cs so the prefab must be sensing that the mouse button is still down.

How can I do it so you click the original cube then the new prefab is created and draggable without having to click again?

CubeController.cs - placed on original Cube gameobject

using UnityEngine;

public class CubeController : MonoBehaviour
{
    RaycastHit hitInfo;
    Ray ray;

    public GameObject CubePrefab;
    private bool canCreate = true;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        }

        if (Physics.Raycast(ray, out hitInfo))
        {
            GameObject objectHit = hitInfo.transform.gameObject;

            if (objectHit.tag == "Cube")
            {
                createCubePrefab();
            }
        }
    }

    void createCubePrefab()
    {
        if (canCreate)
        {
            canCreate = false;
            GameObject newCube = Instantiate(CubePrefab, hitInfo.transform.position, Quaternion.identity);
            newCube.transform.localScale = new Vector3(1.1f, 1.1f, 1.1f);
        }
    }
}

DragController.cs - placed on Cube prefab that is going to be instantiated

using UnityEngine;

public class DragController : MonoBehaviour
{
    private Vector3 screenPoint;
    private Vector3 offset;

    // Start is called before the first frame update
    void Start()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Debug.Log("Prefab created");
        }
    }

    void OnMouseDown()
    {
        screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
        offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
    }

    void OnMouseDrag()
    {
        Vector3 cursorPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 cursorPosition = Camera.main.ScreenToWorldPoint(cursorPoint) + offset;
        transform.position = cursorPosition;
    }
}

sentences:
Any learning/studying material for C/C++ that use game programming as learning context out there? As most of game programming is done - I read on this very site - in C/C++ I was wondering if there is any learning/studying material for C/C++ that would target specifically game programming.

I am not looking for material about "developing games" or "software architecture for games", but rather for material that uses "game programming" as the CONTEXT for introducing and illustrating C/C++ features, idioms, programming techniques, etc...

With a simile: think to the GOF book on design patterns. There, they used "developing a text-editor" as a context for introducing design patterns, but the book is most definitively not a book about "developing text-editors".

EDIT: The book should contain code examples that are not dependant on proprietary technologies (e.g.: it should use OpenGL rather than DirectX, a dialect of C known to gcc rather than needing a specific commercial compiler, etc...)

Thanks in advance for your time and advice!

PS: My background: I am a programmer with a solid experience in OO scripting languages and only some experience in C and Assembler (on AVR microcontrollers), so I am thinking to mid-to-advanced level material, rather than tutorials for beginners, although it might be interesting to take a look to the latter ones if nothing else is available.

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:
Why isn't my player moving? Why is my code not working?

using UnityEngine;
using System.Collections;

public class NewBehaviourScript1 : MonoBehaviour
{
    public float moveSpeed;
    public Vector3 input;
    public Rigidbody rb;

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

    void FixedUpdate ()
    {
        moveSpeed = 2;
        input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        rb.AddForce(input * moveSpeed);
    }
}

sentences:
How can I allow players to draw decals for their avatar and items? I want the player to be able to draw a simple symbol, even if it's pixelated black or white, that their character can have on their weapons, armour, forehead or even markers and monuments. How would I go about that, if I want to do it?  Better if the suggestion is C#/Unity-specific.

PS: The game would be a turn-based, square grid RPG, maybe somewhat like Dofus, but it should probably be in 3D to allow for more flexibility.

sentences:
Exporting .FBX model into XNA - unorthogonal bones I create a butterfly model in 3ds max with some basic animation, however trying to export it to .FBX format I get the following exception.. any idea how i can transform the wings to be orthogonal..

One or more objects in the scene has local axes that are not perpendicular to each other (non-orthogonal).
The FBX plug-in only supports orthogonal (or perpendicular) axes and will not correctly import or export any transformations that involve non-perpendicular local axes.
This can create an inaccurate appearance with the affected objects:
    -Right.Wing

I have attached a picture for reference . . .

sentences:
Help Reading this Data in XML as a List (ContentReader) Edit:

So i'm going to rephrase the question a bit, seeing as now i think know how i'm going to read this data. Looking at this example as my guide:
http://forums.create.msdn.com/forums/p/53404/323877.aspx

This is pretty much what i'm currently doing, and to be clear and show you guys:
http://pastebin.com/GxqQcBDg, that's how i'm loading my data.

So looking at that guys example from his post, he has a similar layout, his "Enemies" can equal my element "Animated_Tiles" and then his "Items" could be equal to my "Tile" objects, at least if you compare my data to his they look extremely similar, and yes i did update the Data as Richard Marskell - Drackir suggested,
But i'm wondering if i can have "Type" definitions like the guy has in his example, to show what i mean:

  <Animated_Tiles Type="System.Collections.Generic.List[Namespace.Class]">

Can that be done? Or is it only the "Asset" element that can have the Type definition?
Currently this is what my new data layout looks like:
http://pastebin.com/i42166ZQ

But currently, it seems to start reading it but i get this error by the first "Tile" Element. So the only difference i see between his & my layouts are that he has the Asset containing the List definition whereas i have "Animated_Tiles". So i'm unsure can any element can have the "Type=Blah" definition?

sentences:
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:
addressables unity unknown async error public AssetLabelReference imgs;
List<IResourceLocation> myImgs = new List<IResourceLocation>();
[SerializeField]List<Texture2D> loadedImages = new List<Texture2D>();
private void Start()
{
    Addressables.LoadResourceLocationsAsync(imgs.labelString).Completed += imgReady;
}
void imgReady(AsyncOperationHandle<IList<IResourceLocation>> op)
{
    myImgs = new List<IResourceLocation>(op.Result);
    insta();
}
 void insta()
{
    Addressables.LoadAssetsAsync<Texture2D>(myImgs, cb);
}
void cb(Texture2D s)
{
    loadedImages.Add(s);
}

I get the locations of the images but not the asset themselves
I get an error of

  Exception encountered in operation Resource(Man.png): Unknown error in AsyncOperation
  UnityEngine.ResourceManagement.Util.DelayedActionManager:LateUpdate() (at

sentences:
HLSL - Binary operations I'm trying to do binary operations with integers in the hlsl code. For example:

int n = 10 & 15;

Binary value of 10 = 1010 and Binary value of 15 = 1111.

With this, n = 10, because (1010 & 1111) = 1010. This is what I need, but if I declare the int values before, I get an error. For example:

int n1 = 10;
int n2 = 15;
int n = n1 & n2;

this shows the error: "error X3535: Bitwise operations not supported on legacy targets."

I made this simple code to help understanding, because I have no idea what is causing this.

I already tried to change the variables type to uint, but the error remains.

I'm using deferred lighting in xna and I want to store the emissive light intensity together with the specular power.

sentences:
Custom List Editor dependent on data from separate class's data I want to make a custom inspector that I'm not really sure how to approach. The idea is I have a quest framework with a class that holds onto the quest data and another class that is intended to hold onto dialogue data. The quest system is agnostic of my dialogue system.

I want to be able to display the quest and dialogue data this way:

QuestName0

DialogueGiveQuest (TextAsset field)
DialogueQuestIsActive (TextAsset field)
DialogueQuestIsComplete (TextAsset field)

QuestName1

DialogueGiveQuest (TextAsset field)
DialogueQuestIsActive (TextAsset field)
DialogueQuestIsComplete (TextAsset field)

etc...

Here's a pseudocode class layout

public class QuestData : MonoBehaviour
{
    List<Quest> quests;
}

public class DialogueData : MonoBehaviour
{
    public TextAsset dialogueGiveQuest;
    public TextAsset dialogueQuestIsActive;
    public TextAsset dialogueQuestIsComplete;
}

public class Interaction : MonoBehaviour
{
    QuestData questData;
    List<DialogueData> dialogueData;
}

[CustomEditor(typeof(Interaction))]
public class InteractionEditor : Editor
{
    public override void OnInspectorGUI()
    {
        var interactionData = (InteractionData)target;
        //foreach interactionData.questData.quests
          // draw quest name
          // make sure there's a dialogueData element for each quest
          // draw field for each DialogueData
    }
}

An obvious issue is dialogueData doesn't care about what's going on with questData.quests so if the inspector were to draw normally it would display 2 lists. I'd like the dialogue data to add and remove elements to itself depending on the quest data but that sounds like it be a real challenge to serialize.

sentences:
Projectile Aim Prediction with Acceleration I'm trying to solve the classic shoot moving object problem but with acceleration attached to that changes it from a quadratic to quartic formula but my math skills are not this good sadly as i prefer to speak in code and not formulas.

i found this https://wiki.beyondunreal.com/Legacy:Projectile_Aiming. i ported it and it's almost what i'm looking for but missing control over the acceleration as its only made for gravity or no gravity and even this i got working only with tricks and modifying it without knowing what i'm doing is getting me only that far.

I made myself a Prototype Interface for the minimum of what i'm trying to get out of it

public class PredictionResult {
    public bool IsInRange; // can we even hit the target?
    public Vector3[] ShotVelocity; // should be up to 4 possible values
    public float[] ShotImpactTime; // how long each shot takes to arrive at the predicted target
    public Vector3[] ShotImpactLocation; // somewhat redundant yet still useful if available
}
// only really the delta between start and target matter but its up to the function
// same for startVel and targetVel where startVel is the shooters speed that gets added to the bullet
// the bullet and target can have different accelerations (standing on ground => no gravity or bullet is not affect by gravity)
public PredictionResult ShootAtTarget(Vector3 start, Vector3 target, Vector3 startVel, Vector3 targetVel, Vector3 bulletAccel, Vector3 targetAccel, float bulletSpeed);

any help solving this would be great

sentences:
Camera controll in Libgdx I've a condition in my game where, I want my camera to follow the Player(its a body from Box2d) and in some not.
This is the start screen of my game:

Now, when i press a button(space) the player get an LinearVelocity in x,y direction and starts flying..

As soon as it reaches the end. The box is now out of the camera.

To fix this I made my camera centered the box.

This is where I screwed. I dont want my ground to come in the center it should always needs to be at bottom.. like in Picture 1 and the player should also needs to be at the left-bottom at the start of the game.  And when player flies away ... the x and y coordinates should be moved as my player moves ... i have certain height where player can fly so camera should be able to move in y-axis also.. and the game is endless running game so x- cordinates also keeps comming in.

sentences:
Efficient approaches to updating adjacent grid tiles when one tile is disabled? I'm trying to update the surrounding grid of tiles if one of them is disabled (not removed). For example,  imagine we have a grid of tiles each with x representing one texture:

x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x
x, x, x, x, x, x

Now if some of these tiles are disabled, I need to update the surrounding tile textures to a different texture:

x, x, x, x, x, x
x, y, y, y, x, x
x, y,  , y, y, y
x, y,  , y,  , y
x, y, y, y,  , y
x, x, x, y, y, y

I'm trying to find the most efficient way of doing this. At present all of the tile data is stored in a dictionary with the key as a vector2.

I'm using C#/Unity 3D, however, I'm not necessarily looking for code but more or less logic on how to do this efficiently so I can program it in.

Any suggestions, examples, or what not would be helpful.

Thanks.

sentences:
Ray-plane intersection to find the Z of the intersecting point I have a rectangle in 3d space (p1, p2, p3, p4) and when the mouse rolls over it I need to calculate the exact Z of the point on the rect, given the mouse coordinates (x, y).

Would a Ray-plane intersection find the Z of the intersecting point?

Edit: Would this one-liner work? .. it returns the t value for the intersection, apparently the Z value.

 float rayPlane(vector3D planepoint, vector3D normal, vector3D origin, vector3D direction){

     return -((origin-planepoint).dot(normal))/(direction.dot(normal));
 }

sentences:
Loading TextureRegion with filter diff from that of texture it came from I am using libgdx .
While packing my texture atlas I have set the filter for mag and min to Nearest . But for just one region I wish to draw it with linear filter . Is it possible to have different filters for texture region than that of texture atlas it came from.

sentences:
A* Pathfiding movement is not stopping and constant I'm trying to make my player move towards mouse click using A* Pathfinding but I'm having some odd issues that I can't solve.
One of the issues is that player is moving a little bit even though it arrives at the position of the other transform

The second one is that the force is that is applied to the player is not constant, I would like it to keep always the same movement speed. I've tried to change to use transform.Translate to move the player with constant movement speed but it makes the movement to be like walk a little then stop, walk a little then stop...

This is the code that I'm using
using System;
using System.Collections;
using System.Collections.Generic;
using Pathfinding;
using UnityEngine;
using UnityEngine.UI;

public class Player : MonoBehaviour
{

    [SerializeField] private float speed = 100;
    [SerializeField] private Text lifeText;
    [SerializeField] private int life;
    [SerializeField] private GameObject target;
    [SerializeField] private float nextWaypointDistance = 3f;

    //AI configurations
    private Path path;
    private Rigidbody2D rigidbody;
    private Seeker seeker;
    private int currentWaypoint = 0;
    private bool reachedEndOfPath = false;

    // Start is called before the first frame update
    void Start()
    {
        seeker = GetComponent<Seeker>();
        rigidbody = GetComponent<Rigidbody2D>();

        InvokeRepeating("UpdatePath", 0f, .2f);
    }

    // Update is called once per frame
    void Update()
    {
        lifeText.text = "Vida: " + life.ToString();

        if (Input.GetMouseButtonDown(1)) //right click
        {
            Vector2 mousePos = Input.mousePosition;
            Vector2 worldPos = Camera.main.ScreenToWorldPoint(mousePos);
            target.transform.position = worldPos;
        }
    }

    private void UpdatePath()
    {
        if (seeker.IsDone())
            seeker.StartPath(rigidbody.position, target.transform.position, OnPathComplete);
    }

    void FixedUpdate()
    {
        if (path == null) return;

        if (currentWaypoint >= path.vectorPath.Count)
        {
            reachedEndOfPath = true;
            return;
        }
        else
        {
            reachedEndOfPath = false;
        }

        Vector3 direction = (path.vectorPath[currentWaypoint] - (Vector3)rigidbody.position).normalized;

        Vector3 force = direction * speed * Time.deltaTime;

        rigidbody.AddForce(force);

        float distance = Vector2.Distance(rigidbody.position, path.vectorPath[currentWaypoint]);

        if (distance < nextWaypointDistance)
        {
            currentWaypoint++;
        }
    }

    private void OnPathComplete(Path p)
    {
        if (!p.error)
        {
            path = p;
            currentWaypoint = 0;
        }
    }

}

What I want to is to make the movement smoother and with constant movement speed.
Can you guys help me?

sentences:
Unity: Efficient way to get the average pixel color for a portion of the camera viewport At it's core, the problem I'm trying to solve is this:
I have a camera (not main) that I would like to project to a 2 pixel RenderTexture. I would like the first pixel to be the average color of all pixels in the left portion of the camera viewport (or a close approximation). And the second pixel to be the average color of all pixels in the right portion of the camera viewport.
So far I've looked into doing this via OnRenderImage(src, dest) but I'm open to any suggestions. Same goes with camera resolutions, 256x256 seems like a good starting point but open to suggestions here too. It's worth mentioning that I just threw together a brute-force non threaded approach that works but totally tanks FPS (nothing surprising)
Any help would be greatly appreciated. This doesn't seem like an incredibly weird downscaling approach but I can't seem to find anything regarding it. There might be a clever way of dealing with this via a shader but I have yet to find it. Bilinear downscaling (which I think is what unity uses by default) sadly does not give the appropriate result.
System compatibility is not an issue, Win 10, DX 12.

sentences:
Applying texture to a 3D object I am trying to draw a 3D cube on the screen, using MonoGame.  The cube was created in Blender and exported as an fbx file.  The following is what the cube looks like in VS when opened in the editor:

And this is what it looks like when displayed on screen:

From the research that I've done so far, I believe that I need to apply a texture.  I couldn't see any way to do this in Blender, or in the Content Pipeline Tool, and so I tried the following when drawing the effect:

effect.Texture = _texture;
effect.TextureEnabled = true;

When I run this, I get a runtime error:

  An error occurred while preparing to draw. This is probably because
  the current vertex declaration does not include all the elements
  required by the current vertex shader. The current vertex declaration
  includes these elements: SV_Position0, NORMAL0, COLOR0.

Clearly I'm missing a key part of this puzzle; please can somebody point me in the right direction.

sentences:
Massive CPU Usage by WaitForTargetFPS in the Profiler So I was checking the Standard Assets Example Projects of Unity, and they all have high FPS numbers in the Profiler.

I started a little project myself, just a simple sprite with movement via rigidbody and a plane as a floor, and suddenly this:

I searched for what exactly does WaitForTargetFPS represents, but apparently there is not a general consensus about what can cause such high CPU usage. So why exactly such a little and simple project have this performance (in contrast with the more complex Unity Example Projects)?

sentences:
How can I rotate a Transform over a specified time in a single line of code? How can I rotate a Transform over a specified time in a single line of code?

I have had a lot of trouble with this in the past.  I wrote a script which rotates a Transform by a specified rotation over n seconds, or rotates a Transform towards a Vector3 over n seconds, in a one liner.  I hope it helps others in the future.  See below.

sentences: How to draw a plane equivalent to a given btStaticPlaneShape using OpenGL With all other shapes in bullet, you can easily get the transform from the MotionState which holds the origin, the scale, and the rotation. There seems to be no way to get the same information about a btStaticPlaneShape. How can I get this information, so that I can build a rectangle with 4 vertices that will act as a representation in OpenGL?

sentences:
Depth Peeling implementation problem: How to render the next layer? (OpenGL) I try to implement order-independet transparency sticking to the pseudo code in the linked paper (page 4). I can't figure out how they are able to do this in OpenGL.

I am rendering the scene two times in two different framebuffers and then want to blend the two. The first rendering uses the normal depth test GL_LESS. So I receive the nearest fragments in the first framebuffer.

I want to render the second nearest fragments in the second framebuffer. In the pseudo code they use the depth test GL_GREATER for this. But this would result in having the "farest" fragments in the second framebuffer, right?

So how can I render the "second nearest" pixels to a framebuffer? Which depth test would be right and how to apply it in OpenGL?

sentences:
Particle System Tracking I have a particle system where instead of tracking the time each particle is alive, I just track the time of the oldest particle and the time of the youngest particle. Basically, the oldest particle is guaranteed to die first, so once the time since it spawned has passed, the particle is 'killed off' and that time is subtracted by the time between particle spawn (1 / rate). And for spawning particles, the time since the spawn of the youngest particle is tracked. Once this time exceeds the time between particle spawn (1 / rate), then a new particle is spawned and this time is subtracted by the time between particle spawn (1 / rate). However, there seems to be some  bug in my code that I can't seem to find. The emitter seems to spawn only a few particles which move for the duration of their lifespan and then just stop and stay visible. The visibility of the particles is dependent on the index of the particle being within the range of the particleStartIndex and the liveParticleCount (These do wrap around and have been accounted for). I am testing with an emitter with 100 max particles. Here is my code:

inline void Update(float t)
{
    timeSinceFirstLiveParticle += t;
    timeSinceLastSpawn += t;

    //Kill Live Particles
    while (liveParticleCount > 0 && timeSinceFirstLiveParticle >= lifespan)
    {
        particleStartIndex = (particleStartIndex + 1) % maxParticleCount;
        liveParticleCount--;
        timeSinceFirstLiveParticle -= timeBetweenFire;
    }

    //Update Live Particles
    for (int i = 0; i < liveParticleCount; i++)
    {
        int idx = (i + particleStartIndex) % maxParticleCount;
        particles[idx] = particles[idx] + direction * speed * t;
    }

    //Spawn New Particles
    while (timeSinceLastSpawn >= timeBetweenFire)
    {
        int idx = (particleStartIndex + liveParticleCount) % maxParticleCount;
        timeSinceLastSpawn -= timeBetweenFire;
        particles[idx] = position + direction * speed * timeSinceLastSpawn;
        liveParticleCount++;
    }

    valid = false;
}

Any ideas?

sentences: How do I find the circumcenter of a triangle in 3D? I want to find the circumcenter of a triangle.  Wolfram only shows how to find the circumcircle of a triangle in R2. How can I find the circumcenter of a triangle in R3?

sentences:
How to sync random incidents over network? In my Photon powered game, I have a shotgun weapon and when a player fires a bullet, I call an RPC on other clients and it's bullets get direction from a random function, Random.Range, and on different clients it acts differently.

How can I sync this so in every client, the bullets behave the same, i.e. in this case they would have same directions?

I tried setting the same seed via Random.Seed but it didn't help.

sentences:
How to make a rigidbody come to rest faster I'm trying to move around a 3D rigidbody in Unity 2018.1.0f2 Personal. I am using a C# script with the basic vector3 and velocity stuff from a YouTube video:

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

public class Player : MonoBehaviour {
    [SerializeField]
    private Rigidbody playerBody;

    private Vector3 inputVector;

    private float xMovement;
    private float zMovement;

    [SerializeField]
    private float playerSpeed;

    private float maxSpeed;

    // Use this for initialization
    void Start () {
        playerBody = GetComponent<Rigidbody>();
        playerSpeed = 1;

    }

    // Update is called once per frame
    void Update () {
        xMovement = Input.GetAxisRaw("Horizontal")* playerSpeed;
        zMovement = Input.GetAxisRaw("Vertical") * playerSpeed;

        inputVector = new Vector3(xMovement, playerBody.velocity.y, zMovement);
        playerBody.velocity = inputVector;
    }
}

It works great with a cube I put it on, except for this: if I move the rigidbody and then stop, it takes a long time for it rotate from go only one of the edges or corners just touching the ground (screenshot of what I mean, another screenshot) to resting flat. How can I make it fall back to stability faster?

sentences:
Inline sprites in Unity's text? How can I use different materials when using the tag for Unity's rich text syntax?

I want to be able to have sprites that are inline with my text without having to create custom fonts.

Here's what I have so far:

Here's the syntax that I'm using for the text in my image:

Planetary <quad material=1 size=20 x=0.1 y=0.1 width=0.1 height=0.1 /> Intergalactic

I'm guessing "material=1" refers to the material index of the Text object. How can I set it to use a different material altogether?

Is there a plugin or other resource that makes embedding icons in text easier?

sentences:
Maximum tile and texture size for tiled maps I'm currently making a game using libGDX and Tiled.

Everything was running fine until I changed the tile size from 96x96 to 300x300. Most layers are still displayed correctly but the tiles of a single layer are just black. I guess that there may be a problem with the large tiles (as there are some tiles together in one tileset bitmap the texure is 2100x2100 large). Are there any upper limits for tiles and/or tilesets regarding the bitmap and texture size?

GL_MAX_TEXTURE_SIZE returns 3379 on this machine.

sentences:
Unity open UI from ScriptableObject I have a Canvas that has multiple UI Panels in it for an inventory, crafting, etc. To open these panels I currently have a monobehaviour class on the Canvas with methods like OpenInventory(), etc.

For every item within the inventory I use ScriptableObjects. However, some items open the crafting panel when right clicking, I created a class that extends the Item class and added a method to it that gets added to the inventory slot and gets called when right clicking that item.

Because the monobehaviour on the Canvas is an instance, I can't access it from a ScriptableObject.

Long story short, is there a way to open a UI panel from a ScriptableObject? If not, what would be the best way to fix this issue?

sentences:
C++ Saving and Loading From Text File In my C++ program I am trying to develop a simple saving and loading function for my game. I can easily get the save function on it, but the loading part of it really stumps me.

What I need is to load the numbers on the file (line by line) and insert them into different variables for my player. I'm just not able to figure that out. I've even looked all around the inter webs.

Here is the code for the player save and load functions:

void Player::Save()
{
    std::ofstream savePlayerFile;
    savePlayerFile.open("Save/playerSave.dat", std::ofstream::trunc);

    savePlayerFile << x << "\n" << y << "\n" << prevX << "\n" << prevY << "\n" << health << "\n" <<
    health  << "\n" <<  mana  << "\n" <<  gold  << "\n" <<  level  << "\n" <<  maxHealth << "\n" <<
    maxMana << "\n" << strength << "\n" << defense;

    savePlayerFile.close();
}

void Player::Load()
{
    std::ifstream loadPlayerFile;
    loadPlayerFile.open("Save/playerSave.dat", std::ofstream::in);

    /*std::string line;
    while(std::getline(loadPlayerFile, line))
    {
        std::istringstream iss(line);
        */
    loadPlayerFile >> ( x && "\n" && y && "\n" && prevX && "\n" && prevY && "\n" && health && "\n" &&
    health && "\n" && mana && "\n" && gold && "\n" && level && "\n" && maxHealth && "\n" &&
    maxMana && "\n" && strength && "\n" && defense);
}

sentences:
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:
Create edges in Blender I've worked with 3DS Max in Uni and am trying to learn Blender.

My problem is I know a lot of simple techniques from 3DS max that I'm having trouble translating into Blender. So my question is:

Say I have a poly in the middle of a mesh and I want to split it in two. Simply adding an edge between two edges. This would cause a two 5gons either side.

It's a simple technique I use every now and then when I want to modify geometry. It's called "Edge connect" in 3DS Max.

In Blender the only edge connect method I can find is to create edge loops, not helpful when aiming at low poly iPhone games.

Is there an equivalent in blender?

sentences:
Is my calculation of chances correct for my AI? I'm working on a turn based game where one part is pretty much like playing "Memory": remember where a specific card is located in a grid.

My AI works like this:

If a card is peeked (turned around and looked at) -by the player or AI - the AI remembers the location of this card 100%.
If the next card is peeked, a "dementia" factor will be applied to all the previous remembered cards. This means, card one is now only remembered with 80%, card two with 100%.
This information is kept in an array. Over time, chances to remember a card location decreases.

Now in order to figure out if the AI remembers a specific card X, I get the chance for the card X from the array, let's say the chance is 60%, or 0.6.

I then generate a random float number between 0 and 1. If the random float is lower than or equal to 0.6, I let the AI remember the location.

Is this a valid approach? I'm assuming here that the randomization in .NET is uniformly distributed.

sentences:
Scale my pixel art files when designing them or when rendering? If I create pixel art files that need to be scaled up on the screen later, so that a single pixel becomes a box of 4 pixels. Should I create my pixel art with 2x2 pixels or should I create it with 1x1 pixels so that I can I 1:2 scale it later in XNA to 2x2 pixels?

I tend to believe that 1:1 would result in too much detail rather than the pixel art effect, thus I want the end result in 2:1 style where a 1x1 pixel of my intended sprite will take 2x2 pixels on the screen.

sentences:
Using Standard Asset RBFP Controller for Universal Windows Platform I was using the rigidbodyfirstperson controller, and it stopped working when I changed the build settings to UWP. Any body know the reason for this or how to solve it? Thanks...

Rik

sentences: Handle game flow in turn-based game on server or client side? Im building a turn-based game using websockets and nodejs. At the end of each turn I want to show some scores before starting the next turn. Should that be controlled by the server using a timer? Or should the client start a timer and tell the server when it's ready for next turn? Just to keep the load of the server. What is the pros/cons?

sentences:
How is persistence managed by browser games? I was wondering,

when you play browser games you never seem to witness a page refresh, even if there is data being stored on the server. So how are databases handled by browser games.

In my opinion there are several possible scenarios:

Data is being modified during your absence. Let's say in FarmVille your plants will grow while you are not using the application. So is this data being constantly updated on the server or does the application calculate everything that might have happened in a fast forward when you launch it?
Let's say you are currently playing in the browser and you completed a mission and get a coin reward or something. Is this data-update instantly written to a database or is it somehow stored in some kind of session tracker (cookies?) and stored on the server once you leave the application?

If it is written to the server instantly how is this done without a page refresh? I mean if there is some kind of client/server communication there must be a page refresh right?

If the data is send to the server once you leave the application, how to handle a case where the user simply kills the browser process by simply closing it? Can this scenario be catched by code so the data can still be written?

I read about several options to use JavaScript for database communication but I guess this is not an option, security, right? Wikipedia says that this kind of games do rely on server-side code but how exactly is this accomplished?

In case this matters, my approach for a browser game would be a JavaScript application with a minimum of client/server communication.

sentences:
directX rotation of a 3d cube inconsistent i'm trying to develope a simple 3d cube in directX that can be rotated in any direction by dragging the mouse.

It works in the following way: i drag the mouse to the right or left, and the cube rotates along the Y axis accordingly. The same goes if i drag the mouse up or down (in this case the rotation is along the X axis).

The problem occurs if i rotate my cube 180 degree on X-axis. After this, every rotation along the Y-axis is in the opposite direction, so that if i try to move it towards positive Y-axis it moves in negative Y-axis.

I understand it has something to do with the way i do the transformations, but i can't fix the problem on my own.

D3DXMatrixRotationY(&MatRotY, rotation.y);
D3DXMatrixRotationX(&MatRotX, rotation.x);
D3DXMatrixTranslation(&MatTran, position.x, position.y, position.z);

D3DXMatrixMultiply(&MatRotXY, &MatRotY, &MatRotX);
D3DXMatrixMultiply(&MatRotXY, &MatRotXY, &MatTran);
D3DXMatrixMultiply(&worldMatrix, &worldMatrix, &MatRotXY);

PS: i know i shouldnt be using D3DX at all, but i'd like to solve this problem before having to switch to a different library.

thanks

sentences: How or when to add a copyright notice in published games? I've seen lot of videogame title screens show a copyright notice together with the company name. I'm about to publish my game and I am looking for possibilities or requirements on how or when to add such a copyright notice (including date or year published). Does it apply to both indie game makers and larger companies?

sentences:
ImGui, how to get value that the mouse is pointing at in a VSliderFloat widget I am using ImGui::VSliderFloat to create a vertical slider in the GUI of my application. To do this I just copied the imgui demo code (imgui_demo.cpp), which reads something like

ImGui::VSliderFloat("##v", ImVec2(18,160), &values[i], 0.0f, 1.0f, "");
                if (ImGui::IsItemActive() || ImGui::IsItemHovered())
                    ImGui::SetTooltip("%.3f", values[i]);

In the demo they have stored some values in the array values[7]. My question is about the tooltip. When you point your mouse at the VSlider, the tooltip you get is the current value in values[i]. Is there some way I that I could ask ImGui for the value of the slider that the mouse is pointing at?

sentences:
How do I find a unit vector of another in Java? I'm writing a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". Part of step 1 says:

  Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n.

My below code represents the normal vector of 2 objects (I'm using a simple array to represent the normal vector).

int[] normal = new int[2];
normal[0] = ball2.x - ball1.x;
normal[1] = ball2.y - ball1.y;

I am unsure what the tutorial means by dividing the magnitude of n to get the un.

What is un? How can I calculate it with my Java array?

sentences:
Keeping sprites nice and pixelated How do I keep the sprites in my game nicely pixelated on screens of all sizes and resolutions? I use nearest-neighbor texture filtering when resizing pixels, but this works well only at really high magnifications, otherwise the pixels get distorted and uneven.

I understand the limits of nearest-neighbor scaling and I wouldn't be asking this except there are so many games that use pixel art without this problem, so I figure there is some trick I don't know about.

sentences:
How to make texture visible in unity from blender file? I've imported a tree to Unity that I've made in blender, but the texture of the tree is not visible. Could you please tell me how to make that texture visible?

I am a beginer and I don't know how to actualy export it or what to select when exporting in blender. I only saved this 'maple' .blend file to my assets folder and that's it. I thought the tree would show up with the texture, but it didn't and I don't know what to do.

sentences:
What is the definition of "tiles?" When we talk of tiles, are we strictly talking about images or the underlying data structures?

For example, I read an article which explains that tiles are a data structure that holds your game data. Then I read this article which explains that tiles are images that fit together.

Which is correct? Should I infer that "tile-based games" use both systems concurrently?

sentences:
Peter Panning Depth Bias Problem No matter how I experiment with RasterizerState Depth Values, I always get a detached shadow which is called peter panning. Ive even adjusted the near plane for the light camera. It always seems to stay at that certain distance. I can get it no closer.

I was wondering on some insight on what the fix could be.
Below is the shader code I use when rendering the depth map which has the BIAS values.
   cbuffer cbPerObject
{
    float4x4 gWorldViewProj;
};

struct VertexIn
{
    float3 PosL    : POSITION;
};

struct VertexOut
{
    float4 PosH    : SV_POSITION;

};

VertexOut VS(VertexIn vin)
{
    VertexOut vout;

    vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);

    return vout;
}
RasterizerState Depth
{

    DepthBias = 85000;
    DepthBiasClamp = 0.0f;
    SlopeScaledDepthBias = 10;
};

technique11 Light2Tex
{
    pass P0
    {
        SetVertexShader(CompileShader(vs_5_0, VS()));
        SetGeometryShader(NULL);
        SetPixelShader(NULL);

        SetRasterizerState(Depth);
    }
}

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:
Heightmap Physics Optimization/Improvement I'm working on implementing the physics surrounding a player walking on a heightmap. A heightmap is a grid of points which are evenly spaced on the x and z axes, with varying heights. The physical representation of my player (what is exposed to my physics engine/manager) is simply a point-mass where his feet are, rather than complicating the problem by treating him as a sphere or a box.

This image should help further explain heightmaps and show how triangles are generated from the points. This picture would be looking straight down on a heightmap, and each intersection would be a vertex that has some height.

Feel free to move this over to math, physics, or stack overflow, but I'm pretty sure this is where it belongs as it is a programming question related to games.

Here's my current algorithm:

Calculate the player's velocity from input/gravity/previous velocity/etc
Move the player's position (nextPos = prevPos + velocity * timeSinceLastFrame)
Figure out which triangle (all graphics is done in triangles!) of my heightmap the player's new position is vertically aligned with
Use the three vertices of that triangle to calculate the equation for the plane which that triangle lies in
Plug in the player's x and z coordinates into the plane's equation to get the y coordinate for the player's position on that plane
Set the y coordinate of the player's position to this (if newPos.y < y)

This is all fine and dandy, but I'm wondering if there's anything that I can optimize. For example, my first thought is to store the plane's equation with the triangle's vertex information. This way all I have to do is plug in the x and z values to the equation to get the y. However, this would require adding 4 floats to every vertex of the heightmap which is a little ridiculous memory wise. Also, my heightmaps are dynamic (meaning the heights will change at runtime), which would mean changing the plane equations every time a vertex's height changes.

Is there a faster way to calculate that point than digging up the plane's equation and then plugging in x and z? Should I store the plane equations and update them on vertex height change or should I just regenerate the plane equations for every triangle every time the player moves on that triangle? Is there a better way to do heightmap physics that maintains this simplicity? (this seems very simple to me as far as physics engines go)

sentences:
Point system that is not competitive or has a clear goal I'm making a game in which the goal is to reach as much entries as possible and I want the player to see that he is making progress somehow. However the game shouldn't be of competitive nature (it co-operative), so I feel that points might not be the right measure. I thought instead of a progress bar, so you work towards a goal of entries. However the problem with this is that there isn't a specific number of entries the user should aim for; The more, the better.

Is there a way of showing progress without assuming there is an end and without it getting competitive?

sentences:
Is Orthogonal in LWJGL 2D or 3D? I'm attempting to develop an orthogonal game with lwjgl 3 and OpenGL in Eclipse, but I can't find an answer for rendering objects in 2D or 3D. Are both applicable? And if so what are the advantages of either one?
I would also like to rotate my camera if that changes your answer.

sentences:
some questions about game development I'm a web developer, I also love games, but I really don't know anything about game development. Recently I've decided to write an outline document about an idea.
I've got a few questions to get me started, mostly I'm looking for terminology (or resources) to be able to research.

How to come up with a fair cost/gather, attack/defence/health and other ratios in a game?

1.1 is it just trial and error or there is a mathematical solution for these things?

1.2 what is the terminology for these things? what do you call them?

1.3 what area these things go into? (game designe, mechanics, etc)

1.4 what are the keywords for research and googling on these topics? (I believe 1.1 answers this too)
Is there a way to estimate development cost (in terms of time and team number)?
Is selecting a time scale for in-game by trial and error?
How to decide what requirments should be for the upgrade system? I mean, is there a solution or these things are just by tase?
what are the steps when developing a game and what to think of in each step? (I really just need resources)
most importantly, should I even worry about these things when crafting the idea? if not, which step of development should be dedicated to these things?

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:
Unity Profiler - What would cause PlayerEndOfFrame to have 10-16MB in GC Alloc? I can't find much documentation on what "PlayerEndOfFrame" does. Sure it is the end of a frame but what would cause the GC Alloc to go so high?

This is the profiler results from a debug build on a remote machine using the IP connect to unity profiler.

sentences:
How to create 2D shadows I'd like to create lights and shadows in a 2D environment, like in the image below:

I did several searches but got no results. Do you have any hint?

sentences: Dynamic Aspect Ratio in Unity (for Anti-Aliasing) I am using HDRP with 1920x1080 resolution. The anti-aliasing works very well if the screen resolution increases and it works really bad if the screen resolution is lower than 1920x1080. Why does this happen? Is there a way to overcome this?

sentences:
What is the intended usage of the Sprite class in LibGDX I am making a small game in LibGDX and it all works, sprites are moving etc. The drawing is mainly done in the render() method of a Screen, using Batch.draw(TextureRegion). So far so good.

But now I would like my sprites to rotate. There are Batch draw methods for rotation (I think), but I noticed a bunch of useful methods in tne Sprite class. Problem is I do not know how to use them without making the rest of the program ugly.

I could have a Sprite as a member of each "game object", but that makes direct dependency of the game model on drawing mechanism, specifically LibGDX. Besides I can see problems with serialization and duplicate parameters (Sprite x,y vs model x,y etc) and unnecessary overhead.

Or I could subclass Sprite, which would probably be orders of magnitude messier.

Is there a common way of clearly separating the model part and rendering part of  a small game? And how is Sprite typically used?

sentences:
Should each Entity have its own update and render methods? First, the questions:

Should each Entity (which are classes like Character, Tree, Enemy) have its own update() and render() methods?
If that's the case, then should I use Interfaces like "Renderable" and "Updatable"?

I ask you this because most of the tutorials I followed "told" me to include all Input Handling and Updates inside the Game's main update() method, and all the Rendering inside the Game's main render() method.

I know these tutorials are very simple but even a few more complex ones still had all the Entities' actions inside the same block of code, which made me doubt the ideas I previously had (separating updates and renders per each object).

To clarify, I feel like I should have something like this:

update() {
    HandleTheUserInput();
    for each active Entity in the game right now {
        entity.update();
    }
}

Then, the same thing for rendering (except the input part). Am I following the right path here or should I rethink the current architecture ideas I have? Thank you.

sentences:
Discrete line inside a 3D matrix First of all a little premise: I'm following this tutorial on YouTube for procedural 2d cave generation in unity using cellular automata and I'm extending it in order to make caves in all three dimensions. With this approach, caves are based on a 3d matrix where if a cell value is 1 it is a wall and if 0 it is an empty space.
The "rooms" created, after being logically connected, need to be "physically" connected by making a path of zeros in the 3d matrix and the tutorial explains how to do this in 2d.

Can you, please, suggest me the approach on how to draw a discrete line (of zeros in this case), in a 3d matrix, that goes from point A to point B?

I'll attach a screen of a map example where rooms are drawn with cubes and red lines are the logical connections.

sentences:
Rotating UVs by X degrees I would like to make a tileable texture with UV noise in Unity Shader Graph only, but I have a problem.
After creating simple noise from UV, I want to rotate it by 90 degrees, but the node Rotate (as well as Rotate About Axis) doesn't rotate my UV (like a picture in PS), instead it changes the colors in it from black & white to red (yellow, green, ...) & black.
Could you tell me please, how to fix it?

Some context :
Based on the answer https://gamedev.stackexchange.com/a/23631 , I want to rotate the noise three times (so 0° + 90° + 180° + 270°), multiply them and thus normalize the edges to make the texture tileable.
Instead of it, even at 0° rotation the color of noise is changed to yellow somehow and the multiplication is everything but not the result I want.
That's how I wanted to do it:

sentences:
Unity is losing track of changes to Resources I have a Unity project, where I recently changed the names of a few files in my Resources folder.  This is relevant because I have code that looks like this:

        internal void LoadItems(string[] names)
        {
            var items = Resources.LoadAll<TileBase>("Tiles\\Items");
            var itemMap = items.ToDictionary(m => m.name.ToUpperInvariant());
            _items.Clear();
            _items.AddRange(names.Select(n => itemMap[n.ToUpperInvariant()]));
        }

The AddRange call is currently throwing an exception, because the incoming data is expecting the new names to be present, but itemMap for some reason still contains the old names.  I've verified this in the debugger, and I've verified in Unity's file search that no file matching the old version of the name that's causing trouble here exists anywhere in the project anymore.  And yet, when I run the project, (using the Attach To Unity And Run option from Visual Studio,) the old names still show up.

If I go into Build Settings and tell it to rebuild the project, this code works correctly... once.  Subsequent runs cause it to fail, going back to the old names again, so it kind of feels like Unity is actively trolling me at this point.

The old data has to be cached somewhere, but I'm not sure where or how to fix it.  Anyone know how I can resolve this?

sentences:
How to create a custom installer for my game for PC/Linux/Macs? How can I create a custom installer that integrates a product key unlocking feature or tells the distributor that the customer was able to access the product like the BMT Mirco payment processor. Or possible how can I connect my BMT Micro management to unlock products to install them in a custom installer.

I want it to have an easy setup like Inno Setup or Clickteam Install Creator and incorporate customized head/side banner.

sentences:
Unreal: Y-Axis boundary on a Camera Bounding Box I was wondering if I could get some help with modifying a Blueprint I'm currently using for a project in Unreal Engine.

I am currently attempting to make a side-scrolling platformer game and I'm using a camera bounding box Blueprint to restrict where the camera can move when tracking the player's movement, based on the following series of tutorials on YouTube by JvtheWanderer: How to make a Metroidvania/ 2D Camera Blueprint System on #UE.

The camera bounding box works as intended, in that it prevents the camera from moving beyond the limitations of the camera box placed within the scene, but I want to go even further than that and establish a limitation within the camera bounding box that not only limits the camera's movement but also prevents the player from moving on the Y-axis beyond the box's boundaries.

Pretty much every platformer from Super Mario to Sonic the Hedgehog to Castlevania, have such boundary limitations, usually at the very start of the level and also frequently at the end.  The limitation on the Y-axis boundary is also frequently used to lock the player into a particular area for forced enemy encounters, mini-boss fights as well as proper boss battles, a limitation that lasts until the player has vanquished the threat.

I wish to implement similar boundaries on the camera bounding boxes within my project to restrict where the player can go without having to place walls everywhere to keep the player from wandering beyond the level's limits.  Using walls to restrict the player's movement is fine for indoor areas, but it ends up looking distractedly out of place in outdoor areas if used in excess.

I've included screenshots below of the Construction Script & Event Graph from the SideScrollerCamera Blueprint I'm using. I would also include the Viewport and the Level Blueprint as well, except that the time being, I am unable post more than two links.

Construction Script:

Event Script:

Any help with this matter would be greatly appreciated.

sentences:
Rendering a scene or prefab in a gallery style view in Unity3D? I'm working on a project that is a bit like YouTube where someone browses some content, clicks on one and sees it in the youtube player while still seeing the rest of the content.

In my case the content is a Unity prefab that runs with interactions and gameplay, a bit like an interactive YouTube.

Is there a way to load these prefabs in a scene or something and have them displayed in a view port of some sort which substitutes the position of the player?

sentences:
What is a good way to determine if a vector is between two other vectors in 2D? I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, though.

This is a routine that is run on every vertex of every convex polygon within the convex decomposition of every physically simulated object, so it should be as fast as possible.

I've got a corner of a convex polygon, so I have a vector from vertex to vertex-1 and another vector from vertex to vertex+1. It is easy to see that for a convex polygon, the interior of the polygon lies in the direction of the average of these two vectors.

I want to determine given any vector whether it points into that region or outside of it. Can I accomplish this using only cross products and dot products and similar fast operations? I am thinking about eventually offloading these calculations to a vertex shader, but as it changes the number of vertices required depending on an object's velocity, I imagine the logic could get dicey. Either way, before I attempt a vertex or geometry shader implementation I had better get a CPU solution working correctly first.

Here's an example: I want to find if N is between A and B. A points right at -10 (=350) degrees, B is at 15 degrees. So it looks somewhat like the < symbol. Function should return true only if N is between -10 and 15, between 350 and 375, etc. This was just to paint a mental picture, the input to the function are vectors: I want to avoid operating on angles because I do not want to call atan2.

It may help if it is known that A cross B is always positive. This is the case because my polygon is CCW winded and convex.

sentences:
Button not clickable if it's under a Content Size Fitter + Horizontal Layout Group in Unity? I'd like to make a Tooltip System/Tutorial System.
I'm using the Content Size Fitter and Horizontal Layout Group components to have a dynamic text bubble..
Also I'd like to attach a button to it,

so when the tooltip appears, the game pauses,

and then when the player clicks the button, it closes the tutorial text, resuming the flow of the game.

But for some reason the click doesn't reach the component. Not even the animation happen, like something is blocking my button from being clicked.
Hierarchy:

uiTutorialText

Has a CanvasGroup to fade the whole structure.

Interactable = true, BlocksRaycast = false

TutorialText

Has an Image (background)

RaycastTarget = false

Has a Content Size Fitter and a Horizontal Layout Group

And Text and Button are just simple plain Text and Button objects, and the Button's Interactable is true.
I also tried making the Button a child of Text, and then translating it sideways, so the button doesn't share screen space with the tooltip. But it's not clickable this way as well.
As soon as I move the Button out of the hierarchy, like directly under the canvas, it works.

sentences:
In Pygame, I can only display text once I stop updating and drawing, why? At this moment, I can only display text once I stop updating and drawing sprites. In the code below (which is actually the game loop), you can see how if GAMEOVER == True (gameloop stops drawing), the text "Game Over!" is displayed. But if I try to display any text while drawing and updating, it doesn't appears until I stop drawing the sprites. In fact, the frist block to display text ("My Game!") isn't shown, as I said, until the gameloop stops drawing. I need to display some info like, name of char, instructions, etc while the game is running, so, how can I render text in every loops and frames?

The game loop:

while True:

    myfont = pygame.font.SysFont("monospace", 30)
    label = myfont.render("My Game!", 1, (255, 255, 0))
    SCREEN.blit(label, (500, 400))

    if PLAYER.healthBase <= 0:
        GAMEOVER = True #True para que se acabe la partida

    if not GAMEOVER:
        charsGroup.update(time_passed)
        npcsGroup.update(time_passed)
        mapTilesGroup.draw(SCREEN)
        charsGroup.draw(SCREEN)
        npcsGroup.draw(SCREEN)
        drawBullets()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    time_passed = freq.tick(0) /1000.

    if GAMEOVER:
        myfont = pygame.font.SysFont("monospace", 30)
        label = myfont.render("GAME OVER!", 1, (255, 255, 0))
        SCREEN.blit(label, (400, 300))

    pygame.display.flip()

sentences:
3D Model Loading in DirectX 11 At the moment I am trying to implement fbx model loading in my DirectX 11 code. This is old code I had create for use with DirectX 9 and I'm simply trying to bring it back up to date.

Since I first create the code, the SDK version I used was 2012.2, not autodesk have released 2014.1. With that, I have managed to update all of my code bar one issue; my sdk seems to be missing all of the .lib and .dll files I need.

In my old code I needed add the following dependency:

  fbxsdk-2012.2-mdd.lib

I thought it would be a case of changing it to:

  fbxsdk-2014.1-mdd.lib

But this doesn't work. I've spent all weekend trying to find a solution to this, but can't. Does anyone know what I need to do in order to genereate these dll and .lib files?

I've downloaded all of the different SDK options from autodesk, I've searched for the 2012.2 version of the SDK, but got nothing. Failing that; can anyone recommend a good library. or way to implement 3D model loading into my project?

I've tried looking at AssImp but found it a nuisance to work with. So I would like to avoid if possible.

sentences:
Configuring Implicit Multi-GPU Rendering Driver Settings Programmatically What is available to game developers to take advantage of implicit multi-GPU rendering technologies as of 2016? For this question I will only be asking about Nvidia's SLI and AMD's Crossfire technologies as they apply to rendering in OpenGL and Direct3D, specifically non-ancient versions of these APIs like OpenGL core 3.3+ and Direct3D 10.0+.

What tools do developers have access to, to programmatically detect and alter the state of implicit multi-GPU rendering for their game?

A key component of this question is what is openly available to independent developers, SLI and Crossfire aren't problems to AAA developers who get GameReady drivers tweaked to enhance the performance of their game and have SLI profiles included within the driver. What is available for smaller developers to take advantage of multiple GPUs?

At the very least, is there anything that developers can do to reduce the negative effects that these technologies can cause? Is there a way to avoid a FPS drop or artifacts that come with SLI/Crossfire bugs, can a developer programmatically disable SLI or Crossfire?

With all of this, how is the cross-platform support? Is there a solution for these issues that will work across Windows, Linux, and OSX? Will it work with OpenGL and Direct3D? Can it run out of the box or packaged with your game?

sentences:
How can I avoid "Moonwalking" Let me explain my question:

I have a sprite sheet with the different frames of the animations. Each animation has 8 frames.

Based on the player's input, I modify the character's coordinates, thus I also modify where the given frame of the animation should be rendered. Based on if the character is running or walking, I either speed up the animation or slow it down (since while running he should take 3 steps per second, and 2 steps per second when walking, so I play 12 frames per second when he's running, and 8 when he's walking).

However in the case of the walk cycle, I also get an unwanted side effect: the character "moonwalks". This means that while the X and Y coordinates are changing, thus the character is moving forward, his current sprite does not change at that instance. This gives the impression that the character is sliding or skating on his feet.

I'm trying to create something similar to Prince of Persia or Flashback. As I see they don't have this problem in their animation, and I wonder how could I eliminate it in mine.

I can not simply just speed up my walk cycle animation, since a fast walking looks weird. Maybe I should have more frames in my animation? Is there a simpler way of doing it? When I search for sprite sheet animation algorithm I find so little.

Update: I have added an image to demonstrate the issue. As you can see, the character does this weird sliding.

sentences:
How to detect collision of a wall with grid movement? I have this little game, where my player is moving around a simple level, using a grid based movement script (See code below). My problem is that I have tried to implement a 2D raycast, which has to detect if the next 'tile' is a movable tile (not a wall). However all the examples I have found on the internet hasn't been something I could make work. So please help me with how I can detect if the player is allowed to move, before he moves.

I am using Unity 5.

using System.Collections;
using UnityEngine;

public class GridMove : MonoBehaviour {
    public float moveSpeed = 2f;

    private float gridSize = 1f;
    private enum Orientation {
        Horizontal,
        Vertical
    };
    private Orientation gridOrientation = Orientation.Vertical;
    private bool allowDiagonals = false;
    private bool correctDiagonalSpeed = true;
    private Vector2 input;
    private bool isMoving = false;
    private Vector3 startPosition;
    private Vector3 endPosition;
    private float t;
    private float factor;
    private Animator animator;

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

    public void Update() {
        if (!isMoving) {
            input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
            if (!allowDiagonals) {
                if (Mathf.Abs(input.x) > Mathf.Abs(input.y)) {
                    input.y = 0;
                } else {
                    input.x = 0;
                }
            }

            if (input != Vector2.zero) {
                StartCoroutine(Move(transform));
                animator.SetBool("isWalking", true);
            }
            else {
                animator.SetBool("isWalking", false);
            }
        }
    }

    public IEnumerator Move(Transform transform) {
        isMoving = true;
        startPosition = transform.position;
        t = 0;

        animator.SetFloat("x", input.x);
        animator.SetFloat("y", input.y);

        if(gridOrientation == Orientation.Horizontal) {
            endPosition = new Vector3(startPosition.x + System.Math.Sign(input.x) * gridSize,
                                      startPosition.y, startPosition.z + System.Math.Sign(input.y) * gridSize);
        } else {
            endPosition = new Vector3(startPosition.x + System.Math.Sign(input.x) * gridSize,
                                      startPosition.y + System.Math.Sign(input.y) * gridSize, startPosition.z);
        }

        if(allowDiagonals && correctDiagonalSpeed && input.x != 0 && input.y != 0) {
            factor = 0.7071f;
        } else {
            factor = 1f;
        }

        while (t < 1f) {
            t += Time.deltaTime * (moveSpeed/gridSize) * factor;
            transform.position = Vector3.Lerp(startPosition, endPosition, t);
            yield return null;
        }

        isMoving = false;
        yield return 0;
    }
}

sentences:
Texturing issues in cry engine sdk Sup?

I've been working on a new environment scene inside 3ds max. It looks something like this -

When I used the cry engine exporter to export my assets onto my level, I've been getting very weird shadow/texture problems. Do any of you know why that's happening? I'm pretty new to all of this, especially cry engine. Here's a screenshot of the same environment inside of cry engine sdk. If you look to the left of the environment, you can see how I'm getting weird results. The area I'm having issues with is highlighted with a faint blue line.

sentences:
Joystick example problem for android 2D I've searched all over the web for an answer to this, and there are simular topics but nothing works for me, and I have no Idea why. I just want to move my sprite using a joystick, since I'm useless at math when it comes to angles etc I used an example, Ill post the code here:

    public float initx = 50; //og 425;
public float inity = 300; //og 267;
public Point _touchingPoint = new Point(50, 300);  //og(425, 267);
public Point _pointerPosition = new Point(100, 170);
private Boolean _dragging = false;
private MotionEvent lastEvent;

    @Override
public boolean onTouchEvent(MotionEvent event) {

    if (event == null && lastEvent == null) {
        return _dragging;
    } else if (event == null && lastEvent != null) {
        event = lastEvent;
    } else {
        lastEvent = event;
    }
    // drag drop
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        _dragging = true;

    } else if (event.getAction() == MotionEvent.ACTION_UP) {
        _dragging = false;
    }

    if (_dragging) {
        // get the pos
        _touchingPoint.x = (int) event.getX();
        _touchingPoint.y = (int) event.getY();

        // bound to a box
        if (_touchingPoint.x < 25) {
            _touchingPoint.x = 25; //og 400
        }
        if (_touchingPoint.x > 75) {
            _touchingPoint.x = 75; //og 450
        }
        if (_touchingPoint.y < 275) {
            _touchingPoint.y = 275; //og 240
        }
        if (_touchingPoint.y > 325) {
            _touchingPoint.y = 325; //og 290
        }

        // get the angle
        double angle = Math.atan2(_touchingPoint.y - inity,
                _touchingPoint.x - initx) / (Math.PI / 180);

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

        // stop the sprite from goin thru
        if (_pointerPosition.x + happy.getWidth() >= getWidth()) {
            _pointerPosition.x = getWidth() - happy.getWidth();
        }

        if (_pointerPosition.x < 0) {
            _pointerPosition.x = 0;
        }

        if (_pointerPosition.y + happy.getHeight() >= getHeight()) {
            _pointerPosition.y = getHeight() - happy.getHeight();
        }

        if (_pointerPosition.y < 0) {
            _pointerPosition.y = 0;
        }
    }
    public void render(Canvas canvas) {
    canvas.drawColor(Color.BLUE);
    canvas.drawBitmap(joystick.get_joystickBg(), initx-45, inity-45, null);
    canvas.drawBitmap(happy, _pointerPosition.x, _pointerPosition.y, null);
    canvas.drawBitmap(joystick.get_joystick(), _touchingPoint.x - 26,
            _touchingPoint.y - 26, null);
}

    public void update() {
    this.onTouchEvent(null);
}

og= original position.
as you can see Im trying to move the joystick, but when I do it stops working correctly, I mean it still works like a joystick but the sprite dosnt move accordingly, if I for example push the joystick down, the sprite moves up, and if I push it up it moves left.

can anyone PLEASE help me, I've been stuck here for sooo long and its really frustrating.

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:
Why do computer games differ so much in size? There are alot of PC games out there that have (seemingly) roughly the same graphics (with bump-maps, shaders, etc), sound complexity and play-through time yet one of them needs 4GB space while the other 13GB.

Why is that? Why to they differ so much in size?

sentences:
Letting the player create a combination of any 4 items that the game will then give the player on a set timer Okay, so I've researched scriptable objects and I've realized that it's something that might be very useful for the kind of game I'm making. I've managed to create my own scriptable object for weapons that is able to hold weapon upgrades, range, damage, and other special stuff. I was told scriptable objects are much better for larger scales than enums so that I can hold data for each weapon. I do know how to implement them into
 [CreateAssetMenu(fileName = "New Weapon", menuName = "Weapon")]
 public class Weapon : ScriptableObject
 {
     public new string name;
     public string _discription;

     public Sprite _artwork;

     public int _range;
     public int _damage;
     public int _upgrades;
     public int _element;

     public void Print()
     {
         Debug.Log(name + ": " + _discription + " The weapon does:  " + _damage + "damage.");
     }
 }

I've researched how to show these on the UI, but is there any hint you could give me on getting scriptable objects working with an inventory system, and point me in a direction on how I can give the player control of the order of weapon in the inventory that the game will use to give said weapons in the same order the player set for themselves.
For Example, I want the player to be able to take any of the four weapons: Katana, Spear, Axe, Chakram, and be able to set them in any order. Even using multiple of itself. Eg. (Chakram, Spear, Spear, Axe) and then the game will then give the player the items list they created on a set timer. (Weapons are one-time use, and the player can only hold one weapon at a time, and the timer won't start until the player has used up their current weapon)
 public class Weapon
 {
     public WeaponType type { get; set; }
 }

 public enum WeaponType
 {
     Katana,
     Axe,
     Spear,
     Chakram
 }
 public class WeaponCycle: MonoBehaviour
 {
     [SerializeField] private Weapon[] _weapon;

     public Weapon[] weapons = new Weapon[4];

     List<Weapon> InventoryWeapons = new List<Weapon>();

     // Start is called before the first frame update
     void Start()
     {
         for (int i = 0; i < weapons.Length; i++)
         {
             weapons[i].type = (WeaponType)Random.Range(0, 3);
         }

         StartCoroutine(GiveWeapons(1));
     }

     IEnumerator GiveWeapons(float delay)
     {
         for (int i = 0; i < weapons.Length; i++)
         {
             yield return new WaitForSeconds(delay);
             InventoryWeapons.Add(weapons[i]);
         }
     }
 }

Sorry if it feels like I'm asking for too much, but I'm a beginner when it comes to C# and I'm trying to learn as efficiently as I can.

sentences:
How to implement the server-side game loop? The server needs to handle the physics, because all the movement will be handled by it. So for that I need a game loop. The thing  is that the server doesn't have the render part, it's just a console.

All the posts I found on the internet were involving the render part. I'm not stupid, I know I should not take in consideration that part but then which type of loop should I use? (fixedtimestep, semi-fixed). My game functionality would resemble League Of Legends or Dota 2 functionality.

Actual questions:

1.What is the server functionality for this type of game?

2.What does the game loop look like?

Additional info: I use libGDX for the client part, and JBox2D on the server part, KryoNet for Networking and thinking of using lwjgl (only the System class) for Native timers.

sentences: How do you do very simple texturing in OpenGL 3+? I managed to create a sphere (calculating all the vertices etc etc). Now I want to apply a texture on it. I have no idea how. I googled some "OpenGL 3 texture tutorials" but I can't seem to find anything simple. I am using shaders btw. Is there anywhere a very basic step by step tutorial on how to implement a texture? A texture is just an image that wraps around a shape right? Sounds simple, but from what I have seen on the web it's kinda complicated.

sentences:
LibGDX keep camera within bounds of TiledMap I have a simple TiledMap which I can render fine. I have a player hopping (with Box2D) around and my camera follows the player around:

cam.position.set(
    player.position().x * Game.PPM + Game.V_WIDTH / 4,
    player.position().y * Game.PPM,
    0
);
cam.update();

However, the camera will move "off" the TiledMap. How could I keep my camera on the TiledMap, so when I near the edges of my map, the camera stops scrolling and the player moves towards the edge of the camera?

sentences:
How do I calculate the x,y of the rectangle after rotating? I'm using SDL2. I want to draw a textured rectangle and I'd like it rotated so I'm using SDL_RenderCopyEx. However SDL2 doesn't give me the option of repeating texture so I need to manually do it myself. The problem is I have no idea how to do the math.
My texture us 20x20, so I make the rects 20x20, I chosen a fixed angle of 45, my rotation point is 10,5 which appears to make the left middle of the rect the point it rotates from. I can see the two rects aren't touching if the second rect is (firstX+15,firstY+15). However if I change one of them to 14 they touch and it looks solid
I don't understand how to find the numbers. I'm finding the angle but doing
double angle = atan2(mouseX - x, mouseY - y) * 180 / PI;

Making the second rect relative to the first by +15,+14 only works if it's a 45 deg angle but is complete wrong for other angles.
How do I figure out the x,y the subsequent rect based on the angle?

sentences:
How to use vertex and fragment shaders without using VBOs and VAOs? Recently, I am trying to make a 3D game in LWJGL 2, not LWJGL 3, just because I am more familiar with LWJGL 2. Since LWJGL decided to shut down their legacy wiki website, I've been researching alot lately on adding shaders. The thing is, most of these tutorials use VBOs and VAOs to render objects.
I am trying to use vertex and fragment shaders to edit the objects. Yes, I am using the depreciated methods glBegin(); and those rendering methods to draw shapes. I am not sure if this affects the use of shaders or not, so that is why I am asking this question.
If anyone wants to know, I am using the depreciated methods because I don't want to really use VAOs and VBOs, I know it reduces performance to use the depreciated methods, but I am fine with this for now.

sentences:
Aligning rotation from a imu9250 to a game object I am experimenting with interfacing unity with real world inputs, specifically I have an imu9250, connected to an arduino clone providing rotation inputs ( either quaternion or pitch/yaw/roll) to unity.   (I’m using the DMP functionality of the 9250 to calculate orientation).

The connectivity (over serial for now) works fine, rotating my sensor rotates my game object but I can’t work out how to align my input (programmatically) so that the rotation of the game object rotates in the same direction (in game space).

Any tips/pointers appreciated.

Additional information:

My understanding is that the DMP only uses the Gryo and Accelerometer, not the magnetometer.

I can’t find any other references to the coordinate system used outside of the images above. Not mentions in the data sheet as far as I could see
http://www.invensense.com/wp-content/uploads/2015/02/PS-MPU-9250A-01-v1.1.pdf

sentences:
Insert 3d text to the front face of a cube GameObject I want to add a text to a cube in Unity.

I have a cube which has a 3d text as a child.

I am using the below UnityScript to write on the 3d text:

var countdown : int = 200;

function Update()
{
    GetComponent(TextMesh).text = countdown.ToString();
}

I am trying to write/show the text to the front face(or very close) of the cube but I am failing.

EDIT: My difficulty is to make the text appear in the front side/face of the cube, like it is written on it. Attaching the text or the script to any object is not an issue

My last failed try was to use the below lines:

var tm = gameObject.AddComponent(TextMesh);
tm.text = countdown.ToString();

Any ideas?

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:
Height and width of a Farseer body? I have a body named PersonA. If PersonA collides with another body, the width and height of that body should be saved. I tried it like this but I always get error messages that "Width" and "Height" don't exist.

bool PersonA_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
{
//How tall and broad is the body that collided with PersonA
float Width = fixtureB.Body.Width;
float Height = fixtureB.Body.Height;

return true;
}

How can I get the width and height of another body? What should I change?

sentences: Can someone explain radiosity lighting to me? I already have the basics of ambient occlusion down.  I have a raycaster and am capable of shooting rays about a hemisphere uniformly.  It seems like those are the basics of what are needed for radiosity but I don't know where to go from there.  Do I find how much light comes from each face?  (I'm making my game out of cubes like minecraft)  After that what do I do?

sentences:
Is it okay to release a playable, but not graphical, game to the Android Marketplace? I'm working on my first simple game for release. I'm going to have it to a point of being playable, interface complete, but very few if any graphics, and no overall style aside from the basic Android white text on black. Should I go ahead and release this game, with a graphics upgrade to come in the next week or two, or should I just wait until I have the better graphics?

The name doesn't require any graphics to play, it's a simple causal type. The graphics won't matter really for play, but will include things like a logo, screen when you die, enhanced opening screen, etc.

sentences:
How do I get the object color? I want to get the object color, when I start the game. How do I do this?

public Renderer cube;
public float r,b,g,a;

void Start() {
            r = cube.GetComponent<Renderer>().material.color =
            b = cube.GetComponent<Renderer>().material.color =
            g = cube.GetComponent<Renderer>().material.color =
            a = cube.GetComponent<Renderer>().material.color =

}

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:
Good way to establish an inventory system? Fairly new to Unity as a whole, and while making a prototype game I came across the issue of setting up an inventory system. So far, I've been stuck on what sort of structure it should have, given:

Each "Mob" (player, enemy, NPC, etc.) has its own inventory
Objects can have children attached, which should be saved (e.g. Gun -> Attachment Manager -> Magazine/Rail/etc.)
Simpler items (ammunition, etc.) are stackable
An inventory has "pouches" which are available only for certain objects (magazines, health items, etc.) and have a certain volume

At first, I simply made a Mob -> Inventory Manager -> Pouch -> Item system where everything was a child of its respective parent, but obviously even with colliders/sprites disabled that's possibly hundreds of transforms per mob being shifted around each update. Right now, I'm just parenting each mob's inventory system to a static "Inventories" object to get past the issue of that many transforms, but is there a better long term solution that takes into account saving/loading and scene transitions?
Right now, I'm considering:

Turning each item with children (guns with attachments) into a prefab and saving it (not ideal)
Using an ID system to instantiate objects on load by loading the root object (gun), then the children (attachments) given certain parameters (but the variables, like the rounds loaded into a magazine, would be tricky to load)
Having different prefabs for items depending on whether or not they're equipped, on the ground, or in an inventory, and switching between them as needed

sentences:
Collectible card game, cards and effects Based on Design of a turn-based game where actions have side-effects

I am building a card-game where cards can have side-effects be triggered under different circumstances.

I was given a good idea on how to handle different phases by having hooks (events) that different cards can be triggered to do something, like when a card is played, draw an additional card, etc.

I am not sure how I should compose all these things to work together, I have a GameState object which handles the state of the game (who's turn, player objects, timers) checking if a move is legal etc.

I am having a Card class that currently just has a type and a name getter/setters and properties. I believe the best way to store cards would be to use .JSON files, because that would let you simply write a new card.

To achieve side-effects I am thinking of having "components" that is configured through a cards JSON-file.

{
    "name": "Ocean Humans",
    "type": "Creature",
    "components": {
    }
}

However, I am not sure how I should compose these JSON-files to some actually working object. How do I call these components when I invoke a hook_event (draw a card, phase begin). And make sure right components are run?

sentences:
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: How do I get Apple to pull an App that violates a copyright? A friend of mine has had his Flash game stolen and published on the iPhone app store without his consent.  What is the best way to get Apple's attention about this?

sentences:
If I want to become a professional game developer, is learning Win32 API a must? If I want to become a game developer, is learning Win32 API a must?

Does X-BOX or PS based game developers need to know Win32 API?

Is it possible for a professional game developer to develop games by only scripting game engines and not using Win32 API?

sentences:
How to get neigbor pixel coordinates in Unity HLSL shader I am writing Mandelbrot set shader for Unity.
I wrote an Image Effect shader and it works.
Unfortunately, each point "shimmers" on translate scale. This is because, for each shader call I compute value for only one mathematical point, which is infinitesimal. On even small translation, the value can change drastically.
So, I would like to compute math value not for one point, but for several. But for this I need to know, which aother points belong to my pixel, and for this I need to know the distance to neighbor pixel. Unfortunately, my incoming values are float and I don't know, how to step to next pixel.
How to accomplish?

sentences: Why do games run so much better in Windows than in OSX? For example, on my Mac Mini with Bootcamp, Team Fortress 2 runs at about 20fps in OSX and 80fps in Windows. This seems to be a common case. Why is this?

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:
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:
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:
Correct way to handle path-finding collision matrix Here is an example of me utilizing path finding.  The red grid represents the grid utilized by my A* library to locate a distance.  This picture is only an example, currently it is all calculated on the 1x1 pixel level (pretty darn laggy).

I want to make it so that the farther I click, the less accurate it will be (split the map into larger grid pieces).  Edit:  as mentioned by Eric, this is not a required game mechanic.  I am perfectly fine with any method that allows me to make this accurate while still fast.  This isn't the really the topic of this question though.   The problem I have is, my current library uses a two dimensional grid of integers.  The higher the number in a cell, the more resistance for that grid tile.  Currently I'm setting all unwalkable spots to Integer Max.

Here is an example of what I want:

I'm just not sure how I should set up the arrays of integers of the grid.  Every time an element is added/removed to/from the game, it's collision details are updated in the table.

Here is a picture of what the map looks like on my collision layer:

I probably shouldn't be creating new arrays every time I have to do a path find because my game needs to support tons of PF at the same time.

Should I have multiple arrays that are all updated when the dynamic elements are updated (a building is built/a building is destroyed).

The problem I see with this is that it will probably make the creation and destruction of buildings a little more laggy than I would want because it would be setting the collision grid for each built in accuracy level.  I would also have to add more/remove some arrays if I ever in the future changed the map size.

Should I generate the new array based on an accuracy value every time I need to PF?

The problem I see with this is that it will probably make any form of PF just as laggy because it will have to search through a MapWidth x MapHeight number of cells to shrink it all down.

Or is there a better way?  I'm certainly not the best at optimizing really anything.  I've just started dealing with XNA so I'm not used to having optimization code really doing much of an affect until now... :(

If you need code examples, please ask.  I'll add it as an edit.

EDIT:

While this doesn't directly relate to the question, I figure the more information I provide, the better.  To keep your units from moving as accurately to the players desired position, I've decided that once the unit PFs over to the less accurate grid piece, it will then PF on a more accurate level to the exact position requested.

sentences:
In Game Maker, how do I make invisible platforms the player can walk on, and reveal with an item? I'm using Game Maker and looking for help with these:

I'd like to have invisible platforms and walkways for the player to move on. I want the platform to be slightly visible in this option so the player can find them but still be invisible while being fair to the player.
Platforms are invisible, but a special item (like the Lens of Truth in Legend of Zelda: Ocarina of Time turns the invisible things visible within a given area for the time the player is using the item.

sentences:
Normalize a rotation around the Z-axis (issue with GLM) I'm trying to undo some transformations coming from an external tool*. I'm getting different results depending on subtle differences in the input and wondering how to convert to a rotation about the Z-axis only.
The transformations are expressed as a matrix = translation * rotation * -translation.  I want to decompose the resulting matrix into a single translation and rotation around Z -- I know this is possible given the source material (2D plane).
My problem is coming from GLM decompose.  Given a matrix that looks like this:
[         -0.5 |     0.866025 |            0 |            0 ]
[    -0.866025 |         -0.5 |            0 |            0 ]
[            0 |            0 |            1 |            0 ]
[            0 |            0 |            0 |            1 ]

If I call decompose, then take the eulerAngles of the Rotation I end up with either:

(            0,           -0,      2.09439 ) from quat(          0.5,            0,     0.866025,            0 )
(      3.14159,       1.0472,      3.14159 ) from quat(          0.5,            0,            0,     0.866025 )

The difference depends on how the matrix was generated, whether the rotation was 120degrees or -240degrees. The display must be clipping the floating point, introducing a subtle change.
I'm assuming both these rotations are actually the same.
How do I force/convert the result to be a rotation about the Z axis only.

*The external tool is Inkscape which uses the CSS/SVG function rotate(r, cx, cy) instead of a rotation and transform.  That function results in the matrix: translate(cx,cy,0) * rotate(r, (0,0,1)) * translate(-cx,cy,0)

sentences:
Unity2017 WWW Requests fail My WWW requests are returning an error that is empty since I switched my project to 2017. Anyone experiencing the same or have a solution?

void Start()
  {
    StartCoroutine(RetrieveQuests());
  }

IEnumerator RetrieveQuests() {
  WWW www;
  www = new WWW("URL that I dont want to share here.");
  yield return www;
  if (www.error != null) {
    Debug.Log("There was an error sending request: " + www.error);
  } else {
    Debug.Log(www.text);
  }
}

I get the following log when I run it: "There was an error sending request: ", which means www.error is empty but there is an error.

NOTE: This does work on earlier versions of Unity.

sentences:
How do I render a 2D sprite in 3D space? I am currently working on a game in XNA 4.0, where I want to implement 2.5D, like in "Paper Mario". I feel like it has something to do with z-buffering a Texture2D, and drawing that, but I really have no idea where to start.

How do I render a 2D sprite in 3D space?

sentences:
Libgdx - Screen tearing (or artifacts) while in fullscreen I have a problem with libgdx, fullscreen and what I believe is screen tearing or any other sort of artifact.

In windowed mode, everything works fine, but when i switch to fullscreen, moving sprites create some sort of screen tearing effect:

Had to take a photo with my phone, because using the print button does not work in fullscreen, and I could not capture the screen tearing effect using a libgdx "TakeScreenshot" Function.

I am using a TexturePacker and I tried changing the Filtering (Nearest, Linear) as well as edgePadding and duplicatePadding with no positive result.

I enabled vSync which also did not fix the problem.

Maybe anyone has encountered such a problem and can lend a helping hand.

Thanks in advance.

Edit:

This is how i enabled vSync:

LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.vSyncEnabled = true;
//some other config stuff
new LwjglApplication(new MyGame(), config);

sentences:
LibGDX Box2D, how to play an animation once, then set the state back So, I've got some animations in LibGDX that I want to get running. Currently, the walking animations work perfectly, but attacking doesn't. I want the attack animation to play once, then set the State back to WALKING.

I've been experimenting with attacking upward (that's why the code's different), and all it does is flash and go back to walking. The other three directions show only the last frame of the animations, and holds it there. Does anyone know how to get this to work? I've looked at the similar questions, but none of them are helping.

There's a lot of code in this method, so I apologize in advance:

private TextureRegion getFrame(float dt) {
        TextureRegion region = null;
        if (currentState == State.WALKING) {
            switch (currentDir) {
                case UP:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkUp.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkUp.getKeyFrame(stateTimer, true);
                    }
                    break;
                case RIGHT:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkRight.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkRight.getKeyFrame(stateTimer, true);
                    }
                    break;
                case LEFT:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkLeft.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkLeft.getKeyFrame(stateTimer, true);
                    }
                    break;
                case DOWN:
                default:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkDown.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkDown.getKeyFrame(stateTimer, true);
                    }
                    break;
            }
        } else if (currentState == State.ATTACKING) {
            switch (currentDir) {
                case UP:
                    region = heroAtkUp.getKeyFrame(stateTimer, true);
                    if (heroAtkUp.isAnimationFinished(stateTimer)) {
                        currentState = State.WALKING;
                    }
                    break;
                case LEFT:
                    region = heroAtkLeft.getKeyFrame(stateTimer);
                    break;
                case RIGHT:
                    region = heroAtkRight.getKeyFrame(stateTimer);
                    break;
                case DOWN:
                    region = heroAtkDown.getKeyFrame(stateTimer);
                    break;
                default:
                    region = heroWalkDown.getKeyFrame(stateTimer); //should never happen
                    break;
            }
        }

        stateTimer = currentDir == previousDir ? stateTimer + dt : 0;
        previousState = currentState;
        previousDir = currentDir;
        return region;
    }

sentences:
How can I clip my sprite as it passes through a portal in a 2D scenario, using OpenGL? This is a very simple question, but after a brief search and reading through the "similar questions" I could not yet find an answer.

I'm creating a 2D game using OpenGL and came across a problem: Let's say I wanted to create portals. An Entity can move into a portal A and come out of the corresponding portal B. Transforming the coordinates and velocity of the entity is easy, but this would create "hard" texture-teleportation.
Which means: while half of the entity is in the A-portal, it won't be rendered on the corresponding B side.
How would I create a smooth transition?

My first Idea was: I define "exit"- and "entry"-zones containing the transformation function (Matrix). Now when an Entity enteres the exit-zone the entity is also drawn at the entry zone using the transformation-matrix relative the the entry/exit-zones. But drawing it twice would still give me the difficulty, that I need to clip the entity on the portals "backside". (The entity shall vanish behind portal A when entering).

So my second thought was, that there should be a solution using (vertex?) shader? But how would such a shader look like? (Example code would be nice, but not neccessary. I'd rather want to have a "what the shader would do" answer). Would I define Uniforms (exit- and entry zones) which the shader would clip/transform ("move") the vertexes from?

How does a typical solution for this clipping look like? Or where could I read some information about these kind of problems? I only found some to 3D versions, where the view of portal B should be rendered in portal A. But this does not solve the object-moving-through-it problem...I think
In my opinion changing the draw-order, or rendering something above the backside of the portals is not the right way to go, since this could create strange behavior in certain situations. (Portal B is just behind portal A for example. One of both would be overdrawn I think.)

sentences:
How to stop objects pushing each other away on collision? I'm creating something along the lines of Super Smash Brothers. There's a problem with the collision between the two players and projectiles.

We have rigid body on the characters and projectiles and every time they collide they push one another back, I know that is how it operates but is there a way to stop that from happening?

sentences: VR Camera and Hands height Using the Oculus Rift S, I just added OVRCameraRig and LocalAvatar or OVRPlayerController and when I press play I feel like I'm not as high as I want in my vision and hands, I change the position of Y of objets to make it more higher, but it affects to everything, my guardian setup floor goes more high too and it does not match with my floor. What can I do to solve this? What should I change or modify?

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:
Unity C# 2D Platformer Main Camera should stop on sides of level I've been working on a 2D Platformer and i succeeded in setting up a script for my Main Camera to follow my Player gameobject using transform positions.

Now when my character is near the sides (or ends) of my level, it's showing dead space, blue space if you will. I want my camera to stop when it reaches the edges of my background sprite(end of level).

Here's my script that is attached to the Main Camera so far:

using UnityEngine;
using System.Collections;

public class CameraSmoothFollow : MonoBehaviour
{

public GameObject cameraTarget; // object to look at or follow
public GameObject player; // player object for moving

public float smoothTime = 0.1f;    // time for dampen
public bool cameraFollowX = true; // camera follows on horizontal
public bool cameraFollowY = true; // camera follows on vertical
public bool cameraFollowHeight = true; // camera follow CameraTarget object height
public float cameraHeight = 2.5f; // height of camera adjustable
public Vector2 velocity; // speed of camera movement

private Transform thisTransform; // camera Transform

// Use this for initialization
void Start()
{
    thisTransform = transform;

}

// Update is called once per frame
void Update()
{
    if (cameraFollowX)
    {
        thisTransform.position = new Vector3(Mathf.SmoothDamp(thisTransform.position.x, cameraTarget.transform.position.x, ref velocity.x, smoothTime), thisTransform.position.y, thisTransform.position.z);
    }
    if (cameraFollowY)
    {
        // to do
    }
    if (!cameraFollowX & cameraFollowHeight)
    {
        // to do
    }

}

}

sentences:
In general how often and when should I optimize my code? In 'normal' business programming optimization step is often left until really needed.  Meaning you should not optmize until it is really needed.

Remember what Donald Knuth said "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil"

When is the time to optimize to make sure I am not wasting effort.  Should I do it a method level?  Class level?  Module level?

Also what should my measurement of optimization?  Ticks?  Frame Rate?  Total Time?

sentences:
What makes it hard to protect from hacks/bots in BF3 and Quake Live? After playing these games, asking other players/admins, and reading online I am led to believe that Quake Live and Battlefield 3 are frequented by bots and there are plenty of hacks of various kinds. I'm confused how this is possible, or even easy seeing how many players have access to these kinds of "tools" (sic).

Isn't it possible for the game authors to digitally sign the game executables so that when they run, the server can ensure only the allowed client is sending commands, thus preventing any kind of abuse? I.e. every player command would be signed by a private key, or symmetrically encrypted (not sure which would make more sense).

I understand that players can look at the running executable's behavior (memory etc.), but if games are apparently so easy to hack, shouldn't most apps be hacked as well (e.g. Skype, all DRM running on Windows etc.)?

sentences:
XNA Texture2D Copy Error I have a static class that I use to build a 3d character and render the results to a RenderTarget2D which I then return.

I'd like to store the results for later use so I need to make a copy of the returned RenderTarget. To do this I`ve tried both a Quad VertexPrimitive Effect with a tiny copy PixelShaderFunction and a SpriteBatch.Draw.

I think that the Quad render is quicker but no matter how I fiddle, the Quad never seems to get it quite right.

For example, I do use SpriteBatch to pick up a 256*256 area of a large Texture2D backdrop and Draw that to a RenderTarget2D. But if I then send that directly to the Quad render and put that result back in the same place it almost - but VERY annoyingly not quite - fits back perfectly. Using another SpriteBatch.Draw does give a perfect result but I've convinced myself that it is slower.

So my questions are twofold.

1) Is the Quad UserIndexedPrimitive quicker than the SpriteBatch.Draw for multiple iterations?

and

2) Why can`t I get the Quad render to give me back the same image when setting it as the  Effect sampler via Effect.Parameter..SetValue(RenderTarget)?

As ever, Thanks :) Stoort.

Here is the problem in png form.

The left half is the RenderTarget2D before I use a short user Effect
that just does a straight copy using

    return tex2D(texture, coord);

as the only PixelShaderFunction instruction via a quad with

    graphicsDevice.DrawUserIndexedPrimitives<VertexPositionTexture>
                (PrimitiveType.TriangleList, verts, 0, 4, ib, 0, 2);

The source and destination width and height are identical as are all the
RenderTarget2D settings for both.

As you can see the output on the right is blurred and the top and right lines are wrapped from the opposite sides.

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:
Maya: after bake into control rig, IK will auto reset when I change another IK Arter setting one IK on my control rig, when I start to set the next IK, the previous one resets to its prior state.

Here's an example of my problem:

How can I keep the previous IK from resetting?

sentences:
How would a game-state snapshot system be implemented for networked real-time games? I want to create a simple client-server real-time multiplayer game as a project for my networking class.

I've read a lot about real-time multiplayer network models and I understand the relationships between the client and the server and lag-compensation techniques.

What I want to do is something similar to the Quake 3 network model: basically, the server stores a snapshot of the whole game state; upon receiving input from the clients, the server creates a new snapshot reflecting the changes. Then, it calculates the differences between the new snapshot and the last one and sends them to the clients, so that they can be in sync.

This approach seems really solid to me - if the client and server have a stable connection, only the minimal necessary amount of data will be sent to keep them in sync. If the client gets out of sync, a full snapshot can be requested as well.

I cannot, however, find a good way to implement the snapshot system. I find it really hard to move away from single-player programming architecture and think about how I could store the game state in such a way that:

All the data is separated from the logic
Differences can be calculated between snapshot of game states
Game entities can be still easily manipulated via code

How is a snapshot class implemented? How are the entities and their data stored? Does every client entity have an ID that matches an ID on the server?

How are snapshot differences calculated?

In general: how would a game-state snapshot system be implemented?

sentences:
When do I need to call `glUseProgram`? Looking at examples at http://learnopengl.com/#!Getting-started/Hello-Triangle and many different places, I've found that the draw sequence usually goes like this:

// setup VBO, VAO, load shaders

while (true) { // game loop
  glUseProgram(shader);
  glBindVertexArray(someVAO);
  drawStuff(...);

  // ...
}

Now my question is, is there any reason why I'd want to repeatedly do glUseProgram(...) on each frame, unless I'm using multiple shaders (such as OpenGL clearing currently used shader after rendering?)?

Also, if I am using multiple shaders, do I need to glUseProgram before switching to a different VAO? I'm unclear on whether the VAO just gets set as active, or if it actually modifies the state of a currently used shader. I've tried looking this up in the OpenGL spec, but couldn't quite find it.

edit: Yes I did mean glUseProgram, sorry.

sentences:
XNA makes the console flicker I create a Window XNA game project from the template in Visual studio 2015. Then I right click and set the property to console application because I think it is convinient to use Console.WriteLine() for debugging.

In the game constructor I add

graphics.PreferredBackBufferWidth = 1920;
graphics.PreferredBackBufferHeight = 1080;
graphics.IsFullScreen = true;

Now the console text flicker. I use Console.Clear() the first thing I do in Update(). When I run the game in a window then the console text do not flicker. I even add counter to not update the text every time Update() is called and the console text still flicker in full screen mode. The same problem is there when I start form Windows Powershell. (The exact same thing do not flicker with MonoGame though.)

sentences:
Start Menu Does not Work On starting the game, a basic startmenu should load. startScreenUI is the background image, and startUI is the buttons for "play" and "exit".

I set Time.timescale to zero in Awake() so that the time would initially be set to zero.

However, the game just plays behind the start screen as normal.

My PauseMenu scripts runs perfectly, pausing the game etc.

My MoveEnemy scripts controls the movement of a wall that moves back and forth between the scene. It moves fine, on pause it stops moving. I should add that the Wall is kinematic and used gravity.

I do not understand why the initial time.Timescale is not set to zero upon starting the game and the game runs normally behind the start screen.

My code for the StartMenu:

using UnityEngine;
using System.Collections;

public class StartMenu : MonoBehaviour
{

public GameObject startUI;
public GameObject startScreenUI;
public PauseMenu otherscript;

  private void Awake() {
    otherscript.enabled = false;
    startUI.SetActive(true);
    startScreenUI.SetActive(true);
    Time.timeScale = 0;
  }

  private void Start() {
    startUI.SetActive(true);
    startScreenUI.SetActive(true);
    Time.timeScale = 0;
  }

  public void Play() {
    startUI.SetActive(false);
    startScreenUI.SetActive(false);
    Time.timeScale = 1;
  }

  public void Quit() {
    Application.Quit();
  }
}

This is my code for the Moving of the Enemy Walls:

using UnityEngine;
using System.Collections;

public class MoveEnemy : MonoBehaviour {
  public Vector3 pos1 = new Vector3 (-7.6f, 1.1f, 7f);
  private Vector3 pos2 = new Vector3(7.6f, 1.1f, 7f);
  public float speed = 1.0f;

  // get StartMenu for bool of startUI

  public StartMenu otherScript;

  // get PlayerController for bool of "dead" to reset the static component manually
  // resets the position of the wall

  void Awake() {
    transform.position = pos1;
  }

  // moves object from pos1 to pos 2
  void Update () {
    transform.position = Vector3.Lerp(pos1, pos2, Mathf.PingPong(Time.time * speed, 1.0f));
  }
}

using the Awake() function was a troubleshooting attempt I heard worked to reset the position of the walls upon restart. But as my game does not restart properly, I do not know if this works fully yet.

and finally this is my code for the Pause Menu that actually works:

using UnityEngine;
using System.Collections;

public class PauseMenu : MonoBehaviour {

  public GameObject pauseUI;
  private bool paused = false;

  void Start() {
  }

  void Update() {
    if(Input.GetButtonDown("Pause")) {
      paused = !paused;
    }

    if(paused) {
      pauseUI.SetActive(true);
      Time.timeScale = 0;
    }

    if(!paused) {
      pauseUI.SetActive(false);
      Time.timeScale = 1;
    }
  }

  public void Resume() {
    paused = false;
  }

  public void Restart() {
  }

  public void MainMenu() {
    Application.LoadLevel(0);
  }

  public void Quit() {
    Application.Quit();
  }
}

Initially I wondered if the problem was associated with the PauseMenu's timescale function interfering with the timescale set on the startMenu, but on disabling the PauseUI completely the game still ran behind the start screen.

Can anyone think of a quick fix to this? I have been troubleshooting for a while and not really getting anywhere.

sentences:
Unity 5 Animator will not disable I am making a small FPS in unity 5. I made a cursor animation that I want to play only for a brief moment. I tried to do this using some code:

using System.Collections;

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

public class CrossAnimate : MonoBehaviour {

public GameObject UpCurs;
public GameObject DownCurs;
public GameObject LeftCurs;
public GameObject RightCurs;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButtonDown(0))
    {
        UpCurs.GetComponent<Animator>().enabled = true;
        DownCurs.GetComponent<Animator>().enabled = true;
        LeftCurs.GetComponent<Animator>().enabled = true;
        RightCurs.GetComponent<Animator>().enabled = true;
        WaitingAnim();
    }
}

IEnumerator WaitingAnim()
{
    yield return new WaitForSeconds(0.1f);

    UpCurs.GetComponent<Animator>().enabled = false;
    DownCurs.GetComponent<Animator>().enabled = false;
    LeftCurs.GetComponent<Animator>().enabled = false;
    RightCurs.GetComponent<Animator>().enabled = false;
}

}

All of the four animators on the four gameobjects (UpCurs, DownCurs, etc) are not enabled by default. When clicking the mousebutton they should be enabled so it plays the animation and then after a brief time, they should disable again. The problem is that they don't disable.

Any help would be appreciated!

sentences:
Directional shadow mapping view/projection matrices I've got shadow mapping with directional lights working, but I believe I am constructing the view/projection matrices wrong.

Here's how I build them:

Mat4 viewMatrix = LookAt(lighting.mCameraPosition + (directionalLight.mLightDirection * Z_FAR / 2.0f), -directionalLight.mLightDirection, Vec3(0.0f, 1.0f, 0.0f));
Mat4 lightVP = CreateOrthographicMatrix(-Z_FAR, Z_FAR, -Z_FAR, Z_FAR, Z_NEAR, Z_FAR) * viewMatrix;

The problem is the shadows become skewed and change depending on the camera position, which is bad. What is the proper way of doing this?

EDIT:

1) No, that is what I'm not sure about; currently as you said it is the camera position and thus the shadows moves around when I move the camera, which is bad - what should be the actual position, since directional lights have no position?

2) Also using Z_FAR DOES make it pixelated which is my second problem - but must not the boundaries be Z_FAR in all directions, otherwise objects in the view range may not cast shadows?

sentences:
Doing imagemagick like stuff in Unity (using a mask to edit a texture) There is this tutorial in imagemagick

http://www.imagemagick.org/Usage/masking/#masks

I was wondering if there was some way to mimic the behavior (like cutting the image up based on a black image mask that turns image parts transparent... )

and then trim that image in game...

trying to hack around with the webcam feature and reproduce some of the imagemagick opencv stuff in it in Unity but I am saddly unequipped with masks, shaders etc in unity skill/knowledge.  Not even sure where to start.

sentences: How to do game dev without downloading binaries? I am trying to start a student club for game development. My initial plan was to have students start by modifying an existing Open Source game, such as Sauerbraten, Tux Racer, or SuperTux. The students all have Windows computers, the problem is they're locked from installing any binaries such as these games, which would be needed to get started. So is there some option for creating a collaborative project that wouldn't require downloading of binaries to do?

sentences:
XNA Sprite mouse selection with layered/overlapping sprites If I use mouse coordinates to select a sprite does XNA provide a built in way to return the top-most sprite on the screen at a coordinate?

I am trying to highlight the selected sprite, but when iterating through my sprites at the specific mouse location there can be multiple sprites found.  The way my game works any one of the sprites found is valid to be on top.

sentences:
How do I create a horizon? I added a sky to my raytracer that gets sampled when a ray completely misses any object.

What I'm doing here is if a ray completely misses anything in the scene, it returns the Perlin noise function at (ray.direction.x, ray.direction.y, ray.direction.z) - in other words it "samples a sphere around the origin".

But it "looks wrong" (because the sky looks like it's facing you).

How can I improve the sky and make it look more like the earth's horizon?

Or is this more or less what it should look like, and I should simply add more geometry on the floor?

sentences:
How to scroll Select objects in the hierarchy tab? So I am creating breakable objects in unity and I have to select around 200 objects in the hierarchy tab so that I can apply some components to each the pieces. My problem is that once I select more than 100 objects in the hierarchy tab, it starts to bug out and it becomes incredible difficult to select objects. So I was wondering if there was a way to a scroll select or something like the box select like you can use on windows to easily select multiple items, or maybe some other way I didn't mention. It would really help me if someone could tell me a quick way to select multiple things in unity, in the hierarchy tab.

Thanks, Nova

sentences:
How to force a line break before the last word of a line reach the edge? I'm printing a sliding text by adding each letter after a short period of time. My problem is that when the text multilines, the last word of a line starts on the current line and jumps to the next when it grows too big to fit, making for an ugly effect.

So I guess I need to determine the word where the line would break and replace the previous space with line break to force the break before the word reach the edge. I'm failing to see how to do that. In addition, if there is any way to make the libgdx BitmapFont calculate that I would love to learn.

sentences:
How to return the scene view camera to the default view By the "scene view camera" I don't mean a GameObject with a Camera component, I mean the camera used to draw the Scene window in the Unity editor, controlled by this "Scene Gizmo" widget:

The default view shows an almost isometric perspective, where all three X Y Z axes are visible.
But when I clicked the green Y cone, my view changed to look straight down the Y axis, and I can't seem to return to the 3-axis view.
Clicking the other cones on this widget just switchest to look along the X or Z axis instead, and clicking the cube in the middle or the "Top" label just toggles between orthographic and perspective projection.
How can I get back to the default 3-axis view?

sentences:
Determining if removal of a voxel will break up a group I have the following situation: I have a 3d grid of voxels (on/off, the max size is probably 128x128x128). I know in advance that inside the grid, all the voxels that are turned on are interconnected, forming a single group.

Now I need to determine: when I remove a voxel (turn it off), will it break up the group?

My initial idea was to look at neighbors of the voxel that is removed and determine if they are still interconnected trough other voxels (see my other question: Algorithm to see if two voxels are interconnected). But there might be better/other ways to do this.

So what would be a good way to determine if removal of a voxel will break up the group it was part of?

sentences:
How to calculate a child UI image's anchoredPosition(?) based on screen position input? How to calculate a child UI image's anchoredPosition(?) based on screen position input?
I'm trying to have the child UI image (Spotlight) show up where the eyeball UI is, but it seems to always be offset. The eyeball correctly shows up based on the Screen Position.

It is perfect when the Canvas is at 1080x1920 (set to scale)
But when I try it using others screen resolutions such as 1125x2436, the issue above shows up.
None of these attempts work. The gif is based on the one not commented out here:
p=Input.mousePosition; // screenPosition

    public static void SetRTPos(Transform g,Vector2 p,Canvas c)
    {
        RectTransform rt = g.GetComponent<RectTransform>();
        rt.anchorMin = Vector2.zero;rt.anchorMax = Vector2.zero;
        rt.pivot = Vector2.zero;
        // rt.anchoredPosition = RectTransformUtility.PixelAdjustPoint(p,g.parent,c);
        //rt.anchoredPosition = new Vector2(p.x* (float)c.pixelRect.x, p.y*(float)c.pixelRect.y);//  c.scaleFactor;
        rt.anchoredPosition = new Vector2(p.x*1080f/Screen.width,p.y*1920f/Screen.height );
        //rt.localPosition = RectTransformUtility.ScreenPointToLocalPointInRectangle(rt.parent.GetComponent<RectTransform>(),p,Camera.main,out p2)
   }

The UI RectTransform for rt.parent:

The UI RectTransform for g (not the x,y,z are updated at runtime):

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

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

Thanks,
Cameron

sentences:
C++, OpenGL: Building a polyhedron via geometry shader I'm stuck with geometry shaders in OpenGL - c++ programming. I want to create simple cube by repeating 6 times drawing one rotated wall. Here is my vertex shader (everyting has #version 330 core in preamble):

uniform mat4 MVP;
uniform mat4 ROT;
layout(location=0) in vec3 vertPos;
void main(){
    vec4 pos=(MVP*ROT*vec4(vertPos,1.5));
    gl_Position=pos;
}

Now geometry shader:

layout (triangles) in;
layout (triangle_strip, max_vertices = 6) out;
out vec4 pos;
void main(void)
{
    for (int i = 0; i < 3; i++)
    {
        vec4 offset=vec4(i/2.,0,0,0);
        gl_Position = gl_in[i].gl_Position+offset;
        EmitVertex();
    }
    EndPrimitive();
}

And now fragment shader:

uniform mat4 MVP;
in vec4 pos;
out vec3 color;
void main(){
    vec3 light=(MVP*vec4(0,0,0,1)).xyz;
    vec3 dd=pos.xyz-light;
    float cosTheta=length(dd)*length(dd);
    color=vec3(1,0,0);
}

Well, there is some junk, I wanted also put shading into my cube, but I've got a problem with sending coordinates. The main problem is - here I get my scaled square (by MVP matrix), I can even rotate it with basic interface (ROT matrix), but when I uncomment my "+offset" line I get some mess. What should I do to make clean 6-times repeating?

sentences:
Comparison of two 2d top down player movement scripts in Unity I have been following along two different tutorials on making an 2d RPG and comparing the two movement scripts that seem to do the same thing but in different ways. Which is a better way when comparing these scripts?

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float moveSpeed;
    private Animator anim;

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

    // Update is called once per frame
    void Update () {
        if(Input.GetAxisRaw ("Horizontal") > 0.5f || Input.GetAxisRaw ("Horizontal") < -0.5f){
            transform.Translate(new Vector3(Input.GetAxisRaw ("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
        }

        if(Input.GetAxisRaw ("Vertical") > 0.5f || Input.GetAxisRaw ("Vertical") < -0.5f){
            transform.Translate(new Vector3(0f, Input.GetAxisRaw ("Vertical") * moveSpeed * Time.deltaTime, 0f));
        }

        anim.SetFloat ("MoveX", Input.GetAxisRaw("Horizontal"));
        anim.SetFloat ("MoveY", Input.GetAxisRaw("Vertical"));
    }
}

Script 2:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {
    Rigidbody2D rbody;
    Animator anim;

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

    // Update is called once per frame
    void FixedUpdate () {
        Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if (movement_vector != Vector2.zero) {
            anim.SetBool ("Iswalking", true);
            anim.SetFloat ("Input_x", movement_vector.x);
            anim.SetFloat ("Input_y", movement_vector.y);
        } else {
            anim.SetBool ("Iswalking", false);
        }

        rbody.MovePosition (rbody.position + movement_vector * Time.deltaTime);
    }
}

sentences:
Faking 2d light using shader (Unity, Shaderlab) Since the concept was difficult to explain in words for someone who's not quite familiar with shader, I described it in pictures.

I'm currently using Unity and it seems Shaderlab is the best choice to accomplish this.

To shader masters, this seems like quite a simple trick, but as beginner, I've been struggling to find right keywords and tutorials to accomplish this.

I wish someone could explain the concept behind this shader trick.

Thank you in advance.

sentences:
Why doesn't light continuous on my model? I created a basic textured cube model with Blender to practice modeling, and then I imported it into Unity. After I put up some lighting it looks pretty ugly. The light is not continuous on a row of textured cubes:

What is more odd, the light on the blocks that makes up the floor is continuous. What am I doing wrong?

This is what it looks like without textures:

If I did not know that these are perfect cubes, I'd say there is a slight curve on surface. I also tried lightening the texture but it also didn't help:

I just simply exported the model from Blender and did not set up any normals or things like that. However, I also did not do anything special with the floor brick model.

Checked the normals and they seem to point to the right direction.

Also I don't really see the difference between the two models.
On the textures panel I also set the projection to flat:

I checked the different panels in Blender and the only normal-related option on the "Object Data" panel is this "Auto Smooth" and it is turned off by default:

sentences:
Why do some videogame sequels become bigger? Sometimes I'm wondering why sequels in games usually strive to have new features, making them more complex, taking much longer to finish and also sounds much harder to keep motivated into it.

I understand that it's needed because gamers don't want to buy the same game with just a different story. but occasionally these features seem to make the original intention of the game more complex than I think it should be.

If a developer is always with the thought to make his next game bigger than the previous, then that means that they'll become overly cluttered with tons of features that a gamer may or may never use. That sounds like a waste of effort to me.

Maybe it's just that I prefer a simple style from indie games,
but when I look at the larger companies, then sometimes I've a feeling
they're trying out a lot (if not too much) to sell well.

Just take a look at Mario Kart 8, Breath of the Wild and Super Mario Odyssey as example.
They're all so complex compared with what the series used to be.
Now imagine how large their next game has to be in order to top that, if that's even possible.

So my question is: what leads game developers to focus on making the next game even bigger? And are there viable ways to avoid this trend?

I'm used to the phrase 'less is more', but I wonder if that also fits in this situation.

sentences:
Shader - Realtime texture masking The first thing that comes in mind is masking using RGBA values. With this you can obtain this kind of textures and this kind of results.

But with this, you can only store up to 4 masks inside a texture and blend between maximum 4 textures.

I am wondering if there's a way to store more than 4 masks inside a texture and being able to blend more than 4 textures using this mask texture. The aim would be to store as much as possible masking data inside a texture.

Is it possible ? How ?

sentences:
What is the simplest way to calculate distance in a 3D environment? What is the simplest way to programmatically calculate difference between two points in a 3D game environment?

I am trying to sort a list of light sources by how close they are to an entity, so that only the four closest light sources affect an entity at any given time.

sentences:
How does XNA/MonoGame project 3d to 2d? I am trying to figure out how XNA is actually projecting a 3d world space coordinate to screen space.

I decompiled the MonoGame framework and copied the CreateLookAt und CreatePerspectiveFieldOfView methods of Matrix and multiplied thereafter  3 vectors like XNA does:

First multiply each position with world, then multiply resultig new vector4 with view and then the new resulting vector4 finally by projection.

      public static Vector2<T> Project(Vector3<T> source, Matrix4x4<T> world, Matrix4x4<T> view, Matrix4x4<T> projection, int width, int height)
    {
        Vector4<T> worldPosition = world * new Vector4<T>(source.X.ParseToNumeric<T>(), source.Y.ParseToNumeric<T>(), source.Z.ParseToNumeric<T>(), 1);
        Vector4<T> viewPosition = view * worldPosition;
        Vector4<T> position = projection * viewPosition;

        var X = position.X.ParseToNumeric<T>();
        var Y = position.Y.ParseToNumeric<T>();
        var Z = position.Z.ParseToNumeric<T>();

        return new Vector2<T>((X / Z) + width / 2, (Y / Z) + height / 2);

    }

Because (0,0,0) would be the center of the screen I added to the corresponding X and Y coordinates width and height divided by 2. Just because it made sense I divided finally the xy components by z.

The result is sobering:

I used following matrices:

      basicEffect.World = Matrix.Identity;
        basicEffect.View = Matrix.CreateLookAt(new Vector3(0, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0));
        basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000.0f);

And these points:

            vertices[0] = new VertexPositionColor(new Vector3(0, 0, 2), Color.Red);
        vertices[1] = new VertexPositionColor(new Vector3(1, 0, 2), Color.Red);
        vertices[2] = new VertexPositionColor(new Vector3(0, 1, 2), Color.Red);

Do you know why this happens?

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

sentences:
Hide back button bar of android mobile while playing game I just want to hide back button bar of android mobile while playing the game.

I tried to make it close by pressing back button,it getting close but its always visible.
please help..

sentences: Different Screen Sizes and Camera in Unity Now I know that no matter what the screen size is the camera will keep its height, so no worries about that. My question is, is there a way to manipulate the camera, either its orthographic size, or its viewport rect width, height, x or y so that the camera will fit perfectly on different screen resolutions. I know this a perfect solution for supporting different screens problem but how do other games do that? I mean I took some games from google play like bunny skater, or stick hero, those games look the same on Huawei P6 which has 1280x720 resoltuion, on Prestigio Multipad 4 which has 1024x768 and on HP Slate 7 which has 1024 x 600 resultion, now my question is how do they do that? I think the closest solution to this is to manipulate viewport rect of the camera, I'm saying this because I found a script that does so but it leaves black bars on top and bottom, the game looks the same on every device though but as I said it leaves black bars on top and bottom, so is there a solution on how to do this?

sentences:
Ball's velocity vector, reflect against a point I need to calculate the new velocity vector when the ball collides with one of the paddle's corners.
Let d be the velocity vector of the ball,
r the target velocity vector
and n the surface normal used for reflecting the velocity vector.
I found that the formula to calculate the reflection vector is:
r=d−2(d⋅n)n
My first thought was to create a vector using the coordinates of the paddle's corner and the ball's center, normalize it and use it as my surface normal n.
That way I have both d and n that I need to calculate the reflection vector.

But, after some more research I've come across the following article:
Pool Hall Lessons: Fast, Accurate Collision Detection Between Circles or Spheres
which may be better since ball - ball collision is the same as  the ball - point collision that I need.
The collisions are all elastic and forces like gravity and friction don't exist.
Is my approach wrong?
If I end up doing this in any of the aforementioned ways, what are the advantages and disadvantages of each one of them?
EDIT: I forgot to mention that the post i linked doesn't contain any collision resolutions, but only collision detections, but it is what made me to think that searching for ball - ball collision resolutions is a better approach.

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:
Find ID from Spiral x, y positions. Hard programming formula I have a formula, which gets coordinates from user_id (see below).
I give User_id, and I get back coordinates.
But now I need to get User_id from coordinates.
For example:

function get_user_id_from_coordinates(x, y) {
  // if x = 1, y = 0, returns 4 (as in this image)
}

Please help me with that formula :) The first one i got also form this forum.

// if user_id = 64
function get_coordinates_from_user_id(user_id) {

  // Math.sqrt(user_id) = 8
  // 8-1 = 7
  // 7 / 2 = 3.5
  // Math.ceil(3.5) = 4
  var k = Math.ceil( (Math.sqrt(user_id) - 1) / 2 );

  // t = 2 * 4 + 1 = 9
  var t = 2 * k + 1;

  // m = 81
  var m = t * t;

  // t = 9 - 1 = 8
  t = t - 1;

  // if 64 >= 81 - 8.   If 64 >= 73
  if (user_id >= m - t) {
    // return [ -4, 4 - (81 - 64)].   return [ -4, -13 ]
    return [ -k,  k - (m - user_id)  ]
  }
  // else m = 81 - 8 = 73
  else m = m - t;

  // if 64 >= 73 - 8.   If 64 >= 65
  if (user_id >= m - t) {
    // return [ -4 + (73 - 64), -4].   return [ 5, -4 ]
    return [ -k + (m - user_id), -k]
  }
  // else m = 73 - 8 = 65
  else  m = m - t;

  // if 64 >= 65 - 8.   If 64 >= 57
  if (user_id >= m - t) {
    // return [ 4, -4 + (65 - 64) ].   return [ 4, -3 ]  <== passes
    return [ k, -k + (m - user_id) ]
  };

  // return [ 4 - (65 - 64 - 8), 4 ].   return [ 11, 4 ]
  else return [ k - (m - user_id - t), k ];
}

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:
Animation Starts Before KeyDown Event Even Happens? Recently when I started working on my first animation transition, it has a bug were the transition will occur as soon as the game begins, even though I haven't pressed the key to activate the transition. I would really appreciate any help I can get on this so I can continue creating more animations. I will include my C# code and an image of the transition below.
Thanks, Nova

using UnityEngine;
using System.Collections;

public class PlayerAC : MonoBehaviour
{
    private Animator anim;

    void Start ()
    {
        anim = GetComponent<Animator> ();
    }

    void Update () {

        if (Input.GetButton ("Fire1"))
        {
            anim.SetBool ("RunStright", true);
        }
        else
        {
            anim.SetBool ("RunStright", false);
        }
    }
}

sentences:
Figure out why vertices are clipped I am trying to figure out why, at sharp cutoffs in geometry, some vertices seems to be culled for some reason.

I have a heightmap for demonstrating it like this

And this is the result I get

See the red rectangles where the geometry is just cut and the skybox is shown behind.

I am not quite sure where to start looking where the problem might be.
I know for a fact it's not colliding with the z-near value.
Any non-steep geometry is fine. Any pointers?

EDIT: at certain angles, re-orienting the camera ever so slightly changes things, like this

sentences: 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: HLSL problem with divide by homogeneous component When I try to divide my position.z by my position.w in HLSL I get as result always 1.0f or higher. Is this a common problem for some reason? When I divide my position.x or y by the w this works fine. But the divide for the z gives a wrong result. I use the view matrix for my camera and the projection matrix as i use it in the game because I want to create a depthmap from the cameraposition. Can anybody explain what I'm doing wrong? Do I need another view matrix?

sentences:
How to deal with players having too much money (or any large numbers)? I'm working on a browser MMORPG in PHP and MySQL and today got a bug report about int32 overflow, due to the player having too much money. When I was designing the core system, I completely forgot about the integer 2,147,483,647 limit, so now I'm trying to come up with some way to fix this without breaking everything apart.

How to better handle in-game currency (or basically any number that's going to increase indefinitely)? I have couple of ideas, but would like to ask for help choosing as this is the first time I'm dealing with this kind of stuff (int overflow and large numbers.)

Fix the current mechanics so that players won't ever have that much money. Doesn't really address the integer problem, but it still needs to be done.
Use float instead of int. This seems like an easy option, but I'm not sure if there would be any potential side-effects. Also, I read somewhere that you shouldn't compare floats, so I'm not sure how I would handle basic hasEnoughMoney? type of conditions. Also, is float the same in PHP and MySQL?
Have some sort of higher currency, like bronze/silver/gold coins and automatically convert it at certain threshold (ie. 1,000,000 would become 1M or something like that.) The downside here is more apparent than with the floats - more complexity and more room for mistakes to happen.
Straight out cap the amount of money player can have few points below the overflow limit. Straight forward and effective, but I don't really like the idea of having a limit on money - though I just realized, GTA (and many more I'm sure) has it if I'm not mistaken, so maybe it could work?

Any help would be much appreciated. I searched for hours, but couldn't find much. I read this How do idle games handle such large numbers? among other things, but it doesn't really help as what I'm doing is multiplayer, so not every player will have either too much (and not need precision, so to use floats) or too little (and need precision), and it needs to be unified for all players.

Thanks!

sentences:
Game Object is Instantiating on same position I am working on a small project . But now I have come across a problem . The problem is the prefab is instantiating on the same position .

I want to instantiate a box end to end . The basic set up is as follows : -

Image 3 :- Please see the comment below

Box game object has a parent empty object (Start_point) , and a child empty object (end point) . Those marks the Start and End of that game object .

The game a empty game object (Tile_Gen) which has a C# script as follows :-

using UnityEngine;
using System.Collections;

public class Tile_Gen : MonoBehaviour
{

   public GameObject G_O_01 ;

   public GameObject Current_Tile ;

   public Vector3 Start_Position_Of_Path ;

// Use this for initialization
void Start ()
{
    Start_Position_Of_Path = Current_Tile.transform.GetChild(0).transform.GetChild(0).position;
    Instantiate(Current_Tile , Start_Position_Of_Path , Quaternion.identity);

}

// Update is called once per frame
void Update ()
{
    Path_Generator ();
}

public void Path_Generator()
{
    Instantiate(G_O_01 , Start_Position_Of_Path , Quaternion.identity);
// End of tile position = start tile position
    Start_Position_Of_Path = G_O_01.transform.GetChild(0).transform.GetChild(0).position;
    print (Start_Position_Of_Path);
}
}

Here G_O_01 is Start_point prefab , Current_Tile is Start_point .

But this is not instantiating as I wanted . This instantiates all the object at one place .

But I want something like one behind the another , like this :-

Image 4 :- Please see the comments below

So Please help me to figure it out .

Regards NB :)

sentences: Mesh deformation maya to unity I have a model that has been modeled & rigged in Maya, whenever i export it as an FBX and take it into unity it seems to collapse at certain areas (see the attachments for a before and after). The model is fine when brought into unity in the T position but once I give a pose in maya & get it to unity it seems to collapse in certain areas. I’ve even tried importing FBX file into 3ds max , model seems to have no problem in it. Its only when I import into unity I seem to get this problem.

sentences: Drawing in 3D with LibGDX Is there any way to simply draw in 3D, just like you would draw with ShapeRenderer or SpriteBatch? All I want is to draw circles that are in x.y.z coordinates, so some circles are far away from view and some are closer. Also I would like to be able to rotate these circles.

sentences:
MySql Database design for Facebook game I'm at the planning stages for a facebook game, it will be similar to farmville, but will feature parks. I've been a Flash game dev for many years but all this database stuff is new to me so I'm having trouble getting my head around what's the best way to handle the data.

I know I need a table for the players, so that's straightforward.

Each player can grow crops/flowers and/or harvest trees etc that are already in the parks. The way I'm setting it up is that the parks are made up of 2 layers, or 2 2D arrays, the bottom array or ground tile array is just big tiles, and in a 8x8 grid, so that seems pretty straightforward as well, just store 16 entries for each part in a "parks ground tile table", but first question about that. Those 16 entries would correspond to each park, so would I still use the auto increment on the ID, or some other kind of ID to represent them as a group somehow? I'm just thinking of what's the fastest way to grab those 16 from the database.

Next onto the trickier stuff which is the 2nd layer of the park or the items/objects/crops 2d array. Each player has to have their own version of this 2D array, so first qusetion is how do I set that up in the database? I was thinking maybe having a "park items array" and then each feature (tree, crop) etc for each player would just be stored in that array, but I can see that getting huge really quick, so not sure how to do that? or if the size of that would be an issue?

Then on top of that, each player can maintain multiple parks :p...again what would be the best database design to maintain all of those?

Thanks for any help!

sentences:
Why can't I reference "targetVelocity" variable to this script? Recently, I implemented a shooting system for my 2D game but this system has a problem. The problem is that when the player is facing left, the bullets are still being shoot to the right. For fixing this, I need to access a Vector2 named targetVelocity to check whether the player is facing right or not. targetVelocity  is defined in another script called PhysicsObject that is specifically for the player physics and the player script inherits from it (the variable was protected but I changed it to public). I just don't know how to reference this in my Bullet script and I don't want to add the player script to the bullet.  Also, I've read the past questions and answers that were similar to this but I haven't found the answer yet because this is a different case. Thanks in advance.
This is my Bullet script and I want to somehow reference targetVelocity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
    [SerializeField] float speed;
    [SerializeField] float lifeTime;

    public GameObject destroyEffect;

    private void Start()
    {
        Invoke("DestroyBullet", lifeTime);
    }

    private void Update()
    {
        transform.Translate(Vector2.right * speed * Time.deltaTime);
    }

    void DestroyBullet()
    {
        Instantiate(destroyEffect, transform.position, Quaternion.identity);
        Destroy(gameObject);
    }

}

Here is the weapon script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Weapon : MonoBehaviour
{
    public GameObject bullet;
    public Transform firePoint;

    private float timeBtwShots;
    public float startTimeBtwShots;

    private void Update()
    {
        if (timeBtwShots <= 0)
        {
            if (Input.GetButton("Fire1"))
            {
                Instantiate(bullet, firePoint.position, transform.rotation);
                timeBtwShots = startTimeBtwShots;
            }
        }
        else
        {
            timeBtwShots -= Time.deltaTime;
        }
    }
}

This is the player script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewPlayer : PhysicsObject
{
    [Header("Attributes")]
    [SerializeField] private float jumpPower = 10;
    [SerializeField] private float maxSpeed = 1;

    //Singleton instantation
    private static NewPlayer instance;
    public static NewPlayer Instance
    {
        get
        {
            if (instance == null) instance = GameObject.FindObjectOfType<NewPlayer>();
            return instance;
        }
    }

    // Update is called once per frame
    void Update()
    {
        targetVelocity = new Vector2(Input.GetAxis("Horizontal") * maxSpeed, 0);
        //If the player presses "Jump" and we're grounded, set the velocity to a jump power value
        if (Input.GetButtonDown("Jump") && grounded)
        {
            velocity.y = jumpPower;
        }
        //Flip the player's localScale.x if the move speed is greater than .01 or less than -.01
        if (targetVelocity.x < -.01)
        {
            transform.localScale = new Vector2(-1, 1);
        }
        else if (targetVelocity.x > .01)
        {
            transform.localScale = new Vector2(1, 1);
        }
}
}

sentences: Why is a baked normal map more efficient to render than additional physical detail? I was just contemplating about why I improve performance by baking additional details into the object rather than just rendering the more detailed model. How does the GPU get to take a shortcut to render potentially the same amount of detail on screen, just because the detail is represented in a different way?

sentences:
Why does my triangle ray intersection test always return -1.0f? I'm trying to get the mouse click position on a terrain geometry, but multiple times in each frame; doing it on the CPU was way too slow, so I'm trying to do it with a compute shader. I can't seem to get a valid result back. I guess it's somehow related to my raydirection/rayorigin vectors, because I tried 4 different written DirectX HLSL solutions, but none of them works for my case; though, I did have to modify them. Anyway, this is my code to generate the ray vectors:

XMFLOAT3 RayOriginFloat = m_Camera->GetPosition(); //The eye position of the camera. I use this vector in the compute shader.

XMVECTOR worldPos;
XMVECTOR RayOrigin = XMLoadFloat3(&RayOriginFloat);
DirectX::BoundingFrustum frustum;

// I use the DirectXMath XMVector3Unproject method to project the mouse coord to worldspace.
ScreenToWorld(m_mouseX, m_mouseY, &worldPos);

XMVECTOR RayDir = worldPos - RayOrigin;
RayDir = XMVector3Normalize(RayDir); //And finally the normalized direction vector

And this is the HLSL code:

cbuffer RayBuffer
{
    float3 RayOrigin;
    float3 RayDir;
    matrix view;
};

struct ComputeInputType
{
    float3 position : POSITION;
    float2 tex : TEXCOORD;
    float3 normal : NORMAL;
};

struct ComputeOutputType
{
    float distance;
    float3 position;
};

static const uint ThreadSize = 32;

StructuredBuffer<ComputeInputType> BufferIn : register(t0);
RWStructuredBuffer<ComputeOutputType> BufferOut : register(u0);

[numthreads(ThreadSize, ThreadSize, 1)]
void PickingCSMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    float result;
    float3 vertices[3];
    float3 edge[2];

    if (dispatchThreadID.x < 64 && dispatchThreadID.y < 64)
    {
        vertices[0] = BufferIn[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].position;
        vertices[1] = BufferIn[(dispatchThreadID.x + (dispatchThreadID.y + 1) * ThreadSize * 2)].position;
        vertices[2] = BufferIn[(dispatchThreadID.x + 1 + (dispatchThreadID.y + 1) * ThreadSize * 2)].position;

        edge[0] = vertices[1].xyz - vertices[0].xyz;
        edge[1] = vertices[2].xyz - vertices[0].xyz;

        float3 normal = normalize(cross(edge[0], edge[1]));
        float b = dot(normal, RayDir);

        float3 w0 = RayOrigin - vertices[0].xyz;
        float a = -dot(normal, w0);
        float t = a / b;

        result = t;

        float3 p = RayOrigin + t * RayDir;
        float uu, uv, vv, wu, wv, inverseD;
        uu = dot(edge[0], edge[0]);
        uv = dot(edge[0], edge[1]);
        vv = dot(edge[1], edge[1]);

        float3 w = p - vertices[0].xyz;
        wu = dot(w, edge[0]);
        wv = dot(w, edge[1]);
        inverseD = uv * uv - uu * vv;
        inverseD = 1.0f / inverseD;

        float u = (uv * wv - vv * wu) * inverseD;
        if (u < 0.0f || u > 1.0f)
        {
            result = -1.0f;
        }

        float v = (uv * wu - uu * wv) * inverseD;
        if (v < 0.0f || (u + v) > 1.0f)
        {
            result = -1.0f;
        }

        BufferOut[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].distance = result;
        BufferOut[(dispatchThreadID.x + dispatchThreadID.y * ThreadSize * 2)].position = vertices[0].xyz;
    }
}

The result is always -1.0f. I don't get it; I might have made a big mistake, but I can't find where.

Why does my triangle ray intersection test always return -1.0f?

sentences:
Collision detection for multiplayer game with MatterJS We are developing JavaScript multiplayer top down game where characters can move freely and collide with each other. We are rather weak at mathematics and physics, luckily we don't need much, just some basic movement & collision mechanics.

After a lot of struggle and failures with custom collision mechanics we decided to use MatterJS library. That works like a charm when character collides with static object (like a wall). However when two characters meet, they basically bounce off each other.

We use simple circle based body with frictionAir and inverseInertia set to 0. There is a lot of other properties, but we are rather clueless how the bounce off actually happens. Anybody can point us in the right direction please?

sentences:
2D game physics, doing it right I have a ball that you can make jump,

I have a sneaking suspicion I'm doing this wrong. It works now, to the extend that gravity pulls the object down toward the ground, but I'm having trouble manipulating the speed of the object.

What this is, is a ball jumping and falling towards the ground.

I have another function called "jump" that just adds a value to it's yVel

I can increase gravity, and it falls faster.

I can increase the jSpeed speed, and it'll rise up longer, but not faster

But I can't get it to do everything faster. It just looks painfully slow, which may or may not be because of my emulator running at 11 fps, on average.

Is it just my emulator, or is it something on my end?

float time = elapsedTime/1000F;
 if (speed < maxSpeed){
            speed = speed + accel;
            }
            if(mY + mVelY < Panel.mHeight){ //0,0 is top-left
            mVelY += (speed);
            }

            if (!(mY + height >= Panel.mHeight)){
            mVelY = mVelY  + gravity ;}

            mX  =  (float) (mX +(mVelX * time));
            mY =  (float) (mY + (mVelY * time));

sentences:
Add points to a prefab in Unity I have a prefab that looks like this:

I have created a couple of 'points' in the Hierarchy using 'Create Element' and I would like to attach them to the prefab, however drag and drop over doesn't work. Why is that?

sentences: Combine Unity games in one app I want to combine multiple Unity games in one Unity app (or other framework if necessary). This app would have a bunch of buttons that will start the desired game. Is this possible and what would be the best way to do this? Thanks!

sentences: What are file formats that store skeletal movements, and are there databases of them? I have a set of 3d vectors representing the positions of a character's hand, foot, shoulders and so on. Is there any kind of easy to read file I can use to animate those with walking, standing, jumping etc motions? Is there a database with some of them?

sentences:
Fair sharing income with designer I am developing my android game, 2D Sidescroll arcade game, its almost finished, I found artist who wants to cooperate with me, creating graphics for my game, but we have to discuss how much % he will receive if there will be any income from our game.

How do you game developers handle this? What is fair share for an artist? Here is little description on my and his work, to estimate work value:

Done by me:

game idea, story
game code (6 months of development) all game features, everything generally
visual level editor
levels created by me (more than 120)
android license bought be me (I know its cheap but still it is value)
sound purchased by me

Done by artist:

game graphics generally, ground tileset, game characters, 5 tiled monsters (animation), around 30 different graphics for different game objects (like environment elements, obstacles etc)

I would be grateful for some informations, thank you!

sentences:
Sending light data from Vertex Shader to Pixel Shader? We have a pixel shader constant buffer that contains the light data for the item that is currently rendered.
To implement tangent space normal mapping, i would need to transform each light into tangent space.
Is it a valid approach to instead bind the light data to the vertex shader and then send the transformed Light Data to the pixel shader since the vertex shader runs less frequently than the pixel shader?
As a side note: I am using forward rendering with a limited light count.
Our pixel shader constant buffer looks like this:
struct RendererLight {
    float3 Position;
    float3 Color;
    float3 Direction;
    float Intensity;
    float In;
    float Out;
    float Range;
};

cbuffer LightsBuffer : register(b2)
{
    RendererLight Lights[8];
    uint NumLights;
};

sentences:
Add singleton to an existing gameobject in Unity via script I did notice that if I assign scripts that generate singleton classes (for my managers), to an empty game object, everything works fine.

Now I would like to start the scene with the empty game object, attach the main game manager singleton, and in the game manager singleton I would like to attach to it the other manager singleton classes.

Although I am not sure how you actually do so. Do you run addComponent to the main game manager, and they will be attached to the existing gameobject?

The gameobject that I use for the main gamemanager is set to not be destroyed on load; the doubt is if I should run addComponent on the scripts, or create a reference from the gamemanager script and instantiate it from there.

I did look for examples on the subject, but the only thing that I found is the reference to add a script to a game object; and I am not sure if that's actually what is supposed to be done.

sentences:
How is "resolution scaling" done? Lots of new games use Resolution Scaling as an option. At first I thought it was just Super-sampling but it does not appear to remove aliasing so I'm assuming there is more to it than that.

I guess my question is, how are developers implementing this? I'm assuming it means multiplying the width and height of the various rendertargets, and then what?

sentences:
Canvas not filling up the whole screen in Unity 5 I am trying to make my canvas auto resize to any screen size. These are my canvas scalar settings:

UI mode: change with screen size

match height and width

reference resolution: 600x800

I looked up in various tutorials where they say to set it to "change with screen size" and "match height and width" so I did that but still it's not fitting. The weird thing is that it fits horizontally but not vertically.

screenshot: https://s15.postimg.org/ue99zehkr/Screenshot_20161207_132731.png

sentences:
Can Bullet Physics (or another 3d physics engine) use callbacks in my engine to check static geometry? I'm wondering if it's possible to use or hack Bullet 3d Physics (or another free 3D physics engine) so that I don't need to "import" my static geometry into Bullet - instead I want to do it the other way, so Bullet uses some sort of callback system to check geometry properties of my mesh/polygons.

Sort of like that Bullet would expect a method in my static geometry classes "checkRayIntersection" or similar, and I take care of the details and optimizations myself. The meshes are immovable, so the only thing that I expect Bullet to care about is intersections and their normals, but I might be missing something..

EDIT: as an example, consider a 10 million polygon terrain mesh which is changing all the time. You probably don't want to keep parallel data structures in the render-engine and in the physics engine for this. You don't want to use an approximation for the physics either.

Bullet uses something called MotionStates to solve this problem for its output - I was hoping there was a similar design pattern for passing geometry input.

sentences:
How to to convert UV coordinates to texel coordinates and how to convert texel coordinates to "array coordinates"? I am currently writing a UV texture mapper.

But i don't know how to convert UV coordinates to texel coordinates.

And i also have no idea how i should convert texel coordinates to "array coordinates".

By "array coordinates", i mean number that represents a part of an array (in this case a bitmap).

Here is my code:

 su =  (u0)  * (tx-1) ;
 sv =  (v0)  * (ty-1) ;

 texloc = ((sv >>16)* bytes_per_row) +((su>>16)* bytes_per_pixel);

Also i use fixedpoint math to interpolate between the uv coordinates.

tx and ty are the dimensions of the texturemap.

sentences:
Making objects larger than 1 tile in a pixel art tile map I'm working on a pixel game, and started creating a little town to test some stuff.

My question is whether there is a way to create bigger objects without having to split them into several parts.

My grass tiles and similar are 16 pixels wide, but how do I build a house for example, I want to stay at 16 pixels with all objects but the house would be far too small this way.

I know I can build it by creating the parts separately, but is there an easier way?

sentences:
Can I set a texture as the wallpaper of an iOS device? I have a game in Unity which creates drawings.

I need to have a button which sets the drawing as the wallpaper (with permission from the user of course).

Is it possible?

sentences:
How can I diagnose a Unity crash when running the game on a phone? I have a 2D android game that is in beta on Google Play. It has about 100 installations, but no testers. I'm the only developer. Some of the users have reported app crashes, and because they are not developers, they can not help me with a diagnosis.

I think the origin of the problem is the phone not having enough memory to run the app. When I rub the app in a LG-D213c running Android 4.4.2, the game opens, and you can navigate the main screen (the title screen). When I select any stage, the game displays the "loading" screen that runs in the same scene as the main title, and SceneManager.LoadScene () is called with the play scene (battle). Then, the game closes. When I do the same procedure with a Galaxy S5 neo (SM-G903M) running Android 6.0.1, the app runs normally.

I have collected a log uaing  Android Monitor. Both of them include the moment of the app crash (the name is com.empresa.aplicacion, but this is not the real name).

This is the profiler capture in both cases.

LG phone case.

Galaxy S5Neo case

So. I have some questions.

What is the real origin of the problem? How can I diagnos the issue? I'm not seeing the cause, this is the filtered Log, and this is the complete log.
How can I control this error from inside Unity? Is there a way to catch exceptions from the Unity core, so that it can generate a report?
How can I make a diagnosis to the installations that I do not have access to, like a production installation or a client that has the app in their phone?

All of my questions are relative to Unity platform.

sentences:
Fixing T-Junction artifacts in a BSP Editor I'm starting a little BSP engine, and have begun implementing Brush CSG.  Currently I represent my brushes as the enclosed volume of surface planes (like old idTech 3 maps), with a cache for each face that is generated on rendering the brush for the first time.

Now, I subtract a cube from another cube to cut a hole into it, yielding 5 brushes. Instantly, t-junctions! As you can see below, visible cracks appear:

This isn't particularly surprising, and obviously moving onto the BSP compilation process I will have to fix up all the t-junctions in the scene. However, I notice that in e.g. GtkRadiant, if I perform the same operation, these artifacts don't show up (or at least, I don't notice them), despite the fact the new brushes ARE separate and can even be moved apart and back together in the scene.

How do I remove this rendering issue at map design time?

sentences:
How can I replicate the color limitations of the NES with an HLSL pixel shader? So since 256 color mode is depreciated and no longer supported under Direct3D mode, I got the idea to use a pixel shader instead to simulate the NES palette of all possible colors so that fading objects and whatnot don't have smooth fade outs with alpha channels.  (I know objects couldn't really fade out on the NES, but I have all objects that do fade in and out on a solid black background, which would be possible with palette swapping.  Also, the screen fades in and out when you pause which I know also was possible with palette swapping as it was done in a few Mega Man games.)  Problem is, I know next to nothing about HLSL shaders.

How do I do it?

sentences: Tab between input fields I am new to working with Unity3d, I need to navigate between several inputField, for this I have looked at the solution that is in: tab-between-input-fields, but always the FindSelectableOnUp() or FindSelectableOnDown() returns null, so my next is always null and always ends in: next = Selectable.allSelectables[0];

sentences:
How do I add an image inside a rectangle or a circle in JavaFX? Suppose we have a rectangle called r

Rectangle r = new Rectangle(40, 20);

and an image called image

Image image = new Image("...src for image");

How do I fit the image inside the rectangle? Also, how can I make the image move if the rectangle moves too? How do I do the same thing for a circle? Code examples are greatly appreciated.

sentences: Keeping 2 objects within cameras view I have two object to control and I wanted to keep them at cameras view without adjusting the cameras size but the camera can move only in positive y-axis meaning ones it goes up it shouldn't move down but it's okay if one object gets out of bounds. Since its 2D the camera is Orthographic view.

sentences:
When do you get Mouse.getstate().X or Y as negative? I am creating a game in which I use a function:

int x()
        {
            int px = 100;
            int pxend = 128;
            int xx = 0;
            for (int i = 0; i < 6; i++)
            {
                l = Mouse.GetState().X;
                if (l> px && l < pxend)
                {
                    xx = px;
                    break;
                }
                else
                {
                    px += 128;
                    pxend += 128;
                }
            }
            return xx;
        }

and

int y()
        {
            int px = 100;
            int pxend = 128;
            int xx = 0;
            for (int i = 0; i < 4; i++)
            {
                l = Mouse.GetState().X;
                if (l > px && l < pxend)
                {
                    xx = px;
                    break;
                }
                else
                { px += 128;
                pxend += 128;
                }
            }
            return xx;

        }

But when I debug I get value a l as negative even though the debug is initiate after a click on the GameWindow screen. Sometimes it works fine sometime does not. I dont know why does it give me negative value. And when I used them with my Rectangle i get Rectangle.X and Rectangle.Y as 0.

sentences:
How to make my characters turn smoothy while walking on a path(list of coordinates)? I have a list with coordinates - output from A* algorithm - and I would like to make my characters smoothly follow this path with rotations.

So I have something like A and I want to get C

How can I do this ?

EDIT

To make myself a little bit more clear:

I am more interested in smooth turning as I already know how to walk from one node to another.

EDIT

As many people find this useful (me too) I am posting link to Daniel Shiffman's "Nature of code" where he discusses a lot of game AI (and physics) problems e.g. steering behaviours http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section8

sentences:
Trying to get enemy sprites to move on C# In my XNA game, I'm have the enemy sprites loaded and in the game screen. However, I put in the code to update their position in the Update method of the main class. The objective is to get the sprites to move from the right hand side of the screen to the left, and the player has to jump over them. Here's my code in the update method(note, the enemy sprites are created in a Texture2d list, and their positions in a Vector2d list):

                Vector2 ep1 = enemyPosition[0];
                Vector2 ep2 = enemyPosition[1];
                Vector2 ep3 = enemyPosition[2];

                        if (enemyPosition[0].X < 800)
                        {
                            ep1.X--;

                        }

                        if (enemyPosition[1].X < 800)
                        {
                            ep2.X--;

                        }

                        if (enemyPosition[2].X < 800)
                        {
                            ep3.X--;

                        }

sentences:
Scoring system (3 Variables) I'm writing a mobile game where the player has

a limited number of clicks to direct their avatar to the bottom of the map
into a bronze, silver, or gold basket
land on his/her feet, head, or side.

I'd like to take each of these into consideration when determining the score.

On level 231, the lowest possible clicks to get into the bronze is 2, silver is 4, and gold is 7, with a limit of 10 clicks.

So let's say the score is calculated like so:

Basket: 1 point for bronze, 2 for silver, and 3 for gold.
Landing: 3 for feet, 2 for head, and 1 for side.

That means the possible outcomes are:

Bronze: 1, 2, 3, or 4
Silver: 2, 3, 4, or 5
Gold: 3, 4, 5, or 6

Now that's all good because I can make a 1 star 3, a 2 star 4, and a 3 star 5 or 6.

But now, the remaining clicks come into play: I originally wanted them to multiply the score. 2x for 1 click left, 3x for 2, and so on. That means getting a fast bronze is better than getting the harder-to-reach gold. Raising the base scores to 1, 2.5, and 6.25, respectively, messed up the other levels.

Does anybody has a solution I could try? I don't care if the points go into the hundred thousands. I want to reward players more for gold, with other elements to keep them interested and feeling accomplished after player a level.

Thanks!

sentences:
Unity2d: orthographic camera and z-axis? I wonder if anyone can help with an explanation of the z-axis and using unity with 2D with an orthographic camera.

Up until now i have only been modifying the x and y values of game objects, thinking this is the correct way. i thought the Z axis didn't exist in 2D space (i.e. unity 2d with orthographic camera) but I do notice that the orthographic camera is placed at -10 on the z axis, if i change this value then the camera disappears. I sort of began to accept that.

Now I cam to a point where I wanted to rotate something, and I notice that rotating eithe on the z or x axis, doesn't seem to do anything, only on the z-axis, there is that z-axis again !

Can anyone tell me when i should be worrying about the z axis in unity using 2D games.

It seems now that it is more important than I once thought :-)

Thanks in advance.

sentences:
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:
sdl: unlock mouse in fullscreen mode and make it useable on another monitor Is it possible to unlock the mouse in fullscreen mode so that you can use it on a another monitor?
I read trough the SDL documentation, but I couldn't find anything related to my problem.

sentences:
Current state of the art for rendering large numbers of dynamic lights? This is intended as a platform-agnostic question, but I currently use OpenGL (with sights on Vulkan) if it is relevant.
The last time I dealt with creating lots of dynamic lights (~10 years ago), the best option was deferred rendering. Which works, but you have all of the problems that come with it (no MSAA, transparency is difficult, G-Buffer size, etc.).
These days, it appears that the industry is moving away from deferred rendering. I've seen mention of clustered forward rendering, more recently there's some sort of voxelized rendering? And then the new stuff, UE5 using some form of software rasterization, and id Tech 7 using some form of forward rendering with per-pixel rejection.
At this point I don't know what the differences are, what to pursue, and what is limited to specific highly-optimized scenarios.
Are there any resources for getting up to speed on the current techniques? Is there a current "best" or recommended technique for modern hardware for rendering large numbers of dynamic lights?

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:
Using proxy servers to tunnel data between clients and world servers Background
I've read up a little on the concept of splitting the world into regions which in turn can each be run on a node within a cluster. However my game concept revolves less around zones but rather bubbles.
In short, a bubble is a region of space defined by a radius which dynamically expands and contracts depending on how many players are in close enough proximity.

For example if two players are over 1000KM apart and there is no one else that close to them, then those two players will be in their own bubbles. However once they come within 1000KM to each other, their bubbles connect, effectively creating a larger bubble.
In terms of the server space, one of those players is switched to the others instance. In practice it may be the case that a single server node could handle multiple bubbles, but for arguments sake we'll say that each bubble is run on a different server.
Problem
Secrecy may well be a big part of this game, so its important that when one player is close to another they aren't able to detect this by listening for connections to new instances.
My current thinking is that players would be grouped into proxy servers which in turn dynamically connect and disconnect from the bubbles therefore separating the client from this process.

The problem of course is latency. There is already latency in the communication itself, and I am concerned that this additional step of tunneling data like this may unnecessarily make it worse.

I would also love to find material to read on this type of instancing.

sentences:
Unity cloud build speedtree textures incorrect type after build So I finally (after a few days) got unity cloud build to work.

When I build it using the unity editor everything is fine. However, when the cloud build service builds it I get some odd textures for my grass and trees:

Is there anything specifically I have to do to make sure this doesn't happen.

I don't know if it matters but I am using unity 2019.1 with HDRP.

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:
moving object in unity from a point A to point B no matter what the original position of the object is I'm moving a Game Object in unity from point A to point B no matter what the original position of the Game Object is.

Let us suppose that I have a Game Object at (0, 0, 0).

But I want to move that Game Object from (1, 1, 1) to (2, 2, 2).

How can I do this in C# ?

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:
Particle trajectory smoothing: where to do the simulation? I have a particle system in which I have particles that are moving to a target and the new targets are received via network. The list of new target are some noisy coordinates of a moving target stored in the server that I want to smooth in the client.

For doing the smoothing and the particle I wrote a simple particle engine with standard euler integration model.

So, my pseudo code is something like that:

# pseudo code

class Particle:
    def update():
        # do euler motion model integration:
        # if the distance to the target is more than a limit
        # add a new force to the accelleration
        # seeking the target,
        # and add the accelleration to velocity
        # and velocity to the position

        positionHistory.push_back(position);
        if history.length > historySize :
            history.pop_front()

class ParticleEngine:

    particleById = dict() # an associative array
                          # where the keys are the id
                          # and particle istances are sotred as values

    # this method is called each time a new tcp packet is received and parsed
    def setNetTarget(int id, Vec2D new_target):
        particleById[id].setNewTarget(new_target)

    # this method is called each new frame
    def draw():
        for p in particleById.values:
            p.update()

            beginVertex(LINE_STRIP)
            for v in p.positionHistory:
                vertex(v.x, v.y)
            endVertex()

The new target that are arriving are noisy but setting some accelleration/velocity parameters let the particle to have a smoothed trajectories.

But if a particle trajectory is a circle after a while the particle position converge to the center (a normal behaviour of euler integration model).

So I decided to change the simulation and use some other interpolation (spline?) or smooth method (kalman filter?) between the targets. Something like:

switch( INTERPOLATION_MODEL ):
    case EULER_MOTION: ...
    case HERMITE_INTERPOLATION: ...
    case SPLINE_INTERPOLATION: ...
    case KALMAN_FILTER_SMOOTHING: ...

Now my question: where to write the motion simulation / trajectory interpolation? In the Particle? So I will have some Particle subclass like ParticleEuler, ParticleSpline, ParticleKalman, etc..? Or in the particle engine?

sentences:
Writing a glow shader I'm trying to learn writing shaders. And I've pieced together something that is kinda working. I want to create a transparent glow around a sphere.
The problem I have is that I can't seem to alter the transparency of the glow.
I tried experimenting with ZWrite off but that doesn't give me the desired results.

The red part around the sphere is the glow. But I'm unable to change its alpha.
I'd would also like to change the "blurriness" of the glow. How would I do that?

EDIT

so I did some more tinkering. I've changed the blending to
Blend SrcAlpha OneMinusSrcAlpha and enabled ZWrite off. This allows me to change the alpha. The problem with this is that the inside of the object is also colored by the glow. I just want the glow around the circle. not inside.

Shader "Custom/HoleShader" {
Properties {
    _holeColor ("Color", Color) = (1,1,1,1)
    _glowColor ("Glow Color", Color) = (1,1,1,1)
    _glowSize ("Glow Size", Range (0.0,5)) = 1.0
    _glowOpacity ("Glow Opacity", Range(0,1)) = 1
}
SubShader {
Tags { "LightMode" = "ForwardBase" }
    Pass {
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        uniform float4 _holeColor;
        uniform float4 _glowColor;

        struct appData {
            float4 normal : NORMAL;
            float4 vertex : POSITION;
        };

        struct v2f {
            float4 pos : SV_POSITION;
            float4 col : COLOR;
        };

        v2f vert (appData v) {
            v2f o;
            o.pos = mul(UNITY_MATRIX_MVP,v.vertex);
            return o;
        }

        float4 frag(v2f i) : COLOR {
            return _holeColor;
        }
        ENDCG
    }
    Tags { "LightMode" = "ForwardBase" "Queue" = "Transparent" "RenderType" = "Transparent"}
    Pass {
        ZWrite Off
        //Blend One OneMinusSrcColor
        Blend SrcAlpha OneMinusSrcAlpha
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        uniform float4 _holeColor;
        uniform float4 _glowColor;
        uniform float _strength;
        uniform float _glowSize;
        uniform float _glowOpacity;

        struct appData {
            float4 normal : NORMAL;
            float4 vertex : POSITION;
        };

        struct v2f {
            float4 pos : SV_POSITION;
            float4 col : COLOR;
            float3 viewDirection;
            float3 normalDirection;
        };

        v2f vert (appData v) {
            v2f o;
            float4 pos = v.vertex + (v.normal * _glowSize);
            o.pos = mul(UNITY_MATRIX_MVP,pos);
            return o;
        }

        float4 frag(v2f i) : COLOR {
            return float4(_glowColor.rgb, _glowOpacity);
        }
        ENDCG
    }
}
}

sentences: What size should i use for my game design? i am currently working on a android game by using libgdx and i am designing graphics with ps for it. I want my game looks the same quality for different screen sizes but i dont know in which size should i design my graphics. For example if i design the graphics 200x200 size and for a bigger screen i should make it bigger by resizing with code. But this will demage the graphic which is something i dont want. What i think is to make a much bigger graphic then shrink for ever screen sizes. is that right approach to do? Or there is a better way. And also if this approach what size should i use for portrait game. Like 800 width is good? Thanks for ur answers.

sentences:
Unity3D - Smooth rotation for seek steering behavior I am trying to implement Reynolds' seek steering behaviour, but I am having problems on the rotation part. This is what I have:

void FixedUpdate()
{
// get position of current waypoint
        Vector3 targetPos = new Vector3(path[currentWaypoint].x, transform.position.y, path[currentWaypoint].z);

        // velocity vector towards target
        Vector3 desiredVelocity = targetPos - transform.position;

        // calculate the steerforce required for the desired velocity based on current velocity
        Vector3 steerForce = desiredVelocity - currentVelocity;
        steerForce = new Vector3(steerForce.x, 0, steerForce.z);
        steerForce = Vector3.ClampMagnitude(steerForce, maxSteer);

        // create a move vector to be added to agent's current position
        // Then normalize it so it can be scaled according to the agent's max speed
        Vector3 moveVector = steerForce.normalized * moveSpeed * Time.fixedDeltaTime;
        transform.Translate(moveVector);
}

How would I do it so my agent will be rotated smoothly based only on the code above? I tried rotating based on the current velocity, but the agents is rapidly rotated in one frame towards the target waypoint. I am not working with rigidbodies.

Am I doing something wrong? What am I missing?

Thanks,
Jack

sentences:
Difference between WM_KEYDOWN and GetAsyncKeyState() I am programming a simple Ping-Pong game in C++ but I don't know how to handle key presses. At first I intended to use WM_KEYDOWN, but I don't know how to track two pressed keys at once since the window processing function always gets only one wParam right? Basicaly I have two paddles on each side of the screen and when user presses W/S, left paddle moves, when Up/Down keys are pressed, right paddle moves. However when I press two keys at once only one paddle moves.

Another problem is that there is always a short pause after key is pressed - the paddle moves once in desired direction, then pauses and then continues to move. I have no idea why this happens. On the other hand when I use GetAsyncKeyState() like this:

if (GetAsyncKeyState('S') & 0x8000)
{
    PingPong.MoveLeftPaddleDown(hWnd);
}

everything works as intended - both paddles can move at the same time and there is no short pause on the beginning of movement. On the internet I read everywhere that I should use WM_KEYDOWN insead of GetAsyncKeyState() but how to configure it properly? Thank you

sentences:
How to implement translation, scale, rotation gizmos for manipulating 3D object's transforms? I am in the process of developing a basic 3D editor. It uses OpenGL for rendering a 3D world. Right now my scene is just a few boxes of different sizes and I am at the stage where I want to be able to select each box and then move/scale/rotate it to achieve any transform I want.

How can I solve the problem of implementing both the rendering of these tool's gizmos(or handles, or how people usually call them), and also picking them on each axis to perform the change in the transform with my mouse? For clarity:

My research so far suggested the cleanest approach is to have an axis aligned bounding box per arrow in the gizmo and another one per square (the ones that move the object in a plane rather than a single axis) and then cast a ray from the mouse position and see what it collides with. But this is still a bit too abstract for me, I would appreciate further guidance in how this algorithm would go (pseudocode is more than enough)

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:
Designing a unit combat system (java) I am looking to make a program that will allow me to test units for balance when in combat. The idea is that there will be two teams of so many units of different types. I would loop through a battle system that would pick units, have them attack, etc, and then see which team won and do this many many times for an average.

The thing I am having issues with is how to design or make the classes for the units. I tried making a class for a generic unit and then classes that pulled from it for each different unit. The issue was when I called a unit from a team, tried to add one etc. I need to know what the unit type was, that was I couldn't write one function that understood all the unit classes.

I am looking to make a system for the units that allows me to have each unit have the same basic stats, health, speed, etc. But that each unit will also have their own functions for abilities that would be different then other units. It would also allow me to make a method where I can say get a unit from an arraylist and call its get speed method and it wouldn't demand I know the unit class. For instance, grunt g = new grunt() instead something where I can get the unit and just call, unit.getspeed();

Any help or ideas for how I can do this, please ask for more information if needed.

sentences:
Is it worth it, to try and prevent cheaters? Perhaps one of the biggest issues that plague FPS-games are cheaters.

If you use a server-authoritative model, you will prevent some level of cheating. But why do this if people can still aimbot?

sentences:
Instantiate prefab randomly but not in already occupied position I want to generate bubbles randomly on screen. When a bubble is generated in one place then other bubbles should not be generated near its radius 1 area, so they can not collide or trigger with any other bubbles.

How can I do it ?

public void GenerateBubble ()
{
    newBubbleXPos = Random.Range (-7, 7);
    newBubbleYPos = Random.Range (-3, 3);
    bubbleClone = (GameObject)Instantiate (bubblePrefab, new Vector3 (newBubbleXPos, newBubbleYPos, 0), Quaternion.identity);
    UIManager.instance.ChangeBubbleSprite (bubbleClone);
    bubbleList.Add (bubbleClone);
    if (bubblePosList.Contains (bubbleClone.transform.position)) {
        bubbleClone.transform.position=new Vector3(Random.Range (-7,7),Random.Range (-3,3),0);
    }
    bubblePosList.Add (bubbleClone.transform.position);
    bubbleClone.transform.parent = UIManager.instance.CurrentLevel.transform;
    GLOBALS.bubbleCounter++;
}

In this code every bubble is generated in a different position, but they can collide with other bubbles.  I want to generate new bubbles not at the same position. My bubble colliders's radius is 1.

sentences: Using Unity's uNet to create a turn-based RPG I've been checking some tutorials about uNet and it seems pretty powerful. The NetworkManager is a great tool when you want to make generic games, but what is troubling me about it is the need of spawning a "Player". I intend to create a turn-based RPG, and for that, during the battle there's not a "physical player entity", there's two players which have a set of monsters and the players can select a monster to attack the opponents', but the player itself doesn't exist, in the end it sums up to a trade of commands between the clients. How can I achieve such an architecture with uNet? Should I discard the use of the default NetworkManager? Should I simply create a bodyless Player and go along with it?

sentences:
Odd Android touch event problem (Nexus 10) Overview

When testing my game I came across a bizarre problem with my touch controls.

Note this isn't related to multi-touch as I completely removed my ACTION_POINTER_UP and ACTION_POINTER_DOWN along with my ACTION_MOVE code.  So I'm simply working with ACTION_UP and ACTION_DOWN now and still get the problem.

The problem

I have a left and right button on the left of the screen and a jump button on the right.  Everything works as it should but if I touch a large area of my hand (the fleshy part at the base of the thumb for instance) onto the screen, then release it and then press one of my arrows, the sprite moves in that direction for a few seconds, and then ACTION_UP is mysteriously triggered.  The sprite stops and then if I release my finger and re-apply it to an arrow, the same thing happens.  This goes on and on and eventually (randomly??) stops and everything work OK again.

Test device & OS

Google Nexus 10 Tablet running Jellybean 4.2.2

Code

        //Action upon which to switch
        actionMask = event.getActionMasked();
        //Pointer Index of the currently touching pointer
        pointerIndex = event.getActionIndex();
        //Number of pointers (for multi-touch)
        pointerCount = event.getPointerCount();
        //ID of the pointer currently being processed (Multitouch)
        pointerID = event.getPointerId(pointerIndex);

        switch (actionMask){

        //Primary pointer down
        case MotionEvent.ACTION_DOWN: {

        //if pressing left button then set moving left
        if (isLeftPressed(event.getX(), event.getY())){
                    renderer.setSpriteLeft();
                }

        //if pressing right button then set moving right
        else if (isRightPressed(event.getX(), event.getY())){
                    renderer.setSpriteRight();
                }

        //if pressing jump button then set sprite jumping
        else if (isJumpPressed(event.getX(),event.getY())){
                    renderer.setSpriteState('j', true);
                }

        break;

        }//End of case

        //Primary pointer up
        case MotionEvent.ACTION_UP:{

        //When finger leaves the screen, stop sprite's horizontal movement
            renderer.setSpriteStopped();
            break;
        }

sentences:
Is it possible to generate a Spheremap from a Texture2D in Unity at run-time? I was trying to create a spheremap from a Texture2D for a skybox at run-time (Standalone build) in Unity. Does anyone know if this is possible and how to do that in Unity?

In the editor you can set a texture to a cubemap and then select it's import setting as a spheremap, but I can't find a way to do this at run-time using the Unity API.

sentences:
Adding sub-entities to existing entities. Should it be done in the Entity and Component classes? I'm in a situation where a player can be given the control of small parts of an entity (i.e. Left missile battery). Therefore I started implementing sub entities as follow.

Entities are Objects with 3 arrays:

pointers to components
pointers to sub entities
communication subscribers (temporary implementation)

Now when an entity is built it has a few components as you might expect and also I can attach sub entities which are handled with some dedicated code in the Entity and Component classes.

I noticed sub entities are sharing data in 3 parts:

position: the sub entities are using the parent's position and their own as an offset.
scrips: sub entities are draining ammo and energy from the parent.
physics: sub entities add weight to the parent

I made this to quickly go forward, but as I'm slowly fixing current implementations I wonder if this wasn't a mistake.

Is my current implementation something commonly done? Will this implementation put me in a corner?

I thought it might be a better thing to create some sort of SubEntityComponent where sub entities are attached and handled.

But before changing anything I wanted to seek the community's wisdom.

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:
MMORPG game map in-memory storage techniques For 2-3 years I've been interested into MMO development.
I'm browsing some emulators source codes and open source projects.

Usually I'm checking how the game server stores data about the 2D map.
There are 2 popular solutions:

map is stored only on the server it's sent to the client in parts (eq. tiles like in OpenTibia https://github.com/opentibia/server)
map is stored in the client and on the server, server sends only coordinates and client got knowedgle of it.

I'm generally interested in this first attitude, do you know any good and bad aspects of it?

How to store this structure on the server? In memory on in database? Open Tibia uses memory storage but there is one drawback: 2000x2000x16 map uses a lot of memory - something around 2GB. Is this because of bad design? Are you able to provide me some examples of good design?

sentences: Fastest way to draw small particles in opengl? Quick question : Which is the fastest method to render a large array of 4x4/8x8 particles in opengl ? Currently i spend 2triangles for each one but i think that its slow so i would really like to know if im doing it right.....

sentences: Should a beta version of an engine be used to start a new project? Is it advisable to use a beta version of unity(2019.3b) to make an actual complete project? What are the disadvantages?

sentences:
Basic 2d platform collision detection algorithm has a slight bug I'm trying to implement collision detection between Player (the main character) and a Platform. They are both modelled as rectangles; when player hits the side of a platform he should bounce off it and when player hits the top of a platform he should glide (move) along it. The problem I'm facing is that sometimes the player bounces when he lands on top of the platform (near an edge) rather than glide along it.

For the collision detection, I'm using the Intersector class (LibGDX). If you are unfamiliar with this class, all it does is create the new rectangle that occurs when two rectangles intersect (i.e. the rectangle shaded green below).

Code:

for (int i = 0; i < list.size(); i++) {

    // An object from a list of objects that the player can collide with
    GameObject go1 = list.get(i);

    // True if the object is of type platform
    boolean playerPlatformCollision = (go1.getType() == ObjectType.PLATFORM);

    // If the two objects being compared are Player and Platform
    if (playerPlatformCollision) {
        Rectangle objectRect = go1.getRect();

        // If the Player and Platform overlap
        if (player.getRect().overlaps(objectRect)) {

            // The resulting rectangle from the overlap (as shaded green in the above pic)
            Rectangle intersection = new Rectangle();
            Intersector.intersectRectangles(player.getRect(), objectRect, intersection);

            // If the Player collides with bottom side of platform
            if (intersection.y > player.getRect().y) {
                player.setySpeed(-getySpeed()); // Make him bounce downwards
            }

            // If the Player collides with left side of platform
            if (intersection.x > player.getRect().x) {
                player.bounce(); // Make him bounce
            }

            // If the player collides with the top side of platform
            if (intersection.y + intersection.height
                < player.getRect().y + player.getRect().height)
            {
                player.setGravity(false);
                player.onPlatform(true);
            }
            else {
                player.onPlatform(false);
            }
        }
    }
}

Is there any sort of trick I can use for this? Haven't been able to find anything online that works.

sentences:
Navigating to android app settings > permission from unity I am trying to rout from my unity application to android app settings permissions. till now I achieved to rout to app settings, But i want to take 1 step more to go inside permission i mean App Settings > Permissions.

Code:

try
        {
#if UNITY_ANDROID
            using (var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
            using (AndroidJavaObject currentActivityObject = unityClass.GetStatic<AndroidJavaObject>("currentActivity"))
            {
                string packageName = currentActivityObject.Call<string>("getPackageName");

                using (var uriClass = new AndroidJavaClass("android.net.Uri"))
                using (AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("fromParts", "package", packageName, null))
                using (var intentObject = new AndroidJavaObject("android.content.Intent", "android.settings.APPLICATION_DETAILS_SETTINGS", uriObject))
                {
                    intentObject.Call<AndroidJavaObject>("addCategory", "android.intent.category.DEFAULT");
                    intentObject.Call<AndroidJavaObject>("setFlags", 0x10000000);
                    currentActivityObject.Call("startActivity", intentObject);
                }
            }
#endif
        }
        catch (System.Exception ex)
        {
            Debug.LogException(ex);
        }

Help if it is possible... any help is appropriated. Thank in advance.

sentences:
Is there a common way to execute a task at a certain pace, without relying on the task priority feature of the OS? There is no cross platform way to set process priorities, and I don't want to use threads since there are no standard method of setting priority to certain threads, apart from the fact that threads are hard to use.

Let's say I have a task that takes a certain amount of computing time, which on my computer takes 10 seconds. This task usually takes a long time, like for example, loading geometry chunk dynamically, or opening a new audio ambience file. I don't need this task to be finished instantly because it's a big task so I can't afford to wait for a frame to finish, so I need to execute it over several frames, rather a certain amount of time.

Since I don't want to freeze the game, I can cut this loop into several batches and execute one batch per frame. If my game runs at 50 fps, a 10 second task can be divided in 500 batches. If my program loops over N*500 iterations, each batch loops over N iterations. If I don't want it impact others parts of my game, I can execute N/2 or even N/5 iterations per batch.

I'm not sure if I'm reinventing the wheel though, isn't there some C++ standard thing or programming pattern that allows me to do that already ? I'm not sure if it's optimal to cut a loop, and I'm not planning to use multithreading.

sentences:
XNA DepthBias increases performance even when EarlyZ is turned off. Why? My 3d scene consists of three main polygons:

The first and the second polygons overlap each other (have the same World matrix and use the same geometry), the third one is perpendicular to the first two and is positioned a few meters away from them. All three polygons are rendered with a forward shader that uses clip() function to do alpha cutoffs. As I read in a Radeon's article,
this causes EarlyZ test to be turned off and my simple subjective tests proved it: I had around 480 FPS when the second polygon's texture was empty (resulting in clip being called in every pixel) and dropping to 415 when it had a colorful for-section square in it (see the picture).

I did try to make sure that Z-test happens: I tried drawing the second polygon first while "rising" it above the ground (polygon #2) and thus bringing it closer to camera - it changed nothing. I also tried removing clip() function from the shader and recieved an FPS boost just as expected. But obviously this produced incorrect results as the ground underneath the second polygon was never drawn as it always failed the Z-Test. So I decided to try using DepthBias to be able to draw two polygons one over another and have no depth-fighting. This is what MSDN writes about it:

  Sets or retrieves the depth bias for polygons, which is the amount of
  bias to apply to the depth of a primitive to alleviate depth testing
  problems for primitives of similar depth. The default value is 0.

  Property Value The amount of bias to apply to the depth of a
  primitive. The value ranges from 0 to 16 (inclusive).

When I finally managed to make it work, I surprisingly got a performance boost. Now the thing is I even managed to gain FPS applying it to the third polygon! This is how I render them to gain the best performance:

GraphicsDevice.RasterizerState = CCWLayer1;
DrawSecond(gameTime);
GraphicsDevice.RasterizerState = CCWLayer2;
DrawThird(gameTime);
GraphicsDevice.RasterizerState = CCWLayer3;
DrawFirst(gameTime);

public RasterizerState CCWLayer1 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.005f,
};

public RasterizerState CCWLayer2 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 1,
};

public RasterizerState CCWLayer3 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.015f,
};

I now 525 FPS and it only drops down to 515 when I draw the huge colored square on the second polygon, which clearly shows that only one set of pixels is being drawn at a time in that particular place (which is similar to EarlyZ test!).

So here is the question: can anyone explain to me what is going on? If I could understand this system better I could make more use of it and gain even more FPS.

Update: now I only draw the two polygons (no other geometry), both using clip(), the one with the colored quad (second) is always closer to the camera. With this code:

DrawSecond(gameTime);
DrawFirst(gameTime);

I get 1.5 ms per frame. With this:

GraphicsDevice.RasterizerState = CCWLayer1;
DrawSecond(gameTime);
GraphicsDevice.RasterizerState = CCWLayer2;
DrawFirst(gameTime);

public RasterizerState CCWLayer1 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.03f,
};

public RasterizerState CCWLayer2 = new RasterizerState()
{
    CullMode = CullMode.CullCounterClockwiseFace,
    DepthBias = 0.045f,
};

I get 1.2 ms.

NO BIAS:

BIAS APPLIED:

sentences:
Create sprite sheet (texture atlas) from video with alpha What's the best way to make a sprite sheet (texture atlas) from a video?

In my case, I have videos of animated character expressions (e.g., smiling, frowning, sad, excited), which I intend to use as frames on quads in my app. I have video sized for retina 2x of a small character, so it's approx 150px square for a 75px character, with alpha/transparency. My animator can output any common format. I'll have 50-100 frames. I do not need a power-of-two size output, any rectangle is ok. I'm working on MacOS.

Is the best workflow still: video -> folder with PNGs -> TexturePacker

Or is there any smarter way to do this? I'll be having a lot of iterations, so I'd like to make it as easy and fast as possible.

There are two older questions from 2010 and 2012 about making sprite sheets.

sentences:
Trying to use an overlapping shader for 2D sprites but sprite wont show its shape So Im trying to use this shader I had from a while ago to implement shadows in a 2D top down game. In order to show clouds on top of the game.
At the moment, Sprites dont overlap which is good, but the shape of the sprite rendered by the sprite renderer is completely different to the one inserted in the sprite renderer, as the sprites in the sprite renderer are circles not squares.
And it seems to cover any other sprite in the scenes which is not what a shade is supposed to be like.

How can I modify the shader so that it respects the sprite. Also I want it to react to lighting the same way as sprite diffuse does.

Shader "Custom/OverlappingDiffuse"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" { }
        _Color ("Tint", Color) = (1, 1, 1, 1)
        [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
    }

    SubShader
    {
        Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" "CanUseSpriteAtlas" = "True" }

        Cull Off
        Lighting On
        ZWrite Off
        Blend One OneMinusSrcAlpha

        Stencil
        {
            Ref 1
            // Comp NotEqual
            Comp NotEqual
            Pass Replace
            Fail Keep
            ZFail Keep
            ReadMask 1
            WriteMask 1
        }

        CGPROGRAM

        #pragma surface surf Lambert vertex:vert nofog keepalpha
        #pragma multi_compile _ PIXELSNAP_ON
        #pragma multi_compile _ ETC1_EXTERNAL_ALPHA

        sampler2D _MainTex;
        fixed4 _Color;
        sampler2D _AlphaTex;

        struct Input
        {
            float2 uv_MainTex;
            fixed4 color;
        };

        void vert(inout appdata_full v, out Input o)
        {
            #if defined(PIXELSNAP_ON)
                v.vertex = UnityPixelSnap(v.vertex);
            #endif

            UNITY_INITIALIZE_OUTPUT(Input, o);
            o.color = v.color * _Color;
        }

        fixed4 SampleSpriteTexture(float2 uv)
        {
            fixed4 color = tex2D(_MainTex, uv);

            #if ETC1_EXTERNAL_ALPHA
                color.a = tex2D(_AlphaTex, uv).r;
            #endif //ETC1_EXTERNAL_ALPHA

            return color;
        }

        void surf(Input IN, inout SurfaceOutput o)
        {
            fixed4 c = SampleSpriteTexture(IN.uv_MainTex) * IN.color;
            o.Albedo = c.rgb * c.a;
            o.Alpha = c.a;
        }
        ENDCG

    }

    Fallback "Transparent/VertexLit"
}

This is how is showing up in the editor:

here is what I want , and want I am getting at the moment:

sentences:
3d compute shaders in order access I'm working on a compute shader for a 3d texture where I want to evaluate pixels in a specific order, is there any way to do this?
let's say that I have made a texture using the following code;

tex = new RenderTexture(64, 64, 0);
tex.volumeDepth = 6;
tex.isVolume = true;
tex.enableRandomWrite = true;
tex.Create();

Now let's say that for example I want to make the following computation on the gpu rather then cpu:

tex[0]=basetex //all values where z =0 are some basic 2d texture
for(int z=1;z<6;z++){ //loop over every z level
 for(int x=1;x<64;x++){ //loop over every x level
        for(int y=1;y<64;y++){ //loop over every y value
         tex[x][y][z-1]=tex[x-1][y][z-1]+tex[x-1][y][z-1]+tex[x][y-1][z-1]+tex[x][y+1][z-1] //add all values next to this pixel on the z value bellow
      }
  }
}

sentences:
Disable default unity editor behaviour on input I'm creating a tool to create scenes easier on edition mode. I'm using the right click to delete elements, and I'd like to be able to delete several elements by keeping the right mouse button pressed and moving the mouse around.

The issue is that when I keep the right mouse button pressed over the scene window, the Hand Tool automatically activates, making the camera pan as I move the mouse.

Is there a way to disable this behaviour?

sentences: Free ebooks about game development Are there good free ebooks on game development? I don't care if they are theoretical or technology specific, I want to start reading one free book that worth it.

sentences:
Translating yaw degrees into 2D movement I've been hitting my head on the wall for a while with this, and I'm almost sure I'm overcomplicating it.

I have a variable for yaw in degrees (and also pitch and roll, but those should be irrelevant). I want to turn that variable into normalized 2D movement, so the distance traveled per frame should always be a constant.

I was easily able to to workout movement when I had a fixed view direction, but translating it with yaw is what's confusing me. I've been trying a combination of converting to radians, then using cos(x) and sin(x) but it only works if I'm looking in a certain direction.

sentences:
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:
Memory dataflow for uniform variables? When a texture (2D) is supplied to a shader as a 'uniform' input, it is first uploaded to OpenGL using glTexImage2D() and then using glUniform1i() it is associated to shader uniform.

eg code :

Texture data

glTexImage2D(): is used to transfer texture data to the server side

glGetUniformLocation(): is used to access shader uniform handle

glUniform1i(): associates the data pointed by texture unit to the shader 'uniform'

but when we pass matrix (eg matrix4x4) to a shader as a 'uniform' input, when don't use any specific function to upload it to OpenGL.

(we just used to glUniform..() to associate the data with the shader input which we also used in the case of texture data)

Matrix data

glGetUniformLocation(): to access shader uniform handle

glUniformMatrix4fv(): to associate matrix data to the shader uniform input.

Where does the matrix data live in each step in the process of passing it to a shader as a uniform input?

Does matrix data always live on client side/ CPU accessible memory and fetched every frame by server side?
If it is uploaded to OpenGL:

which step/function call uploads the data?
where does the data live in OpenGL memory?
how its memory location is pointed?

sentences:
Is it legal to add a cameo appearance of a known video game character in my game? If I am not going to name the character and I use my own original art that very closely resembles a well-known video game character that appears in my game for a very brief moment, is it legal to add a cameo appearance of the character in my game? In an indie game and meant as a tribute to the original game, but I doubt that makes any difference.

Example 1: A scrolling 2D platformer with Super Mario in one level performing a single action and dissapearing afterwards. Not naming the character at all.

Example 2: A video game poster inside the game with Sonic The Hedgehog with or without naming the character, with or without Sega logo.

Fair use doesn't apply here, as I won't be using the art verbatim.
The game might make some money
I don't need to use names, since it is not really necessary, but there is no problem attributing the character trademark holder
I am not going to hold anyone responsible for their answers, you don't need to say "I am not a lawyer" I know a lawyer will probably give me the best answer, but so will probably do indie game developers who used something similar in their game. This is what I am looking for.
The examples given are not real. Just analogy.

sentences:
What are my options for building a centralized server architecture for a Unity game? I have made in the past multiple offline game, and would like to make my first online game. I have very basic knowledge of server structure.

The game is a multiplayer RTS game, with ONE server (If possible in c#), where player can build base, attack other player and move around a world. it is in real time, but slow paced, so not many actions, and every time a user make movement it take let's say an hour to move. The game is planned for Android/iOS and (maybe) but not at all for the moment, web.

The game itself is easy, but the server I don't know where to start and I have been struggling in the last 3 days to find a informations and answer to my question. Most of the example I found are P2P/client-hosted server, this do not apply to my case, I want a single server that runs outside of Unity and that I can run on a computer as stand-alone. My question problems are.

1) for a mobile game, I have seen in some post that UDP TCP/Socket are not available in 3g? is this true ? If so, what should I Use ? I was thinking of websocket since MAYBE i make a web version, but I don't know if it's a good idea, and apparently it is not built in in Unity.

2) Related to my 2) is there any c# library that work in Unity and would fit my game needs? a user would probably load a map, and interact around 20 times with the server during the gameplay. I believe a simple server that get and send message only is largely enough, but I don't know what to use. Start from scratch? then what should I use, TCP ? Socket? WebSocket ?

3) Should I use photon ? I've seen is free to test until 20CCU, and since for probably the next 6month I will be alone on it it's OK, then at release let's say I have 100 player, is not that expensive. Is it a viable solution? I found it a bit overkill for my needs, but it looks documented and easy to start. Will I still learn stuff if I "cheat" like this?

Thank you for your time

sentences:
Replacement for glMatrixMode() in OpenGL 4? In OpenGL version 3.x the function glMatrixMode() specifies which matrix is the current matrix, i.e., which matrix stack is currently the target of all matrix operations based on the parameter, the choices being GL_MODELVIEW, GL_PROJECTION, and GL_TEXTURE.

glMatrixMode() had been deprecated in OpenGL version 4.x.

I have tried to find the equivalent way of performing the same effect in 4.x without success.

I suspect there has been a change in philosophy in OpenGL 4 which I am overlooking.

How is the glMatrixMode() equivalent performed in OpenGL version 4.x?

sentences: Another app has the same name as mine on the appstore! I am about to publish a game on the android playstore and the ios appstore. It is called "PairIt". I checked a while back to see if there were any other apps named PairIt on the playstore, and there were none. But I did not check on the appstore. Yesterday, when I tried publishing my app onto the appstore, it said the name was taken. After looking around on the appstore I saw someone else had an app named PairIt. So what I did was changed my app name to "PairIt!". Will this work? Could I get into any legal troubles for this?

sentences:
LibGDX: Can i get some useful tips for loading textures? So basically in my game(completely new to gave dev) I have a level select screen. I have 8 Buttons to select the levels and i use an asset manager to load the textures for the buttons. For example their is a locked button for when you have unlocked the level, an active for when your mouse is over the button and inactive when your mouse is not over it. My problem is that having all these textures keep interchanging is causing memory usage to go off the charts, from as low as 30mb all the way over 1000mb as soon as i go to the level select screen and it keeps rising. Whats a good way to load lots of textures without having to use so much memory? Or should i just figure out a better way to load them without causing so much usage of memory. Im new to this so go easy on me :)

or... Would this amount of memory being sprung be a memory leak somewhere?

Edit: Heres the code snippet where the memory leak i traced to i believe.

I'm calling this method in my handleInput which i then call in the render method.

public void levelManager(float rowX, float rowY, Screen setScreen, Texture drawActive, Texture drawInactive,
        float multiplier) {
    if (Gdx.input.getX() / GravitySpikesRevamped.PPM < (rowX + BUTTON_WIDTH) / GravitySpikesRevamped.PPM
            && Gdx.input.getX() / GravitySpikesRevamped.PPM > rowX / GravitySpikesRevamped.PPM
            && (GravitySpikesRevamped.GAME_HEIGHT - Gdx.input.getY())
                    / GravitySpikesRevamped.PPM < (rowY + BUTTON_HEIGHT) / GravitySpikesRevamped.PPM
            && (GravitySpikesRevamped.GAME_HEIGHT - Gdx.input.getY()) / GravitySpikesRevamped.PPM > rowY
                    / GravitySpikesRevamped.PPM) {

        if (multiplier == 1) {
            game.batch.draw(drawActive, BUTTON_WIDTH / 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 2) {
            game.batch.draw(drawActive, BUTTON_WIDTH * 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 3) {
            game.batch.draw(drawActive, BUTTON_WIDTH * 3.5f / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        }

        if (Gdx.input.isTouched()) {
            game.setScreen(setScreen);
        }
    } else {

        if (multiplier == 1) {
            game.batch.draw(drawInactive, BUTTON_WIDTH / 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 2) {
            game.batch.draw(drawInactive, BUTTON_WIDTH * 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 3) {
            game.batch.draw(drawInactive, BUTTON_WIDTH * 3.5f / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        }
    }

Okay i solved it, basically in my method above every time i called it was creating a new screen. So i basically was creating infinite amount screens in memory. I fixed it :]

sentences:
How to tell which segment user is interacting with in dynamic road building system? Im prototyping dynamic road building system as seen in most city builder games. I gather the points from user input (red dots) and programmatically generate mesh.

It's currently one big mesh, seems like a good default rendering performance wise.

Starting a new road/creating intersection from already existing road is a very important feature. Everything is pretty straight forward except how to know which segment user is hovering, clicking.

Options:

split segments into separate gameobjects and attach collider to each
use single big mesh and create empty gameobjects for colliders only

Is there a better way besides these two? That would be a lot of colliders if you consider the scale of city builders. I suspect there's a smarter way..

Note: on the other hand, if user adds new intersections, updating a huge mesh could be a problem. If I split meshes into reasonable chuncks, I could localize updates to only affected meshes.

Simplified data structure:

public class Road {
    public List<Segment> segments;
}

public class Segment {
    public Vector3 start;
    public Vector3 end;
}

sentences:
Why would the same script attached to multiple scenes not work the same way in some of the scenes? I have 4 scenes in my Unity Project. And in each scene I have identical sliders, what I want to do when Advance_Trial is called via a button press, the sliders' value resets to 0. However, this only works for two of the scenes. For remaining two it doesnt work, I checked if Advance_Trial is attached to the button gameobject which calls it and it is (in all scenes).  There are no errors messages in the console either.
How do I correct it?
Also, when the else portion is executed the sliders are not inactive meaning, the sliders are still visible. This happens for the same two scenes for which the sliders do not reset.
Am I missing something? Or do I need to check something in individual scenes?
Please see my code below.
public Slider[] sliders;

    public void Start()
        {

            sliders = FindObjectsOfType<Slider>() as Slider[];

            for (int s = 0; s < sliders.Length; s++) //Resets the sliders
            {
                sliders[s].gameObject.SetActive(false);
            }
    }
     public void Advance_Trial()
        {
            for (int s = 0; s < sliders.Length; s++)
            {
                sliders[s].value = 0;
            }

            int stimIndex = UnityEngine.Random.Range(0, signals.Count + 1);
            string text = stimIndex.ToString();
            byte[] data5 = Encoding.ASCII.GetBytes(text);
            client.Send(data5, data5.Length, remoteEndPoint);
            Debug.Log("<color=yellow>Signal played is:</color>" + stimIndex);
            Debug.Log("<color=magenta>NUMBER sent to MAX is:</color>" + text);

            Debug.Log("<color=magenta>Index removed was :</color>" + signals[stimIndex]);
            signals.RemoveAt(stimIndex);

            if (signals.Count > index)
            {

                Debug.Log("<color=orange>Yay! Keep Listening!</color>");
                index++;
            }

            else
            {

                Debug.Log("<color=green>All Trials finished</color>");

                for (int s = 0; s < sliders.Length; s++)
                {
                    sliders[s].gameObject.SetActive(false);
                }

                EndSessionPanel.gameObject.SetActive(true);
            }

        }

sentences:
What torque should I apply in Bullet to maintain a vertical orientation? I have a RigidBody in Bullet. Each frame, I want to apply torque to correct its orientation toward an upright position (i.e. near-zero pitch and roll). I know its angular velocity and orientation.

Bullet is not very well documented. I don't even know what the parameters to btRigidBody::applyTorque() mean.

How should I approach this?

sentences:
Slerp to slerp smoothing p0 ------- p1 ------- p2

I am successfully slerping between 2 points (p0-p1; p1-p2). But the transition between two slerped angles (p1_in-p1_out) do not match, and it looks jarring

Video of how it looks:

green squares are points, the position and angle between each are interpolated.

The issue is most visible at second 6.00

https://gfycat.com/unhealthygraveduckling

I tried hermite splines, although it reduces the effect, it's still visible.

I tried converting Catmull-Rom to use with quaternions by just adding the 4th index to the vector functions. This works perfectly except on some occasions, where some are interpolated from the wrong (long) "way", causing the view to flip between those points. I tried aligning, did not help.

Other questions on SO related to slerp don't ask this question, and I could not get any usable answers from some questions on 4 point slerps.

Is this a common issue, am I overseeing something?

Thanks

sentences:
How to adapt pathfinding algorithms to restricted movement? Imagine car-like movement where entities cannot turn on a dime. Say, for the sake of discussion, that when at-speed they can turn 90 degrees per second. This would in many cases change the optimal path and therefore the pathfinding. It may even make 'usual' paths entirely impossible to traverse.

Are there any pathfinding algorithms or movement planning algorithms that can keep this in mind, or are there simple ways to adapt the popular ones?

sentences:
Strange I'm getting exception but the scripts in the exception message are not exist on my pc. What should I do? I'm using unity version : 2019.2.5f1 personal

I searched on my hard disks the entire pc and none of the scripts in the exception message are exist. And the exception is happens only sometimes. When I stop the game in the editor by pressing the play button the exception is show sometimes and sometimes not.  I tried to close and open over agai the unity editor and the project. Still strange.

  MissingReferenceException: The object of type 'ReflectionProbe' has been destroyed but you are still trying to access it.
  Your script should either check if it is null or you should not destroy the object.
  UnityEditor.ReflectionProbeEditor.OnPreSceneGUICallback (UnityEditor.SceneView sceneView) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ReflectionProbeEditor.cs:651)
  UnityEditor.SceneView.CallOnPreSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3359)
  UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1935)
  UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2320)
  System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
  Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRChainBuilder.cs:238)
  UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:66)
  UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:54)
  UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:72)
  UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:637)
  UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
  UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
  UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

sentences:
How to map interaction events to game actions When I port between Desktop games and Mobile games, I find I always make a kludge out of the interaction events.

I typically end up hard-coding event handling for mobile, and event handling for the desktop in completely separate systems.

On mobile, I need to track multiple touches.

On desktop, I only have a single mouse pointer.

But on desktop, there is a concept of "hovering" above something with a mouse.
There is no such thing on mobile.
Or pressing a modifier key like SHIFT or CTRL while clicking a button or pressing a key.

I want to design an API that I can use on both mobile and desktop that is able to translate an interaction (by user) to an action in my game world.

Are there any design patterns that I can follow, or some abstract model I can use for this? How do people successfully marry the desktop and mobile port of a game?

So in the same code-base, maybe assign Alt+Left-Click to a certain game function, but on mobile have that done via a gesture.

On Desktop, I currently use SDL2's SDL_Event. On Apple, is use UIEvent, and on Android I use NDK's AInputEvent.

sentences:
Will an optional device type specific permission hide my game in the Play Store for those types of devices? I have heard in many places that if my app uses a permission not applicable to a certain device, it will not show up in the play store for that device. Now, in my code, I am playing audio. I mute that audio whenever there is a phone call by doing this:

 private PhoneStateListener phoneStateListener = new PhoneStateListener() {
        @Override
        public void onCallStateChanged(int state, String incomingNumber) {
                if (state == TelephonyManager.CALL_STATE_RINGING) {
                    onPhoneCallInterrupt(); //Method I made that mutes audio for phone call
                } else if (state == TelephonyManager.CALL_STATE_IDLE) {
                } else if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
                    onPhoneCallInterrupt(); //Method I made that mutes audio for phone call
                }
        }
    };

Now, this uses the following permission in the manifest:

<uses-feature android:name="android.permission.READ_PHONE_STATE"  android:required="false" />

Will I get any exceptions because I have made the permission optional by doing android:required = "false" on devices that don't have phone compatibility (tablets)?

The reason I am so confused on this, is because I am checking if the phone is being used, but I am not using it. So, will my app work on tablets, let alone show up in the play store for them?

Thanks for helping me clear up this confusion,

Ruchir

sentences:
How does a game like Minecraft generate new chunks in realtime? I imagine looping through all 65,536 blocks with a noise function to set their type would be very slow. And Minecraft usually generates a ton of chunks at once. I read in one source online that Minecraft creates a column of 16x16x16 chunks, although I can't find any more information on that subject, and that doesn't really change how many blocks there are in one chunk "column". I assume there are optimizations made to make it work, although I can't find much about this subject online.

Edit: The way I am generating chunks in my own (2D) game is by looping through a 16x16 array using a Perlin Noise function for every chunk. With 16x16 chunks it runs fine in realtime. I want the chunks to be 3600 tiles high, and changing the size to be 16x3600 runs very slowly.

sentences:
Is there a way to set a pallet for colours in an SVG image and change them at runtime for one gameobject? in the latest beta build for unity they introduced the ability to import svg files. What I'd like to know is if there is a way to identify all svg shapes by colour, and then change those colours, as if you were changing a class in CSS.

I suspect that you can go into an svg file, find where the text for colour is found and then change it, but I'm worried it'll change it for any object that use that svg file instead of changing it by gameobject.

The thing I'd like to do here is have customizable characters in a fighting game, where you can go into the menu and change their colours on a slider. so if I can identify like 3 colours in an svg and list them, and then edit those values in runtime or load, I'll have what I need

sentences:
Silverlight scrolling with camera I'm trying to get my head around scrolling a 2D map that uses a physics engine. If I was to launch a projectile, would I actually be applying the physics to the background images rather than the projectile itself? I'd like to keep the projectile at the center of the 'camera', but I'm not sure how to do this in Silverlight. I thought of using a translate transform to constantly scroll the parent canvas's position, but is this the best way of doing this in Silverlight?

Edit - I'm using Farseer Physics with the Physics Helper library.

*Edit 2 - Solution *

It turns out the MSI installer of the Physics Helper installs an older version that had a broken camera. I downloaded and recompiled the latest source version and it now works!

sentences:
Do I need to dispose Pixmap in Actor? I create Pixmap in Actor and don't know how to dispose it. Is it necessary in my case?

class MyActor(x: Float = 0f, y: Float = 0f): Actor() {

    var pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
    var texture = Texture(pixmap)
    var sprite = Sprite(texture)

    init {
        setPosition(x, y)
        sprite.setSize(32f, 32f)
        sprite.setPosition(this.x - sprite.width/2, this.y - sprite.height/2)
    }

    override fun act(delta: Float) {
        sprite.setPosition(x - sprite.width/2, y - sprite.height/2)
    }

    override fun draw(batch: Batch?, parentAlpha: Float) {
        sprite.draw(batch)
    }
}

sentences:
WebGL half float equivelant? I'm trying to find a half float for the purposes of doing math in a fragment shader, not trying to have a half float texture.

Is there an equivalent of the half float data type in WebGL?
I know you can create a lowp float, but is that the same, or not necessarily?

sentences:
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:
Organizing movement, collision detection, and collision resolution There's many articles on the internet focusing on how to implement movement, collision detection, or collision resolution. What I'm wondering is how to put them together, specifically in what order to perform them.

Should one iterate through all physics objects and do movement, collision detection and resolution for each (approach A), or perform movement for all objects, then detect all collisions, and finally resolve all collisions (approach B), or some combination thereof? Is there an approach that is universally superior? If not, what are the pros and cons for each approach (including ones I haven't listed)?

Approach A:

for (all objects)
    object.move
    object.detect_collisions
    object.resolve_collisions

Approach B:

for (all objects)
    object.move

for (all objects)
    object.detect_collisions

for (all objects)
    object.resolve_collisions

sentences:
Capsule getting stuck on edge of block I'm making a first person game and when I jump and my character gets close to the top of the wall, the vertical movement stops, jitters, or suddenly snaps to the top of the wall.
Video
Here is my character controller code, based on this tutorial:
using UnityEngine;

[RequireComponent(typeof(CharacterController))]
public class PlayerController : MonoBehaviour
{
    private InputManager inputManager;
    private CharacterController controller;
    private Vector3 playerVelocity;
    private bool groundedPlayer;
    [SerializeField] private float playerSpeed = 2.0f;
    [SerializeField] private float jumpHeight = 1.0f;
    [SerializeField] private float gravityValue = -9.81f;

    private Transform cameraTransform;

    private void Start()
    {
        controller = GetComponent<CharacterController>();
        inputManager = InputManager.Instance;
        cameraTransform = Camera.main.transform;
    }

    void Update()
    {
        groundedPlayer = controller.isGrounded;
        if (groundedPlayer && playerVelocity.y < 0)
        {
            playerVelocity.y = 0f;
        }

        Vector2 movement = inputManager.GetPlayerMovement();
        Vector3 move = new Vector3(movement.x, 0f, movement.y);
        move = cameraTransform.forward * move.z + cameraTransform.right * move.x;
        move.y = 0f;
        controller.Move(move * Time.deltaTime * playerSpeed);

        // Changes the height position of the player..
        if (inputManager.PlayerJumpsThisFrame() && groundedPlayer)
        {
            playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
        }

        playerVelocity.y += gravityValue * Time.deltaTime;
        controller.Move(playerVelocity * Time.deltaTime);
    }
}

I also tried using other solutions by changing the physics material of the level and player, neither worked.

sentences:
I want to implement free-running movement (like Assassin's Creed) in 2D. What to do? I would like to implement free-running as popularized by Assassin's Creed, albeit in 2D.
What are some specific techniques or algorithms that I can use to achieve free-running in 2D without having to reinvent everything?

I tried to Google for resources, but couldn't really find any leads (no surprise there). Ideally, I'd like to know how did Assassin's Creed did it.

sentences:
Colour values of a pixel array from a spritesheet image wrong (C++, SDL2) So basically what i want to do is create a 2D tile based rendering system in C++ that renders each pixel on the screen manually.
Rendering an individual pixel on the screen works just fine (or render the whole screen blue for example).
But i want to load the individual pixel colours of my sprites out of a spritesheet image and heres my problem:

I am able to create the image and access the pixels of the image, however the individual pixel values seem to be wrong. (I compared the pixel values with the supposed hexadecimals on paint.net)

Heres my code for the spritesheet:

    SpriteSheet::SpriteSheet(std::string path, int tileWidth, int tileHeight)
    :
    path(path),
    tileWidth(tileWidth),
    tileHeight(tileHeight)
{
    image = IMG_Load(path.c_str());

    if (image != NULL){
        width = image->w;
        height = image->h;
        pixels = (Uint32 *) image->pixels;
        std::cout <<std::hex <<  pixels[17] << std::dec << std::endl;

        //this prints out: 3030303 when it should be FF007F46

    }
    else{
        std::cout << "SpriteSheet couldnt be loaded!" << std::endl;
    }
}

Note that the pixel format is: AARRGGBB

Edit: I tried using a ".jpg" instead of a ".png" and i got different colour values again, but still not the right ones.

Edit2: I'm pretty sure the pixel format in which my image is getting loaded in is wrong.
Any ideas how to get it to ARGB8888? I tried using SDL_ConvertSurface and SDL_ConvertSurfaceFormatbut i can't seem to get it right.

sentences: How is the Unreal rendering pipeline implimented? I know this seems like a very broad question, but i am just interested in getting to know how the Unreal engine's rendering pipeline looks like, specially how it handles meterials, different types of lighting, and post processing. I know that Unreal4 uses differred shading, but how does it handle things like translucency, reflections, etc. I do not have access to the source code, that's why I asked this question here. You could even direct me to the source of the rendering part if available.

sentences:
How can I dynamically switch between graphics APIs? In games like the new "Doom", you have a console, from which you can use commands to reduce the game's quality or even to switch graphics API, from Opengl to Vulkan and viceversa.

How is this done? I think it reconstructs the window context based on the chosen graphics API (maybe?). How could this be implemented?

sentences:
How to orient hands(or spine) to always look at some target? I am building an FPS game in Unity 3D everything was going cool but when I tried to implement aiming for the rifle everything just broke.

1): I have an IK setup which triggers when you equip weapon, this IK only calculate the hand position and orientation needed to hold the gun and after that the IK system disables itself, basically I am using IK for getting the proper hand position on different guns.

2): Once hands are positioned correctly on the gun then I rotate the hands(or spine, which will rotate hands and head with it) with the mouse to look up, down, right and left.

3): Handgun is very easy to handle, equip it and rotate the arms, arms are almost straight along the z-axis so I just rotate them on the y-axis to aim upward and downwards.

4): With the rifle, I can calculate the hand position and rotation to hold the rifle easily but (because static animation pose of holding he rifle is little oriented to make the player little realistic) when I rotate arms they rotate weirdly.

I checked in the editor by changing the y-axis of the rotation and found that only y-axis can't rotate the arm the way I want and to rotate it that way other axis must change their values. I searched a bit and found that it is a situation called as Gimbal Lock which is very common with euler rotations, I tried many things but still can't fix it.

Original Code:

        leftArm.transform.localEulerAngles = new Vector3(leftArm.transform.localEulerAngles.x,
        leftArm.transform.localEulerAngles.y + (currentCamRotX + offset),
        leftArm.transform.localEulerAngles.z);

        rightArm.transform.localEulerAngles = new Vector3(rightArmFPS.transform.localEulerAngles.x,
        rightArmFPS.transform.localEulerAngles.y + (currentCamRotX + offset),
        rightArmFPS.transform.localEulerAngles.z);

It works great with Handgun but not with Rifle.

I read about and tried following but in vain:

    //Method 1: Failed
    var target = camera.GetChild(0).GetChild(0);
    var direction = target.position - rightArmFPS.position;
    var toRotation = Quaternion.FromToRotation(rightArmFPS.up, direction);
    rightArmFPS.rotation = Quaternion.Lerp(rightArmFPS.rotation, toRotation, Time.deltaTime * 5);

    //Method 2: Failed
    var targetForward = target.position - spine.position;
    targetForward.Normalize();

    var rotAxis = Vector3.Cross(Vector3.forward, targetForward);
    var angle = Mathf.Acos(Vector3.Dot(Vector3.forward, targetForward)) * Mathf.Rad2Deg;

    spine.eulerAngles = rotAxis * angle;

What I am looking for now is if someone can point me what topic I should be looking in(because my poor maths skills are really getting me and I often use very poor workarounds for what could be solved easily with maths or physics), pseudo code to get me started or anything that might help me resolving this issue.

I know there are bunch of other ways to achieve what I am looking for and I have tried many of them like: using IK to position hands and then moving the guns up or down or having animations for each gun aiming up or down but honestly each method has it's own drawback(or its just me who is too noob for these things).

I followed this solution: Orienting a model to face a target

and many others, you might find it duplicate but none of the post on the internet has solved my problem(it is second day and I still can't figure this out).

Hope you understood the question and thanks for reading this:)

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: Vector2 always starts from origin I am trying to create Vector2 which starts from the players sprite and points towards other point. And I need its starting point to move along with player sprite. But however whatever I do all my vectors start from the origin and point towards the point I want. Is there any way to make Vector2 to start from the

sentences:
How to obtain "annealing" effect via particle system In this video demonstration, there is the annealing effect, where particles seems to loose their hue and converge into pure white, and then gradually disappear via alpha channel. And in parallel to all of this: particles are gradually becoming thicker.

I tried with my particle system and it is giving different results. How to obtain the "annealing"?

sentences:
Does it make sense to use Lua scripting in a game developed in Python? Well for C++ written games using Lua scripts for easy changing ai, quets etc is very reasonable and it's common. However now I'm going to write a game in pure python and I don't know if I should use Lua. Python itself is very high level script language. However, there are things to consider why I could use lua scripts:

Lua is commonly used for game scripting and other people who will work with me know Lua and don't know python
Python module to embed lua code into python uses very fast JIT compiler so the lua code actually would be much faster than python code (big plus for AI)
It would separate the game engine itself (Python) from the scripted logic (Lua)

Do python games use Lua? Is it a resonable thing or I should just stick to pure python? I need some advice because I have no idea.

sentences:
Microsoft and media - using the new stuff Over the past 5 or so years, Microsoft has released APIs / that is intended to replace older APIs:

(2006) Direct3D10
(2009) Direct3D11
(2008) XAudio2 / deprecates DirectSound
(2006) Windows Media Foundation / replaces DirectShow

But 66% of Windows users are still on Windows XP as of Oct 2010.

Win XP doesn't and won't have:

Windows Media Foundation
Direct2D
DirectWrite
D3D10
D3D11

There's a lot of cool stuff in these API's!  My question is is there any point, as a game dev, in migrating to the newer technology while you still have to support the old technology and provide a similar gaming experience?

Microsofts refusal to support D3D 11 on XP means there are some cool shader FX that are only supported on Windows 7 machines, such as geometry shaders

http://knol.google.com/k/-/-/2lijysgth48w1/8oyyfu/image2.png

But its generally not that acceptable to say something like "Hey those cool geometry shader FX only show up if you're running Windows 7!"  Suddenly you as a game developer are part of the angry microsoft upgrade push.

UPGRADE YOUR SYSTEM SO YOU CAN PLAY THE GAME!

love,
Microsoft

My point is, if I write code for D3D11, and then I'm going to have to double-up and dupe the rendering code on D3D9 and work extra hard to manually reproduce the stuff that APIs like DirectWrite do for me so easily, why should I bother learning D3D11 at all?

sentences:
Designing a simple snake A.I I've looked at some stuff online regarding this specific topic, and a lot of the info that I read involved graphs and path finding.

I really don't want to get involved in something too complex & out of my level, and also I don't need my snake to be that intelligent (it will be a large board with the snake not growing in size on every munch).

How could you structure a simpler AI for the snake that gets the job done relatively well? I would be able to get the snake to move towards the food item correctly, but my issue is that I'm not sure how to deal with the snake colliding with itself. Say the snake has a look ahead, and it finds that its tail is in the way, it could change direction, but what happens next?

Any ideas on how to tackle this? Should the snake build an instruction set from every square, or should it think on the go?

sentences:
Will the inclusion of LGBT characters in my game detract from possible sales? As we all know, the inclusion of LGBT characters has been a mighty controversial topic in recent film and literature (Beauty and the Beast probably being the premier example). Some love it with every fiber of their being, while others absolutely detest the very thought of it. Now, keep in mind that I am not here to start a political firestorm nor am I here to preach my own personal beliefs regarding this, I'm simply asking the question: will the inclusion of LGBT characters decrease potential sales?

In our game, a pseudo-'90s JRPG, one of our main story writers added two consuls (of a civilization with heavy Roman influence, but with different laws), both female, married. Originally hailing from an area in which LGBT relationships are looked down upon, I was quick to note that it may be too much controversy, but it truly depends on where you live—for him it was almost completely normal.

As I see it, we have three choices.

We can keep the characters just as they are.
We can keep the characters, but only imply their relationship.
We can alter the relationship entirely, changing one to a male.

Right now, our main goal is to satisfy the general public while still strongly appealing to those who actually played JRPG's such as Dragon Quest or Final Fantasy back in the day. Which of these three options should we choose to best enhance our sales, or, if it's not up there, what is the wisest way to go about doing this? I am looking for facts and data if possible and/or applicable.

EDIT: Our target audience is Everyone! Like we said, we’re aiming to satisfy the general public while still appealing to those who played JRPG’s back in the ‘90s.

EDIT II: Wow. Every almost answer here contained a wealth of information, and I'd like to formally thank all that contributed. I will be using the information from just about all of these answers, and I'm sure may others facing this issue may as well.

EDIT III: If you have comments that aren’t answers or you’d like to further discuss this, please refer to the official chat room as opposed to commenting. Thanks!

sentences:
How can i add spaces between gameobject when Instantiate? void Update()
    {
        if (Input.anyKey)
        {
            foreach (Transform child in go.transform)
            {
                if (Input.inputString == child.name)
                {
                    Instantiate(child);
                }
            }
        }
    }

I want to Instantiate the gameobjects with a space between each one that i will set with public variable. And that the gameobjects position will start from the 0,0,0 of the terrain.

For example like that:

sentences:
iOS Game that Runs Continuously in Background I'm trying to understand the most logical way of creating an iOS game that runs continuously in the background.

For example.. you have tower and enemy waves. The game has endless enemy waves even when the game exits. When you open the game again, it will retrieve the data that occurred when the app was closed.

I assume a database on a server would be the best solution. The values continuously increment on the server. The game connects to the server and retrieves the specific user's updated game data.

sentences:
2d block based game storing water simulation I am making a 2d block based sandbox game like terraria.

I'm trying to think where is the better place to store water in, data structure wise.

That is, to store it in the block world array, or to store it in its own sparse data structure. Does doing this have any benefits?

If I store it in the world array I have to store the fluid level (which would be like 16 levels possible). The other way I could simply have a fluid cell struct or something.

It might make things more clear separating it, but not sure if it would possibly affect performance either way.

In a game like this, the simulation is of course usually done via cellular automata (just in case that affects which data structuring I should use)

sentences:
Calculating specific coordinate along a path Let's say I have a path comprised of a sequence of points that are connect by lines and arcs. The entire path has some specific length. Let's call that length 100.

What would be the mechanism to determine the exact x,y coordinate for any given point on that path?

meaning...

 Path path = new Path();
//fill in various lineTos and arcTos to the path here
....

Point p = getCoordsFromPath(path, 50.0f); //get the coords at the half way point on the path

Point getCoordsFromPath(Path inP, float position){
    Point ret;
    //do some magic and get the x,y at the point in the path
    //that is the position distance from start

    return ret;
}

TIA

sentences:
Source Engine - Getting team score How can i get teamscore in code?in hl2mp_gamerules.cpp i found this:

        CTeam *pCombine = g_Teams[TEAM_COMBINE];
        CTeam *pRebels = g_Teams[TEAM_REBELS];

        if ( pCombine->GetScore() >= flFragLimit || pRebels->GetScore() >= flFragLimit )
        {

And here's how i modified in my .cpp file:

CTeam *pRebels = GetGlobalTeam( TEAM_REBELS );
CTeam *pCombine = GetGlobalTeam( TEAM_COMBINE );

CBasePlayer *pPlayer = UTIL_PlayerByIndex(engine->GetLocalPlayer());

  if(pCombine->GetScore() == 1)
  {
    vgui::surface()->DrawSetColor(GetFgColor());
    vgui::surface()->DrawSetTexture( m_nTeamBlue );
    vgui::surface()->DrawTexturedRect(0, 0, GetWide(), GetTall());
  }

But it says: pRebels, pCombine, cTeam are undeclared identifiers. How can i declare them? Or what .h file i need to include?

sentences:
Problems with Creating Snake's Clone on Java I'm creating Snake's clone. My app have too classes: Snake.java and Board.java.

Right now I have three problems:

1) There are two constants - BOARDS_WIDTH, BOARDS_HEIGHT. They are meant to be dimensions for playground where snake moves and collects apples. It's dynamic and I can set them as I want. For example 640 x 480, 160 x 160 or whatever. Only thing I need to keep in my mind is that both numbers must divide with 16. Why? Because constant UNIT is set to 16 x 16 and, for example, when board's dimensions are set to 160 x 160, it means that there would be 10 x 10 units large playground (160 / 16 = 10). Problem: playground is always two pixels (not units) larger than it meant to be. Like if I have set dimensions to 160 x 160, actual dimensions will be 162 x 162! Here are screenshot...

If you measure this image... after pill (apple, if you like) there are two extra pixels.

2) Collisions. I think - it's because problem #1. You see, there are code lines...

if( x[0] < 0 || x[0] > BOARDS_WIDTH || y[0] < 0 || y[0] > BOARDS_HEIGHT ) {

    inGame = false;

}

They should prevent snake from going into walls. Actual result is that snake goes few units in the wall - then only the game stops... i want it to stop exactly when snake collide with the wall!

3) How to make snake start to move only when users clicks any of arrows? Right now it's like snake starts to move her body, but her head is stopped. After joints * DELAY snake's all joints are under her head! Ha, ha...

sentences: Material colours in unity not displaying correctly? Even though I've picked blue the color is displayed as something pinkish. All colors are like this

sentences:
GameMaker: Studio - Slow down calculations I currently have an orbital simulator, with a brilliant answer in another Game Development question here, and would like to know how to slow down the calculations of Game Maker, to be able to do more precise ones as my orbits suffer variably intense Apsidal Precession.

Examples of this can be found in games such as Kerbal Space Program and
Universe Sandbox 1/2. In KSP, you have the Max Physics Delta Time which allows slower gameplay, but more calculations. In Universe Sandbox you are able to change the accuracy of calculations causing orbits to go crazy and extremely precise.

How am I able to implement such a thing into GameMaker: Studio?

sentences:
Getting location / bounds of centered text I want to show a dialog box where the user should answer a question.
It would look like this:

The question is aligned horizontally.

I don't show the entire question text right away, but it builds up character by character like this:

To do that, I store the text string in a variable at the script start, then I set the text to "", and in a coroutine I add character after character to the text component.

My problem is that (because of the horizontal alignment) Unity wants to build it up starting from the center like this:

Since this is not what I want, I was thinking that I should perhaps measure the bounds of the entire text while it is horizontally aligned, then I would turn off the horizontal alignment and make it left-aligned instead and set its position according to the measure bounds.

However, I don't know if I can measure the bounds of the text anyways.

Can anybody suggest how to handle this problem?

sentences:
Code reuse for a CRPG data model on the server-side I'm working on a turn-based game with CRPG (Computer RPG) elements in HTML5. It has to support 10K+ CCUs (Concurrently Connected Users).
The CRPG elements in the game are item and character systems:

The game has characters, characters have items.
Items may be worn or used as consumables.
Items may be crafted and upgraded.
Characters gain experience and get new levels.
Characters and items have characteristics (like health, attack strength etc.).
Characters may have buffs and debuffs placed on them that affects characteristics.
Characters have talents that acts like permanent buffs or debuffs.
Items worn and consumables used may affect character characteristics.
Characters may strike each other, and strike outcome is calculated based on the effective characteristics of the attacker and target.

All of the above has to be stored and handled on the server-side.
To avoid developing everything from scratch for the 100th time, I'd like to maximize my reuse of existing code: original, free, or commercial.
I can adapt the CRPG model requirements to the implementation limitations to a certain (considerable) extent. Technology stack does not matter much either — as long as it is reasonably scalable.
How can I author my server-side solution to maximize code reuse?

sentences:
How wise is this multithreading architecture? I'm rewriting a game engine I wrote in an attempt to parallelize as much as possible. I'm considering making properties which may be accessed from multiple threads all use accessors which use boost scoped_locks to avoid race conditions.

So then this way, say I have a character with base class CharacterBase. The X/Y/Z coords of the character are controlled through accessors with scoped locks. The main loop has 3 threads running, one to process physics, one to process rendering and one to process user input etc.

This will result in scoped_locks basically being everywhere and explicitly required by design when users are extending the engine. I am planning on making this open source so I'm wondering if there are any significant flaws or draw-backs in this design either from a technical perspective or end-user perspective (for those extending the engine). Thanks!

sentences:
Libgdx, TiledMap, and tearing My TiledMap tears when the window is specific sizes, resized, or the camera moves.

The tileset is padded by 2px and have tried as high as 10px. Each tile is 70x70.

Here are the pack.json settings,

{
    paddingX: 2,
    paddingY: 2,
    bleed: true,
    edgePadding: true,
    duplicatePadding: true,
    maxWidth: 4096,
    maxHeight: 4096,
    filterMin: Nearest,
    filterMag: Nearest,
    ignoreBlankImages: true,
    wrapX: ClampToEdge,
    wrapY: ClampToEdge,
    grid: true,
    fast: false
}

Here is the code.

Parameters params = new Parameters();
params.textureMinFilter = TextureFilter.Nearest;
params.textureMagFilter = TextureFilter.Nearest;
TileMap map = new TmxMapLoader().load(file.getAbsolutePath(),params);

So what am I doing wrong? If nothing, does that mean libgdx absolutely cannot handle TileMaps of any sort?

sentences:
Not able to find the constraints option in the Rigidbody component I am working on a game tutorial right now and I need to freeze constraints for a model prefab. I add a Rigidbody component and I want to freeze rotations on the x and z axes. However, I am not able to find the option in the component. Is there another way to access rotation constraints (I do not want to code the constraints at the moment)? Or is there something I am missing in the new version. Please do let me know. Thanks

I am using Unity 5.6.7f1 Personal

sentences:
Class design and data structures for a Tower Defense I was trying to come up with a structure for a simple TD game that has following elements

Tower
Each Tower has a set of properties like range, damage, health etc
There could be different types of Towers with different attack types. For eg Tower A can perform attackType 1 and 2 and Tower B can perform attackType 3 and 4
Creep
Each Creep has a set of properties like damage, health, bountyPoints etc.
There could be different types of Creeps with different abilities just like the Towers

For now I am trying to come with a good design that is scalable and well structured for the above two game elements

This is the skeleton of a Tower class that I have come up with so far. Please comment and suggest changes. Any design patterns that could make life easier

using System.Collections;
using System;

    public enum TowerType
    {
        tA,
        tB,
        tC
    };

    public class Tower {

        private TowerType type;
        private int damage;
        private int range;
        private int health;

        public Tower(TowerType type)
        {
            this.type = type;
            initializeVariables();
        }

        private void initializeVariables()
        {
            if (this.type != null)
            {
                if (this.type == TowerType.tA)
                {
                    this.damage = 20;
                    this.range = 40;
                    this.health = 50;
                }

                else if (this.type == TowerType.tB)
                {
                    this.damage = 30;
                    this.range = 50;
                    this.health = 60;
                }

                else if (this.type == TowerType.tC)
                {
                    this.damage = 60;
                    this.range = 60;
                    this.health = 80;
                }

            }
        }

        public int getDamage()
        {
            return this.damage;
        }

        public int getRange()
        {
            return this.range;
        }

        public int getHealth()
        {
            return this.health;
        }

        public TowerType getTowerType()
        {
            return this.type;
        }

        public string getType(int value)
        {
            return Enum.GetName(typeof(TowerType), value);
        }
    }

So using enums to define various types of towers. But is this a good design? Each Tower would have different damage, range and health.

What if there are 100 different towers? So in my InitializeVariables() would have a cluster of 100 if else statements. How can I improve on this or is there a better way to implement this?

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:
Game networking , server send rate I've been writing some server code recently and I ran into a bottleneck.
If a server is capable of sending data at 60hz, with 1 client it would send data to that client at 60z, with 2 clients this would drop to 30z, then with 3 clients to 20hz,etc... This is because the server can only send data to one client at a time, Is my logic correct here? For example, if I had 50 clients and I wanted each client to receive 60 updates per second the server would have to tick at (60hz x 50 clients)  3000hz!?

Is there a more efficient way this is done?

sentences:
LibGDX - Draw rectangular shapes I'm making a 2d game in which units occupy a dynamic area of the map.

This area will be a rectangular shape like in the following picture. The exact shape will change during gameplay.

How should I draw these shapes?

Should I use a mesh for this? If so, how would I find the vertices of the shapes?

Can I somehow use a "mask" for this? Render a filled rectangular and then subtract those parts which are outside of the shape maybe?

Optional questions: How would I draw a stroke / outline around the whole outer edge of the shape?

sentences:
Unity - AudioClip lags when played My AudioClip is lagging when I play it in Unity3d. The AudioClip is supposed to play when you left-click inside the game window.

Steps I've tried for fixing it:

Uncompressing the .wav sound file.
Setting the clip variable of an AudioSource to a clip and then playing the sound, but that's a different story.

How the issue occurs: When I start the game, on the first click it plays fine. But then after a few clicks, it starts slowing down and/or lagging.

This is my code:

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

[RequireComponent(typeof(AudioClip))]
[RequireComponent(typeof(AudioSource))]

public class GameProcess : MonoBehaviour {

    public Canvas Game;
    public AudioClip explosion;
    AudioSource beatBox;
    Transform btn;
    Vector3 canvasMin;
    Vector3 canvasMax;
    Vector3 pointerMin;
    Vector3 pointerMax;
    Vector3 pointerPos;

    void Start () {
        btn = Game.transform.FindChild("Pointer");
        canvasMin = Game.GetComponent<Collider>().bounds.min;
        canvasMax = Game.GetComponent<Collider>().bounds.max;
        pointerMin = btn.GetComponent<Collider>().bounds.min;
        pointerMax = btn.GetComponent<Collider>().bounds.max;
        beatBox = GetComponent<AudioSource>();
    }

    void Update () {
        if (Input.GetMouseButton(0))
        {
            beatBox.PlayOneShot(explosion);
        }
        if (!(pointerMin.x <= canvasMin.x) || !(pointerMin.y <= canvasMin.y))
        {
            if(!(pointerMax.x >= canvasMax.x) || !(pointerMax.y >= canvasMax.y))
            {
                btn.transform.position = Input.mousePosition;
            }else
            {
                btn.transform.position.Set(pointerPos.x - 1, pointerPos.y - 1, 0);
            }
        }else
        {
            btn.transform.position.Set(pointerPos.x + 1, pointerPos.y + 1, 0);
        }
    }
}

sentences:
If statement works fine until I add a tag check requirement. Why is this? I'm trying to add a tag check to an if statement but for some reason when I add said tag check it stops working.

void Update ()
    {
        Vector3 fwd = transform.forward; // Equivalent to the code you had.

        Ray ray = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        if (Input.GetMouseButton(0) && Physics.Raycast(ray, out hit, 10f) && isPlayerHolding == false && gameObject.CompareTag("Pickable"))
        {
                isPlayerHolding = true;
                hit.transform.SetParent(Player.transform);
                Debug.Log("We hit: " + hit.transform.name);
                hit.rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
                hit.rigidbody.constraints = RigidbodyConstraints.FreezePosition;

        }
        if (Input.GetMouseButton(1) && Physics.Raycast(ray, out hit, 10f) && isPlayerHolding == true)
        {
            hit.transform.parent = null;
            isPlayerHolding = false;
            hit.rigidbody.constraints = RigidbodyConstraints.None;
        }

More specifically this is the bit of code that is holding things up "&& gameObject.CompareTag("Pickable")".

Things I've tried:

Debugged variables in C# to be sure nothing is missing/null.
Making sure the tag is setup properly within Unity.

I really can't think of what the problem is. Anyone have any ideas?

sentences: Is it possible to extract textures or sprites from compiled game files? For instance, every map in Portal has what appear to be sprites over a texture indicating the obstacles you'll face (see screenshot). Are these resources compiled into the source as byte code, or is it possible to extract them from installation files? Obviously I understand copyright implications, and I am only interested in using it for a recreational project. Instead of recreating them, I wonder if they can be extracted.

sentences:
XNA flip SpriteBatch on click Is there any way to make a SpriteBatch flip when its clicked, something like Android Animation?

I know that spriteBatch.Draw() have SpriteEffects, but it literally flip it and I want to flip it like an animation.

sentences:
Null Reference to camera when loading new scene I am getting the error:

  MissingReferenceException: The object of type 'Camera' 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.

The camera in my game contains a persistent object script, which prevents the camera from being destroyed when loading a new scene.

private void Awake()
{
    DontDestroyOnLoad(transform.gameObject);
}

The scene is switched via a method in the GameManager:

public void loadScene(UnityEngine.Object arena)
{
    operation = SceneManager.LoadSceneAsync(arena.name);
    state = GameState.LOADING;
}

and finally the camera contains another script which adds a distortion effect:

void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    distortCam.CopyFrom(mainCam); //Error occurs here
    distortCam.backgroundColor = Color.grey;
    // ...Some more code ...
}

The error occurs in this last method, but the camera still exists in the editor. mainCam is a Camera object that is assigned onAwake via mainCam = GetComponent<Camera>();

Also if I switch the loadScene method to:

public void loadScene(UnityEngine.Object arena)
{
    operation = SceneManager.LoadSceneAsync(arena.name, LoadSceneMode.Additive);
    state = GameState.LOADING;
}

it works perfectly, but it is inconvenient to always have to loadScenes additive.

Why is the reference to the mainCam being lost? I have tried to check if it's null and reassigning it before using it, but so far I still have the problem. Any ideas?

sentences:
How to compute the points of a CollisionPolygon2D? Godot v3.3.1.stable.mono.official

I am trying to draw a CollisionPolygon2D programmatically but I cannot resize or write the PoolVector2Array property called polygon:
extends CollisionPolygon2D

func _ready() -> void:
    polygon.resize(1)
    print(polygon.size())
    polygon[0] = Vector2.ZERO

This code prints 0 and throws an error: Invalid set index '0' (on base: 'PoolVector2Array') with value of type 'Vector2'.

sentences:
Best data structure to store large amount of data I am making a minecraft kind of game. In which I have 100s of objects and their crafting recipe.

Now I want to store them inside the program, ie I cannot load external files. Everything must be inside class for now. In future I might be able to use databases, once the game gets more traction.

All these objects will have addition properties like shootable,purchase cost,etc etc.

Some also have array property like

{ research1: unlocks{ object1:50%, object2:100% }},

{ research2: unlocks{ object1:50% }}.

But all these objects will be constant with an exception of "locked" boolean.

If I do a huge database I'll also have to search data using filters on they keys like we do on sql.
Example: "Give me all Researches that are unlocked and that unlocks object1"

What will be the best datastructure to store them?
Thanks.

sentences:
Scrolling Text in jMonkey I am looking for a way to include scrolling text boxes in a jMonkey game.  I have, of course, looked around online and could not find any examples or libraries that fit.

My goal is to have "quests" pop up for the user in small graphical boxes, containing quest text.  The quest text might be longer than the quest box (which was easy enough to generate in jMonkey), so I am left with the problem of generating scrolling text boxes.

Before I set off on a long venture to properly adjust, indent, and scroll text inside boxes, I was wondering if any knew of existing examples or libraries. I have a hard time believing I'm the first person to using jMonkey that needed scrolling text or quest functionality.

sentences:
Trees swaying in the wind using Tilemap I am working on a top-down, tile-based game (think 2D RPG). However, I would like to have trees that sway in the wind and shake a little if the player bumps into them!
How should I approach this? Is it achievable with trees that are composed of tiles and part of a tilemap?
Or should I exclude my trees from the tilemap and turn them into game objects instead?
If I were to turn them into separate game objects, would I then manually tweak their rotation/position to achieve the sway and shake, or is there some form of shader I can use?

sentences:
Monogame - How to correct “brightness-additivity” while using Alpha-Blend-State When using

GraphicsDevice.BlendState = BlendState.AlphaBlend;

in monogame

following happens:

Is there any avaible method to keep the color brightness everywhere the same regardless of an overlap?

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

    callback(reqList);
}

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

sentences:
Problem with drawing textures in OpenGL ES I'm developing a 2D game for Android and i'm using the framework which has been told in the book which named Beginning Android Games by Mario Zechner.So my framework is well designed and using OpenGL 1.1.It's similar to libgdx.

When i put my textures adjacent each other in my 2d surface,there are some spaces size as 1 px.But this problem only occur on my tablet.There aren't a problem like this on my phone.It's like in this picture:

What can be the problem?I can't fix it from one week.

sentences: Tower defense endless levels logic sprite kit I am making a tower defense game for iOS using Sprite Kit. I would like for my game to support an endless number of levels, like in Bloons TD 5. What approach should I take to implement this?

sentences:
Deferred Rendering with SFML I've been looking to implement a deferred rendering system in SFML.

I've read the tutorials on OGLdev for it, and I was wondering how to draw a scene built in SFML (sprites, text, etc) to the multiple render targets needed for the deferred shading process.

Basically, I need to be able to get SFML to draw every object to the GBuffer's MRTs, so I can have the parameters needed to do what I want.

Is this possible, or will I have to build my own rendering backend from scratch?

sentences:
Do any games have this type of mechanic? This question got closed on gaming SE as off topic. I hope it's on topic here.

Many years ago, a friend and I prototyped a simple 2d rpg with what we thought was a unique idea for the combat mechanics. It used wandering monsters and a cutaway battle screen system. We added a bunch of effects like "conditions" that could affect your player - the standard stuff like blind, dazed, weak, etc.

The unique part is that we wanted to make the combat as close to you, the player actually fighting, and not just you commanding a character to do stuff. So we made it so what the character experiences, you experience. The basic combat screen included an outline of the enemy, and one of you. At randomized times, targets would appear on either figure, and begin to shrink. On the enemy, these were "openings" and you had to click them before they disappear, the closer to center, the better the hit. On your figure, you had to click to defend from an attack before the target shrank.

The conditions on your character made this interesting. Like I said, they were intended to affect the player literally. So blindness literally dimmed the screen 90%. If you were dazed, the targets would wobble randomly. If you were weak, your mouse cursor would lag and glide around. Everything translated to an actual impairment in your gameplay, not some arbitrary "your attacks do half damage".

This would have logically extended into a spell system, where you actually have to remember spell words and combine them into creative combinations and type them real time. I know some games have done variants of this kind of spell system.

Looking back, I think this was still a fun idea, but it seems awful from an accessibility standpoint. Players like their games to make them feel powerful, not to acknowledge and emphasize their real life flaws. So have any games attempted something like this and had some success? What came of it? If not does it seem like a reasonable and creative idea to try?

sentences:
3D terrain generation with overhangs/caves 3D terrain with 2D noise function as heightmap is kind of 'easy'. Make a plane and adjust height based on the noise.

How would one start working on 3D terrain with overhangs/caves?

There are some older topics (for example related to Minecraft) on the thema, but non of them cover overhangs and in general techniques that can be applied to heightmap generated terrain.

sentences:
HLSL: Pack 4 values into 32 bit float I can't find any useful information on packing 4 values into a 32 bit float in HLSL.

Ideally, what I want to be able to do in HLSL is:

float4 values = ... // Some values where each component is between 0 and 1.
float packedValues = pack32R(values);
float4 values2 = unpack32R(packedValues);

I realize that there will be precision limitations, and performance tradeoffs between different precisions in different methods. I'm just wondering what ideas are out there.

sentences:
Unused frame(window) management I'm rewriting my game now using software designing patterns and want to do the code, most correct I can. While implementing MVC(Model View Controller) I got a question which I would like to discuss or to hear some opinions of experts.
The question is about management of unused frames... For example next sequence of windows:
ResourceLoadingWindow -> LoginWindow -> GameWindow
Definetly that I don't want to reuse ResourceLoadingWindow , since I'm using Java Applet and I don't see any situation when I will need to reuse it. The different story is about LoginWindow, which can be reused a lot of times, because some player would want to Logout and come back again in few minutes for example. I would like to know, following the MVC structure, should I destroy window, removing it from ContentPane or just hide? Maybe I need to unregister it from controller or I shouldn't do so?

Thanks in adavance.

sentences:
When rendering on two different computers, the texture is glitchy I am using Ogre3D, and have been using it for a while. Also lately, I have been using the Opengl Rendering system that is included in Ogre, only because Directx will not compile correctly(Will post errors on request through comment).

But as of now the main problem is when i render my model(it is a plane with simple, unblended pixelated texture), it looks like this on my Laptop(Left Image), but when I render on the desktop(Right Image), it looks the way its supposed to be.

Im pretty sure this problem might not be relevant to this site, but im not sure on where else to post this(if it needs to be moved then so be it), but i felt it would fit here just a bit, since its a game-dev type question.

Anyways, My compiler is MinGW that uses the IDE Code::Blocks.
also the operating system that im using on both computers are windows Vista 32 bit.

Now if anyone would know why this would happen then please do tell(but my guess is that maybe the graphics card is not compatible)

Here are the images:

Left:Laptop

Right:Desktop

there both about the same image, and if you notice on the desktop screenshot: it looks more clearer and you can see the "mountains" better, where on the laptop picture, you cant see any pattern at all...Also, you can notice an odd stopping of light(or maybe called something else), but that has me confused also.

sentences:
Managing player/AI state in Entity Component System I am working on a 2d platformer game. Right now, I'm also using ECS. My question is how can I manage player's and AI current states in the context of ECS when some states are exclusive and some may be combined.
At this moment, for the player entity I have several components: HorizontalSpeedComponent, VerticalSpeedComponent, CollisionComponent... and also a PlayerComponent that holds a player state flag.
I also have several systems:

PlayerInputSystem that maps player input to state
PlayerWalkSystem that manages player horizontal speed while moving
PlayerGravitySystem that manages player vertical speed while jumping/falling and also checks if player is on the ground.
CollisionSystem that calculates collisions
AnimationSystem that maps entity state to animation frame
DrawingSystem that renders every entity

Player state flag represents following states:

Idle
Walking
Jumping
Falling
Attacking

Now some of the states are exclusive: if player is Idle, then he is not doing anything else.
But if player is walking (moving horizontally), then he may also be jumping(moving vertically up) and attacking. On the other hand, if player is jumping then he is not falling.
I thought about using a single Finite State Machine system to avoid having state checks and transitions mixed in other systems, but I do not know how it could be implemented it while keeping some states exclusive and some not.

sentences:
A Simple Method To Create Island Map Mask I'm searching for a nice and easy way to generate a mask for an island map with C#.

Basically I'm using with a random heightmap generated with perlin noise, where the terrain is NOT surrounded by water.

The next step would be to generate a mask, to ensure the corners and borders are just water.

Then I can just subtract the mask from the perlin noise image to get an island.

and playing around with the contrast..

and the gradient curve, I can get an island heightmap just like I want it..

(these are just examples of course)

so as you can see, the "edges" of the island are just cut off, which is not a big problem if the colour value is not too white, because I will just divide the grayscale into 4 layers (water, sand, grass and rock).

My question is, how can I generate a good looking mask like in the second image?

UPDATE

I've found this technique, it seems to be a nice starting point for me, but I'm not sure how exectly I can implement it to get the desired output.
http://mrl.nyu.edu/~perlin/experiments/puff/

UPDATE 2

this is my final solution.

I've implemented the makeMask() function inside my normalisation loop like this:

        //normalisation
        for( int i = 0; i < width; i++ ) {
            for( int j = 0; j < height; j++ ) {
                perlinNoise[ i ][ j ] /= totalAmplitude;
                perlinNoise[ i ][ j ] = makeMask( width, height, i, j, perlinNoise[ i ][ j ] );
            }
        }

and this is the final function:

    public static float makeMask( int width, int height, int posX, int posY, float oldValue ) {
        int minVal = ( ( ( height + width ) / 2 ) / 100 * 2 );
        int maxVal = ( ( ( height + width ) / 2 ) / 100 * 10 );
        if( getDistanceToEdge( posX, posY, width, height ) <= minVal ) {
            return 0;
        } else if( getDistanceToEdge( posX, posY, width, height ) >= maxVal ) {
            return oldValue;
        } else {
            float factor = getFactor( getDistanceToEdge( posX, posY, width, height ), minVal, maxVal );
            return oldValue * factor;
        }
    }

    private static float getFactor( int val, int min, int max ) {
        int full = max - min;
        int part = val - min;
        float factor = (float)part / (float)full;
        return factor;
    }

    public static int getDistanceToEdge( int x, int y, int width, int height ) {
        int[] distances = new int[]{ y, x, ( width - x ), ( height - y ) };
        int min = distances[ 0 ];
        foreach( var val in distances ) {
            if( val < min ) {
                min = val;
            }
        }
        return min;
    }

this will give an output like in the image #3.

with a little bit of change in the code, you can get the originally wanted output like in image #2 ->

    public static float makeMask( int width, int height, int posX, int posY, float oldValue ) {
        int minVal = ( ( ( height + width ) / 2 ) / 100 * 2 );
        int maxVal = ( ( ( height + width ) / 2 ) / 100 * 20 );
        if( getDistanceToEdge( posX, posY, width, height ) <= minVal ) {
            return 0;
        } else if( getDistanceToEdge( posX, posY, width, height ) >= maxVal ) {
            return 1;
        } else {
            float factor = getFactor( getDistanceToEdge( posX, posY, width, height ), minVal, maxVal );
            return ( oldValue + oldValue ) * factor;
        }
    }

sentences:
Orbiting a camera around the Y axis whilst remaining up I've been having difficulty with a problem which I thought was going to be a simple solution.

I have a camera facing downwards on a character. The can camera be lowered and when it's lowered it remains the same distance away from the character that it was (basically rotating around the X axis of the target). Now what I want it to be able to do is spin around the character on the Y axis as well, but to maintain the same distance and to remain upwards all the time. The problem I'm having is that if I do something similar to the way I did it on the X axis everything becomes a mess. First of all it doesn't remain facing up, as it spins the camera ends up upside down and i'm not really sure how to recalculate the up vector for it. But ontop of that it doesn't maintain the same distance from the character at all times.

This is what I have right now:

        cameraUp = new Vector3(0, 1, 0);
        cameraPosition = new Vector3(cameraOffset.X, cameraOffset.Y, cameraOffset.Z);
        cameraPosition = Vector3.Transform(cameraPosition - cameraTarget, Matrix.CreateFromAxisAngle(Vector3.UnitX, tippingAngle)) + cameraTarget;

//This is the part that I'm having difficulty with, the rest works fine.
        cameraPosition = Vector3.Transform(cameraPosition, Matrix.CreateFromAxisAngle(Vector3.UnitY, rotationAngle));

        view = Matrix.CreateLookAt(cameraPosition, cameraTarget, cameraUp);

EDIT:

Thank you to everyone, all of your comments helped. The biggest issue was that somehow I let it slip past that the cameraUp value was wrong, I think it happened as a typo when I was tidying the code up. Anyway, after fixing that the code above was exactly what I needed. I had tried that before but because the up vector was wrong I was getting really weird results so thanks to everyone. :)

sentences:
Offscreen arrow indicator appears only when the user go near to the object I have placed four gameobject at different place.And I have a player and have applied movement to it through keyboard control.I have added script for arrow indication towords this gameobject.But the problem is that,the arrow appeaar only when the user go near to the gameoobject.I need the arrows to appear on the screen so that the user initially know where the gameobject is placed on the scene.

Here is the code for onscreen arrow.I have attached this script to each gameobject

public Texture2D icon; //The icon. Preferably an arrow pointing upwards.
public float iconSize = 50f;
[HideInInspector]
public GUIStyle arrow; //GUIStyle to make the box around the icon invisible. Public so that everything has the default stats.
Vector2 indRange;
float scaleRes = Screen.width/200; //The width of the screen divided by 500. Will make the GUI automatically
//scale with varying resolutions.
Camera cam;
public bool visible = false; //Whether or not the object is visible in the camera.

void Start () {
    visible = GetComponent<SpriteRenderer> ().isVisible;

    cam = Camera.main; //Don't use Camera.main in a looping method, its very slow, as Camera.main actually
    //does a GameObject.Find for an object tagged with MainCamera.

    indRange.x = Screen.width - (Screen.width / 6);
    indRange.y = Screen.height - (Screen.height / 7);
    indRange /= 2f;

    arrow.normal.textColor = new Vector4 (0, 0, 0, 0); //Makes the box around the icon invisible.

}

void OnGUI () {
    if (visible) {
        Vector3 dir = transform.position - cam.transform.position;
        dir = Vector3.Normalize (dir);
        dir.y *= -1f;

        Vector2 indPos = new Vector2 (indRange.x * dir.x, indRange.y * dir.y);
        indPos = new Vector2 ((Screen.width / 2) + indPos.x,
            (Screen.height / 2) + indPos.y);

        Vector3 pdir = transform.position - cam.ScreenToWorldPoint(new Vector3(indPos.x, indPos.y,
            transform.position.z));
        pdir = Vector3.Normalize(pdir);

        float angle = Mathf.Atan2(pdir.x, pdir.y) * Mathf.Rad2Deg;

        GUIUtility.RotateAroundPivot(angle, indPos); //Rotates the GUI. Only rotates GUI drawn after the rotate is called, not before.
        GUI.Box (new Rect (indPos.x, indPos.y, scaleRes * iconSize, scaleRes * iconSize), icon,arrow);
        GUIUtility.RotateAroundPivot(0, indPos); //Rotates GUI back to the default so that GUI drawn after is not rotated.
    }
}

public void OnBecameInvisible() {
    visible = false;
}
//Turns off the indicator if object is onscreen.
public void OnBecameVisible() {
    visible = true;
}

}

How can I make the arrows to appear on the edges of the screen

sentences: How does Admob pay for banner ads? I want to know how Admob pays for banners? Is it based on time or impressions or count of times that been showed to users?

sentences:
Finding x and z value in the direction of another object In my game you can drive a car and it has an arrow point to an object you need to drive towards. The arrow pops up above the car using the same x and z value as the car but adding 2 to the y value. What I am trying to do is push the arrow out a little bit toward the object it is pointing to. This way it looks like it is rotating in a circle around the car instead of rotating about it's own center point.

This is what I am doing right now:

if (!(Vector3.Angle(car.transform.forward, obj.transform.position - car.transform.position) < 40f))
{
    arrow.SetActive(true);
    temp = car.transform.position;
    temp.y = car.transform.position.y + 2f;
    arrow.transform.position = temp;
    temp = obj.transform.position;
    temp.y = arrow.transform.position.y;
    arrow.transform.LookAt(temp);
}

sentences:
Using a dissolve shader as well as the Standard shader I'm applying a "burning" dissolve shader to an object which uses the Standard shader already. Because I need the Standard shader for better lighting, etc, I looked into how to use them "both" or how to extend the standard shader.

According to the Unity docs I can define which lighting mode I want to use in the pragma so I used Standard. That must not work the way I thought, because I see none of the lighting I do when using the standard shader directly.

I'm using the burning dissolve shader from Harry Alisavakis

Shader "Custom/BurnDissolve" {
    Properties {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _SliceGuide("Slice Guide (RGB)", 2D) = "white" {}
        _SliceAmount("Slice Amount", Range(0.0, 1.0)) = 0

        _BurnSize("Burn Size", Range(0.0, 1.0)) = 0.15
        _BurnRamp("Burn Ramp (RGB)", 2D) = "white" {}
        _BurnColor("Burn Color", Color) = (1,1,1,1)

        _EmissionAmount("Emission amount", float) = 2.0
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200
        Cull Off
        CGPROGRAM
        #pragma surface surf Standard

        fixed4 _Color;
        sampler2D _MainTex;
        sampler2D _SliceGuide;
        sampler2D _BumpMap;
        sampler2D _BurnRamp;
        fixed4 _BurnColor;
        float _BurnSize;
        float _SliceAmount;
        float _EmissionAmount;

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutputStandard o) {
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
            half test = tex2D(_SliceGuide, IN.uv_MainTex).rgb - _SliceAmount;
            clip(test);

            if (test < _BurnSize && _SliceAmount > 0) {
                o.Emission = tex2D(_BurnRamp, float2(test * (1 / _BurnSize), 0)) * _BurnColor * _EmissionAmount;
            }

            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Standard"
}

I also tried adding this as another subshader to a copy of the Standard shader source, but I wasn't able to get it working there. If I put it before the others, it works as if it was alone, if I put it after, the standard shader works like if it was alone.

I'm still new to shaders so I'm sure I'm misunderstanding this. How can I get the dissolve shader to apply as well the standard shader, without hopefully having to manually rewrite stuff.

sentences:
Problem with 2D game on android. Random FPS drop with OpenGLES 2.0, sudden white screen with Vulkan I'm having a problem with my 2D game on Android.

When I use OpenGLES 2.0 as the graphics API, I experience sudden FPS drops in the game. The game starts to slow down sometimes randomly, And it can drop down to 25 FPS sometimes (from 60). I tried debugging it, and nothing special was consuming CPU time or anything.

it was only GFX.Waitforpresent.

To fix this, I tried using Vulkan as the first Graphics API, and the other two OpenGLES APIs next. The problem of FPS drop is gone! never slows down again on my device.

But I had two other problems.

The first is the screen suddenly turn all white. This is again random! can't reproducde it easily. But it does happen. And when this happens sound can be heard and it's obvious the game is running, and it's just not rendering properly.

The other problem is game won't start on an old device a friend tested it on.

I've been testing this on my Huawei P10 Lite device with Android 8.

sentences:
How to display text and numbers in SFML 2.0 I want to display some text and numerical data over my OpenGL scene in SFML 2.0. I've looked at the SFML 1.6 text tutorials here. But I can't get the code to work.
There is (as of yet) no text tutorial for 2.0

sentences:
Why is my Admob reward interstitial ad connected to Unity stuck on pending? I am trying to better monetize my game by using rewarded interstitials. I have set these up on my admob console. I have also linked the ad source on the admob console to my game through the Unity ads service using my game's id.

It seems to be stuck on "pending". I can't find any further options on admob or on the unity ads console to remedy this. In the game itself, my rewarded ads are not loading.

Is there some step I am missing either through Admob or Unity ads? How long does pending take because it has been like this for a few days.

Edit with more info
Unity version 5.5.1f1
I am using the example code from the admob site (I removed my apps id's here for privacy reasons):

    public RewardBasedVideoAd nonskipInterstich;
    public void NonSkipGoogleAd(){

    #if UNITY_ANDROID
    string adUnitId = "--------------------------------------";
    #elif UNITY_IPHONE
    string adUnitId = "------------------------------------------";
    #else
    string adUnitId = "unexpected_platform";
    #endif

    nonskipInterstich = RewardBasedVideoAd.Instance;

    // Create an empty ad request.
    AdRequest request = new AdRequest.Builder().Build();
    // Load the interstitial with the request.
    nonskipInterstich.LoadAd(request, adUnitId );

    nonskipInterstich.OnAdFailedToLoad += LogFailedToLoadError;

}

if I display the failed to load event I get "No fill".
I haven't ever gotten it to fill a request, but I am only using remediation linked to the UnityAds source.

I read a post online that recommended importing the Unity Ads plugin from the asset store into the project. I did this and the google request is still not filling. I do not use the unity ads plugin directly to make the request. I also have the unity ads adapter jar found here

sentences:
Unity, errors when using Quaternion.Euler to copy rotations In the game I'm creating I have a square that rotates around a parent point, I want the square to always aim upright however (think of a rotating platform). What I've done is simply use
child.transform.rotation = Quaternion.Euler(0.0f, 0.0f, -gameObject.transform.rotation.z)
This rotates the child object in the opposite direction so that they're always aiming in the right direction. Except it doesn't, there is some error that piles up with bigger rotations. For example at 90º the child object will be rotated -90.77 instead which is very noticeable given that the game has a grid of sorts and when objects are not aligned to it they instantly pop out.

So my question is, is there any way to avoid this error?

sentences:
Calculating the correct roll from a bone transform matrix Read this forum topic for more info: http://blenderartists.org/forum/showthread.php?260602-transform-matrix-to-bone-%28head-tail-roll%29-bug

I'm trying to get my Blender3d modeller importer to create correct bones from my file's transform matrices.

The Blender Python API doesn't have a way to do this (anymore!), so people had to dig the Blender C source to find out how Blender does it and port that. Here's a Python port of the needed functions, not by me (I don't know C):

def vec_roll_to_mat3(vec, roll):
    target = mathutils.Vector((0,1,0))
    nor = vec.normalized()
    axis = target.cross(nor)
    if axis.dot(axis) > 0.0000000001: # this seems to be the problem for some bones, no idea how to fix
        axis.normalize()
        theta = target.angle(nor)
        bMatrix = mathutils.Matrix.Rotation(theta, 3, axis)
    else:
        updown = 1 if target.dot(nor) > 0 else -1
        bMatrix = mathutils.Matrix.Scale(updown, 3)
    rMatrix = mathutils.Matrix.Rotation(roll, 3, nor)
    mat = rMatrix * bMatrix
    return mat

def mat3_to_vec_roll(mat):
    vec = mat.col[1]
    vecmat = vec_roll_to_mat3(mat.col[1], 0)
    vecmatinv = vecmat.inverted()
    rollmat = vecmatinv * mat
    roll = math.atan2(rollmat[0][2], rollmat[2][2])
    return vec, roll

How to use them:

pos = mymatrix.to_translation()
axis, roll = mat3_to_vec_roll(mymatrix.to_3x3())

bone = armature.edit_bones.new('name')
bone.head = pos
bone.tail = pos + axis
bone.roll = roll

Sadly, it seems even the Blender C code is buggy and doesn't take into account cases when the bone is parallel to (0,1,0). So such bones can get assigned wrong (by 180 degrees) rolls and mess up animations.

Does anyone have better code for generating roll which takes into account such cases?

The old Blender 2.4 API generated correct ones. Its C code can be found here: http://svn.blender.org/svnroot/bf-blender/branches/blender-2.47/source/blender/blenkernel/intern/armature.c
I'm no C coder myself, again.

sentences: How can I add a glow effect around a pair of wings in Unity without post processing? Basically I want to use post processing and then I found a tutorial to achieve my goal. However, the artist want a pure shader to achieve this, without any C# script hanging in the main camera. Any idea to implement?

sentences:
Is this the correct way to detect ray-sphere intersection? I have this java function that should return a true or false for any sphere passed to it if they intersect. However it seems to end being true a lot of the time when it shouldn't and false sometimes when it should be true.

It is possible however that i am passing incorrect data to the function. This was done with jPCT so the object SimpleVector is a vector with 3 variables.

public Boolean sphereIntersect(SimpleVector rayOrigin,SimpleVector rayDirection, SimpleVector sphereOrigin, float sphereRadius )
{
        SimpleVector Q = new SimpleVector(sphereOrigin);
        Q.sub(rayOrigin);

          float c = sphereOrigin.length();
          float v = Q.calcDot(rayDirection);
          float d = sphereRadius*sphereRadius - (c*c - v*v);

          if (d < 0.0){
              System.out.println("False");
          return false;
          }
          System.out.println("True");
          return true;

}

sentences:
Make a GameObject Constantly Appear and Disappear I am making a game where I need these black rings to appear and disappear one after another. I am in Unity 2D so what I did is simply changed their Z transform. I am also trying to run this code asynchronously so that it doesn't choke up and slow down when I am running other things in the main Update. Right now when I run the game, all the other things happen perfectly in sync but the rings don't turn on and off in sync and then after all the other game objects have stopped moving, they start blinking rapidly and chaotically. How do I fix this?
My code:
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;

public class ring1 : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject ring;
    public GameObject ring2;
    public GameObject ring3;
    public GameObject ring4;
    private bool isCoroutineExecuting = false;
    async void Start()
    {
        ring.GetComponent<GameObject>();
        ring2.GetComponent<GameObject>();
        ring3.GetComponent<GameObject>();
        ring4.GetComponent<GameObject>();
    }

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

    }

    void FixedUpdate()
    {
        //ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 0);
        //WaitForSeconds(1);
        //ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 100);

        //print("fixed");
        StartCoroutine(ExampleCoroutine());
    }

    IEnumerator ExampleCoroutine()
    {
        //Print the time of when the function is first called.
        Debug.Log("Started Coroutine at timestamp : " + Time.time);

        ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 0);
        ring2.transform.position = new Vector3(ring2.transform.position.x, ring2.transform.position.y, 0);
        ring3.transform.position = new Vector3(ring3.transform.position.x, ring3.transform.position.y, 0);
        ring4.transform.position = new Vector3(ring4.transform.position.x, ring4.transform.position.y, 0);

        ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring2.transform.position = new Vector3(ring2.transform.position.x, ring2.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring3.transform.position = new Vector3(ring3.transform.position.x, ring3.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring4.transform.position = new Vector3(ring4.transform.position.x, ring4.transform.position.y, 100);
        yield return new WaitForSeconds(1);

        //After we have waited 5 seconds print the time again.
        Debug.Log("Finished Coroutine at timestamp : " + Time.time);
    }
}

```

sentences:
Creating a hexagonal wraparound map I'm trying to create a wraparound map for a hexagonal map, so when you exit a tile on one side of the big hexagon-shaped map, you enter a tile on the other side.

Example image from Red Blob Games article on Hexagonal Grids.

In the image, the pale tan hexagonal chunk in the center is our map. The greenish/reddish chunks around it are shifted copies of the same map. If we stand on the blue tile under the cursor and walk off the main map into the green copy to the right, that's the same as wrapping around our map to the corresponding point on the other side: here, walking from the blue tile in the lower-right-hand red copy into the bottom-right corner of the center map.

I used an approach with a lookup table first. But as soon as those maps get too big, the lookup tables get even bigger. I'm searching for a solution which works without a lookup table.

sentences:
How to handle assets in Unity? Here's what I have in our little Unity game:

If an asset (mostly a prefab or a texture) has to be accessed (e.g. to instantiate a game object), it is often passed as [SerializeField] to the script component. Scripts that are not components get their assets through the constructor so the assets are passed down until the class where they are needed. It's ugly.
If a lot of assets are needed (like textures of an animation), they are moved into a folder called "Resources" and accessed through the Resources class. The documentation explicitly says "don't use it".

What I want:

To access assets through a name or path to create objects at run-time.

What I found:

The AssetDataBase class looked promising until I couldn't locate it and found out it is deprecated (and the documentation does not tell how to replace it).
Nothing on Google but a lot of outdated things
Asset bundles look promising too, but they are quite complicated and there are no really good migration tutorials and I don't know how to use them.

Any suggestions? How do small/mid sized/bigger Unity games handle their resources?

sentences:
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:
3D Reflection - Drawing Upside Down After reading up on rendering reflections, it seems that the way to do it is the render the scene from underneath the plane of reflection, and then use projective texturing to map the reflected texture to the reflective surface.  However, why can't you just use the image from rendering the scene underneath the water, and draw it upside down behind the terrain?

Here's what I mean:
http://i.stack.imgur.com/g6VbX.png

The lines at the end of the views represent the drawn image, the colored dots are supposed to represent the corresponding points on the textures, and the brown is supposed to represent the terrain.

From the diagram, it would appear that you can just take the image rendered from the camera below the reflective surface, flip it upside down, and then draw it behind the terrain on the actual rendered image.

Is this another way to do it, or am I completely missing something here?

Thanks!

sentences: How can I get my Flash game to scale to all mobile device screen sizes? I want my application to automatically scale its size depending on the screen size. I want my application to fit any screen size automatically. I am making my application for mobile devices, how can I do this? I am fairly new at flash so please make it a bit simple!

sentences:
rotating an object from sourceAngle to destAngle, both 0-359, clockwise or counter clockwise? I've got a game object i need to rotate. It's current angle is player.rotation, the destination is targetAngle, both in degress, 0 to 359. I've got a function named rotateDirection(float sourceAngle, float destAngle) that needs to return -1 or 1 depending on whether the shortest way to reach the destination angle would be clockwise or counterclockwise.

For example - for sourceAngle 300 and destAngle 0 the function would return 1 for clockwise.

The solution is most probably going to leave me looking silly, and i usually don't like just asking for code, but my brain is completely broken so please help me with this one :)

sentences:
Have a method accept generic methods for a in-game console I'm making a console, like in Half-Life so that the devs can add their commands.

I'm making this in Unity's C#.

I have a problem when dealing with the commands. When you want to add a commands, you create a class Command and add it through a method to the Console List of Commands.

The code of the class Command is the following one:

public class Command
    {
        /// The string by which this command will be called
        public string commandKey;
        /// The information of this command that the help option will show
        public string helpInfo;

        public delegate string stringVoid();
        public delegate string stringString(string consoleInput);
        public delegate void voidCmd();
        public delegate void voidString(string consoleInput);

        public stringVoid _stringVoid;
        public stringString _stringString;
        public voidCmd _voidCmd;
        public voidString _voidString;

        public Command(string commandInput, string helpTooltip)
        {
            commandKey = commandInput;
            helpInfo = helpTooltip;
        }

        #region Add Command Methods
        public Command addVoidCommand(voidCmd voidCommand)
        {
            _voidCmd = voidCommand;
            return this;
        }
        public Command addStringVoid(stringVoid stringVoidCmd)
        {
            _stringVoid = stringVoidCmd;
            return this;
        }

        public Command addStringString(stringString stringStringCmd)
        {
            _stringString = stringStringCmd;
            return this;
        }

        public Command addVoidString(voidString voidStringCmd)
        {
            _voidString = voidStringCmd;
            return this;
        }
        #endregion
    }

As you can see users can add four types of delegates methods:

Void methods with no parameters.
String methods with no parameters.
Void methods with a string parameter.
String method with a string parameter.

This makes the class very heavy, and makes the users have to navigate through a lot of options to add a class.

I want to have some way to add methods without having to go through so many options, and, from my side, taking out the need of searching through so many options when a command is called from console.

You can find the whole script/project here.

In conclusion, I want to have a way that the user simply write

// way I want it to work
new Command("commandName", "this is an example" ExampleCommand);
new Command("commandString", "this is another example" ExampleString);

void ExampleCommand(){ }
string ExamplesString(string ble){ return ble + "bla"; }

// way it currently works
new Command("commandName", "this is an example").addVoidCommand(ExampleCommand);
new Command("commandString", "this is another example").addStringString(ExampleString);

To simplify everything. Is any way I can achieve this with delegates, Unity Actions or something else?

Thank you very much.

sentences:
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 can I minimise data sent through a network in a modern FPS? I am aware of snapshot interpolation with the use of delta compression as being a technique used to minimise the amount of data sent in a modern FPS game like Quake 3, but what other techniques are there?

sentences:
Are spritesheets worth it? Is a zip a good alternative? I was wondering if spritesheets are worth it.
I am making a game with pixi.js and was thinking about optimization, beginning with asset loading. I currently have an arraya of all files and use PIXI.loader, but I know this is not good because it will make a web request for all files which takes long, so I should figure out a way to load them in one web request. The first thing I thought of was a spritesheet but then I thought "what if I just zipped everything and loaded it with something like JSZip?" I knew it was possible already (from this project that loads pixi textures from a zip) and listed what I think are potentials good and bad things:
Zip good points:

Compression meaning faster loading of assets
Compression meaning smaller build size when making a build with electron

Zip bad points:

Requires loading a separate library meaning increased loading time and using more RAM
Requires decompressing in-memory meaning increased loading time

Spritesheet good points:

Doesn't has the headers of all individual image files
Is much used so it is a proven technique

Spritesheet bad points:

No compression (or at least not comparable to zipping)
More than one network call due to phone limitations preventing sometimes files over 2024x2024px making it necessary to split spritesheets
Empty holes as all images are not the same size and there is almost always a bit of space left in the spritesheet, meaning useless pixels that are still transfered over the network

I am not a very experienced developper, so I have a few questions:

Did I miss a point above?
Are spritesheets generally worth it?
Which technique of both is more worth it? I could do both but I want to focus on one first and leave the other in a nice to have list.

sentences:
Unity sizeDelta of an Image update opposite to what it should I have an IEnumerator coroutine in which I call the UIManager script to update the Image size to fit the text size but it doesn't happen. when I use yield return new WaitForEndOfFrame() it sometimes solve the problem. but I don't want to use it.

edit: I tested the code like I was suggested in an empty unity project and it still happens, the width should change according to the text size but it happens opposite (when the text is small the width of the image is large and when the text is large the width of the image is small) (it only happens correctly at the first time - the width of the image fits the text width)

public class Example : MonoBehaviour
{
    public Image image;
    public Text text;
    private int k = 0;

    public void ButtonClick()
    {
        text.text = (k % 2 == 0) ? "10" : "10 / 10";
        image.rectTransform.sizeDelta = new Vector2(text.rectTransform.rect.width, 30);
        k++;
    }
}

edit: Solved! thanks for the help, Canvas.ForceUpdateCanvases() did the trick

sentences:
Handling various frame layouts in Android I am trying create a Contra or the old TMNT game (but a simple one) like game for Android. For the game I decided to divide my main screen in three parts - upper for stats, mid for the game and lower for controls.

My main.xml is

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<FrameLayout
    android:id="@+id/upper_bar"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1" >
</FrameLayout>

<FrameLayout
    android:id="@+id/fl"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="0.5" >
</FrameLayout>

 <FrameLayout
    android:id="@+id/low_bar"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="0.85" >
</FrameLayout>

</LinearLayout>

So I have created the gameview and gameloopthread classes for the mid surface(which is pretty standard). My problem is I don't know how to draw in the upper and lower frame layouts. Should I make new classes for view and thread for each layout, should I do all this in the gameview class itself or is there any better way to implement this?

sentences: How to use X,Y, and Z instead of Pitch, Roll and Yaw I'm learning Unreal engine, and I'm rather disappointed because it uses pitch roll and yaw instead of the standard x, y, and z that I'm used to.  Is there any way to convert this easily, or is there a preference, or do  I have to get used to using y,z,x, instead of x,y,z.

sentences:
Straightforward guidelines for converting OpenGL to OpenGL ES? Is there a straightforward list of finite steps that I need to follow to convert an OpenGL program into an OpenGL ES that's used on the iPhone and iPad? I'd be using GLKit.

I've seen some similar API functions but I gather that triangles have to be presented differently.

sentences:
Is it possible to load local html pages into Gamemaker games? I was just wondering if it would be possible somehow to load locally saved web pages into a game. My primary use for them would be as menus, helping to navigate between rooms.

I know about the built in "Open URL" function but I want to know if the loaded page can interact with the actual game.

sentences:
Read actor instance's text variable for widget when triggered on different objects What I'm trying to do:
(a 'long story version' is linked in comment below)
(and another user example is hyperlinked in comment below - i couldn't post over 8 images and/or links in this first comment*)
(there are other similar user questions elsewhere I know)
Short story: I'm trying to make a widget that is triggered by an actor blueprint, and I want the widget to display different text that reflects the public-variable-text edits I make in the editor.
My latest progress includes actors that are titled somewhat according to the hyperlinked user case above so, I have a "door_trigger" and a "doorWidget". I have altered the pin connections so much that I am just going to copy and paste all my screen shots below.
I got to change text asset DoorName by making a public variable called "name," as you'll see. I can make the trigger show this text on screen and have it disappear when the user leaves the trigger actor, BUT EVERY INSTANCE ALSO SHOWS THIS TEXT VALUE, EVEN THOUGH I CHANGE IT
In the screenshots (some in comment following too) you'll see the text "3" appear on screen, and it does this for all three of the dummy boxes I made; notice how the second box is supposed to show "dd" (I was just typing random filler content).
ALL HELP SO APPRECIATED!!!!! Thank you!!!

sentences:
My colliders keep going through one another? So, I have some platform with colliders and a character with a collider (everything in 2D). The problem is, while there is some noticeable effects (a certain push back) when the colliders collide, they actually intersect each other and can go through each other.. How can I actually put a collider that doesn't let anything pass, it just stands there like a brick wall against anything?

By the way, any enlightenment on the inner workings of the colliders behavior will be appreciative as I cannot understand how this could even happen.

Demonstration video

Demonstration video 2

Bellow I have the images showing the inspector of both the character and platforms/wall respectively.

]4

Also: I'm moving the character using transform.position += Vector3.right * speed * Time.deltaTime;

sentences:
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:
2D shader to draw representation of rotating sphere I want to display a 3D textured sphere, and then rotate it in one direction. The direction will never change, and the camera will never move. One way is to actually create a spherical mesh, map a texture to it, rotate the sphere, and render in 3D.

My question is, is there a way to display a 2D circle, that looks like a rotating sphere, with just a 2D shader.

In other words, can someone think of a trick, like mapping a texture to the circle in a particular way, to give the appearance of an in-place rotating sphere, that is always viewed from the side?

I don't need exact shader code, I'm just looking for the right idea.

sentences:
Collaborations with colleges? How do you make them work? I am a graphic artist and not a modeler or a programmer. For the last few months I have been developing the concept for a game, but could not find a proper team of collaborators to make a demo. Then, as luck would have it, I met a group of people from a local Design College that has a new degree in Game Design. After a brief chat with the program’s Director, he seems really interested in coming to an agreement. Most of his students need an actual project to work on for their final year, and I need a team to make a demo…

So it works out great for both of us. I am trying to make a formal meet with the school’s administration to reach a formal agreement. Just one thing I am not sure of.

Who owns the project?

After everything is said and done, the end result is a demo and a Game Design Doc what will be presented to a publisher, but who owns the rights to the game?

I know the answer technically is “who ever is agreed upon in the collaboration contract” but how does these collabs usually work?

sentences:
Fast Ray Sphere collision code I am looking at here and while it's well organized a lot of links are broken:
http://www.realtimerendering.com/intersections.html

I am trying to find fast code that will give me the hit point and the normal of the hit point on the sphere. I saw a lot of functions that only checks if there is collision but nothing else.

I looked at Real Time Collision Detection book but it doesn't seem to have it either.

Any ideas?

sentences:
How do I best remove an entity from my game loop when it is dead? Ok so I have a big list of all my entities which I loop through and update. In AS3 I can store this as an Array (dynamic length, untyped), a Vector (typed) or a linked list (not native). At the moment I'm using Array but I plan to change to Vector or linked list if it is faster.

Anyway, my question, when an Entity is destroyed, how should I remove it from the list? I could null its position, splice it out or just set a flag on it to say "skip over me, I'm dead." I'm pooling my entities, so an Entity that is dead is quite likely to be alive again at some point. For each type of collection what is my best strategy, and which combination of collection type and removal method will work best?

sentences:
Porting WP8 to IOS GraphicsDevice Error (Monogame/Xamarin) I seem to be having a problem porting to IOS. I have my game working on WP8 and Android with any major issues but when trying to run on iPhone I seem to get an error when initialising the GraphicsDevice

below is a screenshot to the problem. has anyone else had this issue and is there a workaround/fix?
Thanks in advance! :)

http://i.imgur.com/6Kwk6D6.png

sentences:
Dropping through a platform in Clickteam Fusion 2.5 I am using Clickteam Multimedia Fusion 2.5. Currently, I have a rudimentary platformer game, with the following setup:

player object is set as a physics platform, with the physics engine added to make it all work
the floor is a quick backdrop, with the obstacle type of obstacle
the only platform in the game is also a quick backdrop, with the obstacle type of platform

The way the game is setup, the player object can jump through the platform.

WHAT I WOULD LIKE TO DO

Is there a default, built-in way for the player object to be able to drop down through the platform? To be more specific, is there a default key press or a default combination of keys which would allow the player object to drop down through the platform?

I guess I could add it all in via the Event Editor, but I was wondering if there's a built-in way which handles it all.

sentences:
Level and Player objects - which should contain which? I've been working on a several simple games, and I've always come to a decision point where I have to choose whether to have the Level object as an attribute of the Player class or the Player as an attribute of the Level class.

I can see arguments for both:

The Level should contain the player because it also contains every other entity. In fact it just makes sense this way: "John is in the room." It makes it a bit more difficult to move the player to a new level, however, because then each level has to pass its player object to an upcoming level.

On the other hand, it makes programming sense to me to leave the player as the top-level object that is persistent between levels, and the environment changes because the player decides to change his level and location. It becomes very easy to change levels, because all I have to do is replace the level variable on the player.

What's the most common practice here? Or better yet, is there a "right" way to architecture this relationship?

sentences:
An odd performance problem rendering a simple scene (less than 14k vertices) in OpenGL using two vbos with LWJGL Problem

I have been having a strange degrading performance issue rendering a simple scene containing two "chunks" of 4x4x4 cubes each.

Video of problem

This is a screen capture showing my console output, look specifically at the FPS dropping (which is the issue).

http://assets.cognitive.io/bugconsole.swf

Details about problem

My machine (a mid-2009 mbp 15") is on average using something like 10% cpu, but the machine is getting very hot to touch so I believe the graphics card is working very hard.

Someone else tested this code on another machine and experienced 100% cpu usage on a quad-core AMD cpu (on one core) and the same kind of performance problem.

I can't quite figure out what's going on, multiple people have looked at this and we are not getting any smarter.

Currently there is no frustum culling or any other sort of culling. I do not think that is the problem, I should be able to render a much much higher number of vertices without experiencing problems.

I have a list of chunks (ArrayList) that is created on start, not within the render loop, that generates a vbo and all that.

In my renderer I loop through the list of chunks and for each one I bind the vbo, setup some uniform variables and such before calling glDrawArrays().

I have a version of this where I only have one vbo (but then also only one cube per vbo/glDrawArrays call, very inefficient) where everything is working fine.

Thoughts and ideas

I believe the problem is something related to either VRAM filling up or me doing something incredibly wrong.

I've tried looking at my project with OSX's OpenGL profiler application, which has given me two different results:

First I was just using glBufferData each frame to pass the data, which resulted in 90% of the gl time spent being spent on CGLFlushDrawable().

After some advice from someone on #opengl on Freenode, it was suggested I should setup the vbo once with glBufferData, and then call glMapBuffer to pass the data after that.

This results in the same performance problem but 99% of the gl time being spent on glMapBuffer().

I was hoping someone had some advice for me, I would really like to just be able to continue learning opengl instead of being stuck debugging this performance issue for weeks.

Code on GitHub

The code is available at https://github.com/flexd/Game/tree/chunkrenderer (specifically the chunkrenderer branch!, you can see that the lighting2 branch works without the same performance issue).

The main game class is Game.java which contains the main method and it's also where I setup OpenGL.

Chunk.java, Cube.java, Renderable.java and ChunkRenderer.java are also of interest. Shader.java is where the shader class lives, but I doubt that has anything to do with the issues, it's basically the same shader as before.

Thanks in advance, I hope to be able to find the issue soon :)

Looking forward to being able to learn more of this.

PS: Let me know if I am posting this in the wrong place, I don't know if there's a opengl category that's better suited for this.

sentences:
How to decide to use OpenGL ES 1.0 or 2.0 for Android? I started learning some Android development and one of the first things I thought I could make is a simple game. However, I'm faced with one difficult question right off the bat. Should I use OpenGL ES 1.0 or 2.0?

The game I have envisioned will be pretty simple graphically, utilizing 2D(tiled top-down type graphics) and fixed-camera isometric views. I've never used OpenGL in a desktop environment, so I'm oblivious on if shaders will be something I'll use, etc.

According to this page I should use OpenGL ES 2.0 generally for new development. My own phone however just recently(past year) got an update to get it to the required Android 2.2. (I don't even know if it has OpenGL ES 2.0 support)

So basically my question is, will I benefit from any of OpenGL ES 2.0's features over 1.0 and/or is it worth it in terms of compatibility?

sentences:
Why can't i change the background color in Phaser? what is wrong with my code? i'm using game.stage.backgroundColor but the screen remains black.

main.js:

var demo = demo || {};

demo.game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '');

demo.game.state.add('state1', demo.state1);
demo.game.state.add('state2', demo.state2);

demo.game.state.start('state1');

state1.js:

var demo = demo || {};

demo.state1 = function() {};

demo.state1.prototype = {
    preload: function() {

    },
    create: function() {
        game.stage.backgroundColor = "#4488AA";
    },
    update: function() {

    }
};

sentences:
Issue with Canvas Background? I'm preparing a 2d game.
I'm working with particles, the problem is my particle is displaying on the obstacle and also a problem with level text see the reference image:

and the second issue is when I run my game on mobile then below some space left?

canvas : screen space camera and render camera->main camera.
Background RectTransform (stretch->stretch).

Canvas Inspector:

Particle Inspector:

Obstacle Inspector:

sentences:
How can I prevent resizing of an Ogre3D object once imported into jMonkeyEngine? I created an object in Blender:

Then I exported it as a mesh.xml file and attached it to the game scene:
[Note: The gray color is the ground.]

In the game I end up with have a smaller, horizontal tower. Any suggestions?

Note: I exported the file with "Force Camera", "Force Lamps" and "Export Scene" unchecked and "Swap Axis: x,y,z".

sentences: Can a standalone WPF application create an interface that looks like a Flash interface? It seems like WPF was created as the application answer to Adobe's Flash.  Silverlight is used for creating web pages.  But, can that same functionality be pulled into a standalone WPF application.  Scaleform allows Flash to be used within unmanaged C++ games.  Can WPF be used to create the same type of interfaces?  What I've read seems to make me believe it can.  But, I haven't seen any sheetshots of applications that show this kind of interface.

sentences:
How To Scale Canvas In Android I am writing a android game using Canvas as the way to draw everything, the problem is that when i run it on different android phones the canvas dosn't change size i tried using canvas.scale() but that didn't make a i difference. The code i use for drawing is ...

public void draw( Canvas c, int score )
{
    Obstical2[] obstmp = Queue.toArray(this.o);
    Coin[] cointmp = QueueC.toArray(this.c);

    for( int i = 0; i < obstmp.length; i++ )
    {
        obstmp[i].draw(c);
    }

    for( int i = 0; i < cointmp.length; i++ )
    {
        cointmp[i].draw(c);
    }
    c.drawText(String.format("%d", score ), 20, 50, textPaint);

    if( isWon && isStarted ) c.drawText("YOU WON", 20, 400, resPaint);
    else if( isLost && isStarted ) c.drawText("YOU LOST", 20, 400, resPaint);
}

The function above calls the draw functions for the entity's on the screen, theses function are as follows

Draw Function For Obstical :

public void draw( Canvas c )
{
    Log.i("D", "COIN");
    coin.draw(c);
}

Draw Function For Coin :

public void draw( Canvas c )
{
     obstical.draw(c);
}

The on create function is :

protected void onCreate(Bundle savedInstanceState)
{
    player = new Player(this);
    //map = new Map(this, );
    WindowManager w = this.getWindowManager();
    Display d = w.getDefaultDisplay();

    float sy = d.getHeight()/800;
    float sx = d.getWidth()/480;

    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    String type = intent.getStringExtra(CUBEMenuActivity.EXTRA_MESSAGE);

    Log.i("MENU", type);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    //mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
    mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

       // Remove the title bar from the window.
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        // Make the windows into full screen mode.
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    map = new Map( this, type, sy, sx );

    canvasView = new CanvasSurfaceView(this, map, player, sx, sy );
    setContentView(canvasView);

    Log.i("C", "Canvas View Set");

}

i am using a canvasSurfaceView instead of an XML layout, the canvasSurfaceView constructor method is

public CanvasSurfaceView(Context context, Map map, Player player, float sx, float sy)
{
    super(context);
    holder = getHolder();

    gestures = new GestureDetector(new GestureListener(this));

    this.map = map;
    this.player = player;
    this.background = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.background1), 480, 10000, false);
    this.sx = sx;
    this.sy = sy;
}

when the game is running the run() method is called repeatedly this is where the canvas class is initialized

public void run()
{
    while( run == true )
    {
        if( !holder.getSurface().isValid() )
        {
            continue;
        }

        Canvas c = holder.lockCanvas();

        if( ( map.isWon || map.isLost ) && map.isStarted ) setCompleated();
        //c.scale(sx, sy);

        if( notCompleated == false )
        {

            if( map.map.bottomOfLevel != 800 ) by += player.terminalVelosity / 2;
            update();
        }
        c.drawBitmap(background, 0, by, null);
        map.draw(c, player.score);
        player.draw(c);

        holder.unlockCanvasAndPost(c);
    }
}

How could i make the canvas re-size to it would look the same on any screen ?

Cheers Daniel

sentences:
How can I add up the Transform/GameObjects in the Array of Waypoints in Unity? I come up with this code and I try to get the waypoint + 1 when I reach the waypoint and it adds up till the last waypoint. I get Array is out of Index error. I guess I need and foreach loop of waypoints ?

Code:

public float speed;
public float turnSpeed;

public Transform[] waypoints;
private int currentWp = 0;

void FixedUpdate ()
{

    if(waypoints.Length >= currentWp)
    {
        return;
    }

    player.position = Vector3.MoveTowards(player.position, waypoints[currentWp].transform.position, speed * Time.deltaTime);

    var rotation = Quaternion.LookRotation(waypoints[currentWp].transform.position - player.position);
    player.rotation = Quaternion.Slerp (player.rotation, rotation, turnSpeed * Time.deltaTime);

    float distance = Vector3.Distance(player.position, waypoints[currentWp].position);

    if(distance <= 10)
    {
        currentWp++;
    }
}

sentences:
How to make a more accurate lap time? get_timer() LIMITATION? In the room there are 22 cars. All cars have a different speed.

The cars are numbered from 1 to 22 with the help of the variable carNumber.

CODE - obj_Car / Set car speed (Create Event):

velocity=10-((carNumber-1)*0.01);

Here's how there is a difference in car placement near the end of the lap:

However, even with this difference, the times of many cars are repeated:

The detection of lap time looks like this.

CODE - obj_Car / Time lap (Collision with obj_Finish) :

other.orderLapTime[car]=get_timer()-other.discount;

Discount = this is the exact time when the room starts (cars already start running).

CODE - obj_Finish / Set discount (Create Event):

discount=get_timer();

The display is made with a modifier (multi, to simulate actual track times).

CODE - obj_Finish / Draw time lap (Draw Event):

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i]*obj_Seth.multi/1000000,1,3));

Even taking the multiplication and increasing the number of decimal places, there are still many repeated times:

Some inconsistencies including. Cars with slower speeds marking faster times.

I could slow down the base speed (10) to solve such a problem, but I already think in the long run. The races can't take so long. In addition I intend to give the player the option to set the speed with which the race takes place (a multiplier, more frames, etc).

It could also increase the difference between the speeds (0.01 to 0.05), but I would like a general resolution, so that I can notice through the lap time, if only by one thousandth (0.001).

EDIT 1 - Attempts made based on answers and comments from Bálint and TomTsagk:

That is what I tried to do.

CODE - obj_Car / lap time (Step Event):

unit+=velocity/60*0.001;

Below the results...

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,3));

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,5));

The speed difference between the cars is 0.01.

sentences:
Quad tree vs Grid based collision detection I'm making a 4 player co-op r-type game, and I'm about to implement the collision detection code. I've read a lot of articles and stuff about how to handle collision detection, but I'm having a hard time figuring out what to go with.
It seems the quad tree is the most common way to go, but in some resources they mention the grid based solution. For having used a grid for detections in a previous game, I'm comfortable with that, but is it actually better than a quad tree ?
I'm not sure which offers best performance, and I've also ran a little benchmark, there is not much difference between both solutions.

Is one better than the other ? or more elegant ? I'm really not sure which one I should use.

Any advice is welcome.
Thanks.

sentences:
Pixel-art sprite distortion with 1:1 pixel ratio So I've been studying the Unity's PPU, pixel density, camera settings topic to make my game pixel-perfect. I've set everything in a way that my screen pixel to sprite texel ratio equals 1.

The art looks very good and crisp overall on the game view...

But!

There are still some minor distortions and I don't know where it comes from.

Take a look at this example:

In this example my settings are:

Screen: 870x510
PPU: 100
Camera size: 2.55
Pixel snap on Sprite material: on

The issue happens when I move the sprite manually by ~0.001 values on the Y axis. Same happens on the X axis.

Any ideas what's the problem?

sentences:
Should I use Game Engines to learn to make 3D games? HI i am a software engineering student in his second-last year.

I am proficient with C,C++,C# and java programming languages, and being a student of engineering I have studied calculus, vectors etc in both 2D and 3D & various other mathematical, probability and statistical topics.

I have made several 2D games, my most recent being a Super Mario-like game with side-scrolling and multiple levels.

Due to my these small game projects,i have become really interested in making games.

So now i want to move ahead to learn to make games in 3D.

Now I know that there are several game engines available which can take care of rendering details and other "low-level" stuff for me...

My Question is:

1) Is it a good idea to learn to program everything yourself, from making 3D shapes, terrains (using polygons meshes) etc, to programming mechanism for collision detection, lighting etc, considering my motive is to learn how to make games in 3D (but am not too eager to get into the game industry quickly, want to build a solid foundation first)

Or could I do without these details & work on the abstraction-level which the game engines (like UDK) provide ??

3) If I should try to develop from scratch, then  can anybody suggest which API to use: Direct3D or OpenGL?? (which i would be more comfortable with, in light of my above mentioned skills) & can anybody also give me references to some good books, reading materials, tutorials, etc to get me started?? (I wouldn't mind theory as long as it helps me make a sound foundation)

Many Thanx in advance (for even reading my question, i know it's lengthy... but i need a DETAILED answer... :D :D )

sentences:
OpenGL memory optimization and batching technique pitfalls I'm studying OpenGL optimization techniques. What I'd like to achieve is to emulate as closely as possible Mantle/DirectX12 programming patterns (aggressive batching, flexible memory handling, complex pipelines) with current OpenGL API. The assumption I'm making here is that hardware behavior is almost the same, with the OpenGL layer being a bit restrictive and not matching accurately the underlying architecture.

I'm considering the optimization technique proposed here:

http://www.openglsuperbible.com/2013/10/16/the-road-to-one-million-draws/

The article suggests allocating a giant buffer and writing a custom allocator to fill it with vertex, instance and texture data, then drawing it with glMultiDrawElementsIndirect. Immutable storage, triple buffering and persistent mapping can also be used for best streaming performance (see http://www.bfilipek.com/2015/01/persistent-mapped-buffers-in-opengl.html).

That seems pretty close to my goal, however I have some doubts:

I read that it's better not to overuse GPU memory on PC because it's also needed by other applications. However, when using this technique with dynamically loaded, continuously changing scenes (e.g. very large tiled worlds) we end up using much more memory than actually needed because we can't predict how much data we'll need to store. Is this a real concern? If yes, how can I address the problem?
View frustum and occlusion culling force you to continuously rewrite instancing and command data. Is this really good? Does decreased CPU load reward time spent copying around memory chunks? Does memory bandwidth significantly impact performance in this case?
Is the "one shader for all materials" method based on subroutines more efficient (higher frame rate with same input data) than modifying the program pipeline? What's the cost of binding a different pipeline or switching a shader in the current pipeline?

sentences:
Best way to deal with a large variety of items? I am currently working on my first java game and I am having trouble figuring out how I should implement my classes that will have heavy variety.  For example, I am considering having an abstract item class that every item in the game will inherit from, but I don't really know how specific I should get with the sub classes.  Is an armor class enough?  Should I break it down into where the armor will be equipped(head, chest, etc)?  Should I go so far as to give every single item it's own class and use a factory?

I apologize in advance for the noobie question, I have been searching around for a couple of hours but haven't been able to find a solid best practices guide that really goes in depth with this kind of stuff.

sentences:
OpenGL Fast-Object Instancing Error I have some code that loops through a set of objects and renders instances of those objects. The list of objects that needs to be rendered is stored as a std::map>, where an object of class MeshResource contains the vertices and indices with the actual data, and an object of classMeshRenderer defines the point in space the mesh is to be rendered at.

My rendering code is as follows:

glDisable(GL_BLEND);
    glEnable(GL_CULL_FACE);
    glDepthMask(GL_TRUE);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);

    for (std::map<MeshResource*, std::vector<MeshRenderer*> >::iterator it = renderables.begin(); it != renderables.end(); it++)
    {
        it->first->setupBeforeRendering();
        cout << "<";
        for (unsigned long i =0; i < it->second.size(); i++)
        {
            //Pass in an identity matrix to the vertex shader- used here only for debugging purposes; the real code correctly inputs any matrix.
            uniformizeModelMatrix(Matrix4::IDENTITY);
            /**
             * StartHere fix rendering problem.
             * Ruled out:
             *  Vertex buffers correctly.
             *  Index buffers correctly.
             *  Matrices correct?
             */
            it->first->render();
        }
        it->first->cleanupAfterRendering();
    }

    geometryPassShader->disable();
    glDepthMask(GL_FALSE);
    glDisable(GL_CULL_FACE);
    glDisable(GL_DEPTH_TEST);

The function in MeshResource that handles setting up the uniforms is as follows:

void MeshResource::setupBeforeRendering()
{
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glEnableVertexAttribArray(2);
    glEnableVertexAttribArray(3);
    glEnableVertexAttribArray(4);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iboID);
    glBindBuffer(GL_ARRAY_BUFFER, vboID);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0); // Vertex position
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 12); // Vertex normal
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 24); // UV layer 0
    glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 32); // Vertex color
    glVertexAttribPointer(4, 1, GL_UNSIGNED_SHORT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 44); //Material index
}

The code that renders the object is this:

void MeshResource::render()
{
    glDrawElements(GL_TRIANGLES, geometry->numIndices, GL_UNSIGNED_SHORT, 0);
}

And the code that cleans up is this:

void MeshResource::cleanupAfterRendering()
{
    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(2);
    glDisableVertexAttribArray(3);
    glDisableVertexAttribArray(4);
}

The end result of this is that I get a black screen, although the end of my rendering pipeline after the rendering code (essentially just drawing axes and lines on the screen) works properly, so I'm fairly sure it's not an issue with the passing of uniforms. If, however, I change the code slightly so that the rendering code calls the setup immediately before rendering, like so:

void MeshResource::render()
{
    setupBeforeRendering();
    glDrawElements(GL_TRIANGLES, geometry->numIndices, GL_UNSIGNED_SHORT, 0);
}

The program works as desired. I don't want to have to do this, though, as my aim is to set up vertex, material, etc. data once per object type and then render each instance updating only the transformation information.

The uniformizeModelMatrix works as follows:

void RenderManager::uniformizeModelMatrix(Matrix4 matrix)
{
    glBindBuffer(GL_UNIFORM_BUFFER, globalMatrixUBOID);
    glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(Matrix4), matrix.ptr());
    glBindBuffer(GL_UNIFORM_BUFFER, 0);
}

sentences:
Should I move the world or move the player? I'm about to start developing a sidescrolling game where the player's goal is to travel as far as he can in the horizontal axis before touching down. Note that I do not need to ever travel back on the horizontal axis.

I'm developing this with the AndEngine for Android which uses OpenGL and Box2d.

Before starting, I need to decide on something important: should I use the world around the player to simulate movement or actually move the player and follow him with the camera features of the game engine?

Both approaches seems to have different strengths and fallbacks, so I don't know which one is considered best. For example, what would make it easier to add power ups along the way and have a nice animated background?

Thanks!

sentences:
2D game libraries that support positional stereo sound? I would like my game to have semi-realistic sound, where the left/right channel volume depends on the position of the sound source within the world.

I've looked and it seems that it's not possible with Löve2d or pygame. They modify the volume of a sound based on distance, but the left and right channels are identical.

Am I wrong?
Are there any other 2d game libraries that make this possible?

sentences:
Setting Higher Z-Index for Sprite For my game, I have to set highest z index for my sprite.
At present, I wrote following code but didn't work for me.

    Sprite houseSprite = new Sprite(pX, pY,
            textureManager.houseBgRegion.deepCopy(),
            mVertexBufferObjectManager);
    attachChild(houseSprite);
    houseSprite.setZIndex(500);
    sortChildren();

My requirement did not satisfied with setting sprite in the HUD. So any how I have to apply highest z index. Also in my game sprites are dynamically generated as per game play.

So members please share your thoughts.

sentences:
Finding Pixels within UV Coordinates I am building lightmaps for 3D models. My lightmap algorithm needs to determine which pixels( lumels ) within the lightmap texture fall within the boundary of a mesh face( triangle )...this process takes place for each mesh face...

I was using barycentric coordinate techniques to accomplish this task. It works for the most part...here is code:

bool PixelIsWithinBounds( const D3DXVECTOR2 &t0,
                            const D3DXVECTOR2 &t1,
                            const D3DXVECTOR2 &t2,
                            const D3DXVECTOR2 &pUV )
{
    // compute vectors
    D3DXVECTOR2 v0 = t1 - t0,
        v1 = t2 - t0,
        v2 = pUV - t0;

    // do bounds test for each position
    float f00 = D3DXVec2Dot( &v0, &v0 );
    float f01 = D3DXVec2Dot( &v0, &v1 );
    float f11 = D3DXVec2Dot( &v1, &v1 );

    float f02 = D3DXVec2Dot( &v0, &v2 );
    float f12 = D3DXVec2Dot( &v1, &v2 );

    // Compute barycentric coordinates
    float invDenom = 1 / ( f00 * f11 - f01 * f01 );
    float fU = ( f11 * f02 - f01 * f12 ) * invDenom;
    float fV = ( f00 * f12 - f01 * f02 ) * invDenom;

    // Check if point is in triangle
    if( ( fU >= 0 ) && ( fV >= 0 ) && ( fU + fV <= 1 ) )
        return true;

    return false;
}

This function takes as input 3 UV coordinates( mesh face ) and a pixel UV coordinate. The problem with this method is that if the pixel is only partially covered by the face, the function returns false( because the pixel center does not ly within the triangle ). I could do overlap tests for each point on the triangle...I would like to know if there is a more efficient method...as this process takes place many times per generation of a lightmap...

...any ideas?

here is a screenshot showing the endpoint of a mesh face after lightmap generation...the corner of this face overlaps a pixel surface but doesn't overlap the pixel center...the algorithm left this pixel black( no light )...

EDIT: Shader code to dilate pixels

//--------------------------------------------------------------//
// Dilation Pass
//--------------------------------------------------------------//
PS_INPUT_Quad DilationPass_Vertex_Shader( VS_INPUT_Quad Input )
{
    PS_INPUT_Quad Output = ( PS_INPUT_Quad )0;

    Output.Position = mul( Input.Position, mOrtho );
    Output.UV = Input.UV;
    return Output;
}
float4 DilationPass_Pixel_Shader( PS_INPUT_Quad Input ) : COLOR0
{
    float4 vC = tex2D( g_SamplerLightMap, Input.UV );
    if( vC.w != 0 )
        return vC;

    int nValidPixels = 0;
    float4 vFinalColor = 0;
    for( int i = 0; i < 8; ++i )
    {
        float4 vNeighborColor = tex2D( g_SamplerLightMap, Input.UV + TexelKernel[ i ] );
        if( vNeighborColor.w == 0 )
            continue;

        //vFinalColor = ( length( vFinalColor ) > length( vNeighborColor ) ) ? vFinalColor : vNeighborColor;
        vFinalColor += vNeighborColor;
        nValidPixels++;
    }
    return vFinalColor / max( nValidPixels, 1 );
}

sentences: Understanding Tensors I don't seem to be able to visualize tensors. I am reading The Morgan Kauffman Game Physics Engine Development and he uses tensors to represent aerodynamics but he doesn't explain them so I am not really able to visualize them.

sentences:
Inaccurate UI button unity As you see in this screenshot I must hover the mouse on that that spot to click on button in overall you must hover the mouse upper than button to click on it, tried to change the Sprite but even with default Sprite I have this problem so I don't think there is problem with Sprites.

Let me explain more about this panel:
In this scene I have two canvas's one for Pause button only and another one for this panel that is disabled. When you click on Pause this panel will appear ( second canvas will be activated. Why is that? I tried to change some things in the canvas like change UI scale mode to scale with screen size but no luck.
I will be grateful for help I don't really know where problem is.

Update : I just now found very odd behavior when hit play if mouse be in game view that problem wont occur, after mouse leave the button issue will appear again.

sentences:
LibGDX: Skin and scaling problems I'm trying to use Skins with TextButtons. However I'm having an issue where the TextureRegions of the Skin are NOT being scaled down to the tablesize.

This is leading to an issue like in this image:

As you can see that is the e from the word Hello. I managed to scale that down to a more reasonable size (still wrong). However the Button textures are still way too large.

Any ideas? Because I am pulling my hair out. I am using a custom viewport with a custom screenspace width and height. Here is the create method for the menu.

    public void create(){
    menuStage = new Stage();
    camera = new OrthographicCamera();
    viewPort = new StretchViewport(SCREEN_SPACE_WIDTH, SCREEN_SPACE_HEIGHT, camera);
    viewPort.setWorldSize(SCREEN_SPACE_WIDTH, SCREEN_SPACE_HEIGHT);
    menuStage.setViewport(viewPort);

    devTexture = new Sprite (new Texture(Gdx.files.internal("data/16by9.png"), true));

    Image newActor = new Image(devTexture.getTexture());
    newActor.setSize(
            viewPort.getWorldWidth(),
            viewPort.getWorldHeight()
    );

    menuStage.addActor(newActor);
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));

    menuTable = new Table();

    skin.getFont("default-font").setScale(0.08f);

    menuTable.debugAll();

    menuTable.setFillParent(true);
    TextButton a,b,c;

    a = new TextButton("hello", skin);
    b = new TextButton("hello", skin);
    c = new TextButton("hello", skin);

    a.getStyle().up.setMinWidth(2.0f);

    b.getStyle().up.setMinHeight(2.0f);
    b.getStyle().up.setMinWidth(2.0f);

    c.getStyle().up.setMinHeight(2.0f);
    c.getStyle().up.setMinWidth(2.0f);

    menuTable.row();
    menuTable.add(a).size(2.0f, 1.0f);
    menuTable.add(b).size(2.0f, 1.0f);
    menuTable.add(c).size(2.0f, 1.0f);

    menuStage.addActor(menuTable);

    camera.translate(
            newActor.getWidth() / 2,
            newActor.getHeight() / 2
    );
}

sentences:
Working principle of an RPG map I am currently thinking of building a basic browser-based 2D(that would eventually become 2.5D) RPG. I have planned everything and I think that would be able to accomplish the current goals, but it seems that I can't think of a good way to develop the mapping. I have been able to move(currently teleporting as no animations at the moment) the character onclick, but can't think of a way to make some parts of the grid(tiles) not clickable so the players will not walk on water or over trees or anywhere else that they are not supposed to do so. the movable area will be 3-4 tiles out of the two-tiled roads/paths. each tile will be around 40-50px as well the character.

The game in general will be like Diablo 2 (Leveling, bosses, different areas/maps, different enemies with different levels, some equipment and etc.). And the map is mainly the biggest problem cuz I want to add cities and merchants, and the player shoould not be able to get on a questgiver's house(will not be able to get inside as well).

So to put everything together:

How should one create a tiled map, so that can mark unmovable and next(those that will trigger entering next part of the map) fields?

1.1  INFO: I was thinking of JSON to pass the data to jQ/javascript and to do the manipulation on client side but can't think of a way to mark fields
How to determinate the shortest path to the new char position for the purpose of animating

EDIT:

I am not asking anyone to do it for me, I would like to be explained how to manage everything in theory, any possible tools, technologies and etc.

sentences:
How to make an object covers a specific distance before moving in other direction for same distance? Suppose there is a small tile and I want an object to move on x axis on that tile back and forth.
How can I make that object in that specific tile.
My code is :
 Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{
    rb.velocity = new Vector2(-3f, 0);
}

As of now object moves left but I want it to start moving right and not go of the tile.

sentences:
Smoothing Heightmap Data I've made a Heightmap Generator that creates island heightmaps like in this picture:

I am dividing the grayscale ( 0 - 255 ) into 4 diferent parts ( water, sand, gras and forrest )
and after coloring those layers the heightmap looks like this:

As you can see, the "coast" is pretty noisy ( there are some sand-pixels on the edges, that are not connected to the island itself )

So my question is, How to smooth that noisy coast / beach ?

Is there any quick method that detects those "lonly" pixels and turns them into water ?

can i use the smoothing function below to smooth the final output ?

( I'm working with either a float[][] or a Color[][] array )

UPDATE

here is my smoothing function that i've implemented in my heightmap generation core.

i don't know if i can use this function for this purpose.

    public static float[][] GenerateSmoothNoise( float[][] baseNoise, int octave ) {
        int width = baseNoise.Length;
        int height = baseNoise[ 0 ].Length;

        float[][] smoothNoise = GetEmptyArray<float>( width, height );

        int samplePeriod = 1 << octave; // calculates 2 ^ k
        float sampleFrequency = 1.0f / samplePeriod;

        for( int i = 0; i < width; i++ ) {
            //calculate the horizontal sampling indices
            int sample_i0 = ( i / samplePeriod ) * samplePeriod;
            int sample_i1 = ( sample_i0 + samplePeriod ) % width; //wrap around
            float horizontal_blend = ( i - sample_i0 ) * sampleFrequency;

            for( int j = 0; j < height; j++ ) {
                //calculate the vertical sampling indices
                int sample_j0 = ( j / samplePeriod ) * samplePeriod;
                int sample_j1 = ( sample_j0 + samplePeriod ) % height; //wrap around
                float vertical_blend = ( j - sample_j0 ) * sampleFrequency;

                //blend the top two corners
                float top = Interpolate( baseNoise[ sample_i0 ][ sample_j0 ],
                    baseNoise[ sample_i1 ][ sample_j0 ], horizontal_blend );

                //blend the bottom two corners
                float bottom = Interpolate( baseNoise[ sample_i0 ][ sample_j1 ],
                    baseNoise[ sample_i1 ][ sample_j1 ], horizontal_blend );

                //final blend
                smoothNoise[ i ][ j ] = Interpolate( top, bottom, vertical_blend );
            }
        }

        return smoothNoise;
    }

and for those who are interested, i'm calling GenerateSmoothNoise() in this way ->

    public static float[][] GeneratePerlinNoise( float[][] baseNoise, int octaveCount ) {
        int width = baseNoise.Length;
        int height = baseNoise[ 0 ].Length;

        float[][][] smoothNoise = new float[ octaveCount ][][]; //an array of 2D arrays containing

        float persistance = 0.7f;

        //generate smooth noise
        for( int i = 0; i < octaveCount; i++ ) {
            smoothNoise[ i ] = GenerateSmoothNoise( baseNoise, i );
        }

        float[][] perlinNoise = GetEmptyArray<float>( width, height ); //an array of floats initialised to 0

        float amplitude = 1.0f;
        float totalAmplitude = 0.0f;

        //blend noise together
        for( int octave = octaveCount - 1; octave >= 0; octave-- ) {
            amplitude *= persistance;
            totalAmplitude += amplitude;

            for( int i = 0; i < width; i++ ) {
                for( int j = 0; j < height; j++ ) {
                    perlinNoise[ i ][ j ] += smoothNoise[ octave ][ i ][ j ] * amplitude;
                }
            }
        }

        //normalisation
        for( int i = 0; i < width; i++ ) {
            for( int j = 0; j < height; j++ ) {
                perlinNoise[ i ][ j ] /= totalAmplitude;
            }
        }

        return perlinNoise;
    }

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:
How to decelerate Ship using Vector Objects in Java I am developing an Asteroids type game in Java, using a custom Vector2D class for the Ship. I have a vector object for its position, direction and velocity. I am having an issue with the ship deceleration, currently when there is no thrust (forward key is released) then I multiply my velocity vector by the Drag constant which is 0.3. However the ships speed does not decelerate and will stop abruptly instead, upon releasing the thrust key.

Here is the update method in my Ship Class:

public void update() {
    velocity = new Vector2D(direction);

    if(ctrl.action().turn > 0) {
        direction.rotate(ctrl.action().turn / STEER_RATE);
    }
    else if(ctrl.action().turn < 0){
        direction.rotate(ctrl.action().turn / STEER_RATE);
    }

    //Acceleration
    if(ctrl.action().thrust == 1) {
        velocity.addScaled(direction, DT).mult(MAG_ACC);
    }
    //Deceleration
    else if(ctrl.action().thrust == 0){
        velocity.mult(DRAG);
    }
    position.addScaled(velocity, DT);
    position.wrap(FRAME_WIDTH, FRAME_HEIGHT);
}

Contructor:

public Ship (Controller ctrl) {
    centerX = FRAME_WIDTH/2.0;
    centerY = FRAME_HEIGHT/2.0;
    this.ctrl = ctrl;
    position = new Vector2D(centerX, centerY);
    direction = new Vector2D(position).normalise();
    velocity = new Vector2D(direction);
}

I'd like to ask how I can slow the ship velocity rather than it losing all of its speed instantly. If more code is required I am happy to show it.

sentences:
C++ game-programming; What would be the "next step"? I'm reading C++ Primer Plus 5th Edition. I'm over at Chapter 8 exercises, which is more than half of the book to go but I was wondering what would be the "next step" after I'm through with the book?

I want to use SDL/OpenGL and whatever cross-platform open source api's and libs there are available for other components of game development.

sentences:
How to use OpenTK (OpenGL) with MonoGame? So I've been making a snake game using MonoGame (DirectX Only). I added movement, controls, feeding and growing in length. I wanted to add smooth animations to the game because the snake is just made out of 32 X 32 squares currently and it moves by 32 pixels (1 square) so it's not smooth at all. So I thought I could use the OpenGL template which has both the MonoGame(XNA) framework and the OpenTK framework so that I can make smooth animations with skewing when changing direction for example. The way I have in mind is to make a "skeleton" for the snake and the textures of the body parts would be skewed (or deformed or whatever) to take the shape of that skeleton. But OpenTK doesn't seem to be set up with the MonoGame framework. So can someone point me towards a way of using it to accomplish my goal?

Thank in advance.

sentences:
Why does Unity3D crash in VirtualBox? I'm running Unity3D in a virtual instance of Windows, using the Virtual Box software on Linux.  I have guest additions installed with DirectX support.  I've tried using Windows XP SP3 32-bit, and Windows 7 64bit.  My host is Ubuntu 12.04 64bit.

I installed and registered Unity on both.  It loads up fine, and then crashes my entire VirtualBox instance (equivalent of a computer shutting off with no warning).

sentences:
closing GUI in Unity How do I close the GUI after the user enters a value? Is there any way to stop execution of the entire app (from inside this script) until a value is entered?

using UnityEngine;
using System.Collections;
using UnityEngine;
using UnityEditor;

public class Popup : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

    }

    string record="";

    void OnGUI() {
        //Participant Number/Record:
        GUILayout.Label ("enter participant id:");
        record = GUILayout.TextField(record);
        //GUILayout.TextField()

        if (GUILayout.Button("Submit")) {
            OnClickSavePrefab();
            GUIUtility.ExitGUI();
        }
    }

    void OnClickSavePrefab() {
        record = record.Trim();

        if (string.IsNullOrEmpty(record)) {
            EditorUtility.DisplayDialog("Unable to save record", "Please specify a valid participant record.", "Close");
            return;
        }
        // Save your prefab
        Debug.Log ("record:" + record);
    }
}

sentences: Fastest way to render image data from buffer Currently I am doing my rendering by using a 3D array window_width x window_height x rgb as a buffer, then looping through the buffer and plotting pixels on screen using SDL2 (SDL_RenderDrawPoint). I know this is horrible and stupidly slow but I am not well experienced in graphics techniques. What is the better way to do this?

sentences:
How can I support the creation and rendering of both interior and exterior environments? Say I already have a renderer that can support outdoor terrain and environment rendering. How would I go about adding support for interior environments (for example, like World of Warcraft's dungeons) to my game?

I'm interested both in how I should fit the interiors into my content creation process (for example, I thought about leaving holes in the terrain mesh into which I can "paste" the interior dungeon mesh at runtime) and how to render them (it seems like I'd want a different rendering flow other than a blended texture rendering phase that terrain uses).

sentences:
Trigger for Melee-attack not working I'm currently trying to add a melee-slash attack to my Sidescroller.

For that I decided to to have an invisible box-colliders infront of my character. My idea is to activate it when the attack-key is pressed and leave it active for the duration of the attack before turning it inactive again.

I know from a previous attempt with a dash instead (didn't work out on the movement for it) that my code for the attack-triggering in the player-script works just fine, so now in my box-collider infront of the player I have:

    public GameObject Player;
//public GameObject Box;
bool attack = false;
//Collider c;

void Awake ()
{
    Player = GameObject.FindGameObjectWithTag ("Player");
    //Box = GameObject.FindGameObjectWithTag ("AttackBox");
    gameObject.collider.enabled = false;
}

void Update ()
{
    Player pstats = Player.GetComponent<Player>();
    attack = pstats.attacking;

    if (!attack)
    {
        gameObject.collider.enabled = false;
    }

    if (attack)
    {
        gameObject.collider.enabled = true;
    }

}

And in my Enemy script I have

    void OnTriggerEnter(Collider collision)
{
    Player pstats = Player.GetComponent<Player>();
    if (collision.gameObject.tag == "Player") {
        collision.gameObject.GetComponent<Player>().PlayerHit();
    }

    if (collision.gameObject.tag == "AttackBox")
    {
        pstats.CurrentEXP += 25;
        EnemyDeath ();
    }

}

Though the hit isn't recognized.

The issue I see is that probably the OnTriggerEnter is the issue since the Enemy tends to be allready inside the attack-box collider when the attack is triggered. I tested a bit with the Debug-Log and the box is activated at least, so it should really be just the issue of calling the Trigger at the right time.

Are there any alternatives to OnTriggerEnter that would be working better?

edit:
I tried adding this right below my collision-part in the enemy-script:

    void OnTriggerStay(Collider collision)
{

    Player pstats = Player.GetComponent<Player> ();
    if (collision.gameObject.tag == "AttackBox")
    {
        pstats.CurrentEXP += 25;
        EnemyDeath ();
    }

}

void OnTriggerExit(Collider collision)
{
    Player pstats = Player.GetComponent<Player> ();
    if (collision.gameObject.tag == "AttackBox")
    {
        pstats.CurrentEXP += 25;
        EnemyDeath ();
    }
}

Though the hit is still not recognized.

sentences:
How to set Text in C# code? I'm trying to make a series of text appear programmatically. It's not quite showing up, and I'm struggling to understand exactly why. Any ideas?

GameObject row = new GameObject("Row");
row.transform.parent = panel.transform;
HorizontalLayoutGroup rowLayoutGroup = row.AddComponent<HorizontalLayoutGroup>();
rowLayoutGroup.childForceExpandHeight = false;

GameObject name = new GameObject("Name");
name.transform.parent = row.transform;
GameObject value = new GameObject("Value");
value.transform.parent = row.transform;

Text nameText = name.AddComponent<Text>();
nameText.text = tup.First;
nameText.alignment = TextAnchor.MiddleRight;

Note that this script is run from a Panel, contained within a Canvas.

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:
Forces on entities: remove all each update step, or remove on demand? Following the answer to my question here, the way I apply forces on an entity, is each entity has a Map of forces (Vectors) and their IDs. Every update step, the acceleration vector is set to the sum of all the forces. Forces can be removed by using their unique ID.

In psuedocode:

class Monster extends MovingEntity{
    Vector position, acceleration, velocity;
    Map<String, Vector> forces;
    // .. stuff omitted

    public void update(){
        acceleration = new Vector(0,0); // zeroing the accleration
        foreach force in forces{
            acceleration.add(force);
        }
        velocity.add(acceleration);
        position.add(velocity);
    }

    public void applyForce(Vector force, String id){
        forces.put(id, force);
    }

    public void removeForce(String id){
        forces.remove(id);
    }
}

This works fine, but here is my dilemma:

Currently, after adding a force I have to remember to remove it. For example, psuedocode to demonstrate the way player input is handled:

if(playerInput.leftPressed()) player.applyForce(new Vector(2,0), "left");
// applyForce() internally deletes the previous force with the same name.
else player.removeForce("left");
// have to remember to remove the force. sometimes a little complicated

This can also be annoying e.g. when using steering behaviors. An AI agent may want to Seek somewhere, which applies a force on itself. But when it's done Seeking, it must remove the force.

I'm wondering if it would be a good idea to empty the forces Map at the end of each update step. In the update() method from before:

    public void update(){
        acceleration = new Vector(0,0);
        foreach force in forces acceleration.add(force);
        velocity.add(acceleration);
        position.add(velocity);
        forces.empty(); // emptying the forces list
    }

Returning to the steering behaviors example, this way an agent doesn't need to remove the Seek force when it's done seeking. Each update step, as long as it calls applyForce(..), it will Seek. But the first update step that it doesn't apply a force, there will be no force. All forces are deleted automatically. And since in games forces are constantly deleted and replaced with new ones, I think this seems natural.

What is your opinion? Reset all forces each update step? Or have entities and their environment manually remove forces when it's needed?

sentences:
What are known game mechanics to disallow player to become infinitely rich still keeping it fun to progress? I want to make an online game with a leaderboard. A player should be able to gather tools/resources to continue exploring/harvesting. The problem I want to solve is that someone can find a way to harvest things like money, food, ammo, crafting resources, etc. infinitely but I don't want it to happen, because: 1) it can potentially ruin the leaderboard 2) it potentially disconnects old players from new players because they become interested in different things having nothing to talk about to share the gaming experience. The player should sometimes to be forced to go back to start but it should be still fun.

For example, games about zombies. AFAIK, the game Project Zomboid had zombies amount growing and resouces were limited in such way that you was losing in any way. Why would it be still fun? Because there is a challenge in how many days you can survive.

Another example -- Realm of the Mad God. There you get into the leaderboard only when you die. So once you reach the goal you start from the level 1 again. You can't be in the leaderboard and keep progressing. Why doesn't it ruin the fun? Maybe because you don't lose the loot that you've saved in a "vault" and while you are now level 1 and can't use most of your loot immediatelly it's still there, not lost.

Rogue games like Nethack, Stone Soup, Cogmind -- basically the world has limited size and once you clean the level you have nothing else to do other than go to the next level. It's still fun because once you master your skills in the game the competition changes from maximizing your progress to minimizing steps you've used to reach the end goal. Like spent steps, time, abilities used, etc.

Rust -- in this one players are playing against each other and you lose almost everything when your base is raided. The base is an object in 3d world and to raid it the opponent have to make nearly a straight hole to the center. So the amount of resources you have to spend on armoring your base is X^3 where X is amount of resources needed to raid you. This makes it impossible to infinitely armor yourself and so finally you get raided anyway. Why is it still fun? Maybe because everything gets wiped once in few weeks and there are game updates that make it not boring to start again because the game will be a bit different.

There is a game mechanic in The Elder Scrolls Online that prevents trading guilds becoming infinitely rich as I understand. I'm not the guild owner and so I can be wrong but every week there is a bidding that forces guilds to pay as much as they can to win a bid to, simply saying, have a benefit during the week. AFAIK all the bids are gone and this is how the amount of money the guilds have in the MMO game with no wipes is limited.

I want my game to have some sort of "death" that would reset the progress to effectively keep players away from having infinitely large base, amount of money, etc. while still being fun to start again. What are some other game mechanics for this that I missed?

sentences:
How can I support both multiple resolutions and multiple orientations in a game? I am writing a mobile Android and iOS game.  This game is similar to Doodle Jump, but without scrolling.  In my game I display a background image that should cover the entire screen.  On top of that I draw some 32x32 tile images that make up the platforms.  I have three control buttons that are displayed at the bottom of the screen. The score is displayed at the top of the screen.

I am trying to ensure that this game will work on any resolution and can be rotated from landscape to portrait mode and vice versa. The player should be able to change orientations without losing sight of any platforms.

I have found several methods for doing this, however they only seem to work if you lock the orientation or skew the images.

Scaling the content
Won't work because it will skew images too much and look unprofessional.
Scaling the content and keeping the aspect ratio via letterboxing
The black bars that this introduces can become overwhelming.  For example, if I rotate a 960x640 resolution device to portrait, the new resolution will be 640x960.  When I tried implementing this, it gave me horrible results.

Portrait:

Landscape:

Scaling the x,y axis with separate values

scaling factor (on x-axis) = screen width in pixels / target width in pixels
scaling factor (on y-axis) = screen height in pixels / target height in pixels

This method changes the bounds of the coordinate system, which I am trying to avoid.
Using a virtual viewport
I like this idea, however it still doesn't seem to work with orientation changes.  The variation of aspect ratios seems to be to large when you try this approach for landscape and portrait.

Some good links I found on the topic can be found here
http://blog.gemserk.com/2013/01/22/our-solution-to-handle-multiple-screen-sizes-in-android-part-one/
http://v-play.net/doc/vplay-different-screen-sizes/#approaches-for-content-scaling

I have also thought about only stretching the background image and recalculating the new positions for everything else (player and platforms) when the orientation changes.  However, I'm not sure how this would affect collision detection and jumping in real-time.  I would rather solve this with a different technique if possible.

It seems like most people just lock their game in one orientation.  I am trying to avoid this, if possible.

The bottom line is that all of the methods I listed look to only solve the resolution issue if you lock the orientation.  Is there a way I can support both orientations?

sentences:
How can I draw dashed or dotted lines with a pixel shader? I am trying to draw the 2D graphics (like line, polyline, polygon etc.) using Direct3D for drawing I am using LINE_LIST. Now I want to make the lines thicker and apply patterns to the line as described here.

I am able to draw the thick lines using a geometry shader to draw a quad but to apply patterns I need to write a pixel shader that will do all the stylization of line that is which fragment should be drawn and which fragment of line should be left behind.

I would really appreciate if, anybody could help in writing the pixel shader or provide me any reference to write it.

sentences:
How can I change Box2D bodyDef type of an object after adding it to the world in Libgdx? I have a basic 2d square class that has it's body type set to a Static Body. After the player presses a button on the UI I want to change the body type to a Dynamic Body.

When I change the object to a Dynamic Body within the render method nothing happens.

How can I change the Body Type so that it updates on the screen?

public void show() {
    ...
    s0 = new Square(-10, -20, 5, 5, 3);
    ground = world.createBody(s0.bodyDef);
    ground.createFixture(s0.fixtureDef);
    ground.setUserData(s0.sprite);
    s0.shape.dispose();
    ...
}

public void render(float delta) {
    ...
    if (ready) {
        s0.bodyDef.type = BodyType.DynamicBody;
    }
    ...
}

sentences:
What are the performance implications of multiple windows with indivdual OpenGL contexts? For an engine I'm developing I've decided to allow users to set up multiple windows showing differing views of the same "world."  This is being developed using OpenGL (hopefully aiming for 3.2 core eventually if that affects the ansmer) and SDL 1.3.  The basic structure I've got set up is:

class Window {
    SDL_Window *sdl_window;
    SDL_GLContext context;

    Window(...) {
        sdl_window = SDL_CreateWindow(...);

        // Rest of the setup of world etc.
    }

    gl_init() {
        context = SDL_GL_CreateContext(sdl_window);

        // Set up initial OpenGL settings.
    }

    render() {
        SDL_GL_MakeCurrent(sdl_window, context);

        // Rendering the world.

        SDL_GL_SwapWindow(sdl_window);
    }
}

This all compiles and runs fine with the rest of the demo code I've developed so far, simply showing a pair of slightly offset views.  However, there's no really performance heavy stuff implemented yet.

Is this the correct approach to use?
Are there any major performance implications with switching the context twice (or more) a frame? (other than the expected double (or more) rendering occurring).

For example, does switching contexts force a flush of the graphics memory to the system RAM or something equally frame-rate killing?

Is there an alternative method  that would allow setting up two different viewpoints and rendering them in one pass?
If this is the best way to do it is there a way of sharing data between contexts?  I'm thinking once I switch to VBO's over display lists, if the views overlap in some way they should be sharing VBO's for that portion.

sentences:
Using Threads to create GameObjects I have this game client which connects to the server and sends requests and getting responses.

I have created a separate thread for listening to the server. Based on the response from the server, I want make GameObjects.

But the problem is, the server response is taken into my game using a separate thread. And as far as I know, we cannot create game objects in unity in any other thread than Main Thread.

How to create game objects based on the server response?

I am new to c# and unity. Sorry if this is a silly question. I did some research on the topic and I couldn't find and answer. There were posts saying to use coroutines; but I can't quite understand them.

sentences:
What should I watch out for in a 3d artist's portfolio? I'm looking to hire a freelancer to help with 3d modeling. I've thought up a few qualifiers so far:

Is their topology okay for animation?
Have they demonstrated the technical capabilities necessary for my project? (Have they baked normals, AO maps, etc.)
Have they shown an ability to execute from conceptual drawings?

Are there any massively important things I should watch out for that I haven't included?

Any red flags I should be aware of, like making sure the work isn't plagiarized?

Note

I'm specifically talking about reviewing portfolio content, before interviewing them. I'm looking for things I can say yes or no to, or that I might want to question them on further in an interview.

sentences:
What are the technical certification requirements for the Xbox 360? I came across this document listing the technical certification requirements from March 2009, but I haven't been able to track down anything more up-to-date, nor have I been able to find the "terminology list" that the document refers to.

Is there a current version that is available to non-developers like myself?

sentences:
Storing Tiled Level Data in J2ME game I'm developing a J2ME game which uses tiled backgrounds for the levels. My question is how do I store this tile information in my game. At the moment it is stored as an array; with each number representing a different tile from the tile-sheet. This works well enough, however I don't like the fact that it is 'hard-coded' into the game because (at least in my opinion) it is harder to edit the levels, or design new ones. I was also thinking that it would be difficult if you wanted to add a 'level pack', I'm not sure on how this would be achieved though; it's not something I was planning on doing, I'm just curious.

I was wondering if there was a way I could store level data in some external file and then load this in to the game. The problem is I don't know what the limitations are for J2ME regarding file I/O, can it read in any file like Java? I am aware of the RMS, but from my experience I don't think this would work (unless I am mistaken).

Also, would loading the data in this way be too big a performance hit? Or is there another way I can achieve what I am trying to do. As I said, the way I have it at the moment works fine, and if this is the only viable option then it will suffice.

sentences:
Calculating damage with damage mitigation/amplification curve/function Let's say instance A is attacking instance B for N damage. I want to calculate the ideally expected damage if those instances have damage mitigation/amplification depending on target's current HP.

Instance B has an ability that it will take less damage as its HP gets lower. It could be like a (half of) sin curve, or maybe some complex function. So the formula look something like this:

$$damage = damage_{raw} \cdot ({1 \over 4} + {3 \over 4} \cdot \sin ({\pi \over 2} \cdot {hp \over hp_{max}}))$$

B will have 75% damage mitigation at 0% HP and 0% at 100% HP.

What I want to here is to chop the damage into infinite pieces and apply each to B so B can fully utilize its ability, and get the value after the process.

Also I'd like know how I'll calculate it when A has a similar ability that also changes the damage, like, increasing damage if the target has lower HP. Also there can be a case both of the instances have a variety of damage changers.

I think it's related to calculus but I have no knowledge about it.

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:
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 can I use ImGui to render simple text instead of using stb_truetype directly? Since ImGui builds on top of stb_truetype for its font rendering, I thought it could be nicer to use its already built font-processing capabilities (ImGui::GetIO().Fonts), and render with those, instead of using stb_truetype directly.

However, I've been having trouble figuring out how to do this, specifically how to get quad position/texture coordinates for a given string to use with the preloaded texture at ImGui::GetIO().Fonts->TexID.

I'm not looking to draw buttons/text inside ImGui windows, all I want to do is to use ImGui to build vertex data for a given string so that I can render it anywhere.

sentences:
How to figure out a vector based on 2 points that add up to a certain value I am writing a game in which I am representing a velocity with a vector. I have a starting point and a point that I want the object to move towards at a certain speed. (I need the resulting vector's x and y values to add up to 800). I'm not sure what kind of formula I can use to accomplish this.

SO! I have a starting point. An "ending point". And need a vector whose x and y values add up to 800.

Here is the code I came up with:

dx = size.width / 2 - ball.position.x
dy = 800 - size.height / 2 - ball.position.y
ball.physicsBody?.velocity = CGVectorMake(dx, dy)

Although this appears to work, |dx| + |dy| != 800 and therefore the balls move at slightly different speeds. I'm sure I'm doing this wrong, but I'm not sure how to go about fixing it.

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:
Creating and joining a multiplayer game over a LAN I'm trying to create and join a multiplayer game that has been created from a custom UDK installation.

It works correctly when two (or more) instances of the game are created on the same computer and are connected over localhost by running the following commands:

udk.exe server map_name
udk.exe 127.0.0.1

The problem comes when trying to connect to the game server over a LAN (with the command udk.exe server_ip_address); the clients are unable to connect and the default map is loaded. The server log reports a client disconnection from the computer trying to connect. The client log reports the error, Error: Can't start an online game that hasn't been created.

Both computers are able to ping each other, as well as both having their firewalls disabled. Many combinations of the command-line arguments for starting the server have been tried. Creating an installer from the server machine and installing a fresh copy of the game on the client has also been tried.

Any solutions on how to solve this issue would be appreciated.

sentences:
Maya users; how can I create my own particle emitter in Maya? (Originally posted in the Programmers Stack Exchange, but was told to ask here instead. Whoops.)

Before you answer this with "well, use the built-in particle emitter", read further.

For one of my university assignments, I have to build a scene involving a Catherine wheel (a spinning firework, basically) attached to a fence post in Maya 2015. I had intended on using Maya's built-in particle emitter, but my lecturer has told me that he would prefer me to create my own.

I have only a vague idea of what to do. I know that I need to assign a position, velocity, lifespan and a trigger flag that re-spawns each particle (all of which are arrays that depend on the number of particles the user wishes to spawn), but I don't know how to arrange them.

Any tips and advice would be appreciated.

Thanks

sentences:
Unity animation: How to reset pivot after 3D character somersaults? I have this new character animation that I made in Blender. None of my other animations use Root Transform or anything fancy, and they work great. This new one is special though. The character jumps up, flips upside-down, hits his head on the ground, lands on his back, and stands back up again. See, when he stands up, he is a distance from the pivot point. I imagine that after this animation concludes, transitions to other animations are going to be buggy.  Here is the animation:

I didn't know what to do at the end so I keyed his idle pose where the animation began. This means that for the animation to be seamless, Unity needs to know to move the character FORWARD a specific distance at the same rate that the distance between the character and the pivot point is closing, during the last 2 frames of the animation.

At this point, none of my other character animations need to be tweaked manually. What do I need to do to make sure this animation works with my other animations (walking, running, jumping, etc) so there is no jarring "snap" into position, and animations are correctly aligned?

Could I do this with an animation event? If so, how? I have never used one before.

sentences:
2d array to calculate height for player in heightmap? I'm trying to work out how to do so my player position takes into the account of the floor so if I generate a floor that is hilly when I walk I won't walk through the heel. The problem is that I'm not sure how to do it.

I can do basic collision detection for walls. However, this isn't collision detection. I need the add the height of the terrain to the player.

So as you see the terrain is really a grid with 4 points making a face. So I can get the 4 points and work out. I can probably work this out on myself, but I was wondering if I should store say the heigh at (x,z) in a 2d array or do I just work out the height again everytime I move?

It just I use simplexnoise and I worry that this will be expensive to do every turn.

 import java.util.ArrayList;

    public class VoxelLevel
    {
    Mesh mesh;
    Material material;
    Transform transform;
    Shader shader;

    VoxelLevel(String textureName)
    {
        material = new Material(new Texture(textureName));
        transform = new Transform();

        shader = BasicShader.getInstance();

        generateLevel();

    }

    private void generateLevel()
    {
        ArrayList<Vertex> vertices = new ArrayList<Vertex>();
        ArrayList<Integer> indices = new ArrayList<Integer>();

        int sizeX = 10;
        int sizeZ = 10;
        int freq = 25;

        for(int x=-300; x<300; x+= sizeX)
        {
            for(int z=-300; z<300; z+=sizeZ)
            {
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+3);
                indices.add(vertices.size()+2);
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+1);
                indices.add(vertices.size()+3);

                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, z/freq) + 0.25 * SimplexNoise.noise(2*x/freq, 2*z/freq)),z), new Vector2f(0.75f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, z/freq) + 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*z/freq)),z), new Vector2f(0.75f,1.0f)));
                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*x/freq, 2*(z+sizeZ)/freq)), z+sizeZ), new Vector2f(1.0f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*(z+sizeZ)/freq)),z+sizeZ), new Vector2f(1.0f,1.0f)));
            }
        }

        Vertex[] vertArray = new Vertex[vertices.size()];
        Integer[] intArray = new Integer[indices.size()];

        vertices.toArray(vertArray);
        indices.toArray(intArray);

        mesh = new Mesh(vertArray, Util.toIntArray(intArray));
    }

    public void input()
    {

    }

    public void update()
    {
        //SimplexNoise.noise(0.25, 0.25);
        //SimplexNoise.noise(0.35, 0.65);
        //SimplexNoise.noise(0.254, 0.225);
        //SimplexNoise.noise(0.254, 0.215);
    }

    public void render()
    {
        shader.bind();
        shader.updateUniforms(transform.getTransformation(), transform.getProjectedTransformation(), material);
        mesh.draw();
    }

}

sentences:
Rendering large and high poly meshes Consider an huge terrain that has a lot polygons, to render this terrain I thought of following techniques:

Using height-map instead of raw meshes: Yes, but I want to create a lot of caves and stuff that simply wont work with height-maps.
Using voxels: Yes, but I think that this would be to much since I don't even want to support changing terrain..
Split into multiple chunks and do some sort of LOD with the mesh: Yes, but how would I do that? Tessellation usually creates more detail not less.
Precompute the same mesh in lower poly version (like Mudbox does) and depending on the distance it renders one of these meshes: Graphic memory is limited and uploading only the chunks won't solve that problem since the traffic would be too high.

IMO the last one sounds really good, but imagine the following process:

Upload and render the chunks depending on the current player position. [No problem]
Player will walk straight forward
Now we maybe have to change on of the low poly chunk with the high poly one
So, Remove the low poly chunk and load the high poly chunk [Already to much traffic here, I think]

I am not very experienced in graphic programming and maybe the upper process is totally okay but somehow I think it is too much.

And how about the disk space it would require.. I think 3 kind of levels would be fine but isn't that also too much?

(I am using OpenGL but I don't think that this is important)

sentences:
How to setup input for local multiplayer without split-screen in Unreal Engine 4 To bind actions and axes in the character blueprint class, I may have multiple such character instances for each new APlayerController.  Merely 1 Action Name (e.g. avoiding UseSkill_P1, UseSkill_P2, etc) is required for each character by adding the node in the Player Controller. However, for more functionality the same is required in cpp.

What I've tried:

When I bind actions and axes (delegates) in the APlayerController's  SetupInputComponent (e.g: InputComponent->BindAction("Attack", IE_Pressed, this, &AMyController::DoSomething);, then spawn multiple players with UGameInstance::CreateLocalPlayer(index, err, true), the editor will crash on pressing Play in Editor (Alt+P).

The error thrown during runtime is: Access violation - code c0000005 (first/second chance not available) and referencing the line where the first ActionBind appeared, e.g: UE4Editor_MyProject!AMyController::SetupInputComponent() [d:\path\to\project\source\private\mycontroller.cpp:66]

A common solution can be found in this wiki post it seems. In short, overwrite GameViewportClient and set it as default, then within, overwrite InputAxis and InputKey and increment the player controller index for each input device (gamepad) used.

As mentioned previously, this would require the project to specify a unique Action Name for each player index e.g. Attack_P4.

There is also some confusion that needs to be cleared up.

An AController will not be created for each input device connected.
1-viewport-multiplayer isn't supported as split-screen. (Weird naming, but good for search engines).
Spawning new Local Players is generally done in your override of AGameMode::BeginPlay. I made it up to the deriving BPs of my Game Mode to call CreatePlayers to create up to the set amount of players.
Setting Skip Assigning Gamepad to Player 1 will allow keyboard to be used for player 1.

Hopefully there are some common best practices to tackle this problem. Any suggestion is very much appreciated!

PS Here is the related unreal answers hub question.

sentences:
What's the most efficient way to find the position of a point in relation to corners of a rectangle despite rectangle's scale I am struggling to achieve the following with C# (in Unity). I need to find the position of the points that lay at a given distance (let's say 1m) from the corners of a rectangle, in a way that the segment between these points and the given rectangle corners form 135 degrees with the corresponding sides the of rectangle - no matter where the rectangle goes, what is its rotation or what is its size. Like the following:

So, using the picture above as reference, it means that the red dotted line has always the same length and divides the angle ABC in the middle. So, the angle of the line with AB is 135 and with BC is also 135.

One of the ways to achieve that is the following code:

    Vector3 dotpos = rectangle.transform.TransformPoint(rectangle.transform.localPosition.x+1.5F,0,rectangle.transform.localPosition.z+1.5F);
    bluedot.transform.position = dotpos ;

The problem is that in such solution the distance between the blue dot and the corner of the rectangle is not independent of the scale of the rectangle. It means, the greater the rectangle, the blue dot goes more distant from the corner.

Can anybody tell what is the most efficient way to achieve what I want, i.e. so the position of the blue dot is always at the same distance from the corner no matter the scale, position or rotation of the rectangle?

PS: blue dot is not an object that can be made child of the rectangle.

sentences:
Where can I advertise my engine, library or framework to attract users? I have just finished my hypothetical game engine, library or framework.
Now, I want to share it with people who may find it useful in their projects. Where can I advertise it to gain users?

By advertise, I mean to spread the word of its existence - not advertise it for money.

sentences:
Converting Projected Vertex Positions to Normalized Device Coordinates I'm using directx 9 and vertex shaders to rasterize triangles...I have vertex shader input structs like this:

struct VS_INPUT_Quad
{
   float4 Position : POSITION;
   float2 UV : TEXCOORD0;
};

and pixel shader input structs like this:

struct PS_INPUT_Quad
{
   float4 Position : POSITION;
   float4 Pos2 : TEXCOORD0;
   float2 UV : TEXCOORD1;
};

Here is vertex shader:

    PS_INPUT_Quad SkyboxVisibilityPass_Vertex_Shader( VS_INPUT_Quad Input )
    {
        PS_INPUT_Quad Output = ( PS_INPUT_Quad )0;

// projected vertex position
        Output.Position = mul( Input.Position, mWVP );

// normalized device coordinates of the vertex
        Output.Pos2 = Output.Position / Output.Position.w;
        Output.Pos2.xy *= float2( 0.5, -0.5 );
        Output.Pos2.xy += float2( 0.5, 0.5 );

// prop uv coordinates
        Output.UV = Input.UV;

        return( Output );
    }

Here is pixel shader( simply returns a color from a texture ):

    float4 SkyboxVisibilityPass_Pixel_Shader( PS_INPUT_Quad Input ) : COLOR0
    {
        return tex2D( g_SamplerMultiplier, Input.Pos2.xy );
    }

I'm finding that the Pos2 value sent to the pixel shader is incorrect. Am I incorrectly converting projected vertex position coordinates to normalized device coordinates? PIX says that values are well above 1 when dubugging the pixel shader, however, the output looks correct when looking at the 'mesh' tab while hiliting the draw call...

Here is debug output for a single pixel whose position lies within the clip space:

   //
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
//   sampler2D g_SamplerMultiplier;
//
//
// Registers:
//
//   Name                Reg   Size
//   ------------------- ----- ----
//   g_SamplerMultiplier s0       1
//

    ps_2_0
    dcl t0.xy  // Input<4,5>
    dcl_2d s0
    texld r0, t0, s0  // ::SkyboxVisibilityPass_Pixel_Shader<0,1,2,3>
    mov oC0, r0  // ::SkyboxVisibilityPass_Pixel_Shader<0,1,2,3>

// approximately 2 instruction slots used (1 texture, 1 arithmetic)

Registers:
    oC0 (0.435, 0.435, 0.435, 1.000)    float4
r0  (0.435, 0.435, 0.435, 1.000)    float4
s0      float4
t0  (11.871, 8.631, 0.000, 0.000)   float4

As you can see above, t0 is the Pos2 coordinates that i use to sample the texture...they are well above 1 ... the vertex they belong to is visible so this pixel should have valid normalized device coordinates. Are the coordinates being altered after leaving the vertex shader and arriving at the pixel shader?

sentences:
D3DXVec3Project returns odd values I would have thought that if the object is on-screen that this function should return screen coordinates. When used in conjunction with the directX draw text function, it works fine. Textual overlays track the 3D objects perfectly, however consider the following code:

D3DXVec3Project(&xyCoords, &HeadPosition(), &viewport, &matProjection, &matView, &matFinal);//for thought bubble

D3DXVECTOR2 origin = D3DXVECTOR2(
    (0.0f / SCREEN_WIDTH) * 2.0f - 1.0f,
    (0.0f / SCREEN_HEIGHT) * 2.0f - 1.0f);

D3DXVECTOR2 headPos = D3DXVECTOR2(
    (xyCoords.x / SCREEN_WIDTH) * 2.0f - 1.0f,
    (xyCoords.y / SCREEN_HEIGHT) * 2.0f - 1.0f);

lineRenderer.Draw2DLine(origin, headPos, D3DXCOLOR(1, 0, 0, 1), D3DXCOLOR(1, 1, 0, 1));

origin has a value of -1, -1 which is fine (texture coords for the screen go from -1 to 1 in each axis) but headPos has the value of -1.#IND000 in both the x and y. I think this may be because D3DXVec3Project is returning MASSIVE numbers, although I could be wrong.

Who knows what's going on under the hood of DrawText_A in the following code, but it clearly compensates for whatevers not working with the above code.

D3DXVec3Project(&xyCoords, &HeadPosition(), &viewport, &matProjection, &matView, &matFinal);

    rct.left   = xyCoords.x;
    rct.right  = xyCoords.x;
    rct.top    = xyCoords.y;
    rct.bottom = xyCoords.y;

    m_font->DrawTextA(NULL, stateStream.str().c_str(), -1, &rct, DT_LEFT|DT_NOCLIP ,   D3DXCOLOR(1,0,0,1));

This all works perfectly. Where am I going wrong with the first bit of code?

EDIT - the code below gives me the following values (also listed below)

D3DXVECTOR2 origin = D3DXVECTOR2(
    (0.0f / 1280.0f) * 2.0f - 1.0f,
    (0.0f / 720.0f) * 2.0f - 1.0f);

D3DXVECTOR2 headPos = D3DXVECTOR2(
    (xyCoords.x / 1280.0f) * 2.0f - 1.0f,
    (xyCoords.y / 720.0f) * 2.0f - 1.0f);

for origin I get (-1, 1.2) and for headPos I get (0, 1.401e-043#DEN). FYI HeadPosition() will return a vector3 that has a 0 z component and x and y values from about 2 to roughly 33.

Now how on earth can me with a calculator be better than the computer? what am I missing?

0.0f / 720.0f) * 2.0f - 1.0f should clearly = -1, not 1.2! what is going on?

0 / anything = 0, 0 * 2 = 0, 0 - 1 = -1!!!

sentences:
How do I get a delay in motion to happen? (Unity) I want the cockpits rotation to lag behind that of the cameras, so I wrote this code:

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

public class Delay : MonoBehaviour {
    public Transform BodyRot;
    public Transform CurrentRot;
    public Vector3 changeInRot;
    public float divideRot;
    Vector3 BodyTarget;
    Vector3 CurrentInitialRot;

    // Update is called once per frame
    void Update () {
        Vector3 BodyTarget = BodyRot.rotation.eulerAngles;

        Vector3 CurrentInitialRot = CurrentRot.rotation.eulerAngles;

        changeInRot = BodyTarget -= CurrentInitialRot;

        if(CurrentInitialRot != BodyTarget)
        {
            RotateFinal();
        }

    }

    void RotateFinal()
    {
        CurrentInitialRot += changeInRot / divideRot;
        transform.rotation = Quaternion.Euler(CurrentInitialRot);
    }
}

But it glitches out frequently. (DivideRot is how many times to divide the distance between the target and current position, so that it takes time to rotate)

sentences:
How do I modify the health of an entity after it has been created? Is there any way to add or remove health after an entity has been created?

For example, I'd like to have a mob regenerate "hearts" when some event happens.

sentences:
Rotate 2D Isometric World Games like RollerCoaster Tycoon allow you to rotate the view at 90 degree intervals. I'm wondering how I could apply this to a game I'm making. I'm using MonoGame... but I'm wondering more if anyone could explain the theory behind the transformation rather than something language specific.

This video is exactly what I want to accomplish: http://youtu.be/qitkgiP13gw?t=15s

Basically all my tiles are in a 2D grid, and I just convert each X and Y to isometric for drawing. I'm assuming the transformation might be straight forward since it's a matter displaying the tiles with the right transformation.

Any help is greatly appreciated!

sentences:
How to prevent a duplicated shadow? It's a blob shadow which is built in Unity's standard asset package.

As you see in the figure below, a shadow that is created by the Unity Projector is duplicated at the floor below.

How can I prevent this duplicated shadow?

sentences:
Online leaderboards for iPhone games I'd like to add an online leaderboard to my iPhone game.  Upon discovering the time and effort required to create a Game Center account I started considering other options.

What do you use for online leaderboards?  Why?

I'm open to a variety of options including App Engine, using EC2, Open Feint, PlusPlus etc.

-- I'd like to make this a community wiki but I don't see the option.

sentences:
What harm would be done if a user were able to play the client side of a multiplayer game without logging in? I am currently developing a multiplayer game for a university project. The purpose of the assignment is to learn about the use of a cluster architecture, but I have a question concerning security.

The multiplayer role-playing game that I'm developing for class utilizes a client-server architecture. The client holds all of the game assets and a 2D game engine. The server provides authentication to log into a user account, provides access to characters and their progression, etc. The server also provides the positions of non-player characters and other players on the same server, and also provides their actions and movements.

My question is whether a tech savvy user that modified the source code of the client could "play the game" without authenticating, forcing a kind of single player version of my game? I am imagining a user sending the client his/her own custom information about where to spawn enemies and whatnot. Maybe he/she would simply want to move around the game world freely.

1) Does this scenario seem possible?

2) Most importantly, what harm could this cause to a multiplayer game? Perhaps I have content that I don't want someone to be able to access without properly purchasing the game, or if they have been banned for some reason.

3) If this is a problem I should try to mitigate, how could I go about preventing this kind of thing from happening?

sentences:
Libgdx Scene2D Table background not showing up I am using Libgdx's Scene2D API to build my UI and everything has been working as expected until now. I created a Skin and a TextureAtlas and linked them as so:

Skin skin = new Skin();
TextureAtlas uiElements1 = new TextureAtlas("skins/uielements1.txt");
skin.addRegions(uiElements1);
skin.load(Gdx.files.internal("skins/uiskin.json"));

And then I tried to create a Table:

Table table = new Table(skin);
table.setWidth(stage.getWidth());
table.align(Align.center|Align.top);
table.setPosition(0, Gdx.graphics.getHeight());
table.padTop(30);
table.setBackground("grey_button02");

Finally, I added a Label to the Table:

Label gameTitle = new Label("Nameless Project", skin, "title");
table.add(gameTitle).padBottom(10).row();

Once I added the Table to my Stage, only the elements in it would show up and not the background image. I tried using background(String s), setBackground(String s), background(Drawable d), and setBackground(Drawable d). None of those seemed to work for me.

I also tried calling pack() and setFillParent(true) but both of those made my table disappear. I have gone through just about every Google result and I can't find anyone else with my issue.

Here is my uiskin.json file

{
  com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: fonts/FutureThin.fnt } },
  com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
   default: { down: blue_button03, up: blue_button04, font: default-font },
  },
  com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
    default:  {
      titleFont: default-font
     }
   },
   com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
    title: {
        font: default-font
     }
   }
}

And the entire class rendering the stage:

public class MainMenu implements Screen {

    GameClass myGame;

    Stage stage;
    Skin skin;

    Table table;
    TextButton singlePlayer;
    TextButton multiPlayer;
    Label gameTitle;

    public MainMenu(GameClass g) {
        myGame = g;

        // Create Skin, load texture Atlas, load skin
        skin = new Skin();
        TextureAtlas uiElements1 = new TextureAtlas("skins/uielements1.txt");
        skin.addRegions(uiElements1);
        skin.load(Gdx.files.internal("skins/uiskin.json"));

        // Create stage
        stage = new Stage(new ScreenViewport());

        // Create Table
        table = new Table(skin);
        table.setWidth(stage.getWidth());
        table.align(Align.center|Align.top);
        table.setPosition(0, Gdx.graphics.getHeight());
        table.padTop(30);
        table.setBackground("grey_button02");

        // Game Title
        gameTitle = new Label("Nameless Project", skin, "title");
        table.add(gameTitle).padBottom(30).row();

        // Single Player button
        singlePlayer = new TextButton("Single Player", skin, "default");
        singlePlayer.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent e, float x, float y) {
                myGame.setScreen(new WorldTesting(myGame));
            }
        });
        table.add(singlePlayer).width(300).padBottom(30).row();

        // Multiplayer Button
        multiPlayer = new TextButton("Multiplayer", skin, "default");
        multiPlayer.setWidth(350);
        multiPlayer.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent e, float x, float y) {
                // Change Scenes
            }
        });
        table.add(multiPlayer).width(300).padBottom(30).row();

        stage.addActor(table);
        Gdx.input.setInputProcessor(stage);
    }

    public void show() {

    }

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

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

    public void hide(){

    }
    public void resize(int x, int y) {

    }
    public void pause() {

    }
    public void resume() {

    }
    public void dispose() {

    }

}

sentences:
Why is it that there are invalid "dt" values in physics simulations? I'm utilising some of NeHe's spring code, and after getting some pretty weird results I eventually realised the source of my error - my "dt" value in my Update function; the value that everything is multiplied against to speed up/slow down the calculations, hopefully based on frame rate. For example:

public void Update(GameTime gt) {
   float dt = gt.ElapsedGameTime.Milliseconds / 160.0f;
   velocity += (force / mass) * dt;
   position += velocity * dt;
}

160.0f seems to work pretty well for the player's update function, but for my spring simulation I need a value of about 3000, or I end up with my springs located at (NaN,NaN) pretty much instantly.

Why do bad values for this cause everything to go so crazy? I thought it would just slow down or speed up my simulation but it seems to cause some weird cascading failure.

Edit: Sorry, forgot to link to NeHe's post on this: http://nehe.gamedev.net/tutorial/introduction_to_physical_simulations/18005/

sentences:
Möller-Trumbore intersection point I am using the Möller-Trumbore method as part of my (still very basic) collision detection system.

The information I'm craving about is the distance from the ray origin and intersection point. The intersection point would be fine too obviously.

I probably wrongly assumed t in the code below is actually the distance from the ray origin to the intersection point. If it actually is, then I don't know what's wrong with my code.

I have got a simulation with a mesh and "bullets", sometimes firing a collision acurately, and sometimes not (bullets passing thru mesh, or firing a colision before it actually should hit).

bool rayTriangleIntersect(const XMFLOAT3 &orig, const XMFLOAT3 &dir, const XMFLOAT3 &v0, const XMFLOAT3 &v1, const XMFLOAT3 &v2, float &t, float &u, float &v) {
// http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection

    float kEpsilon = 0.000001f;
    XMFLOAT3 v0v1 = v1 - v0;
    XMFLOAT3 v0v2 = v2 - v0;
    XMFLOAT3 pvec = XMFLOAT3Cross(dir, v0v2);

    float det = XMFLOAT3Dot(v0v1, pvec);

    if (det < kEpsilon) return false;

    float invDet = 1.0f / det;

    XMFLOAT3 tvec = orig - v0;
    u = XMFLOAT3Dot(tvec, pvec) * invDet;
    if (u < 0 || u > 1) return false;

    XMFLOAT3 qvec = XMFLOAT3Cross(tvec, v0v1);
    v = XMFLOAT3Dot(dir, qvec) * invDet;
    if (v < 0 || u + v > 1) return false;

    t = XMFLOAT3Dot(v0v2, qvec) * invDet;

    return true;
}

Is t really the distance im looking for ? If not how do I get it, or the intersection point. I've heard of baricentric coordinates in a triangle related to u and v - is it the way to go ? If yes I'd be thankful for an example or link related to the Möller-Trumbore method.

Thanks!

sentences:
How to hide Game Progress Files saved in Application.persistentDataPath in Unity Android I am developing a game that saves its state in a text file. I am writing that file in Application.persistentDataPath but my issue is that the game progress file is available to user in Data/PACKAGE NAME/files/*.

How can I hide the game progress file so that user can't access the files ?

sentences:
Designing RPG player classes, and the trend to avoid a Priest or Cleric RPG class From my experience, RPG classes ("hero" or "villain" types) are often divided into four categories:
 1. Mage
 2. Priest
 3. Rogue
 4. Warrior

However, there are quite a few popular RPGs that ignore the Priest or Cleric "base" character class entirely.  Two game series of note: The Elder Scrolls (Skyrim), and Dragon Age.

Is there a specific reason why this is so?  Perhaps the background story makes allowing players to be a Cleric difficult; for example, if there is a large amount of NPCs in the game that have the adventure class of Cleric, and making that class available to players would be detrimental to the story of the game.

I've pondered this quandary myself when working on developing my own video RPG; should the character class options be sub-categorized with the aforementioned base classes?  Or perhaps even more difficult of a question to answer, should a video RPG include some kind of Deity system?

The RPG approach to "gods" is difficult for me, particularly because I've have somewhat of a spiritual perspective on real life, I'm not sure how to reconcile my choices with game design to my choices regarding spirituality.

Any helpful responses will be greatly appreciated!

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:
Generate platforms and move them with same speed I'm building an infinite runner and have to generate pillars on which the player jumps. There's a minimum and maximum value for how much gap can exist between two pillars. In addition to this, i want the pillars to move to the left with increasing velocity. All pillars need to have same velocity.
So, i made a pillarHolder object which would have velocity that increases with time. The instantiated pillars would be made children of this pillarHolder. Code is:

 if ((Vector3.Distance (go.transform.position,transform.position)<25f)) {

                t=rand.Next(13,35);
                t=t/10;
                //Debug.Log(t);
                tempx+=t;

                pos=new Vector2(tempx,-2.22f);

                go=Instantiate(pillar,pos,Quaternion.identity) as GameObject;
                go.GetComponent<Transform>().parent=holder;
            }
holder.GetComponent<Rigidbody2D> ().velocity=new Vector2(-10f,0);

The problem is, the pillarHolder keeps moving in the negative x direction and after a while, the pillars are not positioned properly. The gap between them exceeds the maxGap.
I tried to solve the problem by resetting the pillarHolder's position once it went beyond position.x=-20f. But when it's position resets, child objects are reset too.

Any help please?

sentences: RTS game engine for iOS/iPhone Anyone know any free or non-free RTS engine that can be used for iOS game development?

sentences:
Loading scene before load the level? I didn't understand this point yet. for me its complicated. What i'm trying to do is a level as loading scene work to appear before load the game level. when loading progress bar complete you have to press any button to play the game. Here is my script:

// game level01
// game level02
// loading scene

 public float progressBar;
 public void nextlevel() // this for button
{
 LoadNextLevel();
}

IEnumerator LoadNextLevel()
{
    AsyncOperation async = Application.LoadLevelAsync("level02");
    yield return async;

}

Example from "ninja gaiden black". when you select any level to play. loading scene show up. when complete loading the level. new word appear inform yo to press X to play.

sentences:
Algorithm for staying "alive" forever I am implementing a game where the player is playing(sliding) the little red rectangle and the purpose is to not hit the black rectangles and to not move out of the inner blue rectangle. The black rectangles are moving in trajectories from left to right(right to left) and from top to bottom(bottom to top). The speed they are moving with is constant e.g. 5 pixels. You can get a better idea in this video.

One of the game modes is the following - 2 paths will be proposed by the game displayed as arrows and one of them may lead to "death", while the other will always be the right one and the user will have to choose one of them until he makes the wrong choice. The movement directions can only be top,bottom,left or right and not diagonal and the speed of the red rectangle is constant e.g. 6 pixels and the black rectangles speed is 5 pixels.
I am struggling with the algorithm for the "successful" direction for more than a week and what I have done so far is the following :

Generate a random float number between 1.0 and 2.0 seconds and then divide the generated number by 0.030 for example to get the number of moves that will be made by the black rectangles and red rectangles.
Calculate the black rectangles and red rectangle move points that will be made for the following time session by multiplying the number of moves by the speed which is 5px for the black rectangles and 6px for the red rectangle.
After I know the speed of the black rectangles and the number of moves I can tell their position in any time of the current time session.
Move the red rectangle to the left until it is being hit and remember that result e.g. 15 moves until hit. Do the same thing for right,up,down direction.
Sort the direction by the moves that can be made before hit in ascending order.
Move the red rectangle in the direction in which the most number of moves can be made.
Do the same thing until the time session ends i.e. the random float number generated in the first step.
This solution works most of the time, but some times it leads to a position where an escape is not possible. The problem is not in the code, but in the algorithm logic.
For example look at the following image :

As you can see the red rectangle will go to a position where it will be stuck by two of the black rectangles. The best possible solution in this situation would be to move to top 1 time and then to left and after that to top, because the black rectangle in the top left corner is going to top, but I really have no idea how to solve this task. What would be the optimal way to accomplish this task.
Thank you in advance!

sentences:
In a shader how to map UV coordinates of texture to the UV coordinates of a tile in a tile set? I am writing a fragment shader for a tile set. In the shader I have the UV coordinates of the whole texture, however, I am interested in the UV coordinates of the current tile that is being rendered. In other words: in my shader I am interested to know where the current pixel is within the current tile, not within the whole texture.
So given the overall texture size and the rectangle that defines the tile to render within that texture, and given the UV coordinates of the current pixel corresponding to the whole texture, how can I convert these UV coordinates to the "inner" UV coordinates of the current tile, but also in the range of [0.0,1.0]?

sentences:
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 do game devs optimize their games for new CPUs/architectures? I've learned that DirectX helps devs to program games on a variety of hardware. However, that's the visual/graphics side of things.

How do game devs deal with new CPUs or CPU architectures? Is there another API for that? Do they use DirectX for this too? Or do they need to learn the ins and outs of the architecture and program accordingly?

Thanks.

sentences:
Friction due to gravity in an impulse based physics engine In my physics engine, I'm using impulses to solve collisions. I'm basing all calculations on these equations:

impulse = desired_velocity_change * mass
impulse = force * time
friction_force <= normal_force * coefficient

If an object moves along flat ground (infinite mass), after integration it'll be moving slowly "into" the ground due to gravity. This means that the impulse needed to react to that (given the restitution equals 0) will be the velocity in the direction of the contact normal, multiplied by mass.

The issue here is that gravity is a constant acceleration, which means that the object, no matter the mass, will always "dip" by the same amount given a constant frame rate. So the mass is never a factor in this situation, outside of the impulse calculation, which is just a flat velocity change.

Now, I can use impulse to calculate the force that was needed to react to the collision, this force can then be used in the friction equation as such:

friction_impulse / time <= normal_impulse * coefficient / time

Since time is always greater than 0, I can just multiply both sides by it, and then I can use the impulse equation, as such:

planar_velocity_change * mass <= velocity_change_along_normal * mass * coefficient

And again, I can just remove mass from the equation, which leaves me with:

planar_velocity_change * mass <= velocity_change_along_normal * mass * coefficient

This is the desired velocity change along the contact surface due to friction. The issue is, obviously, that none of this depends on mass, which means that no matter how heavy or light an object is, it'll always continue sliding along the surface by the same amount given a constant initial velocity.

What am I missing? It really looks like there's a logical mistake here. Should the dynamic friction depend on the mass in the first place? Moving a heavy object requires higher force, so static friction should be modeled properly, since it just flat-out removes velocity, though it'd be nice to hear if this has merit or just "looks good".

sentences: Which consoles support fee-less indie game publishing? On which consoles can I publish indie games without paying a license fee?

sentences:
How do you set up PhysFS for use in a game? After my recent question on GD I've been advised to use PhysFS to pack all my game data in 1 file. So I have, and the decission wasn't light, because I've tried out every library in my answers but none contained a single good tutorial whatsoever, in fact PhysFS is the poorest documented library I've ever seen.

After attempting to set up PhysFS in my game I realized it's not as simple as adding the headers to the project, it appears something much more complicated, in fact after my first attempt to install PhysFS the compiler ran out of memory to display errors, it reached the critical count of 50 errors.

So basically what I'm asking here is: How can I set up PhysFS on my game? I'm using Code::Blocks IDE on Windows XP SP3;

sentences:
Game physics presentation by Richard Lord, some questions I been implementing (in XNA) the examples in this physics presentation by Richard Lord where he discusses various integration techniques. Bearing in mind that I am a newcomer to game physics (and physics in general) I have some questions.

15 slides in he shows ActionScript code for a gravity example and an animation showing a bouncing ball. The ball bounces higher and higher until it is out of control. I implemented the same in C# XNA but my ball appeared to be bouncing at a constant height. The same applies to the next example where the ball bounces lower and lower.

After some experimentation I found that if I switched to a fixed timestep and then on the first iteration of Update() I set the time variable to be equal to elapsed milliseconds (16.6667) I would see the same behaviour.
Doing this essentially set the framerate, velocity and acceleration to zero for the first update and introduced errors(?) into the algorithm causing the ball's velocity to increase (or decrease) over time. I think!

My question is, does this make the integration method used poor?
Or is it demonstrating that it is poor when used with variable timestep because you can't pass in a valid value for the first lot of calculations? (because you cannot know the framerate in advance).

I will continue my research into physics but can anyone suggest a good method to get my feet wet?
I would like to experiment with variable timestep, acceleration that changes over time and probably friction. Would the Time Corrected Verlet be OK for this?

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 communicate to an inventory item which character it's being used on? Currently, I have an Inventory that is a ScriptableObject, which means it's not tied to any specific game object or player character. I just drag it into a MonoBehaviour if I would like expose the data of the inventory.

I have created an InventoryUI, which is a MonoBehaviour attached to a GameObject in my scene, and I assign the Inventory SO to it.

The InventoryUI contains button GameObjects with an InventorySlot script, to which I assign the item each slot is holding.

Everything works fine. When I click on one of the InventorySlot buttons, I'm able to call item methods, such as UseItem.

My problem is if the the item is a potion, for example. How can i add health to the player? Of course I could add reference to the player to the slot. But that will reference player repeatedly over 25 slots.

sentences:
What should I do with global high scores when the game has a major update? I have a game that people have been playing for several years now. The game has a global high score list, and there has been some fierce battles among the players for the top positions.

I now want to make a major update to the game, but the changes I have in mind will bring the maximum theoretical score down to about 80% of what it currently is. This is just an estimate, of course, I haven't gotten very far into the update, but it will definitely come down. I should also note that this game has no logical, absolute maximum score because it is based on things like time and resources used as well as kills.

So the question is, what do I do with the current high scores when I release the update? It doesn't seem right to leave it because no one will ever be able to take the high spots, and new scores won't really compare to old ones. I don't think I should wipe it because a lot of people worked really hard to get there. Any suggestions?

Edit to add:

I also don't think I can adjust the current score values because they are a sum of many small games, and the user can replay those to get an increase to the total. An adjustment would make a confusing mismatch.

sentences:
(Unity) Drag and detect object below when dropping I'm studying game development in Unity and I want to create a idle/clicker game like Cow Evolution.

I'm using OnMouseDown, OnMouseDrag and OnMouseUp to move the GameObject around the scene.

Now I want to detect the collision when dropping (OnMouseUp) a GameObject over another GameObject.

Like in this video:  https://www.youtube.com/watch?v=3OK77oVV_G0

Assuming there's more than one object below, I must detect which one is with most below the dropped object.

I apologize if it is difficult to understand my English.

Thank you.

sentences:
Would it be possible to edit character models of a PS1 game, to be played on an emulator? There are some abandoned PS1 oldies out there that I would love to see revamped with improved assets. I have some skills with some some modelling programs, so I was wondering if it would be possible to rip some models with or without their textures so that I could try to update them, and experience them on an emulator. Is this possible?

Even if the edited copies cannot be reinserted into the game, would it still be possible to rip the models out so that I could edit them?

sentences:
A simple map, four biomes, and how to distribute them Here's the basic idea: I've got a Rogue-ish, perhaps Dwarf Fortress-ish game, with a randomly generated overworld and several dungeon entrances scattered around it. I already have the dungeons basically covered, but I'm stuck on an aspect of the overworld.

Said overworld, considered as a 2D map of screens, should have a perhaps blob-like distribution of four different themes or biomes -- grasslands, desert, snow and swamp, each with their own total amount of screens. Let's say the map is 8x8, which gives 64 unique screens. Half of those could be grasslands, a quarter desert, and swamp and snow get a quarter each:

It seems palette reduction has made snow the same color as swamp. Originally, there were eight snow screens in the bottom corner, and a slightly staggered eight-screen swamp area in the middle. Sorry 'bout that, and please ignore the location markers.

The best I could get was some snaking shapes, and often enough with nonsensical combinations like desert snaking through snow (or vice versa). I can't for the life of me figure out how to get it nice and blobby, let alone having it make climatical (?) sense. So how do I generate a biome map like in the mockup?

Okay, by request: the world really isn't much bigger than that example, and what I need is just a way to spread some blobs that determine thematic appearances, with the extra limitation that snow can't touch desert. Screens don't scroll, and if a screen is set to "desert", there'll be no grass anywhere on it.

sentences:
How to make racer map? Hi everyone does 3D racer games use heightmap to build tracks or programmers just use easier solution ? I need to build only track space(road) without fill all hectares with trinagels and more important i need to raise smooth ascents on this tracks

i aksing for some tips not for completle solution of course.

sentences: What are the advantages and disadvantages of both writing a wrapper, and not writing a wrapper? I am going to use Ogre3D as the rendering engine for our 3D software. I am not sure if I need to use the engine as it is, or if I need to write a wrapper for the parts I want to use. What are the advantages and disadvantages of both writing a wrapper, and not writing a wrapper?

sentences:
Minecraft-style player-gound collision detection The title pretty much says it all... (Minecraft is a game consisting of evenly-spaced cubes for terrain, like voxels)
Note: I am using C# XNA.

I am pretty sure AABB is the way to go, yet I don't know how to implement it. I admit, I'm almost looking for code, but theories/ideas are very welcome.

Important capabilities of my code: I have a function that can get a block anywhere in the world, and get a BoundingBox for that cube. Hence, I have created a BoundingBox for the player to collide with those cubes. My idea was to get the blocks around the player (maybe 4x6x4) and test against those.

The problems I have been having: Say the world is a flat plane. If I use the method of go the shortest distance out, then if the player is slightly clipped into the ground (from gravity), but even slighter into the next block over, then the player will be pushed sideways (and so cannot walk along ground). Of course, this is assuming I react to every block intersected. Another problem is knowing which direction to go (aka negative x or positive). That takes me to my final problem- Getting the amount of intersection, in the correct direction (+ or -) has been tough for me.

I hope I haven't been too hard to understand, I'm not too good at explaining things... And if this question has already been asked, I'm sorry, I looked for it... for 3 days straight.
One last thing, if someone knows exactly how minecraft does it, or has source (I know MC modders have the source, how else would they mod), please point me to it.

sentences:
delaying enemy attacks I have an enemy attack script that when a raycast hits the player it deals damage to the player, however the enemy attacks at multiple times per second and I wish for the enemy to have to wait 1 second after it attacks the player before it can attack again. The script is here, the main focal point is the void update(). Any help is appreciated, let me know if I've missed out any needed details. :)
public class DamagePlayer : MonoBehaviour
{
    int attackDamage = 10;

    [SerializeField]
    float agroRange;

    [SerializeField]
    Transform castPoint;

    Rigidbody2D rb2d;

    bool isFacingLeft;

    // Start is called before the first frame update
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();

    }

    bool CanSeePlayer(float distance)
    {
        bool val = false;
        float castDist = distance;

        if (isFacingLeft == true)
        {
            castDist = -distance;
        }

        Vector2 endPos = castPoint.position + Vector3.right * castDist;
        RaycastHit2D hit = Physics2D.Linecast(castPoint.position, endPos, 1 << LayerMask.NameToLayer("Action"));

        if (hit.collider != null)
        {
            if (hit.collider.gameObject.CompareTag("Player"))
            {
                val = true;

            }
            else
            {
                val = false;
            }

            Debug.DrawLine(castPoint.position, endPos, Color.red);
        }
        else
        {
            Debug.DrawLine(castPoint.position, endPos, Color.green);
        }

        return val;
    }

    // Update is called once per frame
    void Update()
    {
        if (CanSeePlayer(agroRange))
        {
            PlayerHealth.currentHealth -= attackDamage;
            //Debug.Log("can see player");
        }
        else
        {

        }
    }
}

sentences:
Help Needed with Shaders Ok, bear with me, I am a beginner with Google Cardboard programming.
What I have been doing is looking at the TreasureHunter sample app from Google's page and (with the help of documentation and other sources) have been trying to create a simple cube floating in space.
 I have also been trying to avoid making everything as bare bones as the sample, so I have been trying to object orient things such as lights and the meshes.

I am pretty sure that my matrices and methods are correct, but I think there could be something wrong with my shaders.

When I compile the app and install it, no errors are thrown, but I am given just my white screen (set with glClearColor) with the Cardboard binocular UI/view; no cube is rendered, tilting/looking around has no effect.

I am using the colors, verticies, and normals from the Treasure Hunter sample, so those should be correct.

Full source code (Java) is here.

uniform mat4 u_Model; // model position in world space
uniform mat4 u_MVP;  // model in projection space
uniform mat4 u_MVMatrix; // model in view space
uniform vec3 u_LightPos; // Light position in eye/camera space (projection space)

attribute vec4 a_Position; // vertex in local space
attribute vec4 a_Color; //Vertex colors
attribute vec3 a_Normal; //vertex normal

varying vec4 v_Color; // color
varying vec3 v_Grid;
varying vec3 v_Normal;
varying vec3 v_Position;

void main() {
   v_Grid = vec3(u_Model * a_Position);
   v_Normal = vec3(u_MVMatrix * vec4(a_Normal, 0.0));
   v_Position = vec3(u_MVMatrix * a_Position);
   vec3 modelViewVertex = vec3(u_MVMatrix * a_Position); //Vertex position in view space
   vec3 modelViewNormal = vec3(u_MVMatrix * vec4(a_Normal, 0.0)); //Normal in view space

   float distance = distance(u_LightPos, modelViewVertex);
   vec3 lightVector = normalize(u_LightPos - modelViewVertex);
   float diffuse = max(dot(modelViewNormal, lightVector), 0.5);

   diffuse = diffuse * 1.0/(distance * distance);
   v_Color = a_Color * diffuse;
   gl_Position = u_MVP * a_Position;
}

My vertex shader:

My fragment shader:

precision mediump float;

varying vec4 v_Color;

void main()
{
    gl_FragColor = v_Color;
}

sentences:
Unity 5 2d Magnet Power Up I made a car game with coins and power up but i wrote a code for magnet power up but in start work fine but after i get power up magnet all coin in surface i collect but after this don`t spawn coin any more and show me this error: Picture 1. And here my code:

//Car script
//PowerUp Magnet Sector
    public bool magnetPowerUp = false;
    public float MagnetDuration;

     private void OnCollisionEnter2D(Collision2D col)
    {
        //Magnet
        if (col.gameObject.tag == "Magnet")
        {
            col.gameObject.SetActive(false);
            StartCoroutine(Magnet());
        }
     }

     IEnumerator Magnet()
    {
        magnetPowerUp = true;
        yield return new WaitForSeconds(MagnetDuration);
        magnetPowerUp = false;
    }

    //CoinScript

    using UnityEngine;
using System.Collections;

public class CoinSpaws : MonoBehaviour
{
    public carController car;
    public GameObject player;
    public GameObject[] coins;
    int coinNo;
    public float maxPos = 1.7f;
    public float delayTimer;
    float timer;

    // Use this for initialization
    void Start()
    {

        timer = delayTimer;

    }

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

        timer -= Time.deltaTime;
        if (timer <= 0)
        {

            Vector3 coinPos = new Vector3(Random.Range(-1.7f, 1.7f), transform.position.y, transform.position.z);
            coinNo = Random.Range(0, 2);
            Instantiate(coins[coinNo], coinPos, transform.rotation);
            timer = delayTimer;

        }

        if (car.magnetPowerUp)
        {
            coins = GameObject.FindGameObjectsWithTag("coin");
            foreach (var treasure in coins)
            {
                treasure.transform.position = Vector2.MoveTowards(treasure.transform.position, player.transform.position, 5.0f * Time.deltaTime);
            }
        }
    }

}

sentences:
How do you draw a random irregular polygon in java? (Asteroids) I am coding an Asteroids game in Java. In the real arcade game, asteroids are made of irregular shapes like this:

When I code, I can only set asteroids to 1 or another specific shape, like this:

I want to make all of the asteroids in my game of totally randomly generated shapes, and I am already tired of designing specific shapes of my own. Here is a snippet of my code that generates the asteroid's shape. P.S: The image does not show it, but I am using the Polygon class and constructor which only enables me to input 2 int[]s and a number of sides.

   public void makeShape() {
    int x = (int) this.x;
    int y = (int) this.y;
    this.shape = new Polygon(new int[]{x - 15, x - 30, x - 10, x - 13, x,x + 10, x + 10}, new int[]{y - 30, y - 15, y + 5, y + 30, y + 35, y + 30, y}, 7);
}

I have tried putting all of the variables on Math.random(), but it outputs nothing but a scribble, even if I were using the Polygon class.

sentences:
2D AABBs and resolving multiple collisions Okay, so this is a problem I've been trying to figure out for quite some time. Mine is a 2D platformer game with a world made up of (usually) immobile tiles and mobile sprites, both of which use AABBs to represent their hitboxes. This game is NOT grid-based due to some complications with moving layers of tiles.

I can detect collisions and easily figure out the depth of the collision. I use the "shallowest axis method" to determine which way to resolve a collision between the sprite and the tile. If the sprite is deeper horizontally than vertically, the direction to resolve is either up or down. If the sprite is deeper vertically than horizontally, the direction to resolve is either left or right.

This is simple enough, and it works pretty well. That is, until you have a sprite colliding with more than one tile. As, by their nature, each collision has to be checked separately, different collisions may have different direction to resolve in. For example, if a sprite is trying to walk across a row of tiles, for one frame they will intersect the next tile such that the horizontal depth is shorter than the vertical depth. As the collision says "resolve left", it will be pushed back and will be stuck on the corner.

I've been mulling this problem over, on and off, for quite some time, and several solutions have come to me, but all have flaws. I could mark certain sides as unreachable, but without a grid-based engine, determining "unreachability" is remarkably complex, especially with moving layers of tiles always a possibility.

Another possible method would be to predict collisions before they happen and "work back" the movement to the point of the collision, I suppose, but I'm not sure how the math on that works.

I feel that I'm missing something incredibly obvious, especially since games from the 80s have already solved this problem.

sentences:
Number of iterations to real time I have an animation of traffic. I have 20 cars in road network, each car have a starting node and end node. Each car know how much distance does it need to travel in order to reach the end node. I move cars each 20 ms for 10 px. To move all cars from their start node to end node I need 60 iterations. That is 60*20ms = 1200ms.

Now I want to convert this time, or use data that I have, to a real time where car move 50km/h. How can I do that? Any idea?

sentences:
LWJGL not streching texture to quad I'm having problems with texturing in LWJGL. The texture is not being stretched to a quad.
As you can see, the texture is not being sized to the quad, marked with pink border. The problem doesn't exist when using square quad and square texture. Scaling the texture to 960x320 px doesn't help
The texture size is 96px width and 32px height.(1 tile is 32x32, this object is 3 by 1)

The code:

//rendering the textured quad. This method also renders everything else
public static void renderTile(Texture tex, int x, int y, int sizex, int sizey) {
    tex.bind();

    glBegin(GL_QUADS);
    glColor4f(1, 1, 1, 1);
    glTexCoord2f(0, 0);
    glVertex2f(x, y);

    glTexCoord2f(1, 0);
    glVertex2f(x + sizex, y);

    glTexCoord2f(1, 1);
    glVertex2f(x + sizex, y + sizey);

    glTexCoord2f(0, 1);
    glVertex2f(x, y + sizey);
    glEnd();
}

//opengl initialization code, called before any rendering
public static void initOGL(){
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 800, 600, 0 , 1, -1);
    Log.info("Display W=" + Display.getWidth() + " H=" + Display.getHeight());
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_TEXTURE_2D);
    glEnable (GL_BLEND);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}

sentences:
What is the actual formula to find the vertices of an animation frame in using a BVH file? I've read this tutorial and tried many formulas to build the skeleton. I am able to build it without the rotations, but those break everything. This, for example, is a simplified code for one of my attempts:

/* Pseudocode using overloaded operators for illustration purposes */
var build_skeleton = function(motion,frame_number){
    positions = [];
    deg_to_rad = Math.PI/180;

    (function travel_tree(node,old_pos){
        pos = [node.offsetX, node.offsetY, node.offsetZ];

        frame = node.frames[frame_number];

        x_rotation = quat_from_axis_angle([1,0,0],frame[2] * deg_ro_rad);
        y_rotation = quat_from_axis_angle([0,1,0],frame[1] * deg_ro_rad);
        z_rotation = quat_from_axis_angle([0,0,1],frame[0] * deg_ro_rad);
        rotation = x_rotation * y_rotation * z_rotation;

        pos = old_pos + apply_quaternion(rotation, pos);

        positions.push(pos);

        node.children.map(function(a){ return travel_tree(a,pos); })
    })(motion.root,[0,0,0]);

    return positions;
};

I've tried many variations of this, switching axes, signals etc. Nothing seems to work. So what is the formula to find the positions of the vertexes of an animation on the BVH format?

sentences:
Using movie names in a game I am working out a concept of a game where I want to refer to movies. However, I am unsure if I can just refer to the real movie titles in the game or if I should change them slightly so that it becomes a parody of the movie for liablility / copyright reasons.

I know it is a bit on the risky side when you are using brands etc, but can I be held acountable for indirect damage to the sales of their movie?

Does this change when I use an API from a website (f.e. imdb / TheMovieDatabase)?

sentences:
Quad Texture to Pixel Screen Space (DirectX 11) I think I must be using the wrong wording for what I want, because I seached and just kept finding pixel shader questions. But this seems like something that anyone making a 2D game would want.

Basically I have my quad, my loaded texture in a ID3D11ShaderResourceView and I can draw it to the screen using coordinates of -1.0 to 1.0.

But what I want to accomplish is drawing based on pixels.

i.e.

I would want to draw a 20x20 pixel image to coordinates 100,100 on a 800x600 screen. But, I want to do this by manipulating the quad to the correct size and position to mimic this (which is, I assume, a common way to do 2D in DirectX11).

As I said, I am able to draw a texture to screen space at the moment but I am lost as to what calculations or methods would be required to convert this to pixel-based drawing.

Thank you :)

sentences:
How to simulate a spinning helicopter rotor visual effect programatically? I decided to display an animation that conveys to the viewer that a narrow flat surface is spinning really fast(such as an helicopter's rotor blade). Does anyone have any experience in implementing this effect and could provide an implementation?
Please remember a rotor on video looks different than it does in real life.
I need to make the rotor look like it does in real life and not on video.

sentences:
Graphic render speed in libgdx using many sprite sheets I am currently working on a customizable Player-character for my top down view 2D pixel game. I am using libgdx and aiming for android devices as well as desktop applications.

I am wondering about an efficient, but yet simple concept. So far my character is build up from different parts ( Feet, Body, Shoulder L, Shoulder R, Hand L, Hand R, Head, Haircut). Every part has its on layer, thus they are 8 layers already. My animations (for example walk cycle) has 8 frames. My character fits on a 24 x 48 px image, thus the naked walking character sprite sheet, with all body parts having their own image and keyframe ends up in having 8 layers x 8 images (24x48 px) = 64 frames.

This fills up 40% of a 512 x 512 sprite sheet. This is only for the walking down animation, weapons would be rendered from a separate sprite sheet, underneath the hands. So for the other 3 directions ( okay maybe they fit here), but certainly for other states (dying, hitting, casting spells) I would need separate character sheets.

Now my questions:

Since my character is customizable, it could end up that every layer has to be taken from a different sprite sheet ( naked head, metal armor, poor gloves, icy shoes etc) thus I would need to switch my textures a lot since they can't possibly fit on one sheet. Sometimes I have to use a sheet again later like: render body and so on naked, bind sword sheet, render weapon, use body parts sheet again and render hands on top.

Questions:

1.
In an old book by Mario Zechner I read that sprite sheets with a size of 512 x 512 px are good to go for, since older devices still support this size. Is this still up to date or can I go for bigger Textures (which I then split in TextureRegion Arrays to use for the Animations).

2.
Currently I tested using one sprite sheet (the one above) and took 7 TextureRegion Arrays to store the images of all body parts, then I created 7 Animations, which I render all on top of each other in the corresponding order.

Is it good to do so? Should I rather combine all the textures in a pre rendered TextureRegion (or so) and use this in ONE animation instance?

What are the expensive calls? Are they hidden in the use of the many animation instances? Is it the use of many TextureRegion instances?

As far as I can see I only use the texture ( sprite sheet ) in the beginning anyways to then split it up in my TextureRegion Arrays, which are then used in the render method. So does it even make any difference if I would be using different textures which I'd split up at the beginning? Would this splitting-up and preparing take much time if done during the gameplay? Currently I set it up in the create method. How much / many TextureRegions can be stored in memory simultaniously (since if all sprite sheets fit into memory I could preload them like this during the splash screen). Do I even need to worry about this with my low Pixel Resolution Assets?
How to get a feeling for this?

sentences:
Unity: Edge of quad is dark. How do I avoid this? I have four quads together like this

These are just the default Unity quad from create\3d object\quad

the texture is white with grey borders on two sides and a black border on other two sides..

Lets zoom in..

How do I get rid of these black lines?

I am generating these bigger shapes out of quads and applying the texture using code...
I noticed that If I didnt change the material in code then there were no black lines.
So I made prefabs for each material, and am now spawning those in instead of changing a material on a quad. But I still get the same lines.
Also, if I drag the prefabs into the scene when the game is running they appear perfect.
I have no idea whats going on.

sentences:
Calculating normals after displacement mapping I'm using C++, DX11 and tessellation. After tessellating a triangle I apply displacement mapping to the new vertices. But they still have the original triangle's normal so the lighting calculation behaves like the surface was flat.

So I see two solutions: sampling a normal map (corresponding to the displacement map) or sampling the displacement map in a few more places to calculate the normal myself (both would be done in the shader).

Since I'm using already using another normal map (with more detail than the displacement map contains) a 2nd normal map seems a little like an overkill. And calculating the normals myself seems inefficient.

Both solutions would work though so my dilemma is really this - am I overthinking it? Should I just go with one of the above solutions? Or is there a better approach?

sentences:
How 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:
What game mechanic can I use to show that the player character is bored? I'm designing a part in my game where the player must notice that his character feels bored about a certain mundane task he is doing, without being boring for the player.

By observing the game mechanic, the player should understand that his character is bored or fatigued. To keep the player interested in playing though, the mechanic has to gamify that mundane process into something interesting or challenging.

How could this be done?

sentences:
List to hold copies of a prefab for later deletion I'm working on a game in which obstacles are Instantiated randomly 5 to 20 units ahead of the player.

When they are instantiated, I want to add them to a list so that when there are too many obstacles loaded in the game, it will remove them from the list and then delete them from the game.

I'm having trouble adding them to the list, because using obstacleList.Add(Obstacles.name); doesn't work.

Here's my code:

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

public class Generate : MonoBehaviour{

    //player position
    public Transform Player;

    // The prefab for an obstacle
    public GameObject Obstacle;

    // Holds float distance from 0 for each obstacle that is instantiated
    private float nextObstacle = 30;

    // is supposed to hold the names of all active instances of the obstacle prefab
    List<string> obstacleList = new List<string>(10);

    void FixedUpdate()
    {
        //Checks to see if the player is colser than 30 units to the most recently spawned obstacle
        if (nextObstacle - Player.position.x < 30)
        {
            //Generates a new obstacle
            GenerateObstacle();
        }
    }

    void GenerateObstacle()
    {
        // Randomly assignes a number for horizontal and vertical Transform
        int randH = Random.Range(5, 20);
        int randV = Random.Range(1, 3);

        //Instantiates an obstacle using those random values
        Instantiate(Obstacle, new Vector3(nextObstacle + randH, randV, 0), Quaternion.identity);

        //Makes that obstacle the new distance so a new obstacle can be spawned
        nextObstacle += randH;

        // Is supposed to add the name of the obstacle that was Instantiated to a list
        obstacleList.Add(Obstacle.name);

        //checks when list has more than 10 items in it
        if (obstacleList.Count > 10)
        {
            DeleteObstacles();
            // Removes the first item from the list
            obstacleList.RemoveAt(0);
        }
    }
    void DeleteObstacles()
    {
        // Supposed to destroy the copied prefab
        Destroy(Obstacle);
    }
}

sentences:
Vertex Shader Fundamental Workings I understand that water ripples (e.g. stone thrown into a pond) are often handled with vertex shaders.  My first question is: are the ripples nothing more than an algorithm that is the function of time?

If yes, it means that the size and diameter of ripples is not "additive."  It means water vertices do not statefully "remember" their previous "disturbance" positions and accumulate more translation info.  Rather it means that, as a function of time, the position of "disturbed" water vertices are freshly computed each frame per unit time.

If no, it means that indeed the vertices accumulate disturbance / translation information - the vertices are stateful.

I hope the answer is "yes," because that actually makes sense to me.  If the answer is no, the I feel it creates tremendous burden on the CPU/GPU to keep track of all the state-per-vertice.  If the answer is "neither," do tell. :)

My second question is, assuming a "yes" above, how does such a "water disturbance shader algorithm" account for continuous interaction with irregular shapes?  For example, please look at the video 40 second mark showing a car crashing through water.  It is not so clear how the vertex shader knows how to make a rectangular disturbance shape (the shape of the car).  Perhaps, over-simplifying, the vertex shader takes both time and a vector to generate the ripples, where the vector is the speed/direction of a car (and the shader code always makes a car-shaped rectangle no matter what).

Is this the right high-level understanding of how this water trick works?

sentences:
ERROR : Destroying assets is not permitted to avoid data loss I want my gameObject named lvl_01 to destroy when I click left or right arrow key but it's keep showing this error "Destroying assets is not permitted to avoid data loss" instead of destroying that gameObject, Can anybody please tell me what is going wrong around here.

using UnityEngine;
using System.Collections;

public class Level_01Text : MonoBehaviour {
public GameObject lvl_01;
// Use this for initialization
void Start () {
    Instantiate (lvl_01);
}

// Update is called once per frame
void Update () {
    if((Input.GetKey(KeyCode.RightArrow)) || (Input.GetKey(KeyCode.LeftArrow)))
    {
        Destroy (lvl_01);
        Debug.Log ("Something is seriously going wrong around here");
    }
}

}

sentences:
How can I write an additive mesh shader that splits the RGB channels while accounting for depth? I'm trying to create a sort of "hologram" effect. So far, what I have is an additive, three-pass shader that uses ColorMask for each pass to separate the RGB channels. The problem is that doing so requires ZWrite to be off (first image) so that each pass doesn't intersect the others (second image). However, doing so means that the model geometry overlaps itself, which I don't want.

I've tried the various methods of taking depth into consideration with transparency (This, for example) but they all cause problems when trying to separate the RGB channels. Is there some way to have each pass take depth into consideration within itself, but not with the other passes?

sentences:
Center of Mass for Convex shape in 3D For an arbitrary convex shape in 3D, how can I calculate its center-of-gravity?

I have face-normals, and the vertices for each face.

@Ocelot No, it most certainly is not the average of the vertices, as demonstrated in this simple 2D case.

The average of coordinates is in top of shape, whereas the C.o.M. is in the bottom half.

sentences:
RayCasting picture noise render method I'm creating a RayCasting tutorial on github (click here to access it) and I'm following a lot of tutorials, implementations and other render methods in the web. One game made with it is the "Prelude of the Chambered" by Markus Persson. He made this game in 2 days with native programming.

My question is about the noise picture effect he used for rendering. I wanted to know how to do this, and if this has some render name. Check the image bellow and you will know what I'm speaking about:

If you check some render position you will find some noise pixels. What is the method to do this? This techique has some name?

Thanks a lot for help!

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:
Switch axes and handedness of a quaternion? I have a quaternion, coming from a system with the following:(intertial sensor)

Right handed.
Forward direction: Y axis
Right direction: X axis
Up direction: Z axis

I need to convert this into a coordinate system that is: (Unreal engine)

left-handed.
Forward direction: X axis
Right direction: Y axis
Up direction: Z axis

I have tried negating the axis, and angle, I have tried switching values, i cannot get this to work. All help greatly appreciated! I am working in C#, with Microsoft.Xna.Quaternion.

sentences:
How to draw sprite according to Player position when button is pressed? How do I draw a sprite right at my Player sprite's position when I pressed Spacebar?

protected void playerInput() {
        KeyboardState key = Keyboard.GetState();

        if (key.IsKeyDown(Keys.Escape)) this.Exit();
        if (key.IsKeyDown(Keys.Up))     playerPos.Y -= 5;
        if (key.IsKeyDown(Keys.Down))   playerPos.Y += 5;
        if (key.IsKeyDown(Keys.Left))   playerPos.X -= 5;
        if (key.IsKeyDown(Keys.Right))  playerPos.X += 5;
        if (key.IsKeyDown(Keys.Space))  bSpawnSandbag = true;
    }

protected override void Update(GameTime gameTime) {
        playerInput();
        base.Update(gameTime);
    }

 protected override void Draw(GameTime gameTime) {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(player, playerPos, Color.White);

        if (bSpawnSandbag) {
           spriteBatch.Draw(sandbag, new Vector2(playerPos.X + 3, playerPos.Y + 3), Color.White);
        }

        spriteBatch.End();

        base.Draw(gameTime);
    }

If I use the code above, the "sandbag / the sprite I want to draw" will move with my Player position and I don't want that. I want it to draw at THAT specific position my Player was once at when I press Spacebar for 1 time. Any clue? O_O
I want it to be...

Let say, player position = (10, 10) Player pressed Spacebar, draw Sandbag at 10,10 (permanently) Even though Player moved to 12, 10 & not pressing Spacebar , the Sandbag would still be at 10,10

sentences: 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:
Algorithm to fit shapes to 2D grid? Let's say you have an n-by-m grid. Some squares are occupied, some are not.

You want to know where in the grid you can fit arbitrary shapes such as to not hit an occupied square. The shapes would variable, and could be x-by-y rectangles, trapezoidal-ish shapes, etc.

Are there algorithmic approaches to this?

sentences:
Scale a game object to Bounds I'm trying to scale a lot of dynamically created game objects in Unity3D to the bounds of a sphere collider, based on the size of their current mesh. Each object has a different scale and mesh size. Some are bigger than the AABB of the collider, and some are smaller. Here's the script I've written so far:

private void ScaleToCollider(GameObject objectToScale, SphereCollider sphere) {
    var currentScale = objectToScale.transform.localScale;
    var currentSize = objectToScale.GetMeshHierarchyBounds().size;

    var targetSize = (sphere.radius * 2);

    var newScale = new Vector3 {
        x = targetSize * currentScale.x / currentSize.x,
        y = targetSize * currentScale.y / currentSize.y,
        z = targetSize * currentScale.z / currentSize.z
    };

    Debug.Log("{0} Current scale: {1}, targetSize: {2}, currentSize: {3}, newScale: {4}, currentScale.x: {5}, currentSize.x: {6}",
        objectToScale.name, currentScale, targetSize, currentSize, newScale, currentScale.x, currentSize.x);

    //DoorDevice_meshBase                   Current scale: (0.1, 4.0, 3.0), targetSize: 5, currentSize: (2.9, 4.0, 1.1), newScale: (0.2, 5.0, 13.4), currentScale.x: 0.125, currentSize.x: 2.869114
    //RedControlPanelForAirlock_meshBase    Current scale: (1.0, 1.0, 1.0), targetSize: 5, currentSize: (0.0, 0.3, 0.2), newScale: (147.1, 16.7, 25.0), currentScale.x: 1, currentSize.x: 0.03400017

    objectToScale.transform.localScale = newScale;
}

And the supporting extension method:

public static Bounds GetMeshHierarchyBounds(this GameObject go) {
    var bounds = new Bounds(); // Not used, but a struct needs to be instantiated

    if (go.renderer != null) {
        bounds = go.renderer.bounds;
        // Make sure the parent is included
        Debug.Log("Found parent bounds: " + bounds);
        //bounds.Encapsulate(go.renderer.bounds);
    }
    foreach (var c in go.GetComponentsInChildren<MeshRenderer>()) {
        Debug.Log("Found {0} bounds are {1}", c.name, c.bounds);
        if (bounds.size == Vector3.zero) {
            bounds = c.bounds;
        } else {
            bounds.Encapsulate(c.bounds);
        }
    }
    return bounds;
}

After the re-scale, there doesn't seem to be any consistency to the results - some objects with completely uniform scales (x,y,z) seem to resize correctly, but others don't :|

Its one of those things I've been trying to fix for so long I've lost all grasp on any of the logic :| Any help would be appreciated!

sentences:
Is XNA good for professional development for the Xbox 360? I want to start off developing for my Xbox 360, and I've heard of the XNA framework that can target both the PC and Xbox. This sounds like an attractive option since my clients can use the game/app on normal computers as well.

However I'm very new to the Xbox scene. Is XNA only for hobbyist development, and is it not recommended for semi-professional or corporate application development? Does XNA lack the capabilities of a C++ developed solution, or dos it badly reduce performance of a game/app running on the Xbox?

Is it possible to target the Xbox using C#, and without XNA? What are the advantages?

Low-level programming would be in C++ directly working with DirectX. What are the advantages?

sentences:
Unity3D Tag as a public variable in editor How do you incorporate Tag strings into a scripts editor found in the inspector?

What it is I'm babbling about: When you create a public GameObject fooObject in a script, it shows up as a box that can have Game Objects dragged onto in its editor. It also has a small clickable dot that shows every Game Object that could be selected.

Now, say I have a public string fooString that would specifically be used for referencing the Tag strings of Game Objects (such as if (fooObject.tag == fooTag) or another use). Is there a way to define that string so that in the script's editor it strictly allows tag names to be used with it? I'm assuming with a similar clickable dot or a drop down menu of every selectable tag.

Although I could just manually type my string, a solution like the one above would have big object-orientated advantages. For example, if I was to change the name of this tag, it would change the string variable accordingly, as if the variable was a reference to such tag.

[Note to the moderators: I looked for an answer to this question for nearly 2 hours now to no avail. I understand that I may be missing some specific wrong word choice, in which case this question easily could have already been answered here. If this is closed as a duplicate, then, a quick comment explaining my mistake would be greatly appreciated.]

sentences:
User magic creation system that isn't programming I would love to create an RPG with a magic system in it that gives the player a LOT of freedom.

To the extent they can make their own spells, systems of magic etc., bind spells to items, and so on.

Spells and magic would obviously have constraints, but doing lots of research into magic, and spending time creating spells etc. should allow players to create more and more powerful spells.

I'm really struggling how to come up with an interface through which they can create spells that isn't directly similar to programming. I don't want it to be so simple/boring as typing a sequence of commands that get triggered by clicking on a wand and calling that a spell.

I would love it if it were less human-intuitive, linearity combinations etc. weren't obvious or easy to figure out, and it was possible to explore the magic system deeply to discover more complex ways to piece together magics.

Are there any precedents? Does anyone have any ideas on how such a system could be implemented?

sentences:
When should you roll your own game engine? I've been a software developer for 5 years, now, and I am wanting to get into iOS game development. I've played around with the iOS SDK for about 2 years, attending cocoaheads meetings, and I feel I have a good grasp on objective-c, cocoa and even c and c++.

I have a game idea, and know that I will use Box2D, but I'm wondering if I should use cocos2D or not. The main reasons are:

I may want to do things, graphics wise, that aren't available in cocos2d.
If I roll my own game engine, I'll have more control.

Of course, the main reason for using an already-existing game engine is the time it saves, and it makes the hard stuff easier; but for someone who has the technical chops to roll his own, does it make sense?

sentences:
What engine could I use for a simulation? I have a simple requirement:  I want to put some ships (I have some mesh models) on a body of water, with islands, and play with various collision avoidance and command and control algorithms.  So I need a environment where I can modify object behaviour but where the world and its mechanics are already coded.  I was expecting that this would be trivial to find as this is such an obvious requirement for say, AI experimentation.  But I haven't found anything open source or commercial.  I've looked at Glest, Delta3D, Spring, Unity, ORTS, Strive, and VBS2.  I looked for, but never found, the Homeworld Engine.  I also found Breve, Lagoon (seemed perfect), ECSLent, but these were/are either no longer supported or documentation (if it exists) is confusing enough that it isn't clear what can/can't be done or how to go about it.  Interestingly, it seems like you have to roll your own if you have a need eg. Breve, Lagoon.

So I'm putting the question to you:  is there a virtual environment out there, with physics, that would allow a person to focus just on behaviour creation?  What have I missed?  Thanks for any guidance you can provide.

sentences: Sound emmiters with panning and volume in 2D How can I create sound emmiters that pan and change volume based on distance from the player in a 2D game?

sentences:
Secure login for a game that is open source I am making a game which i will be open sourcing. Its a simple arcade like game but requires a network connection because it is meant to be played with other people.

The thing i am worrying about is how would i be sure that the client is the one that i put out for the end user to play with? Kind of a like of sv_pure for Team Fortress 2.

I was thinking of different ways to combat this such as the server requesting the client's version or even it's md5 hash but people with simple java knowledge could just force a method to always return what the server wants.

sentences:
Does GPU mipmapping assume the texture es gamma corrected? I have been reading the Real Time Rendering book and stumbled upon this paragraph:

  For textures encoded in a nonlinear space (such as most color
  textures), ignoring gamma correction when filtering will modify the
  perceived bright- ness of the mipmap levels [121]. As you get farther
  away from the object and the uncorrected mipmaps get used, the object
  can look darker overall, and contrast and details can also be
  affected. For this reason, it is impor- tant to convert such textures
  into linear space, perform all mipmap filtering in that space, and
  convert the final results back into nonlinear space for storage.

I have never taken into account gamma correction for color textures using mipmapping.

For generating mipmaps I have always used the GPU-implementation (OpenGL):

glGenerateMipmap

In the resources I have learned from, gamma correction has not been mentioned as something that has to be taken into account for mipmapping.

I was wondering, since color textures that include gamma correction seem to be the norm, are the GPU-provided filtering functions already taking into account gamma correction?

sentences:
Wrapping each script with classes causes errors The goal here is to change variables from another script. Thing is that they must be in classes, so for example I wrapped this code (which is from PadControl.js):

#pragma strict

public var ball : GameObject;
public var moveSpeed : float = 10;
public var rotationSpeed : float = 10;

function Update () {
    var padMove : float = Input.GetAxis("Horizontal");
    var padRotate : float = Input.GetAxis("Vertical");

    this.transform.position.x += padMove * moveSpeed * Time.deltaTime;
    this.transform.rotation.y += padRotate * rotationSpeed * Time.deltaTime;
}

function OnCollisionEnter(col : Collision){
    if(col.gameObject.name == "Ball"){
//      Debug.Log("SAY SOMETHING");
    }
}

like so:

#pragma strict

public class PadControl{
    public var ball : GameObject;
    public var moveSpeed : float = 10;
    public var rotationSpeed : float = 10;

    function Update () {
        var padMove : float = Input.GetAxis("Horizontal");
        var padRotate : float = Input.GetAxis("Vertical");

        this.transform.position.x += padMove * moveSpeed * Time.deltaTime;
        this.transform.rotation.y += padRotate * rotationSpeed * Time.deltaTime;
    }

    function OnCollisionEnter(col : Collision){
        if(col.gameObject.name == "Ball"){
    //      Debug.Log("SAY SOMETHING");
        }
    }
}

As stated in this tutorial coming from Unity's website (https://unity3d.com/learn/tutorials/modules/intermediate/scripting/statics)

But when I do it, this is the error:

  Assets/PadControl.js(12,22): BCE0019: 'transform' is not a member of 'PadControl'.
  Assets/PadControl.js(13,22): BCE0019: 'transform' is not a member of 'PadControl'.

And I really don't know what's actually going on and what should I do. Any suggestions?

sentences: SetActive true/false only once when game install first time unity? In my unity game I try to give player instruction how to play but it only in first level and first time when game install so how i can do this?

sentences:
How to drag 2D objects and stop it if collides with other 2D object? This is the code I am using but it's not working. It drags other object on collision:

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

public class TileControllerHorizontal : MonoBehaviour
{

    private Vector3 screenPoint;
    private Vector3 offset;
    public bool check;

    // Use this for initialization
    void Start ()
    {

    }

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

    }

    void OnMouseDown ()
    {
        screenPoint = Camera.main.WorldToScreenPoint (gameObject.transform.position);

        offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
        transform.name = "draging";

    }

    void OnMouseDrag ()
    {
        if (!check) {
            Vector3 point = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            point.z = gameObject.transform.position.z;
            point.y = gameObject.transform.position.y;
            gameObject.transform.position = point;
        }
    }

    void OnMouseUp ()
    {
        check = false;
        transform.name = "Tile";

    }

    void OnCollisionEnter2D (Collision2D col)
    {
        Debug.Log (col.gameObject.tag);
        if (col.gameObject.tag == "Player" && transform.name == "draging") {
            check = true;
        }
    }
}

sentences:
Retrieving JSON return value from function and parsing in Construct 2 I would like to know how to parse a JSON object and parse each value into either an array, or something that I can use to set values of several global variables in my project file. I want to avoid editing the Javascript file itself, so please try to provide an approach that can be done in Construct itself rather than an external way.

Code sample

 axonify.game = {
  gameData: function() {
    data = {
      name: 'Block Mania',
      timeLimit: 30,
      addedTimePerQuestion: 0,
      addedTimePerCorrectQuestion: 15,
      questionCount: questionCount
    };
    return data;
  },

sentences:
What is the process for porting my game SFML from Windows to Mac I've recently finished version one of a simple arcade game I've been making in SFML. I've already spent months on the physics engine and game, and I'm wondering how much time it will take to port it to Mac. I've been developing it using Visual Studio on Windows10.  As far as I can see, this is the only way to do it;

Open Visual Studio on my Mac laptop, download all my windows code

try to compile it, fail, fix all the various stuff that wont work, try to compile again.

I can't seem to find any tutorials indicating a better process, or how long I should expect it to take. It can't be trivial, or else there wouldn't be so many triple-A games that don't run on Mac. I would greatly appreciate any tips on the process or time estimates. Thanks

sentences:
Cutting up a Sprite sheet to frames I'm new to game development, so please be kind if this is a very simple question.

I have a Sprite sheet with 18 frames of the same character (6 col x 3 rows) moving slightly. I want to get the frames cut out of the sheet into cocos2dx project. There is no xml or plist defining the boundaries but obviously I want the Sprite to be in the same place as it animates as it's an idle action. What's the quickest way to get the frames? I tried texture packer but it seems designed to build a sheet not unpack one?

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:
Collision detection between axis-aligned bounding box and bitmap (pixel perfect) terrain Working on a Worms-type game, I have my objects in bounding boxes and they sit on the pixel terrain.

Currently I am able to successfully do the collision detection for objects when they enter the game by checking the middle-bottom pixel of the bounding box, if it is solid, reduce the x and y velocity to 0, other wise keep moving down at a value of gravity.

The trouble comes in when I start to move the "player sprites" as they can walk into walls and I'm not sure how to approach how to detect collision if moving into pixels, and finally how to resolve these collisions.

I need to be able to detect solid walls I cannot pass, and gradient hills where the player should "walk up".

Could you help point me in a way to do this or how it has been done in the past?

sentences:
Rows of coins in libgdx? I have my coin image in the assetLoader class, then I import it into gameWorld.

My question is, how can I draw() rows of coins without having to write out 15 different coins?

i.e., coin1, coin2, coinRect1, coinRect2, coinX1, coinX2, etc.
Wouldn't it be more efficient/easier on memory&performance to create a 'coin' class and use a loop somehow?

It's a vertical scroller so the coins should be lined up vertically and disappear individually as the playerRect intersects the coinRect.

The coins should not intersect the obstacles and the randomly generated number of coins in any row (e.g. a row of 6 coins all lined up) should be between 1 and 10.
If I used a loop (somehow...) the integer i would be the randomly generated number of coins in any row, so that 1<=i<=10, and if coin.position intersected obstacleRect then it i would become i-1 so that the coins stopped right before the obstacle.

sentences:
Transition Player Position I'm currently working on a Java MMO with a pretty solid start, but I've come across an issue I need a little help with.

I'm working on player positions. Meaning their X/Y on the screen, if the PlayerA has a higher FPS (Frames Per Second) than other players, the resulting action will be that PlayerA will move faster than everyone else. I know the reasoning for this, it's because when the game draws I just use x++.

What would a better method be?

sentences:
My game is just about finished! What do I do now? I have an HTML5/canvas game just about finished and ready to launch. It's a 2d game in which you explore and disrupt a procedurally-generated landscape, crafting items and structures to survive. I have to finalize the 'ending' and fix a few bugs, but the game is pretty much ready for players.

The game will be free to play on the web, and I plan to begin working versions for iOS and the Mac App Store. I will also continue to add content to the game even after it launches.

Can anyone recommend things that I should remember to do before launching the game? Thanks!

sentences:
How to avoid 2d enemy using trigonometry? I'm making a game in Javascript & HTML5.

I have a "bullet" (let's call it so) that needs to reach the enemy (at fixed position) and that need to avoid the enemy's "bullet".

To make the bullet move to the enemy i'm using this code:

var direction = Math.atan2(self.enemy.y - self.y, self.enemy.x - self.x);
var dir_diff = self.rotation - direction;
// ... other code
self.rotation -= dir_diff;
self.x += Math.cos(self.rotation) * self.speed / dt;
self.y += Math.sin(self.rotation) * self.speed / dt;

How can I make the bullet avoid another moving bullet?

I tried to search but algorithms like A* etc. doesn't seem right for this.

Thank you.

sentences:
Deleting/Cleaning Screen-Objects with all child-objects in libGDX For my game, Im using

libGDX
Ashley (ECS)
Box2D

Ive got a lot of screens but for simplification: MainMenuScreen and InGameScreen.

In InGameScreen Im init the ECS (Ashley) and create a lot of entities. Some have PhysicsComponent. The PhysicsSystem will catch them and call Box2D to spawn some objects based on the parameters within the PhysicsComponents.

So far so good.

Now, when the player dyes, I run setScreen(new MainMenuScreen()); from my "Main"-Class (MyGame.java).

the game starts and MyGame loading at first the MainMenuScreen
than the InGameScreen will get loaded (when player presses a key)
than the player dyes
MyGame recognized it and loading again (throu calling setScreen(...)) the MainMenuScreen
When Player press key: MyGame loading another round (setScreen(new InGameScreen))

I guess I have to do something like a complete clean up between switching screens. But how should I implement this? Just "deleting" the old InGameScreen-Object shouldent be enought, right?

Do I have to use the dispose()-Method?
Is it enough to instantiate everything new (in the init from InGameScreen) since it will instantiate all child-object new for its own like Box2DWorld world = new World();

sentences:
Understanding how OpenGL blending works I am attempting to understand how OpenGL (ES) blending works. I am finding it difficult to understand the documentation and how the results of glBlendFunc and glBlendEquation effect the final pixel that is written.

Do the source and destination out of glBlendFunc get added together with GL_FUNC_ADD by default?

This seems wrong because "basic" blending of GL_ONE, GL_ONE would output 2,2,2,2 then (Source giving 1,1,1,1 and dest giving 1,1,1,1).

I have written the following pseudo-code, what have I got wrong?

struct colour {
    float r, g, b, a;
};

colour blend_factor( GLenum factor,
    colour source,
    colour destination,
    colour blend_colour ) {

    colour colour_factor;
    float i = min( source.a, 1 - destination.a );

    // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBlendFunc.xml
    switch( factor ) {
        case GL_ZERO: colour_factor = { 0, 0, 0, 0 }; break;
        case GL_ONE: colour_factor = { 1, 1, 1, 1 }; break;
        case GL_SRC_COLOR: colour_factor = source; break;
        case GL_ONE_MINUS_SRC_COLOR: colour_factor = { 1 - source.r, 1 - source.g, 1 - source.b, 1 - source.a }; break;
        // ...
    }

    return colour_factor;
}

colour blend( colour & source,
    colour destination,
    GLenum source_factor, // from glBlendFunc
    GLenum destination_factor, // from glBlendFunc
    colour blend_colour, // from glBlendColor
    GLenum blend_equation // from glBlendEquation
    ) {

    colour source_colour = blend_factor( source_factor, source, destination, blend_colour );
    colour destination_colour = blend_factor( destination_factor, source, destination, blend_colour );
    colour output;

    // From http://www.khronos.org/opengles/sdk/docs/man/xhtml/glBlendEquation.xml
    switch( blend_equation ) {
        case GL_FUNC_ADD: output = add( mul( source, source_colour ), mul( destination, destination_colour ) );
        case GL_FUNC_SUBTRACT: output = sub( mul( source, source_colour ), mul( destination, destination_colour ) );
        case GL_FUNC_REVERSE_SUBTRACT: output = sub( mul( destination, destination_colour ), mul( source, source_colour ) );
    }

    return output;
}

void do_pixel() {

    colour final_colour;

    // Blending
    if( enable_blending ) {

        final_colour = blend( current_colour_output, framebuffer[ pixel ], ... );
    } else {

        final_colour = current_colour_output;
    }

}

Thanks!

sentences:
Reading depth buffer result in only two values I am attempting to add an SSAO post processing shader to my deferred rendering engine. I am running into problems with reading from the depth buffer. In the images linked below you can see the depth buffer, and the values I'm reading out of it (the values are scaled - see 'range' value at top of image)

Depth Buffer

What I read from the depth buffer

It looks to me like the format must be wrong somehow but I'm not sure in what way.

The depth buffer is being created as follows:

// Texture
D3D11_TEXTURE2D_DESC textureDesc;
ZeroMemory(&textureDesc, sizeof(textureDesc));
textureDesc.Width = m_Desc.Width;
textureDesc.Height = m_Desc.Height;
textureDesc.MipLevels = 1;
textureDesc.ArraySize = 1;
textureDesc.Format = DXGI_FORMAT_R24G8_TYPELESS;
textureDesc.SampleDesc.Count = 1;
textureDesc.SampleDesc.Quality = 0;
textureDesc.Usage = D3D11_USAGE_DEFAULT;
textureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
textureDesc.MiscFlags = 0;
HRESULT hr = m_pDevice->CreateTexture2D(&textureDesc, nullptr, &m_pDepth);

// DS VIEW
D3D11_DEPTH_STENCIL_VIEW_DESC descDSV;
ZeroMemory(&descDSV, sizeof(descDSV));
descDSV.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
descDSV.Texture2D.MipSlice = 0;
hr = m_pDevice->CreateDepthStencilView(m_pDepth, &descDSV, &m_pDepthStencilView);

// SR View
D3D11_SHADER_RESOURCE_VIEW_DESC depthSrvDesc;
ZeroMemory(&depthSrvDesc, sizeof(depthSrvDesc));
depthSrvDesc.Format = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
depthSrvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
depthSrvDesc.Texture2D.MipLevels = 1;
depthSrvDesc.Texture2D.MostDetailedMip = 0;
hr = m_pDevice->CreateShaderResourceView(m_pDepth, &depthSrvDesc, &m_pDepthShaderResourceView);

And the important parts of my SSAO shader:

Texture2D gTextureDepth;

struct VS_INPUT
{
    float3 Position : POSITION;
    float2 TexCoord : TEXCOORD0;
};

struct PS_INPUT
{
    float4 Position : SV_POSITION;
    float2 TexCoord : TEXCOORD0;
};

PS_INPUT VS(VS_INPUT input)
{
    PS_INPUT output = (PS_INPUT)0;

    output.Position = float4(input.Position, 1.0f);
    output.TexCoord = input.TexCoord;

    return output;
}

float4 PS(PS_INPUT input) : SV_Target
{
    int3 loadCoord = int3(input.Position.xy, 0);

    float depth = gTextureDepth.Load(loadCoord).r;

    return float4(depth, depth, depth, 1.0);
}

Any ideas?

sentences:
Turn based game - how to deal with partial world state updates? I'm implementing a simple "turn based" game where the player sets up a bunch of "actions" on a board and "objects" move on the board and are influences by those actions. The player is no longer involved after setting up the board and just watches the actions play out. Each "turn" of the game loop, a "move right" action will move any objects on its square one square to the right, for example.

My problem is now that each time I run the game loop, all actions are executed as follows:

for(auto& go: gameObjects) {
    go->update();
}

Each of these game objects mutates the world state in its update() method. What I'm seeing now is that when the board is updated by one object, the next one will immediately use that updated board state and perform its action "too soon".

For example: When I place three "move right" actions on the board and run the game loop, the object will be moved three spaces in one "turn" while it should actually take 3 "turns" for the object to move through all 3 of those actions.

How can I delay the board state update until all actions have had their chance to decide what to do? I'm considering two strategies:

Copy the board state for each turn and create a new board state as the result of a turn. This is complicated because all my views are tied to the objects on the board. If I copy the board, I'll have to re-create all views?
Have each action not update the world state, but only return a function which, when executed, will do the update. Once I have all the functions collected, execute them all to update the board.

Any suggestions?

sentences:
How can I define a complex collision area on top of a tile map? As many people recommended, I am using Tiled map editor to create a map for my game and it's great particularly because libgdx framework also provides with API for maps from Tiled.

I understand I can define collidable tiles or not in the map editor so I can deal with any collision in my code. But I am currently in a situation that I need to divide a tile into a collidable and non-collidable areas. Manually, I think I can define points and lines of bounds of the two areas and programmatically deal with it. But that's a lot of time-consuming work.

So I googled a lot and found this physics-body editor. This seems like a great tool to automate the process I mentioned above. The system, however, works with each of unpacked image and I am not sure it would work even if I unpack the image for its operation.

I wonder if there is any better way to do this whole process of defining collision area. Any suggestion will be much appreciated.

sentences: How can I find the reflection of a point in a perpendicular line? From the image below I know the positions A and B. How can I find positions C and D and the reflection (Er) of an object E in the line CD? I saw the solution in How can I reflect a point about a line in Unity? but I don't understand it enough to apply it in my case. Please note that I'm trying to achieve this in 2D.

sentences:
How to create per-vertex normals when reusing vertex data? I am displaying a cube using a vertex buffer object (gl.ELEMENT_ARRAY_BUFFER). This allows me to specify vertex indicies, rather than having duplicate vertexes. In the case of displaying a simple cube, this means I only need to have eight vertices total. Opposed to needing three vertices per triangle, times two triangles per face, times six faces. Sound correct so far?

My question is, how do I now deal with vertex attribute data such as color, texture coordinates, and normals when reusing vertices using the vertex buffer object?

If I am reusing the same vertex data in my indexed vertex buffer, how can I differentiate when vertex X is used as part of the cube's front face versus the cube's left face? In both cases I would like the surface normal and texture coordinates to be different. I understand I could average the surface normal, however I would like to render a cube. Also, this still doesn't work for texture coordinates.

Is there a way to save memory using a vertex buffer object while being able to provide different vertex attribute data based on context? (Per-triangle would be idea.)

Or should I just duplicate each vertex for each context in which it gets rendered. (So there is a one-to-one mapping between vertex, normal, color, etc.)

Note: I'm using OpenGL ES.

sentences:
directional lightning I have managed to get a point light working, but I am facing problem with directional lightning.

    Fragment shader
 uniform vec4 lightColour ;
 uniform vec3 lightPos ;
 uniform float lightRadius ;

in Vertex {
vec3 colour ;
vec2 texCoord ;
vec3 normal ;
vec3 tangent ;
vec3 binormal ;
vec3 worldPos ;
} IN ;

  void main ( void ) {
  vec4 diffuse = texture ( diffuseTex , IN . texCoord );
  mat3 TBN = mat3 ( IN . tangent , IN . binormal , IN . normal );
  vec3 normal = normalize ( TBN * ( texture ( bumpTex , IN . texCoord ). rgb * 2.0 - 1.0));
  vec3 incident = normalize ( lightPos - IN . worldPos );
  float lambert = max (0.0 , dot ( incident , normal ));
  float dist = length ( lightPos - IN . worldPos );
  float atten = 1.0 - clamp ( dist / lightRadius , 0.0 , 1.0);
  vec3 viewDir = normalize ( cameraPos - IN . worldPos )
  vec3 halfDir = normalize ( incident + viewDir );

  vec3 viewDir = normalize ( cameraPos - IN . worldPos );
  vec3 halfDir = normalize ( incident + viewDir );
  float rFactor = max (0.0 , dot ( halfDir , normal ));
  float sFactor = pow ( rFactor , 33.0 );
  vec3 colour = ( diffuse . rgb * lightColour . rgb );
  colour += ( lightColour . rgb * sFactor ) * 0.33;
  gl_FragColor = vec4 ( colour * atten * lambert , diffuse . a );
  gl_FragColor . rgb += ( diffuse . rgb * lightColour . rgb ) * 0.1;

As far as I know, directional lightning do not have a radius or a position, just direction.
How should I calculate directional lightning?

sentences:
Unity's free look camera too far away I've been making a game to learn unity and I have been using the free look cam that comes default but have encountered a problem that I don't know how to fix. Basically the camera rig isn't following the target very well, it follows really far behind the target and I have turned up the move speed, messed with other settings but no luck.

Help please!

sentences:
Can I use a list sorted by Morton Code for broad phase collision detection? Until now I used a list of objects sorted by a single axis for limiting the amount of objects that collisions are checked against.

The idea is simple: if the x coordinate of two objects differs by more than their width it is plain impossible that they collide. So if I want to know all possible objects inside a specific rectangle I just need to check those that are inside the indices of the smallest possible and the biggest possible x value.

Now recently I have learned about Morton Code as a way of reducing multiple axes into a single value that preserves locality. However the implications for it aren't 100% clear to me.

Can I determine something like "all objects with a morton code smaller than varA or bigger than varB can't possibly be inside rectangle A"? If so how do I determine these values?

sentences:
Why can't I load images in processing.js and let them be dynamic? I can't easily load images. I can only render an image once unless I put this:
 in my html. I also still need to be able to use..... get(x, y, w, h) to get the pixels of an image But I run into this error: processing.js:13709 Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. when ever I operate it on the canvas.
   Also when I try to load the image sometimes it doesn't load.

So how should I fix it? (It still needs to be a processing js image object)

JS:
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
var processing = new Processing(canvas, function(processing)
{
    processing.size(800, 800);
    processing.background(0xFFF);

var mouseIsPressed = false;
processing.mousePressed = function()
{
    mouseIsPressed = true;
};
processing.mouseReleased = function()
{
    mouseIsPressed = false;
};

var keyIsPressed = false;
processing.keyPressed = function()
{
    keyIsPressed = true;
};
processing.keyReleased = function()
{
    keyIsPressed = false;
};

processing.getImage = function(url)
{
    //Loading of the home test image - img1
    var img1 = new Image();

    //drawing of the test image - img1
    img1.onload = function()
    {
        //draw image
        ctx.drawImage(img1, 0, 0);

        //ctx.fillStysle = "rgba(200, 0, 0, 0.5)";
        //ctx.fillRect(0, 0, img1.width, img1.height);
    };
    img1.src = url;//Set image url

    processing.externals.sketch.imageCache.add(img1.src);

    var img2 = processing.loadImage(img1.src);

    //img2.url = url;
    //img2.onload = img1.onload;

    return img2;
};

// use degrees rather than radians in rotate function
var rotateFn = processing.rotate;
processing.rotate = function(angle)
{
    rotateFn(processing.radians(angle));
};

with (processing)
{
    var img1 = getImage("images/papermario.png");

    //var img2 = createGraphics(180, 180, P2D);
    background(0, 0, 0);
    image(img1, 0, 0);
    //var img2 = get(0, 0, 400, 400);

    draw = function()
    {
        background(255, 255, 200);

        image(img1, 0, 0);

        //ctx.drawImage(img1, 0, 0);s

        //image(get(0, 0, 180, 180), 80, 80);
        //var img1 = getImage("images/papermario.png");
        //img1.onload();

        //image(img2, 40, 0, 40, 40);
        //image(img2, 0 + millis() / 1000, 0, 30, 30);
    };
}

if (typeof draw !== 'undefined')
{
    processing.draw = draw;
}

});

sentences:
Why does my goblin only choose a walk direction once? I'm working on a simpe 2d canvas game that has a small goblin sprite who I want to get pathing around the screen.

What I originally tried was a random roll that would choose a direction, the goblin would walk that direction. It didnt work effectively, he sort of wobbled in one spot.

Here's my current apporach but he only runs in a rundom direction and doesnt change. What am I doing wrong?

Here's all the relevant code to the goblin object and movement.

    var goblin = {
            speed: 100,
            pos: [0, 0],
            dir: 1,
            changeDir: true,
            stepCount: 0,
            stepTotal: 0,
            sprite: new Sprite(
                                goblinImage,
                                [0,0],
                                [30,45],
                                6,
                                [0,1,2,3,2,1],
                                true)
    };

    function getNewDir(){
            goblin.dir = Math.floor(Math.random()*4)+1;
    };

    function checkGoblinMovement(){
        if(goblin.changeDir){
            goblin.changeDir = false;
            goblin.stepCount = 0;
            goblin.stepTotal = Math.floor(Math.random*650)+1;
            getNewDir();
        }
        else
         {
           if(goblin.stepCount === goblin.stepTotal){
                 goblin.changeDir = true;
         }
       }
    };

    function update(delta){

        healthCheck();

        if(isGameOver){
            gameOver();
        }
        if(!isGameOver){
        updateCharLevel();
        keyboardInput(delta);

        moveGoblin(delta);
        checkGoblinMovement();

        goblin.sprite.update(delta);

        //update sprites
        if(mainChar.kills!=0 && bloodReady){
            for(var i=0; i<bloodArray.length; i++){
                    bloodArray[i].sprite.update(delta);
         }
        }

        //collision detection
        if(collision(mainChar, goblin))
            {
               combatOutcome(combatEvent());
               combatCleanup();
            }
            }
        };

    function main(){
        var now = Date.now();
        var delta = (now - then)/1000;
        if(!isGameOver){
        update(delta);
        }
        draw();
        then = now;
    };

function moveGoblin(delta){

    goblin.stepCount++;

    if(goblin.dir === 1){
      goblin.pos[1]  -= goblin.speed * delta* 2;
        if(goblin.pos[1] <= 85){
            goblin.pos[1] = 86;
          }
    }

    if(goblin.dir === 2){
        goblin.pos[1]  += goblin.speed * delta;
        if(goblin.pos[1] > 530){
            goblin.pos[1] = 531;
          }
    }

    if(goblin.dir === 3){
      goblin.pos[0]  -= goblin.speed * delta;
        if(goblin.pos[0] < 0){
            goblin.pos[0] = 1;
          }
    }

    if(goblin.dir === 4){
      goblin.pos[0]  += goblin.speed * delta* 2;
        if(goblin.pos[0] > 570){
            goblin.pos[0] = 571;
          }
    }

};

sentences:
OpenTK OpenGL wierd camera look I am trying to implement a simple camera mouse look.

if (Input.GetInstance().GetMouseKey(MouseButton.Middle))
{
    Vector2 d = Input.GetInstance().getMouseDelta() * 0.001f;
    camera.transform.AddRotation(new Vector3(-d.Y, d.X, 0));
}

Here is the camera matrix:

cameraMatrix = Matrix4.LookAt(myEntity.transform.Position, myEntity.transform.Position + myEntity.transform.GetForward(), myEntity.transform.GetUp());

I also tried to create camera matrix like this, but the results were the same:

Matrix4 t = Matrix4.CreateTranslation(myEntity.transform.Position);
Matrix4 r = myEntity.transform.RotationMatrix;
cameraMatrix = t * r;

Here is the rotation matrix of transform:

var x = Matrix4.CreateRotationX(rotation.X);
var y = Matrix4.CreateRotationY(rotation.Y);
var z = Matrix4.CreateRotationZ(rotation.Z);
rotationMatrix = x * y * z;

Add rotation of transform:

public void AddRotation(Vector3 rotation)
{
    if (rotation == Vector3.Zero) return;
    this.rotation += rotation;
    myEntity.ObserverOnRotationChanged();
}

Get forward method of transform:

public Vector3 GetForward()
{
    return new Vector3(RotationMatrix * new Vector4(0.0f,0.0f,1.0f,0.0f));
    //or just extract third column from matrix
}

Vertex shader:

#version 330

uniform mat4 transformMat;
uniform mat4 cameraMat;
uniform mat4 projectionMat;

layout (location = 0) in vec3 position;
layout (location = 1) in vec3 normal;
layout (location = 2) in vec2 uv;

void main(){
    gl_Position = projectionMat * cameraMat * transformMat * vec4(position, 1.0);
}

It rotates the camera around global x axis instead of local x when i look at triangle from the side.
Thanks.

sentences:
Component instance reference in Unreal Engine 4 I'm creating a C++ script and I want to get a reference to a component instance.
For example, imagine that I want to get the player camera, which is a UCameraComponent. I would create a UPROPERTY like this:
 UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"))
 class UCameraComponent* PlayerCamera;

However, I can't assign it in the editor details panel like I would in Unity. I would expect to be able to drag and drop a Component from an Actor on the World Outline to this property but it seems that's not possible. Moreover, when clicking on the dropdown in the details panel, I don't have any available to choose from.

From what I learned, it just isn't possible to do it this way and the Unreal way is to create a UPROPERTY to store a reference to the Actor and then get the component in runtime. Although this might work for most cases, it's still a bit memory inefficient since you might not need the Actor reference after getting the Component (yes, I know it's just a pointer, but still...). Plus, how would you handle multiple components of the same class in the same actor? I assume you have to loop over them and try to find the one you want, based on a priori knowledge of their order in the hierarchy or based on some of their known properties (maybe with tags)...

All of this seems kind of messy, so I ask you to please shed some light on what's the (best) Unreal workflow for setting component references.

sentences:
Applying Transformation Matrices to VBOs in OpenGL So I've recently tried to add Vertex Buffer Object Matrix transformation to an OpenGL engine I'm working on. I could go about this by applying the matrix to a copy of each vertex individually, but this would take a lot of CPU resources, so I am trying to implement transformation natively using OpenGL. This code works:

    /// <summary>
    /// Sets up the required OpenGL settings so as to create the necessary environment for the models to work (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public static void Setup(Size viewPort, ref Matrix4 camera) {
        GL.MatrixMode(MatrixMode.Projection);
        GL.PushMatrix();
        if (!(viewPort.Width == 0 || viewPort.Height == 0)) {
            Matrix4 matrix;
            Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver3F, (float) viewPort.Width / viewPort.Height, 0.01F, long.MaxValue, out matrix);
            GL.LoadMatrix(ref matrix);
        }
        GL.MatrixMode(MatrixMode.Modelview);
        GL.PushMatrix();
        Camera = camera;
        GL.LoadMatrix(ref Camera);
        GL.Enable(EnableCap.DepthTest);
        GL.Enable(EnableCap.Lighting);
    }

    /// <summary>
    /// Renders the model (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public override void Render() {
        if (IsVisible) {
            /*Matrix4 matrix = Matrix4.CreateTranslation(location);
            GL.MultMatrix(ref matrix);*/
            if (Cull)
                GL.Enable(EnableCap.CullFace);
            else
                GL.Disable(EnableCap.CullFace);
            texture.Bind();
            if (DataBuffer == 0) {
                GL.GenBuffers(1, out DataBuffer);
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
            } else {
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                if (UpdateFrame) {
                    GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
                    UpdateFrame = false;
                }
            }
            IndexBuffer.Bind();
            GL.VertexPointer(3, VertexPointerType.Float, Vertex.SizeOfVertex, IntPtr.Zero);
            GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.SizeOfVertex, TexturePointer);
            GL.NormalPointer(NormalPointerType.Float, Vertex.SizeOfVertex, NormalPointer);
            GL.DrawElements(BeginMode.Triangles, IndexBuffer.Count, IndexBuffer.Format, IntPtr.Zero);
            GL.Disable(EnableCap.CullFace);
            //GL.LoadMatrix(ref Camera);
        }
    }

    /// <summary>
    /// Resets the OpenGL settings set by calling Setup().
    /// </summary>
    public static void Reset() {
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();
    }

First Setup() is called to set up the projection matrix, then several meshes are rendered using the Render() method, then Reset() is called at the end to restore the matrices before I swap the buffers to the window.

However, when I comment out the commented lines in order to apply a simple translation matrix, I only get flickers all over the window. I tried using GL.Push() and GL.Pop() at the beginning and end of the Render() method, but to no avail. I also tried using GL.LoadIdentity() first and GL.MatrixMode(MatrixMode.Projection), but still no success.

Can anyone be kind enough to point out the mistake in my code please?

sentences: 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:
What causes seemingly random triangle artifacts in OpenGL? When switching version of OpenGL from 4.5 to 4.4, I suddenly started seeing these weird random triangles flickering over my scene

They move around somewhat randomly and are always pointed towards [0,0].

Given that this only appears in 4.4 and not in 4.5, my guess would be that I have some undefined behavior that manifests only in one version? I'm not using any advanced OpenGL, just drawing basic triangles with VBO buffers.

How should I go about debugging these sorts of issues, and what are the likely causes that manifest as artifacts? (The hexes and the white-ish path are what I inteded to draw, only the black/yellow/blue triangles are the artifacts)

sentences:
What causes this InvalidOperationException when drawing primitives? I'm working on implementing a 2D masking effect in my current game. To do so, I have two textures, one for the source image and one for the mask. The source image is just a regular texture, so that's easy. The mask I'm generating by rendering to a render target through the use of graphicsDevice.DrawUserIndexedPrimitives, but when I try, the following error pops up.

This is the function that attempts to render to the mask's render target. Vertices are of type VertexPositionColor.

private void RenderMaskTarget(SpriteBatch sb)
{
    graphicsDevice.SetRenderTarget(maskTarget);
    graphicsDevice.Clear(Color.Transparent);

    sb.Begin(SpriteSortMode.Deferred, null, null, null, null, basicEffect, camera.Transform);

    graphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.LineStrip, vertices, 0, vertices.Length, indexData, 0, primitiveCount);

    sb.End();
}

And this is the function that creates my basic effect.

private void CreateBasicEffect()
{
    Matrix projection = Matrix.CreateOrthographicOffCenter(0, Constants.ScreenWidth, Constants.ScreenHeight, 0, 0, 1);
    Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

    basicEffect = new BasicEffect(graphicsDevice)
    {
        World = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, 0, 0, 1),
        View = Matrix.Identity,
        Projection = halfPixelOffset * projection,
        VertexColorEnabled = true,
        LightingEnabled = false
    };
}

I've searched everywhere I can on this site and Google in general, but nothing I've tried has worked. I think my problem is a fundamental misunderstanding of what the exception above actually means. Based on its wording, the current vertex declaration doesn't include all required elements, and it then goes on to list the elements I do have, but it doesn't tell me what the required ones are. Further, where is the current vertex declaration defined? Is it VertexPositionColor that defines it or the BasicEffect?

I realize that similar questions to this have been asked before, but like I said, no solutions I've seen have worked. I think part of that is XNA vs. Monogame, where an XNA solution might not work for Monogame. I apologize if this is a true duplicate question.

Thank you :)

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:
Code is skipped after await call and returns to the calling method I'm developing a roguelike game in Unity using the RogueSharp library. Currently I'm stuck on realizing the turn-based combat aspect of the game (inspired by this tutorial), which is made up of a scheduling system that keeps track of the actors (i.e., the player and monsters) and handles the order of actions they can perform.
private async void ActivateMonsters()
{
    var scheduleable = SchedulingSystem.NextActor;
    UnityEngine.Debug.Log($"Turn of {scheduleable}!");

    if (scheduleable is Player)
    {
        IsPlayerTurn = true;
        SchedulingSystem.Add(Player);
    }
    else
    {
        if (IsPlayerDead)
        {
            return;
        }
        if (scheduleable is Monster monster)
        {
            UnityEngine.Debug.Log("Start monster turn!");

            if (await monster.PerformAction(InputCommand.None))
            {
                UnityEngine.Debug.Log("Monster action done!");

                SchedulingSystem.Add(monster);
            }
        }

        ActivateMonsters();
    }
}

At the bottom of the method, there is a recursive call to ActivateMonsters() for ensuring that all monsters perform their actions until the player has a turn again.
Since my roguelike game is graphical and not text-based, the monsters have animations for attacking, walking, etc., that should be displayed on every turn. Therefore, the game should wait for each monster to perform its attack including playing the corresponding animation, before moving on to the next monster's turn. To achieve that, I've made the ActivateMonsters() method async and wait for monster.PerformAction() to end (the InputCommand.None input enum can be ignored).
ActivateMonsters() is initially called in this event handler method invoked in Unity's Update() method:
private void UpdateGame(object sender, EventArgs e)
{
    if (IsPlayerTurn)
    {
        HandleKeyboardInput();
    }
    else
    {
        UnityEngine.Debug.Log("First ActivateMonsters() call!");
        ActivateMonsters();
        RenderRequired = true;
    }
}

monster.PerformAction() first calculates the next position of the monster via pathfinding in an async method, which then calls the following method:
public static async Task<bool> Move(Actor actor, Loc location)
{
    EnsurePropertiesAreSet();
    var previousActorPosition = actor.Loc;

    // Return true if moving the actor to the given location was successful.
    if (DungeonMap.SetActorPosition(actor, location))
    {
        if (actor is Monster monster)
        {
            var moveDirection = location - previousActorPosition;

            await Task.Delay(3000);

            // Move the monster on the map.
            Game.SetMonsterMoveDirection(monster, moveDirection);
        }

        return true;
    }

    return false;
}

For testing purposes, I put in the await Task.Delay(3000) before the monster moves to the next tile.
With this I get:
First ActivateMonsters() call!
Turn of BrainHero.RogueLike.Actors.Goblin!
Start monster turn!
First ActivateMonsters() call!
Turn of BrainHero.RogueLike.Actors.Player!
[3 second pause]
Monster action done!
Turn of BrainHero.RogueLike.Actors.Player!

However, what I want to get is:
First ActivateMonsters() call!
Turn of BrainHero.RogueLike.Actors.Goblin!
Start monster turn!
[3 second pause]
Monster action done!
Turn of BrainHero.RogueLike.Actors.Player!

The await Task.Delay(3000) part does work, but it seems like that the if (await monster.PerformAction(InputCommand.None)) is skipped and the code execution returns to UpdateGame() for some reason. How can I modify the code so that I can achieve the latter execution sequence?
Thanks in advance for any help in solving this issue!

sentences:
Second text render does not show when hit action button in Unreal Engine 4 I am basically making a system to show texts like "E to Open" when player gets close to a chest or door. I use this:

When I hit first chest, everything's fine but second or any other text won't show after that.

What am I doing wrong?

sentences:
Why is this animation jerky? I am trying to create a simple game on android but I am unsure the best way to do the game loop.  Looking at the LunarLander sample the game loop just loops like a variable time step loop (elapsed = now-lastupdate).  I tried using this method to draw a circle that grows in size to a max radius then shrinks to a min radius and repeats.  However, when I run the program the growing stage is very choppy and slow (it takes longer than it should to get to max radius).

My Code:

    public void updateSize(double elapsed) {
        if (mGrowing == true && mRadius > mMaxRadius) {
            mGrowing = false;
        }
        if (mGrowing == false && mRadius < mMinRadius) {
            mGrowing = true;
        }

        if (mGrowing == true) {
            mRadius += mDRadius * elapsed;
        } else {
            mRadius -= mDRadius * elapsed;
        }
    }

mDRadius is the number of pixel the radius should change per second and elapsed is the number of seconds that has passed.

I tried putting in a sleep of 2ms and 5ms in my game loop and I get the same result.

I converted my loop to a fixed time step (only run physics update if now-lastupdate > TIME_STEP) and the animation was a lot smoother.

UPDATE: I change the sleep to 15ms and it's a lot smoother.  Every other example I've seen of an android game does not have a sleep in the main loop.  Is this because my sample is just so simple that it takes virtually no time to update and all other examples just have a longer update time or am I missing something?

sentences: How can I speed up this design? I am currently developing a game that includes a server and some clients. Currently, the server does its work based on user input then draws the image the clients should see and sends it. Unfortunately, the server's time is taken up almost exclusively by the drawing and encoding. Is there a better way for me to design this?

sentences: Can I use sdl_net2.0 with cocos2d-x? Can I use sdl_net2.0 lib with cocos2d-x? And how it cconects to each other. Or analog lib to use?

sentences:
How can I legally allow modders to use my tools that are dependent on licensed assets? I am making a moddable game with Unity. I actually have working system for serializing/deserializing items etc.
For purpose of easy item creation in Unity, I made editor-only windows that help you with process of creating objects and setting their properties. The thing is these windows are dependent on bought asset.
My question is how to let users create their own items with those editor-only windows? I wanted to make project open source (so they can put it in Unity and just do it as I did) but obviously I can't put licensed files there.

sentences:
Simultaneous game states I think I understand the basic idea behind a Finite State Machine-based game loop. But I'm trying to write a little game in which the same object can simultaneously be in multiple, independent states. At least that's what I want to do.

To give you an idea: Robot may be in FleeState and FireLaserState at the same time, besides in each of them individually at any time.

Would something like this be possible using the FSM pattern? Or ought I to look elsewhere?

After all, does the whole idea make sense?

Pasted from my comment below: A little clarification of why I'd like states to be kept separate:  I want the player to have the ability to program simple state changes before a game... say "if (health_is_way_too_low) flee". But then I want multiple such rules to be active simultaneously in order to keep the game interesting, and cannot know beforehand which other states may be active.

sentences:
Efficient existing rating system for multiplayer? I would like to add a rating for online version of a board game. In this game there are many game rooms each normally having 3-4 people.

So I expect that player's rating adjustments (RA) should depends on

Rating of opponents in the game room
Number of players in game room and final place of a player
Person gets rating increase if he plays more games and more frequently
If a person leaves a game room (disconnect) before the game ends he should get punished with a high rating decrease

I have found two related questions in here

Developing an ELO like point system for a multiplayer gaming site

Simplest most effective way to rank and measure player skill in a multi-player environment?

Please, let me know what would be the most appropriate existing rating model to refer.

sentences: Reverse Movie in Unity 5 guys! Is it possible to reverse video or apply a rewind in Unity 5? I searched in the web but could not find the solution.

sentences:
Programatically placing musical notes on a stave I'm trying to program a musical stave and have come against the problem of where to place a note, given its index.

The index of a note is defined from a model created from the table in the following: Piano Note Frequencies

For example, in the model, C4 has an index of 40 and D#5 an index of 55.

Here is an image of what the stave currently looks like:

The text in red shows the indices the stave has available to put notes (disregard the horizontal position). Only a few indices are shown, however they extend much further. For example, placing a note on the stave at index 0, it appears at A4 on the stave.

I'm having difficulty translating from an index in the note model, to an index on the musical stave.

At first, I've done a (knowingly) naive implementation. Index 0 in the stave corresponds to A4, or index 49 in the note model. Given an index from the model, calculate how many half steps away the index is and use this as the index in the stave. For example, C5 is index 52 and gives a stave index of 3. Looking at the above image, it's clear this is wrong for two reasons.

Firstly, we didn't account for a note and its sharp laying on the same index. Secondly, we didn't account that B4 and C5 have one half step between them, but are in different places on the stave.

I've been scratching my head over this for a while. What are the rules to follow for translating from a note index to a position on the stave?

EDIT: Each note in the note model knows whether it is sharp or not, its pitch (e.g. C, D, E, etc), and octave.

sentences:
Generating spritesheet(s) on load I would like to reduce the size of the spritesheet I am loading by only loading the specific sprites I need.  Is there a way to crop and splice images at runtime using javascript?  Creating separate spritesheets for each level is not ideal, as that would mean lots of repeated sprites.

edit for clarification: Say I want to replace the 5 sprites in the top right corner of my spritesheet based on user input.  Is there a way to remove the sprites that are there and replace them with some from a different file?

sentences: Making a 2d sprite based game in Unity? I'm looking at developing a 2D sprite based platformer. Usually I make games in Gamemaker, because I find it very easy to use. I have never used Unity before but have heard a lot of good things. So, just wondering whether you can easily make this type of game in Unity?

sentences:
score aggregation service Before i write my own asp.net app, i wanted to see if there is an existing service already.
What i am looking for is send # of zombies the player killed at the end of game to the service. The service than shows sum of all zombies killed that day in the world by other players.
It will also show top 3 players by their summed score today, not their best score in one game.
Is there such service available or do i have to roll out my own?
thanks

Moderator marked this as duplicate of this but the service mentioned in the topic is no longer in service.

sentences:
Mouse input and structure in JS I am creating a simple concept where I have a small menu to choose a tool from and then I can click and drag to build.

For example, I click on the rails tool and then I can click and move the mouse to create a rail segment.

I'm coding it something like this(missing some variables for temp values and objects):

var toolSelected = false;//if I click the rails button, it changes to 'rails'

renderer.domElement.addEventListener('mousedown', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //create rail object starting in event coordinates
    }

});

renderer.domElement.addEventListener('mousemove', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //pass the mouse movement to the rail object to update end coordinates position so I can drag and see the potential rail
    }

});

renderer.domElement.addEventListener('mouseup', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //indicate that the rail should be finished and build it with the mouse up coordinates
    }

});

The question is, is there a better or recommended way to structure these mouse events? Or do I have to, under each mouse event, check which tool is selected and perform the appropriate actions?

sentences:
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:
What are the legal implications of creators streaming their development? Is there any question of losing ownership of their work if people stream themselves coding? I can understand that streaming modeling, animations, and game design would be fine because even if you see someone do it it will take time to do, but what about code?

Are there worries about other people recording their streams and using their code?
Is there some special case for these games like being open source or non proprietary?

sentences:
How to increase render distance? I've been trying to find the source of why my render distance is so low (I'm new at using LWJGL and don't know the complete basics yet) and I believe it falls down into this code. My idea for my game (Well, this is more of a practice run to get used to coding 3D games.) is going to be a small island with a size of around 800 which seems extremely low however it is only loading a small portion which I'd estimate to be 600. The code for my MasterRenderer class is below. createProjectionMatrix() is called in the constructor and prepare() is called at the beginning of every render.

private static final float FOV = 70;
private static final float NEAR_PLANE = 0.01f;
private static final float FAR_PLANE = 1000f;

public void prepare() {
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glClearColor(0.49f, 89f, 0.98f, 1);
}

private void createProjectionMatrix() {
    float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
    float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
    float x_scale = y_scale / aspectRatio;
    float frustum_length = (FAR_PLANE - NEAR_PLANE);

    projectionMatrix = new Matrix4f();
    projectionMatrix.m00 = x_scale;
    projectionMatrix.m11 = y_scale;
    projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
    projectionMatrix.m33 = 0;
}

I've tried altering the FAR_PLANE and NEAR_PLANE with no results other than some minor bugs with changing the NEAR_PLANE to a small number.

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:
Why is there high performance hit with many meshes? I am currently reading upon Geometry Instancing, as I want to render a lot of animatable objects on the screen.

However I have come to a more fundamental question first: Why do I even need to use it?

Consider this setup:

A plane as the base of the game world
On top of that a lot of tiles, which can be destructable with the use of a Physics Engine.
A camera which you can control with WASD + mouse for direction.

Now I do understand that there definately must be a performance hit at some point. I thought it would occur when sending all object data (vertices) to the GPU.

However the performance hit remains to be there, at every single frame it renders, what is actually happening in the background? Considering nothing at my scene is changing at all, it even happens when I do not move the camera at all.

I have no clue what exactly is going on and would definately want to read up more about it before starting to fix an issue that I do not understand, thus making the fix also harder to understand. I do know however that the fix (Geometry Instancing) works by sending the vertex data only once per multiple of objects based on that same vertex. So somehow it would have to do with the amount of vertices, yet I don't see what is going on?

Also: I am using the Ogre3D engine, so any specific answers/tips to that engine would also be welcome.

Regards.

sentences:
GODOT Change scene in node I will change a scene on button click. But not change the main scene with button.

Node structure:

main
- scene (with childs)
- button

button.gd:

func pressed():
    get_node("scene").change_scene("res://second_scene.tscn")

It doesn't works.

sentences:
Texture Wrapping isn't getting applied to my object I have a Drawable Class, a Cube Class, and a Texture class. I feel like the texture wrapping isn't being applied due to some values being passed by reference, or just being discarded. My cube just derives from Drawable and only implements the render function and some other small overhead that shouldn't be a factor.

This is the error:
http://imgur.com/Dj2hCkp

Drawable:

// A structure to define each vertex of a model
struct Vertex
{
    glm::vec3 Position, Color, Normal;
    glm::vec2 UV;
};

class Drawable
{
public:
    Drawable();
    // cleans up our shaders, textures, and buffers
    virtual ~Drawable();

    // loads the buffers and shaders for our drawable
    virtual void loadBuffers();
    virtual void loadShaders();
    virtual void loadTextures();

    GLSL shaders;

    std::vector<Vertex> vertices;

    glm::mat4 model, view, projection;
    GLint modelLoc, viewLoc, projLoc, textureLocation;

    GLuint vao, vbo;

    GLTexture texture;
};

loadBuffer function:

glCreateVertexArrays(1, &vao);
glGenBuffers(1, &vbo);

glBindVertexArray(vao);

glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), vertices.data(), GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<GLvoid*>(offsetof(Vertex, Position)));

glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<GLvoid*>(offsetof(Vertex, Color)));

glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), reinterpret_cast<GLvoid*>(offsetof(Vertex, UV)));

glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);

My texture is created with this function:

GLuint& GLTexture::createTexture(int texWrap, int textureFiltering, const std::string filePath)
{
    glGenTextures(1, &_texture);
    glBindTexture(GL_TEXTURE_2D, _texture);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texWrap);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texWrap);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, textureFiltering);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, textureFiltering);

    sf::Image image;
    image.loadFromFile(filePath);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.getSize().x, image.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());
    glGenerateMipmap(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, 0);
    return _texture;
}

draw:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture.getTexture());
glUniform1i(textureLocation, 0);

shaders.use();

glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(projection));
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, vertices.size());
glBindVertexArray(0);
shaders.unuse();

My UV is calculated by clamping the positions from -1 ~ 1 to 0 ~ 1

vert.UV = glm::vec2((vert.Position.x + 1.0f) / 2.0f, (vert.Position.y + 1.0f) / (2.0f));

I feel like i'm doing everything right, based on looking at the source code of two tutorials, yet it ends up warped no matter if i use

GL_CLAMP_TO_EDGE / BORDER
GL_REPEAT

Vertex shader:
    #version 330 core

layout (location = 0) in vec3 in_Position;
layout (location = 1) in vec3 in_Color;
layout (location = 2) in vec2 in_UV;

out vec2 vs_TexturePos;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main()
{
    gl_Position = projection * view * model * vec4(in_Position, 1.0f);
    vs_TexturePos = in_UV;
}

Fragment shader:

#version 330 core

in vec2 vs_TexturePos;

uniform sampler2D t_Texture;

out vec4 color;

void main()
{
    color = texture(t_Texture, vs_TexturePos);
}

It might be that the texture parameters aren't being stored, is there a openGL debugger I can use to verify this?

sentences:
How to find the closest point on multiple colliders within a box? I need to find the position of the closest point from the bounds of multiple colliders. Right now I'm using OnTriggerStay and collider.ClosestPointOnBounds().

This works great for one collider, but as when I add a new collider, it doesn't update.

I've drawn a quick picture to illustrate what I'm trying to say. The black box is the area I want to check in, the red boxes are the colliders with numbers representing the order they entered the black box. The green star is what the code currently says the closest point is, and the blue star is the expected result. The purple star is the position I'm checking for, the blue star should be the closest point to the purple star.

I found this answer to a similar question on answers.unity3d.com. However, I feel like that could be very inefficient because there will be many, probably up to 50 of these box checking scripts running at the same time.

I've also tried using Physics.BoxCast but that gave very wild results. The area it was checking was very different to what I wanted, and also what I was visualizing with gizmos. Also, the whole idea of boxcasts are very very confusing so I would rather something else.

What is the best way to find the closest point on the bounds of multiple colliders within a certain area?

sentences: AR / VR Software Engineering What is the primary difference between Augmented Reality and Virtual Reality software engineering?

sentences:
How do I draw my particles when an enemy is killed? I have enemies that move left and right.
I was wonder how I could make my particles show up when the enemy is killed?
Here is my particle class
    class explode:

        def __init__(self,x,y,height,width,color):
            self.x = x
            self.y = y
            self.height = height
            self.width = width
            self.explode = [
            pygame.image.load("spark_01.png"),
            pygame.image.load("spark_02.png"),
            pygame.image.load("spark_03.png"),
            pygame.image.load("spark_04.png"),
            pygame.image.load("spark_05.png"),
            pygame.image.load("spark_06.png"),
            pygame.image.load("spark_07.png")]

            self.explode = [pygame.transform.scale(image,(image.get_width()//7,image.get_height()//7)) for image in self.explode]

            self.rect = pygame.Rect(x,y,height,width)
            self.direction = "blobright"
            self.anim_index = 0
        def draw(self):

            self.rect.topleft = (self.x,self.y)
            if self.direction == "blobright":
                window.blit(self.explode[self.anim_index], self.rect)
                self.anim_index += 1
                if self.anim_index == len(self.explode):
                    self.anim_index = 0

    black = (0,0,0)
    explode1 = explode(400,450,50,50,black)
    explodes = [explode1]

This is where I delete my enemies when they are killed. How can I add my particles after it's deleted and remove the particles afterward?

        #--------------------------------------------------------------------------------------------------------- enemys

                # enemys 2
            for enemys in enemying:
                for bullet in bullets:
                    if bullet.rect.colliderect(enemys.hitbox):
                        if enemys.health > -4:
                            enemys.health -= 1
                            minusenemyhealthtext()
                            bullets.pop(bullets.index(bullet))
                        else:
                            enemyscore += 1
                            del enemying[one]
                            enemyors = font.render("" + str(enemyscore), True, (0,0,0))
                            enemydors.center = ((130,125))

sentences: Batch resizing of textures I have a large number of png files that I need resize so the sides are in powers of 2 without stretching the images in those files. Basically add/remove white-space so the image is in the upper left corner of the image and it is sized appropriately. Because of the large number of files I would rather not edit them individually if at all possible.

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:
Windows Form code not executing? Ok, I've got a weird one here.  I'm trying to make a basic tile engine using a windows form, but some of my code is just...not happening.  I'll post the chunks in question.

private void MapEditor_Load(object sender, EventArgs e)
    {
        LoadImageList();
        FixScrollBarScales();
        cboCodeValues.Items.Clear();
        cboCodeValues.Items.Add("ENEMY");
        cboCodeValues.Items.Add("CHEST");
        cboCodeValues.Items.Add("NPC");

        for (int x = 0; x < 100; x++)
            cboMapNumber.Items.Add(x.ToString().PadLeft(3, '0'));

        cboMapNumber.SelectedIndex = 0;
        TileMap.EditorMode = true;
        backgroundToolStripMenuItem.Checked = true;
    }

This should be called when the form loads, right?  The code dives into LoadImageList(), which contains:

private void LoadImageList()
    {
        string filepath = Application.StartupPath + @"\Content\Textures\IndoorTileSet.png";
        Bitmap tileSheet = new Bitmap(filepath);
        int tilecount = 0;
        for(int y = 0; y < tileSheet.Height / TileMap.TileHeight; y++)
        {
            for(int x = 0; x < tileSheet.Width / TileMap.TileWidth; x++)
            {
                Bitmap newBitmap = tileSheet.Clone(new System.Drawing.Rectangle(x * TileMap.TileWidth, y * TileMap.TileHeight,
                    TileMap.TileWidth, TileMap.TileHeight), System.Drawing.Imaging.PixelFormat.DontCare);
                imgListTiles.Images.Add(newBitmap);
                string itemName = "";
                if(tilecount == 0)
                    itemName = "Empty";
                if(tilecount == 1)
                    itemName = "Floor";
                listTiles.Items.Add(new ListViewItem(itemName, tilecount++));
            }
        }
    }

The bitmap loads correctly, but then the entire MapEditor_Load method just stops working.  tileCount seems to be a local variable in the debugger, and its value is 0, but the debugger never executes the breakpoint on the line which it is assigned.  I have absolutely no idea why it would do this, and it's driving me nuts.  Any help?
Oh, I put the bitmap load in a try/catch block just to see if it was handling an exception in a weird way, but I had no luck.  It's not throwing an exception.  I began having this problem immediately after replacing my IndoorTileSet with an updated version.

sentences: Is there a faster sine function? I am working on generation 3d perlin noise. The C# Math library seems like overkill for what I need since most of its functions use double percision. I use Math.Sin() in several places to generate the noise. Does anyone know of a faster sine function?

sentences:
How does Texture2D.GetData return coloured pixels? I'm trying to work out how the pixels are stored in the returned array but I'm not having a lot of luck (and thus my calculations don't seem to be working).

I realize that the pixels are stored in one long continuous array but are the pixels grabbed width first or height first? I've tried drawing out the "pixels" of a texture on paper to calculate where the pixels should be based on the single array but I'm not getting expected results.

My assumption is the following:

Assuming I am using i to specify rows and j to specify columns that any given pixel in a 2D texture can be calculated by the sum of i * j or is this incorrect?

sentences: Random generation of realistic human faces What would be a practicable way of generating huge numbers of realistically looking human faces? Randomizing 3D-models and rendering them would require a lot of computing power, especially as I'm needing them on an ad-hoc basis. Layering individual 2D-drawn parts requires some artistic talent, which I'm definitely lacking. Also, I'd like to parameterize as many aspects of the generational process as possible. Do you have any suggestions how to go about this?

sentences:
Where am I obligated to put credits? First of all this is not a discussion for the best place to put credits, but rather where it's allowed.

So for instance is it fine if I just include a credits.txt file in the install directory, or will I have to make an in-game place where you can read them.

And is there any general rules, or is it up to the individual which need credit?

sentences:
Modern opengl for direct3d programmers I don't think this is quite the same questions as this one but if you disagree feel free to close this :)

With SteamOS being announced yesterday I can see that it's entirely possible that opengl will get a big boost in usage in the near future. Now I already know direct3d11 quite well but I think maybe it's time to learn opengl too.

Are there any good resource for learning modern opengl that are aimed at programmers who already know direct3d11 pretty well. So don't need any education on the concepts and math, just on how to use the API and any important differences?

sentences: What are some techniques used for mouse tracking, with a bit of "emulated lag"? I am trying to implement a system, where the cursor (in my case the player's avatar) is always about 1.5 seconds (a configurable interval) behind where the mouse actually is. If I change the cursor's location every time through, I get an emulated mouse cursor with no delay, I'm wondering if there are any pre-canned type of solutions I can throw at this before I "roll-my-own." Source code or even just basic steps you've used would be helpful.

sentences:
How to create opacity mask from colored bitmap? For the image (bitmap) below,

if I do:

Create a spite with the image in unreal engine.

Create a opacity mask on the spite.

Use this image, choose a specific color, such as blue, make its corresponding region the only opacity region on the mask.

My question is about the implementation of part 2 and part 3 in Unreal engine, they are quite confusing.

If anyone know how to implement it in unity, it would also be helpful.

Thanks a lot.

sentences:
How to check for collisions in "diagonal" tiles? I want to create a tiled map in the following scheme:

The player should be able to walk on the blue line (street). Now, what is the best way to solve collision detection in this case? For example, in the case of tiles C1 and C2: If I make them walkable, then the player could also move in on those black parts of the tiles that should not be walkable.

On the other hand, if I make both C1 and C2 blocked, then the player would not be able to walk on these tiles (and therefore on the street) at all.

Any best practices?
Thanks.

sentences:
Why aren't linked lists more common data structures for enemies? I was recently listen to a talk that Jonathan Blow gave, you can find it here.  In the talk, he was talking about what data structures he (and he seemed to imply many others) use, and why.  Which is to say that he simply used arrays to store data, and use the naive approach to find data in it, meaning iterate through the array until you found what you wanted, assuming it wasn't in a performance critical place in the code.  He gave the example of loading data from a wad file in doom, which while fast, still took that naive approach (at least according to the talk, I haven't looked at the source code since I have not a clue to where I should begin).  The reason he gave for this was because while it may be slightly slower to do things the naive way, it's not much, and in many cases, not noticeable, so it's better to optomize how much work you can get done in your lifetime, than to make things a millisecond faster, again, assuming it's not in your physics engine or something like that.

All this seems well and good, except I have one question, why not linked lists rather than arrays?  Sure, if you had to make your own linked list class, I would be on board, but in c++ anyway, assuming your using STL, you only need to declare the type as a list, rather than as a vector, and use iterators to loop over it, rather than looping an index.

The advantages of using a linked list though seem much greater, for example, if you can be guaranteed that nothing is going to be removed from it while your iterating, you don't need to have locks around it, because adding data doesn't have the possibility of moving everything (or is that a bad assumption).  Also, in general, moving data is slow, although this could potentially be avoided if you know the size of your data by reserving the space.

Another advantage is when you do remove data, you just tell the list to remove it, and it just needs to change a few pointers, and call a destructor, which can be done pretty quickly.  But to remove something from an array/vector, you have to either shift everything back one, or possibly add a flag saying that it has been deleted.  (Or, another possibility if you don't care about the order of the data, is move the data at the end index, to the data in the now deleted position).  Either way, this seems like it is a lot of extra, unneeded work, or potentially too slow.

I did take a look around and found this, which claimed that a lot of older developers didn't want to use STL because it wasn't mature enough.  Also, older games AFAIK, used C rather than C++, which also doesn't have STL.  And I could see a case there for using arrays rather than linked lists, because you would have to make your own (which while simple enough to do, could potentially lead to many more errors).

I also read that it's a bad idea to create iterators in Java (due to the garbage collector), but that idea seems moot in languages such as C++, where there isn't a garbage collector, and I would imagine that linked list iterators are pretty lightweight (admittedly probably not as lightweight as vector iterators though).  Or is this also a bad assumption, and it's better/faster just to use an index in your loop, and increase that.

sentences:
Phaser/HTML5 - Trying to add five instances to a group and display on the screen! just started using Phaser today after seeing Thomas Palef's lessmilk series. I completed PhotonStorm's "Make your first Phaser game" tutorial, and grabbed the skeleton, some CSS, and started to throw together a game. It's pretty barebones right now, but this is what I have.

The issue is that the game doesn't display the additional "orc" units I've requested. I used a for loop to throw five orcs around the map within the specified borders (32 pixels from the outside boundary. I even wrote a check for the x and y of each in the Update() function, but they don't appear at all.

I don't know how to move on from where I am, and I'm not sure that any of what I've written has been written the right way, you know what I'm saying? Thanks.

http://pastebin.com/if2VTq7j

sentences:
Level progression grid/chart What I'd like to do is create a sheet where I can track character XP/level progression.

I created this by hand:

It's sloppy, but in the realm of what I'd like to generate on a computer. Each bar represents XP needed to level up, with each square on the grid representing a set number of XP.

Any ideas how I could go about doing this in a more standardized/repeatable/printable?

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:
How do I calculate an inverse bind-pose matrix for COLLADA? I want to port a rigged mesh from a custom format to COLLADA. The bones I have define a position for the bone (local) and a matrix that transforms the child-bones' positions into the next-higher coordinate space. (The position of the root usually is {0, 0, 0}.)

How can I convert these to the inverse bind-pose matrices used for COLLADA?

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:
Swing KeyListener doesn't work when pressing Shift X Z and directions at the same time My code:

addKeyListener(new KeyListener() {
    @Override
    public void keyPressed(KeyEvent event) {
        if (event.getKeyCode() >= KeyEvent.VK_LEFT && event.getKeyCode() <= KeyEvent.VK_DOWN)
            direction.set(event.getKeyCode() - KeyEvent.VK_LEFT, true);
        if (event.getKeyCode() == KeyEvent.VK_Z) direction.set(4, true);
        if (event.getKeyCode() == KeyEvent.VK_CONTROL)          System.out.println(event.getKeyCode());
    }

    @Override
    public void keyReleased(KeyEvent event) {
        if (event.getKeyCode() >= KeyEvent.VK_LEFT && event.getKeyCode() <= KeyEvent.VK_DOWN) {
            speed = event.isShiftDown() ? 1 : fastSpeed;
            direction.set(event.getKeyCode() - KeyEvent.VK_LEFT, false);
        }
        if (event.getKeyCode() == KeyEvent.VK_Z) direction.set(4, false);
    }

    @Override
    public void keyTyped(KeyEvent keyEvent) {
    }
});

I start my application and press Shift, Z, and X at the same time, at this moment everything was fine (Successfully see command line output).
But when I press UP or DOWN, swing isn't invoking my listener (no command line output).

I've repeated many times and it's all the same.

Is there any work-arounds?

sentences:
LibGDX hexagonal tilemap getting adjacent tiles How do I get all adjacent tiles to a hexagonal tile, my tile map is using a staggered co ordinate system with an odd stagger index and I am using libgdx java.

if (x % 2 == 0) {
            hexAdj[0] = new Vector2(x    , y + 1);
            hexAdj[1] = new Vector2(x + 1, y + 1);
            hexAdj[2] = new Vector2(x + 1, y    );
            hexAdj[3] = new Vector2(x    , y - 1);
            hexAdj[4] = new Vector2(x - 1, y    );
            hexAdj[5] = new Vector2(x - 1, y + 1);
        }else{
            hexAdj[0] = new Vector2(x    , y + 1);
            hexAdj[1] = new Vector2(x + 1, y    );
            hexAdj[2] = new Vector2(x + 1, y - 1);
            hexAdj[3] = new Vector2(x    , y - 1);
            hexAdj[4] = new Vector2(x - 1, y - 1);
            hexAdj[5] = new Vector2(x - 1, y    );
        }

sentences:
What edition of VS is installed by Unity and what are its capabilities? My brother just installed Unity on my desktop, and it seems like it installed Visual Studio 2017 as well.

I was planning to install Visual Studio before this, so I was wondering what kind of version is this edition of VS? Is this like a bare-bones version? Does it work like a standalone version without lacking features? Can I use it just as a regular IDE to program in?

I typically program in C++, and I never used Unity before, so I'm not sure if this version of VS is only suited for Unity.

sentences:
Change all boolean parameters of an Animator in Unity How can I change all boolean parameters of an animator to false?

Here is a solution which I found:

foreach (AnimatorControllerParameter parameter in playerAnimator.parameters)
{
    playerAnimator.SetBool(parameter.name, false);
}

The problem with this solution is that I will get a warning in console if my parameter in Animator is not a boolean. I would not like to be getting that. So, I need somehow to being able to take only parameters of type boolean.

sentences:
Incorrect Normal Matrix In my game engine I'm passing a normal matrix to my shaders like so:

Matrix3f normalMatrix = modelMatrix.invert().transpose();

However this is causing lighting to rotate with my object, producing a weird effect.

As I'm not performing any non-uniform scaling, I tried substituting normalMatrix for mat3(modelMatrix), and that worked fine.

Also doing the transpose inverse on the GPU using transpose(inverse(modelMatrix)) worked fine.

This has lead me to believe there is a bug in my invert() and transpose() functions.

According to some math websites, when the modelMatrix lacks any non-uniform scaling, calling inverse().transpose() on it will produce the exact same matrix.

However in my code the output is far from the same:

modelMatrix

0.25    0      0      2353.3474
0       0.25   0      0
0       0      0.25   51.86973
0       0      0      1

normalMatrix = new Matrix3f(modelMatrix).invert().transpose()

4.0 0.0 0.0
0.0 4.0 0.0
0.0 0.0 4.0

Would anyone be able to shed some light on this issue...
(I don't want to just stick with modelMatrix because I do want to support non-uniform scaling in the future)

Here are some screenshots describing the issue:

These are two frames of my planet as it rotates. The light source appears to be rotating with it (it shouldn't be). Using the modelMatrix instead of normalMatrix solves the issue.

sentences:
Questions about Jrpg NPC events (Unity C#) So, I'm trying to wrap my head around something. I've got my basic quest system up and running for my rpg style game.

Right now I'm taking a look at NPC events and triggers that as I see it have two distinct styles

The classic floor panel trigger that rpg maker uses or
have a listener class for quest active / event active

My questions are thusly what's the best way to go about activating the event and what's a good way to define the event? Like set movement patterns etc would it be feasible in json? Or should I use scriptable objects?

sentences:
AS3 Stage3D Mouse click problem? I have a problem with Mouse interaction and Stage3D.

The only way I found to register to listen to mouse clicks and interact with Stage3D, is to add a mouse eventListener directly to the .stage.

However this will result in any time i click anywhere in the flash application the mouse click will fire, even if there is an overlaid 2D menu where the user intended to click.

IE I have a 3D application running in the background, which listens to clicks, and I have some floating User Interface elements in the foreground, and ideally if I clicked a button in the foreground, then that would NOT fire a click event that the Stage3D would register.

Any idea how to solve this problem?

sentences:
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:
XNA 4 / Monogame 3d tunnel collision I am trying to collide an aircraft with a FBX tunnel model. I don't know how to create multiple bounding boxes for a tunnel. The tunnel is contains a single mesh. I tried using the triangle picking sample here http://xbox.create.msdn.com/en-US/education/catalog/sample/picking_triangle
I also created a bounding sphere around the tunnel to be able to detect if the aircraft is inside the tunnel. If the ship is inside the tunnel then I check the triangle & ray intersection. I also detect the intersection. I tried changing the rotation and position of the ship when intersection occurred but although I can detect the intersection ship passes through the tunnel surface mostly and my rotation doesn't work well.

I also tried to calculate ray & plane (here it is triangle) reflection as below:

            if (intersection < 0.4f)
            {
                Plane pickedTriangle = new Plane(vertex1, vertex2, vertex3);
                Vector3 reflectionVector = Vector3.Reflect(direction, pickedTriangle.Normal);
                newPosition = modelPosition + direction * gameSpeed * reflectionVector;
                newDirection = reflectionVector;
                tIntersected = true;
            }

As I see newPosition isn't calculated correctly.

My question is; how can I calculate a new position after a ray & plane intersection.

I think this causes the ship sometimes pass the tunnel surface sometimes.
If there is a better way to detect and calculate tunnel collision I'll appreciate it.

Thanks

sentences: How do I get the touch event on a body in JBox2d I have various bodies rotated at some angle with the help of Box2d in LibGDX. What I want is to destroy the body when I click on it, but the problem is that I am not able to get the area definition of the body so that I can check whether my touch point lies inside the body. I tried using actor and its hit() method but it's working only if I don't rotate it. As far as I know, once I rotate the body, its bounds are not rotated.  How can I check the Touch event in a Body?

sentences:
Pausing and resuming in Unity I've been writing this code quite late so please bear with me.
I'm trying to pause the game and show a menu when I'm inside a collider and then when i press a key it should unpause the game and continue but it wont and i cant figure out why.

Here's the very simple (in my eyes) code:

var savedTimeScale : float;
var playerStatus : Player_Status;
var inTheZone : boolean = false;
private var startTime: float = 0.1;
var start:GameObject;

enum Upgrade { None,Main }
private var currentPage:Upgrade;

function Start()
{
    currentPage = Upgrade.None;
}

//function for ontriggerenter and pressing button to show menu
function OnTriggerEnter(collider:Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = true;
}

function OnTriggerExit(collider: Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = false;
}

function Pause()
{
    savedTimeScale = Time.timeScale;
    Time.timeScale = 0;
    AudioListener.pause = true;
    currentPage = Upgrade.Main;
}

function UnPause()
{
    Time.timeScale = savedTimeScale;
    AudioListener.pause = false;
    currentPage = Upgrade.None;
    if(IsBeginning() && start != null)
    {
        start.SetActive(true);
    }
}

function IsGamePaused()
{
    return Time.timeScale == 0;
}

function OnGUI()
{
    if(inTheZone == true && Input.GetKeyDown(KeyCode.E))
    {
        Pause();
    }

    if(Input.GetKeyDown(KeyCode.N))
    {
        UnPause();
    }

    if(IsGamePaused() && !IsBeginning())
    {
        UpgradeMenu();
    }
}

function UpgradeMenu()
{
    BeginPage(200,200);
    GUILayout.Button("Hello");
    EndPage();
}

function BeginPage(width, height)
{
    //GUI.DrawTexture
    GUILayout.BeginArea(Rect((Screen.width-width)/2,(Screen.height-height)/2,width,height));
}
function EndPage()
{
    GUILayout.EndArea();
    ShowBackButton();
}
function ShowBackButton()
{
    if(GUI.Button(Rect(20, Screen.height-50,50,20), "Resume"))
    {
        UnPause();
    }
}

function IsBeginning()
{
    return Time.time < startTime;
}

I think it's just a case of a new set of eyes. But by my logic this should work.

sentences: Do any 3d engines natively import Google Sketchup models Google Sketchup is about the only 3d cad program I can use, because I suck.  Do any 3d engines natively import Sketchup models?  Are there any major caveats when doing so?

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

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

sentences:
How can I reward dungeon masters that take risks? I am working on a MORPG project featuring essentially two major roles: adventurers and dungeon masters. My concern is about balancing the two roles.

For those who have heard of it, the principle is inspired from the French comics Dungeon. The business model of a dungeon, as stated in the comics, is the following:
dungeon masters place treasures in heavily guarded dungeons, to lure in adventurers seeking fame and fortune. While some of them succeed, most die in the process, dropping valuable items which joins the pile of treasures of the dungeon, further attracting more adventurers.
Dungeon master make a living by collecting the right amount from these drops to create new rooms, pay mercenaries, fetch new creatures, breed dragons and whatnot.

Adventurers are quite classic: they are combat oriented characters that can attack monsters or fellow players and earn XP, items and money in the process, gradually making them stronger.

Dungeon masters are trade oriented. Their difficulty is balancing budgets: treasures and dragons are expensive. Now, I already expect a sort of equilibrium among dungeon masters because dungeons that are either too hard or too easy are naturally penalized (low attempt rate or low kill rate, respectively). DM vs DM balancing: check.

Since PvP combat is enabled in dungeons, there is also a competition  among adventurers pushing weak players to stick to easy dungeons that offer little reward to more advanced players. Adventurers vs advanturers balancing: check.

However there is one specific imbalance between the two roles that I am trying to solve: adventurers have a bias toward attempting dungeons above their league, because even if they die (dropping some items and respawning outside the dungeon), they will have gained some XP in the process. This is good because it rewards risk-takers. On the other hand, dungeon masters do not have any advantage of this kind: if an adventurer completes the dungeon and escapes with their share of the treasure, nothing is gained. This would be a pity if it lead dungeon master to be too cautious about their defenses, killing the probability of ever completing the dungeon. Adventurer vs DM balancing: problem.

Hence my question: what reward mechanism could I introduce that incitates dungeon masters to maintain a small but non-zero winning probability?

sentences:
Frame graph in Vulkan: from theory to implementation I've watched the excellent talk from Yuriy[1] and read a blog post[2] multiple times already, but I still cannot find the answers to the questions I have.
I really like the idea of defining a graph of "virtual resources", it gives a lot of flexibility, maintanability, and ease of use (think about synchronization) in the long term. First, I thought that the easier way to solve my problem (described below) is to implement this system so that the graph building and the transformation to the actual graphics API wouldn't be done every frame, only when the conditions (eg. graphics settings) change.
However, extending the "only when the conditions change" statement to include game logic-related decisions, we get to a point where the frame graph must be rebuilt almost every frame. This is also what Yuriy suggested in his talk and I agree with it.
The main problem
In Vulkan the whole pipeline (with the corresponding render pass) must be pre-built. So the rebuilding of the whole graph every frame can be a bottleneck as I can imagine. The pipeline cache could speed up things (in theory) but avoiding sudden frame-rate drops is top priority. However, if a pipeline (especially the shaders) have not yet been built, it could cause a hitch up. And pre-warming the cache(s) with every possible permutations defeat the purpose of the whole system.
The question
So I'm wondering if there is a way to keep the best from both worlds, rebuilding the whole graph every frame while avoiding sudden frame drops from pipeline creation.
If there is no such solution, what would be the closest thing to this kind of dynamic whole frame predefinition? Should I fall back to the rarely rebuild graph, and use another method to skip (sub)passes?
References
[1] FrameGraph: Extensible Rendering Architecture in Frostbite (GDC Vault)
[2] Render graphs and Vulkan — a deep dive (link)

sentences:
What's the recommended way of doing a HUD for an android game? Basically the question is in the title.

I'm creating a RTS game and I will need buttons like attack move / attack ground, etc. I am not using any engine.

When people do games in OpenGL for android (my case), do they ever use android components to control the game or do they create their components in the game? What are the general recommended approach, if there's any?
How about more complex components like scrolling lists of items , etc?
I would also appreciate you to pair your answer with a brief comment about how was your experience using the approach(es) you describe.

Thanks :)

sentences: How do I prototype an online game? I would like to know if you guys know of any libraries, engines, or even simply design patterns that heavily simplify the task of sharing information and sending of messages between networked programs, so one can focus on tweaking gameplay instead of rewriting networking code, while prototyping networked games. Since this is meant for prototypes, ease of use and flexibility is much more important than speed and security.

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:
Help in understanding atmospheric scattering shading I have a made a planet and wanted to make an atmosphere around it. So I was referring to this site:
Click to visit site
I don't understand this:

As with the lookup table proposed in Nishita et al. 1993, we can get the optical depth for the ray to the sun from any sample point in the atmosphere. All we need is the height of the sample point (x) and the angle from vertical to the sun (y), and we look up (x, y) in the table. This eliminates the need to calculate one of the out-scattering integrals. In addition, the optical depth for the ray to the camera can be figured out in the same way, right? Well, almost. It works the same way when the camera is in space, but not when the camera is in the atmosphere. That's because the sample rays used in the lookup table go from some point at height x all the way to the top of the atmosphere. They don't stop at some point in the middle of the atmosphere, as they would need to when the camera is inside the atmosphere.
Fortunately, the solution to this is very simple. First we do a lookup from sample point P to the camera to get the optical depth of the ray passing through the camera to the top of the atmosphere. Then we do a second lookup for the same ray, but starting at the camera instead of starting at P. This will give us the optical depth for the part of the ray that we don't want, and we can subtract it from the result of the first lookup. Examine the rays starting from the ground vertex (B 1) in Figure 16-3 for a graphical representation of this.

First Question - isn't optical depth dependent on how you see that is, on the viewing angle? If yes, the table just gives me the optical depth of the rays going from land to the top of the atmosphere in a straight line. How to find the optical depth in the case where the ray pierces the atmosphere and goes through it to the camera?
Second Question - What is the vertical angle it is talking about...like, is it the same as the angle with the z-axis as we use in polar coordinates? (I am having a very hard time understanding this angle)
Third Question - The article talks about scattering of the rays going to the sun..shouldn't it be the other way around? like coming from the sun to a point?
Any explanation on the article or on my questions will help a lot.
Thanks in advance!

sentences:
Lag compensation of projectile shooting game I'm thinking about an algorithm for firing projectiles with lag compensation. Now I did find only one descent solution:

Player hits fire button.
Client sends input "fire".
Client waits for server response.
Server generates bullet then sends response to client.
Client recieves response and finally fires projectile.

Is this solution only "trueway"? I find it the only one that can be fair to all of the clients. Valve in this case, doesn't compensate lag from rocket shots. I am feeling that I will not compensate it, too. I think that with today's bandwidth I can close my eyes on this problem, because I don't see any solutions with fair logic. What do you think?

sentences:
Libgdx - GLSL shader which uses mod doesn't seem to work properly on android Through trial and error I've managed to come up with a scanline-ish shader I'm satisfied with. On my desktop testbed it looks like this:

Basically, every 2nd(vertical) pixel is darkened.

However, when I add the same shader to my android sprite batch the darkened lines no longer show up. I've assumed it's due to use of mod and float comparison since GLES is lower precision than desktop GL and it probably never evaluates yPos == 0.5 to true. So to combat that I've created an EPSILON value to give a bit of leeway for float comparison but that didn't help either. However I'm certain that I've set up the shader program correctly since simple color manipulation shaders seem to work properly, only when mod gotten introduced into the mix things turned sour.

Here's the shader code:

scanline.vert

attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;

uniform mat4 u_projTrans;

varying vec4 vColor;
varying vec2 vTexCoord;

void main() {
    vColor = a_color;
    vTexCoord = a_texCoord0;
    gl_Position = u_projTrans * a_position;
}

scanline.frag

#ifdef GL_ES
    precision mediump float;
#endif

varying vec4 vColor;
varying vec2 vTexCoord;

uniform sampler2D u_texture;
uniform mat4 u_projTrans;

const float SCANLINE_INTENSITY = 0.7; // lower is stronger, probably should call this softness
const float SCANLINE_DENSITY = 2.0; // every 2nd pixel

const float EPSILON = 0.01;

void main() {

    vec4 texColor = texture2D(u_texture, vTexCoord);

    float yPos = mod(gl_FragCoord.y, SCANLINE_DENSITY);

    vec4 retColor = vColor;

    //if(yPos == 0.5) {
    if(abs(yPos - 0.5) < EPSILON) {
        retColor *= vec4(vec3(SCANLINE_INTENSITY), vColor.a);
    }

    gl_FragColor = texColor * retColor;
}

What am I doing wrong?

sentences: Client side predicition tick implementation I've been reading about client side prediction and one question I have is what's the best way to implement the server tick. I thought about using the server frame count from the game engine I'm using as an authorative tick, is this advisable due to the changes with delta time or should I just use a simple timer on the server?

sentences:
SDL Surface clipping mask I am creating a GUI for my game, so I use some buttons like
. So you can see it is only text surrounded by a rectangle. But I currently use a huge png image with all the buttons I need arranged as I want it, it is really inefficient, so how can I  upload a single smaller image of the rectangle, a sample of the gradient I want and use SDL_tff to create a surface. Say: I copy the rectangle and the text in an SDL_Surface, it should have two colors (black and white), now make white pixel transparent and black pixels to be replaced with the gradient to create the buttons and place them using SDL_Rects.

sentences:
Let a time counter working when an app is closed? Can we let a time counter working even if an app is closed? I would like to add a timer so that we have to wait XX seconds/minutes before a building is created in a game.

I don't want to use an internet connection, and if the user closes the app and just changes the time on his mobile, I cannot compare the 2 time values - before and after.

Would you know how to do this?

Thanks

sentences:
How to have real time (blood) traces? https://www.youtube.com/watch?v=Tzf3zjPJYw4

In this game, Ink, color blobs fall then they create pretty color spots.

The color traces are unlike any other game.

For an example, in Super Meat Boy https://www.youtube.com/watch?v=snaionoxjos

The red traces of SM Boy was more of sprites aligned across the surfaces of the object.

The trace in game Ink is different from those traditional traces of other games because...

They stack infinitely.
Come in many different shapes.

The approaches I can think of are...

Prepare many different shapes sprites, then put then where traces should be.
Assign each block with their own texture, then draw the traces on that texture.

The issues I see however are...

First solution will lead to having many-MANY-MANY sprites being generated to look as if the traces are being drawn upon the object.
Heavy calls between GPU and CPU. Keep drawing traces while uploading drawn new texture onto the GPU to be rendered. Significantly slowing down the game.

I don't have a good computer. My computer cannot handle either approach 1 or 2. But it can the run the game Ink.

So I am assuming Ink must use some sort of clever approach to handle this crucial visual aspect of the game. But I am out of ideas.

sentences:
Array but with a name for every element (value) Say I have 10 different types of grenades, I would like to create one variable, to allow me to set the number of grenades given from the inspector, I could create an array with 10 integers and set the number of grenades there, however it would be much easier for me if every element of the array (10 in total) had a name next to its value in the inspector so I could clearly see which grenade type am I assigning the value.

Is there any variable type or something that would allow me to do this? If so what is it? And how can I create what I want?

Thanks in advance!

If more information/ better explanation of some aspect is needed ask.

sentences:
Why is my collision resolution failing on the corners? I'm tearing my hair out trying to work out how to handle my collision resolution at the corners of the rectangles that I'm colliding with.

The code that I'm working with is:

class Player(object):
    def move(self):
        # Calculate velocity based on gravity, etc
        # ...

        # Check collisions
        for obj in self.controller.collidable():
            sides = self.get_intersect(obj)

            if sides & TOP:
                self.mover.vy = 0
                self.mover.y = obj.coord.y + obj.size.y
            elif sides & BOTTOM:
                self.mover.vy = 0
                self.mover.y = obj.coord.y - self.size.y
            elif sides & LEFT:
                self.mover.vx = 0
                self.mover.x = obj.coord.x - self.size.x
            elif sides & RIGHT:
                self.mover.vx = 0
                self.mover.x = obj.coord.x + obj.size.x

        self.coord.x = self.mover.x
        self.coord.y = self.mover.y
        self.velocity.x = self.mover.vx
        self.velocity.y = self.mover.vy

    def is_intersecting(self, other):
        return (
            (
                self.coord.x + self.size.x > other.coord.x
                and
                self.coord.x < other.coord.x + other.size.x
            )
            and
            (
                self.coord.y + self.size.y > other.coord.y
                and
                self.coord.y < other.coord.y + other.size.y
            )
        )

    def get_intersect(self, other):
        if not self.is_intersecting(other):
            return 0

        pos = 0

        # Are we overlapping the bottom edge?
        if self.coord.y < other.coord.y < (self.coord.y + self.size.y) > other.coord.y:
            pos |= BOTTOM
        # Are we overlapping the top edge?
        if self.coord.y < (other.coord.y + other.size.y) < (self.coord.y + self.size.y):
            pos |= TOP

        # Are we overlapping the left edge?
        if self.coord.x < other.coord.x < (self.coord.x + self.size.x):
            pos |= LEFT
        # Are we overlapping the right edge?
        if self.coord.x < (other.coord.x + other.size.x) < (self.coord.x + self.size.x):
            pos |= RIGHT

        if pos == 0:
            pos = INSIDE

        return pos

The problem I'm experiencing is during vertical movement. If you push into a wall and jump, as you reach the top corner, it will push you vertically. This is due to the sides & TOP being the first check. Moving the horizontal checks first fixes this when jumping up, but then falling onto a corner moves the player horizontally.

I've tried doing checking based on what the horizontal/vertical velocities are, but this falls apart, since the vertical velocity is always non-zero due to gravity (and is corrected by this check if standing on a platform). Any other answers I've found fail to take this into account.

sentences:
OpenGL never reverts to default FrameBuffer So I'm trying to change the texture using FBOs, When I run it, The whole game gets drawn in the new FBO that I created then deleted, Here's the function
public void ChangeTextureBuffer(int width, int height, ByteBuffer newBuffer) {
    int frameID = glGenFramebuffers();
    glBindFramebuffer(GL_FRAMEBUFFER_BINDING, frameID);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ID, 0);
    glViewport(0, 0, width, height);

    Texture texture = new Texture(width, height, newBuffer);
    glBindTexture(GL_TEXTURE_2D, texture.ID);
    glBegin(GL_QUADS);
    glTexCoord2f(0, 0);
    glVertex2f(-1, -1);

    glTexCoord2f(1, 0);
    glVertex2f(1, -1);

    glTexCoord2f(1, 1);
    glVertex2f(1, 1);

    glTexCoord2f(0, 1);
    glVertex2f(-1, 1);
    glEnd();

    texture.Delete();
    glDeleteFramebuffers(frameID);

    glBindTexture(GL_TEXTURE_2D, 0);
    glBindFramebuffer(GL_FRAMEBUFFER_BINDING, 0);
}

And here's what I'm getting

It's getting drawn where I want it to be with the size that I want, I just don't want everything to be drawn there.
Also when I delete a texture or framebuffer, OpenGL isn't reusing the id, I don't know if that's a feature or a bug.
EDIT: Here's how its supposed to look, Everything getting drawn in its place, I just want to change the text on the bottom left side to show the FPS

sentences:
The rule to scale pixel art non multiple of integer ratios I have pixel art, I want to draw. When player jumping I want to animate the art to squash stretch to have a feeling. But when I scale the art it get's distorted, as demonstrated in the image.

In one video I heard a rule to always scale to multiples of 100% ratio. So 150% is not allowed otherwise pixels collapse into each other. I haven't experienced that in this image but is it ok to scale arbitrarily in pixel art?
I see they scale the sprite arbitrarily in Celeste Game Player source. But It feels wrong to me.

sentences:
How do I make a Java gave without a JFrame? I am working on an arcade-like game, and so far, I have been using JFrame. All the action occurs in the JFrame basically.

However, I've noticed that a lot of games that you install on a computer don't have a frame. When you play them on Windows, the game covers the entire screen (the start bar disappears and you can't access any other application on your computer).

I'd like to do that for my game. Is it possible to do so with Java? If so, how would I do this?

sentences: Game loop with multithreading I have learned how to create and manage threads in C++. Now I'm trying to create game loop based on multithreading but I can't imagine how should I split whole game to tasks. I mean, should rendering be separated from updating physics?

sentences: Approximating strength and hardness of alloys I do not have any formal education in metallurgy, but I am trying to make a game mechanic based on it. I need to be able to alloy together different metals and alloyable materials such as carbon in different percentages, and get an approximation of the strength and hardness of the resulting alloy. If anyone has any ideas how what I would need to do to calculate such a thing I would be very appreciative, thanks!

sentences:
Associating materials and primitive I'm trying to find a way of setting any kind of material class on any kind of primitive class (all the material classes have a base material class, same goes for the primitive classes).

What I mean by that, is, I'm looking for a way to do something like this:

Cube a = Cube( ColorMaterial( COLOR_RED ) );
Cube b = Cube( TexturedMaterial( ambienTex, diffuseTex, specularTex ) );

Ok, so that looks pretty easy, but I've got a few problems.
First of all, inside my Cube class I've got a function in which I build the cube's geometry, as such:

VertexPositionColor vertices[36] =  { VertexPositionColor( pos, color ), ... }

Because of this, I can't just pass any type of material to my primitive class, because that would mean that the function that builds the geometry would need to be able to change the type of vertex it uses.
I can't use templates either, because, even though it would solve the type issue, different vertex types are not constructed the same way.

So, is there any way of associating a material to a primitive?

sentences:
Making an interactive 2D map So recently I have been working on a Legend of Zelda: A Link to the Past clone, and I am wondering how I could handle certain map interactions (like cutting grass, lifting rocks, etc).

The way I am currently doing the tilemap is with 2 PNGs. The first is the "tilemap" where each pixel represents a 16x16 tile and the (red, green) values are the (x, y) coords for the tile in the second PNG (the "tileset"). I am then using the blue channel to store collision data.

Each tile is split into 4 8x8 tiles and represented by a 2 bit value (0 = empty, 1 = Jumpdown point, 2 = unused right now, 3 = blocking). 4 of these 2 bit values make up the full blue channel (1 byte). So collisions work great, and I am moving on to putting interactive units on the level; but I am not sure what a good way is to do it.

I have experimented with spawning an entity for each grass and rock, but there are just WAY to many; FPS just dies even if I confine it to the current "zone" the user is in (for those who remember LTTP it had zones you moved between). It does make a difference that this is a browser-based JavaScript game.

tl;dr: What is a good way to have an interactive map without using full blown entities for each interactive item?

sentences:
Error in unity : The type or namespace name RigidBody could not be found i m new to unity and got stuck in a problem , i have searched unity forum but could not get an answer to solve my problem.
getting this error.

The type or namespace name RigidBody could not be found. Are you missing a using directive or an assembly reference?

using UnityEngine;
using System.Collections;
public class playercomponent : MonoBehaviour {

public RigidBody rb;

void start()
{
    this.rb =  GetComponent<Rigidbody>();
}
void FixedUpdate()
{

    float moveHorizontal = Input.GetAxis("Horizontal");
    Float moveVertical = Input.GetAxis("Vertical");
    Vector3 movement = new Vector3 (moveHorizontal,0.0f,moveVertical);

    rb.AddForce(movement);

}

}

sentences:
2D Infinite Runner: how to manage the generation of dynamic terrain? I'm creating a infinite runner game with Unity3d, i've been using math to generate the terrain by calculating the size/pos of the terrain and place the new one next to it, and it's working correctly, but i think it's a overkill, so the question is, Is there a better way(performance) to generate terrain/floor in 2d scrolling infinite runners?

I also tried this method which consist of using empty gameobject, and when you hit them it create the terrain it was okay, but then problem started when i started using different terrain generation

sentences:
Unable to convert classes into dex format It's my first day using Unity, so be gentle :)

I've spent a good number of hours trying to find the solution to this problem that I'm having when trying to Build & Run my GearVR application in Unity.

I'm aware people have had similar issues, but most of the solutions seemed to boil down to duplicate .jar files in the project's assets folder -- something that I don't have after checking numerous times to make sure I'm not going insane.

So after getting the error message: "Unable to convert classes into dex format", I then get the following error output:

CommandInvokationFailure: Unable to convert classes into dex format.
C:\Program Files\Java\jdk1.8.0_60\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/MichaelAC/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/facebook/androidcompat/AndroidCompat;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/oculus/aidl/RemoteConstants;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/oculus/aidl/RemoteConstants$EntitlementResult;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/oculus/aidl/OVRServiceInterface;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/oculus/aidl/OVRServiceInterface$Stub;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/oculus/aidl/OVRServiceInterface$Stub$Proxy;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/facebook/sign/lib/FBSignVerify;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/facebook/sign/lib/FBSignSigner;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/oculus/appmanager/vrsign/VRSignVerifier;

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:608)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at SDKMain.main(SDKMain.java:129)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:600)
... 9 more

Now, the only two jar files I have (that were included in the UnityIntegration package are vrlib & vrplatlib. As far as I can see, it seems to be vrplatlib that is causing the problem.

If I remove these two jar files (or even just vrplatlib) from the assets folder in my project, I get "Failed to build the APK. See console for more details" with even more error output.

Thanks for any & all help.

sentences:
changescene after timeline Is there a way to change the scene after playing a timeline with the new timeline system?

I have 3 scenes in my project. The first scene is where a player interacts with an object to trigger a change to the second scene. The second scene then plays my timeline. When the timeline finished playing I want to change to the 3rd scene.

How can I trigger the scene change at the end of that timeline?

sentences:
Simple Line Formation I'm working on the first formation for my game's troops. These should simply stand on land, facing the same direction.

To achieve this, I tried to create offsets towards a pivot-unit, that is approximately the unit in the center of the formation.
The units are (temporary) elements of a squad list withing the Squad class.
I divide the List by 2 and get the closest integer, that should be the pivot point of the formation. Now I generate offsets for all units on the left side (Unit 1 to pivot-1) and right (pivot+1 to last unit) based on the distance/gaps.

This is the code for the line formation. Sadly, the units are only forming a very stange line with no visually detectable system:

int count = (int)(squadMembers.Count / 2);
pivot = squadMembers[count];
center = pivot.transform.position;
switch (type) {
    case FormationType.Line:
        int space = 5;
        for (int i = 0; i < squadMembers.Count; i++) {
            Unit tmp = squadMembers[i];
            int dist = 0;
            if (i > count) {
                dist = (count + 1) * space;
                center.x -= dist;
            }
            if (i < count) {
                dist = (count - 1) * space;
                center.x += dist;
            }
            tmp.StartMove(center);
        }
        break;
}

It also appears that this only works along the x axis, any idea how i can realize this with the walking/facing direction ov the pivot?

Is there any (obvious) error? How can I improve this script?

PS: Any idea, how I can transform this into a double line (2 Lines behind with half spacing)

sentences:
In lockstep networking game, how to handle sudden lags and disconnection? I am trying to implement a game similar to "Street Fighter" by using lockstep networking model so that two players can play remotely via Internet.

I have read a lot of articles about lockstep networking method and I can basically implement the turn/frame handling for each step.

My understanding is that if it's now turn 101 and if player A has not received turn 101 action (packet) from player B, player A has to wait.

When this situation happens, player B has to wait too because player A will not send out further actions to player B because he is waiting.

Should the game do anything for this situation? For example, I saw games like Starcraft, sometimes there is a dialog showing up to wait for other players and if the count down goes to 0, players can disconnect this hanging player.

In order to do so, I don't understand how to decide who is lagging and what the proper handling is. Both player A or player B would think the other party is lagging because he does not receive the packet for his current turn. What am I going to show to the user? And if the lagging continues, how to end the game earlier by giving a correct game result (the player who lags should be given a loss and the other player should be given a win)? Just similar to the countdown dialog in Starcraft.

And on the other hand, what if the situation is not lagging but is a disconnection from player B?

sentences:
Why is the image appearing smaller, in the scene? I have a fresh Unity project, with just one 480x800 pixel image. It's platform is set to Android, and the aspect ratio in the game view is WVGA Portrait (480x800). However, the image doesn't occupy the whole screen.

The camera is orthographic, with a size of 5. My intention is to test different resolutions on the same device, and maybe test on other devices.

Why is the image appearing smaller, in the scene?

The project is set to 2D. I added the image firstly by pasting it directly to my Sprites folder using the Windows explorer, then by clicking Assets->Import New Asset, and got the same result. My only GameObject on scene is the one holding the image, this will be used as one of my game backgrounds.

Here are the texture import settings and the inspector for the GameObject:

I haven't tested anything regarding the UI on Unity yet, so no Canvas. My experience with the engine is two weeks.

sentences:
Physics for space game I am making a space game where you fly a ship.

I am trying to work out the physics for such a game and so far came up with:

var thrust; //between 1 & 100 how much the engines are pushing
var mass; // the mass of the spaceship
var speed; //the speed at which the spaceship is moving

Now big ships will have more mass to therefore take longer to speed up and longer to slow down once the thrust is off. Big ships will be slow because of the mass.

Small ships will speed up faster and slow down faster but also go faster.

How will I implement this into a game? I can do the keyevents, if up is pressed for 5 frames for example will I make the thrust raise to by 10 each frame(example) and then increase the speed of the ship based on some formula of the mass & thrust?

This is the game: Only UI and menus made but wan to get an idea of my physics before I implement the movement
http://www.taffatech.com/DarkOrbit.html

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: Visual script editing software tool for creating game behavior logic Is there a visual script editing software tool in any game engine similar to Visual3d for  creating game behavior logic by non-programmers like designers?

sentences:
MMORPG Server [Visible service] Is there an algorithm for collecting the list of [to_spawn][to_despawn][to_send_movement] players from world on player movement from point A to B.

I have list of player in world.
I have function that collects the visible players for a given point.
Each player has a list of visible players.

How can I do this fast & efficient?

void p_spawn::filter(player_list &p_l)
{
    player_list to_depsawn;
    player_list to_spawn;
    std::shared_ptr<Node> temp = std::atomic_load(&head);
    if (p_l.size() > 0)
    {
        while (1)
        {
            if (!temp) break;

            bool in = false;
            for (size_t i = 0; i < p_l.size(); i++)
            {
                if (p_l[i]->eid == temp->p->eid)
                {
                    in = true; break;
                }
            }

            if (!in)
            {
                to_depsawn.push_back(temp->p);

                temp->p->spawn.add_erase(parent, false);
                add_erase(temp->p, false);

            }
            temp = temp->next;
        }

        for (size_t i = 0; i < p_l.size(); i++)
        {
            if (!inside(p_l[i]->eid))
            {
                add_erase(p_l[i]);
                p_l[i]->spawn.add_erase(parent);

                to_spawn.push_back(p_l[i]);
            }
        }
    }
    else
    {
        while (1)
        {
            if (!head) break;

            head->p->spawn.add_erase(parent, false);
            to_depsawn.push_back(head->p);
            head = head->next;
        }
    }

}

sentences:
JWJGL Multi-threading to separate update and render Introduction:

I am currently designing a game in Java using the LWJGL 3.0, with Gradle. I have quite an advanced knowledge on multi-threading, and I am aware how GLFW does/doesn't implement multi-threading from this guide. Currently, I have one class Updater with a loop for updating, and another class Renderer for rendering, each extending Runnable with their own loops and time calculations. Below is a diagram showing the structure of the classes and update and render methods. I have also set up a lock system, using the Java Lock class (again below).

My Problem:

Despite setting each thread as the current context before each loop executes its window call, and setting the current context to null at the end, I still get the error Exception in thread "RENDERER" java.lang.IllegalStateException: GLFW error [0x10008]: WGL: Failed to make context current: The requested resource is in use. Any idea as to why? Been at this for a few hours now.

Loop class:

private void threadLoop() {
    try {
        lock.lock();
        locked = true;
        loop();
        TPS++;
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        lock.unlock();
        locked = false;
    }
}

@Override
public void run() {
    init();
    long lastTime = System.nanoTime();
    double ns = SECOND / (MAX_TPS/2);
    double delta = 0;
    long timer = System.currentTimeMillis();
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while(delta >= 1) {
            threadLoop();
            TPS++;
            delta--;
        }
        if(System.currentTimeMillis() - timer > 1000) {
            finalTPS = TPS;
            timer += 1000;
            TPS = 0;
        }
    }
    stop();
}

Thread Manager:

public void update() {
    if (window == null) return;
    window.setThread();
    window.update();
    window.nullThread();
}

public void render() {
    if (window == null) return;
    window.setThread();
    window.render();
    window.nullThread();
}

Renderer:

@Override
protected void loop() {
    if (state != null) state.render();
    threadManager.intermediateCode();
    threadManager.render();
}

Updater:

@Override
protected void loop() {
    if (state != null) state.update();
    threadManager.intermediateCode();
    threadManager.update();
}

Window:

public void setThread() {
    glfwMakeContextCurrent(getID());
}

public void nullThread() {
    glfwMakeContextCurrent(NULL);
}

public void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glClearColor(0.0f, 0.3f, 0.8f, 0.0f);
    glfwSwapBuffers(ID);
    System.out.println("Rendered window");
}

public void update() {
    glfwPollEvents();
    System.out.println("Updated window");
}

sentences: Godot: Possible to create a 2D tilemap and set it as a texture for a 3D surface? If I created tilemap of some sort of pattern or image and wanted to set it as the texture of a 3d surface or 3d model, how would I do it?

sentences:
Extend distance for rendering grass and tree objects on terrain I am trying to make an adventure game with a big landscape (made the terrain with terrain tools) with 3D models of grass (that I placed using terrain tools) but it only shows the grass/trees that are within a small area. Here is a pic of what I am talking about:

I would not want to totally remove this because otherwise the framerate will go too low. I just want to make the circle bigger.
thanks (:

sentences:
Stencil IncrSat and DecrSat explanation Can someone please explain me what is the purpose of IncrSat and DecrSat?

Currently I know that they increment/decrement the current value in the buffer and they make sure the value is between 0 and 255, but I want to know how can I use them.

Could you please give a simple example and explain how IncrSat or DecrSat can help?

sentences:
C++ OpenGL wireframe cube rendering blank I'm just trying to draw a bunch of lines that make up a "cube". I can't for the life of me figure out why this is producing a black screen. The debugger does not break at any point.

I'm sure it's a problem with my pointers, as I'm only decent at them in regular c++ and in OpenGL it gets even worse.

const char* vertexSource =
    "#version 150\n"
    "in vec3 position;"
    "void main() {"
    "   gl_Position = vec4(position, 1.0);"
    "}";

const char* fragmentSource =
    "#version 150\n"
    "out vec4 outColor;"
    "void main() {"
    "   outColor = vec4(1.0, 1.0, 1.0, 1.0);"
    "}";

int main() {

    initializeGLFW();

    // Initialize GLEW
    glewExperimental = GL_TRUE;
    glewInit();

    // Create Vertex Array Object
    GLuint vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    // Create a Vertex Buffer Object and copy the vertex data to it
    GLuint vbo;
    glGenBuffers( 1, &vbo );

    float vertices[] = {
         1.0f,  1.0f,  1.0f, // Vertex 0 (X, Y, Z)
        -1.0f,  1.0f,  1.0f, // Vertex 1 (X, Y, Z)
        -1.0f, -1.0f,  1.0f, // Vertex 2 (X, Y, Z)
         1.0f, -1.0f,  1.0f, // Vertex 3 (X, Y, Z)
         1.0f,  1.0f, -1.0f, // Vertex 4 (X, Y, Z)
        -1.0f,  1.0f, -1.0f, // Vertex 5 (X, Y, Z)
        -1.0f, -1.0f, -1.0f, // Vertex 6 (X, Y, Z)
         1.0f, -1.0f, -1.0f  // Vertex 7 (X, Y, Z)
    };

    GLuint indices[] = {
        0, 1,
        1, 2,
        2, 3,
        3, 0,
        4, 5,
        5, 6,
        6, 7,
        7, 4,
        0, 4,
        1, 5,
        2, 6,
        3, 7
    };

    glBindBuffer( GL_ARRAY_BUFFER, vbo );
    glBufferData( GL_ARRAY_BUFFER, sizeof( vertices ), vertices, GL_STATIC_DRAW );
    //glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vbo);
    //glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof( indices ), indices, GL_STATIC_DRAW );

    // Create and compile the vertex shader
    GLuint vertexShader = glCreateShader( GL_VERTEX_SHADER );
    glShaderSource( vertexShader, 1, &vertexSource, NULL );
    glCompileShader( vertexShader );

    // Create and compile the fragment shader
    GLuint fragmentShader = glCreateShader( GL_FRAGMENT_SHADER );
    glShaderSource( fragmentShader, 1, &fragmentSource, NULL );
    glCompileShader( fragmentShader );

    // Link the vertex and fragment shader into a shader program
    GLuint shaderProgram = glCreateProgram();
    glAttachShader( shaderProgram, vertexShader );
    glAttachShader( shaderProgram, fragmentShader );
    glBindFragDataLocation( shaderProgram, 0, "outColor" );
    glLinkProgram (shaderProgram);
    glUseProgram( shaderProgram);

    // Specify the layout of the vertex data
    GLint posAttrib = glGetAttribLocation( shaderProgram, "position" );
    glEnableVertexAttribArray( posAttrib );
    glVertexAttribPointer( posAttrib, 3, GL_FLOAT, GL_FALSE, 0, 0 );

    // Main loop
    while(glfwGetWindowParam(GLFW_OPENED)) {

        // Clear the screen to black
        glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
        glClear( GL_COLOR_BUFFER_BIT );

        // Draw lines from 2 vertices
        glDrawElements(GL_LINES, sizeof(indices), GL_UNSIGNED_INT, indices );

        // Swap buffers
        glfwSwapBuffers();
    }

    // Clean up
    glDeleteProgram( shaderProgram );
    glDeleteShader( fragmentShader );
    glDeleteShader( vertexShader );

    //glDeleteBuffers( 1, &ebo );
    glDeleteBuffers( 1, &vbo );

    glDeleteVertexArrays( 1, &vao );

    glfwTerminate();
    exit( EXIT_SUCCESS );
}

sentences:
InvalidOperationException when peeking from a stack within custom editor I've got a simple state machine for handling game states which works using GameObjects that I enable/disable in order to switch the states. Since some states can be loaded additively (such as the pause menu), I'm using a stack to manage the currently active ones.

public class GameController : MonoBehavior {

    private readonly Stack<GameObject> _stateStack = new Stack<GameObject>();

    public GameObject ActiveState {
        get { return _stateStack.Peek(); }
    }

    public void SetState(GameObject newState, bool isAdditive = false) {
        if(newState = null || newState == ActiveState)
            return;

        if(!isAdditive) {
            while(_stateStack.Count > 0)
                PopState();
        }

        if(!newState.activeInHierarchy)
            newState.SetActive(true);

        _stateStack.Push(newState);
    }

    public void PopState() {
        var gameState = _statStack.Pop();
        if(gameState != null)
            gameState.SetActive(false);
    }

}

Now I'd like to have a custom editor which allows me to see and set the currently top-most active state.

What I did was this:

[CustomEditor(typeof(GameController))]
public class GameControllerEditor : Editor {

    public override void OnInspectorGUI() {
        DrawDefaultInspector();

        var controller = target as GameController;
        if(controller == null)
            return;

        var newState = EditorGUILayout.ObjectField("ActiveState", controller.ActiveState,
              typeof (GameObject), true) as GameObject;
        if (newState != controller.ActiveState)
            controller.SetState(newState);
    }

}

However, the custom editor is never visible and in the console, I see the following exception:

InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Generic.Stack'1[UnityEngine.GameObject].Peek()

What does this even mean? What state? Is the stack not initialized? How does Unity instantiate MonoBehaviors when applying a custom inspector?

sentences:
Match-3 algorithm to fill empty space left from removing matches I am currently creating a match 3 game.

I am at the point where I have objects dropping down in the column when only one item is removed. So if an item is removed, the above item moves into its old position etc.

The problem I am having now is that when more than one item is removed from a column, the items in that column only drop down to the first item that was removed. Instead of filling in both items that were removed it just drops down to fill in the first one.

So basically, if two(or more) items are removed from a column the second, third, fourth, etc positions are left blank.

The way I am designing my game is I am using units of 1. So each item takes up 1 unit by x and 1 unit by y. This means that I can position the items like in a grid, at 0x1, 0x2, etc.

What kind of algorithm could I use to move multiple items down to fill the empty space?

sentences:
Is single/double frame allocator suitable only for POD datas? Let´s say I have a single frame stack allocator, so I´m using it for allocating memories for my temporary data.

size_t freeTilesSize = 10;
int* freeTiles = _allocator.allocate<int>(freeTilesSize);

The stack doesn´t save any conditional stuff about the memory it creates(it cares only about the size of the chunk so it knows the new header offset). I see this a good for using with POD data structures or classes with default destructor, however, is it usable also for bigger entities with some behavior at the destruction? At this moment, my function rewind only sets the header ptr to the start of the allocated block so it doesn´t call any destructors.

Am i doing something wrong? What was your approach?

sentences:
What is an easy way to work subsurface scattering into a raycaster? I've got some neat effects with path tracing:

I want to add in an ability to do subsurface scattering, but I'm unsure of the general algorithm.  With path tracing, it's:

foreach pixel:
    trace( ray into scene )
        color = 0
        if( ray hits an object )
            if( that object is emissive )
                color += object.emissive_color
            if( that object is translucent )
                color += trace( object.refracted ray into scene )
            if( that object is specular )
                color += trace( object.specularly-reflected ray into scene )
            if( that object is diffuse )
                color += trace( object.random-direction reflection ray into scene )

        return color

That's the rough outline.  Where does subsurface scattering go and how can I integrate it?

sentences:
Correct utilisation of gameloop (Android) When using a gameloop like (much simplified)............

updateLogic();
render();

How does one perform 'single' operations?  I mean, things like triggering sounds (which will only be played once), displaying a 'Get ready' graphic at the start of the game etc...

Currently I'm simply using 'flags' so maybe something like: (Pseudo code)

if(gameNotStarted==true)
display getReady;

This does work, but I end of up with a ton of condition checks in my game Loop.

Being that I can't just stop the game loop (I can't right?) every time I want to perform a single operation, is what I'm doing the correct way or is there something that I'm missing?

Another example might be when a player completes a level.  I want to stay within my class/activity (I.E., the game as a whole is contained within one activity), then I move onto a small 'cut scene' which simply displays 'Well done' and plays a little piece of music, before returning to the next level of the game.

How would one handle that situation, again remembering that I'm not starting a new activity for each level (if I did, I could see that being a nightmare to manage).

sentences:
Get quaternion between two objects on sphere In a planetary gravity environment objects are represented in the following way:

struct object {
    struct quaternion quat; // quaternion to represent the rotation between the object and the center of the planet
    float dist; // distance from the center of the planet
};

Here are the steps at which I position my player:

// start at center of the planet
applyQuaternion(&object.quat);
glTranslatef(0.0f, object.dist, 0.0f);
drawObject(&object);

Step 1, translate to center of planet:

Step 2, apply quaternion:

Step 3, translate outwards by distance value:

I am also able to get the current position of the player or enemy by using this code:

struct matrix initialMatrix, resultantMatrix;
glPushMatrix();
getPositionMatrix(&initialMatrix);
applyQuaternion(&player.quat);
glTranslatef32(0, player.dist, 0);
getPositionMatrix(&resultantMatrix);
playerPosition = matrixTranslationToVector(initialMatrix, resultantMatrix);
glPopMatrix();

Given two objects:

struct object player;
struct object enemy;

How can I get the enemy to face in the direction of the player, whilst always standing upright on the planet, using quaternions?

I want the enemy to go from this:

To this:

His feet always on the planet, and head always away from planet.

I'm able to rotate on the axis which doesn't affect the position (from first enemy diagram to second enemy diagram like so):

// Rotate right
Quaternion_multiply(&player.quat, Quaternion_fromAxisAngle(vect(0.0f, 0.0f, 1.0f), degreesToAngle(2)));

// Rotate left
Quaternion_multiply(&player.quat, Quaternion_fromAxisAngle(vect(0.0f, 0.0f, 1.0f), degreesToAngle(-2)));

So I'm unsure as to why I'd need a local orientation in addition to the quaternion I already have.

sentences:
Best way to go about collision between rectangle and bool array containing pixel data? Basically, if I have an array along the lines of

    bool[] collision;

Filled with a value for each pixel in the sprite I am checking collision against (pixel 1 = true, pixel 2 = false etc), how do I use it to check collision between the player and the texture?

      protected void GetCollisionData()
    {
    // Declare an array to hold the pixel data
        uint[] pixelLevelData = new uint[textureLevel.Width * textureLevel.Height];
        // Populate the array
        textureLevel.GetData(pixelLevelData, 0, textureLevel.Width * textureLevel.Height);

        for (int x = 0; x < textureLevel.Width; x++)
        {
            for (int y = 0; y < textureLevel.Height; y++)
            {
                 if (x < textureLevel.Width && x > 0 && y > 0 && y < textureLevel.Height)
                {
                    //If it's black, make a note that collision will happen
                    if (pixelLevelData[(x + y * textureLevel.Width)] == 4278190080)
                    {
                        collision[x + y * textureLevel.Width] = true;
                        debug = 9;
                    }
                    //else it's either something black already covers or transparent; no collision necessary
                    else
                        collision[x + y * textureLevel.Width] = false;
                }
            }
        }
    }

This is the relevant part that covers how I got my array of bools. How to I check collision between the set of bools and a normal rectangle?

sentences:
When should I use skill trees versus skill lists in an RPG? What are the pros and cons of skill trees versus flat skill lists in role playing games? In what situations is one more appropriate than the other?

Here is an example of a skill list, taken from Elder Scrolls IV: Oblivion:

Here is an example of a skill tree, taken from Diablo II:

Some additional questions:

Are skill trees inherently more complex than skill lists?
Do skill lists tend to broadly cover a character's abilities, while skill trees focus on specific spells or aspects of a character?
The Elder Scrolls: Morrowind uses skill lists and has a skill called Athletics that was removed in Skyrim. Do skill lists' loose coupling of skills make it easier to create useless or irrelevant skills?

sentences:
Lists of concrete types show up in inspector, but not lists of interfaces In one of my custom C# classes in Unity, I need to expose a List of objects in the inspector, and they need to conform to a specific interface.

Below are two lines from my class definition. Card is a concrete type in my game, and CellObserver is an interface. Multiple classes may implement this interface, so I'd like to define it this way if possible.

public List<Card> currentCards;
public List<CellObserver> observers;

The list of Card objects shows up in the inspector just fine, but lists based on CellObserver don't. It's not unique to this interface either - I also have one on another class that behaves the same way.

The code builds just fine, and as far as I can tell, this is valid in C#. Is there something else I need to do in Unity to implement this list? Or is this simply not an option in Unity?

sentences: Unity. Draw mesh without a mesh class Is there a way to draw an array of vertices/traingles directly from code, above 65k verts? I looked at Graphics class but it can only render a Mesh object.

sentences:
I have my mouse coords converted to world coords. Now how do I detect objects with it? (C++, OpenGL, FreeGlut) I found a way to convert my mouse coordinates to world coordinates that I can easily understand but now I need to know how to use it to check if the mouse is currently over any of my rendered objects.

Here is my mouse click code that converts the mouse coordinates to screen coordinates when the left mouse button is clicked.

code:

void mouseClick( int button, int state, int x, int y ){

//if any mouse button was pressed
if (button == GLUT_LEFT && state == GLUT_DOWN) {

GLint viewport[4]; //hold the viewport info
    GLdouble modelview[16]; //hold the modelview info
    GLdouble projection[16]; //hold the projection matrix info
    GLfloat winX, winY, winZ; //hold screen x,y,z coordinates
    GLdouble worldX, worldY, worldZ; //hold world x,y,z coordinates

    glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); //get the modelview info
    glGetDoublev( GL_PROJECTION_MATRIX, projection ); //get the projection matrix info
    glGetIntegerv( GL_VIEWPORT, viewport ); //get the viewport info

winX = (float)x;
winY = (float)viewport[3] - (float)y;

//get the world coordinates from the screen coordinates
    gluUnProject( winX, winY, 0.0, modelview, projection, viewport, &worldX, &worldY, &worldZ);
    gluUnProject( winX, winY, 1.0, modelview, projection, viewport, &worldX, &worldY, &worldZ);

}
}

I've tested it to make sure that the coordinates are converting successfully, and it works fine!!!

As for the near and far planes I did double check that their coordinates are the same as defined in my glorthro.

sentences:
Perform intersection (horizontal and vertical) checking in raycasting I want to check the horizontal and vertical intersections on my raycasting view, and I can't exactly understand what is ALPHA using this drawing

source : https://www.permadi.com/tutorial/raycast/rayc7.html

I wrote something that makes the walls straights and with less stairs on top and bottom, but i have some columns which go out of the view row, i can't figure out where i failed my operations (rounds)

this is the code of the vertical and the horizontal intersections :

static inline void      inter_hor(t_wolf3d *w, int i, double angle){
t_vec2f a; // first intersection point
t_vec2f o; // offset
double  tangent;

tangent = ttan(angle) + 0.001;
a.y = (angle <= 180) ? floor(w->cam->position.y / 32) *
32 - 1 : ceil(w->cam->position.y / 32) * 32 + 32;
o.y = (angle < 180) ? -32 : 32;
o.x = (angle < 90 || angle > 270) ? 32 / tangent : -32 / tangent;
a.x = (angle != 180.0 && angle < 359.97) ? w->cam->position.x + (w->cam->position.y - a.y) / tangent :
w->cam->position.x + (w->cam->position.y - a.y) / -tangent; //w->mini_h is the w->map->h  * 32 and so on for w->mini_w
a.x = (angle >= 179.97 && angle <= 180) ? w->cam->position.x + (w->cam->position.y - a.y) / -tangent : a.x;
if (ceil(a.x / 32) < 0 || ceil(a.x / 32) >= w->map->w)
    a.x = (ceil(a.x / 32) < 0) ? 0 : w->mini_w - 1;
while (w->map->board[(int)a.y / 32][(int)a.x / 32] == 0)
{
    a.x += ((angle >= 90 && angle < 180) || angle >= 270) ? -o.x : o.x;
    a.y += o.y;
if (ceil(a.x / 32) < 0 || ceil(a.x / 32) >= w->map->w)
    a.x = (ceil(a.x / 32) < 0) ? 0 : w->mini_w - 1;
    if (a.y < 0 || a.y > w->mini_h - 1)
        break;
}
w->cam->interh[i].x = a.x;
w->cam->interh[i].y = a.y;}
static inline void      inter_ver(t_wolf3d *w, int i, double angle){
t_vec2f a; // intersection point
t_vec2f o; // offset
double  tangent;

tangent = ttan(angle) + 0.001;
a.x = (angle >= 90 && angle < 270) ? ceil(w->cam->position.x / 32) *
32 - 1 : floor(w->cam->position.x / 32) * 32 + 32;
o.x = (angle > 90 && angle < 270) ? -32 : 32;
o.y = (angle > 0 &&  angle < 180) ? -32 * tangent : 32 * tangent;
a.y = (angle != 270 && angle != 90) ? w->cam->position.y + (w->cam->position.x - a.x) * tangent :
w->cam->position.y + (w->cam->position.x - a.x) * -tangent;
if (ceil(a.y / 32) < 0 || ceil(a.y / 32) >= w->map->h)
    a.y = (ceil(a.y / 32) < 0) ? 0 : w->mini_h - 1;
while (w->map->board[(int)ceil(a.y / 32)][(int)a.x / 32] == 0)
{
    a.y += ((angle > 90 && angle < 180) || angle > 270) ? -o.y : o.y;
    a.x += o.x;
    if (ceil(a.y / 32) < 0 || ceil(a.y / 32) >=  w->map->h)
        a.y = (ceil(a.y / 32) < 0) ? 0 : w->mini_h - 1;
    if (a.x < 0 || a.x > w->mini_w - 1)
        break;
}
w->cam->interv[i].x = a.x;
w->cam->interv[i].y = a.y;}

I could use the dir.y / dir.x computed before for my tangent, but i didn't cause i had some divisions by zero when my rays was facing at 180, 360, 0 degrees, angles are complexes and i dont understand completely the vectors method to do that way; these are some screeshots :

sentences:
Get NPC to look at player with only head I'm wondering how to get an NPC to look at the player,
I have tried everything.
Find look at rotation changes depending on character rotation.
Here is a fun drawing if letters are too complicated.

sentences:
Calculate 8 different directional input based on arrow keys combinations Considering I have four variables event binded to each arrow key, that can be 0 or 1

My current approach to this issue is simply 8 nested ifs checking each combination or keys

Is there a more math-y clever way to solve this issue?

sentences: Compute Shader vs Pixel Shader I am pretty new to game development and graphic stuff. I find that compute shader is somehow more powerful and flexible than Pixel Shader for almost everything I need so far. But Pixel/Fragment shader should exists for a reason, could anybody let me know when I'd better to use Pixel shader rather than a compute one? Thank you very much.

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:
Pathfollowing with acceleration - centripetal force I'm implementing A* waypoint pathfinding with some twists.
One of the problems I'm encountering is because I do not change velocities of the agents directly but rather I do so through forces.

Which gives me the following problem:
let's suppose the path consists of three nodes,

P0 = the starting position
P1 = node 1
P2 = node 2

When the agent starts moving, it's first target position is P1. The agents moves in that direction because I let a force F act on it's velocity: F=normalized(targetPos-agentPos)*agentAccel*agentMass;

The agent reaches P1.

Now the agent's target position is P2, and upon it will act a force in the direction of (targetPos-agentPos).

However, this is a centripetal force, meaning that the agent will most likely orbit around P2 instead of popping the next node off the path (unless the angle between [P0,P1] and [P1,P2] is small) Stopping the agent at each node is not an option (would look unnatural) What should really happen is the velocity of the agent gradually shifting towards 100% the direction of [targetPos-agentPos], and the velocity should be completely 'shifted' before a certain distance(dX) is laid off, starting from the previous node position

In order to solve this problem, only one parameter is adjustable:

F_dir: the direction of the force acting upon the agent, that's
supposed to lead the agent to the next node.

The values of the following parameters are known:

agentAcceleration (=the magnitude of the force vector)
agentVelocity
agentPosition
node positions
targetPosition (= the next node on the path)

I've been trying some different strategies with trial and error to prevent this, but it seemed rather messy, so my question is, what is a decent approach to this problem?

sentences:
Unity Raycast works only once-Ignores NavMeshAgents I'm new to unity and just trying to build a game.
I've been trying to use Raycast to detect if an enemy is next to the player and I can't seem to get the Physics.Raycast working properly.
Everything works fine in the scene mode and at the beginning of the start mode.But then it stops responding.
I checked threads with similar issues, but it seems I have all those covered(the most common issue is also addressed-the objects I am attempting to detect have rigidbodies and box colliders attached to them)
This is the script I'm working with.
public class hitPlayer : MonoBehaviour
{

    public GameObject player;
    public Transform m_transform;
    Animator playerAnimator;
    int layerMask;
    RaycastHit m_Hit;
    float maxDistance = 5f;

void Start()
{
    layerMask = 1 << 8;
    layerMask = ~layerMask;

    playerAnimator = player.GetComponent<Animator>();
}
public void onTouch()
{

    bool isHit = Physics.Raycast(m_transform.position, -m_transform.right, out m_Hit, maxDistance, layerMask);

    if (isHit)
    {
        playerAnimator.SetTrigger("leftHit");
    }
    else
    {
        playerAnimator.SetTrigger("rightHit");
    }

}
void OnDrawGizmos()
{

    bool isHit = Physics.Raycast(m_transform.position, -m_transform.right, out hit, maxDistance,layerMask);
    Debug.Log(isHit);
    if (isHit)
    {
        Gizmos.color = Color.red;
        Gizmos.DrawRay(m_transform.position, -m_transform.right * hit.distance);
    }
    else
    {
        Gizmos.color = Color.green;
        Gizmos.DrawRay(m_transform.position, -m_transform.right * maxDistance);
    }
}
}

Would highly appreciate your assistance in fixing this issue which is to get the raycast working right throughout the game. Thanks in advance.

sentences:
How can I clear explosions in my function? Hi I have a function to place bombs, and a for loop that places explosions on the tiles where possible.

My problem is that I can't remove the explosions after a while. I've tried everything I can come up with so now I turn here as a last resort.

The function looks like this:

function Bomb(){
var placebomb = false;
    if(placeBomb && player.bombs != 0){
        map[player.Y][player.X].object = 2;
        var bombX = player.X;
        var bombY = player.Y;
        placeBomb = false;
        player.bombs--;
        setTimeout(explode, 3000);
    }
    function explode(){
    var explodeNorth = true;
    var explodeEast = true;
    var explodeSouth = true;
    var explodeWest = true;

    map[bombY][bombX].explosion = 1;
    delete map[bombY][bombX].object;

    for(i=0;i<=player.bombRadius;i++){
        if(explodeNorth && map[bombY-i][bombX]){
            if(!map[bombY-i][bombX].wall){
                if(!map[bombY-i][bombX].object){
                    map[bombY-i][bombX].explosion = 1;
                }
                else
                    var explodeNorth = false;
                    delete map[bombY-i][bombX].object;
                    map[bombY-i][bombX].explosion = 1;
            }
            else
                var explodeNorth = false;
        }

        if(explodeEast && map[bombY][bombX+i]){
            if(!map[bombY][bombX+i].wall){
                if(!map[bombY][bombX+i].object){
                    map[bombY][bombX+i].explosion = 1;
                }
                else
                    var explodeEast = false;
                    delete map[bombY][bombX+i].object;
                    map[bombY][bombX+i].explosion = 1;
            }
            else
                var explodeEast = false;
        }

        if(explodeSouth && map[bombY+i][bombX]){
            if(!map[bombY+i][bombX].wall){
                if(!map[bombY+i][bombX].object){
                    map[bombY+i][bombX].explosion = 1;
                }
                else
                    var explodeSouth = false;
                    delete map[bombY+i][bombX].object;
                    map[bombY+i][bombX].explosion = 1;
            }
            else
                var explodeSouth = false;
        }

        if(explodeWest && map[bombY][bombX-i]){
            if(!map[bombY][bombX-i].wall){
                if(!map[bombY][bombX-i].object){
                    map[bombY][bombX-i].explosion = 1;
                }
                else
                    var explodeWest = false;
                    delete map[bombY][bombX-i].object;
                    map[bombY][bombX-i].explosion = 1;

            }
            else
                var explodeWest = false;
        }

    }
    player.bombs++;
    }
}

If anyone can think of a good way to remove the explosion after a delay please help.

sentences:
Finding the right directory structure for version control Recently I've started thinking about how to layout the directory structure for my game engine. And well, I kinda hit a little snag.

There's going to be 2 people working on this project. Me and one of my friends. The problem is how do I do the layout of the directories so that it works nicely with version control (I'm using Plastic SCM. It has really nice features).

I'm thinking of dividing it up into 3 separate things:

A source code respository for storing all the C++ code
An exported assets repo where my friend can store all his exported data. (Exported as in final version that can be used by the engine).
And a raw assets directory where all my friends raw assets go into. These include stuff like psd files and mb files for easier backup and versioning.

What do you think of this structure? Any comments are welcome. I'm really down in the dirt with this one.

sentences:
Project organization for a multiplayer client-server game I'm programming a game 100% in Java but I'm having some issues concerning the final games architecture.

I plan on having two separate projects: one that will hold the client side of communication and another, the server side. As for all the rest, the Player Class, the Main Game class, etc. I'm not sure whether they should be in the server project or the client project... any suggestions?

sentences:
Determine if 2D-projected point is visible I render a model and do have various 3D points around the surface of it. Because it's easier and I'm already using D2D for UI rendering, I implemented it so that these points are rendered as 2D points onto the screen.

The thing is that of course not all points are always visible. I'd like to test that and only show these which are actually seen by the camera.

Is there any way besides rendering them in Direct3D or reading the depth-buffer CPU-side to test it?

sentences:
How to balance a non-symmetric "extension" based game? Most strategy games have fixed units and possible behaviours.

However, think of a game like Magic The Gathering : each card is a set of rules.
Regularly, new sets of card types are created.

I remember that the firsts editions of the game have been said to be prohibited in official tournaments because the cards were often too powerful.
Later extensions of the game provided more subtle effects/rules in cards and they managed to balance the game apparently effectively, even if there is thousands of different cards possible.

I'm working on a strategy game that is a bit in the same position : every units are provided by extensions and the game is thought to be extended for some years, at least. The effects variety of the units are very large even with some basic design limitations set to be sure it's manageable.

Each player choose a set of units to play with (defining their global strategy) before playing (like chooseing a themed deck of Magic cards).
As it's a strategy game (you can think of Magic as a strategy game too in some POV), it's essentially skirmish based so the game have to be fair, even if the players don't choose the same units before starting to play.

So, how do you proceed to balance this type of non-symmetric (strategy) game when you know it will always be extended?

For the moment, I'm trying to apply those rules but I'm not sure it's right because I don't have enough design experience to know :

each unit would provide one unique effect;
each unit should have an opposite unit that have an opposite effect that would cancel each others;
some limitations based on the gameplay;
try to get a lot of beta tests before each extension release?

Looks like I'm in the most complex case?

sentences:
In unity C#, why use the .SetBool(booleanname, boolean) command when you could just write 'booleanname = true'? I noticed on a tutorial for unity someone used the code:

private Animator animator;
private bool isRunning = false;

While further on, did:

animator.SetBool("isRunning", true)

Why could you not just do

isRunning = true

if it is in the same class?

sentences:
Can threads be used to run resource consuming methods without -ever- freezing UI? Until recently I was sure that running expensive operations in threads can prevent UI freezing, but now I'm not.

Is it not guaranteed that a threaded operation will not hog the main thread's resources? If not, then how can I run a method in a way that it will never ever drain resources from UI thread (until told to)?

sentences:
How can I make an soundsystem with Slick? My question would be, how can I develop an easy-to-use sound system under slick-util?
Under the function

a.playAsSoundEffect(1, 1, true, x, y, z);

it already works to create a static position for the source. But if I adjust my CameraPosition in-game. So how can I change the position of the listener in Slick?

Answers would be awesome :)
Thanks,
Mineorbit!

sentences:
OpenGL 4.5 Primitive Restart vs. Base Index From how I understand the two techniques (Primitive Restart and Base Index) explained on https://www.opengl.org/wiki/Vertex_Rendering , they both do the very same thing. Simply spoken, they allow me to put many meshes into the same buffer and then render them as multiple meshes again. Is my understanding right?

If my understanding is indeed right, then my next question would be how well either of them works together with indirect rendering and multi-rendering.
Let's just use the following example: I have multiple meshes, which are put together to one entity. Multiple entities are put together to one scene. In a scene, entity attributes, like location, textures,... might change. What would be the most optimized way to render them performance vise? By using glMultiDrawElementsBaseVertex() (is there an indirect version?) or by setting glPrimitiveRestartIndex() and then using glMultiDrawElementsIndirect()?
If there is no indirect variant for the former, shouldn't the latter be the better choice?

Of course, there might be a better way of doing things. If so, I would really like to hear it :)

sentences:
How to limit and direct player's view in VR? We are making a VR game where the player will look at the world through the eyes of his character who sometimes moves on his own, so the player is only observer.

The character will rotate his body on his own and we need to change the orientation of player's camera to look where the character looks. For example, the girl takes his hand and leads her way. It would be very unrealistic if the player's head will be turned 180 from his body and he will walk backwards.

It'll allow us to avoid exhausting head rotations. Is it a good idea to guide his view by force by limiting camera euler angles relative to the direction of the body?

sentences:
get the value of lerp at the mouse position? I want to get the value t (value of lerp ()) between two lines
and the position of the mouse and draw a gray line that goes from line a to line b.
what is the value of lerp at the mouse position?

sentences:
How to manage instances of (placed) cards and decks in card games? This question sounds quite specific, but I mean in general, how do you manage something like a card game when it comes to decks (one for player1, one for player2, ...) and placed cards focused on instances of a Card-object?

Specifically in my case - using Java - I got a few cards with static data (image, values displayed on them, ...) and some data, depending on who has the card in their deck or where it lies on the board, for each type of card.

Now I got instances of those cards with their values like

Card DOG = new Card(image, a, b, ...);
Card SHEEP = new Card(image, a, b, ...);
Card PIG = new Card(image, a, b, ...);

statically in Card. Maybe this is already the wrong way to do it?

How do I manage decks and stuff now, because I need specific instances after those blueprints, but fitted to their use, be it the deck where it is in or if it is on hand or on board, ...

The first thought I got was having something like Card.createInstance but is this something that is done?

I'm more or less asking for a best practice on doing something like this.

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:
I'm trying to make another object move, besides from the character I want to create a small build of a TRPG, simaler to the Fire Emblem games. What I want to do is that I want to have the cursor be able to move a 'character' to a certain location. Any help?
(I'm doing this in Game Maker)

sentences:
What is the meaning of component is Dirty? I was reading a blog from Unity about UI it has a term like component is dirty,
what does that mean component is dirty ?

Unity UI Fundamentals tutorial

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:
Determine if set of connected tiles can fit inside grid Feel free to edit the title; I had a hard time figuring out how to explain it in a single line.

Here goes. I'm trying to generate these grids automatically, and randomly.

I have a grid of 25 tiles (indicated by #)

#####
#####
#####
#####

Let's say that I have 2 monsters I want to place in this grid, each monster occupies 3 or 4 tiles, with different patterns (these are not random, but is defined somewhere).

Monster 1 indicated by the letter A
Monster 2 indicated by the letter B

An example of this:

#AA##
#BA##
#BBB#
#####

Or it could be (this is whre the randomness comes in):

AA###
#A###
#B###
#BBB#

How would I go about calculating where, for example, monster B fits in the grid after A has been placde? Monster B has a pattern of:

B
BBB

And A has a pattern of:

AA
 A

A possible pattern could also be (for a different monster than A and B):

C
 C
  C

Is this even possible to automate? Hope that makes sense, otherwise I can try drawing it instead.

Thanks

sentences:
With Slick, how to change the resolution during gameplay? I am developing a tile-based strategy game using Java and the Slick API.

So far so good, but I've come to a standstill on my options menu. I have plans for the user to be able to change the resolution during gameplay (it is pretty common, after all).

I can already change to fullscreen and back to windowed, this was pretty simple...

//"fullScreenOption" is a checkbox-like button.
if (fullScreenOption.isMouseOver(mouseX, mouseY)) {
   if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
      fullScreenOption.state = !fullScreenOption.state;
      container.setFullscreen(fullScreenOption.state);
   }
}

But the container class, contrary to my previous beliefs, does not seem to have any resolution-change functions! And that's pretty much the situation...I know it's possible, but i don't know how to do it, nor what is the class responsible!

The AppGameContainer class, used on the very start of the game's initialization as of Slick's examples and tutorials, is the only place with any functions for changing the display-mode that I've found so far, but it's only used at the very start, and i haven't found a way to travel back to it from my options menu.

  //This is my implementation of it...
  public static void main(String[] args) throws SlickException {
    AppGameContainer app = new AppGameContainer(new Main());
//    app.setTargetFrameRate(60);
    app.setVSync(true);
    app.setDisplayMode(800, 600, false);
    app.start();
  }

I can define it as a static global on the Main, but it's probably a (very) bad way to do it...

sentences:
OpenGL error 0x0506 in -[CCSprite draw] 530 to run project on ios divice in cocos2d? I am running my cocos2d program on simulator. It works fine but when I run it on device, it throws error OpenGL error 0x0506 in -[CCSprite draw] 530. In my program I want to push one scene to another scene.At that time it shows error. Sometime it works fine on device at first time, but sometimes it shows error.Please help me about it. I also tried to google it

My Code As below:

First Load LoadingLayer as below.

-(void) directorDidReshapeProjection:(CCDirector*)director
{

        if ([[director runningScene] isRunning])
        {

            [[CCDirector sharedDirector] resume]; //pause the director

            [[CCDirector sharedDirector] pushScene:[HelloWorldLayer scene]];
        }
        else
        {
            [[CCDirector sharedDirector] runWithScene:[LoadingLayer scene]];
        }

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    // Create the main window
    window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    [self.window setBackgroundColor:[UIColor whiteColor]];

    glView = [CCGLView viewWithFrame:[window_ bounds]
                                   pixelFormat:kEAGLColorFormatRGB565
                                   depthFormat:0
                            preserveBackbuffer:NO
                                    sharegroup:nil
                                 multiSampling:NO
                               numberOfSamples:0];

    director_ = (CCDirectorIOS*) [CCDirector sharedDirector];

    director_.wantsFullScreenLayout = YES;

    // Display FSP and SPF
    [director_ setDisplayStats:NO];

    // set FPS at 60
    [director_ setAnimationInterval:1.0/60];

    // attach the openglView to the director
    [director_ setView:glView];

    // 2D projection
    [director_ setProjection:kCCDirectorProjection2D];

    //  [director setProjection:kCCDirectorProjection3D];

    // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
    if( ! [director_ enableRetinaDisplay:YES] )
        CCLOG(@"Retina Display Not supported");

    // Default texture format for PNG/BMP/TIFF/JPEG/GIF images
    // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
    // You can change this setting at any time.
    [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];

        CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
    [sharedFileUtils setEnableFallbackSuffixes:NO];             // Default: NO. No fallback suffixes are going to be used
    [sharedFileUtils setiPhoneRetinaDisplaySuffix:@"-hd"];      // Default on iPhone RetinaDisplay is "-hd"
    [sharedFileUtils setiPadSuffix:@"-ipad"];                   // Default on iPad is "ipad"
    [sharedFileUtils setiPadRetinaDisplaySuffix:@"-ipadhd"];    // Default on iPad RetinaDisplay is "-ipadhd"

    // Assume that PVR images have premultiplied alpha
    [CCTexture2D PVRImagesHavePremultipliedAlpha:YES];

    // Create a Navigation Controller with the Director
    navController_ = [[MyNavigationController alloc]    initWithRootViewController:director_];
    navController_.navigationBarHidden = YES;

    // for rotation and other messages
    [director_ setDelegate:navController_];

    // set the Navigation Controller as the root view controller
    [window_ setRootViewController:navController_];

    // make main window visible
    [window_ makeKeyAndVisible];

    return YES;
}

After LoadingLayer It Push To ViewController.it has buuton click on it go to HelloWorldLayer.

-(void)Button
{
        director_ = (CCDirectorIOS*) [CCDirector sharedDirector];
        [director_ replaceScene:[HelloWorldLayer scene]];
        [self.navigationController pushViewController:director_ animated:YES];
}

Low as Scene to Viewcontroller to scene.

app is not crash but it got error

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: Debugging multiplayer games without killing network thread? How do I approach multiplayer games for debugging? When debugging locally - how can you prevent yourself from disconnecting? The debugger halts network activity.

sentences:
Will function-local objects affect my performance over time? This is a very simple question.

Let's say my render loop runs at 60Hz, in each call to render(), I draw all my game's buildings, characters and scenery to make the current frame ready. Each of these entities are drawn using its own instance of a RectangleShape, which is a class able to render a texture to the screen. (I am using OpenGL but it shouldn't be relevant)

RectangleShape is a class that once allocated, generates geometry for the "sprite" to be drawn, has some properties to configure and then renders itself using OpenGL.

The problem is, for each entity, I am allocating the RectangleShape object, configuring and rendering it inside render(). So, in practice, there are dozens if not hundreds of blocks like this inside render():

// pseudocode
RectangleShape entitySprite;
entitySprite.setSize();
entitySprite.setTexture();
entitySprite.render();

I am aware I have a performance decrease by not using a pre allocated RectangleShape, already configured, which I only call render() on. I know that is the optimal path to go, but my question is:

Will so many allocations/deallocations of RectangleShape (hundreds, 60 times a second) fragment memory over time, decreasing the performance of the whole program? Or can I be safe that despite the performance hit by on-demand allocation is constant and will not degenerate as time passes?

I am not using any kind of custom allocator for anything. Also, please have in mind that the RectangleShape constructor internally resizes a std::vector, which I think implies a heap allocation.

Thanks

sentences:
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:
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:
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:
What am I doing wrong, in regards to multi-texture? I am writing a bump mapping demo, so I need an image texture, and a normal texture which should be loaded into the fragment shader.

This is the texture part of my OpenGL code:

glActiveTexture(GL_TEXTURE0);
GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, brick);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLint textureLocation = glGetUniformLocation(shader, "texture");
glUniform1i(textureLocation, 0);

glActiveTexture(GL_TEXTURE1);
GLuint normal_textureID;
glGenTextures(1, &normal_textureID);
glBindTexture(GL_TEXTURE_2D, normal_textureID);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE,
    brick_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
GLint normalTextureLocation = glGetUniformLocation(shader, "normal_texture");
glUniform1i(normalTextureLocation, 1);

Here is the fragment shader:

uniform vec3 light;
uniform sampler2D texture;
uniform sampler2D normal_texture;

void main() {
    vec3 tex = texture2D(normal_texture, gl_TexCoord[0].st).rgb;
    gl_FragColor = vec4(tex, 1.0);
}

I am sure that the brick array contains the image texture, and the brick_texture array contains the normal texture; but it seems normal_texture and texture are both the image texture, not the normal texture. What am I doing wrong, in regards to multi-texture?

sentences:
Complex shading using one single (small) texture Recently I stumbled upon a demo reel in UDK about how one can attain beautiful results using just one (rather tiny) texture that's being sent to the shader pipeline. The famous link is this one.

Basically, the author states that they've used just one texture and give a snapshot of the technique here.

I see that every RGBA channel contains different grayscale information.. and that info could be used to inside a shader to obtain a colour blended output. The problem is that the reel displays a fairly complex scene. To top that, the author even makes use of a normal map. How did they manage to fit a normal map in an already cluttered texture? It makes sense to have a half-space normal map by using only RG from an RGB texture, but what about the rest of the information? Since it was proven to be possible, could someone please explain how it was done (the big picture, not the dirty details!)!?

Here's the texture being used. Click to see in full size.

sentences:
Displaying text letter by letter I am planing to Write a Text adventure and I don't know how to make the text draw letter by letter in any other way than changing the variable from
h to he to hel to hell to hello
That would be a terrible amount of work since there are tons of dialogue.

Here is the source code so far

protected override void Update(GameTime gameTime)
{
    //input code removed for clarity

    if (Dialogue == 1)
    {
        Row1 = "Input Text 1 Here.";
        Row2 = "Input Text 2 Here.";
        Row3 = "Input Text 3 Here.";
        Row4 = "Input Text 4 Here.";
    }
    if (Dialogue == 2)
    {
        Row1 = "Text 1";
        Row2 = "Text 2";
        Row3 = "Text 3";
        Row4 = "Text 4";
    }

    base.Update(gameTime);
}

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);

    spriteBatch.Begin();
    spriteBatch.Draw(sampleBG, new Rectangle(0, 0, 800, 600), Color.White);
    spriteBatch.Draw(TextBG, new Rectangle(0, 400, 800, 200), Color.White);
    spriteBatch.DrawString(defaultfont, Row1, new Vector2(10, (textheight + (rowspace * 0))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row2, new Vector2(10, (textheight + (rowspace * 1))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row3, new Vector2(10, (textheight + (rowspace * 2))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row4, new Vector2(10, (textheight + (rowspace * 3))), Color.Black);
    spriteBatch.End();
    base.Draw(gameTime);
}

sentences:
How to do simultaneous action without it being real time? This is really a pacing question, but there's no tag for that:

The general concept is that the players are working in a team and need to be able to react to eachother's movement and observations as they happen(not being turn based) without the game having to be played at a real time pace.

This question and it's answers offer some insight: Turn-based strategy games where action happens in real-time? But I'd like to implement it so players can change their queued actions on the bases of realtime stimulus.

Right now my thought is to use an action queueing system in which the players can state a series of actions they intend to take and actions are played out simultaneously until one player runs out of queued actions or certain triggers offer a brief "change your queue" period.  It seems like it would be clunky and leave players waiting a lot of the time.

Any bright ideas to make this possible while still enjoyable?

sentences:
Check if a point is touching a user drawn curve in HTML5 canvas I am having trouble detecting whether a ball is colliding with a red curve. The curve below is an example of what a user may draw on to the canvas. I can't think of any fast ways to detect collision between a green ball and the red line here.

I have thought of checking the color of the pixel every tick at the location of the ball, but this is very slow and the round ball will fill more than just the centre pixel. I have also thought about logging every single X, Z point that the curve drawer has inserted and then checking if the ball is near to the point, but this also seems like a bad method.

From a red curve drawn on to the screen by a user, what is the best way to detect whether a point is colliding with the red line? Shall I store every single point of the red curve or check the color of the pixel at the point to see if it is red or not?

sentences:
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: 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:
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:
What does the TextureRegion.flip() method do? I'm learning libgdx and don't understand the purpose of parameters passed to flip(boolean x, boolean y). For example, I have code like this:

texture = new Texture(Gdx.files.internal("data/texture.png"));
textureRegion = new TextureRegion(texture, 0, 0, 20, 20);
textureRegion.flip(false, false);

My TextureRegion is flipped when both parameters are true and not flipped when they are false. But why does it need two parameters when it could have only one? The documentation says nothing about that.

sentences:
FPS drop on rendering I am trying to create my own game in java  (without OpenGL, LWJGL etc) and I am having a problem with the rendering.
My map is pretty big and the game redering the entire map at once which cause a result of 2 fps.
Does anyone know how I can make my game to render only what the player see and not the entire map?
map loading code:
private void loadMap(BufferedImage image) {
    int w = image.getWidth();
    int h = image.getHeight();

    for(int i = 0; i<w; i++) {
        for(int j = 0; j<h; j++) {
            int pixel = image.getRGB(i, j);
            int red = (pixel >> 16) & 0xff;
            int green = (pixel >> 8) & 0xff;
            int blue = (pixel) & 0xff;

            if(red >=250)
                handler.addObject(new Wall(i*32, j*32, ID.Wall));

            if(green==255)
                handler.addObject(new Floor(i*32, j*32, ID.Floor));
        }
    }
}

camera code:
public void tick(GameObject object) {

    x += ((object.getX()-x)-Game.WIDTH/2)*0.05f;
    y += ((object.getY()-y)-Game.WIDTH/2)*0.05f;

}

    g2d.translate(-camera.getX(), -camera.getY());
    handler.render(g);
    maps.render(g);
    g2d.translate(camera.getX(), camera.getY());

more codes for MCVE:
public synchronized void start() {
    thread = new Thread(this);
    thread.start();
    running = true;
}

public synchronized void stop() {
    try {
        thread.join();
    } catch (InterruptedException e) {
                e.printStackTrace();
    }
}

public void run() {
     long lastTime = System.nanoTime();
        double amountOfTicks = 60.0;
        double ns = 1000000000 / amountOfTicks;
        double delta = 0;
        long timer = System.currentTimeMillis();
        int frames = 0 ;
        while (running) {
            long now = System.nanoTime();
            delta += (now - lastTime) / ns;
            lastTime = now;
            while (delta >= 1) {
                tick();
                delta--;
            }
            if(running)
                render();
            frames++;

            if(System.currentTimeMillis() - timer > 1000) {
                timer += 1000;
                System.out.println("FPS: " + frames);
                frames = 0;
            }
        }
        stop();
}

public void tick(){
    for(int i = 0; i<handler.objects.size(); i++) {
        if(handler.objects.get(i).getId() ==ID.Player) {
            camera.tick(handler.objects.get(i));
            hud.tick();
        }
    }
}

public class Window extends Canvas{

    private static final long serialVersionUID = -6357664197674207224L;

    public Window(int width, int height, String title, Game game) {
        JFrame frame = new JFrame(title);

        frame.setPreferredSize(new Dimension(width, height));
        frame.setMinimumSize(new Dimension(width, height));
        frame.setMaximumSize(new Dimension(width, height));

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setResizable(false);
        frame.setLocationRelativeTo(null);
        frame.add(game);
        frame.setVisible(true);
        game.start();
    }
}

public static void main(String[]args) {
    new Game();
}

public void render() {
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null) {
        this.createBufferStrategy(3);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    Graphics2D g2d = (Graphics2D) g;
    g.setColor(Color.black);
    g.fillRect(0, 0, WIDTH, HEIGHT);
    //GameState

    //////////////////////////////////////////
    if(GameState == STATE.game) {
    g2d.translate(-camera.getX(), -camera.getY());
    handler.render(g);
    g2d.translate(camera.getX(), camera.getY());
    hud.render(g);
    }

sentences: Is it okay to use STL in my iPhone C++ 2d game? I've read a couple posts on the subject and it sounds hairy. But I think people are talking about using STL containers for Objective-C objects. I'm using pure C++.

sentences:
Unity tilemap spacing between imported sprites What am I missing here? Is Unity's tilemap limited to size 32x32?

I am trying to understand why my sprites in my Unity tilemap are spaced apart from one another such that if I paint them into the scene the tiles are centered in the grid's cells in an undesirable way.

I want my grid to be size 8x8 pixels and I want my sprite sheet to be imported in with pixels per unit set to 32 so that it matches the pixel size of my character and the rest of my art.

I've tried adjusting the import size setting and that did nothing.
I've tried changing the scaling of the grid, but that results in a smaller grid with smaller sprites still centered in the cells.

The only thing I've found that "fixes" this is to re-slice my sprite sheet at 32x32, but that results in tiles that are larger than what I am aiming for.

sentences:
Why does my rectangle move faster in one direction than in the opposite? I am using Slick2d to create a top-down game, however an rectangle than I am drawing to the display is moving faster to the left than to the right, and faster up than down.

I am updating frames like so:

public void update(GameContainer gameContainer, int delta) throws SlickException {
    player = new Rectangle(playerX, playerY, 10, 20);

    if (gameContainer.getInput().isKeyDown(Input.KEY_LEFT)) {
        x -= delta * 0.1f;
    }
    if (gameContainer.getInput().isKeyDown(Input.KEY_RIGHT)) {
        x += delta * 0.1f;
    }
    if (gameContainer.getInput().isKeyDown(Input.KEY_UP)) {
        y -= delta * 0.1f;
    }
    if (gameContainer.getInput().isKeyDown(Input.KEY_DOWN)) {
        y += delta * 0.1f;
    }
}

I then simply draw the rectangle to the display. It is noteworthy that the rectangle class is aorg.newdawn.slick.geom.Rectangle.

Why are the speeds for the movement different, and how can I fix this?

EDIT: I have fixed the problem by slowing the movement to the left and up, but this does not explain why the problem occurs

sentences:
Box2D Libgdx removing bodies in case of simultaneous collisions I am making a clone for the BreakOut game. I'm using Box2D and Libgdx for it. In the game, one scenario is that there could be 2-3 balls at one time. Now the problem occurs when 2 or more balls collide with the same object at the same instant. I'm simulating this by creating 2 balls overlapping each other and having velocities in both directions same, so they move like one body. When they collide I get this error : AL lib: alc_cleanup: 1 device not closed. I searched a little and modified my code by putting the condition if (!world.isLocked()). Now it just gets stuck and I have to end the process using task manager. Here is my code inside collision listener :

if (contact.getFixtureA().getUserData() instanceof Ball) {

        Ball ballTemp = (Ball) contact.getFixtureA().getUserData();

        if (contact.getFixtureB().getUserData() instanceof Brick) {
            brickTemp = (Brick) contact.getFixtureB().getUserData();

            if (brickTemp.getPower() != null)
                brickTemp.getPower().update();

            if (ballTemp.getX() > brickTemp.getPosition().x
                    + brickTemp.getWidth()) { // collision on the right
                ballTemp.goRight();
            }
            if (ballTemp.getX() < brickTemp.getPosition().x
                    - brickTemp.getWidth()) { // collision on the left
                ballTemp.goLeft();
            }
            if (ballTemp.getY() > brickTemp.getPosition().y
                    + brickTemp.getHeight()) { // collision on the top
                ballTemp.goUp();
            }
            if (ballTemp.getY() < brickTemp.getPosition().y
                    + brickTemp.getHeight()) { // collision on the
                                                // bottom
                ballTemp.goDown();
            }
            bodiesToDestroy.add(contact.getFixtureB());
        }
    }

I have another if statement where fixtureB is Ball and fixtureA is Brick with similar code.
And the part in MainScreen.java where I'm doing the cleaning up job is :

world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS);

    if (!world.isLocked()) {
        destroy(MyContactListener.bodiesToDestroy);

        if (MyContactListener.removeBall != null) {
            balls.removeValue(MyContactListener.removeBall, true);
        }

        if (MyContactListener.power) {
            MyContactListener.powerBrick.applyPower(delta);
            powerStartTime = System.nanoTime();
        }

    }
    public void destroy(Array<Fixture> bodiesToDestroy) {
    Array<Fixture> temp = new Array<Fixture>();
    for (Fixture bodyToDestroy : bodiesToDestroy) {
        if (bodyToDestroy.getBody() != null) {
            world.destroyBody(bodyToDestroy.getBody());
            temp.add(bodyToDestroy);
        }
    }
    MyContactListener.bodiesToDestroy.removeAll(temp, true);
    temp = null;
}

applyPower method just creates two new instances to Ball class with the same co-ordinates and velocities.
bodiesToDestroy is defined as public static Array<Fixture> bodiesToDestroy = new Array<Fixture>();

It's unlikely that two balls collide with the same object just at the same instant, but nonetheless I have to take care of such an occurrence. Please suggest how this should be handled.

sentences:
Simple shadow casting in 2.5D game I am trying to build simple game and I just bumped on some logical problem that I am sure many of you already came across. I have a plane - floor and several sprites-trees that have tree texture on them. It basically looks like this:
What I would like to do is to add dynamic shadows below the trees. I don't want to generate the shadows in runtime - I have texture for that. By "dynamic" I mean that I can control shadow length and rotation (simulating different times of day). And here I would like to ask you for best practice for that. I was thinking about adding small plane under each tree and control it's rotation and scaling directly from the game. The other idea I had was to use vertex shader to position, scale and rotate those planes. I was also thinking about using pixel shader to combine floor texture with shadow texture. The last idea has this advantage over the others that my floor may eventually be not flat, and the shadows would still be nicely casted. Also this would allow me to have shadows close to edges of the floor (which hangs in "space") and the shadows would not stick out from the floor. I would be grateful if you could suggest me some approach to the problem.

sentences:
Masking A Postprocess Unreal 4.10 I was able to make a full screen blur with the depth of field post process which I want to use for the background both my pause menus and my in game HUD. The issue is that when I want to use it for my in game UI it needs to only be rendered under the HUD and not the entire screen. Is there any way the I can mask the post process to a UMG widget for simplicity?

The other solution that I thought of was to create a material and mask it off in the material. The problem is that PostProcessInput0 already has the blur applied and I can't use the SceneColor any more, so I don't have a way to get the original texture without the blur. Is there any way to do this?

Cheers.

sentences:
Scene for Computer Screen We are developing a scene that will involve heavily interacting with a "touch screen monitor" in the scene.. Because the workflow of the touch screen will need to be dynamic we are creating a REST API that Unity will fetch JSON data and use that to build out the various parts of the UI. For instance, we get a JSON file that has a list of users and attributes and build out UI elements with that data.

The question is should I build out the display and underlying logic as a 2D scene that I add in to our 3D room or just build it all in the 3D scene.

I want to abstract away as much of the logic as I can for the interactive screen; I want to make sure we can drop this screen in a different Scene down the road without too much reverse-engineering.

Sorry if this is a straightforward question, my background is software dev, not game design.

sentences:
What takes up more processing power between whole character models or models that are pieced together in Unity? In terms of performance when it comes to animation what takes up more processing power: Whole character models or models that are pieced together? (1 object vs multiple objects).

I also wonder if animating multiple objects allows us to get a better overall animation quality instead of working with one object (especially if we deal with action packed scenes).

sentences:
Approximating a fourth point with a weighted average between three points? Given three points \$p_1,p_2,p_3\$, how would one approximate the best positive weights \$(u, v, w)\$ such that \$u+v+w = 1\$ and that the distance between the new \$up_0 + vp_1 + wp_2\$  from \$p_3\$ is minimal?
Basically, the enemy's unit is positioned between several "bases" on a 2d plainand it's easy to tell which is closest or even find the "weights" between two bases \$(t, 1-t)\$ to compute the relative fractions (eg. 0.3, 0.7). How does one find the optimal weights for three surrounding points?

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:
[Unity2D]Make a bullet move toward player and keep moving when past him Basically I'm trying to make enemies attack player and shot bullets towards player and for now is kinda working, but my problem is the bullet stop when it reach the player position instead of keep moving.

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

public class EnemyTwoBulletScript : MonoBehaviour {

    public float bulletDamage;

    private float bulletSpeed = 9.5f;
    private float spriteWithDelta;
    //private Rigidbody2D bulletBody;
    private Transform playerTransform;
    private Transform selfTransform;
    private Vector3 playerPosition;

    // Use this for initialization
    void Start() {
        //bulletBody = GetComponent<Rigidbody2D>();
        spriteWithDelta = GetComponent<SpriteRenderer>().bounds.size.x / 2;
        playerTransform = GameObject.FindWithTag("Player").GetComponent<Transform>();
        bulletSpeed = 9.5f;
        playerPosition = playerTransform.position;
        selfTransform = GetComponent<Transform>();

    }
    // Update is called once per frame
    void Update () {
        selfTransform.position = Vector3.MoveTowards(selfTransform.position,playerPosition,bulletSpeed*Time.deltaTime);
    }
}

I don't want the bullet to follow player either, I just want to shot a rect between origin and player, but keep moving when the bullet past player.

sentences:
Is TIN a 2D or 3D mesh? I have a TIN (Triangle Irregular Network) that was created in CAD software packages from something called DTM (essentially each point represents the height of the ground for that specific point).

The result looks like a 'blanket' of triangle, so not closed in any way. I think that's a non-boundary manifold triangle mesh but not sure. More unclear is if it is a 2D mesh (like a polygon is a 2D surface in a 3D Cartesian space even if not all vertexes are the same z). Can someone please explain what kind of geometry is a TIN?

Example (the blue triangles are the TIN):

sentences:
Input into a switch statement to change position of a character. I'm trying to make a simulation of Travelling sales man problem. So I got random circles spawning and each circle.

I want to make it so I can switch between the circles. Currently the player spawns to the first circle created which is in position (cir[0].x, cir[0].y). However, I'm trying to make an input so you can type in for example 12 and the position of the queen would now be (cir[12].x, cir[12].y). But, this seems to not work.

int number;
cin>>number;

if(number<NUMCIRC)
{
    switch(number)
    {
    case number:
        queenX = cir[number].x;
        queenY= cir[number].y;
        break;

    default: break;

    }
}

I was wondering as surely if I input the number and then press enter it should jump to the number. Assuming it's smaller than NUMCIRC, which is the number of circles that I have spawned.

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:
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: How do I slice a 3D object at runtime in Unity? I'm specifically looking for some sort of algorithm or way that can "cut" a 3 dimensional mesh with some other game object. How would I implement this?

sentences: How does changing weapons and character animation in 2d games work? I know how I can make my character move by changing animation-frames. What if I want to use a weapon database? I want the character to fight with a bow and sometimes with an axe (different moves). Do I need like many pictures/animations for every different kind of weapon (bows, swords)? Or am I totally wrong?

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

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

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

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

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

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

Any ideas ?

sentences:
Invalid operation (1282) in GLSL vertex shader My GLSL vertex shader works fine, but you if put a for loop inside or rename the uniform xxx to something else, it says the follwoing:

Exception in thread "main" org.lwjgl.opengl.OpenGLException: Invalid operation (1282)
    at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
    at org.lwjgl.opengl.GL20.glGetUniformLocation(GL20.java:664)

this is the method causing the problem:

protected void getAllUniformLocations()
    {

        location_transformationMatrix   = super.getUniformLocation("transformationMatrix");
        location_diffuseColor           = super.getUniformLocation("in_color");
        location_projectionMatrix       = super.getUniformLocation("projectionMatrix");
        location_lightPos               = super.getUniformLocation("lightPosition");
        location_lightColor             = super.getUniformLocation("lightColor");
        location_viewMatrix             = super.getUniformLocation("viewMatrix");
        location_specular               = super.getUniformLocation("specularLevel");
        location_boneTransformations    = new int[32];
        for(int i = 0; i < location_boneTransformations.length; i++)
            location_boneTransformations[i] = super.getUniformLocation("xxx["+i+"]");
    }

this is my vertex shader:

#version 400 core

//data from VBO
in vec3 position;
in vec2 texture_coordinates;
in vec3 normal;
//bone data
in int bone_pointer;
in float bone_intensity;
//vertex color output
out vec4 color;
//texture coordinates
out vec2 pass_texcoords;
out vec2 texCoord0;
//normal
out vec3 surface_normal;
//vector pointing towards the light
out vec3 to_light_vector;

//position, rotation, scale
uniform mat4 transformationMatrix;
//perspective projection
uniform mat4 projectionMatrix;
//TODO: material color
uniform vec3 in_color;
//camera viewmatrix
uniform mat4 viewMatrix;
//lights
uniform vec3 lightPosition;
uniform vec3 lightColor;
//skeleton data xxx = bone transformations
uniform mat4 xxx[];
uniform int group_indices[];
uniform float group_values[];
void main()
{
    for(int i = 0; i < group_indices.length(); i++)
    {

    }
    mat4 total_transform =  transformationMatrix;
    total_transform = total_transform * xxx[0];

    vec4 worldPosition;

    worldPosition =  total_transform * (vec4(position, 1)) ; //

    vec4 pos =  projectionMatrix * viewMatrix * worldPosition;
    gl_Position = pos;

    //Texture
    pass_texcoords = texture_coordinates;

    //light
    surface_normal = (total_transform *  vec4(normal, 0)).xyz;
    to_light_vector = lightPosition * worldPosition.xyz;

    //textures
     texCoord0 = texture_coordinates;

}

sentences:
How to disable collider2D when another gameobject is on top of it Each black colored square has a BoxCollider2D. How can I disable the collider after I put another game object on top of it?

Here is the sample output:

sentences:
Scene components and renderer I'm currently writing a very small game engine for learning purposes, and hit a block when trying to separate the engine's logic from the "rendering" module.

My current approach is to feed my renderer with a pointer to a "Scene", iterate through its nodes, test them with a static_cast(yeah you read that right) to a "Renderable" object (for example a static mesh class that contains a material and a vertex array) and draw.

I'm aware that this approach is terrible but I can't think of an alternative. At this point I feel like my architecture is complete spaghetti. Any indication would be much appreciated.

sentences:
Box2d Javascript Disable Contact Between 2 Objects I want two objects, when collided, to not effect each other in velocity or force.

I have looked up guides and they say to change the PreSolve so that b2Contact.SetEnabled is false... which in code is

b2Contact.SetEnabled(false);

However, SetEnabled is a prototypal method for b2Contact, which means I have to instantiate a new b2Contact each time in order to call SetEnabled.

This does not make any sense to me and the code is wrong as right now all the objects in my world still collide with each other, even though I set that every single object will not collide with every other object:

This is my modified PreSolve method:

 B2.b2ContactListener.prototype.PreSolve = function (contact) {
        var a = contact.GetFixtureA().GetUserData();
        var b = contact.GetFixtureB().GetUserData();

        if (a instanceof Entity.Rock && b instanceof Entity.Player) {
            new B2.b2Contact.SetEnabled(false);
        }

        if (a instanceof Entity.Rock) {
            new B2.b2Contact.SetEnabled(false);
        }

    }.bind(this);

Any tips on how to use this API would be much appreciated!

sentences:
How do I save a procedurally-generated map as binary level-data in C++? For example, I'd like to do something as simple as a generating an array matrix using Conway's Game of Life and then filling each cell with particular data to be saved to a binary file.

Additionally, how do I load the binary level-data?  :)

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:
How can I manually advance a timeline in GameMaker? I have a timeline from 0 to 300 frames divided into maybe 20 different steps.

When I certain condition is met, I want to jump to the next step of that timeline. How can I do that?

sentences:
How to run a timer parallel to a series of coroutines and WaitForSeconds In the code below, I have a cycle for enemies appearing and disappearing.

IEnumerator EnemyCycle()    {
while (isRepeating)
{

for (int j = 0; j < enemies.Length; j++) {

    canStartUpdatingReset = true;
    Enemy currentEnemy = enemies [j];
    var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
    var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 0f, fTime, currentEnemy.gameObject, false));

coroutinesToStop.Add(_currentFade);

if (currentEnemy.hasWeapon) {
                weaponCycleCoroutines.Add(StartCoroutine(FadeToForWeapon(currentEnemy.weapon.GetComponent<Renderer>().material, 0f, fadeTime, currentEnemy.weapon, false)));

            }
}

yield return new WaitForSeconds (hideTime);

for (int j = 0; j < enemies.Length; j++) {

    Enemy currentEnemy = enemies [j];
    var _myMaterial = currentEnemy.GetComponent<Renderer>().material;
    var _currentFade = StartCoroutine(FadeToForEnemy(_myMaterial, 1f, fTime, currentEnemy.gameObject, true));

     coroutinesToStop.Add(_currentFade);
if (currentEnemy.hasWeapon) {
weaponCycleCoroutines.Add(StartCoroutine(FadeToForWeapon(currentEnemy.weapon.GetComponent<Renderer>().material, 1f, fadeTime, currentEnemy.weapon, true)));
}
yield return new WaitForSeconds (showTime);

        }
    }
}

I have an enemyCycleDuration float which is

enemyCycleDuration = 60*(hideTime + fadeTime + showTime + fadeTime)

Note that fadeTime comes from FadeToForWeapon and FadeToForEnemy. The idea here is I want the enemyCycleDuration to be run in parallel to EnemyCycle() so it is reset (please see code below) at the same time that

yield return new WaitForSeconds (showTime);

is reached in the  EnemyCycle().

I am resetting enemyCycleDuration in the following way in the update method but  EnemyCycle() seems to be ahead of enemyCycleDuration, always completing before enemyCycleDuration is reset. How can I get both to run parallel to each other in timing and complete at the same time?

if (canStartUpdatingReset)  {
timeElapsed +=1;
if(timeElapsed >= enemyCycleDuration) {

    timeElapsed = 0;

    Debug.Log ("Reset CycleDuration");
    }
}

sentences:
OpenGL 3.0+ framebuffer to texture/images I need a way to capture what is rendered on screen, i have read about glReadPixels but it looks really slow.

Can you suggest a more efficient or just an alternative way for just copying what is rendered by OpenGL 3.0+ to the local RAM and in general to output this in a image or in a data stream?

How i can achieve the same goal with OpenGL ES 2.0 ?

EDIT:

i just forgot: with this OpenGL functions how i can be sure that

I'm actually reading a complete frame, meaning that there is no overlapping between 2 frames or any nasty side effect
I'm actually reading the frame that comes right next to the previous one so i do not lose frames

sentences: how to draw a dashed curved line to a point in as3? How can I draw a dashed curved line to a x,y point in as3? Basically I'm creating a game where you have a turret, and I want the arc the turret would fire a projectile along to be displayed as a dashed/dotted line along the arc to wherever the mouse x,y is. Ideally it would use the drawing API, rather than using any bitmap manipulation.

sentences:
Tools for generating texture atlases/sprites from source images? Is there an industry standard file format for texture atlases?

What are the apps that take a directory of images and turns it into a texture atlas png and a text file describing what's on it?

This is primarily for use in OpenGL iPhone/Objective-C, but it seems like there ought to be a standard across many platforms.  I can create these by hand or by writing a script to simply tile them, but it seems like there would be some tools already made for this.

sentences:
Adding physics to a Blueprint actor in UE4 I am trying to create a dice in ue4 and be able to read off what value it gives. I've made a mesh in Blender and created a texture, imported them and created a blueprint actor and added the static mesh to it.

When I start the game the dice just floats in the air and isn't affected by gravity. I have tried just using the static mesh and I can get that to be affected by gravity. However, I need to add scripts to the object so I can give it a random rotation and read its value, so I created a blueprint actor. I've looked online for a way to give this actor physics, nut nothing.

Does anyone know how I can add physics to a blueprint actor?

Also if anyone has any info on giving the actor a random rotation and reading the value of the dice that would be great.

sentences:
"Pixel-perfect" camera positioning in 2d game I am writing a 2d game using LibGDX. The view to the game world is top-down. The game shows a grid of lines, which looks nice when the camera is at its initial position (0,0).

The problem is now that when I move (shift) the camera left/right/up/down this grid sometimes becomes a bit blurry, so the lines do not look perfectly sharp any more.

I assume this is because in these cases the grid lines are not exactly on screen pixels, but somewhere in between. Is this correct?

In any case: Are there any "best practices" how to address this problem (not necessarily LibGDX-specific)?

sentences:
Slick2D Isometric TiledMap Rendering Problem I created a Tiled Map using the Tiled Map Editor. In the Editor it looks like this:

Desired State

In my java program it looks like this:

Actual State

My java code is:

public class Game extends BasicGame {

    private TiledMap map;

    public static void main(String[] args) throws SlickException {
        AppGameContainer app = new AppGameContainer(new Game());

        app.setDisplayMode(800, 600, false);
        app.setShowFPS(true);
        app.start();
    }

    public Game() {
        super("Test");
    }

    @Override
    public void render(GameContainer arg0, Graphics arg1) throws SlickException {
        map.render(300, 200);
    }

    @Override
    public void init(GameContainer arg0) throws SlickException {
        map = new TiledMap("res/unbenannt.tmx"); //path is valid!
    }

    @Override
    public void update(GameContainer gc, int arg1) throws SlickException {

    }
}

The orientation of the map is isometric. I'm working under Linux Mint, Java 6, eclipse with the latest Slick2D and LWJGL Library.

Did I forget anything? Why am I getting such a weird looking map rendering?

sentences:
How to create a projectile motion of a cannonball in top down view? Objective

To move the bullet with projectile motion to specific destination by touch point.

In the below image is an example of a bullet which has a projectile motion. On my observation, the bullet speed and angle is calculated base on distance.

(source: pixwerk.net)

Where I'm at? (How do I move the bullet to its destination?)

In the below code, is the method I use to move a bullet to its destination. But the problem is I want to create a cannonball bullet which it has a projectile motion. How do I create these tricks to make a cannon ball projectile motion like the image below.

public Vector2 getVelocity(Vector2 currentPosition, Vector2 targetPosition) {
    Vector2 targetDirection = targetPosition.cpy().sub(currentPosition);
    return targetDirection
            .nor();
}

What I have done? (Currently I could move the bullet straight to its destination.)

Bullet is moving straight (It's not problem).

[EDIT]

Drawing a projected trajectory

To get the trajectory point, base on iforced example. I've already have the libgdx box2d version of this.

b2Vec2 getTrajectoryPoint( b2Vec2& startingPosition, b2Vec2& startingVelocity, float n )
  {
      //velocity and gravity are given per second but we want time step values here
      float t = 1 / 60.0f; // seconds per time step (at 60fps)
      b2Vec2 stepVelocity = t * startingVelocity; // m/s
      b2Vec2 stepGravity = t * t * m_world->GetGravity(); // m/s/s

      return startingPosition + n * stepVelocity + 0.5f * (n*n+n) * stepGravity;
  }

Rendering the trajectory point

glColor3f(1,1,0);
  glBegin(GL_LINES);
  for (int i = 0; i < 180; i++) { // three seconds at 60fps
      b2Vec2 trajectoryPosition = getTrajectoryPoint( startingPosition, startingVelocity, i );
      glVertex2f(trajectoryPosition.x, trajectoryPosition.y );
  }
  glEnd();

[Solve]

The answer is to find the angle and speed by the distance by s.tarik.cetin

Another issue encountered (this must be move to another question)

This is the problem, I don't know how do I set the starting velocity. Currently in the below code, to set the startingVelocity and startingPosition where the underlined code is the part that I'm not sure.

    touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0);
    camera.unproject(touchPoint);

    Vector2 touch = new Vector2(touchPoint.x, touchPoint.y);
    Vector2 touchDirection = touch.cpy().sub(bulletPosition).nor(); // get the the direction from bullet position to touch point and normalize the value.

    float distance = touchDirection.dst(startingPosition);
    float angle = touch.angle();
    float speed = 6.0f; // currently the speed is fixed. I need to know the speed base on distance

    startingPosition.set(bulletPosition); // current position of the bullet
    startingVelocity.set(touchDirection.scl(speed)); // where the bullet should be

sentences: Designing social network structure for a mobile game We are going to design a mobile game in which players could be related with each others in a social network-like mechanism. So, how we could integrate a mobile game and a social network (SN). Should we design a SN at first and then add game features to that or vice versa? Any suggestion?

sentences:
Physics2D.IgnoreCollision not work when rb not moving I want to use Physics2D.IgnoreCollision for ignoring collision between enemy and player, when player have shield.
But I have enemy who some time is static and some time jump only on y axis. When enemy not moving Physics2D.IgnoreCollision not work and physics collision between player and enemy occur even Physics2D.IgnoreCollision is called. When i add some velocity to enemy in update method
Code (CSharp):
rb.velocity = new Vector2(0.1f, rb.velocity.y);

IgnoreCollision work like it should.
Can some one tell me why this happens?
Thanks

sentences:
Gradually rotate vector towards another vector For a game I'm making there is an AI bot in it. I want it to rotate so that it is facing it's opponent. The direction it is facing is determined by a vector (it will face the direction that the vector represents.) I can rotate it to face it's opponent like so:

 glm::vec3 opponentRefPos = opponentPos - position;      //for comparing AI's opponent's position to AI's position

glm::vec3 directionTarget = glm::normalize(opponentRefPos);
direction = directionTarget;

Where direction is the direction that the AI bot is facing (and it is a vec3) I want to gradually rotate it to face directionTarget. So let's say that I have a constant variable called SPEED (and deltaTime, which is the time between frames that SPEED will be multiplied by to keep the speed that it rotates at constant), which is the speed that I want the AI bot to rotate at. How can I rotate it towards this vector at that speed?

sentences:
Efficient data packaging for a client-server network Language: C++

My question is as follows: I would like to know what would be the best or at least a good way to pack and send data from client to server and the reverse. There will be a few data composing a single packet. A packet will have a "id", that defines what is it for, then the data in a pre-
determined order for that "action" which the packet corresponds.

For less performance-dependant systems, i would just send strings, that would be separated by a space, being them the data of the "action"and the first "word" the packet identifier and just chain if statements checking when there is a match.

Now for a more critical system, what i tought so far was something like this:

Make a string with packet id and data, and send it. Then, to unpack, i could extract the first integer in the string, and by having an array of packet handlers, with indices corresponding to the packet id they handle, and just do something like packetHandlers[packetID].Process(packetData) .

What do you think of it, any suggestions? greatly apreciated!

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:
What scaling system to use in Box2d? I'm worried about this Caution box from the Box2d manual:

  Box2D is tuned for MKS units. Keep the size of moving objects roughly between 0.1 and 10 meters. You'll need to use some scaling system when you render your environment and actors. The Box2D testbed does this by using an OpenGL viewport transform. DO NOT USE PIXELS.

I don't want to use OpenGL since I know nothing about it. I'm using SFML to render my game.

sentences:
How to properly handle sending arrow-key movement data to a authoritative server? I've made a little C# server which receives UDP packets and shows me the incoming information. I want to make an authoritative server in C# which simulates character movement and interaction in a 2D real-time world and sends information back to a Unity game client where the information is then represented.

My question is: How does my server know how long a button is pressed in real-time (example: right arrow key to move character right)?

My guess is that the client would send a UDP packet to the server on-key-press saying move-this-direction. The server would then simulate the character moving and new positional information is constantly sent back. When the Client releases the key a new UDP packet is sent to the server saying the movement key has been released thus stop-moving-this-direction. BUT the problem is UDP unreliability and the lag between letting the key press up, and the server knowing that the key press is up; which would make the character keep moving for a period of time after letting go of the key - is this solved with proper movement interpolation?.

Any ideas or information sources how to properly handle sending arrow key movement data to a authoratative server?

sentences:
How can I change the dimensions of collision volumes showed in UE4's physics asset tool? How can I change the dimensions of the capsule for one bone in the physics assets tool?

The problem is that bones not connected by joints have overlapping collision volumes in the mannequin that comes with the starter content, which causes those body parts to apear dislocated or out of place when the simulation is running.

For instance in this image the pelvis and the middle bone in the spine (Spine 2) are overlapping.

So, when the simulation runs Pelvis and Spine 2 get pushed apart reducing the overlapping to a contact point.

sentences:
Is it possible to record video, depth map and 6D pose of any games? I'm not a game developer, but a researcher working on improving video quality in various contexts. For my current problem, I need to collect videos which have both RGB data as well as depth data. Video can be monocular or stereo. However, if there is egomotion, I'll need the camera pose (rotation and translation) as well. Is there any way to record all these information in any kind of games? Games can be on any platform: PC games, mobile games or VR games.
In short, I want to record gameplay but with additional information such as depth map and camera pose.

sentences:
Unexpectedly fast rotation after refactoring OpenGL code to add more abstraction I've been working on an OpenGL program that simply renders a square that rotates in 3D space. The square also has a texture applied to both sides. Here you can see an example screenshot of the program running:

I used very little abstraction in that project and most of the code was in main.cpp (apart from the shader loading and usage).

After finishing this project, I wanted to improve it as much as I could with my current knowledge. I started abstracting away functionality. The final result was a very clean main.cpp file with multiple classes (Mesh, Shader, Resource Manager and Window classes).

Apart from the texture, everything should functionally be the same, but I experienced the following after using the rotate function; left is the abstracted version of the first project, right is the first project:

The square in the new project rotates at a much higher speed than in the previous project. The implementation is the same, as in, the degrees that the square should rotate around the y-axis are the same in both projects - the time the program has been running, which is gotten through GLFW's glfwGetTime().

I checked nearly everything. The .lib files are linked the same way between the projects. There are no differences between the vertex data. Both projects are running in DEBUG mode.

The only difference I could think of is the texture not being applied in the second project, but I recall that the textureless version of the first project was still running with the same speed as it is currently. But rendering a 64x64 texture on a square shouldn't be that expensive to run.

NOTE: I'm using GLM for the matrices and for the rotation transformation.

Does abstracting away all of OpenGL's initializing and buffer code improve performance by that much?

I'm using GLFW for window and context creation, and thus using (float)glfwGetTime() for the angle of rotation along the y-axis.

The second project basically moves over all functionality into categorized classes. So everything to do with meshes was moved to a Mesh class, loading of GLSL shaders and textures was moved over to a ResourceManager class etc. So all functionality should be the same.

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:
Generate random starting points at same distance between them Is there an algorithm to generate random 2D points that are at the same distance between each other? Useful for starting points. Check map:

Don't be picky, I know in the image points are not at the same distance, lol, but you get the idea.

sentences:
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:
2D deferred lighting calculations not working I have the following code for my HLSL pixel shader. Modified from another post here on GameDev (Link), but I have a few problems with it:

// calculate UV and get texture and normal.
float2 UV = Input.position.xy / Input.ScreenSize.xy;
float4 DiffuseColor = ColorTexture.Sample( SampleType, UV );
float4 NormalColor = NormalTexture.Sample( SampleType, UV );
float4 normal = 2.0f * NormalColor - 1.0f;

// calculate distance.
float3 LightDir = LightPos - Input.position.xyz;
float distance = 1 - length( LightDir ) / LightRadius;

// calculate dot of normal and light direction.
float NdL = max( 0, dot( normal.xyz, LightDir ) );

// get final color.
float4 finalColor = ( DiffuseColor * ambientIntensity ) + DiffuseColor * distance * LightIntensity * LightColor * NdL;

return float4( finalColor.rgb, DiffuseColor.a );

ambientIntensity and LightIntensity are currently 1.0f to simplify things. LightRadius depends on the size of the geometry, but is in pixels. ~80 for testing. DiffuseColor is a texture resulting from applying self-illumination and darkening the base image. NormalColor is the normal map for the image.

This shader needs to run for every light on the screen, which isn't that many.

For my tests I use the images from the blog post here. It's a little old, but it is pretty much what I need to do, which I can't.

Now; I did enough testing to know that all input and cbuffer parameters are valid but the results I get are not what I hoped for.

Here are my problems:

Problem 1: My knowledge of math is limited and I don't understand exactly what the dot product does, why it is needed in the light calculation or why the distance is calculated as it is. Is there a resource online that would explain lighting in term of HLSL or at least in a way meant for a programmer and not using big equations meant for a mathematician? If I don't understand the basics, I'm afraid I wont be able to improve and I'll be stuck every time I need to add new features (ie: shadows), but I need to get this things running asap.
Problem 2: The results I have are not good. When I move the light around, I can actually see where the geometry cuts off, and it is as if the light does not trail off properly near the edges of the geometry. Are the calculations wrong?
Problem 3: I built a 2D shape editor that I use to design the shape of the lighting geometry, but I don't know how to edit the shaders or the geometry's UV to have the custom shapes (fans, circles, etc) shaded properly. The light I render is always shaded as if it was a circle.

I spent the last two weeks working on this and whenever I search on Google, I keep getting pages I have already visited, so I'm quite lost right now. Any suggestions would be highly appreciated.

My game is a tile-based 2D game, thought I would mention that.

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:
In platformer games, what are "hole in the ground" obstacles called? In most jump and run games, holes in the ground are common obstacles: You need to jump over them, or you'll fall down and lose a life.

It would be helpful to know for documentation, variable naming and discussion: What are those holes called?

sentences:
How can I extract a list of Minecraft items and recipes? I'm designing a robust system for resolving item dependencies in Minecraft and to do so, I need to maintain a database of items and recipes.  Right now, this database has to be hand-crafted (no pun intended); I would like to know if it is possible to somehow query the Minecraft jars (or perhaps more realistically, grep through them) to extract this data automatically.

How can this be done?  The project is currently in Python, but it can still be ported to Java without much fuss at this stage.  (For the curious.)

sentences:
Tile sizes in 2D games While developing a small game using tile-mapping method a question came to my mind:

I would develop the game on Windows but wouldn't exclude adapting it to another platform.

What size(in pixels) would you recommend using for creating the tiles of a tile-mapped game(ie: RPG) with the following requirements?

Have an acceptable level of detail without having too many tiles.
Having a decent map size.
Allow adaptation of the game on a handheld(ie: PSP), smartphone or a computer without too much loss of detail or slowdowns.
Allow more or less important zoom-in / zoom-out.
Have a resolution of tile that permits either pixel-perfect collision or block-collision.

Anything from a good explanation to a game example is useful as long as it can fit the requirements.

This question may seem a bit simplistic, but I noticed that many Indies game developer were using inappropriate scales scenery.

Also sorry for the poor syntax and the lack of vocabulary of my question, being a non-native English speaker doesn't help when talking about computers programming.

sentences:
How to create a minecraft style world that is based of a heightmap For my game I am trying to create a Minecraft style world that is based off a heightmap that I made In Photoshop. I am trying to make the map which is 7km squared where each cube is 1m cubed but I haven't found a way to do it. The heightmap converts to a terrain file(in unity), but my problem is that I can't create the Minecraft look.

what I have done so far looks like this

what i want looks like this

sentences:
Online RTS Game Architecture for Mobiles We came up with an idea for a real-time strategy game for mobile devices that can play with other players over a network. I'm trying to plan out the architecture/protocol required for such as system. Some other related questions (1,2) mention that P2P is the way to go for RTS games. The problem is that most mobile phones cannot open TCP ports to allow incoming connections, so a central server would be required to relay messages between the players. Another issue that is mentioned on the linked questions is the difference in floating point operations and random number generators, etc among different platforms (Our game would run on iOS and Android for example) so running the game simulation on each device may not be optimal. I could run the game simulation on a server and have it broadcast updates, but simulating/broadcasting up to 200 units per game would be quite expensive especially when multiple people are using the same server to play games. The server's performance might drop significantly with more than a few hundred people using it.

I'm currently thinking the central server would be the best method, but would require a lot of server power. I'm looking for any suggestions on a architecture/protocol that would work for this game and any insight on the issues I mentioned with existing protocols.

sentences:
LWJGL—How to Animate and Render Characters Using a Sprite Sheet I'm making an RPG similar to Super Nintendo RPGs in the early '90s. I'm handling movement much like Squaresoft's Final Fantasy IV.

Notice that the player never actually changes his x and y positions on screen. What I'm asking, to be precise, is how could I, in LWJGL through user input (say, the arrow keys), take the sprite sheet I have of my character's movement animations and render them in a [partially] fluid animation like above?

I've been perusing the internet for hours, and I've not found a surefire way to do this. I don't have any code as of yet; I'm more or less looking for a guideline or some pointers in the right direction concerning how I might tackle this.

And, to note, this'll be a rather large game, so I want to focus partially on speed and efficiency—that meaning that I don't want to dive into Slick2D and libGDX unless absolutely necessary.

sentences:
How should I go about creating a generic Scene object for managing VBO data? To simplify managing multiple types of data with different shaders and textures, I thought about creating a generic Scene object (is there a name for this?) which would allow me to pre-configure how I want to render something, and how the data changes. Let me give an example:

Everything  below is in the context of a 2D top-down game

Some parts are completely static, e.g. the background, and their geometry never changes.
Then there'd be a "NPC" layer, which can change on almost every single frame, uses different shaders.
Last but not least, there's a UI layer, which sits on top of everything else.

Some of these parts would probably be split into multiple subparts, such as parts rendered as GL_TRIANGLE_FAN, and other parts rendered as GL_LINE_STRIP, etc. To avoid duplicating lots of setup/generate geometry/render phases, it would seem logical to wrap this in something that can be configured, such as:

Scene s;
Batch b1 = s.create_batch(somehow_specify_shaders_etc);
generate_background_geometry(b1);

Batch b2 = s.create_batch(somehow_specify_other_shaders_and_VAO);

// game loop
while (true) {
  // this would generate/update the NPC geometry on the fly
  b2.process_input(gather_user_input());

  for (Batch b: s) b.render();
}

Now what if I wanted to specify different texture bindings for each batch? Or different shaders?

Is there a general pattern for managing geometry data like this?

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 do you deal with loot in an RPG where all mosters drop their full inventory? I currently have a system where both players and monsters in an RPG use equipment. This means that when an enemy is killed, I can technically drop everything they have. These are armor and weapons that players may choose to equip. This is fun for the first 5 times this happens(when the player is missing some equipment), then the inventory gets crowded with junk, and it's hard to figure out what's valuable and what's not. Most of the NPCs will lag behind player in terms of gear with the exception of bosses, who will have very good gear.

I've seen suggestions of using a "junk bag", where looted white/ gray equipment goes. Junk bag can be sold with one click.

I can think of two old school MMORPGs that had near full loot: Shadowbane and ultima Online. Both of these used disposable equipment that was easy to craft or "farm" from NPCs.

Recently the age of decadence, a PC RPG had a good full looting system where equipment could be broken down to get iron ingots and such and used in crafting. However, that game only has less than 100 enemies to kill and loot during the entire game, and had weight limit.

In my game there would be hundreds of enemies to kill in rapid succession, maybe 2-3 kills per minute. Another option is to abandon the full looting idea and only "drop greens, blue and purple items if the enemy had them.

In other words, how do you use or get rid of unwanted items when there is a lot of junk loot?

sentences:
Explanation of the parameters in the line intersection code I am trying to understand a C code that moves the mesh nodes for each time step and i am totally struck on the parameters t1 and t2 please help me sorting this out.
So here is what the function gets (Xa,Ya) (Xb,Yb) (Xc,Yc) and (Xd,Yd) where (Xc,Yc) is the origin (0,0) about which mesh rotates now i have a function that calculates t1 and t2 and (i think t1 is the parameter in barycentre form of line that gives intersection point between two line formed by (Xa,Ya)(Xb,Yb) and (Xc,Yc)(Xd,Yd)) and i have no idea what t2 is...

The code is

static void find_t(real xa, real ya, real xb, real yb,
             real xc, real yc, real xd, real yd,
             real *t1, real *t2, int * flag)
{
  if((xd==xc)&&(xb!=xa))
  {
    if(yd==yc)
    {
      Message0("\nc and d are the same points-aborting!!!\n");
      exit(0);
    }
      (*flag) = 2;
      (*t1) = (xc-xa)/(xb-xa);
      (*t2) = ((yb-ya)*(*t1)-(yc-ya))/(yd-yc);
   }
  else if((xd!=xc)&&(xb==xa))
   {
     if(yb==ya)
     {
        Message0("\na and b are the same points-aborting!!!\n");
        exit(0);
      }
        (*flag) = 2;
        (*t2) = (xc-xa)/(xc-xd);
        (*t1) = ((yd-yc)*(*t2)+(yc-ya))/(yb-ya);
      }
else if((xd==xc)&&(xb==xa))
      {
         (*flag) = 0;
         return;
      }
else
     {
       real k1, k2;
       k1 = (yd-yc)/(xd-xc);
       k2 = (yb-ya)/(xb-xa);
       if(fabs(k2)>=fabs(k1))
   {
     if(k1==k2)
     {
        (*flag) = 0;
        return;
     }
      (*flag) = 1;
      (*t1) = (-k1*(xc-xa)+(yc-ya))/((yb-ya)-k1*(xb-xa));
      (*t2) = ((xb-xa)*(*t1)-(xc-xa))/(xd-xc);
     }
  else
     {
       (*flag) = 1;
       (*t2) = (-k2*(xc-xa)+(yc-ya))/(-(yd-yc)+k2*(xd-xc));
       (*t1) = ((xd-xc)*(*t2)+(xc-xa))/(xb-xa);
     }
    }
       return;
       }

and the value returned is used to update the mesh point if the following condition is satisfied

  if(((flag==1)||(flag==2))&&(t1<=1+cal_small_number(j))&&(t1>=-cal_small_number(j))&&(t2>=0))

  {
     (*x) = (1-t1)*pt1[0] + t1*pt2[0];
     (*y) = (1-t1)*pt1[1] + t1*pt2[1];
      return;

  }

please can some recognize what t2 is and correct me if my thought about t1 is wrong,The point(*x,*y) i get is the intersection point between two lines

sentences:
How can I implement a directional melee attack? I am attempting to make a top down game similar to the SNES Zelda games, in Unity 4.3, in 2D. When my character swings their sword, every enemy within a radius takes damage. I want to make sure that melee attacks only damage enemies the player is facing.

How can I do this?

The relevant code in PlayerAttack.cs looks like this:

// Update is called once per frame
void Update () {
    // have the player initiate an attack on the object
    if(Input.GetKeyUp(KeyCode.F)){
        MeleeAttack();
    }
}

private void MeleeAttack(){
    // create a variable called distance to make sure the distance is close enough
    // to inflict damage from a melee attack target.transform.positon = the position
    // of the object to attack and transform.position is the position of the players
    // transform
    float distance = Vector3.Distance(target.transform.position, transform.position);

    // make sure the distance is not greater than 1.5 so the player cannot
    // melee an enemy from to far away
    if(distance < 1.5f){
            // get a reference to the enemy's health script and type cast it.
            EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
            // now call the function that will decrease the enemy's health
            eh.AdjustCurrentHealth(-10);
    }
}

sentences: Would using Lua scripts to define game logic for an MMO server be a lot slower than compiled in C++? I am using an entity system for my MMO server and I was thinking about defining the behavior of "actions" using Lua scripts. The server is written in C++. I am not very familiar with the speed/memory usage of Lua in C++ but I have used it for scripting the GUI of the client. Would using Lua to define the game logic on the server side cut the performance by a lot?

sentences:
Programming Dynamic 3D Water/Waves? I'm a little bit stuck on how I might go about programming dynamic, interesting water in a game. To qualify that a little bit, I'm interested in creating water with broad, rolling waves that affect collision, physics, and the visual shape of the mesh. As an example, here's a screenshot from Wave Race 64, a 1996 jetski racing game for the Nintendo 64!

In Wave Race, not only do the waves move visually, but the choppy water pushes your vehicle around and creates bumps that give the game a really fun and unique feeling. I imagine that this type of thing is pretty standard in water simulation and physics, but I think the 'arcadiness' of the water physics in Wave Race makes it a pretty decent example.

I'm not really sure what steps need to be taken to create this effect though. I imagine that the visual effect of waves would be pretty simple to do create using a vertex shader, but I'm uncertain on how to program the physical 'entity' of the water. Here are some of my exact sticking points:

What might the data structure of that water look like?
And how does one 'animate' the physics/collision while keeping the visual mesh deformation in sync?

I have some "starting point" ideas, like possibly using a 2D or 3D vector field for the water. But I'm still fuzzy on the general implementation of fluid simulations, especially as a gameplay element!

sentences:
What is the best method to update shader uniforms? What is the most accepted way for keeping a shader's matrices up to date, and why?

For example, at the moment I have a Shader class that stores the handles to the GLSL shader program & uniforms. Every time I move the camera I then have to pass the new view matrix to the shader, then every different world object I must pass it's model matrix to the shader.

This severely limits me as I can't do anything without having access to that shader object.

I thought of creating a singleton ShaderManager class that is responsible for holding all active shaders. I can then access that from anywhere and a world object wouldn't have to know about what shaders are active just that it needs to let the ShaderManager know the desired matrices but I'm not sure this is the best way and there's probably some issues that will arise from taking this approach.

sentences:
Compute normal based on Voronoi pattern I am applying a 3D Voronoi pattern on a mesh. Using those loops, I am able to compute the cell position, an id and the distance.

But I would like to compute a normal based on the generated pattern.
How can I generate a normal or reorient the current normal based on this pattern and associated cells ?

The aim is to provide a faced look for the mesh. Each cell's normal should point in the same direction and adjacent cells point in different directions. Those directions should be based on the original mesh normals, I don't want to totally break mesh normals and have those points in random directions.

Here's how I generate the Voronoi pattern.

float3 p = floor(position);
float3 f = frac(position);
float id = 0.0;
float distance = 10.0;

for (int k = -1; k <= 1; k++)
{
    for (int j = -1; j <= 1; j++)
    {
        for (int i = -1; i <= 1; i++)
        {
            float3 cell = float3(float(i), float(j), float(k));
            float3 random = hash3(p + cell);
            float3 r = cell - f + random * angleOffset;
            float d = dot(r, r);

            if (d < distance)
            {
                id = random;
                distance = d;
                cellPosition = cell + p;
                normal = ?
            }
        }
    }
}

And here's the hash function :

float3 hash3(float3 x)
{
    x = float3(dot(x, float3(127.1, 311.7, 74.7)),
        dot(x, float3(269.5, 183.3, 246.1)),
        dot(x, float3(113.5, 271.9, 124.6)));

    return frac(sin(x)*43758.5453123);
}

sentences:
How do I get XNA Game Studio 4.0? I want to get started with XNA game development, and I have bought the Pro edition of Visual Studio 2010 so I have the required software to run XNA Game Studio.

How do I get it? Is it released yet?
Is it a free download on some Microsoft site?
Do I have to pay anything? Where?

Edit:
Is this it?

sentences:
Colors for villains, good guys and neutrals I am looking for 4-6 color schemes for three factions, good, evil and neutral (in a space strategy if that matters). I'd like the player to choose which side they want to play and each side will have an optional ally. Each team can have one or two colors (major/minor), if that makes the problem easier.

EDIT: I know that color perception can be subjective, context sensitive and influenced by culture. I am looking for a scheme that majority of players would see as a traditional fight between Good and Evil (Blue and Red comes to mind when having only two colours, two factions).

Based on this article about movie faction colour I'd pick:

Good: Blue (player) + Gold (ally)
Neutral: White (player) + Grey (ally)
Evil: Red (player) + Black (ally)

But something doesn't feel right about the scheme. Maybe it's the absence of color and using three shades of gray. Also it will be impossible to create gray and black "lights", "aura" and similar effects.

sentences:
Render with multiple lights (one pass per light) I have already a system that at the moment handle multiple lights just passing an array of light struct and loop through it. I had been told to switch to a multipass rendering approach. How should I do this in an efficient way? Can you link me to some resources about this?

I cannot switch to defferred rendering.

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:
Is there any opengl cel shading tutorial out there (without GLAUX)? I want to implement cel shading into my opengl game. I have only found a nehe tutorial that uses glaux (old as hell). I'm looking into it, but I wanna avoid the pain of learning how to translate those old glaux functions/variables. Is there any cel shading tutorial out there that uses glut/sdl?

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=37

sentences:
Multi-pass rendering using FBO and combining resulting textures I need to render a 3D scene and then several 2D panels that i need to compose on top of the 3D render. I looked on the web for some resource that would show how people do that but couldn't find any. In my case, I don't want to use the fixed pipeline but shaders. So here is what I do:

Create FBO and 2 textures (say)
Attach texture1 to COLOR_ATTACHMENT0 and texture2 to COLOR_ATTACHMENT1
Render-loop {
    bind FBO
    draw into COLOR_ATTACHMENT0
    clear buffers (depth and color)
    render objects

    draw into COLOR_ATTACHMENT1
    clear buffers
    render the objects that will be the 2D overlay

    draw into default frame buffer
    draw quad to display combination of texture1 and texture2
}

in the quad shader I get the 2 textures and do an alpha blending using the alpha channel of the second texture.

So my question (simple):

Is this how you typically draw different scenes/content into different textures that you can combine into a final pass before displaying the results to the frame buffer? More specifically do you use the mechanism of attaching textures to different color attachment points in the render loop, then active the point you want to draw to (COL0, COL1, etc.) and then combine the textures in the end? Is that how it's typically done?

sentences:
Strange artifacts when using gl_FragCoord to access texels I ran into a problem with using gl_FragCoord variable to access texels. The problem can be illustrated by following example:

First I render a textured quad into texture of size (W, H) where W and H are viewport width and height correspondingly. Then I draw another quad with lower left corner in (0, 0) and upper right corner in (W, H) (so that it effectively takes whole viewport) which is textured with this texture. Let's call it quad A. Then I draw another quad (let's call it quad B) on top of it, with lower left corner in (0, H1) and upper right in (W, H) and also use the same texture for it. The whole scene can be illustrated by this picture:

As you can see, the bottom part of the first quad lays in quad A and a top part in quad B. Thus when I experiment with fragment shader for quad B I can see whether the top part of the quad matches the bottom part.

Now to the problem:

When in fragment shader for quad B I use

gl_FragColor = texture2D(u_backgroundTexture, v_texCoord);

(v_texCoord is (0, 0) for lower left corner and (1, 1) for upper right)

to determine fragment color, everything is fine. Top and bottom parts of the first quad perfectly match each other:

However, when I change this line to:

gl_FragColor = texture2D(u_backgroundTexture, gl_FragCoord.xy / u_resolution);

(where u_resolution is a vec2(W, H))

the top and bottom parts of the quad doesn't match anymore. If I render that quad close to right edge of the screen I get following artifacts:

and if I draw it close to the left side artifacts looks like this:

Could anyone please explain what are the possible causes for such artifacts? Apparently I am missing some fundamental understanding of how texturing works, since in my mind texture2D(u_backgroundTexture, v_texCoord) should be completely equivalent to texture2D(u_backgroundTexture, gl_FragCoord.xy / u_resolution); in my case.

P.S. Obviously, for quad A I always use gl_FragColor = texture2D(u_backgroundTexture, v_texCoord) in fragment shader.

sentences:
How do I share a downloadable WebGL build in Unity? When I make a WebGL build for my project, I get a folder that lets me click a .html to play my game in a browser.  Is there a way I can share a folder like this for playtesters?
I tried sending a .zip folder to playtesters, but they only got a Unity loading screen that didn't do anything.

sentences:
how to dent & deform damaged objects in unreal engine? I am trying to simulate damages in cars using unreal engine when a body collides with it like it is done in this video - https://vimeo.com/162729920

I am trying to do it in the first person shooter game template, so that i can shoot projectiles at the object. but the object just moves and doesn't dent. I tried creating a destructible mesh but that cause the object to break down into pieces. I want it to dent when i apply a force to it. Could someone point me in the right direction?

sentences:
How to make my 2D character stand normally on slope? I've got this character in Unity3D (2D Mode)...
in a a slope which looks like this,

But I want the character to stand along the red line..Like below

How can I make it in Unity3d?

I've got this setup..

I'm using simple Addforce for movement...
If I remove the z position constraint it results in weird movement like rolling and so on....
Any help would be appreciated :)

sentences: Using an iPhone as a controller for a flash game How can I use an iPhone as a controller for a flash game, as described here?

sentences:
I don't understand code that builds 3D sphere I'm trying to learn some lwjgl and opengl, and I was trying to make a 3d sphere etc, I found a code to do that, but I don't 100% understand the code and the math behind it and would like to get some deeper explanation about it.

This is my draw sphere method:

public void drawSphere(float radius) {
    final float PI = 3.141592f;
    float x, y, z, alpha, beta;
    int gradation = 100;
    for (alpha = 0.0f; alpha < Math.PI; alpha += PI / gradation) {
        glBegin(GL_TRIANGLE_STRIP);
        for (beta = 0.0f; beta < 2.01f * Math.PI; beta += PI / gradation) {
            x = (float) (radius * Math.cos(beta) * Math.sin(alpha));
            y = (float) (radius * Math.sin(beta) * Math.sin(alpha));
            z = (float) (radius * Math.cos(alpha));
            glTexCoord2f(beta / (2.0f * PI), alpha / PI);
            glVertex3f(x, y, z);
            x = (float) (radius * Math.cos(beta) * Math.sin(alpha + PI / gradation));
            y = (float) (radius * Math.sin(beta) * Math.sin(alpha + PI / gradation));
            z = (float) (radius * Math.cos(alpha + PI / gradation));
            glTexCoord2f(beta / (2.0f * PI), alpha / PI + 1.0f / gradation);
            glVertex3f(x, y, z);
        }
        glEnd();
    }
}

I understand the general idea of this, and I understand how the x, y, z are calculated, but what I don't understand is the 2 nested loops aka:

for (alpha = 0.0f; alpha < Math.PI; alpha += PI / gradation)

and

for (beta = 0.0f; beta < 2.01f * Math.PI; beta += PI / gradation)

One more thing, is the glTexCoord2f that I don't quite understand the math behind it, so an explanation about this would be really nice as well for:

glTexCoord2f(beta / (2.0f * PI), alpha / PI);

and

glTexCoord2f(beta / (2.0f * PI), alpha / PI + 1.0f / gradation);

sentences:
A guide on multi-direction and multi-animation sprites? In YoYo Game Maker Studio: Is there a way (or an already-created library) I can specify all the possible sprite frames and directions in a way I am allowed to do it in Clickteam Fusion?

As far as I read in the docs, I create Sprite resources which are linear: An image resource can be loaded and read in columns and rows, but a single sprite is generated. However, what I want to achieve is the following:

Import a single image with layout like this:

llll
rrrr
uuuu
dddd

Meaning four frames per direction (left, right, up, down).
Allow my sprite to have four directions. In such case, the animation will involve just the row corresponding to the direction.
Allow the user to stay / not move. In such cases, I would use another image like this (most of the times it would be a subset of the former):

l
r
u
d

Question: Before doing it in the hard way (which for larger games I did in ActionScript already; I'm not net at all at coding) I would like to ask:

Is there an already supported way in the environment to do it? Like managing the related sprites as a set.
Alternatively: Any good 3rd party plugin which already does that?

I have no problem at all with coding the solution on my own, but honestly I would not like to reinvent the wheel.

sentences:
Controlling player and camera movement in a 3rd person game with keyboard and mouse In many action games with a third person view, joystick controls typically map the left joystick for player movement and the right joystick for camera movement (or more precisely camera's direction towards the character). With first-person games, mapping to mouse/keyboard is easy because the camera is directly influenced by the player's movement.  The player has to be able to look at any direction to point where he should go. Here is where the mouse comes in to provide this movement.

But the challenge I see is having separate camera and player controls with this setup. With a mouse/keyboard setup, it seems like I have to settle with a compromise, because the mouse is usually the only source for analog-like movement, whereas modern game pads have two sources, as separate joysticks.

One control scheme I had in mind is using A and D to change the player's heading as he travels through the world, leaving W and S to move forward/backward and the mouse free to move the camera. This still has a disadvantage, because you lack some degree to control how fast to change heading with the keyboard, unless you momentarily punch at the keys instead of holding them.

Is it possible to map the mouse and keyboard controls more intuitively for independent third person player and camera control?

sentences:
What is a good approach for making a relationship between the HUD and Environment? What is an elegant / common way to build a relationship between the game scene / environment / world and the HUD that usually sits on top of it? I have thought about this for a while, and though there are ways to accomplish this that are easy to implement, they always seem to expose too much unrelated information between the two, or end up being too coupled. An example of this that I have used in the past would be to simply pass reference from the HUD to the Environment and vice-versa (which is obviously not a good apporach for many reasons, especially when aiming for low coupling).

What I want to end up with is a clean, uncoupled way to do things like:

From the HUD; reference and manipulate objects within the environment, change the state of the Environment itself.
From the environment; update the HUD to reflect the current state of the environment.

Maybe passing reference between the two is the way to go about this, but I feel like there's some pattern that I am missing for this type of task. Any insights into past experience and implementations concerning this type of problem would be very helpful.

sentences:
Determining whether a large building should be split into multiple scenes This is about designing a first person retro game in Unity3d. In this game the player would walk around inside a large maze-like building that has corridors on 10-15 different floors.

Each floor has a corridor that is set up as a square that surrounds all other corridors (which are set more or less randomly, like a maze) on that particular floor. The length of each side of this surrounding corridor is about 100 steps.

So, considering that this building would have about 10-15 floors constructed like this, the question I wanted to ask is whether it can be included as a single scene?

Or does the answer to this depend also on other factors such as the type of game assets and target devices?

sentences:
Rendering order of shadowing point lights? I'm implementing shadow mapping in my deferred rendering engine. I've got spot lights working, and now I'm working on point lights. Currently, I do it like this:

// Loop through the point lights
for each point light do

    Loop through "directions"
    for I = 1, 6 do
        Render the shadow map for direction 'I'
        Render the point light
    end
end

This works fine, but is this sub-optimal? Should I instead render all the shadow maps at once? If so, how would I handle all the shadow maps at once in the second phase when rendering the light volume?

sentences:
Shadow map: depth texture always returns 0 I'm implementing a shadow map for the sun light in my voxel engine using a depth texture attached to a framebuffer. But when I sample the depth texture during the normal pass, the value returned is always 0.

Here is the shadow map initialization :

    // Create and configure the depth texture
    shadowMapTextureId = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, shadowMapTextureId);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_DEPTH_COMPONENT, shadowMapWidth, shadowMapHeight, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (FloatBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL13.GL_CLAMP_TO_BORDER);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL13.GL_CLAMP_TO_BORDER);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_MODE, GL30.GL_COMPARE_REF_TO_TEXTURE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_FUNC, GL11.GL_LEQUAL);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    // Create the framebuffer and attach the depth texture
    shadowMapFramebufferId = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, shadowMapFramebufferId);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, shadowMapTextureId, 0);
    GL11.glDrawBuffer(GL11.GL_NONE);
    GL11.glReadBuffer(GL11.GL_NONE);

    if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE)
        Voxer.error("Shadow map framebuffer creation");
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

And the fragment shader sampling the depth texture :

    #version 330 core

    uniform sampler2DArray diffuseTextures;
    uniform sampler2D shadowMap;

    in vec3 pass_TextureCoord;
    in vec4 pass_ShadowCoord;
    in float pass_Lighting;

    out vec4 out_Color;

    void main(void)
    {
        out_Color = texture(diffuseTextures, pass_TextureCoord);

        float shadowFactor = 1.0;
        vec4 shadowCoordPostW = pass_ShadowCoord / pass_ShadowCoord.w;

        if (pass_ShadowCoord.w > 0.0f && shadowCoordPostW.x > 0 && shadowCoordPostW.y > 0 && shadowCoordPostW.x < 1 && shadowCoordPostW.y < 1)
        {
            float shadow = texture2D(shadowMap, shadowCoordPostW.xy).x;
            float epsilon = 0.00001;
            if (shadow + epsilon < shadowCoordPostW.z)
                shadowFactor = 0.5;
            // I can replace with this to show that the value is always 0
            // if(shadow == 0)
            //  shadowFactor = 0.5;
        }

        out_Color.rgb *= shadowFactor * pass_Lighting;
    }

I use the same projection matrix for the main camera and the sun camera (it's a perspective matrix), so I know the terrain is in the view frustum.

I used this example : https://github.com/cforfang/opengl-shadowmapping

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:
RevoluteJoint Stop Rotating when Some Physics Body Collide in Andengine + Box2d? I am making a Game from andengine + box2d in Which i am using RevoluteJoint in that case i am facing some problem that when physics body or Sprite Collide with this Revolute joint body then Revolute body stop rotating then after some time it start rotating
I am using below code for this :

     this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(movingFace, movingBody, true, true));

         final RevoluteJointDef revoluteJointDef = new RevoluteJointDef();
         revoluteJointDef.initialize(anchorBody, movingBody, anchorBody.getWorldCenter());
         revoluteJointDef.enableMotor = true;
         revoluteJointDef.motorSpeed = 100;
         revoluteJointDef.maxMotorTorque = 200;

         this.mPhysicsWorld.createJoint(revoluteJointDef);

EDIT Here is a screenshot:

sentences:
How to achieve smooth movement with a fixed timestep Previously in the update method of my game I was using a variable time step which provided very smooth movement of a player sprite except when the frame rate would drop, even slightly. At that point I would end up with the sprite making a noticeable lunge forward. I tried averaging the delta to make it less noticeable but wasn't satisfied.

So I've been trying to implement a fixed time step using the code provided in the article http://gafferongames.com/game-physics/fix-your-timestep/ as an example.

double t = 0.0;
const double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

State previous;
State current;

while ( !quit )
{
     double newTime = time();
     double frameTime = newTime - currentTime;
     if ( frameTime > 0.25 )
          frameTime = 0.25;
     currentTime = newTime;

     accumulator += frameTime;

     // ***** Is this where I should add acceleration to the current state velocity? *****
     // current.v += Player::MoveAcceleration * frameTime;

     while ( accumulator >= dt )
     {
          previousState = currentState;
          integrate( currentState, t, dt );
          t += dt;
          accumulator -= dt;
     }

     const double alpha = accumulator / dt;

     State state = currentState*alpha + previousState * ( 1.0 - alpha );

     render( state );
}

In this example where would I add to the velocity? As I noted in the code comment, I am currently adding it prior to the integration loop, but the sprite movement is now consistently lunging forward each frame and is not smooth at all. Even when lowering the acceleration it is still there, and is not a solution anyway as I want the player to be able to walk or run.

I hope this makes sense. I have read so many articles over the last couple weeks and tried many combinations but nothing is working smoothly. I figure someone here must have a solid routine to achieve a fixed time step in a game with smooth sprite movement/animation.

Thanks

sentences:
Implementing a motorized hinge joint I have a 2d physics engine, with three boxes: "body", "left wing" and "right wing".
The wing boxes are connected to the body using a hinge joint. The physics world has no gravity.

I'm attempting to rotate the wings around their hinge connection, as if the joint is motorized but I'm not exactly sure how to achieve that. If I exert force with a downward vector on the center of the wings, the body itself flies down. This is undesirable. With an actual hinge motor, only the wings will rotate about the hinge, affecting the body only when they hit it.

Which forces should be added to the wings, and at which origin points?

I'm using Phaser.io, with P2.js physics, but the question is platform-agnostic.

sentences:
How to move objects across a canvas with consistent speed on different screen resolutions? I am making a rhythm game in Unity. I have been using Transform.Translate for moving images on a canvas as the music notes. However, I cannot consistently use this method on different screen widths. The notes move the same amount each frame.
I want to use interpolation for my music notes. I want to have the notes reach the center of the canvas at the same time despite the width of the screen. How can I write such a script?

sentences:
Create ROI tools for analysis I want to create some ROI tools on my game for personal analysis.

Let's say that I have 3 different level of special powers with a recursive cost and certain bonus. So, I want to see when certain level will start have income.

1st example: 1000 coins for 10 uses. Bonus: +10% on farming speed. 2000 coins for 10 uses. Bonus: +20% on farming speed. Etc

In this example, I know exactly what the bonus will do. I have the price of the farming per unit and I can calculate the income per use for each power level. So, I can tweak the numbers using the ROI tool to make the effect better.

2nd example: 1000 coins for 3 power ups on a weapon. Bonus: +1 attack power, +5% chance to destroy the weapon. 2000 coins for 3 power ups on a weapon. Bonus: +2 attacking power, 10% chance to destroy the weapon.

3rd example: 1000 coins per use. Bonus: 30% heal, 5% chance to get injured. 2000 coins per use. Bonus: 50% heal, 10% chance to get injured.

As you can see, the first example is simple to calculate the income vs cost. However, the second and third example don't have an exact effect and both of them have a probability to either good or bad effect. How do you work on this type of ROI? How do you calculate the pros of each level?

sentences: MonoGame: prevent command prompt in windows? Is there a way to prevent the command prompt from opening in windows when launching the game (via double clicking)?

sentences:
How to create fun and interactive menus with cocos2d? Possible Duplicate:
  How to make animated buttons in a menu with Cocos2d?

How do I make fun and interactive menus with cocos2d, all the tutorials are just for simple clickable menus. Can any one help me learn this?

It would be see the menu flip or slide away, I know you can do this with scenes but how do I make this with just the menu?

Let's say the menu is a bunch of cards and I want them to flip over like the sub-menu is on the backside of the card, how would I do this?

Or, make the Main menu slide in from the left, right, top or bottom side and then when a button is selected it slides away the same way and switch to a sub-menu (settings, Score etc)?

Anyone?

David

sentences:
Is "Check your surroundings" warning on splash screen really needed for geolocation games? I'm currently building an Android game as a solo dev. It follows the trend of geolocation-based games (like Niantic), but with more unique aspects.

Anyway, I noticed that in Niantic games - Ingress, Pokemon Go - there's always a "check your surroundings" or "don't drive and play" kind of warning to the player in the splash screen. I'm afraid that it might have something to do with legal implications regarding people being trampled or fall to their death while playing.

While I'm definitely not a fan of losing my player base / cause pain and sorrow to their families, I still see no reason to add this to my game. Because let's face it, people promptly ignore warnings like that and play the way the want in the end.

My case is somehow different from most geolocation games, in the sense that one of its unique features is that you don't need to keep looking at the screen to play. In case it helps to clarify how it works here is the play store's link: https://play.google.com/store/apps/details?id=com.arvere.theforage (I'm not sure if this is compliant with SE's rules, if it isn't, I ask to some mod to remove it, please)

So, would there be any reason (besides legal security) to do this in a game like mine?

sentences:
SDL2 Mouse Camera Movement I've been trying to build a 3D camera system in SDL2 with OpenGL so that I can use the mouse to look around. With glfw it's possible to trap the mouse in the window, and keep it centered with a library call, so I was looking for something equivalent in SDL2.

In order to process mouse events in the main loop I'm checking for SDL_MOUSEMOTION.
Searching around the web, I've found that SDL2 allows for mouse trapping with the call to SDL_SetRelativeMouseMode(). With this call, though, the mouse is trapped and limited to move within the window, and not just at the center. This causes the mouse to be able to move from the top left corner at (0,0) to the bottom right corner at (WIDTH,HEIGHT), and not any further.

I've tried to fix this by repositioning the cursor position with SDL_WarpMouseInWindow(), but this generates a SDL_MOUSEMOTION event as well, basically resetting any movement I might've tried to do.

How can I fix this?

sentences:
Pygame for python 3.5? I just got Python 3.5 from...
LINK: https://www.python.org/downloads/windows/

previously i had Python 3.4 and the Pygame version 1.9.2a0. It worked perfectly. However, my the new Python 3.5 isn't compatible with that version of Pygame that i had gotten for the 3.4. I Found the latest Pygame file at...
LINK: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

I downloaded the Pygame file, however, it is a .whl format file. What am i supposed to do?

I have tried looking it up all day yesterday. So far all i've figured out is something about pip and wheel and doing some commands like 'pip install' etc. etc. but i am completely lost. I never knew about pip or any of that before.

I am not even sure if there is a version of Pygame that works with Python 3.5, but i did try to find out by looking it up but i never found such information. All i want is to get Python 3.5 up and running with Pygame and for it to work just as fine as it used to when i had Python 3.4. If Pygame is yet to be compatible with Python 3.5 thats fine, i'll just reinstall python 3.4 and the according pygame file for it.

sentences:
Video playback on mobile: can't seek to the end My Unity3D game needs to play videos on mobile devices (using Handheld.PlayFullscreenMovie()). Seeking works badly. If I tap the video progress bar near the end (expecting it to play the last second then finish), playback jumps back a full 10-20 seconds, depending on the video. What should I try to make it easier for the player to seek within the file? Force additional key frames?

I'm currently encoding with HandbrakeCLI and the following settings:

--preset="AppleTV" --x264-tune=animation --x264-preset=veryslow

sentences:
how to draw a dashed path in Javascript I need to draw a brick curved path but i need to be able to put an arrow pointing to any a brick by API. something like this:

i thought to use canvas but i'm not sure i can get a reference to each brick and fire events.

sentences:
Objects Imported from Blender to Unreal have really zoomed Materials I've been learning how to use Blender for UE4. I just started figuring out how to define which sides should have materials on them. In particular, I wanted this building to have different materials for the sides and top. However, when I apply the Materials, they're very zoomed in.

At first I thought it was a scale issue, but Unreal supposedly converts the models from FBX units to Unreal units. The scale of the model is exactly the same as the one I made in Blender. And yet, I have this issue.
Since it seemed like a conversion of units issue, I made sure to change Blender to also use centimeters just like Unreal, with no scaling or conversion, and yet the issue still arises. I have tried to find a way to shrink the material, with no luck. It seems the only way to do this would be to copy the texture and modify it, but that seems unnecessary. If I wanted to use the same building with a different material, I'd need to do that over and over again.
Is there something I'm missing when Exporting from Blender and Importing into UE4?
I am using Unreal Engine 2.25.1, and Blender 2.83.1
Thanks for your help!

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 to detect Unity UNET errors? I'm working on a simple multiplayer online game. and I use UNET and Networkmanager.

In my game I have some rooms and players that they can join to this rooms by connecting to specific server.exe file that I runned on a dedicated server.

My problem is when I use port 7777 for first server, if I run another server, then this error Appear :

  Cannot open socket on ip{*},and port{7777}

For now I solved this issue by building servers with specific ports.
for example in server1.exe I used port 7777 by default.
and server2.exe , 7778 and same for other servers .

But I want to do this automatically. I mean when the server recognize port 7777 is busy , then increase port number.

I want to know can I use try catch for this kind of errors ?
because I used try catch but it's not work.
I don't know how to use it. this is part of my code :

try
    {
        StartServer();
    }
    catch(Exception ex)
    {
        networkPort++;
        //then change port number and run server again
    }

I just looking for a way that my servers run by choosing right port automatically.

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: DirectX the same across platforms? Various versions of DirectX are available on both Windows and Xbox. Are the libraries the same on both platforms? Obviosly I'm talking about the interfaces — such as the ones for working with windows, input, etc —, not their actual implementation.

sentences:
How can I read a portion of one Minecraft world file and write it into another? I'm looking to read block data from one Minecraft world and write the data into certain places in another.

I have a Minecraft world, let's say "TemplateWorld", and a 2D list of Point objects. I'm developing an application that should use the x and y values of these Points as x and z reference coordinates from which to read constant-sized areas of blocks from the TemplateWorld. It should then write these blocks into another Minecraft world at constant y coordinates, with x & z coordinates determined based on each Point's index in the 2D list.

The issue is that, while I've found a decent amount of information online regarding Minecraft world formats, I haven't found what I really need: more of a breakdown by hex address of where/what everything is.

For example, I could have the TemplateWorld actually be a .schematic file rather than a world; I just need to be able to read the bytes of the file, know that the actual block data starts always at a certain address (or after a certain instance of FF, etc.), and how it's stored. Once I know that, it's easy as pie to just read the bytes and store them.

sentences:
How to 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: Baking Key Frame Animation in Blender I have a rigged model using an armiture in blender, I was wonder how you could bake the animation as kayframed data so that I could remove the armiture and the model still walks without being rigged.

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:
How to share matrix in HLSL? I am trying to share this across multiple effect files:

matrix worldMatrix : register(vs_4_0, b0);

If I set this from one effect file, will it effect every effect file which has the same type of variable assigned to that specific register?
What is the difference between this and the cbuffer struct?

sentences:
GameMaker: how to let the game run as fast as it is able to? I am making a game/simulator where I want the game to, upon command, run as fast as the computer can handle, that is to say, if the game can run at 60 fps, don't run at 30 fps.

What should I do to make the game do that and would this even make sense?

(Note: when I looked at the built-in variable fps, I often see the value to be higher than the room speed I set, so I thought that maybe I can allow the game to run faster than the room speed initially set.)

sentences:
What is the best designed open source game engine to take example? Possible Duplicate:
  Where can I find good (well organized) examples of game code?

I have coded several C++ games and now I'm building my own game engine and editor.

I have some doubts about the design and I wish to find great examples to follow.

What is the best designed in your opinion?

Must be object oriented. Programming language does not matter, but I prefer in this order: C++, C#, Java or another similar.

EDITED: To clarify more, I'm not interested on game-specific code. I want general purpose game engines.

EDITED: This article explains what is a game engine: game engine at wikipedia and here is a list of known game engines: list of game engines at wikipedia

sentences:
Unintended stuttering when moving camera I am using opengl and GLFW to make a rendering engine.

Things work per se, but there is some weird flickering happening when I move the camera.

Due the nature of the problem I need to link a youtube video:

https://www.youtube.com/watch?v=XhFrXadnWbs&feature=youtu.be

If you pay attention you will see the stuttering happening as I move the camera.

I beleive this problem occurs due to how I have implemented my camera movement, which is:

GLFW key callback:

#define CAM_SPEED 0.2f
void static key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if(key == GLFW_KEY_W)
    {
        c.translateForward(CAM_SPEED);
    }
    if(key == GLFW_KEY_S)
    {
        c.translateForward(-CAM_SPEED);
    }
    if(key == GLFW_KEY_A)
    {
        c.translateSideways(-CAM_SPEED);
    }
    if(key == GLFW_KEY_D)
    {
        c.translateSideways(CAM_SPEED);
    }
}

Camera code:

    void inline translateForward(float speed)
    {
        glm::vec3 hForward = forward;
        hForward.y = 0;
        hForward = normalize(hForward);

        position += hForward*speed;
    }

    void inline translateSideways(float speed)
    {
        position += side*speed;
    }

sentences:
trouble getting the lighting and material set up right I am having some trouble getting the lighting and material set up. Below I have setup lighting and material, however, when ever I turn on spectular reflection for material the sphere that I am rendering turns white with only a little of its colour in the corners. But if I don't turn it on I get approximately the right colour. I understand that specular reflection property of material is suppose to reflect light and make the object look shiny. But with a specular reflection value of {0.1,0.1,0.1,1} the difference seems to be really great. I don't think the picture below is what I want. Could anyone tell me what I am doing wrong here?

      glEnable(GL_LIGHTING);
      glEnable(GL_LIGHT0);
      GLfloat ambientLight[] = {1.0, 1.0, 1.0};
      GLfloat diffuseLight[] =  {1.0, 1.0, 1.0};
      GLfloat specularLight[] = {1.0, 1.0, 1.0};
      GLfloat position[] = { 10.0f, 10.0f, 10.0f, 1.0f };

      glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
      glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
      glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);
      glLightfv(GL_LIGHT0, GL_POSITION, position);

      GLfloat materialColor[] = {1, 0, 0, 1.0};
      GLfloat materialSpecular[] = {0.1, 0.1, 0.1, 1.0};

      //The color emitted by the material
      glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, materialColor);
      glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, materialSpecular);
      glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 10);
      // Perform OpenGL calls necessary to set up this material.

sentences:
How do I create a laser pointer dot in Unity URP? I want to replicate the laser pointer dot as in RE4:

Here is a video that shows the laser in action.
I have tried to replicate it using a spotlight. The problem with the spotlight is that its size can only be controlled by its distance to the object. I'm struggeling really hard with keeping it at just the right distance.
Since this is such a big problem, I would first of all like to ask if a spotlight is the preferred way to create such a laser dot.
Thank you.

sentences: Common mistakes when developing a game with Socket.io and Node.js I am not a game developer by trade but am working on a card game (that is real time, not turn based).  I was wondering what the common mistakes are that people make when new to this sort of development so that I can avoid them!

sentences:
A good beginners' game engine to run on linux I am involved with a research that deals with 3D graphics. I am very new to 3D graphics. In my research I have to move a 3D object based on some information queried by processing a video. Viewer's only interaction with the 3D environment is, changing the camera viewpoint.

I am not that worried about the speed or efficiency at this level. What I need is easy to learn and easy to program 3D game engine, I suppose.

I'd like to know about any open 3D model file format supported by the game engine, as I will have to use custom made 3D models using 3D modelling techniques of computer vision.

I tried Panda3D, but the most significant drawback was it's inability to use .max files directly (most of the 3D models available were of this format). Panda3D was quite simple when it came to scripting.

Thank you in advance.

sentences:
How to create random seeds, randomly in gamemaker studio? So, I'm working on a match-3 game similar to Ironcast (in concept, it's just seeing if I can). I've finally got the board to generate properly, and to place down random gems. Problem is, it's always generating the same placement, as though it were seeded (which it isn't, as far as I know).

Here's the code that directly generates the randomness (scr_generate_gem).

var insert = irandom_range(1, 4);//randomizing the gem inserted
var gem_insert;

        switch (insert)
        {
        case 1: gem_insert = obj_Food;
        break;
        case 2: gem_insert = obj_Fuel;
        break;
        case 3: gem_insert = obj_Parts;
        break;
        case 4: gem_insert = obj_Meds;
        break;
        default: gem_insert = obj_Parent;
        break;
        }

return gem_insert;

And here is where it's used.

//hardcoded height and width of the board. could change later
Large_Width = 6;
Large_Height = 6;

var i = Large_Width-1; //5, at the moment
var jreset = Large_Height-1; //5. Used to keep a reference to when j
//needs to be reset to maximum, so the board fills out.
var j = jreset;

repeat(Large_Width) //repeat 6 times; i goes from 5 to 0 through repeats
   {
    repeat(Large_Height) //repeat 6 times; j goes from 5 to 0 through repeats
    //ends up repeating this repeat 6 times, because of the above Repeat, making 36 in total
        {
        //initialize the board by generating the objects
        BoardGems[i, j]  = instance_create((i-1)*36, (j-1)*36, scr_generate_gem()); //creates an object, and places it here
        j -= 1;//decrement j so we aren't overwriting the last object created.
        }
    j = jreset;//resets j
    i -= 1;//decrements i to make a new column
   }

sentences:
How to draw texture to screen in Unity? I'm looking for a way to draw textures to screen in Unity in a similar fashion to XNA's SpriteBatch.Draw method. Ideally, I'd like to write a few helper methods to make all my XNA code work in Unity. This is the first issue I've faced on this seemingly long journey.

I guess I could just use quads, but I'm not so sure it's the least expensive way performance-wise. I could do that stuff in XNA anyway, but they made SpriteBatch not without a reason, I believe.

So I see there is some sort of GUI notation in Unity. Maybe I could efficiently draw everything using it?

sentences:
How important is Programming for a Level Designer? I'm currently attending school in a Level Design program, and I was wondering how important programming really is in being a Level Designer?

I'm apparently incapable of learning programming (despite my best efforts), and tend to do very well in all other courses 3D modelling, story/character design, narrative and dialogue writing, environmental and conceptual design etc.

I'm wondering if my strengths in the other areas are enough (with practice) to let me become a Level Designer, or I'm wasting my time if I can't program?

I really want to be a Designer, but I just can't seem to wrap my head around the "language" of programming in general (Java kicks my teeth in even with tutoring and additional work on my own).

sentences:
Directx11 create Texture2D using subresourceData I'm trying to create immutable texture in d3d11 so I want to use subresourceData, every tutorial on textures creates them with 2nd argument being null and after that updates subresource but I want to create it using the 2nd argument.
This code works:

hResult = m_device->CreateTexture2D(&textureDesc, NULL, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

int rowPitch = textureWidth * 4;
m_deviceContext->UpdateSubresource(m_cubeTexture, 0, NULL, &(decodedTexture[0]), rowPitch, rowPitch * textureHeight);

And this does not:

int rowPitch = textureWidth * 4;
D3D11_SUBRESOURCE_DATA tSData;
tSData.pSysMem = &(decodedTexture[0]);
tSData.SysMemPitch = rowPitch;
tSData.SysMemSlicePitch = rowPitch * textureHeight;

hResult = m_device->CreateTexture2D(&textureDesc, &tSData, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

DirectX11 debug layer outputs this:

D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[3].SysMemPitch cannot be 0 [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]
D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[5].pSysMem cannot be NULL. [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]

Which I don't understand since it's not even an array and texture array size is set to 1

sentences:
Multiple Object Collision SDL I figured this is would be the correct place to ask the following ...

1) How would I go about making multiple object collision detection (Bullets For Example)?

2) How would I make it efficient enough so that I can have many objects be able to detect collision of other objects.

The only idea I currently have is for each bullet to iterate through the other game objects and check collision individually. But that could/would have a terrible impact on time, considering that there can be many objects in the scene. I have also considered multi threading, but I really don't know how to apply it in game programming. Any Suggestions?

sentences:
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:
XNA 4.0 Model into parts is there a way to split a .fbx model into parts, and move those parts individualy in XNA 4.0 ?

Thanks

sentences:
Multiplayer game sdk for ios and android I am working on a multiplayer game supporting Android and IOS.

For IOS Game-Center seems promising. But its IOS only.

OpenFeint could be a option, but now GREE has stopped supporting it.

Is there any other multi-platform SDK which I can use for both IOS and Android?

---------EDIT------

I could not find any good service which provides their own server and SDK for both IOS and android. So finally I chose to go with my own server on AWS-EC2 + python tornado + Websocket. If anyone want to know more plz contact...

sentences:
What method replaces GL_SELECT for box selection? Last 2 weeks I started working on a box selection that selects shapes using GL_SELECT and I just got it working finally.

When looking up resources online, there is a significant number of posts that say GL_SELECT is deprecated in OpenGL 3.0, but there is no mention of what had replace that function.

I learnt OpenGL 1.2 in back in college 2 years back but checking wikipedia now, I realise we already have OpenGL 4.0 but I am unaware of what I need to do to keep myself up to date.

So, in the meantime, what would be the latest preferred method for box selection?

EDIT: I found http://www.khronos.org/files/opengl-quick-reference-card.pdf on page 5 this card still lists glRenderMode(GL_SELECT) as part of the OpenGL 3.2 reference.

sentences:
Rotating objects in an random rotation around center point I almost have what I'm looking for. Still trying to understand rotation and spawning of objects.

I have a ground field with a number of spawn points (and they are placed randomly in a circle). It's working quite well.

I have the issue tho, that I'm spawning them in an angle I'm not intending to and I have troubles finding the issue and understanding the math to it.

This is what it looks like:

I want the rocks to be spawned around the circle on the ground, not 90° to it.

I have the following code:

Vector3 RandomCircle(Vector3 center, float diameter) {
    float r = diameter / 2;
    float ang = Random.value * 360;
    Vector3 pos;
    pos.y = center.y + r * Mathf.Sin(ang * Mathf.Deg2Rad);
    pos.x = center.x + r * Mathf.Cos(ang * Mathf.Deg2Rad);
    pos.z = center.z;
    return pos;
}

sentences:
Animations with Model View Controller I'm currently wondering how to properly structure game code.

I have come across MVC (Model View Controller) method/approach, which seams to be a decent way to get a good extendable structure.

However, I'm wondering how one should put in animations and visual transitions into this model?

The simples example I can think of is Tetris.

In many newer Tetris clones, if a line is cleared, before it's removed from the screen, it sometimes flashes in different colors for visual effect. Where does this fit in the model?

The way I understand is that MVC has a controller that should update the board state, and if one line is full, it should be removed, yet the model would do this in a single frame? The view should not interact with the model, so what would be a good way to make these visual effects appear without loosing the benefits of decoupled logic and rendering?

Sorry if this is an ill posed question.

Thanks in advance : )

sentences:
How can I generate mesh distance fields at runtime on a procedural mesh in unreal engine 4.26? I am building a simulation game that and I that allows the player to create procedural buildings rather than placing static scenery items. If possible, I would like to write a shader that can take the vertices, normals, tangents, etc. and generate an identical mesh distance field so that I can leverage UE4's distance field ambient occlusion and so that various materials can detect generated geometry.
One project that appears to successfully achieve this is the Voxel Plugin. I have looked at the source but I am stumped as to where to start. I failed to find solid resources about this topic online. However, I did find this resource techniques to generate distance fields but this is not clear enough. I Any help is much appreciated. Thank you.

sentences: How to get our music into games? As a fairly unknown independent band, what is the best way to get our music into computer games? I'm not so much thinking about licensing issues, but more about what channels are available and how to get noticed by game devs that could be interested in our type of music.

sentences:
Reference a single 2d Rectangle in an array What I am attempting to do probably has a very simple answer but I can't make heads or tails of it no matter how hard I try.  Provided I'm a newb.

What I am trying to do is after I create a grid of rectangles, when the cursor moves into the grid, it changes the color of the rectangle the cursor is currently in (or highlights it), then changes back when the cursor leaves.  Here's what I've coded so far:

namespace MapGenie
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        Rectangle[,] gameGrid;

        MouseState currentMouseState;
        MouseState previousMouseState;

        bool colorChange = false;

        Color color;
        Color previousColor;

    protected override void Initialize()
    {
        //Creates the array
        gameGrid = new Rectangle[10, 10];

        color = Color.Black;

        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        this.IsMouseVisible = true;

        int Gridsize = 20;

        //Creates the grid
        for(int x = 0;x <10;x++)
            for (int y = 0; y < 10; y++)
            {
                gameGrid[x, y] = new Rectangle(x * Gridsize, y * Gridsize, Gridsize, Gridsize);
            }
    }

    protected override void Update(GameTime gameTime)
    {
        currentMouseState = Mouse.GetState();
        var mousePoint = new Point(currentMouseState.X, currentMouseState.Y);
        previousMouseState = currentMouseState;

        //Checks each rectangle in the gameGrid array to see if cursor is there?
        foreach (Rectangle grid in gameGrid)
        {
            if (grid.Contains(mousePoint))
            {
                previousColor = color;
                color = Color.Blue;
                colorChange = true;
            }
            if (colorChange == true)
                color = previousColor;
        }

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();

        var t = new Texture2D(GraphicsDevice, 1, 1);
        t.SetData(new[] { Color.White });

        foreach (Rectangle grid in gameGrid)
            spriteBatch.Draw(t, grid, color);

        spriteBatch.End();

        base.Draw(gameTime);
    }
}
}

Before I added the else statement (Which I am also aware does not work, but I am working to fix that after asking this), the entire grid would turn blue.  So, I am not sure if it is the right question or not, but how do you get just the one the cursor is in to change color?

sentences:
In unity, some part of mesh doesn't show only in play mode This is screenshot of not playing mode. You can see the the speedloader and bullets inside of the revolver.

And this is when playing mode.

As you can see, I can see the speedloader and bullets in scene view, but not player's camera. Sometimes, it disappears in scene view either!

I made this model same as other weapons, but others are working fine. Only this weapon causes this problem. All weapons that I made are based on same model and rigs, and I kept the weapon's scale fit as same as possible.

I tried move the camera and scale down a little bit, but still couldn't saw.

Why this is happening? How do I solve this? Any advice will very appreciate it.

sentences: In Gamemaker Studio 2 how can I find out in code whether the platform is HTML5 or not? I want to be able to run or not run code depending on which platform I am building for. Some code should only run for the HTML5 platform. How can I find out whether the platform being run is HTML5 inside my gamemaker events?

sentences:
Determining Rectangle-Circle Collision Point I'm developing a 2D game engine currently. I stuck on determining position of a rectangle that collides with a circle when its speed is added to its position. Rectangles have only x axis speed.

On picture rectangles are same. Left sided rectangles x,y,width and height values are known. Second rectangle should be next position. Circles radius, x and y values are known also. (x and y values are top left position of an object). I need to find second position of rectangle.

Edit: I can detect collision perfectly. But I need its new position.

sentences: Quaternion.AngleAxis smallest value? If I'm using an angle with a value of somewhat below 0.1 degrees in Quaternion.AngleAxis, the quaternion will not apply a rotation at all. Why is this?

sentences:
Different executions with different results using the same Random seed in LIBGDX In my Libgdx project (for PC) I am using a Java Random object initialized with a constant seed. I use the Random object to generate a lot of different pseudorandom integers. I am not using multithreading, but the integers are a bit different each time I execute the application.

How can this be possible?

EDIT: What is really strange is that the Random object is called a few times more in some executions and I don't know why, causing the random numbers to be a bit different for each execution.

sentences:
How can I efficiently store Vertex data in C#/XNA? I am creating a terrain system using voxels in a somewhat minecraft-like style and I was wondering if there was anything I could do to increase the number of vertices I am able to store (and therefore render).

Based on different suggestions I have read I created a number of "chunks" of size 32x32x32 cubes and all of the vertices for these cubes are pre-calculated and stored in a VertexBuffer. I then have 7x7x7 of these creating a larger map. Therefore this is around 11 million cubes.

I was unable to render all 11 million cubes, so I removed any vertex in the buffer which would be completely hidden by an adjacent block (this removes all the interior/invisible surfaces/vertices). Overall this reduced the number of vertices by a factor of 36 in the simplified terrain example I am using!

However, this appears to be the absolute limit on the number of blocks I can render. This already takes about 1 GB of RAM according to the task manager (although the vertices themselves are closer to half of this - GC and all).

Do I have to simplify my terrain and/or accept this limit, or is there a better way to do this? I previously tried using instancing but that slowed down after only 20,000 cubes or so.

Thanks.

sentences:
Is it possible to debug shaders in GLSL level instead of assembly language level? I'm writing some Vulkan code and write my shader in GLSL.
I tried to use Renderdoc to debug my shader, but I only got disassembly code.
Is it possible to debug shaders at the level of GLSL if I have the source code of  the shaders in GLSL format?

sentences:
Efficient Bullet Firing Class I've been struggling with this for a while. I have been trying to create a bullet pool class for a game I have made that doesn't cause a significant fps drop.

I have tried creating a bullet pool and have also tried dynamically creating and deleting bullets, both of which drop the fps of the game around 10-15.

I ran a test a few days ago and just put a return statement in the bullet pool's firebullet function, which represented the logic leading up to this, function calling, etc.

This only dropped the fps 2-4. If I can fire bullets without dropping the fps more than another 2-3, I would be satisfied. My bullets are autorelease objects that are a subclass of a ccnode.

I create a ccsprite and a box2d b2body for each one. I am working on the ios platform. Any thoughts on how to make this more efficient? Has anyone managed to do something similar to this?

sentences:
How to check in Unity whether tile B can be reached in a straight line from tile A? I'm currently trying to smooth out my A* paths based on this article.

This is what I want to achieve:

But sadly I'm stuck at implementing the Walkable method.

I don't know how could I check whether a unit can reach tile B in a straight line from tile A.

(Let's keep it simple, and currently every unit is 1 tile wide.)

sentences:
How can I simulate a randomly-generated universe? Possible Duplicate:
  How to generate a universe?

Were would I start looking if I wanted to develop an engine to simulate space at random. Things like black holes, galaxies at distance and moving stars, asteroids and so on?

I would like to know if anyone has some good tips for this, or if there is some information online?

sentences: 2D animated sprite jumping and gravity physics I'm currently writing a Megaman clone for my school project. So far all I did was making the character run and stay put when needed. Know I want to be able to make him jump using the 'X' button. I already have the animation sheet of the jump. But I really can't figure out how to do it and how the physics work after reading so much about it both here and other places. I think you get what I mean. From the state of staying put or running, going to a jumping position and landing. Also to be able to press left/right and the jump button to jump in the direction(I know It's stupid that I explain all of this because you probably know all this but just in case). Anyway this is my code for Game1: http://pastebin.com/zYM5gnRD And this is the code for my Animated Sprites class: http://pastebin.com/5H36YAdb I'm not saying it's the smartest writing, but it's only a school project so I need it to work so I'm fine with it. Thanks a lot, a lot in advance for those who read this and are going to help.

sentences:
How can I profile and debug my usage of D3D10? I've been working on D3D 10 for about 6 months and I have accumulated a basic framework. The thing is I get frame rate spikes.

Even when I have a simple cube on the screen each side with its own texture, every now and the the frame rate drops suddenly.

Any tips to try and find out what is causing it?

sentences:
Find out which way to rotate based on current rotation and final rotation I have one object that I want to rotate to a certain angle with 'smooth' rotation.
I looked up  on how to solve that and I came up with this: enter image description here

But how do I know in what way to rotate, positive or negative?
According the the picture on ex. 1, I need to rotate positively because it is the closest way for me to rotate. And on the second it is the negative way.
But how do I know this? I've tried several solutions but I can't seem to find anything that is correct.

sentences:
Multi threaded game - updating, rendering, and how to split them From the StackOverflow post (it was recommended I move this):

So, I'm working on a game engine, and I've made pretty good progress. However, my engine is single-threaded, and the advantages of splitting updating and rendering into separate threads sounds like a very good idea.

How should I do this? Single threaded game engines are (conceptually) very easy to make, you have a loop where you update -> render -> sleep -> repeat. However, I can't think of a good way to break updating and rendering apart, especially if I change their update rates (say I go through the update loop 25x a second, and have 60fps for rendering) - what if I begin updating halfway through a render loop, or vice versa?

sentences:
How to end a game when player picks up certain number of objects I've got a small maze game where the player has to find a certain number of objects. If the player find all of them, I want the game to end. For now, I just simply want it to stop gameplay completely. I'll worry about ending it elegantly later. This is what I have, but I can't figure out what to put in the if statement. I can't seem to find a simple game state end function or anything like that. (Not really a whole lot of code to show for this. If for some reason someone needs to see more, please let me know and I can post other code, I just don't think anything else is relevant).

void APlayerCharacter::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

    if (Score == 5)
    {
        //WHAT CAN I PUT HERE TO END GAME????
    }

}

sentences:
Is a responsive dimension game worth it? I'm in the process of creating a Wario-Ware-like game that will be created for browsers first then likely ported to mobile. Here are the different ways I've considered setting up the dimensions of the game:

---Fixed width---

The natural go to, set width and height

Pros:

Easy to manage interaction in javascript
Don't have to worry about resizing
As a developer I know exactly how it will look and play

Cons:

It might not be playable on all platforms
It will almost always not make the best use of all of the space on the screen

---Several fixed widths---

I'm currently leaning towards this approach

Pros:

It can reach more platforms than having just one fixed width can
The developer(s) still have full knowledge of how the end product will look through testing on each size
It is fairly easy to change the javascript to match the varying set dimensions

Cons

It doesn't take up the full screen space on many screens
Have to develop javascript in a way where it works with several sizes

---Semi-Responsive---

Consistent dimension ratio, varying actual size. In my case It'd be landscape layout

Pros:

It makes good use of more of the screen
The fixed ratio makes developing easier than a non-fixed ratio

Cons:

On certain platforms it may not be playable depending on the dimensions of the game and of the device
Interaction is harder to manage in javascript than set dimensions

---Fully Responsive---

I'd force landscape mode if possible and keep a minimum height and width, but other than that it's fully responsive

Pros:

Makes use of the full screen
Able to be played on any device

Cons:

A bit harder to manage interaction in javascript

My questions:

What approach is commonly taken when it comes to making dimensions of browser based games? Is there another approach or mix of approaches that I didn't mention that would be useful? It seems that making it fully responsive would be best, but it'd be the most work

I'm also looking for any other advice on the subject

Sorry if this is too broad for this community or if it is tagged inappropriately, feel free to edit as necessary

sentences:
How to make a cylindrical collider for a cylindrical mesh in UE4 When I am importing Axis Alligend cylindrical mesh in UE4 here is what I get as an automatically generated collider:

But if I rotate the mesh in Maya and again exprot FBX to improt in UE4 here is what I get:

As you can see the object is the same but the collider is much worse. How can I make the same callider in spite of the orientation of the cylinderical mesh?

BTW if I remove collider and do auto convex collider:

I get this:

Which is very good but the problem is that I want it to be generate from the beginning and not later when I edit the mesh collider. How can I achieve that?

sentences:
Unity Rotate Object Around Local X Axis , then Local Y Axis, then Local Z Axis (like a turtle) I am having trouble getting my unity gameobject to rotate in the manner I would like.

I would like my gameobject to act kind of  like a turtle from a drawing program, where I could input a Vector3 like (10, 25, -5)  and then it would rotate around its x axis by 10 degrees.  Then rotate around it's Y axis by 25 degrees, and then rotate around it's z axis by -5 degrees.

Here's a picture example: (rotations not exact)

The problem is that the axes (the green, blue, and red gizmos you see when you have an object selected) change direction as the "turtle" goes through the Vector3.

It seems like transform.Rotate(new Vector3(10,25,-5), Space.Self) should be what I'm looking for.
But it doesn't give me the result I would like! It still seems to rotate around it's start up, right, and forward vectors.

public Vector3 rotation;

Quaternion zero = new Quaternion(0,0,0,1)

void Update()
{
    transform.rotation = zero;
    transform.Rotate(rotation, Space.Self);
}

I have also tried doing some things with Quaternions to get the desired result, but I can't figure out exactly what is need. If anyone has any advise it would be greatly appreciated!

sentences:
Finding the on-screen height of straight walls in raycasting rendering I have an issue to find the correct height of walls to make them straight in raycasting rendering.

This is how I calculate the height of the wall which is h_seen:

dist_w = sqrt(pow((w->cam->position.x - w->cam->rays[i].endPoint.x), 2) + pow((w->cam->position.y - w->cam->rays[i].endPoint.y), 2));
distortion = dist_w * tCos(w->cam->fov / 2 - (i * w->cam->fov / WIN_W));
if (distortion)
    h_seen = dist_c * wall_h / distortion;
//printf("h_seen = %f\n", h_seen);
y = cam_h - (h_seen / 2) - 1;

This is a screenshot of the problem  I have fisheye effect, if i use depth directly

    if (l == 0)
    {
        raytravel.y = w->cam->rays[i].endPoint.y - w->cam->position.y;
        raytravel.x = w->cam->rays[i].endPoint.x - w->cam->position.x;
        depth = raytravel.x * dir.x + raytravel.y * dir.y;
        h_seen = dist_c * wall_h / depth;
        y = cam_h - (h_seen / 2) - 1;
        if (hit == 1)
            while (++y < (cam_h + (h_seen / 2)))
                put_pixel_img(w, WIN_W - i + WIDTH_MM, y + 150, 0xff0000);
    }

// Direction of each ray inside the while loop

if ((hit = intersection(w, l, &dir)))
        w->cam->rays[i].endpoint = w->cam->intersection;
else
    {
        w->cam->rays[i].endpoint.x = w->cam->position.x + w->cam->raylength * tcos((w->cam->angle + w->cam->fov / 2) - (i * (w->cam->fov / limit)));
        w->cam->rays[i].endpoint.y = w->cam->position.y + w->cam->raylength * tsin((w->cam->angle + w->cam->fov / 2) - (i * (w->cam->fov / limit))); // limit is just the screen width
    }

sentences: gl_FrontFacing - is there perfomance cost? If I use gl_FrontFacing in my PS, is there any performance cost during vertex transformation (like cross product from triangle  vertices), or is this value computed any time ?

sentences:
Quaternion Rotation Weird Rotation I have an fps camera, and i am representing rotation with quaternions.  every frame i grab how much the mouse moved that frame and then i simply do

Quat DeltaQ = Quat::CreateRotationXYZ(MouseYDelta, MouseXDelta, 0);
m_CurrentRotationQ = DeltaQ * m_CurrentRotationQ;

however, everything works until i rotate 90 degrees to the right.  when i do that i cannot rotate up and down.  also, moving the direction i am facing works, however, depending on where i am looking strafing left and right moves me in different directions,  I've tried many things such as reversing order of multiplication, i'm really at a loss.  Any help would be greatly appreciated.

sentences:
How do I set something when 2 or more touches are pressed? I currently have a working controller with left and right but I want to set the velocity of the character to 0/Stop when 2 or more touches are detected. This is my current working code but I want to make the player stop when 2 touches are detected.

void TouchMove(){

    if(Input.touchCount > 0){

        Touch touch = Input.GetTouch(0);

        float middle = Screen.width / 2;

        if(touch.position.x < middle && touch.phase == TouchPhase.Began) {
            MoveLeft();
        }
        else if (touch.position.x > middle && touch.phase == TouchPhase.Began) {
            MoveRight();
        }

    }
    else {
        SetVelocityZero();
    }
}`

This is how my game looks like

sentences:
Is it easy to use Sun Burn engine for WP7 game development? I was wondering if anyone has tried to develop a game using the SunBurn game engine for the Windows Phone 7 platform.

How good is documentation, examples, etc?
Is it easy in use and implementation?

Any feedback would be greatly welcome.

sentences:
Prefab sorting layer wrongly displayed I have a prefab 'WhiteSmoke' that should render on top of the other objects on my game view but instead it just stays behind. The sorting layer some you see on the image named 'smoke' is the top layer, changing it to default and keeping the big order in layer number does not solve the problem.

The canvas render mode is ScreenSpace-Overlay.

Have any idea what I'm missing here? I don't know what else to try.

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:
Generate 2D Triangular Mesh from Vertices on a Map Given a map of vertices {(x1,y1), (x2,y2), ... (xn,yn)}, how can I generate a 2D triangular mesh covering all vertices, and where the area of all triangles completely covers the map?

The triangular areas may fully enclose other triangular areas, but no two triangles may intersect.

sentences:
RigidBody.MoveRotation Resetting to (0,0,0); I'm trying to rotate a character on along the y axis but rather than continuing to rotate, it rotates then the y rotation goes back to 0. I'm not sure what I'm doing wrong. The same thing happens if I change the rotation in the inspector. The line that's causing this is the second one in the Look Function.

public void Look()
{
    Quaternion Rotation = transform.rotation;
    Rotation = Quaternion.Euler(transform.rotation.x , transform.rotation.y + Input.GetAxis("Mouse X"), transform.rotation.z);
    rb.rotation = (Rotation);
}

sentences:
Should components in Entity Component System pattern have logic? Is often read that in entity component system pattern we should treat components just as a passive data structure with no logic at all, this way we follow to a data oriented design approach with efficient usage of cache memory and gain performance.

I was developing a simple game using this rule and when the game was getting bigger I start facing some serious code smells such as repeated code in systems, let's suppose its a shooter to illustrate an example. In this shooter I had bullets being fired so I created a BulletComponent and a BulletSystem that handles when it collides and make some damage and if don't collide with anything the bullet dissapear in five seconds. Then I wanted some explosives so I created the ExplosiveComponent and ExplosionSystem, once the explosive is placed it explodes in ten seconds. At this point we can notice the first repeated code between systems then we can make an abstraction and we create a DurationComponent and a DurationSystem so the bullet and the explosive contains it with the time it should last.Then I realized that when the explosive should explode I want to create some particle effect in the area so this abstraction is no longer valid as I want to perform differents actions when time runs out, but if I do as at the beginning I have the repeated code between systems (ugh!). This example is simple but I'm facing this with more complex things like AI, or reacting to collisions.

One solution I came to this is that I really wanted an ActionComponent with a ActionSystem that executes the action contained in the component but this way I'm breaking that components only contains data and they should not have logic! this is more an 'hybrid' approach. But if you start thinking deeply the ActionSystem is very generic and you can almost do anything with it so it's hard to determine whether a system is necessary or not. The same can be applied to collisions, instead of having lots of systems with logic for different entities colliding, you can just have a CollisionHandlerComponent  with the logic on it for each entity.

I found the following advantages making generic systems like this:

Higher flexibility (you can customize each entity easily)
No repeated code
Less systems (more performance?)

But as I said the main disadvantage is that is really confusing if a system is needed as you can stick logic to components.

Is it wrong to follow this sort of hybrid ecs? If yes, what would be your approach to the example without repeating code in systems?

sentences:
Changing coordinates of the object with velocity preservation In Doodle jump, if a player jumps over one side of the screen he appears on another side with preserved velocity and other physical parameters.

I made two trigger colliders on the sides of the screen with OnTriggerEnter2D method.

private void OnTriggerEnter2D(Collider2D collision)
{
    collision.transform.position = new Vector3(collision.transform.position.x * -0.95f,
        collision.transform.position.y, collision.transform.position.z);
}

If I multiply collision.transform.position.x by -1f then on collision some glitching occurs. It gets stuck for a second. I believe this happens because when player is moved to the other side there is another collision detected and he is thrown back. Is there a more elegant way of handling this instead of multiplying by 0.95f?

Final solution:

[Tooltip("Controls where is the edge of the level where player is trasfered on the opposite side of the level.")]
[SerializeField]
private float xAxisMovementConstraints;

private void DetectBoundryCross()
{
    if (transform.position.x < (-xAxisMovementConstraints))
    {
        transform.position = new Vector2(transform.position.x + (xAxisMovementConstraints * 2f),
            transform.position.y);
    }
    else if (transform.position.x > xAxisMovementConstraints)
    {
        transform.position = new Vector2(transform.position.x - xAxisMovementConstraints * 2f,
            transform.position.y);
    }
}

sentences:
How to edit the alpha channel of an existing specular map? I am working with a third party model and need to change the specular map. The model material is using the spec map's alpha channel information. I have opened the spec map in Photoshop and if I go to the Channels tab I can see the Alpha 1 channel with the alpha information that I need to change.

What I would like to do is make a copy of this original and drag it into the Layers tab, so that I can revert back to this if need be. I can then duplicate this again and paint over it to create the new alpha map. Once done I can then copy and paste it as the new alpha channel, keeping the original preserved in the Layers tab.

The problem is how do I get the Alpha 1 channel into the Layers tab to make the edits? I cannot click and drag it there; and if I do Select All, Copy and Paste into a new layer nothing is pasted. How can this be done?

If I'm not using the best workflow for editing an existing specular map please suggest an alternative way. I basically just want to edit the alpha channel but keep the original as well.

sentences:
How to store renderer vertex / index data in scene graph objects? I have a SceneNode class which contains a Mesh instance. The Mesh class stores client side information such as vertex and index arrays (before they're uploaded to the GPU). I also have an abstracted Renderer class, for GL and D3D, which render the SceneNodes. However, I'm not sure where I should store the API specific variables, e.g. GLuint via glGenBuffers for GL, and an ID3D11Buffer for D3D.

The few options I've considered are:

Create a derived Mesh class for each API, e.g. GLMesh / D3DMesh
Create a derived MeshData class for each API, which is stored in the main Mesh class
Store a map of Mesh to API variables in each renderer, e.g. perform a lookup of Mesh to GLuint / ID3D11Buffer for each object that is rendered (variables would have to be generated after the scene had been updated, but before rendering).
Separate the logic of rendering from scenes, by visiting the SceneGraph after update, and generating a RenderGraph of all renderable nodes in the scene.

What's the recommended way of doing this?

sentences:
Quaternion.Lerp does not actually rotate object when called inside an "if" clause Let's say I have a RotatableObject class, which inherits from MonoBehaviour. Here is its Start() method:

private void Start() {
    this.startingLocalRotation = this.transform.localRotation;
    this.finalLocalRotation = Quaternion.Euler(this.startingLocalRotation.eulerAngles.x, -150f, this.startingLocalRotation.eulerAngles.z);

    // Initialize other private fields
}

It has a method called Rotate(), defined as follows:

private void Rotate() {
    this.transform.localRotation = Quaternion.Lerp(this.startingLocalRotation, this.finalLocalRotation, 0.2f);
}

Given the following Update() method, the object rotates as expected:

private void Update() {
    this.Rotate();
}

However, if I make the following changes to Update(), then the object does not actually rotate, even though the Rotate() method is hit:

private void Update() {
    if (this.SomeCondition) {
        this.Rotate();
    }
}

this.SomeCondition always has the value true over multiple frames.

What is my mistake, and how can I fix it?

EDIT:

In response to this comment:

  When you say "the object rotates as expected" do you mean that the
  object rotates from starting angles until final angles and then stops
  rotating (without the if) ?

Yes.

  could you provide some more details about what SomeCondition is?

this.SomeCondition is determined by the state of another object, say, Puppy. E.g. if puppyInstance.Mood == Mood.Happy, then this.SomeCondition is true.

  Did you try replacing the condition with the word true

No, I have not tried that. However, when stepping through the call stack in debug mode, I can see that this.SomeCondition is true and Rotate() is called -- I managed to step into the Rotate() method itself.

EDIT:

I tried the first approach described in this answer. However, it did not produce the effects that I was aiming for.

I set a breakpoint here:

transform.localRotation = Quaternion.Lerp(
   startingLocalRotation,
   finalLocalRotation,
   _rotationProgress
);

Every single time the breakpoint was hit in the Update() call, I could see that the value of _rotationProgress was steadily increasing. However, the value of transform.localRotation never actually changed -- it was always (-0.7, 0.7, 0.0, 0.0).

If I updated transform.localRotation outside of an if clause, however, that game object rotates as expected -- transform.localRotation gets updated as _rotationProgress gets updated.

EDIT:

Never mind, I am an idiot. The problem lies elsewhere in the code. The suggested approach works and I have accepted it as the answer.

sentences:
Optimizing HTML5 canvas transformed drawing in Javascript I am trying to optimize my HTML5 game engine and have noticed that currently a majority of the time taken in the game loop can be taken when drawing transformed tiles.  I think this is because each transformed tile saves the state of the canvas, applies a transform, draws the tile, then restores the state of the canvas.  Fortunately I have (at least) 2 classes of tiles, and if I am only drawing un-transformed tiles, the game runs quite smoothly.  Take a look:

Slow with transformed tiles in the background: http://sgdk2.enigmadream.com/ben/JavaSampleo.html
Faster with no transformed tiles in the background:
http://sgdk2.enigmadream.com/ben/JavaSample.html

Sure you could say that drawing the extra tiles alone is responsible, but I have used Chrome profiling to confirm that XFrame (transformed frame) is consuming more than 50% of the time.  So here's the drawing code for XFrame:

XFrame.prototype.draw = function(ctx, x, y) {
   ctx.save();
   ctx.transform(this.m11, this.m12, this.m21, this.m22, this.dx+x, this.dy+y);
   ctx.drawImage(this.imageSource, (this.cellIndex % this.graphicSheet.columns) * this.graphicSheet.cellWidth,
      Math.floor(this.cellIndex / this.graphicSheet.columns) * this.graphicSheet.cellHeight,
      this.graphicSheet.cellWidth, this.graphicSheet.cellHeight, 0, 0, this.graphicSheet.cellWidth, this.graphicSheet.cellHeight);
   ctx.restore();
};

Now one thing I can imagine improving this is if I could determine that many of the tiles I was drawing were using the same transformation, and make the single transform span the drawing of many tiles.  It would be a challenge given my current design, but I might be up to it if it would make a difference.  However that is of little use because the position of the tile has to become part of the transformation if I want the location of the tile to be excluded from the transform operation, I think.  For example, if I want to draw a tile rotated 90 degrees at a coordinate of 64,32, I can't simply apply the rotation matrix and then draw at those coordinates because 64,32 will get transformed to something like 32, -64 (right).  So I have to apply the offset as part of the transform for all transformed drawing operations.  And since each tile is drawn at a different location, that means a different transform for each tile.

Any suggestions for optimizing tile drawing operations where transformations may be applied at the tile level in real time?

sentences:
Why does duplicating my object cause its vertex animation shader to distort it? I used a vertex shader (based on this example) to animate a flag waving. When I have a single flag in my scene, it works correctly.

When I duplicate the flag, all of the copies become wildly distorted after I hit play.

Here is the shader code I'm using:

Shader "Custom/Flag" {
    Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Speed ("Speed", Range(0, 5.0)) = 1
        _Frequency ("Frequency", Range(0, 1.3)) = 1
        _Amplitude ("Amplitude", Range(0, 5.0)) = 1
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        Cull off

        Pass {

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

            sampler2D _MainTex;
            float4 _MainTex_ST;

            struct v2f {
                float4 pos : SV_POSITION;
                float2 uv : TEXCOORD0;
            };

            float _Speed;
            float _Frequency;
            float _Amplitude;

            v2f vert(appdata_base v)
            {
                v2f o;
                v.vertex.y +=  cos((v.vertex.x + _Time.y * _Speed) * _Frequency) * _Amplitude * (v.vertex.x - 5);
                o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                return tex2D(_MainTex, i.uv);
            }

            ENDCG

        }
    }
    FallBack "Diffuse"
}

How can I make this work with multiple flags using the same material?

Should I use a new material instance for each object like this? It doesn't seem optimal:

    material = new Material (Shader); // Create new material
    material.SetFloat ("_Speed", _Speed);
    material.SetFloat ("_Frequency", _Frequency);
    material.SetFloat ("_Amplitude", _Amplitude);
    material.SetTexture ("_MainTex", _MainTex);
    flagObj.GetComponent<MeshRenderer>().sharedMaterial = material; // Set values

sentences:
Animation reset in libgdx i have an issue that i hope it's easy to resolve.
I'm playing various animations in my libgdx-created game.

For a particular animation, i need that to play in loop mode but only if a particular condition is true. Simple this far.

What i need is to "reset" the animation (i mean restart from sprite n°1) when the condition become true again after the animation stopped.
I know that i can simply dispose the actual animation and create another one every time the condition is true, but this seems a complicated way to resolve this..

How do i change the value of the index used by that animation? Is it possible?
Do i have to create a class that extends the Animation class from libgdx library?

sentences:
Google Play beta testing I made a game I wish to upload to Google Play and I faced the options

Production
Beta testing
Alpha testing

I made the game all alone and I think it is complete, was tested on multiple physical as well as virtual devices, all well and good.

As I'm alone and would consider the game finished, does it make sense to upload beta instead of production? I'm not in connection with anybody, so I don't think anyone would try and play the game (apart from meself). Or would some testers employed by Google test the apps if they are submitted to open beta?

sentences:
objective-c iphone sdk side scrolling I was making a game and I did the side scrolling like this: if the player get past 150, the player stops moving and the background starts moving. But thats very annoying with placing objects in the game. Isn't there a better way to do this? I do not want to use cocos2D.

Thanks!

sentences:
Unity Diablo style Multiplayer Good time of the day to everyone who is reading this topic.

I've been enjoying playing Diablo 3 and decided to try myself in game development (to lure my friends into Diablo 3 and to, ofcourse, practice in game development).

I'd like to split the question in to following sections:

Lobby System (using Unet)
Game Server
Scene Loading

So, lets start with the first part:
As far as i know, when user decided to play the multiplayer part of the game, he is either creating new game for others to join, or joining an existing game. This process can be observed on the "Joining/Creating Game" screen.

What i'm actually can't figure out, is that if the game created on the users machine (lets name it local) or the Blizzard server (this will be remote). If it is created on the local machine, how then it is protects itself from cheating. If it is created on the remote machine, does that mean that for every 5 (just any number) players, i will have to start new copy of the game server (probably on the different port)

Moving to the second question:
This requires to run a "headless" version of the game on the server. Is there a possibility to create many different rooms for many players by using only one server instance, or will it require to run separate instance for every 5 players. Also, if player is playing in single-player mode, he seems to be also connected to the game server. Looks like the game server is performing all of the necessary calculations and player only sends in the commands for server to process (e.g, move me from 1,0 to 1,1) and after receiving the response, client interpolates the movement received from the server.

And finally, the third question:
Server may have many different scenes, but many players may be situated across many different scenes. There could also be dungeons and other player oriented stuff. So the question is, is it possible to achieve this goal using default Unity functionality.

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: How to keep player rotated toward a sphere when within a certain radius? In my game the player can fly to multiple spheres, I want to make it so that when the player gets within a certain distance of the sphere, (maybe using a bigger is trigger sphere collider around it?) their feet will stay pointing towards the sphere until they leave the radius, (maybe using a quaternion?) then if they get within the radius of a different sphere, their feet will point towards that too. How can I make this work? I don't know too much about c#, so any example code would help a lot too!

sentences:
Do Octrees, Kd-Trees, BSP only make sense for static geometry? I'm still implementing my scene graph (see this question). Now, I wonder if a spatial representation such as a Kd-Tree or Octree to do View Frustum Culling (VFC) only makes sense with static geometry. The reason for my doubt is that usually dynamic geometry is a small part of the scene, while static geometry can be very large, and dynamic geometry forces to handle updates in the spatial representation at each frame.

Your opinions?

Tunnuz

sentences: Liang-Barsky Line Clipping Algorithm Is it possible to generalize Liang-Barsky Line Clipping Algorithm for n-dimensional space ?

sentences:
Experiencing strange behavior in Unity when rotating a 2D GameObject according to the slope it is standing on I am trying to rotate a square GameObject, so it appears to be standing perpendicular to the slope underneath it. However, when above a slope, the square constantly "spins"; it seems like the rotation is set and then immediately set back to 0, causing it to jitter.
I am currently using a RayCast based character controller instead of rigidbody. To change the rotation, I added the follow line of code following the vertical RayCast:
if (_raycastHit)
    {
       transform.rotation = Quaternion.FromToRotation(transform.up, _raycastHit.normal) * transform.rotation;

    ...
    }

It calculates and rotates the square correctly, but I am not sure why it resets back to 0 every other frame. To avoid taking up too much space, the character controller I am using is hosted on GitHub here. Specifically, this is in the moveVertically() method.

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:
Colliders slightly intersecting each other; any solution? Consider this simple scene:

In Unity, colliders slightly intersect each other. Typically, this isn't a problem. However, I want to make a custom character controller using a box collider and not a capsule collider. In the above scene, the floor is divided into 2 objects, each with their own collider. The playercontroller has their own box collider.

And the problem: if the box collider moves forward, it will clip with the seam on the floor, even though both floor objects have the same height. The box will stop moving as if it has run into a wall. If I keep adding force to the box, it will never move forward. It will stay stuck on the seam-- this only exists because the box is slightly inside the first floor collider, and it will hit the second collider of the floor like a wall.

This only occurs because of collisions clipping. With most playercontrollers, a capsule collider is used and thus this problem doesn't exist.

Is there a workaround? How can the box smoothly move across the floor without colliding with the seam?

Notes:

This does occur with capsule colliders but rare and is not very noticeable.
A possible solution would be to merge all the colliders of the scene into one, unified collider. It is extremely tedious and has its drawbacks.
This occurs if I am moving the collider with both MovePosition(), AddForce(), or modifying the velocity/position of the transform.

sentences:
Tilting a game object left/right/forward/back with gyroscope, regardless of player's heading I'm working on a mobile game in Unity and using the gyroscope to rotate an object along the x and y axes.

float x = Input.gyro.attitude.x;
float y = Input.gyro.attitude.y;

This code give me the rotation I want when pointed in a certain direction along the z-axis. I want the rotation to not depend on the z-axis. I want the rotation to act the same no matter what direction I'm pointed in the real-world.

Here is a 12 second clip of what I get using a mobile gyroscope when pointed at 1 or North on the z-axis:

I want the rotation to be the same no matter what direction I am pointed on the z-axis with the gyroscope. Is there some way to rotate the whole coordinate system?

sentences:
Complete Math Library for use in OpenGL ES 2.0 Game? Are you aware of a complete (or almost complete) cross platform math library for use in OpenGL ES 2.0 games?

The library should contain:

Matrix2x2, Matrix 3x3, Matrix4x4 classes
Quaternions
Vector2, Vector3, Vector4 Classes
Euler Angle Class
Operations amongh the above mentioned classes, conversions, etc..
Standardly used math operations in 3D graphics (Dot Product, Cross Product, SLERP, etc...)

Is there such Math API available either standalone or as a part of any package?

Programming Language: Visual C++ but planned to be ported to OS X and Android OS.

sentences:
Coins don't show up in game in Unity I have a 2D game I'm making with Unity, and I want the player to be able to collect coins that I place all over the game. I used the coin prefab with a 2D circle collider and an animation to make it spin. The problem is that only the first coin I put into the scene shows up in the game, and when I collect that one coin, the counter shows that all the others have been collected as well. Here's the script I attached to the player for the coins:

private uint tokens = 0;

void OnGUI(){
    GUILayout.Label ("Tokens= " + tokens);
}

void CollectToken(Collider2D tokenCollider){
    tokens++;
    Destroy (tokenCollider.gameObject);
}

void OnTriggerEnter2D(Collider2D col){
    if (col.gameObject.CompareTag ("token")) {
        CollectToken(col);
    }
}

This is my current setup for the object properties:

Thank you for any help!

sentences:
Limiting interaction between certain RigidBodies I'm developing a 2D game in Unity and have been tasked with building a particular feature I'm not sure how to accomplish with Unity's physics engine. To simplify, a bunch of objects of type X and O are filled into a pit:

XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXoXXXoXXXoX

Both objects have Rigidbody2Ds and colliders. Objects of type X have normal gravity and should settle into place. Objects of type O have inverse gravity and should float.

However, O should not be able to push X, and X should not be able to push O. Another way of looking at it is that O should only be able to move upward, and X should only be able to move downward. If we remove some of the Xs directly above an O, the O should float upwards as the Xs fall downwards until the Xs settle on top of the O and everything stops moving:

XXXXXXXXXXXX        XX XXXXXXXXX
XX XXXXXXXXX   -->  XXXXXXXXXXXX
XX XXXXXXXXX   -->  XXoXXXXXXXXX
XXoXXXoXXXoX        XX XXXoXXXoX

(In the actual game Xs and Os can be different sizes; their movement is continuous and they are not constrained into rows or columns).

The Os should be able to support the weight of any arbitrary number of Xs without sinking.

XXXXXXXXXXXX
XXXXXXXXXXXX
XooooooooooX
X          X

Lastly, the Os should be able to float diagonally if there is a space available:

XXXX XXXXXXX      XXX       XX
XXXXX     XX  --> XXXXX   XXXX
XXXX    XXXX  --> XXXXoXXXXXXX
XXXo XXXXXXX      XXXX XXXXXXX

I can't solve this problem simply by adjusting the mass of the Xs or Os since the number of Xs on top of an O may vary. I can't use the built-in RigidBody constraints since they don't allow you to disable only one direction along an axis (e.g. saying an object can move upward but not downward).

What's the proper way to handle this? I could do something like this:

void FixedUpdate() {
    if (movementDirection == Direction.UP) {
        if (transform.position.y < lastYCoordinate) {
            Vector3 position = transform.position;
            position.y = lastYCoordinate;
            transform.position = position;
        }
    }
    lastYCoordinate = transform.position.y;
}

but that feels hacky to me and I suspect it will keep the objects from sleeping. Are there better solutions here?

sentences:
3D BSP rendering for maps made in 2d platform style I wish to render a 3D map which is always seen from top, camera is in sky and always looking at earth. Sample of a floor layout:

I don't think I need complex structures like BSP trees to render them. I mean I can divide the map in grids and render them like done in 2D platform games. I just want to know if this is a good idea and what may go wrong if I don't choose a BSP tree rendering here. Please also mention is any better known rendering techniques are available for such situations.

sentences:
My transparent objects overwrite opaque objects depth and always draw on top? I have set up an 'Order Independent Transparency' method for drawing my transparent objects.

The algorithm can be simplified as follows:

DrawOpaqueObjects()
DrawTransparentObjects()

Drawing the transparent objects uses the following render target setup:

        colourAccumulation = new RenderTarget2D(
            game.GraphicsDevice,
            game.GraphicsDevice.PresentationParameters.BackBufferWidth,
            game.GraphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Rgba64,           // 16 bit floating point texture (required for alpha blending caculations)
            DepthFormat.None
            );

        depthComplexity = new RenderTarget2D(
            game.GraphicsDevice,
            game.GraphicsDevice.PresentationParameters.BackBufferWidth,
            game.GraphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Rgba64,           // 16 bit floating point texture (required for alpha blending caculations)
            DepthFormat.None
            );

The transparent objects are combined with another render target texture that all the opaque objects are drawn to before hand:

        scene = new RenderTarget2D(
            graphicsDevice,
            graphicsDevice.PresentationParameters.BackBufferWidth,
            graphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Color,
            DepthFormat.Depth16,        // Requires a depth format for objects to be drawn correctly (e.g. wireframe model surrounding model)
            0,
            RenderTargetUsage.PreserveContents
            );

They are combined as follows:

PixelShaderOutput PixelShaderFunction(VertexShaderOutput input)
{
PixelShaderOutput output;

// Background colour 'Cbg'
float4 BackgroundColour = tex2D(BackgroundSampler, input.TextureCoordinates.xy);

float4 SumColour = tex2D(Texture0Sampler, input.TextureCoordinates.xy);

// [Depth complexity]
// • Each time a pixel is written by the transparent object it adds 1 to the value [float4(1, 1, 1, 1)]
// • This is why a render target with 16-bits per channel is required (SurfaceFormat.Rgba64)
float n = tex2D(Texture1Sampler, input.TextureCoordinates.xy).r;

// If no transparent pixel has been drawn at this location, return the background colour
if (n == 0.0)
{
    output.Colour = BackgroundColour;

    return output;
}

SumColour = Upscale(SumColour);
n = Upscale(n);

// Average colour 'C'
float3 AvgColour = SumColour.rgb / SumColour.a;

// Average alpha based on depth complexity 'A'
float AvgAlpha = SumColour.a / n;

// T = (1 - A) ^ n
float T = pow(abs(1.0 - AvgAlpha), n);

// [Weighted Average Formula]
// • Cdst = (C * A * (1 - (1 - A)^n) / A) + Cbg * (1 - A)^n
// • Cdst = (C * A * (1 - T) / A) + Cbg * T
// • Cdst = C * (1 - T) + Cbg * T;
output.Colour.rgb = AvgColour * (1 - T);
output.Colour.rgb += BackgroundColour.rgb * T;
output.Colour.a = 1;

return output;
}

The problem is that all transparent objects are never obscured by the opaque objects drawn before hand as denoted by the yellow circle in the following picture:

The depth test has to be disabled for the transparent objects but it is enabled for the opaque.

Why is this incorrect effect occurring?

sentences:
How did the SNES handle palettes of multiple sprites? (This is assuming all graphics are stored in 4 bpp)

I understand that the SNES has a 256 color palette split into 16 palettes (each with 16 colors), and 8 of these represent palettes usable by sprites. Each sprite has a number representing which of these 8 palettes it uses. My question is how and when are the colors of these 8 palettes set typically.

Does the SNES copy the palette of a sprite into one of these 8 palettes when it is rendered? If so that would mean that only 8 sprites could be rendered simultaneously, and two sprites using the same colors would not share the palette which would be a waste of memory.

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:
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: Unity3d Colliders not working on my characters I have create 2 characters in maya and imported them in Unity3d. I am able to move and animate them in unity but the characters are not colliding with each others. I have tried all major colliders capsule, box and mesh. I am kind of stuck in it !

sentences:
Create Render Target View [138][140] need to Bind the back buffer to the render target view DirectX 11 This is the error

D3D11 ERROR: ID3D11Device::CreateRenderTargetView: A RenderTargetView cannot be created of a Resource that did not specify the RENDER_TARGET BindFlag. [ STATE_CREATION ERROR #138: CREATERENDERTARGETVIEW_INVALIDRESOURCE]
D3D11 ERROR: ID3D11Device::CreateRenderTargetView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #140: CREATERENDERTARGETVIEW_INVALIDARG_RETURN]

So as i see here i need to set the BindFlag of the backBuffer to D3D11_BIND_RENDER_TARGET, but in all the tutorial i saw nobody is doing it, they all create the render target view by using this code

hr=m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&m_backBuffer));
if (FAILED(hr)) MessageBox(0, L"Failed get buffer", 0, 0);
hr=m_device->CreateRenderTargetView(m_backBuffer, NULL, &m_renderTargetView);
if (FAILED(hr)) MessageBox(0, L"Failed to create rendertargetview", 0, 0);

And nobody, nowhere is doing as the msdn site says, that the render target view must be created with this specific flag: D3D11_BIND_RENDER_TARGET

So I tried doing it by myself.

I created a texture2d desc like this for the back buffer:

D3D11_TEXTURE2D_DESC backBufferDescription;
    backBufferDescription.BindFlags = D3D11_BIND_RENDER_TARGET;
    backBufferDescription.ArraySize = 1;
    backBufferDescription.CPUAccessFlags = 0;
    backBufferDescription.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    backBufferDescription.Height = 600;
    backBufferDescription.Width = 800;
    backBufferDescription.MipLevels = 1;
    backBufferDescription.MiscFlags = 0;
    backBufferDescription.SampleDesc.Quality = 0;
    backBufferDescription.SampleDesc.Count = 1;
    backBufferDescription.Usage = D3D11_USAGE_DEFAULT;
    m_device->CreateTexture2D(&backBufferDescription, NULL, &m_backBuffer);
    if (FAILED(hr))
        MessageBox(0, L"Fallito back buffer desc", 0, 0);

And it doesn't work the same.

Help please

sentences:
What is the fastest algorithm to check if two cubes intersect (where the cubes are not axis aligned)? I am looking for an algorithm to check if two cubes intersect. One can check if each of the 6 faces of cube A are intersected by each of 12 edges of cube B, but that is 72 checks. I've heard there is a paper from 1997 or so, describing a method that uses just 15 intersection checks, but I can't find it. Can you please share the name of the paper, describing it or describe it in your words.

This question deals with axis aligned cubes which is not really useful.
https://stackoverflow.com/questions/5009526/overlapping-cubes

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: Stopping the texture2D from stretching in RawImage I am working with a RawImage texture which is fully stretched, filling up the entire scene. I am using some code to download images from website and then show them on the RawImage, the code is simple, I use WWW to start a download, use WWW.texture as the Image I want to show in RawImage, I do RawImage.texture = WWW.texture; and then I get the image but the Image is getting scrteched, I don't want to stretch the image but just fill instead, Just like a windows Wallpaper setting. Not to stretch or tile the image but to just fill it. I tried an approach to rotate the image via code but that still leaves some stretching in the image, if I use a portrait image( height is greater than width) I rotate the image from showing in landscape mode(which you can imagine, stretches the image a lot) to portrait mode by using some pixel conversion code, nothing special. Some images are displayed ok, because they fit the native size of the scene but for some stretching occurs. Is it possible to completely remove this stretching? I am surprised Unity doesn't have an option for changing how a texture can be displayed in RawImage. Maybe I am missing something,

sentences:
Is it feasible to create a blockchain to use as a market place game mechanic without extreme inflation? After watching a fascinating video about block chains, the narrator brought up the idea of using block chains in video games. The example he used was in an MMO type of situation where the player used a sword to defeat a dragon and then the sword became known as Dragon Slayer and its stats would go up and the value of it would increase as well. The player would then sell it to another player who used it to defeat some other powerful monster and it gained more stats and its name changed again. Obviously, it needs to be fine tuned a lot more before it is a feasible idea considering if a sword is owned by say 1000 players then, its description couldn't hold that much information and would need to be limited.

I am thinking of using the block chains similar to the above example except bring it to more of a market place type of mechanic. The player maybe goes through dungeons to defeat monsters. The deeper you go the higher the value of your weapon goes up (stats and gold value) and the higher dungeon you get to the more powerful weapon you will need.

As I think about this concept more I find myself wondering how I could avoid extreme inflation of the in game currency. I'd like to get away from micro-transactions but, I know that is a big tool in helping keep inflation down. (i.e. a second currency). What are some other key ways to keep inflation down in a fast growing in-game economy?

I guess the main thing I see happening is that the balance between the skills earned vs. value earned on a weapon need to be extremely similar so that combat farming doesn't occur in the lower levels but also so that players don't just hold onto the same weapon the whole time they play the game either.

I guess that could be part of the solution but, maybe there are more concrete answers out there that may prevent extreme inflation of in game currencies.

sentences:
glGenArrays - This functionality is not available Whenever I call glGenVertexArrays(), I get the following exception:

  Exception in thread "main" java.lang.IllegalStateException: This functionality is not available.
      at org.lwjgl.system.Checks.checkFunctionality(Checks.java:36)
      at org.lwjgl.opengl.GL30.getInstance(GL30.java:651)
      at org.lwjgl.opengl.GL30.nglGenVertexArrays(GL30.java:3101)
      at org.lwjgl.opengl.GL30.glGenVertexArrays(GL30.java:3128)
      at me.package.name.ClassName.methodName(ClassName.java:ANY_LINE_NUMBER)

The operating system is OS X Yosemite 10.10.2, Java 7. I think that this problem is OS X specific.

Immediate mode drawing does work.

I am using LWJGL 3.

sentences:
Having trouble combining clampMagnitude and some explosion force I have a character that uses rigidbody, and I am using AddForce() to make it move. And so I do rb.velocity = Vector3.ClampMagnitude(rb.velocity, maxSpeed) to limit diagonal speed. Yes that did worked but my problem is adding for example explosion force. So if explosion force is very high, it will still clamp the velocity of the player. What way should I use to combine movement that limits diagonal speed and a properly working explosion force toward the player. At least give a clue how can I do it?
My only main problem here is the way that I implemented to limit diagonal movement. I wanna improve that by not using Vector3.ClampMagnitude() so the AddExplosionForce() will work properly to the player. Because clamping magnitude of the player will also limit the velocity when it is affected by the explosion force.
So can anyone give a clue how can I implement to limit diagonal movement without using clamp magnitude?
I thought about normalizing the move like:
Vector3 move = transform.right * x + transform.forward * z;
move = move.normalized * Time.deltaTime * moveSpeed;

But I realized I am using AddForce(). Even though I limited the diagonal speed, it will go faster and faster because there is no maxSpeed. Help please.

sentences:
Data structure fo a ship like in Faster Than Light I am wonder me, whats the best data structure for a ship like in FTL.
At first I thought its easy and I need only to make a array with the rooms(Tiles).
But than I noted, that I must put somewhere the doors, walls, weapons, crew and systems.
And with this Aspect I don't know a clean data structure.
Have someone a idea ?

If there is something unclear write it and I try to explain.

sentences:
How can I introduce time pressure on the player's decisions? I am designing a hacking game, in which the player usually can take his time thinking about how to overcome the obstacles that he/she currently faces. However, I decided that besides coming up with clever solutions, hacking should also feel intense, and that the game needs some ways to put a time pressure on the player's decisions.

First such mechanic that I added reassured me that I am going in the right direction: Sometimes the player can trigger a network trace, which lasts X seconds and can potentially kick the player out of the network unless he/she reacts quickly enough and succeeds in evading the trace. I would like to add perhaps one or two more mechanics that would put the player under a time pressure, but I am a little stuck and always seem to come up with a variations on  'Countdown', i.e. 'There will be (a punishment) in (X) seconds, unless (some action is taken)', but obviously all those mechanics end up too similar.

In abstract terms — that is, without knowing the particular mechanics in my ruleset — how can I introduce a time-pressure on the player's decisions?

sentences:
Implementing Vehicles in your game In the game i am creating as an hobby (learning is the primal goal of it all) i plan to implement a space ship that the player can enter and use to explore it. I tried to search the internet for the concept of vehicle implementation but i couldnt find anything worth mentioning, and before I start writing the code I really want a clear idea of what I strive for. So id like to ask the pro game developers how should I look at a vehicle, should I think of it as a player's body extention with different mechanics? or should I just think of it as a usable exterior object? What kind of link should be between the player and the drivable vehicle? How do games usually do it, like GTA 2 and that kind of games?

Main Question: What is the basis of vehicle implementation?

P.S. I dont think its important to mention but the game is 2D and top-down perspective, so i guess GTA 2 can be a close reference to what i wanna do, although the gameplay is very different, but ye, the vehicle implementation i want is similar to GTA 2 although i only plan to do a space ship for now.

sentences:
Skeleton bone in incorrect spot in-game yet, blender rig, skeleton mesh and physics asset are all correct and behave properly I've made a custom character and rigged it in blender. Then exported/imported into ue4. It behaves properly in the PHAT and the skeleton mesh looks fine and it all behaves properly in the simulations.
In the BP and in-game the physics all behave fine except 1 single bone rises above the rest and appears to "flip" the root bone for unknown reasons. Almost like all the sudden the root does a 180 and then one specific bone attached rises as a result, not sure if it rises and that flips the root or the root is flipping for some unknown reason.
What I don't understand is why everything is fine until it is in-game/bp. Maybe I'm misunderstanding how physics work with skeleton mesh?

I've been banging my head on the wall trying to figure out phat, skeletons and how physics work in ue4 for about a month now and there is basically 0 docs/tutorials on this. As much as I love being stuck on this problem forever if anyone has an idea on what is going wrong that'd be great.

sentences:
GameObject.FindWithTag throwing weird errors I've got 2 first person controller scripts, one that handles functionality for basic movement, the other handling looking around. I also have a "CursorLockManager" script, that handles the cursor locking, as well as locking movement and looking (for when opening menus and such). At the beginning of the cursor lock script, in the start function, I have two GameObject.FindWithTag lines. One looks for the playerLook script, and the other looks for the playerMove script. I have them both set up the same way, but one of them isn't working.

First few lines of the CursorLockManager script:

public KeyCode menuKey;
public PlayerLook playerLook;
public PlayerMove playerMove;
public bool menuIsOpened;
public GameObject tempMenu;

private void Start()
{

    playerLook = GameObject.FindWithTag("Camera").GetComponent<PlayerLook>();
    playerMove = GameObject.FindWithTag("FP_Controller").GetComponent<PlayerMove>();

}

and the error Unity is throwing:

  UnityException: Tag: Camera is not defined

Line 17 of the CursorLockManager:

        playerLook = GameObject.FindWithTag("Camera").GetComponent<PlayerLook>();

Any help would be greatly appreciated. If you need any further clarification as to anything else, I'd be glad to provide it to you.

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:
Realtime inverse kinematics on unity apps for android and iOS Hello I want to understand how much overheads do implementing inverse kinematics in realtime add.

I am looking at an implementation as such demonstrated in the video. https://www.youtube.com/watch?v=Gyakxv34404&feature=youtu.be

Let me explain the exact requirement now.

Assuming a game of mario, where mario is a 3D Character. And there is a coin placed at a height. So when mario comes into area of effect for the coin, we know the initial position of his arms, and we know the expected final position which is the position of the coin.

So we create a trajectory from initial to final position in realtime and the main character moves accordingly in the trajectory.

Now I can understand this would work fine in editor but if we have exported the game and this computations happen realtime for every object, how much CPU intensive would this be? Do all the existing IK assets provided on store

for example in this video of final IK https://www.youtube.com/watch?v=ZuWvGq3yV44 the characters are following the trajectory in real time I suppose. But what if we were to create the trajectory realtime depending on player positions, would that be a CPU intensive task to NOT work on mobile devices?

sentences:
Beginner: How do I calculate a vector? I am trying to wrap my head around some concepts in a side project I'm working on. I'm struggling with how I can calculate a vector based on my character movement logic. Here are the relevant details of my character movement:

The character's hit box for collisions (and map position validity) is defined as a rectangle: x,y,w,h
A character can move in 8 directions, let's keep this simple to ignore strafing, call this direction:

Left(x-1), Right(x+1), Up(y-1), Down(y+1)
UpLeft(x-1,y-1), UpRight(x+1,y-1),DownLeft (x-1,y+1), DownRight(x+1,y+1)

The character can be in two moving states, again keeping numbers simple:

Walking 1 x offsets
Running 2 x offsets

When a character is moved the following logic happens:

Create their proposed new hit box by adding an offset to their x & y coordinates based on their direction, call this proposedHitBox
Check if the proposedHitBox is a valid position on the map, if so, then update the character's position to the location defined on the proposedHitBox
If the proposedHitBox is not a valid location on the map it should try to glance the character. This is where I'm having trouble.

Given all this, how do I essentially, calculate a vector of their proposed motion?

Example:

Character is at 10,10.
Character starts running.
Input is DownLeft.
Proposed location is 8,12 (x-(1x2),y+(1x2)).
Proposed location is valid.
Update character position to 8,12.
What calculation defines my vector? How does magnitude come from this? Is that generally stored as Z in a 2D game? So I'd use a Vector3 to store it? How does velocity come into this?

I'd assume my vector is a 45deg angle from current to proposed...?

Edit

Here is a picture of what the walls can look like in the game. The red box being the hit box as discussed above. The character is bound inside the blue polygon (which represents outer walls). Black being inner walls. The way I was doing glancing was overlaying 4x4 tiles across this entire map and then for each tile that the character should glance on I would choose an incoming direction (i.e. DownLeft) and then redirect them to a different direction (i.e. Down) which should make the proposed hit box in a valid position. This is however very tedious as I have to create glances for multiple directions for every tile. I'm looking for hopefully a better way.

I was reading that you could add vectors to each tile but I'm not sure how this works because on some tiles a incoming direction does not always have the same out direction.

sentences:
Problem with Rotation - C#/XNA I have a projecile(Hook) and the tail of the projectile(yellow balls)

TailProjectile class draws a ball at the exact position of the projectile(hook) and let it there until the projectile ends

I'd like to draw the ball at the start of the hook(red circle) because by now it draws at the projectile image position(blue point)

How can I do it independent of the rotation of the hook?

This is how I calculate the rotation of the projectile

distanceY = endPosition.Y - initialPosition.Y;
        distanceX = endPosition.X - initialPosition.X;

        if (distanceX < 0)
            animation.SprtEffects = SpriteEffects.FlipVertically;
        animation.Rotation = (float)Math.Atan2(distanceY, distanceX);

Then I pass the projectile to the tail and draw the ball

        if (hasTail)
            tail.Update(gameTime,  position , animation.Rotation,animation.SprtEffects);

And at the TailProjectile update class :

  public void Update(GameTime gameTime,Vector2 p,float rotation,SpriteEffects sprtEffect)
    {
        if (Vector2.Distance(animations[animations.Count - 1].Position, p) > distanceBetween)
        {
            Animation tempAnimation = new Animation();
            tempAnimation.LoadContent(content, image, "", p);
            tempAnimation.Rotation = rotation;
            tempAnimation.SprtEffects = sprtEffect;
            tempAnimation.DrawColor = color;
            animations.Add(tempAnimation);
        }

And the Animation Draw:

spriteBatch.Draw(image, position + origin, sourcRect, drawColor * alpha, rotation, origin, scale, sprtEffects, 0.0f);

Edit: Using rotation matrix solve half of the problem :

My problem now is how can I calculate it for angles higher than 90º ? (third picture of the image)

 double xO, yO;
        xO = originpoint.X * Math.Cos(rotation) - originpoint.Y * Math.Sin(rotation);
        yO = originpoint.X * Math.Sin(rotation) + originpoint.Y * Math.Cos(rotation);
        initialAnimation.Position = new Vector2((float)xO + initialAnimation.Position.X, (float)yO + initialAnimation.Position.Y);

sentences:
RPG and human psychology Is there any book or article that describe interaction of RPG elements and human psychology?

For example: what will be more popular and attracting for people - linear function of experience per level or exponential function of experience per level?

sentences:
Are there definitive, unambiguous terms for hexagon tile orientations? I have been working on a tile map editor and plan to support two orientations for hexagons. I have seen various terms used, but these all seem ambiguous to me.

Horizontal, Vertical (ambiguous: does this mean they line up horizontally, or stack horizontally?)
Flat, Pointed (ambiguous: Are they flat on the sides or top and bottom?)

I would like to find unambiguous terms for the following two orientations for hexagons -- ideally, these would be definitive and succinct (I could refer to these as "Flat on Top" and "Pointed on Top" but would prefer something more technical and authoritative).

Edit: I was holding out for something more technical, but it's hard to argue with Amit. For me, "pointed" sounds more formal than "pointy," so I am going to use the following (a decision reinforced by DMGregory's answer): Flat-top and Pointed-Top.

sentences: LIBGDX Image tearing I'm making an game in libGDX and I have been noticing some image tearing when camera is moving. Note that it happens only when the game is maximized and the camera x position is less than screen width and camera y position is less than screen height. Here's a GIF showing what is the problem The color errors are not the problem here, it is the GIF fault

sentences:
How do you organize your game files and classes? Although it isn't necessary to exclude things like graphics and audio packages, I'm most interested in the organization of the folders for classes that deal with AI and game state. I'm thinking something like this in Java using packages as the example:

import com.rpg.characters;
import com.rpg.characters.antagonist;
import com.rpg.characters.neutral;
import com.rpg.characters.protagonist;
import com.rpg.characters.state;
import com.rpg.gameplay;
import com.rpg.gameplay.engine;
import com.rpg.gameplay.maps;
import com.rpg.weapons;

Also, does it make a huge difference between 2d and 3d games?

sentences:
Why doesn't Unity keep keydown states between scenes, and how can I change that? So basically, when my scene in Unity changes and I'm holding down, say, Right or Left, when the scene resets, my player (and Unity) doesn't even recognize that I'm still holding that button, until I lift my finger and put it back.

Any thoughts?

Sorry for any broken English or anything, I'm running off two hours of sleep.

sentences:
Balancing game difficulty against player progression It seems that the current climate of games seems to cater to an obvious progression of player power, whether that means getting a bigger, more explosive gun in Halo, leveling up in an RPG, or unlocking new options in Command and Conquer 4.

Yet this concept is not exclusive to video or computer games -- even in Dungeons and Dragons players can strive to acquire a +2 sword to replace the +1 weapon they've been using.

Yet as a systems designer, the concept of player progression is giving me headache after headache. Should I balance around the players exact capabilities and give up on a simple linear progression? (I think ESIV:Oblivion is a good example of this) Is it better to throw the players into an "arms race" with their opponents, where if the players don't progress in an orderly manner, it is only a matter of time until gameplay is unbearably difficult? (4th Edition DnD strikes me as a good example of this) Perhaps it would make most sense to untether the core gameplay mechanics from progression at all -- give them flashier, more interesting (but not more powerful!) ways to grow?

sentences:
How can I scroll my tile maps? I've been trying to understand how I can use matrix to implement a smooth tile scrolling system but I fail miserably.

So I have a pretty big world stored in a multi-dimensional array which is drawn like this :

 for (int i = 0; i < screenHeight / 32; i++)
            for (int j = 0; j < screenWidth  / 32; j++)
               spriteBatch.Draw( texture[i + offsetY][j + offsetX] , screenRectangle[i + offsetY][j + offsetX] , Color.White );

Can somebody give me some tips on what to do or at least explain the logic behind the matrix translation?
Thank you.

sentences:
Do i lose performance doing this public class TileObject : MonoBehaviour {

////some code was here
public PlayerAnimator playerAnimator;

////some code was here

public void SetTileObject(int xPos, int yPos, TileData tileData)
{
   ////some code was here

    if (tileData.player)
        playerAnimator = new PlayerAnimator();
}

And my question do i lose any performances(or memory) doing this instead of inheritance or something else.(tileObject can be other than player)

sentences:
Combining several animations into a single FBX I'm trying to figure out a workflow for preparing character animations for Unity so that they are all combined in a single FBX file. The advantage as far as I see it is that it then uses only a single skeleton where multiple animation files would each have their own skeleton (which I think is unnecessary and would increase size considerably).

I've tried using Maya for this but haven't been successful so far. Then I tried Motionbuilder and I can get the animations (takes) together into a single file but many of the animations don't look right afterwards.

So I was wondering does anyone know of a solid workflow to achieve this? I'm having a hard time finding information about what I'm trying to achieve. This is probably a piece of cake for experienced animators but I'm just starting with animation now.

So how do you combine several animation FBX files into single one (whith either Maya, Motionbuilder, or 3DSMax) and make sure that the animations are all properly retained like they should? I'm sure there are some additional things to take care of but I don't know exactly what they are.

sentences:
How to make a door stay open if the player is inside the trigger zone? I've been struggling with this for all day long, I want to make a door to stay open when the player is inside the trigger zone, but I cannot make it happen...

Here is what I did:

A basic animations and animator (Open, Close, Idle/Default)
Default transitions between states (with and without "Exit Time")
A basic script to check if the player is inside the trigger:

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

public class DoorScript : MonoBehaviour
{
    Animator _animator;
    bool doorOpen;

// Use this for initialization
void Start ()
{
    doorOpen = false;
    _animator = GetComponent<Animator>();
}

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

} */

void OnTriggerEnter(Collider other)
{
    if (other.tag == "Player")
    {
        doorOpen = true;
        DoorController("isOpen");
    }
}

void OnTriggerExit(Collider other)
{
    if (other.tag == "Player")
    {
        doorOpen = false;
        DoorController("isClosed");
    }
}

void DoorController(string trigger)
{
    _animator.SetTrigger(trigger);
}
}

And my result is the same, the animation of the door repeats itself even when the player is in the trigger zone, I tumbled upon some other resources (here... here... here... here I tried to copy what this person did, but is the same... here... and here) about doors and triggers, and I still don't know how I am wrong or what am I doing wrong, I tried everything in those links

The door goes through all animations regardless the script, and the parameters, when I move my player inside the trigger zone loops between open and close animations no matter what

Could some one help me with this?

Thanks in advance

EDIT:

Here are some screenshots of my animator and updated code, for this update I followed this tutorial, just a little difference, I'm using a FPS Controller from the Unity standard assets

Updated code:

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

public class DoorScript : MonoBehaviour
{
    Animator _animator;
    bool doorOpen;

    // Use this for initialization
    void Start ()
    {
        doorOpen = false;
        _animator = GetComponent<Animator>();
    }

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

    } */

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            doorOpen = true;
            DoorController("isOpen");
        }
    }

    void OnTriggerExit(Collider other)
    {
         //These lines were modified
        if (doorOpen)
        {
            doorOpen = false;
            DoorController("isClosed");
        }
    }

    void DoorController(string trigger)
    {
        _animator.SetTrigger(trigger);
    }
}

sentences:
My player won't move My player sprite won't move if I use the A/D keys or the arrow keys. If I try to use them then the sprite will stretch and won't move at all. But if I try to jump before I press the A/D or left/right arrow keys then it will jump. If I press the A/D or left/right arrow keys then it will stretch again and I have to reload the game to jump again.
This is my code.
Create Event:
hsp = 1;
vsp = 0;
grv = 0.5;
walksp = 4;

Step Event:
// get player input
key_left = keyboard_check(vk_left) || keyboard_check(ord("A"));
key_right = keyboard_check(vk_right) || keyboard_check(ord("D"));
key_jump = keyboard_check_pressed(vk_up) || keyboard_check(ord("W"));

//calculate movement
var move = key_right - key_left;

hsp = move * walksp;

vsp = vsp + grv;

if (place_meeting(x,y+1,oWall)) && (key_jump)
{
    vsp = -7;
}

//horizontal collision
if (place_meeting (x+hsp,y,oWall))
{
    while (!place_meeting(x+sign(hsp),y,oWall))
    {
        x = x + sign(hsp);
    }
    hsp = 0;
}
x = x + hsp;

//vertical collision
if (place_meeting (x,y+vsp,oWall))
{
    while (!place_meeting(x,y+sign(vsp),oWall))
    {
        y = y + sign(vsp);
    }
    vsp = 0;
}
y = y + vsp;

//animation

if (!place_meeting(x,y+1,oWall))
{
    sprite_index = sPlayerA;
    image_speed = 1.5;
}
else
{
    image_speed = 1;
    if (hsp == 0)
    {
        sprite_index = sPlayer;
    }
    else
    {
        sprite_index = sPlayerR;
    }
}

if (hsp != 0) image_xscale = sign(hsp);

I don't know why this is happening.

sentences:
Implementing a build queue in a browser based game I need to be able to execute certain events at a given time in my game, for example, say the player "Builds a building" this building should take 15mins to process. Implementing this seems straightforward enough, simply enter the event into the database and execute the event when the time comes for it to be completed.

However, it is my understanding that i would need a script that is running permanently on the server and continually checks the event database for delayed events to execute and process them as needed. My question is, is this the right approach or should i be tackling the "event que" differently?

Some of the events that will be processed can effect many different players so they would need to happen in real time, as opposed to be lazy loaded.

You can see similar such event queues in browser games such as travian, grepolis etc.

Update - If i was to implement a purely lazy load method, are there any flaws in the following pseudo code?

    ## upon player_x pages load

## start a loop that will only exit once all needed events have been processed

## check for any events initiated by player_x that are overdue

## get event and lock it for processing

    ## does this event involve another players object?

        ## if it does, then lets check if said object also has any events that should happen before this event

            ## if it has, then lets process one of those events instead, and loop again once processed

            ## if it doesnt have any previous events, then we're free to process this event, do it

## loop till all overdue events for player_x's object are done

sentences:
How to apply outer glow to a UI game object? Shader? Particle? What's the best or easiest approach to apply an outer glow effect to a UI game object -- let's say, a popup dialog, so it's a rectangular shape -- in Unity 2018.3?

Is this something that should be done with a shader, or is it a particle effect?

Ideally I should be able to specify and perhaps even dynamically adjust the color and size of the glow.

Edit: image below shows a blue rectangle, which has this subtle, grey glow around it. I'm hoping to generate this glow effect somehow in Unity.

sentences:
What does everyone like to use for UI elements for their games on the iPhone? I'm asking this to get everyone's opinion -- I realize there isn't one "right way" to do this.  I've tried a few ways myself, including using Cocoa for everything including the game itself (good for simpler games, like card games for example), using Cocoa for the screens outside of the game and using my game engine to present game objects on the screen as UI.

What do people prefer to use for game UI?  I'm particularly interested in hearing about why you chose to go that way and if you found that your choice was a good one after implementing it.

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:
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:
Quake 1: frame timer If  you check Quake 1 source code (sys_linux.c), you can see something like this:

double          time, oldtime, newtime;

double Sys_FloatTime (void)
{
  struct timeval tp;
  struct timezone tzp;
  static int      secbase; // new epoch

  gettimeofday(&tp, &tzp);

  if (!secbase)
  {
    secbase = tp.tv_sec;
    return tp.tv_usec/1000000.0;
  }

  return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
}

while (1)
{
  // find time spent rendering last frame
  newtime = Sys_FloatTime ();
  time = newtime - oldtime;

  if (time > sys_ticrate.value*2) // 50 ms * 2
    oldtime = newtime;
  else
    oldtime += time;

  Host_Frame (time);
}

Why does Quake do = some time and += at other times? I suppose it must be some floating point issue, but Sys_FloatTime() returns a double, which is very accurate. It is also adjusted to return seconds from the start of the program, it doesn't count from 1/1/1970. Changing the code to use assignment at all times, doesn't seem to change anything.

EDIT: If you check QW source code, you will see, that Sys_FloatTime() is renamed to Sys_DoubleTime(). But even if a float was returned, why would using += vs = make any difference? IMO, ever using a float for something like this was wrong, plain and simple.

sentences:
Is it ok to use NPOT textures with OpenGL in this situation? I drew some icons to use on orthographic projection and instead of loading each icon file individually as a texture I thought of putting them all together in one single file. Now I have a file 72x36 which is not a power of two. This texture is divide in two icons, both with 36px wide.

I didn't remember about this restriction when designing the texture but I eventually noticed it when the texture didn't load because I have an if statement checking if the texture is a power of two, if it's not, than the texture is not loaded. I commented that code to see if the texture loaded anyway and it did. The texture was loaded and properly applied to the area I wanted.

To draw the first icon I do this:

glBindTexture(GL_TEXTURE_2D, gameTextures.hudKeys);
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex2f(0, 36);
    glTexCoord2f(0.5, 0); glVertex2f(36, 36);
    glTexCoord2f(0.5, 1); glVertex2f(36, 0);
    glTexCoord2f(0, 1); glVertex2f(0, 0);
glEnd();

And for the second this:

glBindTexture(GL_TEXTURE_2D, gameTextures.hudKeys);
glBegin(GL_QUADS);
    glTexCoord2f(0.5, 0); glVertex2f(0, 36);
    glTexCoord2f(1, 0); glVertex2f(36, 36);
    glTexCoord2f(1, 1); glVertex2f(36, 0);
    glTexCoord2f(0.5, 1); glVertex2f(0, 0);
glEnd();

Which is easy to understand, I only use half of the texture depending on which icon I want.

I don't want my icons to be distorted or stretched, the icons were designed with 36x36 in mind. If I use a power of 2 texture, for instance 128x64 (that's the lowest possible to fit a 72x36 texture), how do I properly map the 36x36 texture area I want to the quad?

Or maybe I can keep doing using this NPOT texture or should I still really create a power of 2 texture? How to fix the problem above then?

sentences:
Actor not scaling from center I want to scale the start button from the center with initially scaled to 0.3 times.

    start = new ImageButton(new TextureRegionDrawable(new TextureRegion(startTex)));
    start.setTransform(true);
    start.setScale(0.3f);
    start.setOrigin(Align.center);
    start.addAction(forever( sequence(scaleTo(1.5f,1.5f,1f), scaleTo(1, 1, 0.5f), delay(0.5f)) ));
    table.add(start).expandX().colspan(2).size(start.getWidth()*0.3f);

It scales the button but not from the center.

When I remove size method from above, button scales from the center, but it starts from its initial size rather than 0.3 times.
I am stuck at this. Please help me.

sentences:
Vertex data from a buffer I'm using a geometry shader to generate polygons for my voxel terrain (marching cubes).  The data is output into a buffer using the method shown in the article I link to below.

http://msdn.microsoft.com/en-us/library/bb205122%28v=vs.85%29.aspx

Is there any way to somehow extract the vertex data from the buffer, sort of like the inverse operation of this?

struct Vertex
{
    float x, y, z;
    float tu, tv;
}

Vertex[] data = new[] // this is what I want to get
{
    ...
};

DataStream stream = new DataStream(bufferSize, true, true);
stream.Write(data);
stream.Position = 0;
buffer = new Buffer(device, stream, description);

sentences:
Problem with GLFW input I am using GLFW for the input in my game. I just started learning it and I have encountered a problem. The problem is the input, I have a callback function, where I check for keypresses. I want the program to toggle wireframe mode when the user press 1, therefore I have this code:

if(key == '1' && action == GLFW_PRESS)
{
    wireframe = !wireframe;
}

The problem is that I am Czech and we obviously have different keyboard layout - I use english keyboard layout for programming and when I press 1 it works, however, when I press the same key on czech layout it doesn't work, probably because we have to press Shift along with the '1' key to actually get the 1 on the screen. It may seem obvious that it does not work, but when I used SFML it worked.

I also tried replacing the '1' with 49 or 0x0031, but the result is the same.

Is there a solution or do I have to set the layout manually by the system API?

Thanks in advance.

sentences:
GLSL, all in one or many shader programs? I am doing some 3D demos using OpenGL and I noticed that GLSL is somewhat "limited" (or is it just me?). Anyway I have many different types of materials. Some materials have ambient and diffuse color, some materials have ambient occlusion map, some have specular map and bump map etc.

Is it better to support everything in one vertex/fragment shader pair or is it better to create many vertex/fragment shaders and select them based on currently selected material? What is the usual shader strategy in OpenGL or D3D?

sentences:
Windows-Linux cross platform game The answers to this cross-platform related question are useful, however I want my (C++) game to run on Windows and Linux (and be packaged for Ubuntu) only. I'm not interested in platforms like mobile or consoles.

Are there any specific tips or suggestions for this case?

Also, if I get the game to work on linux, is it difficult to add support for OSX?

Updating with more information:

It will be a 3D game simulating the motion of spacecraft in the solar system. We will use Ogre3D for the graphics. We're still in the design phase, so there's no code written yet.

sentences:
Translation Matrix not working properly Hello,
I get this result when i try to scale and then translate a vec4 in my shader.
I created a mat4x4 class on my own and some functions wich return some matrices for me, everything works, but not the translationfunction.

Currently, I use this Shader Codes:

GLchar* vertexShaderCode = {
"#version 330 core                              \n"
"layout(location=0) in vec3 position;           \n"
"uniform mat4 scale;                            \n"
"uniform mat4 translate;                        \n"
"out vec4 vertexColor;                          \n"
"void main()                                    \n"
"{                                              \n"
"   gl_Position = translate*scale*vec4(position,1.0); \n"
"   vertexColor = vec4(1.0f,0.5f,0.7f,1.0f);    \n"
"}                                              \n"

GLchar* fragmentShaderCode = {
"#version 330 core                              \n"
"in vec4 vertexColor;                           \n"
"out vec4 color;                                \n"
"void main()                                    \n"
"{                                              \n"
"   color = vertexColor;                        \n"
"}                                              \n"

The matrix setup looks like this:

program.use(true);
h3d::mat4x4 mat_scale,
            mat_translate;
mat_scale     = h3d::Math::scale(.5f, .5f, 0.f);
mat_translate = h3d::Math::translate(.5f, .5f, 0.0);

GLint location_scale       = program.Uniform.getLocation("scale");
GLint location_translation = program.Uniform.getLocation("translate");

program.use(true);
glUniformMatrix4fv(location_scale,      1, GL_TRUE,mat_scale.getRowWiseValues());
glUniformMatrix4fv(location_translation,1, GL_TRUE,mat_translate.getRowWiseValues());

So basically, the h3d::Math::scale(X,Y,Z) returns:

X,0,0,0
0,Y,0,0
0,0,Z,0
0,0,0,1

And h3d::Math::translate(X,Y,Z) returns this:

1,0,0,X
0,1,0,Y
0,0,1,Z
0,0,0,1

The vertices are normal:

GLfloat vertices[] = {
    -1.0f, 1.0f, 0.f,
     1.0f, 1.0f, 0.f,
     1.0f,-1.0f, 0.f,
    -1.0f,-1.0f, 0.f,
};

What do I am doing wrong ? I really appreactiate your help !
All the other matrices are working (scale, rotate, perspective).

sentences:
Unity3D: Photon syncing physics events I'm making a billiard game and I wanna implement multiplayer in it. Since updating the movement in every frame is inefficient and laggy, I thought I could remake the events in game happen in all clients but for some reason they differ from one another.

The direction that the ball launches is correct but it starts to differ for different users when it collides with other balls(if it collides only with the wall it's fine). Technically this shouldn't happen IMO.

This is the code I use to add force to the player ball:

I use this to launch the player ball

photonView.RPC("FireBall", PhotonTargets.All, storedDirection, power);

This is the function that adds the force to the player ball.

[PunRPC]
    public void FireBall(Vector3 stordDir , float poww)
    {
        rigidbody.AddForce(stordDir.normalized * poww, ForceMode.Impulse);
    }

I use this function to get the desired direction of the player.

public void UpdateStickPosition()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
        {
            if (Input.GetKeyDown(KeyCode.Mouse0)
            {
                storedDirection = hit.point - transform.position;
            }
        }

    }

I appreciate all help given, don't hesitate to ask me any questions.

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 to flatten the collider for a tilemap? I am relatively new to game development, and am working on a simple 2D platformer. I have created a tilemap and painted some tiles for the character to walk on.. but he is getting stuck. Yes, I know this is a common question and I did find some answers (including this one: Player gets stuck on edges between TilemapCollider2D tiles), but none seem relevant for me. The thing is my tiles are not flat.. they have pointy edges due to grass.. see the image below:

As you can see, the edge is not flat. I have overcome the problem of getting stuck by changing the "Edge Radius" to what you see in the above screenshot and that works, but the character now looks like he is floating slightly above the ground. Is there any way I can just tell Unity to ignore the jagged grass and make the collider flat and move the edge of it down a bit? That way it would fix the issue and also have the added bonus of looking like some of the grass is behind him and some in front..

sentences:
Damage indicator screen overlay I want to make something already done by a lot of games , which is when I am taking so much hits from enemy red screen drawn like the following  , using XNA 4.0:

after it's drawn and I am still alive I want to be removed slightly as in the call of duty !!!

sentences:
deferred rendering and point light radius I use a common attenuation equation for point lights:
attenuation = 1 / kc + kl * d + kq * d^2.

I use deferred rendering so I need to know a light radius. An example light has following intensity: vec3(10, 1, 8). RGB components can be greater
than 1.0 beacuase of HDR/Tone Mapping. How to calculate a light radius ?

Edit1
An attenuation equation can be defined this way (link) and we get following equations:

attenuation = 1 / ( (d / r) + 1) ^ 2
attenuation = (attenuation - cutoff) / ( 1 - cutoff)
attenuation = max(attenuation, 0)
lightRadius = r * (sqrt(Li / cutoff) - 1)
cutoff = minLuminance / lightLuminance
Li = lightLuminance

Let's assume that d = 40, r = 1, lightLuminance  = 10 and minLuminance = 0.01. Then: lightRadius = 99 but attenuation = 0. What is wrong ?

sentences:
swipe control can't destroy gameobject I tried to make a game where you can destroy something when you swipe or tap. However, it says NullReferenceException & while the swipe control actually works, the gameobject can't be destroyed.

public class checkUp : MonoBehaviour {
private Swipe swipe;
private UIManager uiManager;

private void Awake()
{
    swipe = GetComponent<Swipe>();
    uiManager = GetComponent<UIManager>();
}

// Update is called once per frame
void Update()
{
    if (swipe.SwipeUp ) //NullReferenceException: Object reference not set to an instance of an object
    {
        Debug.Log("Passed!");
        uiManager.destroyed = true;
        Destroy(gameObject);
    }

Here's the partial code from swipe:

    if (swipeDelta.magnitude > 125)
    {
        //which direction?
        float x = swipeDelta.x;
        float y = swipeDelta.y;
        if (Mathf.Abs(x) > Mathf.Abs(y))
        {
            //left or right
            if (x < 0)
                swipeLeft = true;
            else
                swipeRight = true;
        }
        else
        {
            // Up or down?
            if (y < 0)
                swipeDown = true;
            else
                swipeUp = true;
        }
    }

sentences:
How does Unity pick which sprite atlas to load? I plan to use sprite atlases for my 2D game. All my animation is sprite animation so I'm going to use sprite atlases for my characters' sprites.
My question is, if I put the same sprite in two different atlases, how does Unity decide which atlas to load?
EX:
I have a sprite atlas per level that contains the background for that level.  Sometimes, there's space left over in the atlas.  So, if I want to put a sprite, which already exists in another atlas, in the empty space for that level's atlas, how does Unity know not to load both atlases?

sentences:
I finished "Beginning Android Games", should I use its framework? I've worked through Mario Zechner's "Beginning  Android Games" and have made my own pong and asteroids game using the framework used in the book. I have also downloaded the source code for Replica Island and am able to run that.

I like Replica Island's framework over the one I made from reading the book. Some differences are that Replica Island uses different activities for each screen instead of Zechner's Screen class and that Replica Island can use a lot of textures and isn't limited to textures with dimensions of powers of 2.

If I'm serious about writing games and apps for Android should I learn Replica Island's framework and use that instead of the one I made while reading Zechner's book?

sentences:
Loading dynamically created files with XNA I'm trying to implement a structured save/load functionality so if the user saves, it will take up one of 10 slots, and if the user loads, they would select one of these slots.

To do this, I need the game to load files from a predefined location, but I can't seem to find a good way to do this. I tried using TitleContainer, but this requires the files to be explicitly added to the project and their properties changed to copy to the output directory in the bin. I've also looked at User data loading, but all the examples I can find are for asynchronous file loading where the user selects a file.

Is there any way to load dynamically created files from a fixed location with XNA, such as save files?

sentences: Is Edge by Mobigames 3D or isometric 2D? I'm trying to make a similar to http://www.cultofmac.com/edge-for-iphone-controversy-rumbles-on-game-again-pulled-from-app-store/13115, but I'm not sure if it's real-time 3D or just really good 2D. Any thoughts?

sentences:
Reducing draw calls in a y-sorted orthogonal world This is a hypothetical question, as I haven't yet come across the problem of making too many draw calls, but for my game I am aware that this could become a potential problem.

The style of my game is similar to an old school top down RPG, except the characters and environment are high resolution and not tile based.
With moving characters and objects, different textures and geometries are flitting between layers constantly. It's all in 2D.

Currently I'm finding it very hard to batch anything.
As I understand, batching requires that multiple geometries appear at the same depth with the same texture. Unfortunately, this doesn't leave me many opportunities to batch.
Also consider the high resolution of the textures does not allow me put everything in a single spritesheet, and the z-order of a scene is constantly changing (characters and objects move around)

I'm now trying to add some kind of deferred lighting system and with my many draw calls this appears somewhat incompatible.

I should probably mention I'm fairly new to the concept of GPU rendering. I come from Flash.

This isn't a question really, but I'd appreciate some advice.

sentences:
How to deal with arbitrarily large images in 2D games? Question

When you have a 2D game that uses really large images (larger than your hardware can support), what do you do? Maybe there's some interesting solution to this problem that never occured to me before.

I'm basically working on a sort of graphic adventure game maker. My target audience are people with little to no game development (and programming) experience. If you were working with such an application, wouldn't you prefer for it to handle the problem internally rather than telling you to "go split your images"?

Context

It's well known that graphic cards impose a set of restrictions on the size of the textures they can use. For instance, when working with XNA you're restricted to a maximum texture size of 2048 or 4096 pixels depending on which profile you choose.

Usually this doesn't pose much a problem in 2D games because most of them have levels that can be constructed from smaller individual pieces (e.g. tiles or transformed sprites).

But think about a few classic point'n'click graphic adventure games (e.g. Monkey Island). Rooms in graphic adventure games are usually designed as a whole, with little or no repeatable sections, just like a painter working on a landscape. Or perhaps a game like Final Fantasy 7 which uses large pre-rendered backgrounds.

Some of these rooms can get pretty large, frequently spanning three or more screens of width. Now if we consider these backgrounds in the context of a modern high definition game, they will easily exceed the maximum supported texture size.

Now, the obvious solution to this is to split the background into smaller sections that fit within the requirements and draw them side by side. But should you (or your artist) have to be the one splitting all of your textures?

If you're working with a high level API, shouldn't it perhaps be prepared to deal with this situation and do the splitting and assembling of the textures internally (either as a pre-process such as XNA's Content Pipeline or at runtime)?

Edit

Here's what I was thinking, from a XNA implementation point of view.

My 2D engine only requires a very small subset of Texture2D's functionality. I can actually reduce it down to this interface:

public interface ITexture
{
    int Height { get; }
    int Width { get; }
    void Draw(SpriteBatch spriteBatch, Vector2 position, Rectangle? source, Color  color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth);
}

The only external method I use that relies on Texture2D is SpriteBatch.Draw() so I could create a bridge between them by adding an extension method:

    public static void Draw(this SpriteBatch spriteBatch, ITexture texture, Vector2 position, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth)
    {
        texture.Draw(spriteBatch, position, sourceRectangle, color, rotation, origin, scale, effects, layerDepth);
    }

This would allow me to use an ITexture interchangibly whenever I used a Texture2D before.

Then I could create two different implementations of ITexture e.g. RegularTexture and LargeTexture, where RegularTexture would simply wrap a regular Texture2D.

On the other hand, LargeTexture would keep a List of Texture2D's each corresponding to one of the splitted pieces of the full image. The most important part is that calling Draw() on the LargeTexture should be able to apply all the transformations and draw all the pieces as if they were just one contiguous image.

Finally, to make the entire process transparent, I'd create an unified texture loader class that would act as a Factory Method. It would take the path of the texture as a parameter and return a ITexture which would be either a RegularTexture or a LargeTexture depending on the image size exceeding the limit or not. But the user didn't need to know which one it was.

A bit overkill or does it sound okay?

sentences:
What are the disadvantages of using multiple inheritance to implement components? I've been doing research on component-based game engines and would like to use that model for future game projects. From what I gather, objects in a component-based system are just collections of attributes and behaviors. The examples I've seen have a high-level interface such as Attribute<T> *Entity::getAttribute<T>(int id) but discussions about those systems often talk about performance problems. It seems like this could be implemented with greater efficiency in C++ using multiple virtual inheritance since the compiler could inline attribute accesses and behavior method calls:

// Layer 1: Base
struct Entity {
  virtual ~Entity() {}
  virtual void draw() {}
  virtual void update(float seconds) {}
};

// Layer 2: Attributes each extend from Entity
struct Position : virtual Entity { Vector3 pos; };
struct Velocity : virtual Entity { Vector3 vel; };
struct Health : virtual Entity { int health; };
struct Target : virtual Entity { Position *target; };

// Layer 3: Behaviors extend from the attributes they need
struct Renders : virtual Position {
  Model model;
  void draw() { model.draw(); }
};
struct Moves : virtual Position, virtual Velocity {
  void update(float seconds) { pos += vel * seconds; }
};
struct Seeks : virtual Moves, virtual Target {
  void update(float seconds) {
    if (target) vel = (target->pos - pos).unit();
    Moves::update(seconds);
  }
};

// Layer 4: Definitions extend from the behaviors they need
struct Rocket : virtual Health, virtual Renders, virtual Seeks {};

However, many component-based engine resources discount multiple inheritance without really saying why. I'm sure I'm missing something, but what are the disadvantages of using multiple inheritance like this over lists of components? I know calls to base classes when using multiple inheritance incur an additional constant offset, but that seems better than going through a run-time map for each attribute access. The only disadvantage that I can think of is not being able to swap out components at run-time.

Resources:

http://www.gdcvault.com/play/1911/ (PPT)
http://www.richardlord.net/blog/what-is-an-entity-framework

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:
Slick2D crashes on Image.getGraphics() on some machines On some machines, creating a new Image and calling getGraphics() on it causes lwjgl to enter into some kind of faulty state that crashes when swapping buffers. Any idea what causes this and how to make Slick clean up after itself properly?

Reproduction code:

package crashrepro;

import org.newdawn.slick.*;

public class CrashRepro extends BasicGame {
    public static void main(String[] args) throws Exception {
        CrashRepro cr = new CrashRepro("CrashRepro");
        // Crash only happens in fullscreen mode.
        AppGameContainer agc = new AppGameContainer(cr, 800, 600, true);
        agc.start();
    }

    public CrashRepro(String title) { super(title); }

    @Override
    public void init(GameContainer gc) throws SlickException {}

    @Override
    public void update(GameContainer gc, int i) throws SlickException {}

    @Override
    public void render(GameContainer gc, Graphics grphcs) throws SlickException {
        Image img = new Image(128, 128);
        img.getGraphics(); // This crashes the game.
    }
}

Stack trace:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.WindowsContextImplementation.nSwapBuffers(Ljava/nio/ByteBuffer;)V+0
j  org.lwjgl.opengl.WindowsContextImplementation.swapBuffers()V+35
j  org.lwjgl.opengl.ContextGL.swapBuffers()V+3
j  org.lwjgl.opengl.DrawableGL.swapBuffers()V+0
j  org.lwjgl.opengl.Display.swapBuffers()V+39
j  org.lwjgl.opengl.Display.update(Z)V+44
j  org.lwjgl.opengl.Display.update()V+1
j  org.newdawn.slick.AppGameContainer.gameLoop()V+78
j  org.newdawn.slick.AppGameContainer.start()V+17
j  crashrepro.CrashRepro.main([Ljava/lang/String;)V+27
v  ~StubRoutines::call_stub

sentences:
Load 3D model from external directory I am developing a desktop application that want to load the 3D model from desktop. Using file explorer user wants to choose the 3d model then it want to show in the application scene.I tried to find the object, the path is detecting but if i tried to Instantiate it on unity it showing this error.

  ArgumentException: The Object you want to instantiate is null.

here the code is used

public class ReadData : MonoBehaviour {
string path;
GameObject go;
public void OpenExplorer(){
    path = EditorUtility.OpenFilePanel("Overright with model", "", "dae");
    Debug.Log(path);
    GetObj();
}

void GetObj()
{
    if(path!=null)
    {
        UpdateObject();
    }
}

void UpdateObject()
{
    WWW www = new WWW("file:///" + path);
    go = GameObject.Find(path);
    Instantiate(go);
}}

Anybody please help me to do this. Thanks in Advance.

sentences:
How to optimize a box2d simulation in action game? I'm working on an action game and i use box2d for physics. The game use a tiled map.

I have different types of body:

Static ones used for tiles
Dynamic ones for player and enemies

Actually i tested my game with ~150 bodies and i have a 60fps constantly on my computer but not on my mobile (android). The FPS drop as the number of body increase.

After having profiled the android application, i saw that the World.step took around 8ms in CPU time to execute.

Here are few things to note:

Not all the world is visible on screen, i use a scrolling system
Enemies are constantly moving toward the player so there is alaways to force applied to their body
Enemies need to collide between each others
Enemies collide with tiles

I also now that i can active/desactive or sleep/awake bodies.

Considering the fact that only a part of the enemies are possibly displayed on screen, is there any optimizations i can do to reduce the execution time of box2d simulation?

I found a guy trying an optimization based on distance of enemies from the player (link). But i seems like he just desactives far bodies (in my case, i could desactive bodies that are not visible). But my enemies need to move even when they are not visible on screen, and applying forces will not workd on inactive bodies. Should i play with sleeping bodies here?

Also, enemies are composed by two fixtures and are constantly colliding with each others and with tiles but i really never need to get notified about that. Is there anything i can do to optimize this kind of scenario?

Finally, am i wrong to try to run simulation at 60FPS on mobile and should i try to make it run at 30FPS?

sentences:
libGDX sprite image not updating Event Handling InputHandler I created a separate inputHandler class implementing InputProcessor. I'm using Event Handling (libgdx github page: https://github.com/libgdx/libgdx/wiki/Event-handling)

public class inputHandler implements InputProcessor {
    private cheetah cheetah;
    private gameWorld myWorld;
    private float cheetahX;

    private float scaleFactorX;
    private float scaleFactorY;

    public inputHandler(gameWorld myWorld, float scaleFactorX,
            float scaleFactorY) {
        this.myWorld = myWorld;
        cheetah = myWorld.getCheetah();
        cheetahX = cheetah.getX();

        int midPointY = myWorld.getMidPointY();

        this.scaleFactorX = scaleFactorX;
        this.scaleFactorY = scaleFactorY;
    }

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        System.out.println(cheetahX);
        cheetahX += 5;
        System.out.println(cheetahX);
        return true;
    }

cheetahX is updating in the console, but not on the screen. When I click on the DesktopLauncher window, the console prints cheetahX + 5 properly, but the image of the cheetah sprite remains still.

gameWorld class:

public gameWorld(int midPointY, int gameHeight) {
    currentState = GameState.MENU;
    this.midPointY = midPointY;
    cheetah = new cheetah(33, midPointY - 15, 10, 29);
}

public void update(float delta) {
    runTime += delta;
}

gameScreen class:

@Override
public void render(float delta) {
    // TODO Auto-generated method stub
    runTime += delta;
    world.update(delta);
    renderer.render(delta, runTime);
}

thanks in advance!

sentences:
How to find a point on a plane? I'm using Unreal Engine 4.  Currently I ray trace to a surface in game and I'm trying to find the location of the point relative to the surface1 instead of the world.
I have the world position of the origin of the surface and the world position of the impact point.  I also have the X,Y,Z bounds of the object  What I would like to find out is how to get X',Y' position of the hitpoint relative to the upper left corner.  I've tried rotating the hitpoint around the origin to calculate the hitpoint based on refernce Roll, Pitch, and Yaw like so:
FVector RotatePointAroundPivot(FVector hitpoint, FVector pivot, FRotator angles) {
FVector dir = hitpoint - pivot;
FQuat quat(angles);

dir = quat*dir;
hitpoint = dir + pivot;

return hitpoint;
}

But it changes based on the rotation of the plane no matter what I do.
I also tried a very limited technique like so which just assumes it's in one of the correct orientations:
if (actorRotation.Yaw >= 0) {
    xpos = (actorBounds.Y - clickPosition.Y) / (actorBounds.Y * 2) * compscale.X * 1000;
    ypos = (actorBounds.Z + clickPosition.Z) / (actorBounds.Z * 2) * compscale.Y * 1000;
}
else {
    xpos = (actorBounds.Y + clickPosition.Y) / (actorBounds.Y * 2) * compscale.X * 1000;
    ypos = (actorBounds.Z + clickPosition.Z) / (actorBounds.Z * 2) * compscale.Y * 1000;
}

But it's flawed.  All I want is to be able to use the surface like a screen.

Any help would be appreciated.

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:
How can I make one of the agents to wait X seconds before start moving? The same script is attached to some multiple agents. On one of them the flag waitToMove is set to true. And it does getting to the line :

StartCoroutine(WaitToMove(10));

But still all the agents including the one with the flag set to true start moving when starting the game.

How can I make that agents with the script that the flag waitToMove is set to true will wait X seconds one agent will wait 5 seconds other will wait 3 seconds and this one will wait 10 seconds ?

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

public class AgentControl : MonoBehaviour
{
    public List<Transform> points;
    public bool waitToMove = false;

    private int destPoint = 0;
    private NavMeshAgent agent;
    private Transform originalPos;

    void Start()
    {
        agent = GetComponent<NavMeshAgent>();

        // Disabling auto-braking allows for continuous movement
        // between points (ie, the agent doesn't slow down as it
        // approaches a destination point).
        agent.autoBraking = false;

        originalPos = transform;
        points.Add(originalPos);

        if (waitToMove == false)
        {
            GotoNextPoint();
        }
        else
        {
            StartCoroutine(WaitToMove(10));
        }
    }

    void GotoNextPoint()
    {
        // Returns if no points have been set up
        if (points.Count == 0)
            return;

        // Set the agent to go to the currently selected destination.
        agent.destination = points[destPoint].position;

        // Choose the next point in the array as the destination,
        // cycling to the start if necessary.
        destPoint = (destPoint + 1) % points.Count;
    }

    void Update()
    {
        // Choose the next destination point when the agent gets
        // close to the current one.
        if (!agent.pathPending && agent.remainingDistance < 1f)
            GotoNextPoint();
    }

    IEnumerator WaitToMove(int WaitTime)
    {
        yield return new WaitForSeconds(WaitTime);
    }
}

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

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

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

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

sentences:
How to export an IK structure created in Blender 2.8 to Godot 3.1? I created this IK bone structure in Blender 2.8 and exported as .escn

As you can see, in Blender it's working ok.
Now, how to use it in Godot?

I've tried export with:

.dae (native)
.dae (Better Collada)
.escn
.glb

None of them worked...

Is there any tutorial for using imported IK in Godot?

sentences:
How common is automated testing in game development? Do gamers developers use to write unit and integration tests? How common is it among puzzle developers? And among developers of MMORPGs and FPSes?

(I have no background in game development neither am I cogitating about working with it - it is just a doubt that occurred to me. So, no need of trying to convince me to write them, even because I already like to write automated tests.)

sentences:
Is it possible to have a script built-in into a custom resource? Here's a rudimentary custom resource:

extends Resource

export(Resource) var scr

I can drag a pre-made .gd script into this exported property in Inspector, and it works as intended. I can click on the exported property field and embed a resource (like "New ShaderMaterial"), and it would also work as intended, and I would be able to edit that sub-resource normally. However, if I click on the exported property and select "New GDScript", there doesn't seem to be a way to open the new gdscript for editing. Is it possible to embed a gdscript sub-resource the same way you can embed a different sub-resource?

sentences:
Where to put the screen dimensions to make it accessible for all on screen objects? I'm starting game development to learn a new language (SDL2, C++) and would like some opinions on the best way to handle a probably very basic problem.

I don't want my player to go off screen, so I have something like this now:

void Player::sanitizePosition() {
    if ( m_xpos < 0 ) {
        m_xpos = 0;
    }

    if ( m_ypos - m_height < 0 ) {
        m_ypos = m_height;
    }

    ...
}

For the other two sides I would need the screen dimensions. Now I'm wondering what the best way to give them to the object would be?

Global variables are bad, but a Singleton with the screen information seems like the same thing to me.

Another idea would be to have a GameObject base class, that has the screen dimensions as static members, which Player would inherit from.

Of course I could put them into the constructor of every game object, but that just screams code smell.

This is such a basic problem, I'm sure there is a consensus on how to do it.

sentences:
Recommended way to handle sprite assets for different screen densities (Android) I am currently working on a 2D game for Android. All of the images that I render were created as SVG's and then exported to PNG's which I have placed in my assets directory. These images are also all sprites that I render using a sprite batcher.

My question is around using different versions of the sprites for devices with different densities. I know that when developing a traditional android app you could place separate directories for separate density levels inside of res and then place the correctly sized versions of the images in question in these sub-directories of res.

What is a good approach when dealing with sprite images in the asset directory? Should I just have one copy of the sprites at a really high density / resolution that I use for everything and I just render them on a coordinate system that is independent of screen size or should I resize the image based on screen density before I process it to create all my texture regions? Or is there another solution entirely?

Currently I have one high resolution set of sprites that I use for everything, it just seems wasteful and inefficient for the lower density devices.

sentences:
3d environments and managing them on iOS I would like to start learning 3d game development and currently only develop 2d games.

A few basic questions I am interested in are:

What is used to create the 3d environments? Are they all done in e.g. Maya, Lightwave, 3d modeling software?

What is the output format for these models and how are they manipulated in iOS? Is it all done using openGL(GL ES on iOS)?

e.g a monster needs to be spawned in the game world. What coordinates are used?

Are the concepts the same as 2d in terms of collision on the coordinates and movement on the coordinates of the game world?

How are 3d games managed in iOS on the low available memory. (e.g. FPS games)

Lastly, Can someone please recommend a good book that is up to date and can be applied to todays techniques.

Thanks

sentences:
How can I determine the contact point of a collision? I have two Farseer bodies. A static rectangle and a dynamic ball that is flying around. I want to determine where the ball touched the rectangle. I need the exact coordinates of the contact point.

How can I do that? Is there a way to determine the contact point?

 bool BlueRectangle_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
   {
       if (fixtureB.Body == RedBall)
       {
          Vector2 normal;
          FixedArray2<Vector2> worldPoints;
          contact.GetWorldManifold(out normal, out worldPoints);

          if(contact.Manifold.PointCount >= 1)
          {
            Vector2 contactPoint = worldPoints[0];
          }
        }

        return true;
    }

It works with the following code.

sentences:
How to restrict an AssetReference to a specific type? I am using the Addressables package of Unity.

I am trying to restrict an AssetReference type in the Unity inspector to a specific type.  Currently a user can assign any Unity object to an AssetReference, but I would like to guide the user to assign the correct types to the correct variables and (if possible) filter the assets type list to include only the assignable types when the user click on the drop-down arrow

According to the Unity documentation https://docs.unity3d.com/Packages/com.unity.addressables@1.6/api/UnityEngine.ResourceManagement.Util.SerializedTypeRestrictionAttribute.html

it seems like there is some sort of annotation available. The documentation is very limited and I have tried:

[UnityEngine.ResourceManagement.Util.SerializedTypeRestrictionAttribute(type=typeof(PlayerMaster))]
public UnityEngine.AddressableAssets.AssetReference playerMaster;

but it made no difference.

I also tried to create my own AssetReference type:

    [Serializable]
    public class Reference : UnityEngine.AddressableAssets.AssetReferenceT<PlayerMaster>, UnityEngine.AddressableAssets.IKeyEvaluator
    {
        public Reference(string guid) : base(guid)
        {
        }
    }

but with this new type I cannot select anything!

The following code snippet at least seems to restrict the list to GameObjects which is an improvement, but the user can still assign the wrong GameObjects easily. I was hoping for a more strict filter, but if it is not possible I will settle with:

public UnityEngine.AddressableAssets.AssetReferenceGameObject playerMaster;

sentences:
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:
Style: When to call GL Enable/Disable I'm working on an OpenGL application and some routines render textured objects, some are just colored primitives. I was wondering if there was a standard convention for how to deal with setting the OpenGL 'state'.

For example, consider this routine (using OpenGL ES / OpenTK):

/// <summary>
/// Renders the given tile at the corresponding screen-tile location.
/// </summary>
public static void RenderTile(float[] vertices, float xOffset, float yOffset, uint textureId)
{
    GL.EnableClientState(All.VertexArray);
    GL.EnableClientState(All.ColorArray);
    GL.EnableClientState(All.TextureCoordArray);

    GL.PushMatrix();

    GL.Translate(xOffset, yOffset, 0.0f);

    GL.BindTexture(All.Texture2D, textureId);
    GL.VertexPointer(2, All.Float, 0, vertices);
    GL.ColorPointer(4, All.Float, 0, SQUARE_COLORS);
    GL.TexCoordPointer(2, All.Float, 0, SQUARE_TEXTURE_COORDS);

    GL.DrawArrays(All.TriangleStrip, 0, 4);

    GL.PopMatrix();
}

I'm curious about that GL.EnableClientState(All.TextureCoordArray); bit. Should I just get into the habit of calling GL.Enable(...) / Gl.EnableClientState(...) for everything the current function needs? Even if it is largely redundant? Or is it better to just assume that the application has a certain set of things enabled (blending, back-face culling, 2D textures, etc.).

I know this question is pretty subjective, so I'm looking for advice from someone who has worked with a large OpenGL codebase. (As all my experience is for solo projects.)

sentences:
Unity InputSystem using Unity Events not maintaining values I am testing out using the new Input System and cannot get the values from context.ReadValue<Vector2>() to pass into a private variable.
The simple setup is below:
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    Vector2 leftThumbstickValues;

    void Start()
    {
        leftThumbstickValues = Vector2.zero;
    }

    void FixedUpdate()
    {
        Debug.Log("FixedUpdate: " + leftThumbstickValues); //Always displays "FixedUpdate: (0.0, 0.0)"
    }

    public void Move(InputAction.CallbackContext context)
    {
        leftThumbstickValues = context.ReadValue<Vector2>();
        Debug.Log("Move: " + leftThumbstickValues); //Displays correct values
    }
}

As you can see, in the Move function it correctly pulls the values from the thumbstick, but when it tries to use the values in FixedUpdate it always equals Vector2.zero. It seems like it should just work, but I think I must have overlooked something very simple.
Player Input Settings

Input Action Move Properties

Input Action Left Stick Properties

EDIT: I decided to remove the Player Input component and subscribe to the events in code:
 controls.Player.Move.performed += cntxt =>
 {
     Move(cntxt);
 };
 controls.Player.Move.canceled += cntxt =>
 {
     leftThumbstickValues = Vector2.zero;
 };

This now works as expected. I'm not sure I should mark this as the answer though as it doesn't explain why it doesn't work with the original setup, just offers an alternative solution.

sentences:
How to make the game wait for an animation to finish? I'm teaching myself andengine while trying to make a match-3 puzzle, so far I have a grid of gems that I populate and can move then around. Matching gems and new gems falling is working already. My problem is that the game keeps flowing while animations runs. How can I make the flow suspend until movement is done?

I use entity modifiers for the gems animations. MoveYModifier for the fall and PathModifier for the swap.

sentences:
How do I run a callback when all objects have stopped moving? I'm using Bullet and want to take some action once all objects in a dynamic world have reached 0 velocity (or at least a value that's very close).

I was trying to iterate over all of them all the time and when a counter equals getNumCollisionObjects() then do that action. But it's a complex procedure and I'm beginning to think it's unnecessary.

Is there a better way, perhaps by comparing two frames or a Bullet built-in?

sentences:
Matching game difficulty I'm currently making a matching game where the player is given a color or image type and the player has to click on all of the matching colors of images as fast as possible. My problem is how would I go about making a difficulty curve instead of just randomly generating what the next situation will be.

There's a link down below to show the first version of the game I made a while ago. As you can see the new scenario is chosen randomly and one scenario can be harder than the other with no thought of progression. What I want this time is for the game to progress over-time. So, the more of these "scenarios" a player does the more difficult it will get.

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

sentences:
Projectile Motion in lwjgl with java I was trying to make a game with a bow and arrow using lwjgl but I couldent get the arch right. I have a function called projectile that is updated once a frame for each arrow. my frame cap is at 60 fps. the projectile function looks like this.

public static void projectile(Entity arrow, double speed, double gravity){

    Vector3f position = arrow.getPosition();
    float rotX = arrow.getRotX();
    float rotY = arrow.getRotY();
    float rotZ = arrow.getRotZ();

    //code

    return;
}

How can I use this function to move the arrow with it's speed and gravity along an arch. based on its rotation(for direction it moves in) and location. if you need more information please ask. thank you :)

sentences:
Unity pixel art distorted sprites I have a problem rendering my pixel art sprites properly in Unity.
So far I have one character in a sprite-sheet I made, with frames of size 64x64. The actual sprite is roughly 32x32 but I left room for movement in animations.
I import the sheet following pixel perfection procedures I found on the internet using these settings:

As for the orthographic camera I set its size using this formula:

orthoCameraSize = screenHeight / (2 * 32)

If I zoom on the sprite in scene it looks fine but when in game it gets rendered quite poorly (in game / in scene pics below):

What could be the source of the problem? I applied every good practice advice I could find on the web...
Thanks for your help!!!!

sentences: Is it possible to publish an app based on a board game? Usually the boxes says "all rights reserved" and "registered trademark". What does it mean? Could others make an app with the game's name and mechanic? Is it possible to sell it, put banner ads or make it free?

sentences:
What's the reasoning behind using "redistributable" packages? On Windows, many if not all games require some DirectX package and some VC++ runtime. Others also need OpenAL, wmfaredist, nvidia physx, windows live and probably others.

I'm trying to figure out why do game developers use them. Like what problems are they trying to fix by using them, and how are those problems bigger than the problems they are creating by using them, like the compatibility issues of the VC++ packs, or inconveniencing players.

I'm thinking that it's because these are libraries developed by others, thefor they can save game developers some coding time. That's fine I guess, but then why aren't they including the .dll files directly into the game?

sentences:
how to move a char value "down" in a two dimensional array? I managed to move it up, left and right but when i try to move it down it goes to the last Y position in the array instead of the Y position below it.

the code i wrote to move it up, left and to the right works!

the name of the array is "mapa[h][b]", the "help" variable has the same value as the values i want to move but as an int instead of a char, the variable "i" is for the Y position and the variable "j" is for the X position

//movement upwards
         for (i=0;i<h;i++){
            for (j=0;j<b;j++){
                if(mapa[i][j]==help){
                    aux=mapa[i-1][j];
                    mapa[i-1][j]=mapa[i][j];
                    mapa[i][j]=aux;
                    break;
                    break;
                }
        }
        }
//movement to the left
        for (i=0;i<h;i++){
            for (j=0;j<b;j++){
                if(mapa[i][j]==help){
                    aux=mapa[i][j-1];
                    mapa[i][j-1]=mapa[i][j];
                    mapa[i][j]=aux;
                    break;
                    break;
                }
        }
        }
//movement to the right
        for (i=0;i<h;i++){
            for (j=0;j<b;j++){
                if(mapa[i][j]==help){
                    aux=mapa[i][j+1];
                    mapa[i][j+1]=mapa[i][j];
                    mapa[i][j]=aux;
                    break;
                    break;
                }
        }
        }

And as I said before, this part works, what I did its just to exchange the value I want to move with the one on the position I want to move it to, to locate the value I want to move I use the for() cycles to "scan" the array and the if() is meant to find it, when the if() finds the wanted value I add one to the Y or X position, but when i try to move it down using the same logic

for (i=0;i<h;i++){
        for (j=0;j<b;j++){
            if(mapa[i][j]==help){
                aux=mapa[i+1][j];
                mapa[i+1][j]=mapa[i][j];
                mapa[i][j]=aux;
                break;
                break;
            }
    }
    }

it just moves to the bottom of the array regardles of its current location on the Y position

sentences:
Displaying scores in tutorial projects - GUI and UI I've just started learning to use unity by working through the tutorial projects but in both roll-a-ball and space shooter I've hit dead ends in the text lessons. The lessons tell you to simply add a GUI text object but they don't seen to exist anymore. From what I've gathered they have been replaced with UI text, but I can't find any documentation that explains how to use them in the way the tutorial describes.

Essentially my question is "how do I complete lesson 15 of the space shooter tutorial project now that unity doesn't let me create GUI text objects in the hierarchy?" Any help would be greatly appreciated.

sentences:
OOP in cocos2d for ios I have been pulling my hair out trying to make an object in cocos 2d that is a CCSprite (with an image) and a CCLabelBMFont.

I tried making a CCNode object and I tried making a custom CCSprite object but none of it worked!

Can someone show me how to do this?

Thanks.

sentences:
How to calculate/structure/define rotation vector for OpenGL / WebGL I am trying to define the buffer data for WebGL and want to have in there something that encodes the fact that an object might be rotating. So it makes me think of angular momentum. So if you have something like that, like the angular momentum or some other rotation "vector" or something, you could use that to calculate a rotation matrix, and then go from there.

The problem is I don't know what that rotation thing is, angular momentum or something else. I keep searching rotation vector, but I'm not sure that's it. Wondering if you have any suggestions on how to have rotation encoded (the rotation force), before it is in a matrix form. This is just for 2D rotation.

sentences:
Creating A TickRate Class I need to implement tickrate into my engine to handle timed events such as pushing out entity updates and I don't know where to start.

I have access to a timer which allows me get the time in milliseconds since the device has been initialized.

When I try to brainstorm on the correct approach to take one of the main things that I get stopped up on is that on the client side I should allow the framerate to run as fast as it can, however if I want the tickrate to run at 60 and the client FPS is less than 60 how can 60 ticks execute if the main loop wont run at least 60 times a second due to it being slowed down by the fps?

Can anyone explain how to properly implement tickrate? Thank you for your time.

sentences:
My collider is not following my humanoid animation: how to do ? I've a "Zombie" charachter and the following hirearchy:

I put a Capsule collider on parent Zombie_01.
When I kill the zombie, my "Zombie dead" animation is played, Zombie fall to ground, but the capsule collider stay standing.

So my question is: where I've to put capsule collider ? Or, what am i wrong ?

Thanks

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:
Mob generation design - is creating a class for each mob efficient? I'm working on an RPG game for my coursework project. Everything is going fine but I've reached a stage where I do think that my project's code is not the most efficient.

Here I have a constructor of my class AbstractMob

public AbstractMob (String name, int hp, int attack, int defense, int magicAttack,
                        int magicDefense, int expBound, int goldBound, String folder, String idleAtlas, String attackAtlas) {

        abilities = new ArrayList<>();
        //setting variables
        this.attack = attack; //and so on

        idleAnimation = new Animation<>(
                0.070f, new TextureAtlas(Gdx.files.internal(
                        "sprites\\mobs\\" + folder)).findRegions(idleAtlas),
                Animation.PlayMode.LOOP);

        attackAnimation = new Animation<>(
                0.070f, new TextureAtlas(Gdx.files.internal(
                        "sprites\\mobs\\"+ folder)).findRegions(attackAtlas),
                Animation.PlayMode.LOOP);
    }

And here is an example of a class that inherits AbstractMob

public class FireElemental extends AbstractMob {
    public FireElemental() {
        super("Fire Elemental",
                400,
                12,
                10,
                18,
                15,
                50,
                20,
                "fireElemental\\fire.atlas",
                "firesprite",
                "firesprite"
        );
        //from AbstrctMob, declares any abilities the mob has
        abilities.add(new Fire()); //same design pattern as these mob creations,
        //I have a separate class for Abilities, and subclasses such as Fire
        //that inherit from Abilities

        setAbilities(abilities);
    }
}

Now, my question is - does it make sense to create a multitude of separate classes (i.e make more classes like FireElemental for different mobs) for each entity (whether that be abilities or mobs) for this game? How about utilising files/scripts to load them?

Thank you so much!

sentences:
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:
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:
A controlled trapezoid transformation with perspective projecton I'm trying to implement a controlled trapezoid transformation in Adobe Flash's ActionScript using the built-in perspective projection facility. To give you an idea of how the effect looks like:

http://i.stack.imgur.com/Pa1T0.jpg

I've been searching for a solution for a few days now and, apart from the tessellation alternative which produces poor quality results, no one has tried to employ perspective projection to achieve this effect. It's maybe because it requires solving some math, which is something I hope you could help me with.

So Flash uses a simple frustum model with a viewpoint, projection plane, and focal length, which is the distance from the viewpoint to the projection plane.

http://i.stack.imgur.com/1WmGa.jpg

There is also fieldOfView but it should be of no importance as its meaning appears to be overridden by focalLength (at least it's value makes no difference in my ActionScript experiments as long as the focal length is specified).

The rectangular piece of graphics is located right on the projection plane so that the middle point of its top edge is located in the projection center. To achieve the effect, the rectangle is rotated by some angle.

(Sorry, the forum wouldn't let me post more links to the drawings. Could anyone please edit it to put the last 2 imaged referred at the end of the source right here.)

<>

The question is, what should be the values of focal length and angle so that new height and new bottom width satisfy some given values that are desired for the effect? Or speaking mathematically:

Given:

a frustum with focal length
a rectangle with its width and height, which is pinned to the projection plane (z=0) of so that the midpoint of the rectangle's top edge is located right in the projection center of the frustum
the needed new height and new bottom width of the rectangle after it's rotated and projected onto the projection plane

Unknowns to be found and applied to the perspective projection in order to get the desired new height and new bottom width:

the focal length of the frustum
the angle of rotation

If I missed out any other parameters or added any redundant ones, please correct me.

Also, is it possible to control the effect just by the angle with which the sides of the rectangle should be projected on the projection plane (the angle between the projected rectangle's side and its top edge) provided that the new height remains some constant value?

sentences:
Securing HTTP requests to online game server I'm pretty new at making online games. Right now I'm trying to make an iPhone game. Each player has a profile in my server.

I want to avoid username/password for authentication. Currently, as it stands, when my game is installed it also generates an unique key string and safeguards it in the device. When the player runs the games and needs to perform an action, the action request is sent to the server - along with the key to validate the action.

This is done with an HTTP request, and is working fine.

The thing is, I'm not sure about the security implications behind this. Suppose that a seasoned cracker manages to discover their own key string (if it is stored somewhere in the device I imagine it is always possible to crack), and also identifies the HTTP request schema. They could technically create their own program, use the key string, and send requests to my server and effectively automate several tasks.

For example, let's say that you discover that your key string is 12345, and you also realize that the HTTP requests are like this

http://www.example.com/getcoins.php?key={KEY}

Well, now you're capable of making a nice program automating

http://www.example.com/getcoins.php?key=12345

So then I considered doing something like cookies. As if, the player authenticates using the key string and then the server returns some "session ID" which is stored in the device. The session ID must be used to validate actions. But I'd imagine this would cause the same issue: the cracker just discovers the session ID and off they go.

sentences: pre-load new scene in unity async but don't show it I have a top down dungeon crawler in 3D where I show one room at a time. Each room is it's own unity scene. Each room has an exit point that when clicked I fade the screen, load a new scene and then fade in the screen. What I'd like to do, but not sure how, is to pre-load the next possible scenes (note the S, there will be 2 but could be more. 2 because it's the next room or the previous if the player decides to go back) while in one scene. I know the scenes that are possible to get to, but how can I pre-load but not show them and because there is more than 2, I assume if they go in one direction, there is a pre-loaded one that I need to unload. Overall I want to do this to make a faster/smoother transition between rooms, but I want the one room at a time for artistic style.

sentences:
Can I 'emulate' a device by booting its BIOS on my PC? So for example let's take a SEGA Genesis (Mega Drive).

Let's say I have a usb Genesis cartridge loader with Sonic 1 plugged in. In that case, could I 'hardware emulate' a Genesis by booting a Genesis BIOS from USB (or any other way to boot a Genesis BIOS) and use that to play or mod Sonic 1, or develop & test home-brew games for the console?

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

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

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

Legend

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

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

Question:

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

(I am also open to alternative approaches)

Edit:

Thanks to @Jay it's better now:

sentences:
Unity 4.5 Sprite Packer does not pack images inside Resources folder I'm trying to use the new Sprite Packer tool, but it doesn't work if I put the imagens inside Resouces folder, but inside any other folder it works.

is it a bug?

sentences:
Low dexterity game development I am tasked with developing a game for kids with low dexterity (as a college project).
I am stuck trying to find examples of similar games to generate ideas about game play and overall function. The general idea is that these kids wont be using a fully featured controller, it will be more basic, for example just a joystick.

Can anyone point me in the direction where I might find some resources (specifically game play ideas) to aid the in the development of low dexterity games?

sentences:
Problems with the Unity text field Let say I have this list and currently there are three animals inside the list.
These names below are displayed on the text field in the scene.

Cat

Bird

Goat

If there is a new animal is added to the list, for example a 'dog',
the code will add 'dog' below the 'Goat' inside the text field above.
Now I have a problem when the same animal is added to the list. I don't know how to actually display the updated text field if the same type of animal is added to the list and will not messing up the text field or duplicating the same name inside the text field. Please help.

This is the code

foreach (var animalnames in newComp)
        {
            if((componentName.text.Length !=0)&&(animal.transform.name != animalnames.name))
            {
                componentName.text = oldName+('\n')+('\n')+('\n')+animal.transform.name;
            }
            if((componentName.text.Length !=0)&&(animal.transform.name == animalnames.name))
            {
                Debug.Log("same");
                animalnames.name = animal.transform.name;
                //componentName.text = ('\n')+animalnames.name;
            }
        }
        oldName = componentName.text;

sentences:
Keep a rigidbody velocity constant I have a "board" with a ball (rigidbody) moving over it and colliding with obstacles.

I want its velocity magnitude to remain constant throughout time.

How do I achieve this?

What I've tried/achieved so far:

My first guess was to use OnCollisionExit to set the velocity manually, but that lead to weird physics.
I don't see how to use AddForce to do this since the previous movement would still be factored.
To be clear, what i want is to set the velocity at all times to rigidbody.velocity.normalized x magnitude, where magnitude is a float I set previously. This would allow the physics engine to make all impact math to decide the direction of the ball after the collision, but my math would keep the velocity intact.
I then decided to add UpdatedFixed and on every call set the velocity as stated above. It's working, but feels like a bad hack because I'm updating the velocity every frame and forsaking the physics engine.

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

sentences:
StateMachineBehaviour.OnStateExit is called before StateMachineBehaviour.OnStateEntered is called When I start my game I get null-references in my OnStateExit of objects that are initialized in the OnStateEntered. After this it goes smooth, so it only occurs at startup before any conditions for statechanges are met.

How come? My understanding is that OnStateExit is always preceded by OnStateEntered.

My StateBehaviour

public class DuckStateBehaviour : BaseStateBehaviour {

    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateEnter(animator, stateInfo, layerIndex);
        mMovement.BeginDuck();
    }

    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (mMovement != null) mMovement.EndDuck();
        base.OnStateExit(animator, stateInfo, layerIndex);
    }
}

public class BaseStateBehaviour : StateMachineBehaviour {

    protected Transform mTransform = null;
    protected Rigidbody2D mRigidBody = null;
    protected IMovement mMovement = null;

    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        mTransform = animator.gameObject.GetComponent<Transform>();
        mRigidBody = animator.gameObject.GetComponent<Rigidbody2D>();
        mMovement = animator.gameObject.GetComponent<IMovement>();

        Debug.Assert(mTransform != null);
        Debug.Assert(mRigidBody != null);
        Debug.Assert(mMovement != null);
    }

}

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:
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:
Pixelated and incomplete image when loading with pygame.image.load This is the image I'm trying to load on the surface, an 40x40 Ubuntu logo:

Ans this is how it looks when trying to show the image on the surface via the blit method:

I'm trying to load different Linux logos, the majority have PNG extension and a couple of GIF. The Ubuntu logo is a PNG image, it's weird that the other PNG and GIF images load just fine (Ubuntu and Kubuntu logo are the exceptions, they look pixelated and incomplete).

This is how my code looks like (I'm just starting with pygame):

#-*- coding: utf-8 -*-
import sys
import os
import random
import pygame
from pygame.locals import *

PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
LOGOS_DIR = os.path.join(PROJECT_DIR, 'data/images/logos')
WINDOW_WIDTH = 640
WINDOW_HEIGTH = 480
FPS = 30

# Colors
WHITE = (255, 255, 255)

BACKGROUND_COLOR = WHITE

pygame.init()
MAIN_SURFACE = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGTH))
CLOCK = pygame.time.Clock()

def get_linux_logos():
    logos = []
    for img in os.listdir(LOGOS_DIR):
        try:
            logos.append(pygame.image.load(os.path.join(LOGOS_DIR, img)))
        except pygame.error, e:
            continue
    random.shuffle(logos)
    return logos

def main():
    pygame.display.set_caption('Geezle - Memory Puzzle')
    MAIN_SURFACE.fill(BACKGROUND_COLOR)
    LINUX_LOGOS_IMGS = get_linux_logos()[:12]

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()

        MAIN_SURFACE.blit(LINUX_LOGOS_IMGS[0], (300, 220))
        pygame.display.update()
        CLOCK.tick(FPS)

if __name__ == '__main__':
    main()

sentences:
How to tell OpenGL to use normals for lighting? Let's say I have

    glGenBuffers(1, &vertexbuffer);
    glGenBuffers(1, &indexbuffer);
    glGenBuffers(1, &normalbuffer);

    glBindBuffer(GL_ARRAY_BUFFER,vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER,sizeof(float)*numVertices*3,verticesArr,GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexbuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER,numIndices*sizeof(GLuint)*3,indicesArr,GL_STATIC_DRAW);

    glBindBuffer(GL_ARRAY_BUFFER,normalbuffer);
    glBufferData(GL_ARRAY_BUFFER,sizeof(float)*numVertices*3, normalsArr, GL_STATIC_DRAW);

    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER,vertexbuffer);
    glVertexAttribPointer( 0, 3GL_FLOAT,GL_FALSE,24, (void*)(0));

    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ARRAY_BUFFER,normalbuffer);
    glVertexAttribPointer( 1, 3GL_FLOAT,GL_FALSE,24, (void*)(12));

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indexbuffer);

is it possible to tell OpenGl to use the normals in buffer for light "calculation"?

Basically I want to know how to say to OpenGl: "Here are my normals take them and make me nice lighting". Since I didn't find answer in google I posted my question here. Thank you for attention.

sentences:
What is the range of RAM consumption for the typical 3D character in a video game? What is the average number of KB in memory for a 3D character?
Granted, this will obviously be biased based on what game we're talking about.
However, I am less interested in actual size in KB, and more interested in the range.
Simply, a general idea.

I want to know this information, to compare it to my 2D game. Currently, my 2D game has an almost exact scale for how much RAM a character takes up in memory.

The current formula is this: 95KB * Number of Animations * Number of Frames * Number of Directions. So for example, if a character had an Idle Animation with 15 frames, and a Walk animation of 15 frames, and there were 4 directions the character could move, the character would take 11.4MB in memory.

3D Characters have to load their mesh, textures, and animations. 2D characters simply load a image. However, with hundreds of animations- I can only imagine the 2D character would eventually exceed the memory requirements of a 3D character.

I need to get a general idea of how many characters I should limit on screen, how I should load my characters and their animations in memory, etc. I get some performance hits when swapping out textures in memory, probably because they are large spritesheets. I do not know if not using spritesheets would fix this or not. I was always told "Sprite Sheets are good for performance."

What about 3D games? Any example would work, and it doesn't have to be a real range. I just want to know what I may be looking at. An example of a lower quality 3D game and an example of a higher quality 3D game would be perfect.

sentences: Generating random Pools or lakes I have implemented functions that can draw any polygonal shape, however I have been unable to generate a smooth shape that mimics the rounded edges of a lake. I tried generating two circles and joining the edges but there is not enough variation or smoothness to it. Does  anyone have any pointers or ideas that could generate a shape like this?

sentences:
Scene building for procedurally generated tile based world in Unity i'm making a procedurally generated side-scrolling and destructible tile based world. So far I've got :
 - the values generator (for deciding which tile to place where)
 - a testing scene generating one object per tile (a mesh with 2d box collider, inactive at start)
 - map chunking (separating the map into chunks to show only what is visible)
 - visibility based on orthographic camera size (it's not much but the camera can zoom in or out)
 - the chunks are 32x32 tiles in size
 - the maximum chunks I've seen is around 25

This works fine for testing the world generation, however there is massive stuttering when moving around with camera zoomed out to the maximum. It's less when zoomed in, but it is still noticeable.

From testing, I've found out that its obviously the building in the scene that causes the major part of the stuttering.

I've been searching for better ways of building the scene but there are a few constraints that make most of the non viable :
 - The world is destroyable, so I need to be able to interact with each tile
 - There are textures coming on top of the tile texture depending on context (selection rectangle, decoration, glow...)
 - The tile texture itself is not a single sprite but a repeatable texture, so it needs to be places based on coordinates so it properly repeats itself.

So far I've looked at :
 - TileMaps
 - Mesh melding
 - Texture bombing

None of these seem to be able to fulfill the constraints fully.

Is there a way to fulfill the constraints while improving scene building or am I missing something? Please help.

sentences:
Compressing 2D level data So, I'm developing a 2D, tile based game and a map maker thingy - all in Java.

The problem is that recently I've been having some memory issues when about 4 maps are loaded. Each one of these maps are composed of 128x128 tiles and have 4 layers (for details and stuff).

I already spent a good amount of time searching for solutions and the best thing I found was run-length enconding (RLE). It seems easy enough to use with static data, but is there a way to use it with data that is constantly changing, without a big drop in performance?

In my maps, supposing I'm compressing the columns, I would have 128 rows, each with some amount of data (hopefully less than it would be without RLE). Whenever I change a tile, that whole row would have to be checked and I'm affraid that would slow down too much the production (and I'm in a somewhat tight schedule).

Well, worst case scenario I work on each map individually, and save them using RLE, but it would be really nice if I could avoind that.

EDIT:
What I'm currently using to store the data for the tiles is a 2D array of HashMaps that use the layer as key and store the id of the tile in that position - like this: private HashMap< Integer, Integer >[][]

sentences:
Passing a value to a stuct So I've been making a 2D grid and pathfinder using SFML. Now I ran into a problem. I've been making a vector for the path nodes.

struct Node
{
    std::pair <int, int> node; // position of the node <x,y>
    std::pair <int, int> previous;
    bool iswall = false;
    sf::Vector2f rectCenter = sf::Vector2f(0, 0);
    sf::Vector2f position;

};

class Gridspot
{
    Node start;
    Node end;
    std::vector <Node> Openset
    std::vector <Node> Closedset;
    std::vector <Node> Path;
};

I then make a function so I can set grid cell's center:

void Gridspot::calculaterectCenter(sf::Vector2f& center, int i, int j)
{

    for (auto path : Path)
    {
        if (path.node == std::make_pair(i, j))
            path.rectCenter = center; break;
    }
}

in the main:

for (auto path : cell.Path)
{
    if (i == path.node.first && j == path.node.second)
    {

sf::Vector2f center(box[i][j].getPosition().x + box[i][j].getSize().x / 2, box[i][j].getPosition().y + box[i][j].getSize().y / 2);

                box[i][j].setFillColor(sf::Color::Magenta);
                cell.calculaterectCenter(center, i, j);

    }

}

the problem that I'm facing is that when I enter the value the vector element in question rectcenter variable doesn't change.

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:
Best source for sound effects? What is a good source for sound effects for use in an indie game production (C#, XNA)?

The sounds do not need to be free.
They, however, should have a clear licence for commercial use.
The website should allow for searching, browsing and preview (or better: pre-listening).

I already had a look at http://www.1soundfx.com but their collection is not too large. I am specifically looking for sound effects. No music and no ways to make my own sounds.

All help is greatly appreciated!

sentences:
Need Guidance Making HTML5 Canvas Game Engine So I have some free time this winter break and want to build a simple 2d HTML5 canvas game engine. Mostly a physics engine that will dictate the way objects move and interact(collisions, etc). I made a basic game here:

http://caidenhome.com/HTML%205/pong.html

and would like to make more, and thought that this would be a good reason to make a simple framework for this stuff. Here are some questions:

Does the scripting language have to be Javascript? What about Ruby? I will probably write it with jQuery because of the selecting powers, but I'm curious either way.
Are there any great guides you guys know of? I want a fast guide that will help me bust out this engine sometime in the next 2 weeks, hopefully sooner.
What are some good conventions I should be aware of?
What's the best way to get sound? At the moment I'm using something like this:

var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'paddle_col.wav');
audioElement.load();

I'm interested in making this engine lightweight and extremely efficient, I will do whatever it takes to get great speeds and processing power. I know this question is fairly vague, but I just need a push in the right direction.

Thanks :)

sentences:
python for game development Possible Duplicate:
  Famous games written in Python

Is python any good for game development? Can I have some examples of great indie python games.

So I can have an idea what it's capable of?

I'm looking for games which are on a realistic scale for one person.

thanks.

sentences:
Efficient acceleration structure for moving 3D objects in scene I am implementing a 3D FPS game in C++. The game has large outdoors areas with both static and dynamic objects in the scene, with the following implicit assumptions:

Static objects:

Do not move after initialization
Only added to scene during load time, all in one go
Examples: buildings, plants, obstacles, etc.

Dynamic objects:

Can be expected to move at any time
Can be added to or removed from the scene at any time
Examples: players, vehicles, moveable physics objects, etc.

I want to implement acceleration structures that can efficiently handle collision detection on the objects in the scene (e.g raycasts, frustum culling, etc.) NOTE: I am only doing these tests on the bounding volume level, i.e no polygon-ray/box/etc. tests. The goal here is to have an efficient method for early-outs before testing on the polygon level. In other words, let's assume all the static/dynamic objects are simple 3D boxes of various sizes.
For static objects, I found that I can just create a Bounding Volume Hierarchy using their AABBs, which I've already tested and found to be quite efficient. I want to do something similar with the dynamic objects, i.e use their bounding volumes to create and update an acceleration structure at runtime.
So far, the only candidates I found are Spatial Hashing and Dynamic Octrees, but I could not find a lot of material for this specific use case, nor is it clear which of the two is more efficient. Also, I am not sure how to efficiently update the scene whenever the objects change. I can think of two approaches, which are indicated in the following pseudocode:
struct RayResult;
struct RayCast;
class RenderObject;

class DynamicScene
{
public:
    void addObj(RenderObject* obj) { /* Add object, update structure... */ }
    void removeObj(RenderObject* obj) { /* Remove object, update structure... */ }
    void updateObj(RenderObject* obj)
    {
        /* Update the acceleration structure based on the changes in the object */
        updateAccelerationStructure(obj);
    }

    void perFrameUpdate(float dt)
    {
        // Update all the objects in the scene
        for(RenderObject& obj : m_sceneObjects)
        {
            obj.update(dt);
        }

        /* OPTION 1: update the scene here, after all objects have been updated? */
        updateAccelerationStructure();
    }

    RayResult rayTest(const RayCast& ray)
    {
        RayResult result;

        // Test all the dynamic objects using the accelerator structure
        // Add objects where we hit the OBB to the result struct
        // ...

        return result;
    }
};

class RenderObject
{
public:
    // Assume it has a 3D matrix for position/orientation, and an OBB that is updated whenever the transform changes
    // ...
    void update(float dt)
    {
        // ...
        /* OPTION 2: update the scene here, based on the changes to this one object? */
        if(transformChanged())
        {
            m_scene->updateObj(this);
        }
    }
private:
    DynamicScene* m_scene;
};

Option 1 would result in a single update to the entire acceleration structure, but would require constantly inspecting all the objects for changes. Option 2 would only update if an object actually changed, but it also means N objects changing in a frame will result in N updates to the acceleration structure.
Thus, my questions are:

For the above use-case, which 3D acceleration structure is optimal, or at least most frequently used in game dev?
What is the ideal per-frame update procedure for said acceleration structure?

sentences:
When are Lagrangian Mechanics useful in a game? I have not used or heavily studied Lagrangian Mechanics before and I have not built a physics engine modeled with constraints yet.

I understand that Lagrangian Mechanics are an alternative way to think about Newtonian Mechanics (standard kinematics equations) in-terms of constraints, does this actually come into practical usage in a game engine?

I've been getting started with constraint-based resolution with this tutorial: http://gamedevelopment.tutsplus.com/tutorials/modelling-and-solving-physical-constraints--gamedev-12578

In addition I'm going through Erin Catto's white paper "Iterative Dynamics with Temporal Coherence": http://www.bulletphysics.com/ftp/pub/test/physics/papers/IterativeDynamics.pdf

sentences:
How can I save and load an adventure game? I'm using cocos2dx and sqlite to store datum. The table looks like this: x INT, y INT, className TEXT, properties TEXT. I use json to serialize terrains and sprites. But I don't know how to synchronise it. Below is how I'm doing:

//1: create a interface takes an range and returns data in it.
Data getData(Rect range);

//both are global objects.
cachedRange = [];
cachedData = [];

//2: while reading from sqlite, I scale the range and cached other data.
Data getData(Rect range){
    //if it has been cached.
    if(cachedRect.contains(range)){
        return retrieveDataFromCached(cachedData, range);
    }

    var scaledRange = scale(range, 10);
    var data = retrieveFromSqlite(scaledRange);
    var inRange = [];
    for(var d : data){
        if(range.contains(d)){
            inRange.append(d);
        }else{
            cached.append(d);
        }
    }
    cachedRange.append(range);
    return inRange;
}

However, these data will change. For example, some mobs are instantiated and then killed, and some are moved. When should I delete original records of the table.

sentences: What's the difference between displacement mapping and height mapping? What's the difference between displacement mapping and height mapping and what is the connection to adaptive tessellation?

sentences:
Is a dynamic enviroment map using pincushion curvilinear perspective projection possible? I'm wondering if it is possible to generate a dynamic spherical environment map using a single frame render using a pincushion curvilinear perspective projection matrix (phew, that's a mouthful)?

I've been researching this for a few days now and the closest thing I can find is a curvilinear perspective but it isn't a commonly used projection matrix so there isn't any help I was easily able to find and I still don't know if it supports a full circle FOV.

Why?

The standard perspective matrix but it begins to look very strange and distorted above 180 degrees vertical FOV and completely fails to render when approaching 360 degrees. So instead most games render the scene six times using 90 degree FOV facing the faces of a cube.

Rendering the scene 6 times seems like a waste if it might be possible to simply imagine a camera that has a 360 degree view across both axis and then render that to a spherical environment map.

sentences:
What's a pre-multiplied 4x4 matrix? I'm using a 3d game engine, that uses a 4x4 matrix to modify the camera projection.

The matrix is in the regular 4x4 format:

 r r r  x
 r r r  y
 r r r  z
 - - -  zoom

The description for the matrix class says:

  A transformation matrix. Matrices are pre-multiplication, as in: x' =
  M*x.

What does this mean?

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:
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:
Low Level Audio Engine Sample Rate Conversion First off, there seems to be a sparse number of audio programming tutorials out there so if anyone knows of some good resources I would be very appreciative. Now on to the topic at hand!
I am using WASAPI for the audio engine that I am trying to develop and I am having difficulties reformatting data from a read audio file data into a format that the audio device is prepared to receive. Specifically I am wondering how games generally handle converting the sampling rate of a read audio file into the requested sampling rate of the device. I saw an example where linear interpolation was used but read elsewhere that such a filter introduces too many artifacts, so again I'm wondering what a practical algorithm would be for game design, something good enough that can be achievable in a high work load real time environment.
On a separate note, would it be safe to assume that most games store the majority of its audio assets in an uncompressed audio format to save the CPU the work of uncompressing the data or are there more benefits to be gained from having less data to load from the hard drive.
Thanks in advance for the help.

sentences:
Why do I have render problems happening frequently in my Unity scene? I am making vertical endless runner. My platforms are moving down, and the camera and players are remaining in the same location, resulting in the effect of player movement. The obstacles are generated and move in same direction as platforms.

The problem is obstacles rendered by the camera is not right. I mean that the obstacles are in camera's FOV but are still visible after some time when they reach the player to close.

sentences:
Create tile map in Cocos2D-X by not using TMX file I used to make a tile base game in Windows with my own tile map file, but it is a static tile map. I use an 2D array to store of my tile map. Now I want to make game in smartphone by using Cocos2D-X, and I want to make a random tile map, so I guess using TMX file is not appropriate in this case. I tried to search about making a tile map with Cocos2D-X but there is only a tutorial with TMX file.

Can you give me an idea about this case.

Thanks in advance.

sentences:
Can’t Load .fbx from blender to Monogame correctly I am using pipeline.exe tool, to convert an .fbx file I made using Blender (using the default Blender 2.73a export settings) to .xnb, and then manually copy and paste it in my content directory (Is this one of the correct ways to convert it properly ?).

After watching this video https://www.youtube.com/watch?v=u7tLYMPC828 I saw that you have to convert the .fbx file that you create using blender, to a new .fbx file, using a tool called fbx converter 2013, and then use that file in the pipeline.exe tool, to produce the final .xnb file. Without doing that, I can't even see my model when drawn on the screen.

With the steps I described above, I managed to see the .xnb file on my screen but it was not exactly the original model I had made. For example:

As you can see the real model I got (after the convertion with the fbx converter 2013)  is much longer, whereas the one on the left (the one I draw in my game), is like packed in a small square.

If you are using blender, please let me know how do you import the .fbx to your Monogame project. (Or you can suggest to me another software you are using to make models and tell me your method of importing models to Monogame)

This is how I am drawing my model:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.Black);

    Vector3 modelPosition = new Vector3(-25, 0, 0);
    float modelRotation = 0;
    float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

    // Draw the model. A model can have multiple meshes, so loop.
    foreach (ModelMesh mesh in Brick.Meshes)
    {
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 50.0f);
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = Matrix.CreateRotationZ(modelRotation)*
                Matrix.CreateTranslation(modelPosition);
            effect.View = Matrix.CreateLookAt(cameraPosition,
                Vector3.Zero, Vector3.Up);
            effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);
        }
        // Draw the mesh, using the effects set above.
        mesh.Draw();
    }
    base.Draw(gameTime);
}

Edit: I also tried exporting to .X from blender and when i converted to .xnb, loaded the model and drew it, nothing shows up.

sentences: Game only runs at 60fps in windowed mode with a 120hz monitor? In fullscreen the game will run at 120fps fine, the correct refresh rate for the monitor, but in windowed mode it only runs at 60fps.  If I disable VSync then it runs at thounsands of fps so it's not a case of a lack of performance.  I've correctly set the refresh rate in the ModeDescription.

sentences:
Is it a good idea to make a game for one aspect ratio and arbitrary screen resolution? After several very small games I have decided to make something more standalone (2D) and playable. However, I have met the problem of every game that is going to be played in more screen resolutions.

Basically, after some research I see that there are several solutions.

This seems to be the simplest one: Let's say I define a constant aspect ratio for the game (16:9) and the whole game will be created for a resolution 1680 x 1050.

The game will be rendered in this resolution and then I will be able to scale the render to match the player's display resolution. Therefore the game might be playable on almost any resolution, while it would keep the aspect ratio. So, if the game was run on 4:3 display, the top and the bottom of the display would be filled with black color.

It seems easy, but my question is - Is this a good approach for a simple game? The game will be simple, but I want to maintain high quality.

sentences:
How to choose inputs to an artifial neural network? I have to implement, as part of an assignment, a learning method that enables minesweepers to avoid colliding with mines. I have been given the choice to choose between a supervised/unsupervised/reinforcement learning algorithm.

I remember in one of my lectures, the lecturer mentioned ALVIN. He was teaching artificial neural networks.

Since the behaviour I'm looking for is more or less similar to ALVINN's, I want to implement an ANN. I've implemented an ANN before for solving the 3-parity xor problem, here's my solution. I've never really understood the intuition behind ANNs.

I was wondering, what could the inputs be to my ANN?
In the case of the 3parity xor problem it was obvious.

[EDIT]

The game is not minesweeper. However, it has bots which look like battleships which we refer to as minesweepers. Please see the screenshot below. The goal is for the battleships aka minesweepers to move in one direction each but should learn to avoid mines over time.

sentences:
2D procedural veins/cumps of weighted ores/rocks I'm evaluating methods for generating "clumps" or "veins" of rocks in a 2D top-down procedural game. Obviously the most common suggestion is to use various types of noise, but I feel like noise (alone) won't achieve what I'm after.

I've used a combination of voronoi and perlin noise because it's easier to generate "regions" of different noise. I can more easily turn these areas into "veins" of rocks or something than I could be using a "heightmap" alone - heightmaps tend to be more swirly/cloud-like.

With a high threshold and some rounding, I can turn this into a mask that works well for veins:

Changing the spacing and scale is as simple as toying with the math/threshold.

The difficulty lies with choosing which "rock" (or "ore") will fill each vein. Primarily, this is thanks to the fact that my rocks are weighted. Veins of rare rocks should not be common.

I currently map the original voronoi cell value to a specific rock, which  forces each vein to be a single type, but can't be weighted. As you can see in picture #1, there's a fairly even distribution of each shaded area.

So either, I need a new way to choose a weighted random rock type for each vein, or I need a new way to place veins.

Minecraft is a good well-known example of what I need, except I work in 2D:

Regularly distributed ore veins
Veins of common ores are found more often and are typically larger veins
Veins of rare ores are harder to find, and are smaller in size

Noise alone just can't seem to produce these values. What else can I try?

sentences:
How to implement an tooltip item cache? I'm building a tooltip item like that

I would like to keep this information cached on the client side, avoiding that whenever the information is displayed it's necessary to make a request to the server, but make the cache is not the problem, the problem is that an item can have its attributes modified and the cache on the client side will show wrong information.

My question is, cache is a good idea? if yes what is the best solution?

sentences:
XNA realistic water: How to clip along a mesh instead of a plane I hope you can help me with the following problem:

I'm developing a 3d game (in XNA) with an ocean. I want it to look semi-realistic.
So far, I'm rendering 4 things:

The ocean floor (terrain) on the view matrix (refraction)
The terrain above water on the mirrored view matrix (reflection)
The terrain above water on the view matrix (actual terrain)
The water, which is simply a plane, using the refraction and reflection rendertargets, the fresnel term, and a normal map to give the impression of small waves.

Instead of a flat plane, I want to render the water on a mesh, to get some actual waves going. This is where I've been stuck for a while now. It's quite simple to clip the terrain along that plane, but is it possible to clip a mesh along another mesh? Or am I going about this the wrong way?

sentences:
State Machine class vs function pointers What do you guys recommend to use?
A State Machine with function pointers or classes?

Or, in which case one would be better than the other one?

At work we use the state machine with function pointers only and I've never tried to use one with classes before.

sentences:
Godot doesn't loop the sound Basically it's the sound of a fuse for a bomb, until the timer sends the signal the sound should stop playing and play the explosion sound, but right now only plays once and the stop.
What i did wrong/ what i did missed?
the code i use for the bomb scene:
extends StaticBody2D

func _ready():
    $AnimatedSprite.animation = "bomb"
    $CollisionShape2D.disabled = true
    $BombTimer.start()
    $FuseSound.play()

func _on_BombTimer_timeout():
    $AnimatedSprite.animation = "explosion"
    $CollisionShape2D.disabled = false
    $RemoveTimer.start()
    $ExplosionSound.play()

func _on_RemoveTimer_timeout():
    queue_free()

func _on_Bomb_body_entered(body):
    print("bomb collided with:" + body.get_name())

sentences:
Make openGL program only update every 1/60 seconds I'm learning C++ and openGL and have this program as a result from tutorials and playing around. The problem is that the main loop is running at "full speed", making the program unnecessarily cpu intensive. I have managed to make it only perform rendering every 16.7 ms or so, but the outside loop that is waiting to render still is iterating as fast as my computer can handle.

This is the full main.cpp:
http://pastebin.com/KaCW7wZw

This is the main loop at line 95:

while (!terminate) {
    if (SDL_GetTicks() >= time_start + frame_rate)
    {
        time_start = SDL_GetTicks();
        while (SDL_PollEvent(&event))
        {
            if (event.type == SDL_QUIT) {
                terminate = true;
                break;
            }
        }

        glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        renderLoop(entities, &counter);
        SDL_GL_SwapWindow(m_window);;
        counter += 1.0f;
    }
}

I've tried googling and haven't found anything concrete (obviously), except that using some kind of sleep is bad design for these loops.

So how can I alter this to slow the whole thing down, and avoid having 100% cpu usage for a program that's not doing much at the moment?

sentences:
I need advice on creating animal 3D walk cycles in XNA I want to purchase a number of 3D models from TurboSquid and animate them in an XNA game.

I wrote a lot of games from 1985-1999 and have recently become involved with XNA. Now I would like to port one of my old games to the XBOX. I do have a background in 3D animation; but that was years ago.

What is the current method for animating a walk cycle with a 3D model and using it inside XNA?

Is there a book, software or a tutorial that you can recommend?

Thanks in advance and sorry for such a broad and currently naive question.

sentences:
Position sprite at center of screen I am trying to get a sprite to position itself at the center of the screen but nothing seems to be working for me.
I'm trying

Viewport viewport = graphics.GraphicsDevice.Viewport;
logoPosition = new Vector2((viewport.Width - towerImage.Width) / 2,
                           (viewport.Height - towerImage.Height) / 2);

and

spriteBatch.Draw(towerImage, centre, null, Color.White, 0, baseOrigin, 1.0f, SpriteEffects.None, 0);

This is my first time using XNA and I don't really have a clue what I'm doing.

sentences:
Storing game data on user end? A thought occurred to me after seeing this question:
Storing data - think character data for an online game - on the user`s computer is definitely less safe (maybe an understatement) than on a server under your control, but...

Is such a mechanism feasible? (while preventing cheating and such, of course...) If yes - why is it not used? Is it just me who hadn't seen it?

Some elaboration and ramblings:

A hypothetical advantage to this would be a need to store VERY little data on the server itself while still being able to handle a HUGE bookkeeping for the character, recording amounts of data you wouldn't dream of while storing the data on your server (think looking back on the exact date of your first attack in a game... sweet, useless, nostalgia :) ).

(Of course, there's a limit to how much you would do this way as well - your user isn't likely to condone a 1GB game save file... or they would... who knows.
Maybe an option for what data to keep could give users the choice between conservative and extensive logging of their adventures?)

Take the following example: I think that an attempt to:

Store a hash of the user's data on the server.
On the next run, request the data from the user`s end.
Hash it.
Compare the hashes.

is bound to fail.

The user could change the data on his end after the verification.
I'm assuming there will always be a 'hole' somewhere even if the programmer utilizes tons of checks throughout the game, verifying every action.

This could very well be a reason for not doing this... just remember I'm asking about feasibility, not practicality.

There are some more considerations, of course:

The user's data being at their hands can be less safe and less available.
They could lose it, have it stolen, forget their flash drive containing the file at home etc etc.

But it could also mean that the server has very little data on it to be compromised - say, if all of the user's data will be in their file, and the server will only be able to verify its authenticity via hashing mechanism and whatnot.

It will also be very easy to back up a server containing so little data.

The mechanism for the user should be a simple encryption/signature of the data file... or is that bound to fail as well?

sentences:
What's wrong with reversing an action like this? I'm working on an undo and redo system map editor and have come across a major issue. If I place a tile down, move right a tile, and then move back to that tile I previously placed everything works fine. Until I try and Undo, Redo, and then Undo again.

This is the state when they're placed:

Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:

The undo redo stack looks something like:

Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
41
Unexecuting:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
41

I don't want this to be a code dump or "debug my code for me". I understand the problem is located at the bottom most segment where it assigns the tile an ID of 41 once again - since that's what it's previous value was. This works the first time - but not the second as seen. I'm confused to why the algorithm fails. If anyone has written something similar, feedback would be appreciated. I don't need code-fixed - just hints as to where I can find a working algorithim or a rational explanationa s to why this happens. It's just a simple pencil tool that should write tiles the grid.

  public new void Execute(GameMap gameMap)
{
    Console.WriteLine("Executing: ");
    PrintState();

    _previousTiles.Clear();

    // Get vertical portion
    var curTexture = MapEditorGlobals.CurrentActiveTexture;

    // We need to loop over the width of the editor
    for (int w = 0; w < SelectedTiles.Width / 32; w++)
    {
        for (int h = 0; h < SelectedTiles.Height / 32; h++)
        {

            var gX = SelectedTiles.X / 32 + w;
            var gY = SelectedTiles.Y / 32 + h;

            var tY = (gY) * curTexture.Width / 32;
            var tX = gX;
            var tileID = tY + tX;

            _previousTiles.Add(gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId);
            gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId = tileID;
        }
    }

}

  public new void UnExecute(GameMap gameMap)
        {

            Console.WriteLine("Unexecuting: ");
            PrintState();

            List<int> newTiles = new List<int>();

            // Get vertical portion
            var curTexture = MapEditorGlobals.CurrentActiveTexture;

            // We need to loop over the width of the editor
            for (int w = 0; w < SelectedTiles.Width / 32; w++)
            {
                for (int h = 0; h < SelectedTiles.Height / 32; h++)
                {

                    var gX = SelectedTiles.X / 32 + w;
                    var gY = SelectedTiles.Y / 32 + h;

                    var tY = (gY) * curTexture.Width / 32;
                    var tX = gX;
                    var tileID = tY + tX;

                    newTiles.Add(gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId);
                    gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId = _previousTiles.Last();
                    _previousTiles.Remove(_previousTiles.Last());
                }
            }

        }

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:
stop previous audio from playing when starting a new one I created a dialogue system with audio it works perfectly fine unless you start skipping the voice lines so then it all becomes a mess with all of the voice lines overlapping is there a way to make it so when you go to the next audio line the previous one stops playing?
Example of what is happening
as you can see in the video you can switch the text just fine and it doesn't show the previous one but for the audio, it just transforms into a jumbled mess, is there a way to fix this or to at least make it so people cant go to the next line until they finish hearing the current one?
DialogueManager Script:
public class DialogueManager : MonoBehaviour
{
public Door1Animation doorAnimation;

public Text nameText;
public Text dialogueText;
public Text changeText;

public AudioManager Sound;

public Animator textBoxAnimation;

public Queue<string> sentences;

public Queue<string> voiceLines;

void Start()
{
    sentences = new Queue<string>();
    voiceLines = new Queue<string>();
}

public void StartDialogue (Dialogue dialogue)
{
    textBoxAnimation.SetBool("Open", true);

    changeText.text = ("Aperte R para continuar");

    nameText.text = dialogue.name;

    sentences.Clear();

    voiceLines.Clear();

    foreach (string sentence in dialogue.sentences)
    {
        sentences.Enqueue(sentence);
    }

    DisplayNextSentence();

    foreach (string voiceLine in dialogue.voiceLines)
    {
        voiceLines.Enqueue(voiceLine);
    }

    PlayNextLine();
}

public void DisplayNextSentence()
{
    if (sentences.Count == 1)
    {
        changeText.text = ("Aperte R para fechar");
    }

    if (sentences.Count == 0)
    {
        EndDialogue();
        return;
    }

    string sentence = sentences.Dequeue();
    dialogueText.text = sentence;
}

public void PlayNextLine()
{
    if (voiceLines.Count == 0)
    {
        return;
    }

    string voiceLine = voiceLines.Dequeue();
    Sound.Play(voiceLine);
}

public void EndDialogue()
{
    Debug.Log("End of conversation");
    doorAnimation.openDoor = true;
    textBoxAnimation.SetBool("Open", false);
}
}

AudioManager Script:
using UnityEngine.Audio;
using System;
using UnityEngine;

public class AudioManager : MonoBehaviour
{
public Sound[] sounds;

void Awake()
{
    foreach (Sound s in sounds)
    {
        s.source = gameObject.AddComponent<AudioSource>();
        s.source.clip = s.clip;

        s.source.volume = s.volume;

        s.source.pitch = s.pitch;

        s.source.loop = s.loop;

    }

}

private void Start()
{
    Play("BackgroundMusic");
}

public void Play (string name)
{
    Sound s = Array.Find(sounds, sound => sound.name == name);
    s.source.Play();
}
}

Just the part of the interaction code so you can go to the next line/audio:
    public void Update()
{
    if (Input.GetKeyDown(KeyCode.E))
    {

        PersonInteract();
        buttonInteract();

    }

    if (Input.GetKeyDown(KeyCode.R))
    {
        FindObjectOfType<DialogueManager>().DisplayNextSentence();
        FindObjectOfType<DialogueManager>().PlayNextLine();
    }
}

Inspector view of the dialogue manager:

sentences:
In Game Window Frame Size Consistency I'm currently building a game that utilizes many of its own 'windows' to display various information and dialogue to the user.  Since there are multiple sizes and proportions these windows must be displayed at, we need a consistent way to draw the frame around the window itself so that it does not become stretched as we change the default size/proportion of the art asset during runtime.

The solution we have currently come up with is drawing the frame in pieces, and the background of the windows separately.  We would have the background, a 'corner piece', and a 'connector piece'.  The background would be drawn and resized to whatever size and proportion not caring about if this particular piece was stretched .  The corner would be drawn and rotated to fit at each corner of the window.  Finally the connectors would be 1 pixel wide pieces that would be drawn and rotated/stretched to fill the gap between the 4 corner pieces.

While I feel this is an adequate solution to the problem I am not sure if this is the solution most games use when they have windows they would like to keep consistently framed.  Is there a more commonplace solution for this issue, or does what we've come up with pretty much nail it on the head?

sentences: How to get smooth transition within slick? When a player clicks start, my app immediately switches to the first level. My question is how do I incorporate a smooth transition within Slick?

sentences:
Why is my model flickering when translating I have several models here. When they stand still during gameTime, there's no flickering.
But as soon as I move them across the x-axis, they flicker on some places.

protected override void Draw(GameTime gameTime)
{
    graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

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

    foreach (ModelMesh mesh in myModel.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index] *
                Matrix.CreateRotationY(modelRotation)
                * Matrix.CreateTranslation(modelPosition);
            effect.View = Matrix.CreateLookAt(cameraPosition,
                Vector3.Zero, Vector3.Up);
            effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45.0f), aspectRatio,
                1.0f, 10000.0f);
        }
        mesh.Draw();
    }
    base.Draw(gameTime);
}

Why is that happening and what could I do to prevent it?

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 to Slice the external Spritesheet programmatically by using C# in Unity I have a sprite sheet like this:

I am using Unity Engine to develope my game. I would like to load this external spritesheet outside and slice it as Grid type programmatically instead of using Sprite Editor in Unity.
I would like to find a way to do it by using C# scripting. Because my game would have more than 5 heroes with 10 animations per hero for next updates in my game.

sentences:
Is a mesh OK to use for grass if there will be 1000's of them across the terrain? Am creating a low poly game in Unity 3D for PC.  The terrain is made in Blender, so it's a fixed size, but quite large for the player to explore.  I want to add things such as grass and flowers, but am not sure the best practices are for creating those types of assets.

Is using a mesh for small clumps of grass the wrong way to do this if there will be 1000's of them?

I will likely be using the occlusion culling system Unity provides, but I'm not sure if I still need to look at doing things such as grass in a different way for performance sake.

sentences: Maximum audio delay before the player notices? Given some event in a game, what is the maximum delay to producing audio that the player will properly associate the audio with that event (and not perceive lag)?

sentences:
how to make skills and their animations in opengl ? are skills 3d model or 2d? 1)slash effect
2)area skills like dota2 crystal maiden ulti and first skill
3)over an enemy skills example dota2 crystal maiden second skill

how they make in opengl

i know opengl billboards way and texture atlas i can make basic flame effect with using these 2 way together.
But how they make others ? area skills are 3d model animation ? then its texture is changing every frame? over an enemy skills can 3d model i think? how they make skills transparent ? with glblend ? what is best way to make them sorry for bad english i searched but i couldn't find any suggestion help please
im using c++,sdl,opengl

sentences:
In 2D, how can I improve character rotation using raycasts when dealing with sharp/convex edges? Edit:

After making some edits to my polygon collider (based on @Alex F's suggestion), I can indeed confirm that sharp, convex corners are causing the buggy rotation. For now I've decided to only rotate my character if its moving, so standing on a corner when velocity.x = 0 won't cause my collider to rotate rapidly. However, this seems like a band-aid fix, and I'm still wondering if there's a better way to handle these edges. Resuming movement after idling on a corner still causes some buggy behavior, and I'm concerned that this will compound once my rotations become more complicated or frequent:

Original question:

I'm quite inexperienced with quaternions and rotating, so I'm not entirely sure if this issue has to do with my code, the collisions shown in this question, or my game design.

What I'm trying to achieve is "smooth" rotation of my character's collider based on  the normal of the current surface. I've been creating a custom raycast controller in 2D from the ground up, and already know how to find all kinds of information from rays, such as the current angle of a sloped surface. My controller is coming along quite nicely, and rotation is one of the last things I'd like to tackle. It should be able to handle sloped box colliders, but also irregular ground shapes that require something like a polygon collider.

I've been somewhat successful, having learned that I shouldn't set my character's z-rotation directly, but instead update my entire transform.rotation with a method like Quaternion.Lerp. This has worked generally well, but I'm running into issues on irregular ground, and on corners.

Notice the smooth transition from flat to sloped surfaces, but that my collider rotates rapidly when the raycast hits a corner:

Movement is still somewhat smooth on irregular terrain, but there is a noticeable shakiness at times. Sometimes my character's collider rotates rapidly as well (end of gif):

I suspect that the shakiness on the irregular terrain is just my collider getting "caught" on the many edges that the polygon collider creates. I just don't know if this is happening because I could be doing something differently in my code, or if I need to edit the polygon collider, or is caused by something else entirely. Perhaps raycasting isn't the best way to achieve my desired behavior.

[SerializeField]
private float speed = 5;
[SerializeField]
private float gravity = -20;
[SerializeField]
private LayerMask collisionMask;

private BoxCollider2D boxCollider;
private Vector2 velocity;
private Vector2 groundNormal;

private void Awake()
{
    boxCollider = GetComponent<BoxCollider2D>();
}

private void Update()
{
    float playerInput = Input.GetAxisRaw("Horizontal");

    velocity.x = playerInput * speed;
    velocity.y += gravity * Time.deltaTime;

    MoveCharacter(velocity * Time.deltaTime);
}

private void MoveCharacter(Vector2 velocity)
{
    //Rotate the character
    Quaternion targetRotation = Quaternion.FromToRotation(Vector2.up, groundNormal);
    transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, 0.5f);

    groundNormal = Vector2.zero;

    CollideBelow(ref velocity);
    transform.Translate(velocity);
}

private void CollideBelow(ref Vector2 deltaMovement)
{
    float rayLength = 1;
    Vector2 rayOrigin = transform.position;

    RaycastHit2D hit = Physics2D.Raycast(rayOrigin, -transform.up, rayLength, collisionMask);
    Debug.DrawRay(rayOrigin, -transform.up * rayLength, Color.red);

    if (hit)
    {
        velocity.y = 0;
        deltaMovement.y = -(hit.distance - boxCollider.size.y * 0.5f);

        groundNormal = hit.normal;
    }
}

sentences:
Rendering Texture Quad to Screen or FBO (OpenGL ES) I need to render the texture on the iOS device's screen or a render-to-texture frame buffer object. But it does not show any texture. It's all black.

(I am loading texture with image myself for testing purpose)

//Load texture data

UIImage *image=[UIImage imageNamed:@"textureImage.png"];

    GLuint width = FRAME_WIDTH;
    GLuint height = FRAME_HEIGHT;

    //Create context
    void *imageData = malloc(height * width * 4);
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextRef context = CGBitmapContextCreate(imageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
    CGColorSpaceRelease(colorSpace);

    //Prepare image
    CGContextClearRect(context, CGRectMake(0, 0, width, height));
    CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.CGImage);

    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

Simple Texture Quad drawing code mentioned here

//Bind Texture, Bind render-to-texture FBO and then draw the quad

const float quadPositions[] = {  1.0,  1.0, 0.0,
                                -1.0,  1.0, 0.0,
                                -1.0, -1.0, 0.0,
                                -1.0, -1.0, 0.0,
                                 1.0, -1.0, 0.0,
                                 1.0,  1.0, 0.0 };
const float quadTexcoords[] = { 1.0, 1.0,
                                0.0, 1.0,
                                0.0, 0.0,
                                0.0, 0.0,
                                1.0, 0.0,
                                1.0, 1.0 };

// stop using VBO
glBindBuffer(GL_ARRAY_BUFFER, 0);

// setup buffer offsets
glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, GL_FALSE, 3*sizeof(float), quadPositions);
glVertexAttribPointer(ATTRIB_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, 2*sizeof(float), quadTexcoords);

// ensure the proper arrays are enabled
glEnableVertexAttribArray(ATTRIB_VERTEX);
glEnableVertexAttribArray(ATTRIB_TEXCOORD0);

//Bind Texture and render-to-texture FBO.
glBindTexture(GL_TEXTURE_2D, GLid);

//Actually wanted to render it to render-to-texture FBO, but now testing directly on default FBO.
//glBindFramebuffer(GL_FRAMEBUFFER, textureFBO[pixelBuffernum]);

// draw
glDrawArrays(GL_TRIANGLES, 0, 2*3);

What am I doing wrong in this code?

P.S. I'm not familiar with shaders yet, so it is difficult for me to make use of them right now.

sentences:
How would I detect if two 2D arrays of any shape collided? Say there's two or more moveable objects of any shape in 2D plane, each object has its own 2D boolean array to act as a bounds box which can range from 10 to 100 pixels, the program then reads each pixel from a image that represents it, and appropriatly changes the array to true(pixel has a alpha more then 1) or false(pixel has a alpha less than one).

Each time one of these objects moves, what would be the best accurate way to test if they hit another object in Java using as few APIs/libraries as possible?

sentences:
How can I get separate caches for different coroutines? (Unity) I want to fade out an image, so I have a coroutine FadeOut(). However, I want to have a separate image each time I call FadeOut.

If I try to do something like this:

IEnumerator FadeOut(GameObject image) {
    SpriteRenderer render = image.GetComponent<SpriteRenderer>();
    yield return null;
}

Ignoring all the color changing code which I took out, how do I make it so that I can save a separate cache for each image I add? I don't want to run GetComponent() each frame, because I'm running on mobile and because I want to think of a clever way to stash the renderer.

For example, if I declare the renderer at the top like this:

private SpriteRenderer render;

and want to cache it on the first frame of the coroutine, there's the chance that calling FadeOut() on another object will change the renderer to a new object and the first FadeOut() will cancel.

Can I make the method static? Will that cache a private version of renderer?

sentences:
How to properly differentiate single-clicks and double-click in Unity3D using C#? What I am trying to understand and learn here is a very basic thing: what is the most general and most polished way to properly differentiate single-clicks and double-clicks for the 3 main mouse buttons in Unity, using C#?

My emphasis on the word properly is not for nothing. Although I was surprised that this seems to have never been asked in this website before, of course I have searched and found numerous similar questions on Unity's forums and Unity's own question-answer pages. However, as it is often the case with answers posted in these resources, they all seemed to be either plain wrong or at least a bit too amateurish.

Let me explain. Proposed solutions always had either of the two approaches and their corresponding flaws:

every time a click happens, calculate time delta since last click and if it was smaller than a given threshold, a double click would be detected. However, this solution results in that a quick single click is detected before the double-click is detected, which is undesirable in most situations because then it activates both single and double click actions.

Rough example:

float dclick_threshold = 0.25f;
double timerdclick = 0;

if (Input.GetMouseButtonDown(0)
{
   if (Time.time - timerdclick) > dclick_threshold)
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
   } else {
       Debug.Log("double click");
       //call the DoubleClick() function, not shown
   }
   timerdclick = Time.time;
}

set a wait-for delay for the single-click to be activated, which means, at every click, only activate single click actions if the time delay since last click is above a given threshold. However, this gives sluggish results, since a waiting before it is possible to notice the waiting before single-clicks are detected. Worse than that, this kind of solution suffers from discrepancies across machines, since it does not take into account how slow or how fast is the user's double-click speed setting at the OS level.

Rough example:

   float one_click = false;
   float dclick_threshold = 0.25f;
   double timerdclick = 0;

   if (one_click && ((Time.time - timerdclick) > dclick_threshold))
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
       one_click = false;
   }

   if (Input.GetMouseButtonDown(0))
   {

       if (!one_click)
       {
           dclick = -1;
           timerdclick = Time.time;
           one_click = true;
       }

       else if (one_click && ((Time.time - timerdclick) < dclick_threshold))
       {
           Debug.Log("double click");
           //call the DoubleClick() function, not shown
           one_click = false;
       }

   }

Therefore, my questions becomes the following. Is there a more polished and reliable way of detecting double clicks in Unity using C#, other than these solutions, and one that handles the problems aforementioned?

sentences:
Preserve top right position and relative size to screen I have the following circle laid out where I'd like it at 1920x1080: http://imgur.com/a/PmvVA at 1280x720 it takes the same amount of relative screen space.

When the aspect ratio changes I want the circle to remain a circle and for it to always be top right aligned.

When I set the image to preserve aspect it gets pushed downwards like so: http://i.imgur.com/1sicdD5.png

How can I ensure the image stays top right aligned in all cases?

sentences:
Determine terrain type and worldobject placement techniques I'm currently researching the techniques of generating a procedural map. I've already found some methods regarding the mesh generation (e.g. variations of noise like perlin, simplex and cell, midpoint displacement and diamond square).

The next step for me is to determine the terrain type. The most easy way is probably matching a static value to the height value (e.g. everything below 0.2 is water, everything between 0.2 and 0.3 is sand, everything between 0.3 and 0.5 is grass, etc.). To make a more advanced version I can use temperature and moisture values for the biomes. I'd very much like to know other techniques to determine this.

I also want to place objects (like rocks, trees, plants) on the map, however I can not seem to find different techniques to research/implement this. I probably just don't know the name of the global technique to find specific techniques. I found the use of fractal noise with a variable for the probability, but I'd like to know more techniques.

So, let me know some of your techniques.

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:
3D Translations relative to 3D Rotations I'm trying to program camera movement to be relative to camera rotation. (Forward is always forward, regardless of pitch, yaw, and roll)
I want to be able to move forward, backward, left, right, up, and down.

I do not want to use a matrix.

I want to use sin and cos from the standard math library.

The camera rotates on all 3 axis.
The rotation order is z(roll), y(pitch), x(yaw).
When all rotations are 0, positive z is forward, positive y is down, and positive x is left.

So far I've gotten forward and backward movement to work with:

velZ = speed * cos(rotX) * cos(rotY);
velY = speed * sin(rotY);
velX = speed * sin(-rotX) * cos(rotY);

If somebody knows how to do this or knows where I can find information on this, it would be greatly appreciated.

sentences:
Events management using SDL 2.0 I wrote a simple SDL program using SDL 2.0. I have a little problem when I want to check the mouse wheel events. Actually, in the version 2.0 the flags SDL_BUTTON_WHEELDOWN and SDL_BUTTON_WHEELUP no longer exist. There is just the flags SDL_MOUSEWHEEL. The code below check correctly the' WHEELUP' and 'WHEELDOWN' events but with the same flag.

while(!terminer)
    {
        while (SDL_PollEvent(&evenements))
        {
            switch (evenements.type)
            {
            case SDL_QUIT:
                terminer = true;
                break;
            case SDL_KEYDOWN:
                switch (evenements.key.keysym.sym)
                {
                case SDLK_ESCAPE:
                    terminer = true;
                    break;
                }
                break;
                case SDL_MOUSEMOTION:
                    std::cout << "MOUSE : MOVE" << std::endl;
                    break;
                case SDL_MOUSEBUTTONUP:
                case SDL_MOUSEBUTTONDOWN:
                    std::cout << "MOUSE : BUTTON DOWN" << std::endl;
                    break;
                case SDL_MOUSEWHEEL:
                    std::cout << "MOUSE : WHEEL" << std::endl;
                    break;
            }
        }

But I would like to handle separately the 'WHEELUP' and 'WHEELDOWN' events. I tried several others flags in my condition but without success. Does anyone can help me, please ?

Thanks a lot in advance for your help.

sentences:
How to create heat haze effect in Libgdx? I would like to create a heat haze effect for a 2D game I am making.

Do You have ideas or suggestions, how to get that effect. I am using Libgdx(OpenGL 2.0).

Thank You in advance!

sentences:
LibGDX and Sound Priorities According to a post I found, the setPriority of a Sound in LibGDX is not only a hint, but does nothing on desktop, and I can confirm this.

I really need priorities for sounds in my desktop game.

The first thing that comes to mind is to roll some kind of simple "sound system" with, say, a PriorityQueue, but I'm not quite sure of how I would implement it exactly, and I'd like to re-use code as much as possible... has anyone here perhaps rolled one that I could use?

sentences:
How to create a legally valid timestamp of unpublished game artwork Before publishing promotional material of my first indie game I wanted to mark all my artwork with a legally valid timestamp.

There are two ways I know to do this:

 1 go to a sollecitor/lawyer and pay for them to certify the document
 2 use an online webservice to mark any given file/folder readable to the service

Anyone has already done this and if yes how (e.g. which website have you used? which type of solecitor have you contacted? etc..)?

I am doing all this because I have prepared a kickstarter video that I wanted to publish in these days to ask for some additional funds to complete my game and, as it contains sequences of the game, I am at the same time worried about publishing it (somebody might copy the characters as I say in the video that I would like to do also a comic book series based on those characters). I guess that "eCO" (or something similar) becomes a must in this case right?

Kind Regards

PS: I know that there is always the good old "send yourself a mail with a stamp and a date" but is not very strong as proof.

sentences:
How to create a thread in XNA for pathfinding? I am trying to create a separate thread for my enemy's A* pathfinder which will give me a list of points to get to the player. I have placed the thread in the update method of my enemy. However this seems to cause jittering in the game every-time the thread is called.

I have tried calling just the method and this works fine. Is there any way I can sort this out so that I can have the pathfinder on its own thread? Do I need to remove the thread start from the update and start it in the constructor? Is there any way this can work?

Here is the code at the moment:

bool running = false;
bool threadstarted;
System.Threading.Thread thread;

public void update()
{
    if (running == false && threadstarted == false)
    {
        thread = new System.Threading.Thread(PathThread);

        //thread.Priority = System.Threading.ThreadPriority.Lowest;
        thread.IsBackground = true;
        thread.Start(startandendobj);
        //PathThread(startandendobj);
        threadstarted = true;
    }
}

public void PathThread(object Startandend)
{

    object[] Startandendarray = (object[])Startandend;
    Point startpoint = (Point)Startandendarray[0];
    Point endpoint = (Point)Startandendarray[1];

    bool runnable = true;
    // Path find from 255, 255 to 0,0 on the map
    foreach(Tile tile in Map)
    {
        if(tile.Color == Color.Red)
        {
            if (tile.Position.Contains(endpoint))
            {
                runnable = false;
            }
        }
    }
    if(runnable == true)
    {
        running = true;
        Pathfinder p = new Pathfinder(Map);
        pathway = p.FindPath(startpoint, endpoint);
        running = false;
        threadstarted = false;
    }
}

sentences:
What data structure to use for the map in Pac-Man? I am trying to make a Pac-Man game in C# using GDI+. I have done some basic work and I have previously replicated games like Copter-It and Minesweeper, but I am confused about how I can implement the map in Pac-Man. I mean: which data structure to use, so I can use it for moving AI controlled objects and check collisions with walls.

I thought of a 2D array of ints but that didn't make sense to me. Looking for some help.

sentences:
2D Screen Coordinates to 2D World Coordinates in LWJGL I'm making a 2d top down game with lwjgl and am having trouble converting my 2d screen coordinates to 2d world coordinates.

Here's what I have so far

 private Vector2f toWorldCoords(Vector4f eyeCoords) {
    Matrix4f invertedView = Matrix4f.invert(MathUtil.createViewMatrix(camera), null);
    Vector4f rayWorld = Matrix4f.transform(invertedView, eyeCoords, null);
    Vector2f mouseRay = new Vector2f(rayWorld.x, rayWorld.y);
    mouseRay.normalise();
    return mouseRay;
}

public Vector2f screenToWorld(Vector2f mouseCoords) {
    Vector2f normalizedCoords = CursorHandler.getNormalisedDeviceCoordinates();
    Vector4f clipCoords = new Vector4f(normalizedCoords.x, normalizedCoords.y, -1.0f, 1.0f);
    Vector2f worldRay = toWorldCoords(clipCoords);

    return worldRay;
}

I understand it's been asked before, and I've tried following some 3d tutorials that deal with the same topic, but so far I haven't been able to use the code successfully.

Thanks

sentences:
In Socket.IO, should I use JSON for communication between server and client? I'm building an MMO with Socket.IO and Node.js. It works quite fast (though I don't have 1000 players yet) but my feeling is that it's not very optimized. JSON is super cool and easy to use within Socket.IO but when I see a broadcast from the server (1 player connected):

   debug - websocket writing 5:::{"name":"snapshot","args":[{"players":[{"id":1,
"tx":-5.62,"y":23.74,"tz":-5.64,"tRotY":0,"tSpeed":0}]}]}

I take it all the variable name are broadcast as well. Isn't that a huge overhead? Wouldn't it be better if I glued all data together using delimiters like this?

1;-5.62;23.74;-5.64;0;0

The disadvantage here would be that I have to split the string each time I receive it. But isn't that much better for latency?

sentences: If I own the rights to a third party game on a defunct console, can I republish it without the permissions of the console manufacturer? Suppose I owned the rights to a third party game published on the NES. Could I make a ROM of it and sell the emulated version?

sentences:
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 well known algorithms for efficient map knowledge? The question subject's is a little confusing, but I had no better way to express my train of thought. I'm working on an RPG at the moment, and I have a question. Using SARSA (State-Action-Reward-State-Action), I'm building a smart brain by training it through a reward system. Right now, what I want is to improve the learning process when moving each unit of the party, the selected actions will impact the team as a whole.

Moving to attack an enemy on which I have a tactical advantage, such as when a knight attacks a wizard, the wizard being weak on physical attacks, will get more damage out of the attack. The brain starts to understand that doing this gives a better reward. But, doing so could lead a unit to attack an enemy that has a tactical disadvantage against it but it has friends that can help him defeat the foe.

What I'm looking for is the following: Is there any algorithm that can parse a given data structure representing a map and see whether or not I'm moving toward a bad or good position depending on some variables such as moving toward target, target has friendly surrounding, moving toward treasure chest and etc.

I'm not looking for someone to write down an implementation for me, just to point me in the good direction because I have no idea what I'm looking for. If you're well versed in what I'm speaking and willing to give me a sample algorithm that I should follow and adapt for my game, I will gladly refer you in my prototype and send you a link once the prototype is playable!

sentences:
What is the most appropriate way to achieve synchronous Addressable asset loading? I am transitioning my project from Resources to Addressables. Some parts of my game just aren't worth doing asynchronously, and would just cause more problems - but I still want to use Addressables for its other benefits.

Anyway, it doesn't offer any synchronous methods in their API. Unity has an official repository with an example for "synchronous addressables" right here: https://github.com/Unity-Technologies/Addressables-Sample/blob/master/Advanced/Sync%20Addressables/Assets/SyncAddressables/SyncAddressables.cs

Although the code does appear to work in the few tests I've done The code below won't always work, and it doesn't make sense to me anyway. This is the relevant method:

    public static TObject LoadAsset<TObject>(object key)
    {
        if(!s_Initialized)
            throw new Exception("Whoa there friend!  We haven't init'd yet!");

        var op = Addressables.LoadAssetAsync<TObject>(key);

        if(!op.IsDone)
            throw new Exception("Sync LoadAsset failed to load in a sync way! " + key);

        if (op.Result == null)
        {
            var message = "Sync LoadAsset has null result " + key;
            if (op.OperationException != null)
                message += " Exception: " + op.OperationException;

            throw new Exception(message);
        }

        return op.Result;
    }

It will throw an exception if the asset didn't manage to load instantly (the !op.isDone part). Sure, that's technically synchronous, but it seems to ignore the elephant in the room: if the asset is large I would expect it to need a bit more time (i.e. freeze the game), which is fine for my current needs - but instead, the game will just end up crashing because it couldn't load immediately.

What is the most appropriate way to achieve synchronous Addressable asset loading?

sentences:
Unity or Monogame or Gamemaker 2 for an experienced application developer? So i know this question has been hammered down several times but please bear with me.

I used to be a C# .Net application developer but i am no longer employed, i am pretty good at C#.

I want to get into serious game development and i dunno where to start, i used to work with unity occasionally which is a very little and i kinda find it clunky, like it works but somehow it does not feel right and feels kinda clunky. But it works with tiled map editor without much of a hassle.

I Remember using Game maker studio when i was back in college and i found it  very good, its a breeze to work with and even have its own tiled map editor, even seems to have some good tutorials, the only con is its price.

I was initially inclined towards Monogame cause of my C# background, but i neither have time nor money and resources to support me for long enough time to be able to code every single thing from scratch and i am kinda in a pretty bad situation overall right now. It just takes too much time to do anything even to make it work with a tiled map editor, and there are very few tutorials or documentation to start with.

It seems like the only option for me is Unity at the moment, cause of ease of access and how easy it is to work with tiled map editor and lots of tutorials.

which one do you guys think is good overall?

Please keep in mind that i am currently unemployed and have very little resources to support myself, and i am a programmer so i don't even know how to compose music and do art for the game and i'd prefer if it provides some asserts to be used so i wont waste time in learning stuff when i cannot afford to spend time.

I will eventually learn them but not now, its not happening now so i prefer something that comes with some sorta free asserts that can be used (mainly music and art), I mean does it even matter if all i am trying to do is earn a decent minimum living?

I just want to make simple 2D NES/Snes style games with multiplayer support.

Thank you.

sentences:
Delay when moving elements How you can see my mouse goes little bit faster than widget.

My movement algorithm is:

cursorPositionPrev.set(cursorPosition);
cursorPosition.set(getCurrentPos());
...
Vector2f delta = new Vector2f(cursorPosition).sub(cursorPositionPrev);
widget.getPosition().add(delta);

I am using LWJGL and my own GUI solution.

Here is visual structure of event processor part.
One thread for processing events generated by user and another thread render current gui state.

Even if rendering and processing events is in one thread the issue is still exist.

So what can I do to make to avoid this delay and make widget to keep up with the mouse movement?

sentences:
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:
Using Farseer Physics, how can I get objects to bounce at the correct angle I am using the Farseer Physics engine in my MonoGame project. I have static walls which have "body" friction 0 and "body" restitution 1. I have dynamic objects, which are circles, with "body" friction 0 and "body" restitution 1. There is no gravity.

When I launch a dynamic object at a wall, it does not bounce in the way I would expect for a perfectly elastic, frictionless collision. The angle it bounces at should be the reflection (through the wall's normal vector) of the angle it arrives at.

Instead, the dynamic objects often slide along the wall:

In the diagram, the black line is the wall; the blue line is the desired path of the dynamic object; and the orange line is the current path of the dynamic object.

How can I make my dynamic objects bounce properly?

sentences:
DirectX post-processing pipeline I'm trying to make a simple post processing pipeline, depicted as follows with 3 effects in this case:

        |------|    |------|    |------|
   I -->|Shader|-O->|Shader|-I->|Shader|-O->
        |------|    |------|    |------|

I and O stand for a pair of 2 ShaderResourceViews/RenderTargetViews.

My plan was to do the following:

Create a shader resource and render target for each the input and the output
Apply the shader
Swap input and output to be used for the next shader
Goto 2.

This sounds somewhat confusing, but basically the same 2 ShaderResourceViews /RenderTargetViews should be reused for each stage of the post processing pipeline.

Is this possible, or do I have to create separate input and output ShaderResourceViews /RenderTargetViews for each stage of the postprocessing pipeline?

sentences:
Dealing with field of view when zooming into a terrain from a height I'm creating a tech demo featuring a small planet. The problem I'm having is that the planet doesn't really feel like the right "scale" when the camera in down on the surface, I think it could be the curvature of the surface of the planet.

I was wondering if anyone had any suggestions for adjusting maybe the field of view, or any other camera tricks to give the impression that, once on the surface, the planet is larger than it appears at the moment.

sentences:
Efficient algorithm for simultaneously updating game objects which need to be updated I have a grid of objects like this:

 1
      +
 F

1 is equal to the constant 1, F flickers between 0 and 1 each tick,
and + is equal to the sum of the 1 and the F.

I want to update these values as described above. The 1 won't change, the F will change from 0 to 1 and vice-versa, and the + will change to the sum.

I could just do a loop:

for node in nodes {
    if(node.type == '+') {
        node.value = node.input1.value + node.input2.value;
    }
    if(node.type == '1') { ... }
    if(node.type == 'F') { ... }
}

but the problem is that this will depend on the order of iteration. If the F
is iterated on first, then it will be set to 1 from an initial value of 0, then the + would equal 1 + 1, i.e. 2. But if the + was first, the result would be 1 + 0 = 0 and the NEXT tick would be 1 + 1 = 2.

I want to do this simultaneously. So I thought I could have a map of new values:

global map = new HashMap<Node, double>();
...
map.clear();
for node in nodes {
    if(node.type == '1') {}
    if(node.type == 'F') {
        map.set(node, node.value == 1 ? 0 : 1);
    }
    if(node.type == '+') {
        map.set(node, node.input1.value + node.input2.value);
    }
}
map.forEach(k, v -> k.value = v);

but this is probably inefficient as all values have to be looped over and entries in the map must be created for each node (node count is expected to be alot, around 10,000).

How do I do this? I probably need a list of "update required" nodes but I'm not sure what to do exactly, especially to do it simultaneously.

Examples:

1
 \
  == + === + === + == (flickers between 6 and 7 starting at 6 due to F flickering)
 /        /     /
F        3     2

// Nodes can be created by the player

1 => + <= 2
     |
     |
     (equals 3)

// Player creates a node:

1 => + <= 2
     |
     |
     (factorial) ===> (equals 6)

There can be multiple of these connected nodes at a time:

1 => + <= 2
     |
     |
     (equals 3)

2 => + <= 3
     |
     |
     (equals 5)

// If the player chooses, they can connect these 2 together:

1 => + <= 2
     |
     |
     -===========
                |
2 => + <= 3     |
     |          + =====> (equals 8)
     |          |
     -===========

Nodes can be inputs to themselves, or have no inputs (in which case the inputs default to 0):

     =====> (starts at 1 in the first tick, then keeps incrementing.)
     |
1 => + <==
     |   |
     =====

sentences:
how to change value of variable only once? I am building simple platformer game in which the player hops on to platforms and the speed of platforms increase per time. This is an endless game and depends on the high score system.

But, the problem is whenever I change the speed of the platform it changes per frame and it increases like 0.1f, 0.2f, 0.3f, and so on.
For eg:- my default speed of platforms is 0.1f and whenever the player collides with that platform, I want it to change to 0.2f but since, I did this in update function in unity, it changes 0.1f ,0.2f,0.3f constantly.

My code is:-

public class destroyTime : MonoBehaviour {
    public float startTime = 3f;
public MoveTheTiles movethetiles;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        foreach (Transform child in transform) {
            if (child.tag == "Player" ) {
                startTime -= Time.deltaTime;
movethetiles.move += 0.1f;`//Problem is here!`
                if (startTime <= 0) {
                    startTime = 3f;
                    child.transform.parent = null;
                    Destroy (gameObject);
                }
            }
        }
    }
}

sentences:
Map handling - Indoors/Outdoors and loading large maps I have two questions regarding the handling of maps.

Question 1. My map will consist of outdoor enviroments as well as dungeons, houses etc. How would I go on about connecting the outdoors with the indoors?

My simple solution to 1.
Put everything in the same map file and when you, for example, walk through a door the player will be "teleported" to the indoor location. Let's say the outdoor location of the door is at the coordinates (10,10) and the indoor enviroment of the given house is at (1000,1000) the player's coordinates will be set to (1000,1000) when he walks through the door.

Is this optimal or is there a better way of doing this?

Question 2. My map will consist of a bunch of larger cities and paths connecting these cities. Obviously the map will be pretty big and I'm not sure if I can keep the whole map in memory. How would I go on about creating an effective map management system?

My simple solution to 2.
Have the map consist of "chunks" with x*x tiles where x is the number of tiles that will fit in the screen. I would then load the chunk the placer is currently in and also the surrounding chunks but nothing else. When the player moves to a new chunk the map will load new surrounding chunks etc.

Would this be a more effective way of handling the map than loading the entire map into memory? Advantages of this way is that I don't have to keep the entire map in the memory but it will take time to dynamically load each "chunk" when it's needed thus creating loading time.

Any improvements to my rudimentary solutions is gladly appreciated.

sentences:
Cant get a Farseer Physics body’s rotation to follow the mouse Here is what’s in my HandleKeyboard() method that is called from the Game1 Update method.

        MouseState mState = Mouse.GetState();
        // the Vector2 that will hold the angle from the player to the mouse pointer.
        Vector2 mDirection = new Vector2(0, 0);

            // Get the current mouse position from the state update in the beginning of this method.
            Vector2 mPosition = new Vector2(mState.X, mState.Y);
            // Subtract the potsition of the player fromthe mouse pointer to get the exact angle in a vector2
            mDirection = mPosition - arrow.Position;

            // Control Rotation
            arrow.FixedRotation = true;
            // display the arrow in the rotation gathered above.
            arrow.Rotation = (float)Math.Atan2(mDirection.Y, mDirection.X);

From what I have read, this seems like the exact right thing to have the arrow look at my pointer. However when I rotate the mouse around the pointer it really doesn’t work properly.

It's hard to explain so here is a youtube video displaying what’s happening

I really hope you can tell me what’s going wrong.

sentences:
How do I load real-world map terrain? I'm new to game development and want know how to make or load a terrain from OpenStreetMap or Google Maps in your current city. (I'm using Unity3D.)

My idea is just load or generate a map of the current location, without collisions or anything else. A good example could be the Google's game "Ingress".

I found a few tutorials but only for a static city or mountain.

sentences:
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:
Vertex Snapping on a mesh with an armature I've made a selection of modular walls for a game i'm working on and some of the pieces have moving parts, like doors and flaps, but the moving pieces with an armature attached don't use vertex snapping like all of the other pieces and it leaves ugly gaps in the walls.
I've tried everything I can think of to get them lined up, the closest I can get is lining them up by eye and this leaves small gaps when in game and isn't perfect.
Does anyone know of a way to get vertex snapping to work with meshes that have an armature attatched?
I've attached a picture to try and explain:

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:
AddForce doesn't work anymore when Acceleration is added Everything worked fine until I added acceleration on the x axis..now when I try to jump it just lifts up very little from the ground in a weird way and then it slowly sinks down like having 0 gravity. Here is the code I'm using:

public class PlayerMovement : MonoBehaviour {

    public float baseSpeed = 10f;
    public float maxSpeed = 10f;
    public float timeFromZeroToMax = 10f;
    public float jumpSpeed = 10f;
    public Collider coll;

    float accelRatePerSecond;
    float forwardVelocity;
    Rigidbody rb;

    void Awake () {
        rb = GetComponent<Rigidbody>();
        coll = GetComponent<Collider>();

        accelRatePerSecond = maxSpeed / timeFromZeroToMax;
        forwardVelocity = 0f;
    }

    void FixedUpdate() {

        transform.Translate(transform.right * baseSpeed * Time.deltaTime);
        forwardVelocity += accelRatePerSecond * Time.deltaTime;
        forwardVelocity = Mathf.Min(forwardVelocity, maxSpeed);

        if (isGrounded() && Input.GetKeyDown("w"))
        {
            rb.AddForce(transform.up * jumpSpeed * Time.deltaTime, ForceMode.Impulse);
        }

    }
    void LateUpdate()
    {
        rb.velocity = transform.right * forwardVelocity;
    }
    bool isGrounded()
    {
        return Physics.Raycast(transform.position, Vector3.down, coll.bounds.extents.y + 0.1f);
    }
}

sentences:
Rendering a fullscreen quad is leaving a one pixel line on the left and top I am rendering a fullscreen quad using XNA. I am having an issue where the top pixel line and left pixel line are not rendered. It should be black in the picture. Can anyone tell me why this might be happening?

The effect's intent is to fade the screen out or in by adjusting the alpha of the pixel.

HLSL

float3 c;
float a;

float4 ShadeVertex(float3 pos : POSITION0) : POSITION0
{
    return float4(pos, 1);
}

float4 ShadePixel(float2 p : VPOS) : COLOR0
{
    return float4(c, a);
}

technique Simple
{
    pass FirstPass
    {
        VertexShader = compile vs_3_0 ShadeVertex();
        PixelShader = compile ps_3_0 ShadePixel();
    }
}

QuadRenderer.cs

internal sealed class QuadRenderer : GameComponent
{

    #region fields

    private VertexPositionTexture[] triangles;
    private short[] indexData = new short[] { 0, 1, 2, 2, 3, 0 };
    private GraphicsDevice gfx;

    #endregion

    #region constructors

    public QuadRenderer(IGameEngine engine)
        : base(engine)
    {
        this.gfx = engine.Device.Graphics;

        // texture coordinates semantic not used or needed
        this.triangles = new VertexPositionTexture[]
                     {
                       new VertexPositionTexture(new Vector3(1, -1, 0),
                                                 Vector2.Zero),
                       new VertexPositionTexture(new Vector3(-1, -1, 0),
                                                 Vector2.Zero),
                       new VertexPositionTexture(new Vector3(-1, 1, 0),
                                                 Vector2.Zero),
                       new VertexPositionTexture(new Vector3(1, 1, 0),
                                                 Vector2.Zero)
                     };
    }

    #endregion

    #region methods

    public void Render(Effect effect)
    {
        foreach (EffectPass p in effect.CurrentTechnique.Passes)
            p.Apply();

        this.Render();
    }

    private void Render()
    {
        this.gfx.DrawUserIndexedPrimitives(PrimitiveType.TriangleList,
                                           this.triangles, 0, 4,
                                           this.indexData, 0, 2);
    }

    #endregion

}

sentences:
Event Based Render / Update Loop I'm working on a few game dev tools which use OpenGL or DirectX to render 3D models (viewing).
Consider your favorite 3D modeling software package (Softimage, Maya, 3DS Max, modo, etc.). Note that the 3D viewport does not sit in a constant render loop pegged at max FPS. It remains idle (0 FPS) until some action is taking place in the viewport such as moving the viewport camera from side to side using the mouse or pressing play for animation. If the viewport is idle, there is no drain on the CPU / GPU. I'd like to use this technique in a couple of tools I'm working on and possibly within the game.
Is there a generally accepted programming technique with OpenGL and/or DirectX (via C++) that will achieve this?
One solution would be to do a standard render loop and check for input 1000s of times per second, but that seems inefficient and hard to manage as you add more and more "events" which would trigger a updated render.
Please let me know if the question is unclear. If I knew how to describe it perfectly I could probably just search google.

sentences:
Designing a four-directional movement control I'm developing an RPG for iOS. Currently, I plan my controls to look like this:

So the user can interact with objects, people, etc. by tapping on the right side of the screen, and moves by swiping in the direction they want to go in on the left side of the screen. Right now, I'm having a problem with the movement controls. What I want is for there not to be a fixed d-pad; I want the user to be able to tap anywhere on the left side of the screen and swipe in the direction they want (within a range, demonstrated in the below image), and it seems easy enough to implement this.

However, I'm having a bit of a math problem. Since I'm developing for iOS, how I planned to implement this was to subclass UIView and have two properties, startTouch and endTouch that represented where the user began his/her swipe and where the user lifted his/her finger. Then, I could do a bit of math and discern which direction the swipe was in. But I'm having a bit of trouble doing the math, and that's what my question's about: given two points, how can I figure out if the swipe was going up, down, left, or right? Keep in mind that the user could tap anywhere on the screen and that tap is the center of the imaginary d-pad, like so:

sentences:
Quaternion rotation is inverse of what I expect I'm trying to learn quaternions and decided to implement my own quaternion class.

To test it I made a couple vertex shaders, one that gets a model matrix (calculated from the quaternion) and another that gets the rotation quaternion directly and rotates vertices in-shader.

I then feed these a quaternion that rotates around the Y axis t / 10000 radians (t = time):

const rotation = Quat.fromAxisAngle(new Vec3([0, 1, 0]), t / 10000)

The result surprises me because my model is rotating counter-clockwise but I expected it to rotate clockwise, since the angle is increasing (checked it, quat's xyz increase with time). Rotation around the X or Z axes is also backwards.

All translations as well as matrix rotations work as expected in my coordinate system. I suspect my formulas are wrong, and probably assume +Z is forward. If I transpose my model matrix (or post-multiply with it) it rotates as expected, which suggests it's a handedness problem.

Where are my formulas wrong and how can I understand the math behind this?

Details

My matrices are column-major in memory (to match GLSL's mat4).
My coordinate system is +X right, +Y up, -Z forward.

My code

Quaternion from axis + angle

function fromAxisAngle(axis: Vec3, angle: number, dest = new Quat()): Quat {
  angle *= 0.5
  const sin = Math.sin(angle)

  dest.x = axis.x * sin
  dest.y = axis.y * sin
  dest.z = axis.z * sin
  dest.w = Math.cos(angle)

  return dest
}

Note: I noticed if I negate this quaternion's x, y and z, everthing works as expected. Is this the root cause? I thought quaternions didn't have handedness!

Since this is actually just inverting the quaternion (and thus its rotation) I'm afraid I'm just patching over the root cause. I don't want to patch the issue, I want to fix my math!

Matrix from quaternion

toMat4(dest = new Mat4()): Mat4 {
  const { x, y, z, w } = this

  const x2 = x + x
  const y2 = y + y
  const z2 = z + z

  const xx = x * x2
  const xy = x * y2
  const xz = x * z2
  const yy = y * y2
  const yz = y * z2
  const zz = z * z2
  const wx = w * x2
  const wy = w * y2
  const wz = w * z2

  // Notice matrix is column-major
  // Source:
  // https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Quaternion-derived_rotation_matrix
  dest.init([
    1 - (yy + zz), xy - wz,       xz + wy,       0,
    xy + wz,       1 - (xx + zz), yz - wx,       0,
    xz - wy,       yz + wx,       1 - (xx + yy), 0,
    0,             0,             0,             1,
  ])

  return dest
}

Matrix vertex shader

precision mediump float;

attribute vec3 aVertexPosition;
attribute vec2 aVertexUV;

uniform mat4 uModelMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;

varying vec2 vUV;

void main(void) {
  vUV = aVertexUV;

  gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aVertexPosition.xyz, 1.0);
}

Quaternion vertex shader

precision mediump float;

attribute vec3 aVertexPosition;
attribute vec2 aVertexUV;

struct Transform {
  float scale;
  vec3 translation;
  vec4 rotation;
};

uniform Transform uModel;
uniform Transform uView;
uniform mat4 uProjection;

varying vec2 vUV;

// Source:
// https://twistedpairdevelopment.wordpress.com/2013/02/11/rotating-a-vector-by-a-quaternion-in-glsl/
vec3 rotateVector(vec4 quat, vec3 vec) {
  return vec + 2.0 * cross(cross(vec, quat.xyz) + quat.w * vec, quat.xyz);
}

void main(void) {
  vUV = aVertexUV;

  vec3 world = rotateVector(uModel.rotation, aVertexPosition * uModel.scale) + uModel.translation;
  vec3 view = rotateVector(uView.rotation, world * uView.scale) + uView.translation;

  gl_Position = uProjection * vec4(view, 1.0);
}

sentences:
HTML/JS publish LibGDX I want to publish an app created with libGDX (HTML/JS publishing). Here are the steps I am doing.
Right Click on the Project -> Google -> Gwt Compile -> Compile.
After the compilation there is no .html file in the /war directory . There are 3 folders assets,html,WEB-INF . What am I doing wrong?

sentences:
Why when a certain boolean variable is true, the Unity editor crashes? In my game I've got a timer script, which counts down unless the game is paused, but whenever the variable for pausing is true, something in the timer script makes the editor itself crash, and I have to pull out the task manager to close unity because it freezes up completely.

Timer.cs

using UnityEngine;
using System.Collections;

public class Timer : MonoBehaviour {

  public LevelManager levelManager;

  // Use this for initialization
  void Start () {
    levelManager = FindObjectOfType<LevelManager>();
    StartCoroutine ("timerUpdate");
  }

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

  IEnumerator timerUpdate (){
    while (levelManager.levelTimeSeconds>0) {
      if (levelManager.isPause== false){
        yield return new WaitForSeconds(1);
        levelManager.levelTimeSeconds -= 1;
      }
    }
    levelManager.isOver = true;
  }
}

Anyone have any idea what's causing the editor to crash once isPause is true?

sentences:
SDL & Image quality on iOS We are just finishing a mobile game for Android and iOS.
The image quality on iOS is subpar, and we are trying to understand why.
We are currently having two problems: the background, which is a gradient, is shown using few colors and the grandient's steps are very visible, and the fonts are pixelated.
I think both issues are clearly visible in this screenshot from the simulator (zoom in if needed):

The simulator is running an iPhone Xs with Graphics Quality Override set to High Quality.
I have disabled “Compressing PNG files”, but the result is the same. This issue is not always so visible, or, at least, not on all devices. On a smaller iPhone (e.g., 7, so 4.7"), there are no noticeable issues with the image quality and the font pixelation is minimal.
We are probably going to disable support for iPad because of this.
Do you have any hints on what we can do?
Thanks!

sentences:
Is Google App Engine suitable for a real-time but single player game? I'm in the planning stage of a new project. Without going into details, this is a real-time 2D game with some basic construction aspects, combat, and a large procedurally generated world.

Because of the design of the game, it really makes most sense for it to run directly in a browser with all of a player's progress stored on the server. Basically each player will have their own persistent 2D map which they can modify, and I want them to be able to access it from any computer. It's not multiplayer.

Imagine a real-time 2D action and building game that could be played completely offline, except it saves your progress to a server so it can be accessed from anywhere.

This will be my first foray into making an online game or web application, so I'm wanting it to be as painless as possible. Would GAE work well for a game like this? I've been told that GAE is simply not appropriate for a real-time game; however, this has always been said in the context of a multiplayer game, not a single player game.

I should also note that it would be acceptable for the game to have an ordinary save option and to only save data to the server when this option is used by the player. Since that means the player would lose progress if he just closed the tab or browser window without saving, it could be accompanied with a 5 minute autosave.

sentences:
OpenGL Blending Format In OpenGL, is there a format for a texture in glTexImage2D that prevents blending, or do you have to disable it using glDisable(GL_BLEND).

Reason for use is that I would like to store additional data in the alpha channel of a texture, but it blends with whatever's behind it.

sentences:
My game has messed up layouts! Earlier, I asked this question:
Landscape mode for game?

Where I had a directory for each and every layout, but the layout in the layout-land directory wasn't showing up when positioning my layout in landscape orientation.

So, someone suggested to me that it maybe that the

Layout-normal directories are overriding my regular layout-land directories. Is this true?
If so, will any other of my layout folders get overriding?** What is the purpose of layout-normal in the first place then anyway?

sentences:
Why do loot drops contain (mostly) useless items? I was thinking about this and couldn't figure this out.  In Diablo you kill enemies and they drop random things.  But usually the drops are worthless to you relative to what you already have equipped.  Why bother building a drop system that gives you crappy drops?  Maybe I'm not communicating my question well so I'll provide an alternative implementation:

Instead of frequently dropping crappy items and rarely dropping good items, why not only rarely drop good items?

I guess that crappy items adds to the addictive-ness somehow, but I don't understand why.  Why is dropping crappy items part of the design?  What does that add?

Edit: FWIW, I have been referring to Diablo 2 as my reference, not D3.  But it's still interesting to see answers explaining why D2 was more addictive.

sentences:
What are "supporting points" in the context of the SAT? I am currently implementing a separating axis theorem collision response. It can be used by oriented bounding boxes and axis-aligned bounding boxes.

So far I have covered face-something contacts. I struggle witth the edge-edge cases. I know the all the axis, penetration depth and the collision normal. But I don't understand the how I can receive a contact point. I read something about using supporting points but what is a supporting point? There are just a few explanations with even less information.

Do you know a good source which explains something? I already digged into some source code of different physic engines. But every engine calculates it different and the comments often don't even exist.

sentences:
texture cordinate VBO not being updated OpenGL I'm making a minecraft style game and I decided to add a VBO with the texture atkas coordinates of the vertices but it is appearing all white. However I'm following the same process as another VBO for the block positions which works

the one that works

glBindBuffer(GL_ARRAY_BUFFER,chunk->posOffsetVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec3)*65536,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(2,3,GL_FLOAT,GL_FALSE,3*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(2);
glVertexAttribDivisor(2,1);

then I fill it with glm::vec3s like this

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->posOffsetVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(posOffsets),&posOffsets[0]);

this is the one with the texture coordinates that doesn't work

glBindBuffer(GL_ARRAY_BUFFER,chunk->texCoordVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec2)*36*1000,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,2*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(1);

then  fill It with 36 glm::vec2s for each block so one per vertex

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->texCoordVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(texCoords),&texCoords[0]);

Is there a reason why the texture one doesn't work?

sentences:
box2d rendering performance degrading extremely even with sleeping bodies? I'm working on my first smartphone game, a simple 2D platformer built with libgdx. Game maps use the Tiled level format, so a map is just a bunch of blocks. I recently started using box2d to implement character collision and movement.

So this is probably naive, but what I did is for a level consisting of 64x50 (= 3200)  blocks, I added a static body for every block to represent the physics for this geometry. I set these blocks to sleep, which I thought would be a hint for box2d to disregard these blocks when stepping the simulation unless they're actually interacting with the player (the only dynamic body), so this shouldn't hinder performance very much? I recall reading in the box2d manual that it employs a spatial algorithm to only even look at the bodies relevant to render the current frame.

Yet having these 3500 sleeping static bodies degrades performance to such a degree that even when running the game on my MacBook Pro 2012 in a Genymotion emulator, I get about 5 FPS.

I suppose I'm doing something terribly wrong. My questions would be:

when dealing with bodies in the thousands, am I supposed to remove/add box2d bodies for my level geometry dynamically to improve performance, e.g. based on a fixed box around the player? that sounds painful and I'm wondering why the library wouldn't be able to figure out itself
maybe I've just made a mistake mapping map tiles to box2d bodies? I've posted my setup code below

Any help appreciated.

Here's how I attach the static bodies to the level geometry; it just walks the map and creates a static body for every block:

private void addB2Bodies(World b2World) {
    for (int row = 0; row < blocksLayer.getHeight(); row++) {
        for (int col = 0; col < blocksLayer.getWidth(); col++) {
            BodyDef bodyDef = new BodyDef();
            bodyDef.type = BodyDef.BodyType.StaticBody;
            bodyDef.awake = false;
            bodyDef.position.set(col + 0.5F, row + 0.5F);

            final PolygonShape shape = new PolygonShape();
            shape.setAsBox(0.5F, 0.5F);
            FixtureDef fixtureDef = new FixtureDef();
            fixtureDef.shape = shape;
            fixtureDef.friction = 0;

            final Body body = b2World.createBody(bodyDef);
            body.createFixture(fixtureDef);
            blocks[col][row] = body;
        }
    }
}

I only have one dynamic body, the player. As for the simulation, I step it at 1 / 60, with the default/recommended iteration counts of 6 and 2.

sentences:
How significant is the addition of multiplayer to a singleplayer game compared to starting with multiplayer in mind? Especially for game designers or software engineers, I was wondering how significant of an increase in difficulty/frustration/workload it would be for multiplayer to be an afterthought of a singleplayer game, as opposed to putting in all of the work for the game to be "multiplayer ready" from the start.

This question is especially important when the question of "Will there be multiplayer?" is up in the air until after the game is developed.

I only ask because coding with multiplayer in mind from the start, I assume, is a hefty chunk of extra difficulty that one could otherwise skip. Of course adding in such a engine-changing feature, I assume, would be quite frustrating given a game already close to being finished. Both strategies seem burdensome, but if the extra workload of implementing a big feature after a game is already completely is extraordinary compared to the heavy workload of engineering it from the start, then obviously one would nearly always want to prepare for multiplayer.

I am also curious on a personal level as I have seen a few indie projects declare they will never add multiplayer, and then months later after the game has over a year in development, change their mind and say they will be adding it as a high priority feature due to the large demand for what is probably the most common core feature of any game.

sentences: App Store free promotion How can I make my app to be free for certain period of time? Is it ok to switch it to free and then after a day or two switch back to my original price, is it possible and where can I do it?

sentences:
Plot and Story design basics I have made several games but they have all been space invaders or mario style.

Following my last question (thank you for all the great answers) I am trying to write out a plot line and a plan for the events that will take place.

The problem I am having is that my story's tend to resemble things that already exist like films or other games I have played.

The events to feel like a mix of various other games I have played.

So apart form become a more creative person does anyone have any advice. Has anyone written a fairly lengthy story for a game and have pointers or does anyone know any good books on the subject.

Any thoughts would be welcome, story of event ideas to.

FYI the game has a final fantasy style battle system and a pokemon catch/raise system.

sentences:
What are some effective methods for implementing downsampled transparency? It seems that some games have managed to implement downsampled transparency, and presumably gained a significant performance boost. (Examples: Uncharted 2, Crysis 2) A while back I attempted to implement a form of this based off of an article in GPU Gems 3, but we found that it wasn't quite fast enough to be a win for us.

I'm looking for information on other techniques of implementing downsampled transparency, especially targeting the PS3 and Xbox360.

sentences:
Bullet physics weird behavior. Jittering and drifting with btBoxShape I'm dropping a simple box onto a plane from 100 units and my solution using Bullet Physics is giving me some weird behavior. The dimensions of the box are {2, 4, 1}.

When the box hits the ground it jiggles up and down, drifts off to the side, and finally settles by sinking 1.5 units into the ground.

When I reduce the fall height to about 5 units the box doesn't sink into the ground, and the sideways drift is less pronounced.

When I declare a btSphereShape instead of a btBoxShape the problems go away. It should be noted that I'm developing for iOS with Objective-C file that interphases my code with Bullet.

Here's my code:

- (void)setUpPhysicsWorld { //This sets up the physics world and plane shape:

    collisionConfiguration = new btDefaultCollisionConfiguration();
    dispatcher = new btCollisionDispatcher(collisionConfiguration);
    broadphase = new btDbvtBroadphase();
    solver = new btSequentialImpulseConstraintSolver;
    dynamicWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);

    btTransform t;
    t.setIdentity();
    t.setOrigin(btVector3(0, 0, 0));
    btStaticPlaneShape *planeShape = new btStaticPlaneShape(btVector3(0, 1, 0), 0);
    btMotionState *motion = new btDefaultMotionState(t);
    btRigidBody::btRigidBodyConstructionInfo info(0.0, motion, planeShape);
    btRigidBody *planeRigidBody = new btRigidBody(info);
    dynamicWorld->addRigidBody(planeRigidBody);
    [self addBlock];

}

- (void)addBlock {

    btTransform t;
    t.setIdentity();
    t.setOrigin(btVector3(0, 5, 0));

    /* Actual declaration of the box shape. For some reason, when I change this
    to a btSphereShape, all the problems go away. */
    btBoxShape *boxShape = new btBoxShape(btVector3(1, 2, 0.5));
    btVector3 inertia(0, 0, 0);
    boxShape->calculateLocalInertia(1.0, inertia);

    btMotionState *motion = new btDefaultMotionState(t);
    btRigidBody::btRigidBodyConstructionInfo info(1.0, motion, boxShape, inertia);
    blockRigidBody = new btRigidBody(info);
    dynamicWorld->addRigidBody(blockRigidBody);

}

- (GLKVector3)getBLockLocation {

    dynamicWorld->stepSimulation(1/60.f, 10, 1/300.0);

    btTransform trans;
    blockRigidBody->getMotionState()->getWorldTransform(trans);

    return GLKVector3Make(trans.getOrigin().getX(), trans.getOrigin().getY(), trans.getOrigin().getZ());

}

Can anyone tell me what's wrong here?

sentences:
GLSL strange if statement problems I'm trying to use if statement in my fragment shader.

I want to compare my in int finalLightType[4];

Here is my vertex shader code and fragment shader code:

Vertex:

#version 400 core

in vec3 position;
in vec2 textureVector;
in vec3 normalVector;

out vec3 color;
out vec3 surfaceNormal;
out vec2 textureCoords;
out float visibility;
out vec3 toLightVector[4];
out int finalLightType[4];

uniform vec3 mainColor;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

uniform float tilingX;
uniform float tilingY;

uniform float density = 0.01;
uniform float gradient = 1.5;

uniform int lightType[4];
uniform float lightRange[4];
uniform vec3 lightPosition[4];

void main(void)
{
    finalLightType[0] = 1;
    color = mainColor;

    textureCoords = textureVector;
    textureCoords.x = textureCoords.x * tilingX;
    textureCoords.y = textureCoords.y * tilingY;

    vec4 worldPosition = transformationMatrix * vec4(position,1.0);

    vec4 positionRelativeToCam = viewMatrix * worldPosition;

    float distance1 = length(positionRelativeToCam.xyz);

    visibility = exp(-pow((distance1 * density), gradient));
    visibility = clamp(visibility,0.0,1.0);

    surfaceNormal = (transformationMatrix * vec4(normalVector,0.0)).xyz;

    gl_Position = projectionMatrix * positionRelativeToCam;
}

You can see out int finalLightType[4]; and finalLightType[0] = 1;

Fragment:

#version 400 core

in vec3 color;
in vec3 surfaceNormal;
in vec2 textureCoords;
in float visibility;
in vec3 toLightVector[4];
in int finalLightType[4];

out vec4 out_Color;

uniform bool textured;

uniform sampler2D sampler;

uniform vec3 bgColor;
uniform vec3 ambientColor;

uniform vec3 lightColor[4];
uniform float lightIntensity[4];
uniform vec3 lightDir[4];
uniform float lightSpotAngle[4];

void main(void)
{
    vec3 unitSurfaceNormal = normalize(surfaceNormal);

    if(finalLightType[0] == 0)
    {
    }

    if(textured == true)
    {
        out_Color = texture2D(sampler,textureCoords);
    }
    else
    {
        out_Color = vec4(color,1.0);
    }

    out_Color = mix(vec4(bgColor,1.0),out_Color,visibility);

    vec3 convAmbientColor = vec3(1.0,1.0,1.0) - ambientColor;

    out_Color = out_Color - vec4(convAmbientColor,1.0);

    out_Color.w = 1.0;
}

Everything looks good, but if I start my game I receive really strange effect (Uncolored, untextured, transformed on the front of the camera object):

But.. If I try to compare another int same way, but not in variable, but local variable (Or even uniform variable, they works fine too):

#version 400 core

in vec3 color;
in vec3 surfaceNormal;
in vec2 textureCoords;
in float visibility;
in vec3 toLightVector[4];
in int finalLightType[4];

out vec4 out_Color;

uniform bool textured;

uniform sampler2D sampler;

uniform vec3 bgColor;
uniform vec3 ambientColor;

uniform vec3 lightColor[4];
uniform float lightIntensity[4];
uniform vec3 lightDir[4];
uniform float lightSpotAngle[4];

void main(void)
{
    vec3 unitSurfaceNormal = normalize(surfaceNormal);

    int lightTyp = 0;

    if(lightTyp == 0)
    {
    }

    if(textured == true)
    {
        out_Color = texture2D(sampler,textureCoords);
    }
    else
    {
        out_Color = vec4(color,1.0);
    }

    out_Color = mix(vec4(bgColor,1.0),out_Color,visibility);

    vec3 convAmbientColor = vec3(1.0,1.0,1.0) - ambientColor;

    out_Color = out_Color - vec4(convAmbientColor,1.0);

    out_Color.w = 1.0;
}

It only happens if I compare in variables, everything is works fine with uniform variables, local variables, etc.. (Also tried with varying variable).

Edit:

This object after I run my game is always on the front of the camera and never rotates or whatever. I can't also see other object like a cube that should appear something (probably my camera is inside this cube and I can't see it because of culling faces).

sentences: What is XNA's GameTime used for? I'm developing a game using fixed time step, and so far I haven't been using XNA's GameTime class in my code.  What uses does the class have, and should I definitely use it in my game, or can I ignore it?

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:
How to generate random waves for a bullet hell game that feel balanced and natural My game consists of 'waves' of objects called 'spawners', which once every certain amount of time (their firetime), move to a new place on the screen and spawn an enemy. Each wave has 4 important properties:
1: the amount of spawners the wave has
2: the interval of time between creating new spawners
3: the total length of the wave
4: the types of spawners that can appear in a wave (represented as a std::vector<std::pair<std::string, int>> where the string is the spawner name, and the integer is its spawn weight.
The game works by picking a random spawner from the possible spawner types (with a weighted rng) every new spawner interval. Currently waves are set and are loaded from a file at runtime.
My problem is that I cannot find a good way to randomly generate waves that feel balanced and natural. Currently, I am trying to generate waves based on a difficulty value, mostly using weighted random number generation. However, this does not produce balanced waves that correspond well to the target difficulty. Even after trying several different techniques, I am unable to get a system that generates waves that fell balanced and natural (like the ones hand made).
Is there any way to generate waves that feel natural, based off of the difficulty value? How should I approach this problem?
Also if it's of any help, each spawner also defines its own difficulty value.
Example Waves:
Easier wave:
SpawnerTypes = {'BasicSpawner': 100} (basic spawner has a difficulty of 10)
SpawnerAmount = 5
NewSpawnerInterval = 4
WaveLength = 30
This is a good easy wave because it the spawner it has is simply shoots bullets that move in one direction at a slow speed, which are easy for the player to dodge. It also does not overwhelm the player with large amounts of them, and the wave is not too long
Medium Wave
SpawnerTypes = {'LaserSpawner': 60, 'BasicSpawner': 40} (basic spawner has a difficulty of 10, laser spawner has a difficulty of 20)
SpawnerAmount = 8
NewSpawnerInterval = 3
WaveLength = 30
This is a good medium wave because its combination of spawners requires the player to be paying close attention to multiple parts of the screen other than just right near the character, while still remaining relatively easy. It also spawners more spawners, but balances that by having a small interval between spawners and a small wave length.
Hard Wave
SpawnerTypes = {'RicochetSpawner': 100} (ricochet spawner has a difficulty of 60)
SpawnerAmount = 2
NewSpawnerInterval = 10
WaveLength = 30
Note that this wave has only one spawner type and only 2 of them, but is still much harder than the other listed waves
This wave is hard because the spawner it contains is challenging to keep track of, and in large numbers quickly because almost impossible, so it only spawners two spawners. However, the wave still lasts for 30 seconds, which provides the player with a decent challenge while not completely overwhelming them.
Extremely Challenging Wave
SpawnerTypes = {'RandomSpawner': 30, 'LoopSpawner
: 70} (random spawner has a difficulty of 90, loop spawner has a difficulty of 60)
SpawnerAmount = 4
NewSpawnerInterval = 5
WaveLength = 40
This wave is a perfect example of a wave which is extremely challenging, but is possible for a skilled player. It has two very hard spawners, one of which is very unpredictable (hence the name 'random'). It also spawns 4 spawners, and the wave lasts a total of 20 seconds longer than when the last spawners is created

sentences:
Best practice for implementing overall / weekly / daily highscores? So I'm setting up social leaderboards and I want there to be daily weekly overall high scores. The way the scoring works is each score is tied to a user after the user logs in so the scores need to always be linked to a user. I'm using the Parse BaaS with Unity C# and I've gotten overall highscores working by adding a highScore field to the ParseUser model. From the research that I've done so far based on google play services and game center has led me to the following solution.

Have 3 fields for the ParseUser model: overallScore, dailyScore, weeklyScore. Reset dailyScore and weeklyScore when appropriate

Is this an appropriate solution for what I'm trying to implement? Is there a more efficient or scalable way to do it?

sentences:
How can I make the text flash? I want to have text that flashes from green to white and back to green over and over until the window is closed? Below is what I have tried but i cant seem to get it to work, please help me.

int main()
{
    sf::RenderWindow window(sf::VideoMode(LAYOUT_WINDOW_WIDTH, LAYOUT_WINDOW_HEIGHT),
        "Tetris 2019 - A New Beginning");

    sf::Font myFont;
    if (!myFont.loadFromFile("cartoon relief.ttf")) {

    }

    window.setFramerateLimit(30);

    sf::Text gameOver;
    gameOver.setFont(myFont);
    gameOver.setFillColor(sf::Color::Green);
    gameOver.setStyle(sf::Text::Regular);
    gameOver.setString("GAME OVER!");
    gameOver.setCharacterSize(65);
    gameOver.setPosition(30, 60);

    //everything below gets copied into the "processSplash" function
    while (window.isOpen())
    {
        sf::Time elapsed_time;
        sf::Clock r;

        sf::Time delta_time = sf::seconds(1);

        sf::Text playAgian;
        playAgian.setFont(myFont);
        playAgian.setFillColor(sf::Color::Green);
        while (window.isOpen && elapsed_time >= delta_time)
        {
            if (elapsed_time == delta_time)
            {
                playAgian.setFillColor(sf::Color::Green);
                elapsed_time == r.restart();
            }
            else
                playAgian.setFillColor(sf::Color::White);
                elapsed_time += r.restart();
        }
        playAgian.setStyle(sf::Text::Regular);
        playAgian.setString("Press ENTER to play agian!");
        playAgian.setCharacterSize(25);
        playAgian.setPosition(80, 235);

        sf::Event event;

        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            if (event.type == sf::Event::KeyPressed
                && event.key.code == sf::Keyboard::Space)

                //close splash screen and start game
            {
                /*processSplash();*/
            }
        }

        window.draw(gameOver);
        window.draw(playAgian);

        window.display();
    }

    return 0;
}

sentences: Unity - Access animation clips/motion of an animator So I have an animator on my GameObject. I need to change the animation clip/motion of different states in my animator to the one I assign in my EditorGUILayout.ObjectField. Problem is, I have no idea how to access those clips. This is purely Editor Scripting.

sentences:
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:
What is the "pricing standard" on Windows Phone? On iOS, I find it is more usual to see light versions of a game for free (with ads and less features) and a full version for a cost and all the features.

On Android, I see more games that have both a full version for free and one for a cost. One with ads and the other without.

On WP7, how are games usually priced?

Talking about a rather simple and small game here and I'm trying to figure out how to price it. I'm thinking of going for a 1$ app with full features no ads, but I'm not so sure. Would it be more profitable to put it for free with ads instead? How do other developers usually make that choice?

sentences:
Checklist for finished game? I and a couple of friends are doing a game on our spare time and we've finished about 80% of the game.. so all the obvious stuff and core mechanincs. We've done a couple of games before and we always have problems finishing.

The problem isn't that we're not passionate enough about the game, it's rather that no one of us sees those last details that need to be added, we've become blind somehow with the game. It's really frustrating. It can be stuff like.. "maybe we should have a pause function?" "Uhh, yeah, of course, why didn't we think of that earlier?"

Sometimes even though it takes a long time to realise the need, afterwards it's really obvious that it needed to be done/added.

Do you use any kind of checklist to force a finish or do you rely on your keen senses to know when it's done?

A checklist would be nice to have when estimating project time as well..

sentences:
Three button combination to open next scene I have thirty (30) buttons in a trivia game, they are laid out in the following configuration with three rows:

( A, B, C, D, E, F, G, H, I, J)
( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
(00,01,02,03,04,05,06,07,08,09)

Using these combinations of buttons and clicking one and only one from each row I have a thousand (1000) - three (3) button combinations. E.g.: A27 would be one combination of the thousand possibilities. These are not random combinations each opens a very specific scene.

What I am trying to do is create a C# script that when I click any of these three (3) button combinations it will open a new scene. Once that scene is open I’m okay because then have my own scripts attached to the single buttons in the new scene to continue to a further scene.

What I can’t figure out is the syntax, should I use if Statements such as -  if (Btn_A)  &&  (Btn_1)  &&  (Btn_01) then load scene such and such? Then do I attach the script to the canvas then to each of the three button combinations (A 1000 Scripts combinations)?

sentences:
How to raycast octree for closest leaf node? So I need to raycast a octree for closest leaf node as efficient as possible. I will be doing it on compute shader (hlsl), but I think it doesn't matter because first I need to understand the approach and math behind this process in general.
My struct looks like this:
struct OctreeNode
{
    uint  size; // size of cubic node

    uint posX; // center of node
    uint posY; // center of node
    uint posZ; // center of node

    uint childExists;
    uint isLeaf;
    uint isChild;

    uint parentIndex; //Parent node index in structured buffer
    uint minchildIndex; // Node child min index in structured buffer (+1 is next child, etc)
    uint index; //Index in structured buffer
};

Octree is rather big, so I guess I can't afford to raycast everything and then compare distances. I have been looking into https://stackoverflow.com/questions/6281415/octree-raycasting-raytracing-best-ray-leaf-intersection-without-recursion , but I do not understand the answer (especially HLSL one with hitbox what is unknow thing).
Any hints, code, directions highly appreciated.

sentences:
Shadow mapping with deffered shading for directional lights - shadow map projection problem I'm trying to implement shadow mapping to my engine. I started with directional lights because they seemed to be the easiest one, but I was wrong :) I have implemented deferred shading and I retrieve position from depth. I think that there is the biggest problem but code looks ok for me.

Now more about problem:

Shadow map projected onto meshes looks bad scaled and translated and also some information from shadow map texture aren't visible.

Yellow frustum is light frustum and I have mixed shadow map preview and actual scene. As you can see shadows are in wrong place and shadow of cone and sphere aren't visible.

Could you look at my codes and tell me where I have a mistake?

// create shadow map
if(!_shd)glGenTextures(1, &_shd);
glBindTexture(GL_TEXTURE_2D, _shd);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_FLOAT,NULL); // shadow map size
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, _shd, 0);

glDrawBuffer(GL_NONE);

// setting camera
Vector dire=Vector(0,0,1);
ACamera.setLookAt(dire,Vector(0));
ACamera.setPerspectiveView(60.0f,1,0.1f,10.0f); // currently needed for proper frustum corners calculation

Vector min(ACamera._point[0]),max(ACamera._point[0]);
for(int i=0;i<8;i++){
    max=Max(max,ACamera._point[i]);
    min=Min(min,ACamera._point[i]);
}

ACamera.setOrthogonalView(min.x,max.x,min.y,max.y,-max.z,-min.z);

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _s_buffer); // framebuffer for shadow map

// rendering to depth buffer

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _g_buffer);

Shaders["DirLight"].set(true);

Matrix4 bias;
bias.x.set(0.5,0.0,0.0,0.0);
bias.y.set(0.0,0.5,0.0,0.0);
bias.z.set(0.0,0.0,0.5,0.0);
bias.w.set(0.5,0.5,0.5,1.0);

Shaders["DirLight"].set("textureMatrix",ACamera.matrix*Projection3D*bias); // order of multiplications are 100% correct, everything gives mi the same result as using glm

glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_2D,_shd);

lightDir(dir); // light calculations

Vertex Shader makes nothing related to shadow calculatons

Pixel shader function which calculates if pixel is in shadow or not:

float readShadowMap(vec3 eyeDir)
{
// retrieve depth of pixel
float z = texture2D(depth, gl_FragCoord.xy/screen).z;

vec3 pos = vec3(gl_FragCoord.xy/screen, z);

// transform by the projection and view inverse
vec4 worldSpace = inverse(View)*inverse(ProjectionMatrix)*vec4(pos*2-1,1);

worldSpace /= worldSpace.w;

vec4 coord=textureMatrix*worldSpace;

float vis=1.0f;
if(texture2D(shadow, coord.xy).z < coord.z-0.001)vis=0.2f;

return vis;
}

I also have question about shadows specifically for directional light. Currently I always look at 0,0,0 position and in further implementation I have to move light frustum along to camera frustum. I've found how to do this here: http://www.gamedev.net/topic/505893-orthographic-projection-for-shadow-mapping/ but it doesn't give me what I want. Maybe because of problems mentioned above, but I want know your opinion.

EDIT:

vec4 worldSpace is position read from depht of the scene (not shadow map). Maybe I wasn't precise so I'll try quick explain what is what: View is camera view matrix, ProjectionMatrix is camera projection,. First I try to get world space position from depth map and then multiply it by textureMatrix which is light view light projectionbias. Rest of code is the same as in many tutorials. I can't use vertex shader to make something like gl_Position=textureMatrix*gl_Vertex and get it interpolated in fragment shader because of deffered rendering use so I want get it from depht buffer.

EDIT2:

I also tried make it as in Coding Labs tutorial about Shadow Mapping with Deferred Rendering but unfortunately this either works wrong.

sentences:
My polygons only register a collision if they are the same shape and directly over top of each other I'm trying to learn about 2d polygon collision detection/handling and have ran into a snag.

After running through lots of tutorials and sample code I've attempted to implement my own polygon class and separating axis functionality.

I have two polygons of the exact same shape and size that I can move around the screen, but they only register a collision if they are directly (to the pixel) over top of each other.

I suspect the problem to be in my isSeparatingAxis() or flattenPoints() function, as I'm struggling with some of the math involved in those.

Here's the relevant stripped down code / working example
https://jsfiddle.net/gyngbo0d/

sentences:
Betatesting an android game. Best practices? Our game is in our final stage prior to be released. I would like at this stage to add some beta testers to let them hunt bugs, etc... Is there any good platform/site to achieve this? I have noticed there's a site called betalizer but they still are in beta.

Could anyone suggest how to find beta testers for a little-medium size android game without spending a lot of bucks or any platform that could help on it?

Thanks in advance.

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: How do you create a funky moving background? I'm trying to create something similar to what you would see if you loaded a song in Windows Media Player (the cool abstract background that moves and produces various colors). I have no idea how this can be accomplished in libgdx. I've seen other games, such as puzzle games, on the Android store that having moving backgrounds to add visual effect so that the background isn't so static/boring. How can I achieve a similar effect without consuming a ton of RAM or without high CPU usage?

sentences:
Get on what tile has mouse clicked I am writing a chess game using Java and Swing, And I wanted to get the tile position on which a mouse clicked. I searched through internet, but all of them were really off, and never accurate. When I clicked on a tile's first half, it said it was tile 1, but on the second half, it said it was tile 2, but it was still tile 1. So I was wondering, how can I do it?
My tile size is (75, 75) This is the code I've written for tileX: Math.floor((double)evt.getX() / 75), and this is the code I've written for tileY: Math.floor((double)evt.getY() / 75).
Code for drawing:
ImageIcon l_winter = new ImageIcon("/Users/user/NetBeansProjects/chess/src/b/bibe/assets/winter/light.gif");
        ImageIcon d_winter = new ImageIcon("/Users/user/NetBeansProjects/chess/src/b/bibe/assets/winter/dark.gif");
        ImageIcon l_wood = new ImageIcon("/Users/user/NetBeansProjects/chess/src/b/bibe/assets/wood/light.png");
        ImageIcon d_wood = new ImageIcon("/Users/user/NetBeansProjects/chess/src/b/bibe/assets/wood/dark.png");
        String theme = th;
        int color = 0;
        for (int i = 0; i < 600; i = i + 75) {
            for (int j = 0; j < 600; j = j + 75) {
                JLabel panel = new JLabel();
                panel.setText(null);
                panel.setSize(75, 75);
                if (color == 0) {
                    if (theme.equals("wood")) {
                        panel.setIcon(l_wood);
                    } else if (theme.equals("winter")) {
                        panel.setIcon(l_winter);
                    } else {
                        panel.setText("notexture");
                    }
                    //panel.setBackground(new Color(white[0], white[1], white[2]));
                    color = 1;
                } else {
                    if (theme.equals("wood")) {
                        panel.setIcon(d_wood);
                    } else if (theme.equals("winter")) {
                        panel.setIcon(d_winter);
                    } else {
                        panel.setText("notexture");
                    }
                    //panel.setBackground(new Color(black[0], black[1], black[2]));
                    color = 0;
                }
                panel.setLocation(j, i);
                getContentPane().add(panel);
            }
        if (color == 0) {
            color = 1;
        } else {
               color = 0;
            }
        }

sentences:
Unity - Avoid using Find method by caching UnityObjects - Code review I'm trying to avoid using GameObject.Find during runtime to find particular GameObject components when wanting to instantiate them.

I have created a cache for the gameobjects from which I can either return the original instance or create a new instance.

Components which should only have one instance are returned by GetOriginal<UnityObject>

A new instance of an Original component is returned using GetInstanceOf<UnityObject>

public class GameObjectTools : MonoBehaviour
{
    static List<Object> gameObjectCache = new List<Object>();

    // This is called BEFORE Start() when the script is being loaded
    void Awake()
    {
        // Cache any GameObject classes that are required by other classes here
        gameObjectCache.Add(GameObject.Find("Timer").GetComponent<Timer>());
        gameObjectCache.Add(GameObject.Find("Object Rotator").GetComponent<ObjectRotator>());
        gameObjectCache.Add(GameObject.Find("Object Translator").GetComponent<ObjectTranslator>());
    }

    public static T GetOriginal<T>() where T : Object
    {
        int index = -1;
        int numObjects = gameObjectCache.Count;

        for (int i = 0; i < numObjects; ++i)
        {
            if (gameObjectCache[i].GetType() == typeof(T))
            {
                index = i;
                break;
            }
        }

        return index == -1 ? null : gameObjectCache[index] as T;
    }

    public static T GetInstanceOf<T>() where T : Object
    {
        var o = GetOriginal<T>();
        return o == null ? null : GameObject.Instantiate(o) as T;
    }
}

I'm slightly concerned that I am not approaching this problem in the right manner and was hoping for some feedback regarding my methodology.

Is there a more efficient or straightforward approach to achieve what I am trying to achieve here?

EDIT

public class Ball : MonoBehaviour
{
    int lifeSpan = 1000;

    void Update()
    {
        if (Timer.CurrentTime > lifeSpan)
            GameObject.Destroy(gameObject);
    }
}

public class GameObjectTools : MonoBehaviour
{
    public static Ball Ball;

    void Awake()
    {

        Ball = GameObject.Find("Ball").GetComponent<Ball>();
    }
}

If I call

var ball = GameObject.Instantiate(GameObjectTools.Ball) as GameObject;

anytime after the lifespan of the ball has expired then I will get a null reference error.

How then can I ensure that this doesn't happen while still being able to create new instances from a static cache?

sentences:
How to store sprite data in a VBO? I'm planning on rendering many sprites in my games, but I am not sure which method of storing their data to use. I haven't tried all of them yet, but I want to see if I also have anything important missing. Right now my options are:

Store information such as position, color, rotation, scale, and texIndex in a VBO, and then let the geometry shader output the triangles. (Not sure if possible)
Compute the vertices for all sprites in the CPU and put it all into one VBO to draw. (Sounds like a waste of CPU time, especially in a game)
Store repeated copies of the same four vertices in a VBO, and then use uniforms? (This is just an idea, I have no idea if it works or makes sense) Apparently I can just use instancing for this.

What design should I use to efficiently store sprite data? Do any of my ideas hold?

Edit: I would greatly appreciate if pseudocode could be provided for a solution, although certainly not necessary.

sentences:
Loading large bitmaps in Android In a few games in the Android Market/Google Play Store, huge bitmaps are drawn onto the screen.

For example, the game Unicorn Dash:

and Robot Unicorn Attack:

I'm assuming the entire island (which is multiple screens long) is loaded into memory. With probably around 10 different islands, how can something like this be possible? I've attempted to do something similar in one of my games, but I always ran out of memory. The bitmaps are (estimated) at around ~2000px x 500px at the largest which comes out to about 4mb each uncompressed? If you had 10 of them it would require 40mb of memory! So obviously I'm missing something.
Is it plausible to be loading and unloading bitmaps into memory while the game runs? Or is there some other technique that I'm not aware of?

EDIT:

I extracted the images from Robot Unicorn Attack and saw that they were indeed whole images (not split up) of around 2000*500 pixels.

sentences:
XNA objects not occluding properly I have got simple 1x1x1 cube model. I draw 3 of them. They are located at:

1,0,0
2,0,0
3,0,0

I draw them in the same order every time. When I move the camera and look at them from one end everything is fine. If I look at them from the opposite end I can see parts of the cubes that should be occluded by the cubes.

How can I have them draw properly?

sentences:
How do I make planet move slower the further away they are? I got this code from somewhere else, I want to implement Kepler's third law to make the simulation look more realistic, the simulation is a 2D satellite orbiting around a planet, the satellite(Planet) script here is :

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

public class Planet : MonoBehaviour {
private float alpha; //will use for cos & sin (as angle)
private float distance;//distance from center
private float Rotation;//rotation angle
private float currentTime;//Time start when Instantiated
//input values
public float speed;
public Vector2 RotationValues;
public Vector2 distanceValues;
public Vector2 sizeValues;

void Start () {
    //Initialize with Random rotation & distance & size

    //Random Rotation between -2 & 2
    Rotation = Random.Range(RotationValues.x, RotationValues.y);
    //Random distance  between -1 & 2
    distance = Random.Range(distanceValues.x, distanceValues.y);
    //Random Size between 0.2f & 0.7f
    var Size = Random.Range(sizeValues.x, sizeValues.y);
    //Set localScale with random size
    transform.localScale = new Vector3(Size, Size, Size);

    //calculating current time by subtraction Time.time and lastTime
    currentTime = Time.time - Generator.lastTime;

    //GetComponent<MeshRenderer>().material.color = new Color(Random.value, Random.value, Random.value); //Random Color
}

void Update () {
    //Timer
    currentTime += Time.deltaTime;

    var X =  (distance * Mathf.Cos(currentTime)); //X
    var Y =  (distance * Mathf.Sin(currentTime)); //Y
    var R = (Rotation * Mathf.Cos(currentTime)); //Rotation
    //give earth from generator class
    var Earth = Generator.Earth;
    transform.position = Earth.transform.position + (new Vector3(X, R, Y));// RotateAround Earth

}
}

also I have this other script which generates the planets:

using UnityEngine;
using System.Collections;

public class Generator : MonoBehaviour {
public GameObject prefab;
public static GameObject Earth;
public static float lastTime;
public int numerOfSatellites;

void Start() {
    Earth = GameObject.FindGameObjectWithTag("MainPlanet");//Find Earth
    for (int i = 1; i <= numerOfSatellites; i++) {
        lastTime = Time.time;
        GameObject sat = Instantiate(prefab, Earth.transform.position, Quaternion.identity);
        Physics2D.IgnoreCollision(sat.GetComponent<CircleCollider2D>(), Earth.GetComponent<CircleCollider2D>());
    } }
}

I know that the main part here is

void Update () {

    //Timer
    currentTime += Time.deltaTime;

    var X =  (distance * Mathf.Cos(currentTime)); //X
    var Y =  (distance * Mathf.Sin(currentTime)); //Y
    var R = (Rotation * Mathf.Cos(currentTime)); //Rotation

    //give earth from generator class
    var Earth = Generator.Earth;
    transform.position = Earth.transform.position + (new Vector3(X, R, Y));// RotateAround Earth

}

The main problem is that whatever distance the planets have from the mainPlanet (called earth) they move at the same angular velocity, how would I change this?

Those are the basic 4 steps of every orbit, the problem here is that they all align in the center, which shouldn't be possible because of the random distances they have

sentences:
Working Qt controls in a 3d environment I need some advice from a Qt expert.

The background:
I have a 3D engine (ogre3d) working in concert with Qt. The 3D Content is displayed in a widget (using a custom OS window in the client area). I'm able to overlay arbitrary Qt widgets onto the 3d world using the widget render() method and a shared bitmap. This makes a great "heads up display". I can use the standard Qt style sheets and animation using this technique.

My goal
I'd like to go a step further and allow the user to move these rendered widgets using the mouse. I'd like some advice on the best way to implement this.

Possible solutions:

The widgets in the HUD are not part of the inheritance chain. I render them manually. They don't get events though. I could add them to the inheritance chain so they get events in the usual way. Then I would need to change them to render to my shared bitmap instead of to the operating system. I looked at this once but couldn't find enough information to implement it.
Capture mouse events in the 3D display widget and EMIT them to child controls. I basically create my own event handling chain.

Any suggestions on how to implement this?

I'm also considering switching to Qt5. I'm not sure how that might affect this decision.

sentences:
Javascript Isometric draw optimization I'm having trouble with isometric tiles drawing.

At the moment I got an array with the tiles i want to draw.
And it all works fine until i increase the size of the array.

Since I draw ALL tiles on the map it really affects the game performance (obviously) :D.

My problem is I'm no genius when it comes to javascript and I haven't managed to just draw what is in viewport.

Should be fairly simple for an expert though because its fixed sizes etc.
Canvas is 960x480 pixels, each tile 64x32.
This gives 16 tiles on first row, 15 on the next etc. for a total of 16 rows.

Tile 0,0 is in the top-right corner. And draws X up to down and Y right to left.
Going through the tiles on the first row from left to right as +X -Y.

Here is the relevant part of my drawMap()

function drawMap(){
    var tileW = 64; // Tile Width
    var tileH = 32; // Tile Height
    var mapX = 960-32;
    var mapY = -16;
    for(i=0;i<map.length;i++){
        for(j=0;j<map[i].length;j++){
            var drawTile = map[i][j];
            var drawObj = objectMap[i][j];
            var xpos = (i-j)*tileH + mapX;
            var ypos = (i+j)*tileH/2 + mapY; // Place the tiles isometric.
            ctx.drawImage(tileImg[drawTile],xpos,ypos);
            if(drawObj){
                ctx.drawImage(objectImg[drawObj-1],xpos,ypos-(objectImg[drawObj-    1]));
            }

        }
    }
}

Could anyone please help me how to translate this to just draw the relevant tiles?
It would be deeply appreciated.

sentences:
On Creating a D3DX10 texture atlas I have a DirectX10 texture (ID3D10Texture2D) that I load from disk with the following code:

CComPtr<ID3D10Device>   spD3D; // Initialized correctly elsewhere

hr = D3DX10CreateTextureFromFile(
        spD3D.p,
        wsFilename.c_str(),
        NULL, NULL,
        &spTextureResource,
        NULL
    );

if( FAILED(hr) || ! spTextureResource.p )
    return false;

spTextureResource->QueryInterface <ID3D10Texture2D> ( &m_spTexture );
if( ! m_spTexture.p )
    return false;

The texture loads fine, I can blit this onscreen.

Later, I want to use that texture as an atlas.  To do so, the first thing I want to do is to call ID3D10Texture2D::Map() in order to get at the texels and parse them (to determine where my tiles are).

The following call fails with E_INVALIDARG:

D3D10_MAPPED_TEXTURE2D mapped;
HRESULT hr = spTexture->Map( 0, D3D10_MAP_READ, 0, &mapped );

So I'm thinking that this fails because the texture can't be read from by the CPU.  So in order to get a texture that is CPU readable, I tried setting the D3DX10_IMAGE_LOAD_INFO structure to include D3D10_CPU_ACCESS_READ.  This fails on D3DX10CreateShaderResourceViewFromFile() with E_INVALIDARG.

So I guess I've given up trying to load in a texture and be able to read its data from on the CPU.

So I thought, what about making a texture with the following D3D10_TEXTURE2D_DESC flags:

    D3D10_TEXTURE2D_DESC    desc;
    ZeroMemory(&desc, sizeof(D3D10_TEXTURE2D_DESC));
    desc.CPUAccessFlags     = D3D10_CPU_ACCESS_READ | D3D10_CPU_ACCESS_WRITE;
    desc.Usage              = D3D10_USAGE_DYNAMIC;
    desc.BindFlags          = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;

Step 2 of my plan is to use CopyResource or CopyResourceSubregion to copy data from the disk file into my dynamic texture, so I can use the dynamic texture as a source to read texel data from.

Will this approach work?  Am I barking up the wrong tree and missing an obvious simpler route?

I'm worried that CopyResource won't work either, since the original texture was loaded from disk without the D3D10_CPU_ACCESS_READ flag.

God, I've got to write this for OpenGL too, I hope it's easier with GL!

My plan is to parse this texture and determine where my tiles are, so I can use the texture as an atlas for generating sprites.

sentences:
How can I simulate relatively realistic weather? I'm trying to create relatively realistic weather patterns for my game. The simulation should handle temperature, wind, cloud formation and evolution, fog/mist, rain, snow, etc., and account for terrain (including seas/oceans).

My question: how can I achieve this? I've tried looking up how weather systems work but it hasn't been that helpful.

I've given it a shot anyway. I started with a 2D pressure grid that diffused and advected in the regular fluid-dynamical way (which generates a pressure-velocity grid, i.e. wind). Then I added a humidity grid that is pushed according to the wind. I made clouds form / un-form (rain?) based on the humidity (I gave the air a humidity 'carrying capacity' based on its pressure. Any extra humidity is converted into cloud).

Anyway, I've sort of lost faith in my work so far. Am I going in the right direction? One idea would be to simulate warm / cloud fronts themselves. Would that work out?

Any direction would be nice, I really don't know what I'm doing here. Thanks.

sentences:
Using gluLookAt to move camera in 2D iPhone game? I'm trying to use gluLookAt to move the camera in my iPhone game, but every time I've tried to use gluLookAt my screen just goes "blank" ( grey in this case )

I'm trying to render a simple triangle and to move the camera, this is my code:

to setup my scene I do:

glViewport(0, 0, backingWidth, backingHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glRotatef(-90.0, 0.0, 0.0, 1.0); //using iPhone in horizontal mode
glOrthof(-240, 240, -160, 160, -1, 1);
glMatrixMode(GL_MODELVIEW);

then my "triangle rendering" code looks like:

GLfloat  triangle[] = {0, 100, 100, 0, -100, 0,};
glClearColor(0.7, 0.7, 0.7, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f(1.0, 0.0, 0.0, 1.0);
glVertexPointer(2, GL_FLOAT, 0, &triangle);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableClientState(GL_VERTEX_ARRAY);

This draws a red triangle in the middle of the screen, when I try to apply gluLookAt ( I got the implementation of the function from Cocos2D so I asume it's correct ), i do:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,1,0,0,0,0,0,1); // try to move the camera a bit ?

GLfloat  triangle[] = {0, 100, 100, 0, -100, 0,};
glClearColor(0.7, 0.7, 0.7, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f(1.0, 0.0, 0.0, 1.0);
glVertexPointer(2, GL_FLOAT, 0, &triangle);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableClientState(GL_VERTEX_ARRAY);

This leads me to grey screen (glClearColor is grey), I've tried all sort of things and read what I've found about gluLookAt on the net, but no luck :(, if someone could explain me or show me how to move to move the camera in a top-down fashion ( zelda, etc ), I would really appreciate it.

Thanks!

sentences:
Translating an Object to a certain Vector 3 in OpenGL and Java LWJGL So after almost two hours, I got the hang of using glTranslated() (with Java and LWJGL). If I am correct, applying glTranslated on an object moves that object with the x,y,z relative to the previously moved object. I believe the correct term for this is local vs global, global being the one I want. I was wondering if there was a way to translate an object to a specific XYZ position, or relative to the origin. Thanks!

(Code or other details can be supplied if it helps, just let me know. Also sorry if this is a noob comment, Im very new to OpenGL.)

sentences: Keyboard arrow Navigation My crossword is a table made with <td> tags. The input boxes are textboxes (input="text"), styled with CSS. My question is how do you get the focus to the next cell/textbox by using the keyboard arrows. (Up, down, right, left, and backspace)

sentences:
How to avoid lots of booleans This was probably asked somewhere but I can't google anything for some reason.
So I'm making a puzzle game as a result I have lots of booleans which affect the game only once and become redundant.
As an example, to enter some door player needs to pickup a key so there is check for that. After that when hero enters a doors for the first there is a special animation triggered.
So after player had entered the door  this checks are no longer neccery.

I am not worried about perfomance but rather code design.
Maybe there is some clever trick to manage game state without bunch of ifs and bools?

sentences:
Clock hand, how much should I rotate the hand by every frame? I've got a virtual clock.
The clock consists of the actual clock sprite, and a hand to go over it.

I'm able to set how long the clock duration is.
Say I set it to: 5 seconds.
While the clock time is going, it will eventually stop until it reaches 5 seconds.
Until it has reached 5 seconds, the hand will start rotating.

The hand should theoretically be at the same position it was when the clock was initialized.
So..the hand should go from 0 degrees to 360 degrees...

The only problem is...I don't know how many degrees I need to rotate the clock by every frame.
Like take the 5 seconds for example, how would I know how many degrees the hand needs to rotate based on those 5 seconds, until it has rotated around to 360 degrees?

sentences:
How should a player object to communicate with a map object? I'm writing my first game (in Javascript / Node over WebSockets) and am running into a bit of chicken and egg problem, and am afraid how I'm doing it right now won't scale once the game gets more complex.

Here is how the game is architected. It's a tiled strategy game. When a user connects, a new Game object is created:

// width and height of the board / map
function Game(width, height) {
  this.map = new Map(width, height);
  this.player = new Player();
  // ...
}

game = new Game(100,100);

What's reasonable way for 2-way communication between a player object (or any object), and the map?

For example, if a player wants to move left, first I must check that there is no obstacle in his way, then, once this condition is true, his position must be updated, and he loses a stamina point, so both the map and the player objects are updated depending on conditions that most objects both meet (in the simplest case, where there is no interaction with other objects).

One way I can think, is to have a global GAME object, so that the map can access GAME.player and the player can access GAME.map, but this doesn't seem elegant (and will cause me a headache once I have multiple rooms with separate games running on the same node instance).

sentences:
Efficient way to store information about neighbour chunks I've finally managed to implement an infinite chunk loading system for my voxel engine. Since every chunk needs to have information about the border of the neighbouring chunks, I need to access them fast. First some information about how I'm storing the voxel data: I have an Integer array of block information on each chunk (rather than byte because of the read/write access speed), which is stored in an Dictionary(Vector3i chunkPos, Chunk chunk).
When building a chunk I have to access the voxel data of the chunk and of the neighbouring chunks several times.

Without information about their neighbours it currently looks like this:

So I've tried the following two things:

getting the chunk data every time like this:

public static int getBlockAt(int x, int y, int z) {
    Vector3i chunkIndex = new Vector3i(
        x >> ChunkManager.logChunkSize,
        y >> ChunkManager.logChunkSize,
        z >> ChunkManager.logChunkSize
    );

    if (chunkManager.chunkData.ContainsKey(chunkIndex)) {
        return chunkManager.chunkData[chunkIndex].data[x & ChunkManager.chunkMask, y & ChunkManager.chunkMask, z & ChunkManager.chunkMask]} return 0;

storing chunkSize + 2 information on each chunk, which makes editing much, much slower, but improves chunk loading alot

In general I want to implement something like using approach 1 only when the block data isn't on the chunk.

I really don't know how I could do it! Do you have an idea, or experience from writing voxel engines?

Thanks in advance!

sentences:
How to use the Object parameter in UInputComponent.BindAction? What is the purpose of the Object parameter here?

UInputComponent.BindAction(..., UserClass* Object, ...)

What information should I pass here?

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:
Why don't Sin and Cos give expected results when rotating off axis around a non uniform shape? When I rotate a rectangle and draw straight lines along it's edge using Sin and Cos the lines don't follow the edge as the angle approaches 45 degrees, why? The exact same code works just fine when I use it on a square. See Gif:

Left object has the same width and height, No distortion of angles. Right side has larger X axis and lots of distortion.

Why does this happen and how do I prevent it?

Unity code:

[RequireComponent(typeof(Image))]
class rotation : MonoBehaviour
{
    [SerializeField]
    private float left = 180f, up = 90f;

    private void OnDrawGizmosSelected()
    {
        RectTransform rect = GetComponent<RectTransform>();

        Vector3[] corners = new Vector3[4];
        rect.GetWorldCorners(corners);
        float rot = transform.eulerAngles.z;

        Gizmos.color = Color.red;
        Gizmos.DrawLine(corners[3], corners[3] + new Vector3(
                Mathf.Cos((left + rot) * Mathf.Deg2Rad) * rect.rect.width,
                Mathf.Sin((left + rot) * Mathf.Deg2Rad) * rect.rect.height));

        Gizmos.color = Color.blue;
        Gizmos.DrawLine(corners[3], corners[3] + new Vector3(
            Mathf.Cos((up + rot) * Mathf.Deg2Rad) * rect.rect.width,
            Mathf.Sin((up + rot) * Mathf.Deg2Rad) * rect.rect.height));
    }
}

sentences: Wwise with Unity Rigidbody 2d or Collider 2d I'm half way in making a 2D game in Unity and found that Wwise needed the game objects to have a normal 3D RigidBody, since that's quite some work to replace everything, is there any way around?

sentences:
How to bounce a 2d point particle off of a circular edge In a prototype I'm building, a particle can spawn anywhere within a larger, confining circle. Important to note is that the particle will not spawn in the origin of the larger circle, but anywhere within it.

This particle will essentially be given a random x and y velocity and set on it's way.

When the particle hits the edge of the confining circle, I want it to bounce back inwards appropriately.

Unfortunately I'm extremely new to vector math, and have never really directly dealt with it before.

Given that I'm treating the particle as a point, and I don't care about any loss of force or friction, what should I ultimately do to the particle's x and y velocities after the bounce?

I will know the particle's x and y velocity, it's x and y coordinate when it hits the outer circle, the radius of the outer circle, and the x and y coordinates of the origin of the outer circle (since its origin will likely not be 0,0).

My brief research on vector math tells me I need to find the normal velocity at the point where the particle hits the outer circle and then negate that, but unfortunately I'm not sure how to do that exactly.

sentences: Screen management: How to switch between screens How can I switch between different screens that implement Screen?

sentences:
SDL2 SDL_PollEvent endless polling on key hold What is wrong with SDL2 SDL_PollEvent() function? When I press-and-hold a key it enters "while (SDL_PollEvent())" block each frame. If in previous frame event queue was emptied and in new frame I press-and-hold button it should create one event - SDL_KEYDOWN. Run this code. It has macro to compile for SDL2 and SDL1.2. SDL1.2 runs okay, polls keyhold and empies queue. SDL2 seems to pump it back each frame, so SDL_PollEvents grabs the same even next frame.

#define USESDL2

#include <iostream> //cout
using namespace std;

#ifdef USESDL2
//link with -l SDL2
#include <SDL2/SDL.h>
#include <SDL2/SDL_events.h>

#else
//link with -l SDL
#include <SDL/SDL.h>
#include <SDL/SDL_events.h>

#endif // USESDL2

int main(int argc, char **argv)
{
    bool q = true;
    SDL_Event e;

    SDL_Init(SDL_INIT_VIDEO);
#ifdef USESDL2
    SDL_Window *win;
    win = SDL_CreateWindow("SDL2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
#else
    SDL_Surface *buff;
    buff = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
#endif
    while (q) {
        while (SDL_PollEvent(&e)) {
            cout << "Polling: ";
            switch (e.type) {
            case SDL_QUIT:
                q = false;
            break;
            case SDL_KEYDOWN:
                cout << "Key down: ";
                switch (e.key.keysym.sym) {
                case SDLK_q:
                    q = false;
                break;
                case SDLK_UP:
                    cout << "UP\n";
                break;
                case SDLK_r:
                    cout << "r\n";
                break;
                }
            break;
            }
        }
    }

#ifdef USESDL2
    SDL_DestroyWindow(win);
#endif
    SDL_Quit();
}

sentences:
How can I make the switch from immediate mode to VBOs? I've been using OpenGL for a short time now- and I'd like some clarification on VBOs.
As I understand it, a VBO is an object stored on VRAM. In immediate mode, to apply a texture we simply bind it and specify the texture coordinates before the vertex coordinates, however it doesn't seem that way with VBOs.

Question 1: Can I specify texture data in a VBO? What portion of the data?

Normally when I make a game in 2d I'd store all of my objects in instances of different classes, then when my drawing routine comes up- just draw the objects that are on screen. With a 3D environment it would be a bit more difficult to just draw the objects on the screen but with some math I'm sure it's doable.

Question 2: Once we figure out which objects need to be rendered, would it be acceptably fast to send those corresponding objects an "apply" request, and have them apply themselves? Or is there a better way?

Question 3: If I have a completely dynamic map, but with objects that won't change very often, are there any guidelines as to the performance differences between  GL_STATIC_DRAW and GL_DYNAMIC_DRAW?

Final Question: Should I even consider using vertex lists? Or are VBOs just a better option?

sentences:
Populate triangles array when you already have sorted vertices array Input is a Vector3[] of verticies. Length is unknown, it could be anything above 2 - so these vertices form all kinds of multifaceted shapes with 3 being a triangle and 6 hexagon-ish.

Poor example to visualize:

vertices = [Vector3(..), Vector3(..), Vector3(..), Vector3(..), Vector3(..)];

Coordinates in that array are ordered counterclockwise. I also have the coordinates of center point that these verticies form (look at illustration below) - it doesn't have to be used but if it helps..

Few examples of which shapes can occur and which cannot:

Now I need to build meshes out of them. For each shape I need:

Vertices array (which I already have, nicely ordered)
Triangles array - 3 indices (from vertices array) per triangle until all vertices are covered

How to populate triangles array with these relatively easy shapes where each vertex has "direct line of sight" to every other vertices? Number of vertices is unknown of course.

sentences:
Which buffering process would be more efficient? I'm working on the base engine of my game right now, specifically converting a text file into a level on-screen. As a 2D platformer, each level has an array of rectangles that can be drawn to the screen. Obviously I don't want to draw all these bad boys to the screen every frame, as that would slow everything down. I've thought up two solutions to this problem myself:

Draw these rects to a separate texture (I'm using SDL2, by the way) and paint a specific portion to the screen every frame
Choose which rects to draw every frame based on the player's position by checking collision between every rect and an imaginary moving "chunk"

My question: Which of these two processes, if either, would be less of a burden to the cpu? If neither seem reasonable, what other alternatives are there?

sentences:
How do I resolve a sphere-triangle collision in a given direction? I am trying my hand at game physics.

I understand that the basic way to pull back a sphere when it collided is to negate the penetration distance:

// If collided...
// `distance`: distance form triangle face; a negative number
// `normal`  : triangle face, in vec3
// `position`: sphere center, in vec3
position.x -= normal.x * distance;
position.y -= normal.y * distance;
position.z -= normal.z * distance;

But I don't want to change y coordinate, while the player is on the ground like this (side view):

How can I calculate the expected translation?

I have these values:

penetration distance, as a negative number (shown in blue)
triangle face normal, as a vec3 (shown in red)
triangle vertices, as 3 vec3s

and

sphere radius, as a number
sphere center, as a vec3

Answers in any programing language are welcome!

updated Jul 17, 2014

I found a hint. It's difficult to explain, I will attach 2 more figures.
It seems, dashed lines in following figures are the translation value what I need, I guess.

and in another case

sentences:
Does Windows 8 still support DirectX 9? Is Windows 8 supporting DirectX 9? Because I was looking through some samples written in C++ and DirectX 9 made for Windows 8. It wasn't that, like I know it ( look here http://directxtutorial.com/Lesson.aspx?lessonid=111-4-2 ). E.g. Inizialising DirectX with COM:

ComPtr<ID3D11Device1> dev;
ComPtr<ID3D11DeviceContext1> devcon;

It's just weird because I know it with the old way:

ID3D11Device *dev;
ID3D11DeviceContext *devcon;

( I hope you understand what I want to tell )

I hope it hasn't change completely due the released their new OS.

sentences:
Geometry design and buffers I'm making some tests with rendering stuff and I'm wondering how to design my Geometry class. For the moment, here is how I do:

Init: Stock array with positions, array with colors, array with normals, … has attributes.
Just before rendering, if my geometry have changed, I update his vertex buffer and index buffer. To do that, I compute interleaved array here and send it to my vertex buffer.

I've made some tests with particles (10000 on iPad), the heaviest function is "Geometry::computeInterleavedArray.

How can I avoid this part? Is it better to stock geometry's data inside a single array with all data already interleaved?

sentences: Is there an SDK to write console apps to simulate an Xbox 360 controller? Is there any SDK I can use to write a console app that can connect to an Xbox 360 as a controller and simulate controller interaction?

sentences:
Pathfinding for a lot of units, mostly random movement I'm using a uniform cost eight-directional grid as a map, with buildings that represent unpassable terrain - the map tries to simulate a top-down flat city. I'm trying to fill the city with randomly walking citizens, and with player units with controlled paths.

So far, for the random walking I've just chosen a direction and set a direct line on it ( using berensham's line algorithm), until the unit strikes a wall, but even this slows down the game with 200 units, and that's before more complex routes are looked for by the player.

So, I need:

An algorithm to quickly compute a lot of simple routes.
A good pathfinding algorithm - so far I've read about HPA* and A* with JPS, but to both I haven't managed to find an implementation, which is a problem because the articles are a bit too theoretical for me.

For illustration, the situation is somewhat similar to the movement in Atom Zombie Smasher - there are uncontrolled civilians that walk randomly / run away from a threat, and few player units that walk on prescribed paths, only in my game the player can't affect the path mid-walk.

So, to summarize - I'm looking for a system for pathfinding for a couple of hundred of units which is as quick as possible.

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:
Method for creating a next gen MMORPG out of thin air? Update August 2012: thank you all for your answers. I started small as suggested, creating first a Facebook Game about it, the next step will be to port it later on PC for a 3D version, and much later as a MMORPG as I would have build credibility and funding. The upcoming FB game will be done by Blup Blup Game Studio (my studio). Thanks.

Original Question:
Background:
I am documenting since a few months a game design document (GDD)(sci-fi & fantasy MMORPG) all by myself, without any real game design background (I am just a Chartered Accountant (CA and CISA)). For now, it looks more like a proposal document.

The question:
If you would have a series of amazing ideas that would revolutionized MMORPGaming how would you create that company out of thin air? Focus on creating the initial core team that would create the mockup that would be present to capital venture companies for major financing.

You may not be financial expert here but you did a massive amount of games in the past, of various types and platforms. With our different backgrounds we are complementary.

Cheers,

Raistx

P.-S. Edited for a leaner question. Removed elements linked to money as it's not the core question. I know how to get money and convince cap venture CIES, but I need a mockup / high pitch to do so.

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: Flickering water effect I have downloaded completely different samples with water effects (in XNA) and I've noticed that they all exhibit a common problem: when the camera direction (only the direction, not the position)  moves, a noticable and annoying flicker occurs where the water meets terrain. I'm curios to find out more about this. Why does it happen? Does it have a name? And what can I do about it?

sentences:
LibGdx 2d Free-Form Terrain I have a query about how to create a 2d landscape level using libgdx/ box2d (Or possibly with Unity) for Android and iOs. Let me describe the goal and then the specific points I need help with.
What I'm trying to create is something like "Hill Climb Racing" where the player has to drive across a finite 2d free-form landscape, like the one shown here. Different areas may have different properties (friction, texture, restitution, etc) as shown. The player will be able to pinch and zoom out to see all or most of the map and pinch to zoom in to see details..

The level width will vary from game to game but at most it will be about 800 box2d meters wide. Now if I use 32px/m that requires an image 25,600 pixels across and this is where the issues start.. I can't tile it because that might preclude me from making free formed curves which I need to be able to do.
So what I need to know is:

How can I create a box2d body for the terrain?
What pixel/meter ratio should I use?
How many pixels wide should the image be?
Should I split the image up into sections and how should I chunk the images together?
What strategies have people used before to achieve this effect?

Hope I have been specific enough and thanks for all the help..

sentences:
Unity 2D: Position Child Object to center of Parent Object What I'm trying to achieve is snapping a child object to the center of its parent object after dragging and dropping it.

The moving object successfully follows the mouse, and drops. It also successfully selects a dynamic parent when it moves over a new node.

What it does NOT do is then snap to the center of its parent. It instead jumps all over the screen and snaps to nothing.

Here is all of my code:

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

public class Object_Moveable: MonoBehaviour {

 private Vector2 mousePos;
 public float moveSpeed;
 public float offset = 0f;
 private bool following;
 private GameObject SelectedNode;

 // Use this for initialization
 void Start() {
  following = false;
  offset += 10;
 }

 void Update() {

  if (Input.GetMouseButtonDown(0) && ((Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position).magnitude <= offset)) {
   following = true;
  }

  if (following) {
   transform.position = Vector2.Lerp(transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), moveSpeed);
  }

  if (Input.GetMouseButtonUp(0)) {
   following = false;
   //Attach (Node, 0, 0);
   transform.localPosition = SelectedNode.transform.position;
  }
 }

 void OnTriggerEnter2D(Collider2D trigger) {
  if (trigger.tag == "pipenode") {
   transform.SetParent(trigger.transform);
   SelectedNode = trigger.gameObject;
  }
 }
}

sentences:
Render 2D texture on the cube texture at given location I would like to simulate a moving sun on the sky. What I have managed to do so far is calculating the exact location of the sun, that is the 3D direction vector from the camera's position in the world to the sun. The sky is the cube with 6 faces textured with some cube map texture. The skybox positon is constantly being set to the position of the camera, so that the camera is always in the cube's center.

Now, I have a simple 2D texture of the sun that I would like to render onto the cube map texture using the aforementioned direction vector. Could you please describe how I can achieve this? My reasoning is that I need to bind the framebuffer of the cube map and then render the sun mesh with the correct sun texture. But how do I specify the position of the sun here so that it matches the direction vector I have calculated earlier? Another question is if there might be problem when it happens that part of the sun is supposed to be rendered on one face of the cube texture and the other part on some other face of the cube texture?

Thank you in advance.

sentences:
Coroutine different behaviour when called from another script I am quite new with game dev, specially with unity. In order to understand how it works, I decided to start small with a pong game.

I have a Ball script, which in the Update() method move the ball depending to the speed, and if a player score, it increment a score field and reset the ball to the center (and stop the ball for 2 seconds) trough a coroutine function.

Ball script:

public class Ball : MonoBehaviour
{
    [SerializeField]
    float speed;
    int isMoving = 1;
    float radius;
    Vector2 direction;
    Vector2 startPosition;

    // Start is called before the first frame update
    void Start()
    {
        direction = Vector2.one.normalized;
        radius = transform.localScale.x / 2; // half the width
        startPosition = new Vector2(transform.position.x, transform.position.y);
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(direction * speed * isMoving * Time.deltaTime);

        if (transform.position.y < GameManager.bottomLeft.y + radius && direction.y < 0) {
            direction.y = -direction.y;
        }
        if (transform.position.y > GameManager.topRight.y - radius && direction.y > 0) {
            direction.y = -direction.y;
        }

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
            StartCoroutine( Reset() );
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
            StartCoroutine( Reset() );
        }
    }

    IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }
}

This works as expected! The score is incremented, the ball go back to the center, wait for 2 seconds and start to move again.
However, now I want to call the Ball Reset() method trough my GameManager (because I want to code some logics inside the GameManager).

So here are my modifications:

Ball script: (remove Reset() calls and update Reset() method to public)

public class Ball : MonoBehaviour
{
    ...

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

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
        }
    }

    public IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }

GameManager script:

public class GameManager : MonoBehaviour
{

    public Ball ball;

    ...

    void Start()
    {
        ...

        // Create ball
        Instantiate (ball);

    }

    public void addScorePlayer(string player) {

        if (player == "p1") {
            score1 += 1;
            score1Text.text = score1.ToString();
        }
        else if (player == "p2") {
            score2 += 1;
            score2Text.text = score2.ToString();
        }

        StartCoroutine( ball.Reset() );
    }

This doesn't work for some reason. The ball don't come back to the center, and the score increment infinitely.

I have tried many things and I have figured out that the behaviour is the same as running the Reset() method trough the Ball script without the StartCoroutine.

So it seems that the Coroutine don't work properly if called trough the GameManager ?
I have also printed some logs into my console in the Ball.Reset() method, and the method is being called, so I don't understand why the ball don't go back to the center.

(Link to my public github repository https://github.com/Sewake/Unity2D-Pong)

sentences:
Art style - setting - gameplay I'm looking for resources describing art style - setting - gameplay relationship (from game design perspective).

For example, Fallout's colour palette most often is the dark one, models - realistic and not cartoonish. Setting - post nuclear holocaust. Auditory - mature players.

I could also take a different example like Borderlands. Art style is cartoonish, comic but not childish. Setting - vault raiding/monster killing on an alien planet. Auditory - mature players, but still appealing to teenagers (I suppose 13 and up).

Pixar and Nintendo games tend to be both cartoonish and childish. Setting - simple or movie based. Auditory - definitely kids, yet can be entertaining for adults for a limited time.

GTA - cartoonish, comic and somehow childish (especially the first one), yet auditory is definitely mature. Setting - working for crime syndicate/free roaming.

Let's say I create and epic fantasy game (setting). How should I choose most appropriate art style for my game? Are there any canons in art style like there are canons in literature (western, eastern, etc...) How does art style alone suggest what kind of gameplay one should expect? One can release concept art, but setting is generally kept secret so that player could uncover it while playing.

sentences: How to get an ESRB rating for my game? What does it take to get an ESRB rating for my game?

sentences:
convert mouse coords to zig-zag isometric I was wondering, how do I convert mouse coordinates to zig-zag isometric coordinates?

I already know how to convert to isometric using the Diamond approach, so I just need to know about the zig-zag approach. I also know how to get the mouse coordinates as well.

Here is the zig-zag approach (copied from the link below):

Here is the link I used for the definition of drawing both the Diamond and zig-zig isometric approaches.

https://stackoverflow.com/questions/892811/drawing-isometric-game-worlds

Help is greatly appreciated, thanks.

sentences:
How to stop car from slipping backwards on a slope? I am trying to simulate a car in Unity, the slope of the road is high so the car slips backwards. Is there any physics property which can stop this from happening?
Thanks in advance.

sentences:
libgdx- tilemap rendering problem I don't really know how to describe my tilemap rendering problem with words, so I think the best way is to show the pictures.
This is how my map looks like when it rendered correctly:

but when I move the player little bit (the camera follows the player) I get this weird result:

Notice how the tiles which generating the floor got this strange shape, like they are not align correctly.
I do have a padding in my tileset, so I'm not sure this is the problem.
I also tried to round the camera position to integers, but it's result was always rendered like the second picture (the unwanted way), instead of sometimes correctly and sometimes not.

What else can be the issue?

EDIT: I noticed now that this problem happened only when the camera reach to the edges points of the tilemap, and also right at the beginning of the program running (when the player is at his first position, before any movement was made).

sentences:
2D lighting theory: day-and-night cycle, spot lights at night I am writing a rogue-like  'zombie' management game. The game map will be similar to Prison Architect. A top-down 50 X 50 grid.

I want to implemented a day night cycle and during the night I would like the player to be able to position lights.

I would like to be able to lighten and dark to whole map to display the day and night cycle.

Then lights would be a circle of light blocked by game entities such as walls, players, trees etc.

How would I achieve and what is the standard way of achieving this?

sentences:
What makes a good tech tree? In strategy/simulation games there are often tech/research trees which allow players research new abilities/options, improve existing options and decease negative effects.

Some games seem to follow the abc approach of item 1 -> item 2 -> item 3 with minor stat changes while others make every unlocked option wildly change the way a game is played by throwing new units into the game which are able to change the balance of the game. Some make unlocking one branch block off another for the rest of the game while other will let you research everything. Some let you research multiple things while others will penalize you for switching research before it is complete. On that note tech trees can be progressive (with dedicated research over time unlocking an item) while some need you to collect enough money/points in order to unlock instantly.

What are some general guidelines for when to employ what strategy in a game? What games types of games would benefit more from one tech tree type over another and why? When should a linear tech tree be employed over a branching one?

Edit

For example a game where the main character has to build up an organisation and research technologies in secret while others are finding them and shut them down resulting in lost research laboratories, which reduce research output. The research output should increase somewhat exponentially as the game goes on as better technology is unlocked and research laboratories are upgraded. There would presumably be a very large tech tree to explore and the constant danger of losing facilities to other parties until you either unlock some endgame tech or lose everything.

Why this isn't a duplicate

Some people are marking this question as a duplicate because there is a related question about tech tree size. This question has to do more with the connections, cost and relationships between the technology options (of which size is a factor but not everything).

sentences:
LibGdx: Texturing cube results in jagged transparent edges currently I'm in the works of programming a game - surprise xD
I'm using LibGdx for this manner but I've encountered a very unknown bug I guess.
I wasn't able to get any further by searching the internet.

If you're interested in the entire source code - it's on Github

here is the code of the Block class

package richbar.com.github.treasurepyramid.block;

public abstract class Block implements EventSubscriber, Loadable {

    public abstract String getId();

    Vector3 pos;
    String name;
    Model model;
    BoundingBox bounds;
    Texture texture;
    Material attributes;

    private boolean loadedData;
    public boolean isLoaded(){return loadedData;}

    public Block(){
        Main.getInstance().addAssetListener(this, "blocks/"+getId()+".json",    Text.class);
    }

    public Block(Block block){
        Main.getInstance().addAssetListener(this, "blocks/"+block.getId()+".json", Text.class);
        pos = block.pos;
        attributes = block.attributes;
        bounds = block.bounds;
    }

    public Model getModel(){
        if(model != null) return model;
        texture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
        Material material = new Material(TextureAttribute.createDiffuse(texture));
        ModelBuilder modelBuilder = new ModelBuilder();
        modelBuilder.begin();
        modelBuilder.node();
        MeshPartBuilder mesh_part_builder = modelBuilder.part("box", GL20.GL_TRIANGLES, VertexAttributes.Usage.Position
            | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates, material);
        BoxShapeBuilder.build(mesh_part_builder, 5, 5, 5);
        return modelBuilder.end();
    }

    boolean stayUpdated = true;
    @Override
    public void eventUpdate(Event e, Object args) {
        AssetManager manager = Main.getInstance().getAssetManager();
        if(e == Event.ASSET_LOADED && manager.isLoaded("blocks/"+getId()+".json")){
            Main.logger.log("loaded blocks/"+getId()+".json");
            stayUpdated = false;
            JsonValue json = new JsonReader().parse((manager.get("blocks/"+getId()+".json")).toString());

            name = json.getString("name");
            texture = new Texture(Gdx.files.internal(json.getString("texture")));
            loadedData = true;
        }
        //generate Cube Model if Absent
        model = getModel();
    }

    @Override
    public boolean stayUpdated() {
        return stayUpdated;
    }
}

Pic of this weird behavior     ||   Changing angles only changes the jaggedness

I'd really appreciate if anyone could help me fix this issue : )

Have a nice evening,

Marco

sentences: Frustum culling + instancing I've implemented instancing in my app and right now I have an instance buffer holding position data for all instances. But I'd like to also implement frustum culling which would cull some of the instances depending on the camera view. Now, how can I render only some of the instances in the buffer but not all? Do I have to rebuild the buffer every frame (so that it only holds visible instances) or is there a way in DirectX 11 to "tell" API which instances from the buffer I want drawn?

sentences:
GET and POST requests in gdscript How do I perform get and post requests from Gdscript in Godot?
I am trying to get a map API and use it in the game.

sentences:
Dynamic Flow Control in HLSL with Array References I'm trying to do lighting calculations for an array of point lights in HLSL. I simply want to pass light direction vectors from the vertex shader to the pixel shader. Here is sample code:

static const int MAXLIGHTS = 8;
float4 g_vLightPosition[MAXLIGHTS];
float4x4 mW : WorldTransform; // model to world
float4x4 mV : ViewTransform; // world to view
float4x4 mP : ProjectionTransform; // view to project

void VS_Lighting( in float4 PositionMS : POSITION0,
out float4 PositionCS : POSITION0,
out float4 Texcoord[MAXLIGHTS] : TEXCOORD )
{
    // view-projection
    float4x4 mVP = mul(mV, mP);

    // world position
    float4 vPosWS = mul(PositionMS, mW);

    // clip space pos
    PositionCS = mul(vPosWS, mVP);

    // compute light direction vectors
    for(int i = 0; i < g_nLightCount && i < MAXLIGHTS; ++i)
    {
        Texcoord[i].xyz = g_vLightPosition[i] - vPosWS;
    }
}

The above code forces the loop to unroll and gives the following warning:

  warning X3550: array reference cannot be used as an l-value;
  not natively addressable, forcing loop to unroll

I would like for this code to be dynamic so as to reduce the instruction count. I understand that the problem is accessing the array in the loop. How can I rewrite this code to prevent unrolling during compilation? I am using ps 2.0 or 3.0.

sentences:
Subdived objects in different shapes Currently I'm working on an Android OpenGL 3D game and now I want to implement a collision detection. For this I want to use oriented bounding boxes but here is my problem. For a normal oriented bounding box I have to store the middle and then the length into every dimension. Now let's say I have a tree and of course my character can walk under the treetop but not into the tree trunk. I tried to sketch up the different bounding boxes here:

Tree as two rectangels                         Normal bounding box

-----------------------                   ------------------------------
|                     |                   |                            |
-----------------------                   |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |             x              |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        -------                           ------------------------------

If you think about the collision detection in the first sketch you can walk under the treetop because the border of the tree is subdivided into different shapes and the outline of a tree is still visible. In the second picture you can't tell something about the outline of the object because you only have one big box around the whole object so you can't walk under the treetop. You see the first method is much better then the second method for my plan.

Now my question: Do you have any ideas how I can subdivide my objects into different shapes? Maybe even in triangles, circles and so on. Is there an algorithm  for this or do I have to do it by myself?

sentences:
How do components access one another in a component based entity system ---Most of the stuff I am talking about I read here---

I am currently tring to wrap my head around component based systems to make a simple game engine of sorts.

I am having a hard time understanding how its supposed to work. I get that there are components which all inherit from the same base, which provides basic functions (init, update, end) and lets all of the different kind of components be stored in the same array of pointers. I get that. However I dont get how any efficient interactions of the components in a game object are supposed to happen.

Lets say I made a component that stores the amount of gold in a treasure chest (lets call it dataComponent).
Lets also assume I made a component that does something when its update function is called (lets call it logicComponent)

There is also a class called Entity

class entity{
private:
    vector<component*> components;
public:
    void addComponent(component* comp);
    void removeComponent(component* comp);
    void getComponent(int id);
}

Lets now say I plan to make treasureChest, without any functions. Its just a background model.
Then I will make a new enitity and using addComponent I will add the dataComponent(and give it 100 gold pieces in its constructor) and a logicComponent(and give it nothing in its constructor).
The player might take out, or put in as much gold as he likes. We dont know how much gold there is in the chest. There might even be multiple dataComponents storing how many jewels or weapons are in the chest.

Example:

void main(){
    Entity chest;
    chest.addComponent(new dataComponent<int>("gold",100)); //100 gold pieces
    chest.addComponent(new dataComponent<int>("guns",2)); //2 weapons
    chest.addComponent(new logicComponent()); //this is going to do the printing
    updateEnt(Entity);//simply iterates through all components of the entity and calls thier update functions.
}
EXPECTED OUTPUT:
This chest contains 100 gold and 2 guns

The logic components job is to somehow get its hands on the data and print it to the screen.

My question is:
How can the logic component get access to the other components in the same object as it is in and access the approperate ones (the ones it needs to function) without looking through the entire array every single time?

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:
Why is my OpenGL enabled Java game not detected by Fraps? Recently I found out that I could enable OpenGL hardware acceleration in my Java game with the line

System.setProperty("sun.java2d.opengl", "True");

Initial tests showed a big boost in performance. However, several days later I wanted to make a small test video using Fraps but I found out that it didn't recognize my application (as in the  FPS counter did not show and I could not record anything). After I removed the earlier mentioned line of code (thus disabling OpenGL hardware acceleration) it recorded just fine.

Is there any way to use Fraps while I have OpenGL enabled in my Java game?

sentences:
Track first time leveling up Broad question, but I'm looking for some better ideas.

Currently I have a Player class and booleans for hasSeenLevel2, hasSeenLevel3, etc. When I give a player exp I call a checkLevel method that checks to see if they level up.

checkLevel(){
    if(totalExp > 100){
         level = 2;
         if(!hasSeenLevel2){
             display("You gained level 2");
             hasSeenLevel2 = true;
         }
    }

}

this works, but is incredibly tedious to setup and inefficient.

What better ways are there to organize player levels and exp?

sentences:
Rewarded video ads for two different functions - Unity I'm implementing reward based video ads in my game. There are two functions that provide the reward. One is a ReceiveLife() function where once the player dies, if they click on the revive button the game restarts and the score is set to score before the player dies instead of 0. The other function is ReceivePoints(), where if the player clicks on the add points button, they are rewarded with 100 extra points. Here are the functions in the game manager script:
 public void ReceiveLife()
   {
     savedScore = (int)playerScore;
     SceneManager.LoadScene(1);
   }

 public void ReceivePoints()
   {
     playerScore+=100;
     gameOverPanel.gameOverScoreText.text = "Score: " + ((int)playerScore).ToString();
   }

Here is the unity ads manager script:
 public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
  {
    if (showResult == ShowResult.Finished)
    {
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        gameManager.ReceiveLife();
    }

    if (showResult == ShowResult.Finished)
    {
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        gameManager.ReceivePoints();
    }
 }

Once they watch the ad successfully, both the functions are being called. If the player clicks on the ReceiveLife(), he should only get one extra life and not the additional 100 points and vice-versa.
I'm not sure how to call each function separately. Do I have to create two separate admanagers in order to call these functions or is there a better method?

sentences:
Collision detection implementation suggestions I'm working on a simple 2D game involving a rotating octagonal ring where a sphere sprite moves up/down avoiding objects as the ring rotates faster and faster. I'm having a difficult time with the collision between the sphere and the sides of the walls.

The ring is made up of 8 instances a primitive called a straightSection object. The camera is also zoomed in along the z-axis and positioned along the x and y to give the appears of a track. I've attempted to have 2 collision rectangles as part of the straightSection constructor. The rectangles would rotate with of the straightSection but what was happening was that the rectangles were aligning themselves with the axis and not rotating. I've then attempted to simply draw a vector across the top and bottom and use a BoundingSphere over the sprite and use the BoundingSphere.Intersect() method to determine but it was only working on vertices of the vector and not across the whole top.

I've tried attaching vectors and boxes to the vertices after they are transformed but also have used Viewport.Project() to obtain the coordinates for the box in the space as the sprite but it's the same thing

I've attached an illustration:

What I think is going wrong... well I'm not sure entirely. I've read so many tutorials and feel that I'm doing the same thing as them and it should be simple. My guess is that it has to do with the camera location, the ring location and the sphere location not being where I think they are.

If anyone needs to see the code, I can post that as well. I've been at this for weeks and I think I'm looking at the problem the same way over and over...

Adding some code

What I thought would be the simplest and most intuitive way to go about it was to have a ray traces starting from the top right of the primitive to the top left of the primitive. In the drawing above it would be the narrow red box (but in this case an attempt at a ray).

BoundingSphere bs = new BoundingSphere(new
Vector3(spriteManager.getPlayer.collisionRect.Center.X,
SpriteManager.getPlayer.collisionRect.Center.Y, 1) 25.0f)

Ray intersectRay = new Ray(section1.CoordTopR, section1.CoordTopL)
intersectRay.Direction.Normalize()

if (bs.Intersects(intersectRay) < 25.0f)
{
///

}

I've tried this with the View.Project coordinates of the vertices, or just using the transformed coordinates CoordTopR and CoordTopL and it doesn't work.  It either always collides or only does over a small point. I've tried to change the intersect float value but that doesn't help. I'd like it to stretch over the whole top of the shape.

sentences:
Sharing the XNA executable of my game on dropbox I'm currently making a game and I have my artist living in a different city as me.  We share a dropbox folder so that I can see her art, and I thought it should be easy to copy the debug bin folder into the dropbox so that she can see it.  This doesn't work (I can't even run it), so what could I do?

EDIT:

I run the executable in the dropbox folder, and immediately I get the "game.exe" has stopped working.  So obviously I have XNA installed, but my game can't run in this folder.

sentences:
How can I ensure a Unity game continues to run in RAM, even if the disk it loaded from is removed? I'd like to make a game with Unity, put the build with all the data on a USB key, plug it in another Windows computer, and run the game from the USB drive, then remove the USB drive, but keep the game running flawlessly.

How could I do that?

sentences:
How can i change the camera view when clicking a button? I added enum with all the views options.
But when i click/press on V nothing happen with the game is running.

using UnityEngine;

public class FollowTargetCamera : MonoBehaviour
{
    public enum Views
    {
        Forward, Backward, Left, Right
    }

    public Transform Target;
    public float PositionFolowForce = 5f;
    public float RotationFolowForce = 5f;

    public Views views;

    void Start()
    {

    }

    void FixedUpdate()
    {
        Vector3 vector = new Vector3(0, 0, 0);
        Vector3 dir = new Vector3(0, 0, 0);

        if (Input.GetKeyDown(KeyCode.V))
        {
            switch (views)
            {
                case Views.Backward:
                    vector = Vector3.back;
                    dir = Target.rotation * Vector3.back;
                    break;
                case Views.Forward:
                    vector = Vector3.forward;
                    dir = Target.rotation * Vector3.forward;
                    break;
                case Views.Left:
                    vector = Vector3.left;
                    dir = Target.rotation * Vector3.left;
                    break;
                case Views.Right:
                    vector = Vector3.right;
                    dir = Target.rotation * Vector3.right;
                    break;
            }
        }
        dir.y = 0f;
        if (dir.magnitude > 0f) vector = dir / dir.magnitude;

        transform.position = Vector3.Lerp(transform.position, Target.position, PositionFolowForce * Time.deltaTime);
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(vector), RotationFolowForce * Time.deltaTime);
    }
}

sentences:
Separating part of mesh facing upwards I really hope you can help me fix this code:
List<Vector3> verticesToExport = new List<Vector3>();//vertices of the triangles facing upwards.
        List<int> trianglesToExport = new List<int>();//new triangle facing upwards.
        //meshToCut is the original mesh, then I just try to replace it with the new data.
        int[] triangles = meshToCut.triangles;
        Vector3[] vertices = meshToCut.vertices;

        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;

            float projection = Vector3.Dot(Vector3.Cross(b, a), Vector3.down);
            if (projection > 0f)
            {
                verticesToExport.Add(vertices[triangles[i]]);
                verticesToExport.Add(vertices[triangles[i + 1]]);
                verticesToExport.Add(vertices[triangles[i + 2]]);
                trianglesToExport.Add(triangles[i]);
                trianglesToExport.Add(triangles[i + 1]);
                trianglesToExport.Add(triangles[i + 2]);
            }
        }
        meshToCut.SetVertices(verticesToExport);
        meshToCut.SetTriangles(trianglesToExport, 0);//probably I'm doing wrong here!

It works great by retrieving the vertices facing up, and I guess the triangles too but when I put it into a mesh filter I believe the triangles are not in order...
1.The model I'm trying to separate; the triangles facing upwards.

2. This is what happens if I just take the vertices and triangulate them again. It proves that vertices are alright!

3. The result I get from the code above:

sentences:
C++ low-level optimization tips Assuming you already have the best-choice algorithm, what low-level solutions can you offer for squeezing the last few drops of sweet sweet frame rate out of C++ code?

It goes without saying that these tips only apply to that critical code section that you've already highlighted in your profiler, but they should be low-level non-structural improvements.  I've seeded an example.

sentences:
XNA: My bullets lag the game the first time they're fired, but not after I'm working on a SpaceWar-esque project to get comfortable with XNA. I have a Ship DrawableGameComponent and a Bullet DrawableGameComponent. The player's Ship is created at the start of the game, and the Bullets are created for each Ship as part of its constructor.

In my Ship constructor, I have the following code:

for (int i = 0; i < 5; i++)
{
    activeBullets[i] = new Bullet(game);
}

The relevant part of my Ship's shoot() function is as follows:

activeBullets[bullet].Visible = true;
activeBullets[bullet].Enabled = true;
activeBullets[bullet].position = this.position;

The first five times I shoot() (that is, once for each bullet object that the ship is allotted), there is lag that I think is due to the bullet sprite being loaded. I've tried setting Visible and Enabled to true in the ship constructor loop where the Bullets are instantiated, but the first-five-shots lag persists. Any shots beyond the first five are completely lag-free.

How do I load the Bullets properly ahead of time so that there is no lag on the first shots?

sentences:
Making Basic Touch Behaviors I am trying to make Basic Touch behaviors for my game where i want to

Pan Camera by Single finger touch.
Zoom Camera by pinch With two fingers ofCourse.
Rotate Camera by two fingers rotation.
Rotate camera around an object and move only in x axis using Two fingers y position.

i am having problem in making camera to rotate on X axis but i am not able to do it correctly plz help and it also conflicts with my pan behaviour when input is given

   public float comfortZoneVerticalSwipe_A = 10;
    public float comfortZoneHorizontalSwipe = 50;
    public float minSwipeDistance = 100;

    public float startTime;
    public Vector2 startPos;
    public float maxSwipeTime = 0.5f;

    if (Input.touchCount > 0 && Input.touchCount < 2)
            {
                Touch touch = Input.touches[0];
                switch (touch.phase)
                { //following are 2 cases

                    case TouchPhase.Began: //here begins the 1st case
                        startPos = touch.position;
                        startTime = Time.time;

                        break; //here ends the 1st case

                    case TouchPhase.Moved:

           Vector3 offset = transform.right * (-Input.touches[0].deltaPosition.x * 0.9f) * panSpeed + transform.up * (-Input.touches[0].deltaPosition.y * 0.9f) * panSpeed;
                                Vector3 newTargetOffset = Vector3.ClampMagnitude(offset, maxOffsetDistance);

                                transform.position += newTargetOffset - targetOffset;

                        break;

                    case TouchPhase.Ended: //here begins the 2nd case

                         float swipeTime = Time.time - startTime;
                        float swipeDist = (touch.position - startPos).magnitude;

                              Debug.Log("Mathf.Abs(touch.position.x - startPos.x) " + Mathf.Abs(touch.position.x - startPos.x));

                            Debug.Log("swipe Time " + swipeTime);

                            Debug.Log("swipe Dist " + swipeDist);

                            if (Mathf.Abs(touch.position.x - startPos.x) < comfortZoneVerticalSwipe_A && swipeTime < maxSwipeTime && swipeDist > minSwipeDistance && Mathf.Sign(touch.position.y - startPos.y) > 0)
                        {

                            Debug.LogWarning(transform.rotation.x);
                            transform.rotation = new Quaternion(transform.rotation.x - 5 , transform.rotation.y , transform.rotation.z , transform.rotation.w);
                           if (transform.rotation.x > 0.2)
                           {
                                transform.Rotate(Vector3.right, -2);
                            }
                                Debug.LogError(transform.rotation.x);
                            Debug.LogWarning("Up");

                        }
                            else if (Mathf.Abs(touch.position.x - startPos.x) > comfortZoneVerticalSwipe_A && swipeTime > maxSwipeTime && swipeDist > minSwipeDistance && Mathf.Sign(touch.position.y - startPos.y) < 0)
                            {

                                 transform.rotation = new Quaternion(transform.rotation.x - 5 , transform.rotation.y , transform.rotation.z , transform.rotation.w);
                                if (transform.rotation.x < 0.9)
                                {
                                    transform.Rotate(Vector3.right, 2);
                                }
                                print("down");

                            }

                        break; //here ends the 2nd case
                }
            }

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:
Text alignment in OpenGL with FreeType2 I'm trying to implement font rendering and have got into some trouble with glyph metrics.
Here's the code where I get the metrics:

Glyph gl;
gl.width = face->glyph->metrics.width / 64;
gl.height = face->glyph->metrics.height / 64;
gl.character = i;
gl.advance = face->glyph->metrics.horiAdvance / 64;
gl.bearingX = face->glyph->metrics.horiBearingX / 64;
gl.bearingY = face->glyph->metrics.horiBearingY / 64;
gl.textureX = this->_textureWidth;

The value of gl.advance is way too small. Here is a picture of it:

If I'm dividing face->glyph->metrics.horiAdvance by 40, it looks like this:

The text is now readable, but the advance and X-, Y-bearing still don't look correct. This is what it should look like:

Here is my code where I draw the glyphs:

float aspect = this->_graphics->getMetrics().x / this->_graphics->getMetrics().y;

float offset = 0;
for(unsigned char c : str){
    Glyph g = this->_fonts[fontID]->getGlyph(c);

    vec2 pos = (position.getRelative() + vec2(offset, 0) + (vec2(g.bearingX, -g.bearingY) / SCALING) * scale - vec2(1, 1))
                * vec2(1, -1);
    glyphShader->setUniform("position", pos);
    glyphShader->setUniform("scale", (vec2(g.width, g.height * aspect) / SCALING) * scale);
    glyphShader->setUniform("glyphSize", vec2(g.width, g.height));
    glyphShader->setUniform("textureMetrics", this->_fonts[fontID]->getTextureMetrics());
    glyphShader->setUniform("textureOffset", vec2(g.textureX, 0));
    glyphShader->setUniform("image", 0);
    glyphShader->setUniform("color", color);

    this->_graphics->getMeshByID(guiInstance->_quadID)->drawMesh();

    offset += (g.advance / SCALING) * scale;
}

I'm doing some transformations on position to move the origin to the top-left corner and flipping the coordinate system on the X-Axis. Then I divide every pixel value by a constant factor, to have the font having the same size on every resolution. The ratio of the glyphs is correct, but not the alignment.
And here is my vertex shader:

#version 400

layout(location=0) in vec4 vertPosition;
layout(location=1) in vec2 vertUV;

uniform vec2    position;
uniform vec2    scale;
uniform vec2    glyphSize;
uniform vec2    textureMetrics;
uniform vec2    textureOffset;

out vec2 fragUV;

void main(void){
    gl_Position = vertPosition *
                  vec4(scale, 1, 1) +
                  vec4(position, 0, 0);

    fragUV = vec2(vertUV.x * (glyphSize.x / textureMetrics.x) + (textureOffset.x / textureMetrics.x),
                  -vertUV.y * (glyphSize.y / textureMetrics.y));
}

Why are the characters misaligned?

sentences:
How do I adjust the origin of rotation for a group of sprites? I am currently grouping sprites together, then applying a rotation transformation on draw:

private void UpdateMatrix(ref Vector2 origin, float radians)
{
     Vector3 matrixorigin = new Vector3(origin, 0);
     _rotationMatrix = Matrix.CreateTranslation(-matrixorigin) * Matrix.CreateRotationZ(radians) *  Matrix.CreateTranslation(matrixorigin);
}

Where the origin is the Centermost point of my group of sprites.  I apply this transformation to each sprite in the group.

My problem is that when I adjust the point of origin, my entire sprite group will re-position itself on screen.

How could I differentiate the point of rotation used in the transformation, from the position of the sprite group?  Is there a better way of creating this transformation matrix?

EDIT

Here is the relevant part of the Draw() function:

Matrix allTransforms = _rotationMatrix * camera.GetTransformation();

spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, allTransforms);

for (int i = 0; i < _map.AllParts.Count; i++)
{
    for (int j = 0; j < _map.AllParts[0].Count; j++)
    {
       spriteBatch.Draw(_map.AllParts[i][j].Texture, _map.AllParts[i][j].Position, null, Color.White, 0, _map.AllParts[i][j].Origin, 1.0f, SpriteEffects.None, 0f);
    }
}

This all works fine, again, the problem is that when a rotation is set and the point of origin is changed, the sprite group's position is offset on screen.

I am trying to figure out a way to adjust the point of origin without causing a shift in position.

EDIT 2
At this point, I'm looking for workarounds as this is not working.  Does anyone know of a better way to rotate a group of sprites in XNA?  I need a method that will allow me to modify the point of rotation (origin) without affecting the position of the sprite group on screen.

EDIT 3
I think if I was able to reset the screen coordinates to (0,0) at my sprite position, it would essentially allow me to re-position the origin without movement.  I essentially need a way to set the current position/rotation, then start from scratch.  Does anyone know if it is possible to make my sprite the new screen origin?

MOVING ORIGIN WITHOUT A ROTATION:

MOVING ORIGIN WITH A ROTATION (notice how it shifted upwards):

sentences:
c++ static only classes for subsytems and Engine From the book Game Engine Architecture

  In C++, global and static objects are constructed before the program’s
  entry point (main(), or WinMain() under Windows) is called. However,
  these constructors are called in a totally unpredictable order. The destructors
  of global and static class instances are called after main()
  returns, and once again they are called in an unpredictable order. Clearly this
  behavior is not desirable for initializing and shutting down the subsystems
  of a game engine, or indeed any software system that has interdependencies
  between its global objects.

The book suggests to implement the subsystems as singelton objects with empty constructor and destructor and add explicit Init() and Dispose() methods, such that the construction and destruction order can be manually specified.
The question is now whether this can be done using global static classes instead of singelton objects, like this:

//Renderer.h
class Renderer
{
public:
    static void Init()
    {
        //init logic
    }

    //Some static, global fields

    static void Dispose()
    {
        //Disposing logic
    }
private:
     //some more static, not global fields / methods
};

//Engine.h
class Engine
{
public:
  static void Init()
  {
    Renderer::Init();
    //etc
  }
  //other stuff

  static void Dispose()
  {
      Renderer::Dispose();
      //etc
  }
};

//Main.cpp

int main()
{
    Engine::Init();
    //some work
    Engine::Dispose();
}

Will this kind of approach also solve the initialization order problem described in the book?

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:
Unity smooth local rotation around one Axis, oriented toward a target I want to acheive the same rotation you see in the inspector.
In short: a smooth local Y rotation, toward a target

I have a Vector3 orientation:
Vector3 dirOrientation = targetToLook.position - movingCamera.position;

So, every Update, what should I do ? I try many thing, but I don't realy understand Quaternion...

I just want to rotate localy in Y, toward a precise moving target, NOT in X or Z. and smoothly with some Lerp or Slerp.

Thanks !

sentences:
Where to start for implementing vehicle physics? A little background for myself. I am relatively experienced with 3rd part physics engines such as Havok, Box2D, Bullet and have successfully integrated them in custom engine(s). I have also made a simple physics engine by following a few known books.

Now I am interested in diving into vehicle physics. There are a couple of books that skim over the topic but do not go over in enough detail for me to grasp anything useful. So I would like to know of good books/resources that are not too heavy (by that I mean a book that is pure vehicles and made for engineers rather than game developers) that help me get started on vehicle physics. Here get started = at least guide me through creating a simple vehicle in 3D with modern features found in most games (suspension/transmission etc.)

Note: I searched for a similar question but did not find one, but if one exists, please post the link and feel free to close the question.

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

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

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

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

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

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

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

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

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

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

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

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

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

Any thoughts or insight?

sentences:
Ring and Pole - Box2d How I can make a b2Body in box2d so that it could form a ring which does not collide from the center just like a ring. like when we flick the object and there's another body (like pole), the pole can go inside from the ring.

like this:

sentences:
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: 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:
How to store a shmup level? I am developing a 2D shmup (i.e. Aero Fighters) and I was wondering what are the various ways to store a level. Assuming that enemies are defined in their own xml file, how would you define when an enemy spawns in the level?

Would it be based on time? Updates? Distance?

Currently I do this based on "level time" (the amount of time the level is running - pausing doesn't update the time). Here is an example (the serialization was done by XNA):

<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:level="pekalicious.xanor.XanorContentShared.content.level">
  <Asset Type="level:Level">
    <Enemies>
      <Enemy>
        <EnemyType>data/enemies/smallenemy</EnemyType>
        <SpawnTime>PT0S</SpawnTime>
        <NumberOfSpawns>60</NumberOfSpawns>
        <SpawnOffset>PT0.2S</SpawnOffset>
      </Enemy>
      <Enemy>
        <EnemyType>data/enemies/secondenemy</EnemyType>
        <SpawnTime>PT0S</SpawnTime>
        <NumberOfSpawns>10</NumberOfSpawns>
        <SpawnOffset>PT0.5S</SpawnOffset>
      </Enemy>
      <Enemy>
        <EnemyType>data/enemies/secondenemy</EnemyType>
        <SpawnTime>PT20S</SpawnTime>
        <NumberOfSpawns>10</NumberOfSpawns>
        <SpawnOffset>PT0.5S</SpawnOffset>
      </Enemy>
      <Enemy>
        <EnemyType>data/enemies/boss1</EnemyType>
        <SpawnTime>PT30S</SpawnTime>
        <NumberOfSpawns>1</NumberOfSpawns>
        <SpawnOffset>PT0S</SpawnOffset>
      </Enemy>
    </Enemies>
  </Asset>
</XnaContent>

Each Enemy element is basically a wave of specific enemy types. The type is defined in EnemyType while SpawnTime is the "level time" this wave should appear. NumberOfSpawns and SpawnOffset is the number of enemies that will show up and the time it takes between each spawn respectively.

This could be a good idea or there could be better ones out there. I'm not sure. I would like to see some opinions and ideas.

I have two problems with this: spawning an enemy correctly and creating a level editor. The level editor thing is an entirely different problem (which I will probably post in the future :P).

As for spawning correctly, the problem lies in the fact that I have a variable update time and so I need to make sure I don't miss an enemy spawn because the spawn offset is too small, or because the update took a little more time. I kinda fixed it for the most part, but it seems to me that the problem is with how I store the level.

So, any ideas? Comments?

Thank you in advance.

sentences:
Game (X-Plane) boot/startup time / performance I use X-Plane for my question but it also concerns probably every other flight-simulator or simulation game in general. When developing a plugin what bothers me most is the startup-time of the application to test my plugin functionality so I was wondering how I can improve the startup speed of the simulator.

First I removed all additional scenery and reduced the loaded files to a minimum which gave me a startup time of 34 seconds which is quite fast already.
To improve the time even further I thought it would make sense to run the whole application from memory and I installed ubuntu 64-bit and created a 2GB tempfs filesystem in memory (ram-disk).

When starting x-plane from this memory file system it still takes 30 seconds. Can anyone explain what the application does during startup which needs so much processing time?

I assume that the graphic bitmaps for the object and the environment are compressed on disk and therefore they have to be decompressed in memory first before they can be used in opengl. This would explain the time spent on startup.

If it is true that the bitmaps need to be decompressed first would it be possible to improve the time by using multiple cores? If the application is multithreaded and there are four cores would the time be divided by four or does this processing happen on the GPU?

Any explanation which helps me to better understand the startup-process of a computer game is really appreciated because I'm interested in improving the overall performance of the system and therefore I need a better understanding of the bottlenecks (RAM, CPU, GPU, Disks (SSD/Raid), OS, libraries, ...).

sentences:
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:
Scrolling 2D sprites on a map with a camera I'm working on a 2D sprite-based strategy-type game (ok, full disclosure: it's a tower defense game), and I'm having a problem getting the actors to behave correctly when I move the camera.

I've got a Camera class, which contains data and methods for moving the camera and exposing its' current position. When I draw the background, I offset the background thusly (and it works great):

var backPos = new Vector2(background_bounds.X - camera.CameraPositionX,
                          background_bounds.Y - camera.CameraPositionY);
spriteBatch.Draw(background_texture, backPos, Color.White);

My sprites each have a GraphicsComponent that directs the rendering. I've been playing around with different combinations, but none seems to give the proper (expected behavior); I lose collision detection (done via my CollisionComponent object), or the physics misbehave, etc, because actor's position is different than what the other components expected. Here's the GraphicsComponent.Draw(...Camera camera):

 //...snip
 var adjustedPosition = new Vector2(actor.Position.X - drawOffsetX,
                                    actor.Position.Y - drawOffsetY);
 //Uncommenting this line doesn't work either - just makes things seem worse
 //actor.Position = adjustedPosition;
 DrawContext.Draw(actor.Texture, adjustedPosition,
                  actor.SpriteBounds, DrawColor);

How do you folks approach applying camera offsets to sprites in a way that avoids exposing the camera to every component? Do you offset the actual position by the camera's position, or do you simply render the position with the offset, and compensate elsewhere?

sentences:
try to create CCSpriteFrame but get nil values I'm trying to animate a CCSprite in cocos2d v3 following this question, but I'm getting the following error message in Log:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM
 insertObject:atIndex:]: object cannot be nil'

This is my code:

NSMutableArray *animationFrames = [NSMutableArray array];
    int frameCount = 0;
    for(int i = 1; i <= 9; ++i)
    {
        CCSpriteFrame *spriteFrame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName: [NSString stringWithFormat:@"hero-%d.png", i]];

            [animationFrames addObject:spriteFrame]; //ERROR OCCUR THIS LINE

        frameCount++;
        if (frameCount == 8) break;
    }

The problem is that all spriteFrames are nil, but I don't why. I already tested the i values with NSLog, and also tried to add hero-1.png to a CCSprite object and works fine. I also tried to add all fixed hero-1.png in all frames to verify if the problem was with i variable. But didn't work also.

sentences:
how to choose the board design in a multiplayer game? I'm making a Nine Men's Morris board game in which players can play with other online players.

But my problem is in steps before starting the game between two players.

This is what I thought about:

  1- Player B requests to play with Player A

  2- If player A accept the request, the game will start.

I need a step in between, so that they can choose a board design, but I don't know who should choose it or how.

Is there any better way in maching two players or how to select a borad map? Any ideas is much appreciated.

sentences:
What maths should I learn for game programming, and what aspect of programming does it relate to? Possible Duplicate:
  What math should all game programmers know?

Obviously a good knowledge of maths is essential for good programming, my maths isn’t the best ( I didn’t pay attention in school all those years ago) so, in order to get one step closer to being the best I need some advice. What maths should I learn for specific areas of game programming?
If someone could outline some subjects and say one or two words about what areas of game programming they would be used in I’d greatly appreciate it. I’m working through the Khan academy programme at the moment, and I’m just getting into algebra now.

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:
LibGDX - Actors on top of each other, avoid multiple draw calls I am writing a card game with multiple cards that will stack up on the unplayed deck, and also on player hands.

Currently I add all 100 card actors to the screen at the start to make it easier so i don't have to manage adding them when they are needed. They all start on top of each other and some get dealt out to players hands, which are also just piles of cards. So in theory with a 5 player game there are only 6 cards visible, the deck and the top off each player's hand.

I'm hoping someone can tell me off a clever method to mean that only 6 draw methods get run on the actors that are visible, or do i have to manage all this myself?

If i do, would you suggest adding the actors only when i need them, or adding them invisible and then setting them visible when i need to?

Or another method?

sentences:
Errors on LibGDX tutorial I get the following errors on the LibGDX tutorial "Simple App"

  Exception in thread "main" java.lang.UnsatisfiedLinkError: no gdx64 in
  java.library.path     at java.lang.ClassLoader.loadLibrary(Unknown
  Source)   at java.lang.Runtime.loadLibrary0(Unknown Source)   at
  java.lang.System.loadLibrary(Unknown Source)  at
  com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:118)
    at
  com.badlogic.gdx.backends.lwjgl.LwjglNativesLoader.load(LwjglNativesLoader.java:41)
    at
  com.badlogic.gdx.backends.lwjgl.LwjglApplication.(LwjglApplication.java:52)
    at com.badlogic.drop.DesktopGame.main(DesktopGame.java:7)

I copied and pasted the final code onto the project, but I don't know why it wont run.

Whats the problem?  Is it the project set-up?

sentences:
How to create character avatars without lots of artwork? I am writing a mafia RPG game where it is required to hire "goons" to be part of your family, I have about 10 "goon" avatars/artwork (+ retina) already and am hitting a problem.

The problem is that for every avatar I imply a character (with stats), so if I have,

avatar001.png = {Character: Bob Health: 100 Skills: ... }
avatar002.png = {Character: Mike Health: 100 Skills: ... }
avatar003.png = {Character: Alan Health: 100 Skills: ... }

The implication is that these 10 pieces of artwork I have are 10 specific characters, with specific names and stats.

This causes me a problem in that in order to get a good selection of goons, I'm going to need a lot more than 10 avatars; probably even in the hundreds if not thousands.

Bottom line, To do this, it's going to be expensive.

The way Tiny Tower did it was to have a template and use this, and I've thought of a similar solution -- a faceset generation tool, but I'm mot sure if its going to work; all the current goon avatars I have are custom designed and would not lend themselves to 1-4 generic face templates.

The only solution I have right now is to,

  Just use the 10 avatars I have and randomly generate the name, stats,
  class levels or whatever  -- and don't worry about it.

But I don't know if this is good enough and I'm looking for alternative solutions -- how would you create character avatars without spending loads on literally thousands of avatars?

Thanks.

sentences:
Selecting/Hiding is broken for Perspective but works for Orphographics views. Why? I'm learning Unreal4. Got a problem with selecting, focusing and hiding objects.

Focusing Issue: Focusing have to be done separatly for perspective view and ortho view. Why it is so?

Example: If I select an object in perspective view and focus on it (key F) everything works only for perspective view, but at the same time in ortho view no focusing occurs. So inorder to focus on the object in the ortho plales too I have repeat the whole process again: find object in orpho plane, select it, click F and only then focusing happens in all ortho view planes.

In perspective view "Show only selected" does not work, but works in ortho views
The same issue with "Show all actors".

Please, I need help. Thnaks.
P.S. Damn, it looks like I'm in some kind of a mode (for the lack of a better word). I mean in my clicking around, i've clicked ON some mode and now this selection\hiding thing works buggy...

sentences:
Can I use New York City in my game? I want to make game more realistic, for that I need a city. So, I decided to take New York City, as it can be seen through Google Maps with Street View, 3d view and much more and will help me a lot to make realistic game.

So, my simple question is: Can I use the whole New York City in my game and publish it commercially?

sentences:
Using Unitys URP how to make sprites lit by 3D Lights again? I'm working on 3D game and I converted my project to URP. Everything works fine expect sprites that previously were 'Sprite/Diffuse' so they were lit by 3D lights (kind of Doom style, 2D elements in 3D world, always facing you). But now 'Sprite/Diffuse' shader is not supported in URP, it converted my materials to use 'Universal Render Pipeline/Simple Lit' Shader which does not work with sprites, it's for textures. There is 'Universal Render Pipeline/2D/Sprite-Lit-Default' but it's only for using 2D Lights.
How do I make sprites littable by 3D lights again in URP?

sentences:
Why the canvas text is gray and not really white? This script change the text color to white:

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

public class DisplayInfo : MonoBehaviour
{
    public string myString;
    public Text myText;
    public float fadeTime;
    public bool displayInfo = false;

    // Use this for initialization
    void Start()
    {
        if (myText == null)
        {
            Debug.LogError(myText + " Is null please add Text component !");
        }

        if (myString == "")
        {
            Debug.LogWarning(myString + " Is empty, No text will be display.");
        }

        myText.color = Color.clear;
    }

    // Update is called once per frame
    void Update()
    {
        FadeText();
    }

    void FadeText()

    {
        if (displayInfo)
        {
            myText.text = myString;
            myText.color = Color.Lerp(myText.color, Color.white, fadeTime * Time.deltaTime);
        }

        else
        {
            myText.color = Color.Lerp(myText.color, Color.clear, fadeTime * Time.deltaTime);
        }
    }
}

This is the script i'm using with the DisplayInfo:

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

public class DetectInteractable : MonoBehaviour
{
    public Camera cam;
    public float distanceToSee;
    public string objectHit;
    public Image image;
    public bool interactableObject = false;
    public DisplayInfo displayInfo;
    public Canvas canvas;

    private RaycastHit whatObjectHit;

    private void Update()
    {
        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee))
        {
            if (whatObjectHit.collider.gameObject.tag == "Interactable")
            {
                image.color = Color.red;
                objectHit = whatObjectHit.collider.gameObject.name;
                interactableObject = true;
                displayInfo = whatObjectHit.collider.gameObject.GetComponent<DisplayInfo>();
                displayInfo.displayInfo = true;
            }
            else
            {
                image.color = Color.white;

                if (displayInfo != null)
                    displayInfo.displayInfo = false;
            }
        }
        else
        {
            image.color = Color.white;

            if (displayInfo != null)
                displayInfo.displayInfo = false;
        }
    }
}

When it's "Interactable" then i display the info about this object.

The DetectInteractable is attached to the Player (FPSController) in the hierarchy:

And on each "Interactable" item i attach the script DisplayInfo:
For example the door:

And this is the editor screenshot before running the game:
Display Infomration is Canvas. The Text i set it's color to white in the inspector.

But when running the game the text i see on objects is gray and i see that on the inspector the white is becoming gray: On the game view window there is a text Security Door in fray it's hard to see it. It should be in white and bright enough to see it clear:

sentences:
Check key state or listen for event? Possible Duplicate:
  Polling vs event driven input

I'm trying to teach myself a bit of game development using Pygame, and I'm unsure what's the best way to approach some of the fundamental parts of a game. For example, I've made a tiny 2D game where a sprite can move around the screen, seen from the top like a classic RPG. I'm using an event loop, and whenever I detect the right arrow key being pressed, I start the character walking right, and whenever I detect the key being released, it stops walking right, etc.

My question is if this is the best way to do it, or if it is better to check the state of the key at each step, and move right if the key is down, etc. I originally thought that it would be best to listen for events, as the player might conceivably press and release a key between two timesteps, thus making the game miss the event if it only checks the state of the key at each timestep.

I imagine for things like attack, which would start at or soon after the press of a key, and then last for a certain amount of time regardless of the state of the key, it would be best to listen for events. For things like movement, however, which typically lasts for as long as the key is pressed, it might be better to check the state of the key.

Any thoughts? Also, any links to a tutorial or textbook on game design which discusses these kinds of low level decisions would be great.

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:
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: Using non-copyrighted music for a paid game I'm making a game. It will be sold and not free. Am I allowed to use non-copyrighted music in it?

sentences:
Creating a 3D text mesh from a 2D glyph I have thought of three steps for doing this:

Acquire the vertex coordinates which will represent the glyph's form
Extrude them
Render

Can you suggest a better method? Can you give me an insight on how to do the first and the second step?

I use FreeType 2.4.10 for text managment.

sentences:
Why does my terrain texture fail to load? (OpenGL) I'm currently using a vertex shader and a fragment shader for loading my texture onto the terrain I made.

Here is my vertex shader

#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

float scale = 0.5;

out vec2 TexX;
out vec2 TexY;
out vec2 TexZ;
out vec3 blend_weights;

void main()
{
    vec3 blend_weights = abs(aNormal.xyz);
    blend_weights = (blend_weights - 0.2) * 0.7;
    blend_weights = max(blend_weights, 0);
    blend_weights /= (blend_weights.x + blend_weights.y + blend_weights.z);

    TexX = aPos.yz * scale;
    TexY = aPos.zx * scale;
    TexZ = aPos.xy * scale;

    gl_Position = projection * view * model * vec4(aPos, 1.0);
}

And here is my fragment shader.

#version 330 core
out vec4 FragColor;

uniform sampler2D terrainTexture;

in vec2 TexX;
in vec2 TexY;
in vec2 TexZ;

in vec3 blend_weights;

void main()
{
    FragColor = texture(terrainTexture, TexX)*blend_weights.x + texture(terrainTexture, TexY)*blend_weights.y + texture(terrainTexture, TexZ)*blend_weights.z;
}

I was trying to implement 3D texture planar projections, based on section 1.5 of this link
https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch01.html

If I just try to implement the texture in a very simple way, it works (which looks terribly stretched on the mountanous terrains, of course). But if I implement it this way, the texture does not load. What could be the possible reason?

Just in case anyone is wondering, the following is my VAO, VBO, EBO configuration

// VAO, VBO configuration
    unsigned int VAO, VBO, EBO;
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &VBO);
    glGenBuffers(1, &EBO);

    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, positions.size()*sizeof(glm::vec3) + normals.size() * sizeof(glm::vec3) , NULL, GL_STATIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER, 0, positions.size() * sizeof(glm::vec3), &positions[0]);
    glBufferSubData(GL_ARRAY_BUFFER, positions.size() * sizeof(glm::vec3), normals.size() * sizeof(glm::vec3), &normals[0]);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(int), &indices[0], GL_STATIC_DRAW);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)(positions.size() * sizeof(glm::vec3)));

This is my draw function

// Inside the render loop
void drawScene(Shader &shader, unsigned int VAO, unsigned int numIndices, unsigned int texture1)    //draw the scene with the parameter data.
{
    glm::mat4 model;
    model = glm::translate(model, glm::vec3(-(int)(gridXNum)/2, 0.0f, -(int)(gridZNum)/2));
    glm::mat4 view = camera.GetViewMatrix();
    glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);

    shader.use();
    shader.setMat4("model", model);
    shader.setMat4("view", view);
    shader.setMat4("projection", projection);
    shader.setFloat("TERRAIN_WIDTH",gridXNum);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture1);

    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLE_STRIP, numIndices, GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);
}

However, I really don't think this is the problem because as I said, if I change the shader codes into a really basic one, the texture successfully loads. There is definitely something wrong with my shader program. Any help would be appreciated. Thanks in advance!

sentences:
Is there a significant importance in what axis I chose in my top down 2.5D game? I have read several posts stating what seems like a "standard" in how to chose your 2d axises in a 3d engine. It is often Y up on screen and X right on screen. However, in these examples I often see that it's a scene set up like a platformer, where the player sees the world from the side.

I'm developing a top down 2.5D (locking depth axis but keeping perspective on camera) game and I have it setup so that Z is up on the screen and X is right on the screen. To me it makes sense as Y is height in the world and thus would approach the camera. I will make use of the 3d world at certain times and I feel that it would be confusing to not have the standard axises then...

Is there something I'm not thinking about here?

sentences:
Emulating 3d trajectory in top-down 2d game? As the title suggests, I am wondering if it's possible to emulate a 3d arrow trajectory to a top-down 2d game? If you would look at this clip of Age of Empires 2 game, especially when archers are firing from bottom to top. Can the parabola/arc of the trajectory (in that certain view angle) be emulated in a 2d orthographic, top-down game? So that the arrows would look like they're in 3d space. I know it's tricky but I wonder if there's some computation available for this.

If you could point me in the right direction or some sample code I would be very grateful. I've only implemented this projectile motion in a side-scroll view.

Thank you in advance.

sentences:
The Pixel Shader unit expects a Sampler configured for default filtering to be set at Slot 0 [...] I don't understand this error. The full output being :

  The Pixel Shader unit expects a Sampler configured for default
  filtering to be set at Slot 0, but the sampler bound at this slot is
  configured for comparison filtering.

Here is how I create the sampler state.

// Skybox sampler description
D3D11_SAMPLER_DESC skyboxSamplerDesc;
ZeroMemory(&skyboxSamplerDesc, sizeof(D3D11_SAMPLER_DESC));
skyboxSamplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
skyboxSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
skyboxSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
skyboxSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
skyboxSamplerDesc.MipLODBias = 0.0f;
skyboxSamplerDesc.MaxAnisotropy = 16;
skyboxSamplerDesc.ComparisonFunc = D3D11_COMPARISON_EQUAL;
skyboxSamplerDesc.MinLOD = 0;
skyboxSamplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

// Create the skybox texture sampler state
hr = g_d3dDevice->CreateSamplerState(&skyboxSamplerDesc, &g_SkyboxSamplerState);
if (FAILED(hr)) return false;

The bindings.

ID3D11SamplerState* samplerStates[2];
samplerStates[0] = g_SkyboxSamplerState;
samplerStates[1] = g_PixelDepthSamplerState;
g_d3dDeviceContext->PSSetSamplers(0, 2, samplerStates);

HLSL side.

SamplerState sbSamplerState : register (s0) {
    Filter = MIN_MAG_LINEAR_MIP_POINT;
    AddressU = CLAMP;
    AddressV = CLAMP;
    AddressW = CLAMP;
    ComparisonFunc = EQUAL;
};

sentences:
Unity 5.6.0f3 Inspector Tooltips are off in macOS, is me or everyone the same? Running latest version (5.6.0f3) in macOS, my tooltips are always misalign to the left of my screen, is me or anyone else also experience the same? And, it is still misalign even after I reset the layout setting to factory default.

Here are the screenshots http://imgur.com/a/dR0Pv

Update: Filed a bug report.

sentences:
How do I find voxels along a ray? I am making a voxel engine, and I want to make it possible to create and destroy voxels with the mouse. I use C++ and OpenGL, so C++ examples would be best.

So far, I have the camera position and appropriate angle as Vector3 values. I need to find voxels along a ray extending from the camera position along the angle. I tried to solve it myself, and essentially came up with a slow, 3D version of Bresenham's line. This would be okay, but it skips diagonals, meaning if I point toward the edge of a voxel, it usually misses.

The "bad" line skips over where the line crosses diagonals, while the good line hits them. I currently have the bad, but I want the good:

I have tried reading around this, but most of what I find relates to sparse octree rendering.

sentences:
Recursively calculate possible pathway on a grid depending on max walk distance I have a character that is placed on a grid. It has a variable maximum walking distance. Grid fields can be walkable or not walkable. As the character may has to walk around certain not walkable fields to reach his destination his maximum walking distance isn't allways represented by a circle.

See these examples:

Without obstacles, walking distance 7:

With obstacles, walking distance 7:

Note how the obstacles affect the players maximum walking distance

To calculate this i've written this recursive function:

static Vector2Int[] GetWalkableFields (Vector2Int position, int steps) {
    List<Vector2Int> walkableFields = new List<Vector2Int>();

    if (steps > 0) {
        foreach (Vector2Int v in GetNearbyFileds(position)) {
            if (m_mc.IsInBounds(v) && m_mc.IsWalkable(v.x, v.y)) {
                walkableFields.Add(v);
                walkableFields.AddRange(GetWalkableFields(v, steps - 1));
            }
        }
        return walkableFields.ToArray();
    } else {
        Vector2Int[] v = { position };

        return v;
    }
}

And this function, that returns all four neighbour fields of a field:

public static Vector2Int[] GetNearbyFileds(Vector2Int position) {
    Vector2Int[] neighbors = new Vector2Int[4];
    neighbors[0] = new Vector2Int(position.x, position.y - 1);
    neighbors[1] = new Vector2Int(position.x, position.y + 1);
    neighbors[2] = new Vector2Int(position.x - 1, position.y);
    neighbors[3] = new Vector2Int(position.x + 1, position.y);

    return neighbors;
}

The function is called with the players position and maximum walking distance (steps) and get's the four neighbour fields and unless the steps are zero calls itselve for every neighbour field with the maximum walking distance decremented.

As you can see in the screenshots, this works absolutely fine. The problem is, as the calculation not only goes away from the player but, in some recursion paths, goes back and fourht between tiles until stepcount zero is reached without even having traveled one field, that this way of calculating the path is really resource heavy. For a walking distance of 7 there are 27646 possible walkways that all are getting calculated. If a player is able to walk 11 fields the calculation takes a few seconds, if he can walk 12 fields Unity crashes while calculating.

Is there a way to calculate this more efficient?

Thank you in advance.

sentences: Phaser Editor / Phaser 2 Resize State I’m working with Phaser Editor, and I was wondering if it was possible to resize the scene with the editor or just plain Phaser 2. I want to resize the world, by which I mean to make a camera follow the player past the screen, but I can’t figure out how in the docs for phaser 2 or phaser editor. Can someone help?

sentences:
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:
Is there a way of using XNA+Xbox 360 with the current generation of 3D televisions? I'm interested in playing around with 3D on a new Sony 3D television (polarized light rather than red/green/blue anaglyph glasses).  Is this possible with XNA on the current XBox 360?

Alternatively, It doesn't look like there is a comparatively trivial PS3 dev. solution to XNA right now, hence my interest in XNA and the 360.

Regards,

sentences:
screen coordinate not working with pixel values I have a very simple effect file shown below. I am using this to draw 2D lines, however it is not behaving how I expected and I can't seem to get my head round why.

If I draw a line that goes from 0,0 to 100, 100 for example, I would expect it to draw a line from one corner of the screen to a little way in. I would expect it to treat these numbers as screen coordinates. Instead, the line is huge! A line of about 2 long fills the whole screen. Why is this? How can I modify my shader to 'think' in screen coordinates?

// a struct for the vertex shader return value
struct VSOut
{
float4 Col : COLOR;    // vertex color
float4 Pos : SV_POSITION;    // vertex screen coordinates
};

// the vertex shader
VSOut VS(float4 Col : COLOR, float4 Pos : POSITION)
{
VSOut Output;
Output.Pos = Pos;    // set the vertex position to the input's position
Output.Col = Col;    // set the vertex color to the input's color

return Output;    // send the modified vertex data to the Rasterizer Stage
}

// the pixel shader
float4 PS(float4 Col : COLOR) : SV_TARGET
{
return Col;    // set the pixel color to the color passed in by the Rasterizer Stage
}

// the primary technique
technique10 Technique_0
{
// the primary pass
pass Pass_0
{
    SetVertexShader(CompileShader(vs_4_0, VS()));
    SetGeometryShader(NULL);
    SetPixelShader(CompileShader(ps_4_0, PS()));
}
}

sentences:
Problem with stencil in directx 12 I'm trying to use stencil buffer in directx 12. I have problem that probably is really easy to solve.
So, it's look like dx12 ignore it, ClearDepthStencilView() affect only depth, writing to stencil doesn't work.

D3D12_DEPTH_STENCIL_DESC for PSO:

static D3D12_DEPTH_STENCIL_DESC const defaultDepthStencil =
{
    /*DepthEnable*/                         TRUE
    /*DepthWriteMask*/                      ,D3D12_DEPTH_WRITE_MASK_ALL
    /*DepthFunc*/                           ,D3D12_COMPARISON_FUNC_LESS
    /*StencilEnable*/                       ,TRUE
    /*StencilReadMask*/                     ,D3D12_DEFAULT_STENCIL_READ_MASK
    /*StencilWriteMask*/                    ,D3D12_DEFAULT_STENCIL_WRITE_MASK
    /*FrontFace.StencilFailOp*/             ,{ D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilDepthFailOp*/        ,D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilPassOp*/             ,D3D12_STENCIL_OP_REPLACE
    /*FrontFace.StencilFunc*/               ,D3D12_COMPARISON_FUNC_ALWAYS }
    /*BackFace.StencilFailOp*/              ,{ D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilDepthFailOp*/         ,D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilPassOp*/              ,D3D12_STENCIL_OP_REPLACE
    /*BackFace.StencilFunc*/                ,D3D12_COMPARISON_FUNC_ALWAYS }
};

DSV heap desc:

D3D12_DESCRIPTOR_HEAP_DESC dsvHeapDesc = {};
    dsvHeapDesc.NumDescriptors = 1;
    dsvHeapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
    dsvHeapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;

DSV desc:

D3D12_DEPTH_STENCIL_VIEW_DESC depthStencilDesc = {};
    depthStencilDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    depthStencilDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D;
    depthStencilDesc.Flags = D3D12_DSV_FLAG_NONE;

Resource desc:

m_gBuffer[GB_Depth].Dimension( D3D12_RESOURCE_DIMENSION_TEXTURE2D );
m_gBuffer[GB_Depth].Width( m_width );
m_gBuffer[GB_Depth].Height( m_height );
m_gBuffer[GB_Depth].DepthOrArraySize( 1 );
m_gBuffer[GB_Depth].MipLevels( 1 );
m_gBuffer[GB_Depth].Format( DXGI_FORMAT_R24G8_TYPELESS );
m_gBuffer[GB_Depth].SampleCount( 1 );
m_gBuffer[GB_Depth].Layout( D3D12_TEXTURE_LAYOUT_UNKNOWN );
m_gBuffer[GB_Depth].Flags( D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL );

Then OMSetRenderTargets() and ClearDepthStencilView() with flags D3D12_CLEAR_FLAG_DEPTH, D3D12_CLEAR_FLAG_STENCIL.

Any idea what's missing?

sentences:
Unity C# Invoke Function Freezes Program if(Input.GetKeyDown(KeyCode.G) && ammo <= 9)
        {
            ableS = false;
            while(ammo <= 9)
            {
                Invoke("bulletplus", 0.5f);
            }
            ableS = true;
        }

This is the main part I am having trouble with.
Down there is ALL my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class gun : MonoBehaviour
{
    Vector2 rotation = new Vector2 (0, 0);
    public float rot = 3;
    public Vector3 pos;
    public Rigidbody Orb;
    public Text ammoT;
    public int ammo = 10;
    bool ableS = true;

    void Update () {
        // Ammo
        if(ammo >= 7)
        {
            ammoT.GetComponent<Text>().color = Color.green;
        } else if(ammo >= 4)
        {
            ammoT.GetComponent<Text>().color = Color.yellow;
        } else {
            ammoT.GetComponent<Text>().color = Color.red;
        }

        // Rotation
        rotation.x += -Input.GetAxis ("Mouse Y");
        rotation.x = Mathf.Clamp(rotation.x, -70, 70);
        rotation.y += Input.GetAxis("Mouse X");
        transform.eulerAngles = (Vector2)rotation * rot;
        pos = new Vector3(transform.position.x, transform.position.y, transform.position.z);

        // Shoot Choklats
        if(Input.GetMouseButtonDown(0) && ammo >= 1 && ableS)
        {
            ammoT.text = "Ammo: " + ammo.ToString();
            ammo -= 1;
            Rigidbody projectile = Instantiate(Orb, pos, transform.rotation);
            projectile.velocity = transform.forward * 50f;
        }

        // Reload
        if(Input.GetKeyDown(KeyCode.G) && ammo <= 9)
        {
            ableS = false;
            while(ammo <= 9)
            {
                Invoke("bulletplus", 0.5f);
            }
            ableS = true;
        }
    }

    void bulletplus()
    {
        ammo += 1;
        ammoT.text = "Ammo: " + ammo.ToString();
    }
}

sentences:
Unity Grid Shader line Color First of all I'm sorry if my question is a odd thing to ask, but i'm new to Shader things and don't know how to handle this stuffs.
I have a shader that draws grid on a ground plane and it works just fine.
But i wanna do one thing more.
Currently the color of the grid lines are all in same color. I want to set the main grid line's color differently.
for example, like this one :

and this is what i have now :

for example, every 4x4 or 2x2 the line color should be something like red / blue etc.
I'm adding my shader's code below. plz somebody help me figure this out.
Shader "Unlit/Grid"
{
    Properties
    {
         _GridColour("Grid Colour", color) = (1, 1, 1, 1)
        _BaseColour("Base Colour", color) = (1, 1, 1, 0)
        _GridSpacing("Grid Spacing", float) = 0.1
        _LineThickness("Line Thickness", float) = 1
    }
    SubShader
    {
       Tags { "RenderType" = "Transparent" "Queue" = "Transparent"}
        LOD 100

        Blend SrcAlpha OneMinusSrcAlpha
        ZWrite Off

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            fixed4 _GridColour;
            fixed4 _BaseColour;
            float _GridSpacing;
            float _LineThickness;

            v2f vert(appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = mul(unity_ObjectToWorld, v.vertex).xz / _GridSpacing;

                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                float2 wrapped = frac(i.uv) - 0.5f;
                float2 range = abs(wrapped);

                float2 speeds;
                /* // Euclidean norm gives slightly more even thickness on diagonals
                float4 deltas = float4(ddx(i.uv), ddy(i.uv));
                speeds = sqrt(float2(
                            dot(deltas.xz, deltas.xz),
                            dot(deltas.yw, deltas.yw)
                         ));
                */  // Cheaper Manhattan norm in fwidth slightly exaggerates thickness of diagonals
                speeds = fwidth(i.uv);

                float2 pixelRange = range / speeds;
                float lineWeight = saturate(min(pixelRange.x, pixelRange.y) - _LineThickness);

                return lerp(_GridColour, _BaseColour, lineWeight);
            }
            ENDCG
        }
    }
}

sentences:
Real-time MMO: how should authoritative server update client position I'm trying to build a real-time MMO game. I'm using Phaser for FE and Node.js + socket.io for BE. I have read all the tutorials like http://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html and so on.

Different players might have different FPS, this is how I update position on the client:

const data = {
  down: this.cursors.down.isDown,
  timestamp: Date.now()
};

var deltaTime = (data.timestamp - this.lastTimestamp) / 1000;
if (data.down) {
    player.position.y += speed * deltaTime;
    socket.emit('input', data);
}

This ensures speed is FPS independent (every player is moving with the same speed).

The server is running a tick at 60 FPS. This method is processing saved inputs from players.
How should the server correct player positions? It doesn't know their delta times. It can't use server's delta time since it would be always around 0.016 and it doesn't reflect player's update interval.

tick() {
    var now = Date.now();
    var serverDelta = (now - this.prevTimestamp) / 1000;
    this.prevTimestamp = now;

    for (var player of players) {
        player.update();
    }
}

player.update() {
    for (input in savedInputs) {
          player.y += input.down * speed;
    }
}

sentences:
Farseer: How can I break a body into multiple pieces? I created a breakable body but the pieces are not flying around if the ball touches it. What is wrong? Why is the breakable body not breaking into pieces?

I made a video and I enabled debugview, so you can see the bodies:

http://www.vidup.de/v/ihW2L/

//create the breakable body
BreakableBody Polygon;
List<Vertices> list = new List<Vertices>();
Vector2 _origin;
float _scale;
PolygonSprite = Content.Load<Texture2D>("polyplatform");
uint[] data = new uint[PolygonSprite.Width * PolygonSprite.Height];

PolygonSprite.GetData(data);
Vertices textureVertices = PolygonTools.CreatePolygon(data, PolygonSprite.Width, false);
Vector2 centroid = -textureVertices.GetCentroid();
textureVertices.Translate(ref centroid);

_origin = -centroid;
textureVertices = SimplifyTools.ReduceByDistance(textureVertices, 4f);

list = BayazitDecomposer.ConvexPartition(textureVertices);
_scale = 1f;
Vector2 vertScale = new Vector2(ConvertUnits.ToSimUnits(1)) * _scale;
foreach (Vertices vertices in list)
{
  vertices.Scale(ref vertScale);
}

Polygon = new BreakableBody(list, world, 1);
Polygon.MainBody.BodyType = BodyType.Static;
Polygon.MainBody.Position = new Vector2(graphics.GraphicsDevice.Viewport.Width / 200f, graphics.GraphicsDevice.Viewport.Height / 200f + 1.15f);
Polygon.Strength = 2;
Polygon.MainBody.CollisionCategories = Category.Cat11;
world.AddBreakableBody(Polygon);

//Draw the breakable body
spriteBatch.Draw(PolygonSprite, ConvertUnits.ToDisplayUnits(this.Polygon.MainBody.Position), null, Color.White, this.Polygon.MainBody.Rotation, _origin, _scale, SpriteEffects.None, 0f);

sentences: How to get and use delta time I have mice looking and walking in my game, but they are very slow and hard to use. I think it's because I'm using fixed speed. I heard that in big projects developers use delta time. How do I calculate delta time in glut? How do I calculate speed using delta time?

sentences:
Call Unity3D coroutines from a scripting language I created a simple scripting language to use on a Unity3D game. My parser generates an AST with nodes for every type of operation, and to run the script all I need to do is call Execute() on the root of the tree, which propagates recursively to every node in it.

To run functions from my script, I first create a dictionary linking function names to delegates, and the function node simply needs to look it up run it.

But I have ran into a problem now... Some of the functions I need to call from the script are coroutines that take time to execute, such as WalkTo or WaitNSeconds, and for those coroutines I need to halt the script execution until they are done.

I'm stuck on figuring a way to halt the script execution, as once I call Execute() on the root node, the script gets executed recursively all the way.

Just to provide some more context, here are some examples of a few possible types of nodes and how they operate (not the actual nodes from my language, but close enough). Some nodes simply call Execute() on their children and return nothing. Some nodes simply return values directly. Other nodes get values from their children and modify it in some way.

abstract class Node
{
    object Execute();
}

class RootNode: Node {
    List<Node> Children;
    object Execute() {
        foreach(Node node in Children)
            node.Execute();
        return null;
    }
}

class NumberNode : Node {
    int Value;
    object Execute() { return Value; }
}

class SumNode : Node {
    Node Left;
    Node right;
    object Execute() {
        return (int)Left.Execute() + (int)Right.Execute();
    }
}

class PrintNode : Node {
    Node Expression;
    object Execute() {
        Console.WriteLine(Expression.Execute().ToString();
        return null;
    }
}

class FunctionNode: Node {
    string Name;
    object Execute() {
        return SymbolTable.FindFunction(Name)();
    }
}

sentences:
Deciding when to switch focus between UI elements I've been coding a simple logic game recently and there is a UI decision that has been bothering me.

Since certain blocks of logic are going to be used across many levels (e.g. logic to reverse the input queue) I decided to add a template feature, allowing the user to name and save blocks of logic.

As it stands, I simply have a text field in which to enter the template name. While the game is primarily played with the mouse, some keys are used as controls (w, a, s, d, space, delete). This creates the requirement of deciding when to take focus away from the text field. Some decisions are obvious (e.g. when the user presses the New Template button and the template is created) but others, not so much. For example, the user clicks the text field, then decides not to create a template.

While one option is to simply pop up a dialog and remove the text field from the main UI altogether, I was trying to avoid this. Does anyone have any thoughts on what would be a good trigger for taking focus away from the text field? Or do you think I should just drop the field and go with the dialog?

sentences:
How do I create a horizontally centered "gravity line"? Here's my ideal scenario: A game object (in blue) can change its horizontal velocity, but it will be pulled back by gravity (dotted gray arrows) toward a central vertical line (in red).

How can I do this?

sentences:
cocos2dx: RunningScene != Scene You just Replace I have this code for cocos2d-x 3.x:

void MainMenu::StartGame(cocos2d::Ref* pSender)
{
    auto director = Director::getInstance();
    auto newScene = Scene::create();
    director->replaceScene(newScene); //run
    Scene *maybeNewScene = director->getRunningScene();
    CCASSERT ( maybeNewScene == newScene , "...") ;          //Assert Fail

    auto hudLayer= HUD::create();
    hudLayer->setPosition(Vec2::ZERO);
    scene->addChild(hudLayer, Z_NORMAL);
}

But When I get runnign scene by director->getRunningScene(), It gives me the scene which was running before calling director->replaceScene(). (the scene which is going to be destructed soon)

When I checked replaceScene() function, This function places newScene in some varibale called _nextScene but not assigned it to _runningScene .

Question:  How can I access newScene, just some lines further? ( for example in HUD::init())

sentences: Using NumPy arrays as 2D mathematical vectors? Right now I'm using lists as position, velocity, and acceleration vectors in my game.  Is that a better option than using NumPy's arrays (not the standard library's) as vectors (with float data types)?  I'm frequently adding vectors and changing their values directly, then placing the values in these vectors into a Pygame Rect.  The vector is used for position (because Rects can't hold floats, so we can't go "between" pixels), and the Rect is used for rendering (because Pygame will only take in Rects for rendering positions).

sentences:
Where to hire a scenario writer for a small interactive story game? I need a scenario for a small dialog-based game / interactive story. The game would be used as an example to be shipped with a middleware tool we're developing.

I would like to buy an existing story (it should be dynamic of course — with branching dialogs etc.), or hire someone to write a new one.

Please advise, where to go to find such person / service? We're based in Russia, so getting a talented enough native English writer locally is a bit of a problem.

Update: To be extra clear: We must get all necessary rights to reuse the story and make a derived work (i.e. the game we're talking about) from it. This is a commercial product. Borrowing someone else's work at random and using it just not going to work.

WARNING: Please do not post "I can do it" answers here. This is not a job board! You will get downvoted and your answer will be deleted. If you really want to contact me, look into my profile.

sentences:
Making Modular Mini's Work in TTS This is not exactly game development, and I have also posted this in Arqade but it is development of a virtual playable version of a board game so maybe it loosely fits. Im hoping someone has an idea either way, or can point me to the right place to post this to get better results.

I am working to create a Tabletop Simulator mod for a newly Kickstarted game: Shiver Me Timbers.

https://www.kickstarter.com/projects/shivermetimbers/shiver-me-timbers-0/description

I have gotten all of the game pieces into the mod, all of the cards, tokens, tiles, I even made 3D models of the standees.

Where I am getting stuck is the pirate ship miniatures. These modular miniatures are what you use to move around the board. In the game one of the things you can do is upgrade your ship. When you upgrade the ship, or get damaged in some way, (IRL) you physically add or remove pieces from the mini (when you upgrade your hull you pull apart the front and back of the ship and add another hull section in between and put them back together, when you upgrade sails you add a different Mast to the ship, when upgrading cannons you push a new cannon into one of the holes in the side of the ship, when taking damage to any of these areas the opposite. You can see how this works in the different GIFs on the kickstarter page above). Each ship can have a maximum of up to 7 hulls, 7 sails, 7 cannons or any combination in between. Also each "hull" piece has a disk/wheel in it that determines what type of cargo you are carrying.

The problem I am running into is making the different components come together in a way that 1. stays together when moved, 2. is able to later be removed, and 3 allows for the disks to rotate/change as needed.

I originally thought about just using different states for each configuration of the mini but that would turn out to be 343 states for just the ship (not to mention the 4 positions each cargo disc can be in) and creating that many states for one mini would not only take an insane amount of time making the 3D models, but would be a HUGE number of assets for the game to load, and be extremely confusing when trying to find the correct state for the configuration you need.

I did decide (potentially incorrectly) to have set it up to use states for the 7 different hull configurations, and use the fixed joint tool to attach the cargo disks and that works, as long as you have each hull state set to be attached to the disk, or if you have each disk state (4 different states for the cargo types) set to attach to the base. But if I have both items having multiple states if I change the one that the Joint is going TO then it breaks and the disks fall out.

The other issue with the mini's is attaching Sail Masts and Cannons. If I bring in the basic ship base and attempt to add a piece to it (aka one of the masts) I can create a snap point that allows it to fit to the correct spot but it always immediately falls over and off of the ship.

I have thought about using the attach tool, but once you place the new part onto the base of the mini, by the time you can get to the attach tool and use it the new part has fallen off or fallen over. It cant just be pre-done (with a gizmo on a locked object or something) because the players have to be able to modify mid game.

I have enough ability with blender to work these models some (though still a bit of a beginner) and I have been trying to learn unity so that I can use the higher poly count ship models (the texturing was done with 3D geometry not a texture png) and set them up to be asset bundles. I have done a tiny bit of work with collider geometry in blender/unity. I also have a minor amount of programming ability and could muddle through learning LUA and doing some scripting to make it work if that is the solution.

Does anyone have any ideas how to make these "Modular" mini's a reality in the virtual space of TTS? Any Ideas are welcome. I Really want to figure this thing out. Thanks in advance.

sentences:
Specular reflections shine at the wrong angle when using a normal map I'm using Unity with URP and I'm trying to include a normal map in my shader graph.
Here is a basic graph that just display a normal map, with properties to control tiling and smoothness.

When I render the scene, the sun reflection highlights the wrong parts of the surface.
In this example, we can see the shadow direction of the cube, and the light itself. The sun reflection is clearly at the wrong place.

I tried with several normal maps from the web, all maps behave exactly like this one, so I think I'm missing something.
Ah, and strangely, when I rotate the object, the light reflection origin seems to change!
Of course, without the normal map, the light reflects gracefully.

What am I missing?

sentences:
I'm trying to write a randomly patrolling AI for my 2D Platformer I'm trying to write a randomly patrolling AI for my 2D Platformer. The AI already has a ground checker function which checks if there are tiles nearby or not. What I want to do is randomize its actions and create an illusion of a somewhat "sentient" enemy. What I tried to create below is using the built in RNG to make the enemy either jump, change direction, or keep moving.
The problem is, it doesn't seem to work properly. The enemy just jumps every second I want it to change behaviour. The change direction functions, however, don't occur as frequently. I need to know what I've done wrong here. Thanks.
void Update()
{
      //RNG
      behaviour = Random.Range(0,3);
      jumpSpeed = Random.Range(1,5);

      //clock
      timer += Time.deltaTime;
}

  //time
    private float waitTime = 2.0f;
    private float timer = 0.0f;

 void MoveRandomizer()
{
    if((Mathf.Round(timer%waitTime)) == 0)
    {
        if(behaviour == 0)
        {
        movingRight = false;

        }
        if(behaviour == 1)
        {
        movingRight = true;

        }
        if(behaviour == 2)
        {
        rb.velocity = new Vector2(rb.velocity.x, jumpSpeed);
        }
    }

}

sentences: How do i keep the image size proportionate after camera size change Basically, I want to keep an image the same size on the screen maximized as it would be minimized. Is there any way to do this without a script?

sentences:
Why doesn't this formula double the value properly? Making a clicker game: Amount awarded per click not increasing based on how many increasers purchased.

I have a few global variables set up.

global.ramen_1 = 1

This part says how many ramen makers I have,
or what my cursor level is, if you purchase another one it goes to 2, then 3 etc...

global.ramen_1_bonus = (global.ramen_1 * 2)

This is the formula that I want to work. If I own 10 ramen makers. Every time I click the ramen picture it is going to increase based on the value of global.ramen_1 times by two. So in theory the more I buy, the higher it should go up when I click it.

I made the ramen image and clicking on it does the following code.

//Increases the amount of money by clicking the ramen
global.money += global.ramen_1_bonus

I have the object that you click that does this code which subtracts from the amount of money you have, but increases the amount of ramen makers you have. And for the time being I just have a static price, nothing that increases yet.

if (global.money >= 10) {
    global.money -= 10;
    global.ramen_1 += 1;
}

This works perfectly, ramen_1 goes up by one, the money goes down by ten when you have enough.

BUT

After I have 2 ramen makers or global.ramen_1 = 2. The formula does not work.

When I click on the ramen bowl, my money doesn't go up 4 like it's supposed to, it still only goes up by two. Why not?

sentences:
Unity 2d sprite repeated as background I'm a web developer with over 12 years of experience and I'm moving my first steps in game development in the latest days. Specifically I'm playing with Unity and trying to understand how it works and how can I realize a 2d platform game. Currently I created a character that can be controlled with the keyboard (it moves to right, left and can jump), so far it seems more easy than I was expecting and despite I never used C# before I'm already quite comfortable. My first big concerning is about sprites and how can I create combined sprites or use an image as a repeated background.
For example, let's imagine that I have a png of a brick and that I want to use it to create a wall, that can be of a variable width and height. How can I achieve that? With html/css I would simply create a class like this:

.wall {
    background: url(brick.png);
}

and by applying that class to any html element it will render a repeated background by adapting it to its container no matter how large or tall is it. In unity/C# what should I do?

So far I tried to create a new material and applied it to a cube object but the result is that the image gets stretched and sucks.
I saw some example that creates N sprites programmatically by adding them one after another, but I wonder about the performance implications of this technique... for example if I have to repeat the brick 100 times I have to create 100 objects, it seems unfeasible to me!
What I want to achieve is the most flexible, simple and performant way to create "shapes" with repeated background.

sentences: Modifying UV's origin on shader (OpenGL) Is there a way to change the UV's origin (bottom-left) on shader?

sentences:
Get rid of the usual MUD cycles I am working on a MUD engine and I want to do it a little differently then all the MUD games I played. I find a "cycle" system very boring. One of the idea I had is to make every clients socket working in their own Thread. I am aware that it wont end with hundreds of player but I would like to know if there are problems creating "alot" of thread in a single process.

Or, what other strategy I could use if I want to make it (eg. combats) in "real-time".

I hope you guys understand the question.

Thank you.

sentences:
TextMesh Pro conflict in Unity2019.1.5f1 I'm having an issue with Textmesh Pro in my project. I originally got it from the Asset store a few months ago. More recently, I deleted it and downloaded it from the Package Manager. However, now in my scripts I'm getting the following error when using TextMeshPro class in my scripts:

  The type 'TextMeshPro' in '/Users/unityj/Documents/unity
  vscode/VSCode/FirstGame/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TextMeshPro.cs'
  conflicts with the imported type 'TextMeshPro' in 'Unity.TextMeshPro,
  Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type
  defined in '/Users/unityj/Documents/unity
  vscode/VSCode/FirstGame/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TextMeshPro.cs'.
  (CS0436) [Assembly-CSharp]

Tried to uninstall the package via package manager, deleting the package folders, deleting everything that mentions 'TextMesh Pro' and 'TMPro', reimporting all, and reinstalling, but I still get the error. Once TextMesh Pro is uninstalled, the class can't be accessed.

Asset Serialisation mode is set to 'Force Text' and I've set .Net4.x in the Player Settings

Making a new project does not replicate the problem, so I know it's a problem specific to my project, but I don't know where to start. Any suggestions would be appreciated.

sentences:
How do I enable and disable objects with a certain tag in C#? I have a script that is supposed to find every active object with a certain tag and on the push of a button enable and disable it's meshrenderer and collider. but the script only tries to enable and disable the previous on the object the script is attached to. what am i doing wrong and is there any feasible way to do this?

I've checked all tags, but the script keeps trying to reach this unrelated object. i even tried adding a mesh renderer and a colider. but nothing

here is the script:

private bool on = true;

public void Update()
{
    GameObject[] gameObjectArray = GameObject.FindGameObjectsWithTag("buildnode");

    if (Input.GetKeyDown("b"))
    {
        on = !on;
    }

    if (on == false)
    {
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("buildnode"))
        {
            go.GetComponent<MeshRenderer>().enabled = false;
            go.GetComponent<Collider>().enabled = false;
        }
    }

    if (on==true)
    {
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("buildnode"))
        {
            go.GetComponent<MeshRenderer>().enabled = true;
            go.GetComponent<Collider>().enabled = true;
        }
    }
}

Thank you and have a good day.

sentences:
2D Hitboxing on an HTML image I want to make a turn-based game where the player is given "opportunities for attack." An image of the in-game sprite character appears when it's the player's turn to attack. The player can mouseover the various parts of the image, which will highlight that specific body part, like so:

The player can then choose to attack that given body part.

To do this, I was thinking of adopting the "grid" method, and put my image within a 2D array... with each region of the body mapped to a certain square, like so:

Or, I could generate a pixelated version of the in-game sprite within a grid to begin with, so I would already have the mappings, like so:

Minecraft Pixel Art

I'm not sure:

how to partition the image up so that each section is represented meaningfully in the matrix
if this is the right way of doing this

Any guidance would be helpful

sentences:
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:
Can I simplify the inequality "distance(p1, p2) < distance(p1, p3)?" I am working on some vector logic, so am asking: can I save processor time by simplifying this inequality:

distance(vector1, vector2) < distance(vector1, vector3)

I see that vector1 is repeated in both cases.

sentences: How to handle day and night in a 2D sprite game Do I need to draw, for example, a tree how it looks in the day (normal colors) and how it looks at night (colors aligned according to the moonlight)? Or does Unity have a function for that?

sentences:
Whats a good setup/toolchain for a project? I was thinking, what is needed for a good setup and what are good (free) tools to use? Some of what i came up with are

Bug tracking
Some good (distributed:P) source control (which means no svn fellas)
automated nightly builds or a continuous integration (or anything that automates builds and possibly sends emails when there are build errors)
wiki to document decisions, road map or milestones.
Something to backup assets (art, sound, etc)

What else? and do you have suggestions for any of the above? i pretty much clueless of all of these except for source control

sentences:
Collision detection across multiple components I have been reading this article: http://gameprogrammingpatterns.com/component.html which describes how a game object should be constructed out of components. It also encourages the decoupling of components, which brings up a problem with input, collision detection, and things that cause events to be triggered.

If I have a game object, which is a player and this player has 3 components; PlayerSoundManager, PlayerCollisionDetection, and PlayerStateManager, how would I go about making sure they have no references to each other? If PlayerCollisionDetection detects that a player should die, messages should be sent to the other two components telling the player to play a death sound, and change it's state.

Would it be wrong to put collision detection methods throughout all components and perform each reaction separately?

sentences:
How to create 2D game terrain? Last month, I experimented a lot in game development using cocos2d for the iPhone, especially on moving and modifying sprites. However, vertices and polygons are still new stuff for me.

I developed an algorithm that creates a set of points. I now want to use them to create my 2D terrain. Here is how it looks like when I connect the points in java, so that you can get the idea

The points are connected with lines. However a real game terrain is a shape that is colored or has a texture overlayed, right? For example:

How could I use my points to create such a terrain?

What I tried so far is I created an array and filled it with my points. I pass this array to this method

void ccDrawPoly ( const CGPoint *  vertices,
    NSUInteger  numOfVertices,
    BOOL  closePolygon
)

  draws a poligon given a pointer to
  CGPoint coordiantes and the number of
  vertices measured in points. The
  polygon can be closed or open

This actually draws a plain shape. But from the blue picture it looks like there is not one shape but many.

Please share you knowledge on how to create 2d game terrain.

Update 03.06.2011

Based on the two good answer I have following result

sentences:
What is the best type of c# timer to use with a Unity game that uses many timers simultaneously? I am developing a stand-alone 3d game in Unity that will have anywhere from 1 to 200 timers running simultaneously. There will be a GameObject containing 1 timer. For this game timer durations will range from 5 minutes to 4 days. There will not be any countdown displays or any UI for the timers.

Each object is a prefab, with all the necessary materials included. An attached script will handle the timer and all the necessary code to change the materials and make any sound effects. Once the timer is expired, the user will then click on the object again, and the object will be destroyed, and the user's inventory will be adjusted.

If the user wants to save or end the game before all the timers are done, the start value of the still running timers is to be saved to an XML file such that when the game is started again, any still running timers will be checked to see if they have expired, where the object's materials will be changed appropriately.

I am still trying to figure out what type of timer to use, and see also if there are any suggestions for saving and calculating times over several days.

What class(es) of timers should I use?
Are there any special issues I should look out for in terms of performance?

sentences: What name (if any) applies to this particular 3D rendering technique? Is there a name for this technique where when instead of rendering certain polygons, you just calculate a few key points and do the drawings in 2d? For instance, instead of rendering a sphere, you just calculate its central vector and draw a 2d circle? And what are the situations one can benefit from it?

sentences:
How to manage my model I have in my model, a list of Classes : Player, NonPlayerCharacter, Monster, Item, NonMovableItem etc

With AndEngine I've a list of sprite for each piece of my model,

How can I manage the relashionship between my model's classes and the graphical elements, what is the degree of abstaction recommended  for my problem?

One sprite for one Model
or one Model for one Sprite or n for n

for exemple If I do drag&drop have I to make abstraction of the Sprite Class, another exemple a map is a List of sprite or a list of element of my model?

sentences:
stats or profit give away result of game Think of a coinflip game, whose logic looks as follows:

Server sends websocket message (RESULT_MESSAGE) to frontend with result of a game (won/lost)
Server sends websocket message to frontend with updated aggregated stats (STATS_MESSAGE) (think all-time profit after the new coin flip, or updated all-time stats)
Frontend reacts to RESULT_MESSAGE by playing an animation (coin flipping). It also updates the all-time stats and profit in response to STATS_MESSAGE

The problem with this logic is, responding to STATS_MESSAGE (updating profit and stats) gives away the result of the coin flip before the animation finishes.

Solutions I cannot use:

Merging RESULT_MESSAGE and STATS_MESSAGE together, and only updating the  stats/profit after animation finishes. Because those 2 messages are produced and sent by different services.
Linking a particular RESULT_MESSAGE to a STATS_MESSAGE and only reacting to a STATS_MESSAGE when its corresponding RESULT_MESSAGE has been processed and its animation completed. Because in reality I have several kinds of STATS_MESSAGES (trophies updated, stats updated, profit/balance updated, etc), and it's just not practical for the frontend to hold onto all those messages until their respective RESULT_MESSAGE is processed

Solutions I've tried successfully before, but I'm trying to avoid:

Having the backend send STATS_MESSAGE with a delay, to make sure it doesn't reach the frontend before the coinflip animation has finished. This sort of encodes frontend behavior (animation) on the backend.

All ideas and suggestions appreciated. Thanks a lot!

EDIT: I made the coin-flipping example for simplicity, but it's not precisely con-flipping. It's a multiplayer game where dozens of games/animations per user per seconds are going on. So queuing a bunch of stuff on the frontend might be less than ideal (I'm still looking into performant versions of this solution though).

Pulling the STATS data via an API call when the animation finishes (instead of using websockets data) is another alternative that I've considered, but for the same reason described above it might not be feasible (dozens of API calls per user per second). Plus there's a chance that an API call is triggered by game-1 finishing, but while game-2 animation is still going on, giving away the result of game-2

sentences:
Attach a method to every GameObject or use a manager script I'm new to Unity but not new to development so I'm wondering what the standard way of doing this in with Unity.

In the scene from the start is an empty GameObject that has a script that contains all of the items in the game. Once the game starts, chest prefabs are going to be spawned in the game and upon interaction they will reveal some random loot from the items script.

Is it better practice to have a script on all of the chests that accesses the items script or should I create another empty GameObject as a sort of a chest manager that accesses the item script and keeps track of all of the chests in the game and what all of their loot is.

sentences:
Handling cameras in a large scale game engine What is the correct, or most elegant, way to manage cameras in large game engines? Or should I ask, how does everybody else do it?

The methods I can think of are:

Binding cameras straight to the engine; if someone needs to render something, they bind their own camera to the graphics engine which is in use until another camera is bound.

A camera stack; a small task can push its own camera onto the stack, and pop it off at the end to return to the "main" camera.

Attaching a camera to a shader; Every shader has exactly one camera bound to it, and when the shader is used, that camera is set by the engine when the shader is in use. This allows me to implement a bunch of optimizations on the engine side.

Are there other ways to do it?

sentences:
Memory leak with glfwSetWindowTitle? I am using GLFW for a game, and I have a function which allows me to set the window title.

    // PROBLEM WITH INCREASING MEMORY USAGE
    void WindowSystem::setTitle( const string & title )
    {

        glfwSetWindowTitle( window, title.c_str() );

    }

This function is called once during every iteration of the main program loop, so that I can have a basic FPS counter. Under Xcode the program memory usage increases faster and faster. If I replace title.c_str() with a literal, the problem does not happen, i.e., the following does not cause the same memory usage growth.

        // DOESN'T CAUSE PROBLEM
        void WindowSystem::setTitle( const string & title )
        {

            glfwSetWindowTitle( window, "Hello world!" );

        }

This where the function is called.

    int SystemControl::update()
    {
        double time = glfwGetTime();
        double timeStep = time - control->lastUpdate;
        control->lastUpdate = time;

        float frameRate = 1.0f / timeStep;

        string windowTitle = std::to_string( frameRate );

        control->windowSystem->setTitle( windowTitle );

        control->physicsSystem->update( timeStep );

        return OK;
    }

The string title is allocated on the stack, and should be freed at the end of update. Could there possibly be a memory leak? I understand that the pointer for c_str() is internally managed, and does not need to be freed.

sentences:
Mixing 3D and 2D content on the iPhone? I am at the design phase of a board game on the iPhone and am considering a couple of options for rendering the view:

Quartz to render top down views of the board with core animation to do the transitions to close ups etc. Using a 3D library (or GL directly) to render dice rolls on top of the 2D view.
Full 3D interface to render the board and do the transitions (something like the Monopoly app on the iPhone).

Keeping most of the game in 2D simplifies the implementation and the artwork, but I wonder if the overall finish will suffer.  Is it practical to render 3D views (for the dice rolls) on top of a Quartz 2D app?

Should I just bite the bullet and go 3D?

sentences:
What would be the best way to create a cone representing the field of view of an entity in Godot Engine? I would like to create a game in which PC and NPCs would have a field of view, shown as a cone in the front of the entity (see picture for an example).

As it would be the first game I develop using Godot Engine, I am wondering what would be the best way to implement this feature. Also if possible, in later versions of the game, I would like to be able to make the decor stop the field of view, like what is done in Monaco: What's yours is mine.

Would you have any recommendation?

sentences:
How do I check whether a camera has unobstructed view of a GameObject? I want to check if a GameObject is visible to the camera. The renderer.isVisible-method only checks if the camera is turned towards the object, not if there is anything between them (like a wall).

How can I check whether the object is actually visible?

sentences:
Forge 1.14.4 Minecraft modding: Override vanilla loot tables I cannot figure out how to override vanilla loot tables, I've been at this for hours, and I can't find anything online. Just very outdated tutorials.
I added custom crops and seeds to my mod, now I need those seeds to drop from the in-world grass.

The loot tables for my custom blocks are in data.modId.loot_tables.blocks and they work just fine.

Now, when I try to override the grass to drop an item of my choosing, say, coal, I do this:

1) Make  grass.json

2) Fill it:

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "item": "minecraft:shears"
                  }
                }
              ],
              "name": "minecraft:grass"
            },
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:random_chance",
                  "chance": 0.125
                }
              ],
              "functions": [
                {
                  "function": "minecraft:apply_bonus",
                  "enchantment": "minecraft:fortune",
                  "formula": "minecraft:uniform_bonus_count",
                  "parameters": {
                    "bonusMultiplier": 2
                  }
                },
                {
                  "function": "minecraft:explosion_decay"
                }
              ],
              "name": "minecraft:coal"
            }
          ]
        }
      ]
    }
  ]
}

3) Place it in my project in data.minecraft.loot_tables.blocks

When I test it in game, grass still drops wheat seeds and not coal. Why?

sentences:
How do I scale my spell target indicator to match the radius of OverlapSphere I have a spell system in which some spells have an Area of Effect. To get the targets I use Physics.OverlapSphere. I show the player an indication of the spell's radius by spawning a Unity plane primitive at the target position and scaling it to match the radius of the spell.

How would I scale my spell target indicator visual to correctly match the radius of OverlapSphere?
I have tried setting the scale of the plane's X,Y,Z to radius * 2, but this does not seem to align with the overlap sphere radius.
data.indicatorInstance.transform.DOScale(data.parent.radius * 2, 0.5f);

And just for completeness sake, below is the OverlapSphere call.
Physics.OverlapSphere(targetPosition, data.parent.radius)

sentences:
How to properly rotate towards a local point in Unity C#? (a local LookAt) I am having a nightmare trying to make a child object rotate towards a given point of its parent object, similar to what is possible at the world level when using LookAt.

The problem is that most functions related to rotating in Unity C# do not work for local level. In the description of function transform.Rotate one can have the impression that it allows that, trough passing the Space.Self parameter. However, to use that function one has to know the 3 angles between the 2 points of interest. And there is no function that allows such calculation.

Anyone could please help implementing a local LookAt?

sentences:
Box2d/Farseer how to use the World object? this question is primarily about farseer but as it is a wrapper around box2d i think it's relevant for both libraries.

I'm in the beginning of developing a simple platform game, and I'm stuck as to how i should use the World object in relation to my "levels". Should I create a new world for each level and load all the contents of my level into this new world. Or should I remove all objects from my world and load in the new contents of the new level?

Any help or suggestions are greatly appreciated.

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:
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:
Unity Anti-Cheat solutions I'm currently working for a websites client development team and need guidance on where to go for anti-cheat with unity.

We have scripting, where a user can code in their own features via a editor we have made in lua, with a scripting api that allows them to interact with parts of the game via said scripting, others can exploit this with tools and execute scripts on games that didnt have said scripts, via "hacking". I'm trying to stop script execution exploit(eg scripts being executed that weren't put there by the author) and general hacks such as speedhacks, assembly injection, etc. We have tried the anti-cheat toolkit but it hasn't worked well for us. In terms of execution we have the lua5.2 library in a dll, of course they can hook this library and execute anything via luas execution functions built in, statistcally linking the library would help defend againist this but that is not a option that is easily done in unity, so anyone could just hook it and execute any script/lua they want. we have server-side scripts(executed on server) and client/local-side scripts(executed on client/locally), we've done our best to secure these but we're looking into more ways to help protect us, such as anti-cheat.

We have plans to possible invest into paid anti-cheats in the future such as battleeye, easyanticheat, etc.

we currently don't make a lot of capital and i have no experience making any type of anti-cheat nor anti cheat in unity, where do i start and what do i do?

sentences:
What is the ballpark GL framerate for iPad and iPhone 4? Does anyone the GL frame rate for iPad and iPhone 4 under the follow conditions:

Unlit
Non supersampled
GLSL texture mapped with two textures.
Single quad, 4 vertices

Thanks,
Doug

sentences:
How to avoid recursive and or infinity loop monogame return function This piece of code is returning on a infinite base how to fix?

public GuiElement MoveElement(int x, int y)
{
    GUIRect = new Rectangle(GUIRect.X += x,GUIRect.Y += y,GUIRect.Width,GUIRect.Height);
    return MoveElement(x,y);
}

this is where i set the values i have in my Other class

        gm.Add(new GuiElement("BackGround"));

        gm.Add(new GuiElement("Play_Button").MoveElement(150, 50));

        gm.Add(new GuiElement("HighScore_Button"));

        gm.Add(new GuiElement("Quit_Button"));

basicly i want a to be able to move some elements using that MoveElement

it creates a infinite loop

An unhandled exception of type 'System.StackOverflowException' occurred in giftman.exe

sentences:
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:
Level of detail for the map of stars I have a large list of points (millions) in 2d. Let's say it's a star map. Each star has a radius and position in space.

I want to render this map at different level of details. From a single star to entire star system, galaxy or even universe. I also want it to be fast.

So I started with a quad tree approach: loaded every point into the tree. At any moment of time I can query a tree with a simple question: Give me top N points in this region

But what is a top? I thought to myself that quads can be compared based on total radius of points that they host. So, this gives me sorting order to work with, and the algorithm boils down to a mix of quad tree and a priority queue:

priorityQueue.push(rootQuad)

while priorityQueue.size < N {
  let node = priorityQueue.pop() // take the largest node
  for each child of node {
    if child.intersects(region) {
       priorityQueue.push(child)
    }
  }
}

After this algorithm is done, I can render each point either at its location (if it's a leaf), or at the node's center of mass (if it's intermediate node). It works very fast, and gives decent results.

However there is a problem with this approach. Let's consider a simple grid of points:

If I render each intermediate quad tree node at node's center of mass, then I get these artifacts, where two nodes are collapsed into one:

It almost feels like I should start from leaves, combine individual points into single cluster, until I get N clusters, but this would kill performance.

What would you recommend to do to avoid such artifacts?

sentences:
How should my creatures see the world? This may not be the best forum for this question, but I know a lot of you have dabbled in the field of general AI for games so here it is.

I'm doing the cliche population evolution of creatures in a simulated ecosystem (with some cool irrelevant twists) where each creature is its own neural network. Specifically, I'm using the NEAT algorithm to evolve creature brains over generations.

My problem is that I can't figure out what to feed as input to the creature neural networks. I haven't found any relevant literature on it either.

The world right now is composed of prey/predator creatures and grass for the prey to eat. I want all creatures to see all three objects (prey, predators, and grass). The other important point is that the populations are not fixed. Prey can become endangered, grass can become limited, etc.

Initially I was going to have a list of all objects as relative positional vectors within a radius of a given creature as input, but variable sized inputs are basically a no go for neural networks. My second idea was just show everything in the scene (even if it may be a sensory overload), and when an object dies just replace it with a -1 hot vector. But that would just confuse the ANN.

I'm out of ideas and flailing in the water. Any thoughts are appreciated.

sentences:
How to achieve smooth gameplay in a physics based multiplayer game? (2d) I'm using cocos2d 2.0 and Gamekit for networking. I've got a server/client model. It works over wifi (local) and bluetooth. (Xcode 4.3, Objective C)

Basically, there's a ball and 2 or more players. What I wanted to do is:

The physics is completely simulated on the server. The clients send their inputs to the server and the server sends the position (only the position and rotation that's it) to the clients. The clients than set the position of the objects to the given position datas.
The ball is also simulated on the server.

Problem: There can be a high latency and the gameplay would be not smooth on the client side. The players can freely move around and interact with the ball (just pusing it and such things).

I read about prediction but how should it be possible to guess the movement of the player? The player can move completely free (360°).
I also read about Servertime and clienttime but I didn't get it very well :/

How could I reduce lag? Please explain your solution because I don't want to just copy and paste it, I want to understand it.

PS: Probably I will have very low ping (1-5 ms) on wifi (local, both devices on the same network), I guess but I want to implement Gamecenter too and than I would need to handle the lag. But handling the lag on wifi/bluetooth would be great to, to achieve smoother gameplay.

sentences:
Generate Angle for Projectile to Follow So It's Ends Facing Downward I am building a game within a game engine. The game is a 2D platform, where the player can move left, right, and jump/fall down. Part of the game is the presence of physical projectiles falling from the 'sky'. When these objects are created (in the sky), impulse is applied to them toward the present location of the player [Pic 1]. Please note the impulse is applied one time using the location of the player at object location, it is not constantly being applied to the location of the moving player. The projectile should move toward that location of the player, not necessarily to the location - and it does - but as it reaches its destination the object starts to curl upward [Pic 2].

I have tried several formulas for setting the angle on each tick (every frame), namely

Set Angle Toward: PlayerWasAtX, LayoutHeight
Set Angle Toward: Self.X, LayoutHeight
Set Angle Toward: If (Self.X > Self.PlayerWasAtX)
                  Then (Self.X - PlayerWasAtX) / 2
                  Else (PlayerWasAtX - Self.X) / 2
                  , LayoutHeight

Where PlayerWasAtX is the stored location of the player upon projectile creation, LayoutHeight is the total height of the canvas, and Self.X is the X-coordinate of the projetile.

In those examples, example 1 would curl, example 2 would keep the object straight down at all times even when falling at a curve, and iirc example 2 just acted wacky.. or it acted the same as example 1.

Any help would be appreciated. Here are my reference pictures:

sentences:
Ray tracing - soft shadow I'm implementing my own ray tracer as an iPad app for a school project. At the moment this is the result:

I need to add the last requirement, soft shadows, but I can't find a complete reference anywhere. If I understood well, to implement this feature I have to shoot many rays from an intersection point to mt light source. This one must be an area light. Suppose i use a sphere, my questions are:

which point on the sphere i must use to calculate the shadow ray?
how do I average the result?

Thanks for helping me.

sentences:
Entity Component System - Physics Animation Matrix Calculation? The problem is how many times the matrices representing the bones (for animation and rendering) of an entity get calculated.

If i have these components:

Position
Skeleton (holds matrices for bones)
Physics
Animation

When the physics get's updated, the position is changed to move the entity. This sends a message, that position has changed. The skeleton takes note and updates the matrices for the changed position (and potentially rotation). The animations are then updated in a separate system, the skeleton then gets updated and changed again. So essentially the matrices are being updated twice (unnecessarily) instead of just once.

Am i going about this the wrong way? Is this just the price of having everything disjoint?

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

sentences:
My Java Game's movement looks awfull. Maybe Problem with Thread.sleep I have a big problem with my Java games. In every game I make the movement of the player and objects just looks awfull. The framerate is 60 fps without any problems. But the movement looks extremly unsmooth. I tried several things but nothing worked. The game code is too long and unstructured to show the hole one but here are some parts that may cause the problem:

this.repaint();

//Framerate
try {
    Thread.sleep(15);
} catch (InterruptedException e) {
    e.printStackTrace();
}

and that's how I tested the framerate:

 //FPS anzeigen

    if(RaumNr >= 0){

        FPSCount += timesincelastframe;
        howoften ++;
        if(FPSCount > 1){
            FPSCount = 0;
            FPS = howoften;
            howoften = 0;
            System.out.println(FPS);
        }
    }

That's how my delta time system works:

 while(true){

        long thisframe = System.currentTimeMillis();
        timesincelastframe = ((float) (lastframe - thisframe)) / -1000f;
        lastframe = thisframe;

        if(!M.hasFocus())
            M.requestFocus();

and so on.

    super.paintComponent(g);

    Graphics2D g2d = (Graphics2D) g;

    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2d.scale(BreiteMulti, HöheMulti);

And that's how I move the player for example:

 x -= 350 * timesincelastframe * speed;

I hope you have any ideas wht the problem might be. If you need more code examples please tell me.

sentences:
Laggy empty project at 60FPS @Override
public void create() {
    batch = new SpriteBatch();
    img = new Texture("badlogic.jpg");
}

@Override
public void render() {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    if (x < 0 || x > 400) {
        speed = -speed;
    }
    x += speed * Gdx.graphics.getDeltaTime() * 60;
    Gdx.app.log("delta",Gdx.graphics.getDeltaTime()+"");

    batch.begin();
    batch.draw(img, x, 0);
    batch.end();

}

I had a problem and i created a new project. The problem libgdx tries to keep 60FPS and avarage deltatime is ~16ms.Some renders take +20ms then next render takes 12ms(render1 + render2 = 32ms) to achieves 60FPS. That makes game laggy. As you can see i don't have anything in the project and it is the same in desktoplaunch. How did you solve this ?

Note: I also tried reqeustRendering. But it is the same thing if the render takes more time than the avarage. I also tried to wait some times for the render if that is smaller than 16ms. It didn't help either. It doesn't have any GC problem. I use Libgdx 1.6.4.

sentences:
How do I get the number of Steam friends online programmatically? How can I get the current number of Steam friends online in order to insert it into a script or program? I'm looking to use this value to do something like changing an LED colour or for providing data for a desktop widget etc.

Is this possible? How do I get access to that number?

P.S. I got my idea from here: Xbox Live Traffic Light Notifies You When Friends are Gaming

sentences:
How can I convert screen coordinates from a click to 2D scaled world coordinates? I need a way to convert screen coordinates obtained from mouse clicks to world coordinates in my 2D game.

To create a zoom effect controlled by the user, before drawing a model I will scale all of it's points by a world scale value.

The screen origin (0,0) is at the top left corner while the world has it's center (0,0) at the center of the screen (width/2, height/2).

I need a function to convert the coords obtained by mouse clicks (screen coords) to the corresponding scaled-world coordinates, so that I can determine what world element is clicked by the user in this scaled world.

Any of my approaches worked as required and unfortunately none of the found solutions where aplicable to my case.

This is a very simple example JS Bin:

Use the mouse wheel to zoom in/out
Click on the screen to set a point

Thanks!

sentences:
WebGL .NETCoreApp 1.1 - UnityLoader.js - SyntaxError: expected expression, got end of script After creating a release build of my game using Unity 5.6, I could navigate to the created folder and open the 'index.html' file and my game would load and play normally.
However, when trying to integrate it into my WebApp (.NETCore 1.1), I would continually get this error in Chrome, Firefox, IE, etc..:

UnityLoader.js - SyntaxError: expected expression, got end of script

Invoking error handler due to
TypeError: UnityLoader[r] is not a function

sentences:
How can I check if a point(Vector3) is in Matrix4x4 I'm placing random objects in an imaginary cube in front of my target. I am using following code to do this:

var center = Vector3.zero;
center.z = (m_size.z / 2) + m_offset.z;
center.x += m_offset.x;
center.y += m_offset.y;
var mat = Matrix4x4.TRS(m_target.position, m_target.rotation, m_target.lossyScale);
Vector3 pos = center + new Vector3(Random.Range(-m_size.x / 2, m_size.x / 2), Random.Range(-m_size.y / 2, m_size.y / 2), Random.Range(-m_size.z / 2, m_size.z / 2));
pos = mat.MultiplyPoint(pos);
m_instantiatedObject.Add(Instantiate(m_object, pos, Quaternion.identity));

And it's working as expected. but now my problem is as my target moves, the previously placed objects may not be in this imaginary cube anymore. how can I check if my placed objects are in this imaginary cube and if they are not I can remove them?

sentences:
Stroring components in arrays (entity component system) I'm looking for ways to improve my ECS and I've seen many people suggest storing components in arrays. This seems great, considering fast access for a component using entity id and more importantly, fast iteration over elements of array (because systems do this all the time) and fewer cache misses than if I store components in Entity or use:

std::map<int,std::shared_ptr<Component>> components // where int is a component id

But I have some questions about this approach.

1) Do I have to create array for each component? Something like:

PositionComponent positionComponents[MAX_OBJECTS];
HealthComponent healthComponents[MAX_OBJECTS];
...

Or is there a better way to store different components contiguously in memory?

2) How can I get components using entity id if I do this?

I'd like to implement some function like this:

template <class T>
T* getComponent(int entityId) const {
    ... // ??
}

so I can then use it like this:

PositionComponent* pc = getComponent<PositionComponent>(entityId);

sentences:
Polygon count budget Is there any smart way to think about polygon budget relating to PC gaming today?
My game will have one static 3d background scene and two fighters. No more enemies. I am thinking about having animated 3d models in the background for atmosphere, like spectators.

So how could i find out what the polygon count for the player models and background scenarios could be. I guess the question is, what is a for today typical polygon count that most PCs can handle?

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:
MYST/RIVEN and Quicktime Video Integration How was Quicktime video integrated into the MYST series games? I was watching a Making of MYST video and noticed that they used a small green screen and for the sequels like Riven they continued to use a green screen but with a much bigger stage. How is it that they match up the video file and integrate it seamlessly into the game? I'm really curious as to how they did it with Riven, where full body actors actually move around with a greater degree of freedom.

My guess is that the video recording is an exact duplicate of a pre-rendered scene. When the player enters into a certain area where a movie is supposed to take place, the video is drawn onto the screen and played. After the video ends, the pre-rendered screen is drawn back to the screen that reflects the changes that took place in the video.

Any other ideas how it might have been done?

sentences:
How to use the zoom gesture in libgdx? I found the example code for the GestureListener class, but I don't understand the zoom method:

private float initialScale = 1;

public boolean zoom (float originalDistance, float currentDistance) {
    float ratio = originalDistance / currentDistance; //I get this
    camera.zoom = initialScale * ratio; //This doesn't make sense to me because it seems like every time you pinch to zoom, it resets to the original zoom which is 1. So basically it wouldn't 'save' the zoom right?
    System.out.println(camera.zoom); //Prints the camera zoom
    return false;
}

Am I not interpreting this right?

sentences:
3D rotation math/code for plane I am making a simple 3D game with plane in space.
With c++ (win32).
But the plane rotation is not realistic.
The code I am using for the rotation is the following:

point3D AxisRotation(point3D point,point3D Rotation){
float sx = Sin(Rotation.x*PI/180);
float cx = Cos(Rotation.x*PI/180);
float sy = Sin(Rotation.y*PI/180);
float cy = Cos(Rotation.y*PI/180);
float sz = Sin(Rotation.z*PI/180);
float cz = Cos(Rotation.z*PI/180);
float xy,xz, yx,yz, zx,zy;
xy = cx*point.y - sx*point.z;
xz = sx*point.y + cx*point.z;
yz = cy*xz - sy*point.x;
yx = sy*xz + cy*point.x;
zx = cz*yx - sz*xy;
zy = sz*yx + cz*xy;
point.x = zx;
point.y = zy;
point.z = yz;
return point;}

The axis of the rotation needs to be (Roll,Yaw,Pitch).
Does anyone know the code or the math for it ?
Thank you. Dave

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:
Sprite framework binding multiple textures In an attempt to batch render as many quads (sprites) as possible, I'm instance rendering a single unit-sized quad and passing in a buffer of per-instance data that includes width/height, texture coordinates, color, texture Id, etc.

Offline, I have a tool that constructs texture atlases based on any particular sprite animation, so the output is flexible in terms of texture atlas width/height, which sprites reference which texture atlas, and so on.

The end result is that I may have many texture atlases, and sprites which reference any one of those atlases for their current frame.

I need a robust solution that'll allow me to draw these sprites in any order while reducing texture binding as much as possible. After some research there are two options:

combine multiple 2D textures into a 2D array texture (up to GL_MAX_ARRAY_TEXTURE_LAYERS_EXT)
bind multiple textures in array of samplers (up to MAX_TEXTURE_IMAGE_UNITS)

The first solution I believe requires all textures to be the same height/width.
The second solution seems to have a limitation that requires a constant index to access the array of samplers in the fragment shader.

I think I want to go with the second solution, but I'm worried I won't be able to properly write a fragment shader if I have to use a constant index, as I'd be getting the index via per-instance data input.

Are my above suspicions correct? Is there a known work-a-round for the second solution? Or is there a better way to do this than what I presented.

sentences:
Trying to find a game development competition About a month or two ago one of my friends participaded in a game development competition. The theme was "infinity". I think he had either a week or a month to finish the game. The problem is I cannot for the life of me find or remeber the name of the site. (Its not Ludum Dare)

I am hoping someone here might know what I am talking about.

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:
C++ Generate random float values between a range In my current situation I have a game world, in that game world I want to place loads of tree models. It is a waste of time for me to actually explicitly define the x y and z values of each tree model, so I want to do this with the help of random logic, so that it can just set the values for me. I don't want true randomness, so I do not need to seed the random logic, I want to generate the positions of all the trees randomly so that I don't need to type each one myself, but each time I run the game the trees are in the same position, so it is not truly random but that is what I want.

My current attempt is as follows:

for (int i = 0; i < numOfTrees; i++) {
        treeObjects.push_back(
        (new Entity(Vector3f(//x, y and z position value of each tree
                             rand() % 200 + (-200), //random value for x
                             0.0f,                  //y value kept as 0.0f
                             rand() % 200 + (-200)) //random value for z
//above code positions the trees, the rest of the code is irrelevant
}

The issue with this is that all the trees are very tightly packed together, so I am very skeptical that they are getting a value between -200 and 200, because if they were they would be much more spread out. Does someone know of a better solution to produce what i'm after? maybe there is an issue with the way I am doing it?

sentences: How to get more gentle (cloud like) noise? Recently I have started playing around with making terrain with perlin noise. Using this library  I can make A fairly fast. However, it is to squiggly to be desirable. What I want to achieve is B, where you can see more convincing slopes with the softer noise.

sentences:
instancing and GPU skinning I'm trying to render a large number of identical rigged entities with independent animation.

Compared to standard skeletal animation, I can't compute the pose of each entities and send it to the GPU for each frame. This would demand too much work for the CPU and saturate the VRAM very quickly. Let's say I have 5000 entities with 20 bones, I would have to compute and send 5000 * 20 * (size of matrix/quaternion-translation/dual-quaternion) poses to the GPU, each frame.

I recently found this article/paper : https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch02.html Their idea is to load animations to the GPU in order to access them independently with each instance.
Correct me if I'm wrong but I think this is equivalent to move the interpolation part to the GPU.

I pre-computed all the bone transformation in local space for each frame for each animation and packed it into texture buffers. It works as expected.

However, I experience strange results with my animated models...
In fact the interpolation is necessarily wrong ! I am trying to interpolate between poses in local space, not in bone space like with standard CPU interpolation. There is no problem with translations, but with rotations. (the axis is shifted to the local space origin).

I imagine I could send the bone space transformations AND the bone hierarchy. But that would impose to parse the hierarchy for each vertex (in vertex shader), in order to re-compute the interpolated bone transformations.

One other idea I had is to upsample the animations in order to have smaller interpolation intervals, but again, it will use more VRAM.

To be honest I'm not sure I understood well the paper (especially in the interpolation part)...

Any suggestion ?

EDIT 1 : It's maybe unclear : by "local space" I mean entity space, so it is more like "global space"...

EDIT 2 : To provide more details about my implementation :

In the CPU (c++) pre-process part, I pre-compute all the bone transformations in local space for each frame (natively, I get bone-space transformations using Assimp library so I have to do a bit of work here).

Then, I send this information as an array to the GPU (array of numFrames * numBones * numAnims dual quaternions).
In the vertex shader, I get information about the current instance using gl_instanceID. I get world position, current animation and time in current animation.

Then I compute the interpolated pose of the bones influencing the current vertex. I do that by finding the bounding frames using the instance's time. I interpolate my pairs of transformations (pairs of dual quaternions) for each concerned bone.

(I know there is a mistake because the interpolation must be performed in bone space).

Once they are interpolated, I blend linearly the transformations into one using the bone weights attached to my vertex (and I normalize my final dual quaternion).

It worked when i was doing interpolation in bone space in CPU, I'm just trying to move the interpolation part on the GPU.

sentences:
Texture swapping and 2d Drawing in Xna Usually in 3d drawing you want to ideally have fewer larger textures rather than lots of smaller ones, and make sure you render the same kinds of textures at the same time. So there is less texture swapping going on behind the scenes.

This is not a difficult thing to do as most textures are purely used for models or terrains/structures. So you may have a terrain texture, a structures texture and a couple of player/enemy textures. Then just draw the terrain, the structures and any enemies and the player, only requiring a few texture swaps there, and if you are also using some sort of model instancing for the enemies you can get away with some other improvements there.

Anyway now enter the 2d drawing world, rather than applying a texture and then drawing lots of vertices using it you are giving a texture to each draw command. So I am wondering how XNA handles this behind the scenes.

Take for example a top down 2d game, you have a tileset for the level containing many ground sprites, an enemy sprite sheet which may contain anywhere from 10-20 enemies sprites and animations, then possibly a player/equipment sheet which contains anything for them.

Now in this instance if I were to draw my level which was lets say 64x64 tiles (a tile being an x,y,tileSetIndex), and I have a tileset with 8x8 sprites (lets say 32x32 each):

var tileSetSourceRect = someTilesetEntity.GetSourceRectForIndex(tile.tileSetIndex);
mySpriteBatch.Draw(someTilesetEntity.TilesetTexture, tileSetSourceRect , tile.Position, Color.White);

assuming no real optimisations and just looping through every tile would this just retain the tilesetTexture in memory, or is it going to keep removing/adding the texture after every Draw() call? As I do not know how it can manage this unless it keeps some state under the hood between draw calls (maybe thats what Begin/End is for on spriteBatches).

So will I be getting 4096 (64x64 tiles itterated) texture swaps, or will it only do 1 texture swap in this instance?

sentences:
Do Gradle 'implementation' replace Unity Jar Resolver dependencies? I have a project with several *Dependencies.xml files which the Unity Jar Resolver resolves fetching the .aar files and storing them on Plugins/Android.

When installing Ironsource, I saw in the documentation that it says to add the dependencies to the mainTemplate.gradle file:

dependencies {
    // Your other dependencies //
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    compile 'com.android.support:support-v4:27.1.1'
    **DEPS**
     // Your other dependencies //
     // ... //
     // AdMob's dependency //
    compile 'com.google.android.gms:play-services-ads:17.1.1'
}

Because one of my dependencies that the jar resolver imports is an older version of support-v4 my build fails.

Seeing this new alternative, can I move all the dependencies files to the gradle file and let Gradle auto resolve this problem on the post build process?

Is there any pros/cons that the jar resolver has that Gradle doesn't? For what I know the Jar Resolver uses gradle.

sentences:
from where do i start to learn game ai Possible Duplicate:
  New to creating AI - where to start?

i have been programming 2-3 games till now. but i have not used ai in any of them...so can u please suggest good ebooks or net articles or tutorials on game ai...problems featuring shortest path, pathfinding etc...
Thankyou

sentences:
Is Java AWT suitable for 2d game rendering? [Reposting this question from stackoverflow, as it was pointed out that it fits better here.]

I'm currently porting my 2D game engine to Java. I looked at some of the game libraries pointed at here on stackoverflow. However, the ones I looked at were rather simplistic and didn't even state if they supported things like alpha transparency, so I decided to port my C++ renderer for which I had already written out the logic.

This renderer is a pure software renderer which uses tiling to avoid needless re-rendering. I optimized its scrolling performance by creating an "offscreen buffer" a little larger than my output pane, and blitting this offscreen buffer onto my output on every frame. This way, I could avoid redrawing tiles needlessly just because I scrolled a pixel on the map.

I used Java's AWT to implement it, using a large BufferedImage for the offscreen buffer. The CPU usage is okay(around twice of what I had in C++), but there's an odd problem with continuous scrolling, where every second or so, the renderer will lag out for around 0.2 seconds.

Since there's nothing in my own code that would occur in these periods, and since the spikes disappear if I don't draw my offscreen buffer onto the main view, I can only conclude that Java is doing some internal optimization of its own. However, I'm not sure what it does, nor do I know which of my own optimizations I would have to remove to get rid of the spikes. Also, it might be that java AWT wasn't made with continuous, high FPS scrolling in mind, and that's entirely unusable for this purpose.

Is there some way for me to get rid of these spikes?

sentences:
Unity saving and loading of images in game So I'm planning out this game for unity but I don't know how feasible it will be with all of the image loading and saving.  I've worked with some other coding, and while I am in the process of learning C# and Unity I don't have a very informed base for my opinion.

Basically the game will be inspired by the base mechanics of the Chaotic tv show where you have to adventure to take scans of creatures and these scans will be used in another aspect of the game as cards.  The creatures will be randomly generated.  The problem is I want the scans to be like actually taking a picture (A picture that includes all the stats of the creature).  This means I want to be able to save a picture of the scene with the creature in it as well as the stats associated with said creature which means I would have to have some sort of data base capable of storing hundreds (Possibly thousands if you include player made and prebuilt cards) of cards and the data associated with them.  The scans take a picture and record the stats of the creature at that point in time so they're only highly usable for the game when the creature is in near perfect condition (Not yet defeated or attacked).  I would have to be able to store scans of creatures, scans of the environment, and possibly scans of items found while adventuring.  I think it would work best if only a small picture of the actual scene is saved with the stats instead of the full card and the stats, with it rebuilding the card each time it's loaded into memory.  The small picture would also cut down on storage space (Possibly so small as to be high res pixel art)

Would it be unrealistic to save all of this data?  Aswell, does Unity/C# even have the capabilities to take screenshots from specifically defined areas of the screen/players view and then reuse them in another area of the game instead of saving them in some predefined screenshot area?

(This game will be entirely offline so no data will need to be transferred to a different system)  (Said game will also be 3d with the card playing area in 2d)

sentences:
What's efficient way to draw a lot of textured cubes in XNA4? Title says it all.

What's efficient way to draw a lot of textured cubes in XNA4?

sentences:
How can I change the root namespace for scripts in Unity? How can I change the root namespace for scripts in Unity?
I went to Edit - Project Settings... - Editor - Root namespace and put there the gameplay value.
I checked that the Assembly-CSharp.csproj has the <RootNamespace>gameplay</RootNamespace>
Now I go to VS Code editor, create a class and the class still uses a wrong namespace. What may I be missing here?

sentences:
When load my unity scene on vmware windows virtual machine, the color/lightening of the scene randomly changes? It turns pink Hi I have a unity scene doing all it is suppose to on mac but I had to load that scene on vmware windows virtual machine and when I did that, the color or the lighting of the scene was randomly changed and I don't know how to fix that. Any help will be highly appreciated.
Thanks

sentences:
How can I unpack a sprite sheet into multiple images? I need to take a sprite sheet and convert it into multiple images, one for each frame of the sprite sheet.

How should I go about this? I would prefer an offline method or a tool to do so -- I found Alferd SpriteSheet Unpacker, but it is really slow on Windows 7 and does not seem to respond well at all.

sentences:
How to convert relative position of child to parent into an absolute position? I am modifying a game that stores object positions with a 3d vector { x, y, z } and rotation as a 3d vector with degree angles { x, y, z }.
I want to place an object in relation to a parent object accounting for its rotation. I do not have access to the game code, so I have to provide a position of the child as an absolute position.
For example, I would like to place a child object at a relative position { 50, 0, 100 }: 50 units along the x axis and 100 units up the z axis from the parent's position.
Assuming the parent object is currently at position { 0, 0, 0 } with rotation { 0, 0, 0 } the resulting absolute position for the child object would be simply { 50, 0, 100 }.
But, if the parent has a position of { 0, 0, 0 } and a rotation of { 0, 0, 90° }, the child's absolute position would be { 0, 50, 100 }.
What would be the transformation function that, given the absolute parent position, parent rotation, and relative child position, outputs the absolute position of the child (taking into account all three axes of rotation)?

sentences:
How to do "realistic" plastic material? How can i do "realistic" plastic material in Unity 3d , using standard shader or other shader ?

Can you suggest me options ?

Thanks

sentences:
How can I make sprites from multiple images using SDL2? Using SDL2 in C++ I can load textures with out problem however, I have sprites that are from about 15 different png's that I was hoping I could load them all up and for loop through them. However, when I try this it looks like the image is still .

I am hoping that I wouldn’t have to photo shop them into one image and shift/pan through that considering I have about 3K of images to go through.

can some one provide an example of how this could be done cleanly?

I have been working on this for a while for a bit and yes, this is probably a coding mistake as I am learning C++ still and know that for me to learn is to take up a project.

int main ( int argc, char *argv[] )
{

    SDL_Init(SDL_INIT_EVERYTHING);
    Window = SDL_CreateWindow("NEW WINDOW",100,100,300,300,SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
    renderer = SDL_CreateRenderer(Window,-1,SDL_RENDERER_ACCELERATED);

    if (Window == NULL)
    {
        std::cout << "Window Couldn't be Created!\n";
    }

    struct imagebatch
    {
        const char *image;
    };

    imagebatch foto;

    //  A for loop is needed here to loop through Healer0.png Healer1.png to Healer15.png
    foto.image = "DData/towners/healer/healer/Healer0.png";
    HealerTexture = IMG_LoadTexture(renderer,foto.image);

    //loads an image;
    //HealerTexture = IMG_LoadTexture(renderer,"DData/towners/healer/healer/Healer0.png");

    //defines the rect of this image;
    SDL_Rect HealerRect;
    HealerRect.x = 0;
    HealerRect.y = 0;
    HealerRect.w = 90;
    HealerRect.h = 90;

    while (!quit)
    {
        while( SDL_PollEvent( &event ) != 0 )
        {
            //User requests quit
            if( event.type == SDL_QUIT )
            {
                quit = true;
            }
        }
        SDL_RenderClear(renderer);

        //Blit everything here.
        SDL_RenderCopy(renderer,HealerTexture,NULL,&HealerRect);

        SDL_RenderPresent(renderer);
    }
    close();

    return 0;
}

Full code is here: http://pastebin.com/H5fD6cfX

sentences:
How can I generate a lightning bolt effect? Is there an algorithm to generate a lightning bolt?
I would like an algorithm that generates a list of segment or point objects specifying where the bolt will land. The method would need a start point parameter, along with an endpoint. The bolt should have random branches coming off it, and zig-zag at random intervals. The result will be a random lightning effect that would look somewhat like this

(source: wikimedia.org)
If anyone knows of an algorithm that this may work for, help would be greatly appreciated!

sentences:
surface.Bake(); no such command Regarding the code shown in this video at 13:50:
When I try: surface = GetComponent (); surface.Bake();
I am getting the following error message:

UnityEngine.AI.NavMeshSurface does not contain a definition for bake
and no extension method Bake of type UnityEngine.AI.NavMeshSurface
could not be found "are you missing an assembly reference

I am struggling to get the dynamic navmesh working with Unity 2017.1.

sentences:
How do I move a game object instead of the entire scene in Unity? I'm trying to move GameObject between scenes but when I do it moves my whole scene instead of just that one game object. How do I move just the game object and not the whole scene?
I have tried SceneManager.MoveGameObjectToScene(UIRootObject, sceneToLoad); and DontDestroy but it keeps moving my whole scene new scene.

sentences:
What compatibility checks should i do while creating Direct3D device, swap chain etc I've done DirectX apps for 1.5 years now, mainly to teach myself but now i would like to make games for public. So i was wondering would it work for others just leaving the values default ie. swap chain's refresh rate to 60 without checking the users monitors refresh rate.
Could you tell me what things should not be ignored in situations like this, thanks.

There's no SDL or SFML in my programs just pure C++, DirectX and WinAPI.

sentences:
How can I draw the depth value in GLSL? I want to draw the depth buffer in the fragment shader, I do this:

Vertex shader:

varying vec4 position_;

gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
position_ = gl_ModelViewProjectionMatrix * gl_Vertex;

Fragment shader:

float depth = ((position_.z / position_.w) + 1.0) * 0.5;

gl_FragColor = vec4(depth, depth, depth, 1.0);

But all I print is white, what am I doing wrong?

sentences:
How can I calculate respective 2D world/mouse position through different resolutions? I have been at this game of trial-and-error for days now. I cannot find a consistent method to calculate the respective mouse position in my game world after the calculations are done to stretch the game's render view to the current resolution. I've seen other, similar questions and answers on this site, but after looking at them long and hard, I can't translate the answers to my project.

I'm using XNA. First, I render everything to a RenderTarget2D at a resolution of 800x600. Then I render said RenderTarget to the screen by calculating it's size and location through a method that returns a Rectangle:

public Rectangle CalculateRenderTargetPosition()
    {
        Rectangle rec;
        Single preferredAspect = Globals.RenderSize.Width / (Single)Globals.RenderSize.Height;
        Single outputAspect = Globals.WindowSize.Width / (Single)Globals.WindowSize.Height;
        if (outputAspect <= preferredAspect)
        {
            // output is taller than it is wider, bars on top/bottom
            Int32 presentHeight = (Int32)((Globals.WindowSize.Width / preferredAspect) + 0.5f);
            Int32 barHeight = (Globals.WindowSize.Height - presentHeight) / 2;
            rec = new Rectangle(0, barHeight, Globals.WindowSize.Width, presentHeight);
        }
        else
        {
            // output is wider than it is tall, bars left/right
            Int32 presentWidth = (Int32)((Globals.WindowSize.Height * preferredAspect) + 0.5f);
            Int32 barWidth = (Globals.WindowSize.Width - presentWidth) / 2;
            rec = new Rectangle(barWidth, 0, presentWidth, Globals.WindowSize.Height);
        }
        return rec;
    }

The Camera's position is rendered during rendering to the RenderTarget2D through a Matrix in the SpriteBatch.Draw method, so there's nothing weird going on there. The Camera itself works fine at any resolution.

After days of guesswork, this is the closest method I've got:

Rectangle r = Globals.Draw.CalculateRenderTargetPosition();
MouseState ms = Mouse.GetState();

Single aspect = Globals.WindowSize.Width / (Single)Globals.WindowSize.Height;
Single pmx = (ms.X - r.X);
Single pmy = (ms.Y - r.Y);
Single mx = (pmx == 0 ? pmx : pmx / aspect);
Single my = (pmy == 0 ? pmy : pmy / aspect);
Vector2 pos = Vector2.Transform(new Vector2(mx, my),
    Matrix.Invert(Globals.Camera.GetViewMatrix()));
Globals.RelativeMousePosition = new Vector2(pos.X, pos.Y);

Even if this is almost close enough, it's still off. I don't know if there's some magical Matrix method I don't know about or if I just suck at math.

sentences:
Why does a UI button that is child to a canvas not appear in game view? I am trying to place a button onto a canvas background using C# script.
I want the button specific to the canvas (i.e., if I move the camera to look at another canvas, I do not want the button visible).

My C# script is below. I have attached it to an empty game object.
When I run the game, the Heirarchy panel of Unity shows that the canvas and button are created OK, and that
the button is a child of the canvas.
The canvas appears in game view at the right size (200 x 200).

But in game view, there is no button!

The button is definitely present ; clicking on its name the Heirarchy panel shows me a location and size in the scene view that are exactly as specified in my C# script.
But nothing happens when I click the region in game view where the button is supposedly present.

Unity's Inspector panel shows that a "Button (Script)" has been attached to my button object, with Rect Transform parameters as specified in my C# code.
I tried messing with the colors, but still no button.
The "On Click()" window contains nothing except the message "List is Empty".

How do I make the button appear in game view?

How do I make the button work (i.e., generate the Console message "button pressed")?

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

public class TestScript : MonoBehaviour {

private GameObject myGO;
private Vector2 buttonSize;
private Vector3 buttonPosition;

void Start () {
// setup a canvas
    myGO = new GameObject ();
    Canvas myCanvas = myGO.GetComponent<Canvas> ();
    myCanvas.renderMode = RenderMode.WorldSpace;
    RectTransform parentRectTransform = myGO.GetComponent<RectTransform> ();
    parentRectTransform.sizeDelta = new Vector2 (200, 200); // set size of parent rectangle

// create and place the button
    Vector2 buttonSize = new Vector2 (10, 10);
    Vector3 buttonPosition = new Vector3 (150, -70, 1);

    CreateButton (myGO.transform, buttonPosition, buttonSize);
}  // end Start()

public void CreateButton(Transform panel ,Vector3 position, Vector2 size)
{
    GameObject button = new GameObject();
    button.name = "Button";
    button.transform.parent = panel;
    button.AddComponent<RectTransform>();
    button.AddComponent<Button>().onClick.AddListener (handleButton);
    button.transform.position = position;
}

void handleButton() {
    Debug.Log("Button pressed!");
}

} //  end class TestScript

sentences:
trouble in making a game questions? all i've a little trouble understanding some concepts while making game please give your suggestions on my questions.

I have a animated sprite image this i want to move this image according to given path. I can get path from

    Path path = new Path();
    Point s = new Point(150, 5);
    Point cp1 = new Point(140, 125);
    Point cp2 = new Point(145, 150);
    Point e = new Point(200, 250);
    path.moveTo(s.x, s.y);
    path.cubicTo(cp1.x, cp1.y, cp2.x, cp2.y, e.x, e.y);

    canvas.drawPath(path, paint);

these points are hard coded and give different results on different screen.

Q1. How can i make path which is similar in all screen size?

Q2. How can i move my animated sprite image according to given path with the image has it's head according to path?

sentences:
Divide a tile map into multiple images So let's say I have a tilemap 5 x 5, which equals 25 tiles.
How can I divide my tilemap into 25 different images? I'm using tiled, but I don't know if it is possible to do it on there or if I need to use one other program.
Of course, my tilemap is bigger than 5 x 5, so it's why I'm asking because it would consume a lot of my time.
Thanks.

sentences: How to handle pixel-perfect collision detection with rotation? Does anyone have any ideas how to go about achieving rotational pixel-perfect collision detection with Bitmaps in Android? Or in general for that matter? I have pixel arrays currently but I don't know how to manipulate them based on an arbitrary number of degrees.

sentences:
Do open world games need less backstory? I've played a few open-world games and really enjoyed them, though the ones I've really enjoyed have generally received complaints about how little story there is to them.

The Saboteur is one example of this. Fully open-world, good enough story (for me, anyway), engaging gameplay, and still has received complaints in reviews about not having enough story.

Do open-world games actually need a full, all-encompassing story? Or can fun and engaging gameplay fill in the gap and let the designer get away with a slightly less complete story?

sentences:
How to report bugs found on procedurally generated levels? There is many topics on how procedural generating works but I couldn't find any info on how to test and - what's more important - how to report bugs that may occur on procedurally generated levels. What is the best way to describe a bug, for example related to level design, on a map that will look different each time you play new game? What information should be included in bug report so reproducing it would be easier for level designer, level artist, etc. and then also during regression process?

EDIT:
It is worth mentioning that the game, I am preparing to test, is in very early phase of developing and is constantly changing along with the systems responsible for generating levels. The purpose of this research is to learn how to describe bugs (what info to include in report) so the regression in a changing environment would be as less time consuming and as effective as possible.

sentences:
Creating the Vertices and Triangle Indices for Voxel Generated Mesh I am running into a problem with a compute shader I am writing to generate the vertices and triangle indices for a voxel generated mesh.
Currently, I am creating an AppendStructuredBuffer of triangle structs which just have the three vertices of a triangle and reading from the AppendStructuredBuffer to the CPU. When read to the CPU, I then read from the buffer and set it in a RWStructuredBuffer in the GPU. Following that, I run a compute shader kernel to parse the triangle buffer.
Obviously if I can do this all on the GPU I should since reading and writing between the CPU and GPU is expensive.
When trying to put it all in one kernel I run into problems however. Each voxel has a range of possible triangles (0-5) that can form in it. Because of that, I can't simply use the dispatch ID to put it in a RWStructuredBuffer (at least I don't think so). That's why using an AppendStructuredBuffer seems natural; it allows for the variable amount of triangles.
After getting the array of triangle vertices and array of triangle vertex indices, I bring them back to the CPU and set them to a mesh and render it. In the future I want to use a geometry shader to render the mesh since that is most likely more efficient, but I'm trying to take this one step at a time, and geometry shaders are a whole 'nother beast I know nothing about.

sentences:
How do I click on specific text in an array of text? I am trying to click on a specific word in an array but I can't think of how.
This is what I have:
  for x in range(0, len(names)):
    templine = font.render(names[x], True, WHITE)
    tempRect = templine.get_rect()
    tempRect.midleft = (50, (170+30*x))
    if mouse012[0] == True and tempRect.collidepoint(mouseXY):
      state = AppState.STATS

      detailsName = names[x]
    screen.blit(templine, tempRect)

sentences:
Unity UI Chat Message Expanding Bubble How do you set up Unity's UI Layout system so that the chat bubble changes in size automatically based on the length of the text? What's the right use of Layout and Content Size Fitter elements?
How do you turn
into

sentences:
Registering and (more importantly) Unregistering with Message Server I've finally implemented an extendable message class and messageServer class.  The message class dynamically assigns a unique static ID to each derived message type (ex.  ObjectCreatedMessage might be assigned id = 1).  The actual message data is a member of the derived class.

Messages can be pushed to MessageServer class by upcasting to MessageBase*.

Systems (or anything) can subscribe to Message Server by passing a std::function to:

typedef std::function<void(MessageBase*)> Callback;
void registerCallback(int messageType, Callback callback);

When MessageServer is processing messages, it pops a message off the queue, checks the message type, then sends the message to each callback function registered to that type.

My Questions are:

Is this efficient?
How could I implement an "unregister" function?  std::functions can't be compared by equality.
What is a smart way to handle the callback failing? (perhaps the registered object went out of scope so the function pointer is undefined)

sentences:
GNUstep Game Development Are there any good resources out there for game development in GNU step? I looked at some of the source code for ooLite, but that didn't really have much in Objective-C.

What is there these days?

sentences:
LibGDX Box2DLights shadow offset problem on bodies Hello I just started to use LibGDX, and it's awesome.
I looked at the Box2DLights library, and started to learn how the lighting work here.

I got something up:

(source: gyazo.com)

As you can see, it works, but the shadow of the sprite goes over itself, and doesn't start in the right place.

Why is it doing this? is it possible to set offsets?

This is how I initialize them:

    this.texture = new Texture("sprites/water.png");
    this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    this.camera.setToOrtho(false);
    this.renderer = new SpriteBatch();

    this.map = new TileMap(20, 20);
    this.map.generateAllSame(new Texture("sprites/sprite.png"));

    this.world = new World(new Vector2(), true);

    this.createBodies();

    RayHandler.setGammaCorrection(true);
    RayHandler.useDiffuseLight(true);
    this.ray = new RayHandler(this.world);
    this.ray.setAmbientLight(0.2f, 0.2f, 0.2f, 0.1f);
    this.ray.setCulling(true);
    this.ray.pointAtLight(50, 0);
    this.ray.setBlurNum(1);
    camera.update(true);
    this.spriteLight = new PointLight(ray, 128);
    this.spriteLight.setDistance(500f);
    this.spriteLight.setPosition(150, 150);

    this.spriteLight.setColor(new Color(0.5f, 0.8f, 0.7f, 1f));
    this.spriteLight.setSoftnessLength(0);
    this.spriteLight.setSoft(true);

public void createBodies() {
    CircleShape chain = new CircleShape();
    chain.setRadius(10);

    FixtureDef def = new FixtureDef();
    def.restitution = 0.8f;
    def.friction = 0.01f;
    def.shape = chain;
    def.density = 1f;

    BodyDef body = new BodyDef();
    body.type = BodyType.DynamicBody;

    for (int i = 0; i < 3; i++) {
        body.position.x = 40 + MathUtils.random(500);
        body.position.y = 40 + MathUtils.random(500);

        Body box = this.world.createBody(body);
        box.createFixture(def);
        this.bodies.add(box);
    }
    chain.dispose();
}

And my rendering:

public void render() {
    handleInput();
    camera.update();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.setProjectionMatrix(camera.combined);

    renderer.disableBlending();
    renderer.begin();
    this.map.render(renderer);
    renderer.draw(texture, 50, 50);

    renderer.enableBlending();

    for (Body body : this.bodies) {
        Vector2 pos = body.getPosition();
        renderer.draw(texture, pos.x + amount, pos.y);
    }
    renderer.end();

    ray.setCombinedMatrix(camera.combined, camera.position.x, camera.position.y,
            camera.viewportWidth * camera.zoom, camera.viewportHeight * camera.zoom);

    ray.update();
    ray.render();

}

What did I do wrong?

sentences:
Swapping axis labels between 2D and 3D coordinates My game world is 3D.

The map is only 2D, however.

It is natural to think of the map as having an X and Y axis.

And it is natural to think of the world has having an X, Y and Z axis, where Y is upwards.

That is to say, X Y in 2D map coordinates is X Z in 3D coordinates.

What conventions and approaches do you have to keeping things straight at a code level to make mapping between them natural?

(Is Y usually upwards in 3D?  Or do you have X and Z in map coordinates, or?)

sentences:
opengl matrix multiplication Can someone provide some type of example of multiplying a 4x4 matrix without using loops?

typedef struct matrix4
{
    data[16];
} m4;

can someone provide a sample of how you you'd multiply two of these in the opengl column major way?

sentences: First person camera turning 3D I know how to make the effect of moving an object on the z axis, and strafing, but how do you make the effect of the view turning, I don't use any 3d libraries or engine

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: Libgdx. Converting Screen Click Coordinates into World Coordinates for 2D Game I'm using the InputHandler's touchdown method. It gives me my screenX and screenY. Is there a simple way to convert screenX and screenY to world coordinates? By my understanding, InputHandler returns the coordinates in relation to your screen.

sentences:
Why does the text of my label objects overlap? I am having a problem with labels in my GUI:

I have looked for solutions online but not found something solid enough to fix this problem. Has anyone ever come across this? Here is my GUI function. When the variable changes it overlaps with the previous one:

 void OnGUI() {
    if(selected) //set your selected variable in the OnMouseDown method
        GUI.Label(new Rect(40, 50, 400, 22), GetComponent<MeshFilter>().mesh.name);

}

sentences:
How to pass array of dozens of floats to OpenGL 3.0 vertex shader? I use PyOpengl and Python 3.

I have 50 thousand vertices. Position of each vertex could be calculated in vertex shader as

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];
in vec3 v_coefficients[COEFFICIENTS_AMOUNT];
in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position + v_coefficients * coefficients_weights;
}

Amount of coefficients varies between 0 and 199 — it's not a problem  for me to generate 200 vertex shaders to cover each situation.
I need to change position of vertices tens of thousands times per application calls as fast as it's possible, so I cannot calculate them once on start.

Though, I cannot provide arrays for each vertex because documentation says:

  Attribute variables cannot be declared as arrays or structures.

I see following solutions of this issue:

(will not work) hardcode suffices of variables names to emulate arrays:

use vectors with names like coefficients_000, coefficients_001, ..., coefficients_199;
use matrices to have 4 vectors in each of variable — will it be better than previous solution with vectors (maybe performance of matrices product is faster than 4 products of vectors)?

calculate vertices positions by myself using C/NumPy;
calculate vertices positions by myself in parallel using OpenCL;
(will not work) store all coefficients in uniform int v_coefficients[COEFFICIENTS_AMOUNT*VERTICES_AMOUNT] and access needed ones according to vertex number, which will be stored in in int vertex_id;
store coefficients in textures (proposed by @HolyBlackCat).

Are there any other solutions of my issue? Is there optimal solution in proposed above?
Will I go out of memory if I will use 200 float 3-vectors for each vertex?

I imagine the solution with hardcoded indices as:

#version 300 es

uniform v_coefficients_weights[COEFFICIENTS_AMOUNT];

in vec3 v_coefficients_000;
in vec3 v_coefficients_001;
...
in vec3 v_coefficients_199;

in vec3 v_initial_position;
out vec3 v_position;

void main() {
    v_position = v_initial_position
        + v_coefficients[0] * coefficients_weights_000
        + v_coefficients[1] * coefficients_weights_001
        + ...
        + v_coefficients[199] * coefficients_weights_199;
}

sentences:
Attach Transform to another GameObject The scenario I am trying to accomplish is attaching a turret to a mount point on a ship.  I have gotten as far as bringing in the prefab and assigning it as a child object with the following code:

GameObject leftFixedGun = (GameObject)MonoBehaviour.Instantiate(Resources.Load("Laser Fixed Gun"), leftMountPoint.position, leftMountPoint.rotation);
leftFixedGun.transform.parent = player.transform;

The problem is, it takes on the rotation of the mount point object, obviously, which isn't exactly what I'm going for.

I have a couple ideas of how to fix this problem, but would really like it to be a different solution all together.

My idea to fix this problem would be to rotate the transform at leftGunMountPoint in order to align the attached gun correctly.

The ideal solution, and the one I would like help with, would to be to align a local mountPoint transform I have under the leftFixedGun to a leftGunMountPoint under the  ship I am trying to attach the gun to.

I hope this makes sense, and if it doesn't please feel free to leave questions in the comments.  Also, please let me know if I am going about this completely wrong =)

Thanks!

EDIT:

Thanks to the answer, and if anyone else is wondering about this, easiest way to accomplish this is as follows:

Create a transform, and line it up with where you want to place the item trying to be mounted.
The following code attached the gun as I wanted.

GameObject laserFixedGun = (GameObject)MonoBehaviour.Instantiate(Resources.Load("Laser Fixed Gun"), leftMountPoint.position, leftMountPoint.rotation);
laserFixedGun.transform.parent = player.transform;

sentences:
Simulation step size in a physics engine I am trying to integrate a physics engine (Bullet) into my game engine, but I immediately found that I do not know how big should I make the simulation step. I think of 2 options:

Use a fixed step size of 1/60. This way I have consistent simulation. Bullet allows making multiple steps when this time is exceeded. I think this is good for consistent simulation but I think it has a big flaw and that is that position of objects will not update when my framerate is higher than 60FPS. Right now I have around 1000 FPS but it will drop significantly to around 150 I expect because I use simple materials and not many objects plus the simulation time is not included yet. Is it possible to interpolate between steps so that 2 frames are always different but check for collisions only when 1/60 of a second passed?

Update physics every frame but when frame time is longer than 1/60 then use substeps. This way I should be able to get more precision but it would lower framerate because the step is performed more than 60 times per second. I definitely get the new position of the object in every frame.

Which is a better approach and why? Is there a standardized way to go about it?
I know that when slow-motion footage of CSGO is taken in every frame the position of the object change but the tick rate is just 64. Which would not update the position in every one of the 240 frames monitors can handle and duplicate frames would be created. I know that animation can be sampled at any point in time but not the position of the objects. How is that achieved?

sentences:
Help Improving Map Generation I've recently attempt for the first time to implement a map generation system and while it does work, it doesn't work exactly the same I want but I'm not really sure on what changes I can make it to make it generate the type of map I want.

This is my map generation code

///<summary>Generates a Room at a Start Position</summary>
    void GenerateMap(Vector2 roomStartPos)
    {
        Vector2 startPos = roomStartPos;

        int roomTileNum = random.Next(minRoomTiles, maxRoomTiles);
        for (int i = 0; i < roomTileNum; i++)
        {
            if (CheckTilePosValid(startPos)) //Checks if a position is taken by a tile already
            {
                Tile newTile = CreateTile(startPos); //Creates a Tile at a passed in Position
                startPos = GetRandomEdgeDirection(newTile.SpritePosition); //Gets a Random position next to the passed in Position

            }
            else
            {
                startPos = GetRandomEdgeDirection(startPos);
                i--;
            }
        }
    }

It's likely a really bad way of generating a map. It basically gets a random number of tiles to generate, it will then place a Tile at the start position and select a new position in a random direction (Up, Down, Left, Right). It'll then place a new tile at that new position specified, it will then simply loop through that till it's placed every tile.
The "CheckTilePosValid()" function is used to determine if the random position that is gathered has already been taken by a tile. If the position isn't taken then it will create the tile and continue through the loop, while if the position is taken then it will get a new position and basically keeping doing that till it gets a position that hasn't been taken already.

This generates maps like this:

The issue is mainly with the first image since as you can see, the map is very stretched out which isn't what I want. I'd more want a map similar to the second image, tiles much closer together and not so stretched out but is still random enough.

I'm just not sure how exactly I can achieve this so I was wondering if anyone would be able to help me? Would I need to completely rework my generation system or can I just make simple changes to fix this?
I'd very much appreciate the help :)

sentences:
Libgdx - gesture dection I have made a card game, and have two methods that sort the players hand.

sortHandBySuit();
sortHandByValue();

I would like one method to be called when the user slides their finger from left to right across the screen, and the other from right to left.

public class InputHandler implements InputProcessor{
  .............
  public boolean touchDragged(int screenX, int screenY, int pointer) {
    world.getHand().sortHandBySuit();
    return false;
  }
  .............
}

How can I use touchDragged to call my methods?

sentences:
XNA Multisampling only for 3D I am working on a game which consists of 3D elements and a 2D GUI. I have it working properly, but I want to enable multisampling for only the 3D parts, and not the 2D Textures. Otherwise, the GUI icons become blurred.

Here is the code for my Draw method

    protected override void Draw(GameTime gameTime)
    {
        graphics.PreferMultiSampling = true;
        graphics.ApplyChanges();

        GraphicsDevice.Clear(Color.Black);

        GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
        GraphicsDevice.DepthStencilState = DepthStencilState.Default;

        foreach (Element e in Elements)// 3D part
        {
            e.Draw(GraphicsDevice, camera);
        }

        graphics.PreferMultiSampling = false;
        graphics.ApplyChanges();

        spriteBatch.Begin();
        UIM.Draw(GraphicsDevice, spriteBatch);
        spriteBatch.End();//

        base.Draw(gameTime);
    }

Using this code, I get an exception because all of my Texture2Ds dispose for some reason.

Is there a way to change the MultiSampling in the middle of the Draw method?

sentences:
What is Minecraft's database? I was wondering, what kind of database does Minecraft use? Is it a relational database, maybe something common like MySQL? Do we even know what he's using?

And maybe even a better question, SHOULD he be doing it that way? What type of database should be used?

sentences:
Calculating the 2D edge normals of a triangle What's a reliable way to calculate a 2D normal vector for each edge of a triangle, so that each normal is pointing outwards from the triangle?

To clarify, given any triangle - for each edge (e.g p2-p1), I need to calculate a 2D normal vector pointing away from the triangle at right angles to the edge (for simplicity we can assume that the points are being specified in an anti-clockwise direction).

I've coded a couple of hacky attempts, but I'm sure I'm overlooking some simple method and Google isn't being that helpful today - that and I haven't had my daily caffeine yet!

sentences:
Why is my AABB vs AABB code returning false positives I am trying to do AABB vs AABB collision and the code is never finding a collision.

    private static boolean checkFullCollision(Entity entity, Entity entity1) {
    float[] amin = entity.getMin();
    float[] amax = entity.getMax();

    float[] bmin = entity1.getMin();
    float[] bmax = entity1.getMax();
    return  (amin[0] <= bmax[0] && amax[0] >= bmin[0]) &&
            (amin[1] <= bmax[1] && amax[1] >= bmin[1]) &&
            (amin[2] <= bmax[2] && amax[2] >= bmin[2]);
}

where I calculate my min and max.

    public float[] getMax() {
    final float[] max = new float[3];
    max[0] = position.x + this.max.x;
    max[1] = position.y + this.max.y;
    max[2] = position.z + this.max.z;
    //System.out.println(position);
    return max;
}

public float[] getMin() {
    final float[] min = new float[3];
    min[0] = position.x - this.min.x;
    min[1] = position.y - this.min.y;
    min[2] = position.z - this.min.z;
    return min;
}

Can someone help me please.

Thanks in advance

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:
How to use textures in 2D games in WebGL I have been trying to figure out how to structure the VBOs in WebGL, and think that keeping them all together in one if at all possible sounds like the best approach. Right now I'm thinking of having color buffer, position buffer, and index buffer, just those 3. But my question is what about a texture buffer (maybe it's called a UV buffer, but I'm not sure if that's 3D only).

I would like to have a game with basically flat colors and alpha/opacity and some drop shadows perhaps, maybe some glows, but nothing too complex. Mainly it would be like traditional vector graphics look but in WebGL. As such, I'm wondering how to solve the texture problem. If I need a texture, or I don't at all need one.

Part of figuring this out is knowing what you should really be using textures for. I get that they are useful for mapping images to geometry, but I don't know of any other use case. Wondering if one could explain some use cases of textures as it applies to my situation. The main goal is figuring out if I need a texture buffer at all, or I can/should just stick with color/position/index.

A look I like is like this:

sentences:
I cannot save my game data on Godot Engine I'm trying to save my game on Godot Engine by pressing a "save" button but I get this message error when i do:

  Attempt to call function 'get_nodes_in_group' in base 'null instance' on a null instance

this is my project code:

#File.gd, contains the methods to write and read over the file
extends Node

var path_name := "res://resource/debug/save"
var file := "sav.tres"

class_name WriterReader

func write():
    var writer := Save.new()
    var directory := Directory.new()

    writer.version = ProjectSettings.get_setting("application/config/Version")
    for node in get_tree().get_nodes_in_group("persistance"): #it's  the line that thows the error
        node.save(writer)
    print(writer.version)

    if not directory.dir_exists(path_name):
        directory.make_dir_recursive(path_name)

    if ResourceSaver.save(path_name.plus_file(file), writer) != OK:
        print("ERROR")

#the save button gdscript file
extends Button

func _ready():
    var save = Save.new()
    self.connect("pressed", self, "save_game", [save])

func save_game(save):
    var s = WriterReader.new()
    s.write()

#it's the part of code where of the player character is saving
extends KinematicBody2D
...

func save(write: Resource):
    write.dat = {"position": position, "health": health}

#sav.gd, singleton used to save the player data

extends Resource

class_name Save

var dat : Dictionary = {}
var version := ""

I'm a beginner on Godot so I cannot figure out why this happens.

could somebody explain me, please?

Thanks

sentences:
What is the best option to implement buttons as player controls? I am familiar with programming, but new to Unity. There seems to be a million ways to implement a right and left button for turning the plane. I'm wondering what the standard/easiest/best way to do this would be.

Do I make a single script that references the two sprites "left" and "right" and then detects mouse clicks and figures out whether they are over the sprite?

Should the buttons even be sprites / game objects? Or is there a better option for UI objects?

Should the left and right buttons both have their own scripts?

ps. I absolutely can't stand video tutorials, and it seems like that's all there is for unity :'( so if there is a good written tutorial on unity desgin patterns, let me know please :)

sentences:
Splitting an object into two I'm using Farseer physics engine.

I have a simple rectangle body and would like it to split into two pieces given a starting coordinate (where the bullet enters the object) and ending coordinate (where it exits).

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:
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:
Can you offset the horizontal flip in SpriteEffects XNA? As the title suggests I need to know if there is a way to offset the SpriteEffects.FlipHorizontally component in the XNA draw method. My reason for this is the sprite I am attempting to flip is not centered, the result is that the sprite does not rotate as expected and causes unexpected collisions when flipping. I have the alternative of redoing all the textures in the sprite sheet to centre them up however I'm wondering if there is also a quick  solution that can be added into the code?

My tests so far have shown that the origin of the texture seems to have no effect on where it is flipped otherwise I would just offset my origin and gone with that.

sentences:
AS3/Flash Game Dev: Looking for good & current step by step Flash tutorials and examples have been around so long it is hard to know what sites to actually read for good, current AS3 game dev.

I'm looking for a good start to finish for flash game development, covering things such as:

Preloader (when to use, how to implement)
UI (AS3 only, no FLEX)
OOP architecture.  (I come from C++/C# world)

I'm just trying to create a simple game, sort of an "escape the room" style.

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:
Trying to create a '2D 8 Ball Pool' game - Trajectory Prediction I am trying to create a game similar to (Pocket Run Pool) https://www.youtube.com/watch?v=ewlAE6NQnsI&t=215s a 2D pool game that is much simpler than a 3D one I need help with creating code for trajectory prediction something similar to this https://docs.unity3d.com/Manual/physics-multi-scene.html
How do I go about doing this?

sentences:
Query regarding a quad tree implementation for spherical terrain I am having some difficulty conceptualising how a quadtree would be used to implement a spherical terrain system.

I currently have a spherical terrain system working, without any form of optimisation, I just have a vertex buffer full of every vertex in the terrain. Obviously, this can only be rendered at very low resolutions without lagging.

I intend to use a Chunked Level of Detail system to speed things up, however, despite my research, I am still somewhat unsure as to how to proceed.

From what I understand:
I need to generate several levels of detail (by essentially creating several distinct terrain files, each with a lower resolution than the last).

I then load the quad tree with the data by setting each level of the quad tree to be a "level of detail", so level 1 would be the root node, encompassing everything, level 2 would contain very low resolution terrain data (in the form of a low-resolution list of terrain vertices), and so on until level n, where the highest resolution data would be stored (in the form of a high resolution list of terrain vertices).

This is the part I have the most trouble with, is this correct? Generating several terrain files at different resolutions, and loading each one to a separate level of the quad tree?
Or should the tree be populated with vertices in a different way?

I then populate the main vertex buffer by searching the quadtree's nodes, and I use the players position to decide which nodes to return. So, the nodes far away from the player will be all high level (level 1) nodes with low detail, and as the distance to the player gets closer, the search will drill deeper and deeper into the quad tree, so eventually the nodes returned will be the highest detail level possible.

Is this in any way correct? My thinking on this is still quite hazy, even though I have done extensive research.

Thanks for any help or advice!

sentences:
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:
Camera Movement Smoothing I am trying to smooth a camera I create in my game, but I can't seem to find a way to actually do this correctly.

What I have :

//Calculate the "current" Forward vector
var cameraForward =
    -Vector3.Cross(-Self.forward, target.up)
    .normalized.Cross(target.up).normalized;
//Rotate the camera on the Y axis of the current target,
// and X Axis based on delta.y and CurrentVerticalLook
cameraForward =
    Quaternion.AngleAxis(delta.y, ViewTarget.transform.up) *
    Quaternion.AngleAxis(CurrentVerticalLook, Self.right) * cameraForward;

var offset = cameraForward * CameraDistance;
var pos = LookAt + offset;
Self.Position = pos;
Self.transform.LookAt(ViewTarget.position)

So what I ahve tried :

I tried Lerping the Vector Position, I tried smoothing the delta.y based on the last N frames.

The Camera I need is something like this :

Rotate on the Around UP Axis of the target and Rotate on Right Axis of the Camera, Camera Up is always = to Target UP.

So this is sort of Orbital Camera, but I am having trouble finding the correct rotation/operations.
The way its set right works, but the camera movement is jaggy, but I can't seem to find a way to add Slerp in there without messing everything.

Thanks!

Edit :
<>

sentences:
Can I use JBox2D on server with Box2D on libGDX on client? I want to use Box2D for my turn-based game, made with libGDX. The client is supposed to do some prediction of physics after his input and I want to correct these calculations with server-side calculations afterwards.
As I do not want to run an entire libGDX project on my server (because there will be parallel games and a single game per GameRoom is not necessary), I thought about running JBox2D on the server and send the final calculations for correction purposes to my two clients.

Can I e.g. step 10 seconds ahead at once with my server-side physics and send the results to my client right away? I don't need small steps, because the server won't render them anyways
Will these results mostly match with the client results of the built-in libgdx box2d version? I will here use smaller steps, so the client can render the changes easily.

Thanks in advance!

sentences:
Huge slowdown when running Lua as statically linked lib versus stand alone interpreter I'm developing some algorithms in Lua which are run mostly in Lua (few calls to C++) and I'm noticing a huge slowdown when I'm running them from my app rather than the default Lua interpreter.
The script returns in about 11 seconds with the interpreter, and about 5+ minutes with my program.

I don't think it is a problem with calling the C++ function, overruling that function with an empty function in the script has no noticeable effect for time.

Both Lua and the program are compiled with Visual Studio 2010 (I created a new solution for Lua, with projects for both the interpreter and static library)

I've run a profiler on the code (the Very Sleepy profiler, can't get a Lua profiler working but haven't tried to much) and found that in my application around 50% of the time is spend on malloc.. and 40% on free, both called from the Lua garbage collector (tried disabling that to check, but that crashes with using to much memory (understandably), the Lua interpreter peeks at about 4mb ram usage).

I'm new at Lua, so its very possible I've done something wrong somewhere, anyone got a few hints to try?

sentences:
How can I render a font in C with OpenGL? What I tried:
I was testing some things in order to render text with stb_truetype.h and OpenGL in C.
I took as a reference the example that appears here.
Basically, this example, loads a .ttf file and returns the raw information in bytes, that can be used to generate a texture in OpenGL.
I adapted the example, mentioned before, into modern OpenGL, because, the example uses OpenGL deprecated functions, like glVertex2f. The only thing I get to output on screen was this kind of noise of strange colors:

The code I use:
texture_t fnt_texture;
GLuint fnt_shader;

unsigned char ttf_buffer[1 << 20];
unsigned char temp_bitmap[512 * 512];

stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs

#define FONT_VS\
    "#version 330 core\n"\
    "layout(location = 0) in vec3 m_Position;"\
    "layout(location = 1) in vec2 m_TexCoords;"\
    "out vec2 TexCoords;\n"\
    "void main() {\n"\
    "TexCoords = m_TexCoords;\n"\
    "gl_Position = vec4(m_Position, 1.0);\n"\
    "}\n"\

#define FONT_FS\
    "#version 330 core\n"\
    "in vec2 TexCoords;\n"\
    "uniform sampler2D Texture;\n"\
    "void main() {\n"\
    "gl_FragColor = texture(Texture, TexCoords);\n"\
    "}\n"\

void font_init(void)
{
    fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
    stbtt_BakeFontBitmap(ttf_buffer, 0, 32.0, temp_bitmap, 512, 512, 32, 96, cdata); // no guarantee this fits!

    glGenTextures(1, &fnt_texture[3]); // My texture type, is an array that saves the texture on the 3rd position.
    glBindTexture(GL_TEXTURE_2D, fnt_texture[3]);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 512, 512, 0, GL_RGBA, GL_UNSIGNED_BYTE, temp_bitmap);
    glGenerateMipmap(GL_TEXTURE_2D);

    // can free temp_bitmap at this point
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glBindTexture(GL_TEXTURE_2D, 0);

    fnt_shader = shader_init(FONT_VS, FONT_FS);
}

void font_render(model_t model)
{
    shader_bind(fnt_shader);
    texture_bind(fnt_texture, 0);

    model_begin(model);
    model_draw(model, GL_TRIANGLES); // The model (vao, vbo, ibo) is rendering the whole buffer, not individual glyphs
    model_end();

    texture_unbind();
    shader_unbind();
}

Can someone tell me what I'm doing wrong, and, how I'm suposed to render correctly text, with modern OpenGL, with textures and buffers, in order to read the .ttf file and create the necessary information with stb_truetype.h and, then, render the text?

sentences:
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:
SceneKit-Convert a rotation vector into rotation matrix I'm very new and I'm studying this ARKit code from RPasecky/CubesInSpace on github where he/she convert the point of view 's rotation vector into a rotation matrix

https://raw.githubusercontent.com/RPasecky/CubesInSpace/master/CubesInSpace/MainViewController.swift

func calculateCameraDirection(cameraNode: SCNVector4) -> SCNVector3 {
    let x = -cameraNode.x
    let y = -cameraNode.y
    let z = -cameraNode.z
    let w = cameraNode.w
    let cameraRotationMatrix = GLKMatrix3Make(cos(w) + pow(x, 2) * (1 - cos(w)),
                                              x * y * (1 - cos(w)) - z * sin(w),
                                              x * z * (1 - cos(w)) + y*sin(w),

                                              y*x*(1-cos(w)) + z*sin(w),
                                              cos(w) + pow(y, 2) * (1 - cos(w)),
                                              y*z*(1-cos(w)) - x*sin(w),

                                              z*x*(1 - cos(w)) - y*sin(w),
                                              z*y*(1 - cos(w)) + x*sin(w),
                                              cos(w) + pow(z, 2) * ( 1 - cos(w)))

It was called from here

    let rotation = self.sceneView.pointOfView!.rotation //else { return (SCNVector3Zero) }
    let direction = calculateCameraDirection(cameraNode: rotation)

I understand the rotation of pointOfView that is passed in has x, y, z as the coordinate of the axis and w is the rotation angle. But how do I arrive at the code in the function? Which concepts should I learn about here?

I read about homogeneous vector, find rotation matrix between 2 vectors, and transformation matrix but this doesn't look like it

Thanks,

sentences: Why are people developing and publishing games online without charging money? What's the incentive of sharing games one designs themselves for free online such as itch.io? I see people doing this and I don't understand.

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: 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:
OpenGL VBO Additional Attributes If I have a buffer with my vertices, normals and texture coordinates, and I use glDrawArrays to draw the VBO to the screen, how can I send attributes per vertex that I placed in an array to the shader program? I'm making a voxel terrain, and every chunk is 1 VBO, this works all great, but I want to send the light value of each block (Just an array filled with int's) to the shader as well, how would I do that?

Edit: After reading some comments, here some clarification:
I'm trying to avoid the deprecated glVertexPointer etc, so I'm using Vertex Arrays. Here is the layout of my vertex array:

X, Y, Z, NX, NY, NZ, X, Y, Z, NX, NY, NZ,X, Y, Z, NX, NY, NZ

I'm using this to draw it: (ofcourse with the array buffer bound)

glVertexAttribPointer(0, 3, GL_FLOAT, false, 12, 0);
glVertexAttribPointer(1, 3, GL_FLOAT, false, 12, 12);

glDrawArrays(GL_TRIANGLES, 0, arraySize / 6);

However I get some weird shapes on my screen. Apart from the light problem, that is essentially the same thing, I don't get why this doesn't just work. When I remove the normals, and use just 1 vertexattribpointer it works fine. Yes, the attributes are bound to in_position and in_normal, and the vertex shader is nothing more than gl_Position = gl_ModelViewProjectionMatrix * vec4(in_position, 1.0);

Thanks!

This is what I get:

(This are 6X6 chunks, so this code is called 6*6 times.)

sentences:
rotate opengl mesh relative to camera I have a cube in opengl. It's position is determined by multiplying it's specific model matrix, the view matrix, and the projection matrix and then passing that to the shader as per this tutorial (http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/). I want to rotate it relative to the camera.

The only way I can think of getting the correct axis is by multiplying the inverse of the model matrix (because that's where all the previous rotations and tranforms are stored) times the view matrix times the axis of rotation (x or y).

I feel like there's got to be a better way to do this like use something other than model, view and projection matrices, or maybe I'm doing something wrong. That's what all the tutorials I've seen use.

PS I'm also trying to keep with opengl 4 core stuff.

edit: If quaternions would fix my problems, could someone point me to a good tutorial/example for switching from 4x4 matrices to quaternions. I'm a little daunted by the task.

sentences:
DX11 render 800x600 scene without a window Normally I would create a hidden overlay window and render my DX scene into that, but I think it is possible to render without a window at all as well, is this true? The goal for me is to render on top of all running Windows applications without using a TOPMOST window.

Does someone know how this would approximately be achieved? Thanks!

sentences:
Get array from JSON in Libgdx? I wanted to load in map information using JSON, is there a way to get String, Int, float etc lists or arrays from JSON in Libgdx?

My structure looks like this

{
    "data": [{
        "name": "startmap",
        "actors": [{
            "name": "ryder"
        }]
    }]
}

And I want to get Actors as either a String List or Array, but there is no GetList or GetArray function. Is there any other way to do this?

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:
Is there a way to earn money from non-mobile HTML5 game? I'm just a hobbyist, who has some ideas, that would not fit on a mobile screen. I have searched for some method, to make a bit of money from them, but I've found just for mobile-optimized games.

So the question is: is there any way to earn some money from these games, too?

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

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

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

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

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

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

  this.physics = function() {

    this.y += this.yVel;

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

var generateBalls = function(p) {

  var i, random;

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

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

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

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

  }
};

var drawBalls = function() {
  var i;

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

var applyPhysics = function() {
  var i;

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

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

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

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

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

sentences:
What is the necessary know-how to write an animation library (IK & FK)? I can't find any good library for animation, the ones that I found are just really old and discontinued, but I have noticed that the libraries are relatively small, so I'm thinking about coding one on my own: where should I start? What are the basics for this? There is a book about this?

Some further notes about a good file format for animation are also highly appreciated.

I'm using C++.

sentences:
How can I handle mouse input and cursor in a WinAPI window? Hello I'm studying game engine programming, but I got stuck with mouse input.

As for now I have only WinAPI window, which has a message pump and processing. For the mouse I used RAWINPUT, but there is a problem: I can't find any elegant way of handling the mouse cursor, for example making a menu in a shooter.

Raw input provides relative movement data directly from mouse driver, but how can I control the cursor with it? Or maybe I should make 2 message processing queues with filters on the mouse? I haven't found any real solutions in my searching yet.

sentences:
How can I create a mesh of triangles made from the vertices of a polygon and contained within that polygon? I'm trying to programatically generate a mesh, given the vertices of a polygon, which is contained within that polygon. For example, starting with these points:

I would want to generate a mesh similar to this:

My first port of call would be a Delaunay triangulation, but having implemented this, I came up against the problem that this was not contained within the polygon, i.e. it produced a mesh like this:

My question then is, is there either an algorithm which produces the desired result rather than the Delaunay result (because I can't find one online), or a modification that I can make to the Delaunay triangulation algorithm that will fix this?
I'm using the Bowyer-Watson algorithm, by the way. Thank you!

sentences:
How do I create a 2D tile map, and implement movement within it? How do I create a 2D tile map that I can use? How do I get the world coordinates of it so I can move something to that tile?

I'm learning OpenGL, at the moment, but I'm having a lot of issues understanding how to create a 2D tile map. I have rendered tiles to the world, but I have no way of using them. For example, I'm trying to implement movement, where when clicking on a tile, I would move the player to that tile.

To elaborate, I want a tiles coordinates when I click near/on it, so I can use that position when implementing movement. Right now, I have no idea how to do that; I am able to get the windows 2D coordinates on click, but I don't know how to turn that into a useful way of finding the coordinates I want based on where my tile is in the world.

sentences:
Rigidbody freeze rotation around global Y My player is a cube that moves in all directions, but cannot jump. I want to achieve that the cube cannot rotate around global Y axis, but can rotate around global X and Z. This cannot be simply done by freezing the local Y rotation, since the cube can fall from higher ground and rotate mid-air - after that the local and global y axes are not parallel anymore and some other axis should be frozen.
Currently, I am using this line:
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(transform.rotation.eulerAngles.x, Mathf.Round(transform.rotation.eulerAngles.y / 90) * 90, transform.rotation.eulerAngles.z), 1f);

which is located in the FixedUpdate(). The resulting movement is shown in this video. Clearly, this always snaps the axis that is parallel to the global Y to the closest 90° angle. This solution, however, has a few unwanted side effects. One of them is clipping with the terrain or other player cubes, the second one is that the cube randomly rotates if walking over the edges or corners, and the third one is that if one cube is on top of another and both have this script attached, they start lagging, jittering and sometimes spinning.
I also tried by freezing the rotation based on what side of the cube is "on the bottom", but this does not work OK, since it often happens that the cube does not rotate for exact 90° when it drops from higher ground and ends up frozen standing on only one edge, just slightly off from being on the ground with the whole bottom side.
What is the "to go" solution for this type of movement?

sentences:
How to do in Godot 2D: game screen in one viewport and minimap in another. Different sprites on each The second day I google the tutorials, but nothing comes of it. All tutorials link to splitscreen demo, but it is made under the second Godot and does not work in the third.

The problem is this: I want to render the world in the main viewport and its simplified view on the minimap in another viewport using two different cameras.

In the main viewport the main AnimatedSprite node of objects should be rendered, and on the minimap there are only additional Sprite node of objects with their schematic view.

Tried to do:

Node2D
-ViewportContainer
--ViewportMain
--- Camera2D
--- World
----Player
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
----OtherObjects
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
-ViewportContainer
--ViewportMinimap
--- Camera2D

In code I assign main viewport's world to minimap's viewport:

$ ViewportMinimap.world = $ ViewportMain.world

For the main AnimatedSprite I set Light Layer #1, for the sketchy Sprite I set Light Layer #2.

And it does not work.

Firstly, nothing is displayed on the minimap. I don’t understand how to make it work. How to tell minimap's viewport to use the world from main viewport?

Secondly, I can’t find anywhere how to set the camera which Light Layer it has to display (in the three-dimensional Camera there is a Cull Layer parameter, but I don’t see it here).

Will this approach hit performance?

How to correctly implement minimap without need to modify it when you add new object to game?

How to correctly replace scenes when player moves from one to another if it child of the Viewport?

sentences:
How can I modify PlayStation 1 games? Is it possible to modify Sony PlayStation 1 games?

For example I'm planning to modify a soccer game called Winning Eleven 3. What I'm exactly trying to modify is player properties such as speed, shot power and so on.

sentences:
How to spawn objects and control the content in each spawn I'm using unreal engine and would like to spawn multiple actors and control the text in each spawned actor.

How can this be achieved in unreal engine?

sentences:
SDL_image entry point SDL_acosf not found in SDL2_image.dll I tried using SDL2_image (2.0.3) with SDL2 (2.0.7) to load png files,
but when I start the application I get

SDL_image entry point SDL_acosf not found in SDL2_image.dll

This even happens when I just include SDL_image.h without actually using any of it`s functionality.

I`m using x86 versions of both libraries. Dlls are in SysWOW64.
Compiling with VS 2017.

What am I missing?

Update:
This happens when I link against SDL2_image.lib. I don't even need to include SDL_image.h.
Also SDL_acosf doesn't seem to exist in SDL2 or SDL2_image.

thanks

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:
Algorithm for making sets in a Rummikub game I'm developing an Okey game (a Turkish version of Rummikub/Rummy). In it, each players has a bunch of tiles. Tiles have a colour and a number, like playing cards. Now, the player needs to make sets of these tiles, with three options:

Groups: Same number, different colours (Red 1, Blue 1, Black 1)
Straights: Same colour, sequence of numbers (Red 1, Red 2, Red 3)
Doubles: Two identical tiles

I'm now trying to create a simple AI for the game. I want it to be able to find and create sets in/from its own tiles.

I already have a TileSet class. Feed it a list of tiles and it will say whether it's a valid set and of what type.

Using this, what kind of algorithm can I use to find the sets in an unordered heap of tiles?

sentences:
How can I display a 3d object and my player on a canvas? The main goal is to animate my player with animator on a canvas.
The problem is that any 3d object (my player, a cube) I drag over the canvas is transparent/not seen.
The main camera is set to Clear Flags : Depth Only and Culling Mask to Everything.
The Main Menu Canvas is set render mode to Screen Space Camera and I selected the main camera.
The Main Menu Background Material is set to New Material I created and on the new material I added a shader I created that make this image to be blur.
The main camera settings screenshot :

And the Canvas settings :

And the Main Menu Background settings :

You can see in all the screenshots in the scene view top left that my player and the cube both are transparent on the canvas.
Now if I change the Main Camera Clear Flags to SkyBox then I see my player and the cube but also they are not looking like they should be with the texture/materials and also I don't want the Main Camera to be the clear flags on SkyBox I want the objects to be over the blur image so the Main Camera should be clear flags depth only.
The main goal again is to put my player on the canvas with the blur image and animate my player. This is for my main menu.

The canvas that will display the player if the player will be on his own canvas should be transparent and only display the player so the canvas will not overlap the other cnavas with the blur image.

I want to animate using animator the player not only to display it as static object.

This is a screenshot of what I mean I used paint to cut my player and put it on but the player canvas should be transparent or without a canvas the player should be on like the ui button on the left :

Another screenshot. On the top it's the scene view window the player the ui button and the blur image.
On the bottom the game view window the ui button is on the blur image.
I want the player to be the same as the ui button on the blur image and then to animate the player. Not like in my other screenshot the player should not have a skybox background or something it should be like the ui button on the blur image:

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:
Trouble with Lightmaps When Meshes Intersect I've been working on making lightmaps for a game on mobile devices (meaning that individual texture sizes cannot exceed 2048 and that file size needs to be as small as possible), but I'm running into some problems that I cannot seem to fix.

The most glaring problem (as can bee seen in the attached picture), is the appearance of these "rough edges" (I'm not sure what to call them) that appear on or around certain objects that occur wherever two meshes intersect with eachother. During rendered previews, both by camera and Rendered Mode, the quality of the lights and shadows look just fine, it is only after baking that these problems are visible.

I've tried simply making the lightmap textures larger, but even that does not remove the problem, not to mention that even the roughly 3x3 foot rock in the picture is using a 512 image just for that 1 rock (and giving each object in the scene a individual lightmap will create a massive game size for a mobile device). I've tried playing with AO and Environment Lighting, and I've tried changing lamp light settings and have not made any progress.

Any ideas on how to fix or improve this result are appreciated.

Other Notes:
-I'm using Full Render on baking, with margins at 8 (I've set them to 15 and have not noticed any difference).
-I'm using Bledner 2.69

sentences:
Breathing for game/movie characters Breathing (the movement of chest and face features): I'd like to ask if it is hard to model and whether it is computationaly expensive. I recently noticed the great effect it has in Madagascar 3 movie, but (please, correct me if I am wrong) don't remember seeing it in any games (except maybe steam cloud in cold/winter setting) and very few animated movies does that to noticable degree (e.g. when it is necessary by the plot or situation).

I'd greatly appreciate answers from both movie graphics and game graphics perspective.

sentences:
How to stop diagonally in an event driven input system? Example scenario:

Assume 2 dimensional top down movement system.

Given that I have 4 directional keys ( UP / DOWN / LEFT / RIGHT ), I am able to move in 8 different directions 4 perpendicular and 4 diagonal.

As long as a directional key is pressed there exists an assumed movement, if all directional keys are released then movement is assumed to have stopped.

If I have an event driven input system in place (instead of polling for key states every frame there is an observer which receives and acts upon events based on which keys are pressed and released) is it possible to stop movement in a diagonal direction given that the events received will be sequential?

In a polling driven input system, as long as I would be able to release both keys fast enough for them both to register as released at the same time on the next frame there would be no need to change the direction and the movement would conclude in a diagonal state.

sentences:
Exporting spritesheet for Cocos2d I would like to know how people usually save the animations in order to load them easily in Cocos2d with as few hard-code as possible.

E.G. The solution I thought of is to have one plist file containing information about each frame, and the second plist to contain information about each of the animation(name of the animation, which frames to play, and the delay probably).

If this is the correct solution, how can I generate such plist files for spritesheet automatically?

sentences:
Positioning a Window to Fill the Screen I'm using Pygame (just started), and I'm struggling to find how I set the position of the window to fill my entire monitor screen.

I can move things around within the screen / surface. I can make the screen the right size to fill my monitor (can drag it with my mouse to the right place), but can't find how to set the top-left corner of the surface to the top-left corner of my monitor. I'm using sprites.

sentences:
Text Mesh Pro Text edges are not smooth form orthographic camera I have a minimap camera (orthographic camera) which is rendering text mesh pro but the problem is the text edges are not smooth. Here is the screenshot:
[
The camera orthographic rendering on render texture.
Edit:
Some basic Orthogrphic camera setting are:
transform.localPosition = new Vector3(-26853f, 1165f, 24669f);
            transform.rotation = Quaternion.Euler(90f, -175.45f, 0f);
            miniMapCamera.orthographicSize = 110000;

Here is my text mesh pro, inspector:
[
Text mesh pro font size is 80.

sentences:
How can I find the object closest to a given 2D point? I have an array of objects. Their position is a Vector2. I want to select the closest object, given an X and Y coordinate that represents an user touch on screen.

How can I do this?

sentences:
Cross platform low level graphic API When creating a system abstraction is better to have the platform different APIs hidden by a common interface at the lowest level that makes sense.

Taking in account the different modern (with no fixed function pipeline) native graphics APIs: OpenGLES 2.0+, OpengGL 3.0+, DirectX 10.0+, Xbox DirectX 9, LibGCM

If one was to create a stateless low level graphic API to sit on top of them all, what would be the best way to go to make it as thin and as fast as possible?

sentences:
How do I handle game objects with two depths? I want to be able to do what you see in the image, but with a single wall. The player should be able to walk on either side of the same object. That is, the same wall is below the hero when I go down from it, and it's above the hero if I come from above it.

It's like two depths in the same wall, so its not just a matter of drawing it before or after. I could cut the object in two, but that would be the easy (and maybe computationally expensive) solution. How should I do this?

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 load textures in Unity and keep them between scenes? I have some textures that are used in multiple scenes and I want to keep them in memory to speed up load times between scenes.  I know about Resources.Load, but does that always keep it loaded?  If a texture is loaded with Resources.Load, will instantiating a prefab with that texture recognize that it's already loaded or will it load its own instance of the texture?

It would be better if it's a method that I can use in code so that I can make a loading screen and not freeze everyhing up.  I'm limited to an earlier version of Unity so I don't have access to LoadLevelAsyc.

sentences:
Ray Sphere Interesection Distances WRONG The discriminant is not working. This code produces incorrect distances from ray to sphere, but it can tell whether or not the ray does strike the sphere.

HOW HARD IS THIS I'VE BEEN TRYING TO DO THIS FOR 2 DAYS

float raySphereIntersect2(glm::vec3 ray, glm::vec3 origin, glm::vec3 sphere_origin, float sphere_radius, float drawdistance){
    //A sphere is given by its center
    float cx = sphere_origin.x;
    float cy = sphere_origin.y;
    float cz = sphere_origin.z;
    //its radius R
    float R = sphere_radius;
    //and its color
        //Ignored
    //A line segment (ray) is given by its endpoints:
    //P0
    float x0 = origin.x;
    float y0 = origin.y;
    float z0 = origin.z;
    //and P1
    float x1 = origin.x+(ray * drawdistance).x;
    float y1 = origin.y+(ray * drawdistance).y;
    float z1 = origin.z+(ray * drawdistance).z;
    //set
        float dx = x1 - x0;
        float dy = y1 - y0;
        float dz = z1 - z0;

        float a = dx*dx + dy*dy + dz*dz;
        float b = 2*dx*(x0-cx) + 2*dy*(y0-cy) + 2*dz*(z0-cz);
        float c = cx*cx + cy*cy + cz*cz + x0*x0 + y0*y0 + z0*z0 + -2*(cx*x0 + cy*y0 + cz*z0) - R*R;

        float discriminant = (b * b) - (4 * a * c);
        if (discriminant < 0)
            return -1;
        // OK so there is a solution, compute the distance
        float t = (-b - sqrtf(discriminant))/(2*a);
        return t;
}

sentences:
What is wrong with my 2D orbit calculation? I am working on a 2D game, and I am working on adding some space physics, so I need to find a way to create a circular orbit.

I want to make my game object move on a circular way around a planet. I'm starting with the old famous formula:

V = sqrt(G * ((m1 + m2 ) / r))

This formula is the classic real world one, V is the velocity of the game object.

Once I code it, it doesn't move on a circular way, it just being attracted by the planet, like normal gravity. Here's my code (I'm using Unity):

dist = new Vector2(
  Planet.renderer.bounds.center.x - renderer.bounds.center.x,
  Planet.renderer.bounds.center.y - renderer.bounds.center.y
);
r = dist.magnitude;
rigidbody2D.velocity = dist.normalized * (Mathf.Sqrt (0.5f * ((mBody + mPlanet) / r)));

Dist is a 2D vector and r is a float, The G value is 0.5 (I used this one because 6.673E-11 is very small and it's not what I want)

So the question is is how can I make my GameObject move on a circular orbit like a satellite around earth ?

One thing to note, is that my GameObject is kicked by the player, so it get a speed of 12. (I am using addForce()).

sentences:
Lense distortion correction with unity5 I am working on lens distortion correction in Unity. I created a new scene dragged the "Cardboard" prefab to the scene. In the cardboard setting I have set the Distortion correction as "Non". and I havent made  any changes to the CardboadDistortion.cginc shader code.  But still the performance is not clear.What will be the issue.How can I improve the performance.

I am using Unity 5.3.5
GoogleVRForUnity Package

sentences:
Tweening Colors in OpenGL I'm making a sky gradient in OpenGL by drawing with glColorPointer and glDrawArrays. I would like to be able to change the sky colour from morning to daytime to evening etc. I can either:

Make a number of sprites and fade them in with my framework
Somehow tween the color vector in openGL over time and use a single sprite

The second one seems like a more efficient option, but my framework doesn't pass the time delta into the draw method for me to decide how far I've progressed into fading.

Here's my current code:

glDisable(GL_BLEND);
glDisable(GL_DITHER);
glDisable(GL_FOG);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);

CGSize size = [[CCDirector sharedDirector] winSize];
float w = size.width;
float h = size.height;

const GLfloat vertices[] = {
    0, 0,
    w, 0,
    0, h/3,
    w, h/3,
    0, h*2/3,
    w, h*2/3,
    0, h,
    w, h,
};

const GLubyte colors[] = {
    254,255,134,255,
    254,255,134,255,
    230,157,0,255,
    230,157,0,255,
    230,60,0,255,
    230,60,0,255,
    167,0,86,255,
    167,0,86,255,
};

glVertexPointer(2, GL_FLOAT, 0, vertices);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

glEnable(GL_TEXTURE_2D);

Which gives me:

sentences:
Animator on a WorldSpace Canvas Ok, so I have my world space canvas attached to the player object. In my script I have a reference like this :

 GameObject myWorldCanvas;

Awake()
{
 myWorldCanvas= transform.FindChild("nameOfObject").gameObject;
}

Then when the right conditions are met I simply activate the object like this :

myWorldCanvas.SeActive(true);

This worked perfectly until I added a animator to the object. If I manually enable/disable the object in the scene the animation works perfectly(it just changes the scale to give it a pop effect), but when the object is activated by my script the animation still plays and changes the scale values but nothing is rendered. In play mode if I manually enable/disable the animation works.

Any ideas ? If you need more info or screens let me know.

Edit : the canvas has some buttons as children and when I mouse over something seems to be refreshed and the images show up on screen.

Edit: Further test have show that manually disabling and enabling the Canvas component also shows the images, but If the canvas and game object are enabled from a script nothing shows up on the screen.

Edit: I solved the problem by disabling the canvas component on the first key of the animation and then enabling it on the second one where the Y scale is set to 0. This seems more like a hack and I dont like it. Does anyone have a idea why this is happening ?

sentences: Adjusting a skeleton to a Specific Stance Imagine having a climbing wall and you take 4 adjacent handholds and footholds where  together they create a stance. Is there any algorithm or technique with which it would give you a realistic human pose? Currently im adjusting the skeleton by firstly finding the center of the 4 holds where then i construct the chest shoulder and pelvis accordingly. And by the use of IK i give position to the remaining limbs being which the arms and legs. Is there any other more elegant/better technique how to do such positioning of a skeleton ? As how i am adjusting the skeleton isnt so much of a realistic pose.All is done in 2D

sentences:
How do I get 'getchar()' to not block the input? I am working on designing a pong like game but converting a getchar() to getch() and getche(), respectively, but getchar() is blocking the input. I am using C++ code, and while there is the ncurses library, I heard that this is a better approach; I am only needing to update this one command.

How do I get getchar() to not block the input?

The code is as follows:

#include<iostream>
#include <termios.h>
#include <stdio.h>

//Prototypes
char inputReader();
void updateWorld();
void renderWorld();
void initTermios(int echo);
void resetTermios(void);
char getch_(int echo);
char getch(void);
char getche(void);

static struct termios oldChars, newChars;
int main()
{
   bool running = true;

   do
   {
      if(getche() == 'q')
      {
         running = false;
      }
      updateWorld();
      renderWorld();
   }

   while(running);
   std::cout << "I exited the loop";
   return 0;
}

char inputReader()
{
   return getch();
}

void updateWorld()
{
  std::cout << "I am updating the world" << std::endl;
}

void renderWorld() {}

void initTermios(int echo) //struct termios &oldChars, struct termios &newChars)
{
  tcgetattr(0, &oldChars); /* grab old terminal i/o settings */
  newChars = oldChars; /* make new settings same as old settings */
  newChars.c_lflag &= ~ICANON; /* disable buffered i/o */
  newChars.c_lflag &= echo ? ECHO : ~ECHO; /* set echo mode */
  tcsetattr(0, TCSANOW, &newChars); /* use these new terminal i/o settings now */
}

/* Restore old terminal i/o settings */
void resetTermios(void)//struct termios &oldChars)
{
  tcsetattr(0, TCSANOW, &oldChars);
}

/* Read 1 character - echo defines echo mode */
char getch_(int echo)
{
  char ch;
  initTermios(echo); //oldChars, newChars);
  ch = getchar();
  resetTermios();//oldChars);
  return ch;
}

/* Read 1 character without echo */
char getch(void)
{
  return getch_(0);
}

/* Read 1 character with echo */
char getche(void)
{
  return getch_(1);
}

sentences:
How can I fix the artifacts near the shadow edges in my variance shadow map? I'm trying to implement variance shadow mapping in my engine. I'm using WebGL 2 and now I have only one directional light source.  It's working, but it has a serious issue near the shadow edges and I don't know how to solve it.

The back of the cube isn't entirely in shadow, the edges are in light.

The shadow on the sphere is too small, I think about half of the sphere should be in shadow.

This is how I implemented variance shadow mapping:

Create the shadow map

Vertex shader:

#version 300 es

layout(location = 0) in vec3 i_positiom;

uniform mat4 projectionViewModelMatrix;

void main(){
    gl_Position = projectionViewModelMatrix * vec4(i_positiom, 1.0f);
}

Fragment shader:

#version 300 es

precision highp float;

out vec4 o_color;

void main(){
    float depth = gl_FragCoord.z;
    float depthSquared = depth * depth;
    float dx = dFdx(depth);
    float dy = dFdy(depth);
    depthSquared += 0.25f * (dx * dx + dy * dy);
    o_color = vec4(depth, depthSquared, 0.0, 1.0);
}

The texture's size is 1024x1024, it uses linear filtering, but doesn't use mipmapping or multisampling. The result looks like this:

Blur the shadow map, horizontally, then vertically

Vertex shader:

#version 300 es

layout (location = 0) in vec3 i_position;
layout (location = 1) in vec2 i_textureCoordinates;

out vec2 io_textureCoordinates;

void main(){
    io_textureCoordinates = i_textureCoordinates;
    gl_Position = vec4(i_position, 1.0f);
}

Fragment shader:

#version 300 es

precision highp float;

in vec2 io_textureCoordinates;

uniform sampler2D image;
uniform bool horizontal;

out vec4 o_color;

void main(){
    ivec2 texSize = textureSize(image, 0);
    float blurAmount = 1.0;
    vec2 blurScale = horizontal ? vec2(blurAmount / float(texSize.x), 0.0) : vec2(0.0, blurAmount / float(texSize.y));
    vec4 color = vec4(0);

    color += texture(image, io_textureCoordinates + (vec2(-2.0) * blurScale)) * (1.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(-1.0) * blurScale)) * (4.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(0.0) * blurScale)) * (6.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(1.0) * blurScale)) * (4.0 / 16.0);
    color += texture(image, io_textureCoordinates + (vec2(2.0) * blurScale)) * (1.0 / 16.0);

    o_color = color;
}

Render the scene and calculate the shadows

float calculateShadow(vec3 N, vec3 L){
    /*if(dot(N, -L) < 0.0){
        return 0.0;
    }*/
    vec3 projectionCoordinates = io_fragmentPositionLightSpace.xyz / io_fragmentPositionLightSpace.w;
    projectionCoordinates = projectionCoordinates * 0.5 + 0.5;
    float currentDepth = projectionCoordinates.z;
    vec2 moments = texture(shadowMap, projectionCoordinates.xy).xy;
    if (currentDepth <= moments.x) {
    return 1.0;
    }
  float variance = moments.y - (moments.x * moments.x);
  variance = max(variance, 0.00002);
  float d = currentDepth - moments.x;
  float pMax = variance / (variance + d * d);
    return smoothstep(0.1f, 1.0f, pMax);
}

I tried many things, like changing shadow map resolution, filtering, blur kernel size, blur amount, changing the magic numbers in calculateShadow (which are there to prevent light bleeding), but the best I could do is what you can see (it's commented out) at the beginning of the calculateShadow function. If the angle between the surface's normal vector and the light direction is greater than 90°, then it's in shadow.

It solves the problem, however on the sphere the shadow becomes too sharp:

sentences:
LibGDX - Managing a Minimap I'm making a top-down strategy game so I thought a minimap is a must. I'm using Scene2D to display my GUI and since the minimap is technically a part of the GUI, I used the stage camera to position the minimap. Below is how I'm rendering the minimap.

    shape.setProjectionMatrix (stage.getCamera ().combined);
    shape.begin (ShapeType.Filled);
    shape.setColor (Color.CYAN);
    shape.rect ((Constants.RENDER_WIDTH - 500) + ship.getX () / 30, ship.getY () / 30, 5, 5);
    shape.end ();

    shape.setProjectionMatrix (stage.getCamera ().combined);
    shape.begin (ShapeType.Line);
    shape.setColor (Color.YELLOW);
    shape.rect (Constants.RENDER_WIDTH - 500, 0, 500, 500);
    shape.setColor (Color.WHITE);
    shape.rect ((Constants.RENDER_WIDTH - 500) + (camera.position.x) / 30, (camera.position.y - camera.viewportHeight / 2) / 30, Constants.RENDER_WIDTH / 30, Constants.RENDER_HEIGHT / 30);
    shape.end ();

The first ShapeRenderer (shape) call renders the ship marker, which is currently a small square. The second renders the bounds of the minimap which is 500x500. RENDER_WIDTH and RENDER_HEIGHT are the width and height that I'm plugging into camera as viewport dimensions (1920x1080). The map is 15000x15000, so I'm dividing the ship location by 30 so that it is always in the range of 0-500. However, when I move the camera around I actually end up being able to see the ship before the minimap says I should, which is illustrated below. I'm fairly certain it's due to the zoom level of the camera, but I haven't figured out how to incorporate that other than multiplying the width and height of the display of where the camera is (the white box), by the current zoom level, which didn't work.

sentences:
Cylinder scrolling / wrap-around world using shaders? I am making a 2D game using OpenGL ES 2.0 (libgdx), where the world will wrap-around itself on Y-axis.

Apart from implementing the "modulo" method in my rendering code, I'm wondering whether it's possible to render such a world using only shaders?

How would I go about handling the edge case in GLSL?

EDIT: Basically, I want to move this part of the code to the GPU, if possible.

sentences:
SteamVR No Longer Opening With Unity Projects I'm trying to get Unity to open/utilize SteamVR for development. Everything was working fine until today, but now Unity does not use SteamVR.
I did not make any changes to SteamVR recently, and I get the same results on multiple projects and Unity installs. I also tried rebooting.
It looks like Windows pushed an update today for KB4023057 but I can't uninstall it. It's not found within uninstall updates, not in add/remove programs, and even using command prompt wusa /uninstall /kb:4023057 results in "KB4023057 is not installed." So it seems I'm stuck with it.
Any other ideas to either try to uninstall the update or else to somehow get SteamVR working in Unity again?

sentences:
Assign a ScriptableObject to MonoScript through code Sample code:

public class Item : MonoBehavior
{
    public ItemObject item; //the scriptable object

    void Start(){ // do stuff}

}

Normally I would drag and drop the asset of the ScriptableObject in the inspector.

How can I find and assign the asset (from Project View) through the script during runtime and possibly add it to a List<> or Array[]?

sentences: Good Tutorial For Lua and LÖVE I want to make a very simple 2D game, and have been reading a lot of good things about LÖVE, so I want to try it out. However I can't seem to find any good tutorials. The ones on the LÖVE page are rather unstructured, and the other one I found by Mathew Casperson is not very useful. Does anyone know of a better tutorial?

sentences:
How does one develop a first person shooter with a one man team? I have an idea for a first person shooter game and I have plenty of free time to work on it.

I know java and objective-c very well and I also know autodesk inventor (which is similar to 3ds max).

How would I go about starting to develop a small fps? What programming language should I use? What modeling/animation software should I use?

sentences:
Minimal Inform6 code to support  syntax Without using any of the standard Inform libraries, what is the minimal amount of code / infrastructure needed to support the <action> syntax?

What I tried is

Verb 'foo' * -> Foo;

[ FooSub;
    "Hello from FooSub";
];

[ Main;
  <foo>;
];

I expected this to print Hello from FooSub when run; however, the output I get is

Action <0 0 0>

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:
Which texture do I bind to when implementing multi-texturing? I have been having some issues getting multi-texturing to work using OpenGL ES 1.1. I have two PKMs - one with RGB's and one for alphas and I am trying to combine the two as below:

            int rgbTexture = textureId[0];

            gl.glActiveTexture(GLES10.GL_TEXTURE0);
            gl.glBindTexture(GLES11.GL_TEXTURE_2D, rgbTexture);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_TEXTURE_ENV_MODE, GLES11.GL_MODULATE);

            ETC1Texture etcTexture = ETC1Util.createTexture(inputStream);
            ETC1Util.loadTexture(GLES11.GL_TEXTURE_2D, 0, 0, GLES11.GL_RGB, GLES11.GL_UNSIGNED_SHORT_5_6_5, etcTexture);

            int alphaTexture = textureId[1];

            gl.glActiveTexture(GLES11.GL_TEXTURE1);
            gl.glBindTexture(GLES11.GL_TEXTURE_2D, alphaTexture);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_TEXTURE_ENV_MODE, GLES11.GL_COMBINE);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_COMBINE_RGB, GLES11.GL_REPLACE);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_SRC0_RGB, GLES11.GL_PREVIOUS);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_OPERAND0_RGB, GLES11.GL_SRC_COLOR);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_COMBINE_ALPHA, GLES11.GL_MODULATE);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_SRC0_ALPHA, GLES11.GL_TEXTURE);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_OPERAND0_ALPHA, GLES11.GL_SRC_ALPHA);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_SRC1_ALPHA, GLES11.GL_PREVIOUS);
            gl.glTexEnvf(GLES11.GL_TEXTURE_ENV, GLES11.GL_OPERAND1_ALPHA, GLES11.GL_SRC_ALPHA);

            InputStream inputStreamAlpha = fileIO.readAsset(fileName + "_alpha.pkm");
            ETC1Texture etcAlphaTexture = ETC1Util.createTexture(inputStreamAlpha);
            ETC1Util.loadTexture(GLES11.GL_TEXTURE_2D, 0, 0, GLES11.GL_RGB, GLES11.GL_UNSIGNED_SHORT_5_6_5, etcAlphaTexture);

One of the problems that I am having is I don't know which texture ID to bind to when rendering this multi-texture and if I should make GL_TEXTURE0 or GL_TEXTURE1 active when rendering. The code above is from the load() method within my Texture class. On startup, I load all of the necessary textures using the code above. I then keep a reference to these Texture objects while I still need them and when I want to render them, I bind to the ID of the rgbTexture (as shown above) and I make GL_TEXTURE0 active. Is this correct? Should I be binding to the alphaTexture's ID? Should GL_TEXTURE1 be active when rendering? Or both? Or is multi-texturing supposed to happen at render time? Ideally I am looking for a solution that combines these textures into one at startup and then when rendering, I just bind to this one combined texture.

sentences:
C++/SDL Snake Game: Drawing Tail Crashes Game I"ve been making a snake game in C++ using SDL (first game and first time using SDL), and I've run into a bug. As the tail of the snake gets longer, the game slows down (snake gets slower), and eventually the game crashes (once the length of the tail reaches 29 pieces/parts). I went and deleted little bits of code until I found what was causing the problem, and I found that the problem is the snake's draw() method. It is responsible for drawing the head, and also for looping through each part of the tail and drawing it. Since the tail keeps getting longer, so does the loop, as it has more to draw. When I take out the loop that draws the tail, the game works fine. Is there anything I can do that is more efficient and that will stop the game from slowing down and crashing? Maybe the structure of the program is just bad. Here is some code with all the unnecessary stuff cut out:

snake.h

#pragma once

...

class Snake
{
...

private:
    void drawPart(SDL_Renderer *renderer); // snake is made up of individual parts
    ...

public:
    void draw(SDL_Renderer *renderer); // draws whole snake
    ...

private:
    SDL_Texture *texture = nullptr;
    int x = 0, y = 0; // initialized to something else later, irreverent
    std::vector<Snake> tail; // tail is made up of objects of this class
};

snake.cpp

...
void Snake::drawPart(SDL_Renderer *renderer) {
    auto surface = IMG_Load("part.png");
    texture = SDL_CreateTextureFromSurface(renderer, surface);
    SDL_FreeSurface(surface);
    SDL_Rect rect = { x, y, WIDTH, HEIGHT };
    SDL_RenderCopy(renderer, texture, nullptr, &rect);
}

void Snake::draw(SDL_Renderer *renderer) {
    drawPart(renderer);
    // the code below is what slows down the game until it crashes
    for (auto i = 0; i < tail.size(); ++i) {
        tail[i].drawPart(renderer);
    }
}
...

If any more code is necessary, please let me know. Thanks!

sentences:
When does a parallel-tasks engine becomes a good solution? I'm often tempted to break the game I'm working on to try a parallel-tasks based architecture, but that don't seem a big requirement for my project so I avoid this for the moment. I'm planning to just try it in a toy project first, to "play with the concept."

Now, what I'm asking is, as lot of (non AAA) games do not require really really high performance, it feels like using a task-based engine isn't worth bothering until... what cases?

At the moment, I'm only guessing that it's necessary when you really need to exploit maximum performance of the (multi-core) hardware. Is there other cases where it's a good idea to use task-based engine? Or maybe, for new projects, it's always good to start with a task-based engine?

sentences:
LibGDX: open android camera I need help, I can't find a solution to open camera device in my libgdx app. I'm developing it only in Android for now but I have this issue.
I need only to open the preview view, no snap picture o make video... I followed this example but I found this unhelpful.

https://github.com/libgdx/libgdx/wiki/Integrating-libgdx-and-the-device-camera

Have you other resource to do that?

Thanks

sentences:
Farseer Physics EndContact events don't fire for all registered delegates Here's my situation:

I have several objects that contain a body and a fixture. They are set to sensor = true;

atmosphere = BodyFactory.CreateCircle(world, atmosphereRadius / Level.METER_IN_PIXELS, 1f, new Vector2(pos.X, pos.Y));
atmosphere.IsSensor = true;

//JointFactory.CreateWeldJoint(world, this.getBody(), atmosphere, getBody().LocalCenter, atmosphere.LocalCenter);

this.registerBeginContact(new BeginContactDelegate(this.OnBeginContact));
this.registerEndContact(new EndContactDelegate(this.OnEndContact));

I commented out the join part because it didn't seem to make a difference either way. When the object we control goes enters any of these bodies, the even its fired properly. However, when the player object leaves the sensor field, it doesn't fire the OnEndContact method, EXCEPT if it was the last object that I call

this.registerEndContact(new EndContactDelegate(this.OnEndContact));

When my OnEndContact method is called by the EndContact event in ContactManager, it is called for ALL the delegates I registered, including the ones that are tied to the objects that are not getting these events to fire. The OnBeginContact delegates work perfectly, firing for every object, but the EndContact event does not.

Does anyone have any idea why this is happening or is this a bug in Farseer?

for reference my register methods look like this

public void registerBeginContact(BeginContactDelegate action)
{
    getLevel().getWorld().ContactManager.BeginContact += action;
}

public void registerEndContact(EndContactDelegate action)
{
    getLevel().getWorld().ContactManager.EndContact += action;
}

Thanks in advance.

this is also posted on the farseer code plex page
Faeseer EndContact Discussion

sentences:
Is there a javascript physics engine that does not require canvas? I just need a really simple and small physics engine for squares or circles that moves images using javascript. For the project that I am working on, I can't use canvas, so I will be moving the images via the dom. If I understand it correctly, Box2D and PhysicsJS both require the canvas (or at least in my testing that seemed to be the case). I don't really want to make my own, because I bet there is something out there that already does this.

So, is there a javascript physics engine that does not require canvas?

sentences: Is there an approach in creating an AI Framework? I am creating a board game using Actionscript 3.0. I've finished it to the point of the game playable with (computer players making random decision). I'm now working to create an AI framework/module ( Designing and creating classes that will be used to drive the AI). Is there a commonly/popular approach on creating an AI framework)? I've searhed around abit and could only find algorithms and sample codes. What I'm not looking for game/code specifics but more to thinking process in designing and modeling the AI.

sentences:
Why does Forge not find my texture for my custom background? I am creating a minecraft mod that improves the main menu for my minecraft server. At first I wanted to create the background, but somehow when I try to start minecraft it closes and I get a nullpointerexception because minecraft didn't find my background.

public class ThundrialMenu extends GuiScreen {

    @Override
    public void initGui() {

    }

    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        Random rnd = new Random();
        int background = rnd.nextInt(3)+1;
        String backgroundLocation = "/assets/thundrial/gui/Background"+background+".png";
        this.drawBackground(mc.renderEngine.getTexture(new ResourceLocation(backgroundLocation)).getGlTextureId());
        super.drawScreen(mouseX, mouseY, partialTicks);
    }

    @Override
    public void updateScreen() {
        super.updateScreen();
    }
}

This is the folder where the pictures are located:

Why does Minecraft not find those pictures?

sentences:
How does one achieve a 'shimmering' effect similiar to the ones from the Pokemon games? I have an assignment to make a game in C++ using Winapi. As such I've decided to recreate pieces of the Pokemon games. I'm pretty well underway with the project, but there's one effect I would like to achieve that I don't really know how to achieve.

It can first be seen just before the game's title screen. (Pictured below)

As you can see, the logo sort of 'shimmers' from left to right a few times.

A similiar effect can be seen inside of combat when a pokemon's stats are altered. (Pictured below)

The effects I am talking about are the reddish shimmer appearing on the wolf (Poochyena), and the blue 'waves' appearing on the beaver (Bibarel).

I would like to know if there is a generalized method of applying such effects, as I aspire to have more than one Pokemon in the project, and I would therefore want a method that works on all cases. If the effect cannot be effectively achieved using winapi, then I am open to suggestions of other libraries, etc, to use.

sentences:
Empty game object (child of player) not changing position correctly when key pressed I've made an empty game object which is the child of the player. It is by default on his right side and following his every move, and I want to make it so that every time a directional key is pressed (WASD) it changes position and stays there. But the way I've made it, it's not working as intended and seemingly goes to random positions every time. Here's the script:

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

public class ChangePositionAccordingToKey : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            transform.position = new Vector3(-0.58f, 3.09f,0);
        }
    }
}

This is probably a dumb question but I am new to coding so I can't figure it out. Any help is greatly appreciated

sentences:
Separating components and logic I've been working on how to build some of my game systems using components and systems. I'm having a little trouble following the approach that components should just be bags of data and systems should implement the logic. It'd seem for this to be true you have to limit the complexity of the components or somehow make the system aware of all possible complexity.

For example, I have equipment in my game that characters can equip. Equipment has an "Item" component that has an item name, description, value etc. and allows me to identify it as an item for the purpose of character inventory, etc. That's simple enough.

Here's my problem though. Equipment also needs to be "equippable". Originally, I implemented it as something like this:

class EquipComponent : public Component
{
public:
     virtual bool equip(Entity* character) = 0;
     virtual bool unequip(Entity* character) = 0;
};

then I'd export this class to my scripting engine, and I'm free to have equip/unequip do whatever I want to the character they're being equipped too.

When I try to implement this component as just a bag of data, it just seems so limited. If I want the equipment to increase stats, I can add an array of stat adders/multipliers. If I want to have equipment add status effect resistances, I can add a table for that. If a piece of equipment has different effects for different weatrers, now I have to add data on a per user basis. Suddenly my simple bag of data has gotten massive. I could split it into seperate components, but now my system needs to be aware of every possible component that can change how an item is equipped.

I can see problems like this popping up in a lot of potential components/systems, so I was wondering how one can decouple the components and systems? Am I thinking too rigidly that most component logic should be handled by systems? As much as this is a learning experience, I would like to have something I can use for more than one project and that has good scalability.

Any insight or advice would be appreciated!

sentences: Unity 5: Use Network Simulator, should I? I am looking to test intelligent prioritisation of a client server game. In my scenario, two clients are connected to the server. I want one client to have a good connection to the server while the others is poor. With my test environment the server and clients are machines within a lab. Can the network simulator within the Network Manager Script do this? Can the network simulator be used on the clients or does it have to be used on the server? Can I, for my situation, have one client use it and bump up the latency or packet loss and then have the other client not use it? I couldn't find anything within Unity's Documentation about this.

sentences:
Cocos2d: Adding a CCSequence to a CCArray I have a problem with an action performed by a sprite. I have one CCSequence in a CCArray and I have an scheduled method (is called every 5 seconds) that make the sprite run the action. The action is performed correctly only the first time (the first 5 seconds), after that, it does not.

Here is the code:

In .h ->

@interface PowerUpLayer : CCLayer {
    PowerUp *powerUp;
    CCArray *trajectories;
}

@property (nonatomic, retain) CCArray *trajectories;

In .mm ->

@implementation PowerUpLayer

@synthesize trajectories;

-(id)init
{
    if((self = [super init]))
    {
        [self createTrajectories];
        self.isTouchEnabled = YES;
        [self schedule:@selector(spawn:) interval:5];
    }

    return self;
}

-(void)createTrajectories
{
    self.trajectories = [CCArray arrayWithCapacity:1];

    //Wave trajectory
    ccBezierConfig firstWave, secondWave;

    firstWave.controlPoint_1 = CGPointMake([[CCDirector sharedDirector] winSize].width + 30, [[CCDirector sharedDirector] winSize].height / 2);//powerUp.sprite.position.x, powerUp.sprite.position.y);
    firstWave.controlPoint_2 = CGPointMake([[CCDirector sharedDirector] winSize].width - ([[CCDirector sharedDirector] winSize].width / 4), 0);
    firstWave.endPosition = CGPointMake([[CCDirector sharedDirector] winSize].width / 2, [[CCDirector sharedDirector] winSize].height / 2);

    secondWave.controlPoint_1 = CGPointMake([[CCDirector sharedDirector] winSize].width / 2, [[CCDirector sharedDirector] winSize].height / 2);
    secondWave.controlPoint_2 = CGPointMake([[CCDirector sharedDirector] winSize].width / 4, [[CCDirector sharedDirector] winSize].height);

    secondWave.endPosition = CGPointMake(-30, [[CCDirector sharedDirector] winSize].height / 2);

    id bezierWave1 = [CCBezierTo actionWithDuration:1 bezier:firstWave];
    id bezierWave2 = [CCBezierTo actionWithDuration:1 bezier:secondWave];

    id waveTrajectory = [CCSequence actions:bezierWave1, bezierWave2, [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil];

    [self.trajectories addObject:waveTrajectory];
    //[powerUp.sprite runAction:bezierForward];

    //        [CCMoveBy actionWithDuration:3 position:CGPointMake(-[[CCDirector sharedDirector] winSize].width - powerUp.sprite.contentSize.width, 0)]
    //[powerUp.sprite runAction:[CCSequence actions:bezierWave1, bezierWave2, [CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)], nil]];

}

-(void)setInvisible:(id)sender
{
    if(powerUp != nil)
    {
        [self removeChild:sender cleanup:YES];
        powerUp = nil;
    }
}

This is the scheduled method:

-(void)spawn:(ccTime)dt
{
    if(powerUp == nil)
    {
        powerUp = [[PowerUp alloc] initWithType:0];

        powerUp.sprite.position = CGPointMake([[CCDirector sharedDirector] winSize].width + powerUp.sprite.contentSize.width, [[CCDirector sharedDirector] winSize].height / 2);

        [self addChild:powerUp.sprite z:-1];

        [powerUp.sprite runAction:((CCSequence *)[self.trajectories objectAtIndex:0])];
    }
}

I don't know what is happening; I never modify the content of the CCSequence after the first time.

sentences:
Conversion of a number from Single precision floating point representation to a Half precision floating point Hope it is relevant here.

I have a code where I have to work on Half precision floating point representation
numbers. To achieve that I have created my own C++ class fp16 with all operators(arithmetic logical, relational) related to this type overloaded with my custom functions, while using a Single precision floating point number with a Half precision floating point number.

Half precision floating point = 1 Sign bit , 5 exponent bits , 10 significand bits = 16 bit

Single precision floating point = 1 Sign bit, 8 exponent bits, 23 significand bits = 32 bits

So what I do to convert from a Single precision floating point number to a Half precision floating point number:-

For significand bits - I use truncation i.e. loose 13 bits from the 32 bits to get 10 bits significand for half precision float.

What should I do to handle the exponent bits. How do I go from 8 exponent bits to 5 exponent bits?

Any good reading material would help.

sentences: How do I combine two HTML levels? If I have two levels that I have made separate in HTML5 how may I combine them so one comes after another?.

sentences:
Separating Game Engine from game code in similar games, with versioning I have a finished game, that I want to decline in other versions. These would be similar games, with more or less the same kind of design, but not always, basically things might change, sometimes little, sometimes big.

I would like the core code to be versioned separately from the game, so that if say I fix a bug found in game A, the fix will be present in game B.

I am trying to find the best way to manage that. My initial ideas are this:

Create an engine module/folder/whatever, that contains everything that can be generalized and is 100% independent from the rest of the game. This would include some code, but also generic assets that are shared among games.
Put this engine in its own git repository, which will be included in the games as a git submodule

The part I am struggling with is how to manage the rest of the code. Let's say you have your menu scene, this code is game-specific, but also most of it tends to be generic and could be reused in other games. I can't put it in the engine, but re-coding it for each game would be inefficient.

Maybe using some sort of git branches variation could be effective to manage that, but I don't feel like this is the best way to go.

Anyone has some ideas, experience to share or anything about that?

sentences:
Lights not displayed on Sprite I have a scene that contains 3 elements:

Main Camera
A 2D Sprite that renders a single white pixel image, scaled to 2000 x 1000
A point light with a yellow color

What should be done so that the light is actually rendered on the sprite?
I have recorded a short video showcasing the issue: https://www.youtube.com/watch?v=g2iZB6BXhPs

sentences:
How can I clearify users my controlls? In my game I use a really simple control mechanic to control a character on screen. But my problem is that users do not understand this control.

Beside a little delay problem they work this way:

  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.

a) Do you think this mechanic could work, if my users learn to use it?

If yes: what would be the best way to show them how it works? A short video? Or some graphics? Maybe a tutorial level?

My concern is that it might be not a good mechanic, because people do not understand it when playing my prototype the first time. That could be because they only know swipe and tap, but not swipe-hold-swipe.

I do not know if there is a right answer or if it is just a question of opinions.

sentences:
How to check if user has integrated graphics card? I'm almost done with my Direct3D game. When user starts game first time it will adjust settings (and maximum settings) based on DirectX feature level starting from 9_1 up to 11_1. I have different shaders/multisampling/anisotropy/LOD/shadows. I used my personal PC for development and I had so much backup power I thought performance wont be a problem. Then I bought laptop with integrated graphic card which supports 11_1 but is extremly slow (AMD A6-4400M, Radeon 7520G). First I thought it's my game but after few days of intense testing in other games it feels like integrated card has not enough power. In my game on full settings game drops to 30fps. When I disable few settings I can easly get up to 60 (which is required by Windows store apps).

I don't want to ruin user experience first time he runs app so I would prefer to adjust his settings to 60 fps and here is my question. Is there any way to check if it's integrated card and does it make any sense? I don't want to force user to run some simulator. I could also check ram but I won't solve my problem since game is not using much ram.

Thanks in advance.

Edit: Fixed hardware description.

sentences:
Breaking up List into sublists by multiple values I'm trying to break up a C# List<InventoryItem> into multiple lists based on two different values: InventoryItem.name and InventoryItem.isStackable.

I want the list to be broken up into multiple lists for the purpose of populating my UI with the data - while keeping non-stackable items in their own list (one item per item slot in UI terms.)

If this is the input:

{
   InventoryItem - name:apple,  stackable:true
   InventoryItem - name:apple,  stackable:true
   InventoryItem - name:carrot, stackable:true
   InventoryItem - name:knife,  stackable:false
   InventoryItem - name:knife,  stackable:false
 }

I should get this output:

{
   InventoryItem - name:apple, stackable:true
   InventoryItem - name:apple, stackable:true
 }
 {
   InventoryItem - name:carrot, stackable:true
 }
 {
   InventoryItem - name:knife, stackable:false
 }
 {
   InventoryItem - name:knife, stackable:false
 }

I'm successfully separating by name alone (see below), but I'm not sure how to take isStackable into account. I'm also using LINQ which I'd prefer to avoid if possible.

var itemsByType     = new List<List<InventoryItem>>();
var inventoryByItem = inventory.GroupBy(x => x.name);
foreach(var v in inventoryByItem)
{
    var itemList = v.ToList();
    itemsByType.Add(itemList);
}

sentences:
GL_SPOT_CUTOFF not working properly I'm new to OpenGL. I'm studying OpenGL 2.1 and I'm trying to make a little program to test the GL_SPOT_CUTOFF property, but when I set a value between 0.0-90.0, the light doesn't work and everything is dark.

The code:

void lightInit(void) {

    GLfloat light0Position[] = {0.0,0.0,2.0,1.0};
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0);
    glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
}

void reshapeFunc(int w, int h) {

    glViewport(0, 0, (GLsizei) w, (GLsizei) h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    if (w <= h)
        glOrtho(-4, 4, -4*(GLfloat)h/(GLfloat)w, 4*(GLfloat)h/(GLfloat)w, -4.0, 4.0);
    else
        glOrtho(-4*(GLfloat)w/(GLfloat)h,4*(GLfloat)w/(GLfloat)h, -4, 4, -4, 4.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    gluLookAt(0,0,0,0,0,-1,0,1,0);

}

void displayFunc(void) {

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // center sphere
    glutSolidSphere(1, 100,100);

    // right sphere
    glPushMatrix();
        glTranslatef(3,0,0);
        glutSolidSphere(1, 100,100);
    glPopMatrix();

    // left sphere
    glPushMatrix();
        glTranslatef(-3,0,0);
        glutSolidSphere(1, 100,100);
    glPopMatrix();

    glutSwapBuffers();

}

void keyboardFunc(unsigned char key, int x, int y) {

    if (key==27) {
        exit(EXIT_SUCCESS);
    }

}

int main(int argc, char** argv) {

    //freeglut init and windows creation
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(600, 500);
    glutInitWindowPosition(300, 100);
    glutCreateWindow("OpenGL");

    //glew init and errors check
    GLenum err = glewInit();
    if (GLEW_OK != err) {
      fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
      return 1;
    }
    fprintf(stdout, "---GLEW %s---\n\n", glewGetString(GLEW_VERSION));

    //general settings
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);

    //light settings
    lightInit();

    //callback functions
    glutDisplayFunc(displayFunc);
    glutReshapeFunc(reshapeFunc);
    glutKeyboardFunc(keyboardFunc);

    glutMainLoop();

    return 0;

}

This code produces this image:

If I delete glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0);, the next image is produced:

Is there some kind of bug ?

sentences:
OpenGL - question about glColorPointer So, I'm just starting out with LWJGL, and my current task is to render two colored cubes on the screen. I can render them, however, I'm looking for some advice on the most efficient way to specify the colors. Currently, I'm doing this:

// specify vertices and colors
vertexData.put(new float[] { -0.5f, -0.5f, 0, 0.5f, -0.5f, 0, -0.5f,  0.5f, 0, 0.5f,  0.5f,  0, // 1st cube vertices
                             -1.0f, -2.5f, 0,    0, -2.5f, 0, -1.0f, -1.5f, 0,    0, -1.5f,  0 }); // 2nd cube vertices
colorData.put(new float[] { 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, // colors for 1st cube
                            1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1 } ); // colors for 2nd

In the render loop:

glVertexPointer(vertexBufSize, GL_FLOAT, 0, 0L);
glColorPointer(colorBufSize, GL_FLOAT, 0, 0L);
...
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); // 1st cube
glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); // 2nd cube

This works, but I can't help but think that since I'm specifying the exact same color values for both cubes, I'm wasting memory. I was hoping to just have one set of vertex colors that could be applied to each cube that gets drawn. Can it be done? If so, what is the best way to do it?

Thanks

sentences:
How do I separate physics from framerate? Skyrim (Creation Engine / Gamebryo) is a prime example of a game that has its physics tied to the framerate for which it has been heavily criticized, because if you disable vsync / have a > 60 HZ monitor the physics will glitch, characters will fly into the air, and the screen will flicker while you are put into a swimming position. This problem can be solved by using a framerate limiting mod. But I want my game to run at any framerate, any refresh rate, just fine. How can I do that? Sorry if this isn't a game development question necessarily, it's more of a game engine question.

I looked and saw similar questions asked but they were very old and new tech / new programming techniques might have allowed better ways to do it since 2008.

sentences:
Unity 5 Dynamic Button Creation with Event Parameters According to the documentation, you cannot instantiate buttons except via prefab instantiate.

http://docs.unity3d.com/Manual/HOWTO-UICreateFromScripting.html

  You might wonder why we don’t have a API methods to create the various types of controls, including visuals and everything. The reason is that there are an infinite number of way e.g. a button could be setup. Does it use an image, text, or both? Maybe even multiple images? What is the text font, color, font size, and alignment? What sprite or sprites should the image use? By letting you make a prefab and instantiate that, you can set it up exactly the way you want. And if you later want to change the look and feel of your UI you can just change the prefab and then it will be reflected in your UI, including the dynamically created UI.

What I'm trying to do is dynamically create a table of buttons, each one going to a level in my game. The amount of button depends on how many levels the user has unlocked.

I can create a prefab for a button, that's fine, but how do I go about assigning an OnClick event to each of these buttons with an appropriate 'levelIndex' parameter?

I can not find any scripting method to do this, and I'd like to avoid hacky solutions like creating 50 buttons and only showing the first N children.

sentences:
Low CPU/Memory/Memory-bandwith Pathfinding (maybe like in Warcraft 1) Dijkstra and A* are all nice and popular but what kind of algorithm was used in Warcraft 1 for pathfinding?

I remember that the enemy could get trapped in bowl-like caverns which means there were (most probably) no full-path calculations from "start to end".
If I recall correctly, the algorithm could be something like this:

A) Move towards enemy until success or hitting a wall

B) If blocked by a wall, follow the wall until you can move towards the enemy without being blocked and then do A)

But I'd like to know, if someone knows :-)

[edit] As explained to Byte56, I'm searching for a low cpu/mem/mem-bandwidth algo and wanted to know if Warcraft had some special secrets to deliver (never seen that kind of pathfinding elsewhere), I hope that that is more concordant with the stackexchange rules.

sentences: Rushing water in Unity How would I go about creating a river with rushing water?  I can do the texture around it but I'm stuck on the actual water part.  This is in Unity3D.

sentences:
is wisdom of what happens 'behind scenes' (in compiler, external DLLs etc.) important? I have been a computer-fanatic for almost a decade now. I've always loved and wondered how computers work, even from the purest, lowest hardware level to the very smallest pixel on the screen, and all the software around that.

That seems to be my problem though ... as I try to write code (I'm pretty fluent at C++) I always sit there enormous amounts of time in front of a text-editor wondering how every line, statement, datum, function, etc. will correspond to every Assembly and machine instruction performed to do absolutely everything necessary for the kernel to allocate memory to run my compiled program, and all of the other hardware being used as well.

For example ... I would write cout << "Before memory changed" << endl; and run the debugger to get the Assembly for this, and then try and reverse disassemble the Assembly to machine code based on my ISA, and then research every .dll, library file, linked library, linking process, linker source code of the program, the make file, the kernel I'm using's steps of processing this compilation, the hardware's part aside from the processor (e.g. video card, sound card, chipset, cache latency, byte-sized registers, calling convention use, DDR3 RAM and disk drive, filesystem functioning and so many other things).

Am I going about programming wrong? I mean I feel I should know everything that goes on underneath English syntax on a computer program.

But the problem is that the more I research every little thing the less I actually accomplish at all. I can never finish anything because of this mentality, yet I feel compelled to know everything... what should I do?

sentences:
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: 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:
Texture the quad with different parts of texture I have a 2D quad. Let say it's position is (5,10) and size is (7,11).

I want to texture it with one texture, but using three different parts of it.
I want to texture the part of quad from x = 5 to x = 7 with part of texture from U = 0 to U = 0.5 (replaying it after achieving 0.5, so I will have 4 same 0.5-lenght fragments).
The second one with some other part of texture (also repeating it) and third in the same style.

But, how to achieve it?

I know that:

float2 tc = fmod(input.TexCoord, textureCoordinates.zw - textureCoordinates.xy) + textureCoordinates.xy; //textureCoordinates.xy = fragments' offset

Will give me the texture part replaying.

sentences:
Minimal Projection Matrix i hope you can help me. I'm currently stuck at the creation process for projection matrices used by shadow maps.

The problem is the following:
I got the spot/directional light projectionmatrix/boundingfrustum and additionally the bounding frustum of the camera projection matrix.

What i need is the minimal bounding box of these two frustums. How do i get that? Or is there a better way to create projection matrices for shadow maps?

sentences:
Floor is made up of tiles with their own box colliders. Pushable item gets stuck on the "seams" So I have a scene where the floor is made up of some tiled objects. All of these have the exact same height and exact same Y position. I also have a block with a rigidbody that you can push on the ground. It has a rigidbody with freeze rotation enabled for X, Y, and Z.

My issue is this: when pushing the block around, it sometimes gets stuck when reaching the seams of the tiled objects. I have tried giving it a friction of 0, but it still gets stuck sometimes. Is there any solution for this, other than manually creating a big collider that spans the entire floor?

sentences:
How do I create a closed beta on the App Store? After months of hard work, much to my surprise I'm about to unlock the "feature complete" and "production ready" achievements with the game I'm working on, so it's time to ask my colleagues and Facebook acquaintances if they'd like to help me by playtesting the game.

This is going to be my first game, and I'm wondering if I can somehow upload it as a "closed beta" to the App Store and generate a couple of keys/tokens, so I could hand these to my playtesters? This way they wouldn't have to install unsigned developer versions, so they'd also be testing the real installation process, and of course paying customers wouldn't even be seeing the product until I make it public.

Is this how a closed-beta testing goes at all?

sentences:
logitech dual shock Python support Does anyone know how to use "dual vibration feedback makes your games more realistic and immersive." on this logitech gamepad

I know about pygame however I don't think it gives feedback.

http://www.logitech.com/en-us/product/wireless-gamepad-f710

sentences:
Monogame/Android: Using content from PCL I'm quite new to Monogame and PCL, but I hope someone can help me with my question.

I have a Monogame/Android project with references a PCL which targets .NET 4.5, iOS and Android.
The PCL has content files suchs as SpriteFont and Texture2D. They are set to "Content", "Always copy" and are .xnb files.
The problem is when I start my Android game I get a "asset not found" exception for the content in the PCL. When I launch my Windows game it works all fine.

To begin with, can I have content files in a PCL and is that good practice?

sentences:
How to prevent clients from stuttering while keeping the game in sync in multiplayer Pong? I wrote Pong in multiplayer. The clients all run their own game, but I have an authoritative server which enforces its ball position onto the clients.

The game is in sync and playable, however, there is some stuttering on the client side even with a fast connection. I've read that clients could be configured in a way that shows a smooth experience to the player, while in fact the connection may be lagging.

I was thinking about not directly correcting the ball position when a server position update comes in, but to increase or decrease the ball's velocity based on the difference. I didn't manage to get this working properly yet.

Am I thinking in the right direction? How would I make a calculation that shows a smooth experience to the players, while keeping the game in sync?

sentences:
Rotate an object on itself, from one random Quaternion to another I have a situation:
I have a 3D object in the world. let's say a sphere.
I have 2 random directionnal vector: vector A, and vectorB:

My question is: How to I rotate over time my object, from A to B ?
The vector A is important: I don't want to simply rotate the forward of the object from current forward to B.

I know I can use the function vector3 C = Vector3.SmoothDamp(...) in unity to lerp between my 2 vectors A & B.

but then ok, I have vector3 C, how do I apply the rotationof my object to C ?
if don't want to do:
gameObject.transform.forward = C;

I want something like:
gameObject.transform.rotation = SomeQuaternion(C, initial rotation A).
or something.

Thank you for help !

PS: I don't want to parent / unparent gameObject or something like that, i want the math answer, using Quaternion.

sentences:
How does having the Debugger change the game execution on an XBOX 360? So I thought my issue was relating to the difference between a Debug and a Release build as per this question: What's the difference between a "Release" Xbox 360 build and a "Debug" one? but I've since found that if I go ahead and build a Creators Club version of the game using a Debug build and deploy to the XBOX, I get the same experience I had with the Release version of my game.

However if I run the game from Visual Studio using F5 and having set the XBOX as the default platform, then the game runs as expected. If I change from Debug to Release and run with CTRL+F5 then the game also works as expected.

How would running the game with the debugger attached change the results I am getting in game? Is there any way that I can use the same approach or change the default compilation of the game so that I can use this approach to release my game?

sentences:
How to find a point of taking into account the distortion of the projection I can not find the material that will help me to implement the algorithm of coordinate transformation based on the distortion of the projection.

I am creating a code recognition algorithm (similar to qr-code). After recognizing the image I get the three points.

My problem that image have different projection distortion, size and angle.

How do I find the k point, knowing the coordinates of p1, p2, p3 with distortion and without distortion of the projections.

Help me to understand! Perhaps there are ready-made algorithms or literature that will help implement it.

It is very important for me. Thank you!

sentences:
Generate ETC2 compressed texture from Android Bitmap in OpenGL ES 2 My app currently uses a lot of textures most of which probably could be compressed quite a lot by using ETC2 (my app runs on 4.4 so i have a lot of devices supporting GLES30), i cannot use ETC1 since i need alpha too.

Problem is that i map my textures from a Bitmap i create dynamically (and quite often every 60 seconds), i currently map them this way (textures are not power of 2 sized):

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, id);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, mode);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, mode);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);

So i was wondering if:

Is it possible to load a Bitmap using ETC2 to use less memory on the graphic card? A code example would be great
How much overhead does the compression have? Mapping a 1024x1024 ARGB_8888 Bitmap every 60 seconds is feasible?

sentences:
Unity3d - How to use controller joystick to look around? I try to use my xbox controller as input device for a game targeted to run on windows. However the documentation fails to explain how to set it up.
E.g. how can I use the right stick from my xbox controller to look around, like in any 3D game? Even such a common task is not documented.

I found a very old wiki entry where the xbox controller is briefly described, I was able to find out that the Y-Axis of the right analog is called 5th axis (Joysticks) and the X-Axis is called 4th axis (Joysticks). I post the images below, in case the link get's dead.

Linux

Note: wired controllers only support axises for the d-pad, while the wireless controller only supports buttons for the d-pad, refer to the table above for the wireless controller configuration.

I figured out that the name of a control is responsible for the action which the button, stick, key, pedal etc. does. But it is not documented how the control has to be named for looking around vertically or horizontaly like you can do in an 3D game to look around with the camera by using the right joystick (e.g. witcher 3)

How can I control the camera by using the right joystick?

sentences:
Equation for exponential deceleration so the objects “stops” at destination Let's say my ship's velocity during deacceleration phase is given by:

v(t) = v0 * exp(-k * t)

where v0 is the speed at the time of starting deacceleration and k is arbitrary constant.

My problem is: Is it possible to calculate such k that the ship "stops" (let's say slows to a velocity vf) at the target position given:

v0
distance to the target d0
?

Or alternatively: given k calculating a distance at which deacceleration should start?

I'm making a space simulation game where the ship's warp drive needs to accelerate/deaccelerate exponentially. While accelerating to a maximum speed is easy the problem is with deaccelerating so that the ship "stops" at the destination.

Thank you in advance for any help.

sentences:
Who has the rights to the party game Mafia / Werewolf? Who has the rights to the party game Mafia / Werewolf?

Or is it public domain, meaning anyone can do an implementation of the game and release it as a commercial product?

Update 1:
According to this question:
Making a mobile app from a board game. Copyright infringement?

You can't copyright concepts or mechanics. This basically means this should be public domain, right?

sentences:
Integrating Moonsharp with Unity for Nintendo Switch project Has anyone tried to run Unity project with integrated Moonsharp on Nintendo Switch? Can it be done? Are there any significant performance issues due to running Lua scripts?

EDIT: Sorry, I wasn't clear enough about my intentions. I'm working on small project in my spare time and I was wondering if I could try to port my game to Nintendo Switch in future.

The problem is, I don't have my own switch sdk right now, so I can't simply check if integrating Moonsharp is even possible in such scenario. I would like to hear if anyone tried compiling unity project with moonsharp on switch and succeed, or should I look for another runtime scripting engine. I worked with switch SDK in past and I remember that compatiblity issues were real pain.

sentences:
MotionBuilder- Actor attached to Mocap moves fluently, but Character using Actor as source jitters and has joints occasionally pop out I'm trying to get a MotionBuilder animation to work in Unity on my custom character.
I've downloaded Motionbuilder FBX mocap files with Actors already attached from http://dancedb.eu/main/performances
The thing is that when I put the Actor as the Input source for my own (Characterized) character model and hit play on MotionBuilder, my model follows the animation 80% correctly but for the other 20% my character jitters and shakes and occasionally even "breaks a limb" when a joint randomly pops out of its place for a second.
Does anyone have suggestions on how to get the animation smoother for my Character?

sentences:
How to remove white background from an image using LibGdx? I am fairly new to game development.

I am developing an application(Aquarium) for windows which requires me to animate(move) fishes around the screen and user will be able to add new fishes drawn on paper and scanned into the application, I did some research and decided to use LibGDX so when user scans the image coming to the system has White background which needs to be removed I needed to know how to remove that make it transparent in LibGDX.

sentences:
Drawing bullets on a map I'm going to be making a shooter-style game, on a navigatable map (All 2D). I'm a little unsure of how to handle the bullets: I see two main ways i could do it

I could have the bullet's x and y position be updated based on its trajectory, and then draw it using the formula

Screen.x - Bullet.x , Screen.y - bullet.y

This would draw the bullet relative to the players location, so that it would appear on the map

The other main method I am considering is drawing the bullet directly to the map image via the getGraphics() method. However, this seems like it could cause performance issues, as just testing this seemed to lag

(this was my test method)

public void Draw(Graphics g){
    image.getGraphics().drawRect(10,10,10,10);
    g.drawImage(image,0,0,null);
}

Adding in the drawRect line caused considerable lag - removing it made the game run fine

Are either of these a good way to handle drawing projectiles? If not, how else could I do it efficiently?

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:
bmGlyph alternative for windows (Bitmap font generator) I have been using this tool (bmGlyph http://www.bmglyph.com/) to create fonts from apple machines, but now, I'm on windows and need a program with same / more features. The main features about this program is the possibility of give a grandient color and apply a texture to each glyph. Could anybody recommend something like this for windows?

Thanks in advance.

sentences:
How do I combine multiple squares into one Tetris block? I am learning Phaser by making a simple game—Tetris. I'm having difficulties:

Can I use simple rectangles as tetrominoes or they should be sprites? I don't know how make the figure's block from simple rectangles and apply physics to it.
How I can join 4 separate squares into one tetromino?

sentences:
What size textures do I need for a 2D grid based game if my tiles are larger than textures I have? I'm building a grid-based game for iPad, and for usability purposes I've selected my game grid to be built of 75x75 squares. However, so far I've seen that the majority of (free)texture catalogs I can find are either 16x16 or 32x32.

Currently I have the graphics engine stretch the 32x32 texture onto a 75x75 tile, which does not look very sharp.

How can I make my game look good -  do I need to create textures whose size is equal to my game tile? Should I try to stitch multiple textures together (like 4 texture squares per game square)?

sentences:
Doubt about texture waves in CG Ocean Shader I'm new on graphical programming, and I'm having some trouble understanding the Ocean Shader described on "Effective Water Simulation from Physical Models" from GPU Gems. The source code associated to this article is here.

My problem has been to understand the concept of texture waves. First of all, what is achieved by texture waves? I'm having a hard time trying to figure out it's usefulness.

In the section 1.2.4 of the article, it does say that the waves summed into the texture have the same parametrization as the waves used for vertex positioning. Does it mean that I can't use the texture provided by the source code if I change the parameters of the waves, or add more waves to sum?

And in the section 1.4.1, is said that we can assume that there is no rotation between texture space and world space if the texture coordinates for our normal map are implicit.
What does mean that the "normal map are implicit'? And why do I need a rotation between texture and world spaces if the normal map are not implicit?

I would be very grateful for any help on this.

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:
How do I get access to the SpriteBatch service in my Sprite class using XNA? I have the following Sprite class (leaving out everything that doesn't pertain to my question):

public class Sprite
{
    public Texture2D Texture { get; set; }
    public Vector2 Position { get; set; }
    private SpriteBatch _spriteBatch;

    public Sprite(Texture2D texture, Vector2 position)
    {
        Texture = texture;
        Position = position;

        // what code do I put here?
        _spriteBatch = ???
    }

    public virtual void Draw()
    {
        _spriteBatch.Draw(Texture, Position, Color.White);
    }

In my Game1.cs class, I register the SpriteBatch as a service:

protected override void LoadContent()
{
    _spriteBatch = new SpriteBatch(GraphicsDevice);
    Services.AddService(_spriteBatch);
}

Problem is, I don't know what code to put in the Sprite constructor to get the SpriteBatch object from the service. It doesn't have access to the Game.Services object. How would I load the service in this case?

sentences:
Storing Highscores using PlayerPrefs in Unity int highscore = 0;
void Update()
{
    storepoints();
    print(PlayerPrefs.GetInt("highscore", highscore));
}
void storepoints()
{
    if (points>highscore)
    {
        highscore = points;
        PlayerPrefs.SetInt("highscore", highscore);
        PlayerPrefs.Save();
    }

}

Using the following code:

it works first time. But not the second time

so, for e.g, when I play the first time, suppose my score is 2, my high score becomes 2. However when I play the second time, and my score is 1. My high score becomes 1. This shouldn't happen.

sentences:
Applying texture inside of an Icosphere? I have implemented a code to generate an Icosphere procedurally in Unity 5.3.4f, which works pretty well. However, what I need to do know it tweak the code to make the sphere to receive texture only in its inside triangle-faces, not outside. Searching trough the Unity forums, many have said that it's simply the case of flipping the normals of all triangles (i.e. multiplying them by -1). I tried it and it is not the case.

What is the correct way of changing the triangles (not trough shaders) so the Icosphere mesh can only be textured inside (e.g. in a skydome)?

EDIT: After Kromster's answer, I did some research and ended up implementing the following code:

Mesh InvertMeshFaces(Mesh _mesh)
{

    //Flip the triangles
    int[] triangles = _mesh.triangles;

    int numtriangles = triangles.Length / 3;
    for (int t = 0; t < numtriangles; t++)
    {
        int temptriangle = triangles[t * 3];
        triangles[t * 3] = triangles[(t * 3) + 2];
        triangles[(t * 3) + 2] = temptriangle;
    }

    //reseting the UV
    Vector2[] uvs = _mesh.uv;
    for (int uvnum = 0; uvnum < uvs.Length; uvnum++)
    {
        uvs[uvnum] = new Vector2(1 - uvs[uvnum].x, uvs[uvnum].y);
    }

    //reseting normals
    Vector3[] normals = _mesh.normals;
    for (int normalsnum = 0; normalsnum < norms.Length; normalsnum++)
    {
        norms[normalsnum] = -norms[normalsnum];
    }

    //setting the new values of triangles, normals and UVs
    _mesh.triangles = triangles;
    _mesh.uv = uvs;
    _mesh.normals = normals ;

    return _mesh;
}

So far, it works only partially. Applying that function to my Icosphere mesh, now it is possible to see the sphere rendered when camera is inside it. However, oddly enough, it's still also possible to see the sphere from outside. It means, both inside and outside are visible - the outside is not culled as expected.

sentences:
Perspective correct texture mapping in iOS Metal I tried various ways of getting the interpolation work and generate a perspective correct image, but none of the suggested ways works.

My current code is:

struct VertexStruct
{
  float4 normalizedPosition [[ position ]];
  float4 texCoord;
}

vertex VertexStruct testVertex(device float4 *vertices [[ buffer(0) ]],
                                     uint vid [[ vertex_id ]])
{
  VertexStruct outVertices;

  outVertices.normalizedPosition = ...;

  outVertices.texCoord = float4(vertices[vid].x, vertices[vid].y, 0.0, 127.0);

  return outVertices;
}

fragment half4 testFragment(VertexStruct inFrag [[ stage_in ]],
                            texture2d<half, access::sample> volume [[ texture(0) ]])
{
  float2 texCoord = float2(inFrag.texCoord.xy * (1.0 / inFrag.texCoord.w));
  constexpr sampler s(coord::normalized, filter::linear, address::clamp_to_zero);
  return volume.sample(s, texCoord);
}

Texture is 128x128 and vertices are:

0,0
0,127
127,0
127,127

In theory, the 4th parameter, w, should help with perspective correct interpolation. This trick has been reported to work in OpenGL ES, but in my case if I have it or not, nothing changes.

What I get is:

Blue is the clear color, while anything inside the black trapezoid is the content of the texture. The red trapezoid should be centered in the black trapezoid. If you open it with Photoshop and trace the diagonal of the black trapezoid, it will pass exactly true the diagonal of the red trapezoid.

It means that the two triangles that are rendered don't read the texture with perspective correct sampling. It is the classic problem of texture mapping, but I can't get my head around it.

Can anyone see the error?

sentences:
Tile collision detection Right. So I was making this simple game. The player is two tiles wide, and four tiles high. My current code is really buggy (it was better before my rewrite)

Here it is:

    float newx = position.x + velocity.x;
    float newy = position.y + velocity.y;

    int tx = (int) newx;
    int ty = (int) newy;

    Tile tile = WorldHandler.currentWorld.getTile(tx, ty);
    Tile ground = WorldHandler.currentWorld.getTile((int) position.x, (int) position.y-1);

    if (tile.type == 0) {
        position.x = newx;
        position.y = newy;
    }
    if (ground.type != 0) {
        grounded = true;
        //position.y = Math.round(position.y);
    }

    if (grounded) {
        velocity.x = 0.0f;
        velocity.y = 0.0f;
        //position.y = Math.round(position.y);
    } else {
        velocity.x = velocity.x * (1.0f - Math.min(0.1f, 1.0f));
        velocity.y += 0.0f;
    }

it basically uses the indices for performance.

But I need a decent collision detection system that wouldn't be painful to implement, would AARBs be of use here? Also, the game loop is a tick based one, it runs at 30 ticks/s.

sentences:
My game is not shown in Play Market New Releases I've published my app for like an 36 hours ago. It is possible to find it with exact search query ("Village Keeper") and it is available via the direct link.

Thing is I can't find it in "New Releases" ("New Free Games") and I can't find it by typing something like "village game" or "keeper". So I have only 3 installs by me and my friends.

Is it a bug or is a new app not guaranteed to get in "New Releases"? I tried to google it but found no answers. If so, how can indie developer get into the market with no money for an ad campaign?

P. S. I tried to contact Google Support twice and 24 hours after first email passed with no reaction.

sentences: How to Refresh Dependencies after Adding FreeType Extension in Android Project I'm planning to use FreeType fonts in my game (LibGDX and Android Studio) and I already added the freetype dependencies in my project. How can I refresh the dependencies after adding them? I have found few similar questions regarding this topic but didn't offer much help. Here is an image of the dependencies:

sentences:
Is there something like a "real-action-to-3D" filter? I recently watched the cutscenes of Call of Duty WWII and was very impressed with the graphics, especially the facial expressions and the creases in the clothing. This is, of course, pre-rendered material and not actual ingame footage.
After doing some research I found that they used real actors for the scenes (Josh Duhamel, Jonathan Tucker, ...) and filmed the scenes like it was a real-action movie.

This got my wondering if there is some kind of "filter", the turns real-action footage into something that looks like it is entirely computer generated?

So basically instead of going bottom-up and trying to make the 3D model look as realistic as possible, going top-down and alter real-action footage in a way that it looks like a 3D model.

Is this done?

Clarification: I am not referring to motion capture, at least I think I am not. I am not talking about filming facial expressions and applying the mechanics to 3D models, but rather taking the whole film and just put a filter on it to make it look 3D.

sentences:
Why doesn't this movement script work, while the other one does? Im trying to get a rigidbody2D to move around and got it working with this script:
public class RubyController : MonoBehaviour
{
public Rigidbody2D rigidbody2d;
public float speed = 5.0f;
Vector2 movement;

void Start()
{
    rigidbody2d = GetComponent<Rigidbody2D>();
}

void Update()
{
    movement.x = Input.GetAxis("Horizontal");
    movement.y = Input.GetAxis("Vertical");
}

private void FixedUpdate()
{
    rigidbody2d.MovePosition(rigidbody2d.position + movement * speed * Time.deltaTime);
}

but not with this, and I can't understand why:
public class RubyController : MonoBehaviour
{
public Rigidbody2D rb2d;
float horizontal;
float vertical;
public float speed = 5f;

private void Start()
{
    rb2d = GetComponent<Rigidbody2D>();
}

private void Update()
{
    horizontal = Input.GetAxis("Horizontal");
    vertical = Input.GetAxis("Vertical");
}

private void FixedUpdate()
{
    Vector2 position = this.rb2d.position;
    position.x = position.x * speed * horizontal * Time.deltaTime;
    position.y = position.y * speed * vertical * Time.deltaTime;

    rb2d.MovePosition(position);
}
}

sentences:
How to share Unity High Scores on social media (Facebook , Google+ and Twitter)? This may be a common question but as a n00b I have some confusion on achieving this .

I am on a small game project and I want the user to share his / her scores on social media after completing the game .

When they post , it should be something like "Hurrayyyy ! I Scored 12345 on -My Game App Name- , Can you beat my score ? Try it ." where '-My Game App Name-' and 'Try it' should be a link directing to Google Play / Windows Store etc .

My Idea is like this :-

Here Share This on Facebook , Share This on Google+ and Share This on Twitter are 3 UI Images with Button component attached to them .

So when the player clicks on those buttons , they should post on social media .

So how to achieve this ? I got something here , but I don't know how to use that . I will prefer not to use Facebook Unity Plugin . So can I achieve this ?
I need code in c# , not in JavaScript :)

I hope you will help me to figure this out .

Regards , NB :)

sentences: Top view physics engine For my first game i want to create a topview game in c++ where you can drive a car (like in gta2). As far as i know i dont need any gravity. While doing a bit of research about games they often advice a physics engine. What are the benefits of a physics engine on a topview game?

sentences:
Make a fake random distribution? Sometimes a "real" random event seems unfair and makes players frustrated. For instance a enemy has probability of 20% to cause double damage("critical hit"). Thus he could make 4 critical hits in a row with 1/725 probability. It's not as small as it sounds.

I hope the probability could be adjusted after each hit. If the player just got a critical hit, the probability decreases for the next hit. Otherwise it increases.

Is there a mathematical model for this behaviour?

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:
How to create a 2D physics waterfall I am trying to create a waterfall that looks similar to the first image below (please check this video for a better idea of what I want to achieve) with physics properties so it can move or around objects with colliders on its course (similar to the second image below). Though the linked waterfall is 3d I am interested in a 2d implementation.

Note that the objects are dynamic and some move frequently hence the waterfall has to reshape every frame. The objects move slowly either moving to different positions or rotating. How can this be done?

sentences:
Why would Rigidbody.AddForce not resulting in movement of my objects? I'm trying to get my card objects to spread out randomly but nothing happens. I know the method is called cause I get the prints in the console for each card. But they don't move. No errors reported. The cards have a RigidBody.

public static void CardCascade ()
{
     print ("CARD CASCADE!");
     foreach (var card in Card.Cards) {
          float range = 500F;

          var x = Random.Range (-range, range);
          var y = Random.Range (-range, range);
          card.rigidbody.AddForce (x, y, 0);
          print ("I just added force to card: X/Y " + x + y);
     }
}

sentences:
Why I get different size for equal attributes types? I trying to implement flexible shader attributes, but when I try to get them I got strange info.
This is my vertex shader:

    GLchar* vertexShader =
    "in vec4 position; \n"
    "in vec4 loc;\n"
    "\n"
    "void main()\n"
    "{\n"
    "gl_Position = position + loc;\n"
    "}";

This is my code with the help of which I get attributes info:

GLint i;
GLint count;

GLint size; // size of the variable
GLenum type; // type of the variable (float, vec3 or mat4, etc)

const GLsizei bufSize = 16; // maximum name length
GLchar name[bufSize]; // variable name in GLSL
GLsizei length; // name length

glGetProgramiv(shader->GetProgram(), GL_ACTIVE_ATTRIBUTES, &count);
printf("Active Attributes: %d\n", count);

for (i = 0; i < count; i++)
{
    glGetActiveAttrib(shader->GetProgram(), (GLuint)i, bufSize, &length, &size, &type, name);

    printf("Attribute #%d Type: %u Lenght: %d\n", i, type, length);
}

And what I get:

Why I got such strange info and how I can get size of each attribute?

sentences:
Unity mesh - delete quads I'm trying to delete quads in unity. The code here creates a procedural grid. Setting the gridSizeX to 5 and gridSizeY to 3, creates a 6 by 4 grid. I want to delete the first row of quads when I click the left mouse button (later will implement a trigger to delete). I have created a DeleteTriangle() method but it doesn't work properly. I would like to delete all the quads in the first row when I first click the left mouse button. When I click again, it should remove the next row and so on. Here is the code I have:
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class Grid : MonoBehaviour
 {
   Mesh mesh;
   Vector3[] vertices;
   int[] triangles;

   public float cellSize = 1;

   public int gridSizeX, gridSizeY;

   void Awake()
   {
     mesh = GetComponent<MeshFilter>().mesh;
   }

   void Start()
   {
    MakeGrid();
    UpdateMesh();
   }

   void Update()
   {
    if (Input.GetMouseButtonDown(0))
      {
        DeleteTriangle(0);
      }
   }

  void MakeGrid()
  {
    //set array sizes
    vertices = new Vector3[gridSizeX * gridSizeY * 4];
    triangles = new int[gridSizeX * gridSizeY * 6];

    //set tracker integers
    int v = 0;
    int t = 0;

    for (int x = 0; x < gridSizeX; x++)
    {
        for (int y = 0; y < gridSizeY; y++)
        {
            Vector3 cellOffset = new Vector3(x * cellSize, 0, y * cellSize);

            //populate the vertices and triangles arrays
            vertices[v] = new Vector3(-cellSize, 0, -cellSize) + cellOffset ;
            vertices[v + 1] = new Vector3(-cellSize, 0, cellSize) + cellOffset  ;
            vertices[v + 2] = new Vector3(cellSize, 0, -cellSize) + cellOffset  ;
            vertices[v + 3] = new Vector3(cellSize, 0, cellSize) + cellOffset  ;

            triangles[t] = v;
            triangles[t + 1] = triangles[t + 4] = v + 1;
            triangles[t + 2] = triangles[t + 3] = v + 2;
            triangles[t + 5] = v + 3;

            v += 4;
            t += 6;
         }
      }
    }

   void UpdateMesh()
   {
    mesh.Clear();

    mesh.vertices = vertices;
    mesh.triangles = triangles;
    mesh.RecalculateNormals();
   }

   private void DeleteTriangle(int id)
    {
      Mesh currentMesh = mesh;

      var triangles = currentMesh.triangles.ToList();

      triangles.RemoveAt(id );
      triangles.RemoveAt(id );
      triangles.RemoveAt(id );

      currentMesh.Clear();
      currentMesh.vertices = vertices.ToArray();
      currentMesh.triangles = triangles.ToArray();

      currentMesh.RecalculateNormals();
   }
 }

sentences:
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:
How do I switch between the game screen and score screen without redrawing everything? I'm working on a multiplayer game in Libgdx and  want to display the scores of say, the top 10 players on the map. The player should be able to checking the scores at any point during the game and return to the game screen (with themselves in the same location they were at earlier), much like pressing Tab during a game of Counter Strike displays the scores.

Changing the screen to the score screen is simple enough using setscreen, but how can I return to the previous view without calling a setscreen on the game screen and rendering everything all over again?

sentences:
How do I pass an object location into a vertex shader? I am using Blender Game Engine. I want to create a large flat plane, and deform it locally near a moving object.

So far (despite being a beginner at shaders) I've written a vertex shader for the plane which moves the vertices to their correct positions (constant positions, for now).

I cannot find a way to swap that constant location with an object's location updated every frame, while the shader is running. I am not even sure if it's possible. I only want to access a specific object's center from the shader.

sentences:
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:
Inventory management syncronized network I'm implementing an inventory system with items in 1x1 slots in a open-world multiplayer game. But I can't decide how I want to synchronize the item management with the server. I see two options here.

Server and client are fully synced after every move.
Synchronize every action the player takes in their inventory, even the action of "lifting" items.
Server only syncs "when neccessary" An unordered list on the server keeeping track of WHAT items the player has and not WHERE (in what slot) they are. Then every time the player drops/uses/acquires or stacks/unstacks an item the client syncs their inventory including slot positions with the server.

Is there perhaps another option that's even better?

sentences:
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: UE4 Procedural Planet Design I am building a game that requires a full planet but it would be too complicated to create it as one mesh, so I decided that I will use procedural generation to create the (partially) editable landscape, rocks, trees, caves, etc. I was wondering on what server-side a procedural planet is generated? For example, is it generated when the player first plays the game, and is it the same for every player? Or is it completely rebuilt each time the player enters the game? If the answer is the latter, is there any way to somehow save the planet and make it into one map for everybody using the game and not change if they reload the game? If possible, I would strongly prefer any answers in Blueprints rather than C++. FYI: I haven't started building the game yet and am still researching my options for how to create the world. I didn't find much about saving the character's location anywhere so far.

sentences:
Concerns about using a 3D tileset grid I'm thinking of implementing a 3D tile system for my engine, and tie it to it's world streaming system as well. As in, using it for it's terrain for an open world in an engine that theoretically can support up to about 80 kilometers squared even if it won't be fully used.

The game will be making use of both free form movement, and tiled movement when it comes to combat. With cover systems involved.

I was wandering about a few questions.

How viable is it to use a bunch of smaller tiles for terrain? Think Dota 2 Reborn. Where the increased levels are guaranteed to be flat and at exact heights. And there will be hills and the like connecting them.

If I was to use tiles, do I need to weld the vertexes and recompute the normals for the affected vertices?

If I do not need to connect them, will it cause any visible artifacts? Or any sort of performance hits? I know I can batch all the standard tiles. But I don't think the same can be said if I treat the terrain tiles like normal terrain when it comes to texturing.

sentences:
Unity WebPlayer : WWW GET Requests fail in webplayer only, not in editor My question is about my game requesting data from my server-side cloud-based storage (I have the option of free public Dropbox or Amazon S3) via GET and the WWW class, and it not working only in the WebPlayer (works fine in the Editor).  By not working, I mean that the request is sent successfully, authorized and responded to by the cloud-service, but that WWW shows an error in the logs.  In the case of using Amazon S3, the Web Player even crashes, otherwise it just fails gracefully and the user is unable to move forward.

The Error log left by the webplayer says the following:

  WWW Error: Error when creating request. GET request with custom
  headers is not supported. for URL:
  https://my-storage.s3.amazonaws.com/myDir/myFile.json

Here's when I use a similar request to a public directory on Dropbox.  There is no crash, but the request also fails.

  WWW Error: Failed downloading
  dl.dropboxusercontent.com/u/7782207/spare-change/weapons/0.json for
  URL: dl.dropboxusercontent.com/u/7782207/spare-change/weapons/0.json

Try it for yourself: http://webroleplay.appspot.com   (currently using Dropbox, so not crashing the player)

username: test1

password: t

sentences:
LibGDX - Collision detection between all bullets and all enemies I'm trying to make a collision detection system between the player's bullets and all the enemies on screen.

So far I had something like this:

for (Bullet bullet : hero.getPistols().getAllShotBullets()) {
        for (Enemy enemy : enemies) {
            if (!enemy.isDead()) {
                if (bullet.overlaps(bullet.getBounds(), enemy.getBounds())) {
                    enemy.die();
                }
            }
        }
    }

But after a while, the frame rate drastically drops - making the game unplayable, almost (which is understandable, as the nested for loop looks terrible for performance...).
I've been looking around and found out that a common solution is to use Quad-Trees, but at the same time, I'm worried that the overhead brought by the use of that data structure will make it a bit of an overkill, if that makes sense.

Are there any more solutions? Or should I use the Quad-Tree?

Thanks in advance.

sentences:
Implementing monte-carlo tree search in a tile based game with units I have this simple risk-like game I would like to develop an AI for. Players move their Units on the  map and a simple fight resolution is done. There is a time constraint of 100ms for each round, the AI has complete information and fight resolution is deterministic but units move simultaneously each round.

As far as I understand the monte carlo approach, I need to copy the state of a current round and generate a tree with new game states, play it out randomly or do an evaluation.

Currently my zones keeps a list each unit and they're moved around by storing orders. They're kept in a dictionary for each turn and are applied at the end of the round. Deep copying this takes around 3ms and I guess is too slow to use effectively considering the time constraint. I was wondering if I could use this order-system to generate the tree faster by applying and undoing them, but I can't yet wrap my head around how I would do it.

This is my current class design:

How can I effectively add MCTS for this kind of game?

sentences:
Creating my own kill cam I plan on creating my own kill cam system for a sandbox tool set.  After thinking about the mechanics of the kill cam itself, however, I'm quite lost.  I'm trying to recreate the ones commonly seen in call of duty games that show, from the view of the killer, the actual killing scene.

My Thoughts:

-I can't just keep in memory when people kill others because I wouldn't know when to start the 'recording process'.  There is on way for me to accurately determine when somebody is 'about' to kill someone.

-My only real idea so far is to have a complete duplicate of everything loaded off to the side copying all the movement from the original world but with a 10 second delay.  That way, all the kill cams would be 10 seconds long and the persons camera would just be moved to the second world of their killer.

My Questions:

Is there already an accepted way to do this?  Does anybody have any good ideas for something like this?  Thanks if you can!

sentences:
Component based architecture in TypeScript I'm doing a game using Phaser with TypeScript. I want to implement a component based architecture for Actors.
What I'm trying to achieve is this:

var component:AwesomeComponent = actor.getComponent<AwesomeComponent>();

I know there's a workaround by constructing objects of type T. But I don't like it because I'd probably need to define tons of different constructors to represent all differents kinds of components.

What I'm doing so far is passing a string with the type (of course a number would be better, but I'm still prototyping):

getComponent<T>(componentType:string): T
{
    for (let i = 0; i < this.components.length; i++)
    {
        if (componentType == this.components[i].componentType)
        {
            return <T><any>this.components[i];
        }
    }
    return undefined;
}

It works, but the result is not good, you have to type the class name twice:

var animComp = actor.getComponent<AnimationComponent>("AnimationComponent");

Any suggestions on how to solve it?

Thank you for your time!

sentences:
How to constrain axis-angle rotation? I have a problem where I'm performing an axis-angle rotation and am trying to constrain my rotations.  Specifically I have a skeleton (model/mesh with rig, transforms are hierarchy parented to pelvis which move the triangles of the mesh) and I am constraining the motions to prevent bad joint rotations (e.g. knees bending sideways or backwards).  The rotations in this case can pretty much be constrained by saying "do not rotate about X/Y/Z."

I'm using the Unity3D RotateAround function which rotates about a specified axis at a point by an arbitrary angle.  Given control over this point, axis, and angle how can I constrain this rotation to prevent "bad" rotations?

sentences:
How to emulate knob turning, based on x/y movement? I'm doing a game where one component is that you turn a knob.  I'm having trouble getting good "knob behavior".

I know the current touch/mouse X,Y location, and I keep track of the previous X,Y location, so I can determine if I'm going left or right and/or up or down.

It works, but it's crude.  I suspect I have to take an average of any given direction over a period of time (say, last quarter second) to eliminate jitter because people don't move uniformly in the same movement every moment.

I can't really use touchdown/release because you should be able to put the touch down, then move left/right up/down continuously without release, and the knob would turn, just as if you had a free-spinning audio control or video shuttle (say).

Any thoughts in this direction on how to even it out?

sentences:
Iterate over a loop to calculate a sum, or update a sum variable as items are added and deleted from a list? I thought I ran into this concept at one point but can't figure out how to find an answer for it.
Is it better to iterate over a list of ints to calculate a running sum each frame, or is it better to create a variable to hold the sum and to increase or decrease it as numbers are added to the list?
The only downside I see for keeping a sum variable around is that you have to make sure you really update it correctly in all niche cases that might appear. Or ensure that items are removed from the list correctly, say, on death.

sentences:
Path-finding algorithms for Polar coordinate based maze? Following on from my question about moving a sprite in a circle, assuming that you have a maze which is shaped like a a set of circles with holes in them and barriers between them.

Location of a sprite is stored in polar coordinates and then translated into cartesian coordinates to be rendered.

I'm going to assume that most path finding algorithms rely on cartesian geometry, is there a path finding algorithm I can use to allow "beasties" to chase my players sprite?

sentences:
Gyro and swipe in Unity How can I properly save rotation of the camera while swipe and pass it to  transform.rotation = Quaternion.Slerp() start start Quaternion?Right now after I swiped Gyro get his transform.position and I need to take the position after the swipe.

    protected void Update()
    {
        if (!using_Touch)
        {
            if (show_video)
            {
                   AttachGyro();
                show_video = false;
            }
            gyroEnabled = true;
            if (!gyroEnabled)
                return;
            if (from_touch)
            {
                transform.rotation = Quaternion.Slerp(First_position ,
cameraBase * (ConvertRotation(referanceRotation * Input.gyro.attitude) * GetRotFix()), lowPassFilterFactor);

            }
            else
            {
                transform.rotation = Quaternion.Slerp(transform.rotation,
cameraBase * (ConvertRotation(referanceRotation * Input.gyro.attitude) * GetRotFix()), lowPassFilterFactor);
            }
            from_touch = false;
        }
        int fingerCount = 0;
        foreach (Touch touch in Input.touches)
        {
            using_Touch = true;
            gyroEnabled = false;
            if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
            {
                fingerCount++;

                float scalar = 0.8f;  //0.05f;
                transform.rotation = Quaternion.Slerp(transform.rotation,
    Quaternion.Euler(new Vector3(
                    transform.localEulerAngles.x + touch.deltaPosition.y *

scalar, transform.localEulerAngles.y + touch.deltaPosition.x * scalar, transform.localEulerAngles.z)), scalar);
    //need to set it to that variable
    First_position = Camera.main.transform.rotation;
                    from_touch = true;

            }
            else
            {
                using_Touch = false;

            }
        }
    }

sentences:
"Following" Object is acting Strangely? So I recently designed an enemy that will follow the player when he comes within a certain distance of the object. However, there are times when the player comes in range, only for the "follower" enemy to seemingly reverse before following, or almost kind of circle the player on the way towards him.

I can't quite put my finger on why this is happening, so I have attached my code. I hope someone can give me some advice on how to improve this:

    public class Follower : MonoBehaviour
{
// spawn position and other info of Follower
private Vector3 pos1 = new Vector3(-7f, 0.5f, -7f);
public float speed = 1.0f;
public int Range;
public GameObject target;
private Vector3 targetTran;
private Vector3 diffVec;
private float diffMag;

void Awake()
{
    transform.position = pos1;
    sourceCollFol = GetComponent<AudioSource>();
}
void Start ()
{
    target = GameObject.FindWithTag("Player");
    targetTran = target.transform.position;
}
void Update ()
{
    pos1 = transform.position;
    targetTran = target.transform.position;
    diffVec = (targetTran - pos1);
    diffMag = diffVec.sqrMagnitude;
    // check for range between Player and Follower Enemy
    if ( diffMag < Range)
    {
        transform.LookAt(targetTran);
        diffVec.Normalize();
        transform.Translate(diffVec.x * speed * Time.deltaTime, 0f, diffVec.z * speed * Time.deltaTime);
    }
}
}

sentences:
Libgdx create rectangle Scence 2D I want to draw a empty rectangle around my gamescreen, to show "borders" around. I've tried pixmap. Works perfectly fine, but i could not find the option of change stroke width of the rectangle.

I thougt about using texture, but i do not feel it's the best way. Due to there is no artwork into this border. It's just a thick line around the screen.

Remember i want to create the border once and not recreate it everytime i render.

Any suggestions?

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: Unity post processing Bloom lags on mobile I made my (first) game today and noticed, that it looked kind of boring, so I decided to add some bloom to my camera and it was looking waaay better. The only problem was the performance, it dropped down from constant 60 fps to like 20-30, I looked it up in the profiler to be sure and yep, it was the post-processing, I saw mobile games which had post-processing including bloom, but these games never lagged on my phone. My phone has pretty good specs for a phone (Samsung Galaxy M20) so how do I make my post-processing performant, are there some special settings I have to make or is it just my phone?

sentences:
Hemispherical Projection I'm trying to implement a radiosity processor. I'm aware of many places online to find information about radiosity. I found a great source on NVidia's website is  GPU Gems - Chapter 39 . On this page they talk about Hemispherical projection. I've implemented a projector that will place mesh 'vertices' on a unit hemisphere...the problem is that the rasterizer only linearly interpolates between vertices along an edge...

...is there a way to adjust the method of interpolation?

Here is shader code for hemispherical projection...it does place the objects correctly, however, the edges between the vertices are straight...when true hemispherical projection would create rounded edges...

float4x4 mW;
float4x4 mV;
float4x4 mP;
float4x4 mOrtho;
float2 vNearFar;
static const float PI = 3.14159265f;

texture g_TextureDiffuse;
sampler g_SamplerDiffuse = sampler_state
{
    Texture = <g_TextureDiffuse>;
    MinFilter = Point;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VS_IN
{
    float4 Position : POSITION0;
    float3 Normal : NORMAL0;
    float2 UV : TEXCOORD0;
};

struct PS_IN
{
        float4 Position : POSITION0;
    float3 Normal : TEXCOORD0;
    float2 UV : TEXCOORD1;
    float4 Pos2 : TEXCOORD2;
};

PS_IN VS( VS_IN input )
{
    PS_IN output = ( PS_IN )0;

    float4x4 mWV = mul( mW, mV );
    float4x4 mWVP = mul( mWV, mP );
        half4 vPos = mul( input.Position, mWV );

    half3 vHemi = normalize( vPos.xyz );

    half3 fNearFar = vNearFar.y - vNearFar.x;

    output.Position.xy = vHemi.xy * fNearFar;
    output.Position.z = ( vPos.z / ( vNearFar.y - vNearFar.x ) );
    output.Position.w = fNearFar;
    output.Pos2 = output.Position;
    output.Normal = mul( input.Normal, mWV );
    output.UV = input.UV;
    return output;
}

float4 PS( PS_IN input ) : COLOR0
{
    //float2 uv = input.UV - 0.5;
    //float z = sqrt( 1.0 - input.Pos2.x * input.Pos2.x - input.Pos2.y * input.Pos2.y );
        //float a = ( z * tan( ( PI / 2 ) * 0.5 ) );
        //return tex2D( g_SamplerDiffuse, ( uv * a ) + 0.5 );

    float4 diffuse = tex2D( g_SamplerDiffuse, input.UV );
    return diffuse;
}

technique Render
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VS();
            PixelShader = compile ps_2_0 PS();
    }
}

Here is screenshot:

It may be difficult to tell, but the cube has two faces( triangles ) per side( 6 sides, 12 faces ). From the picture you may be able to see the problem with flat edges...this problem is well documented...I'm trying to avaoid having to render 5 different images( hemicube ) to approximate a hemisphere...I'm mostly interested in hearing about methods of implementing a hemisphere...I also tried( to no avail ) to write a pixel shader that would warp the final( post scene render ) image. I didn't get great results...

...it also just came to me that I don't necessarily need a render result for computing the form factor...just the area that the projected object consumes within the area of the hemisphere base...

...any thoughts are appreciated!

... here is a screenshot of the cube subdivided...much better...still not accurate

sentences:
Prefab spawning issue I am having trouble spawning some obstacles from some prefabs. The aim is to make and endless runner (like normal) with obstacles to go through that spawn as the sprite goes up. But my prefabs don't spawn at the top?

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

public class RandomSpawn : MonoBehaviour
{
    public GameObject B1, B2;
    public float spawnrate = 2f;
    float nextSpawn = 0f;
    int whatToSpawn;

    void Update()
    {
        if (Time.time > nextSpawn)
        {
            whatToSpawn = Random.Range(1, 3);
            Debug.Log (whatToSpawn);

            switch (whatToSpawn)
            {
                case 1:
                    Instantiate(B1, transform.position, Quaternion.identity);
                    break;
                case 2:
                    Instantiate(B2, transform.position, Quaternion.identity);
                    break;
            }

            nextSpawn = Time.time + spawnrate;
        }
    }
}

sentences:
Set texture of a LHSprite that is loaded from LevelHelper How do i set the image/texture of an LHSprite that is loaded into xCode using levelHelper & spriteHelper?

I am using sprite sheets. So i tried to load the image the old fashioned way using CCSpriteFrameCache, but unfortunately it isnt recognizing the .pshs file :( Any Help would be great!

sentences:
Using Behavior Trees and Events together I am beginning to work with behavior trees and am unsure how events should be handled within the tree. Lets say we have a space game where the player is dogfighting with a handful of other ships, some friendly some not. The player destroys a ship and the rest of the hostile ships should then start to retreat.

How was should the shipWasDestroyed event effect the other ship's behavior trees so that they start running the retreat behavior?

One way I could think of doing this is have all the conditions I care about be high level nodes that effectively state change the ship. This would mean I'd have to check all of these state change conditions on every frame the behavior tree was run, even if they are very rare occurrences. I'd prefer not doing this for performance and complexity reasons.

From looking at the Halo papers on behavior trees it seems that they handled this by dynamically placing nodes into the tree when the event occurred. It seems like calculating where the new node should go could be problematic depending on the current state of the running behavior.

How is this normally handled?

sentences:
Libgdx + Ashley moving one texture causes everything to jump My problem is that as i am moving my player entity all my entities shift position by the reverse total of my player entities movement vector, However the only system to move things is my MovementSystem class which moves a entity by its own movement vector and is clamped by delta Time.

MovementSystem

public class MovementSystem extends IteratingSystem
{

    private ComponentMapper<MovementComponent> movementComponentMap;
    private ComponentMapper<TransformComponent> posComponentMap;
    private ComponentMapper<DebugComponent> debugComponentMap;

    public MovementSystem()
    {
        super(Family.all(MovementComponent.class,  TransformComponent.class,
            DebugComponent.class).get());

        movementComponentMap = ComponentMapper.getFor(MovementComponent.class);
        posComponentMap = ComponentMapper.getFor(TransformComponent.class);
        debugComponentMap = ComponentMapper.getFor(DebugComponent.class);
    }

    @Override
    protected void processEntity(Entity entity, float deltaTime)
    {
        TransformComponent pos = posComponentMap.get(entity);
        MovementComponent mov = movementComponentMap.get(entity);
        DebugComponent db = debugComponentMap.get(entity);

        pos.Position.x += mov.Velocity.x * deltaTime;
        pos.Position.y += mov.Velocity.y * deltaTime;
    }
}

RenderSystem

public class RenderSystem extends SortedIteratingSystem
{
    private ComponentMapper<TextureComponent> textureComponentMap;
    private ComponentMapper<TransformComponent> transformComponentMap;
    private ComponentMapper<DebugComponent> dbMap;

    SpriteBatch batch;
    OrthographicCamera camera;

    public RenderSystem(SpriteBatch batch)
    {
        super(Family.all(TransformComponent.class, TextureComponent.class).get(), new RenderComparator(), 50);

        textureComponentMap = ComponentMapper.getFor(TextureComponent.class);
        transformComponentMap = ComponentMapper.getFor(TransformComponent.class);
        dbMap = ComponentMapper.getFor(DebugComponent.class);
        this.batch = batch;
        camera = new OrthographicCamera(CONST.FRUSTRUM_WIDTH, CONST.FRUSTRUM_HEIGHT);
    }

    @Override
    public void update(float deltaTime)
    {
        camera.update();
        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        super.update(deltaTime);
        batch.end();
    }

    @Override
    public void processEntity(Entity entity, float deltaTime)
    {
        TextureComponent tex = textureComponentMap.get(entity);
        TransformComponent pos = transformComponentMap.get(entity);
        DebugComponent db = dbMap.get(entity);

        batch.draw(tex.Texture, pos.Position.x - tex.TextureOrigin.x,
            pos.Position.y - tex.TextureOrigin.y,
            tex.TextureOrigin.x, tex.TextureOrigin.y,
            tex.Texture.getRegionWidth(), tex.Texture.getRegionHeight(),
            pos.Scale.x, pos.Scale.y,
            MathUtils.radiansToDegrees * pos.Rotation);
    }
}

The full code can be found on my github profile

i have no idea what is happening. i have been over my code with a fine toothed comb and lots of console output and i just cannot find a reason for everything to be jumping by essentially the speed of the player. any thoughts or nudges in directions would be greatly appreciated

sentences: Godot: does parse_json accept multiple JSON objects? If I had a JSON file that had multiple objects, can the method read through without some form of exception?

sentences:
Heightmap vertex list to vertex + index list Right now I'm trying to load a heightmap into my LWJGL application. I load it like that into a float[][] array and I can read the height value at a given x and z position in the map:

public class HeightMap
{

float[][] heightMap;

public HeightMap (String fileName)
{
    int height, width;
    try
    {
        BufferedImage image = ImageIO.read(getClass().getResourceAsStream(fileName));
        heightMap = new float[image.getWidth()][image.getHeight()];
        for (int x = 0; x < image.getHeight(); ++x)
        {
            for (int z = 0; z < image.getWidth(); ++z)
            {
                heightMap[x][z] = new Color(image.getRGB(x, z)).getRed() / 255f;
            }
        }
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}

My problem is that I don't understand how to create the float[] vertices and byte[] indices arrays that I can pass to the vao and iao(and also texture coords (tco)).

Hope you can help me,

bebe

sentences:
How can I create a pack file / archive for game data files, and then load them? (zlib?) I'm starting to think about how I'm going to go about loading models, images, sounds, etc for my game. I have two competing lines of thought to deal with:

If possible, it would be nice to make use of existing libraries to load things like PNGs, etc.
I would like to pack all of my game data into a single archive, and it would be great to use an existing library here also.

Is it possible to do this? I've heard that I could use something like zlib for (2), but I've never used it before so I'm not sure how it would work. Is it possible to yank a file out of a zlib archive in memory, and then pass it to some compatible library for the actual loading? How would these two systems interface with each other? Would using zlib slow down the loading process?

I've not had much experience with I/O in my career, so I'm not really sure where to start.

sentences: Does SDL_SetThreadPriority work with std::thread I'm trying to set the priority of my threads so that my UI thread can be given priority over background calculations. I noticed that SDL has a SDL_SetThreadPriority method, however I still prefer the standard std::thread syntax rather than SDL_CreateThread. Does SDL_SetThreadPriority work with threads created with std::thread, or do I need to update everything to use SDL_Thread?

sentences:
Blender: Bones get enlarged in export/import process I have a rig in blender that I want to export into a different blender project. For some reason, when I do that, some of the bones get enlarged. All the scales are applied. Why might this be happening?
I've no clue why this might be happening, as this problem seems exclusive to this project and one other project, where one bone out of the whole armature gets enlarges, but here is the information I can provide:
Some differences between the projects where this happens and the others is that the ones where this does happen have animations, and a pose library. However, this does not seem to cause the problem, as deleting the animations and poses doesn't change anything.
This problem happens when I export/import the project as an FBX.
I usually export the project to unity and in order to compensate for the unity/blender rotation, I follow this [guide][1. I rotate the armature -90 on the x axis, apply rotation. Then rotate the armature 90 on the x axis but only apply the rotation to the mesh. I export the project as a FBX, with unity unit scale, no leaf bones, and the 3rd and 4th box under animations checked off. This also does not seem to cause the problem, as not rotating the armature and such doe not change anything.

sentences:
How to implement A.I. for checkers/draughts? I saw this checkers game and I wondered how the A.I. was implemented.

How should I implement an A.I. for checkers (draughts, dama, dame)? Are there any known algorithms?

Very thnaks full to all. I m very wonder to see this Tic Tac Toe game tutorial blog post.

So, i want dama game algorithm open source code and blog post..  Is there any helpful link or any doc file..? please let me know..

sentences:
GameObject that should have a fixed speed keeps accelerating I'm using a coroutine to make a GameObject move from a random point A to a random point B. The GameObject should move along this trajectory at fixed intervals and at a constant speed.

However, each time my coroutine that executes the movement is called, the GameObject is a little bit faster.

private IEnumerator movement () {

        // Initialize position and rotation
        float distanceX = endTransform.position.x - startTransform.position.x;
        float distanceZ = endTransform.position.z - startTransform.position.z;
        float angleAroundY = 90.0f - Mathf.Rad2Deg*(Mathf.Atan2 (distanceZ, distanceX));

        this.gameObject.transform.position = startTransform.position;
        this.gameObject.transform.rotation = startTransform.rotation * Quaternion.Euler (90.0f, angleAroundY, 0.0f);

        // Move from point A to point B
        while (this.gameObject.transform != endTransform.transform) {
            float step = speed * Time.fixedDeltaTime;
            this.gameObject.transform.position = Vector3.MoveTowards (this.gameObject.transform.position, endTransform.transform.position, step);
            yield return null;
        }
        yield return null;
    }

I checked and the step variable is constant.

sentences:
What would be a suitable way to model projectiles in an action game? I'm designing a 2d fighting game in which characters can shoot out some projectiles like arrows, ninja knives, Hadouken (like the one in Street Fighter), etc...

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

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

Bullets and projectiles in component based entity systems

Any comments would be appreciated! :)

sentences:
set model to transparent where texture is transparent I finally got around to applying textures to my game, and I noticed that the areas that are transparent on the .png of the texture are not transparent on the actual model.It is illustrated in the image below.

I want the areas of the model that are supposed to be transparent to be transparent. The white areas are the areas that should be transparent. the white areas are transparent on the actual .png. Is there any way to do this using glfw? Is there some sort of transparency function GLFW has? I thought changing RGB to RGBA on the texture generator would fix it but it did not.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
The data for the actual model is below (its formatted in json but still shows the vertices). The first 3 entries on each row are the coordinates, then 3 entries for the color, then the texture mapping.
{"vertices":[
0.00,0.00,0.0,0.0,0.0,0.0,0.0,0.0,
500.00,0.00,0.0,0.0,0.0,0.0,1.0,0.0,
500.00,500.00,0.0,0.0,0.0,0.0,1.0,1.0,
0.00,500.00,0.0,0.0,0.0,0.0,0.0,1.0

],
"indices":[
0,1,2,
0,3,2
],

"texturePath": "textures/planet1.png"}

Do I have to map the coordinates of the texture to a circular object rather than a square one like it is formatted now. I am hoping I don't, because that would make my life so much simpler.

sentences:
Why would running WebGL app in Edge improve performance in Firefox? I have a WebGL app (built using Unity 2019) which I'm testing locally in Firefox and Edge. If the app is only running in a tab in Firefox, it runs at 25 - 50 fps and has noticeable stutter. If I run the app in Firefox and Edge at the same time (each browser on its own monitor), the performance in Firefox significantly improves - it jumps up to 50 - 60 fps and stutter is eliminated.

Frankly, the results sound ridiculous even to me, but I've tested it over and over and it's 100% consistent. Opening the app in a tab in Edge immediately improves performance in Firefox. Closing the tab in Edge immediately reduces performance in Firefox.

I'm on Windows 10 with a GTX 2070 Super.

sentences:
Libgdx change the image inside table dynamically I am trying to draw a HUD that shows the score and time and image like loading but I want to update and change the image when the score get higher but I tried to do that but it is not working. I thought maybe I can define new table in the update method and put different image each time but I don't want to define new table each time. is there anyway to update the image only inside the table: this is the code:

public class Hud implements Disposable{

        public Stage stage;
        private Viewport viewport;
        private static Integer worldTimer;
        private float timecount;
        private static Integer score;
        Label countdownLabel;
        private static Label scorelabel;
        private Label timelabel;
        private Label levellabel;
        private Label worldlabel;
        private Label mariolabel;
        private Image loading;
        private Table table;
        public Hud(SpriteBatch sb)
        {
            worldTimer=40;
            timecount=0;
            score=0;
            viewport=new FitViewport(Fruits.V_WIDTH,Fruits.V_HIEGT,new OrthographicCamera());//2
            stage=new Stage(viewport,sb);//stage is as box and try to put widget and organize things inside that table
            table = new Table();
            table.top();//table at top of our stage
            table.setFillParent(true);//table is now fill all the stage
            countdownLabel=new Label(String.format("%02d",worldTimer),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            scorelabel=new Label(String.format("%02d",score),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            timelabel=new Label("TIME",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            levellabel=new Label("1-1",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            worldlabel=new Label("WORLD",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            mariolabel=new Label("Score"    ,new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            loading = new Image(new Texture("10%.png"));
            //loading.setSize(40, 10);
            table.add(mariolabel).expandX().padTop(10);

            table.add(timelabel).expandX().padTop(10);
            table.add(worldlabel).expandX().padTop(10);
            table.row();
            table.add(scorelabel).expandX();

            table.add(countdownLabel).expandX();
            table.add(loading).width(50).height(10);

            stage.addActor(table);

        }
        public void update(float dt)
        {
            timecount+=dt;
            if (timecount>1)
            {
                worldTimer--;
                if(worldTimer>=0) {
                    countdownLabel.setText(String.format("%02d", worldTimer));
                    loading=new Image(new Texture("90.png"));
                }
                timecount=0;

            }
        }
        public static int getTime()
        {

            return worldTimer;
        }

        public static void addScore(int value)
        {
            score +=value;
            scorelabel.setText(String.format("%02d",score));
        }
        public static int getScore()
        {
            return score;
        }
        @Override
        public void dispose() {
            stage.dispose();
        }
    }

sentences:
Help Me Make Sense of the Canvas and Text-Based Non-UI Objects in Unity I am trying to wrap my head around the concept of the Canvas in Unity and its many uses especially outside of user interfaces. However, I cannot really find a good tutorial that digs deep enough into it; so, I was hoping that I can find some help here.
The concept of a user interface needing to have a separate wrapper layer to position elements overlaying the game window does, kinda-sorta, make sense, and I have created one that works fine at the moment. What does not make sense is how everything that contains text also needs to be inside a canvas object to even be visible. I don't understand how a canvas makes sense when I want to display non-UI game elements that contain text, such as damage counters or, as in the case of the game I started working on, playing cards.
Furthering the concept of playing cards, it gets even more complicated. If I understand it correctly, I would not only need a canvas to place my cards on (preferably separate from the one that contains my UI elements) but if I want to put text on my cards and make them come from a reusable Prefab, the Prefab itself needs to be a canvas (or somehow contain one), otherwise text elements would not show up on it (at least based on my trials).
Now, I have read about and actually tried the Text Mesh Pro framework, but honestly I don't need that bloated functionality; a simple text would be perfectly fine for my needs, if only I could make it work.
My question is, can someone briefly illustrate how to work with canvases and text-based game objects (preferably  in the context of a card game). My cards need to contain an image and several text fields to display various information. What would be the best way to create a Prefab to initialize these cards? Then, what would be the most optimal way to display these cards on the scene (they should not be part of the UI but the game itself).
My game is 2D and uses a pixel art aesthetic if it is relevant.
Many thanks for your answers!

sentences:
Shadows go through meshes, and also being applied to itself I am using Ogre3D and I am using stencil shadows for my character. They work pretty well, but I have 2 problems: first, the shadow is applied to the entity it is casting the shadow, and secondly, the shadow goes through all the entities on the screen, and I would like to apply the shadow to only the first entity.

Also, the shadow gets rendered on the back of the model.

Images showing the problems:

sentences:
How to control an Animator without having all the animations on a Controller? I am building a sims-like game where there are a lot of objects for my autonomous characters to interact with.
Because of this, as much of the unique interaction code as possible is controlled by the objects, rather than the characters. This prevents unnecessary script bloat.
However, many of these objects also have unique animations used to interact with them. Like the actual behaviour, I'd prefer to store these animations on the object rather than the characters.
Though all my characters possess an Animator, I see no way to trigger animations that aren't on the associated Animation Controller.
What options does this leave me with? Can I somehow drastically alter the controller at runtime? Is that the smart approach?

sentences:
Unity3D: Mathf Lerp too fast when timescale increases I have an image with a fill amount component controlled by a Mathf Lerp. The problem is, the time for completion of the Mathf Lerp function decreases more than expected when the timescale increases.

When the timescale is equal to 2 the function should take half the time to complete but it takes less than that. Any idea why?

public static float demolishTime = 6.0f

public void OnClickDemolish()
{
    InvokeRepeating("demolishProgress", 0f, 0.1f);
}

void demolishProgress()
{
    progress += (Time.deltaTime / demolishTime);
    demolishProgressBar[DemolishManager.demolishState].fillAmount = (float)Mathf.Lerp(0, 1, progress);
    if (progress >= 1) demolishCompleted();
}

sentences:
How do I efficiently check which object causes the most gravitational force in a list of thousands of objects? I'm working on a proof-of-concept space engine, and one of its tasks is to find the object with the greatest sphere of influence towards the player; that is, the mass of the object, divided by the square root of the distance to the player. I don't see much optimization to do, as an octtree or a KDTree only works for points. Even though there might be a planet only a few thousand kilometers away, a black hole many million kilometers away might have a greater gravitational force on the player.

The current check is brute-force. I go through each object, and return the one with the highest gravitational pull on the player. I have around 10,000 objects to perform this check on, but I might increase this number to millions, later. Optimally, I want to perform the check during each frame, which currently lowers the frame rate from 1600 a second to around 100 a second, which is unacceptable.

A few ideas comes to mind, but none of which seems optimal:

Make the system run in its own thread. Great, if the user has a core they don't use for anything, but only gives more overhead if there are no more cores available.
Limiting the check to run only once every few frames, resulting in a better average frame rate. The frames that need to be checked will result in stuttering, so this seems like a bad road to go down.
Limiting the number of objects checked per frame, so no matter what, only 128 objects may be checked per frame. This has the advantages of solution 2, without the disadvantage of stuttering, as each frame is equally heavy. Still, the programmer in me somehow also dislikes this solution. Then again, game programming is quite different from what I have previously worked on.

I'm not asking solely just for the purpose of this specific system, but also to find the best practice for problems like this, where there must be a compromise between running frequently and performance.

Any suggestions specific to this problem, like how to optimize the function through a modified version of a KDTree, is also very much appreciated; but the question is directed more generally towards the best practice for such problem.

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:
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:
Real-time UDP multiplayer games: ping measurement? In real-time multiplayer games that use UDP for the actual game (CS:S, UT, etc.), how is network latency (ping) measured? More specifically, how do you find out how long ago a UDP packet was sent?

Sorry if this is a dumb question, but I'm very new to network programming.

sentences:
How can I iterate over the vertices of a mesh without an IndexOutOfRangeException? I'm trying to draw a gizmo sphere at the location of each vertex in my mesh with the following code:

private void OnDrawGizmos()
    {
        MeshFilter selectedMeshFilter = (MeshFilter)objecttodraw.GetComponent("MeshFilter");
        Mesh mesh = selectedMeshFilter.sharedMesh;
        Vector3[] vertices = mesh.vertices;
        Color[] colors = new Color[vertices.Length];
        for (var i = 0; i <= vertices.Length; i++)
        {
            Gizmos.DrawSphere(vertices[i], vertices.Length);
        }
    }

I'm getting an exception, "Array index is out of range" on this line:

Gizmos.DrawSphere(vertices[i], vertices.Length);

  IndexOutOfRangeException: Array index is out of range.

  GetBounds.OnDrawGizmos () (at Assets/Scripts/GetBounds.cs:32)

  UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

sentences:
Modifying z axis position of a canvas and adapting it to camera I have a camera with y rotation of 0.

And i have a canvas with position value of (0f,76.29f,41.82f).
The size value of the canvas is (194.1f,307.8f).
I want to modify the z value of the canvas to -10.

public Canvas textcanvas;
void Start () {
textcanvas.anchoredPosition = new Vector3 (0f, 24.5f, -10f);
}

But i get an error "error CS1061: Type UnityEngine.Canvas' does not contain a definition foranchoredPosition' and no extension method anchoredPosition' of typeUnityEngine.Canvas' could be found. Are you missing an assembly reference?"

Also, when i succeed moving the canvas, does the size of it adapting to the camera automatically?

sentences: How to drag my dragging object in 'game'-unity? I have made a dragging sphere which drags, problem is how can I drag it using keyboard keys , I dont want to build it again on iphone simulator after experimenting with my code. for dragging it is not accepting mouse or any keyboard keys. Is it possible ?

sentences:
Dual Currency vs. One Currency in social games economics and monetization Not a programming question but game development related.

I am creating an iPhone online game which I wish to be free-to-play where in-app purchase is used for monetization. The important point is to make sure that this does not break the game-play, my priority is gameplay first, monetization second.

One popular way of monetizing the player base is to sell your in-game currency, however there are 2 ways to go about this:

One Currency: This currency can buy anything within the game, it can be earned through normal play at a limited rate. Players can, however, choose to buy this currency directly to speed up the acquisition of the currency.
Dual Currency: One currency can be earned through normal play and it can be used to buy a limited set of items that is required for normal enjoyment of the game. The second currency is 'premium' and must be purchased using real world money. This second currency can be used to purchase 'premium items' that gives extra abilities such as increase EXP gain, etc. The 2 currencies can be traded between players to give non-paying players to exchange their time for the 'premium' currency.

Both methods do not break gameplay and allows players who does not wish to pay enjoy the entire contents of the game if they put in enough time and effort.

My question is, is there any reason why you would pick one over another? What are the pros and cons that I should pay attention to when implementing each alternative?

Thank you.

sentences:
Heightmap in Shader not working I'm trying to implement GPU-based geometry clipmapping and have problems to apply a simple heightmap to my terrain. For the heightmap I use a simple texture with the surface format "single". I've taken the texture from Catalinz's XNA blog.

What I'm trying to do is just getting the single float value from the texture at the vertex world coordinate and apply the value to the Y-Value of the Vertex. I'm applying the heightmap through the shader, because there is no fixed grid in-code it could be applied on. What I've tried so far was using the tex2Dlod function, but there seems to be no output or an output of 0. The Direct X vertex shader's code looks like this:

float4 worldPos = mul(float4(pos.x,0.0f,pos.y, 1.0f), worldMatrix);
float elevation = tex2Dlod(HeightmapSampler, float4(worldPos.x, worldPos.z,0,0));
worldPos.y = elevation * 128;

Where HeightmapSampler is a point-mirror sampler of the heightmap texture. Here is the output, I actually get no elevation:

And here's the heightmap I'm using:

sentences:
Unity prefabs - chose what to Apply I have some prefabs and if I change a value of a script on them - as to be expected - it turns bold meaning if I apply, that value will be input for all of my prefabs. The problem is, I wish to have a value changed only on the instance and then change something else and apply only the latter.
How can I do that? So how can I specify which values are "applyable" and which are not?

sentences:
Unity3D Automatic Mipmap I'm using Unity3D. I'm working advanced topics. For example Mipmap.

How I can automatic mipmap (use camera distance) for textures?

Thank you.

sentences:
php multiplayer game - server&client model I'm working on a simple round&web-based multiplayer game. The idea of the game is very simple: The players get an array of audio files which they listen to and write the transcripts for in 5 minutes. the player who sends in the most right transcripts gets the most points. its fairly simple and i was able to implement it locally. at the moment i have the .php file which lets me do all this but only in single player. what i'm trying to say is that whenever a player logs him/herself in, the page is loaded anew. what i want to do is to start the game from the server everytime 3-5 players log themselves in, so that the players can play at the same time and their results can be compared at the end of the round.

the thing is, i don't know how to start with this session or server/client model for a multiplayer game. i have read that php isn't ideal for web based multiplayer games because real time data exchange could be problematic, but since that is not really the case here i don't think that should be a major problem. i googled my problem but i have failed to find a solution. any help or advice would be much appreciated. cheers.

edit: is a node.js server what i'm looking for here?

sentences:
Where should I handle player movements in a Java Game? I had an old pure Java 2D top-down game that I'm trying to reformat a bit. Before, I had a bit of a messy game loop that didn't use delta timing for any movements or animations. Now, I'm trying to implement this delta timing.
I implemented delta timing into the game loop with two framerates (60FPS and 30FPS) to test it, but I noticed that the movement created with the 30FPS was half of what was obtained using the 60FPS.
When I moved the player, I did something like:
posX += Game.deltaTime * SPEED;

and this didn't work well because the delta time was the same for both the 30FPS and 60FPS.
So, I did some calculations... I run into some problems if I use change the player's position from the update() method, because it runs at a constant 60UPS.
Here are my calculations

int deltaXPerSecond = Game.deltaTime() * SPEED * 60;

// To get the delta X over a second, I multiplied deltaX by 60 (UPS)
// with 30FPS, it was 9.9, with 200FPS it was 1.5

// Game Loop

private static final double UPDATES_PER_SECOND = 1.0 / 60.0;

@Override
        public void run() {

            /*
             * Note: This game loop uses Majoolwip's game loop.
             * https://www.youtube.com/watch?v=4iPEjFUZNsw&list=PL7dwpoQd3a8j6C9p5LqHzYFSkii6iWPZF
             */

            double firstTime = 0;
            // converts to seconds because System.nanoTime is extremely accurate.
            double lastTime = System.nanoTime() / 1000000000.0;
            double passedTime = 0;
            double unprocessedTime = 0;

            double frameTime = 0;
            int frames = 0;
            int fps = 0;

            boolean render = false;

            // Continuously repeats this loop until the game is stopped.
            while (running) {
                render = false;
                firstTime = System.nanoTime() / 1000000000.0; // converts to seconds.

                // Gets how many milliseconds have passed between now and the last time.
                passedTime = firstTime - lastTime;
                deltaTime = (float) passedTime;
                lastTime = firstTime;
                unprocessedTime += passedTime;
                frameTime += passedTime;

                while (unprocessedTime >= UPDATES_PER_SECOND) {
                    unprocessedTime -= UPDATES_PER_SECOND;
                    // Sets render to true. This makes the game render only when it updates
                    render = true;

                    // Updates the game
                    if (frameTime >= 1.0) {
                        frameTime = 0;
                        fps = frames;
                        frames = 0;
                        System.out.println("FPS: " + fps);
                    }
                    update();
                }

                if (render) {
                    frames++;
                    render();
                }
                else {

                    /*
                     * If the game doesn't need to render or update,
                     * the GameLoop thread sleeps for 1 millisecond,
                     * causing a decrease in CPU usage.
                     */

                    try {
                        Thread.sleep(1);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

            }
        }

What am I doing wrong? Shouldn't these numbers be approximately the same regardless of the frame rate? Do I need to change the game loop? Please let me know what I am missing.

sentences:
How can I communicate user information from a website to a hosted Unity game? I have a Ruby on Rails website running which provides a log-in system and dashboard for users. I am building a small game in Unity which is much like an inventory management system. But, the inventory is specific to a user and the user can make changes to it. The user sees the game as a part of his dashboard.

What I'd like is for the moment the user lands on his dashboard, the Unity game should load with the inventory of the signed-in user. How can I get this user information from the Ruby dashboard over to Unity?

sentences:
Will I have copyright issues making a mobile game based on an anime? I have been wanting to create a mobile game based on some of my favorite anime.

I want to know if using character images and names from those anime (even after giving full copyright credits and disclaimer) infringes any copyrights?

Would this come under "fair use" in the DMCA (I mean there are already so many not-so-legal sites using this "fair use" to continue running).

What are the possible things I can do for making this game? I have seen many online browser games based on anime which use images and elements from that anime, while I have also seen many games advertise themselves based on a anime but just use diffrent names for characters of that anime (sometimes modifying the character images, too).

sentences:
Velocity Issue With MonoGame I'm relatively new to programming velocity and such as I used to use Unity so it was already implemented. Right now, I'm using MonoGame and have an issue with my velocity code. Whenever I decelerate, my "velocity.X" never becomes 0 it just keeps going down to numbers like "-8.775121E-10". I tried to check if it's less than or equal to 0.05 but that just causes issues.

Movement Code:

currentState = Keyboard.GetState();

        deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

        bounds.X = (int)position.X;
        bounds.Y = (int)position.Y;

        position.X += velocity.X;
        position.Y += velocity.Y;

        if (velocity.X >= MAX_ACCELERATION)
            velocity.X = MAX_ACCELERATION;
        if (velocity.X <= -MAX_ACCELERATION)
            velocity.X = -MAX_ACCELERATION;

        if (currentState.IsKeyDown(Keys.A))
        {
            if (velocity.X > -MAX_ACCELERATION)
                velocity.X -= acceleration * deltaTime;
        }
        else if (currentState.IsKeyDown(Keys.D))
        {
            if (velocity.X < MAX_ACCELERATION)
                velocity.X += acceleration * deltaTime;
        }

        Console.WriteLine("Velocity: " + velocity);
        Console.WriteLine("Current KeyState: " + currentState.IsKeyUp(Keys.A));

        prevState = currentState;

        Console.WriteLine("Prev KeyState: " + prevState.IsKeyDown(Keys.A));

        SlowDown();

SlowDown Method:

            /*if (!prevState.IsKeyUp(Keys.A) && currentState.IsKeyUp(Keys.A))
        {
            if (velocity.X >= -0.5f)
                velocity.X = 0;
        }*/

        velocity.X *= FRICTION;

sentences:
Game Maker x and y coordinates wrong I'm making a game which the user can use the arrow keys to scroll left and right to view the map.  I had an issue with the health bars of my enemies being drawn way off even though I set them to be drawn at the x and y position of the enemy.

I tried to debug using the following line to draw something at mouse_x and mouse_y:

draw_text(mouse_x, mouse_y, "X");

The X on screen would be at the correct position (the mouse position) when the mouse was at 0, 0, BUT as the mouse was moved farther right or down, the respective x or y offset became bigger and bigger, almost like I said to draw the X at mouse_x * 1.5, mouse_y * 1.5.

I'm using a view (view[0]) to allow the user to scroll through the map, and I thought this might be the source of the issue.  This is the code I used to allow the user to scroll left and right:

if (view_xview[0] < room_width - view_wview[0]){
    view_xview += clamp(room_width - view_xview[0], 0, 10);
}else{
    view_xview[0] = room_width - view_wview[0];
}

The same code was used for moving left, but reversed.

sentences:
jMonkeyEngine ignores keyboard input Created a game login form using the Nifty GUI. The interface reacts to the movement and clicking of the mouse, but ignores the input in the text fields. Whether the program is looking for a click handler, instead of typing, or I don’t know what. What could be the case and how to fix it?

Interface/screen.xml:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.lessvoid.com/nifty-gui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd
https://raw.githubusercontent.com/void256/nifty-gui/1.4/nifty-core/src/main/resources/nifty.xsd">
    <useStyles filename="nifty-default-styles.xml"/>
    <useControls filename="nifty-default-controls.xml"/>
    <screen id="start" controller="mygame.LoginScreen">
        <layer id="background" childLayout="center">
            <image filename="Interface/start-background.jpg"></image>
        </layer>
        <layer id="foreground" childLayout="center">
            <panel id="panel" height="25%" width="75%" align="center" childLayout="horizontal">
                <panel id="panel_left" height="100%" width="25%" align="left" childLayout="vertical">
                    <text text="E-mail:" font="Interface/Fonts/Default.fnt"/>
                    <text text="Password:" font="Interface/Fonts/Default.fnt"/>
                </panel>
                <panel id="panel_center" height="100%" width="50%" align="center" childLayout="vertical">
                    <control name="textfield" maxLength="50" font="Interface/Fonts/Default.fnt"/>
                    <control name="textfield" maxLength="100" passwordChar="*" font="Interface/Fonts/Default.fnt"/>
                </panel>
                <panel id="panel_right" height="100%" width="25%" align="right" childLayout="vertical">

                </panel>
            </panel>
        </layer>
    </screen>
    <screen id="hud" controller="de.lessvoid.nifty.screen.DefaultScreenController">

    </screen>
</nifty>

src/mygame/Main.java:

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.renderer.RenderManager;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }
    public String driver = "org.apache.derby.jdbc.EmbeddedDriver";
    public Nifty nifty = null;
    @Override
    public void simpleInitApp() {
        NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay(assetManager, inputManager, audioRenderer, guiViewPort);
        nifty = niftyDisplay.getNifty();
        nifty.fromXml("Interface/screen.xml", "start");
        guiViewPort.addProcessor(niftyDisplay);
        inputManager.beginInput();
        flyCam.setDragToRotate(true);
    }

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
        nifty.update();
        inputManager.update(tpf);
    }
}

src/mygame/LoginScreen.java:

package mygame;

import com.jme3.app.Application;
import com.jme3.app.state.BaseAppState;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

public class LoginScreen extends BaseAppState implements ScreenController {

    @Override
    protected void initialize(Application app) {

    }

    @Override
    protected void cleanup(Application app) {

    }

    @Override
    protected void onEnable() {

    }

    @Override
    protected void onDisable() {

    }
    @Override
    public void update(float tpf) {

    }

    @Override
    public void bind(Nifty nifty, Screen screen) {

    }

    @Override
    public void onStartScreen() {

    }

    @Override
    public void onEndScreen() {

    }
}

sentences:
Swapping Y and Z in quaternion I am converting between coordinate systems where Z is the vertical axis in one, and Y in another. I have the rotation values represented as a quaternion.

I see this related issue but it's switching the handedness (DirectX and OpenGL): Switch axes and handedness of a quaternion?

How would I go about swapping these values? I'd prefer not to convert to a vector3, modify and convert back again.

sentences:
Light levels - How to determine if a character should be spotted Our team is trying to develop a stealth system with the UDK. Part of this will involve lighting.

The idea being that if you're hiding in a dark corner of the room, the armed goons will not start attacking you.

I've been looking for a few hours now. And while I can't say I have no leads it seems that now is a good time to start asking for help.

At the simplest level, I'm looking for a way to determine how brightly lit an actor is (primarily the player right now).

A bit beyond that, what they are wearing might also be a factor. Someone wearing solid dark clothing is going to be harder to spot than someone in a loud Hawaiin t-shirt covered in (given the stealth context probably stolen) diamonds.

The lighting will be dynamic, so the solution needs to be dynamic. As an example, a guard might get rather upset, grab a torch on the wall and throw it in your direction.

sentences:
Multiple viewpoints in Unity3D? I'm working on a 3D game in Unity.  The primary view is a top-down view, but I am also looking to do target profiles that are true animated versions that reflect the actions of the target.  The easiest way to do this, as far as I can see, is to create a second camera, a set offset from my target, facing at it.  But how do I show the view from that camera in a small area of the screen?

A possibly related question - how to handle a mini-map?  I considered doing this the same way - with a camera fixed high above the character that would show the area around him, but there may be a better way to do this, I'm open to any suggestions.

sentences:
Solving the riddle on distributing a python built game? So, I've done the research, and i've done the try/catch process of almost getting things to work. . . almost.

I've read this chart: https://spreadsheets.google.com/pub?key=tZ42hjaRunvkObFq0bKxVdg&output=html
and i've read this post: How can I distribute a native executable for a Python program?

I'm at that point where I'm looking for either just using an installer that can run a python installer, then run the installers for all the dependencies (modules) or just copy paste the modules into the proper python directories.

So my question is: Do you have any experience with this? If so, what are your success/fail stories? Would you want to build everything into an Exe with something like pyinstaller, or just use a custom installer that would require more time to learn (like: http://www.actualinstaller.com/)?

sentences:
GraphicRaycaster on the child object containing buttons blocks Raycast from the parent object containing GraphicRaycaster. How to solve it? What I'm trying to achieve is to detect clicks on buttons in UI. Here is the tree:
I have a parent object SlotMachineScreen containing GraphicRaycaster with a script detecting clicks attached to it:
if (Input.anyKeyDown)
        {
            //Set up the new Pointer Event
            m_PointerEventData = new PointerEventData(null);
            //Set the Pointer Event Position to that of the mouse position
            m_PointerEventData.position = Input.mousePosition;

            //Create a list of Raycast Results
            List<RaycastResult> results = new List<RaycastResult>();

            //Raycast using the Graphics Raycaster and mouse click position
            m_Raycaster.Raycast(m_PointerEventData, results);
            foreach (RaycastResult result in results)
            {
                Debug.LogWarning("Hit " + result.gameObject.name);
            }
        }

And there are a bunch of child objects with a GraphicRaycaster (red ones) with buttons in it, that I want to detect a click on. But there is no response from my sprit at all when I click on them.
I found one solution so far, but its not what I need: the solution is to move all buttons from child containers to SlotMachineScreen.
Are there any different ways to solve this problem?

sentences: Will using OpenGL for rendering with SDL make my 2D game run smoother? I've been working on a 2D game using SDL.  I've noticed the objects look blurry and glitchy when they're moving, so I was thinking about using OpenGL to render the graphics.  Would this help?  What are the pros and cons of using OpenGL for a 2D game?

sentences:
Breakout Collision: Detecting the side of collision I am writing a breakout clone (my first game) and am totally stuck as to how I figure out which side of the brick was hit.

I have a collision detection method that looks like this:

DetectCollision(Object a, Object b)

   x = distance(a.x, b.x);
   y = distance(a.y, b.y);

   if (x is smaller than the combined width &  y is smaller is than combined height {
       return true;
   }
return false;

This works totally fine, but I need to know the side of the collision, and location relative to the center in order to respond properly.

I've spent the past few days snooping around but am lost.

sentences:
What should I worry about when changing OpenGL origin to upper left of screen? For self education, I'm writing a 2D platformer engine in C++ using SDL / OpenGL.  I initially began with pure SDL using the tutorials on sdltutorials.com and lazyfoo.net, but I'm now using SDL to create an OpenGL rendering context and then render with OpenGL functions (specifically immediate mode but I'm learning about VAOs/VBOs). I am using SDL only for interface, audio, etc.

SDL uses a coordinate system with the origin in the upper left of the screen and the positive y-axis pointing down. It's easy to set up my orthographic projection in OpenGL to mirror this.

I know that texture coordinates are a right-hand system with values from 0 to 1 -- flipping the texture vertically before rendering (well, flip the file before loading) yields textures that render correctly... which is fine if I'm drawing the entire texture, but ultimately I'll be using tilesets and can imagine problems.

What should I be concerned about in terms of rendering when I do this?

If anybody has any advice or they've done this themselves and can point out future pitfalls, that would be great, but really any thoughts would be appreciated.

sentences:
Building an Octree for terrain generation I've previously implemented marching cubes/tetrahedra to render an IsoSurface. It worked (YouTube), but the performance was dire as I never got around to implementing variable Level of Detail based on view distance (or even removing old, distant chunks).

I decided to have another go and do it properly this time.
I've started by creating an OctreeNode that works as follows when Build() is called.

If the chunk is too small to build, return immediately.
Work out if the surface passes through this chunk's volume.
If so, then decide if we want to raise the LOD (because the camera is close)
If so, then spawn 8 children and call the same process on them
If not, build the mesh using the current node's dimensions

Some PseudoCode:

OctNode Build() {
    if(this.ChunkSize < minChunkSize) {
        return null;
    }
    densityRange = densitySource¹.GetDensityRange(this.bounds);
    if(densityRange.min < surface < densityRange.max) {
        if(loDProvider.DesiredLod(bounds)² > currentLoD) {
            for(i 1 to 8) {
                if(children[i] == null) {
                    children[i] = new OctNode(...)
                }
                children[i] = children[i].Build();
            }
        } else {
            BuildMesh();
        }
        return this;
    }
}

¹ As well as returning density at a point, the density source can determine the possible density range for a given volume.

² The LoD provider takes a bounding box and returns the max desired LoD based on camera position/frustum, user settings, etc...

So... This all works fairly well. Using a simple sphere as the Density source, and showing all nodes:

And just the leaves:

However, there are a couple of issues:

I have to define the initial bounding volume (and the larger it is, the more processing I need to do)
At the root of the tree, I have no idea how deep the leaves will be, so my LoD numbering starts at lowest quality (root) and increases as chunks get smaller. Because LoD is now relative to initial volume, it's not much use when I want to do things at specific sizes / qualities.

I've thought of a couple of options but both seem flawed:

Maintain a collection of Octrees and add/remove depending on distance. Can't see how I'd mesh across nicely¹, plus I'd need a list of known-empty nodes, especially if I want arbitrary 3D surfaces (to avoid re-calculating empty volumes repeatedly)
Add a parent Node to the current root, then add seven siblings for the original node. This would work and be on-demand but it seems complex to shrink back down sensibly as the player moves through the landscape. It would also make LoD numbers even less meaningful.

¹ [In clarification to Q below] At present, if 2 physically adjacent nodes in the tree are at different LODs, I have some code to coerce the verts such that there's no seam when the meshes are generated. I'm able to do this by knowing the the density for multiple of surrounding nodes. In a scenario where I have 2 independent octrees side-by-side, I'd have no easy way to retrieve this information, resulting in seams.

What's an optimal way to approach this?

sentences:
Isometric Architecture Map Game Data I'm not sure this kind of question has been answered yet, if so i'm sorry to duplicate it.

My question is rather simple :

I'm creating a simple Isometric game with libgdx, i'm using Tiled but only to design the map and render it with OrthographicMapRenderer.

The map is a static map of 6864 * 6880 pixels, one tile is 59*43 pixels

I wanted to do some pathfinding to my game, so I decided to store my map data into a simple 2D array like this : int cells[i][j] which would contains 0 if the tile is walkable or 1 if it's not, it is as simple as that !

Currently I've simply using basic formula to convert world cartesian coordinate to Isometric coord, and formula to get tile pos based on iso pos, (eg : you input a iso coord, the function return a vector like <2,5> which is the 2nd x tile and 5th y tile.

It perfecttly work as execepted, I also make it that iso tile coord is always positive ( <0,0> is at the top left corner of my world )

But here is my Question or doubt : How to handle correctly the game data tile ? Does a 2D array is sufficient, if yes, how to, for exemple write a function that get if a tile is walkable or no based on tile coord ? ( example : I click on my map, the coordinate is translated to tile coord ( < 4,5> for example,) how to check if this tile is walkable ?, i dont get on how to do it i'm really lost.

EDIT : Ive successfully implemented the isometric logic : I can convert world coordinate to tile coorinate ( eg : (5075;4851) -> (203;28)) and the reverse but i'm confused on how to fill the 2d Array, use it for A* algorithm and make the bridge between these coordinate and the 2D array

Thank you for you help,
Regard

sentences:
Convert Autocad DWG to OBJ, FBX or similar I know this is only partially game development related, but couldnt find another place to ask.

How can i convert an autocad dwg or dxf file to a more 'common' format like OBJ, FBX, 3DS, etc. ?

i tried directly using autocad LT but the export options dont have any other format.s

free and oss solutions preferred.

sentences:
How to load values into a script from a file? I have a prefab of a "generic unit;" each one has a script with some public variables: name, health, and attack.

Currently, I am manually making copies of that prefab and editing their names, health and damage values in the inspector. This seems unwise to me.

I would rather be able to make a simple file for each unit type, containing its important information, like this:

name = "Archer"
health = 3
attack = 1

And so on. Then, I would like to be able to turn that into actual GameObjects in Unity, presumably by instantiating the prefab and filling in its values with values from the file.

I could then make a script that runs when the game begins and iterates through, making all the objects I need.

However, I do not know the proper way to go about doing this. Is there some way to read files and slot values into variables of a script?

To be clear, I would like to be able to tell Unity to make an Archer, then have it read the Archer file, look up its values for health and attack, then instantiate a copy of the Generic Unit prefab and slot the values that it read into the public variables of a script component of the newly-created game object.

sentences:
Implementing The Command Pattern - Undo And Entity References I am trying to implement a replay/undo system for a turn based strategy game I am currently working on. A sample move could go as follows:

1. A players select a pawn and gives it an attack command.
2. The attacked unit dies.
3. The dead unit is removed from the map and the controlling player.
4. The controlling player takes some damage.
5. The attacking unit gains a survivor strength power up for the remainder of the game.

The rest of the game plays similarly to a Fire Emblem type game, but the point is a single command like attacking yields multiple effects to various game entities.

Eventually I want to make the game networked, but for now everything is local play.

After doing some research, I came across several resources discussing the command pattern and feel it is the solution to my replay and undo system. I ended up using an interface similar to https://gamedev.stackexchange.com/a/37684/41499 but I am confused on some of the implementation details.

Do I make commands to update each component of my game separately (i.e. AtkUnitCmd, RmvUnitFromMapCmd, RmvUnitFromPlayerCmd, InflictPlayerDmgCmd, etc.) or should my AtkUnitCmd handle all updates of entity state internally?
How do I handle dead units? I can store a reference to the dead unit, but this would likely need to change when networking is implemented as the object itself would not be transmitted over the network correct?
Each command has some animation involved for example when a unit moves an animation needs to play. I may choose to skip the animations while other times leave them on. Do I bake the animations into the commands themselves or should I separate the animation code and call it somehow when the command is played?

Any thoughts?

sentences:
XNA Game arhitecture, sharing vertices between objects I'm practicing primitives rendering in XNA and I want to create something like pipe or tunnel.
I have base class called PipeSegment from which I inherit classes like RotatingSegment and NormalSegment (and whatever I imagine).
To combine this segments I have created class called Pipe, which have List of PipeSegment objects.This is what I have so far :

It's ok, except the fact that I'm generating way more vertices than necessary.
For each segment I'm generating 36 vertices for 'front side', and 36 for 'back side'.

Illustration :

Now, my question.
How can I optimize this, how to generate less vertices ?
Is there any way to 'share' vertices between Segments to preserve my current code structure and is my code structure suitable for this ?

Thanks

sentences: Unity3D/Blender: Bounding box rotated on import For some reason my bounding box is always tilted when i import to unity. I've checked for loose geometry and everything but there's nothing.

sentences: How do I calculate the angle of the slope at a point on a 2D bitmap terrain? I have an arbitrary destructible bitmap terrain like the one in "Worms". It's easy to work out if a character or missile intersects the terrain, but how do I work out the angle of the slope at the contact point, so I can make grenades roll down hills, bounce off at the right angle, etc. I know it can be down by somehow taking a sample of points around the impact point and seeing which ones intersect, but I'm not sure exactly how to go about it, and in an efficient way.

sentences:
LibGDX: Scrollpane won't scroll to bottom after adding children to contained table To my game I want to add a gui element that displays text and textButtons whenever something is happening or it wants you to make a decission (an answer while talking to a person for example). To keep track of your actions you shall be able to scroll it. Similar to text adverntures or dialog boxes in rpgs.

I use Scene2Dui for my GUI, so I put a scrollPane in my GUIs root table. I have methods for adding stuff to the contained table and tell the scrollPane to scroll to the bottom.

In general the idea works, but the thing doesn't scroll to the bottom but only to the bottom of the element I added before the current one. I'm puzzled.

Here's the code, leaving out the skins and styles part:

public class TextBox {

ScrollPane box;
Table table;
Label.LabelStyle lStyle;
Skin skin;

TextBox() {

    table.setFillParent(false);

    box = new ScrollPane(table, scrollStyle);

    box.setScrollingDisabled(true, false);
    box.setOverscroll(false, false);
    box.setFillParent(false);

    table.align(Align.topLeft);
    table.row();
}

void writeDecissions(GameEvent[] events) {

    Table tableD = new Table();
    tableD.setFillParent(false);

    if (events != null) {

        for (int i = 1; i < events.length; i++) {

            if (events[i] != null) {

                String s = Character.forDigit(i, 10) + " - "
                        + events[i].getDecision();

                TextButton button = new TextButton(s, style);
                button.getLabel().setWrap(true);
                button.getLabel().setAlignment(Align.left);

                tableD.add(button).width(box.getWidth() - 40).spaceBottom(20).spaceTop(20);

                tableD.row();

            }
        }
    }

    table.add(tableD).align(Align.left).pad(20);
    table.row();

    box.setScrollY(table.getHeight());
}

This is the way I test it:

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

    stage.act();
    stage.draw();

    if (Gdx.input.justTouched()) {
        gui.textBox.writeDecissions(events);
    }

I tried box.setScrollY(box.getMaxY) as well as setting overscroll to true (don't really know what that is tough). With the same result.

Finally a screenshot:

Help appreciated.

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

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

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

I will appreciate your responses.

sentences: Can a prefab of a complete Unity scene be created? Can we create a prefab out of a complete unity scene, so that we can instantiate the complete scene like we instantiate gameobjects in unity.

sentences: What does a C++ expert need to know? so the other day I was looking for jobs in the gaming industry (software engineer/game programmer/gameplay programmer, etc) just to get a look at what are some of the requirements. Most of these jobs require 5+ years of experience with C++, and to be an "expert" in this language. My question is, what does exactly an expert in C++ need to know, apart from pointers, STL, memory allocation, inheritance, polymorphism? Do you need to know the programming language from A to Z? Every bit of the language? Or what are some of the most important topics that you need to know in order to qualify as a "C++ expert"?

sentences:
Efficiently Handling Entity-Interactions in a Tile-Based World I've been programming Roguelike games lately and there's a common problem I always run into. I can't seem to find a satisfactory solution for handling Monster-Monster interactions.

For the intents and purposes of this question, let's assume my Game-Map just is an array of bytes.

struct Map{
 unsigned char tiles[100][100];
};

Now, I've got Monsters, which have an X and a Y position.

struct Monster{
 unsigned int x, y;
};

Handling Monster-Map interactions is trivial. For example, if a monster wants to move to the left, I just have to check if tiles[x - 1][y] is a passable tile. This is very nice because no-matter how large the map is, I only have to check one tile.

But here's where I run into problems. What if a monster wants to breath fire onto a tile to the left. To ignite any monster that might be on the tile, I'd have to iterate through every monster in the entire world, checking if it's x, y matches the coordinates of the tile. This is not-so-nice, as the cost of breathing fire scales linearly with the amount of monsters in the world. If only there were a way to access monsters using tile-coordinates...

Which leads me to one solution. Tiles could hold a pointer to a monster. When a monster moves to a tile, it sets the previous tile's pointer to a nullptr and sets the current tile's pointer to this.

struct Map{
 unsigned char tiles[100][100];
 Monster* resident;
};

Now, when a monster breaths fire, it just ignites whatever monster is on that tile by using the tile's monster-pointer. Now the cost of breathing fire is constant, and the cost of moving is constant. Perfect!

But...

Now a tile is 9 bytes instead of 1 byte. sizeof(map) has more-than octoupled! Ouch!

My question is: What other solutions could be used to solve this problem? Maybe one's that meet in the middle on memory usage vs. number of operations.

sentences:
OnCollisionEnter2D incorrect contact point? I am trying to shoot a bullet (rigidbody2d, boxcollider2d) to another enemy object (rigidbody2d, kinematic, circlecollider2d). I want the collision point between these two. When they collide, i want a collision particle effect and from the contact point, i want to create 5 rock objects all moving in different directions. How should i achieve this? Problem is that, the contact point i get seems incorrect. Collision particle effect is created when collision happens but the rock objects are created in some other point close to the contact point but not the contact point. Also how to i move the rock objects in different directions after instantiating them?

my code:

void OnCollisionEnter2D(Collision2D coll)
{
    if (coll.gameObject.tag == "Enemy")
    {
        ContactPoint2D contact = coll.contacts[0];

        GameObject rock1 =  Instantiate (rock, contact.point, transform.rotation) as GameObject;
        rock1.rigidbody2D.velocity = transform.up * 20;
        GameObject rock2 =  Instantiate (rock, newPos, transform.rotation) as GameObject;
        rock2.rigidbody2D.velocity = transform.right * 20;
        Destroy(coll.gameObject);
        Destroy (gameObject);
        Instantiate (explosion, transform.position, Quaternion.identity);

    }
}

sentences:
XNA CustomModelAnimationSample problem I downloaded the official tutorial from:CustomModelAnimationSample
It works fine but when I try to replicate it in my project, it fails to load the Tag property in my model.

Is found that the probelm is in the line:

skinnedModel = Content.Load<Model>("DudeWalk");

This line loads the model from the DudeWalk.fbx file and with the custom SkinnedModelProcessor. It loads the animations data in the model. After the line the Tag property is full. I stepped into the method and it went to the custom ModelData class.

I copied everything from the projects CustomModelAnimationWindows and CustomModelAnimationPipeline to my solution and set all the references. I tried the same line of code and couldn't step in the method. It called the default method or model constructor and after the line the model's Tag propetry was null.

I have to load the model through my custom SkinnedModelProcessor class, but how I tell the game to use this class? In the tutroail CustomModelClass the line is changed to:

model = Content.Load<CustomModel>("tank");

So I assumed that I have to set the generic type to a custom model class, but the first example works without it.

If anyone has some useful advice or some other helpful link, I'll be happy to try it.

EDIT :

I tried this tutorial Creating a Custom Importer and Processor but it didn't work either.

I understand now that the binding of the custom pipeline processor is done at build-time and not a run-time. But my custom processor never gets bound nor called.

sentences:
How do I use a PC Dance Pad with Xna? I have a Dance Pad and I want use it in XNA as a controller. It has a USB connection.

Can someone help me?

sentences:
Semi Fixed-timestep ported to javascript In Gaffer's "Fix Your Timestep!" article, the author explains how to free your physics' loop from the paint one.

Here is the final code, written in C:

double t = 0.0;
const double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

State previous;
State current;

while ( !quit )
{
     double newTime = time();
     double frameTime = newTime - currentTime;
     if ( frameTime > 0.25 )
          frameTime = 0.25;   // note: max frame time to avoid spiral of death
     currentTime = newTime;

     accumulator += frameTime;

     while ( accumulator >= dt )
     {
          previousState = currentState;
          integrate( currentState, t, dt );
          t += dt;
          accumulator -= dt;
     }

     const double alpha = accumulator / dt;

     State state = currentState*alpha + previousState * ( 1.0 - alpha );

     render( state );
}

I'm trying to implement this in JavaScript but I'm quite confused about the second while loop...

Here is what I have for now (simplified):

...
(function animLoop(){
  ...

  while (accumulator >= dt) { // While? In a requestAnimation loop? Maybe if?
    ...
  }

  ...
  // render

  requestAnimationFrame(animLoop); // stand for the 1st while loop [OK]
}())

As you can see, I'm not sure about the while loop inside the requestAnimation one...

I thought replacing it with a if but I'm not sure it will be equivalent...

Maybe some can help me.

sentences:
How can I organize render and transformation data in a scalable fashion? I am writing for OpenGL 2.0 and in the future porting to OpenGL ES 2.0. I only use VBOs and shaders (no immediate mode, no vertex arrays).

I already have working solutions, they just... feel wrong. All my calls related to OpenGL are tucked away in a separate class called RenderManager (this includes creation of VBOs and IBOs, texture IDs and shader programs) and rendering. I called the creation of OpenGL objects logging in and out, so majority of this action is invoked from the ResourceManager object upon loading of data. However, a lot of geometry (level) is generated dynamically and therefore some RenderManager calls to create the VBOs/IBOs is scattered throughout the level class.

Now, I have a Renderable interface which returns the (single) transformation matrix and a RenderOp object when it is time for rendering. RenderOps is an object that has Vertex/Index Buffer pointers (has actual geom. data which in turn has VBO/IBO indices) and some parameters such as whether to use the index buffer and if the RenderOp needs blending and stuff.

There is also the RenderView object; it has the viewport parameters, projection matrix and view matrix (camera).

The game objects reside in the World class (single-dimension arrays). These game objects are added upon their creation, and are derived from Entity interface. Entity is able to  return the number of Renderable-type objects within as well as the actual pointer to a Renderable at a given index.

The magic happens when the main loop traverses the World. First it collects all Light objects visible from within Frustum. Then it collects Entity object that's within Frustum (it gets added to std::vector inside RenderView if it is), and then it checks that same object to see if it is inside any of the visible Light's bounding volumes (and gets added into Light's std::vector).

Then the RenderView is passed onto the RenderManager class, which  extracts appropriate Renderables from each Entity, applies Renderable's shader, then applies Renderable's textures, then stores the transforms inside itself and promptly shoves them down the programmable pipeline's throat along with attributes stored inside the RenderOperation (that gets extracted from Renderable as well).

Last note - I have NO way to render debug data, which is extremely annoying.

A lot of what I am doing feels wrong. My question is, how do you organize all your Renderable and Transformation data to facilitate your rendering needs? I am burning out thinking of semi-flexible ways of managing this data and I want to hear your ways. I am not a big fan of scene graphs, and consequently don't really want to implement one as I feel there are no real hierarchies inside the game, but I feel like I'm running myself into a corner.

Please throw me a bone here, how do you manage all this data? And if you suggest an event based rendering system, how would you design it?

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:
Opengl ES 2.0: Is there a way to use less resources to draw in-game background texture 1.Should my in-game background be drawn with my game loop renderer, or if

2.I don't want to draw my background image every frame in my main renderer since it could possibly be a heavy job while the game loop is running. Do I need to use a separate thread or some other method to achieve this?

FYI, the background should be able to scale and translate with zooming function, it should be flexible.

sentences:
SDL2 focus lost = massive gain in FPS Whenever I lose focus from my game window, I go from ~60FPS to 6000+, then when the window gains focus again, I go back to around 60 frames per second. And yes, this happens every time I run my game, including Release mode.

Here is an example log output from my game:

[INFO] [10/01/2013 22:37:42.355] Window Gained Focus!
[INFO] [10/01/2013 22:37:45.365] Frames Per Second: 60.0439
[INFO] [10/01/2013 22:37:45.365] Frame Counter: 60
[INFO] [10/01/2013 22:37:46.365] Frames Per Second: 60.0324
[INFO] [10/01/2013 22:37:46.365] Frame Counter: 60
[INFO] [10/01/2013 22:37:47.381] Frames Per Second: 59.4341
[INFO] [10/01/2013 22:37:47.382] Frame Counter: 58
[INFO] [10/01/2013 22:37:49.669] Window Lost Focus!
[INFO] [10/01/2013 22:37:50.383] Frames Per Second: 1240.02
[INFO] [10/01/2013 22:37:50.383] Frame Counter: 9561
[INFO] [10/01/2013 22:37:51.384] Frames Per Second: 1839.02
[INFO] [10/01/2013 22:37:51.384] Frame Counter: 6662
[INFO] [10/01/2013 22:37:52.77] Window Gained Focus!
[INFO] [10/01/2013 22:37:52.400] Frames Per Second: 1656.77
[INFO] [10/01/2013 22:37:52.400] Frame Counter: 34
[INFO] [10/01/2013 22:37:53.400] Frames Per Second: 1512.46
[INFO] [10/01/2013 22:37:53.400] Frame Counter: 60
[INFO] [10/01/2013 22:37:54.401] Frames Per Second: 1391.89
[INFO] [10/01/2013 22:37:54.402] Frame Counter: 60
[INFO] [10/01/2013 22:37:55.402] Frames Per Second: 1289.78
[INFO] [10/01/2013 22:37:55.402] Frame Counter: 58
[INFO] [10/01/2013 22:37:55.876] Quitting with error code: 0

The frame counter is just a simple integer that I increment every loop in the game, and then reset (and print it out) every second. Here is the implementation of my game loop, (inside the run() function), based off of this article.

Is this a problem with my loop, or is this a problem with SDL? I'm not sure why my frame rate is rocketing up.

sentences:
XNA texture garbage collection I use a

 Dictionary<string, Texture2D>

for storing textures and every texture in the game is a reference to a texture from this dictionary. However when all references are gone, does the GC dispose of the textures (I don't think so as they are still accessible)?

And if it doesn't, how can I count the references to the textures so I can dispose of them manually?

sentences:
Perlin noise example the same on CPU as GPU? I am looking for an example site with a Perlin Noise implementation in both CPU and GPU, that generates somewhat the same results in those two places.

I see many CPU implementations of Perlin Noise, but they don't match up with the GPU implementations that I found.

The reason I need this is for physics. The map is generated with Perlin Noise on the GPU in 2D, but this also means that to do physics, I must have a CPU version of the algorithm that generates the same results.

sentences:
Unity3D Drag Object with Mouse Gives Invalid Position I am trying to implement a simple script to drag a GameObject with the mouse in Unity.
However, when the position of the object is updated with the following script, I get an error saying:

transform.position assign attempt for 'purpie_5' is not valid. Input position is { Infinity, 51351759646418134000000000000000.000000, -143589927261340110000000000000000000000.000000 }.
UnityEngine.Transform:set_position(Vector3)

I am not sure what I am doing wrong. This is the code I am using:

public class MouseInputInterface : MonoBehaviour {

#region PUBLIC MEMBERS
public Transform heldObject;
#endregion //PUBLIC MEMBERS

#region PRIVATE MEMBERS
private GameObject currTarget;
private Vector3 touchOffset;
private bool dragging = false;
#endregion //PRIVATE MEMBERS

// Use this for initialization
void Start ()
{

}

    void Update()
    {
    if(Input.GetMouseButton(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if(Physics.Raycast(ray,out rHit))
        {

            currTarget = rHit.transform.gameObject;

            if(currTarget != null)
            {
                if(!dragging && currTarget.transform.tag == "Moveable")
                {
                    dragging = true;
                    heldObject = currTarget.transform;
                }

            }

        }

        if(heldObject != null)
        {
            /*calculate offset*/
            Vector3 screenPoint = Camera.main.WorldToScreenPoint(heldObject.position);

            /*calculate offset from camera*/
            Vector3 offset = heldObject.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));

            //form the current position
            Vector3 curPosition = Camera.main.ScreenToWorldPoint(screenPoint) + offset;

            heldObject.transform.position = curPosition;
        }
    }
    else if(Input.GetMouseButtonUp(0))
    {
        //clear held object
        heldObject = null;
        //clear flag
        dragging = false;
    }

    }
}

Thanks for the help.

sentences:
How to texture a floor so that edges have slightly different texture than the rest of the floor When trying to create somewhat realistic environments, I often find that the edges where floor/wall/ceiling meet will have slightly different texture compared to the rest of the floor/wall/ceiling.

An example of this can be seen on this concrete walkway:

The parts of the concrete away from any walls is worn smooth by people walking across it, but it becomes lighter and rougher closer to the wall or the metal pole.

What are some techniques (general or UE4 specific) to emulate this when texturing a level?

sentences:
Retrieve variable from another class and send to another scene in Unity Sorry for asking a noob question, but I have never used c# in Unity, only unityscript.

Basically I have a public int score variable stored in Players Class.

I need to retrieve it in the following method:

void OnTriggerEnter(Collider c)
{
    if(c.tag == "PlayerCollision")
    {
        if(!c.gameObject.transform.parent.gameObject.GetComponent<Player>().isDead)
        {
            Debug.Log("Hit");
            //Load next scene
        }
    }
}

How can I retrieve the score variable in this method below and send the variable to the next scene? (In unity script I had to do something like Application.LoadLevel(1); after of course building the scene as levels. Thanks

sentences:
Transparent image changing color to very light when used on light background in Unity I'm trying to use this transparent image (transparent brown, with a transparent white shadow):

over this background:

in Unity UI.
But the end result is not similar to what I see in photoshop at all.
What I expect and what I have inPhotoshop:

What I get in Unity:

How can I fix this?

sentences:
What is the purpose of a guild bank? I've seen guild banks in Wow, or Dofus, and other MMO games.

In the guild I've been a part of, we mostly used the bank as storage; resources stored that end up not being used are wasted. Sometimes there is a free share policy, but there is always that one guy who will take stuff he does not really need and sells it.

This led me to wonder what is the original purpose of a guild bank, what do players like to use it for, and how can a game help them do it?

sentences:
How to change the Art of the Catch script in order to spawn random items? I've downloaded the mod Art of the Catch and I was wondering how I could change the scripts in order to spawn three new category of items:

any ingredient (dragon bones)
any non-enchanted craftable item (iron helmet)
any enchanted craftable item (ring with magic enchantment that is vanilla or added by a mod)

Looking at the source code, I found this:

function SelectFish()
    Form fish_base = fish_detected.GetBaseObject()

    if fish_base == CritterPondFish01
        PlayerRef.AddItem(CritterPondFish01Ingredient, 1, true)
        _AC_CaughtFish01.Show()
    elseif fish_base == CritterPondFish02
        PlayerRef.AddItem(CritterPondFish02Ingredient, 1, true)
        _AC_CaughtFish02.Show()
    elseif fish_base == CritterPondFish03
        PlayerRef.AddItem(CritterPondFish03Ingredient, 1, true)
        _AC_CaughtFish03.Show()
    elseif fish_base == CritterPondFish04
        PlayerRef.AddItem(CritterPondFish04Ingredient, 1, true)
        _AC_CaughtFish04.Show()
    elseif fish_base == CritterPondFish05
        PlayerRef.AddItem(CritterPondFish05Ingredient, 1, true)
        _AC_CaughtFish05.Show()
    elseif fish_base == CritterSalmon01 || fish_base == CritterSalmon02 || _AC_FishWaterfallTypes.HasForm(fish_base)
        PlayerRef.AddItem(FoodSalmon, 1, true)
        _AC_CaughtFishSalmon.Show()
    endif
endFunction

It was inside _ac_beginfishing.psc with other functions. I am pretty sure I just need to modify the function, but I am not sure if we can use a general class of items as a variable, and I am even less sure about adding items with enchantments, because from what I know there's no variable that points to a list of items.

Anyway, how would you change the scripts so that it spawns random items? The way I would do is generate a random number and use it to select an item in a list, but I am not familiar with the scripting language, so I am not exactly sure how I could do that or even if it's possible.

sentences:
Unity not redrawing sprite, after sprite change I am making a game where the player mines dirt by walking on it:  So, I created a scene and added a bunch of dirt to a grid, from a dirt prefab. When the character walks on a square, it is supposed to change to dark dirt. If I only have a few hundred dirt squares, it works as expected. I step on the dirt, and it turns dark. But now that I have a few thousand dirt squares, unity renders incorrectly, and will only change the sprite for dirt squares that are in every 4 or 5 columns. See the following picture:

The debugger outputs GetComponent<SpriteRenderer>().sprite.name for the dirt I walk on is DarkDirt even though it is showing up as "Dirt" in reality. The inspector in the scene view agrees that it should be rendering DarkDirt.

How can I get unity to re-draw sprites when they update?

sentences:
What version of OpenGL should I target for Steam? I'm planning on developing a game (targeting towards PC and Linux) and putting it up on Steam in the future but I am not sure of what version of OpenGL to target so that the majority of steam users can be able to play my game.

I know Steam has a hardware survey but I'm still not sure of what OpenGL to use but a lot of people recommend OpenGL 3.0 and to make sure not version OpenGL 3.x since 3.x != 3.0.

sentences:
Player Ranking System Already posted this on another forum but I'll repost it here because I'm curious if this is a good forum for game-design questions.

I'm looking to design a player ranking system for my game. The game is similar to a racing game where you get a score for individual tracks you play (based only on your own performance). Beside the score for tracks played I want a player rank. The purpose of this player rank is to:

Make you feel like you are progressing and getting better
Encourage you to play more
Encourage you to play better and improve your skill
Be enjoyable

Another way to state it is that I want to encourage playing more levels (increasing amount of play) as well as improving skill (getting higher score). It's not necessary for the rank to actually reflect your skill. Although, I suspect some amount of accuracy is needed for the score to feel meaningful.

The only ranking system I'm familiar with is the ELO-type ranking system which I feel is lacking in some ways. Although it accurately reflect the skill of the player it has the problem of not being enjoyable in my experience - it punishes bad plays, gives no rewards for trying/experimenting with new plays. It also puts a lot of pressure on you to perform well in every game which discourages casual play.

Any ideas?

Thanks

sentences:
Problem when using two different shaders I have created a simple shader for drawing my scene in OpenGL. When another shader was introduced, a problem appeared.

I use the first shader and draw few objects in the scene. Then I use the second shader and draw something else. Every draw call has it's glUseProgram() before the drawing starts. Problem is that all my objects drawn with the first shader disappear, but if I call glUseProgram(firstShader) right after the second drawing is finished everything is fine. I can't figure out why this is happening even if I'm calling glUseProgram(firstShader) right before the drawing starts.

Is there something I'm missing about OpenGL drawing process? Is it possible that OpenGL actually draws everything using the second shader?

Most simplified version of my program looks something like this:

glClear(...);

glUseProgam(simpleStandardShader); // just transforming vertices and doing some directional lighting and texturing
foreach (GameObject)
    glDrawArray(...); // draw all 3D objects

glUseProgram(spriteShader); // transforming quads in screen space and texturing
foreach(Sprite)
    glDrawArray(...); // draw all quads

glSwapBuffers(); // i hope i wrote it right, don't remember exact name

sentences: Output from vertex shader in D3D9 I've been looking at creating some 2D rendering systems in D3D9, basically because I don't like ID3DXSprite. For the output of the vertex shader, what co-ordinate system does the run-time expect vertex co-ordinates in, like homogenous device co-ordinates? And secondly, does the depth of the resulting vertices have any effect except on the culling/depth buffering? I wanted to "reserve" a section of depth for use in 2D drawing, and then have a section for 3D geometry, to ensure that 3D geometry is always behind 2D.

sentences:
Use vsync event instead of a 16ms timer? I found that in game development, most people set a timer that gets triggered every 16ms to do the rendering.

As an Android programmer, I'm familiar with the Choreographer. You set a callback that will do the drawing stuff, and each time vsync happens, the callback is called.

I know the original use of vsync is to prevent modifying the buffer when the front buffer and the back buffer are being switched. But don't you think making the drawing/render code have the same period as the actual screen refresh rate (in an ideal situation) is better?

So is there any reason why people don't prefer the vsync callback or vsync event based design?

One reason I can come up with is that if a monitor is 75Hz, it will be too high-frequency to do the rendering, right?

sentences:
How do I make voting to kick a "leader" player fair? My game has many rooms of around 10 people where they compete. It's basically one big guy against the other small 9 people.

However, sometimes the one guy will intentionally 'troll' and make for an unfun game for the other 9 people. These people would like to kick the one guy to replace him with one of the other 9.

If the vote was required to be unanimous (other than the guy being kicked), then him just having one friend in the game would prevent the vote from passing. Likewise, if you did unanimous minus one, then two friends could stop the vote, etc.

There there is the issue with small rooms. If a room has only two or three people, then one guy can trivially kick other people.

Has any research been done for optimal votes required to kick someone from a room depending on how many people are in the room?

sentences:
How to make a noise gradient? Introduction:

I am working on a heat map made by Perlin Noise with the next result:

(Figure 1)

                  *(Red means really hot and light blue is colder)*

The algorithm identifies that mountains are colder at their top and plains vary between warm and hot(randomly, there is no physics behind).

QUESTION:

How can i do so that heat map i generated with Perlin Noise looks like this example:

(Figure 2)

where the temperature variations follows something like Earths equator.

My Ideas:

I thought about divide the map manually (from height to height2 is hot and so on...) but i do not like that idea as i want something more dynamic (temperatures may vary so does the heat map)

What i am asking?

Is there any better solution to this idea i had?

Thanks for your interest in this question.

EDIT:

With the code below i made possible the next thing:

public static Texture2D GetAirTemperature(int width, int height, Tiles[,] tiles)
{
    var texture = new Texture2D(width, height);
    var pixels = new Color[width * height];

    for (var x = 0; x < width; x++)
    {
        for (var y = 0; y < height; y++)
        {
            if (y <= 5 || y >= 95)
            {
                pixels[x + y * width] = Coldest;
            }
            else if (y <= 15 || y >= 85)
            {
                pixels[x + y * width] = Colder;
            }
            else if (y <= 30 || y >= 70)
            {
                pixels[x + y * width] = Warm;
            }
            else if (y <= 45 || y >= 55)
            {
                pixels[x + y * width] = Warmer;
            }
            else { pixels[x + y * width] = Warmest; }
        }
    }

    texture.SetPixels(pixels);
    texture.wrapMode = TextureWrapMode.Clamp;
    texture.Apply();
    return texture;
}

and obtaining the next result:

(Figure 3)

How i could multiply/modulate/something it by my Perlin noise so i get something irregular but looks a like Earths Equator?

Because you cannot do like Texture2D * Texture2D (multiply textures)

EDIT2:

What if, instead of using noise, i create my own 2D air temperature map as a starting point?
I mean, my own matrix [width*height].

Temperature will have the input given at the center of matrix (equator) and then, when update the temperature map (a cycle).

A cycle will go once in a while (periodically) to simulate temperature changes.

The input from the sun at the equator [(width/2)x(height/2)] will move outwards from the center into "north and south the matrix" (North is x, y < 50 && south is x,y > 50)

That means i have to check each row and number above and under the equator while maintaining energy conservation and other factors.

It is nice on paper but a hell in coding. Do you have any other idea to accomplish something similar to figure 3?

sentences:
How to create a glowing corona/halo around a sun and make it emit light I am trying to understand material and shaders in Unity.
make my object glow like a sun. For the moment I do not care if it's not looking like a star, but I would like that it at least emit light.
How do I make something that look like a star, and emit light?
Like this:(And if possible, be able to change the light color)

I tried to play with the Standard shader, and add some emission like this :

I tried legacy self illuminated, but they look like 2d, and have no depth

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:
How to network this entity system? I have designed an entity system for an FPS. It basically works like this:

We have a "world"-object, called GameWorld. This holds an array of GameObject, as well as an array of ComponentManager.

GameObject holds an array of Component. It also provides an event mechanism which is really simple. Components themselves may send an event to the entity, which is broadcasted to all the components.

Component is basically something that gives a GameObject certain properties, and since GameObject is actually just a container of them, everything that has to do with a game object happens in the Components. Examples include ViewComponent, PhysicsComponent and LogicComponent. If communication between them is needed, that can be done through the use of events.

ComponentManager just an interface just like Component, and for each Component class, there should generally be one ComponentManager class. These component managers are responsible for creating the components and initializing them with properties read from something like an XML-file.

ComponentManager also takes care of mass updates of components, like the PhysicsComponent where I will be using an external library (which does everything in the world at once).

For configurability, I will be using a factory for the entities which will read either an XML-file or a script, create the components specified in the file (which also adds a reference to it in the right component manager for mass updates), and then inject them into a GameObject object.

Now comes my problem: I am going to try to use this for multiplayer games. I have no idea how to approach this.

Firstly: What entities should the clients have from the beginning? I should start with explaining how a single-player engine would determine what entities to create.

In the level editor you can create "brushes" and "entities". Brushes are for things like walls, floors and ceilings, basically simple shapes. Entities are the GameObject I have told you about. When creating entities in the level editor, you can specify properties for each of it's components. These properties are passed directly to something like a constructor in the entity's script.

When you save the level for the engine to load, it is decomposed into a list of entities and their associated properties. The brushes are converted into a "worldspawn" entity.

When you load that level, it just instanciates all the entities. Sounds simple, eh?

Now, for networking the entities I run into numerous problems. First, what entities should exist on the client from the beginning? Assuming that both the server and client has the level file, the client could might as well instanciate all the entities in the level, even if they are there just for the purposes of game rules on the server.

Another possibility is that the client instanciates an entity as soon as the server sends information about it, and that means that the client will only have entities that it needs.

Another issue is how to send the information. I think the server could use delta-compression, meaning that it only sends new information when something changes, rather than sending a snapshot to the client at every frame. Though that means that the server must keep track of what each client knows at the moment.

And finally, how should networking be injected into the engine? I'm thinking a component, NetworkComponent, which is injected into every entity that is supposed to be networked. But how should the network component know what variables to network, and how to access those, and finally how the corresponding network component on the client should know how to change the networked variables?

I'm having huge trouble approaching this. I would really appreciate if you helped me on the way. I'm open to tips on how to improve the component system design too, so don't be afraid of suggesting that.

sentences:
calculating the weights for direction vectors to a target I have an entity that is allowed to move in a fixed amount of directions. Let's call a the angle between two directions. r is the length of each direction vector. Now the entity wants to head from its current position (x1,y1) to a target (x2,y2) in one of the fixed directions. Instead of getting the direction that the entity should head into, I want to get a weight for all directions that is based on how close the entity gets to the target with that direction, so that I can combine those weights with other things like avoiding some direction for example.

I thought about calculating the distance from the new positions to the target and then use the closest distance (the one in which the entity heads in the direction directly to the target) to get a weighting from 1 to zero for the other directions.

Now I was wondering if there is some other way to get the weights without having to calculate the distance for each direction. Maybe there is some sort of relation between the angle from the ideal direction and the distance that could be used to calculate the weights instead? So far I've figured out that at least there is no no linear relation between the angle and the distance.

Here is an image to hopefully clear things up a bit:

sentences:
In Unity how do I easily snap modular building pieces to the grid without overlaps or gaps? I'm new to Unity and purchased a set of modular building pieces from the asset store. I'm trying to arrange pieces of wall. The pieces are 5 x 5 x 0.5, so I've set my world grid size to 5 units and am using align to grid to make them line up nicely. I'm running into an issue when I try to make a corner. When I align the pieces to the grid, there is some gap and overlap, as seen in this picture:

I then tried to manually move the end piece inwards, which resulted in this:

That looks slightly better, but needed a manual adjustment so I don't think doing this everywhere scales very well, and plus there is some kind of visual/lighting artifact where the pieces overlap (hard to see in the screenshot but very obvious when I move around in game mode). Then I tried resetting that end piece back to the grid and pushing the two side pieces inwards, which resulted in this:

This looks good and has no overlap, but required a bit of manual adjustment and brought the sides off of the grid.
Assuming a set of wall pieces that are 5x5x0.5, how can I configure my grid and snap settings so that everything fits together nicely?

sentences:
Adding Log4Net to Unity I would like to add log4net library as a logging tool to visual studio project which created by Unity, Is this possible?

I dragged the log4net DLL to assembly references in Visual Studio. so the DLL added to the project, but when I want to import it in code with using log4net, it doesn't find the library!

sentences:
what can be done to improve the ultimate insane real time strategy game AI? I had this chat with a friend of mine about whether an AI can be created or not that could beat any human without resource cheating in a real time strategy game. An AI that would play almost perfectly. The AI of today's games have many areas that can be improved, most of them rely on resource cheating, a better early base developement because of that, and attacking in waves.

Still, the question is what would need to be done to improve on this to obtain the ultimate AI. Also, if you have any example of a game where a certain feature was used it would be great.

Edit: There is little clarification i can provide for those who haven't read the title or the few paragraphs describing the problem. This is about real time strategy games and the ultimate AI. That means Strarcraft, Warcraft, Generals, Red Alert, Age of Empires, AI War etc. Games that have more than one difficulty level, but the focus here is on the ultimate challenge.

tenpn has a fantastic post filled with great resources. Thank you, tenpn! I wish more people would contribute in that direction.

sentences: How to auto animate character movement - Unreal engine 4 I am learning Unreal 4. And basically I want to find out how to auto move character. Which means when I start playing I want the character to auto move forward without my interaction. I know how to do it in UDK, but can't do it in Unreal 4.

sentences:
Understanding diffuse lighting in The Division Here is a screenshot of the main character walking under a bright lamp:

His hat, that was originaly dark grey, turns completely white. My question is how can such lightsource do this without making everything around it superbright? Cuz that's what my humble attempts resulted in.

I can only think of two options:
 - they either use a standard diffuse formula (it has got to be diffuse light as it does not react to camera movement) and have a lightsource that fades extremely quickly (fastar than the standard quadratic attenuation model.
 - or they use some clever shaders for clothes to make them "catch light" so fast.

Maybe there is an easier solution?

Here are two more shots, the floor is not nearly as bright as the character that goes under the lamp:

UPDATE: I think I got my problem - they have a different attenuation formula. I think if I improve my attenuation I whould be able to achieve similar results.

sentences:
Min/Max of two vectors? This seems like a simple question, but i'm having trouble searching the internet for it.

In XNA, during a collision detecting method, I would determin the minimum of some vectors.

// Get the minimum top point
Vector2 minTopPoint1 = Vector2.Min(topLeft1, topRight1);
// Get the minimum bottom point
Vector2 minBottomPoint1 = Vector2.Min(bottomLeft1, bottomRight1);
// Get the minimum of both the top and bottom points.
Vector2 minPoint1 = Vector2.Min(minTopPoint1, minBottomPoint1);

I switched over to making a C++ engine, and am trying to replicate the collision formula (Honestly, it's confusing enough, I just need to replicate it from XNA)
I made my own Vector2, and now I need to make this Min function.

So, what is the minimum or maximum of two vectors?
Is it just the magnitude of the two vectors measured against eatchother?
Is it the x and y values min/maxed somehow?

sentences:
How does OpenGL determine different outputs with shaders? Lets say I have this GLSL code:

#version 330

out vec4 outputColor;

void main()
{
    float lerpValue = gl_FragCoord.y / 500.0f;

    outputColor = mix(vec4(1.0f, 1.0f, 1.0f, 1.0f),
        vec4(0.2f, 0.2f, 0.2f, 1.0f), lerpValue);
}

(taken from http://www.arcsynthesis.org/gltut/Basics/Tutorial%2002.html)

How does OpenGL determine that outputColor is in fact what color the fragment should be?

sentences:
How do I blend a bitmap with a color? I have a png which is mostly transparent, except for a shape I've drawn in white. I want to be able to blend this bitmap with a color when drawing it with Canvas. I'd like something like [Sa, (Dc * (1 - Sa)) + (Sc * C * Sa)], where C would be the color I want to blend with. I assumed I would just set the paint color to C, then call drawBitmap, but the default behavior doesn't seem to be blending.

Is this the right approach? Are there some Xfer codes I'm missing? Can I create a custom shader to do this? Is there an example in the android sdk api I missed that does this?

As an additional constraint, I should mention I want to avoid just creating a new bitmap with the blended color to use. The color C (above) could change every frame, and I don't want to have to generate 100's of these bitmaps for every color that I might need.

sentences:
glViewport like camera I'm using glViewport as a camera of sorts, but I'm not quite sure how it works. For example when I change do:

glOrtho(0, 800, 600, 0, -1, 1);
glViewport(0, 0, 400, 200);

It makes the viewing area larger rather than just viewing a 400x200 area...

sentences:
Possible to pass pygame data to memory map block? I am building a matrix out of addressable pixels and it will be run by a Pi (over the ethernet bus).  The matrix will be 75 pixels wide and 20 pixels tall.  As a side project, I thought it would be neat to run pong on it. I've seen some python based pong tutorials for Pi, but the problem is that they want to pass the data out to a screen via pygame.display function.

I have access to pass pixel information using a memory map block, so is there anyway to do that with pygame instead of passing it out the video port?

In case anyone is curious, this was the pong tutorial I was looking at: Pong Tutorial

sentences:
How can I automatically pause my timeline at a specific time code? I want to setup a way that the timeline will pause at a particular time/frame. I have tried this, and it doesn't work:

public PlayableDirector playableDirector;
void Update() {
    if (playableDirector.time == 4f)
        playableDirector.pause();
}

Also, is it alright to leave this in the update method?

sentences:
Colliding wiith a smooth line of blocks I'm having a strange problem. I'm creating a 2D platformer, and creating the gameplay map by reading a csv file and placing prefabs of the appropriate type on map.

One part of the map is a simple straight line of blocks. I can move across them no problem except that there's this particular area where I simply can't move over it.

(In the image the blue tiles are the ones I'm colliding with. I added that to help debug it). The block itself is not higher than any other blocks in the rest of the line, comes from the same prefab et cetera.

If I remove "Fixed Angle" from the player character block, when passing from this block it'll start to rotate wildly instead - suggesting that it's colliding with some sort of edge.

Here's the code I'm using to generate the blocks

 for (int x = 0; x < tiles.GetLength(0); x++)
        {
            for (int y = 0; y < tiles.GetLength(1); y++)
            {
                var tile = tiles[x, y];

                if (tile.HasValue)
                {
                    switch (tile.Value)
                    {
                        case TileType.MAIN_CHARACTER:
                            Instantiate(mainCharacter, new Vector3(x * TILE_SIZE, -y * TILE_SIZE), Quaternion.identity);
                            break;
                        case TileType.NORMAL:
                            Instantiate(maintile, new Vector3(x * TILE_SIZE, -y * TILE_SIZE), Quaternion.identity);
                            break;
                        default:
                            throw new NotImplementedException("No code for tile value " + tile.ToString());
                    }
                }
            }
        }

So, what am I doing wrong exactly? Is there a way to tell Unity to ignore these 'tiny' collisions?

EDIT 1: If it makes any difference, I'm using BoxColliders2D around each block

sentences:
How to Draw 2D Shapes in DirectX I am currently trying to draw a simple 2D circle and an arc in DirectX but there are no resources online with info on how I can do this. Lines & Points are built into DirectX anyway so that has never been a problem.

Can somebody explain how I can do this? I'm not talking about a sphere or any other 3D geometry. Just a simple 2D Circle and Arc.

sentences:
Procedural terrain using 3D noise I'm coding a procedural terrain generation based on this article from GPU Gems 3.

But using CPU (not GPU). I'm stuck at generating the procedural terrain. I just can't
figure out how make a 3D texture the way it looks in the article (fig. 1-10). Am I missing something big here? Here is the code:

float CTerrain::DensityFunction(float x, float y, float z) {
    CPerlin3DTexture perl_tex;
    float noise;
    uint32_t octaves = 3;
    float amplitude[10] = {0.25,0.5,1.0,1.9,4.1,8.1,16.1,9,10};
    float lacunarity = 1.5;
    float freq[10] = {4.03,1.96,1.01,0.51,0.2487,0.12563,0.8013,0.39913, 0, 0};
    uint32_t i;

noise = 0.0;
    for(i=0; i < octaves; ++i ) {
        noise += perl_tex.noise(x * freq[i],
                                y * freq[i],
                                z * freq[i]) * amplitude[i];
        x *= lacunarity;
        y *= lacunarity;
        z *= lacunarity;
    }

    return noise;
}

Values (nx,ny,nz) = (128,128,10)

float ***CTerrain::GenerateDensityTexture(uint32_t nx, uint32_t ny, uint32_t nz) {
float step[3];
int32_t i, j, k;

step[0] = 1.0 / (float)nx;
step[1] = 1.0 / (float)ny;
step[2] = 1.0 / (float)nz;
for(i = 1; i < nx-1; i++) {
    for(j = 1; j < ny-1; j++) {
        for(k = 1; k < nz-1; k++) {
            tex[i][j][k] = DensityFunction((float)i * step[0],
                                           (float)j * step[1],
                                           (float)k * step[2]);
        }
    }
 }

return tex;
}

Help, anybody? This is what I get from the above code:

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:
Programmatically creating billboards in unity What is the most efficient way to render a billboard in Unity?

In order to apply a texture to something must it be a GameObject with a Mesh component?  In which case, is my best bet to create a prefab of a Plane with the given texture and Instantiate(...) it at runtime? Or is there some sort of "billboard" primitive I should use instead?

sentences:
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:
How to transform mesh components? I am attempting to transform the components of a mesh directly using a 4x4 matrix. This is working for the vertex positions, but it is not working for the normals (and probably not the tangents either).

Here is what I have:

// Transform vertex positions - Works like a charm!
vertices = mesh.vertices;
for (int i = 0; i < vertices.Length; ++i)
    vertices[i] = transform.MultiplyPoint(vertices[i]);

// Does not work, lighting is messed up on mesh
normals = mesh.normals;
for (int i = 0; i < normals.Length; ++i)
    normals[i] = transform.MultiplyVector(normals[i]).normalized;

// Tangents?? I really do not understand these guys
tangents = mesh.tangents;
for (int i = 0; i < tangents.Length; ++i) {
    Vector4 temp = transform.MultiplyVector(tangents[i]).normalized;
    temp.w = tangents[i].w;
    tangents[i] = temp;
}

Note: The input matrix converts from local to world space and is needed to combine multiple meshes together.

sentences:
how can i fix my code in order to get rid of the error that says that the object I want to instantiate is null? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class replicate : MonoBehaviour
{

    public void replicateCube(InputField T)
    {
        int H = int.Parse(T.text);

        for (int i = 0; i < H; i++)
        {

            GameObject prefab = Resources.Load("Cube") as GameObject;
            GameObject go = Instantiate(prefab) as GameObject;
            go.transform.position = new Vector3(0, i*5, 0);

        }
    }
}

sentences:
Why are my triangles not being drawn in the color I define? I render a simple mash structure with Tao (don't think this is relevant) using DisplayList.

Following code appears between

int displayList = Gl.glGenLists(1);
Gl.glNewList(displayList, Gl.GL_COMPILE);

and

Gl.glEndList();

Simplified version of the code, with removed unrelevant parts:

Gl.glBegin(Gl.GL_TRIANGLES);

for (int i = 0; i < triangles.Count; i++)
{
    var triangle = triangles[i];

    bool ok = false;
    var normal = triangle.GetNormal(out ok); //get normal of TRIANGLE

  //this method just retrives correct color information here
    var visualData = GetVisualData(visual,
                      visual.RenderSettings, triangle,null, false);

    //Set the color for the vertex here. Color is always the same in THIS case
    Gl.glColor4f(m_colors[visualData.color.R],
                     m_colors[visualData.color.G],
                             m_colors[visualData.color.B],
                                 visualData.transparency);

    //for every vertex in triangle
    for (int vtx = 0; vtx < triangle.Vertices.Length; vtx++)
    {
         var v = triangles[i].Vertices[vtx];
         Vertex3 v3 = v.Coord;
         Gl.glVertex3d(v3.x, v3.y, v3.z); //set vertex
         Gl.glNormal3d(normal.x, normal.y, normal.z);  //set normal

    }

}

Gl.glEnd();

Accoring to documentation if I set the same color for all 3 vertices of the triangle it must have the solid color. But what I get is:

As you see the colors are not uniform across different triangles, but I'm pretty sure that in this loop the color is not changed, it remains static (I even tried to set constant int values as color , but  result is always the same)

Q:

What can be possible reason of this rendering behaviour?

sentences:
Unity - Access to svPosition in fragment shader I am trying to access to the svPosition in my fragment program in Unity but I keep having this error.

  invalid input semantic 'POSITION': Legal indices are in [1,15] invalid ps_3_0 input semantic 'POSITION'

Here are some information about my whole shader.

struct : float4 pos : SV_POSITION;
vertex : o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
fragment : col.rgb = i.pos.xyz;

Any idea how to access this value?

sentences:
Which software to keep track of my project? I'm about to start the first real phase of my game development which will consist of the acquisition of information, resources and the definition of where I want to go and what I will need for that. I just want to make sure that I'm prepared as best as possible before I actually start development.

I don't like the thought of using Microsoft Word or Excel for my project management... I already worked with MS Project but I don't think it fits my needs.

I need a software where I can easily maintain project steps, milestones, important issues, information about technologies and engines I use, as well as simple notes and thoughts I just want to write down.

I usually prefer a whiteboard for stuff like that but unfortunately it's not a persistent way of storing. ;) Also writing it down the old-school way is something I can think of, but only for quick notes...

Which software do you use for that?
Are there commonly used programs?
Is there any free software at all?

sentences: Source control for storing everything of game project? Is it usual to manage not only source code, but all assets, textures, art, documentation files, etc under git repository for version controlling? For example I wanna to get back old version of texture. If it is very bad practice what tools do you use for version control of assets and other stuff?

sentences:
Game resources storing I'm working on a browser-based RTS, and we are targeting 10k+ users with multiple towns per user.

I have the following table townresources in which I store every resource value for every town ID:

CREATE TABLE IF NOT EXISTS `townresources` (
  `townResourcesId` int(10) NOT NULL AUTO_INCREMENT,
  `userId` int(10) NOT NULL,
  `resourceId` int(10) NOT NULL,
  `townId` int(10) NOT NULL,
  `balance` decimal(8,2) NOT NULL,
  `resourceRate` decimal(6,2) NOT NULL,
  `lastUpdate` datetime NOT NULL,
  PRIMARY KEY (`resourceId`,`townId`,`townResourcesId`,`userId`),
  KEY `townResources_userId_users_userId` (`userId`),
  KEY `townResources_townId_towns_townId` (`townId`),
  KEY `townResourcesId` (`townResourcesId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Stores Town Resources' AUTO_INCREMENT=9;

I'm a bit reserved about performance impact for a large amount of users. I'm thinking about moving the balance for resources to the towns table, and the general value of a resource to a PHP file. Is this a better option?

sentences:
How to change chance of spawn based on distance? I am trying to make a cellular automate cave but want to keep the middle empty.

How should I change the chance based on the distance from the middle?

I don't want to completely deny it just want a small enough chance to keep it almost empty.

sentences:
Process for developing psd images into animation I wrote a kids' picture book that I want to make into an iPad app and iPhone app.

(More of a story than a game, but same principles, I guess.)

Here's a sample page: https://img.skitch.com/20120108-bqusir4xt3hhxx5fufhh7pw4wy.jpg

(There are words on each page -- I've just scrubbed them out on the image for this example.)

All the images are in Photoshop.

I want to make an app of the book for iPads and other tablets.

For the app, I'd like to add a little animation on each page. Things like fish changing their expressions. Some interaction. Fish swimming on some pages, and other stuff.

I want to know who I should recruit to do the animation:

The illustrator who did the original images normally doesn't do animation.

Since that illustrator doesn't normally do animation, I guess I need to get an animator on board for the project -- what skills am I looking for in that person?

(Obviously they need to know how to make an animation, but what technology etc will they need to know?)

To draw the different frames for the animation, would I need to employ the same illustrator who did the original images, or would a good illustrator be able to do that, based on the images that already exist?

(The illustrator who did the original images is available, but I'd need to wait a while for her to be able to fit the job in.)

The images don't exist as vector files -- they are Photoshop bitmap. Is this an issue?

Thanks, Richard

sentences:
Using Graphics from my Frame's paint() gives cutting effect every call to repaint() Every frame the run() method of my thread calls the repaint() of the frame subclass, in this frame subclass I override the paint(Graphics) and since I want to have different screens from my game I pass the Graphics g parameter to an instance of the PlayScreen class where I do my drawing for that particular screen. The issue comes whenever the run() calls repaint() and the tile start to flash rendered on and off. I am starting to suspect that the issue comes from the order in which I set my repaint() and draw() calls.

GameObject(class with run method).

@Override
public void run() {
    isAlive = true;
 try{
     while(isAlive){
     Thread.sleep(17);
    screen.repaint();
     }
 }catch(Exception x){

 }

}

Screen class that extends Frame

@Override
public void paint(Graphics g) {
    playScreen.draw(g);

}

PlayScreen(where the tiles are rendered)

public void draw(Graphics g){
    for(ArrayList<Tile> tileArray: tiles){
        for(Tile tile : tileArray){
            g.drawImage(tile.getTile(), tile.getX(), tile.getY(), null);
        }
    }

}

sentences:
Detect which tile in a tile palette a player is colliding with I have a megaman-style platformer that I've been working on for a while now. I'd like to have my scene set up so that when a player interacts with certain tiles, it will have some sort of effect on the player.

This could easily be achieved with creating individual sprites for the aforementioned interactables, but I'd ideally like to be able to have a portion of my script handle it so that everything besides the player and enemies would be tilemaps.

For instance, I have a tile that would act as a treadmill that moves the player along in one direction. Another tile would be bouncy, and another would deal damage.

I have the game set up right now to detect when the player is touching a tile, but I have no way of being able to tell which tile the player is touching. Is there a way to be able to compare programmatically which tile from a tile palette my player's hitbox is currently touching?

sentences:
Platform Cannot move down when player collide buttom of platform Unity? In my unity game I've arrange different platform ,when my player collide with upper part of the platform so platform falling down but issue that when my player collide to platform buttom of part so platform falling down.

void OnCollisionEnter2D(Collision2D target)
{
        if (target.gameObject.tag == "Player") {
        gameObject.GetComponent<Rigidbody2D> ().isKinematic = false;
    }
 }

sentences:
Particle effect in sprite I want to create a particle effect when my player sprite collide with my star sprite. How can I add a particleSystem in the sprite and not in a image?
Also, I wish if it could wait for the animation for some miliseconds, and then remove the star sprite.

This is my code:

- (BOOL)ccPhysicsCollisionBegin:(CCPhysicsCollisionPair *)pair starCollision:
    (CCNode *)star playerCollision:(CCNode *)_player {
    NSLog(@"----------Colisao---------");

    //update score
    score += 1;
    [scorelabel setString: [NSString stringWithFormat:@"score: %d",score]];
    NSLog(@"score %d", score);

    CCParticleSystem *particleSystem = [[CCParticleSpiral alloc] initWithTotalParticles:1000];

    [self addChild:particleSystem];
    //[particleSystem release];
    //[particleSystem setTexture:[[CCTextureCache  sharedTextureCache] addImage:@"star.png"];

    //remove stars
    [star removeFromParent];
    return YES;
}

sentences:
AABB Collision Detection Confusion I am trying to understand and implement AABB collision to learn simple 2D game physics. I'm following a tutorial and its method is a bit different to other websites. It uses the center of the object and its "half-size" to determine collision. This is its code:

public bool Overlaps(AABB other)
{
    if ( Mathf.Abs(center.x - other.center.x) > halfSize.x + other.halfSize.x ) return false;
    if ( Mathf.Abs(center.y - other.center.y) > halfSize.y + other.halfSize.y ) return false;
    return true;
}

And this is the seemingly more popular option:

if (rect1.x < rect2.x + rect2.width &&
   rect1.x + rect1.width > rect2.x &&
   rect1.y < rect2.y + rect2.height &&
   rect1.y + rect1.height > rect2.y) {
    // collision detected!
}

Which one is more efficient? And for the first option, would I define the center and half-size like this:

AABB = new AABB(new Vector2(Width / 2, Height / 2), new Vector2(Width / 2, Height / 2));

Center and half-size method source: https://gamedevelopment.tutsplus.com/tutorials/basic-2d-platformer-physics-part-1--cms-25799

Position and width/height source: https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection

sentences:
Is it possible to build an app with Corona with only a PC, and expect it to reasonably run well on an iPhone? So I understand that Corona allows me to "write once," and deploy on both iPhone and Android. And I understand that I cannot get any iPhone app into the app store without having (at the moment of submission/distribution) an (Intel-based?) mac (physical hardware).

I assume that if I only own PC hardware, I will not be able to test-deploy my game to an iPhone, nor see how the performance might be on an iPhone; but given those limitations, can I expect my Corona app to work decently if it performs decently on the Windows SDK and iPhone versions?

sentences:
Extract a rotation matrix given a camera direction (vector) and a up vector for the camera? I am having some issues constructing a rotation matrix from a camera direction vector.

The Up vector is computed from the camera direction as such:

up = cross(cross(direc,(0,1,0)),direc)

How do i given the up vector and a camera direction vector compute the rotation vector, that tells the camera how it should be rotated such that it points toward my object?

sentences:
Flow effect to static water on a isometric city Hello everyone I want to give the idea that the river in my city is flowing but I am having an hard time to figure how.

Do you have any idea of what I should look into to?

sentences:
Only subtract velocity on one axis I'm really slow in uptaking this! I have a GameObject with a Rigidbody.  Now I add via AddForce a velocity to the y-axis. But after that, I want to lerp it to zero. But how? My problem is, that I use the velocity also for steering my GameObject

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

[RequireComponent(typeof(Rigidbody))]
public class PlayerController : MonoBehaviour {

[Header("Movement")]
[SerializeField] private float speed;
[SerializeField] private float steeringPower;
[SerializeField] private float jumpHeigt;

[Header("Physics")]
[SerializeField] private float gravity;

private Rigidbody rigid;

void Start () {
    rigid = GetComponent<Rigidbody> ();
}

void Update () {
    if (Input.GetKeyDown(KeyCode.UpArrow)) {
        rigid.AddForce (Vector3.up * jumpHeigt);
    } else if (Input.GetKeyDown(KeyCode.DownArrow)) {
        rigid.AddForce (Vector3.down * jumpHeigt);
    }
}

void FixedUpdate () {
    rigid.velocity = new Vector3 (Input.GetAxisRaw ("Horizontal") * steeringPower, rigid.velocity.y, speed);

    //lerp rigid.velocity.y to zero here
}
}

sentences:
Efficient Sprite Batching Am considering porting over from XNA to the Stage3D API's (Molehill).
So as a performance examination I've implemented sprite-batching, but the performance is not all that great, while with XNA i can easily draw up to 500 000 quads but with my Molehill implementation i can draw around a measly 1000 quads and while a rather dramatic performance difference was expected on the CPU side this is due to being GPU bound.
So currently the implementation is as follows.
set render states

let texture be null
let batchSize be arbitrary

for each sprite in queue
    if texture is not sprite texture
    or buffers are full

        upload vertex data to index buffer
        upload index data to vertex buffer

        bind texture
        draw triangles

        flush vertex data
        flush index data

    add sprite vertices to vertex data
    add sprite indices to index data
end

upload remaining vertex data to vertex buffer
upload remaining index data to index buffer
draw remaining triangles

flush data

The bottleneck is uploading the buffers, but as for a better implementation I'm hoping for a discussion here.
Cheers.
Revision:

One optimization that comes to mind is to persist the index buffer, since the indices are predictable and will always follow the same format. Am going to benchmark that now.

Caching the index buffer had no noticeable performance gains, so in an effort to try to understand where the bottleneck is, I ported it over to C#/XNA, ever so slightly slower than Microsoft's implementation but still has a GPU capacity over 500 times more than the Molehill implementation.
Is Molehill simply an extremely bad abstraction layer?

sentences:
Help finding bug in seperating axis theroem code My collision detection is inconsistent. I am testing between 2 rectangles. When they are un-rotated, it says they are intersecting way before they touch, but when I rotate one, it works properly. I do not understand why.
When rect1 is rotated 0 or 180 degrees it starts saying collision detected about one rect width apart, but when its rotated at a non 90 degree angle, it works properly.
        // storing rotated points in lists for easy looping to avoid duplicate code
        FixedList512<float2> points1 = new FixedList512<float2>();
        points1.Add( bl_r );
        points1.Add( br_r );
        points1.Add( tl_r );
        points1.Add( tr_r );

        FixedList512<float2> points2 = new FixedList512<float2>();
        points2.Add( bl_r2 );
        points2.Add( br_r2 );
        points2.Add( tl_r2 );
        points2.Add( tr_r2 );

        bool intersects = true;

        for ( int shape = 0; shape < 2; shape++ )
        {
            if ( shape == 1 )
            {
                var temp = new FixedList512<float2>();
                temp.Add( bl_r );
                temp.Add( br_r );
                temp.Add( tl_r );
                temp.Add( tr_r );

                points1 = points2;
                points2 = temp;
            }

            for ( int a = 0; a < points1.Length; a++ )
            {
                int b = ( a + 1 ) % points1.Length;
                float2 axisProjection = new float2( -( points1[ b ].y - points1[ a ].y ) , points1[ b ].x - points1[ a ].x ); // invert points for normal to line segement

                float minR1 = float.MaxValue;
                float maxR1 = -float.MaxValue;

                for ( int p = 0; p < points1.Length; p++ )
                {
                    float q = points1[ p ].x * axisProjection.x + points1[ p ].y * axisProjection.y; // dot product of current point and axis of projection
                    minR1 = math.min( minR1 , q );
                    maxR1 = math.max( maxR1 , q );
                }

                float minR2 = float.MaxValue;
                float maxR2 = -float.MaxValue;

                for ( int p = 0; p < points2.Length; p++ )
                {
                    float q = points2[ p ].x * axisProjection.x + points2[ p ].y * axisProjection.y; // dot product of current point and axis of projection
                    minR2 = math.min( minR2 , q );
                    maxR2 = math.max( maxR2 , q );
                }

                if ( !( maxR2 >= minR1 && maxR1 >= minR2 ) ) // break if points dont overlap as we dont have a collision
                {
                    intersects = false;
                    break;
                }
            }
        }

        if ( intersects )
        {
            Debug.Log( "Intersects" );
        }
```

sentences:
Obj Blender Export Recommendation for OpenGL C++ I have been modelling some objects inside blender, like a light bulb.
I finished the light bulb, and I got a question at the time of export it.

I want to export the light bulb in the wavefront format (.obj), but the light bulb is formed by different meshes, I mean, It's not joined in one mesh. If I export the obj that will be as different meshes inside the .obj

My final question is, for import it in the OpenGL C++ side, it's better to join all the meshes (vertexes) inside one or leave them as separated objects? There will not be any trouble on translating... resizing... etc, if they are not joined?

sentences:
Camera math: How to calculate the horizontal and vertical angle from the look at vector I'm using the PerspectiveCamera class in C#/WPF to implement an FPS style camera.

For that, I would need to offset the camera's horizontal and vertical angles every time the mouse is moved. The problem is that PerspectiveCamera doesn't store those angles and only provides a lookat vector.

So, is there a way to calculate those angles from the lookat vector ?

sentences:
Torque2D default t2dTileMap object When I start a blank project I have noticed that I get one t2dSceneGraph and one t2dTileMap (under the project tab). I selected the t2dTileMap and gave it a name 'tilemap'.

In my game.cs function startGame I added

%LayerCount = tilemap.getTileLayerCount();

...but when I execute the project and inspect the variable %LayerCount in Torsion I first of all get an error:

Unable to find object: 'tilemap' attempting to call function 'getTileLayerCount'

How do I access the default t2dTileMap?

sentences:
Displaying 2 textures on the same surface? I'm messing around with XNA in a very simple Minecraft-esque world I'm making and I'm wondering how I can do the "breaking the block" visuals in XNA.

If you're unfamiliar with the game, you begin interacting with the cube and based one what tool you're using, the block will take X amount of time to break. There's about 10 different stages of cracking that the cube will display before the cube breaks. I'm curious about how to display those 10 stages of cracking on top of the original skin of the block.

I know the game works using a Sprite sheet to color the blocks. This sprite sheet does not include every possible design at every possible stage of breaking the block, each stage is a different sprite with some transparency.

In short, how can I quickly and efficiently overlay a texture on a surface that already has a texture?

Do I have to combine them? If so, how?

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:
Monogame - Load SpriteFont using .spritefont file without using the Pipeline Tool There is a way to load a sprite-font without using the Monogame Pipeline tool?

I am creating a Game-Engine using Monogame, i cant use the Monogame Pipeline tool because the way that Game-Engine manage the Content Files is different, and it needs to read the source file, not the .xnb file that Monogame Pipeline tool create.

sentences:
Facet file that contains face coloring inside the file I'm looking for a few example facet file types that allow applying face materials in the same file.  At the moment I know of COLLADA (.dae) but I'm looking for others due to the difficulty on manually parsing and writing that I'm implementing.  Other requests I have are that the file is human readable, ie ASCII vs binary.  I've looked at Wavefront (.obj) formats but they require a secondary file for the face materials.  I've also looked into the PLY format but that one looks focused around vertex coloring vs face coloring.

Having an open and easy to understand format is greatly appreciated.

sentences:
OpenGL ES 2.0 basic camera issues I am having issues with the camera, I cant find how to invert the AXIS

Now

A point is 0,0,0
B point is 1,0,0
C point is 0,0,1

What I want is

A point    0,0,0
B point    0,0,1
C point    1,0,0

I cant find the way to do this, so if you can explain also why is this happening it will be great! (if you need more code ask for it)

Code:

final float eyeX = 2.0f;
    final float eyeY = 10f;
    final float eyeZ = 6.0f;

    final float lookX = 1.0f;
    final float lookY = 0.0f;
    final float lookZ = 6.0f;

    final float upX = 1.0f;
    final float upY = 0.0f;
    final float upZ = 0.0f;

    Matrix.setLookAtM(mViewMatrix, 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);

ViewPort

    GLES20.glViewport(0, 0, width, height);

    final float ratio = (float) width / height;
    final float left = -ratio;
    final float right = ratio;
    final float bottom = -1.0f;
    final float top = 1.0f;
    final float near = 1.0f;
    final float far = 25.0f;
    Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);

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:
How do you rotate a material 90 degrees in UDK? So, I have started checking out UDK since yesterday, and most of it is clear and understandable.

I'm trying to create a curved road. The idea was to use a brush (Curved Staircase) and set the steps to 0 so it would be flat. This all worked well and I made a static mesh of it. Now, the problem arrives when I add a material. It doesn't rotate the material the way I want it.

Here's the way I do the example above:

Create a brush:
Convert to Static Mesh
Add Static Mesh into the game:
Change material to "Asphalt"
Scale it a bit so you can notice the problem:

As you can see, the stripes aren't following 'the mesh' correctly. They have to rotate 90 degrees for them to appear correctly.

How can you do this?

sentences:
Viewport like Angry Bird in Corona Not sure if that's the right name for it, but I'm looking for a way to implement zooming in my game.

Essentially the game should zoom in on my character during the moving and shooting phase (its like Worms), but zoom out when the character has shot (preferably by following the shot, like Angry Birds does).

Can Corona/Lua do something like this?

sentences:
Cartesian Coordinates & Layout The way cartesian coordinations are presented and used is kinda confusing.

When working with 2D the vertical axis is Y, though when working with 3D the vertical axis is Z and Y becomes the "depth" axis.

Basically I'm thinking the correct way, and best way would be to use the layout of axis.

Though Blender (3D modelling program) and other program, a lot games, present the axis in the "weird order" (my opinion)

Also if you read on Wikipedia about cartesian coordinates, your are presented with that layout of axis.

Wikipedia Cartesian Coordinates

Is there any specific or logical reason for this "flip" of axis?

sentences:
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:
Pathfinding and clusters For an assignment, I am required to implement an A* algorithm in order to find the shortest path between two object using different heuristics

null, this effectively becomes Dijkstra
Euclidean distance
Clustering

So I have successfully implemented the A* algorithm and the first two heuristics and they work wonderfully. However the third heuristic I am having trouble with. According to the text

  The cluster heuristicworks by grouping nodes together in clusters. The nodes in a cluster represent
  some region of the level that is highly interconnected. Clustering can be done automatically using
  graph clustering algorithms that are beyond the scope of this book

  When the heuristic is called in the game, if the start and goal nodes are in the same cluster, then
  Euclidean distance (or some other fallback) is used to provide a result. Otherwise, the estimate is
  looked up in the table.

I'm not one to give up on a challenge so I would like to implement some automatic clustering technique. I am lazy and I really don't feel like manually clustering nodes, I want it to be automated. So I have been doing research on clustering and I've come across this technique: Markov Cluster Algorithm(MCL)

Are there any good methods besides the one presented? I have searched the IEEE database for clustering techniques but I am not entirely sure if those are valid for the scope of my assignment. I'm not looking for any code but I would surely appreciate any guidance on the matter.

Edit: I should clarify what is required in the assignment for clustering.

  For the Cluster heuristic consider the nodes in each room to contain a cluster, and each
  corridor to contain a cluster. Using Dijkstra’s algorithm, between each pair of clusters
  compute the shortest distance between any two nodes (one from each cluster). Use
  these results between pairs of clusters to create a lookup table.

Furthermore this is the requirements for the level. Each convex polygon represents an obstacle. If I had to guess, there are 7 clusters in total

sentences:
ASP.NET MVC & SQL Server vs. PHP & MySql I'm going to develop a strategy browser-based game with ASP.NET MVC and SQL Server.

However, as I explored the web to get some ideas and patterns from existing games, I found out that none of them developed by .NET tools.

So, it made a question for me that what's the reason behind this...:

1) Is there any big draw back for microsoft technologies in this area?

2) Why all of games in this field are developed with PHP & (maybe1?) MySql?

3) Is there any performance issue with above mentioned microsoft technologies in this area?

Thanks in advance

sentences:
Does Blender have a main menu? 1 - Does Blender have a main menu, and if so, how do I make it appear? This is what I'm looking at currently:

http://imgur.com/wbowyco

2 - Also, that text panel at the top, that is as large as I can make it. Is there any way to make it taller? Or change the panel layout...?

sentences: Unity how to set Off mesh link speed How can I set agent's speed on off mesh link? I want it to look like a jump, but now it looks like it was in slow motion.

sentences:
ArgumentNullException Parameter name: format I have made a simple game using Unity with Vuforia and exported for Android and iOS. It works fine on Android, but on iOS it crashed and gave the error:

ArgumentNullException: Argument cannot be null. Parameter name:
format at System.Type.GetTypeFromHandle (RuntimeTypeHandle handle) [0x00000] in :0
at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in :0
at System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in :0
at System.String.Format (System.String format, System.Object[] args) [0x00000] in :0
at UnityEngine.Debug.LogFormat (System.String format, System.Object[] args) [0x00000] in :0
at Vuforia.TrackerManager.InitTracker[T] () [0x00000] in :0
at Vuforia.TrackerManager.InitTracker[T] () [0x00000] in :0
at Vuforia.TrackerManager.InitTracker[T] () [0x00000] in :0

  (Filename: currently not available on il2cpp Line: -1)

sentences:
In HLSL pixel shader , why is SV_POSITION different to other semantics? In my HLSL pixel shader, SV_POSITION seems to have different values to any other semantic I use. I don't understand why this is. Can you please explain it?

For example, I am using a triangle with the following coordinates:

(0.0f, 0.5f)
(0.5f, -0.5f)
(-0.5f, -0.5f)

The w and z values are 0 and 1, respectively.

This is the pixel shader.

struct VS_IN
{
    float4 pos : POSITION;
};

struct PS_IN
{
    float4 pos : SV_POSITION;
    float4 k : LOLIMASEMANTIC;
};

PS_IN VS( VS_IN input )
{
    PS_IN output = (PS_IN)0;
    output.pos = input.pos;
    output.k = input.pos;
    return output;
}

float4 PS( PS_IN input ) : SV_Target
{
    // screenshot 1
    return input.pos;

    // screenshot 2
    return input.k;
}

technique10 Render
{
    pass P0
    {
        SetGeometryShader( 0 );
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetPixelShader( CompileShader( ps_4_0, PS() ) );
    }
}

When I use the first statement (result is first screenshot), the one that uses the SV_POSITION semantic, the result is completely unexpected and is yellow, whereas using any other semantic will produce the expected result. Why is this?

sentences:
Tangent basis calculation problem I have the problem with seams with calculating a tangent basis in my application.
I'm using a seems to be right algorithm, but it gives wrong result on the seams. What am I doing wrong? Is there a problem with an algorithm, or with the model? The designer says that our models with our normal maps are rendered correctly in Xoliul Shader Plugin in 3Ds Max, so there should be a way to calculate correct tangent basis programmatically.

Here's an example of the problem I'm talking about.

 Steps, I've already taken:
- Tried different algorithm (from Gamasutra, I can't post the link because I don't have enough reputation yet). I got wrong, much worse, results;
- Tried to average basis vectors for vertexes are used in multiple faces;
- Tried to average basis vectors for vertexes that have same world coordinates (this would be obviously wrong solution, but I've tried it anyway).

sentences:
Calculate bike heading from front wheel heading and velocity I have a simple top down bike game that I'm trying to add steering to. I would like to know how I use the heading of the front wheel to determine the heading and velocity of the bike.

void Update ()
{
    //Get input from user Vertical: 0 to 1, Horizontal -1 to 1
    float forwardInput = Input.GetAxis("Vertical");
    float sidewaysInput = Input.GetAxis("Horizontal") * m_steeringAmount;

    // Turn front wheel
    m_frontWheelTransform.localEulerAngles = new Vector3(0, sidewaysInput, 90);

    // get speed and drag
    float   speed           = m_velocity.magnitude;
    Vector3 forwardDrag     = -m_forwardDragConstant * m_velocity * speed;

    // calculate acceleration
    float engineForce       = forwardInput * m_enginePower;
    Vector3 forwardTraction = transform.forward * engineForce;
    Vector3 forwrdForce     = forwardTraction + forwardDrag;
    Vector3 acceleration    = forwrdForce / m_mass;

    // update velocity and position
    m_velocity += acceleration * Time.deltaTime;
    transform.localPosition += m_velocity * Time.deltaTime;
}

I have tried to apply the bike velocity to the front and rear wheel and use the difference of there positions to determine the bike heading, but the forward drag make it confusing.

Edit based on madshogo comment

sentences:
XNA `tex2Dlod` always returns transparent black I want to sample a texture in a vertex shader, so at first I just tried using

float2 texcoords = ...;
color = tex2D(texture, texcoords);

But apparently I cannot use tex2D in a vertex shader, and must use tex2Dlod. So then I changed the above code to

color = tex2Dlod(texture, float4(texcoords, 0, 0));

But now color is always float4(0, 0, 0, 0) (i.e. transparent black).

Why is this, and how can I fix it?

EDIT: I know for a fact that the texture does not contain just transparent black pixels.

sentences:
testPoint not working - libgdx I'm making a game like angry birds with LibGDX and box2d in which I want to drag a ball (instead of the bird) back before releasing it.

I deploy with testPoint function: when I touch down the screen, I check if the point is within the body of the ball or not but testPoint function never works exactly. Here's what I'm trying thanks so much:

public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    for(Fixture fixture:bird.getBody().getFixtureList()) {
        if(fixture.testPoint(screenX/100, (mapHeight-screenY)/100)) { //100 is scaled parameter
             draggedBird = true;
             return true;
         }
    }
    return false;
}

sentences:
Should I slow down my animation with co-routines or update the animation state? I want to

gradually stop the car animation as it collides with another car
gradually speed up the car animation as it exits the collider

I have two ways to achieve this.

Update
Co-routine

For co-routine I used this piece of code:

IEnumerator IncreaseSpeedGradually1(AnimationControlSpeed lastGOHitScript)
{
    //stop if decrease speed in progress
    StopCoroutine("DecreaseSpeedGradually");
    float decrementValue = ((lastHitVehicleSpeed / 2) * 2);
    while (lastGOHitScript.Speed <= lastHitVehicleSpeed)
    {
        lastGOHitScript.Speed += decrementValue * Time.deltaTime;
        yield return 0;
    }
    //setting speed to the last speed
    lastGOHitScript.Speed = lastGOHitScript.iniSpeeed;
}

and for the update-based approach I just added this criteria to the method:

if (carAnimState == carAnimationState.starting)
{
    carAnimState = carAnimationState.running;
}

if (carAnimState == carAnimationState.stoping)
{

    carAnimState = carAnimationState.running;
}

These are the two ways I thought about using. I wanted to ask which is right way to do this job? To slow down animation speed and hence get my objective? I guess co-routines can be problematic later in my game.
Are there performance concerns for using one of the approaches?

sentences:
Extending ModelProcessor How can one extend a model processor inside Windows Forms. In a normal XNA game you would simply create a new class like so(I think...):

[ContentProcessor]
public class ExtendedModelProcessor : ModelProcessor
{
    protected override ModelContent Process(NodeContent input,
        ContentProcessorContext context)
    {
        ModelContent m = base.Process(input,context)
        //my own code
    }
}

How can I duplicate this inside Windows Forms project, I am working on a project from microsoft site, "WinFormsContentLoading sample". I tried creating a class like above, but didnt work, then I tried to change the processor on contentBuilder.Add(...,"ExtendedModelProcessor"). And I also tried creating a new .dll ContentExtensionLibrary and then adding it inside ContentBuilder class, under:

static string[] pipelineAssemblies =
{
    "Microsoft.Xna.Framework.Content.Pipeline.FBXImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.XImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.TextureImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.EffectImporter" + xnaVersion,
    Application.StartupPath + "\\myDll.dll"
};

And adding the .dll to the same folder as the program. But nothing worked. How can I create an extension for ModelProcessor inside Windows Forms?

Thanks

sentences:
How can I do something only after an animation has finished? I'm making this 2D platform based game. Basically what I want is when the player walks into spikes (which have a "deadly" tag") it displays the animation that has the parameter of animate with the value of 3 and after that the player gets destroyed. So my question is:

How do I build a timer or something so that the object only gets destroyed after the animation is played (with no looping)?

This is the code I'm using now:

void OnTriggerEnter2D(Collider2D target) {
    if (target.gameObject.tag == "Deadly") {
        Die();
    }
}

void Die() {
    animator.SetInteger ("AnimState", 3);
    Destroy (gameObject);
}

sentences:
XNA GameTime before first Update Using XNA, is it possible to access the GameTime object before Update is called for the first time?

Can it be used in the game constructor, Initialize or LoadContent methods?

sentences:
How can I determine how widespread support of OpenGL ES 3 is? I am developing new app in OpenGL which should run on iOS and Android devices.
I'd like to use OpenGL ES 3. For iOS that's not a problem, since any iPhone newer than the 5 has GLES 3.

But I am not sure how wide-spread GLES 3 is in the Android world or if all new devices support it. How can I determine how much support exists for GLES 3 so I can determine if I should use it or fall back to an older version?

sentences:
How can I avoid instantiating multiple instances of a RigidBody? I could use a little help.

I've a state machine for an NPC that does a melee attack. The problem I'm running into is that the current code instantiates multiple instances when I only need one per cycle.

I could use some ideas.

This is the chunk of code I'm working with:

public void ChaseToAttack()
{
    _navMeshAgent.speed = 3.5f;//slow down the navAgent

    float playerDistance = Vector3.Distance(chaseTarget.position, transform.position);
    //stop navMeshAgent to begin attack sequence
    if (playerDistance <= stopAtDistance)
    {
        /// ensure enemy is always looking at player
        enemyToTarget = ((chaseTarget.position + offset) - eyes.transform.position);
        if(Physics.Raycast(eyes.position, enemyToTarget, out _hit, sightRange) && _hit.collider.CompareTag("Player"))
        {
            _navMeshAgent.Stop();
            currentState = _attackState;
            //StartCoroutine(FistTimer());
            PunchCycle();
        }
        /// ensure the enemy isn't hitting air & will always look for the player
        else
        {
            transform.Rotate(chaseTarget.position, searchTurnSpeed * Time.deltaTime, 0);
        }
        /// end look & atttack player block
    }
}

void PunchCycle()
{
    StartCoroutine(AttackCycle());
}

void PunchClone()
{
    clone = Instantiate(pfbPunch, transform.position, transform.rotation) as Rigidbody;
    clone.transform.Translate(0,1f,0);
    clone.velocity = transform.TransformDirection(0.0f,0.0f,0.125f * punchDistance);
}

IEnumerator AttackCycle()
{
    //move animation here
    AnimPunch();
    PunchClone();
    yield return new WaitForSeconds(4f);//fistTimer
    BeAlert();

}

Thanks in advance...

EDIT:

Changed the code so it would only instantiate once- but now, it will only instantiate only once even though it's still in the attack sequence.

    public void ChaseToAttack()
{
    _navMeshAgent.speed = 3.5f;//slow down the navAgent

    float playerDistance = Vector3.Distance(chaseTarget.position, transform.position);
    //stop navMeshAgent to begin attack sequence
    if (playerDistance <= stopAtDistance)
    {
        /// ensure enemy is always looking at player
        enemyToTarget = ((chaseTarget.position + offset) - eyes.transform.position);
        if(Physics.Raycast(eyes.position, enemyToTarget, out _hit, sightRange) && _hit.collider.CompareTag("Player"))
        {
            _navMeshAgent.Stop();
            currentState = _attackState;
            StartCoroutine(AttackCycle());
        }
        /// ensure the enemy isn't hitting air & will always look for the player
        else
        {
            transform.Rotate(chaseTarget.position, searchTurnSpeed * Time.deltaTime, 0);
        }
        /// end look & atttack player block
    }
}
void PunchClone()
{
    if(!didClone)
    {
        clone = Instantiate(pfbPunch, transform.position, transform.rotation) as Rigidbody;
        clone.transform.Translate(0,1f,0);
        clone.velocity = transform.TransformDirection(0.0f,0.0f,0.125f * punchDistance);
    }
    didClone = true;
}
IEnumerator AttackCycle()
{
    //move animation here
    AnimPunch();
    yield return new WaitForSeconds(0.75f);//fistTimer
    PunchClone();
}

sentences:
Wander steering behaviour in 3D I'm trying to implement the Wander Steering Behaviour but getting strange result (see .gif). What am i doing wrong? I want to move a sphere in a random direction.

I read this article Understanding Steering Behaviors: Wander

using UnityEngine;

public class UnitWander : MonoBehaviour
{
    public const float CircleDistance = 1f;
    public const float CircleRadius = 0.1f;
    public const float AngleChange = 50f;

    public float Mass = 1;
    public float MaxSpeed = 1;
    public float MaxForce = 1;

    private Vector3 velocity = Vector3.forward;
    private float wanderAngle;

    private void Update()
    {
        var steering = GetWanderForce();
        steering = Vector3.ClampMagnitude(steering, MaxForce);
        steering /= Mass;

        velocity = Vector3.ClampMagnitude(velocity + steering, MaxSpeed);
        transform.position += velocity;
        transform.forward = velocity;
    }

    private Vector3 GetWanderForce()
    {
        var circleCenter = velocity.normalized * CircleDistance;

        var displacement = transform.right * Mathf.Cos(wanderAngle * Mathf.Deg2Rad) * CircleRadius;
        displacement += transform.up * Mathf.Sin(wanderAngle * Mathf.Deg2Rad) * CircleRadius;

        wanderAngle += (Random.value * AngleChange) - (AngleChange * 0.5f);

        var wanderForce = circleCenter + displacement;
        return wanderForce;
    }
}

sentences:
Using a Vertex Buffer and DrawUserIndexedPrimitives? Let's say I have a large but static world and only a single moving object on said world.

To increase performance I wish to use a vertex and index buffer for the static part of the world.

I set them up and they work fine however if I throw in another draw call to DrawUserIndexedPrimitives (to draw my one single moving object) after the call to DrawIndexedPrimitives, it will error out saying a valid vertex buffer must be set.

I can only assume the DrawUserIndexedPrimitive call destroyed/replaced the vertex buffer I set. In order to get around this I must call device.SetVertexBuffer(vertexBuffer) every frame. Something tells me that isn't correct as that kind of defeats the point of a buffer?

To shed some light, the large vertex buffer is the final merged mesh of many repeated cubes (think Minecraft) which I manually create to reduce the amount of vertices/indexes needed (for example two connected cubes become one cuboid, the connecting faces are cut out), and also the amount of matrix translations (as it would suck to do one per cube). The moving objects would be other items in the world which are dynamic and not fixed to the block grid, so things like the NPCs who move constantly.

How do I go about handling the large static world but also allowing objects to freely move about?

sentences:
Can't import shaders/textures to Godot from Blender 2.8 I'm using this shader for my models and then i import them like this
This is the original model in blender:

the result in godot:

I think i might have missed some step but not sure of which one, i followed the tutorial video on how to import and other similar guides but the results is the same. Any ideas of what i'm doing wrong?
Looks like my model not importing shader and textures cor

sentences:
What should I wear to a job interview with a game development company? Many game development companies are less formal in terms of workplace attire than other types of software development houses. For example, I know that one place at which I will be interviewing soon has a predominant workplace culture of jeans and polos or t-shirts.

Should I wear a suit? Shirt and tie? Shirt and sport jacket, with or without tie? I want to show that I'm serious about the job, but that I understand the culture, too.

sentences:
Thick Ray interaction with AABB I would like to intersect a thick ray (actually a cylinder) with an AABB.
The current code to perform intersection with the ray is the following.

template <class RealT>
bool CAABB<RealT>::Pick(const CPoint3T & base, const CVector3T & dir) const
{
    // SLAB based optimized ray/AABB intersection routine
    // Idea taken from http://ompf.org/ray/

    RealT l1 = (_minPnt.x - base.x) / dir.x;
    RealT l2 = (_maxPnt.x - base.x) / dir.x;
    RealT lmin = minT( l1, l2 );
    RealT lmax = maxT( l1, l2 );

    l1 = (_minPnt.y - base.y) / dir.y;
    l2 = (_maxPnt.y - base.y) / dir.y;
    lmin = maxT( minT( l1, l2 ), lmin );
    lmax = minT( maxT( l1, l2 ), lmax );

    l1 = (_minPnt.z - base.z) / dir.z;
    l2 = (_maxPnt.z - base.z) / dir.z;
    lmin = maxT( minT( l1, l2 ), lmin );
    lmax = minT( maxT( l1, l2 ), lmax );

    if( (lmax >= 0.0f) & (lmax >= lmin) )
    {
        // Consider length
        const CVector3T rayDest = base + dir;
        CPoint3T rayMins( minT( rayDest.x, base.x), minT( rayDest.y, base.y ), minT( rayDest.z, base.z ) );
        CPoint3T rayMaxs( maxT( rayDest.x, base.x), maxT( rayDest.y, base.y ), maxT( rayDest.z, base.z ) );
        return
            (rayMins.x < _maxPnt.x) && (rayMaxs.x > _minPnt.x) &&
            (rayMins.y < _maxPnt.y) && (rayMaxs.y > _minPnt.y) &&
            (rayMins.z < _maxPnt.z) && (rayMaxs.z > _minPnt.z);
    }
    else
        return false;
}

I would like to write a routine that takes an additional parameter for ray_thickness (diameter of the cylinder) and compute the intersection.

sentences:
shooting in the direction of the mouse My game is a 2D, top-down game where you aim with the mouse and the gun follows it. I'm trying to get the bullet to go in the direction of where the mouse is. The code will be a component of the bullet prefab.
here my code:

public class BulletBehavior : MonoBehaviour {

public float speed;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    GetComponent<Rigidbody2D>().velocity = new Vector2(speed, GetComponent<Rigidbody2D>().velocity.y);
}

private void OnTriggerEnter2D(Collider2D collision)
{
    Destroy(gameObject);
}

}

sentences:
What is the proper way to maintain the angle of a gun mounted on a car? So I am making a simple game. I want to put a gun on top of a car. I want to be able to control the angle of the gun. Basically it can go forward all the way so that it is parallel to the ground facing the direction the car is moving or it can point behind the car and any of the angles in between these positions.

I have something like the following right now but its not really working. Is there an better way to do this that I am not seeing?

#This will place the car
glPushMatrix()
glTranslatef(self.position.x,1.5,self.position.z)
glRotated(self.rotation, 0.0, 1.0, 0.0)
glScaled(0.5, 0.5, 0.5)
glCallList(self.model.gl_list)
glPopMatrix()

#This will place the gun on top
glPushMatrix()
glTranslatef(self.position.x,2.5,self.position.z)
glRotated(self.tube_angle, self.direction.z, 0.0, self.direction.x)
print self.direction.z
glRotated(45, self.position.z, 0.0, self.position.x)
glScaled(1.0, 0.5, 1.0)
glCallList(self.tube.gl_list)
glPopMatrix()

This almost works. It moves the gun up and down. But when the car moves around, the angle of the gun changes. Not what I want.

sentences:
How to optimize collisions I'm building a 2D MORPG using JavaScript, Node JS and socket.io

To prevent cheating, I have to run all collisions for all players on my server.

I'm currently doing fairly simple square collisions like this:

  for (var i = 1 ; i < collidables.length ; i++) {
    if (y < collidables[i].y + collidables[i].z &&
        x < collidables[i].x + collidables[i].z &&
        x + z > collidables[i].x &&
        y + z > collidables[i].y) {
          // Handle collision
    }
  }

When a player collides with a wall I halve their speed and bounce them back.
This is not working optimally, but it's fine for now.

The same logic is used to check bullet collision and possibly collision with monsters in the future.

I'm currently using 3 different loops for the follwing:

Player vs Terrain collisions
Bullet vs Terrain collisions
Bullet vs Monster collisions

Since all of them have slightly different logic.

Should I put them all in the same loop or is using multiple loops fine? I feel like using multiple loops will slow down my server a lot once there will be some more terrain / players / monsters.

I chose square collisions because I think they are a lot faster than any other type of collision checking, and my game will have a LOT of collision checking.

I think I will allow between 50-100 players on a single server, with most likely hundreds of monsters and thousands of bullets flying around.

There will also be a rather big map that has to stay loaded on the server. But since the server doesn't actually have to draw anything this should be fine?
Client-side the map is split up into smaller parts and only loads the parts near the player.

My game is working fine for now, but there's no real way to test with 50 players until people actually start playing.

I'm afraid I will find out way too late that my collision checking is taking up way too much server memory and/or cpu.

How can I improve the efficiency of my collision checks?

...

Here's a preview of my game in pre-alpha, it should make my question less abstract.

http://185.115.218.199:3000/

If I need to post any more info / code, please let me know and I will do so!

I'm currently running this game on a very small test-server with 512MB RAM and 1 VCPU (can't find the specifications)
This is scalable to up to 16GB RAM and 8 VCPU's and probably beyond that.

sentences:
MonoGame - correct overloads for SpriteBatch.Draw flipping horizontally I want to flip my sprite horizontally while drawing and I can't figure out how to use the correct parameters without either an error or a warning about the method being obsolete.

This is what I assume it would be:

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, Color.White,
SpriteEffects.FlipHorizontally);

Except it comes up for errors for the color (cannot convert from color to rectangle) and the SpriteEffects bit (cannot convert from sprite effects to rectangle).

What is the correct way to lay out these arguments?

P.S: When I provide all the default values (says it's obsolete):

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, null, null, null, 0f, null,
Color.White, SpriteEffects.FlipHorizontally);

sentences: 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:
How to include compiled GameMonkey script in final game release instead of script source? I use GameMonkey to script the game play and use the script from my C\C++ host game.
I've got it working the script with my engine.
But I have a question. In these engines like Torque, Unreal, Unity, etc. when you finally build the game, all the scripts are also compiled and you don't need to ship all the script source.

How do I do that?
Right now my engine needs GameMonkey source script to process the game logic.

Thanks

sentences:
Should chunks be procedurally generated client-side or server-side? I'm developing a game with a friend that involves a procedurally generated map. My question is... Should the client generate the chunks, or should the client make a request to the server, and the server responds with the procedurally generated chunks? I can think of some advantages to both sides.

If it is generated client-side:

there will be a whole lot less load on the server
perhaps some game performance improvements too?

If it is generated server-side:

I can implement anti-cheating algorithms a whole lot more easily and efficiently
chunks can be "dynamically modified" by the server. Meaning the server can modify chunks for the clients before sending them if needed.

Another option would be for them to work together. The client would generate the chunks on-the-go, but would make a request to the server for modified tiles. I still can't implement the anti-cheating algorithms in this method though. But the advantages to this method are:

not much load on the server
server can dynamically modify chunks
moderate game performance

What is the best option, if any? And what do people usually do? Are there any advantages to any of these methods I'm missing?

EDIT: I know Minecraft chose the server-side method. I wonder what their reasons were?

sentences:
Model colors look much better in blender than Unity (LWRP), how to fix bad colors in Unity LWRP? I made some models in blender 2.8:

After importing them to Unity, they look much worse:

Still the same material as in blender, I use the LWRP and have had nothing but issues with it, the lack of AO being one. Is there something I'm missing because it should not look this much worse in the Game Engine?

sentences:
Slide effect in voxel collisions I'm making a voxel engine, and I'm trying to figure out the right way to make efficient collisions with a slide response (making the player slide against the wall).

Currently my collisions are pretty simple : if, after update, the player bounding box collides with the voxel world, then we just cancel the collision.

I have seen this answer on SO, but I don't understand what the answerer means here. Since a voxel is a single unit, how can I compute its normal ? Should I map the 3x3x3 block surrounding the voxel to a precomputed normal ?

  Take the unit surface normal of the colliding voxel (pointing outward).

sentences:
What is the proper strategy to manage vertex buffers? I have created a large variety of shaders for my game engine for different use cases. The vertex input for the shaders depend on what I want to do with them. For example, if I want to just render the wireframe of a mesh, I do not need texture coordinates, normals, etc. because I just need basic vertex information. However, when I render animated meshes (I use Skinned Animation), then I need additional information like joint link weights for each vertex.
My question is: What is the best way to manage Vertex Buffers? Do I create a Vertex Buffers for each use case when I create the model and store them for later use, i.e. I select at run-time which of the stored Vertex Buffers to use for rendering? Do I create the Vertex Buffer I need at run-time in each render cycle? What is the best way to do it?
I am using DirectX 11 and C# (using SharpDX as wrapper).

sentences:
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:
Rotate bone on 1 axis to look at another object - Unity 3D I'm new to game development and I'm trying to create a basic 3D Tower Defence game as my first project. I've created a basic turret in Blender and I'm now trying to rotate 2 different bones to make the turret follow the enemy. The first bone (which I have working) rotates the turret to face the direction of the enemy. The second which I can't get right needs to rotate the gun at the top of the turret to look down at the enemy. I need it to keep facing the same direction as the rest of the turret and don't want it to tilt to either side. So it needs to move on 1 axis only.

I have tried various things, including examples from the Internet but I can't figure it out. So far I've managed to get it to look down at its base, up at the sky and spin like a wheel. Basically everything except where it's supposed to be looking.

Here is the code I have at the moment:

if (enemiesInRange.Count > 0)
    {
        //Rotate Platform //#### This section works fine
        Transform platform = transform.root.Find("Armature/BaseBone/PlatformBone");

        Quaternion targetRotation; //Final rotation (I.e. facing the enemy)

        Vector3 turretPosition = platform.position; //Store the turrets current position
        turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

        Vector3 targetPosition = enemyManager.activeEnemies[enemiesInRange[0]].transform.position;

        targetRotation = Quaternion.LookRotation(targetPosition - turretPosition);

        float rotateSpeed = 2.0f * Time.deltaTime;
        platform.transform.rotation = Quaternion.Lerp(platform.transform.rotation, targetRotation, rotateSpeed);

        //Rotate GunBox //####TO DO: This part is not working
        Transform gunBox = transform.root.FindChild("Armature/BaseBone/PlatformBone/LowerArmBone/UpperArmBone/GunBoxBone");
        Vector3 gunBoxPosition = gunBox.position;

        float angle = Vector3.Angle(gunBoxPosition, targetPosition);

        gunBox.RotateAround(gunBox.position, Vector3.left, angle);

        Debug.Log(angle);

    }

Here's a picture of the turret to give you an idea what I'm working with. You can see in the screenshot that the bone's default X rotation is roughly -50.

Enemies walk through the trench around the turret. The PlatformBone rotates everything from the silver platform upwards.

I also don't understand why the line below makes the turret rotate instead of tilting it. I would expect to rotate the turret around the Y axis to keep it flat on the floor and face another direction. Yet I seem to have to do the opposite (If I select the PlatformBone its Y axis is facing up as expected):

turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

sentences: Unity3d memory management I am baking animation to draw a huge amount of crowd in unity3d. I am storing mesh of each frame of skinned mesh in the list and just iterating over it. I can't use the compute shader as I want to target low-end devices too. But now I am facing memory issues as mesh consumes over 1.5gb of memory. Is there any way I can free memory consumes by mesh?

sentences:
How can I rumble/vibrate my controller with libGDX? The com.badlogic.gdx.controllers.Controllers API only supports getting the input data (which works fine).

Is there a way to make my controller rumble/vibrate, possibly using some other classes?

I tried using the org.lwjgl.input.Controllers class, which supports this, but the controllers don't get indexed there and I can not access them.

sentences:
How to make my sprite jump in pygame? I wonder how to make a sprite jump in pygame! Can anybody explain if possible?
Thank you!

sentences:
Shape Centers as Vectors: Local space or World space? Given a shape (any shape) in a 2D world where all positions, locations, and centers are two dimensional vectors, should the shape's center be described in local space or world space?

EXAMPLE:

World Space center of a Rectangle: Position: (100, 100); Dimensions: (200, 200); Center: (200, 200);

Local Space center of a Rectangle: Position: (200, 200); Dimensions: (100, 200); Center: (50, 100);

World Space center of a Circle: Position: (100, 100); Dimensions: (50, 50) (diameter); Center: (100, 100);

Local Space center of a Circle: Position: (50, 50); Dimensions: (200, 200); Center: (0, 0);

sentences:
Seams between tiled textured cubes I've created a textured cube in Blender, which I have uv-mapped like this:

The tiles are 256x256, and I've mapped the coordinates exactly at the edges (e.g. x: 256, y: 512). I then export my model as an fbx-file to Unity. In Unity, if I put many cubes adjacent to each other, seams appear between the cubes, like this:

I think I understand why this happens, because the uv-coordinates are exactly on the edges, and thus two faces sample from the same points along an edge.
I could solve this in some ways:

By making the uv-tiles smaller, but it would look ugly with patterns.
By adding some space between the tiles in the texture, and aligning the uv-coordinates to them.

My question: is there a better proper way for achieving this?

UPDATE:
So, about half a year later I still have issues with the seams. I've tried many things:

Start uv-coordinates at 256.5 instead of 256, and so on...
Turned of mipmapping.
Set wrap mode to clamp.
Set filter mode to point filter.
Edge padded the texture atlas with first 4px, 8px, 16px, 32px. But still bleeding occurs at certain angles. Also updated the uv-coordinates accordingly.
Changed my atlas to be of Power of 2 instead, i.e. 1024x1024 instead of 1024x768.
Set "Non Power of 2" in Unity to None so Unity doesn't rescale my texture to nearest Power of 2.
Set texture format to Automatic Truecolor instead of Compressed.

With 32px edge padding it actually gets a lot better, but it still isn't perfect, I guess I could go on and try even more padding, but my textures will get bigger and bigger.
I understand now that it is the mip-levels that are causing the bleeding. At far distances I don't think this is a problem, but I can see this occuring just about 5-7 units away from the player, if the player is looking down.
I believe there is something trivial about this that I'm missing. This is really a showstopper for me, forever grateful to the one who helps me solve this.
Thanks in advance!
This is how I have edge padded my texture (lines not visible on real texture), the problem does not only occur when the faces has such extremes distinct difference in colors as this one. It also occurs when the faces have patterns.

sentences:
Verlet collision with impulse preservation I came across this article, recently, that presented a technique for impulse preservation with position-based verlet integration. What was interesting was that the integration steps are seemingly done differently from typical position-based verlet schemes, as well as the ordering of the integration step and collision resolutions.

Specifically, the typical verlet position integrator is:

newPosition = 2 * position - oldPosition + acceleration * timeStepSquared
oldPosition = position
position = newPosition
DoConstraints()

Where the article has:

position += acceleration * timeStepSquared
DoConstraints()
newPosition = position * 2 - oldPosition
oldPosition = position
position = newPosition

Which ignoring constraints for a moment works out to be:

newPosition = 2*position - oldPosition + 2*acceleration*timeStepSquared
oldPosition = position + acceleration*timeStepSquared
position = newPosition

Which is different in a term of acceleration * timeStepSquared.  I haven't quite convinced myself that those terms cancel out through the iteration, as the prior acceleration * timeStepSquared term may not be the same as the current one.

Could someone explain the reasoning for this, and if indeed it makes sense?

sentences:
3D Huge mesh rendering I am writing a program, that as input, I have a huge (10^6 elements) 3d mesh (with hexagonal shaped elements), and I want to realtime render it, but not as real-time as a game. It just can show the scene and rotate, zoom and pan. The most important point is, I don't need any special lighting nor any shadows. Also, the objects to render are static, and they do not move. My object hasn't any textures.

I've read about ray tracing methods, but I don't know if there is any good libraries for this purpose, or I have to implement everything by myself.

Thanks a lot.

sentences:
Why can´t this boolean stop the sound from playing 60 times a second? The code:
local dontPlayMoreThanOnceDammit = false

function Behavior:Awake()
    local sound = CraftStudio.FindAsset( "motorbuson1" )
    self.mySoundInstance = sound:CreateInstance()
    self.mySoundVolume = 1.0
    self.mySoundInstance:SetLoop( true )
    self.mySoundInstance:SetVolume( 1.0 )
 end

function Behavior:Update()
    if dontPlayMoreThanOnceDammit == false and CraftStudio.Input.WasButtonJustPressed( "on" ) then
        self.mySoundVolume = 1.0
        self.mySoundInstance:Play()
        dontPlayMoreThanOnceDammit = true
    end
    if CraftStudio.Input.IsButtonDown( "off" ) then
        self.mySoundInstance:Stop()
        dontPlayMoreThanOnceDammit = false
    end
end

Error it gives:

sentences:
How should I define interaction modes in a strategic game? I am creating a typical strategic game that gamer can select, deploy and move the game characters (Human mostly) and move or create buildings on its isometric map.

These all are going to be done by gamers gestures obviously, So each time I am handling a tap, pan, swipe or pinch, it is important to know what was the gamer at the middle of or was doing so the new gesture can be handled.

Doing this, I created a global enumerated type including Idle,Select,PanMap and Place and defined a variable with name gameMode to control what the gamer is about to do. for example when the game starts it is valued "Idle" and when gamer touches a building or a character it will be selected only if the gameMode  is Idle and if so gameMode will be changed to Select so the handlePan() method can manage the new gesture and sees if the user is moving the map or a selected building for instant.

When the gamer selects a building and does a pan afterward, the game logic should update the gameMode. When the first touch point of the pan gesture is recieved by handlePan() function, the function will check it against the selected building(currentSelection) to see if the gamer is tended to move the building or it is just a simple map panning, by changing the gameMode to "Place" or "PanMap" and check which gameMode is the case while processing the rest of the touches so they can be handled correctly.

  As I have mentioned above, I have four game modes including idle, select, panmap(while something is selected), place (when gamer is moving something on the map)

Can anyone with strategic experience tell me is this kind of handling user interaction is the best way?

if yes do you think these modes are enough?

Can you tell me what was your modes in case you used this method?

I am using SpriteKit with xcode.

sentences:
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:
MonoGame game running slowly Through development I've been running my 2D game (Monogame 3.6) on my windows laptop, which has some crummy integrated graphics card and an i5. Now I try my game on my gaming PC, which has a GTX 970 and also an i5 (a slightly better one), and the game runs slow as hell.

I'm at a complete and total loss here. Here's what I've tried to speed up the game, and it's still hovering around maybe 15 FPS:

Reducing the game from 3 or 4 spritebatch blocks to a single one
Removing ALL shader uniform changes, so that it only sets up the shader uniforms once and never changes them
Commenting out 100% of particle rendering code.
Removing my extra render target that I used for post process fx.

After all of this, making it about as simple as a Hello World renderer, and it's still dog slow. I'm dumbfounded. Codetrack profiler says 80% of my cpu time is inside of a function called DoDraw which seems to be XNA framework code. So I'm sure it's not the update logic, or sheer number of things rendering, etc. The time anything is taking pales in comparison to DoDraw. The stack looks like this:

Tick
DoDraw
Present
PlatformPresent

But I don't really understand what it's doing and why it's taking so long. Any tips, knowledge of rendering quirks, profiling tips, etc, anything appreciated.

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: How to render depthmap image in 3d? I'm new to game development and XNA. I have this depthmap image and I want to render it in 3D, how do I do it, any tutorial or blog post would be helpful.

sentences:
Networking in a strategy, city management game I'm developing a city management mobile game with its' share of multiplayer elements (leaderboards, achievements, social interactions). It's built using Unity and GameSparks as a backend. I'm a little bit confused on how I should be implementing the networking.

At the end of every in-game month, the game should go through every business building, calculate the revenue (each building generates different amounts of money depending on the number of workers), then add this value to the player's funds. These funds can then be used to continue building more businesses and houses, which increase the population.

I have to save the states for the city (buildings, population, etc) and player (funds, premium currency, etc) in the cloud.

I'm afraid people will exploit the game (due to the leaderboards) if I entrust data with the client, and I feel it would be best to keep the system deterministic, but I'm not completely sure I'm doing the right thing. How would you solve the problem?

sentences:
What are the technologies used to create Metal Gear game? What are the technologies (programming languages and engines for example) used to create "Metal Gear : Snake Eater" and "Metal Gear : Guns of The Patriots"?

Is it usual to keep those things secret?

sentences:
Unity 5: Check if an object's collider contains the mouse click point I am building a 2D turn-based RPG battle scene with Unity 5. The enemies are represented as 2D sprites with box colliders. In my script, the relevant enemy class is defined as:

public class EnemyView : MonoBehaviour {

    public SpriteRenderer _renderer;
    public BoxCollider2D _collider;

    void Awake() {
        _renderer = gameObject.GetComponent<SpriteRenderer>();
        _collider = gameObject.GetComponent<BoxCollider2D> ();
    }
}

And I have the following code grouping the enemy sprites together:

public class MainGUIView : MonoBehaviour {
    public EnemyView[] _enemyViews;
}

When a player clicks on an enemy, I would like to know the index of that enemy within the _enemyViews array. I thought of implementing this within EnemyView class but that class has no information about its index, so I am thinking of implementing OnMouseDown() within MainGUIView where I could iterate through _enemyViews to find the one whose collider contains the mouse click point, but I don't know how to write the code. Anyone can point me to some useful code snippet?

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:
How to receive shadows on animated object In optimize way? I've been trying to add shadow to my flag that animated In my vertex shader but after adding shadow , my shadow is fixed and does not follow the animation of the flag.

for adding shadow I use below link:

  Diffuse has a fallback of vertex lit, which contains within it two passes; Shadow Caster and Shadow Receiver. These are the two passes that allow the shader to cast and receive shadows.
  http://polycount.com/discussion/131260/how-to-get-custom-shaders-to-recieve-shadows

my shader is here:

Shader "Custom/Flag" {
    Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Speed ("Speed", Range(0, 5.0)) = 1
        _Frequency ("Frequency", Range(0, 1.3)) = 1
        _Amplitude ("Amplitude", Range(0, 5.0)) = 1
    }
    SubShader {
        Tags { "RenderType"="Opaque" "LightMode"="ForwardBase"  }
        Cull off

        Pass {

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma multi_compile_fwdbase

            #include "UnityCG.cginc"
            #include "AutoLight.cginc"

            sampler2D _MainTex;
            float4 _MainTex_ST;

            struct v2f {
                float4 pos : SV_POSITION;
                float2 uv : TEXCOORD0;
                LIGHTING_COORDS(1, 2)
            };

            float _Speed;
            float _Frequency;
            float _Amplitude;

            v2f vert(appdata_base v)
            {
                v2f o;
                v.vertex.y +=  cos((v.vertex.x + _Time.y * _Speed) * _Frequency) * _Amplitude * (v.vertex.x - 5);
                o.pos = UnityObjectToClipPos(v.vertex);
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                TRANSFER_VERTEX_TO_FRAGMENT(o);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                return tex2D(_MainTex, i.uv);
            }

            ENDCG

        }
    }
    FallBack "VertexLit"
}

Finally I use "LightMode"="ShadowCaster" but this Tag prevents rendering my flag like this problem.A solution came to my mind that works correctly "using two pass for implementing shadows: 1.normal pass 2.ShadowCaster pass" but I think It's not optimize.

this is my solution as Pseudo Code:

   SubShader {
        Tags { "RenderType"="Opaque" }
        Cull off
        Pass {
            CGPROGRAM
            Shader "Custom/Flag" // normal Pass for animating flag
            ENDCG
        }

        Pass {
            Tags { "LightMode"="ShadowCaster" }

            CGPROGRAM
            Shader "Custom/Flag" //ShadowCaster Pass for recieving shadow
            ENDCG
        }
    }
    FallBack "VertexLit"
}

Flag shader.unitypackage

In short I finding a way for adding shadows for vertex animated objects In optimized way.

sentences:
Unity display message upon keypress? Hi I'm trying to get NGUI's HUDtext to display a set of text message one of which being "Try using WASD to move" and displaying "Well done!" upon input of any of the four keys. Unfortunately I'm not well versed in C# and am currently stuck and unsure how to implement this.

using UnityEngine;
using System.Collections;
using System;

//public KeyCode KeyCode.Alpha2;

public class Test : MonoBehaviour {

    public int seen = 123;
    public HUDText hudText;

    void Start() {

        StartCoroutine(MyCoroutine());
        //Debug.Log(KeyCode);
        Tutorial ();

    }

    void Tutorial() {

        while (true) {
            while (!Input.GetKeyDown(KeyCode.Return)) Debug.Log ("Hit return");
        }

    }

    IEnumerator MyCoroutine() {

        hudText.Add("Welcome", Color.white, 3f);
        yield return new WaitForSeconds(3);    //Wait one frame

        hudText.Add("This is System Defence", Color.white, 4f);
        yield return new WaitForSeconds(4);

        hudText.Add ("Try using WASD to move", Color.red, 3f);
        yield return new WaitForSeconds(3);

    }

}

I would appreciate it if someone could tell me how would I go about doing this.

sentences:
How to convert strict limit in position into gradual slow down? The player moves a spell object, the spell must stay withing a certain range of the player.  The spell is moved using a physics system and it has mass and velocity.  Currently when the spell goes out of range of the player it's being moved back into range, this has the effect stopping the spell abruptly at the edge.  I want to smooth out this abrupt stop so that it gradually slows down.  I tried to apply an easing function but because the time and distance change every frame I couldn't figure out the formula.

Is there some sort of physics or easing formula I can use to gradually slow down the spell before it gets to the edge of its range, while at the same time guaranteeing that it never leaves the range?

Additional Info:

The spells range is a circle.  I only care about the center of the spell object.  Movement forces are continually being applied to the spell.

sentences:
What are the legal considerations about making a game with a dynamic age restricted content? What I mean by this is - is it legal to make a game which asks (or proves) your age during install or on initial load, and then dynamically sets the content to the players age.
For example if the players is under-age then all swear word assets are replaced with there PG13 equivalents.
Or the same with blood and gore.

Does this make sense?
Also what are the communities opinions or feelings about this?
(note for locality I am referring to UK law but laws and opinions for any other country is encouraged!)

(ps i can't create tags)

sentences:
Why isn't my background drawing to the screen? Ok, So I have a game I have been working on for a few months now and I am now stumped beyond belief. My friend who has spent days working on this background gave it to me and I put it in my game. On the phone the background draws fine, on the PC the background draws fine but my tablet refuses to draw the background and I have no idea why. The game was pretty much built for tablet and I really need an answer because I want to release this to google play soon to make it worth while for the friends who put the effort into this game. Do any of you have any idea why this isn't working? The file for the background is pretty big is that the reason (2500x2500)?

Here is the code to the drawing method

    //Render Function When in Play Mode
private void renderPlayMode(){

    //Draw background
    background.render(mainBatch);

    foreground.render(mainBatch);

}

The background.render and the foreground.render are the two functions that cause the game to go black on the tablet. I really need an answer, please!

EDIT

Ok, so the code above is the code that screws up the tablet and makes the screen black. Because the foreground.render is the last thing that is drawn it makes the entire screen black and if I comment out that line the background.render just makes the entire background black and no drawing.

sentences:
Subsurface Scattering - Transmittance I have a question related to SSS and especially transmittance. I've looked at several papers about that topic, most of them from Jorge Jimenez, which are very interesting and, I admit, a bit hard for me.

Here is one of the papers : http://www.iryoku.com/translucency/

I have some difficulties to understand the way it works and the way it calculates the distance the light traveled through the object. I think that I understand the very big lines but I am also a bit confused as I am trying to integrate this into the Unity engine and I have some difficulties to match Unity engine available values such as the shadows maps, the shadows coords, etc... to make them fit the way they are used in the paper.

So here it is, I am a bit lost in the "in-between" and I hope that somebody might be able to help me.

Thanks a lot.

EDIT : added the shader code from referenced paper

float distance(float3 posW, float3 normalW, int i) {
  // Shrink the position to avoid artifacts on the silhouette:
  posW = posW - 0.005 * normalW;

  // Transform to light space:
  float4 posL = mul(float4(posW, 1.0), lights[i].viewproj);

  // Fetch depth from the shadow map:
  // (Depth from shadow maps is expected to be linear)
  float d1 = shwmaps[i].Sample(sampler, posL.xy / posL.w);
  float d2 = posL.z;

  // Calculate the difference:
  return abs(d1 - d2);
}

// This function can be precomputed for efficiency
float3 T(float s) {
  return float3(0.233, 0.455, 0.649) * exp(-s * s / 0.0064) +
         float3(0.1,   0.336, 0.344) * exp(-s * s / 0.0484) +
         float3(0.118, 0.198, 0.0)   * exp(-s * s / 0.187)  +
         float3(0.113, 0.007, 0.007) * exp(-s * s / 0.567)  +
         float3(0.358, 0.004, 0.0)   * exp(-s * s / 1.99)   +
         float3(0.078, 0.0,   0.0)   * exp(-s * s / 7.41);
}

// The following is done for each light 'i'.

// Calculate the distance traveled by the light inside of the object:
// ('strength' modulates the strength of the effect; 'normalW' is the vertex
//  normal)
float s = distance(posW, normalW, i) / strength;

// Estimate the irradiance on the back:
// ('lightW' is the regular light vector)
float irradiance = max(0.3 + dot(-normalW, lightW), 0.0);

// Calculate transmitted light:
// ('attenuation' and 'spot' are the usual spot light factors, as in regular
//  reflected light):
float3 transmittance = T(s) * lights[i].color *
                       attenuation * spot * albedo.rgb * irradiance;

// Add the contribution of this light:
color += transmittance + reflectance;

sentences:
Should I pass my resource manager to types that might need it, or make it global? Say I have this Cache<typename Resource> class template, which is a resource cache that contains an std::map<std::string, Resource>, mapping strings to resources.

I can many different kinds of resources: sounds, textures, geometry etc. So I need to have something like a container of all of these caches:

struct ResourceManager {
  Cache<Sound*> _soundCache;
  Cache<Mesh*> _meshCache;
  Cache<Texture2D> _textureCache;
};

A Mesh object might need to query Texture objects from the texture cache, so working with these caches is possible in two ways: Either pass a pointer to _textureCache to every Mesh object, perhaps via its constructor (this approach is pretty clumsy), or define a ResourceManager object globally, so every class can use its caches all the time.

Has this issue ever been brought up for discussion? How should I deal with it?

What do most engines do? Where do they store these caches? Is it viable to do something like this? :

~GameEngine.h~

...
#include "ResourceManager.h"

//global object
resourceManager g_resourceManager;

class GameEngine {
  ...
};

sentences:
Securing feasibility in procedurally generated endless runner I am currently in the concept phase for an endless runner I want to develop with libgdx in Java.

As I can not preassemble an infinite level, the generation of obstacles and power-ups needs to be "random" and during the game itself. In my last endless runner, I simply had randomness to determine the next obstacle type, as well as its position.

This time, however, I want to integrate two resources that play a major role and change the way I need to handle feasibility fundamentally.
One resource is some sort of an energy bar, which decreases over time, as well as due to collision with obstacles (possible to get over in the beginning, deadly as the game proceeds) and increases with the collection of power-ups.
The other resource is a coin-like entity, which you can collect during a run and which need to be present to a certain amount, in order to collect the energy-filling power-ups on collision.

I have a vague to solid idea of securing feasibility in terms of creating manageable obstacle-chains, but can't think of generation procedures, that ensure the possibility to collect enough power-ups while being provided the opportunity of collecting enough coins first. Furthermore, this procedure needs to increase the difficulty with the games duration.

I am not asking for code itself, but rather for adequate ways to approach my issue, such as dividing my endless runner in minilevels, that have some transition and are feasible on their own. Alternatively, experienced statements on which ways not to use and why are very welcome as well!

Feel free to ask further questions - Thanks in advance!

sentences: XNA Silverlight 5 3D Model Position I am use to XNA and starting to learn XNA for Silverlight 5. My Question is that in XNA when you create a Model and load it using content.load you are able to access the models Position, scale etc.. In Silverlight XNA these options are not available. It would be possible  to change the Models position using World Translate, but I need the models position for collision detectection using boundingSphere Any Advice??

sentences:
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:
crashing generating fire-balls(bullets) with Box2D I got crash, making fire-balls as bullets.

I guess I should not use   "private Array fireballs" in player class.
it seems like when I add one more fire as index of 1 into the list, the first index does not look working on destroying in for loop in player class.
it seems only destrying index of 0.

in playscreen class,

 public void handleInput(float dt){
       if (Gdx.input.isKeyJustPressed(Input.Keys.SPACE)){
            playerBlue.fire();
        }

in player class,

private Array<FireBall> fireballs;
public void update(float dt) {
  for (FireBall ball : fireballs) {
        ball.update(dt);
        if (ball.isDestroyed())
            fireballs.removeValue(ball, true);
    }

 }
public void fire() {
    fireballs.add(new FireBall(screen, b2body.getPosition().x, b2body.getPosition().y, Blue.runRightSide ? true : false));

}

in fire class,

public class FireBall extends Weapon {
private TextureRegion fireball;
private float rotate;
public FireBall(PlayScreen screen, float x, float y, boolean rightside) {
    super(screen, x, y, rightside);
    fireball = new TextureRegion(screen.getAtlas().findRegion("fireball"),0,0,40,40);
    setRegion(fireball);
    setBounds(getX(),getY(),getWidth()*2,getHeight()*2);

}

@Override
protected void defineWeapon() {
    BodyDef bdef = new BodyDef();
    bdef.position.set(rightside ? getX() + 12 / AlienAdvantrue.PPM : getX() - 12 / AlienAdvantrue.PPM, getY());
    bdef.type = BodyDef.BodyType.DynamicBody;
    if (!world.isLocked())
        body = world.createBody(bdef);//?
    FixtureDef fdef = new FixtureDef();
    CircleShape shape = new CircleShape();
    shape.setRadius(3 / AlienAdvantrue.PPM);
    fdef.filter.categoryBits = AlienAdvantrue.FIREBALL_BIT;
    fdef.filter.maskBits = AlienAdvantrue.GROUND_BIT
            |AlienAdvantrue.Enemy_Head_BIT
            |AlienAdvantrue.BRICK_BIT
            |AlienAdvantrue.COIN_BIT
            |AlienAdvantrue.Enemy_BIT;

    fdef.shape = shape;
    fdef.restitution = 1;
    fdef.friction = 0;
    body.setLinearVelocity(new Vector2(rightside ? 2 : -2, 2.5f));
    body.createFixture(fdef).setUserData(this);

}

public void update(float dt){
    stateTime += dt;
    rotate +=100; // flip faste// ?
    rotate(rotate);
    setPosition(body.getPosition().x - getWidth() / 2, body.getPosition().y - getHeight() / 2);

    if((stateTime > 3 || setToDestroy) && !destroyed) {
        world.destroyBody(body);
        destroyed = true;
        stateTime=0;
    }
    if(body.getLinearVelocity().y > 2f)
        body.setLinearVelocity(body.getLinearVelocity().x, 2f);
    if((rightside && body.getLinearVelocity().x < 0) || (!rightside && body.getLinearVelocity().x > 0))
        setToDestroy();
}

}

sentences:
Tweaking screen transitions not to fire every time in Unity I'm making a simple screen transition system for my game which consists of two states firing the right clips (one for the starting half od the transition animation, one for the ending one) and a condition between the end and start one which is set to true when user wants to change the level (so that the Start animation would fire in the previous animation and the End in the new one).

This is cool and all but poses two problems - firstly, the game starts with the End phase animation which looks a bit weird. Secondly, since the Restart button in the main game just reloads the level, it causes the End transition to fire every time too which looks weird and out of place.
How would I go about tweaking the Animator so that the End phase only runs when I actually change the level as opposed to when starting the game or reloading the current scene? Maybe there's some way to pass some kind of a parameter when loading a new scene that I'm not aware of? This way, I could just pass a flag like shouldFireEndAnimation so that it does not fire when the game just starts or a level restarts?

sentences: What is an OpenGL equivalent to ID3DXSprite? As a Direct3D developer I can use the ID3DXSprite class (in D3DX library) for drawing 2D graphics. What's the best way to implement this functionality in OpenGL?

sentences:
Access GLFW functions from DLL My game uses DLLs as mods. Players can write DLLs which can render, play audio, print to console, etc. This works fine, however when I try to access GLFW functions, they don't seem to work properly.
CustomMod.cpp (compiled to DLL)
void runDLLCode()
{
    std::cout << glfwGetKey(Game::getWindow(), GLFW_KEY_A);
}

Game.cpp (compiled to EXE)
void run()
{
    //Load DLL....

    std::cout << glfwGetKey(Game::getWindow(), GLFW_KEY_A); // Prints 1
    runDLLCode();                                           // Prints 0 (should print 1 since key is still down)
    std::cout << glfwGetKey(Game::getWindow(), GLFW_KEY_A); // Prints 1
}

Running std::this_thread::get_id() provides the same thread ID across both the DLL and exe.
The address of both Game::getWindow() is the same as well.
Is it possible to have all print 1 when the application is run? Or is it not possible to use GLFW functions across the DLL "wall"?

sentences:
How to enable/ disable GameObject I have child object with ParticleSystem component.
I want to have particles disabled until I press button.

I unchecked child object to make it disabled but when I press play it enables automatically(with no scripts attached). Then I made this script below (with .SetActive(false) part only) and it worked.

But then I needed to activate it somehow, which I did, but now when I press play, object is automatically enabled/ activated again.

Is there another way of doing this because I need it haha.

var particle1: GameObject;
var particle2: GameObject;
var particle3: GameObject;

public var triggered : boolean = false;

function OnTriggerEnter() { triggered= true; }
function OnTriggerExit()  { triggered= false;}

function Start()
{
    particle1.SetActive(false);
    particle2.SetActive(false);
    particle3.SetActive(false);
}

function Update()
{
    if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1))
        particle1.SetActive(true);
        particle2.SetActive(true);
        particle3.SetActive(true);
}

sentences:
Camera bounds grow along with the game scene editor in Unity I am extremely confused by the Unity editor. Look:

I have an image,

And I want my camera to fit it perfectly. I have achieved so by using a size property of 540:

Notice how the viewport rect has 1 width and 1 height. If you run this game in a Samsung Galaxy S5, the sprite will fit perfectly in your device.

Now, resize the game scene view a bit (drag the Unity window border outwards to make it grow). Let's make it bigger. Then this happens:

The camera "white bounds" grew bigger! And the sprite no longer fits perfectly in the Galaxy S5!

My question is, then: why did the camera's bounds grow along with the editor window, if the viewport rect property never changed (it is still at 1 width an 1 height)?

sentences:
Assign type to an entity in Entity-Component System (super entity - syntactic sugar) I have created ECS framework from scratch using C++.

Everything works fine, but I think my code is not so cute (at #1):-

class RocketComponent{
    Entity mainBodyGraphic;
    Entity topGraphic ;
};
//inside some system (script-like)
void createRocket(){
    Entity mainBodyGraphic = graphicFactory->createCylinder();
    Entity topGraphic = graphicFactory->createCone();
    //^ internally create entity (with graphic component and others),
    //         then attach together
    Pointer<RocketComponent> rocket  = create<RocketComponent>();
    rocket->mainBodyGraphic = mainBodyGraphic;
    rocket->topGraphic = topGraphic;
    //.... other logics ....
}

void showDamage(Entity rocket){
     Pointer<RocketComponent> rocket  = rocket->get<RocketComponent>();
     systemGraphic->setColor(rocket->mainBodyGraphic,RED);   //#1
}

#1 is ugly.
In my dream (Object-oriented style), #1 could be :-

rocket->mainBodyGraphic->setColor(RED);                      //#1

The above line is far easier to read and code.     It is also less error-prone.

The Change (super entity)

I plan to change my code to support it, but I don't want to lose any disadvantage of ECS.
Therefore, I will create super entity.

For example:-

I create a new super Entity class named GEntity (graphic entity).
I provide a converter (operator=()) between Entity and GEntity.
Whenever a function just want Entity, I can pass GEntity instead, and vice versa!
graphicFactory->createCone() and similar functions will return  GEntity instead of Entity.
The field in RocketComponent will be GEntity mainBodyGraphic;.
Entity has no access to game logic like before, but GEntity can access all game logic/system.

Here is my adoption (future plan / promise to myself):-

In GEntity, I can add all syntactic sugar functions e.g. setColor() as much as I want.
I will use GEntity only when logical type of entity is very obvious.
I will also create PEntity = Physic body, because its type is also obvious.
I may also create other types of super entity if its type is very obvious && I want the syntactic-sugar.

Here is the result (change marked with $):-

class RocketComponent{
    GEntity mainBodyGraphic;      //$
    GEntity topGraphic ;          //$
};
void createRocket(){
    GEntity mainBodyGraphic = graphicFactory->createCylinder(); //$
    GEntity topGraphic = graphicFactory->createCone();          //$
    Pointer<RocketComponent> rocket  = create<RocketComponent>();
    rocket->mainBodyGraphic = mainBodyGraphic;
    rocket->topGraphic = topGraphic;
    //.... other logics ....
}
void showDamage(Entity rocket){
     Pointer<RocketComponent> rocket  = rocket->get<RocketComponent>();
     rocket->mainBodyGraphic->setColor(RED);                    //$
}

Concern (my fear)

I feel that I am violating some ECS rules.
I am probably destroying good ECS abstraction and design pattern in favor of my indolence.

I have already refactored some of my code to the new way.
It looks nice and neat.   I think I am biased.

Question

What are disadvantage of this approach?
What are things (potential issue) that I should concern and prevent?
What is the name of this technique/design-pattern (if any)?

sentences:
Error: Cannot create FMOD::Sound instance for resource sharedassets0.resource when splitting application binary in Unity I'm trying to publish an Unity app to the PlayStore. Since the size of the app is over the limit of 100MB, I need to split the binary. So I selected the option Split Application Binary in Unity.

However, when I try to launch this application (either by downloading it on the Playstore or putting the .apk and the .obb directly on my device from my computer), I get the following errors on Android SDK monitor:

01-24 11:38:52.442: E/Unity(25004): Error: Cannot create FMOD::Sound instance for resource
sharedassets0.resource, (File not found. )
01-24 11:38:52.442: E/Unity(25004):
01-24 11:38:52.442: E/Unity(25004): (Filename:  Line: 882)
01-24 11:38:52.442: E/Unity(25004): Function SoundHandle::Instance::~Instance() may only be
called from main thread!
01-24 11:38:52.442: E/Unity(25004):
01-24 11:38:52.442: E/Unity(25004): (Filename:  Line: 25)

The application freezes at the "Made with Unity" splash screen.

This is not happening when I don't use the Split Application Binary option and put the .apk directly on my device from my computer.

I'm using Unity 5.4.0.

sentences:
How do I use trigger colliders in Unity? I am trying to create a "Fruit Ninja" style game in Unity in VR. I have a BoxCollider on my sword set to "Trigger" and I have some "fruit" objects coming towards it. I then have this function:

void OnTriggerEnter(Collider other)
{
    Destroy(gameObject);
    Destroy(other.gameObject);
}

I've tried applying this script to the sword and to the objects, but nothing is destroyed.

In the documentation, there is also a note of "Trigger events are only sent if one of the Colliders also has a Rigidbody attached", but I've attached a Rigidbody to the objects.

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 to check if NPCs are on ground or not? I'm using Unity Engine. I see the common way to check if player is on ground is shooting a Raycast:

How to solve the ground check problem?

How to check if grounded with rigidbody

I have a simple scene with Unity's terrain  for ground (Game Object > 3D Object > Terrain). Imagine you have a lot of NPCs (like GTA), is it possible to check a character on ground without Raycast? Do you have to run loop to ray cast check each NPC?

sentences:
Getting UV maps from UDK? I have created a map using UDK and I am exporting it as a .fbx for use within an XNA project.

My question is, can I generate a UV map for texturing the map or is there an easier way to texture a map made within UDK to be used in an XNA project?

Thanks.

sentences:
How do I export Physique animations without breaking them? I've been trying to export a simple footstep animation that I made in 3ds Max, but it either fails to export or is broken (imports into unity missing a few frames, or appears to have imported but won't play) every single time.

I've tried .fbx and .3ds, but neither works. I'd rather not use the Skin modifier, because it would require starting from scratch and learning a new system. Any ideas?

sentences:
How do I create textured landscape in low poly style? I'm trying to create something similar to this kind of artistic landscapes in Unity.

I've been from trying to use Unity's terrain system and Gaia to making it in Blender; no matter how I can't figure out how it's made; how to texture it afterwards.

I'd be thankful is someone can point me in the starting direction.

Thanks !

sentences:
Pre- or post-multiplication for rotation between coordinate frames I have three 3D coordinate frames: O, A and B, as shown below.

I want to know the rotation matrix RAB between A and B, that is the rotation that is required, with respect to the frame A, to move from A to B.

Let us imagine that all I know, is the rotation matrix RAO between A and O, and the rotation matrix ROB between O and B.

So, what is the correct way to determine RAB? There are two suggestions that come to mind:

(1) RAB = RAO ROB

(2) RAB = ROB RAO

Now, my intuition is that (1) is correct, i.e. post-multiplication. This is because I am multiplying everything with respect to the local coordinate frame (as discussed in http://web.cse.ohio-state.edu/~whmin/courses/cse5542-2013-spring/6-Transformation_II.pdf).

However, when I compute this, I get a different answer to that which I get by inspection of the diagram. The correct answer, I have noticed, is equal to the pre-multiplication solution of (2).

Please can somebody explain to me why (2) seems to be correct, rather than (1)? I was under the impression that if all your transformations are with respect to the current local frame, then post-multiplication should be done, i.e. multiply the matrices from left to right as you move between each frame. However, when doing the maths, pre-multiplication gives the expected answer.

sentences:
How can I get complete path of a sprite? I want to get a path of sprite using the spriteRenderer component in Unity.I want my path should  be like - "asset/PATH OF MY FILE/FILENAME.EXTENSION". Currently I am using following code but it returns only parent name/path.

string GetSpritePath(Transform goPath){
    List<string> path = new List<string> ();

    Transform current = goPath.transform;
    path.Add(current.name);

    while (current.parent != null) {
        path.Insert(0, current.parent.name);
        current = current.parent;
    }

    return string.Join("/", path.ToArray());
}

Whats wrong with my code ?

sentences:
Unity3d and Windows 8 run game in frame How do I set Unity3D to run my game on Windows 8 in a fixed size frame (with a border around it) and not in fullscreen?

I tried setting this in the Unity script and in the final C# project, but nothings seems to work.

I have set the players resolution to 1366x786 (the desired size) and while this works fine with the webplayer the windows 8 solution seems really unimpressed by it. I also tinkered with the 'Default Is Full Screen' option

sentences:
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:
3-hit combo system plays first attack animation every time So the new input system is out, and we're using it for our game. The next hurdle I'm trying to get over is implementing a melee combo  ( E->-E->E). Not 100% sure how to get the new system to execute something like that. Right now my trigger isn't resetting. Images of the animator graph at the bottom

public class PlayerController : MonoBehaviour
{
    Rigidbody2D _rigidbody;
    SpriteRenderer _renderer;
    Animator _animator;
    public float fallMultiplier = 2.5f;
    public float lowJumpMultiplier = 2f;

    PlayerInputActions inputActions;
    Vector2 movementInput;
    public bool inInteractionZone;
    public int attackCount = 0;
    public float attackTimeout = 0.5f;

    bool touchingWall;
    private void Awake()
    {
        HRHEventHub.OnPlayerDeath += HRHEventHub_OnPlayerDeath;
        inputActions = new PlayerInputActions();
        inputActions.Player.Move.performed += ctx => movementInput = ctx.ReadValue<Vector2>();
        inputActions.Player.Interact.performed += InteractPressed;
    }

    private void InteractPressed(InputAction.CallbackContext obj)
    {
        //TODO add attack timeout
        //Check if we are inside a interaction zone
        if (inInteractionZone)
        {
            //TODO implement
            return;
        }
        if (attackCount == 0 && _grounded)
        {

            attackCount++;
            _animator.SetTrigger("Attack");
            //_animator.SetBool("ATK1", true);
        }
        else
        if (attackCount == 1 && _grounded)
        {
            attackCount++;
            _animator.ResetTrigger("Attack");
            _animator.SetTrigger("Attack");

        }
        else
        if (attackCount == 2 && _grounded)
        {
            attackCount = 0;
            _animator.ResetTrigger("Attack");
            _animator.SetTrigger("Attack");

        }

    }

}

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:
What is the technical term for animation of a dead body? In some 3D games when a 3D model of a person is shot to death (or suddenly dead) his body falls to the ground and every limb, the head and the body move free.
What is this particular way of handling dead bodies called?
Is it possible with UDK?

If you didn't understand, I meant like in this video: see how the corpse falls.

sentences:
Collision between UI element and GameObject When I first started to develop in Unity I followed the Unity Tutorial for the Space Shooter 2D game and used the knowledge from that to create something myself. Looking at it now it may not have been the best idea.

Currently my game is 2D but in a 3D environment where the camera is top down and I am trying to figure out how I can detect a collision between a UI Image and my Player GameObject.

Any help will be extremely appreciated!

sentences: Linux Game Development Resources Do you have any Linux-specific game development resources?

sentences: Rendering artifacts at a large scale I'm a new to OpenGL or graphics in general. Trying to write a game with realistic scale. I had a perfectly fine rendering of earth at a small scale, but when I try to scale it up to 1:1 I get this artifact. Any ideas what this could be? I suspect it's because I am using floats, but I would rather avoid using doubles in the shader for performance reasons.

sentences:
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:
2D XNA Tile Based Lighting. Ideas and Methods I am currently working on developing a 2D tile based game, similar to the game 'Terraria'. We have the base tile and chunk engine working and are now looking to implement lighting. Instead of the tile based lighting that terraria uses, I want to implement point lights for torches, etc.

I have seen Catalin Zima’s shader based shadows, and this would be perfect for the torches (point lights). My problem here is that the tiles on the surface of the world need to be illuminated, doing this by a big point light is firstly extremely expensive, but also doesn't look right.

What I need help with (overall) is...

To have a surface that is illuminated regardless of torches, etc.
To also have point lights, or smooth tile lighting similar to Catalin Zima’s shader based shadows.

Looking forward to your replies. Any ideas are appreciated.

sentences:
How to "piece together" an image in code, to render later? I want to make a game in Dart and have decided to use the available port of the JS Phaser game engine. This will be my first time really making a game involving graphics so I guess I'll have a lot to learn as I go along...

The main thing I'm trying to reason about doing in code at the moment is as follows: a key part of the game will be that the grid-based map that will be rendered onscreen will be previously generated to be composed of various "tiles" by an algorithm. You could think of it as analogous to a patchwork quilt I suppose in that regard. So naturally with a map like this I need to have some way of piecing together multiple copies of all my base tile images to form the appropriate map configuration to render. So essentially my question is how would I approach doing this in code so that I can indeed programmatically put together the image of my map and not render it tile-by-tile or something like that.

sentences:
Finding an angle between two bodies I am trying to find angle between vectors a and b. But the cosine for some reason is not within +/- 1, that means that it is not possible to find an angle between a car and a pedestrian...

Any help appreciated

EDIT I have rewritten my function in accordance with the answer below (I had to do some changes due to writing in Python, for example pedestrian.body.position is equivalent to body.GetPosition()

I also tried to normalize both vectors, but the cosine is still not within +/- 1
And the car can move in both direction, so I do not know how to get its other component...

    def detect_pedestrian(car,pedestrian):
        #Find a vector which connects pedestrian with a car
        pedestrian_position = pedestrian.body.position
        car_position = car.body.position

        #Find vectors a and b
        car_vector = Box2D.b2Body.__GetTransform(car.body).R.GetYAxis()
        pedestrian_vector = pedestrian_position - car_position

        #Calculate magnitudes of both vector
        pedestrian_vector_magnitude = np.linalg.norm(pedestrian_vector)
        car_vector_magnitude = np.linalg.norm(car_vector)

        #Normalize both vectors
        pedestrian_vector_normalized = pedestrian_vector/pedestrian_vector_magnitude
        car_vector_normalized = car_vector/car_vector_magnitude

        #Calculate angle
        magnitudes = pedestrian_vector_magnitude * car_vector_magnitude
        dot_product = b2Dot(pedestrian_vector_normalized, car_vector_normalized)
        cosine = magnitudes/dot_product
        arccos = np.arccos(cosine)

        print(cosine)

```

sentences:
How can I use different fonts for different objects in Unity? In Unity 3.5, I have a font that is strangely linked to four game objects. I want to put separate fonts on each object.

In the Inspector, when I click on the circle icon next to the "Text" attribute, I can select a font.  But, then it changes the font on the other three objects as well.

I was hoping Unity would have something like a material ID from 3DS Max. If I could put a new material ID on the other objects, hopefully I could assign a new font to the text mesh. Regardless, is there a way to assign a different font to each of my objects?

sentences:
Instantiating prefabs by dragging in scene not working So I have this problem where I try to instantiate prefabs as in this video for example. I can take instantiate one prefab to the scene, but if I try to instantiate a second one to the scene (whether it's with the same prefab or a different one), instead of creating an instance of the second prefab, it brings the first instance I had created to my mouse and I'm in position to move it by dragging it around.

The only work around I have for this so far is to drop into the hierarchy instead of the scene (which works fine), but I have to carefully avoid the scene while dragging and dropping, otherwise the above-described issue happens instantly.

Am I doing something wrong, or is this a bug of some kind?

EDIT : I managed to reproduce the error in a consistent manner. I don't know why it happens, but it does every time. It doesn't involve code and it is very simple to reproduce (at least for me, perhaps not for you if you're not doing the wrong thing that I do...).

I created a new project. I created a cube and a sphere. I turned them both into prefabs and deleted the original instances (they have the .prefab extension in my folder, so I am sure). I drag-dropped the cube in, works fine. I drag the sphere in, and it appears as a cube which I have to position (by releasing the click), and my initial prefab instance of the cube is gone.

sentences:
Rigidbody or Character Controller for a momentum based sidescrolling shooter/platformer? I'm working on a side scrolling game where among other movement options the player can perform a "bullet jump". The bullet jump fills a similar role to a double jump, but instead of just jumping in midair, it launches the player in the direction of the mouse cursor. Unfortunately, I can't seem to find any way of doing this using Character Controller, so I've turned to Rigidbody physics to handle the air launch of the player.

As I can't use both Rigidbody and Character Controller, I'm forced to pick one, and as I'm a novice, I decided I'd turn to Stack Exchange for help. I am aware that Character Controller was the given answer for this question on many other occasions, but due to the momentum focus of the game and the nature of the bullet jump mechanic, I feel it's worth asking this question in the context of my specific game.

sentences: Analysis of Mario game Physics I know there's a breakdown of Sonic the Hedgehog physics found here, and I was wondering, does there exist a breakdown of any of the Mario games? Something similar to this but for Mario is what I'm interested in!

sentences: How to implement bullet physics in libgdx I am new at game development want to know that how can I implement bullet physics in libgdx. I searched lot of things on Internet but nothing found worthy.

sentences:
Building dynamic bounding box hierachies I've been reading about collision detection and I saw that the first part was a coarse detection which generates possible contacts using bounding box hierarchies.

I understand the concept of splitting up your objects in groups, to speed up the detection phase, but I'm a little confused on how do you actually build the hierachy, more so on what criteria is used to group them together.

Do I iterate through all the objects in the scene, and check the distance between them to see where they should be inserted in the tree?

Do you know some resources that may shed some light on this topic for me?

sentences:
What is an example of a binary 3d file format? I'm new to GD so if this is too broad I apologize. I'm looking for some quick information.

What binary file format supports the basic game rendering information?

raw position vertices
Texture/UV
(or) Color
Normals
Animation keyframes

I'm aware that .obj and .dae have all of the above, however these files are in ascii. What file type supports these and is in binary?

And is it common to make custom 3d model format for one's game engine?

sentences:
How should I make a jump-timing game's character static on screen? I decided to learn Pygame and try to make a simple game inspired by Google's T-rex jump game. However, I stumbled upon a problem that I can not seem to figure out: How can I implement a scroller/camera that can keep up with my character and platform?

Now it just disappears off the screen. I have made it so the platform moves to the right with the same speed as the character. Here is a GIF of what it looks like at the moment:

Is this the best way to do it for a game like this where speed of the character is always constant or is there a better way that will make adding obstacles in the future more easy?

sentences:
How to add & copy ParticleSystem attached to an existing GameObject using C# script in Unity? I have a GameObject "FireBall" with a ParticleSystem attached to it. I want to add the same ParticleSystem to other GameObject "Avatar". Initially there is no ParticleSystem attached to "Avatar".

When I do this -

ParticleSystem fireparticlesyst = gameObject.AddComponent<ParticleSystem>();

It adds a ParticleSystem to "Avatar" but I want to set all the properties of this ParticleSystem to the ParticleSystem attached to "FireBall".

If I add all the properties by individually I can't set some of the properties as they are read only.

How to do this ?

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:
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:
Handling multiple pressed keys with KeyListeners I'm making a game Applet with Java that uses KeyListeners to control a paddle (for a game like Breakout/Pong). My basic implementation goes like this:

public void keyPressed(KeyEvent e) {
    switch (e.getKeyCode()) {
        case KeyEvent.VK_LEFT:
            direction = "LEFT";
            break;
        case KeyEvent.VK_RIGHT:
            //repeat for the rest
    }
}
public void keyReleased(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_RIGHT)
        direciton = "";//paddle doesn't move
}

My problem is that when the user tries to change the direction of the paddle twice too fast (let's say you press left, then right and left again super fast), the paddle freezes for a split second, and continues to move along its direction.

I understand that the problem is the logic in my code, but I can't think of a better implementation. What am I missing?

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:
How do I drag my widgets without dragging other widgets? I have a bunch of drag-able widgets on screen.  When I am dragging one of the widgets around, if I drag the mouse over another widget, that widget then gets "snagged" and is also dragged around.

While this is kind of a neat thing and I can think of a few game ideas based on that alone, that was not intended.  :-P

Background Info

I have a Widget class that is the basis for my user interface controls.  It has a bunch of properties that define it's size, position, image information, etc.  It also defines some events, OnMouseOver, OnMouseOut, OnMouseClick, etc.  All of the event handler functions are virtual, so that child objects can override them and make use of their implementation without duplicating code.

Widgets are not aware of each other.  They cannot tell each other, "Hey, I'm dragging so bugger off!"

Source Code

Here's where the widget gets updated (every frame):

public virtual void Update( MouseComponent mouse, KeyboardComponent keyboard ) {
    // update position if the widget is being dragged
    if ( this.IsDragging ) {
        this.Left -= (int)( mouse.LastPosition.X - mouse.Position.X );
        this.Top -= (int)( mouse.LastPosition.Y - mouse.Position.Y );
    }
    ... // define and throw other events
    if ( !this.WasMouseOver && this.IsMouseOver && mouse.IsButtonDown( MouseButton.Left ) ) {
        this.IsMouseDown = true;
        this.MouseDown( mouse, new EventArgs() );
    }
    ... // define and throw other events
}

And here's the OnMouseDown event where the IsDraggable property gets set:

public virtual void OnMouseDown( object sender, EventArgs args ) {
    if ( this.IsDraggable ) {
        this.IsDragging = true;
    }
}

Problem

Looking at the source code, it's obvious why this is happening.  The OnMouseDown event gets fired whenever the mouse is hovered over the Widget and when the left mouse button is "down" (but not necessarily in that order!).  That means that even if I hold the mouse down somewhere else on screen, and simply move it over anything that IsDraggable, it will "hook" onto the mouse and go for a ride.

So, now that it's obvious that I'm Doing It Wrong™, how do I do this correctly?

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: How well does Unity 3d work for both Android and iPhone? First off this question might be a bit broad so I apologize if it is. I am really just looking for peoples experiences and personal knowledge on the subject. I am looking to create a game for both Android and iPhone platform. I know Unity is a great game engine and my question is how well does it work for creating one code base to build for both Android and iPhone platforms? Time is a constraint on this project so I am very interested in how smoothly the process usually is when trying to build both applications and how much custom code must be written for each specific application. Any insite that people have on this topic would be much appreciated thanks.

sentences:
Shader | Special Effect - Unit selection I would like to know how the shaders used to show which unit is selected are made. Here is an image to illustrate.

How the merge effect of the blue circles can be achieved ? I didn't found any explanation concerning this effect. I know that to project those texture I can develop a decal system but I don't know how to create the merging effect.

sentences:
How do I manually submit a new UI InputField in code? I need some conditions for submitting the text inside of an Inputfield, however I cannot find a way to do this via code. I was expecting something simple like with WPF or WinForms, but I cannot find any method I can use to actually submit an Inputfield via code.

How can I submit an Inputfield through code so that I can add some sort of conditions to when it can be submitted by the user other than just the enter button.

Thanks!

Edit, some clarification:

Submitting an input field is submitting it's text, firing an event which can be listened to by the OnSubmit method which then fires an onEndEdit event (I think event) which you can add listeners to so that specific methods of your own get called when it fires.

Right now I am unable to identify a reasonable way to change the keys or combination of keys that control when the form is submitted (Default ie "Enter" or "Return" in the Input Manager) (Can't use Shift-Enter for a new line since enter submits the form). Instead I want to manually submit the form through code when the appropriate keys are pressed.

public class ChatInputField : MonoBehaviour
{
    public InputField textInput;

    public void Start()
    {
        textInput.onValueChange.AddListener(delegate { CheckForSubmit(); });
    }

    //Checks for an enter to submit
    public void CheckForSubmit()
    {
        //No idea how to get the actual value changed from this event so I have to check for keys being held down. Terribly awkward
        if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
        {
            if(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
               //Add a new line
            }
            else
            {
                if(textInput.text != "")
                {
                    //Submit form if not empty
                }
            }
        }
    }

Edit2: I just realized that I can manually edit the attributes I want. I can send it's text to the appropriate class, clear the input field, and de-select it if I wanted. No need to fire the event other than for ease-of-use within the inspector. Sorry for wasting you guy's time :)

I'll leave this question open in case someone does figure out how to fire these events manually though.

sentences:
Pyglet: text.Label().draw to FBO? I just started OpenGL (PyopenGl) & Pyglet 3 weeks ago, and decided to read the Red Book. So sorry if my question shows my lack of comprehension...

My question is: Is it possible to display/write text using  text.Label().draw  in a FBO ?

What I want to do is use text.Label().draw to generate a texture and use that texture when I need it. But so far I haven't been able to do it. (lack of comprehension/experience?) I know that text in OpenGl is usually done by Bitmap Fonts, Outline Fonts or Texture Mapped Text, but I was wondering if the method I am thinking of could be a sortcut.

So sorry again if this question is stupid/obvious, but I'm still learning and did spend a lot of time looking/searching for an answer.

Thanks guys.

sentences: Blender to Unreal or Unity - will combining animations into one clip for a parent object to store effect workflow? Hey so I have a gun and a set of rigged hands in blender, and I was wondering if I made a parent object for the gun, hands and everything, took all the animations respectively (such as right hand reload, left hand reload, gun reload, etc) and combined them all into one animation called reload, would there be problems in the future when working in Unreal or Unity? Would I be able to apply the same animation to all the objects that are a part of the action and have them work respectively?

sentences:
How to draw a 2D cross-section of a 3D object? I am creating a game where I only want the user to see the 2D intersection of a plane with a 3D object. The goal of the game is to move this plane to a certain position and rotation, which gives a certain 2D shape. Here is a link to a website which illustrates the 2D slices of a 3D object.
How do I approach this if I only want the player to see the slice.

Just to be clear, the solution does not necessarily have to be in 3D, since the ui for the player is going to be 2D anyway

sentences:
Vertex Displacement Distortion Correction I am developing for Mobile VR using GoogleVRSDK and Unity. My target platform is Android.
I have a shader which displaces vertices to create a reverse lens distortion.

Following is my shader,

Shader "Unlit/Cube"
{

Properties {
    _Color("Main Color", Color) = (1,1,1,1)
}

Category {

    Tags { "Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" }

    Blend Off
    AlphaTest off
    Cull off
    Lighting Off
    ZWrite On
    ZTest LEqual
    Fog { Mode Off }

    SubShader {
        Pass {
            CGPROGRAM

           // #pragma target 3.5
           // #pragma target 2.0
           // #pragma only_renderers gles2
           // #pragma only_renderers gles

            #pragma vertex VertexProgram
            #pragma fragment FragmentProgram
            #pragma multi_compile __ GVR_DISTORTION
            #include "GvrDistortion.cginc"

            struct VertexInput {
                half4 vertex : POSITION;
                half4 texcoord : TEXCOORD0;
            };

            struct v2f {
                half4 vertex : SV_POSITION;
                half4 uv : TEXCOORD0;
            };

            v2f VertexProgram (VertexInput v)
            {
                v2f o;
                o.uv = v.texcoord;
                o.vertex = undistortVertex(v.vertex);
                return o;
            };

            fixed4 _Color;

            fixed4 FragmentProgram (v2f fragment) : COLOR
            {
                return _Color;
            }
            ENDCG
        }
    }
}

Following is my GvrDistortion.cginc

#if defined(GVR_DISTORTION)

float4x4  _Undistortion;
float     _MaxRadSq;
float     _NearClip;
float4x4  _RealProjection;
float4x4  _FixProjection;

float distortionFactor(float rSquared) {
  float ret = 0.0;
  ret = rSquared * (ret + _Undistortion[1][1]);
  ret = rSquared * (ret + _Undistortion[0][1]);
  ret = rSquared * (ret + _Undistortion[3][0]);
  ret = rSquared * (ret + _Undistortion[2][0]);
  ret = rSquared * (ret + _Undistortion[1][0]);
  ret = rSquared * (ret + _Undistortion[0][0]);
  return ret + 1.0;
}

// Convert point from world space to undistorted camera space.
float4 undistort(float4 pos) {
  // Go to camera space.
  pos = mul(UNITY_MATRIX_MV, pos);
  if (pos.z <= -_NearClip) {  // Reminder: Forward is -Z.
    // Undistort the point's coordinates in XY.
    float r2 = clamp(dot(pos.xy, pos.xy) / (pos.z*pos.z), 0,     _MaxRadSq);
    pos.xy *= distortionFactor(r2);
  }
  return pos;
}

// Multiply by no-lens projection matrix after undistortion.
float4 undistortVertex(float4 pos) {
  return mul(_RealProjection, undistort(pos));
}

// Surface shader hides away the MVP multiplication, so we have
// to multiply by _FixProjection = inverse(VP)*_RealProjection
// and then by inverse(M), in order to cancel it out and leave our
// own transform in place.
float4 undistortSurface(float4 pos) {
  float4 proj = mul(_FixProjection, undistort(pos));
  return mul(unity_WorldToObject, proj);
}

#else
// Distortion disabled.

// Just do the standard MVP transform.
float4 undistortVertex(float4 pos) {

 return mul(UNITY_MATRIX_MVP, pos);
}

// Surface shader hides away the MVP multiplication, so just return   pos.
float4 undistortSurface(float4 pos) {

  return pos;
}

#endif

This shader works completely as excepted in Samsung S6 and LG G3 and the Unity Editor.

But we are working for a phone named Venus. In that phone shader renders but the displacement of vertices doesn't happen.

I tried disabling conditional compiling.
I tried changing render targets and forcing different OpenGL versions in render.

Nothing worked.
I would love to hear a solution. Thank you.

The specs of the Venus,

GPU Adreno(TM) 405
Runs OpenGL ES 3.0
GPU SM:4.0 and VRAM 512MB
RM 2gigs
Screen 1080x1920 60hz  dpi 480
Android 5.1 API-22
CPU is ARMv7 VFPv3 NEON (8 cores)

The shader in LG G3 :

The shader in Venus :

sentences:
cocos2d Merging box2d bodies i'm using cocos2d to build an iphone game.

my game currently has two sprites: one for the main character and another for an item i should carry once he gets on him.

the main character and the item are both box2d bodies. i can detect the collision between the two. what is want is to make the item body stick to the main character body when they meet, that way any movement of the main character would also affect the item.

any suggestions on how to implement this?

thanks!

sentences:
How do we solve big video memory requirements in a 2D game? How do we solve big video memory requirements in a 2D game?

We are developing a 2D game (Factorio) in allegro C/C++, and we are facing a problem with increasing video memory requirements as the game content increases.

We currently gather all the info about images that are going to be used first, crop all of these images as much as possible and organize them into big atlases as tightly as possible. These atlases are stored in video memory, the size of which depends on the system limitations; currently it is usually 2 images of up to 8192x8192, so they require 256Mb to 512Mb video memory.

This system works pretty good for us, as with some custom optimisations and splitting the render and update thread we are able to draw tens of thousands of images on the screen in 60 fps; we have many objects on the screen, and allowing a big zoom-out is a critical requirement. As we would like to add more, there is going to be some trouble with the video memory requirements, so this system can't possibly hold.

One of the things we wanted to try is to have one atlas with the most common images, and the second as a cache. The images would be moved there from the memory bitmap, on demand. There are two problems with this approach:

The drawing from memory bitmap to video bitmap is painfully slow, in allegro.
It is not possible to work with video bitmap in other than the main thread, in allegro, so it is practically unusable.

Here are some additional requirements we have:

The game must be determistic, so the performance issues/loading times can never alter the game state.
The game is real time, and soon to be multiplayer, as well. We need to avoid even the smallest stutter at all costs.
Most of the game is one continuous open world.

The test consisted of drawing 10 000 sprites in a batch for sizes from 1x1 to 300x300, several times for every configuration. I did the tests on the Nvidia Geforce GTX 760.

Video bitmap to video bitmap drawing took 0.1us per sprite, when the source bitmap wasn't changing between individual bitmaps (the atlas variant); the size didn't matter
Video bitmap to video bitmap drawing, while the source bitmap was switched between drawings (non atlas variant), took 0.56us per sprite; the size didn't matter, either.
Memory bitmap to video bitmap drawing was really suspicious. Sizes from 1x1 to 200x200 took 0.3us per bitmap, so not so horribly slow. For larger sizes, the time started to raise very dramatically, at 9us for 201x201 to 3116us for 291x291.

Using atlas increases the performance by a factor greater than 5.
If I had 10ms for the rendering, with an atlas I'm limited to 100 000 sprites per frame, and without it, a limit of 20 000 sprites. This would be problematic.

I was also trying to find a way to test the bitmap compression and 1bpp bitmap format for shadows, but I was unable to find a way to do this in allegro.

sentences:
Are there any good articles that layout the evolution of game development techniques? I'm just getting into coding up some 3d rendering apps and I'm considering taking the jump into interactivity. While developing I've learned about Euler angles, gimbal lock, quaternions, frustum, culling, vector matrices, (quad/oc)trees, etc. Haven't touched vertex buffers, textures, mipmapping, peripheral interfaces (other than mouse/keyboard), and general game engine components.

I imagine all of these terms, techniques, have evolved over time from early "Wolfenstein"  implementation, to Quake 3 implementation, to modern day id Tech 5 implementation (and everything in between.)

Seems like information like this would be valuable so I can rule out certain implementations of something because they've already been obsoleted by other newer and cooler things. Essentially looking to evolve my own skills, but on a fast track (instead of reading all the material and chronologically keeping track.)

Are there any good articles that layout the evolution of game development techniques?

Thanks,
Chenz

P.S. I'm not trying to avoid RTFM, just trying to only get the up-to-date information.

sentences:
How can I get the front buffer into a texture on the GPU? I'm attempting to write a small screen capture utility that writes captured video to disk.

First, I get the front buffer surface.  I've written a shader that takes this surface and through render to texture, converts it to a YUY2 format frame.  The format change is required so that I can pass the frames off to an encoder.

I'm using DirectX 9 to acquire the frontbuffer.  There are a couple of ways I know of to get at the front buffer:

GetRenderTargetData()

GetFrontBufferData()

The MSDN page on both of these API calls state that the data is copied from device memory to system memory.  I'd like to copy the front buffer surface directly to another graphics memory surface, as I have other manipulations to perform on the acquired surface before returning it to system memory.

I'm creating a D3DUSAGE_DYNAMIC texture (gfx mem texture) and calling GetFrontBufferData() to write the front buffer to my textures surface0.  Is this valid?  Will the operation remain in gfx memory, or will it need to move to system memory and then back to graphics memory?  If this is the case, is what I'm trying to achieve possible?

EDIT
I've been acquiring the front buffer as below, simply because its a convenient way to get a surface populated:

hr = Dx9Mgr::Ref().D3DDev()->GetFrontBufferData( 0, m_spCaptureSurface );

OTOH, GetBackBuffer() allocates a new surface (I want to reuse one over and over), so I just went with GetFrontBufferData().

GetRenderTargetData() requires that the destination surface be created in system memory rather than in gfx memory (e.g. uses D3DPOOL_SYSTEMMEM ), so I ruled this out.  Maybe I should reconsider?

sentences:
2D Collision Box Clipping There is this strange issue with the collision in a game I am making. When the player is slightly lower than a block it is colliding with from the side, the player ends up clipping to the top of the block rather than sliding along the side of it down. Do you have an idea how to fix it?

If that description didn't help you at all you can reproduce it here (goes to the website with the game on it). (Use WASD/Space/Arrow Keys to move) To reproduce, stand on the single block and hold the right move button. You will fall off the edge, hit the side of the block, and get clipped to the top of it. You are meant to fall onto the block below instead.
(The words and colors are debug info)

The code below is what handles the collision detection. If you need the rest of the code, you can view the source of the page linked above.

this.doCollision = function() {
var tx = Math.floor(this.x),
    ty = Math.floor(this.y),
    nx = this.x % 1,
    ny = this.y % 1,
    cell = this.cell = levelStorage.currentLevel.getTileAtPosition(tx, ty),
    cellRight = this.cellRight = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty),
    cellDown = this.cellDown = levelStorage.currentLevel.getTileAtPosition(tx, ty + 1),
    cellDiag = this.cellDiag = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty + 1);

if(this.vy > 0) { // Ground collision
// The !cell checks return if the cell exists or not (null)
  if((cellDown && !cell) || (!cellRight && cellDiag && nx)) {
    this.y = ty;
    this.vy = 0;
    this.falling = false;
    this.jumping = false;
    ny = 0
  }
}else
if(this.vy < 0) { // Ceiling collision
  if((!cellDown && cell) || (cellRight && !cellDiag && nx)) {
    this.y = ty + 1;
    this.vy = 0;
    cell = this.cell = cellDown;
    cellRight = this.cellRight = cellDiag;
    ny = 0;
  }
}
if(this.vx > 0) { // Right collision
  if((cellRight && !cell) || (!cellDown && cellDiag && ny)) {
    this.x = tx;
    this.vx = 0;
    nx = 0;
  }
}else
if(this.vx < 0) { // Left collision
  if((!cellRight && cell) || (cellDown && !cellDiag && ny)) {
    this.x = tx + 1;
    this.vx = 0;
    cell = this.cell = cellRight;
    cellDown = this.cellDown = cellDiag;
    nx = 0;
  }
}
this.falling = !(cellDown || (nx && cellDiag)); // If player isn't on ground
}
}

Thanks for the help!

EDIT: I should note this also happens with the bottom of blocks as well. The same principles apply as clipping to the top, except you clip to the bottom instead.

sentences: Apply Vertex Colors to XNA Spritebatch sprites I know that you can use custom vertex and pixel shaders using SpriteBatch but I can't figure out how to apply colors to individual vertex points on a sprite generated by spritebatch. All I can do is apply a blanket color to the entire sprite rather than being able to blend between the 4 points that should be available in a quad. Can anyone give me a hand with this?

sentences:
Improving Rigidbody collision between real-time movable object and other Rigidbodies I have a cube that has been scaled to be rectangular (controlled by a remote Raspberry Pi gyro/accelerometer/magnetometer) and am translating its orientation into Unity via calls to transform.localEulerAngles = new Vector3(...). This works wonderfully (the cube object modeled to be a Pi rotates perfectly), however now I'm running into issues with the actual physics.

GIF of successful roll

Initially the ball will land on and roll around the Pi object, however when I start to increase the speed of my movements the ball will sometimes fall through the Pi.

The cube has a Rigidbody (no gravity, is kinematic) and Box collider (not triggered), and the sphere has a Rigidbody (has gravity, not kinematic) and Sphere collider (not triggered) attached.  I've tried varying the collision detection from discrete to continuous on both objects and have noticed similar behaviors.

The intent is to turn this into a marble maze type game, and the issue that I have is similar.  If I roll the ball into the joint between a wall and the floor (both stretched cubes), rotate it down, and then rotate it up, the ball will fall through the joint.  I have the same movement code attached to the GameArea object below.  Again, same issue with various types of collision detection applied.

My assumption is that this is a quickness of movement thing, as the cubes overlap each other (there's not a space for the ball to sneak through).

For reference, in the physics colliders section of the project preferences, all relevant layers are supposed to collide with each other.  I don't mind getting into code-based collision detection, but this seemed fairly trivial for Unity to take care of so I was wondering if I was missing something obvious.

sentences:
opengl : Running at least 25 windows with different Draw callback I need to run at least 25 windows concurrently with each window rendering a different game state.
I am storing all the 25 game states in the array of type GameState allGameStates[25].

For each of the window, i am currently doing this to register a different draw callback for each of the 25 windows.

 glutCreateWindow(title);
 glutDisplayFunc(allGameStates[i].Draw);

The issue here is that glutDisplayFunc requires a parameter of type function ptr, and i cannot pass in a member function ptr.(i am using GLUT which is in C)

It is not feasible to make the Draw function static as i require the Draw function to render differently accordingly to the other variables in the game state object.

How do i overcome this problem?

sentences:
Drawing behavior when a fragment is written to multiple times in a single pass This seems really basic, but I'm confused and can't find a clear answer anywhere.

What happens to a target fragment of a rendertarget if the fragment is written to multiple times within one pass (e.g. by drawing two identical triangles above each other), assuming depth and stencil testing is disabled?

Does this just use the behavior specified with the current blend state? If not, can I modify this behavior?

sentences:
Is it possible to mod a game to use a scripting language like Lua? So my questions are:

Is it possible to mod a game to use a scripting language?
How would I go about doing so?

I really like Arma 2 but like many games it does not have much in terms of capabilities beyond using server commands in scripts. That makes it pretty limited.

Personally I would like to add the ability to use a different language than Arma 2's scripting language; possibly Lua.

How could I make Arma 2 use Lua? Is there a way?

I remember from when I just a teenager and into modding Halo PC some people had created scripting mods for that game. How did they do that? I hope this question isn't too general or difficult to answer.

sentences:
Position Reconstruction from Depth by inverting Perspective Projection I had some trouble reconstructing position from depth sampled from the depth buffer. I use the equivalent of gluPerspective in GLM. The code in GLM is:

template
GLM_FUNC_QUALIFIER detail::tmat4x4 perspective
(
    valType const & fovy,
    valType const & aspect,
    valType const & zNear,
    valType const & zFar
)
{
    valType range = tan(radians(fovy / valType(2))) * zNear;
    valType left = -range * aspect;
    valType right = range * aspect;
    valType bottom = -range;
    valType top = range;

    detail::tmat4x4 Result(valType(0));
    Result[0][0] = (valType(2) * zNear) / (right - left);
    Result[1][2] = (valType(2) * zNear) / (top - bottom);
    Result[2][3] = - (zFar + zNear) / (zFar - zNear);
    Result[2][4] = - valType(1);
    Result[3][5] = - (valType(2) * zFar * zNear) / (zFar - zNear);
    return Result;
}

There doesn't seem to be any errors in the code. So I tried to invert the projection, the formula for the z and w coordinates after projection are:

and dividing z' with w' gives the post-projective depth (which lies in the depth buffer), so I need to solve for z, which finally gives:

Now, the problem is I don't get the correct position (I have compared the one reconstructed with a rendered position).
I then tried using the respective formula I get by doing the same for this Matrix.
The corresponding formula is:

For some reason, using the above formula gives me the correct position. I really don't understand why this is the case. Have I done something wrong? Could someone enlighten me please?

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

struct PositionUpdateJob : IJobParallelForTransform

{

    public TransformAccessArray Object;

    public float DIst;

    public void Execute(int i, TransformAccess transform)

    {

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

}

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

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

sentences: 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:
Knowing the size of a framebuffer when rendering transformed meshes to a texture I have a couple of 2D meshes that make a hierarchical animated model.
I want to do some post-processing on it, so I decided to render this model to a texture, so that I could do the post-processing with a fragment shader while rendering it as a textured quad.
But I don't suppose that it would be very smart to have the render texture's size as large as the entire screen for every layer that I'd like to compose – it would be nicer if I could use a smaller render texture, just big enough to fit every element of my hierarchical model, right?
But how am I supposed to know the size of the render target before I actually render it?
Is there any way to figure out the bounding rectangle of a transformed mesh?
(Keep in mind that the model is hierarchical, so there might be multiple meshes translated/rotated/scaled to their proper positions during rendering to make the final result.)
I mean, sure, I could transform all the vertices of my meshes myself to get their world space / screen space coordinates and then take their minima / maxima in both directions to get the size of the image required. But isn't that what vertex shaders were supposed to to so that I wouldn't have to calculate that myself on the CPU? (I mean, if I have to transform everything myself anyway, what's the point of having a vertex shader in the first place? :q )
It would be nice if I could just pass those meshes through the vertex shader first somehow without rasterizing it yet, just to let the vertex shader transform those vertices for me, then get their min/max extents and create a render texture of that particular size, and only after that let the fragment shader rasterize those vertices into that texture. Is such thing possible to do though? If it isn't, then what would be a better way to do that? Is rendering the entire screen for each composition layer my only option?

sentences:
Problem getting mouse events while keys held down in SDL2 I'm attempting to write input capturing code using SDL2 on Windows.  However, I'm running into a problem.

Whenever a key is held down, the SDL event queue has no mouse movement, nor will the mouse move on my screen. Instead, The SDL event queue continually returns the key I am holding down as an SDL_KEYDOWN event.

Here is a simple example program which reproduces the problem exactly:

#include <SDL2/SDL.h>
#include <iostream>

int main(int argc, char** argv) {
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Window* window = SDL_CreateWindow("Moust Input Test", SDL_WINDOWPOS_UNDEFINED,
                                        SDL_WINDOWPOS_UNDEFINED, 640, 480,
                                        SDL_WINDOW_SHOWN);
  SDL_Event event;
  for(; ;) {
    while (SDL_PollEvent(&event)) {
      if (event.type == SDL_QUIT) {
        SDL_DestroyWindow(window);
        return 0;
      } else if (event.type == SDL_MOUSEMOTION) {
        int x, y;
        SDL_GetMouseState( &x, &y );
        std::cout << "Mouse moved to: " << x << " " << y << std::endl;
      } else if (event.type == SDL_KEYDOWN) {
        std::cout << "Code of key pressed: " << event.key.keysym.sym << std::endl;
      }
    }
  }
  return 0;
}

What I would expect to happen is that, when I hold down a key (for example, 'a'), it prints exactly once:

Code of key pressed: 97

And then, while they key is held down, if the mouse is moved, it prints every time the mouse is moved:

Mouse moved to: [wherever]

Instead, I'll keep seeing over and over again:

Code of key pressed: 97

And I will not get any mouse movement whatsoever on the screen, nor will I get my mouse movement log printed, until I release whatever keys I am holding down.

Anybody know how I can capture mouse movement while I have a key held down?

The only thing I can think of which could possibly be relevant is I am compiling with MinGW using:

g++ -Dmain=SDL_main test.cpp -o test.exe -L./lib/SDL2 -lmingw32 -lSDL2main -lSDL2 -mwindows -mconsole

Thanks.

Edit: I've also just noticed that the problem persists even when the window is minimized- if I am holding a key down in this text window while my program is minimized in another Window, the mouse stops working, though my program is not printing out the key code.

sentences:
Is it possible to make a randomly rotating terrain texture painting brush in Unity? I wanted to make a terrain in unity with a dirt texture painted onto the original grass texture to make a path, but when I tried, the dirt (and grass) looked repetitive and full of patterns.

My question is, is there any way I can make a texture's tiles randomly rotate when being applied or painted onto an object?

sentences:
SDL2: Why is my player's position not updating? I've just started getting into game development, SDL in particular, so please go easy on me. I'm struggling to understand why my player's position isn't chaning when I press the left arrow button.

main.cpp

#include <iostream>
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"

typedef struct
{
  float x, y;
  SDL_Texture *sprite;
} Player;

int processEvents(SDL_Window *window, Player *player) {
    SDL_Event event;
    int done = 0;
    while(SDL_PollEvent(&event)) {
        switch(event.type) {
            case SDL_WINDOWEVENT_CLOSE: {
                if(window) {
                    SDL_DestroyWindow(window);
                    window = NULL;
                    done = 1;
                }
            }
            break;
            case SDL_QUIT: {
                done = 1;
            }
            break;
        }
    }

    const Uint8 *keyState = SDL_GetKeyboardState(NULL);
    if( keyState[SDL_SCANCODE_LEFT] ) {
      player->x = 120;
    }
    return done;
}

void render(SDL_Renderer *renderer, Player *player) {
    SDL_RenderClear(renderer);

    SDL_Rect playerRect;
    playerRect.x = 0;
    playerRect.y = 0;
    playerRect.w = 32;
    playerRect.h = 32;
    SDL_RenderCopy(renderer, player->sprite, NULL, &playerRect);
    SDL_RenderPresent(renderer);
}

void update(Player *player) {
     player->x += 10;
}

int main( int argc, char *args[] ) {
    SDL_Window* window;
    SDL_Renderer* renderer;
    SDL_Event event;

    Player player;
    player.x = 50;
    player.y = 0;

    SDL_Init(SDL_INIT_EVERYTHING);
    window = SDL_CreateWindow("Dungeon", 100 , 100, 640, 480, SDL_WINDOW_SHOWN);
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

    player.sprite = IMG_LoadTexture(renderer, "assets/player.png");

    int done = 0;
    while( !done ) {
        done = processEvents(window, &player);
        update(&player);
        render(renderer, &player);
    }
    SDL_DestroyWindow(window);
    SDL_DestroyRenderer(renderer);
    SDL_Quit;
    return 0;
}

Any help would be much appreciated.

Thanks :)

sentences:
AS3 Rect-Rect Collision Basically, my game has the player's attack hitbox change based on the attack being performed. I tried to make a simple collision test that takes an enemy's coordinates and have it check to see if it's within the range of the player. I don't want to resort to using Sprites and use hitTest() since efficiency is an issue. Anyway, the problem lies in the fact that the function below always returns true (even when the player is nowhere near the enemy).

private function quickHitTest(boxLeft:int, boxRight:int, boxTop:int, boxBottom:int, rangeWidth:int, rangeHeight:int):Boolean

return ((boxLeft > (300 - (rangeWidth/2)) && (boxBottom > (450 + (rangeHeight / 2)) || boxTop < (450 - (rangeHeight / 2)))) || (boxRight < (300 + (rangeWidth/2)) && (boxBottom > (450 + (rangeHeight / 2)) || boxTop < (450 - (rangeHeight / 2)))));

I having difficulties finding the source of the problem. All help is appreciated.

sentences:
Constantly Checking Collisions and OnTriggerEnter Ok so i wanted to ask a basic question.
suppose i have an edge collider 2d,

Fact - if i add the OnTriggerEnter() into my code. it will check for trigger enters constantly.

Now,
If the edge collider exists but i don't put OnTriggerEnter(), will the game still check for trigger enter collisions? or will it not check for them?

sentences:
How do I do a game loop in c99? I'm having trouble with how to structure a game using c99. I've seen a few tutorials on making a game loop, but they are all done with c++ and classes. My main problem seems to be moving data around between the functions without creating a mess, and what stuff to put in what header files etc. Do I just do something similar to the c++ loops, and create a class-like header with a structure containing all items needed by more than one of the functions, along with the prototypes of said functions, and include the header in each function's header file? Then, in the main function, instantiate the structure and pass a pointer to it to every function in the loop?

Is this ok, or is there a better way to do it, and are there any good 'c' specific tutorials available?

Cheers

sentences:
How can I fill the interior of a closed loop on a tile map? In my game the player can dynamically modify terrain.  The map is stored within a 2D array of prefabricated 3D objects.  This is working well for now.  The player modifies terrain by selecting what sort of tile they'd like to create (like cliff going up or down), and then clicking individual tiles, or "painting" over multiple by holding down mouse button and scrolling.

I don't want the player to have to manually click every tile they want to rise or fall in elevation.  The most elegant solution I can conceive, is for the player to "paint" a loop of cliff tiles, which is then filled in automatically when the loop closes.  Imagine, perhaps, someone drawing a line using MS Paint or Photoshop, until that line closes into a shape which then autofills.

Let's say the player wants a plateau, and so they select cliff going up, and then click and drag the desired shape.  Upon closing the loop, when the last cliff tile is created beside the first cliff tile, witchcraft is invoked which fills the inside.

I have no idea how this can be done, never mind elegantly or optimally.  There are obvious possible solutions (find the average vector of all tiles in the loop, and then dijkstra algorithm from the average until the space is filled with the correct elevation), but these assume the shape generated is blobby or boxy.  An irregular shape where the mid point falls outside of the shape is possible and would probably ruin that solution!

How can I fill the inside of a closed loop? I'd like a theoretical solution I can go away and implement in C#.  At this point it seems like there is probably conceptual overlap between raster graphics and procedural maps!

sentences:
Heightmap-based Terrain with a Road What's the best way to implement a detail feature, like a road, on a heightmap-based terrain?

Update: It's a bit hard to see in the image, but the road descends from the top of the quarry to do its base.

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:
Reducing Spherical Harmonic Ringing I've generated some 2nd order SH light-probes from cube-maps in my scene and I was surprised how strong artifacts are around the back of the dominant lights. I switched to a Lambert source plus ambient and got a result just like in the image below. Stupid SH Tricks (http://www.ppsloan.org/publications/StupidSH36.pdf) suggests a technique called Han Windowing for reducing the artifacts, which I'm guessing is a convolution filter similar to a Gaussian blur, but I'm unable to tell much from the description or find an example.

I've also read some sources that say Gaussian might be best when using a HDR source.

sentences:
OpenGL Post Processing Introducing Artifacts on Certain Systems Playing around with God-Rays in my framework, I was greeted with the following artifacts on my laptop:

The artifacts themselves act almost like noise, flickering around the image rapidly. They also appear in colors that are not in the source image whatsoever.

Running the program on a PC yielded the correct results with no artifacts whatsoever. The program also experienced the same artifacts on another identical laptop (these laptops are distributed by my faculty, so they are going to be as identical in hardware and software as you can get).

I'm just not sure how to approach an issue like this one. I imagine the source of this issue will be very tricky to find, so I am just hoping someone can offer some advice to put me on the right track to isolating the issue.

Some potential clues:

In Nvidia's Nsight frame capture system, the artifacts are not static! Even though I should be viewing a "screenshot" of the current frame-buffer, the artifacts are still dynamic and moving around like noise on an old TV.
Multiplying the final result of the GodRay directly influences the amount of artifacts. If multiplied by zero, they no longer appear.
The seam between the two triangles of the full-screen quad can be seen running from the top left to the bottom right.
I have up to date Drivers. Version 347.52 on the NVS 5400M. I have also tried 347.25, but there was no difference.
OpenGL is not generating any errors
I am using an OpenGL 4.5 Core profile
I have never had any graphical issues in other programs running on my laptop.

Fragment Shader

#version 450 core
#define NUM_SAMPLES 128

uniform float Exposure;
uniform float Decay;
uniform float Density;
uniform float Weight;
uniform vec2 LightPositionOnScreen;
uniform sampler2D uTex;

in vec2 texcoord;

out vec3 outColor;

void main()
{
    vec2 texCoord = texcoord;
    vec2 deltaTextCoord = LightPositionOnScreen - texcoord;
    deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * Density;

    float illuminationDecay = 1.0;

    for (int i = 0; i < NUM_SAMPLES; i++)
    {
        texCoord += deltaTextCoord;
        vec3 tap = texture(uTex, texCoord).rgb;
        tap *= illuminationDecay * Weight;

        outColor += tap;

        illuminationDecay *= Decay;
    }

    outColor *= Exposure;
}

Thanks for taking the time to read my post! I will update if the source of the issue is found.

Edit:
Issue solved by: chipgw

Initializing outColor to vec3(0.0, 0.0, 0.0) before the loop removed the artifacts.

sentences:
Ogre3D particle effect causing error on iPhone 1) First I have added the Particle Folder from the Ogre SDK (contains Smoke.particle).

2) Added the Smoke.material And smoke.png and smokecolors.ong.

3) After this I added the Plugin = Plugin_ParticleFX in the plugins.cfg.

Here is my code:

#Defines plugins to load

# Define plugin folder
PluginFolder=./

# Define plugins
Plugin=RenderSystem_GL
Plugin=Plugin_ParticleFX

4) I have added the particle path in the resources.cfg (adding the particle file in this causes the crash):

#Resource locations to be added to the 'bootstrap' path
# This also contains the minimum you need to use the Ogre example framework
[Bootstrap]
Zip=media/packs/SdkTrays.zip

# Resource locations to be added to the default path
[General]
FileSystem=media/models
FileSystem=media/particle
FileSystem=media/materials/scripts
FileSystem=media/materials/textures
FileSystem=media/RTShaderLib
FileSystem=media/RTShaderLib/materials

Zip=media/packs/cubemap.zip
Zip=media/packs/cubemapsJS.zip
Zip=media/packs/skybox.zip

6) Finally I did all the settings, my code is here:

mPivotNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode();  // create a pivot node

// create a child node and attach an ogre head and some smoke to it
Ogre::SceneNode* headNode = mPivotNode->createChildSceneNode(Ogre::Vector3(100, 0, 0));
headNode->attachObject(OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity("Head", "ogrehead.mesh"));
headNode->attachObject(OgreFramework::getSingletonPtr()->m_pSceneMgr->createParticleSystem("Smoke", "Examples/Smoke"));

7) I run this and got the error below:

An exception has occurred: OGRE EXCEPTION(2:InvalidParametersException): Cannot find requested emitter type. in ParticleSystemManager::_createEmitter at /Users/davidrogers/Documents/Ogre/ogre-v1-7/OgreMain/src/OgreParticleSystemManager.cpp (line 353)

8) Getting crash at:

(void)renderOneFrame:(id)sender
{
    if(!OgreFramework::getSingletonPtr()->isOgreToBeShutDown() &&
       Ogre::Root::getSingletonPtr() && Ogre::Root::getSingleton().isInitialised())
    {
      if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isActive())
      {
         mStartTime = OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
//( getting crash here)

Does anyone know what could be causing this?

sentences:
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:
Array of script class references in inspector I'm trying to remove the Reflection part of one of my scripts so it works in WebGL, however I am having some trouble.

Basically I need a way to store references to classes in an Inspector array so that I can then use AddComponent() to add them to an object I spawn.

The code I'm using uses arrays to hold different types of AI modules and then chooses a random set of modules and add them to an base enemy prefab. Previously I was using Reflection to create the array and add the modules but that doesn't seem to work in WebGL. Currently the modules are Monobehaviours but it is possible for me to make them normal classes.

sentences:
ScaleX and Y for stretching MovieClip I'm developing a game, and the game has a shop.  In that shop there is an option for a house expansion.  This is a movieclip that I want the user to be able to spend their coins to increase their house in the following ways:

-> stretch house to right <- stretch house to left ^ stretch house upward v stretch house downward.

The thing is, I've been thinking of using ScaleX and ScaleY to accomplish this.  The only problem:  It stretches the left and right, I can't make it do one.  I'm sure there is a way to do this, but I haven't yet figured it out.  Any ideas?

sentences:
Display loading screen after scene change but wait for coroutine to finish I thought I'd understood how coroutines work but I'm still experiencing problems getting them to run when I want them to run:

There are two scenes in my game: The main menu one and a game one.
The main menu consists of a couple of buttons that let you choose a txt file and if you click on one of them, the "game" scene is loaded (SceneManager.LoadScene("Game");), which first thing reads the chosen txt file from HDD. Afterwards there's some other stuff that has to be finished (FinishRest()) but it's pretty quick anyway.

I want to display a loading screen while it's reading the file (no need to update it), which can take a while. Clicking on the button freezes the game in the main menu while the txt file is being read and it never displays the loading screen. That's why I put the actual reading part inside a coroutine and start it as soon as the "game" scene is loaded:

//In SciptA (derives from MonoBehaviour, is on the main camera)
void Awake() {
    loadingOperationReadTxt = StartCoroutine(ClassB.ReadTxtCoroutine());
    FinishRest();
}

//In ClassB (derives from ScriptableObject)
public IEnumerator ReadTxtCoroutine() {
    loadingPanel.SetActive(true);
    loadingPanel.GetComponentInChildren<Text>().text = "Reading txt file...";
    output = ClassC.ReadTXT(); //ClassC derives from nothing
    loadingPanel.SetActive(false);
    yield return null;
}

The problem is that it never displays the loading screen like this (I'm guessing because I don't let it tick until after I'm already done), so I tried to fix it by putting another yield return null; right before output = ClassC.ReadTXT();. Now it does display the loading screen but skips the rest of the coroutine and goes right to FinishRest(), which fails, of course, because it's missing the data from the txt file.

I want to display a loading screen but I also have to wait for the coroutine to finish before actually calling FinishRest() (I miss Tasks...). How can I accomplish this?

sentences:
Terrain collision with sphere and OBB I'm implementing my physics engine for my 3D game. So far I've been able to implement collision detection between OBB, spheres and planes. The engine generate contacts and resolve them with an iterative impulse-based approach.

The result is this (so far).

Now I need to detect and generate contacts between a height map terrain and those bounding volumes (sphere and OBB). The terrain looks like this:

I don't know how to do it. I need to detect collisions and generate contact data (contact point, contact normal and interpenetration to feed my existing engine).
I know I can't use a SAT because the terrain in not convex. What about ad hoc code for boxes and spheres? or is there a general approach?

EDIT

I narrowed down my problem to detecting (and resolving) collisions between a simple convex collidable (sphere/OBB) and triangles (always convex). Since the terrain is stored as an height map I can easily select a subset of triangles to run the algorithm against. I can use the SAT to detect interpenetrations. But what about collision response? How can I generate the necessary contact data (collision point and collision normal) to resolve the collision?

sentences: Was there any equivalent of glVertex3f in Direct3D? I know that OpenGL's Vertex3f is a bit old but I can't find any information about suitable equivalent for that function that was used in DirectX. Was there any equivalent in DX?

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:
Computing pixel's screen position in a vertex shader: right or wrong? I am building a deferred rendering engine and I have a question. The article I took the sample code from suggested computing screen position of the pixel as follows:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition = output.Position;
}

PixelShaderFunction()
{
    input.ScreenPosition.xy /= input.ScreenPosition.w;
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

The question is what if I compute the position in the vertex shader (which should optimize the performance as VSF is launched significantly less number of times than PSF) would I get the per-vertex lighting insted. Here is how I want to do this:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition.xy = output.Position / output.Position.w;
}

PixelShaderFunction()
{
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

What exactly happens with the data I pass from VS to PS? How exactly is it interpolated? Will it give me the right per-pixel result in this case? I tried launching the game both ways and saw no visual difference. Is my assumption right?

Thanks.

P.S. I am optimizing the point light shader, so I actually pass a sphere geometry into the VS.

Solution:

struct PSInput
{
    float2 vPos : VPOS;
};

PixelShaderFunction(PSInput input)
{
    float2 ScrPos = input.vPos*halfPixel*2;

        //The correct Screen Space Texture Coordinates.
    float2 TexCoord = ScrPos + halfPixel;

    //Bonus: getting the world position.
    ScrPos = ScrPos*2 - 1;
    ScrPos = float2(ScrPos.x, -ScrPos.y);

    float4 position;
    position.xy = ScrPos;
    position.z = depthVal; // Read from the depth map.
    position.w = 1.0f;

    position = mul(position, InvertViewProjection);
    position /= position.w;
}

sentences:
How can I make that when the first animation end the next animation will start but from the same position? I have two animations.
The first animation I downloaded from the Mixamo site.  The game start when the player is on his back on the ground and then slowly stand up. When the animation end the player is standing : Look at the player legs :

Then it's starting playing the next animation idle animation : Look at the player legs now when the idle animation start :

There is no problems with the animations.  It's just when the first animation end the player legs move close to each other because the legs position in the start of the second animation is not the same position when the first animation end.
I need somehow to make if it's possible that the first animation legs will end at the position of the second animation start. Now the legs are moving to each other and it looks funny. If I was showing a gameplay you will see the legs moving to each other like the player is closing his legs.
This screenshot is of the Animator controller where the left New State is the first animation and the Grounded is a blend tree with the idle animation inside :

And this is a screenshot of the blend tree and the first top state is the idle animation :

The transition between the two animations looks bad/funny. The player is closing his legs. Instead I wish there was a way to make the first animation to end with the legs close like in the second animation start.

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

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

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

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

I think theres two paths to go down:

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

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

Question about each path:

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

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

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

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

sentences:
How do I stop clicks on a button from also triggering my gameplay scripts? My character jumps when I press the right side of screen. The pause button is alsp in the top right corner. So when I press that button, the right side script always triggers and I don't want that to happen.

Here the script :
 if (Input.GetMouseButtonDown(0))
            {
                float xPosition = Input.mousePosition.x;

                if (xPosition > Screen.width / 2 && isGrounded && !isJump)
                {
                    // mouse is on the right part of the screen, shoot right

                    rb2d.velocity = new Vector3(0, jumpForce, 0);

                    isJump = true;

                    JumpSoundSfx();
                }
            }

            if (Input.GetMouseButton(0))
            {
                float xPosition = Input.mousePosition.x;

                if (xPosition < Screen.width / 2 && !isJump)
                {
                    // mouse is on the left part of the screen, so shoot to the left

                    crouch.SetActive(true);

                    stand.SetActive(false);
                }
            }
```

sentences:
rotating an array of images in 90 degree-java In my java game,I have a stickSprite in vertical position.I want to rotate this stick in 90 degrees.so that it can hit the floor,once I press a key.
I used a an array of stick sprites to create a large stick.Why I am doing this because I want to increase the stick length differently at different times.

I am using this method to rotate the stick image:

public Image rotateImage(Image src, float angle) {

    int sw = src.getWidth();
    int sh = src.getHeight();
    int[] srcData = new int[sw * sh];

    src.getRGB(srcData, 0, sw, 0, 0, sw, sh);
    int[] dstData = new int[sw * sh];

    double rads = angle * Math.PI / 180.f;
    float sa = (float) Math.sin(rads);
    float ca = (float) Math.cos(rads);
    int isa = (int) (256 * sa);
    int ica = (int) (256 * ca);

    int my = -(sh >> 1);
    for (int i = 0; i < sh; i++) {
        int wpos = i * sw;

        int xacc = my * isa - (sw >> 1) * ica + ((sw >> 1) << 8);
        int yacc = my * ica + (sw >> 1) * isa + ((sh >> 1) << 8);

        for (int j = 0; j < sw; j++) {
            int srcx = (xacc >> 8);
            int srcy = (yacc >> 8);

            if (srcx < 0)
                srcx = 0;
            if (srcy < 0)
                srcy = 0;
            if (srcx > sw - 1)
                srcx = sw - 1;
            if (srcy > sh - 1)
                srcy = sh - 1;

            dstData[wpos++] = srcData[srcx + srcy * sw];

            xacc += ica;
            yacc -= isa;
        }
        my++;
    }

    return Image.createRGBImage(dstData, sw, sh, true);
}

and rotating the single stick(that is not an element of the array.Stick array elements are placed above this base stick.)like this.It worked well.

private void RotateBaseStick() {

    if (smashBool &&angleValue<90) {
        angleValue = angleValue + stickMovingSpeed;
        rotatedImage = rotateImage(stickImage, angleValue);
        stickSprite.setImage(rotatedImage, rotatedImage.getWidth(),
                rotatedImage.getHeight());

    }
    if (angleValue >= 90) {
        smashBool = false;
    }

    }

I am wondering how can I rotate the entire stickArray efficiently to make the feel of a long single stick hitting the ground?
Please help me.

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:
Storing large array of tiles, but allowing easy access to data I've been thinking about this for a while. I have a 2D tile bases platformer in XNA with a large array of tile data, I've been running into memory problems with large maps. (I will add chunks soon!)

Currently, Each tile contains an Item along with other properties like how its rotated, if it has forground / background, etc.

An Item is static and has properties like the name, tooltip, type of item, how much light it emits, the collision it does to player, etc. Examples:

public class Item
{
    public static List<Item> Items;

    public Collision blockCollisionType;
    public string nameOfItem;
    public bool someOtherVariable,etc,etc

    public static Item Air
    public static Item Stone;
    public static Item Dirt;
    static Item()
    {
       Items = new List<Item>()
       {
            (Stone = new Item()
            {
                nameOfItem = "Stone",
                blockCollisionType = Collision.Solid,
            }),
            (Air = new Item()
            {
                nameOfItem = "Air",
                blockCollisionType = Collision.Passable,
            }),

        };
    }
}

Would be an Item, The array of Tiles would contain a Tile for each point,

public class Tile
{
     public Item item; //What type it is
     public bool onBackground;
     public int someOtherVariables,etc,etc
}

Now, Most would probably use an enum, or a form of ID to identify blocks. Well my system is really nice just to find out about an item. I can simply do tiles[x,y].item.Name To get the name for example. I realized my Item property of the tile is over 1000 Bytes! Wow! What I'm looking for is a way to use an ID (Int or byte depending on how many items) instead of an Item but still have a method for retreiving data about the type of item a tile contains.

sentences:
Implementing a resource bar with LibGdx I am developing my first LibGdx game, and I would like some help understanding Scene2D/Ui.

So far I understand a "Stage" contains the various UI elements, and a "Table" contains the layout; an input processor can be assigned to buttons and stuff to define what they will do.

What I don't really understand clearly so far is how to utilise tables and skins, and if I'm doing this correctly.

So far I have a MainGameScreen class which extends Screen, and renders a Tiled map.

I want to render the UI on top of it, I have defined a Stage, a Table and a Skin, as well as a button; here are my relevant code snippets.

//declaration of stage, table, skin
public class MainGameScreen implements Screen, InputProcessor{
    ...
    private Stage stage;
    private Table table;
    private Skin skin;
}

//class constructor
public MainGameScreen(final MyGame game){
   ...
   stage = new Stage(new ScreenViewport());
   table = new Table();
   skin = new Skin(Gdx.files.internal("uiskin.json"));
   table.setFillParent(true);
   stage.addActor(table);
   button = new TextButton("TEST BUTTON", skin, "default");
   button.setWidth(200);
   button.setHeight(50);
   stage.addActor(button);

//Screen render function
public void render(float delta) {
    ...
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
}

It works, the Tiled map gets rendered, a button appears on the bottom left.

Now, please take a look at this Warcraft 2 screenshot: http://en.war2.ru/wp-content/uploads/2015/03/screenshot-14.png

I'd like to implement a top bar similiar to that, meaning "Menu" "Pause" buttons as well as rendering an icon + value for each resource (variable) at the top of the screen.

I understand that I'd have to use the Image widget for the icons, Label for text and Button for Menu and Pause, but I don't get how to lay them out properly using a Table and ensuring scaling.

I'd be grateful if someone could provide a simple implementation, or point me on the right direction.

sentences:
How to choose what to use in Java: Enums or Objects? I'm in a dilemma over using Enum Types or using class objects in that particular part of my java project.

Let's suppose I have an array where I constantly add and remove things from it, but I also render textures from that array via accessing the texture with an enum type from its class like:

public static Texture requestTexture(Type type){
    if(type == Type.One){
        return textureOne;
    }
}

// can be improved with hashmap

I wonder if I can use classes instead of enums? Will it slow down my performance since I will be constantly creating new objects and deleting them since they leave the stack, but on the other hand, it will be more cleaner and structured code?

sentences:
How I can advertise my browser game I developed a browser-based game. It's a Multiplayer Business Strategy Game. Currently I am unable to find a place where I can advertise my game. My main requirements are :

I can only pay via Credit Card. No Paypal. Just tell me which ad company accepts credit cards.
I also have quite a limited budget.

Also, I want to know is their is any rating / review website for my type of game?

sentences:
How can I protect my save data from casual hacking? What options are there for saving game data in a secure manner? I'm interested in solutions specifically tailored for C++.

I'm looking for something that is fast and easy to use. I'm only concerned about storing simple information such as

Which levels are and are not unlocked
The user's score for each level

I'm curious again to know what's out there to use, any good libraries to use that give me nice, secure game data files that the average player can't mess with.

I just found this here which looks very nice, but it would be great to get some opinions on potential other libraries/options out there.

sentences:
How To Fix Strange White Edges With DOF and Fog in Unity? I'm using global fog and the standard assets Depth Of Field script but it has a strange effect on the edges of far away objects.

How can I make the white edges along the trees blend smoothly into the fog?

sentences:
How to detect the device type in UnrealScript? How can I recognize if the player device is an iPad or an iPhone?

Now I can do it by checking the viewport size. But I think is just a tricky way, is there any other, more standard way?

sentences:
Spherical harmonics lighting interpolation I want to use hardware filtering to smooth out colors in texels of a texture when I'm accessing texels at coordinates that are not directly at the center of the texel, the catch being that the texels store 2 bands of spherical harmonics coefficients (=4 coefficients), not RGBA intensity values.

Can I just use hardware filtering like that (GL_LINEAR with and without mip mapping) without any considerations?

In other terms: If I were to first convert the coefficients back to intensity representations, than manually interpolate between two intensities, would the resulting intensity be the same as if I interpolated between the coefficient vectors directly and then converted the interpolated result to intensities?

sentences:
How to use TextureArray's Pre-OpenGL 4.2? I've been using TextureArray's in my current Project; However, I have come to the problem of OpenGL 4.2 functions not being on the present Mac software when ported over. Due to only version 4.1 of OpenGL being supported.

All my problems stem from the single function. glTexStorage3D which is the only function not supported.

This is how it currently works on my OpenGL 4.2 capable machine. (and works wonderfully I might add.)

1.) I allocate the memory beforehand with glTexStorage3D.

glGenTextures(1, &_texture);
glBindTexture(GL_TEXTURE_2D_ARRAY, _texture);
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 255, GL_RGBA8, 16, 16, _maxLayerCount);

2.) Then per image I would load it into the before allocated memory block with the following.

glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, _layerCount, 16, 16, 1, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr());

3.) Success.

How would I go about mimicking this functionality pre OpenGL 4.2 without using Immutable Storage? Aka (glTexStorage3D).

I've tried stuffing all my images into a horizontal single image and then loading that into just glTexImage3D with no success. Am I missing something?

Additional Note: I prefer to use TextureArray's for my project in order to avoid rendering artifacts I had using a TextureAtlas. It's simplicity during shaders is also a big plus.

sentences:
Are commercial javascript games sensible? So I love javascript as a language and how it is able to be run anywhere. I'm gonna enumerate my concerns:

Does it make sense to make money from javascript? I mean, the second I publish my game online, people can download it, and post it on their own site and put their own ads into the game.
There are rumors that Facebook is working on an HTML5 platform. Still, even if you require the use of secret keys with your online part of the game, people can still just download the source code and implement their own online version. It's a little inconvenient, but the game itself didn't lose any value. They just need to build their own community now - which should be easy with a great game.
I don't have a smartphone, can someone explain if it's possible to view the source if I publish my game as a javascript application? (maybe it's wrapped into native code by the marketplace, I would appreciate the information)

I know Flash is somewhat similar, but it's my understanding that good obfuscators can effectively make the source code so ugly that it would be a mountain of work to modify.
Native games can be cracked too of course, but that doesn't mean they have the source code. They'll still rely on my online part and my updates to the game.

Tell me I'm not paranoid :)
How can someone justify spending resources on a javascript game?

sentences:
Too many neighbors when pathfinding in Sparse Voxel Octree Imagine we have upto 9 or so layers (that is depth), and due to some big colliding platform in the level, one of the empty nodes close to the root have all much smaller nodes as neighbors at one of its faces. If my calculations are not wrong, in the worst case scenario the number of neighbors on a face would be equal to power(2, absolute(depthA - depthB) * 2). For example, power(2, absolute(8 - 2) * 2) = 4096 little neighbors in direction of only one of the faces of the bigger node.

I'm implementing a linear tree (just saving all location codes in a set). I know how to find neighbors. I have no idea how to deal with high number of neighbors in cases like this when running A*. Both, finding all neighbors and iterating over all of them would take too much time.

I have taken a look at the GDC "Getting of the NavMesh by Daniel Brewer", but their example for neighbors of different sizes was only for difference of 1, which would return only 4 neighbors per face.

sentences:
Solve Constraints with linear factor of 0 in Bullet Physics In my code I need to set the linear factor for velocity to 0 (sometimes). For example, game->rigidBody->setLinearFactor(btVector3(0, 0, 0)); When this is done, collision detection continues to work, however, collision response fails to work. Essentially running as if there were not colliders at all. I think this is because it applies a velocity to solve the constraints.

Is there an alternative to setLinearFactor or is there another Constraint Solver which does not rely on velocity?

I am using the default btSequentialImpulseConstraintSolver();

sentences:
Libgdx if statement is not working well I am trying to make the player die when it hits the rock or the time is up and the score is not reached, in this code at the first if statement it works when  Rockhit is true, the player jump and disappear at the bottom of screen and the music is work very well, but when the time is 0 and score is not reached , the player is jump and keeps going out of the top of screen and the sound is work but slow and not clear. (notice: that before I adding the Rockhit condition the player was going up out of screen and the voice wasn't clear)
this is the code:

  public State getState()
        {
            //Gdx.app.log(Float.toString(b2body.getLinearVelocity().x),"hi");
            if ((Hud.getTime()==0&& Hud.getScore()<(level*15)+50)|| Rockhit()) {
                Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
                collectoIsDead=true;
                Filter filter = new Filter();
                filter.maskBits = Fruits.NOTHING_BIT;
                for (Fixture fixture : b2body.getFixtureList())
                    fixture.setFilterData(filter);
                b2body.applyLinearImpulse(new Vector2(0, 5f), b2body.getWorldCenter(), true);
                //b2body.applyLinearImpulse(new Vector2(0,-2.5f), b2body.getWorldCenter(), true);
                Fruits.manager.get("music/fail.mp3", Sound.class).play();
                return State.DEAD;

            }

            if((Hud.getTime()==0&& Hud.getScore()>=(level*18)+50)|| (Hud.getScore()>=(level*15)+50)) {
                Fruits.manager.get("music/Backmusic.ogg", Music.class).stop();
                Fruits.manager.get("music/cheering.mp3", Sound.class).play();
                return State.SUCCESS;
            }
            if (b2body.getLinearVelocity().x!=0)
                return State.RUNNING;
            else
                return State.STANDING;

}

sentences:
Positioning 2D (non-UI system) game objects As an old Flash dev I'm slightly confused about how you position game objects on the screen in Unity since game objects have no width or height (only a scale).

Let's say I have a container gameobject that has several child game objects with sprite renderers representing tiles on them. If I set the container to x0, y0, the whole tile layout will extend from the screen center upwards and to the right.

What are the commonly used ways to position the game object so that it would be centered on the screen? I could calculate the width/height of my container but that would still not be very useful because the x/y coordinates work in a different scale than pixel (right?). E.g. my test screen is 640x1024 and to center my container (while running in the editor) I'd have to set x/y to -4.5. How does that make any sense?

Of course Unity's UI system would be a solution but I don't want to create the playfield with the UI system.

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:
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:
Why do separate loops run faster than one loop that does multiple things? My game had some lag, so I tried to improve the performance.

I found that if I write my loops separately like this:

for (...){
    for (...){
        // Do operation A
        // (Fill int[][] with 1s)
    }
}

for (...){
    for (...){
        // Do operation B
        // (Work with Sprite Renderers & Spritebatch)
    }
}

for (...){
    for (...){
        // Do operation C
        // (Work with Shape Renderers with alpha)
    }
}

then the result runs a whole lot faster than if I try to do all the operations in one loop:

for (...){
    for (...){
        // Do operation A
        // Do operation B
        // Do operation C
    }
}

Can anyone explain this?

I'm running this game on Android OS!

sentences:
how could RTT be so slow on my intel card? I simply draw something into a render target, and use it as an normal texture. It's always working greate to me with my nvidia video card. But today I found my program ran terribly slow (less than 5 fps) on a intel card.

After running an analyse I found glGenerateMipmapEXT is the trouble maker, it costs most of the cpu time. Here's how I bind a RT texture:

  glBindTexture(GL_TEXTURE_2D, m_textureID);<br>
  glGenerateMipmapEXT(GL_TEXTURE_2D);

without glGenerateMipmapEXT the texture is nothing but pure white pic. Something wrong with my RTT?

sentences:
Resolution independence (for touch input on different mobile screens) I have drag mechanic in Unity game and I want to have same experience in all devices. I've done this before in another game engine and now that Unity gives us Dpi with Screen.DPI, it should be much easier to achieve, but I can't figure it out for the love of the god.

My theory is you have to divide the delta movement of touch with Screen.Dpi to normalize the movement and make it same across devices with different screen sizes and dpi's:

(touch0.deltaPosition.x / dpi) * SENSITIVITY * Time.deltaTime;

But this doesn't work. Would someone please tell me why?

I've done extensive search on this but surprisingly nothing much can be found.

Thanks in advance and regards.

sentences:
Making a sales curve over time from a static baseline figure I am making a game where there are objects that will be for sale.  The objects have a reputation score, which is the amount of sales they get each week.  This is calculated up front and remains the same for the entire release period.  The release period is also created up front and represents a period of time in weeks.

In my example Object#1 has a sales score of 10,000 and a release period 8 weeks.  This means it will sell 80,000 copies at 10k/week.

My aim is to take this flat line, and curve it, so it has rising sales at the start, a smoothed peak of sales in the middle, and lower sales at the end tailing off, like a gamma probability distribution curve.  The total sales across the period will be the 80,000, but the distribution of weekly sales will change.

I am looking to create this distribution shape from the flat sales total.  I'd ideally like to keep the sales volume the same, but as long as I have that curve, it doesn't matter too much.  I have looked at the Wikipedia entries etc, but they are all about the maths side of distribution, and calculating distribution from figures, I am just looking to fake that distribution from a median figure.

The idea is once I have this algorithm (or a good tutorial), I can play with it to create other unique distributions, adding variety to object releases, to help make things feel less procedural.

(Any help with improving title and tags greatly appreciated).

Edit -----

I realised I missed out a chunk about looking for help with the programming.  I have read a lot of math algorithms but converting what I am learning into code is proving more difficult.  Ideally I'd like links/references to solutions for this from a C# perspective, to help me see my way past issues like the one below.

I have a function in math:
    BetaCDF(x,a,b) = (x>=1)?1:(x<=0)?0:sum[k=1:b] ( Gamma(a+k-1)/(Gamma(a)*Gamma(k)) * xa * (1-x)(k-1) )

that i am trying to convert into a function.  I have everything covered except for the sum.  I need to sum b times the function on the right, however I cannot figure out how to do this in Unity C#.  The function currently looks like this:

public static double BetaCDF(double x, double a, double b) {
    double k;
    return ((x >= 1) ? 1 : (x <= 0) ? 0 : Sum(k = 1,b )(Gamma(a + k - 1) / (Gamma(a) * Gamma(k)) * Math.Pow(x, a) * Math.Pow(1 - x, k - 1)));
}

sentences:
Use an image as mask only where pixels are opaque We are into a game where to build our tile map, we carve on an image with a mask (At first the whole map is an image, and we create holes on it with tiles to create the map and le the background show. It is like substracting instead of adding new tiles in any common tiled based game).

We have done this with just a tile that acts as a mask using stencil buffer. The problem comes when we want to mask with tiles where all their pixels are not opaque, for example a slope. The problem is that it applies the mask as if all the pixels in tile where opaque and we want to apply the mask in two differnet ways:

1) Keep the pixels of the big image where the mask pixels are opaque

2) Mask the pixels of the big image where the mask pixels are transparent (alpha==0)

I have read a lot of info about using stencil and alpha blending but can't make it work. Checking the pipeline order it seems that stencil is applied after the fragment color has been calculated. Is it possible to access the alpha value at stencil stage and write to the stencil as needed to just mask part of the image (tile in my case).

Update to add a visual example:

sentences:
C# Pathing algorithm for moving a object from point(X, Y) to point(X, Y) Given a object which may move forward, backward, left and right at a given X,Y point. How to efficiently direct the object to a X,Y point using the given movement mechanics in the most efficient and human natural way.

The object is available for movement in real time, you may tell them to "startMoving|Direction|()" and "stopMoving|Direction|()" to any heading of 360 degrees. Though as a additional twist and the part I am having trouble with, is the facing of the object is never known, only its current location is known, so the algorithm must "detect" direction. The location of the object is updated in a separate thread in 500-1second intervals. A "Request" to update the location within the algorithm made be made at any point, but it is not immediately available and the algorithm must keep that in consideration. Doing something like requestAndWaitForCoordUpdate() is perfectly acceptable, however likely not needed.

In addition, no obstacles appear, it can be assumed you are on a MOSTLY open plane, stray to far from the direct straight line between the paths and you may run into obstacles. It is safe to assume that 1/4th the distance between a target and source, should be available in width on a given direct path.

I would also mention I am not sure A* applys in this scenario, if it does I am unsure how to implement it given the constraints. The only real variable here is the facing of the object.

Here is some example code:

public int[] currentCoords;
public void movement() {
  currentCoords[0] = 1005; // starting y coord
  currentCoords[1] = 1007; // starting x coord
  moveTo(1050, 1025);
}

public void moveTo(int x, int y) {
  ... how?
}

public void threadUpdatingCoords() {
   ... periodically check for source coord updates
   ... between 200ms and 1000ms apart.
}

sentences: How to use mocaps in your game if they don't loop smoothly? Following suggestions on IRC, I've downloaded, parsed and incorporated the Free Release of 2500 mocaps to my game. I've noticed, though, that none of those loop perfectly. It does not connect and thus won't form proper walking/jumping/etc cycles. So how I'm supposed to use them in my game? Is there a tool or some trick to solve that problem I'm not aware of?

sentences:
How do I load tmx files with Slick2d? I just started using Slick2D and learned how simple it is to load in a tilemap and display it. I tried atleast a dozen different tmx files from numerous examples to see if it was the actual file that was corrupted. Everytime I get this error:

Exception in thread "main" java.lang.RuntimeException: Resource not found: data/maps/desert.tmx
    at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:101)
    at game.Game.init(Game.java:17)
    at game.Tunneler.initStatesList(Tunneler.java:37)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:164)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
    at game.Tunneler.main(Tunneler.java:29)

Here is my Game class:

package game;
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;
import org.newdawn.slick.tiled.TiledMap;

public class Game extends BasicGameState{
    private int stateID = -1;
    private TiledMap map = null;

    public Game(int stateID){
        this.stateID = stateID;
    }
    public void init(GameContainer container, StateBasedGame game) throws SlickException{
        map = new TiledMap("data/maps/desert.tmx","maps");//ERROR
    }
    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException{
        //map.render(0,0);
    }
    public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException{
    }

    public int getID(){return stateID;}
}

I've tried to see if anyone else has had similar problems but haven't turned up anything. I am able to load other files, so I don't believe it's a compiler issue. My menu class can load images and display them just fine. Also, the filepath is correct.

Please let me know if you have any pointers that might help me sort this out.

sentences:
Is there a tool to automatically pack individual textures into one big png? I'm currently was working on a texture pack for minecraft (but this question is not restricted to that). All terrain textures are squared and stored in one big terrain.png. (FYI that's from Glimmar's Steampunk pack). I'd like to store each texture in an individual file and have same automated process pack them into the terrain.png later on (maybe leaving the not yet created ones their default). At the moment I do this manually by copy/pasting them with gimp (at least the raster helps a lot here) but I'd really like to do this automatically. Basically this seems to be what happens behind the scenes of the Painterly pack customizer already. So,

  Is there a tool that replaces some squarespolygons* in a png file with new ones (also png), the position of which might be configured in a separate file?

edit Some automated resizing for different resolution versions might be nice as well...

edit2 Meanwhile I learned that "position [...] configured in a separate file" means atlas, and since the question originated from Minecraft texture packs (IIRC the format got changed meanwhile), the ideal tool would allow for using an existing atlas to replace some of the tiles

*) might as well ask the general case

sentences: MonoGame WP custom vertex decleration How do I go about implementing and using a custom vertex deceleration in monogame for windows phone 8. I want to be able to store a position, a colour and a normal?

sentences:
Do I need a server if I only want to upload data to a DB? I'm currently creating a game where people get some kind of reports for their game performance on a website. Let's say, you log-in, play the game, the system gathers your performance data and this is being sent to a database so that it can be read and interpreted by an external website later. For this, I'm using a firebase real-time database and it's working fine by now.

I'm pretty noob with unity and I have read and watch tutorials on the internet where people actually create a server to achieve this but do I really need a server when the only thing I need to do is to post data to a database based on users?
This isn't really a multiplayer game, but there is some kind of information which is shared for example sometimes I need to get those data in order to get high scores and that kind of small information, but that's it.

I'm using unity webgl and firebase for the moment, and everything is working fine, but then why people always create a server for this?

PS: sorry for my bad english

sentences:
Locust Swarm algorithm for path finding (devour and move on) I need to model a locust swarm that devour food stacks and move on to next stacks. I searched for articles and found few articles. These papers is about optimization applications but I want to convert it to a path finding algorithm to reach multiple targets (like randomly seeded many food stack). Swarm should split when food stack is not enough to feed them( multiple objective problem). How can I do this?

x: position
v: velocity vector

sentences:
Action button: only true once per press I'm using SFML2.0 and am trying to make a wrapper class for my controller/joystick.
I read all the input data from my controller and send it off to my controllable object.

I want to have two types of buttons per button press, one that is continues(true false state ) and one that is an action and is set to false after the next frame update.

Here is an example of how I set my button A to true or false with the SFML api.
Whereas data is my struct of buttons, and A holds my true/false state every update.

data.A = sf::Joystick::isButtonPressed(i,st::input::A);

But I've also added "data.actionA" which represents the one time action state.

Basically what I want is for actionA to be set false after the update its been set to true. I'm trying to keep track of the previous state. But I seem to fall into this loop where it toggles between true and false every update.

Anyone an idea?

sentences:
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:
nodejs game server timer I'm new to game server develop.
I'm developing a card game server.
How could I make nodejs server wait for few seconds then push data to client after an event fired ?
Example : in poker game, one player have about 20 seconds to make a move, after 20 seconds server will auto fold and then push a message to another player. How could I make server wait for 20 seconds and then do next action ?

sentences: Moving lights or scene objects in Unity seems to cause a second point light to shrink or dim Moving a Point Light in 2d space seems to be dimming lights around it. What is this and how can I solve it?

sentences: Looking for good comunication schema in turn-based game with multiple players based coop game that will need to communicate to the server to handle the game process. Basically I need to be able to invite to the game, progress through turns (one player at a time) and finish in win or loss. Also players could drop off from the game and the game should continue. Is there a known basic schema for this or a set of standards?

sentences:
Using glm to rotate the modelview matrix based on the cursor position I am rendering a 3D model of an object, and I want the user to be able to rotate around that object by dragging the mouse. To do this, I want to use the cursor position to continually update the modelview matrix.

To start with, my modelview matrix is:

1 0 0 0
0 1 0 0
0 0 1 -100
0 0 0 1

So the camera is looking at the origin of the object, and 100 units away from it. Let's say the mouse now moves onto the right-hand side of the screen. This means I want the camera to rotate around the object -- by 90 degrees, for example.

In order to compute the new modelview matrix, I take the identity matrix, rotate it by 90 degrees, and then move away from the object along the camera's z-axis by using glm::translate().

However, the problem I am having is that glm::translate() seems to move the matrix with respect to the world coordinate system, not the camera coordinate system. Therefore, "moving away from the object along the camera's z-axis" does not hold, because the z-axes of the world and camera coordinate systems are no longer aligned after the rotation.

Please could somebody explain how I should be achieving this?

Thank you :)

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 to dynamically construct a reference to a game object by name I have game objects tagged MenuOption0, MenuOption1, MenuOption2, etc. I want to keep a currentIndex var, which gets incremented each time the user swipes on the controller. That swipe should increment the currentIndex var, and switch the reference to a new game object, whose text color will be changed.

This is what I'm trying as a test:

GameObject testText = GameObject.Find("MenuOption" + 4);
TextMeshProUGUI thisTextMesh = testText.GetComponent<TextMeshProUGUI>();
thisTextMesh.color = colorWhite;

How do I dynamically construct a reference to MenuOption1,2,3,4,etc? Or is there a better way to handle this without writing a big long conditional?

sentences:
Storing object position and rotation I only superficially understand the idea and I can't find any thorough explanation (partially because I can't find very good keywords to Google - English is not my first language):

Although I partially understand some things (next paragraph), my question is what data structure would you use to store a body's position and rotation and how does everything come together? I want to be able to translate that object to a (x, y) position, rotate it about the origin or about its centre (then fetch these things and draw a sprite using that position and rotation). Very similar to Unity's Transform object.

From my understanding I will need (at least) a 2/3-dimensional vector and a quaternion and then I should be able to generate a model matrix from them. How? Multiply what to what and in what order? I certainly have no idea how to get a 4 x 4 matrix from a 2/3-dimensional vector and a quaternion. Then if I change the position, I should probably update the model matrix again.

I'm using OpenGL ES 2 on Android, but I wouldn't mind an agnostic answer.

sentences: How forward rendering done using OpenGL? Recently I come across the term forward rendering. I'm kind of curious how this could be done in OpenGL. I have done a lot of search on this, majority of the result I get are on theory but not code implementation. May I know is there any code implementation on OpenGL for this rendering technique?

sentences:
Difference between unity scripting backend IL2CPP and Mono2x IL2CPP is a Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. Note - IL2CPP is only available when building for the following platforms:

Android AppleTV, iOS*, Nintendo 3DS, Nintendo Switch, Playstation 4
Playstation Vita, WebGL* ,Windows Store, Xbox One

I have a project(unity 5.2) which has switched for Android deployment. I tried to switch my scripting backed from Mono2x to IL2CPP and its showing me that

  IL2CPP on Andriod is experimental and unsupported

So, my simple question is that if it is still not supported then why the option has included, what is the fundamental difference between IL2CPP and Mono2x. Why I switched to IL2CPP scripting backend ? what are its pros and cons?

I have also checked in unity 5.5.2 there is not IL2CPP option in windows platform deployment.

sentences:
Unity Inspector Not Showing Serialized Variables Of Child So I'm new to using Serialaiziblewtfever(I just cannot remember the correct spelling). In the Unity editor it works fine if I have something like:

[System.Seriliabizblewtfever]
Public class BaseClass{
    public ChildClass showvariables;
}
[System.serializable]
Public class ChildClass{
    public float nipz;
}

With that I can see the variables "nipz" in the inspector when I click the drop-down arrow. However, I want ChildClass to be an actual child class so I can manipulate variables inherited from the parent. So if I change it to:

Public class ChildClass:BaseClass

It stops working. It doesn't matter what class the "BaseClass" is. In the inspector it shows me "showvariables", but then has the field like how you can drag objects, transforms, etc, but no drop down list of any variables. Is there something I'm missing?

sentences: NullReferenceException: Object reference not set to an instance of an object Hi so im displaying food, health an water on the screen in a text box by using UnityEngine.UI and making text variables. They are all defined in the update function so they will keep changing and are all defined one after another with nothing in between. it will only call the first one there and the others it gives me the error message above.

sentences:
how to close lua file call luaL_dofile? i created tool that generate lua script on each level which contain lot function, and they named based on the object+id format. ex : trigger1(), etc; so every level may have same function name, what i need is call luaL_dofile on beginning level load.(+ registration ofcourse)

on game every level load i call do_file this lua script, so i can call it in the code. the thing is, when i try to change level to another level, i dont want close entire lua state and do rereigistration / initialization ,i just want close previous luaL_dofile and change it with new luaL_dofile on the next lua level script. since i want instaneous transition each level.

can anyone help me on this ?

sentences:
Algorithm for sensing mouse movements like a wiimote I want to make a driving game where you can do tricks with your mouse when you hold down LMB. Ex. if you move it up in a straight line really fast (your cursor goes from the bottom to the top of the screen in, say, 0.1s),  your bike will do a flip. If you do a quick circular movement, your bike will spin. Essentially, drawing a shape onto the screen = performing a move.
How would this be sensed? Currently, I can only think of having shapes defined by coordinates relative to some starting position (it would be some function taking in your mouse down coords), and within a certain time frame, every update loop will check to see if the current mouse coordinate pair is between the current preset one and the next preset one (and within a margin of error). To know which shape to use, you'd loop through the shape list, see whether or not the mouse coord is invalid for the current shape, and knock it off the possibilities if true.
Example circle path:

X = Coordinate
Red arrows = Expected mouse movement path
Green = Margin of Error

Problems I can see with this algorithm right now:

If I have a lot of moves, then there are a lot of shapes to loop through every frame before the deduction process kicks in
It's not an optimal solution for doing consecutive moves in a short timespan, because the player would have to release LMB before pressing it down again for the system to sense that a new shape is starting
Tiny circles vs big circles, how wide the margin of error would need to be to allow for both, and how that would affect calculations (clashing with other shapes that have similar valid spaces)
What if you draw circles like flattened, diagonally skewed ovals, even when you're not trying to do it fast? It is indeed a circular motion, but maybe diagonally skewed ovals are for another move. Is it okay to just shun your artistic ability?
How much time will it take before the system recognizes that you're doing a specific move? Must a full circle be completed before any bike spinning occurs?

What would be a better algorithm?

sentences:
Enemy awareness for Tower Defense 1I have a thesis project about dynamic difficulty in games and I'm focusing on Tower Defense genre. My plan let the enemy units or each units in a wave know that a tile on a path is dangerous (or many units have died there). When an enemy unit with a skill(for example area shield boost) pass or walks to a tile with the most units killed in that tile it will trigger the skill to prevent minimal damage to the wave. What algorithm would be suitable to achieve that?

PS: is this a good idea for a dynamic difficulty, if not suggestions are accepted.

sentences: How reliable is glLineWidth() for parameters greater than 1? It says in the OpenGL ES specification that glLineWidth is only required to support values up to 1, but how many OpenGL drivers actually keep this function at the minimum requirement?

sentences:
How to know the adresses an editor modifies while saving a file I hope this question belongs here.

Suppose an editor for a specific file extension. It usually has a user friendly interface so you don't see raw data. Once you edit anything and save the editor modifies some data. Is there any way to keep track of these changes and see which specific data is modified?
This is motivated by the fact that an editor is a program that has its limitations and sometimes it does not allow some changes. This protects the original file from fatal damage. As an example suppose a .nes file that can be edited through the HEX editor or a "level" editor. I might not know the ROM address where some level information is stored but (i guess) the "level" editor knows. So I can edit, save and search the region of the ROM, with the HEX editor, that was modified. That would give me information on where this level data is stored and be able to understand it.

My system is Windows so I wonder if there is any "save register" that keeps track of this save operations. Or is it an editor specific thing and each one has its own way of saving data, meaning i should look into the editor's code more than a general Windows place?

Thanks,

PD: I'm sorry if I misunderstood something essential but I'm not experienced with how this precesses work.

sentences:
Are you supposed to be looping through all PhysicsObjects at every step in a physics engine? I am currently making a small 2D game and I am trying to implement some basic 2D physics. I currently have  a list of around 100 PhysicsObjects which I loop through every frame in order to update and apply forces to that object based on user input. The basic code is as follows:
accumulator = 0
dt = 0.01

while running:
    for each object in PhysicsObjects:
        update object

    accumulator += time between last frame and current frame

    while accumulator >= dt:
        for each object in PhysicsObjects:
            resolve forces to get new position of object based on dt
        accumulator -= dt

    for each object in PhysicsObjects:
        render the object

I was going to resolve the forces and calculate the new position in the update method of each object, but I was told the dt was necessary in order to make the movement and physics independent of frame rate, which is why it is in a separate loop. I also can't update the objects in the physics engine loop as the update method needs to occur every frame.
This already seems incredibly inefficient, and I haven't even started to test for collisions or anything else more in the physics engine. Is there a better way to structure this where I don't need to loop through every object again in order to calculate their new position?

sentences:
Best ways to navigate a single step on a hexagonal grid depending on input Problem

In my puzzle game, the player moves one step at a time on a hexagonal grid. (Not an action game.)
The sequence of steps is important for the gameplay, so it is not only about getting from A to B.
There are of course six possible move directions that I have to map my input to.
My hexagons have a pointy tip, so I do not have a North or South adjacent cell. So the ordinal directions are NW, NE, E, W, SW and SE. See the image.
I am particularly interested in ideas to accomplish this movement for mouse, keyboard and Xbox-like controllers, but feel free to post your thoughts on touch.
The main difficulty is that I am very experienced with my very clunky controls and new players are struggling to simply move the player around. Also, the movement controls cannot be accomplished via conventional square grid controls, e.g. a dpad or WASD.

What I have tried / Ideas
Keyboard

Mapping the characters around S directly to the six hexagonal directions, so W->NW, E->NE, A->W, D->E, Z->SW and X->SE. This is what I use basically.
Idea: Use WASD only. W is a North modifier, S is a South modifier and A and D correspond to East and West. Holding down the modifier will change what A/D does. Maybe show preview of current move possible with modifiers.

Controller

Flick controls: When you reach a certain threshold in displacement of the 2D left stick, this angle counts as as movement and will be mapped directly to a direction. You will see a small line/arrow pointing to the corresponding direction of the stick when you are not fully tilting the stick. Center stick to proceed.
Same as before, but you have to press A to go in that direction.

Mouse

Idea: Click on the adjacent tile to go there, maybe highlight possible moves.
Idea: Press a button and drag from that position to mimick stick controls, e.g. flicks.

sentences:
Unity Rendering (Bug): Objects rendered as multiple instances after repositioning Context: I am currently making the menu for my game demo. It involoves "Raindrop"-Gameobjects (Sprites) being repositoned and recolored after a random amount of time. I do this by instantiating a predefined amount of Raindrops and manipulate them after said amount of time.

I am using Unity 2018.1.6f and, if possible, want to avoid switching to another version. If it is of relevance and requested, I can also post my sprite import settings.

Problem: Upon repositioning a sprite, it keeps being rendered at its old position AND the new position, making it appear as if a new instance was created

(this isn't the case as 1. the objects in the hierarchy view remain the same, and 2. the unwanted "multiple renderings" aren't shown in the scene view either, only in game view)

As seen below, there are 5 Raindrop objects in the hierarchy as well as in the scene view. In the game view however, there a lot more than 5 Raindrops are being rendered. The amount of rendered Raindrops increases each time a single one is repositioned.

Further notice:
I had a fairly similar problem once where a bug in my code caused it tho delete all objects at once. The objects were deleted but kept on being rendered and even functioning as if nothing happened, save for the difference that all moving objects would be rendered like the cards in solitaire once the game is over (I do not know of a different way of describing it). None of the code above, except for the Exit() function of MenuEnvironment destroys any object. As you can see, the rainbow objects are only instantiated once, upon Setup(GameObject, GameObject) and being continuously manipulated in Unity's Update Loop.

sentences:
Why does occlusion culling have a negative performance impact on Gear VR in Unity 5.4.03f? I am making a GearVR game using Unity 5.4.03f and Oculus Utilities for Unity 5.

I have problem with Occlusion Culling. I've set appropriate objects as static and baked the data. The culling works correctly when I visualize it in the editor - I set a complex scene and hid it behind a big cube. The scene is not rendered when visualizing in the editor when the camera is behind the cube.

When I deploy this scene to the device, Samsung Galaxy S6. The culling does work - when looking at the complex scene through the occluding cube, I have good a framerate, the scene is culled. Without the cube and occlusion culling, the FPS would be around 40, with the cube and OC, it is around 60.

The problem starts when I get past the cube with OC on - the FPS drop to 30, while without OC in the same spot they were around 55.

I tried looking online for solutions, but this is supposed to be an old bug that was fixed back in Unity 5.1.X.

Any ideas?

sentences:
What is the minimum of shader I need to use to run basic calculation on GPU? I read, that the Hull Shader, Domain Shader, Geometry Shader and Pixel Shader can be used optional. So, is the Vertex Shader optional too? If no: What does a basic Vertex Shader look like? Just like a simple pass through? Is the Vertex Shader necessary to tell what kind of datastructure (Van Stripes or Meshes) are used? What can I do, with just the vertex shader?
Are the fixed functions working without any help of programming a programmable stage?

sentences:
if the player moves in the real world the game object also want to move I am creating an iOS game. It's my first experience in iOS. I am facing an issue in player movement. If the player moves in the real world this means the game object (character in the game) also wants to move. So I tried to access pedometer to take the step count. But it is not updating. It's showing the step count as 0 only. The value is not changing. Here's my script:

 private float loLim = 0.005F;
 private float hiLim = 0.3F;
 private int steps = 0;
 private bool stateH = false;
 private float fHigh = 8.0F;
 private float curAcc= 0F;
 private float fLow = 0.2F;
 private float avgAcc;

 public Text stepCountTxt;

 public void Update(){
   stepDetector();
 }

 public int stepDetector(){
 curAcc = Mathf.Lerp (curAcc, Input.acceleration.magnitude, Time.deltaTime * fHigh);
 avgAcc = Mathf.Lerp (avgAcc, Input.acceleration.magnitude, Time.deltaTime * fLow);
 float delta = curAcc - avgAcc;
     if (!stateH) {
         if (delta > hiLim) {
             stateH = true;
             steps++;
         }
     } else {
         if (delta < loLim) {
             stateH = false;
         }
     }
     avgAcc = curAcc;
     calDistance (steps);

 return steps;
}

void calDistance(int i){
   stepCountTxt.text=i.toString();
}

sentences:
Playing a sound once pygame I'm trying to play background music and the music keeps on starting. I tried to use music.busy, but I can't figure it out. I want it to check if sound/music is playing, then I want it to print "music is playing". If a sound/music isn't playing I want it to start up a new song and loop it.

def musica():
    if pygame.mixer.music.get_busy() == True:
        print("music is playing")
    if pygame.mixer.music.get_busy() == False:
        music.play(loops=-1)

sentences: Bind render result to texture id I want to save the result screen of the rendering and then apply another shader on that result, the typical way is to read the screen using glReadPixels and then buffer that image to gpu and then apply my effect, so is there a way to bind the screen result to a texture id directory in gpu, instead of retrieving it back to CPU and then buffer it to GPU ?

sentences:
Run XNA game without graphics Wondering if there is anyway to run an XNA game with out displaying anything.

I have a working game that runs in a client server setup where one player is the host and other people can connect to his game.

I now want to be able to run the game as a host on a decicated server with no graphics card, basically I dont want to run any Draw() logic at all.

Do i really need to go through the entire game and remove all references to XNA?

How have people done this?

EDIT: The reason I want to do this is because I have a working client server setup in the game and I dont want to make a separate "headless" server program.

sentences:
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:
Octree implementation for fustrum culling I'm learning modern (>=3.1) OpenGL by coding a 3D turn based strategy game, using C++.

The maps are composed of 100x90 3D hexagon tiles that range from 50 to 600 tris (20 different types) + any player units on those tiles. My current rendering technique involves sorting meshes by shaders they use (minimizing state changes) and then calling glDrawElementsInstanced() for drawing. Still get solid 16.6 ms/frame on my GTX 560Ti machine but the game struggles (45.45 ms/frame) on an old 8600GT card. I'm certain that using an octree and fustrum culling will help me here, but I have a few questions before I start implementing it:

Is it OK for an octree node to have multiple meshes in it (e.g. can a soldier and the hex tile he's standing on end up in the same octree node)?
How is one supposed to treat changes in object postion (e.g. several units are moving 3 hexes down)? I can't seem to find good a explanation on how to do it.
As I've noticed, soting meshes by shaders is a really good way to save GPU. If I put node contents into, let's say, std::list and sort it before rendering, do you think I would gain any performance, or would it just create overhead on CPU's end? I know that this sounds like early optimization and implementing + testing would be the best way to find out, but perhaps someone knows from experience?

sentences:
How to Use Text in Unity3d How Can i Create Text in Unity3D?
I Use "3D Text" But Its Always on Top Of Everything!
Can You Suggest Anything?
I creating a 2D Game So its not Necessarily a 3D Text..

Edit: Because I Building a 2D Game My Scene is Full of Planes in Front of Camera And I want My Text to be Over One of the Planes and when plane is moving My Text appears behind it.
But When I Use "3D Text" Its Always In Front of Everything.

Sorry for My Bad English...

sentences:
OpenGL: What's the best way to convert a screen coordinate to a world coordinate? For example, suppose I'm building a first-person shooter and the player pulls the trigger. I want to convert the screen coordinate (x, y) into a world coordinate (x, y, z) to know what they've hit.

I've seen some people mentioning a lookup using glReadPixels, but I've heard it's slow and those references were years old, so I'm not sure if this is the best way.

I'm working with core OpenGL 3.3, not ES. gluUnProject is not part of the API I'm asking about.

These types of answers would be most helpful:

An explanation of how to retrive a pixel's (x, y, z) value using glReadPixels and how to transform that into world coordinates. I know how to multiply by inverse matrices; I don't know exactly what steps OpenGL takes to arrive at its depth buffer value.
Or, an explantion of how to do something similar, perhaps more efficiently, with a pixel buffer object.
Or some method that I don't even know about that's better than either of the above.

For some context: I have many months' worth of code into a game I'm developing in OpenGL using the core 3.3 profile. I'm using minimal libraries and not the old fixed-function GL pipeline, which is why it does not make sense for me to use gluUnProject. I mention this to highlight why this question is not the duplicate of a currently-linked older question.

Note: I previously mentioned a shader idea that did not add much to the question, so I removed it. I also edited the question to clarify the context and the type of answer I am looking for.

sentences:
Resizing D3D Buffers within a frame I have a particle system. So far it worked like this: I have a dynamic vertex buffer for a system, which is created with a size that can hold for example 100 000 particles. I map/unmap this and write the new data into it every frame.

But what if the particle count gets bigger than the buffer can hold? I thought of recreating the vertex buffer with the double of its previous capacity (then map/unmap into it). Is this the right direction for this or should I solve it in a different way?

A short example:

ID3D11VertexBuffer* buffer;
ID3D11Device*       graphicsDevice;
//...
D3D11_BUFFER_DESC desc;
buffer->GetDesc(&desc);
if(dataSize>(int)desc.ByteWidth){ //data can't fit, so destroy and recreate
    buffer->Release();
    desc.ByteWidth*=2;
    graphicsDevice->CreateBuffer( &desc, nullptr, &buffer ); //returns S_OK
}

Update:

I want to use it for other things, not just particles but for example instanced meshes. If I spawn a couple of instances, I'd only like to resize a buffer, without creating an other one.

sentences:
How can I deal with vertex precision errors between terrain chunks? I am using OpenGL to render the following scene, using vertex data from one of the map files of a popular MMORPG. The data is chunked and the pictured scene is made up of 256 (16x16) chunks.

However between the chunks I am seeing what I believe to be glitches due to the float precision. Yet I am not doing any large translations and rendering very close to the origin, should I be seeing this problem? The glitches very noticeable as you fly over the scene with it flickering different points along the chunk edges.

I was wondering if I was overlooking something simple or there are tricks other games use to mask this problem. I guess the source data could be the reason for this problem but I am not aware of it happening in the original game.

View screenshots in a new window to see the issue.

sentences:
How to structure my projectile code I have a submarine model that I would like to shoot torpedoes.

I want these torpedoes' initial velocity to vary with the forward velocity of its shooting submarine (so they go faster if launched off a moving sub, slower if show from a stationary sub).

I have a few requirements I'm trying to achieve:

Torpedos despawn when they swim too far away. No need to keep them in memory if they're too far too see.
When a torpedo is updated, and collision detection is done, there should be a way to determine who shot the torpedo, so it can be determined who to award the kill.
Torpedos should outlive the lifecycle of its parent sub, in the case the sub is destroyed between the torpedo was shot, and the time the torpedo hits or veers too far away. (Who doesn't love double kill mechanics :D?)
I'm working in C++, so manual memory management is a concern.

I'm debating between two approaches:

Have subs be the owners of their torpedoes. This makes requirements 1 and 2 easy, but complicated 3.
Have the scene be the owners of torpedoes. This makes 3 easy, but complicates 1 and 2.

This seems like it would be a common problem. What's the preferred way to do this?

sentences:
Simulating Smartphones on PC with Unity I want to make a game that depends on the phone orientation (changing shoot direction with tilt), however I need to test this on PC. So is there any tool I can use to simulate the orientation of the phone with mouse or keyboard of my PC? Something like joysticks on the screen.

Thanks for any help!

Edit :

Thanks to @jhocking for his suggestion of Unity Remote. I, however still can accept a solution with using only PC, since I'm afraid of shortening my phone's battery life, for some reason.

sentences:
What is the movement represented by this sprite animation? Fire Emblem 7 is a sprite based game with some interesting sprite art aesthetics. For example, see this sheet of one of the main characters, Lyn:

On the last frames of the critical hit, the artist used some kind of slash effect to represent the entire motion of the sword in a single frame. It looks really appealing on video. I have two questions:

What is this effect called?
How or why did the artist arrive at that result? For example, why are those "spikes" where they are, and why is the "end" of the line fatter?

sentences:
Modular weapon in UE4 editor I want to create a modular weapon system. I already got most of it working, but I wonder how to make an improvement.

Weapons in my game have different firing modes (semi and auto) and "bullet" modes (projectile and hitscan). Each weapon is it's own blueprint, and there I can select proper one in editor, so for example an Uzi would be auto / histcan, while a rocket launcher would be semi / projectile. (the firing mode actor gets created at spawn from the class selected in editor).

I want to make it easier to edit by giving the weapon some variables, like spread and projectile blueprint. But not all of the variables apply to all the types of weapon...

TLDR:
Can I create / show different variables in the editor, depending on other variables? If I choose projectile type of weapon, can I also select the projectile type, but not show the option if I chose hitscan?

sentences:
Why my game is running slowly if it was launched from a wpf application? i have some issues why my GameEditor. I would start my XNA project from it, like a debug-client. It opens and all works fine, but it runs on 45 frames until I hide the wpf form. then the framerate goes up and remains there, even if I return the wpf form.

    private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
    {
        var gameAppDomain = AppDomain.CreateDomain("Game");
        gameAppDomain.ExecuteAssembly(@"..\..\..\WindowsGame1\WindowsGame1\bin\x86\Debug\WindowsGame1.exe");
    }

the game is a just a new xna game without any rendering, except my framerate counter.

/// <summary>
///     This is the main type for your game
/// </summary>
public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    private FrameRateCounter frameRateCounter;

    public Game1()
    {
        this.graphics = new GraphicsDeviceManager(this);
        this.Content.RootDirectory = "Content";
    }

    /// <summary>
    ///     Allows the game to perform any initialization it needs to before starting to run.
    ///     This is where it can query for any required services and load any non-graphic
    ///     related content.  Calling base.Initialize will enumerate through any components
    ///     and initialize them as well.
    /// </summary>
    protected override void Initialize()
    {
        // TODO: Add your initialization logic here
        this.frameRateCounter = new FrameRateCounter(this);
        base.Initialize();
    }

    /// <summary>
    ///     LoadContent will be called once per game and is the place to load
    ///     all of your content.
    /// </summary>
    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
        this.frameRateCounter.LoadContent();
        // TODO: use this.Content to load your game content here
    }

    /// <summary>
    ///     UnloadContent will be called once per game and is the place to unload
    ///     all content.
    /// </summary>
    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    /// <summary>
    ///     Allows the game to run logic such as updating the world,
    ///     checking for collisions, gathering input, and playing audio.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Update(GameTime gameTime)
    {
        this.frameRateCounter.StartUpdateTimer();

        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        // TODO: Add your update logic here

        base.Update(gameTime);
        this.frameRateCounter.EndUpdateTimer(gameTime);
    }

    /// <summary>
    ///     This is called when the game should draw itself.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Draw(GameTime gameTime)
    {
        this.frameRateCounter.StartDrawTimer();
        this.GraphicsDevice.Clear(Color.CornflowerBlue);

        // TODO: Add your drawing code here

        this.frameRateCounter.EndDrawTimer(gameTime);
        base.Draw(gameTime);
    }
}

If I do the same for a WinForms application, I dont have that issue.
My first try was to launch it in an TASK/Thread but then it crashes after 15-20 min if I have loaded my soundeffects. The event log says it was "XAudio2_6.dll_unloaded" with a access violation exception.

hre is my test game: https://www.dropbox.com/s/gtt49lwquyoo86e/WindowsGame1.zip?dl=0

sentences: How to set LOD specifications for all meshes in unreal at once? I have a large model and want to avoid separately setting the LOD specifications for each component in the model. Is there are way set LOD specifications for all meshes in unreal at once since I want to set the same specifications for each one? (percentages, how many LOD's, and at what screen distance they kick in, using Unreal's autogenerated LOD's).

sentences:
How do you get the best rendering performance in a 2D Java Game? I have seen a lot of tutorials, and they develop games with 2 different ways:

The first one is using a virtual image (BufferedImage) and filling it's pixels. And displaying virtual picture.

private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
private int[] colors = new int[6 * 6 * 6];

Second one is using lots of real images. And displaying they.

SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png"));

    //PLAYER SPRITES PROVIDED BY: AddFact
    player = sheet.crop(width * 4, 0, width, height);

    dirt = sheet.crop(width, 0, width, height);
    grass = sheet.crop(width * 2, 0, width, height);
    stone = sheet.crop(width * 3, 0, width, height);
    tree = sheet.crop(0, 0, width, height);

First Question: Which one has the best performance ?

Second Question: How should we load maps? With images or with text files ? Which one is good to chose ?

Sorry for my english. I hope I can explain to you :) Thanks for helping, have a nice day ^^

sentences:
How can I give the illusion of height to a ball in 2D? In 2D top down soccer games, sometimes a ball is given the illusion of being in the air, like below:

How can I achieve this?

sentences:
How to set a box2d body to follow a strict path I'm making an infinite runner type game and I want one of my enemies (when it's created) to swoop down in a sort of U motion where it'll hit the player if they don't react quick enough once the enemy (bat) leaves the screen it'll be destroyed and created again once certain requirements are met . The path will be the same each time so I don't need anything to do with AI. Unfortunately I'm only in grade 10 so calculus makes no sense to me and neither does the pathfinding libgdx documentation. I either need something similar to this (But written for libgdx) or some way to get a box2d body to move in an exact way.

My game is structured like this:

in Bat.java:

public class Bat extends Sprite {

private World world;

public Bat(GameScreen screen) {

    this.world = screen.getWorld();
}

In GameScreen.Java

public class GameScreen implements Screen {

private Bat bat = new Bat(this);

public World getWorld(){
    return world;
}

sentences:
C# - console application, array problem I have problem in very simple console app, code looks like this.

int x - player moving and changing axis "x" and I want make full history of moving via array. See code(only example) below...

Thank you for your help and answer

  int round = 0;

  while(infinity){

  int[] PosXSave = new int[round + 1]; //theoretically infinity size of arrray.

  PosXSave[round] = x; //every round i want save current value of x, but
                       //only last save have propertly value and rest are
                       //zero or other number

  round++

  }

sentences:
Optimal solution to render sprites with transparent edges in Unity Since I'm currently developing a 2D game for mobiles, overdraw and drawcall count is my first priority in the design of the application
I've thought initially to split each sprite in two parts: one where each pixel is fully opaque (to render with cutout shaders in front-to-back order) and the other part with semi transparent edges (which will be ordered back to front)

Since I need to support ES2.0 devices, I can't use texture-arrays and I need to fit as many sprites as possible in a single 2048x2048 texture atlas to reduce drawcalls and ensure mobile compatibility, but as you can see from this picture:

Splitting sprites in opaque and non-opaque parts will certainly double the space occupied in the atlas, thus decreasing by half the potential amount of consecutive sprites I can draw in a single drawcall

This way, I'm paying drawcalls to reduce overdraw.
By rendering the entire sprite with transparent shaders I'd pay overdraw to reduce drawcalls.

Am I missing something? Is there a better approach?

sentences:
How do I understand a big c++ gaming project in SFML? Currently I am doing SFML- c++ as a basement in game development before starting out Unreal

When I see a game project in  SFML,  the codebase is huge, like above 30 classes, 100 functions, how can I get an idea of the code project, any suggestions about the usual standard class names in SFML projects and their purpose would be helpful.

sentences:
How do I make Ground Check stop rotating with the character when it rotate? How do I make my character routice without Ground Check rotating with it, but still follow my character?

Code:

using UnityEngine;
using System.Collections;

public class Player: MonoBehaviour {

public float maxspeed = 10f;
bool facingRight = true;

Animator anim;

bool grounded = false;
public Transform groundCheck;
float groundRadius = 0.2f;
public LayerMask whatIsGround;
public Vector2 jumpDirection = new Vector2(1f, 1f);
public float jumpFocre = 500f;
bool doubleJump = false;

void Start ()
{
    anim = GetComponent<Animator> ();
}

void FixedUpdate () {
    grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
    anim.SetBool ("Ground", grounded);

    if (grounded)
        doubleJump = false;

    float move = Input.GetAxis ("Horizontal");
    anim.SetFloat ("Speed", Mathf.Abs (move));

    GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
}
void Update()
{
    if((!doubleJump) && Input.GetKeyDown ("up"))
    {
        anim.SetBool("Ground", false);
        float move = Input.GetAxis ("Horizontal");
        jumpDirection.x = move;
        GetComponent<Rigidbody2D>().AddForce(jumpDirection.normalized * jumpFocre);

        if(!doubleJump && !grounded)
            doubleJump = true;
    }

}

void Flip()
{
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}
}

sentences: How to port a Skyrim Legendary Edition mod to Skyrim Special Edition, and vice-versa? There are a lot of mods I want to port, but I don't know how to go about it and do it properly to avoid crashes, etc. Could you put all of the steps and relevant information here so I can use it as a future reference? I am trying to port a major mod with scripts, 3d models, new items, new spells and whatnot.

sentences:
How to apply toastr notifications when user get leveled up? This question is about when user get leveled up the toastr will pop up.

What I want to do is i want to put the toastr.js inside my script but I don't have idea how to implement.

** Link and Script **

<link rel="stylesheet" href="{{ asset("css/toastr.min.css") }}">
<script src="{{ asset('js/toastr.min.js')}}"></script>

** Profile.blade **

 <script>
   @if(Session::has('success'))
    toastr.success("{{ Session::get('success') }}")
   @endif
 </script>

** Controller **

         use Session;

          while($user->curr_exp >= $user->exp_needed){
             if($user->level == 10 || $user->level == 15 || $user->level == 20)
               {
                  $user->reward_token += 1;
               }
                  $user->curr_exp -= $user->exp_needed;
                  $user->prev_exp = $user->exp_needed;
               if($user->level <= 19){
                   $user->exp_needed = $user->prev_exp * 1.4;
               }
               elseif($user->level >= 20 && $user->level <= 39){
                   $user->exp_needed = $user->prev_exp * 1.1;
               }
               elseif($user->level >= 40 && $user->level <= 59){
                   $user->exp_needed = $user->prev_exp * 1.05;
               }
               elseif($user->level >= 60 && $user->level <= 79){
                   $user->exp_needed = $user->prev_exp * 1.04;
               }
               elseif($user->level >= 80 && $user->level <= 99){
                   $user->exp_needed = $user->prev_exp * 1.03;
               }
               elseif($user->level == 100){
                   $user->exp_needed = $user->exp_needed * 0;
               }
                   $user->level += 1;
                   Session::flash('success','You leveled up!');
                   $user->save();
               }

I'm using laravel framework 5.4.36 version. I'm confused how to display a live notifications on the user's profile every time they leveled up.

Any ideas? Thank you

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: Calculating minimum velocity of the projectile needed to hit target in parabolic arc If I have a point which I want to hit at the end or during a parabolic arc, how would I calculate the needed x and y velocity?

sentences:
How do I program attacks and combos in a fighting game? I'm working on a game a bit like "Super Smash Bros.", using C++ and SFML. I can't figure out a good way to program attacks.

First, I coded individual functions for each attack. The problem with this was that I needed three functions for each attack; one for dealing knock-back to other players, one for setting variables for the actual punch and one for checking for unique types of collision. This ends up being almost the same code for all the other attacks, and was also very messy for programming combos.

I then tried creating a class called Attack, and inherited classes like Punch and Kick. The problem with this was that I wasn't sure how to implement all of the methods in the Player class.

How do I program attacks and combos in a fighting game?

sentences:
Transform 3d viewport vector to 2d vector I am playing around with 3d transformations and came along an issue.

I have a 3d vector already within the viewport and need to transform it to a 2d vector. (let's say my screen is 10x10)

Does that just straight works like regualar transformation or is something different here?

i.e.: I have the vector a = (2, 1, 0) within the viewport and want the 2d vector.

Does that works like this and if yes how do I handle the "0" within the 3rd component?

sentences:
Unity Augmenter Reality on Android with Video playing Hey sisters and brothers,
So, I created an augmented reality marker, which works perfectly, I was able to display 3 shape on the screen with my Nexus 5.

I would like to replace my shapes with a Video. So, when the user track on the marker, I would like to start to play a video above the marker as a part of the augmented reality (No full screen playing).

I tried to use this video tutorial (https://www.youtube.com/watch?v=YBc3ubr18ks) , but on Android you can't use MovieTexture (they say).

My question(s): how can I display a shape above the marker, with a video on it and what it the video format ? When I trying to build the project with mp4, it failing, but when I do with AVI it's okay, but the app crashing.

Thank you,

sentences:
Representation of trains on a simplified rail grid I'm working on a hobby game, basically about train dispatcher's job.

(stack: Typescript, phaser.js)

My map is based on a grid, each tile can hold 1 rail tile (well, except junctions, but we can simplify it for now, since junctions are just multiple tiles, from which only one is active).

Example (black is grid, white is rail):

As you can see, we have basically three different tiles: straight rail, 45 degree turn and diagonal rail (which can be also considered straight rail). I don't plan to add more tiles, as you can already build pretty complex setups from these tiles.

On these rails, trains would drive. Each carriage has two "wheels" - positions, where it snaps to a track. This may be seen on the following example from my prototype:

However the existing system (see below) has some issues:

when a train travels diagonally, sometimes it's x and y coordinates fit in a field than it should (example: traveling from 1|1 to 2|2, but at one point the train's coordinates correspond to the field 1|2 or 2|1).
axles sometimes get closer or futher away from each other. This has almost no effect on resulting simulation (as the carriage is centered between those two axles), but may cause carriages to be closer or futher away from each other (this effect is visible on the prototype as weell)
moving the train in a certain direction is handled by a big chunk of code that essentially lists all possibilities of directions and handles it. I'm interested if there's a better way to do it, so I could simplify the code.

I decided that I would improve the core. I'm wondering, what would be the best way to do this?

What I am looking for:

how to save the rail pieces on the map?
how to move train (I know it's x, y, speed and acceleration)?
how to have the train continue to the next piece on the grid?

Current solution (broken in some edge cases, also not ideal):

each rail piece has it's class (CurvedRail, StraightRail)
each rail piece class has method movePoint, that accepts x, y, direction and distance and returns new point (that is distance away from the original point, but also considering track turns). It may also return delta, if the movement reached edge of the tile and it needs to be moved futher (on another piece). This is handled by a separate class, that finds the following rail piece and calls movePoint with the delta instead
it has issues, because sometimes trains passing diagonal connection don't exactly follow the diagonal, so they instead of ending up on the next diagonal piece, they end up on neighboring horizontal or vertical piece and derail.

One of the issues I may be facing is that tiles are 32x32 pixels, so it's hard to travel exactly in the "middle" of the piece, because it's "between two pixels", and although I'm using decimals, it may be a problem. Is it better to have a grid from odd-sized tiles?

sentences:
How to draw a circle on the ground like in "Warcraft 3"? I've been watching "Warcraft 3", and suddenly realized that I have no idea how to draw a circle on a surface.

Here is an example:

I guess this is projection? I also have very little idea of how to draw a shadow. I only somewhat know OpenGL.

It is also interesting how this circle seems to not perfectly repeat the shape of that cliff. My guess is that it's drawn using a height map, which is stored somewhere separately, and not as the cliff, itself. It looks like it actually goes underwater, but it may be just a compression artifact.

sentences:
Using unity Rigidbody 2D gravity, how to add to velocity? I am creating a top-down game, and have an object I want to create a small bouncy illusion for. Since I dont have anything to collide with I'll have to do it with Scripts.

Without Unity I would probably do something like:

function fall ()
{
    this.vertical_speed = this.vertical_speed + GRAVITY;
    if (this.vertical_speed > TERMINAL_VELOCITY)
    {
        this.vertical_speed = TERMINAL_VELOCITY;
    }
    this.vertical_position = this.vertical_position - this.vertical_speed;
}

However in Unity we have the Rigidbody 2D, so I want to somehow use that for this.

if I set rigidBody.velocity = new Vector2(1, 0) * speed * delta;, it gets a constant speed, and ignores gravity. How can I add gravity?

i.e: I want to create a curve like:

sentences:
How can I change the name of my game in Google Play? I have just released my first app game called 'paperplane', now the problem is that there are hunderds of paperplane apps so I dediced the change the name to 'neonplane'. I was not able to change the package name, however i could change the title name which is what I did. I updated the game and waited for google to publish it.

Now it is published it is called neonplane, but here is my problem:

If I look for neonplane I can't find nothing.
If I look for paperplane I find somewhere down the list neonplane with the name neonplane.

Is it somehow possible to fix this.

sentences: Calculate the Z of a line intersection given the XY coordinates? I'm intersecting a line in 2D and I calculate the X,Y coordinates of the intersection point. What I need is the Z of the intersection point given the X,Y,Z of the line points, and the X,Y of the intersection. From what I understand of equations it should be a one-liner but I don't know enough math to get there.

sentences:
Physics engine deltaTime and force acceleration I am working on a physics engine that uses basic Euler integration to compute forces. So, here is the thing:

function applyForce (rigidbody, force) {
    rigidbody.forces.add(force);
}

function computeAcceleration (rigidbody) {
    rigidbody.acceleration = rigidbody.forces / mass;
    rigidbody.velocity = rigidbody.velocity + rigidbody.acceleration * time.deltaTime;
}

// The forces are reset after each gameloop

So now imagine I want to apply a force to jump, I will use applyForce at the moment the player presses the jump button.

But: What happens is that the amount of movement depends on the gameloop speed, since the force is applied for a single frame. I feel like I missed something about how you should use forces, but I don't see how I should manage it properly.

In which cases should we use a force, considering this deltaTime issue? And also, what should I use instead?

sentences:
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:
Why is my game freezing? Ok here is what I have done. I have made a simple test game where you move a character around. I built it and installed the app onto 2 different devices (as it will be a multiplayer game later).

Phone1 - Samsung Galaxy S4 (Android version 4.4 kit kat I know I need to update it)

Phone2 - LG G Stylo (Android version 5.1 lollipop)

My SDK - I have android 6.0 (API 23) installed everything up to date.

Phone1 plays it flawlessly no errors. Phone2 plays it until it freezes at random times. Not much going on in the scene as far as graphics. I kept it pretty simple.

Some debugging I did was to check the logcat. No errors are shown! The only thing I notice is that the frames just stop. So I go to developers options on both phones and check the box that allows you to see every update. I find out that after a while Phone2 stops updating the games frames, which freezes it. It is no longer calling Update(). Phone1 keeps running perfectly no crash yet.

What am I doing wrong? I am guessing it's a version issue but I don't know where to go from here.

sentences:
Get normal dependent on collisions position As I hask ask here I'm working on how my objects can move over the terrain and other objects. My proposal and also an idea in the answers was to calculate the rotation from the object with the normals from other objects around (under and in front) the moving object.

My main problem for that is how I can get the normal from an object at a special position. Let's take the ramp on the road from the old example. It depends from which side my car comes. If it comes from front it can drive along the ramp but if it comes from back it moves against the wall. Of course there are other normals if I come from the other side. All my objects have these variables:

float vertices[];
float normals[];
short drawOrder[];

float[] modelMatrix;
AABBox boundingBox;

So you see I can allways get the vertices, normals and the position. I can also test if the object collides with another object with the bounding box (axis aligned) but I have no idea how I can get the normal where the collision happens but that is the important thing for the rotation of the car. Do you have any ideas or are there usual way how to do this?

sentences:
How to store tiles with different sizes? in a tilegame, how can we use several tiles for 1 object?

I thought I could add each tile in a json file, with the type and its coordinates, like :

"line1: type1_xTile1_yTile1, etc."

"line2: type1_xTile1_yTile1, etc."

but in case when an object is bigger than the others, i don't see how to store this information. Is there another common way to store the tiles with different sizes?

Here is an example : the pond is bigger than the other tiles :

Thanks!

sentences:
OpenGL doesn't draw (3.3+) Brief:
I've been following this tutorial about OpenGL for 2 days, and I still can't have a triangle drawn, so I'm asking for help here. The tutorial is turned to OpenGL version 3.3 programing, using vertex arrays, buffers, etc. The libraries are: GLFW3 and GLEW, and I setted them by myself. The screen keeps black all the time.

Full code:

link here
(It's just like a Hello World opengl program)

Further Details:

I get no errors at all.
I downloaded a software to test my video card, and it supports OpenGL 4.1+
Standard OpenGL code for drawing (from earlier version) such as this one works normally.
I'm using Microsoft Visual Studio 10.0
I presume all the OpenGL implementation was dune right: I added Additional Dependences  to the linker as glew32.lib, opengl32.lib, glfw3.lib. The glew.dll was placed at SysWOW64 - because I'm running window 64bits, and glew is 32.

Notes: I've been working hard to find out what this is, but I can't find. I would appreciate if anyone could test this code for me, so I can know if I implemented something wrong, and that its not my code.

sentences:
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:
Supporting Controllers on Mac I'm currently developing a small, cross-platform game for Windows/OSX. I have XInput support working correctly on the Windows version. I've left off Mac controller support until now and I'm struggling to find an analogous library on OS X.

Does something similar to the XInput API exist for OS X or am I on my own for that?

sentences:
Job title for a roleplaying event gamemaster in an online RPG? I'm considering creating a position in an online RPG where the responsibilities would mainly involve conceiving roleplaying-oriented events and plotlines and executing on them using developer tools such as the ability to create instances of NPCs/items and the ability to control NPCs.  Examples of events/plotlines might be "ancient god of evil breaks loose from his prison and attacks the realm" or "upcoming marriage between offspring of powerful dynasties has political opponents trying to disrupt it".

What is the best job title for this sort of position?

The first thing that popped into my head was "customer experience associate", but this appears to have an established meaning in retail where it's a way of dressing up "salesperson".  "Game master" positions in MMOs are generally helpdesk positions with no creative duties or authority.  I want to select something that neither exaggerates nor undersells this person's level of responsibility.

sentences:
Matrix interpolation for animation blending I use the XNA Animation Component library to perform blending between animations. It uses spherical linear interpolation between matrices.

In most cases this works without problems. However, I have one model where all of the animations are blended wrong. Weird rotation and warping of the model occurs.

I was told by a math expert that the problem may lie in the method that does the matrix interpolation. He said:
"The right way to do it would be to decompose A=UP (polar decomposition), obtain quaternion from U and lerp/slerp it, while interpolating P component-wise.
I'm not sure why the original author refrained from implementing the polar decomposition as its implementation is straightforward and easy."

I have included the code below.

I need some help in making the recommended changes. I am an expert in C# but know almost nothing about matrix interpolation.

private static Quaternion qStart, qEnd, qResult;
private static Vector3 curTrans, nextTrans, lerpedTrans;
private static Vector3 curScale, nextScale, lerpedScale;
private static Matrix startRotation, endRotation;
private static Matrix returnMatrix;

public static void SlerpMatrix(
        ref Matrix start,
        ref Matrix end,
        float slerpAmount,
        out Matrix result)
    {
        if (start == end)
        {
            result = start;
            return;
        }
        // Get rotation components and interpolate (not completely accurate but I don't want
        // to get into polar decomposition and this seems smooth enough)
        Quaternion.CreateFromRotationMatrix(ref start, out qStart);
        Quaternion.CreateFromRotationMatrix(ref end, out qEnd);
        Quaternion.Lerp(ref qStart, ref qEnd, slerpAmount, out qResult);

        // Get final translation components
        curTrans.X = start.M41;
        curTrans.Y = start.M42;
        curTrans.Z = start.M43;
        nextTrans.X = end.M41;
        nextTrans.Y = end.M42;
        nextTrans.Z = end.M43;
        Vector3.Lerp(ref curTrans, ref nextTrans, slerpAmount, out lerpedTrans);

        // Get final scale component
        Matrix.CreateFromQuaternion(ref qStart, out startRotation);
        Matrix.CreateFromQuaternion(ref qEnd, out endRotation);
        curScale.X = start.M11 - startRotation.M11;
        curScale.Y = start.M22 - startRotation.M22;
        curScale.Z = start.M33 - startRotation.M33;
        nextScale.X = end.M11 - endRotation.M11;
        nextScale.Y = end.M22 - endRotation.M22;
        nextScale.Z = end.M33 - endRotation.M33;
        Vector3.Lerp(ref curScale, ref nextScale, slerpAmount, out lerpedScale);

        // Create the rotation matrix from the slerped quaternions
        Matrix.CreateFromQuaternion(ref qResult, out result);

        // Set the translation
        result.M41 = lerpedTrans.X;
        result.M42 = lerpedTrans.Y;
        result.M43 = lerpedTrans.Z;

        // Add the lerped scale component
        result.M11 += lerpedScale.X;
        result.M22 += lerpedScale.Y;
        result.M33 += lerpedScale.Z;
    }

sentences: Unreal Engine 4 is now only free or open source as well? Recently Unreal Engine 4 become free with Royalty fees. What about the code? Is it opensource or no?

sentences:
Sharpdx 2D Camera not moving I am trying to move a camera to the right, but it isn't moving.

i use this code to move:

Camera.Position.X = gameobject.transform.Position.X;

This is the camera code that i use to create Matrix3x2

        public Vector2 Position = new Vector2();

    float Rotation = 0;

    public float Zoom = 1;

    public Vector2 ViewportCenter { get { return new Vector2(ViewportWidth * 0.5f, ViewportHeight * 0.5f); } }

    public Matrix3x2 GetTransform3x2()
    {
        return Translation;
    }

    private Matrix3x2 Translation
    {
        get
        {
            return Matrix3x2.Translation(Position) *
                   Matrix3x2.Rotation(Rotation) *
                   Matrix3x2.Scaling(Zoom, Zoom) *
                   Matrix3x2.Translation(ViewportCenter);
        }
    }

This is the code that i use to render

        public void DrawGameobjects(Gameobject[] gameObjects)
    {
        RawMatrix3x2 CameraPosition = new RawMatrix3x2();

        foreach (Gameobject Gameobject in gameObjects)
        {
            if (Gameobject.Enabeld == true)
            {
                foreach (object Component in Gameobject.Components)
                {
                    //render 2D
                    if (Component is Sprite)
                    {
                        RawMatrix3x2 CurrentTransform = renderTarget.Transform;
                        Sprite NewSprite = Component as Sprite;
                            Bitmap Texture = Game.bitmapManager.GetTexture(NewSprite.texture.TexturePath);
                            RawRectangleF PositionRectangle = new Rectangle(new Point(0, 0), new Size(NewSprite.texture.TextureSize * Zoom)).ToRawRectangleF();
                            float Transparency = NewSprite.Transparency;
                            RawRectangleF ImageRectangle = new Rectangle(new Point(0, 0), new Size(NewSprite.texture.TextureSize * Zoom)).ToRawRectangleF();
                            Vector2 NewScale = (Vector2)Gameobject.transform.Scale;
                            Matrix3x2 Translation = Matrix3x2.Translation((Vector2)Gameobject.transform.Position);
                            Matrix3x2 Rotation = Matrix3x2.Rotation(Gameobject.transform.Rotation.X);
                            Matrix3x2 Scale = Matrix3x2.Scaling((Vector2)Gameobject.transform.Scale);
                            renderTarget.Transform = (Translation * Rotation * Scale).ToRawMatrix3x2();
                            renderTarget.DrawBitmap(Texture, PositionRectangle, Transparency, BitmapInterpolationMode.NearestNeighbor, ImageRectangle);
                            //renderTarget.Transform = CurrentTransform;

                    }

                    if (Component is Camera2D)
                    {
                        CameraPosition = (Component as Camera2D).GetTransform3x2().ToRawMatrix3x2();
                    }
                }
            }
        }

        renderTarget.Transform = CameraPosition;

    }

Everything moves except the camera

sentences:
Shading Languages vs Materials in 3D editors There are many 3d packages which are able to construct materials. Autodesk Maya, 3ds max, Houdini, etc.

There are languages which are able to construct materials as well, like GLSL and Cg.

How does first group correspond to the second? Are there workflows, where they are used simultaneously?

From my experience, constructing materials in 3d packages is way faster than writing code in GLSL. They also have scripting systems for more customization. Do shading languages have their own benefits?

sentences:
How do I create weapon attachments? My question is; I am developing a game for XNA and I am trying to create a weapon attachment for my player model. My player model loads the .md3 format and reads tags for attachment points. I am able to get the tag of my model's hand. And I am also able to get the tag of my weapon's handle. Each tag I am able to get the rotation and position of and this is how I am calculating it:

Model.worldMatrix = Matrix.CreateScale(Model.scale) *
                    Matrix.CreateRotationX(-MathHelper.PiOver2) *
                    Matrix.CreateRotationY(MathHelper.PiOver2);

Pretty simple, the player model has a scale and its orientation(it loads on its side so I just use a 90 degree X axis rotation, and a Y axis rotation to face away from the camera). I then calculate the torso tag on the lower body, which gives me a local coordinate at the waist. Then I take that matrix and calculate the tag_weapon in the upper body. This gives me the hand position in local space. I also get the rotation matrix from that tag that I store for later use. All this seems to work fine.

Now I move onto my weapon:

Matrix weaponWorld = Matrix.CreateScale(CurrentWeapon.scale) *
                            Matrix.CreateRotationX(-MathHelper.PiOver2) *
                            TagRotationMatrix *
                            Matrix.CreateTranslation(HandTag.Position) *
                            Matrix.CreateRotationY(PlayerRotation) *
                            Matrix.CreateTranslation(CollisionBody.Position) *

You may notice the weapon matrix gets rotated by 90 degress on the X axis as well. This is because they load in on their sides. Once again this seems pretty simple and follows the SRT order I keep reading about.

My TagRotation matrix is the hand's rotation. HandTag.Position is its position in local space. CreateRotationY(PlayerRotation) is the player's rotation in world space, and the CollisionBody.Position is the player's world location. Everything seems to be in order, and almost works in game. However when the gun spawns and follows the player's hand it seems to be flipped on an axis every couple frames. Almost like the X or Y axis is being inversed then put right back. Its hard to explain and I am totally stumped. Even removing all my X axis fixes does nothing to solve the problem. Hopefully I explained everything enough as I am a bit new to this! Thanks!

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:
Can't figure out projection transform I'm trying to fugure out all the spaces transformations, and currently have some inconsistency I can't understand. I'm working on a 2D game (so we assuming Z is always 0 for now), on a device with 960x544 resolution. So, as far as I understand my World Space is left-top (0, 0) to right-bottom (959, 543), with Y axis inverted (going down). Let w = 960, h = 544. To transform it to Eye Space we need to move (0, 0) to center of the screen, so it would be simple translation, viewT:

1, 0, 0, -w/2
0, 1, 0, -h/2
0, 0, 1, 0
0, 0, 0, 1

Next step is Clip Space. I want all world space to be rendered so it's just scaling. But we also need to invert Y axis and that's the part I'm unsure of. My assumption would be that we just add minus sign for the Y scale, and thus projT:

2/w, 0, 0, 0
0, -2/h, 0, 0
0, 0, 1, 0
0, 0, 0, 1

Then viewProjT = projT * viewT would give me:

2/w, 0, 0, -1
0, -2/h, 0, 1
0, 0, 1, 0
0, 0, 0, 1

But in samples I have, "reference" matrix is:

2/w, 0, 0, 0
0, -2/h, 0, 0
0, 0, 1, 0
-1, 1, 0, 1

i.e. it's my viewProjT, but transposed. And that's the part I don't understand. Can someone clarify why I need to transpose matrix to get correct matrix? Is this somehow related to inverting Y axis?

Note: I'm using this, as a basis for my calculations.
And image to illustrate my World and Clip spaces:

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:
Calculating 2D (screen) coordinates from 3D positions in XNA 4.0 I have a program that draws some items to the scene by loading their positions from a file. Now I want to place a Ray on the same location where the items are drawn. So my question is how can I calculate the position of the ray (it's 2D components) by using 3D coordinates of each particular item? The items don't move anywhere, so once they are placed they stay until the end of the programs execution.
 Thanks.

sentences: Should I use scenes in Unity for menus? I assume scenes are for different levels, but should I use them for menu screens or is there a specific tool for menu screens?

sentences:
Remove or skip splash screen from Unity Free/Personal game binary for modding How can I modify a Unity game (Windows) binary to skip the 5-second Unity logo splash screen?
I know how to mod game code using dnspy to modify Assembly-CSharp.dll. I'm able to find isShowingSplashScreen but that appears to be irrelevant. I'm at a loss whether I can find the splash screen code in any .dll or if one would have to edit the game .exe or some other file.
Looking at the game .exe in HxD (hex editor), I see multiple occurrences of unity_SplashScreen but have no idea whether I can use this for anything.
Background
I'm modding a Unity game and I am not very good at it. I have to try a lot and start the game a lot. This means each time I test something, I lose five seconds because the game was made with the free Unity version.
As a player I made no commitment to the Unity ToS. I also have no intent to distribute a modded file that removes the splash screen. However, I want to remove it during development.
I am not asking how to remove the splash screen while building the game. I am not developing in Unity, I am modding a game made in Unity and I'm trying to streamline the process.
I did see Unity remove logo in splash screen, Alternatives to remove Unity splash screen after developing a game with the free version?, Can I legally remove the default Unity splash screen by removing it from the APK?. They revolve around the question of removing the splash screen with intent to distribute, which is not the topic here.
I had hesitations about asking this question, due to the answer being useful to developers willing to violate the ToS. However it seems on-topic and legal. I would also argue that the solution to my problem is probably going to be too much effort for active game dev projects to bother using it (having to repeat the steps for each new update) and that "bad apple" devs would rather use pirated versions of Unity Pro.

sentences:
Performance of pixel shaders vs. SpriteBatch: XNA Precondition: I read this question/answer about using shaders, or spritebatch, to render and mark a sprite.

I need to do something like that. I also have a 2D lighting PoC which I need to write. The way it will work will basically be something like:

Draw all the sprites
Draw lighting gradients to create a lighting texture
Multiply/add the lighting texture to achieve different effects

(I use multiple passes of add/multiply the lighting texture to achieve different effects.)

My question is really about a generalization: can I say with certainty that pixel shaders are always faster than adding/multiplying textures to the SpriteBatch? Or that adding/multiplying is always faster? Or if it's not generalizable, how do I decide which approach to take, given that I can probably code either of them?

(If it matters, I'm using MonoGame 3.0 beta for Windows games)

sentences:
Infinite space 2d map - how to implement in js Im not exactly sure how to implement this in JS.

So I want to have a 2d infinite map, but not tiled. The coordinates are there only so that if you are travelling around space you know in what coordinates you are. Or if I want to add a couple of things here and there I can specify the coordinates for the placement.

So the coordinates only serve as grid points, but how would I got about implementing this in JS?

Also, how would I go about storing the different things I want to add to the map. Meaning this is not procedural or anything, it's static, a static map.

Could I just use the canvas grid system?

sentences:
I'm having trouble with collision detection in XNA I've written a tile editor and game in XNA, with velocities and gravity, and am having trouble with some of my collision detection things. It works okay, but seems to glitch between just inside and outside the tile the player is on. Here's my collision detection function and the other functions it uses:

void SolveCollisions(List<Tile> tiles, Vector2 screensize)
    {
        if (position.X < 0)
        {
            position.X = 0;
        }
        if (position.X + 32 > screensize.X)
        {
            position.X = screensize.X - 32;
        }
        if (position.Y < 0)
        {
            position.Y = 0;
        }
        if (position.Y + 32 > screensize.Y)
        {
            position.Y = screensize.Y - 32;
        }

        foreach (Tile t in tiles)
        {
            if (absTilePos(position.X) == absTilePos(t.position.X))
            {
                if (intersect(position.Y, t.position.Y, 32, 32))
                {
                    if (position.Y > 0)
                    {
                        velocity.Y = 0;
                        position.Y = tilePos(position.Y);
                    }

                    if (position.Y < 0)
                    {
                        velocity.Y = 0;
                        position.Y = tilePos(position.Y) + 32;
                    }
                }
            }

            if (absTilePos(position.Y) == absTilePos(t.position.Y))
            {
                if (intersect(position.X, t.position.X, 32, 32))
                {
                    if (position.X > 0)
                    {
                        velocity.X = 0;
                        position.X = tilePos(position.X);
                    }
                    if (position.X < 0)
                    {
                        velocity.X = 0;
                        position.X = tilePos(position.X) + 32;
                    }
                }
            }
        }
    }

    bool intersect(float p1, float p2, float s1, float s2)
    {
        if (p1 < p2 && p1 + s1 > p2)
        {
            return true;
        }
        if (p2 < p1 && p2 + s2 > p1)
        {
            return true;
        }

        return false;
    }

    float tilePos(float f)
    {
        int i = (int)f;
        i /= 32;
        i *= 32;
        return (float)i;
    }

    float absTilePos(float f)
    {
        int i = (int)f;
        i /= 32;
        return (float)i;
    }

The player also glitches into blocks on it's top and right ( http://puu.sh/2cVQf ) when it hits them instead of bouncing off them - it just goes straight into them.

Does anyone know how to remedy this? Thanks!

sentences:
How to make an object with its own sprite draw an additional sprite on top of itself I'm making character select buttons for a Game Maker Studio 2 game, hoping to do so by just having a single object I can edit on an individual basis to change which character it represents. I also want the button itself to display the sprite of the character it's meant to represent like an image overlaying the button's own sprite. I can't seem to get a clear, direct answer on how this is done.

To sum up:

Character select button is an object with its own assigned sprite.
Each individual button object holds (a reference to) a corresponding character object the player may select by clicking that specific button.
Button object should be able to check the sprite of the character object it references, and draw it on top of its own sprite without replacing it entirely.

If anyone can help show me how to do that last part- or barring that, perhaps point me toward a better way to achieve a similar effect, it would be appreciated.

sentences:
How can I project a vector on another vector? I have a generic not normalized Vector3 v1 and I want to calculate its component along another Vector3 v2. I used to normalize the vector I want to be the direction and then multiplying the other vector's magnitude for it. I can't really understand if it would also work to multiply the other vector (not just its magnitude), but I want to know if there is a lighter way to do it, since compute the magnitude of a vector implies evaluating a square root.

In code I would say

Vector3 v1;
Vector3 v2; v2.Normalize();
Vector3 resulting_v = v1.Length() * v2;

the other case (I am not sure if can work) would be

Vector3 v1;
Vector3 v2; v2.Normalize();
Vector3 resulting_v = v1 * v2;

or, if there is a better solution, I'm listening

sentences:
Using components in the XNA Game State Management example? In the game state management example at the App Hub, they say that if you want to use components in the example you can extend the GameScreen to host other components inside itself.

I'm having a very hard time trying to tie this up.
I tried extending the GameScreen class by adding a public property of public List<DrawableGameCompnent> components { get; set; } and then add my components to that list when I initialize the current screen as well as looping over the components in the LoadContent, Update and Draw methods. However, this doesn't feel like the correct way to go - mainly because it doesn't work when I get to the implementation of my GameplayScreen.

Any thoughts?

sentences:
How do I add a random number of points to my score stored in Player Preferences? My problem is the value I get from Random.Range is not stored, but I get another value instead.

In level 1 I press the "claim" button to store a randomly-chosen score
In level 2 I retrieve the level 1 score using player preferences.
When I press the "claim" button again in level 2 I want to add the new random score to the score from level 1.

How can I do this?

Here is the code I'm using currently:

playermanager.cs

 internal static int pointsAdd;

 void Start()
 {
       PlayerManager.pointsAdd = PlayerPrefs.GetInt("score");
 }

 void FixedUpdate()
 {
        creditsText.text = PlayerPrefs.GetInt("score").ToString();
 }

 public void GetClaim()
 {
        PlayerManager.pointsAdd = PlayerPrefs.GetInt("score");
        Debug.Log("pointadd" + PlayerManager.pointsAdd);

        PlayerManager.pointsAdd =  Random.Range(20, 40);
        Debug.Log("Your Point is:" + PlayerManager.pointsAdd);
        Debug.Log("random.range" + Random.Range(20, 40));

        PlayerPrefs.SetInt("score", PlayerManager.pointsAdd);

        creditsText.text = ("" + PlayerManager.pointsAdd);
 }

Output:

sentences: Game uses gamecenter in iphone - can I design a fallback for 3G and prior devices? If I develop a game using gamecenter, does itunes connect lock me in to only supporting 3GS and above with iOS 4.0 and above, or will it still allow sales of my game on older devices (as long as I build in fallback so it never calls gamecenter framework)?

sentences:
I need help with 2D collision response (of stacking rotating polygons, with friction and gravity, for a game) Hi I am looking for suggestions on how to write a collision response for game programming purpose (so not a scientific simulation). I am dealing with 2D polygons that are rotating, and I want them to be able to stack. I also want friction and gravity. I have a detection mechanism that returns the separating axis, how long the polygons are overlapping, and up to 2 points of contact. For the response, I am currently using an impulse-based response, which main idea is:

find the separating axis, length of overlap, and the point of contact (if there are two, pick a random point between to simulate averaged force. i believe there are better ways than this)
separate the object (modifying their positions, taking into account of their masses. i do not separate them completely though, to keep track that they are colliding to reduce jitter)
calculate normal force based on the coefficient of restitution as if there is no friction.
calculate friction, as if there is no normal force. I also assume that the direction of the friction is the same throughout the collision.
apply the two forces (which result in a rather inaccurate result, since each force is calculated as if the other is not present. for non-rotating bodies though, this method is exact)

I am aware that this method requires the coefficient of friction to be sufficiently small due to the assumption that the direction of friction stays the same in a collision.

Also, the result is visually satisfying if gravity is not present. However, when there is gravity, objects on ground jitter and drift (even with zero coefficient of restitution)! It also happens for stacking objects. Larger coefficient of restitution and gravity increase the jittering.

I hope you can help me with this. Some things i would like to know more about is how to handle collision with two point of contacts (how to end up having an object sitting still on the ground?), how to reduce, and prevent if possible, jitter and drift (do people use the most accurate method possible, or is there a trick to overcome this?), and how to handle multiple objects collision (for example, in the case of stacking objects, how do I check collisions between all of them and keep them all stable at every frame so they don't jitter?). A total reformulation of my algorithm is also welcomed, as long as it works. Another thing to note is that I am not making a Physics game, so I only need a visually satisfying response (though a realistic response is preferable, if it is not performance-heavy). But surely jittering and drifting objects on flat ground are not at all acceptable. In addition, I am a Physics student, so feel free to talk about impulse and whatever needed.

Finally, I'm sorry for the long post. I tried to be as concise as I can. Thank you for reading it!

EDIT

It seems what I didn't manage to come up all this time is to separate resting contact as a class of its own and how to solve them. Currently reading the paper suggested by Jedediah. More suggestions on the topic are welcome :)

CASE CLOSED

After reading various papers referenced in the paper, successfully implemented simultaneous impulse method (referring to the original paper by Erin Catto, [Catt05]). Thanks maaaan!! The paper is wonderful. The current system is visibly much better than the previous.

Still haven't separated resting contact as a class of its own though, which brings me to my next question. Love you all! Haha (sorry, I'm just so happy thanks to you).

sentences:
How is it possible to call abstract methods from another class? Im creating a game using LWJGL and just as a bit of organising I made an Abstract class called Game so I could extend Game in my main class The game class is like so -

public abstract class Game {
    public abstract void init();
    public abstract void render();
}

Really simple stuff, and my plan was to call the render and init method in my DisplayManger class so every whenever I my display is created and updates it runs these methods so all games extending my game class with have their methods run. My approach was like this but as you probably have figured out you cannot a abstract method from another class nor from a static method from inside my abstract, it needs to be static to call from another class. Here was my approach -

public class DisplayManager {
    public DisplayManager(int width, int height) {
        try {
            Display.setDisplayMode(new DisplayMode(width,height));
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
        }
        Game.init();
        while (!Display.isCloseRequested()) {
            Game.render();
            Display.update();
        }
        Display.destroy();
    }
}

Does anyone know how I can call these two methods from this Display class?

sentences:
Best practice child and parent script What is the best practice coming to where to place the code in this scenario.

I have a gamobject called player. It has lots of child objects. One of them is sword.
Like this:

Player

Body

Head

Torso

Sword

So i have code that controls the player in player. It controls movement and triggers an attack animation which swings the sword. The code that checks if the sword is swinging and if it has hit something is at the moment inside the sword. My question is, what model is best practice? I can think of some:

All code in player. player checks if sword is colliding and handles what happens to the enemy that was hit.
sword checks for collision but player handles it by polling sword and takes care of what happens with enemy and player after.
sword checks for collision but player handles it  by listening to an event that sword triggers and takes care of what happens with enemy and player after.
sword handles everything by handling what happens to enemy and player communicating with parent through a reference.

sentences:
In WebGL, how can I efficiently render a mesh many times per frame, without instancing? I'm using WebGL and I want to render a single mesh many times at different locations. I know about WebGL 2's drawArraysInstanced() and drawElementsInstanced() calls, but I think only Firefox supports them now.

The only solutions I see are :

Put all the meshes in a single buffer and render it with a single call to drawArrays()/drawElements(), but that would be a waste of memory because the mesh contains a lot of vertices and if the meshes are not static I would need to re-load the vertices in gpu memory every frame or so.
Have a single mesh in memory and render each instance with a separate call to drawArrays()/drawElements(), updating the model matrix between each call. I don't think that's the best way.

Any ideas?
Thanks

sentences:
Space game scene boundaries I've been trying to add boundaries to my space game.

I've been following this tutorial with a sphere instead of a cube, but every time I start the game and move or rotate my ship it appears outside the sphere, as shown in the image:

The ship has a collider and a characterController.

Could anybody tell me what I'm doing wrong here? Thanks!

sentences:
Y and X - Am I doing it wrong? I sometimes run into small issues when doing my JavaScript projects.
That is because most build in functions of JavaScript run  X,Y if positions are needed. (In that order).

But when I build a 2D Array I start out with Y, it seems more logical for me to to run the X axis horizontal. If I am bad at explaining it, let me show you:

So my loops look like this:

for(var y = 0; y < 10; y++){
    for(var x = 0; x < 10; x++){
        console.log("Doh!");
    }
}

Is this so insane?
I would like to convert to the normal practise so that I have an easier time while building my game and don't have to do constant switcherroos.

So why is it X before Y ?

Edit:
Here is another example, and probably the main reason for my confusion:
X is Horizontal, and Y is Vertical in my books..

[
[0,1,2,3,4],
[0,1,2,3,4],
[0,1,2,3,4],
[0,1,2,3,4],
]

sentences:
Half-Life 2 BSP Lightmaps I'm writing a BSP viewer for a university project. So far I have the main geometry loaded properly, and the PVS working.

Now I'm trying to apply the lightmaps, but I can't seem to get the texture coordinates for the lightmaps calculated properly.

According to here: http://developer.valvesoftware.com/wiki/The_Source_Engine_BSP_File_Format

struct texinfo_t
{
    float textureVecs[2][4];  // [s/t][xyz offset]
    float lightmapVecs[2][4]; // [s/t][xyz offset] - length is in units of texels/area
    int flags;                // miptex flags overrides
    int texdata;               // Pointer to texture name, size, etc.
}

  The first array of floats is in
  essence two vectors that represent how
  the texture is orientated and scaled
  when rendered on the world geometry.
  The two vectors, s and t, are the
  mapping of the left-to-right and
  down-to-up directions in the texture
  pixel coordinate space, onto the
  world. Each vector has an x, y, and z
  component, plus an offset which is the
  "shift" of the texture in that
  direction relative to the world. The
  length of the vectors represent the
  scaling of the texture in each
  direction.

  The 2D coordinates (u, v) of a texture
  pixel (or texel) are mapped to the
  world coordinates (x, y, z) of a point
  on a face by:

  u = tv0,0 * x + tv0,1 * y + tv0,2 * z
  + tv0,3

  v = tv1,0 * x + tv1,1 * y + tv1,2 * z
  + tv1,3

  (ie. The dot product of the vectors
  with the vertex plus the offset in
  that direction. Where tvA,B is
  textureVecs[A][B].

  Furthermore, after calculating (u, v),
  to convert them to texture coordinates
  which you would send to your graphics
  card, divide u and v by the width and
  height of the texture respectively.

So I am doing the calculation as follows. Take the dot product of the vertex and the lightmap vector(lightmapVecs[0][0], lightmapVecs0, lightmapVecs[0][2]) add the offset (lightmapVecs[0][3]), subtract the mins, and divide the result by the width/height.

float s = Vector3f.dot(v, new Vector3f(lightmapVecs[0][0], lightmapVecs[0][1], lightmapVecs[0][2])) + lightmapVecs[0][3] - f.LightmapTextureMinsInLuxels[0];
float t = Vector3f.dot(v, new Vector3f(lightmapVecs[1][0], lightmapVecs[1][1], lightmapVecs[1][2])) + lightmapVecs[1][3] - f.LightmapTextureMinsInLuxels[1];
s /= (f.LightmapTextureSizeInLuxels[0] + 1);
t /= (f.LightmapTextureSizeInLuxels[1] + 1);

However it ends up looking like this:

Here's a sample calculation for the texture coord 't' for one vertex.

vertex = 352.0, -144.00027, -224.0
lightmap vector = -4, 0, 0
lightmap offset = 0
lightmap mins = 9
lightmap height = 14

So the dot product is -1408

(-1408 + 0 - 9) / 14

t = -101.21

This seems way off.

sentences:
How to read ARGB pixel data from SDL2 surface and store them in an array? I've been trying for hours now to figure out why this piece of code is giving me seg fault, but can't figure out why.
 void pixel::Texture::LoadTexture(const char* filepath)
 {
    SDL_Surface* image = IMG_Load(filepath);
    SDL_Surface* formattedImage = SDL_ConvertSurfaceFormat(image, SDL_PIXELFORMAT_ARGB8888, 0);

    textureBuffer = new Uint32[formattedImage->pitch * formattedImage->h];

    width = formattedImage->w;
    height = formattedImage->h;
    pitch = formattedImage->pitch;

    SDL_LockSurface(formattedImage);

    Uint32* pixels = (Uint32*)formattedImage->pixels;

    int bpp = formattedImage->format->BytesPerPixel;

    for(int y = 0; y < height; y++)
        for(int x = 0; x < width; x++)
            textureBuffer[(formattedImage->pitch * y) + (x * bpp)] = pixels[(formattedImage->pitch * y) + (x * bpp)];

    SDL_UnlockSurface(formattedImage);

    SDL_FreeSurface(image);
    SDL_FreeSurface(formattedImage);
 }

Essentially, what I'm doing is I have an array of unsigned 32 bit integers called the texture buffer. All I do is load an image into a surface then convert it's pixel format to ARGB then start reading each pixel and storing it inside my texture buffer array but for some reason the pixels array gets an out of bounds error at some point in runtime and I can't figure out exactly why.

sentences:
Match-3 should pieces store their location in the matrix? I'm making a match-3 game. I have a TileManager script which stores all the tiles in a matrix, it's a singleton and it handles tile swapping and basicly everything regarding the management of tiles.
I have a variable called selectedTile. I have a method called SwapSelected which swaps the currently selected tile with the one you just clicked on. As pieces don't know their location in the matrix I can only loop through the whole thing to find them but it feels extremly stupid I just feel like there's gotta be a better way. If pieces stored their location and I kept that updated all the time that'd feel stupid too.
What could I do to make this method work nicer and more optimalized? Is there a way or there is no problem with how I do it?
    public void SwapSelected(Tile tileToSwap)
    {
        Vector3 tempPos = selectedTile.transform.position;
        selectedTile.transform.position = tileToSwap.transform.position;
        tileToSwap.transform.position = tempPos;

        Vector2Int tileToSwapPosition = new Vector2Int(-1, -1);
        Vector2Int selectedTilePosition = new Vector2Int(-1, -1);

        //OPTIMALIZE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        for (int x = 0; x < _tileMap.GetLength(0); x++)
            for (int y = 0; y < _tileMap.GetLength(1); y++)
            {
                if (_tileMap[x, y] == tileToSwap)
                {
                    tileToSwapPosition = new Vector2Int(x, y);
                }
                if (_tileMap[x, y] == selectedTile)
                {
                    selectedTilePosition = new Vector2Int(x, y);
                }
            }

        _tileMap[selectedTilePosition.x, selectedTilePosition.y] = tileToSwap;
        _tileMap[tileToSwapPosition.x, tileToSwapPosition.y] = selectedTile;

        UpdateTileName(tileToSwap);
        UpdateTileName(selectedTile);
    }

sentences:
Unity OnCollision() not working Seem to have exhausted google looking for an answer to a VERY bullet simple code that should work.

void onCollisionEnter(Collision col) {
    print ("hit " + col.gameObject.name);
    Destroy (gameObject);
    }

Bullet object has the above script, SphereCollider (radius a lot bigger than object), RigidBody, not a trigger, not kinematic, is travelling slow. All checked during runtime.

When it hits a wall (Box collider), it just bounces off but no collisionEnter code is ran.

Debug console bubble is 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:
Is there a way to duplicate the windows desktop zooming in SDL to make low res pixels look like stylyzed cartoon art? When you hit the Win key and numpad plus key at the same time it opens the desktop magnifying glass and the effect of this on low res pixel art is to make it look like super cool stylized cartoon art. I want the game to look like this all the time. Is there a way to do this permanent i SDL or DirectX or OpenGL?

How I have achieved this image is to run the game in a small windows and have the windows 10 magnifying glass hoover over it and I hit print screen. And I want the game to look like this all the time in full screen.

Ps. This is the Gradius 3 ship that I use for place holder graphics for question asking purposes.

sentences:
How to handle and make animations? I just finished a game for my design class and I ran into a problem that I always have but this time I'm going to learn the right way to do it. I was making the background animation for my menu in photoshop (just moving layers and tweening them)and I ended up rendering out 300 frames as pngs. I always do animations this way because the only way I've learned how to write animation engines is to use a root file name and append 00x on the end to get the current frame or to create an array of images to then loop through. This results in me having large numbers of individual images in my assets folder. Is there a better way to do animations? Both programmatically and in making them. I want to hand draw the frames most of the time but I don't usually want vector images. (So no flash unless its changed recently.)

Thanks!
(I'm working off no sleep for three days now so if I need to clarify let me know)

sentences:
Rotating an object while moving I have an object the is a perfect circle.  The object is moving left, right and jumping with collision detection.  What I am trying to do now is rotate the object while it is moving, so it looks like rolling.

This is the code that I have so far:

key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space);

//1  right, -1 left
var move = key_right - key_left;
hsp = move * walkspd;
vsp = vsp + grv;

if(place_meeting(x, y + 1, oWall)) && (key_jump)
{
    vsp = -7;
}

//horizontal collisions
if (place_meeting(x + hsp, y, oWall))
{
    while (!place_meeting(x + sign(hsp), y, oWall))
    {
        x = x + sign(hsp);
    }
    hsp = 0;
}
x = x + hsp;

//vertical collisions
if (place_meeting(x , y + vsp, oWall))
{
    while (!place_meeting(x, y+ sign(vsp), oWall))
    {
        y = y + sign(vsp);
    }
    vsp = 0;
}

sentences:
LWJGL GL_QUADS texture artifact I managed to get working LWJGL in Java, and I loaded a test image (tv test card), but I keep getting weird artifacts outside the image.

Code:

glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(10, 10);
glTexCoord2f(1, 0);
glVertex2i(500, 10);
glTexCoord2f(1, 1);
glVertex2i(500, 500);
glTexCoord2f(0, 1);
glVertex2i(10, 500);
glEnd();

What could be the cause?

sentences:
Make a basic running sprite effect I'm building my very first game with XNA and i'm trying to get my sprite to run.
Everything is working fine for the first sprite.
E.g : if I go right(D) my sprite is looking right , if I go left(A) my sprite is looking left and if I don't touch anything my sprite is the default one.
Now what I want to do is if the sprite goes Right, i want to alternatively change sprites (left leg, right leg, left leg etc..) xCurrent is the current sprite drawn xRunRight is the first running Sprite and xRunRight1 is the one that have to exchange with xRunRight while running right.
This is what I have now :

    protected override void Update(GameTime gameTime)
    {
        float timer = 0f;
        float interval = 50f;
        bool frame1 = false ;
        bool frame2 = false;
        bool running = false;

        KeyboardState FaKeyboard = Keyboard.GetState();
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

            if ((FaKeyboard.IsKeyUp(Keys.A)) || (FaKeyboard.IsKeyUp(Keys.D)))
            {
                xCurrent = xDefault;
            }

            if (FaKeyboard.IsKeyDown(Keys.D))
            {

                timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
                if (timer > interval)
                {
                    if (frame1)
                    {
                        xCurrent = xRunRight;
                        frame1 = false;
                    }
                    else
                    {
                        xCurrent = xRunRight1;
                        frame1 = true;

                    }
                }

                xPosition += xDeplacement;

            }

Any ideas...? I've been stuck on this for a while..
Thanks in advance and let me know if you need any other part from the code.

sentences:
How to set up borders in snake game I have a snake game set up in Java and I wanted to be able to toggle between the ability to go through the sides and pop out the opposite side and the classic version where you die when you hit the border. The problem is that my snake keeps going one spot after the border; how do I fix this?

This is one of the parts of my code, that acts when the right arrow key is pressed:

if(right) {
    for(int i = lengthofsnake - 1; i >= 0; i--) {
        snakeylength[i+1] = snakeylength[i];
    }

    for(int i = lengthofsnake; i >= 0; i--) {
        if(i == 0) {
            snakexlength[i] = snakexlength[i] + 25;
        }
        else {
            snakexlength[i] = snakexlength[i-1];
        }

        if(!borderGameplay) {
            if(snakexlength[i] > 850) {
                snakexlength[i] = 25;
            }
        }
        else {
            if(snakexlength[i] > 850) {
                borderDead = true;
            }
        }
    }

    repaint();
}

borderGameplay is the variable that you can toggle to have borders on and off, and borderDead is used in this if statement:

if(borderDead) {
    if(score > highScore) {
        highScore = score;
    }
    playing = false;
    dead();
    deadGraphic(g);
}

This is my deadGraphic(g):
    public void deadGraphic(Graphics g) {
        g.setColor(Color.WHITE);
        g.setFont(new Font("arial", Font.BOLD, 50));
        g.drawString("Game Over", 300, 300);
        g.setFont(new Font("arial", Font.BOLD, 20));
        g.drawString("Press \"Space\" To Restart And \"Enter\" To Toggle Borders", 160, 340);

    if(borderGameplay) {
        g.drawString("Borders ON", 370, 380);
    }
    else {
        g.drawString("Borders OFF", 365, 380);
    }
 }

This is my dead():

public void dead() {
    right = false;
    left = false;
    up = false;
    down = false;
    dead = true;
    score = 0;
    moves = 0;
}

And finally, my JFrame:

JFrame obj = new JFrame("Snake");
gameplay Gameplay = new gameplay();
obj.setBounds(10, 10, 905, 700);
obj.setBackground(Color.DARK_GRAY);
obj.setResizable(false);
obj.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
obj.add(Gameplay);
obj.setVisible(true);

If you need to see other parts of my code, please tell me; this question is already really long, and my total code is 550 lines.

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:
Wait for vSync without swapping buffers with SDL I am trying to optimize my SDL rendering loop for an immediate mode GUI application that doesn't need to be redrawn every frame. I have vSync turned on and would like to skip buffer clearing / drawing altogether if the GUI hasn't changed.

The problem is, swapping buffers without redrawing causes flickering because of double / triple buffering. On the other hand, also skipping the buffer swap causes the program to run full throttle because the waiting is effectively done in SDL_GL_SwapWindow.

Ideally I would need some kind of function that waits for vSync without swapping buffers, but I haven't seen one in the SDL documentation. I've tried the following solutions but none are satisfying:

Drawing VBOs every frame even if they haven't been updated. That will reduce load on the CPU but not on the GPU, so not ideal.
Keeping track of which backbuffers are up to date, and only redraw them if they are dirty. This worked in my testing but requires to make some assumptions (the number of backbuffers, and hoping the driver didn't replace them with fresh ones). So not reliable enough.
Manually waiting with a small delay. Probably the most reliable, but still not ideal.

sentences:
Categorizing Projectiles in an arcade shooter (multiple inheritance?) I have been working on a simple arcade shooter in Java in the vein of missile command/space invaders.  I've made a base Projectile class and have been extending other Projectile types from it. This has been a nice way so far for me to keep the same basic behavior of the projectile, while experimenting with new ideas, like a missile projectile, electric projectile, bursting, etc.  Before I went further though, I started to realize I needed to think about this in a better organized way because of this problem: what if I wanted to make a projectile that has features of more than one type?

Like, for example, if I wanted to make a projectile that is both seeking as well as bursting, or seeking, and shocking, etc... or a projectile that is all of the types.  It seems repetitive then for me to have to create a class for each combination type. If I tried to do this on my own now, I'd essentially be copying n' pasting code from one type into another to make the hybrid type.

What's the best way to organize this type of design?  It seems as though I need multiple inheritance. I don't understand how that works exactly in runtime though and how to ensure that the functions that I'm required to implement will be called and perform the behaviors I want, given any projectile.

Maybe in code it looks something like this?

Projectile p = new Projectile(loc, vel);
p.attachBehavior('electric');
p.attachBehavior('bursting');

and Projectile already inherits all the types possible? (It seems like it will make the Projectile class really huge though) and so perhaps attachBehavior() is essentially a loop that cycles through all the interfaces that the Projectile has?

However, looking at this post on Java and multiple inheritance (https://stackoverflow.com/questions/21824402/java-multiple-inheritance?lq=1), it seems as though even the base Projectile would also be an inherited thing. So I'm a bit confused about how to design such behaviors. (Even more confused when I think that some projectiles like lazers/beams behave instantaneously compared to gun bullets)

Also, when I'm doing things like this, I'm a bit wary about how to code in such a way that I'm not running more for loops than I should. Like for example, the missile projectile type needs to loop through the enemies to find the closest enemy, but the electric type, which shoots out an arc to a badguy will also need to loop through the enemies to see if its close to it.  Instead of having one for loop, by having these two behaviors, haven't I now made the game run potentially slower because I'm going through two for loops now as opposed to just making a distinct hybrid projectile class that checks for both conditions in the same for loop?

sentences:
Client Side Logic vs Server Side Logic for HTML5 Game I'm writing an HTML5 game that takes place in a single screen and does not have any data that would need to be saved (except for a score). I am writing all of my canvas logic on the front end. because it seemed like the easiest way to program interactions. However Ive been reading on r/gamedev that the best way to organize games is to sent client input to the server and have the server render the results on the client. I have a couple questions about this:

1.) If my game takes place on a single screen (meaning no changes in background, enemies, etc. Think Space Invaders), is it worth putting my game logic on the server?

2.)If I do put my logic on the server, how can i facilitate clean communication with the client? Web sockets? or plain HTTP? Using a WebSocket seems straightforward for this kind of task, but they are not supported by all browsers. On the flip side I'm kind of hazy on how HTTP could be used to send and receive data from the client.

Any advice would be great.

sentences:
Why do I get this crash when dealing with SDL_Events? I do not know if this is the best way to handle these SDL_Events, but I am attempting to create a very abstract and generic code that will update my game object. I have a Scene which in my case is just a map from a string to a game object that has special functions to Add(string key, gameobject value), Remove(string key), Render(), and Update(SDL_Event& event). I think this last method is the problem.
Scene.cpp
void Scene::Update(SDL_Event& ev)
{
    for (std::map<std::string, GameObject&>::iterator it = x_ObjectDictionary.begin(); it != x_ObjectDictionary.end(); ++it)
    {
        it->second.Update(ev); //where the game crashes
    }
}

void Scene::Render()
{
    for (std::map<std::string, GameObject&>::iterator it = x_ObjectDictionary.begin(); it != x_ObjectDictionary.end(); ++it)
    {
        it->second.Render();
    }
}

void Scene::Add(const std::string& key, GameObject& value)
{
    x_ObjectDictionary.insert(std::pair<std::string, GameObject&>(key, value));
}

GameObject& Scene::Get(const std::string& key)
{
    std::map<std::string, GameObject&>::const_iterator iterator = x_ObjectDictionary.find(key);
    if (iterator == x_ObjectDictionary.end()) return GameObject();
    return iterator->second;
}

GameObject& Scene::Remove(const std::string& key)
{
    GameObject removed;
    std::map<std::string, GameObject&>::const_iterator iterator = x_ObjectDictionary.find(key);
    if (iterator == x_ObjectDictionary.end()) return GameObject();
    removed = iterator->second;
    x_ObjectDictionary.erase(iterator);
    return removed;
}

This iterates my map and updates all of the GameObjects. My game object update method is defined like this in the header file:
GameObject.h
class GameObject
{
public:
    GameObject() {}
    virtual ~GameObject() {}

    virtual void Update(SDL_Event& ev){}

    virtual void Render(){}

    virtual void Destroy(){}

};

Now, I created a scene. This Scene is called Splash and extends Scene properly. I created it like so
void Splash::CreateScene()
{
    Add("something", GameObject());
}

Every time I execute/debug my project now, my program "breaks" on the it->second.Update(ev); line and inside the console after I stop "debugging" the message says something along the lines of Exception thrown at 0x00007FF7CB457024 in XXXXXX.exe: 0xC0000005: Access violation reading location 0x00001CFA67BC13F9.
Am I going about this completely incorrectly? Or did I just make a stupid mistake?

sentences:
How to go about implementing pathfinding in Unity with Tiled2Unity map prefabs? I have created a map using Tiled application and have added collision boxes and used Tiled2Unity to import the map to Unity. The collisions are working with key inputs.

I want to implement pathfinding in my 2D tile game.

I have studied and written a A * pathfinding code with 2D array in C#, which is working. But with the map import I have no way to iterate through the tiles.

How to go about implementing pathfinding?

sentences:
How 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:
Every Item is colliding but 1 In my game I have a BULLET, MOONS, STARS, and A SHIP. I shoot bullets from the ship and hit stars or moons and collisions occur. Yet when a moon runs into my ship there is no detection even though I set the a Collider for 2D on both of them.

    void OnCollisionEnter2D (Collision2D col) {
        Debug.Log (this.transform.tag);//moon hit ship not printing
        Debug.Log (col.transform.tag);//only bullet hit moons and stars
    }

Heres a quick snippet
https://i.gyazo.com/acc0bbf5d2aab994db3a6598bfd206aa.mp4

sentences:
Do associative array data structures have a place in game development? Is it a bad idea to use a map data structure (an associative array or dictionary) in game development?

According to this flowchart, the ideal container for storing game object's container would actually be a map for many games. But I've heard anecdotal claims that maps are a very bad choice for games.

Is this true?

sentences:
Cocos2d JS - Getting vector reflection I'm working on a small Breakout clone using Cocos2D-JS, without the use of a physics engine.

One of the things that baffles me was how the ball bounces. My friend came up with this:

  inputVector - 2(normalVector * inputVector)

I have no idea how to translate that in code. So I tried with this:

g_Ball.position = this.velocityComputer(cc.p(g_Ball.x, g_Ball.y), cc.p(this.x, this.y));

velocityComputer: function(inVector, thisNVector) {
    var prodVec = cc.pDot(inVector, thisNVector);
    var retVec = inVector - (2 * (prodVec * inVector));
    cc.log(retVec);
    // cc.log(blockNVec);
    return retVec;
},

But g_Ball doesn't change directions, and retVec simply logs NaN.

Any suggestions?

Thanks.

sentences:
View Full File Name in Project View Unity Is there any way to view the full name of a file in Unity Project view without having to click on it?

This picture sums up my frustration:

sentences:
How to keep sprite on screen while increasing its width to screen width I have been able to increase the width of a sprite to the width of the screen size, but the sprite exceeds the borders of the screen width to the right or left when I try expanding it when it's not at the center. How can I scale the sprite in such a way that it's width increases on both sides till it occupies the screen width without exceeding it's bounds, regardless of the sprite's initial position? Please see my code below:

bool isScaling = false;

IEnumerator scaleToX(SpriteRenderer spriteToScale, float newXValue, float byTime)
    {
       if (isScaling)
         {
           yield break;
         }
       isScaling = true;

       float counter = 0;
       float currentX = spriteToScale.transform.localScale.x;
       float yAxis = spriteToScale.transform.localScale.y;
       float ZAxis = spriteToScale.transform.localScale.z;

       Debug.Log(currentX);
       while (counter < byTime)
        {
          counter += Time.deltaTime;
          Vector3 tempVector = new Vector3(currentX, yAxis, ZAxis);
          tempVector.x = Mathf.Lerp(currentX, newXValue, counter / byTime);
          spriteToScale.transform.localScale = tempVector;
          yield return null;
        }

       isScaling = false;
  }

sentences: How to play a movie on top of a webcam texture I've been through the Unity docs, searched here, and on stackoverflow; I have not found any good information about using the WebCamTexture for my purposes. So here goes, how do I play a movie asset such as an mp4 clip so that it appears to be on top of the captured webcam image? Lets assume the movie is semi-transparent.

sentences:
OpenGL, Offset and Camera Space I was reading chapter 4 of the Arcsyntesis OpenGL tutorial when I came across this line in the GLSL shader.

vec4 cameraPos = position + vec4(offset.x, offset.y, 0.0, 0.0);

About it, the tutorial says

  The first statement simply applies the offset to get the camera space positions of the vertices.

I understand what cameraPos is but I don't get what the offset is. It's defined as a uniform and it's passed to the shader by the main program like this:

glUniform2f(offsetUniform, 1.5f, 0.5f);

So offset.x = 1.5f and offset.y = 0.5f. But I see no mention of that offset in the rest of the tutorial and its values seem quite random to me. I know that the offset from the projection plane to the eye is always -1 but that refers to a value of Z. Where do X and Y come from? Are they arbitrary values? What they mean, what they do? I understood everything up to the point but I can find no reference to said offset in the tutorial and I'd like to know if someone can explain it to me, please.

Edit: the last line I posted was probably forgotten by the author of the tutorial and can be find in the book's source distribution here.

sentences: Unity - UI - Raw Image with Texture becomes Smaller after Build I am a beginner in the game development world, I have just one quick problem with the UI, as you can see during the Unity Player, the UI (Raw Image w/ Texture) is normal in size but when I build my game to APK or EXE and run it, the UI is small. Why is this happening and how to fix it?

sentences:
Make object follow mouse angle? what I'm trying to do is make the paddle follow the mouse position(red dot).
I know how to rotate the paddle relatively to the center of the screen, but I'm not sure how to determinate the coordinates.

thanks.

sentences:
Billboards offset for character names + rotation I am successfully using Matrix.CreateBillboard in my XNA game to print the characters name above the models. The problem I have is with the offset (to appear above the models). Currently, I am creating the location of the text using;

Vector3 objTextPosition = objPlayerShip.objShipVector + new Vector3(0, 3, 0);

This works fine if I stay within the same general lateral location. If I rotate above or below the model the text either appears on top of, or is covered by (or even below) the model. To compensate for this, I would need to create a rotation around the model (should I use a quaternion?) with the top always pointing up (with a Vector3(0, 3, 0) offset).

Am I over thinking this? Is there a simple way to achieve this?

Thanks in advance!

Here is the correct way (above the model)

Here is looking from top, down

sentences:
Swept AABB vs Line Segment 2D I've really exhausted as much as Google has to give, I've spent a solid week googling every combination of words for an "AABBvsLine sweep", downloaded countless collision demos, dissected SAT intersection examples and an AABBvsAABB sweep trying to figure out how to approach this. I've not found a single thing covering this specific pairing.

Can anyone shed any light on how to get the hit time of a swept AABB vs a Line segment in 2D? I'm still getting familiar with the SAT but I do know how to implement it to a degree, I'm just not sure how to extract the hit time from the velocity in the non axis aligned separating axes for the sweep.

I really would appreciate anything at the moment, some code or even some helpful links, I'm at my wits end!

sentences:
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:
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: What is a quaternion? What is a quaternion, and do how they work? Also, what advantages do you gain using three points on a 2D plane? Finally, when is it considered good practice to use quaternions?

sentences:
How to decrease the size of a distance? I made a code for the character to be teleported to the place where the mouse cursor is, if the distance is less than or equal to 350.

Blueprint:

I happen to wish that if the distance were greater, the character teleported to the equivalent point of the line (distance between character and mouse cursor) of 350.

What I would like to know how to do:

I've thought about using the Line Trace by Channel, but I can not think of how to decrease the value of a distance and find the equivalent point in a line (vector value).

EDIT 1 (attempt based in Ocelot comment)

Blueprint:

Result in game:

Now the character teleports to a point that seems to have reference to the center of the level. I tried to add this vector to the character's position, but I did not get the desired result.

PS - The print of the word "Hello" on the screen indicates how many times I clicked on the teleportation key in the last 2 seconds.

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:
Libgdx: touchup fired even when figure not on texture I've implemented a touchup listener for an actor in stage. Now what happens is that when user touch downs the sprite and releases finger, its all good. The problem is when user touch downs the finger, and drag it somewhere else (possibly to cancel the touch) and releases, it still fires the touch up event as if nothing ever happened. How do I stop that? Here's my code:

voiceToggle.addListener(new InputListener() {
    @Override
    public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
        System.out.println("touched");
        return true;
    }

    @Override
    public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
        System.out.println(event); // still fires even if not on original touchdown element
    }
});

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:
How to decompose a rectangular shape in a Voronoi diagram, only generating convex shapes? I think this is a very straighforward question, lets say i have a building in 2D, a rectangle shape. Now i want to decompose that area in a lot of convex shapes, as seen in a voronoi diagram, or closely like it, just so I can add those shapes to the physics engine, and have a realistic destruction.

Bonus: Possible suggestions on how to make the effect more dynamic and interesting.

Please keep in mind we re talking about realtime calculations..

sentences: How do you create 2D skeletal animations without extra software? I'm working on a Cocos2d-x game and I'm developing on Windows. What I want is to make some skeletal animations, without using a tool or extra software to do so?

sentences:
Can DirectX9 be used without HWND handle? I found an excellent code here that does almost everything I need: running an HLSL shader on memory texture to process video frames into another texture buffer without displaying it.
http://www.codeproject.com/Articles/207642/Video-Shadering-with-Direct-D?msg=5092502#xx5092502xx

My question is: can DirectX9 be used to work purely with in-memory data without display and without specifying a HWND handle? What needs to change in the code if not giving it a HWND?

The code I'm writing is a DLL that has no graphical interface.

sentences:
Random Position between ranges Does anyone have a good algorithm for generating a random y position for spawning a block, which takes into account a minimum and maximum height, allowing player to to jump on the block.

Blocks will continually be spawned, so the player must always be able to jump onto the next block, bearing in mind the minimum position which would be the ground, and the maximum which would the players jump height bearing in mind the ceiling

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:
Do delays after losing and before restarting serve as a defense against burnout, or are they addiction machines? In games like Super Hexagon or even Everwing, there's a very brief but noticeable delay from losing to starting over: waiting for the restart button to appear, pressing it, etc...

Is this a defense against player burnout? If there's no pause that separates one game try from next, the game might feel never-ending and burn out the player quickly.

Or is it a way to keep the player addicted? I often suspected this in Everwing, because that game's hardly shy about its avaricious nature. Perhaps there's a psychological effect in making the player wait before they can play again — like building the craving part of a habit?

Or perhaps a lack of this delay is to keep the flow going, so to speak? Ori and the Blind Forest does something similar in its Ginso Tree level. It has very fast restarts, no button or anything, and deaths do not restart the music that's playing in the BG. The result is that deaths do not break the flow of the game, and despite them the whole level feels seamless.

So, are there any studies on this? Barring those, anecdotes? I couldn't find anything, anywhere.

sentences:
Simple animation text color change I apologize in advanced if this is a trivial ask, but I am wondering if it is possible to use an animation to change the color of a Text element from teal -> white without any lerp, i.e the color instantly changes. My current animation is only the one frame at 0:00 where I do the switch, but you can still see that the color is lerping even though it is the first and only frame. Am I missing something simple or should I just script the change? Fixing the problem is easy (Trivial to script), but I am just curious if there is something in the animation I can change to not have the color lerp?

I posted the question here as well, but I never have any luck posting on the Unity forums.

sentences: Saving video to android device (unity) How can I create a folder on Android device, download from ftp-server video and save it there?

sentences:
OpenGL 2.0 - How to swap buffers for color picking I'm trying to reproduce color picking on iOS, following the technique described here: http://www.lighthouse3d.com/opengl/picking/index.php3?openglway2, with OpenGL ES 2.0.

When the user touches the screen, I need to draw the objects on a buffer different from the one displayed on the screen, which seems to be done by glRenderMode(GL_SELECT); how could i do the same with OpenGL ES 2.0?

Should I create a support buffer as described here?
https://developer.apple.com/library/ios/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/WorkingwithEAGLContexts/WorkingwithEAGLContexts.html#//apple_ref/doc/uid/TP40008793-CH103-SW6

Thanks for any suggestion,

DAN

sentences:
Flipped camera with Google VR I just imported latest Google VR SDK into Unity and made a simple scene that has only Main Camera, plane, and single zombie just standing there with T-Pose.

In Main Camera, I added GvrPointerPhysicsRayer component, and it has GvrReticlePointer as child object.

Running in Unity Editor seems fine but when I build and run, whole world is just flipped.

I can't find any related issues about this anywhere, and struggle with this almost a day.

Why camera flipped and how do I fix it? What am I missing?

Using Unity 2019.1.0f2 and gvr-unity-sdk@1.200. Any advice will very appreciate it.

P.S. I saw the warning message in project settings - default orientation:

  Virtual Reality Support is enabled. Upon entering VR mode, landscape left orientation will be the default orientation unless only landscape right is available.

This message never disappear whatever default orientation selected.

sentences:
2D Voxel isometric rendering with non grid-aligned objects I'm currently working on making a simple SDL2 game (written in C++) where the maps are comprised of sprite voxels (essentially just a png of an isometric cube). Game entities move in 3D space. The world is rendered in 2D by a change of basis, where i,j,k are vectors (96,43,0), (96, -43, 0), (0, -105, 0)

Everything works fine with cubes that are aligned to the grid, the [x,y,z] locations and their contents are drawn in the correct order.

Moving entities are drawn at their closest grid-space location, resulting in a problem when the player sprite oversteps the boundary of their closet grid.

I don't know how to overcome this problem. One idea I had was to assign the player a list of [x,y,z] locations they are occupying, and have each of those locations when drawn, draw only the segment of the sprite that occupies their region. Unfortunately I lack the knowledge of how that could be carried out using SDL2.

Any advice would be appreciated, even if it isn't SDL specific. I'm sure there's an obvious solution and well-known technique, but my searches so far haven't been successful.

sentences: An evaluation of game UI, based on certain usability criteria? Is there a resource online which has made the effort to evaluate game user interfaces and estimate their usability (by genre)? (something like what Nielsen does). In-game reviews in magazines unfortunately do not always present an objective and quantifiable point, based on established heuristics or criteria

sentences:
Planar mapping/projecting UV coordinates from normal I've got set of vertices, and would like to calculate their UV coordinates by projecting them by a given normal. Similar to what "planar mapping" does in 3ds max.

Another way of looking at it is that I want to flatten the vertex positions from a given normal direction, so that I can simply use their X & Y (or X & Z depending on your preference) coordinates as UV coordinates.

I'm thinking it's a simple matter of a mathematical Vector function, basically rotating vertex positions along the normal, but I can't figure out the math behind it. I'm using C# and XNA, so I've got Vector3, Matrix and Quaternions. Preferably as cheap as possible.

Any help?

sentences:
Rotate vector by matrix? If I have a Vector, say (1,1), how can I rotate it around the origin (0,0)?

I'm working in XNA if that helps.

sentences:
Networking gampeplay - Sending controller inputs vs. sending game actions I'm reading about techniques for implementing game networking.

Some of the resources i've read state that it is a common practice (at least for some games) to send the actual controller input across the network, to be fed into the remote game's loop for processing.

This seems a bit odd to me and i'd like to know what are the benefits of using such a method?

To me, it seems that controller input is merely a way to gather data to be fed into the game, which in turn determines how to translate these into specific game actions.

Why would i want to send the control data and not the game actions themselves?

sentences:
How should I approach architecting a data-driven shoot-em-up? I'm venturing into Mobile/Tablet based development coming from the world of Web Applications.

I want to write a game similar to 1942/43 video game from the 80's:

...similar in the sense that I have a plane/spaceship that flies vertically "up" the screen and stuff comes down to attack it (otherwise nothing that would violate copyright).

I'm familiar with collision detection, sprites, object pooling, etc. but what I'm spinning my wheels on is how to layout all the code for this game.  e.g. it doesn't fit my normal MVC pattern, I don't have a DB, and the user input will likely be limited to touch based movement around the screen with "auto-fire" on all the time.

What I'm blanking out on is how to do all the "levels" and sequence "waves" of attackers within a level.

Should I just have a "level" file for each level, that queue's up attack waves? if so, based on time? based on some event? based on a position passed by the player?

e.g.

<level id="1">
  <event timeoffset="500" type="attack" name="vConfiguration" position="50"/>
  <event timeoffset="1250" type="attack" name="jConfiguration" position="75"/>
  <event timeoffset="1300" type="bonus" name="quadGunUpgrade" position="10"/>
  ...
</level>

Part of me thinks this would be really easy to setup levels this way, then read in the file to queue up the events for the attacks/bonus/? to occur (where each named "attack" is a bit of configured code to position "N" enemies and start their flight sequences)

The other part of me thinks - whoa! before you even dream of implementing this - determine how others would approach it - no need to re-invent the wheel or create a monster.

sentences:
Why not pre-render story parts in a game? When playing games nowadays there are often story related cut-scenes, during which you cannot interact with the game, you can only listen to it or watch it while it plays.

However in a lot of games these story scenes are rendered live with the game engine, and not with pre-rendered videos. I can't seem to understand why the story scenes aren't pre-rendered during game development

My question is:

Why not pre-render a story cut-scene during game development as a video with the highest settings so the user doesn't need to render it on his/her end?

My guess is that game developers don't choose to do this because videos and real-time game rendering need a smooth transition a lot.

sentences:
Text-based hold 'em game in C using TCP So I'm trying to create a simple text input Texas Hold 'Em game that can be played in a Terminal between multiple computer. (Disturbing lack of hold 'em games that don't require Facebook integration or a million ads or micro transactions :c )

With my current knowledge I can create the TCP Server and Connect some clients, but I'm not sure how to proceed from here. How can I communicate between the clients and server turn by turn using text input effectively?
My vague idea of what to do is

Accept clients, store FD in Array
Loop through Id's sending them 2 cards each
Create thread with a game info struct, that reads users text input
Wait for thread to finish and return value will be the players move
Update game info, and move repeat step 3-4 for all Clients
Break whenever only 1 player is left, or all bettings phases are over then repeat

This outline makes sense in the server, but I'm not sure how to construct the client to not do anything until it gets prompted by the thread creation in the main server while loop. If anyone has any advice or links to helpful articles or example code I would really appreciate it thanks so much!!

sentences:
Assimp skeletal animation matrices I startded to make an assimp only opengl skeletal animation demo. For that I used this: http://sourceforge.net/p/assimp/discussion/817654/thread/5462cbf5
And something is not correct in bone matrices.

and my standerd bob_with_lamp model(.md5) looks like this. its moving its parts but not in correct way.This is the code:

    for( size_t a = 0; a < anim->mNumChannels; ++a)
{
  const aiNodeAnim* channel = anim->mChannels[a];
  aiVector3D curPosition(0,0,0);
  aiQuaternion curRotation(1,0,0,0);
  aiNode* targetNode = scene->mRootNode->FindNode(channel->mNodeName);
  while((int)time >channel->mNumPositionKeys) time-=channel->mNumPositionKeys;
  curPosition = channel->mPositionKeys[(int)time].mValue;
  curRotation = channel->mRotationKeys[(int)time].mValue;
  aiMatrix4x4 trafo = aiMatrix4x4(curRotation.GetMatrix());
  trafo.a4 = curPosition.x; trafo.b4 = curPosition.y; trafo.c4 = curPosition.z;
  targetNode->mTransformation = trafo;
}
for (unsigned int n = 0; n < scene->mNumMeshes; ++n)
{
    const aiMesh* mesh = scene->mMeshes[n];
    std::vector<aiMatrix4x4> boneMatrices( mesh->mNumBones);
    for( size_t a = 0; a < mesh->mNumBones; a++)
    {
      const aiBone* bone = mesh->mBones[a];
      aiNode* node = scene->mRootNode->FindNode( bone->mName);
      boneMatrices[a] = bone->mOffsetMatrix;
      const aiNode* tempNode = node;
      while( tempNode)
      {
          aiMatrix4x4 m = tempNode->mTransformation;
          boneMatrices[a] *= tempNode->mTransformation;
          tempNode = tempNode->mParent;
      }
    }

and my render:

    std::vector<aiVector3D> resultPos( mesh->mNumVertices);
    std::vector<aiVector3D> resultNorm( mesh->mNumVertices);

    for( size_t a = 0; a < mesh->mNumBones; ++a)
    {
      const aiBone* bone = mesh->mBones[a];
      const aiMatrix4x4& posTrafo = boneMatrices[a];
      aiMatrix3x3 normTrafo = aiMatrix3x3( posTrafo);
      for( size_t b = 0; b < bone->mNumWeights; ++b)
      {
        const aiVertexWeight& weight = bone->mWeights[b];
        size_t vertexId = weight.mVertexId;
        const aiVector3D& srcPos = mesh->mVertices[vertexId];
        const aiVector3D& srcNorm = mesh->mNormals[vertexId];
        resultPos[vertexId] += weight.mWeight * (posTrafo *srcPos);
        resultNorm[vertexId] += weight.mWeight * (normTrafo * srcNorm);
      }
    }
    //And rendering the vertices from the pos vector

what should I change to made this to get correct positions?

sentences:
Unity Canvas hover image does not trigger event So i have the following setup:

This produces the following UI:

Now on each of the "HudCircle"(Bottom/Right/Left/Top), I have the following components:

As you can see I have a script that has the following code:

    public class HUDAction : MonoBehaviour,  IPointerEnterHandler, IPointerExitHandler
{
    public Color StartColor;
    public Color SelectedColor;
    public Image Image;

    private void Awake()
    {
        Image = GetComponent<Image>();
        StartColor = Image.color;
    }

    public void OnPointerEnter(PointerEventData eventData)
    {
        Image.color = SelectedColor;
        Debug.Log("Over");
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        Image.color = StartColor;
        Debug.Log("Not over");
    }
}

Sadly when playing this scene nothing happens when I hover either of the circles.

Can anyone tell me what I've done wrong?

sentences:
RPG Maker (Issue) RGSS_RTP STANDARD the issue i am having is rpg maker is installed onto my computer as well a rgss-rtp standard and when i go to run RPG maker it says RGSS-RTP STANDARD not installed?
how can i get it to run?

sentences:
How can I add a delay to my enemy spawning in Greenfoot? How can I add a delay between spawning my enemies in Greenfoot? I'm doing it from a class that is neither a world nor an actor, its made totally by me. I need to it spawn 3 enemies, 3 times, with a 1-second delay between each time. Here's what I've got now.

void attack()
{
    long beginTime = System.nanoTime();
    int i = 0;
    while(i < 3)
    {
        if ((System.nanoTime()-beginTime)/1000000000>1f)
        {
            for (int j = 0; j < 3; j++)
            {
                world.spawnEnemy();
            }
            i++;
        beginTime = System.nanoTime();
        }
    }
}

It's based off of this answer to this question. However, it does not at all give me the desired results. Instead, it entirely pauses everything else in the game (all of the actors, probably the world too, but I'm not sure) until the makeshift timer ends 1 second into it, and then spawns all 3 waves (all 9 enemies) at once.

sentences:
Is it ok to return a call to itself inside a method that has a return type? Hello all I am making a little blackjack game in Unity. Although these classes don't actually use Monobehaviour or anything just yet.

I have this method and I'm not sure it will work like this or not. I need a way for it to return the card, but if the card has already been dealt out it needs to just repeat until it finds a card that isn't already dealt to return to the original place where i invoke this method from.

    public Card TakeRandomCardFromDeck()
{
    var rand = new Random();
    int randomIndex = rand.Next(cards.Length);
    Card card = cards[randomIndex];
    if (card.stillInDeck)
    {
        cards[randomIndex].stillInDeck = false;
        return card;
    }
    else
    {
        return TakeRandomCardFromDeck();
    }
}

Im specifically worried about the else{ ....... part.

NOTE: I have already done this and whilst it seems to work, its hard to tell whether its actually ran into a card that is already dealt yet since I only have a few cards dealt so far. (I've ran it dozens of times and not had any errors in the one test deal it performs on each run)

sentences:
How do I move the paddle with the arrow keys? I am making a pong game using gdi+ and c#. I want to move the paddle using the arrow keys by using the move variable, but it does not work; the paddle does move when I use the int move=0; global variable.

I am thinking about nesting my methods.

Is it possible to nest the Form1_Paint into the Form1_Keypress method?

    int move = 0;

    public void Form1_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == (char)56)//key 8
        {
            move--;
        }

        if (e.KeyChar == (char)50)//key 2
        {
            move++;
        }
    }

    public void Form1_Paint(object sender, PaintEventArgs e)
    {
        Graphics g = e.Graphics;
        SolidBrush blueBrush = new SolidBrush(Color.Blue);
        SolidBrush redBrush = new SolidBrush(Color.Red);
        SolidBrush whiteBrush = new SolidBrush(Color.White);
        Rectangle rect1 = new Rectangle(0, 250, 35, 100); //blue paddle
        Rectangle rect2 = new Rectangle(750, 250 + move, 35, 100); //red paddle
        Rectangle rect3 = new Rectangle(390, 290, 10, 10); //white ball
        g.FillRectangle(blueBrush, rect1);
        g.FillRectangle(redBrush, rect2);
        g.FillRectangle(whiteBrush, rect3);
        g.Dispose();
    }

sentences:
Animate Loading Screen During CPU-Heavy Scene Load I have a scene with lots of lightweight objects and one that takes anywhere between 10 and 45 seconds to load.
At a high level, the Awake method does...

Query database
For each result do some (fairly heavy) calculations
Populate a list
Use that list to generate game objects

[Only the last step of which requires the main thread]
I have another scene to display a loading screen. It has a UI panel with a shader that shows an animation.
The Loading screen starts a coroutine to switch level...
private IEnumerator LoadNewScene() {
    AsyncOperation async = SceneManager.LoadSceneAsync("GalaxyMap", LoadSceneMode.Single);
    while (!async.isDone) {
        yield return null;
    }
}

At which point, the animation freezes for 10-45 seconds while the heavy object loads.
In an attempt to make the animation CPU-independent, it's coded as a shader using the built-in _Time property.
I assume this is because my heavy object's Awake() is running on Unity's main thread and thus is blocking updates to the shader.
If so, I can move a lot of the heavy lifting onto a background thread, but I can't work out how to release the thread back to Unity temporarily.
The Awake() method isn't async, and any attempt to create a Task and wait for it will just block the same thread.
Conversely, I could have a completion callback for when the load is done. That would allow me to release the main thread sooner, however, Unity would think my scene had finished loading prematurely and remove the loading screen.
How can I either:

Release control of the thrad intermittently so Unity can refresh the UI
Explicitly tell Unity when it should consider a scene "loaded" and ready for display

?

sentences:
Align spawned particle system I am working on a game in which tanks can shoot at each other. I intend to spawn a spark particle system (particles emit to Z) when a bullet hits a surface. I want to align the Z axis of the newly spawned particle system to be

a) in a 90 degree angle to surface that has been hit
b) in a reflective angle from the original trajectory

I know that I can "fake it" by setting particle Z to World 90 degrees, however then it will do so on any angled surface, while I would like to have the particle system dynamically orient itself in a 90 degree angle away from the surface that has been hit/ or reflect into the direction away from the incoming bullet.

hope you can help me, getting quite frustrated.

sentences:
Debugging-Setting Consoles in Games Right now I have the graphical and input portions of a console for my game (command parsing hasn't been implemented yet). I was wondering how you would go about making changes to properties in game objects. For example, if I typed in the console:

skeletonMonster maxHP 20

That would change all of the existing in-game skeletons' max hit points to 20. After you parse this information what are some ways to change the value? How can I change the that member variable without directly accessing it (by making it public/global)?

I'd like to implement this so I don't have to change variables in the code and recompile every time while playtesting.

sentences:
Calculate matrix transformation components separately It is possible to calculate the translation, rotation and scale that were used to build a matrix?

I mean if I have a matrix M can I calculate the rotation, scale, and translation it represents?

Of course I could save each component in the matrix individually, but can I recover this information from just the matrix data?

sentences:
Why is my collision code blocking the player's movement in XNA? I have the following code to check for collisions in my game, but this code doesn't work it as should. For example:

I go from up to down and if collision is detect I can't turn right;
if I go from right to left and collision is detect I can't turn down.

What is wrong with this code and how could I improve it?

foreach (var o in ObjectList) {
    previousPosition = player.Position;
    if (player.CollisionRectangle.Intersects(o.Rectangle) && o.isCollision == true) {
        if (o.ObjectUpdateLeftRight(player, o.Position) == 0) player.CanRight = false;
        if (o.ObjectUpdateLeftRight(player, o.Position) == 1) player.CanLeft = false;
        if (o.ObjectUpdateUpDown(player, o.Position) == 2) player.CanUp = false;
        if (o.ObjectUpdateUpDown(player, o.Position) == 3) player.CanDown = false;
    }
}

and ObjectUpdateLeftRight and UpDown:

public int ObjectUpdateLeftRight(Player.Player player, Vector2 objectToCheck) {
    if (player.Position.X < objectToCheck.X) return 0; // right
    if (player.Position.X >= objectToCheck.X) return 1; // left
    return -1;
}

public int ObjectUpdateUpDown(Player.Player player, Vector2 objectToCheck) {
    if (player.Position.Y >= objectToCheck.Y) return 2; // up
    if (player.Position.Y < objectToCheck.Y) return 3; // down
    return -1;
}

sentences:
How to make Unity game moddable with scripting in a friendly way? I am building a game in Unity using C# and visual studio. I want to make it possible for users to write code in some scripting (for modding purposes) without necessarily opening the source. What are my best options?

I'd prefer well-supported and battle-tested options that integrate well with Unity and visual studio, but I am willing to do a fair amount of work myself as long as it makes scripting as seamless as possible for future modders.

sentences:
Creating texture and palette modification I need to create a texture from a surface with indexed color palette and alter the colors. However, after I set new colors, the rendered texture gets blank.

int main(int argc, char** argv)
{
    init();

    gSurface = TTF_RenderText_Solid(gFont, "text", fg1);

    // text is rendered properly, without following line
    SDL_SetPaletteColors(gSurface->format->palette, &fg2, 1, 1);

    gTexture = SDL_CreateTextureFromSurface(gRenderer, gSurface);

    SDL_SetRenderDrawColor(gRenderer, 255, 255, 255, 255);
    SDL_RenderClear(gRenderer);

    SDL_RenderCopy(gRenderer, gTexture, NULL, NULL);
    SDL_RenderPresent(gRenderer);

    SDL_Delay(1000);

    quit();
}

I tested this code with software rendering using window surface instead of renderer and pallete changing worked.
Could someone explain me why does it happed and how to fix it?

sentences:
Still i can't make the cross hair to be in the middle of the screen, What am i missing? In the editor i did:

GameObject > UI > Image

On the Canvas i changed the Render Mode to Screen Space - Camera.

It created a Canvas and a child Image in the Hierarchy.
Then i changed the Image source to UISprite changed the color to red also added to it a material in red.

I can't changed the Canvas anchors not sure why.

The Image rect transform anchors is set to the center.

I don't have a Main Camera the only camera i have is on the FirstPersonController (The FirstPersonController is a child of a FPSController).

But still the red dot/circle is a bit to the left not in center.

Screenshot of the Canvas:

And two screenshots of the Image:

And

sentences: 3D modeling: how to make a spaceship with interior and exterior recently i wanted to try and model a spaceship. i want to make one with interior and exterior. (like spaceships in star citizen.) But i dont know how to start working on it. Do i first build the interior and thzn build the exterior around it ? or reversed ? also how does one design interior if there is already an exterior. my goal is to maybe implement this in a game engine so i can walk around inside of it. i tried looking for this on google but i only got results that show how to make a spaceship but withoud interior. or interiors alone. does someone know how to make this ? or does someone have a tutorial i can use to learn from ? thanks in advanced.

sentences:
Getting half plane direction relative from cam position Im implementing certain Camera movements in my turn based games. I'm able to place and rotate the camera between two units that attack each other. However it will always move to the same "side". Which isn't necessarily wrong, the rotation of the camera just seems to be sharp when it's on the other side of the half plane ( as of right now it always goes on one half plane). I would like the camera to move to one side relative to the cameras position.

Essentially I just have to flip the Normal which gives me the direction where I have to place my camera:
A and B are units.
C is the current camera position
T is the target position.

Essential code

center =  Vector3.Lerp(attacker.transform.position, target.transform.position, 0.5f);
Vector3 diff = attacker.transform.position - target.transform.position;
Vector3 normal = Vector3.Normalize(diff);
normal = Vector3.Cross(Vector3.up,normal);

//CHECK HALF PLANE HERE
normal *= -1;

//Center is the target position.
center -=  normal * (diff.magnitude + 1.0f);

sentences:
How do I combine images into a single entity in libgdx? I've googled this but can't seem to find anything on "concatenating" two images, especially with libgdx.

Any ideas?

labels: c# opengl physics unity opengl opengl unity c++ java procedural-generation ai c# udk shaders collision-detection xna architecture animation unity 2d javascript unity cocos2d-iphone 3d c# unity collision-detection unity mmo c# opengl java unity game-design physics maps opengl unity android unity shaders c# unity game-design architecture unity xna animation unity rotation opengl libgdx licensing sdl unity iphone unity ipad unity mathematics unity unity minecraft-modding box2d java unity libgdx nintendo performance unity c++ android game-mechanics java iphone opengl javascript client-server pc models c++ lua character mathematics books sprites entity-system box2d unity xna fragment-shader xna-4.0 android lighting game-industry unity 3d collision-detection physics-engine unity mathematics raycasting marketing software-engineering unity architecture xna 3dsmax sfml opengl c# unity databases c# networking unity c++ fonts direct3d12 opengl leaderboards c++ unity unity 2d unity unity procedural-generation unity unity game-mechanics collision-resolution game-design c++ java unity game-design unity unity ios unity opengl xna business unity collision-detection adventure-game-studio opengl c++ android unity physics multiplayer unity unity game-design xna 3d unity xna android unity glsl transformation java unity gui unity unity software-engineering roblox input unity opengl opengl unity unity java tiles unreal-4 2d textures windows libgdx movement unity box2d javascript legal java c# opengl opengl-es sharpdx iphone raycasting c# unity opengl algorithm lua libgdx collision-detection box2d ai unity c# c++ modding 2d 3dsmax graphics 2d unity unity unity objective-c opengl unity javascript opengl unity hlsl algorithm opengl unity c# unity mathematics unity ai game-design opengl game-industry unity sound c# slick unity architecture unity c++ xna xna unity iphone android javascript unity unity camera unity game-design 3d android mathematics xna c# opengl c++ c# xna 2d c++ unity game-design vulkan java unity opengl unity sprites unity tiles unity architecture java unity game-maker unity c++ c# xna unity physics unity 3d android source-engine 2d directx 3d unity opengl opengl mathematics javascript xna c++ libgdx animation c# 3d opengl 2d unity actionscript-3 xna unity c++ unity sfml unity input c# component-based java graphic-effects image networking unity c++ android 3d algorithm unity mmo xna android opengl andengine c++ unity opengl unity game-mechanics c++ corona-sdk leaderboards multiplayer java shaders actionscript-3 camera iphone c++ libgdx opengl 3d directx11 unity unity graphics unity unity game-mechanics game-design textures unity collision-detection c# procedural-generation 3d unity sprites c# javascript unity textures game-design java unity procedural-generation 3d opengl opengl opengl graphics c++ java unity unity rpg-maker-mv unity xna glfw ai xna unity c++ xna c# architecture 2d c++ opengl xna c# unity c# opengl unity xna path-finding xna xna unity xna networking isometric unity opengl c++ c++ javascript unity unity unity java 2d 2d c++ java javascript game-design ai camera game-design c# java java shaders c++ opengl collision-detection publishing xna audio unity xna c++ mathematics unity unity unity unity opengl xna c++ c# opengl 2d flash c++ unity legal xna unity opengl opengl physics opengl performance mathematics unity cocos2d-iphone opengl unity ios c# unity opengl unity unity lighting algorithm transformation opengl 2d physics java 3d unity box2d unity javascript multiplayer c++ 2d unity opengl unity ios unity collision-detection legal directx unity unity shaders android unity 3d android xna opengl unity c# opengl c++ unity windows racing xna c# android collision-detection unity procedural-generation open-source 3d xna-4.0 keyboard opengl game-maker unity game-design c++ algorithm interface xna-4.0 opengl 2d game-mechanics unity unity matrix unity rendering mathematics unity c# unity libgdx matrix collision-detection unity 2d minecraft-modding graphics c# unity random unity optimization physics unity software-engineering game-design c# unity unity rendering architecture rotation opengl animation xna competition entity-system 2d actionscript-3 javascript unity game-design 2d opengl unity c# oculus game-maker libgdx graphics-programming xna grid c# c++ textures opengl shaders android mathematics sprites c# unity unity unity unity unity box2d shaders collision-detection xna c++ path-finding 3d multiplayer mathematics unity c++ collision-detection 2d opengl unity unity point-cloud physics opengl opengl 2d c# c++ rendering unity 3dsmax game-industry xna unity unity opengl game-mechanics 2d c++ android unity c# unity xna android xna unity unity algorithm libgdx opengl unity sprites 2d java java xna unity game-design unity 3d unity unity models browser-based-games java animation javascript java andengine unity unity unity unity c++ physics unity directx c++ flash unity love2d 3d skyrim-modding xna-4.0 unity unity xna game-maker ai c# unity c++ architecture unity architecture unity 2d tiles c# tools unity unity 3d unity game-design textures c# unity opengl opengl opengl java unity shaders unity c++ actionscript-3 physics-engine box2d animation terrain unity mathematics minecraft-modding ruby voxels blender management physics unity unity unity 2d xna c# android architecture android 2d architecture sprites unity opengl multiplayer libgdx unity roblox graphics tilemap lua textures unity unity java rendering c++ unity rpg-maker c android 3d 3d physics andengine scripting android java unity architecture c++ architecture unity unity game-design open-source performance android iphone opengl component-based flash unity unity opengl mathematics box2d android android mathematics path-finding java android data-structure opengl 2d game-mechanics unity gpu ai level-design opengl unity opengl c# unity terrain textures component-based opengl unity c# open-source unity java 3d opengl textures physics unity unity opengl unity udk rendering unity models xna unity multiplayer collision-detection tiles 3d collision-detection unity 2d unity java sdl algorithm 3dsmax unity multiplayer java 3d unity raytracing unity glsl directx unity c# art opengl unity ios mathematics unity unity opengl godot xna xna sdl2 architecture timer java monogame c++ unity unreal-4 unity content-generation opengl mathematics libgdx java unity unity legal graphics libgdx unity component-based rigidbody opengl libgdx unity rendering java c++ java unity unity java c# java unity c++ c++ unity rendering source-engine collision-detection mathematics unity java 3d java libgdx unity ios 3dsmax c++ networking three.js unity c++ game-design 3d python unity graphics java mathematics unity javascript unity unity python sfml ai normal-mapping android unity unity unity android 2d xna unity ai c++ unity architecture unity procedural-generation java assets 2d c++ unity c++ cocos2d-iphone unity 3d opengl 2d algorithm unity unity 2d xna directx unity opengl networking unity collision-detection tiles unity unity physics unity graphics unity copyright algorithm music 2d unity unity 2d marketing glfw python flash three.js monetization mmo opengl opengl libgdx unity trademark c# ai ios hlsl opengl materials textures directx11 xna opengl savegame input unity c# 3d java opengl user-experience unity c++ c++ c++ c# augmented-reality xna 3d c++ unity algorithm java mathematics java unity rendering c# unity c++ libgdx libgdx 2d c++ xna xna unity xna unity iphone libgdx unity unity 2d unity java c++ camera game-design physics lua opengl terrain multithreading graphics xna-4.0 events 2d ios raytracing xna opengl server unity unity architecture android opengl unity c# matrix unity game-design unity xna unity unity unity unity opengl side-scroller unity terrain-rendering algorithm html-canvas opengl unity c# level-design java unity google-play unity unity c++ xna unity software-engineering xna xna browser opengl 3d unity 3d c++ unity 3d opengl unity 3d unity xna game-design game-loop unity unity unity textures java game-design character slick xna unity java unity xna game-design 3d unity c++ opengl directx11 collision-detection 3d-meshes java ai rendering javascript algorithm unity opengl unity opengl 2d content-rating java unity java architecture unity unity libgdx opengl unity mathematics physics java opengl java mathematics xna opengl c++ andengine c++ unity legal xna c# c++ java unity unity xna c++ c# terminology opengl unity 3d unity html5 unity opengl java cocos2d-iphone camera design-patterns 2d c++ unity maps unity opengl opengl unity opengl opengl 2d graphics opengl unity scoring opengl opengl c++ java xna path-finding directx9 unity vector unity java collision-detection mathematics java android voxels unity opengl game-design unity unity javascript xna unity c# javascript unity opengl matrix collision-detection opengl separating-axis-theorem xna-4.0 unity unity legal opengl opengl xna game-design java 2d game-maker unity collision-detection code-reflection flash blender c++ xna movement unity graphics opengl networking camera 2d unity unity unity-networking game-maker 2d glsl xna c# 3d opengl graphics opengl c# unity models xna matrix libgdx collision-detection unity java unity 2d java architecture networking c++ unity unity unity unity directx11 simulations 3d career unity unity networking javascript unity textures xna c++ 3d c++ xna javascript geometry android graphics-programming opengl sdl collision-detection opengl c++ unity opengl xna android tools flash unity java unity unity publishing opengl mathematics c# libgdx unity unity java unity unity unity unity networking python color unity camera xna c# java sky networking unity textures c++ rpg lighting 3d monetization unity c++ 3d iphone ai opengl c++ bullet-physics unity java data-structure unity libgdx iphone gpu libgdx c# libgdx unity iphone sprites performance sprites libgdx c# xna opengl android c# xna-4.0 opengl java opengl xna physics unity c# opengl unity c++ unity unity 2d unity xna 2d c++ unity collision-detection flash rendering frame-rate playstation4 opengl game-design architecture unity lighting c++ savegame collision-detection textures javascript iphone unity networking unity unity particles 2d unity architecture javascript unity unity unity c++ game-industry unity unity java networking game-design java unity unity unity opengl game-design 3d java unity collision-detection java 2d 2d javascript bullet-physics hlsl fsm c# unity opengl java libgdx xna opengl cocos2d-x physics python unity game-design c# unity android physics game-design c++ javascript java unity 2d turn-based architecture android ios xna javascript java textures xna unity c++ voxels physics mathematics opengl opengl xna c# software-engineering xna unity graphics 2d actionscript-3 rts javascript tools c++ collision-detection collision-detection javascript unity textures game-design unity unity xna ios java java mathematics vector architecture c++ unity unity unity game-design unity c++ javascript unity mathematics steam 2d unity shaders c# sound unity libgdx architecture unity map-editor movement collision-detection libgdx unity game-maker unity xna unity xna unity libgdx legal unity terminology opengl blender software-engineering graphics xna game-design opengl networking textures c# unity multiplayer c++ copyright collision-detection java c# c++ 2d lwjgl opengl c++ graphics-programming game-design c++ xna opengl opengl c# android unity java xna xna opengl mathematics opengl opengl unreal-4 unity project-management unity java flash mathematics legal xna unity 2d unity unity unity raycasting transparency graphics unity libgdx mathematics collision-detection java 2d unity game-design mobile c# ios game-mechanics 3d unity game-design camera unity unity c# unity c++ windows-phone-7 game-design physics unreal-4 unity c# legal architecture xna opengl collision-detection godot physics unity design-patterns java c++ unity ai box2d jobs opengl libgdx unity opengl opengl sdl2 javascript cross-platform physics opengl 2d cocos2d unity xna android opengl shaders javascript xna xna xna mathematics c++ mathematics rendering unity 2d unity 2d unity collision-detection unity c++ xna unity opengl unity networking unity unity unity unity 2d c++ state physics flash opengl c++ javascript terrain javascript directx11 c# textures c# java multiplayer rendering unity color multithreading unity android unity javascript java collision-detection unity unity unity procedural-generation unity 3d mathematics game-design c++ java c++ performance xna java unity c++ java unity c++ unity javascript directx unity c# java unity c++ libgdx control physics unity server unity opengl opengl collision-detection unity unity unity python 3d camera android c# 2d unity collision-detection opengl box2d c# c# opengl graphics java unity unity c++ career mathematics planning xna movement opengl opengl mmo java collision-detection architecture opengl unity unity unity xna android path-finding physics performance unity python c# shadows android javascript shaders unity unreal-4 libgdx unity xna java libgdx cocos2d unity input unity c# physx unity c++ cocos2d-iphone godot xna xna unity c++ opengl gpu c# unity unity unity path-finding lua xna unity xna unity opengl scoring xna unreal-4 opengl java xna opengl c++ unity android xna blender unity xna xna unity savegame xna unity game-design c++ unity ios legal unity xna xna design-patterns java game-design unity mathematics c++ web java 2d fonts unity unity collision-detection unity xna textures cocos2d-iphone entity-component-system unity udk java physics architecture python multiplayer java javascript unity unity rendering unity ios directx11 architecture unity unity opengl unity architecture c++ unity unity java rendering unity unity libgdx assets android game-design unity directx software-engineering monogame php javascript unity 2d collision-detection ai unreal-4 unity graphics networking cocos2d-x-js audio unity opengl xna unity steam opengl unity animation cocos2d unity mathematics collision-detection art 2d opengl java memory-efficiency c# unity c# 3d c++ unity 3d game-loop unity godot animation 2d unity 2d unity android c++ xna unity algorithm roblox webgl c++ game-design marketing unity geometry unity unity sprites unity c++ unity unity sprites xna education multiplayer 3d unity xna 2d libgdx c++ mathematics directx animation ai java c++ unity unity unity android unity javascript 2d unity unity 2d unity legal java xna javascript unity voxels opengl collision-detection c++ unity opengl unity java unity xna networking geometry unity unreal-4 c# opengl c++ xna opengl networking unity c++ unity c++ unity physics 3d unity software-engineering xna unity unity xna models mathematics raytracing game-design unity localization unity game-maker procedural-generation graphics fonts shaders rendering c# android architecture computational-geometry xna opengl collision-detection c++ entity-system 2d unity c++ android java 3d coordinates xna unity unity c# java unity directx11 opengl unity 2d algorithm algorithm xna java java unity animation distribution shaders c# javascript unity unity game-design unity normal-mapping unity unreal-4 android xna unity multiplayer physics unity architecture opengl libgdx unity unity unity opengl modding unity c# java unity c# unity java cocos2d-x libgdx linux opengl software-engineering godot unity 3d android libgdx collision-detection xna ios unity 3d java unity 2d android server unity opengl unity unity competition collision-detection opengl c++ java opengl directx9 xna textures physics graphic-effects c++ unity unity javascript blender unity networking opengl ai android javascript fonts shaders mathematics c++ opengl c++ opengl unity camera opengl-es mathematics unity java unity unity c++ opengl unity unity android unity c# unity shaders xna xna c# java 3d physics java flash unity c# unity cocos2d-x iphone unity 3d unity collision-detection unity physics ai html5 unity unity matrix opengl-es2 java unity multiplayer javascript game-design camera unity godot xna mathematics algorithm unity libgdx c# unity java unity 2d legal index-buffer terrain collision-detection unity ai performance unity java security game-design algorithm javascript unity 2d opengl xna unity rendering opengl c++ unity opengl interpolation unity unity game-design phaser opengl xna animation tools c# unity unity unity unity java unity opengl c# directx unity unity unity opengl opengl opengl opengl c# javascript opengl unity opengl unity xna unity java networking water 3d unity c++ normals opengl unity mmo unity unity xna multiplayer ajax c# unity algorithm xna rendering android c# unity java entity-system unity xna opengl multiplayer c++ textures orientation algorithm pygame java java entity-system 3d web unity xna unity java c++ javascript game-design opengl 2d iphone unity multiplayer textures virtual-reality graphics pygame opengl tools directx11 javascript unity unity c++ c++ opengl game-design random unity xna unity terrain 3d matrix opengl java strategy unity opengl-es tilemap unity opengl unity c++ xna-4.0 c++ unity networking c# game-design java javascript unity unity unity xna-4.0 2d unity directx c++ tiles c++ unity unity documentation rendering c# c++ ai assets unity android assets unity movement unity game-mechanics unity game-design c++ java unity xna unity legal iphone opengl xna-4.0 unity java libgdx android unity java c++ unity unity c# unity xna opengl unity c# unity opengl unity ai unity java racing java publishing xna legal unity shaders c++ c++ voxels shaders procedural-generation mathematics unity rotation opengl architecture unity collision-detection opengl shaders input textures unity architecture java normal-mapping unity unity networking c++ 2d rendering c# opengl opengl c# unity unity opengl rendering sdl2 unity c++ unity software-engineering mathematics c++ unity opengl unity mathematics c++ opengl unity unity xna-4.0 glsl c++ c++ unity game-design box2d xna xna networking javascript software-engineering android algorithm c# xna windows particles android opengl java input iphone unity architecture flash unity xna xna 2d java libgdx deployment unity camera unity unity graphics random collision-detection unity unity directx9 libgdx libgdx gui c++ game-maker unity java collision-detection input pygame rigging physics mathematics opengl c++ opengl maps c# udk xna udk performance c# unity timestep c# unity javascript unity opengl unreal-4 unity unity unity directx11 2d unity android xna java unity c++ rendering c# models rpg unity sprites architecture c++ playstation4 visualization 2d game-maker libgdx java collision-detection 3d unity c++ ai c++ directx11 unity game-industry android c# android javascript c++ unity java spritekit libgdx c++ c# xna unity java unity unity 2d software-engineering business unity c# ios opengl directx opengl vb.net architecture rotation opengl opengl shadow-mapping c++ libgdx unity opengl unity shaders opengl unity unity c++ cocos2d-iphone collision-detection xna opengl android opengl java directx11 libgdx unity xna c++ unreal-4 unity unity opengl xna c++ opengl c# multiplayer opengl unreal-4 c++ unity unity opengl game-mechanics c++ c++ java 2d architecture sprites c++ xna-4.0 bounding-spheres unity xna gpu unity graphics unity javascript animation shaders xna libgdx 3d unity opengl c# unity unity unity 2d xna unity unity fragment-shader game-design xna opengl collision-resolution unity 2d java multiplayer architecture java xna unity c++ unity android unity movement animation jobs c++ tools game-design java collision-detection collision-detection architecture unity physics-engine entity-component glsl unity unity 3d projectile-physics game-maker unity c++ unity opengl c# directx entity-system opengl directx 3d unity xna project-management javascript c++ xna libgdx game-design python camera c# iphone unity python android corona-sdk audio iphone c++ game-loop physics 2d java algorithm unity opengl 3dsmax opengl networking unity google-play unity performance 3d memory-efficiency collision-detection xna unity multiplayer gpu java opengl game-mechanics c# design-patterns unity unity c# collision-detection terminology unity directx c# unity software-engineering collision-detection libgdx unity 2d c++ unity xna 2d 2d unity physics java opengl iphone c# opengl geometry unity unity unity ai unity c++ ai unity raycasting algorithm unity unity graphics databases unity software-engineering javascript c++ performance c++ 3d unity unity interactive-fiction input unity opengl unity physics rotation unity camera unity game-design sdl2 unity android game-loop unity xna mathematics unity unity terrain xna unity 2d xna unity unity vector unity rpg unity xna 2d unity procedural-generation unity 3d unity c++ unity c++ shaders graphics c++ unity c++ mathematics android unity architecture unity c++ algorithm unity unity unity opengl c# glsl directx11 unity java unity xna unity java server terrain c++ java unity xna unity java unity libgdx android isometric minecraft-modding unity javascript java unity opengl graphics unity javascript unity unity ai unity c++ unity opengl rendering libgdx unity unity unity 3d 2d unity c++ lua xna unity algorithm unity 2d unity java unity xna lua unity unity game-design opengl xna opengl java path-finding java babylonjs javascript c++ c# opengl mathematics algorithm unity 3d-meshes unity lighting unity unity c++ mathematics unity unity unity unity algorithm xna unity xna c++ xna unity flash algorithm unity android unity android rotation 2d architecture game-design collision-detection xna c++ video game-maker graphics udk c++ unity opengl graphics 3d xna c++ collision-detection 3d c++ unity directx cross-platform unity unity c++ unity c++ flash unity c# java directx java window-management opengl java unity starcraft-2 actionscript-3 c# unity java unity opengl opengl python networking unity opengl xna unity architecture xna c++ unity unity mathematics unity 2d xna java c# java unity software-engineering opentk cryengine shaders marching-cubes python assets ruby unity xna unity physics game-design sdl2 unity android unity xna 3d architecture 2d architecture unity c++ xna unity pipeline unreal-4 opengl unity java unity c++ libgdx unity c# xna xna unity unity xna unity c# libgdx c# 3d libgdx unity unity xna unity unity opengl opengl c++ mathematics unity unity unity opengl unity c++ c++ 3d ai xna unity turn-based browser-based-games c++ legal c++ java textures unity tiles directx11 unity opengl game-design opengl game-design c++ unity 2d unity libgdx java unity unity unity linux camera unity 2d unity rendering c++ optimization c++ unity models 2d opengl optimization c# java opengl libgdx sdl2 java unity unity collision-detection xna lighting android unity c# unity architecture opengl copyright career unity performance xna c++ graphics xna rendering 2d unity xna java java opengl c# camera rendering c# optimization bot xna c++ maya architecture opengl c# c# unity opengl unity teaching xna sky unity java unity algorithm unity mathematics opengl unity 2d 3d game-design opengl 3d xna game-maker unity unity vector c# mathematics java unity directx11 animation xna browser-based-games c# unity 3d architecture unity normal-mapping hlsl physics android unity transparency unity 3d android lighting unity c++ unity collision-detection c++ pixel-art unity unity opengl shaders unity java unity xna c# c# game-design unity xna c++ rendering architecture performance unity sprites c# books particles unity android unity c++ opengl spritekit game-design first-person-shooter unity networking android unity architecture unity mmo opengl unity java unity c++ xna-4.0 spritesheet unity unity unity books movement physics opengl legal unity opengl google-play java unity unity c++ quaternion path-finding unity design-patterns android procedural-generation sprites c# libgdx glsl models collision-detection unity 2d c++ rendering c++ unity java libgdx graphic-effects architecture directx c++ rpg unity c++ simulations geometry source-engine java unity physics unity mmo c++ opengl unity unity c# algorithm networking libgdx unity unity game-design xna unity collision-detection algorithm jmonkeyengine unity 3d unity android ios opengl game-design procedural-generation hlsl java c++ architecture c# xna unity advertisements unity unity unity sfml unity unity animation unity java unity hexagonal-grid unity android shaders android mathematics unity unity networking javascript unity android unreal-4 opengl html5 unreal-4 unity unity mathematics game-design collision-detection game-loop xna physics levels opengl android javascript unity blender flash java unity game-maker c++ unity software-engineering opengl java c++ 2d 2d libgdx c++ physics unity libgdx javascript unity c# unity java c++ c# unity c# rendering terrain-rendering c# c# performance physics game-mechanics mobile directx11 java c++ unity 3d-modeling xbox360 java mathematics xna game-loop opengl ios unity networking 3d unity java rendering input unity marketing c++ c++ unity minecraft-modding 2d unity iphone mmo java xna c++ unity game-design algorithm unity iphone unity algorithm mathematics unity directx physics publishing c++ c# architecture unity leaderboards c# textures c# xna architecture xna unity android unity java c# animation java unity copyright c++ graphics opengl unity hlsl 3d game-design c# shaders unity unity physics 3d unity xna xna 3d 2d c# xna unity game-design ios simulations xna networking opengl unity unity 2d javascript sfml cocos2d-x server java 2d java html5 path-finding libgdx opengl c++ c++ 2d geometry opengl-es opengl unity collision-detection javascript javascript c# unreal-4 c# libgdx opengl shaders java unity unreal-4 android server multiplayer unity game-design game-design unity algorithm javascript unity leaderboards javascript game-design legal 3d c++ 3d 2d opengl unity virtual-reality python textures opengl-es windows-forms xna xna graphics assets opengl path-finding unreal-4 collision-detection c++ javascript mathematics unity 3d opengl java java unity unity opengl unity 3d xna xna java unity sketchup game-design game-design vulkan opengl networking java opengl networking android networking sdl android graphics unity 2d opengl javascript java c++ game-mechanics architecture 2d unity c# unity unity unity architecture unity physics xna scripting mmo opengl 3d unity unity c++ c# java c++ raycasting android 3d c# game-design c# unity opengl raycasting animation algorithm shaders iphone physics unity javascript architecture java directx balance unity gui java opengl unity mathematics java javascript movement unity c# mathematics java ios c# c# performance unity shaders c# opengl shaders xna game-design collision-detection xna android mathematics java java c++ unity java collision-detection shadows unreal-4 unity unity mathematics unity unity mesh c++ skeletal-animation c# unity 2d spritekit glsl unity architecture collision-detection c++ xna game-maker unity textures actionscript-3 iphone physics libgdx java java mobile unity glm c++ c# box2d networking unreal-4 camera opengl opengl 2d unity 2d c# 2d minecraft-modding 2d unity networking java opengl unity architecture mathematics 2d mmo physics opengl opengl xna game-design opengl unity opengl opengl opengl unity rendering 2d iphone opengl game-maker movement actionscript-3 unity opengl opengl libgdx game-design c++ physics unity game-design c# cocos2d-iphone mobile c++ python unity javascript unreal-4 box2d unity unreal-4 directx minecraft-modding unity animation opengl c++ game-maker open-source opengl opengl unity node.js linux game-maker xna software-engineering c++ c++ terrain xna android opengl unity architecture procedural-generation music xna-4.0 unity game-maker collision-detection unity java xna shaders iphone unity procedural-generation 2d c++ rotation java c++ game-design collision-detection unity raycasting opengl opengl unity windows-phone-7 unity unity algorithm rotation entity-system unity textures opengl unity 2d unity libgdx google-play 2d unity mathematics unity performance algorithm unity opengl unity unity c++ unity unity rendering xna palette unity rotation unity directx11 3d unity unity game-mechanics opengl unity java game-design java physics unity c++ animation 2d xna rpg tilemap java 2d unity game-design xna unity unity unity game-maker browser-based-games unity iphone xna unity frame-rate opengl libgdx c# c++ opengl c++ opengl unity 3d unity xna opengl unity unity android xna-4.0 3d rendering xna c++ textures opengl unity box2d libgdx unreal-4 physics unity unity blender unit-testing godot collision-detection android 3d xna unity opengl opengl unity android physics game-design java unity copyright directx c++ unity cocos2d-iphone opengl c++ unity 2d java c++ unity 3d ios unity emulation splines unity game-design unity unity graphics unity unity xna python opengl 2d algorithm unity 2d c++ java sound 2d python collision-detection physics c++ textures matrix 3d unity unity c++ unity cocos2d-x c# directx11 resolution algorithm unity c++ xna c++ godot opengl xna xna client-server c# unity unity c++ java xna c++ c# unity audio opengl unity textures java unity c# unity procedural-generation c++ mathematics opengl shaders java game-design xna c# 2d node.js emulation unity ai unity unity java unity physics directx camera algorithm unity java xna 2d android unity performance unity xna opengl mathematics rotation libgdx unity ios 2d opengl java game-design 3d opengl android multiplayer ios game-design rendering ios c++ xna opengl c++ unity sfml unity c# xna planning unity hlsl deferred-rendering 2d android animation java java unity opengl android xna-4.0 unity ogre javascript c++ simulations opengl opengl java architecture java architecture unity c++ c++ unity unity physics java events opengl unity c++ 3d c++ opengl c# c# java game-design javascript xna libgdx unity opengl unity game-design content-rating java unity libgdx xna game-design java directx11 godot c++ collision-detection c++ unity opengl architecture unity xna xna unity unity unity c++ xna c# shaders opengl xna c++ opengl c# physics collision-detection box2d normals udk levels opengl xna-4.0 2d software-engineering game-design collision-detection copyright libgdx libgdx art unreal-4 copyright unity unity events opengl unity copyright opengl opengl 2d unity directx11 unity c++ unity phaser opengl xna c++ directx unity unity networking xna glut c# java java cocos2d-iphone mathematics game-design unity unity unity unity game-maker 2d opengl multithreading unity unity 2d unity vector unity tools c# 2d c# 2d java game-design unity 3d opengl 2d godot unity java unity camera xna collision-detection opengl unity iphone c# opengl 2d unity networking 2d shadows entity-system unity java java steam javascript unity unity c++ unity unity methodology java c++ shaders opengl competition unity c++ terrain opengl xna unity ai 2d unity xna unity unity tools rotation unity c++ algorithm unity unity c++ opengl c# unity sprites tilemap android game-design procedural-generation unity pygame unity c++ objective-c opengl vector opengl java unity android c# opengl unity physics-engine procedural-generation android xna databases 2d java c++ opengl godot unity physics unity 3d xna flash networking unity terrain path-finding unity libgdx c++ opengl path-finding mathematics business xna unity opengl opengl directx libgdx algorithm html5 javascript c++ c++ unity opengl unity 2d modding unreal-4 sdl2 c++ algorithm unity blender lighting 3d architecture ios pygame unity algorithm architecture 2d unity c# c++ unity c# opengl animation animation c++ glsl libgdx shaders unity unity lua first-person-shooter interactive-fiction shaders android c++ multithreading android xna physics software-engineering gui c++ unity c++ networking cocos2d-iphone floating-point javascript architecture unity ios c++ unity opengl opengl opengl gui algorithm unity software-engineering unity ios c++ xna unity appstore gamepad xna java unity xna 2d android unity movement copyright unity unity libgdx java java 2d physics 2d textures balance xna unity textures 3d java android android rendering unity unity physics-engine mathematics webgl unity unity opengl unity unity libgdx shaders maps xna java procedural-generation 3d unity java architecture camera javascript unity android unity path-finding unity unity libgdx phaser unity c++ unity iphone c# java godot heightmap c++ c++ blender algorithm unity game-design opengl unity libgdx unity ogre unity unity c++ unity gui networking unity unity unity game-design hlsl unity unity multiplayer java unity android monogame game-maker java mathematics lighting unity python unity opengl java c++ unity libgdx 3d unity networking xna unity 2d libgdx game-design unity c++ c++ unity xna-4.0 xna javascript opengl c++ android c++ xna physics c# textures c# unity game-design skyrim-modding unity opengl game-design opengl c++ game-loop game-design c# unity unity networking mathematics unity unity ai unreal shaders xna opengl android lwjgl python unity unity 2d opengl unity unity android mathematics unity c# unity project-management assets php procedural-generation animation java unity unity ios collision-detection android rotation unity unity actionscript-3 collision-detection c++ mathematics scripting textures c++ monogame opengl android unity rotation lua game-design directx11 unity c# blender unity unity directx 3d physics xna libgdx unity c# unity xna opengl-es unity unity xna shaders jobs c++ unity opengl collision-detection c# objects scripting performance unity collision-resolution directx physics unity unity libgdx pygame c++ unity physics rendering lua game-design unity xna unity xna networking software-engineering unity java unity unity physics software-engineering java unity architecture libgdx xna tiles libgdx unity opengl c++ unity unity c++ unity unity xna unity xna animation unity opengl c# unity camera unity unity animation unity linux opengl c++ xna 2d mathematics unity unity unity physics java collision-detection file-format camera unity xna shaders java mathematics c# unity android opengl c# opengl unity unity shaders box2d c++ game-design c++ 2d xna unity opengl opengl scripting mathematics unity xna opengl sdl unity c++ collision-detection collision-detection c algorithm terrain opengl mathematics opengl iphone 2d c# flash unity collision-detection opengl libgdx hlsl unity movement unity java game-design xna java java browser-based-games security unity udk opengl opengl javascript path-finding c++ java unity game-mechanics unity java opengl unity c# unity c# 3d java textures xna unity algorithm c++ xna server unity multiplayer opengl opengl unity opengl-es2 opengl unity c# unity c++ mouse tower-defense opengl-es modding physics input unity unity shaders unity python opengl xna unity c++ unity opengl directx11 opengl c++ unity animation unreal-4 xna unreal java java java c# unity c++ unity skyrim-modding javascript opengl mathematics c++ 2d unity javascript opengl unity android 3d physics 2d unity collision-detection tilemap opengl gui c++ mmo xna unreal c# 3d xna unity transformation unity collision-detection unity unity 2d 2d xna sprites c# xna unity iphone 2d java unity opengl unity javascript textures c++ unity unity game-design sdl animation game-maker opengl xna java procedural-generation sdl2 java html5 c++ 2d architecture unity performance javascript unity unity unity opengl unity flash xna collision-detection unity c++ mathematics unreal-4 2d libgdx textures procedural-generation cocos2d-x c++ 2d unity game-design unity unity ios unity sprites game-design c# xna architecture design-patterns rendering networking opengl unity rpg-maker-xp java c# c# unity unity architecture c++ xna unity sdl2 unity 3d-modeling unity java