texts: Should I go with Windows Phone 7 or Try Android?

texts:
I already know C# and am familiar with XNA.

So it would make sense to develop for the Windows Phone 7, but would it be worth while to learn Java, get familiar with Android, and instead develop for Android devices?

Android has been around longer so it would probably have a larger user base. Is it really worth it to try to develop for one of the more popular mobile platforms. (Windows Phone 7 has been out for like a month?)

I haven't tried either one yet though. I'm also going to buy a phone, so this decision would probably influence the phone that I buy. (to develop/test on)


texts: How do you transform a vector to use another objects orientation?

texts: I want to take a vector that is using world coordinates and position it using the orientation of an object.  So, if the direction of the object is the z-axis, and the vector is (0,0,1), then the orientated vector would point in the direction of the object.  I want to vector to remain in the world coordinate system.  All I have for the object is it's up and direction vector.  So, I can build a matrix with those by crossing them to create the third axis.  Multiplying the vector by this matrix transform the vector into the object coordinate system (right?).  But, I want the vector in world coordinate system.  Should I use the matrix to find euler angles and then use those angles to create a rotation matrix?


texts: Midpoint Displacement 1D - How to properly reduce my random number range?

texts:
So I'm trying to implement this http://www.gameprogrammer.com/fractal.html#midpoint algorithm, to generate myself a terrain.
In the tutorial is said:

OK, before we go into 2D fractal surfaces, you need to know about the roughness constant. This is the value which will determine how much the random number range is reduced each time through the loop and, therefore, will determine the roughness of the resulting fractal. The sample code uses a floating-point number in the range 0.0 to 1.0 and calls it H. 2(-H) is therefore a number in the range 1.0 (for small H) to 0.5 (for large H). The random number range can be multiplied by this amount each time through the loop. With H set to 1.0, the random number range will be halved each time through the loop, resulting in a very smooth fractal. With H set to 0.0, the range will not be reduced at all, resulting in something quite jagged.

Let's say rand_start and rand_end are the starting and ending values that a random number can be generated by using for example random.uniform(rand_start, rand_end) or random.uniform(-1.0, 1.0)

Then I must reduce the number range so I do:

rand_start *= H * (pow(2, -H))

rand_end *= H * (pow(2, -H))

With H set to 1.0 for example.Both rand_start and rand_end will be lowered by half and in the next iteration the random value will be between -0.5 and 0.5.
All clear, just like the tutorial said it.

Here is the problem:

My x coordinate starts at 0 in the left side of the window, and y coordinate in the top of the window, in Pygame

I draw my line at this coordinates:

line_start = (0, 300)

line_end = (WINDOWWIDTH, 300)

How to reduce my random range if start and end values are initialized like that:

rand_start = 400

rand_end = 200

Again, my line starts at y coordinate 300 and the highest the midpoint can be displaced is 200, the lowest - 400.

Any code required will be provided asap.


texts: Strange diagonal line artifact in simple ripple shader

texts:
I have a simple shader, converted from GLSL to HLSL. This is the original:
https://www.shadertoy.com/view/tdKSWG

The problem is that there is a very visible diagonal line artifact going from UV(1,1) to UV(0,0) and this artifact is not visible in the GLSL original.

No artifacts visible when ripples are started in any other screen position:

The sampler AddressU is set to "Wrap" and in shadertoy it is set to "Repeat", it should do the same but the waves still get reflected at the screen border (It works fine in GLSL)...

Does anyone know how to fix this?

This is my HLSL version:

//-- Include some common stuff
#include "mta-helper.fx"

float STRENGTH = 5.0;
float MODIFIER = 0.91;
float STEP = 2.6;
float FADESTRENGTH = 20;
float2 iResolution = {1024,512};
float3 iMouse = {0,0,0};
texture buffer;

sampler myself = sampler_state
{
    Texture = (buffer);
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Wrap;
    AddressV = Mirror;
};

//------------------------------------------------------------------------------------------
// Structure of data sent to the vertex shader
//------------------------------------------------------------------------------------------
struct VSInput
{
    float4 Position : POSITION0;
    float4 Diffuse : COLOR0;
    float2 TexCoord : TEXCOORD0;
};

//------------------------------------------------------------------------------------------
// Structure of data sent to the pixel shader ( from the vertex shader )
//------------------------------------------------------------------------------------------
struct PSInput
{
    float4 Position : POSITION0;
    float4 Diffuse : COLOR0;
    float2 TexCoord: TEXCOORD0;
};

//------------------------------------------------------------------------------------------
// VertexShaderFunction
//------------------------------------------------------------------------------------------
PSInput VertexShaderFunction(VSInput VS)
{
    PSInput PS = (PSInput)0;

    // Calculate screen pos of vertex
    PS.Position = MTACalcScreenPosition(VS.Position);

    // Pass through color and tex coord
    PS.TexCoord = VS.TexCoord;
    //PS.TexCoord.y -= 0.5;
    PS.Diffuse = VS.Diffuse;
    return PS;
}

float4 psFunction(PSInput PS) : COLOR0
{

    float4 color = tex2D(myself, PS.TexCoord);
    float value = 0;

    float3 direction = float3(STEP, STEP, 0) / iResolution.xyy;

    float s1 = tex2D(myself, PS.TexCoord - direction.zy).r;
    float s2 = tex2D(myself, PS.TexCoord - direction.xz).r;
    float s3 = tex2D(myself, PS.TexCoord + direction.xz).r;
    float s4 = tex2D(myself, PS.TexCoord + direction.zy).r;

    if (length(PS.TexCoord - iMouse.xy) < 0.005 && iMouse.z == 1) {
        value = STRENGTH * smoothstep(3, 0.5, length(iMouse.xy - PS.TexCoord));
    }

    value += -(color.g - 0.5) * 2 + (s1 + s2 + s3 + s4 - 2);
    value *= MODIFIER;
    value = value * 0.5 + 0.5;

    float alphaFade = saturate(FADESTRENGTH * PS.TexCoord.y) * saturate(FADESTRENGTH * (1 - PS.TexCoord.y));
    return float4(value, color.r, value, alphaFade);
}

technique shield
{
    pass P0
    {
        VertexShader = compile vs_3_0 VertexShaderFunction();
        PixelShader  = compile ps_3_0 psFunction();
    }
}


texts: Disabling impact damage by Kinematic actor on non-dynamic destructibles (using NVidia APEX)

texts:
I have a destructible non-dynamic object at Apex scene and am hitting the object with a kinematic actor. I do not want it to be fractured by these impacts. Is it possible?

PS: the impact damage is off when the destructible is dynamic. I have tried below settings:

physx::apex::NxDestructibleParameters destructibleParameters =
                                          destructibleActor->getDestructibleParameters();
destructibleParameters.forceToDamage = 0;
destructibleParameters.damageCap = 0;
destructibleParameters.impactVelocityThreshold = PX_MAX_F32;
destructibleParameters.impactDamageDefaultDepth = -10;
destructibleActor->setDestructibleParameters(destructibleParameters);


texts: How i can make better jump to my game? - C++ SFML

texts:
So, I ask question about my 2D game, actually it is not game, but it is something like poor game. Well i made moving system and now is time to make jump. I made some kind of gravity with tutorial but I don't like it. It is simple and nice but there is problems in that gravity example: 1. You can hold up arrow and "fly" with jump. I tried to fix that and make some kind of limit to jump but it was bad try. Second problem is that when you jump and you release up arrow (jumping key) then my sprite fall very fast and I can't really control that sprite in air.

This is my first game and I want spend time to do that, but now i have problem that i can't solve with my self so if you can help, please do it. I use C++ with CodeBlocks and SFML multimedia library.

So there is little parts of my code.

First there is velocity and gravity configuration:

     //gravity & velocity
     const float gravity = 1;
     int ground = 600; //height of ground
     Vector2f velocity(Vector2f(0,0));
     float movingSpeed = 0.5f, jumpingSpeed = 2.0f;

Then there is simple when you press button you jump:

if(Keyboard::isKeyPressed(Keyboard::Up)){
            skeleton.move(0,velocity.y = -jumpingSpeed);
            source.y = Up;
            isWalking = true;
        }

And there is system what recognize if you jump and this make you fall:

if(skeleton.getPosition().y + skeleton.getScale().y < ground || velocity.y < 0){
             velocity.y += gravity;
        }else{
            skeleton.setPosition(skeleton.getPosition().x, ground - skeleton.getScale().y);
        }

So my sprite name is "skeleton". And yeah this is first time with game physics. I'm not very good game programmer so these code can be poor and yeah... if you invent a solution share it.


texts: Accessing libgdx classes within Android classes

texts:
Currently what I'm able to do is to access android APIs within libgdx with an  interface in core and defining all the methods and then implementing it in every project (desktop, android, etc). What I want to do is I want to create a way so that I can call a method from some android class (say AndroidLauncher) and it calls a method of a libgdx core project class (like modifying some stage element). How do go about that?

Any help would be really appreciated.

Note: As a 'hack' right now, I'm just waiting for any update from android class in the render method using those same interface methods, but I don't think that's the best possible way.


texts:
I have a 32x32x32 cube (I say 32 because that's the size of the texture).

I can make the vertices of this cube go from (0,0,0) to (32,32,32). This mean the camera will be moving += 1 when ever a key on the keyboard is pressed. This also mean that the far clipping area will be pretty big when calling the CreatePerspectiveFieldOfView function.

Since everyhing is in double, I can also have the vertices go from (0,0,0) to (1,1,1). The camera will be moving += (1/32) and the far clipping area will be much smaller.

Is there a standard into this?
I've read that if the far clipping area is too big it can causes problems.
Since both solution have the same effect, I don't know what is the best one and which one can potentially case a problem in the long run.


texts: Is there a standard way to track 2D tile positions both locally and on screen?

texts:
I'm building a 2D engine based on 32x32 tiles with OpenGL.  OpenGL draws from the top left, so Y coordinates go down the screen as they increase.  Obviously this is different than a standard graph where Y coordinates move up as they increase.

I'm having trouble determining how I want to track positions for both sprites and tile objects (objects that are collections of tiles).  My brain wants to set the world position as the bottom left of the object and track every object this way.  The problem with this is I would have to translate it to an on screen position on rendering.  The positive with this is I could easily visualize (especially in the case of objects made of multiple tiles) how something is structured and needs to be built.

Are there standard ways for doing this?  Should I just suck it up and get used to positions beginning in the top left?

Here are the OpenGL calls to start rendering:

// enable textures since we're going to use these for our sprites
glEnable(GL_TEXTURE_2D);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

// enable alpha blending
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

// disable the OpenGL depth test since we're rendering 2D graphics
glDisable(GL_DEPTH_TEST);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);

I assume I  need to change:

glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);

to:

glOrtho(0, WIDTH, 0, HEIGHT, 1, -1);


texts: Get the XZ to the right of a rotated point?

texts:
I need to do this entirely with math, take a look at this picture:

What I'm doing is building a path finder algorithm that basically looks 30 units ahead, raycasts a few times perpendicular to the future point, finds the midpoint between the min/max vectors that found the dirt road, and puts a green cube in the middle.

I thought this would be rather simple, yet here I am trying to figure out how to plot the exact geometry of a rotated left/right projection.

I hope I explained this well enough!  I'm also open to suggestions on how to do this if my approach is silly.  Eventually this path will split and the algorithm has to detect the split and have the user decide which direction to go.

EDIT: After applying the math below (I opted to use the trig version) I go this result on my algorithm.  THANK YOU!!!


texts: Early stages of games development - create 2d animation images for iOS games?

texts: I am in the early stages of developing a game. I don't have an artist or graphics person on board yet. How can I create simple images for animation to work through the early stages of game development? Should I create stick figure images in Photoshop/Pixelmator or are there other ways of using sample artwork or some other tools which can help make images for animation?


texts: Why does my 3D model not translate the way I expect?

texts:
In my first image, my model displays correctly:

But when I move the model's position along the Z-axis (forward) I get this, yet the Y-axis doesnt change. An if I keep going, the model disappears into the ground:

Any suggestions as to how I can get the model to translate properly visually? Here is how Im calling the model and the terrain in draw():

cameraPosition = new Vector3(camX, camY, camZ);

        // Copy any parent transforms.
        Matrix[] transforms = new Matrix[mShockwave.Bones.Count];
        mShockwave.CopyAbsoluteBoneTransformsTo(transforms);
        Matrix[] ttransforms = new Matrix[terrain.Bones.Count];
        terrain.CopyAbsoluteBoneTransformsTo(ttransforms);

        // Draw the model. A model can have multiple meshes, so loop.
        foreach (ModelMesh mesh in mShockwave.Meshes)
        {
            // This is where the mesh orientation is set, as well
            // as our camera and projection.
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.PreferPerPixelLighting = true;
                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                    * Matrix.CreateTranslation(modelPosition);
                // Looking at the model (picture shouldnt change other than rotation)
                effect.View = Matrix.CreateLookAt(cameraPosition,
                    modelPosition, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(45.0f), aspectRatio,
                    1.0f, 10000.0f);
                effect.TextureEnabled = true;
            }

            // Draw the mesh, using the effects set above.
            prepare3d();
            mesh.Draw();
        }

        //Terrain test
        foreach (ModelMesh meshT in terrain.Meshes)
        {

            foreach (BasicEffect effect in meshT.Effects)
            {
                effect.EnableDefaultLighting();
                effect.PreferPerPixelLighting = true;
                effect.World = ttransforms[meshT.ParentBone.Index] *
                    Matrix.CreateRotationY(0)
                    * Matrix.CreateTranslation(terrainPosition);
                // Looking at the model (picture shouldnt change other than rotation)
                effect.View = Matrix.CreateLookAt(cameraPosition,
                    terrainPosition, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(45.0f), aspectRatio,
                    1.0f, 10000.0f);
                effect.TextureEnabled = true;
            }

            // Draw the mesh, using the effects set above.
            prepare3d();
            meshT.Draw();
            DrawText();
        }
        base.Draw(gameTime);
    }

I'm suspecting that there may be something wrong with how I'm handling my camera. The model rotates fine on its Y-axis.


texts: Avoid the same code several times in game state enum

texts:
I use a switch with enums to divide my game in different parts. In the code below, that is simplified, I have a problem, becasue I need to show the same text in two or perhaps more parts and I wonder if there is a better way to do this, to avoid the use of the same code at several cases?

 switch (currentGameState)
        {
            case GameState.Start:
                // Code
                break;

            case GameState.Info:
                // Code
                break;

            case GameState.PlayGame:
                spriteBatch.Begin();
                spriteBatch.DrawString(scoreFont, "Score : " + currentScore, new Vector2(10, 10), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Time : " + secondsToDisplay, new Vector2(10, 30), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Spaceship : " + numberOfSpaceship, new Vector2(10, 50), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.End();
                break;

            case GameState.NewSpaceship:
                spriteBatch.Begin();
                spriteBatch.DrawString(scoreFont, "Score : " + currentScore, new Vector2(10, 10), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Time : " + secondsToDisplay, new Vector2(10, 30), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.DrawString(timeFont, "Spaceship : " + numberOfSpaceship, new Vector2(10, 50), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
                spriteBatch.End();
                break;

            case GameState.GameOver:
            // Code
                break;
        }


texts: How do I render my DirectX C++ engine to a C# Panel?

texts: The title pretty much sums it up. I'd like to know how I can get the HWND of my C# Panel object to my DirectX engine so I can render to it. I know it involves making a C++/CLI wrapper, but I'm not quite sure what to do beyond that.


texts: Unity: Alpha and color issues with opaque projector/decal shader

texts:
I have been attempting to make a simple "overwrite" version of Unity's projector shader.  I can either respect the color, or respect the transparency, but not both.
I have simplified the frag method to simply take cookie (the texture of the projection) and color tint, skipping all the fall off and fog stuff for now.  I hope to eventually add those back in once I figure out what's going wrong.
Shader "Projector/Overwrite" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _ShadowTex ("Cookie", 2D) = "" {}
        _FalloffTex ("FallOff", 2D) = "" {}
    }

    Subshader {
        Tags {"Queue"="Transparent"}
        Pass {
            ZWrite Off
            ColorMask RGB
            Blend DstColor DstAlpha
            //Blend DstColor Zero
            Offset -1, -1

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

            struct v2f {
                float4 uvShadow : TEXCOORD0;
                float4 uvFalloff : TEXCOORD1;
                UNITY_FOG_COORDS(2)
                float4 pos : SV_POSITION;
            };

            float4x4 unity_Projector;
            float4x4 unity_ProjectorClip;

            v2f vert (float4 vertex : POSITION)
            {
                v2f o;
                o.pos = UnityObjectToClipPos(vertex);
                o.uvShadow = mul (unity_Projector, vertex);
                o.uvFalloff = mul (unity_ProjectorClip, vertex);
                UNITY_TRANSFER_FOG(o,o.pos);
                return o;
            }

            fixed4 _Color;
            sampler2D _ShadowTex;
            sampler2D _FalloffTex;

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 texS = tex2Dproj (_ShadowTex, UNITY_PROJ_COORD(i.uvShadow));
                texS.rgb *= _Color.rgb;
                //texS.a = 1.0 - texS.a;
                return texS;

                /*texS.rgb *= _Color.rgb;
                texS.a = 1.0-texS.a;

                fixed4 texF = tex2Dproj (_FalloffTex, UNITY_PROJ_COORD(i.uvFalloff));
                fixed4 res = texS * texF.a;

                UNITY_APPLY_FOG_COLOR(i.fogCoord, res, fixed4(0,0,0,0));
                return res;*/
            }
            ENDCG
        }
    }
}

I am fairly certain the issue lies in the BLEND options.  I can either respect the texture * color, or respect the alpha of the texture, but not both together.
Alpha is respected, but the color is no longer accurate:

Alpha is ignored, but the color is accurate:

Thanks for your guidance.


texts: 3dsMax to Mudbox - Import Warning: UV not a complete set

texts:
I'm exporting my 3dsMax model to Mudbox. The import gives me a warning that the UV set is incomplete.

First, what does this mean?  That I haven't got all the UVs unwrapped?  Web searches have brought nothing.

Also if this is the problem, is there a way to check if all UVs are unwrapped?

I'll post my map if you need it.


texts: Libgdx : point that scrolls on the edge of a circle

texts:
I'm not very familiar with libgdx vectors. I want to create my own joystick-controller and I want to know how can I find the coordinates of B by using Vectors. I can calculate the radius and I have the center.

Thank you.


texts: Values at the start of the string are not being sent while sending json data in Unity

texts:
I have been trying to solve this issue on my own but couldn't find the cause of the issue.
Before I start, I am using unity 5.4 and for creating json data I used JSONObject, https://github.com/mtschoen/JSONObject.

The code i used to send data to server, is below

Debug.Log (jsonObject.ToString ());
byte[] bytes = Encoding.UTF8.GetBytes (jsonObject.ToString());
Debug.Log (Encoding.Default.GetString (bytes));
WWW www = new WWW (url, bytes, headers);
yield return www;
Debug.Log ("Sending Data " + www.text);

I used jsonObject.ToString() just to test sending it as a string.
The data is something like

{"Image_name":1,"Links":[{"HotspotName":"User_arch0","Location":"(-1.2, -0.2, 1.6)","Scale":"(0.1, 0.1, 0.1)","LinkedImageID":0,"HotspotName":"User_arch1","Location":"(0.5, 0.5, 1.9)","Scale":"(0.1, 0.1, 0.1)","LinkedImageID":3}]}

The first two log statements give this data correctly into the log in the console. But the last one logging www.text gives this Sending Data

{"Image_name":1,"Links":[{"HotspotName":"User_arch1","Location":"(0.5, 0.5, 1.9)","Scale":"(0.1, 0.1, 0.1)","LinkedImageID":3}]}

As you can see, the values for Hotspot "User_arch0" is just not there in the final output. Even if i send a string directly instead of jsonObject.ToString(), it doesn't work.

What is causing this? If you need anymore of the code let me know


texts:
I am trying to make a dice rolling game. I want to generate a random integer in the range of the number of dice I have multiplied by the number of sides the dice has. For example, if two dice were played with three sides, then there could be any number between 2 and 6.

Here is my code; when I put in, for example one dice and two sides, it prints numbers upwards of 13. The problem is that it doesn't create an integer between the amount of sides and dice.

condition = "Start"
while condition == "Start":
Dice = int(input("Please select number of dice you would like to use (atleast 1)"))
Sides = int(input("Please select number of sides on dice you would like to use (atleast 2)"))
if Dice <= 0 and Sides <= 1:
    condition = "Start"
elif Dice >= 1 and Sides >= 2:
    print("You have selected", Dice," dice and", Sides,"Sides")
    condition = "play"
    Roll1 = 0
    Roll2 = 0
    Score1 = 0
    Score2 = 0
while condition == "play":
        Roll1 += randint(Dice,Sides)
        Roll2 += randint(Dice,Sides)
        print (name1,"'s Roll", Roll1)
        print (name2,"'s Roll", Roll2)


texts: How to use arrow keys to navigate between cells in a crossword puzzle

texts:
I am making a crossword puzzle, using a canvas.

How do you get the keyboard arrows to interact with the screen so that when the user presses any of the arrow keys, the cursor will advance to the next available input block.

This is how I drew the blocks on the canvas, with css styles added, button 1 and button 2: The "names001" stands for each box in the puzzle, then each box is assigned a letter value:

var r = event.keyCode;
if (r == 13 && m003 == "c") {
    w003 = 1;
    document.getElementById("names003").value = "c";
}

then a variable checks to see if each word is right and places a checkmark beside clue:

var check001 = w010 + w011 + w012 + w013 + w014;
if (check001 == 5) {
    clue001.innerHTML = "✔"
}

Now, I want to know when the puzzle is drawn to the canvas, how do you get the keyboard arrows to interact with the canvas when the user presses one of the arrows(up, down, left, right and also the backspace to clear entry when guess is wrong; I want to move the cursor to advance to the next block.


texts: DirectX 11 GenerateMips only works with premultiplied alpha?

texts:
The GenerateMips method in the ID3D11DeviceContext allows generation of mipmaps at runtime, which is fine for fully opaque textures. However, when this method is used with transparent textures that do not have premultiplied alpha, the resulting mip levels tend to have black outlines at the transparency edges. For instance, this PNG texture, loaded through WIC and processed with GenerateMips, produces mipmaps with edge pixels that are way too dark:

My question: Is there any way to specify to that this texture uses non-premultiplied alpha, so that DirectX can generate more correct mip levels?


texts: How can I change InvokeRepeating time in unity?

texts:
I have a slider in the pause menu which will have a min value of 1 and max of 5.
When I change it, the InvokeRepeating function maintains the same speed, but Debug.Log shows current slider value.

How can I change the InvokeRepeating rate?

Player.m1 is a float; when I give 5f or something like that to InvokeRepeating it works fine.

    using UnityEngine;

    public class Gen1 : MonoBehaviour
    {
        public GameObject rocks;

        int scr = 0;
        public int m=0;
        float n11=Player.m1;
        float sp;

        // Use this for initialization
        void Start()
        {
            //if (Player.m1 == 5 || Player.m1==4) {
            InvokeRepeating ("CreateObstacle", Player.m1,5f);//Here speed handels
            //} else {
                //InvokeRepeating ("CreateObstacle", 4f, 5f);//Here speed handels
            //}
            Debug.Log ("current speed is afad"+Player.m1);
        }

        void Update()
        {
            //InvokeRepeating ("CreateObstacle", 4f, Player.m1); //Here speed handels
            //Debug.Log ("current speed is afad"+Player.m1);
        }

        void OnGui()
        {
            GUI.color = Color.black;
            GUILayout.Label ("Score is" + scr.ToString ());
        }

        void CreateObstacle()
        {
            Instantiate(rocks);
            Player.score += 1;
            Debug.Log ("current speed is "+sp);

        }

        void OnBecameInvisible() {
            // Destroy the bullet
            Destroy(this.rocks);
        }
    }
```


texts: Are native code obfuscations needed to prevent piracy of Android games?

texts:
Is the copyright protection and enforcement of Android apps written in Java sufficient or should I be relying on a native implementation to use machine code obfuscating techniques in order to prevent piracy of my game?

Please provide an answer with supporting examples of games which use either technique.


texts:
I'm currently trying a new approach on a Card Game in Unity.

To capsuling my Card Prefab i have a root GameObject with the Canvas Component.

I'm highly count on the Canvas behavior which should render things after the main scene rendering.

  Elements on a canvas are rendered AFTER scene rendering, either from an attached camera or using overlay mode.

Before i further proceed, i want to know if there are any disadvantage of this, when my Game Logic approximately generate 100-200 of this GameObjects?

Should the Canvas Component not be overused in Unity?


texts: Make a GameObject Constantly Appear and Disappear

texts:
I am making a game where I need these black rings to appear and disappear one after another. I am in Unity 2D so what I did is simply changed their Z transform. I am also trying to run this code asynchronously so that it doesn't choke up and slow down when I am running other things in the main Update. Right now when I run the game, all the other things happen perfectly in sync but the rings don't turn on and off in sync and then after all the other game objects have stopped moving, they start blinking rapidly and chaotically. How do I fix this?
My code:
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;

public class ring1 : MonoBehaviour
{
    // Start is called before the first frame update
    public GameObject ring;
    public GameObject ring2;
    public GameObject ring3;
    public GameObject ring4;
    private bool isCoroutineExecuting = false;
    async void Start()
    {
        ring.GetComponent<GameObject>();
        ring2.GetComponent<GameObject>();
        ring3.GetComponent<GameObject>();
        ring4.GetComponent<GameObject>();
    }

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

    }

    void FixedUpdate()
    {
        //ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 0);
        //WaitForSeconds(1);
        //ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 100);

        //print("fixed");
        StartCoroutine(ExampleCoroutine());
    }

    IEnumerator ExampleCoroutine()
    {
        //Print the time of when the function is first called.
        Debug.Log("Started Coroutine at timestamp : " + Time.time);

        ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 0);
        ring2.transform.position = new Vector3(ring2.transform.position.x, ring2.transform.position.y, 0);
        ring3.transform.position = new Vector3(ring3.transform.position.x, ring3.transform.position.y, 0);
        ring4.transform.position = new Vector3(ring4.transform.position.x, ring4.transform.position.y, 0);

        ring.transform.position = new Vector3(ring.transform.position.x, ring.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring2.transform.position = new Vector3(ring2.transform.position.x, ring2.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring3.transform.position = new Vector3(ring3.transform.position.x, ring3.transform.position.y, 100);
        yield return new WaitForSeconds(1);
        ring4.transform.position = new Vector3(ring4.transform.position.x, ring4.transform.position.y, 100);
        yield return new WaitForSeconds(1);

        //After we have waited 5 seconds print the time again.
        Debug.Log("Finished Coroutine at timestamp : " + Time.time);
    }
}

```


texts:
Hello, I would like to get in a script the event whenever we click on the pause button, or the Jump frame button.

I have already manage the Pause button:

private void OnEnable()
{
    EditorApplication.playmodeStateChanged += HandleOnPlayModeChanged;
}

private void OnDisable()
{
    EditorApplication.playmodeStateChanged -= HandleOnPlayModeChanged;
}

private void HandleOnPlayModeChanged()
{
    if (EditorApplication.isPaused)
    {
        // do stuff when the editor is paused.
    }
    else
    {
        // do stuff when the editor is unpaused
    }
}

But How to get the "jump frame" button ?
Thanks !


texts: Patterns on preserving players progress across all player's devices

texts:
I'm writing cross platform game that is requested to store player progress across all their devices. I'm not talking about implementation details, but overall picture;

What are the patterns for preserving player progress in the least intrusive/distruptive way?

Logging in requires players to make account or share their facebook/gmail address; It is strong entry-obstacle when someone wants "just to try the thing up"
I can make account for player after they played a bit... This way, the user already tried the game and if he like to have his progress saved, they can make an account now. If not - the progress will be saved only locally
I can experiment with some information taken directly from device (when playing from mobile, for example); I believe I can easily access their gmail on Android, and use it for account merging later on
I can give them codes that unlock their progress. They can type them on different machines
They can manually move save file; I don't need to keep it online
They can move save file via cloud provider (like Dropbox/Skybox/GoogleDrive)
Anything else...?


texts: How to properly synchronize achievements on Google Play Services?

texts:
I have a mobile game with achievements on android, so the achievements are using Google Play Services.

For a couple of reasons, I must track the progress on the achievements locally (or so I think) because:

If the user is not connected to the internet
Some achievements have complex "step" that the simple increment system provided by the Google Play Service (number of steps, current step) cannot track.

When the game starts, the local copy data on the achievements is synced with what is on Google's server. Either

both are the same, do nothing
the local copy has more progress than what is shown on Google's: so update Google data (that happens if you play offline)
the copy on Google's server show more progress than locally: so update the local data (that happens if you play on a different device)

Clearly, there's a way to abuse the system here. Given two players with different achievement progress (Player_A (lots of achievements), Player_B (few achievements)) they can do the following:

Using Player_B's device, Player_B signs out of his account
Player_A signs in (the current active Google Account is now Player_A)
Start the game
All of Player_A's achievements are synced locally (they had more progress than the previous local version of Player_B)
Player_A signs out and Player_B signs in
Re-start the game: the local copy will show as more advanced than Player_B achievements, therefore they will get updated.

How do people deal with this problem? Not care? Key the local achievement progress to the logged in player (which causes some problems)? Not to track anything related to the achievements locally (but how to deal/detect being offline?)


texts: Getting collisions with equal values in Sweep and Prune

texts:
When sorting an (incremental and persistent) SAP, you generally move extremas left until you run into a smaller/equal extrema, gathering collisions along the way.  However, that results in the collisions of end-points being exclusive (equal extrema don't collide).  At first, I was thinking of moving left until a smaller (but not equal) extrema is found, but I'm pretty sure that would give incorrect collision results.

If I want equal values to properly collide (and uncollide), how would that handled?


texts: How can I make particles glow and cast light on its surroundings?

texts: Im currently attempting to make a firefly effect on a dark forest. The level has very low light and the player is one of the few light sources. To let the player see the level better, I am attempting to making glowing fireflies appear randomly on the map. One way is to use a particle system. But I cant make the particles cast light one the surroundings. Is there a way to do this?


texts: XNA - Am I screwing up the LoadContent for Texture2D?

texts:
I've read forum threads and questions and I done just about everything. I need to know what am I  screwing up here.

Here's the code in the constructor.

Content.RootDirectory = "GameStateContent";
//Content.RootDirectory = "Content";

And this is in the LoadContent method

 menu = this.Content.Load<Texture2D>("mainmenu");

And here's the image screen shot of the folder structure.
http://i.stack.imgur.com/HnndE.png

Any helps on this?

Thanks.


texts: When using Prefab Mode only one game object is adjusted while the others need to be manually selected in hierarchy window for changes

texts:
I created a bezier curve prefab using the code in the post How to create an illustrator/photoshop-like pentool for creating bezier curves in Unity. I added a few copies of the prefab to my scene. When I open the original prefab in prefab mode (I am using Unity 2019.1.0a8) and adjust any of the points it only affects one of the prefabs, the changes are not recognised in the scene view till I select the other objects manually.

I added SceneView.RepaintAll(); after calling path.MovePoint(i, newPos); in the Draw() method but it still doesn't update the others.

Could it be that I haven't serialised by variables correctly?
How can I get all of the objects created from the prefab to recognise changes immediately when the original prefab is altered?


texts: Unity Giving following error : NullReferenceException: Object reference not set to an instance of an object

texts:
im going to probably look really stupid and i will be no means admit this is my code however i cant seems to get it to work so i was wondering you you might be able to?

I'm getting the following error when trying to break a block with the left click button in unity:
"NullReferenceException: Object reference not set to an instance of an object
Player.Update () (at Assets/Scripts/Player.cs:67)"

the code that is causing the error is below:

if (Input.GetMouseButtonDown(0))
        {
            Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(mousePos, Vector2.zero);
            if (hit.collider.gameObject != null)
            {
                Destroy(hit.collider.gameObject);
            }
            else
            {
                Debug.Log("hit nothing");
            }
        }

i've searched around for other ways to do this and after many itterations i cant seem to get it working still so i have come to the forms.

Sorry line 67 is: Camera.main.ScreenToWorldPoint(Input.mousePosition);

i know it looks simular to other questions however i have looked at the link that was attached to this being a duplicate and i cant see anything in there that will help me so i am still stuck with the same issue.


texts:
Is it possible to use project level conditional defines in hlsl code?

I'm trying to conditionaly compile a shader using MonoGame Content Procesor. Depending on project type (ie. Windows, Windows8...) different shader models should be used.
Pragma directives are supported. The code:

#if WINDOWS
   PixelShader = compile ps_3_0 PixelShaderFunction();
#else
   ...

... doesn't work as WINDOWS is interpreted as false. Judging from the article on Gamasutra this should work. This answer on Gamedev lists constants which should be defined when using MonoGame.

I've also tried adding constants into csproj manually (in content project, then in dummy content compiler csproj).

Is there something I'm missing?

My sln structure is as follows:

MonoGameContentProject - holds .fx file
MonoGameDummyProject - has
content reference to content project, builds .fx file
WindowsProject - has a link to dummy project xnb file in the windows build directory


texts: Handling packet impersonating in client-server model online game

texts:
I am designing a server-client model game library/engine.

How do I, and should I even bother to handle frequent update packet possible impersonating?

In my current design anyone could copy a packet from someone else and modify it to execute any non-critical action for another client.

I am currently compressing all datagrams so that adds just a tad of security.

Edit: One way I thought about was to send a unique "key" to the verified client every x_time and then the client has to add that to all of it's update packets until a new key is sent.

Edit2: I should have mentioned that I am not concerned about whether the actions described in the packet are available to the client at the time, this is all checked by the server which I thought was obvious. I am only concerned about someone sending packets for another client.


texts: How to create texture using raw RGBA texture data without having to use LockRect

texts:
I was previously uploading textures to DirectX by creating texture in D3DPOOL_MANAGED and then calling LockRect to upload the texture data to DirectX.  However, I have switched to using DirectX9 Ex, and can no longer use D3DPOOL_MANAGED, so in order to call LockRect I have to make the texture use D3DUSAGE_DYNAMIC.  However, I would prefer not to have to use D3DUSAGE_DYNAMIC.  Is my only other option to create a texture in system memory, and then call IDirect3DDevice9::UpdateTexture to get the texture data into video memory?  I also see there is a D3DXFillTexture function.  But what i really want is something equivalent to glTexImage2D where i can create a texture and pass it raw data.

Note that I have stripped down RGBA texture data, otherwise I would try using DXCreateTextureFromFileInMemory.


texts: Is it possible to display no white images/sprites when using the latest Android OS?

texts: Was it okay to use Texture.setEnforcePotImages(false) in order to disable conditional width and height pixel size that requires power of 2? I'm planning to sell the game app at Google Play. I want to know and make sure that most of the latest models and Android OS's that won't display faulty white images by estimation, depending how many smartphone owners have latest Android OS's. (Gingerbread, ICS, or Jellybean) I had updated my LibGDX library.


texts: $0.99 or Free with Virtual goods - Revenue Model for mobile games

texts: I'm trying to decide between a paid game and a free to play game. Is there research on the pros and cons of each one. I would really appreciate some concrete data on this and not just opinions. This is for mobile (currently iOS with Android later) game.


texts:
I had issues using the isometric tilemaps feature in Unity. Whenever I try to place tiles, they don't seem to line up and create this jagged effect. I've tried messing with the anchor points and am a complete beginner at this.
Edit: My grid component looks like this:


texts:
So i decided to write my games data files in xml since a lot of people recommend it security wise for an online game, but how exactly does one render an xml tile grid in java?

format will be as follows:

<Data>
   <Tile X="1" Y="1" Value="12"></Tile>
</Data>


texts: I implemented several approaches such as A* and Potential fields for my tower defense game. But I want smooth paths, first I tried to find path on very small grid ( 5x5 pixels per tile) but it is extremly slow. I found nice video showing an RTS demo where paths are found on big grid but units dont move from each cell's center to center. How do I implement such behavior? Some examples would be great.


texts:
I'm trying to implement color correction with the 3d lookup table. The lookup table is actually just a 2d texture 256x16 and consists of 16 squares which one is 16x16.

When it comes to rendering, I pass 2 textures to shader: first one is whatever I rendered on the screen and the second is a lookup table. Shader takes RGB components of the rendered image, and uses it to find a replacement in a lookup table.

And there is two problems: first, I can't use filter to smooth colors (16 for each dimension is not enough) because it also smoothes the line between two contiguous 16x16 squares and that's inappropriate; second problem is no interpolation for a B-component.

Using a volume texture could solve both problems, but, unfortunately I'm short on time and there are not so many information about using 3d-textures in shaders. So, here's my questions.

Is it possible to pass a 3d-texture to shader (HLSL)?
If it is possible, could the filter be applied to the 3d dimension?
Maybe there is a better way to implement color-grading that I don't know?


texts: What are the common character animation techniques used in tile based hack&slash games?

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

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


texts: How do I scale my spell target indicator to match the radius of OverlapSphere

texts:
I have a spell system in which some spells have an Area of Effect. To get the targets I use Physics.OverlapSphere. I show the player an indication of the spell's radius by spawning a Unity plane primitive at the target position and scaling it to match the radius of the spell.

How would I scale my spell target indicator visual to correctly match the radius of OverlapSphere?
I have tried setting the scale of the plane's X,Y,Z to radius * 2, but this does not seem to align with the overlap sphere radius.
data.indicatorInstance.transform.DOScale(data.parent.radius * 2, 0.5f);

And just for completeness sake, below is the OverlapSphere call.
Physics.OverlapSphere(targetPosition, data.parent.radius)


texts: How does one make models that are proportionate to the other game assets you've made?

texts:
As a programmer, I am not very good (yet) at making game art. One of the many issues that often causes me trouble is asset creation.

Often I will want to create a house that a player could enter, and when the asset is made in blender, it looks right. But then once the asset is imported into whichever engine I am using I will find that the proportions of the doors or windows look completely inconsistent with all the other assets. Sometimes even the entire buildings proportions are off in comparison to the rest of the buildings.

Even worse, I find that my player model is either dwarved or enlarged by the scale of my models.  Resizing the models doesn't help because of the proportions.

The question is, how does one design consistently proportioned assests that fit the scale of the player?


texts: how to draw a dashed curved line to a point in as3?

texts: How can I draw a dashed curved line to a x,y point in as3? Basically I'm creating a game where you have a turret, and I want the arc the turret would fire a projectile along to be displayed as a dashed/dotted line along the arc to wherever the mouse x,y is. Ideally it would use the drawing API, rather than using any bitmap manipulation.


texts: How to make a projectile align correctly with the entity that shot it

texts:
I'm developing a 2D game. In the game, all entities can rotate 360 degrees. Each entity holds an angle value, and every frame it is drawn rotated around it's center by it's current angle value. For example:

An entity can 'shoot' another entity, a projectile. The Projectile is instantiated with a position and an angle. The position is calculated like so:

radius = entity.width / 2
angle = entity.angle
projectileX = entity.centerX + cos(angle) * radius
projectileY = entity.centerY + sin(angle) * radius

Example positions this calculation gives:

The angle the Projectile is instantiated with is the angle of the entity creating it. So if the entity's current angle value was 45, the angle of the new Projectile is going to be 45.

All of this creates a problem. I will demonstrate the steps leading to this problem:

1- An entity decides to shoot a Projectile. It's position is calculated like shown above.

2- A new Projectile is added to the game. It is instantiated with the position calculated in the previous step and with the angle of the entity instantiating it, for this example 45.

3- Every frame, each entity is drawn rotated around it's center by it's current angle value.

The angle of the new Projectile is 45, so it is drawn rotated around it's center by 45 degrees.

As you can see: after the rotation, the Projectile is no longer aligned correctly with the entity that created it. They are both rotated by the same angle, but the Projectile isn't 'pointing from the center' of the entity. It seems like it 'moved' a little to the side.

To clarify:

My question: how can I make the Projectile align correctly with the entity that created it? How can I make it still 'point from the middle' of the entity that created it, and not mess this up when rotating it around it's center?


texts: Change the scale-policy of OpenGL ES in Android?

texts:
I currently develop a game for Android in OpenGL ES 1.0, use libgdx library. I target the 720x480 screen size.

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

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

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


texts:
I am preparing for an internship as game programmer at a world-renowned game development company. When I searched their website for necessary prerequisites, it showed me this:

  Added Advantage

  Knowledge of DirectX/OpenGL.
  Strong command on 3D Maths and Physics.
  Visual Studio IDE for C++ development.
  System Programming and OS concepts.

What exactly do they mean by system programming and OS concepts?

Should I be studying Windows programming? Or should I be going with Linux programming (meaning they want me to know the important concepts). Or is it something totally different?


texts: What's a clean way to find (up to) 3x3 squares within a 6x6 grid?

texts:
I have a 6x6 grid where every cell have a color property (simply integer value).

Player can change one cell at a time to form rectangles of the same color inside of the grid. New rectangles can only be 2x2, 3x2, 2x3 and 3x3 in size.

Is there a cleaner way to find those rectangles rather than having to manually search for [i][j], [i+1][j], [i][j+1] and [i+1][j+1] (et cetera) color matches?


texts: Is there a term for the sounds that play when text is printed out letter by letter?

texts: Take a game like Undertale: whenever a character "talks", the text is printed out one by one, and a sound is played for each letter, as if the character is actually talking (even if it's just gibberish). These sounds are usually different for each character. What are those types of sounds called? If I wanted to get placeholder sounds for such a dialog system, how do I find them?


texts: How do I link a GameObject activated state to a UI button being held?

texts: How do I go about this functionality: When a user taps and still holds onto a UI button, a GameObject will be set active, when they release the UI button, the GameObject will be deactivated.


texts: Why the object is not getting close enough to the waypoint/s too high?

texts:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Waypoints : MonoBehaviour
{
    public GameObject objectToMove;
    public GameObject[] waypoints;
    public Transform target;
    public float moveSpeed = 1f;
    public float rotationSpeed = 1f;
    private Transform myTransform;
    private int targetsIndex = 0;
    private Vector3 originalPosition;
    private bool visitNpcsDistance = false;

    public float walkSpeed = 15f;

    // Use this for initialization
    void Start()
    {
        if (objectToMove == null)
        {
            myTransform = transform;
        }
        else
        {
            myTransform = objectToMove.transform;
        }

        originalPosition = myTransform.position;

        if (waypoints.Length == 0)
        {
            waypoints = GameObject.FindGameObjectsWithTag("Waypoint");
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (visitNpcsDistance == false)
        {
            WayPointsAI();
        }

        DrawLinesInScene();
    }

    private void WayPointsAI()
    {
        if (targetsIndex == waypoints.Length)
            targetsIndex = 0;
        target = waypoints[targetsIndex].transform;
        float distance = Vector3.Distance(myTransform.position, target.transform.position);
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

        //move towards the player
        myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
        if (distance < 0.3f)
            targetsIndex++;
    }

    void DrawLinesInScene()
    {
        // draw lines between each checkpoint //
        for (int i = 0; i < waypoints.Length - 1; i++)
        {
            Debug.DrawLine(waypoints[i].transform.position, waypoints[i + 1].transform.position, Color.blue);
        }

        // draw a line between the original transform start position
        // and the current transform position //
        Debug.DrawLine(originalPosition, myTransform.position, Color.red);

        // draw a line between current transform position and the next waypoint target
        // each time reached a waypoint.
        if (target != null)
            Debug.DrawLine(target.transform.position, myTransform.position, Color.green);
    }
}

The object that move between the waypoints. I added to it a box collider and set the size of the collider to 0.4,0.4,0.4 it was 0.5,0.5,0.5

The moving object also have a rigidbody I added :

Each waypoints sphere WP1,WP2....scale is set to 0.3,0..3,0.3

I added some spheres as waypoints on a stairs so the object will move up and down the stairs.
But when it's moving up and down the object seems to be too far from the waypoints :

Look at the droid (the object that move between the waypoints) height and it's not 0.3f distance from the waypoint/s. I don't want the droid to walk on the stairs move on it touch the stairs I want it to be in the air a bit but not that high.

The droid selected and set to center and local :

when changing the local to global nothing changed but when changing the center to pivot :


texts:
Hey I'm currently getting started with physics engines and I set up a body (box shaped) which represents my character.
Question: Which methods can I use to move a Nape.Body aka my char?

I tried so far to manipulate the velocity, addLocalForce / Impulse but I don't know which method is the best for moving a character.


texts: Moving a body in a specific direction using XNA with Farseer Physics

texts:
I have a custom polygon attached to a body, which looks like this:

What I am trying to accomplish is getting the body to move according to wherever the tip of the body is. So far this is what I've tried:

        if (ks.IsKeyDown(Keys.Up))
        {
            body.ApplyForce(new Vector2(0, -20),body.GetLocalPoint(new Vector2(0,0)));

        }
        if (ks.IsKeyDown(Keys.Left))
        {
            body.ApplyTorque(-500);
        }
        if (ks.IsKeyDown(Keys.Right))
        {
            body.ApplyTorque(500);
        }

The body rotates fine - but when I try making the body accelerate according to the tip of the body - assuming I have specified the tip correctly(I am pretty sure I haven't), it just spins around, as if I have applied Torque to it. Can anyone point me in the right direction of how to fix this problem?


texts:
I want to render a depth map by importing it from a file, then creating an array of vertices and indices, and then displaying it using a basic shader (just apply the view and projection matrices on it and then display). I'm aware of GPU-based solutions, however, I want to perform additional calculations using the CPU on the vertices before rendering them.

So, basically what I do is that I have my vertices with there depth in a grid, and then I import my triangles as follows:

+--+--+--+--+--+--+
¦ \¦ \¦ \¦ \¦ \¦ \¦
+--+--+--+--+--+--+   meaning that I simply split every quad spanned by four pixels
¦ \¦ \¦ \¦ \¦ \¦ \¦   into two triangles.
+--+--+--+--+--+--+
¦ \¦ \¦ \¦ \¦ \¦ \¦
+--+--+--+--+--+--+

When I took the first best depth map that I've found on google, I've got this result:

However, as soon as I'm moving the camera up, strange things happen:

The problem seems to only arise when multiple triangles are rendered behind each other. In this case, a triangle from the back (a black one at infinity depth or a wall behind the front object) seems to shine through. Also, when I use "PIX for Windows", and I use the "Debug this pixel" functionality, I get two triangles for each of the buggy pixels I've checked.

The rendering is done as follows:

Initialize

graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;
graphics.IsFullScreen = false;
graphics.ApplyChanges();
IsMouseVisible = true;

Draw

GraphicsDevice.Clear(ClearOptions.DepthBuffer | ClearOptions.Target, Color.Black, 0, 0);
DrawModel();
spriteBatch.Begin();
DrawControls();
DrawFileBrowser();
spriteBatch.End();
base.Draw(gameTime);

DrawModel

GraphicsDevice.RasterizerState =
    new RasterizerState {
        CullMode = CullMode.None
    };
// [...]
// set up view and projection matrix
// [...]
GraphicsDevice.DrawUserIndexedPrimitives(
    PrimitiveType.TriangleList,
    vertices,
    0,
    vertices.Length,
    indices,
    0,
    indices.Length / 3);

What could be the problem in my rendering method? Do I have to somehow order my triangles from back to front? (no alpha-values are used) If yes, how can I order them?

Is it maybe some problem with the depth buffer? How can I fix it?

Any other ideas on how to fix the problem?

Edit

Shader code is basic:

float4x4 View;
float4x4 Projection;

void VS_Model(in  float4 inPosition            : POSITION,
              in  float4 inColor               : COLOR,
              out float4 outPosition           : POSITION,
              out float4 outColor              : TEXCOORD0)
{
    outPosition = mul(mul(inPosition, View), Projection);
    outColor = inColor;
}

void PS_Model(in  float4 inColor               : TEXCOORD0,
              out float4 outColor              : COLOR)
{
    outColor = inColor;
}

technique Model
{
    pass
    {
        VertexShader = compile vs_3_0 VS_Model();
        PixelShader = compile ps_3_0 PS_Model();
    }
}


texts: Currently developing a game with Android SDK, should I switch to a game engine in future projects?

texts:
I am an android developer, and I've made several apps on the Google Play Store. I'm currently working on my first game, which is just a simple RPG for android, that I'm coding in Java with the android SDK. I went to an indie game conference recently, and one of the veterans, asked why I didn't use Unity or another game engine to build my game, so it could be easily ported later on. Which got me to wonder if I should use a game engine, since I do want to port this game to other platforms.

So, my question is, should I try to adapt to a game engine to make my future projects, if so, which game engines should I look into?

Thanks!


texts: How can I incorporate subsurface scattering into a custom shader graph?

texts:
I'm working on some 3D grass in Unity with HDRP (the grass is not a 2D asset on a plane, it's a mesh).
I did a shader to make it move following a tutorial, it works great. I would like to add Subsurface Scattering (SSS), but I can't find any node or tutorial helping me in that way.

If I could somehow inject the output of this SSS material into my base colour pin, that would solve the problem.
How can I achieve this subsurface scattering look?


texts: What is "ROAM" related to terrain rendering?

texts: I saw it mentioned on this question, but no one explained what it is.


texts:
I'm currently working on a minor multiplayer project which is made like a hacking simulator where your character can login to a "console"-like interface to permanently manipulate the system with various commands. But now i want to convert this to a more persistent model like if two characters enter the same systems minutes apart, the second character should be able to see if the first character left traces of him being there and continue his damage or counter it.

Could all this be handled by a Rest API or what would be the more "right" way of doing it. ?

This will also work as the authentication for the player, which will initialize all multiplayer behaviour in the game.


texts: Polygon editor to draw collision data over image

texts:
I need an editor to plot a polygon over the texture for of a ship  in my game.

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

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

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


texts: Can I use physics in Isometric map based games?

texts:
I am trying to use physics in my game which is an isometric map based strategy game that the player deals with a city full of buildings, roads and people in it. I am writing the game with Swift and SpriteKit technology.

(the following picture shows a snapshot of my game)

MY GAME

I like to use Spritekit's physics library so I would be able to simulate car accidents and preventing them to go throw the buildings and other kind of stuff that physics could provide.

I am familiar with Physics and I have enough experience with Bullet and I can write a 3D game using OpenGL ES and physics, but I haven't really used physics in 2D isometric map games.

I have also wrote a 2d physic game that was really 2d (an endless runner) which was actually a sample of a book but as you can see in the following picture the gravity vector is the Y axis and every thing is pretty easy.

Here is the gravity vector that is used to create the game at the following picture.

self.physicsWorld.gravity = CGVectorMake(0, -9.8)

Someone Elses Game, Book Sample

Book Name : iOS 7 Game Development

Author : Dmitry Volevodz

You may find the book Here

However, in an isometric map game you can't just set and assign the Y axis as a gravity vector. since the method which sets the gravity vector accepts two arguments it is a big hope that I can use physics in my isometric map games. For example something like this

  I Say!!! :

As I am still using a cartesian coordinate system (perpendicular axis) X and Y axis make a 90 degree angle and if I need to project the gravity quantity over the X and Y axis it would be gCos(45),gSin(45) I haven't tested it yet.

self.physicsWorld.gravity = CGVectorMake(-9.8*0.707, -9.8*0.707)

May you please help me on setting the gravity vector and how should I define the moving objects like cars and humans and the static ones like buildings any other tips on modelling physics in isometric map are also welcome and appreciated.

The main question is: is it really possible to use physics in an isometric map based games?


texts: How would I run a VR game that depends on external hardware?

texts:
I have a VR game idea which is being built on Unity with external hardware (Arduino, Gyroscopes, etc).

I have thought of ways to connect the Arduino to Unity but what I am now struggling with is thinking of a way to play the VR game.
I've created VR games before for iOS where the user can use Google Cardboard, however, I feel like that would not be possible due to the external hardware.

Are there any other ways that you know are possible?


texts: Gamemaker studio 2 getting error message

texts:
I'm currently using gamemaker studio 2 following a youtube guide on making my first game. I am very new to coding and need some help.

Im getting this error message attached to my code and I'm not sure why.


texts: How can I find the center position of two or more objects?

texts:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveCameraBehind : MonoBehaviour
{
    public GameObject camera;
    public List<GameObject> targets = new List<GameObject>();
    public float cameraDistance = 10.0f;
    public bool behindMultipleTargets = false;
    public string cameraWarningMsgs = "";
    public string targetsWarningMsgs = "";

    // Use this for initialization
    void Start()
    {
        if (camera == null)
        {
            var cam = GetComponent<Camera>();
            if (cam != null)
            {
                cameraWarningMsgs = "Gettig camera component.";

                camera = transform.gameObject;
            }
            else
            {
                cameraWarningMsgs = "Creating a new camera component.";

                GameObject NewCam = Instantiate(new GameObject(), transform);
                NewCam.name = "New Camera";
                NewCam.AddComponent<Camera>();
                camera = NewCam;
            }
        }

        if(targets.Count == 0)
        {
            targetsWarningMsgs = "No targets found.";
        }
    }

    void FixedUpdate()
    {
        if (targets.Count > 0)
        {
            MoveCameraToPosition();
        }
    }

    public void MoveCameraToPosition()
    {
        if (targets.Count > 1 && behindMultipleTargets == true)
        {
            var center = CalculateCenter();
            transform.position = new Vector3(center.x, center.y + 2, center.z + cameraDistance);
        }

        if (behindMultipleTargets == false)
        {
            Vector3 center = targets[0].transform.position - targets[0].transform.forward * cameraDistance;
            transform.position = new Vector3(center.x, center.y + 2, center.z);
        }
    }

    private Vector3 CalculateCenter()
    {
        Vector3 center = new Vector3();

        var totalX = 0f;
        var totalY = 0f;
        foreach (var target in targets)
        {
            totalX += target.transform.position.x;
            totalY += target.transform.position.y;
        }
        var centerX = totalX / targets.Count;
        var centerY = totalY / targets.Count;

        center = new Vector3(centerX, centerY);

        return center;
    }
}

The CalculateCenter function make the targets(objects) to change positions and vanish away far away.
Even if there is only one single target.

What I want to do is if there is one object for example one 3d cube position the camera behind the cube.
And if there are more cubes for example two or ten and the camera is somewhere else calculate the middle position behind the targets and position the camera in the middle behind them.

To show what I mean in this example the view(like a camera) is behind the two soldiers in the middle position between them from behind.

But what if there are 5 soldiers how can I find the middle position and then position the camera behind them like this example in the screenshot ?


texts: OpenGL vector rotation matrix to a given point

texts:
I have a sphere with a radius of .5

The sphere is centred at 0,0,0

I am now trying to place items around my sphere based on a given x,y,z on the surface of the sphere.

My items have been draw/created in such a way that they are positioned on the surface when translated to 0,0,0 because their centre offset has been positioned at the centre of the sphere.

What I need is some help with the calculation needed to get the correct glRotate values so that my icons will show at the correct x,y,z on the surface.

To help explain what I mean, here is a picture:

So you can see 0,0,0 at the centre, and also rotating around the same point is the blue line, This represents the rotation of my object. The green part is the visible part of my item, and so will draw on the surface of the sphere.

I have everything ready to go for this, in that I can already draw my items in this manner, however I am not able to correctly calculate the rotation.

With the default rotation of Identity my items will draw on the bottom of the sphere.

In summary I am looking for something like this:

glRotate = GetRotationForSurface(X,Y,Z);

I hope that's clear, this is a bit tricky to explain.

Thanks,


texts: Maya and Game Engines (i.e. Environment Testing)

texts:
What does it mean if I'm designing an environment and I want to test it in the game engine, to see what its like to "run" [or fly] around my environment? I heard an instructor say that exact thing in a Maya training video and I'd like to know more about "How Game Engines and Maya are related to each other." He stated this would be done to see how things look in "size" (e.g. I assume he meant: 'How big is the cathedral, bridge, wall, building, etc.').

I've tried to research such information but it's too complicated, and detailed. I just want a simplistic response to my query. Thanks to everyone willing to help and not criticize my question.


texts: Why are my click events being fired many times for every click?

texts:
I am working on a game in unity where a user will click a button to gain coins and clicks over a lifetime of clicking the button but the code is making the clicks go up by a lot instead of just 1 each time it is clicked like here are the values returned the first 3 clicks
247 731 2111
anybody have an idea why it produces this behavior and how i can fix it?

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

public class GameManager : MonoBehaviour {
    public Button clicker;

    public Text coinsSec;
    public Text ltClicks;

    private float baseClick = 2;
    private float coins = 0;
    private float lifeTimeClicks = 0;
    private float coinsPerSec;

    private void Start(){
        UpdateTxt ();
    }

    private void Update(){
        UpdateTxt ();
        Clicker ();
    }

    private void Clicker(){
        clicker.onClick.AddListener (delegate {
            coins += baseClick;
            lifeTimeClicks++;
        });
    }

    private void UpdateTxt(){
        coinsSec.text = "Coins/s: ";
        ltClicks.text = "Lifetime Clicks: " + lifeTimeClicks.ToString ();
    }
}


texts:
I'm currently trying to convert from grids to navigation meshes for pathfinding, since grids are either too coarse for accurate navigation, or too fine to be useful for object tracking.

While my map is fairly static, and the navigation mesh could be created in advance, this is somewhat of a tower defense game, where objects can be placed to block paths, so I need a way to recalculate portions of the navigation mesh to allow pathing around them.

Is there any existing documentation on good ways to do this? I'm still very new to navigation meshes, so the prospect of modifying them to cut or fill holes sounds daunting.

EDIT:
To be clear, I'm looking for solutions that use a polygon navigation mesh, not a grid. I currently use grids, but I'm trying to move away from using them. It is the efficient dynamic modification of that polygon mesh that I'm trying to figure out.


texts:
I am looking into options for the model assets for my game. I have gotten pretty good with Blender, and want to use C++/DirectX9 (don't need all the excess from 10+), but Blender 2.6 exports .fbx not .x (by nature) and supposedly what is exported from Blender to .x is not entirely stable.

In short how do I import .fbx models (I can work around not having animations if I must) into DirectX9? Is there a middleware, or conversion tool that will maintain stability?


texts:
i am creating my 3d game engine using Opengl.

this question might sound stupid to you but i am still in the process of learning, i have a 3d animated girl that slaps guys of different talls on the face.

however the animation is specified for a tall say 1.85CM.
when i want her to slap a guy that is 1.60CM tall then she slaps the space over his head.

do i have to create animations for the girl slapping different talls of guys?!

this would be a lot of work, i hope you give me some insight about how such thing are handled.

also could you please give me some resource on generating animations in runtime?

to get my idea for example take a game like fight night, a head punch would be directed to the head no mater how the tall of the other guy is.


texts: How can I do a weighted cascade down a path in a 3D environment?

texts:
I am trying to perform a weighted cascade down a path in a 3D environment. Now, what I am trying to do is have one object(a cube) in the environment scan from its coords 1 in every direction for another cube, and then if it finds another cube, it will scan around that cube for another cube etc all the way to the end of the path, or it has reached its limit of 40 cubes, and I would like it to have a weight for each step down the path it takes so it will stop if it has travelled more than 40 cubes down the path.

Now, I have no idea on where to go from scanning directly around the first cube. How do I make it move onto the next cube, then the next cube, then the next etc without writing a really long method that considers each cube along the path?

Before pathfinding algorithms such as A-Star or BFS/DFS come into this, I have already tried that and found it way too complicated, it was unnecessary complicated just for this one part of my program.

Thanks.

Edit: I forgot to mention that these cubes do not move, they stay wherever the player puts them.


texts: Compute world position by walking N units along spline?

texts:
My goal is to move ahead along a spline 'x' world units, unfortunately there is no way to map spline points to world points.

What I do is I iterate along the spline by a small alpha amount (say 0.001), get the new spline point vs the old one and add the difference to a total up until it equals or is slightly greater than the distance I wanted to move in world space.

This works fine but there is a huge bottleneck with the sqrt, basically to calculate the distance between two vector points you need to do a square root calculation.

I feel it should be possible to just get the squared value and just use that, unfortunately I can't get the code working, here is what I have:

Where _distance is the amount to move, Distance is the alpha value along the spline.

        float distanceMoved = 0;

        float oldDistance = Distance;

        while (distanceMoved < (_distance))
        {
            Vector3 before = Position;
            float oldAlpha = Alpha;
            float oldDist = Distance;
            Distance += _iteration;

            distanceMoved += (before - Position).magnitude;
        }

Notice the line with (before - Position).magnitude, the .magnitude property performs a square root.

I've tried changing it to .sqarMagnitude and say distanceMoved < distance * distance but it has accelerated the rate of movement forwards.

Any ideas what is going wrong or how I can get rid of the square rooting or do this differently entirely?


texts: Point Sprites vs Textured Quads in Open GLES 2.0

texts:
I'm wondering what would perform better, point sprites (GL_POINTS) or regular sprites (GL_TRIANGLES).  Here's the scenario:

I am developing a simple particle system to allow me to produce various effects like fire (in a very simple way).  Each particle will be rendered using a texture, but the rub is I want different textures depending on the "age" of the particle (imagine a fire particle transitioning from a "burning" style texture to a "smoke" style texture).

As I understand it if I use point sprites I would have to bind different textures during the lifetime of the particle set based on the age of the various particles still alive.  That is, as many texture bind operations as there are "stages" for a particle (at most).

Conversely if I use regular sprites I can do a single bind of an atlas then just render away.

I'd also "like" to be able to rotate the particles, but that's probably not a deal breaker if the performance gain for point sprites is significant.  I would definitely want to scale, but I'm assuming I can do that by changing the point size... not sure what the max is for that.

My sense is that a few additional texture bind operations is going to have less of a performance impact than drawing 4 times the number of vertices (4 verts per sprite vs 1 per point).  Of course there'd also be an additional sort operation in the point sprite approach so I can batch up the particles with the same texture, but again that shouldn't be too heavy if there are only 3-4 states per particle.

I'm developing for mobile (Android/iOS) so chipset will vary (not sure how much impact that will have on the decision).

Now the "right" thing to do would be to implement both and test, but that sounds like way too much hard work ;)

Would I be correct in assuming point sprites are still the better approach?


texts: Finding out which Panel was clicked in function

texts:
I have a panel with 10 sub panels in it. I am using Event Trigger to intercept the messages from these sub panels OnPointerDown  event calls some function in the some script of an Game Object.

Is there a way to know in the function which of the sub panels was clicked. That way I can use the same function for all the sub panels or should I make individual function for each of the sub panels.


texts: How do you exactly implement a Semi-Implicit Euler type of movement in a 2D platformer?

texts:
So I've been following along Sebastian Lague's 2D platformer tutorial, and to understand exactly how
the physics of how a jump is done, I dug into the subject and noticed a lot of people, from GafferonGames and Kyle Pittman, all mention using Semi-Implicit Euler in making an accurate jump.

Now my problem is: How do you exactly implement this type of integration scheme in a game?

Specifically a platformer. A comment on the tutorial I was following said that the code below uses the Explicit Euler type of integration. Though I'm not exactly sure myself on whether or not this is true; another tutorial I found on the topic, specifically Jorge Rodriguez's Math for Game Developers  uses the Semi-Implicit Euler integration to make a spaceship simulator, but the code used was C++ and I only have some limited C# and I was not able to fully understand parts of the code that went into implementing the integration.

  Specifically:

          auto v = [vn, gravity](Vector x, float h) -> Vector
            {
                return vn + gravity(x) * h;
            };

            auto a = [xn, gravity](Vector v, float h) -> Vector
            {
                return gravity(xn) + gravity(xn + v*h) * h;
            };

from what I understand, this function returns a Vector2, but I don't know if the auto = a [xn, gravity] is supposed to be about declaring a variable or what, or how the -> vector bit fits in the whole code.

All in all, I need help, I'm still pretty new to programming and general and these small nuances confuse me. Any help is greatly appreciated, Thank you.

This is the code for the Platformer Character controller I followed from Sebastian Lague.

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

[RequireComponent (typeof(EntityController2D))]
public class PlayerController : MonoBehaviour
{
    EntityController2D playerController;

    #region Y-Velocity Fields
    public float jumpDisplacementDeltaTime = 0.75f;
    public float jumpHeight = 6.0f;

    float gravity;
    float jumpVelocity;

    #endregion

    float moveSpeed = 6.0f;

    Vector2 velocity;

    public void Start()
    {
        playerController = GetComponent<EntityController2D>();

        gravity = -(2 * jumpHeight) / Mathf.Pow(jumpDisplacementDeltaTime, 2);
        jumpVelocity = Mathf.Abs(gravity) * jumpDisplacementDeltaTime;

        print ($"Gravity: {gravity}");
    }

    // Update is called once per frame

    public void Update()
    {
        Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if (playerController.collisions.below || playerController.collisions.above)
            {
            velocity.y = 0;
            }

        if (Input.GetKeyDown(KeyCode.Space) && playerController.collisions.below)
            {
            velocity.y = jumpVelocity;
            }

        velocity.x = input.x * moveSpeed;
        velocity.y += gravity * Time.deltaTime;
        playerController.Move(velocity * Time.deltaTime);
    }
}


texts:
I realise that this question exists but the answer doesn't explain how to create DEB packages and whether they're suitable.

I'd like to package my Java 8 game for Linux. Most people don't have Java 8 (and some don't even have Java), so including the JRE in the package would be great.

The package should also have a logo that shows up on most desktop environments.

Lastly, the package should be cross distro (or cover a large number of distros), if possible, because there are simply so many distros.

How would I go about achieving this?


texts: Scaling a game world both for realism and for mechanics

texts:
I am currently working on a turn-based 4X game, and one of the things I quickly ran into was a question of scaling. On one hand, I want things like realistic sizes (having some idea of what each tile represents in terms of area), but on the other hand, doing so would limit me in terms of certain mechanics I want to implement (the size of a realistic city would not even occupy a tile, let alone multiple tiles, a mechanic I want to use).

How would I go about scaling the world so that I can have both realistic scaling AND the mechanics I want?

Some things I have considered:

Changing the size of the world. Nothing says that I have to have this take place on an Earth clone (especially with randomly generated terrain). Smaller worlds might allow the detailing I'd need for the cities without having unrealistic tile sizes.

Foregoing the realism: Something that came up while I was researching was that ancient cities were tiny by today's standards. Ancient Rome (the part encompassed by the Aurelian Walls) was only 5.3 square miles (for comparison, Manhattan is 22.96 square miles- enough to fit four Romes). I could forgo the realistic sizes of cities and make them the size I want for my mechanics.

Not including the entire world: Depending on the time-period I end up basing this off of, it may be pointless to include areas that effectively did not exist.

What is the best way to balance realism and mechanics for the scaling of a game world?


texts:
I'm drawing my ship by the following code and wanted to draw a missile at the tip of the ship, so that when I click spacebar it fires that missile. I don't know if what I'm doing is correct or not. Is that the "correct" way to do the job of drawing a missile then firing it by a space bar? or there is a "better" way?
Is the transformation correct here, I mean writing hard coded values and just stick the missile at the tip of the ship by trial and error?

void Ship::Draw( )
{

    gl::pushMatrices();
    gl::translate(Vec2f(m_Pos.x,m_Pos.y));
    gl::rotate(Vec3f(0,0,m_Angle));

    gl::color(ci::Color(1,0,0));

    gl::drawLine(Vec2f(-43,-52),Vec2f(59,1));
    m_Bullet.Draw(59,-8);
    gl::drawLine(Vec2f(-14,-34),Vec2f(-14,38));
    gl::drawLine(Vec2f(59,1),Vec2f(-43,54));
    gl::popMatrices();

}
void Bullet::Draw(int x, int y)
{
    gl::pushMatrices();
    gl::translate(x,y);
    gl::drawSolidRect(Rectf(0,0,16,16));
    gl::popMatrices();
}


texts: limits of tiles on tilemap, for mobile devices?

texts:
how many tiles are we allowed to add on a Tile map, using softwares like Tiled , to target mobile devices? Some devices cannot load a texture that exceeds 2048x2048, would you know how a tilemap works and if a limit of size exists?

Thanks


texts: Playing two sound effects in a queue libgdx

texts:
I've been developing this game for which I need to play two sound instances one after another.
Calling them one after another results in overlapping sounds.
The issue is there is no way to know if a sound has finished playing, any workarounds anyone has found for this?


texts: Collision detection - make sure the player touches the object exactly

texts:
I know this is really something I should be able to figure out on my own, but a solution is evading me.

Okay, here are a few relevant parts of my code.

bool Game::Col(int x1,int y1,int w1,int h1, int x2, int y2,int w2,int h2)
{
    if(x1 > x2 + w2 || y1 > y2 + h2 || x2 > x1 + w1 || y2 > y1 + h1)
    {
        return false;
    }
    return true;
}

That's my collision detecting algorithm. Simple, for rectangles only.

        int bX = (player.getX() - 64) / 32;
        int bY = (player.getY() - 64) / 32;
        int tX = (player.getX() + 64) / 32;
        int tY = (player.getY() + 64) / 32;

        for(int a=bX;a<tX;a++)
        {
            for(int b=bY;b<tY;b++)
            {
                if(Col(player.getX(), player.getY(), 32, 32, a * 32, b * 32, 32, 32) && blocks[a][b] == 1)
                {
                    player.setX(oldX);
                    player.setY(oldY);
                    goto loopExit;
                }
            }
        }

        loopExit:

Here is my collision detection. This is performed right after the player x/y is manipulated(5 pixels in whatever direction every 1/60th of a second). Blocks is just a 2d array for my tile map. I know the way I have collision detection right now is not too optimized, but it took a few seconds to implement and is reasonably fast.

But the player can only get within 5 pixels of an object now. How do I solve that?


texts: Saving an array in GameMaker with DS Maps

texts:
I have the following issue. I'm creating a game with different levels. When the level is generated, an array of random number is generated for later use.

If the player leaves the game and come back later, I would like the array to be the same. So I'm trying to save the array when the level is generated. I was thinking about using the function ds_map_add_list(id, key, value).

I'm digging through the documentation, but I'm a bit lost and I have a few questions:

How do I create a list from a GML array?
If I create a DS Map with the following function inventory = ds_map_create();, what's the scope of the DS Map? Can I use it only in the object holding the code where it was created?


texts: Unity 5 Standard Assets for Linux / Ubuntu

texts:
Unity recently has released Unity3D Editor for Linux machines. But in its website there is no support for Linux / Ubuntu. As of Unity 5 standard game assets have been removed from the editor itself and should be installed apart.

For installation I should follow these steps:

http://unity3d.com/get-unity/download?ref=personal
Additional Downloads
Standard Assets

But there are only options for Windows and OS X, nothing for Linux. So what should I do? Is it possible to do it manually?


texts: Opengl - Know when a new frame is drawn, regardless of window

texts:
I want to know the framenumber of the current frame at any time, regardless the bound window or if it was changed. I dont want to implement a framecounter in my window class, since that would 1. require every depending library to check which window is bound and only use frames from there and 2. Isnt independent of windows.

I am sure there is a way to simply know when A opengl context has something new send to it. Please help me find it!

I want a frame number that is in sync with other debugging tools so I can easily compare and contrast.


texts: OpenGL: glRotatef cause performance drop while rotating -x and -y

texts:
I have made a rotating cube and I got some performance drops while using two glRotatef calls. So basically this code is giving me 80FPS:

    //code 1
GLrotate_x += 0.4f;
GLrotate_y += 0.4f;
        glPushMatrix();
            glRotatef( GLrotate_y, 0.0f, 1.0f, 0.0f );
            glRotatef( GLrotate_x, 1.0f, 0.0f, 0.0f );
            glTranslatef(multiplxGL+0.5f+spaceGL/2, -multiplyGL-0.5f-spaceGL/2,  multiplzGL+0.5f+spaceGL/2);
            glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
        glPopMatrix();

While this one is giving me 100FPS

    //code 2
GLrotate_y += 0.4f;
        glPushMatrix();
            glRotatef( GLrotate_y, 1.0f, 1.0f, 0.0f );
            glTranslatef(multiplxGL+0.5f+spaceGL/2, -multiplyGL-0.5f-spaceGL/2,  multiplzGL+0.5f+spaceGL/2);
            glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_SHORT, BUFFER_OFFSET(0));
        glPopMatrix();

The rotate results from the rotation code 1 and code 2 are not the same (cube rotates different).I know that the code 1 is the most proper way here for the rotation but why the performance drops? Any chance of updating my code 1 to the performance of code 2?

On the other side in DirectX I use:

D3DXMatrixRotationYawPitchRoll(&matDXRotate,
                                D3DXToRadian(DXrotate_y),
                                D3DXToRadian(DXrotate_x),
                                D3DXToRadian(0.0f));

and then

matDXStack->Push();
        D3DXMatrixTranslation(&matDXmove, multiplxDX + 0.5f + spaceDX / 2, multiplyDX + 0.5f + spaceDX / 2, multiplzDX + 0.5f + spaceDX / 2);
        matDXStack->LoadMatrix(&(matDXmove*matDXRotate));
        d3ddev->SetTransform(D3DTS_WORLD, matDXStack->GetTop());
        d3ddev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 36, 0, 12);
    matDXStack->Pop();

Which gives me 100 FPS and rotate results same as code 1.


texts: How much a scene would be done in 3D modelling program before exporting?

texts:
What I am trying to work out is, when creating a level, or section of a level, how much is created in the modeling package before it is exported, take the scene in the link. Would this whole scene be created in Max first, if so what is the point of a level editor, where does that come into play.

Basically how are levels made, how much of a whole level, or section of a level is created in the modeling software, how can multiple people work on the same level at once, what is the relationship of a level editor to modeling package like 3ds max?

I would be using Unreal 4 and 3ds Max.


texts:
I've learned quite a bit of Box2D and I've succeeded basic stuff concluding ball physics.

I want to implement 'opposing forces', as the character kicks the ball with a certain strength, with the leg having a certain mass, in a certain velocity. Basically, I don't want the leg to be controlled by Box2D's world, but to be counted as an object that I (the programmer) can move freely without the b2World::Step() method affecting it (as the player controls the leg).

How do I do so? I'd be happy to have a link, as I can't seem to find one.


texts:
When last I dabbled in game development, I managed my geometry in a tree. Every node would call the render method on it's children, prior to resetting it's transformations, thus allowing the transforms to propagate.
(The typical illustration of how this works is a radar dish spinning, on top of a vehicle that moves. The radar is a child of a autorotator node, which is a child of the vehicle.)

Now I'm at it again, and I learn that transformations are supposed to be done with shaders. Fair enough. What I can't wrap my head around is how to inherit transformations between objects.

Perhaps I´m over thinking it. Is it just a matter of passing the M, V and P matrices down the tree yourself and multiplying them prior to sending them to the shader?

In any case I'd like to hear how other have dealt with this. There is not much out there on this topic.


texts: Ball Physics : Bounce height altered by elasticity of ball and bounce surface

texts:
I have created a bouncing ball simulator using XNA and I am happy with my use of gravity, acceleration, change of direction and friction/spin.

However, I am now at a stage where I would like to define my ball as being made of a different material, subsequently meaning that the "bounce height" will be different depending on the elasticity of the material.

Ultimately, I will also want differing types of bounce surfaces as well.  This will mean that I could have bounces as varied as:

Rubber ball on concrete.
Ping-pong ball on wood.
Concrete ball on mud.
Etc., etc.

My question is; How should I alter my bounce height depending on the material(s)?

I have found some information about Young's Modulus of Elasticity but I would be grateful if someone could advise as to how I use this (or another) value as a ratio in my "bounce" calculation.

Thanks in advance and please let me know if you would like to know anything else.


texts: How to use Bidirectional path tracing on sky dome for rendering indoor

texts:
Is it possible to use bidirectional path tracing to render an indoor scene where
the light source is skylight(no sun) coming through a window? I think I roughly
know how this is done if the light source was the window rectangle itself acting
as a diffuse source but cannot get my head around on how it would work if the source is skylight and the camera is in a room: Is it the window shape that needs to be sampled or the sky dome? Would the light sample point be picked from the whole sky dome, or just a visible bit from the window?

Thanks.


texts: Unity - Tiling of a material, independen of its size

texts:
I am using Textures and Materials to tile my sprites, for instance when building a wall in my game.

The problem with this is that everytime I resize the plane or size of my game object I have to retouch the tiling property of the material.

I have asked around about how to solve this, and they told me to write me own shader, but after reading around a little, that seems quite a deep and long topic, to solve this small issue.

Would anyone know a way to solve this issue, or at least recommend me a shader that already does that ? (and if possible a small explanation on how to use it).


texts: How can I implement a file format that allows for random access to varying-sized sub-files?

texts:
I need to store and update collections of serialized data (of varying sizes) into a single file that is compact and allows for efficient random access to the stored data.

Some real world examples:

Storing a series of JSON objects (of varying sizes) that can be
pulled out individually for parsing given an index or hash key.
Other serialized structures that may contain persisted state or
configuration settings given an index or hash key.

How can I implement such a file format?

I think at the very least there would need to be an index that points to blocks of the serialized data. Minecraft uses the Region file format which allocates space in the file by a fixed block size and then store data in the header of the file to determine the location and size of the data.

If the data I was storing was static, something like this format would probably be a fit, however, the data could change in length. Because the length may change, I think some mechanism would need to be in place to defragment the file.


texts: So this is a weird one. I've looked it up but can't find anyone with similar issues. Basically I have a simple combat system and after the enemy health is zero I go through each rigidbody component in the enemy object and add a force to make it go flying on death. For some reason, the parent object isn't affected and stays still while the Skeleton goes flying. Does anybody know how to make the parent object follow the skeleton, or make the skeleton follow the parent because as of now they act as separate entities? I've tried just adding force to the parent but that only moves the parent object and none of the children. Would appreciate any advice! Thanks.


texts: Clipping Effect in Toon Boom Harmony 15.0

texts: I want to do similar effect like this tutorial Masking Effect. The tutorial using Toon Boom Studio 8, I'm using Toon Boom Harmony 15 and can't seem to find the Cliiping Effect they use in tutorial. Not even from Node View. Any advice to do the same effect ??


texts: How can I generate an infinite procedural road?

texts:
I'm currently trying to make a game where the player races others along an infinite, more-or-less straight, road.

By "more-or-less straight", I mean that the road goes straight ahead (the player can't turn their vehicle to face left or right), but there are bends in the road for them to pass through, as if they were switching from one lane to another on a highway.

There will also be different "areas" to race through (all on the same road), for example, deserts, jungles and over water.

And, finally, there will be gaps in the road for the player to jump over, as well as checkpoints every so often.

Starting with a seed, how can I generate the road ahead of the player as they race? I can't generate the entire road in advance (obviously), but each player needs to see the same thing at the same places along the track.

How can I do this?


texts: How can I implement rectangle collision response?

texts:
I am working on a game in JavaScript and my current implementation of collision uses the shortest distance to push the intersecting object away, which isn't always correct. I've made this diagram of the ideal collision. The red box represents the starting position, the green box represents the proper position and the black box represents the static object it is colliding against. The blue arrow is the velocity vector. With my current implementation, the object would be placed in its final position and pushed out (and in this case it would be pushed left)

How can I fix this?


texts: I can only find a user's manual for Cg 1.4 from Sept 2005, and the Cg Tutorial from earlier than that. Cg is now on version 3 and I'm wondering about all the new profiles and tech that must be in it... Anyone got some links?


texts:
How do I parse StarCraft 2 replay files (.sc2replay)? Is there an API?

I know of Sc2gears, but it doesn't quite fulfil my needs.