texts: How can I create a fast, real-time, fixed length glowing ray?

texts:
Similar to the disintegrate skill in Diablo 3. It should not light other objects in scene. Just glowing and animated. Like in this video http://www.youtube.com/watch?v=D_c4x6aQAG8.

Should I use pack of pre-computed glow sources textures for each frame of ray animation like in this article http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html and put it in bloom shader?

Is there any other efficient ways to achive this effect? I'm using OpenGL ES 2.0.


texts: What are the benefits of binary format when storing map info?

texts:
I am developing isometric 2D exploration game. At this moment I faced with a problem where game takes too much disk space. Game's world at this moment is about 1 square kilometer and it's about 50MB.

I need to somehow squeeze it. Should I think about compressing it to archive or maybe there's some kind of game files packing technique?

What about binary? Can someone explain me the magic behind it? I heard that a lot of people use it, but when I tried to use it - it took same amount of space like simple .txt file.

I'm new on file formats, so I would be grateful for any ideas. Thanks.


texts: Managing a complex game storyline or quests system

texts: 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?


texts:
I have a typical parallax backgrounds. They are scrolling by

public float Speed=0f;

void Update ()
{
    renderer.material.mainTextureOffset = new Vector2 (Time.time*Speed,0);
}

I have a character. OnKeyDown he starts to move: Speed of background sets to 0.4f for example. OnKeyUp a character stops by setting the speed of background 0f.
The problem is: when backgrounds stop to scroll, they return to its start position. They must just to pause the position. How to do?


texts: How do I prevent my platformer's character from clipping on wall tiles?

texts:
Currently, I have a platformer with tiles for terrain (graphics borrowed from Cave Story). The game is written from scratch using XNA, so I'm not using an existing engine or physics engine.

The tile collisions are described pretty much exactly as described in this answer (with simple SAT for rectangles and circles), and everything works fine.

Except when the player runs into a wall whilst falling/jumping. In that case, they'll catch on a tile and begin thinking they've hit a floor or ceiling that isn't actually there.

In this screenshot, the player is moving right and falling downwards. So after movement, collisions are checked - and first, it turns out the player character is colliding with the tile 3rd from the floor, and pushed upwards. Second, he's found to be colliding with the tile beside him, and pushed sideways - the end result being the player character thinks he's on the ground and isn't falling, and 'catches' on the tile for as long as he's running into it.

I could solve this by defining the tiles from top to bottom instead, which makes him fall smoothly, but then the inverse case happens and he'll hit a ceiling that isn't there when jumping upwards against the wall.

How should I approach resolving this, so that the player character can just fall along the wall as it should?


texts:
I would like to implement something that behaves much like a distance joint / revolute joint in Box2D, however I do not want to throw a whole physics engine at this problem. I'm curious where I might start research to implementing such a thing.

Currently I only know them by their Box2D names, so googling that leads of course back to Box2D, so even that would be helpful.


texts: Assigning bone transform in every draw a good idea?

texts:
In my Draw method, I am doing the following:

thisMesh.CopyAbsoluteBoneTransformsTo(transforms);

Is this a good idea?  Or should I do this once at the constructor level?


texts: OpenGL glDisable(GL_TEXTURE_2D) vs glBindTexture(GL_TEXTURE_2D,0)

texts:
I would like to ask which one of these is better to use after I finished my texture rendering.

glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,0)

Is there any difference performance-wise?


texts:
I have a tile based board game where units move in 3D space on a 2D isometric view. When calculating attack tiles for a unit, how do I verify that they aren't shooting through a wall or a level too high for them see. I need quickly verify a lot of these attack tiles are within a unit's range of sight (about 20). What's the fastest way I can verify line of sight with the x, y, and z axis?

Somebody posted a similar question here, but it covers 2D sight calculation instead of 3D (making the answer very different).


texts:
I'm working on an input system (in C#) and now I'm wondering, what is the best place to put input functionality?

Currently what I was coding was a bunch of delegates which act as callbacks (i.e. onkeypress, onmouseclick, etc) and the idea is when the input manager checks for input it invokes these delegaetes.

However this means that input is updated when the input manager updates and not when a game class has its own update function called.

The way I see it is moving input functionality out of a classes update function and deferring them would forecefully reduce the codes complexity (particularly the update function) but on the other hand I'm thinking it might be a better idea to move update and input to the same place as it would give the coder more freedom to work with the input systems.

Anyone have any ideas on this matter?


texts: How can I render a texture to a polygon in SDL2? A fake 3D problem

texts:
I am working on a fake 3D game recently.  The game is based on the perspective principle and using angular perspective.  Here is a screen shot:

But the problem is that the walls and floor displayed are polygons, not exact rectangles.  I draw them preline.  Now I want to put some imgs on them.  How can I render a texture to a polygon?  How do I make texture exactly fill the area?  How do I give the plane a more 3D-like feel?


texts: dx Shader Model 3.0 break, continue, and loop attributes not recognized

texts:
I've been stuck on this problem for just too long. Long story short, the compiler returns "syntax error: unexpected token" for break, continue, [loop], [unroll] and pretty much every other attribute.

I am using DirectX SDK June 2010 on Windows 10, and compiling shaders for Source Engine 2013.

Microsoft Docs says these statements should be supported for pixel shader 3.0, so I absolutely have no idea what's wrong.

The entire code can be found here:

#include "common_vertexlitgeneric_dx9.h"

// front sampler and back samplers are used to calculate ray starting and ending points and direction.

sampler2D frontSampler : register(s0);
sampler2D backSampler  : register(s1);
sampler3D volSampler   : register(s2);

const float3 nPasses   : register(c0);
const float3 nAlphaCorrection : register(c1);
const float3 nClip             : register(c2);

struct PS_INPUT
{
    float4 FragPos                      : TEXCOORD0;
    float4 vPos                         : TEXCOORD1;

};

float4 raymarch(float4 p)
    {

    float2 texC = p.xy /= p.w;
    texC.x =  0.5f*texC.x + 0.5f;
    texC.y = -0.5f*texC.y + 0.5f;

    float3 front = tex2D(frontSampler, texC ).xyz;
    float3 back = tex2D(backSampler,texC).xyz;

    float3 dir = normalize(back - front);
    float4 pos = float4(front, 0);

    float4 dst = float4(0, 0, 0, 0);
    float4 src = 0;

    float value = 0;

    float3 Step = dir * (1/nPasses.x);

    // loop doesn't work, nor does unroll in this step
    // if loop then syntax error unexpected token 'for'
    // if unroll then undeclared identifier 'unroll'

    [loop]
    for(int i = 0; i < nPasses.x; i++)
    {

            pos.w = 0;
            value = tex3Dlod(volSampler, pos).r;

            src = (float4)value;

            src.x = src.x * 2 * step(pos.z, nClip.x);
            src.y = pow(src.y*2,2)* step(pos.z, nClip.x);
            src.z = pow(src.z*2,2)* step(pos.z, nClip.x);
            src.a = src.a * step(pos.z, nClip.x);

            src.a *= nAlphaCorrection.x; //reduce the alpha to have a more transparent result

            //Front to back blending
            // dst.rgb = dst.rgb + (1 - dst.a) * src.a * src.rgb
            // dst.a   = dst.a   + (1 - dst.a) * src.a
            src.rgb *= src.a;
            dst = (1.0f - dst.a)*src + dst;

            //break from the loop when alpha gets high enough
            if (dst.a > 1.0f)

                break;

            //advance the current position

            //break if the position is greater than <1, 1, 1>
            if (pos.x > 1.0f | pos.y > 1.0f | pos.z > 1.0f)

                continue;

            pos.xyz += Step;

    }

    return dst;

}

float4 main( PS_INPUT i ) : COLOR
{

    return FinalOutput( raymarch(i.vPos).rgba, 0, PIXEL_FOG_TYPE_NONE, TONEMAP_SCALE_LINEAR );
}


texts:
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?


texts: SharpDX Constant buffer not passing values

texts:
I'm trying to pass values to a Pixel Shader. I've added the following to the HLSL files.

cbuffer QuadShaderValues : register(b0)
{
    float3 PixelDropThresholds;
    float4 OverlayColor;
    uint PixelDropEnabled;
}

I've added the follow structure to the C# code;

[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct QuadShaderValues
{
    public SharpDX.Vector3 PixelDropThresholds;
    public SharpDX.Color4 OverlayColor;
    public uint PixelDropEnabled;
}

I've added the following code to the Initialization of the device :

m_ShaderValueBuffer =
            AddDisposable(new SharpDX.Direct3D11.Buffer(direct3DDevice, SharpDX.Utilities.SizeOf<QuadShaderValues>(),
                SharpDX.Direct3D11.ResourceUsage.Default,
                SharpDX.Direct3D11.BindFlags.ConstantBuffer,
                SharpDX.Direct3D11.CpuAccessFlags.None,
                SharpDX.Direct3D11.ResourceOptionFlags.None, 0));

        direct3Dcontext.VertexShader.SetConstantBuffer(0, m_ShaderValueBuffer);

I've added the following code to the Render Method :

deviceContext.UpdateSubresource(ref ShaderValues, m_ShaderValueBuffer);

The values do not seem to be making it into the shader.


texts:
I was able to do subdivision on a triangle mesh with midpoints but then I get polygons with too many faces. How do I convert to triangles after?

Similar to this picture:


texts:
I've got a custom OpenGL based rendering engine and I'd like to add support for cinema-type scene animation. The artist that is helping me uses primarily 3DSMax. I'd like a file format for exporting and importing this data. I'm also in need of a file format for skeletal animation data, which may have an impact here.

I've been looking at MAXScript to manually export this stuff, which would buy me the most flexibility, but I have virtually no experience with 3DSMax itself, so I get a little lost when it comes to terminology.

So I'd like to know what file formats exist for animated scene data, and whether they are appropriate for my use (my fear is that they will be way too broad for my fairly simple needs.)

The way I view animated scene data is basically a bunch of references to [animated] models with keyframe-based matrices describing their orientation over time. And probably some special camera stuff to handle perspective. I might also want some event type stuff for adding/removing objects. Is this a sane concept?


texts: Hide/move the Particle Effect panel on the Scene view window

texts:
The problem for example is if I want to drag the particle system object to the bottom-right corner of my view, then it goes behind the Particle Effect panel.
Is there any way to do hide or move this panel in editor mode and/or in runtime mode?


texts: How do I use openGL shader to reproduce this Photoshop implementation?

texts:
Here are my Photoshop actions:

step1 - convert the current image into gray

step2 - use the default parameters, as showed in the screenshot

step3 - use the 『Hue/Saturation』 to convert the grey image

step4 - use the parameters to complete

I did some search and find some code to make it available to convert to Grey as:

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;

void main()
{
    vec4 c = v_fragmentColor * texture2D(CC_Texture0, v_texCoord);
    gl_FragColor.xyz = vec3(0.2126*c.r + 0.7152*c.g + 0.0722*c.b);
    gl_FragColor.w = c.w;

}

I would like to know whether the code is correct according to the parameters in Step 2 and what can I do with openGL shader to achieve step 3 & step 4.

Thanks!


texts: How do i change the vertical fit of a constant size fitter? For example changing vertical fit from min size to unconstrained. Is it posible to do this?


texts: I'm trying to find a research resource for MMOs -- preferrably where people send papers to be published, have conferences, etc. If nothing else, just a repository of articles would be nice. Is there a site like that? I'm assuming it would be a subconference of a bigger group.


texts:
When creating meshes, I made a mesh class and then used that one as base model and redrew that same mesh for each instance of an object with that mesh. (For eaxmple, one rock mesh, many rock objects.) This is good for saving memory.

Now I'm trying to do this for dynamic models. I have implemented an MD5 animation and I can't really use the same method, because different instances of the same model may be in different stages of the animation.

Is there a similar design pattern that works for animated meshes and which will let me avoid creating a mesh per instance?


texts:
I want to create a turn based battle system for Pokemon online rpg!

I will some how implement the coding of the battle..but I want to know how can a user send request for a battle to other user?

If a user wants to have a live battle with some other user, he will send a battle request!
If the opponent wants to battle he will accept it otherwise it will be rejected and no battle will take place...!

How can I implement the above??


texts: Handling an item database with procedurally generated items?

texts:
Let's say you have an item database which has every item in your game.
This works fine for regular items like a Health Potion, a normal Iron Sword etc, because these items have ItemID's so we can get an exact copy of this item.
But what if we have an Iron Sword with an enchantment: '+5 Fire Damage'? (or whatever)

If you were to save that item to a player's inventory, exit the game and load the game, the item will load as a regular Iron Sword, because it still has that ID.

Specifically, how would you save that item to a file? I'm using Unity, so to save the Player's inventory, I use:

PlayerPrefs.SetInt("Inventory " + i, inventory[i].ItemId );

Would you create a custom item ID for every item with enchantments or is there a better way around this?


texts:
I am making a platformer, where my player is represented as a circle and the ground is represented as lines. The actual collision detection and resolving works, it's just an edge case I can't find a solution for.

I check on which line the hero is by using the normal, and if the hero's center is between these normals I know he is on that line. That works except for the case in the image above.
When he get's in the 'Problematic Area' the algorithm will not detect any collision.

So how do I know which line to pick for the collision when the hero get's in this area?

Here is some code that shows how I test collisions (which again works, but does not consider the problem I actually have).

playerPointer:Vector2D = New Vector2D(position.x - line.x1, position.y - line.y1)
lineNormal:Vector2D = line.vector.Copy()
lineNormal.LeftHandNormal()
playerOnNormal:Float = playerPointer.ProjectionOn(lineNormal)
playerOnLine:Float = playerPointer.ProjectionOn(line.vector)

#Do we have a collision between the circle and the infinite line
If Abs(playerOnNormal) <= radius

  #Get the direction vector of the line
  Local directionVector:= New Vector2D(line.x2 - line.x1, line.y2 - line.y1)

  #Is the player inside the normals boundaries
  If (playerOnLine <= directionVector.Length) And (playerOnLine >= 0)


texts:
I'm trying to create an infinite flying game where the gameobject (a plane) keeps moving forward and at a particular height throughout the game. I want to be able to
roll and pitch the plane but not move it up/down. I added a rigid body to the plane and selected "y" position constrain. However the plane doesn't stay in the 'y' position but starts move up or down. I just have a script that translates the plane in the z direction. Not sure how to implement the mobile input and keep at the same "y" position throughout.

Update

Here is the code for the plane. Its very basic as I'm not sure how to use the accelerometer:

public class Player : MonoBehaviour {

public float speed = 1.0f;

void Update () {
    float tempx = Input.acceleration.x;
    float tempy = Input.acceleration.y;
    float tempz = Input.acceleration.z;
    transform.Translate(0, 0, 10); // move forward in z
    transform.Rotate( 0,  tempy * speed, tempz * speed);
}

As for the freezing of the 'y' position, I'm just selecting the y constraint available in the inspector that comes along with the rigidbody.


texts: Matrix transformations vs manipulating vertex data directly

texts:
I was wondering whats more efficient to do if you want to transform a mesh. 1) Transforming a matrix and pass that to a shader or
2) Manipulate the meshs vertex data directly

I was wondering because LibGDX is using the second option to transform sprites. And calculating the translation, rotation and scaling for every mesh every frame seems a bit too much, since you have to change the vertex data every frame too.


texts: Best free advertising for Facebook strategy game

texts:
I have written a game for Facebook. I think the game is fun to play, although the graphic presentation is primitive since I am not a graphic artist/web designer

I am the only Facebook user playing the game at this time. It does not appear to appeal to FB's demographic audience who seem to prefer less complex and less challenging games. Does anyone have any ideas on how I could get the word out about my game to the proper audience while spending very little or no money?


texts: apk is fine, but when building aab for google play submission google play services dont start when i download it

texts:
So I have a game on app store, I added Google play services

Now when I do an apk build and test it works great really happy with it.

But when I then tick the box for aab ( this is what Google store want uploaded ) it builds it,  I upload it, it rolls out but the Google play stuff fails to work, leaderboard and sign in.

When I extract the apk on my Mac from the aab and install that it works great again.

What am I doing wrong? Is there a way to check logs of running app? On a device

I have tried

7 different versions of unity (currently on 2019.2.9f1)
Changing the min version of Android API to 21
I exported it as a Gradle project and tried building it like that, again test great on device but play services fail when downloading it from the google play store.

It's using the IL2CPP scripting backend.

Any ideas at this stage are welcome


texts: Stitching terrain tiles made in Blender at runtime

texts:
Background

I'm making several individual terrain tiles inside of blender for use within a Unity 3D 5 game. Each tile is square and is made to represent a segment of a world. In game the tiles are randomly* chosen and placed between each other. However these tiles do not always have matching sides.

Why the tiles

To allow for greater terrain sculpting possibilities such as caves, precision-placed landmarks e.t.c. but still allow for a procedurally generated feeling; randomly placed static tiles are used.

There are mountain tiles and there are plane tiles. Mountain tiles have a more extreme terrain and are mostly next to other mountain tiles so that bigger mountains can be formed. Plane tiles are similarity placed next to other plane tiles.

The game is "low poly" and so is the terrain. This makes it hard to have flat sides on every tile at the same height for easy "stitching".

Concrete question

How can I match these edges runtime to ensure that there are no visible tile edges?


texts: Find your value between four values in a grid based on distance, Unity

texts:
Please note: Originally posted in stack overflow, redirected due to nature of problem.

I am making a procedural mesh game. I am trying to calculate the temperature for the player's current chunk by getting nearby temperature values and interpolating.

The way this works is, let's say we are at world space 95, 0, 65 (x,y,z). What I do is:

1) generate, using perlin noise, temperature values for every 20 squares (smartly generated to only do so to the 4 squares most relevant to us at any given time). We will get the points: 80, 0, 60 100, 0, 60 80, 0, 80 100, 0, 80

Each of these points is fed into a perlin noise generator and spits out a number. That number is the temperature.

So, in order to make the climate smoothly transition, I need to figure out how to get the distance each point weighted against its temperature so I can calculate the temperature of the space I am standing in.

If there is a name for this (there must be, I'm essentially sampling a gradient made by four points) and a way to do it, please just link that instead.

I tried taking the distance from my point to each point and multiplying that number against the temperature at that point, but I'm not sure if that's a correct first step, or what to do from there (just average the four resulting numbers?!).


texts:
I would like to create a city generator for a game, but I am facing a problem at the very start of the generation: the road system.

As it is a medieval world, I don't want a grid plan like many modern cities. I would ideally prefer a pseudo-random generation of large avenues and smaller streets, where it could be possible to get lost, but with still some logic - not a complete labyrinth.
Something that would look like a naturally grown town.

In order to keep it simple, let's say my cities would be on flat and stable terrains, without any river-crossing or relief problems. I could try to integrate it to a solution after.

I didn't decide of a precise size or disposition for my cities, so if you have a solution that would work only with cities of a precise form (square, circle, rectangle etc), I would take it.


texts: Trees made with Unity's Tree Editor have 2 sides: 1 bright and 1 normal

texts:
(The directional light lits the side shown at the right side of the picture.)

I tried changing shaders, but that just makes the bright side fully dark.

I tried changing Ambient Occlusion but that make the normal side fully dark, and the bright side normal.

I use the "Green Forest" (free) asset from the Unity Store.

Currently it uses the "Hidden/Nature/Tree Creator Leaves Optimized" shader.

Some types of trees got fixed by turning off AO, and setting shadow strength to 0 both at the shader and at the Tree component, but for example the tree on the picture can't be fixed for some reason.

One type got fixed by setting its shader to "Tree Creator Leaves Fast". But that way shadows "float" around the leaves.

Why does this happen?


texts:
I need some help with some terrain I'm working on. I'm developing a plugin for Minecraft, but these concepts will apply to any game with terrain. I am using Simplex noise to generate cavern-like terrain. I am using the power of the noise to generate hills that look like this:

As you can probably tell, it inst looking very cavern-like. What can I do to improve this terrain?


texts: Sending position updates from server to clients (Unity + gRPC)

texts: So clients connect to the server and the server spawns an entity for each of them. What I'm confused about is how to send position updates from the server to the connected clients. I read about bidirectional streaming but I'm confused because that would mean clients would have to specifically request the positions every update, which is not what I want. I want the server to send positions to every connected client. Is it possible to do it with gRPC? If so, how would I go about it?


texts: Is it possible to debug a Unity Android game directly on a device?

texts:
I'm working on my game and every time I make changes to it I send the game to my mobile device to debug it.

I want to know how I can directly debug my game using an Android device instead of the MonoDevelop editor?


texts: How to get plane rotation by known normal vector

texts:
I have a FPP quaternion Camera and Plane with known normal vector.

I want to find the orientation of this Plane so I can replace it to the Camera orientation to put the camera forward vector to a plane's normal vector.

First method I tried, I don't understand RotationAxis and RotationAngle. I built a rotation matrix and applied it to the camera but it didn't behave as I wanted.
The second method I tried  is with method called "from_one_vector_to_another". I don't understand what the "from" vector is in my example; is it the camera's forward vector?

Here is my pseudo code:

Vector3 vector_from = camera->getForwardVector();
Vector3 vector_to = triangle->faceNormal;

Quat cameraQuaternion = camera->getOrientation();

Quat q = vector_from.getRotationTo(vector_to);//The method `getRotationTo` is from Ogre.
camera->setOrientation(cameraQuaternion * q);

Camera does not change their orientation as I expected; it changes its orientation just a little bit.

EDIT:

Maybe I have something wrong with my code:

//Quat xrot = axisToQuat(Vector3(1, 0, 0), vertical);  // disabled for now
Quat yrot = axisToQuat(Vector3(0, 1, 0), horizontal);
rot = rot * yrot;

position += velocity;

Matrix lookAt = Matrix::createLookAt
        (
            Vector3(position.x, position.y, position.z),
            Vector3(position.x, position.y, position.z-1),
            Vector3(0,1,0)
        );

view = rot.toMatrix() * lookAt;

I am only rotating the quaternion. Should I rotate lookAt Matrix too?


texts: How can I places objects to specific facial landmarks ? like ears and hats

texts:
I'm currently trying multiple AR plugins in unity and I'm stuck in how to place certain objects in specific landmark positions.
I used the landmark positions to spawn certain objects but they are way off from the intended areas I wanted.

Here is the code sample I'm using the get the facial landmarks of the ears, mouth, nose and eyes :

MatOfPoint2f imagePoints;
imagePoints = new MatOfPoint2f ();
Mat rgbaMat = webCamTextureToMatHelper.GetMat();
Rect detectionResult = faceLandmarkDetector.Detect();
List<Vector2> points;
if(detectionResult != null && detectionsResult > 0)
    points = faceLandmarkDetector.DetectLandmark(detectionResult[0]);
if(points != null)
{
imagePoints.fromArray(
new Point((points[38].x + points[41].x) / 2, (points[38].y + points[41].y) / 2), //Left Eye Facial LandMark Position
new Point((points[43].x + points[46].x) / 2, (points[43].y + points[46].y) / 2),// Right Eye
new Point(points[30].x, points[30].y), //Nose
new Point(points[0].x, points[0].y),Left Ear
new Point(points[16].x, points[16].y) Right Ear

);
}


texts: How can I make an update patch for a Unity game on Windows?

texts:
I ran into trouble making a PC game using Unity.

If I try to update my game, I can't a update the C# scripts (because AssetBundles don't include C# scripts)

So I think I'll need to use a server and patch all files.

But I don't know how to do so...

How can I make an update for my Windows game?


texts: Are there any usable performant path-finding libraries for python?

texts:
This is cross-posted from StackOverflow, please feel free to answer there too:

I'm working on a real-time isometric RPG in python, and wish to target mobile devices as a platform. The main area where I'm having difficulties is with my pathfinding. I have tried a few algorithms including A* and a few tweaks to better fit the maps I'm using.

I am satisfied with the results of my algorithm - they give the illusion of some intelligence while being deterministic, and being consistent in either direction so that two characters targeting each others' locations will collide in the middle.

My problem is that while the results look good on the PC where I have all the processing power I could ask for, on my mobile it's quite another story, and there is often a second or more delay while the algorithm is calculated. For this reason I am considering writing a library for this with the most performance-intensive code written in C, however if there is an existing solution for this, or a better way I could do this, I would be all ears.

I stumbled across python-pathfinding but this seems to be slower than what I have built myself for my use case.

My use case:

My maps are build from levels, which are surrounded by walls (visible or invisible), and must be linked by doors (visible or invisible).

My current approach is to have two different algorithms:

Within a room I search individual tiles as nodes, with each boundary as an equal-cost edge, using a depth-first in the direction of the target location
Between rooms where each door is a node. The shortest possible path through a room (from door to door) is calculated using the first algorithm and stored in a hash table as the edge cost between those nodes. Sets of edges that can be traversed to get from one node to another are then calculated and also stored in the hash table, and it is not permitted to include the same edge more than once in the same path.

I spawn a separate process on start-up that generates a graph for the second algorithm using the first, and this solves many of my issues, rooms tend to be relatively small and so the penalty of on-the-fly path-finding is kept lower than it otherwise could be, and then for longer distances:

the first algorithm is used to calculate the distance from the current location to every door in the current room.
the first algorithm is used to calculate the distance from each door in the target room to the target location.
the output of the second algorithm is used to get the set of paths between rooms
the cost of these is added to the cost of getting to the first door and from the last door
the set of solutions is sorted by cost in such a way that the order of paths of the same cost will always be consistent
the first item in the set of solutions is chosen.


texts: Euler adjustments between two quaternions

texts:
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!


texts:
Hi I need to implement following effect using vertex shaders.
Basically its a shader for particle laser beam that rotates to particle along its own y axis till its "best" visible (Roughly).

My idea was:

Take  "y" axis of particle model (its a rectangle) and transform it
to view space ("vy").
Calculate the vector orthogonal to "vy" and eye vector ("w"), to get the
direction on the screen which "x" of partilce should be oriented.
Change particle vertices model coordinates using "w" instead of x.


texts: How can I control a game 2d car mechanic from acceleration & speed to just 1 value?

texts:
So I have a car in a 2d game that runs on acceleration and speed, two values that have a max.
The acceleration is small, under the value of 1 and it rises by an incrementation.
The speed is large number like 100 and it rises by incrementing the current acceleration.
They are both incremented relative to the fps but that's not important.

What I am trying is to have a formula with having only one value (with a max) instead of two as I am trying to simplify the UI for the player.

Alternatively, I was thining of having a value (lets call it speed) that gets incremented by something, without a max, but is limited by, lets say road friction (like multipling it with 0.99). Such a thing would be felt lower when the car is slow but eventually the friction would act as a max/limit, the car oscilating to near max values.

I know too little of physics and car stuff to figure this out on my own so I am reaching out for help. Thanks!


texts: How should I display ping in a client-server-client multiplayer?

texts:
Say I'm having a multiplayer RTS game. There's a main server for each individual game and several clients connected to it. All packets are sent to server first and then server retransmits them back to specified clients.

I'm thinking of 2 ways:

List of Client-Server pings, which will be the same, no matter which Client asked for it
List of Client-Client pings, which will vary for every Client

My question is how should I calculate and display ping info to players?

I will add more details to my question if necessary


texts: Procedurally generated 2d terrain for side scroller on Sega Genesis hardware?

texts:
I'm working on the Sega Genesis that has a 8mhz Motorola 68000 CPU.

Any ideas on how to generate fast and decent 2d tile terrain for a side scroller in real time? The game would generate new columns or rows depending on the direction the player is scrolling in. The generation would have to be deterministic. The same seed value would generate the same terrain.

The style of game would be a platformer like Sonic The Hedgehog. Maximum size would be around 1024 x 1024 tiles, but smaller could also work.

A column or row doesn't have to be calculated every frame, just when a new one is needed. If the player moves 1 pixels a frame, then a new column is only needed every 8 frames.

I'm looking for algorithms that would satisfy the memory and CPU constraints of the hardware.


texts: Resource management with Lua integration

texts:
I have a questions about how to better implement resource management when integrating with Lua. I have an entity system that has gameplay logic done in Lua. One of the design points was that I wanted to simplify the script code as much as possible. To that end, things like sprites and sounds are generic "resource" handles (currently just integers) that are referenced, e.g.

self.image = resource("/foo/baz.png")
self.hurtSound = resource("/foo/bar.mp3")
...
play(self.hurtSound)

This works well, but I don't know when (from the native code side) it is safe to delete a resource because a Lua object could be holding on to it. I don't have "levels" where there are convenient "load/unload" points, so I'm wondering how I might safely achieve this without making the Lua code have to do anything complicated with resources. Essentially, I want garbage collection for unused resources. I'm not a Lua expert, so I'm sure there is some feature of the language that could implement such a behavior.

My requirement is that I should be able to copy handles around safely, e.g. do not need to call resource() twice to do some kind of "obvious" reference counting. Similarly, if resource() is called n times, but at least 1 reference is valid, then the resource should not be unloaded; i.e. simply because one value was __gc'd, doesn't mean that all of them should be invalidated.

The native code implements the resource cache and simply needs to be informed when it would be safe to unload something (even if it doesn't unload it immediately).

Any Lua experts ran into similar sort of situations? What did you do to solve this problem?


texts: Ensure packet owner from connection is the authentic user

texts:
In a multiplayer game, how can you be sure that the IP from a packet is the real IP? By spoofing I could send, for example, a "suicide packet" which tells the server that the owner of said packet wants to destroy its avatar when in reality I faked it.

Do games just give up on this aspect?


texts: Problem, why the mouse cursor position is totally wrong, after resizing the window?

texts:
I come here, because i'm trying to add some "menu" interface in my small XNA Game . I found on internet a nice library adviced by many devellopers. Till now everythink is ok, the problem is my C# code logic. I try to allow the player (user) to change the screen resolution . The resolution and screen are both of them change . The problem is about the "cursor" of my computer mouse . It's really weird, i don't why but the cursor of my mouse does not select the right elements .It's look like a gap persisted between the old window.

Here is the code i use, as you can see , very simple. And should be normally work. I hope you have some idea why . I'm lost :'(

void btnApply_Click(object sender, Controls.EventArgs e)
{
  Manager.Graphics.IsFullScreen = chkResFull.Checked;

  //Resolution set by default
  int w = 1024;
  int h = 768;

  if (rdbRes1024.Checked)
  {
    w = 1024;
    h = 768;
  }
  else if (rdbRes1280.Checked)
  {
    w = 1280;
    h = 1024;
  }
  else if (rdbRes1680.Checked)
  {
    w = 1680;
    h = 1050;
  }

  Manager.Graphics.PreferredBackBufferWidth = w;
  Manager.Graphics.PreferredBackBufferHeight = h;

  Manager.Graphics.ApplyChanges();
}

Here is the screen shot of my original screen ( 800/480 )

Here is the screen shot after change to the screen resolution ( 1280/860 )


texts: How to find grid cells not seen by an object

texts:
I am writing a VB.NET program.

I have a grid view which is made of multiple small cells called grid cell.

On the grid view, I have placed an obstacle (red box) and an observer (blue box).

My task is to find how to find grid cells which are not seen by the blue box.
You may refer to the screenshot below.

Take note that the yellow box shape is not necessary a rectangle.

1) I have considered to loop through all grid cells in the grid view and check each of them if it is seen by the blue box.

However, there could be millions of grid cells in the grid view and looping through each of them will consume a lot of time and is not efficient.

Is there any better way to locate grid cells not seen by the blue box other than looping through all the grid cells in the view?

Thank you.


texts: What technologies were used to create "Dueling Network"?

texts:
I want to make a similar browser online multiplayer game like "Dueling Network" (link below) but for a different TCG.

What technologies you believe they used to create it?

Could anyone kindly refer to any good resources/books to start from, so that eventally (not soon) I myself can create something very similar to the game mentioned above, perhaps a little more simpler.

Assuming Flash and AS3 are involved, and I have 0 knowledge of them. Only have been exposed to VB, C#, and most web programming languages.

Dueling Network NSFW: loud music


texts:
A path is defined as a list of positions for units to follow sequentially to navigate terrain. For example,

var Path = new List<Vector2> (){
    new Vector2 (0,0),
    new Vector2 (10,5),
    new Vector2 (20,5)
};

Conceptually, how would a group of 10 clumped-up units navigate to each of the waypoints? When each unit checks its distance to the waypoint to decide whether or not to move on to the next waypoint, units may start running into each other, trying to occupy the same waypoint.

Are there any clearcut solutions for group path following or ideas for how to solve it?


texts:
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.


texts: Calculating the winding and normal when programatically adding triangles to a mesh

texts:
I'm writing a program that takes a 2D planar polygon and extrudes it to a 3D mesh with a given height. I identify triangle edges that are borders of the polygon and now I'm trying to automatically compute the two triangles required for the extrusion of the border. However, I'm stuck at how to compute the correct winding and normals

My start situation is this: I have the two coordinates of the edge (marked in white) and the normal of the original triangle (marked in orange)

Using this information I'm trying to compute two triangles which should result in:

The 4 vertices are easy to compute (just the two vertices of the edge and two more at a different height). The normal should be perpendicular to the original normal but to do that I need a second reference point. It doesn't seem to be as simple as using the centroid of the triangle.

The triangle winding confuses me. I need a counter-clockwise winding and I guess I could determine which vertices to use based on the normal but how is not immediately apparent to me.


texts: What is a legal way to use music from registered authors in a game?

texts:
I have recently asked a question about music in games like Guitar Hero.

I have found that that in Europe (at least) if I do want to use a track composed by a musician member of a royalty collecting society I need to pay a flat fee to the society and not only to the member.

So a "one-to-one" agreement is not valid and the society can come up to me and ask me for money for each download. Even if for FREE!

This is a fee sheet list of the UK agency:
for fee, see "Permanent download services"

It is about 1,200 GBP for less than 22,000 copies and they DON'T specify anything more and they said me on the phone that I need to wait and see how many downloads I get before knowing the price.

This is kind of crazy as If I give away the App for free I will have to PAY 1,200 GBP!!

I am shocked and I feel very bad.

The other solution is to work only with non registered musicians.

The question here to you is:

Has anyone found a legal way to use music from registered authors in a game?


texts: Why does reverse depth buffering provide more precision? (with DXGI_FORMAT_D24_UNORM_S8_UINT Datatype layout)

texts:
I lately came around methods optimizing the use of the depth buffer, as the easiest solution reverse depth buffering is mentioned but I cannot wrap my head around why I would be gaining a better depth distribution with it.

First I thought it to be that way because floats use well floating point format so if I can map 90% of the scene to near zero i can benefit from floats great precision near zero but then I saw that those 8 bit for the exponent are being reserved by stencil so now I don't think they store exponent data?

Edit: Now that i was told unnorm are just fixed precision and have actually tested that it does improve depth resolution indeed I dont understand how it can improve Z-buffering without having exponent data has someone a theory regarding why? If the UNORMs have fixed precision it should´nt matter whether I map the 99% that don't lay 3 meters in front of the camera to one or to zero.


texts: C# 2D Enemy Follow Y Axis Only While Rotating to Look At Player (Unity)

texts:
I have a 2D game where the player can move up and down on the y axis, I need the enemy to rotate to look at my player (which I have working, but probably isn't the best method) while also moving up and down with the player.

I have both of those things working, but not fully, right now whenever I move up and down, the rotation happening seems to cause the enemy to move backwards more and more with each up and down movement.

I need it to remain stationary on the x and z axis's.

Also, if anyone knows how I could make it so the enemy always wants to be slightly above the player on the y axis, that'd be awesome. Meaning, instead of locking onto the player dead straight, maybe the enemy can be up slightly by perhaps 20%.

This is the code I'm working with:

public float moveSpeed = 3.0f;
public Transform target;

private Transform myTransform;

// Use this for initialization
void Start () {
  myTransform = transform;
}

// Update is called once per frame
void Update () {
  Quaternion rotation = Quaternion.LookRotation(
    target.transform.position - transform.position,
    transform.TransformDirection(Vector3.up));
  transform.rotation = new Quaternion(0, 0, rotation.z, rotation.w);

  if (target.transform.position.y < myTransform.position.y)  {

    myTransform.position -= myTransform.up * moveSpeed * Time.deltaTime;
  }
  else if (target.transform.position.y > myTransform.position.y) {

    myTransform.position += myTransform.up * moveSpeed * Time.deltaTime;
  }
}


texts: Can I call c functions within the XNA framework?

texts: I would like to make a 360 game and was just wondering if I could re-use some existing C code I have or whether I need to re-write everything in C#.  Any help is appreciated.


texts: Unity 'Collider.bounds.Intersects'. Does it handle rotation?

texts:
You will probably laugh at my code here (and I would love to hear some completely different approaches to this problem if possible), but I've written this myself using the only logic I could come up with alone.
Basically I want to make a slope randomly covered with trees. The slope is a quad with a mesh collider (I've also tried Box), and the tree is a prefab with just a model and a collider.  I iterate through every possible tree location and give it a 0.25 chance of spawning a tree. This all works ok, but since the quad is not lying flat to any axis, I couldn't think how best to assign the Y-position value to my trees.
My idea was to simply drop the trees all from above and have them land in the quads collider. If I lay the quad flat my code will work fine, but as soon as I tilt the slope the collision is still detected. It seems as if its reading the top of the quads highest point and making a box around it all the way to the bottom.
This is the code:
        for (int i = 0; i < trees.Count; i++)
        {
            if (!trees[i].GetComponent<Collider>().bounds.Intersects(ski_slope.GetComponent<Collider>().bounds))
            {
                Debug.Log("moving tree");
                trees[i].transform.Translate(0, -0.2f, 0);

            }
        }

So really I think my use of the 'Intersects' function must be wrong.
I hope my description of the problem makes sense. Otherwise I can take some screenshots to try show it.
Thank you for any help.


texts:
I want to detect the double tap on a Container. If it is detected, then i have to remove the Actor associated with it.

This is my first attempt:

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

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


texts: 2D Physics Engine to Handle Shapes Composed of Multiple Densities XNA

texts:
The game I'm working on involves shapes that might be composed of multiple materials in a variety of ways. Let's just take for example a wooden rod with and sizable tip of iron or say a block composed of a couple triangles of stone and aluminum and small nugget of gold. The shapes and compositions will change from time to time, so I was wondering what engine I should use and how I might implement this feature?

I've looked at Farseer 3, but I'm still trying to decipher the library by reading the source and the samples and wasn't sure if I was barking up the wrong tree.

Thanks!


texts:
In my game, I fire a bullet from the gun along with that I generate a particle behind the bullet so that I look like fire effect after the bullet. But my problem is that the position I got from the bullet was distance in place. So basically I want to say that the bullet speed was high for that reason I got coordinate for the particle generation was far from each other like

dot dot effect. But I want continuous flow of particle behind the bullet. So please provide any guidance for my problem


texts: Screen coordinates to isometric coordinates?

texts:
I know this has been discussed here before, but I couldn't find an easy solution for my particular problem. I have a tile system and I'd like to convert screen coordinates into isometric tile coordinates. Here's an image to explain what I need:

As you can see, the coordinates are between 0 and 1. I can't figure out a formula for the conversion though. Can you guys help me?


texts: 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?


texts:
My player controller code is bellow. So is my player inspector. This makes my character move yet it blurs the background, but when I use  transform.position.x = transform.right * speed * Time.DeltaTime it moves without blurring the background. However I'd prefer moving the character using the physics system, to avoid complications with collisions, etc.. What is going on?

[SerializeField] public float speed;
[SerializeField] public float jumpForce;

private Rigidbody2D rb;
private CharacterAnimationsAn animationScript;
void Start()
{
    rb = GetComponent<Rigidbody2D>();
    animationScript = GetComponent<CharacterAnimationsAn>();
    gameObject.transform.eulerAngles = new Vector3(0, 180, 0);

}

// Update is called once per frame
void FixedUpdate()
{
    rb.velocity = new Vector2(speed, rb.velocity.y);
    animationScript.SetRunning(true);
}

Maybe it might be related to the Script that make the Camera follow the Player?

myDistanceToFllowerDifference = gameObject.transform.position - objectTofollow.transform.position;

gameObject.transform.position = new Vector3(objectTofollow.transform.position.x + myDistanceToFllowerDifference.x, gameObject.transform.position.y, gameObject.transform.position.z);

I have no processing stack, my camera inspector is bellow:

I also have a parralax script working on the background which has an inner working almost identical to this: Parallax Video

I should correct that it might not be a blur but actually an effect similar to a low frame rate on the background, while the player and everything show no such effect. Unfortunately I can't actually provide you with an image of the effect, as I'm not authorized to do so.


texts: Maya - Single Model with different animation

texts:
I am newbie in Maya and would like to clarify some implementations in Animation. I know how to create simple animations in Maya. These animations are exported to Unity3D (as .fbx with controllers) to use in my application.

I want to know whether it's possible to attach different animations to one model. For example, let's say, I have an arrow mark model and I want to show different animations for the model like moving left, moving right, moving up, moving down, etc. So that, when I export, I'll get one model - Arrow.fbx and different controllers - LeftAnimController, RightAnimController, etc.

Is that achievable? Or I need to create different Arrow mark model with it's own controllers.

Any help will be appreciated.
Thank you.


texts:
I am a blind programmer, working on an audio game for the blind.
I am using SlimDX, and it has been tested on dozens of systems from XP to Win 8.1.
My code works on most systems just fine, but I am getting the following error at runtime on a handful of older XP systems:

vupgraderacer.wav SlimDX.DirectSound.DirectSoundException:
DSERR_INVALIDCALL: This call is not valid for the current state of
this object (-2005401550)
at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
at SlimDX.DirectSound.SecondarySoundBuffer..ctor(DirectSound device, SoundBufferDescription description)
at RR.Sound..ctor(String fileName)

The same error is repeated for each sound it is trying to use.
Here is the code I am using to setup the DS device:

dsDevice = New SlimDX.DirectSound.DirectSound
dsDevice.SetCooperativeLevel(OGw.Handle,
SlimDX.DirectSound.CooperativeLevel.Normal)

I realize there are other flags that can be set, but this basic setup has worked well thus far, minus the older XP systems.
This is my first post, so hope I am entering it properly, if not, please let me know, it is sometimes difficult to tell where you are or should be with a screenreader on forums.


texts: How would I setup fog to follow a players coordinates?

texts:
I'm wondering if its possible to setup a fog to a player's coordinates (where there is fog around the player to make it more third-person) the main reason I ask this is because I have my player more towards the top right corner of the screen

Here's some code that can give you a guide on what im doing:

glEnable(GL_FOG) GLfloat FogColor[] = {0.8,0.8,0.8,1.0};
glFogfv(GL_FOG_COLOR,FogColor);
glFogi(GL_FOG_MODE,GL_LINEAR);
glFogf(GL_FOG_START,30);
glFogf(GL_FOG_END,);
glHint(GL_FOG_HINT,GL_NICEST);

and I want the fog to follow a player with a position as said in

posX,posY,posZ

If anyone can turn this into some example code that would be very helpful, thanks

If this is not possible then how would I setup the fog to be around a certain position of the camera, like show on the top right corner of the camera instead of the center?

Here's a picture of the game screen so you can see what im talking about:


texts: I need some help with stopping individual sound effects in OALSimpleAudio

texts:
I'm trying to find out how to stop a specific sound effect rather than having to stop all of them.

I'm using OALSimpleAudio.

I can't seem to find how to do it. simple google searches result in nothing, which means my searches are crap, it's REALLY easy to do and i'm ... stupid :p, or it isn't possible.

I hope you guys can help me.

In the background i have a humming engine sound, but when the object takes damage, the humming sound is stopped, that's not what i want.

case kStateTakingDamage:
        CCLOG(@"Ship taking damage");
        [self playTakingDamageSound];
        self.characterHealth = self.characterHealth - 1.0f;
        action = [CCActionAnimate actionWithAnimation:damageAnimation];
        [[GameManager sharedGameManager] stopSoundEffect];
        break;

- (void) playSoundEffect: (NSString *) soundEffect {
    [self playSoundEffect: soundEffect andLoop: NO];
}

- (void) playSoundEffect: (NSString *) soundEffect andLoop: (BOOL) loop {
    [[OALSimpleAudio sharedInstance] playEffect:soundEffect loop: loop];
}

- (void) stopSoundEffect {
    [[OALSimpleAudio sharedInstance] stopAllEffects];
}

- (id) isSoundPlaying {
    //TODO: find out how this works ;
}


texts:
Possible Duplicate:
  Tools for creating 2d tile based maps

I am Indie Game developer and  I am looking for a tile based 2d level editor. I also would like to know the free ones as well as paid ones, which you feel as the best.


texts: matrix to transform unit cube to space defined by 8 arbitrary points

texts:
I asked a question relating to similar to this already, but I think this is a clearer objective of what Im trying to achieve.. or whether its possible at all!

Im trying to find a transformation (matrix ideally) which would transform the 8 points of a 3d unit cube to 8 arbitrary points in space.

The 8 target points have no known structure.

e.g:

My gut feeling is that a matrix is unable to provide this xform since the cube faces vertices can be concave.. but are there any other methods of transformation?
Thanks!


texts: Why am I seeing undesirable rendering results using VBOs like this?

texts:
I am trying to write a program that renders using VBO(vertex buffer objects). Everything works great except that when I run the program, It looks like the object is spazzing out. I think its due to the fact that I am trying to delete the buffers, but I could not fix the problem no matter what I have done. Can someone tell me what I am doing wrong with the piece of code?
Appreciate it.

    GLuint VBOvertex;
    GLuint VBOTexCoord;
    GLuint VBONormal;

//////////////////////////VERTEX BUFFER
glGenBuffers(1, &VBOvertex);
glBindBuffer(GL_ARRAY_BUFFER,VBOvertex);
glBufferData(GL_ARRAY_BUFFER,sizeof(m->verticies)*3,m->verticies,GL_STATIC_DRAW);

///////////////////////////TextCoord BUFFER
glGenBuffers(1, &VBOTexCoord);
glBindBuffer(GL_ARRAY_BUFFER,VBOTexCoord);

glBufferData(GL_ARRAY_BUFFER,sizeof(m->TextCoord)*2,m->TextCoord,GL_STATIC_DRAW);
//////////////////////////////NORMAL BUFFER
glGenBuffers(1, &VBONormal);
glBindBuffer(GL_ARRAY_BUFFER,VBONormal);
glBufferData(GL_ARRAY_BUFFER,sizeof(m->Normal)*3,m->Normal,GL_STATIC_DRAW);

delete[]m->verticies;
m->verticies=NULL;
delete[]m->TextCoord;
m->TextCoord=NULL;
delete[]m->Normal;
m->Normal=NULL;

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);

glBindBuffer(GL_ARRAY_BUFFER,VBOvertex);
glVertexPointer(3,GL_FLOAT,0,0);

glBindBuffer(GL_ARRAY_BUFFER, VBOTexCoord);
glTexCoordPointer(2,GL_FLOAT,0,0);

glBindBuffer(GL_ARRAY_BUFFER, VBONormal);
glNormalPointer(GL_FLOAT,0,0);

glDrawArrays(GL_TRIANGLES, 0,m->nbrTris*3);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);


texts:
A "minigame" (sometimes mini-game) is a rather common term used in game design and the general game industry. Therefore it has a definable scope, that is not opinion based, but rather established and tangible. However, I'm at a loss to define its scope. The wikipedia page says:

  "A minigame (also spelled mini-game or mini game and sometimes called
  a subgame) is a short video game often contained within another video
  game and sometimes in application software or on a display of any form
  of hardware. A minigame is always smaller or more simplistic than the
  game in which it is contained. Minigames are sometimes also offered
  separately for free to promote the main game. For instance, the
  Pokémon Stadium minigames involve merely pressing a few buttons at
  specific intervals, with little complexity."

When asked to define it, I guess loosely I'd consider a minigame any game that:

could easily be a self-contained game within another one
that usually shows all the information on the screen
could have been produced in the "dawning of gaming" (At least its mechanics)
that the average (perhaps even non-gamer) can sit down and instantly
understand nearly all the game rules without having to "learn" them via
play.

Some things to think about:

Is Game_B that has been included in another game, Game_A, still
a minigame if it is later played or released independently from
Game_A?
What if Game_B was originally independent, but Game_B (or
clones) are now almost exclusively found as minigames within other
games? Will Game_B always be a minigame after that?
Is pong a minigame - it most certainly has been a minigame?
Likewise, is chess a minigame (it matches my personal definition
despite being incredibly complex logically)?

(I don't know if I can link pictures here, otherwise I would add some examples.)

Answers should please be constructive and professional. Good answers should also give reasoning and cite sources when possible.


texts:
I have a question about the popular FXAA shaders that are out there written using HLSL or GLSL, and they all mainly feature these three parameters:

#define FXAA_REDUCE_MIN (1.0 / 128.0)  //0.0078125
#define FXAA_REDUCE_MUL (1.0 / 8.0)  //0.125
#define FXAA_SPAN_MAX 8.0

What is the function of each parameter?


texts: Heat bar that always goes down but when near fire it goes up

texts:
For the fire I have this script on it.
public class HeatingZone : MonoBehaviour
{
    public float heatPerSecond = 1.0f;

    void OnTriggerStay2D(Collider2D other)
    {
        PlayerHeat heat = other.GetComponent<PlayerHeat>();
        if (heat != null)
        {
            heat.Heat(heatPerSecond * Time.fixedDeltaTime);
        }
    }
}

On the player I have this script.
public class PlayerHeat : MonoBehaviour
{
    public int maxHeat = 100;
    public float currentHeat;

    public HeatBar heatBar;

    void Start()
    {
        // all objects should spawn with full health
        currentHeat = maxHeat;
        heatBar.SetMaxHeat(maxHeat);
    }

    // method for getting healed
    public void Heat(float amount)
    {
        currentHeat += amount;
        // make sure we can't heal further than max health
        if (currentHeat > maxHeat)
        {
            currentHeat = maxHeat;
        }
    }
}

And for the heat bar I have this script.
public class HeatBar : MonoBehaviour
{
    public float UpdatedHeat;
    public Image Heat;
    public float HeatDecreasePerSecond;
    public int maxHeat = 100;
    public Slider slider;
    public Gradient gradient;
    public Image fill;

    // Start is called before the first frame update
    void Start()
    {
        HeatDecreasePerSecond = -0.5f;
    }

    // Update is called once per frame
    void Update()
    {
        UpdatedHeat += HeatDecreasePerSecond * Time.deltaTime;
        Heat.fillAmount = UpdatedHeat / maxHeat;

        if(UpdatedHeat >= maxHeat)
        {
            UpdatedHeat = maxHeat;
        }
    }

    public void SetMaxHeat(int heat)
    {
        slider.maxValue = heat;
        slider.value = heat;

        fill.color = gradient.Evaluate(1f);
    }

    public void SetHeat(int heat)
    {
        slider.value = heat;

        fill.color = gradient.Evaluate(slider.normalizedValue);
    }
}

There are no errors but it is not working. Please help.


texts:
I need to build an object that will have only one instance because this Object is dedicated to the storage of vital settings for my application and I would like to avoid a misuse of this type or a conflict at run-time.

The most popular solution for this, according to the internet, is the Singleton pattern. But I would like to know about other ideas or solutions for this; also I would like to know if other solutions can be much more easy to grasp for an user of this hypothetical library.

Thanks.


texts: How to geographically locate the position of character on a map?

texts:
Beyond the different coordinates systems (x/y, ...), imagine you draw the map of your world on a bitmap, png, gif or whatever image.

Then you got your world and you'd like your players/character (PC) to travel through its different parts (lands, regions, etc...).

How can I simply locate in which part (land, region, ...) of the world a PC is entering/leaving ? Detecting when a boundary is crossed ?

What is the easiest way ?
What options do I have ?


texts: Unity3d NullReferenceException: Object reference not set to an instance of an object

texts:
I'm making a script to climb ladders in my game.
These are the variables used in the function.

private Vector3 climbDirection = Vector3.zero;
private Ladder currentLadder = null;
private bool latchedToLadder = false;

And here is the function

void LatchLadder (GameObject latchedLadder, Collider collisionWaypoint){
    currentLadder = latchedLadder.GetComponent<Ladder>();
    latchedToLadder = true;
    climbDirection = currentLadder.ClimbDirection();
    gameObject.SendMessage("OnLadder",null,SendMessageOptions.RequireReceiver);

}

Everytime I collide with the ladder in playmode i get

NullReferenceException: Object reference not set to an instance of an object
UseLadder.LatchLadder (UnityEngine.GameObject latchedLadder, UnityEngine.Collider collisionWaypoint)
UseLadder.OnTriggerEnter (UnityEngine.Collider other)

at

climbDirection = currentLadder.ClimbDirection();

Anyone can see what's the cause ?


texts: How does an HLSL shader actually end up affecting the render output?

texts:
I understand the syntax of HLSL, for example let's pretend I have this as my HLSL:

struct VOut
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
    VOut output;

    output.position = position;
    output.position.xy *= 0.7f;    // "shrink" the vertex on the x and y axes
    output.color = color;

    return output;
}

float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
    return color;
}

and I compile it like this:

D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile(L"shaders.hlsl", 0, 0, "PShader", "ps_5_0", 0, 0, 0, &PS, 0, 0);

How does it like... know to change... I'm confused about exactly what the pipeline between HLSL and the actual pixels/vertices on the screen is.

Is this what actually "applies" them?

dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);

// set the shader objects
devcon->VSSetShader(pVS, 0, 0);
devcon->PSSetShader(pPS, 0, 0);

Keep in mind I'm like a literal beginner at this stuff. Can someone maybe explain what it's doing? I'm assuming the vertex HLSL function goes through every vertex and then changes them to whatever I have in the function, and the output is what was changed... and similarly for the pixel shader?

Another confusion, I know what a pixel is, and I understand what a vertex is... but what exactly does the pixel shader do?


texts: So I connected a ps3 controller to my computer via USB cable, when I press play I am able to move by using arrows on the left of the ps3 controller and also I am able to shoot and aim by triangle and circle but when I try setting up the 2nd Horizontal axis in the Input Manager by changing the "X axis" to 5th axis (so I could use sticks to move) and changing type to joystick axis I am not able to move. Also I tried creating a second "Mouse X" and also setting it to joystick axis and changing the "X axis" to "4th axis (joysticks)" nothing happens again, I tried pressing everything but it doesn't work. Anyone knows how I can make it work?


texts: XNA: How do I match Spritebatch View/Projection Matrices with BasicEffect Matrices?

texts:
I'm rendering a bunch of 2D content using SpriteBatches to a default XNA viewport. A simple 2D camera is used to move around the scene, which generates a transformation matrix passed to each SpriteBatch.Begin()-call.

I want to draw custom polygons on top of my SpriteBatches, which I'm doing via DrawIndexedPrimitives (straightforward, as well). I'm using a BasicEffect to shade them.

How can I best match up the SpriteBatch's implicit view and projection matrices with the BasicEffect's matrices? Currently, I create the matrices for the Effect from scratch, using the Viewport's properties. How can I get around this? Can I access the Viewport's matrices and pass them into the BasicEffect?

So far, Google has come up empty on this.


texts: Is there any way to bring animation into unity without a rig/bones?

texts: I am developing for mobile and to make the game run on lower spec mobiles, I was only going to import bones/rig for the main character. There are other humanoid characters in the scene which do move about and are rigged already in my 3d app but since they wont be controlled in anyway by the player in the game, I just wanted to bake and import their animations alone without the bones. I know unity can handle blendshapes but I am more comfortable with rigs and also cos these characters are already rigged properly.


texts: Can't work with universal tween engine while having added it to gradle

texts:
I'm actually developing a game with libgdx and I'd like to create a splash screen. To do this, I must use the Universal Tween Engine. To add the Universal Tween Engine, I followed the instructions of the libgdx doc at this link: https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine

I created a new directory called "libs" in my project directory (not with Eclipse) and put on it the universal tween engine files I got by downloading the universal tween engine.
At this time, I had this:

After that, I made the edits in the dependencies sections of "build.gradle" (by adding this: compile fileTree(dir: '../libs', include: '*.jar') )

Then I tried to refresh the gradle dependencies (by right clicking on my core and android projects and pressing "refresh".)

After restarting eclipse, I tried to work with the universal tween engine by trying to import some of the tween engine (I typed on the top of my main class "import aurelienribon.tweenengine.TweenAccessor;").

The problem is that I got a problem message saying "the import aurelienribon cannot be resolved", even after trying to fix the project setup, I got a message saying that this problem is unresolvable.

What shall I do?

Thanks for your answers.


texts: Handling collision with 2D surfaces and player sprite

texts:
What's the best way of representing surfaces in a 2d top down racing game? I'd like paved and dirt surfaces in my game to have different friction properties. Would you break up the map into a grid and simply check where in the grid the car is to determine the friction? Or is there a better way of managing it?

The roads and dirt are not self contained all or nothing tiles either, so I'd have to handle a grid section that contained some road and some dirt.


texts: Ball's velocity vector, reflect against a point

texts:
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.


texts:
I am looking into using Java to write a game core, then writing the game logic separate either in Java, or using something like Python. This way I open up the ability for any future users to modify the game to their liking, similar to how TES or Torchlight 2 is setup.

However, my main concern is doing this securely. Looking at the Java option, I can't help but feel that this would allow nefarious users from accessing a lot more than would be safe (OS-level stuff, complete access to the user's file system, etc.). So I was hoping that there was some way of making sure that this isn't possible. Ideally I'd like to use something like Python, Lua, or Angelscript to reduce what the mod writer has access to, but I'm not sure how secure even this would be.

So I came here hoping that this is something dealt with on a regular basis, since I know it's a long shot but... I hope to get on Steam at some point, and I can't imagine Workshop support would allow unsafe code.


texts: Batching a bunch of gameObjects that change their color

texts: So I have a bunch of cubes instantiated. Each time the player hits one of these cubes (which is quite often) they change their color to match that of the player. What would be a performant way to do this? So far i am doing this on OnTriggerEnter then grab my player’s mesh renderer, get its material and get the color. This is quite an expensive process. I was wondering if there is any better way. The cubes do not move by the way, so if they can somehow be batched as well that would be a plus! Also, the player’s color is random.


texts:
I'm trying to calculate the delta time of my program. In main, I call:

glutInit(&argc, argv);

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);

glutCreateWindow("OpenGL Renderer");

InitGL();

glutDisplayFunc(DrawGLScene);
glutReshapeFunc(ReSizeGLScene);
glutIdleFunc(idle);

glutMainLoop();

My idle func:

void idle(void)
{
    int time;
    time = glutGet(GLUT_ELAPSED_TIME);
    delta = time - lastTime;
    lastTime = time;
    glutPostRedisplay();
}

I have these global variables:

int lastTime;
int delta;
float rtri; //Angle for triangle
float rquad; // Angle for quad

In the render method, I call:

// ...
glRotatef(rtri, 0.0f, 1.0f, 0.0f);
// ...
rtri += 0.2f * delta;
rquad -= 0.15f * delta;

Whith this code, I can't resize the window and if I press the close button, the window isn't responding anymore.

How can I fix this?


texts: Orbiting a camera around the Y axis whilst remaining up

texts:
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. :)


texts:
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.


texts: How to refresh Unreal Editor Viewport when dragging a spinbox (FModeToolkit)?

texts:
The viewport of my custom EdMode does not update while I drag a spinbox (which is in a custom FModeToolkit). In fact, MyCustomEdMode::Render() is not even called (while the spinbox).

How can I refresh the viewport while dragging?


texts: requestAnimationFrame handles game ticks weird when tab isn't viewed

texts:
So i have the game logic and render in the callback for requestAnimationFrame, and somehow the ticks run very weird.

In fact, the rendering happens alright.
But the ticks seem to skip an if, to be specific.

The questionable code moves the entity a few pixels until an amount of pixels is traveled.

When the tab isn't viewed the movement happens, and gets rendered correctly, but when going back to the tab i see that the movement went way to far and to make it more dubious, the entity travels back to its actual target position.

It feels a bit like the frames get rendered with the tick-function using kind of a state, like the variables keep the same value while the tab isn't viewed, and when viewing the tab again all the frames get played back reverse until the movement should actually stop.

Is there any reason for this and maybe a solution, too?


texts: What does the alpha channel on a back buffer do?

texts: 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?


texts:
I am developing a top down 'thing' in SFML and C++ and was wondering about how best to handle so called Entities in my game.

An entity, for example is defined by me as an object in-game, such as a door to a house, that can be interacted with, can be animated, can act on user input, can be affected by physics etc.

I was thinking of handling this system by a series of classes and subclasses.

For example, the base class of Entity would contain the methods Render, Update, HandleInput and such as these are the most basic methods that all entities will contain. Variables of the main class could include isVisible, isPhysical, drawDepth and so on.

A new class for MapObject would use inheritance to take the methods from Entity and may also add other methods and variables such as tileTexture, tileHeight and tileWidth.

Abstracting(?) from that again could be the DoorTile class which would handle the item specific level of input handling and interaction.

Is this a valid way to handle objects in-game? Are there and glaring errors?(Bear in mind I've been awake for many many hours :p)

Sorry if this is somewhat long-winded, I wanted to be specific as to how my proposed system would work.


texts: adding radial gradient to heightmap results in jagged edges

texts:
I am trying to implement a simple heightmap editor. In this editor, you can elevate the terrain by clicking on a spot in the heightmap, and holding down the mouse button. This will little by little, every frame, elevate the terrain into a hillshape. The hills created looks like this:

http://imgur.com/JNBUXz1

As can be observed, however, the edges of the hill has some pretty awful jagged edges:

http://imgur.com/gvCwSQu

I am not quite sure how to get rid of these edges. For every frame that I hold down the mouse, the following code is executed:

float rad = 35;
for(int ix = -rad; ix <= +rad; ++ix) {

    for(int iz = -rad; iz <= +rad; ++iz) {

    // distance from center of hill.
    float dist = sqrt( (float)ix * (float)ix + (float)iz * (float)iz  );

    // if within the radius of the hill(this ensures that the hill is round)
    if(dist <= rad) {

        // the farther we get from the center, the less we increase the height.
        // this effectively results in a radial gradient being added to the
        // heightmap.
        // Note that we use "x*x" instead of "x", because this results in a
        // more round and natural-looking hill
        float x = dist / rad;
        float y = (1.0 - x*x);

        // maximum height of the hill
        float maxHeight =y * (float)MAX_HEIGHT;

        /*
          Note that cx and cz describe the center position of the hill.
         */

        if( heightData(cx+ix,cz+iz) < (float)MAX_HEIGHT) { // do not exceed the maximum height

             // if we hold down the mouse for 30 frames, the hill will reach its maximum height
             float increment = maxHeight  / 30.0;

            if(heightData(cx+ix,cz+iz) + increment > MAX_HEIGHT) {
                 // clamp the hill height so that it does not exceed the maximum height of the
                // height map.
                heightData(cx+ix,cz+iz) = MAX_HEIGHT;
            } else {
            heightData(cx+ix,cz+iz) += increment;
            }
        }

    }

    } // end for
} // end for

As can be observed, every frame I simply add a radial gradient to the heightmap. MAX_HEIGHT = 65535;, because the heightmap is a grid of unsigned shorts. And the resolution of the heightmap is 256x256. But even if I increased it to 512x512, the jaggies still remained.


texts:
I am a beginner to drawing with OpenGL ES and I have a problem. I am drawing a figure consisting of triangles in orthographic projection, but when I run my app, I see a black screen and system buttons only (I am using a real device and not an emulator).

Why do I get a black screen, and how could I fix it?

I am using OpenGL ES 1.0 version.

Initialization before drawing:

float[] verticesArray = new float[] {
        180.0f, 80.0f, 10.0f,
        260.0f, 80.0f, 10.0f,
        318.0f, 138.0f, 10.0f,

        260.0f, 80.0f, 10.0f,
        318.0f, 138.0f, 10.0f,
        318.0f, 216.0f, 10.0f,

        318.0f, 138.0f, 10.0f,
        318.0f, 216.0f, 10.0f,
        260.0f, 264.0f, 10.0f,

        318.0f, 216.0f, 10.0f,
        260.0f, 264.0f, 10.0f,
        180.0f, 264.0f, 10.0f,

        260.0f, 264.0f, 10.0f,
        180.0f, 264.0f, 10.0f,
        122.0f, 216.0f, 10.0f,

        180.0f, 264.0f, 10.0f,
        122.0f, 216.0f, 10.0f,
        122.0f, 138.0f, 10.0f,

        122.0f, 216.0f, 10.0f,
        122.0f, 138.0f, 10.0f,
        180.0f, 80.0f, 10.0f,

        122.0f, 138.0f, 10.0f,
        180.0f, 80.0f, 10.0f,
        260.0f, 80.0f, 10.0f
};
verticesAmountTotal = verticesArray.length/3;
coordsOfVerticesAmountTotal = verticesArray.length;

ByteBuffer byteBuffer = ByteBuffer.allocateDirect(coordsOfVerticesAmountTotal * 4);
byteBuffer.order(ByteOrder.nativeOrder());
vertices = byteBuffer.asFloatBuffer();
vertices.put(verticesArray);
vertices.flip();

Drawing method:

gl.glViewport(0, 0, glGraphics.getWidth(), glGraphics.getHeight());
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(0, 480, 0, 320, 30, -1);
gl.glColor4f((float)Math.random(), (float)Math.random(), (float)Math.random(), opacity);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertices);
gl.glDrawArrays(GL10.GL_TRIANGLES, 0, verticesAmountTotal);


texts:
Well I'm reading the Frank's Luna DirectX10 book and, while I'm trying to understand the first demo, I found something that's not very clear at least for me. In the updateScene method, when I press A, S, W or D, the angles mTheta and mPhi change, but after that, there are three lines of code that I don't understand exactly what they do:

// Convert Spherical to Cartesian coordinates: mPhi measured from +y
// and mTheta measured counterclockwise from -z.
float x = 5.0f*sinf(mPhi)*sinf(mTheta);
float z = -5.0f*sinf(mPhi)*cosf(mTheta);
float y = 5.0f*cosf(mPhi);

I mean, this explains that they do, it says that it converts the spherical coordinates to cartesian coordinates, but, mathematically, why? why the x value is calculated by the product of the sins of both angles? And the z by the product of the sine and cosine? and      why the y just uses the cosine?
After that, those values (x, y and z) are used to build the view matrix.

The book doesn't explain (mathematically) why those values are calculated like that (and I didn't find anything to help me to understand it at the first Part of the book: "Mathematical prerequisites"), so it would be good if someone could explain me what exactly happen in those code lines or just give me a link that helps me to understand the math part.

Thanks in advance!


texts: Use a different language for engine and game

texts: Just a quick question that I haven't been able to find an answer to, I am creating an engine for a game, I have begin making the engine in C++ but I want to make the game in java. My question is, is there a way to maker my game in a different language on a separate "layer"?


texts: How to find point on a circle that's opposite another point?

texts:
How do I find the coordinate of point and angle value on circle sprite which placed on opposite side of sprite from a touch point and the center point of the sprite?

I know A position, B position and sprite circle size. How do I calculate the position of C? and the angle it is around the sprite circle?


texts: I'm interested in making a game that can be distributed on PSN. Any suggestions?


texts:
This is something that's really cooking my noodle.  When I'm computing the light response for a material in my fragment shader, I'm using the standard 3 normalized vectors, in eye space: fragment normal, light direction, eye direction.

However, because the 3 vectors are in eye space, I've seen the eye direction represented as the following, because the camera is looking down -z:

vec3(0, 0, 1)

While the light direction is:

normalized(light_eyespace_position - fragment_eyespace_position)

This makes sense at first glance, but the more I think about it, I'm trying to figure out why the eye direction isn't computed similarly to the lighting direction:

normalized(-fragment_eyespace_position)

In other words, why does the vector from the light to the surface dependent on fragment position, but the vector from the camera to the surface is independent on the fragment?

The only thing I can work out is that using vec3(0, 0, 1) is correct only for ortho cameras, while normalized(-fragment_eyespace_position) is correct for perspective cameras.  Is this correct?  Can anyone shed some light on this?


texts:
In a concept I'm working on, the player can move from one position in a grid to the next. Once movement starts it can't be changed and takes a predetermined amount of time to finish (about a quarter of a second).

Even though their movement can't be altered, the player can still press keys (perhaps in anticipation of their next move). What do I do with this input?

Possibilities i've thought of:

Ignore all input during movement.
Log all input and loop through them one by one once movement finishes.
Log the first or last input and move when possible.

I'm not really sure which is the most appropriate or most natural. Hence my question:

What do I do with player-input during movement?


texts:
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);
        }


texts: Collision library for bullet hell in Python

texts:
I am making a bullet hell game in Python and am looking for a suitable collision library, taking the following into consideration:

The library should do 2D polygon collision.
It should be very fast.  As a bullet hell game, I expect to do collision checks between hundreds, likely thousands of objects every frame at a consistent 60fps.
Good documentation
Permissive license (like MIT, not GPL)

I am also considering writing my own library in C/C++ and wrapping with python ctypes in the event that no such library exists, though I do not have experience with collision detection algorithms, so I am not sure if this would be more trouble than it's worth.

Could someone provide some guidance on this matter?


texts:
In my 2d game, I want to rotate car face based on collision detected. But at present after 3 to 4 collision its doing continuous rotation only rather than moving straight after collision.

Here is my straight movement related code:

myRigidbody.MovePosition (transform.position + transform.up * Time.deltaTime * GameManager.Instance.VehicleFreeMovingSpeed);

For better collision purpose, I have used Rigidbody position change approach.

Here is my collision time code:

public void OnCollisionEnter2D (Collision2D other)
{
 if (other.gameObject.CompareTag (GameConstants.TAG_BOUNDARY)) {
     ContactPoint2D contact;
     contact = other.contacts [0];
     Vector3 reflectedVelocity = Vector3.Reflect (transform.up, contact.normal);
     direction = reflectedVelocity;
 }
}

if (direction != Vector3.zero && pathGenerator.positionList.Count <= 0) {
        float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg;
        Quaternion targetRot = Quaternion.AngleAxis (angle - 90f, Vector3.forward);
        transform.rotation = Quaternion.Slerp (transform.rotation, targetRot, 0.1f);

        if (Quaternion.Angle (transform.rotation, targetRot) < 5f) {
            transform.rotation = targetRot;
            direction = Vector3.zero;
        }

    }

Rotation get applied within other code so that car was changing its face correctly and that method not affecting here that I have checked by placing debug statement.

Share you side thought for this.


texts:
I am finishing a very basic 2D racing game with top-down perspective. I can't get the appropriate formulas to make the movement of the cars fun and addictive... Do you have tips on how to achieve that arcade feeling a lot of games have? Do you know of any guide/tutorial on this topic?

Right now, these are the formulas I am using:

// (speed changes linearly according to the user input)
direction += turnAmount.Value;
Vector3 pos = Position + new Vector3(speed.Value * (float)Math.Cos(direction), 0, -speed.Value * (float)Math.Sin(direction));

I have tested other, more complex options but this is the best I have got so far...


texts: Okay, so I'm making a platformer, and I wanna know how I can make a arc'd jump easily. Like what Mario does in super Mario Bros 1. Any ideas on a simple way to accomplish this?


texts: What is an elegant way to localize level data?

texts:
I'm writing a simple android game. I planned to store all levels in xml files that contain info about level, including a level_name field. The Level class would load an appropriate level by parsing the corresponding XML file and reading data into the Level's fields) when user selects it.

Everything seems fine, until I want the game to support multiple languages. With UI it is clear how to solve this problem since we have strings.xml file. But what about localizing level data stored in XML files?

I considered having multiple fields for a given piece of data in a level.xml file, with each containing a different translation. Another thought was storing only the ID of level and get related level name from strings.xml file.

However, neither of these seem very elegant. Is there a more better way of doing this?


texts: Unity3D, How do I press one key and then cant press another key while the one is pressed?

texts:
I am making a horror game, and I want to press a key to look up while I am idle, that i've done but if I press the W key it stands in idle but floating forward. How can I disable the W key while I press the F key to look up ?
Everything works fine I can press F and the LookUp Animation is being played and if KeyUp on F the Animation goes back to Idle.
My problem is if I am in LookUp Animation when I press F, I can also press W to go forward but its floating not walking. I want to deactivate this function so I can just press F when I am Idle.

Thanks for help.

my Script:

public float speed = 10f;
public Rigidbody rgb;
public Animator anim;
bool walk = false;

// Use this for initialization
void Start ()
{
    rgb.GetComponent<Rigidbody> ();
    anim = GetComponent<Animator> ();
}

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

    float move = Input.GetAxis ("Vertical");
    anim.SetFloat ("Speed", move);

    if (Input.GetKey (KeyCode.W) | walk == true)
    {
        rgb.transform.position -= new Vector3(0, 0, 1) * speed * Time.deltaTime;
        Debug.Log("Walking");
    }
    else
    {
        walk = false;
        Debug.Log("Idle");
    }

    if (Input.GetKey (KeyCode.F))
    {
        anim.SetBool("LookUpIdle", true);
        rgb.transform.position = transform.position;
    }
    else
    {
        anim.SetBool("LookUpIdle", false);
    }

}

}