texts: How can I get into the educational market?

texts:
I believe that my current game project is very well-suited for educational gaming; so well-suited, in fact, that I know of several different schools (one community college and at least one or two high schools) that have used versions of it at some time or another. And that's without any such marketing on my part.

I'd like to expand on this part of the potential user base. But I have absolutely no experience in dealing with school administrations. How can I break into this market enough to be noticed?

And on a side note, could marketing the game as educational kill the gamers market?


texts: is it possible to use c# GUI toolbox in an XNA app?

texts: I need both reach GUI features of c# toolboxes and fast rendering features of XNA, is there any way to merge these two into one app? or is there any other way? for example some equivalent to c# toolbox in xna?


texts: How to prevent Unity3D generates unnecessary changes after saving scene with no actual changes

texts:
I was having trouble where Git shows a lot of changes (for my case, about ~3000 diff change since I have many objects in the scene) after saving scene (.unity file) in Unity3D, even though there are no changes made on the scene file (.unity file).

Upon checking, I noticed Unity3D recompiled the scene file and some values are just in a different order.
How do we prevent this from happening?
Steps to reproduce:

Open the scene file.
Disable and enable back any GameObject (just to trigger Unity to think there're changes, so you can save the scene file).
Save the scene file.


texts: How do I derive the angular movement for a craft

texts:
I have the regular (linear) motion implemented like this:

class Craft{
...
Vector location, velocity, acceleration, angularVelocity, angularAcceleration;

...
//the move class responsible for linear motion
//this method works
 public void move(Vector target){
  Vector desired = target.sub(location);
  desired.normalise();
  accleration.set(desired.multipied(speed));
  velocity.add(acceleratio);
  location.add(velocity);
}

//the turn method
//I need help/tips

public void turn(float angle){
//I need the craft to gradually turn in a circular motion
// so that eventually maybe 10 secs, it makes 360 degrees turn

}

}


texts: Clock hand, how much should I rotate the hand by every frame?

texts:
I've got a virtual clock.
The clock consists of the actual clock sprite, and a hand to go over it.

I'm able to set how long the clock duration is.
Say I set it to: 5 seconds.
While the clock time is going, it will eventually stop until it reaches 5 seconds.
Until it has reached 5 seconds, the hand will start rotating.

The hand should theoretically be at the same position it was when the clock was initialized.
So..the hand should go from 0 degrees to 360 degrees...

The only problem is...I don't know how many degrees I need to rotate the clock by every frame.
Like take the 5 seconds for example, how would I know how many degrees the hand needs to rotate based on those 5 seconds, until it has rotated around to 360 degrees?


texts: Algorithm for finding edge vertex points on a tilemap

texts:
I have a 2d tilemap array contains 1 or 0. 0 corresponds empty tile, 1 corresponds solid tile. If tile is 1 I draw a texture.
I have to find edge vertices and coordinates that 1's grouped.
I couldn't find a way to implement this algorithm. Is there a algorithm or approach I could use?
Red dots are the vertices I want their coordinates.


texts: Triangulation of "polygon with holes" for NavMesh

texts:
Just for fun, I am working on a little side-project: As a first step, I want to be able to build a grid-based world (think Dungeon Keeper), generate a nav-mesh for this world and then let agents wander around it. I've already done plenty of googling and ended up following the instructions given in the answer to this gamedev question: How can I generate a navigation mesh for a tile grid?

Now, I've completed step 1 in that I now have iso-lines representing the outlines of the walkable area. This could look like this:

The blue lines are the generated outlines of the walkable area. As you can see, in this case there is one walkable areas defined by two lines because the area is a circle.

This is where I'm stuck: If it were a regular polygon I'd probably be able to implement some sort of triangulation algorithm (there's plenty of examples on the net, I guess), but how do I go about this case? Do you have any pointers for me?


texts: Unity3D: AI follow player script for prefab enemy?

texts:
So I am having an issue, I have an enemy prefab that is created when the new wave happens(think of Nazi Zombies from Call of Duty, same system) but every script I have found that deals with ai following player always involves a public transform variable. The issue is that the object I put in that variable in the inspector does not save with the prefab, rendering the script useless. Is there anyway I can get the enemy prefab when the enemy spawns to follow the player?

He is a script I tried and failed due to the issue:

    //The target player
public Transform player;
//In what time will the enemy complete the journey between its position and the players position
public float smoothTime = 10.0f;
//Vector3 used to store the velocity of the enemy
private Vector3 smoothVelocity = Vector3.zero;

private void Start()
{
}

//Call every frame
void Update()
{
    //Look at the player
    transform.LookAt(player);
    //Move the enemy towards the player with smoothdamp
    transform.position = Vector3.SmoothDamp(transform.position, player.position, ref smoothVelocity, smoothTime)*Time.deltaTime;

}


texts:
I've been programming professionally for years using languages like VBScript, JavaScript, and C#. As a hobby, I'm getting into some c/c++ and games programming with DirectX.

I am running into an issue where I cannot create direct3d objects. I am using Visual C++ 2010 Express. After I installed vc++2010express I then installed the June 2010 release of DirectX.

I am trying to include DirectX via #pragma statements. This is the code I have so far in my winmain.cpp source file:

#include <Windows.h>
#include <d3d11.h>
#include <time.h>
#include <iostream>
using namespace std;

#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "d3dx11.lib")

// program settings
const string AppTitle = "Direct3D in a Window";
const int ScreenWidth = 1024;
const int ScreenHeight = 768;

// direct3d objects
LPDIRECT3D11 d3d = NULL; // this line is showing an error

The type LPDIRECT3D11 is showing an error:

Error: Identifier "LPDIRECT3D11" is undefined

Am I missing something here to get VC++2010Express to recognize and load the DirectX libs?

Thanks for any help.


texts: Receiving user commands in a text based console game

texts:
I'm working on a little text based console game for a bit of fun and am starting work on the user commands entered into the console.

Are there some good design patterns for deciding what to do with the commands the user enters into the console window?

My thoughts so far:

I've createed a basic query structure for obtaining the command and it's arguments. It works kinda as follows (the code is C#):

var userCommand = _getUserInputQuery.Invoke(new GetUserInputRequest
                                                {
                                                  FullCommandText = Console.ReadLine()
                                                });

I now have two items available to me in the userCommand. Firstly I have the name of the command as a string userCommand.UserCommand and secondly I have a string array of arguments userCommand.UserCommandArgs.

I figure there's a couple of ways I can now proceed with the information I have.

The most basic form could be a simple switch/if on the command name and invoke the relevant class/method required (seems a bit icky though).

I also figured given a generic interface for all commands IUserInputCommand I could create the class required using reflection and fire off a generic Invoke method from the interface. (Although I'm not sure how useful this will be given that some command invokations will require different data than others).

What are some design patterns already available for solving this kind of problem? What would you do personally?


texts: Find the current player instance from multiple scripts

texts:
I have the following code used by multiple classes (e.g. Enemy, Scenary, EnemyProjectile etc.) in my game, which seems intrinsically wrong. What are some ways I could write this code once and use it from multiple places?
        GameObject go = GameObject.Find("Player");
        if (go == null)
        {
            Debug.Log("Failed to find Player go");
        }
        else
        {
            _player = go.GetComponent<Player>();

            if (_player == null)
            {
                Debug.Log("Failed to find player component");
            }
        }

I usually have this code in an Awake function but sometimes I do it in a collision event, e.g. for EnemyProjectile grabbing a player handle would often not be required and thus a wasted lookup. Player is a private variable in the class definition of each class.


texts:
Currently I'm trying to localize a mobile game into popular language.

Apart from technical stuff (like how to store string and including supporting fonts),
I'm a bit confused about designing two things: choosing first language when they play game for the first time and changing between them

Currently, I already have several options about choosing first language:

Language is chosen programatically based on user's default
language/font
Ask user on first time run to choose which language thay want
Just set default language to english

About changing language, is it necessary to give user the option to change language? (assuming that my localization team is really good without any flaw when localizing this mobile game)


texts: Help understanding the parkour tutorial in Cocos2d

texts: I was practicing the parkour tutorial for chapter 7, but I failed to understand why we should move the same delta movement of this.gameLayer, which contains the background layer and the animation layer in opposite direction. Why do we do this?


texts:
Currently I am creating a forest scene in the dark, and the trees are shining far away, but when I get close they are fine. I have the shaders set to "Nature/Tree Soft Occlusion [bark/leaves]", but they are still rendering strange far away, but close they are fine.

I tried placing the trees in a folder named "Ambient-Occlusion" like said here, but no luck. Also fog is turned off. Thanks in advance.

UPDATE

When I looked at the trees using the "Render Paths" camera, they appeared red while everything else was green.

UPDATE 2

I have tried re-installing the package I downloaded these from, but still no luck.

UPDATE 3

I have added some trees manually, and they work fine, but when adding them by painting on the terrain I get the problem.

FINAL UPDATE

I tried building the game to see if this had the effect on the .exe, and it didn't. So I just have to ignore when I am debugging it, as it works fine on the build. Thanks for all the help, it just seems like an error with unity. Picture of build:


texts: Slow performance on an A* implementation in a tower defense game

texts:
I'm making a Tower Defense game in Flash with no predefined path.

Although my grid is 40x40 (small?), A* is struggling when recalculating every time. So I made my own modification to ease the recalculation and the touched cell count dropped to around 900 (when modifying near the root). It still freezes for a very short, but detectable, amount of time when a new tower is placed.

Is this an implementation problem, or is 40x40 just too much?

Edit:

The structure of my code:

All the data is saved in 2d array of cells.
Each cell contains its parent in path direction (1-8 clockwise) and bitwise encoded array of its children in path (every bit represents a child).
The search is performed by A* with the estimate of euclidian distance.


texts: Multiplayer architecture of shooter games

texts:
I've a doubt about synchronization on multiplayer games. In the case of the architecture of a game is like this:

Client tells to the server is shooting at this position, then the server simulates the same movement then tells to client if the enemy was hit or not.

I think in this type of architecture when a client has too much lag the information on shoot arrive very late on server. Could happen that if the client hits an enemy the same thing may not be happen on server that gets information too late, so the hit that is registered on client is lost.

I've noticed that when i've too much lag, all my hits are always registered.

So what I think is that the architecture of game is different of my proposed.

How "Overwatch", "CS:GO", or "Rainbow six siege" are handling this syncronization? It's possible that allow clients to send hit's information to server?


texts:
I'm wondering how I could create a shader that would turn a randomly generated shape like this:

And turn it into something more like this:

Essentially just creating a top down view of ocean waves that would flow in and out. I would prefer to be able to subtract this shape from a tilemap.

Any resources or pseudo code on how I could get started with this would be great.


texts:
I want to be able to draw 3D objects as well as 2D objects in an openGL environment. Normally, I would draw my 3D stuff, disable the depth buffer and depth mask, then draw my 2D stuff.

However, this creates a hassle. What if I have a single draw() function that is supposed to draw 3D and 2D? I would need to separate it, which I really don't want to do. I want to be able to do stuff like draw3D(...); draw2D(...); draw3D(...);

So is there a common way of doing this? I can think of a few solutions but would prefer to do it a standard way.

Here's a visual of the problem. My 2D text is interfering with my 3D environment:


texts:
I am storing one material ID per vertex in my meshes. In the shader for the mesh, I have a texture array full of textures that the material ID can refer to. The fragment color is chosen using triplanar texturing. Unlike vertex colors, these material IDs cannot be blended.

For example, if a dirt texture had a material ID of 5, and a grass texture had a material ID of 1, fragments in between one vertex with material ID 5 and one with material ID 1 would potentially have a material ID between 2 and 4, which is not ideal. Another flaw with this method is the fact that there would be a hard transition in between materials, as the mix or lerp function in the shader is not used.

Is there a way to blend the textures of two neighboring vertices in the fragment shader? I can add additional per-vertex data if needed.


texts: How does a wow server handle which player position to set to each nearest players?

texts:
I already understood how game developers could create very large game levels, bypassing the floating point precision limit.

This was my very first mind boggling question, and I understood it when I read how some programmer told the story of some dungeon PC game.

My question is more related to game networking, more precisely wow.

There are no interruptions in the game level (apparently I think).

Since the viewing distance is much smaller than the world size, and since there are a lot of players, you can't send all players positions because it would require too much bandwidth; so you have to only send the nearest players positions, among a pretty big list of connected players.

Those servers are almost always online, with a large number of players (only doing quests or idling into cities, since I guess dungeons and raids must be hosted on dedicated servers), and they must find a solution to save as much bandwidth as possible.

So at one point the server has to determinate which players positions it has to send to which players, and when it has to stop sending it.

I was wondering about how the server does this, because to me it seems to have O(n^2) or even an O(2^n) complexity.
How do they do it ? Do they fragment into virtual tiles so they only check players in the nearest tiles ? Do they calculate this not so often so that the server can handle it ?

A continuous online persistent world is quite awesome, but technically I don't really know how they do it.


texts: Does GPU mipmapping assume the texture es gamma corrected?

texts:
I have been reading the Real Time Rendering book and stumbled upon this paragraph:

  For textures encoded in a nonlinear space (such as most color
  textures), ignoring gamma correction when filtering will modify the
  perceived bright- ness of the mipmap levels [121]. As you get farther
  away from the object and the uncorrected mipmaps get used, the object
  can look darker overall, and contrast and details can also be
  affected. For this reason, it is impor- tant to convert such textures
  into linear space, perform all mipmap filtering in that space, and
  convert the final results back into nonlinear space for storage.

I have never taken into account gamma correction for color textures using mipmapping.

For generating mipmaps I have always used the GPU-implementation (OpenGL):

glGenerateMipmap

In the resources I have learned from, gamma correction has not been mentioned as something that has to be taken into account for mipmapping.

I was wondering, since color textures that include gamma correction seem to be the norm, are the GPU-provided filtering functions already taking into account gamma correction?


texts:
Basically what i have at the moment is a tile based game with a grid containing a number of colored cells.

this is what i've done so far

The prinipal idea of the game is that the user has to connect all the shapes with the same color. but when two (or more) cells of the same color join they cannot be separated.

for example:

the player cannot go from image 1 to image 2 because the blue cells are attached, it should become what is in image 3

i need help how to make the attached cells move as a unit not separately one by one (like in image 2 which is what i have right now).

each cell is a Cell object and they are held in an array like this:

private Cell[][] grid;

and this is the code i'm using to move the cells around.

public void move(int dx, int dy) {
  // if (dx == -1) ==> move left
  // if (dx == 1) ==> move right
  // if (dy == -1) ==> move down
  // if (dy == -1) ==> move up
    if (clickedCell == null) {
        return;
    }
    if (dx > 0) {
        if (clickedCol < numCols - 1) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow][clickedCol + 1];
            grid[clickedRow][clickedCol + 1] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow][clickedCol + 1].setPosition(x + (clickedCol + 1) * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            clickedCell = null;
        }
    } else if (dx < 0) {
        if (clickedCol > 0) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow][clickedCol - 1];
            grid[clickedRow][clickedCol - 1] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow][clickedCol - 1].setPosition(x + (clickedCol - 1) * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            clickedCell = null;
        }
    } else if (dy > 0) {
        if (clickedRow > 0) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow - 1][clickedCol];
            grid[clickedRow - 1][clickedCol] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow - 1][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 0) * Cell.SIZE);
            clickedCell = null;
        }
    } else if (dy < 0) {
        if (clickedRow < numRows - 1) {
            Cell temp = grid[clickedRow][clickedCol];
            grid[clickedRow][clickedCol] = grid[clickedRow + 1][clickedCol];
            grid[clickedRow + 1][clickedCol] = temp;
            grid[clickedRow][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 1) * Cell.SIZE);
            grid[clickedRow + 1][clickedCol].setPosition(x + clickedCol * Cell.SIZE,
                    y + (numRows - clickedRow - 2) * Cell.SIZE);
            clickedCell = null;
        }
    }
}

thanks in advance and by the way this game is built using LibGDX.


texts: Why can't I sample a texture in a vertex shader?

texts:
I'm old in Game Development but very new in shader writing. I just want a shader that transform from 1 texture to another. So I did start learning shader writing and wrote my desired shader. But during writing one thing I cannot understand as I am very dumb in shader writing that if I assign fixed4 color with COLOR semantic in vertex method then compiler gives the following error.

  Shader error in 'Hamza/TwoTextures': cannot map expression to vs_4_0 instruction set at line 39 (on glcore)

  Compiling Vertex program
  Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP UNITY_TEXTURE_ALPHASPLIT_ALLOWED

Here is the not working shader code,

Shader "Hamza/TwoTextures"{
    Properties{
        [NoScaleOffset]
        _Texture1 ("Texture 1",2D) = "white"{}

        [NoScaleOffset]
        _Texture2 ("Texture 2",2D) = "white"{}

        _Mixer ("Mixer", Range(0,1)) = 0
    }

    SubShader{
        Pass{
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            sampler2D   _Texture1;
            sampler2D   _Texture2;
            float       _Mixer;

            struct appdata{
                fixed4 vertex   : POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            struct v2f{
                fixed4 pos      : SV_POSITION;
                fixed2 tex      : TEXCOORD0;
                fixed4 col      : COLOR;
            };

            v2f vert(appdata i){

                v2f o;
                o.pos = mul(UNITY_MATRIX_MVP,i.vertex);
                o.tex = i.tex;

                // Giving error on this line
                o.col = (tex2D(_Texture1,i.tex) * _Mixer) + (tex2D(_Texture2,i.tex) * (1 - _Mixer));
                return o;
            }

            fixed4 frag(v2f v) : COLOR
            {
                return v.col;
            }

            ENDCG
        }
    }
}

And if I write same expression to throw it as return fixed4 value in fragment method then everything is working fine.

Here is working shader code,

Shader "Hamza/TwoTextures"{
    Properties{
        [NoScaleOffset]
        _Texture1 ("Texture 1",2D) = "white"{}

        [NoScaleOffset]
        _Texture2 ("Texture 2",2D) = "white"{}

        _Mixer ("Mixer", Range(0,1)) = 0
    }

    SubShader{
        Pass{
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            sampler2D   _Texture1;
            sampler2D   _Texture2;
            float       _Mixer;

            struct appdata{
                fixed4 vertex   : POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            struct v2f{
                fixed4 pos      : SV_POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            v2f vert(appdata i){

                v2f o;
                o.pos = mul(UNITY_MATRIX_MVP,i.vertex);
                o.tex = i.tex;
                return o;
            }

            fixed4 frag(v2f i) : COLOR
            {
                // It is giving me no error
                return (tex2D(_Texture1,i.tex) * _Mixer) + (tex2D(_Texture2,i.tex) * (1 - _Mixer));
            }

            ENDCG
        }
    }
}

Can anyone explain me that why it is happening? And what is the difference between them?

As I mentioned that I did start learning only two days before. I'm sort of noob in this.


texts: What version of Marching Cubes bring "ambiguities"

texts:
I am reading Eric Lengel’s paper about the Transvoxel algorithm.

In an early part describing the classical Marching Cubes (3.1.1), he talks about ambiguous cases. From what I understand, these can result from grouping the cases into “equivalence classes”.

However, in the Marching Cubes paper I read (is this the one he is referring to ?), there does not seem to be any grouping done, and each of the 256 cases produces its own triangulation. For example, taking the case of Lengyel’s figure 3.2 (on page 12 of the first document), the left cube has index 189 (vertices 0 2 3 4 5 7) and the right cube index 24 (vertices 3 and 4), which gives non “equivalent” triangulations: 4 triangles for the left cube, and 2 for the right cube.

To phrase this as a question: are there different versions of Marching Cubes, and could Lengyel be referring to a different one than Paul Bourke's ?


texts:
No, I'm not talking about foreach. I have the following list:

public List<float> angles = new List<float>(new float[] { 0, 90, 180, 270 });

This list can vary depending on the object I use, having only 0 and 90 or all except 270 for example.

What I want to do is have a rotClockwise and rotCounterClockwise function that grabs the value before or after a given value. Here's some pseudo code:

function float rotClockwise(angle) {
    return angles.grabNextAngle(angle);
}

function float rotCounterClockwise(angle) {
    return angles.grabPrevAngle(angle);
}

So calling rotClockwise(90) would return 180, rotCounterClockwise(90) would return 0, rotClockwise(270) would return 0, etc.

How can I accomplish this? Is there a list type that allows me to loop back to the beginning when I reached the end?


texts: How do I interpolate around a rectangle?

texts:
I want to make a fancy animation where a point travels around a rectangle. I want to find the point's position at a time t.

The rectangle is given by X, Y, Width and Height.

Is there an algorithm for this?

I've used sin/cos for circles. What's the equivalent approach for rectangles?


texts:
I was reading through this: using-hardware-scaler-for-performance and am a little confused by it.  It says all you need to do to invoke the scaler is to set it like so:

surfaceView = new GLSurfaceView(this);
surfaceView.getHolder().setFixedSize(1280, 720);

They says to use a fixed size for all devices.  On my Google Nexus 10 (which has a resolution of 2560 x 1600).  I've used 1280*800.  It then goes on to say that the system will scale it to match the device's actual resolution.

So this is what I get:

What am I missing here? Unfortunately the above link says that examples will be added soon but as yet there is nothing.


texts: How and when do the model to world, world to view, et cetera multiplications happen?

texts:
I learn matrix transformations for game design and I struggle with some basic concepts. I see the actual multiplication taking place before rendering in this sequence:

MODEL into WORLD: multiply each model's vertex by worldMatrix. If
the model is big it's a bit of a stress for GPU.
WORLD into VIEW: well, if Model to World was bad, than multiplying the whole world full of models by some matrix is a huge burden on GPU. Why then in every book authors say that is much better to do exactly this? The VIEW is just a point (one vertex) it's much easier to change one vertex than millions.
Well any other steps in this sequence are irrelevant to me right now. I just stuck in 2. cause I don't believe that any one will perform such multiplications.

I'm sure no one multiplies world vertexes by any matrix, If i'm right here then and HOW the whole multiplication stack of transformation happens? I guess I'm missing some low level understanding.

P.S. So to stress my point:
 Why multiply the whole world by anything? I will only see the part of it! How this huge multiplication is avoided in game engines (openGL, ect).?

P.S.S. Thanks for answers guys! Huge job just to help the me___ Those are the most detailed answers I've evere gotten on any stachexchange forums. :)

P.S.S.S. I come from 2D visualization of financial data. Some of you point out that it can be the reason of my missunderstanding about why every world object must be processed. My pipeline:

object\model space = is just a data serie with bunch of bars and prices. It's a 2D object with "bar" units in X direction and "price" units in Y direction. So by using "i" Serie.bar[i] one navigates in this array. I usually say that data series is in "array space"  since I use "i" to navigate therer.
world space = where 2 data series can co-exist. For example you have price of Google and Tesla in the same chart stacked on top of eachother for analisys of correlation.
Camera space - a 2D rectangle in world coordinates. For example camera.width=300bars, camera.X =11000bar, camera.Y=33 $ per share.

Using mouse, user changing only camera (that's why it's super wired for me when someone says that view should not be moved and the world should be moved around). Camera coordinates change and when it is time to render, you just look inside camera and do such thing:

for (int i = camera.left; i < camera.right; i++)
{
g.DrawSerie(google.bar[i]);
}

So you see, there is no need in and world transformation here. I know all I need before rendering thanks to "camera being in world coordinates". I guess you can't do in in 3D, but some details are still missing for me.


texts: Quaternion rotation, translation, scale or 4x3/4x4 matrices for Skeletons?

texts:
I'm modding a game that uses 4x3 and 4x4 matrices to make skeletons, but I saw that an skeleton can also be made with a quaternian rotation and vector translation and scaling.

What's the difference between both? The first one has more values, I suppose, but, which is better?

If I have a 4x3/4x4 matrices skeleton, can I transform it in some way to the rotation, translation and scaling?


texts: Has anyone used PhoneGap to make 2D games for the iPhone?

texts:
I love simple casual games. I've been riding the bus a lot recently and so simple, no-brainer games are great fun and well worth the small price I pay on the App Store.

It got me thinking... I know HTML5, CSS3 and JS very well. I looked into PhoneGap and it looks like it's something I could use for making apps for the iPhone.

The games I've been fleshing out myself are very simple 2D affairs. Fun, simple and high quality. That's what I'm after with my games... I also make music and my friend is an digital illustrator so together we have all the media covered.

Does any one make 2D games for the iPhone using PhoneGap?

I'm presuming that because I want to code in JS and use the HTML5 Canvas tag, that PhoneGap does nothing more than provide me a wrapper with a WebKit view?

I know it won't be as fast as using native... But is using PhoneGap a viable option?


texts: How to take into consideration gravity when moving AI

texts:
I'm making a 2D game. There is currently a helicopter flying around, controlled by the player. It's controlled using the arrow keys: UP, LEFT and RIGHT.

It's speed along the y axis is dy, and speed along the x axis is dx.

It's physics is as follows:

Whenever UP isn't pressed, dy accelerates in constant acceleration, indefinitely towards down. (Gravity). dx stays in it's current value.

When UP is pressed, dy accelerates in constant acceleration from whatever it currently is, up to 4 (upward, until it reaches speed 4). dx stays in it's current value.

When LEFT is pressed, dx accelerates in constant acceleration, from whatever it currently is, up to -4.

When RIGHT is pressed, dx accelerates in constant acceleration, from whatever it currently is, up to 4.

(When LEFT or RIGHT are pressed and UP is not pressed simultaneously, as I said: dy increasingly becomes smaller and smaller, because gravity is affecting the helicopter)

All of this makes the helicopter often follow arches in the air, rather than straight lines.

This creates physics that seem quite realistic.

My question is:

The opponent helicopter, an AI, should move using the same physics system.

Lets say the AI wants to get from where it currently is, to point B.

If there was no gravity and no gradual acceleration in the game, it would be easy. I would simply draw a vector from the AI's position to point B, and make the AI follow it.

But since there is gravity and gradual acceleration, the AI can never move in a straight line (almost). what would be the best way to make the AI go to point B, as time-efficiently as possible?

How can I take the gravity into consideration when moving the AI toward a specific destination?

(If it's easier to explain, please consider point B to be on the same level on the y-axis as the AI, and not in diagonal to it.)

Thanks


texts:
I wish to achieve a snowing effect on my game. The game is made in LibGDX and im using ParticleEmitter. I created a snow effect in ParticleEditor which consists in a line which spawns snow flakes. The problem is:

First, and the most important, since the game movement is vertical (its a jumper), if i just place the line above the screen, the jumping makes it look unnatural since when im jumping up, and the camera follows me, the particle emitter also has to move up, and the snow flakes are spawned with a bigger vertical distance; And when Im going down from the jump, a section of closer snowflakes is spawned due to that occurence. That makes the snow visually inconsistent.

Second, i wanted the snow to show up filling the screen from the start, instead of it starting to follow when the emitter is started.

To try to fix the first problem, i made the snow screen static, but it looks horrible, i really want the feeling that the snow is falling and my character is going up against it.

Any ideas how to achieve such an effect?


texts: Character progression through leveling, skills or items?

texts:
I'm working on a design for an RPG game, and I'm having some doubts about the skill and level system. I'm going for a more casual, explorative gaming experience and so thought about lowering the game complexity by simplifying character progression. But I'm having trouble deciding between the following:

Progression through leveling, no complex skill progression, leveling increases base stats.
Progression through skills, no leveling or base stat changes, skills progress through usage.
Progression through items, more focus on stat-changing items, items confer skills, no leveling.

However, I'm uncertain what the effects on gameplay might be in the end. So, my question is this:

What would be the effects of choosing one of the above alternatives over the others?
(Particularly with regards to the style and feel of the gameplay)

My take on it is that the first sacrifices more frequent rewards and customization in favor of a simpler gameplay; the second sacrifices explicit customization and player control in favor of more frequent rewards and a somewhat simpler gameplay; while the third sacrifices  inventory simplicity and a player metric in favor of player control, customization and progression simplicity.

Addendum: I'm not really limiting myself to the above three, they are just the ones I liked most and am primarily interested in.


texts: What are the pros and cons of non-unique display names?

texts:
I know of at least big title game (Starcraft II) that doesn't require unique display names, so it would seem like it can work in at least some circumstance.

Under what situations does allowing non-unique display names work well?  When does it not work well?

Does it come down to whether or not impersonation of someone else is a problem?

The reasons I believe it works for Starcraft II is that there isn't any kind of in-game trading of virtual goods and other than "for kicks" there isn't much incentive to impersonate someone else in the game.  There's also ladder rankings so even trying to impersonate a pro is easily detectable unless you're on a similar skill level.

What are some other cases where it makes sense to specifically allow or disallow duplicate display names?


texts: Physics.CheckSphere never returning true despite being called to where a hitbox is

texts:
I'm trying to create a random level generator where I have a load of rooms 16x10 and I generate them when the player enters the room. I want to check the space where I want to place a room, in this case up for if there's already a room there. I've written this code to do that but it doesn't appear to be working. Currently it should ALWAYS return true (and not run the code) because the object it is on has a hitbox. I want it to hit triggers because then I don't need a physical block in the centre of every room (hard when the rooms are even both ways)

Can you see what's wrong here? The code does spawn a block in the correct place.

if (!Physics.CheckSphere(new Vector2(transform.position.x, transform.position.y), 1f, 6, QueryTriggerInteraction.Collide))
        {
            //Get list of open bottoms
            getList("Assets/Room Lists/bottom.txt");
            //Make a random number from the list
            int newRoomIndex = random.Next(0, prefabObjects.Count);
            //Get that object
            GameObject newRoom = prefabObjects[newRoomIndex];
            //Place it in the world in the correct position
            Instantiate(newRoom, new Vector3(transform.position.x - 8, transform.position.y + 15, transform.position.z), Quaternion.identity);
        }


texts: How to store each rendered frame as image in libgdx for debugging

texts:
I have a libgdx screen's render method where I am executing lots of for loops and drawing various shapes on screen in thoese loops. Also I am manupulating (x,y) of each shape at runtime to acheive a smooth animation.Everything was ok until,

Issue: Recently I had added few more shape's at some positions in my screen. Due to some mess up, I am getting flicker, and some shapes are getting drawn out of my game world.

I tried to debug my code many times but there are too many loops and shapes so I am unable to pin point the exact loop or frame where shapes are getting drawn out of my game world.

Need Input on following approach to debug:

So I was thinking to save each frame of my render method as an image locally. Is it possible? Please provide suggestions or sample code to acheive it.

I will hook up some debug variables in my loops to calculate exact frame where things are getting messed up. That I will take care of.  Please advice on above question.

Thanks in advance.


texts: How to start building the racing levels in unity?

texts: I had an idea of making more fun less redundantly designed level for a racing game, i have core mechanics and ui of the game sorted out but i m confused where to begin with the levels and how do i structure them. link of any sites that focusses on this would be greatly helpful.


texts: Programmatically determine UVs by rotating a plane along X axis

texts:
I'm having a math brainfart while trying to solve what might be a simple problem.  I've got a plane in 3d space (it's actually the face of a 10-sided die):

Coordinates [x,y,z]:
Point_top  = [0,0,1]
Point_left = [Sin (2pie9/10), Cos(2pie9/10), 0.1] = [-.5878,.809,.1]
Point_right= [Sin (2pie/10) , Cos(2pie/10), 0.1]  = [ .5878,.809,.1]
Point_bot  = [-1,0,-0.1]

If you project that out, it's a plane with the top leaning back away from you, and the bottom closer to you.

I'm trying to automatically build a UV map of that face to put a texture on, so think I should rotate it around the x-asix so that it's only in 2D, then scale that to best fill up a 256x256 texture.  I'm doing this in Three.JS for a canvas app.

Is this the right approach?  In this example:
http://wecreategames.com/games/DiceBoard ( die creation code is in: http://wecreategames.com/games/DiceBoard/die10.js ), I'm estimating the UVs by:

//Build UVs
scope.faceUvs = [[]];
scope.faceVertexUvs = [[]];
for (var f = 0; f < numHalfFaces; f++) {
    var faceuv = [
        new THREE.UV(.2, .6),
        new THREE.UV(.5, .75),
        new THREE.UV(.8, .6),
        new THREE.UV(.5, .2)
    ];
    scope.faceUvs[0].push(new THREE.UV(0, 1));
    scope.faceVertexUvs[0].push(faceuv);
}

But when I view on an iPhone or Android, it shows weird screen artifacts... I'm thinking because the UVs aren't exact.

I think I'd apply some function like this (where andDist is an angle):

rx = x;
ry = (y * Math.cos(angDist)) - (z *Math.sin(angDist));
rz = (y * Math.sin(angDist)) + (z *Math.cos(angDist));

But, I'm not sure how to get the angle that the face is inclined at. Any suggestions?  Or, are those white screen artifacts due to something else I've overlooked?


texts: stats or profit give away result of game

texts:
Think of a coinflip game, whose logic looks as follows:

Server sends websocket message (RESULT_MESSAGE) to frontend with result of a game (won/lost)
Server sends websocket message to frontend with updated aggregated stats (STATS_MESSAGE) (think all-time profit after the new coin flip, or updated all-time stats)
Frontend reacts to RESULT_MESSAGE by playing an animation (coin flipping). It also updates the all-time stats and profit in response to STATS_MESSAGE

The problem with this logic is, responding to STATS_MESSAGE (updating profit and stats) gives away the result of the coin flip before the animation finishes.

Solutions I cannot use:

Merging RESULT_MESSAGE and STATS_MESSAGE together, and only updating the  stats/profit after animation finishes. Because those 2 messages are produced and sent by different services.
Linking a particular RESULT_MESSAGE to a STATS_MESSAGE and only reacting to a STATS_MESSAGE when its corresponding RESULT_MESSAGE has been processed and its animation completed. Because in reality I have several kinds of STATS_MESSAGES (trophies updated, stats updated, profit/balance updated, etc), and it's just not practical for the frontend to hold onto all those messages until their respective RESULT_MESSAGE is processed

Solutions I've tried successfully before, but I'm trying to avoid:

Having the backend send STATS_MESSAGE with a delay, to make sure it doesn't reach the frontend before the coinflip animation has finished. This sort of encodes frontend behavior (animation) on the backend.

All ideas and suggestions appreciated. Thanks a lot!

EDIT: I made the coin-flipping example for simplicity, but it's not precisely con-flipping. It's a multiplayer game where dozens of games/animations per user per seconds are going on. So queuing a bunch of stuff on the frontend might be less than ideal (I'm still looking into performant versions of this solution though).

Pulling the STATS data via an API call when the animation finishes (instead of using websockets data) is another alternative that I've considered, but for the same reason described above it might not be feasible (dozens of API calls per user per second). Plus there's a chance that an API call is triggered by game-1 finishing, but while game-2 animation is still going on, giving away the result of game-2


texts: Return different components by name in entity component system

texts: I'm working on an entity component system but I'm having trouble with the editor. Components take the form of structs with this formula Component healthComponent; This works fine when you know what component you want but for the game editor I'm working in a dynamic way and need to be able to simple get any component of an entity by string for example auto component = GetComponent("Health", entityId); I know c++ is strongly typed so is there any work around for this?


texts: How can I render text above a mesh in DirectX 9?

texts:
I want to render some text over a mesh in my DirectX app. It will have a similar application to health bars for units in games, just as text rather than a bar. I'm looking for the simplest way to do this.

It's a Win32 app, I'm using DirectX 9 and I need it to be in 3D (i.e. when the unit is moving around the Z-axis, the text above moves with it).

Any ideas?


texts: Why does my sprite player move faster when I move the mouse?

texts:
I'm trying to develop a simple game made with Pygame (Python library).

I have a sprite object which's the player and I move it using arrow keys. If I don't move the mouse, the sprite moves normally, but when I move the mouse, the sprite moves faster (like x2 or x3). The player object is inside the charsGroup var.

I've run the game in W7 and in Ubuntu. Same thing happens in both OS.

I have more entities which move like NPCs and bullets but they don't get affected, just the player. Given this, I think that the problem maybe has a direct connection with the player moving system (arrow keys).

Here is the update() method of the player object:

def update(self):

    for event in pygame.event.get():
        key = pygame.key.get_pressed()
        mouseX, mouseY = pygame.mouse.get_pos()
        if event.type == pygame.MOUSEBUTTONDOWN:
            self.bulletsGroup.add(Bullet(pygame.image.load("bullet.png"),
                                          self.rect.x + (self.image.get_width()/2),
                                           self.rect.y + (self.image.get_height()/2),
                                            mouseX, mouseY, 50, 50))

        if key[pygame.K_RIGHT]:
            if not self.checkCollision():
                self.rect.x += 10
            else:
                self.rect.x -= 10
        if key[pygame.K_LEFT]:
            if not self.checkCollision():
                self.rect.x -= 10
            else:
                self.rect.x += 10
        if key[pygame.K_UP]:
            if not self.checkCollision():
                self.rect.y -= 10
            else:
                self.rect.y += 10
        if key[pygame.K_DOWN]:
            if not self.checkCollision():
                self.rect.y += 10
            else:
                self.rect.y -= 10

And here is the while loop:

while True:

    if PLAYER.healthBase <= 0:
        GAMEOVER = True

    if not GAMEOVER:
        mapTilesGroup.draw(SCREEN)
        charsGroup.update()
        charsGroup.draw(SCREEN)
        npcsGroup.update()
        npcsGroup.draw(SCREEN)
        drawBullets()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()

    if GAMEOVER:
        myfont = pygame.font.SysFont("monospace", 30)
        label = myfont.render("GAME OVER!", 1, (255, 255, 0))
        SCREEN.blit(label, (400, 300))

    freq.tick(0)

    pygame.display.flip()

I don't know what more you can  need to help me, but anything you need (more info or code) just ask for it!


texts:
I'm on my way with a tiled based game. I have correctly implemented scrolling, position handling etc.

I have (before) had a simple collision system that is a really bad one, and now I'm going to switch from simple x and y checks to AABB.

The real problem isn't really about AABB itself, since I've made a simple application demonstrating the technique - it works like intended. This is for singular, independent objects that is static.

Since I know the technique and how to resolve collisions correctly I wanna apply this AABB technique to my tile world. It is now the real problem (or question?) arises.

Since the world is built on tiles and the world's objects is built together to a world, how would I implement the AABB? Before it was only for single static objects, now for a whole world. Is it possible to create a single world static object or are there any better idea out there?

Should I create a single box for every single tile in the world? It doesn't sound well, but how should I fight this problem down?

Any help is appreciated!

Comments to Nick's answer:

  Considering what you've said about how you previously had a "simple collision system that was a really bad one", I assume you want the latter.

That's correct. The previous collision system made my character get stuck in tiles and it wasn't working properly.

  So you can see how it will haphazardly overlay your four tiles. Your AABB for the object then is a rect with x=7, y=10, w=12, h=15. Let's say this is your only obstacle in the world.

I understand, I think. Does this necessarily mean I have to create a single AABB for every tile?

  You can see that due to his width and height, he now overlaps the top left of your obstacle at {7,10}. So resolve the collision. That's all there is to it.

Yep, that part I understand. For now, the world is built from a single 2D array, but is it really efficient to create an AABB for every obstacle?

Oh, I think it does not really matter if I only loop through the obstacles and tiles in the area where the player is..


texts: How to reapply force applied to one object to another object

texts:
Edit: While I wasn't able to make the code work completely, I believe my question has been sufficiently answered.

I want to make two objects move, react to collisions and other stuff as if they were one.

For example, Objects A and B are entangled.

When Object C rams into Object A and starts moving with it, Object B should start moving with it. When Object B hits a wall, Object A should act like it also hit a wall.

I tried changing position/speed every frame, but this only works when done in one direction.

Now, I want all forces applied to any of the objects to also apply to the other objects entangled to it.

EDIT: The next step is making the thing work with one of the objects moving along a different axis(e.g. the opposite direction of the others) and at a different scale (e.g. speed is proportional to size). So fixed joints, while a working solution for the simplified version of the problem, don't work for me.

UPDATE: Here's the code so far, trying to figure out how to send the other object spinning in the same way as the first one, not sure how to set the position for the force(s?) applied

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

[RequireComponent(typeof(Rigidbody))]
public class EEScript : MonoBehaviour
{
    public List<GameObject> activeObjects;

    // Start is called before the first frame update
    void Start()
    {
    }

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

    private void OnCollisionStay(Collision collision)
    {
        OnCollisionEnter(collision);
    }

    private void OnCollisionEnter(Collision collision)
    {
        Rigidbody rigidbody = gameObject.GetComponent<Rigidbody>();
        foreach (GameObject obj in activeObjects)
        {
            Rigidbody rb = obj.GetComponent<Rigidbody>();
            if (rb is null || rb.gameObject==gameObject) continue;
            Debug.Log(collision.gameObject.name+"->"+obj.name);

            for (int i = 0; i < collision.contactCount; i++)
            {
                ContactPoint co = collision.GetContact(i);
                Vector3 relativePoint = co.point - rigidbody.centerOfMass;
                Vector3 normal = co.normal;
                Vector3 impulse = collision.impulse;
                if (Vector3.Dot(normal, impulse) < 0f) impulse *= -1;
                rb.AddForceAtPosition(impulse, relativePoint + rb.centerOfMass, ForceMode.Impulse);
            }
        }
    }
}


texts:
I am writing a 2D game with cocos2d-x. I want to put a "shadow" sprite on a background sprite using the equation:

  MAX(0, Cd * 1 - Cs * S)

where Cd is the destination color (that is, a background pixel), Cs is the source color (the shadow pixel), and S is the scale factor (between 0 and 1).
The MAX() function is used to avoid negative results. This is a lighting effect: when the shadow sprite pixel is 0, there is no effect on the background
pixel, otherwise, the background pixel becomes darker.

Now, the only way that comes to my mind is to change the blending equation to GL_FUNC_SUBTRACT, but it doesn't compile with cocos2d-x (can't found it).

I would subclass the CCSprite class in order to implement the draw() method in order to change, when needed, the blending equation, call the original draw() method and restore the blending equation to its previous state at the end of the method.

So my questions are two:

How to use glBlendEquation() with cocos2d-x? Keep in mind that I am writing a game for iPhone/Android/Windows.
Are shadows handled this way in 2D games?


texts: What edition of VS is installed by Unity and what are its capabilities?

texts:
My brother just installed Unity on my desktop, and it seems like it installed Visual Studio 2017 as well.

I was planning to install Visual Studio before this, so I was wondering what kind of version is this edition of VS? Is this like a bare-bones version? Does it work like a standalone version without lacking features? Can I use it just as a regular IDE to program in?

I typically program in C++, and I never used Unity before, so I'm not sure if this version of VS is only suited for Unity.


texts:
How can I change the texture at runtime. I have done changing the label(text) at runtime. The following code is used

using UnityEngine;
using System.Collections;

public class switchtime : MonoBehaviour {

    // Use this for initialization
    private bool showLabel = false;
    private bool showLabe2 = false;
    private bool showLabe3 = false;
    private bool showLabe4 = false;

    public void Start() {
        Invoke("ToggleLabel", 1);
        Invoke("ToggleLabel2", 3);
        Invoke("ToggleLabel3",6 );
        Invoke("ToggleLabel4", 9);
    }

    public void ToggleLabel() {
        showLabel = !showLabel;

    }
    public void ToggleLabel2() {

        showLabe2 = !showLabe2;
    }
    public void ToggleLabel3() {

        showLabe3 = !showLabe3;
    }
    public void ToggleLabel4() {

        showLabe4 = !showLabe4;
    }

    public void OnGUI() {
        if (showLabel) {
            GUI.Label(new Rect(300, 200, 100, 20), "Copying window file..");

        }
        if (showLabe2) {

            GUI.Label(new Rect(40, 40, 100, 20), "Epanding windows file..");
        }
        if (showLabe3) {

            GUI.Label(new Rect(80, 80, 100, 20), "Installing Feature..");
        }
        if (showLabe4) {

            GUI.Label(new Rect(100, 100, 100, 20), "Installing Updates");
        }
    }
}

Now I need to change the GUITexture at runtime. How can do this? Can anybody help me in coding?

Here is some changes I made. I worked on changing the gameObject when mouse is placed on it. This is the code I applied and its working for me

using UnityEngine;
using System.Collections;

public class change : MonoBehaviour {

    // Use this for initialization
    public GameObject newSprite;

    private Vector3 currentSpritePosition;
    void update()
    {
    }

    void Start()
    {
        newSprite.renderer.enabled = false;
        currentSpritePosition = transform.position;

        //then make it invisible
        renderer.enabled = false;

        //give the new sprite the position of the latter
        newSprite.transform.position = currentSpritePosition;

        //then make it visible
        newSprite.renderer.enabled = true;
    }

    void OnMouseExit(){
        //just the reverse process
        renderer.enabled = true;
        newSprite.renderer.enabled = false;
    }
}

Now the problem is that, in same code I need to set a time so that the text get loaded without the mouse click. I mean a particular time to load each text one after the another.

Here  is my screen shot

Here I have placed the image one below the another,when the mouse is hovered on it it will change the text from bold to normal text.Changes process stated in (image 2,3).That code I posted is working for me.


texts: How to draw unlimited FPS on Mac OS X with OpenGL?

texts:
I d'like to draw as many frames as possible with OpenGL on Mac OS X to measure the performance on different scenes.
What I've tried so far:

Using a CVDisplayLink that has NSOpenGLCPSwapInterval set to 0, so it does not sync with the Display. But with that it's still stuck at max 60FPS
Using normal -drawRect: with a timer that fires 1/1000sec and calls -setNeedsDisplay: Still not more than 60FPS
Same as 2. but I call -display in the timer callback. With that I get the FPS above 60, but it still stops at 100-110 FPS. Although the frame rate should easily be at 10times more.

Andy idea how I can really draw as many frames as possible?


texts:
Im not sure if i use the right terms, but im not able to find something to start with.

Im trying to develop a little HTML5 game. I have a ground with a texture and now I want to make a surrounding texture. The texture is an image wich should be bend around the ground.

At the moment im using easelJS for display my images/textures. So im looking for some sort of Tutorial/Script/Advice. Im not even sure if I can bend a image in javascript. So the worst case I can think of is split the image in 100 pieces and then put it back together and rotate each piece.

for example like this:


texts: Scaling a rotated child with parent-child transforms

texts:
In unity, if you parent something to another object, then give the child some rotation, and scale the parent, the scale applies to some arbitrary axis to the child, here's some pictures to demonstrate:

Now I scale the Z axis of the parent object and this happens:

My from scratch game does not do this. Rather it applies the parent scale along the same local axis on the child, so you get this:

I don't know how to achieve Unity's scaling behaviour though. Right now transformations are combinations of standard transform matrices that are just applied child to parent. Like this:

Matrixf child = Matrixf::Translate(childTrans) * Matrixf::Rotate(childRotation) * Matrixf::Scale(childScale);
Matrixf parent = Matrixf::Translate(parentTrans) * Matrixf::Rotate(parentRotation) * Matrixf::Scale(parentScale);

Matrixf worldChildTransform = parent * child;

Transform matrices defined as such:

inline static Matrix Translate(Vec3<T> translate)
{
    Matrix mat;
    mat.m[0][0] = T(1.0); mat.m[0][1] = T(0.0); mat.m[0][2] = T(0.0); mat.m[0][3] = translate.x;
    mat.m[1][0] = T(0.0); mat.m[1][1] = T(1.0); mat.m[1][2] = T(0.0); mat.m[1][3] = translate.y;
    mat.m[2][0] = T(0.0); mat.m[2][1] = T(0.0); mat.m[2][2] = T(1.0); mat.m[2][3] = translate.z;
    mat.m[3][0] = T(0.0); mat.m[3][1] = T(0.0); mat.m[3][2] = T(0.0); mat.m[3][3] = T(1.0);
    return mat;
}

inline static Matrix Rotate(Vec3<T> rotation)
{
    // This is a body 3-2-1 (z, then y, then x) rotation
    const T cx = cos(rotation.x);
    const T sx = sin(rotation.x);
    const T cy = cos(rotation.y);
    const T sy = sin(rotation.y);
    const T cz = cos(rotation.z);
    const T sz = sin(rotation.z);

    Matrix res;
    res.m[0][0] = cy*cz;    res.m[0][1] = -cx*sz + sx*sy*cz;    res.m[0][2] =  sx*sz + cx*sy*cz;    res.m[0][3] = T(0.0);
    res.m[1][0] = cy*sz;    res.m[1][1] =  cx*cz + sx*sy*sz;    res.m[1][2] = -sx*cz + cx*sy*sz;    res.m[1][3] = T(0.0);
    res.m[2][0] = -sy;      res.m[2][1] = sx*cy;                res.m[2][2] = cx*cy;                res.m[2][3] = T(0.0);
    res.m[3][0] = T(0.0);   res.m[3][1] = T(0.0);               res.m[3][2] = T(0.0);               res.m[3][3] = T(1.0);
    return res;
}

inline static Matrix Scale(Vec3<T> scale)
{
    Matrix mat;
    mat.m[0][0] = scale.x;  mat.m[0][1] = T(0.0);   mat.m[0][2] = T(0.0);   mat.m[0][3] = T(0.0);
    mat.m[1][0] = T(0.0);   mat.m[1][1] = scale.y;  mat.m[1][2] = T(0.0);   mat.m[1][3] = T(0.0);
    mat.m[2][0] = T(0.0);   mat.m[2][1] = T(0.0);   mat.m[2][2] = scale.z;  mat.m[2][3] = T(0.0);
    mat.m[3][0] = T(0.0);   mat.m[3][1] = T(0.0);   mat.m[3][2] = T(0.0);   mat.m[3][3] = T(1.0);
    return mat;
}

EDIT: Some more information about the matrices in this specific case:

Given this configuration

Parent position = (0, 0, 3)
Parent scale = (0.5, 0.5, 0.2)
Parent rotation = (0, 0, 0) (euler angles, radians)

Child local position = (0, 0, 4.2)
Child local scale = (1, 1, 1)
Child local rotation = (0, 0.9, 0) (euler angles, radians)

Then we have the following matrices

Child (combined translation, rotation and scale)

{0.621609986, 0.000000000, 0.783326924, 0.000000000}
{0.000000000, 1.00000000, 0.000000000, 0.000000000}
{-0.783326924, 0.000000000, 0.621609986, 4.19999981}
{0.000000000, 0.000000000, 0.000000000, 1.00000000}

Parent (combined again)

{0.500000000, 0.000000000, 0.000000000, 0.000000000}
{0.000000000, 0.500000000, 0.000000000, 0.000000000}
{0.000000000, 0.000000000, 0.200000003, 3.00000000}
{0.000000000, 0.000000000, 0.000000000, 1.00000000}

Then parent * child gives this:

{0.310804993, 0.000000000, 0.391663462, 0.000000000}
{0.000000000, 0.500000000, 0.000000000, 0.000000000}
{-0.156665385, 0.000000000, 0.124321997, 3.83999991}
{0.000000000, 0.000000000, 0.000000000, 1.00000000}


texts: Unity stop sprite moving when hit be another sprite

texts:
I have two dots/points that move onto the screen at start. I have a pencil move and when collide with the points the pencil writes which all works ok.

My problem is when the pencil RigidBody hit the RigidBody of the point, the point gets pushed out fo position. I cant change the point RigidBody  to static because I need to move it at the start.

pencil script

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.name == "Point")
    {
        writing = !writing;
    }
}


texts: How to correctly handle multiple Songs in XNA?

texts:
I'm working on a (Windows-only) game in XNA, and I have multiple music tracks. I don't want to load them all into memory, but play them on demand. To properly dispose them, I have a separate ContentManager just for music and a method that looks like this:

    public void PlayMusic(MusicTracks trackToPlay)
    {
        if (trackToPlay == _currentlyPlayingTrack)
            return;

        MediaPlayer.Stop();
        _musicContentManager.Unload();

        Song song = null;
        switch (trackToPlay)
        {
            case MusicTracks.TitleMusic:
                song = _musicContentManager.Load<Song>("TitleMusic");
                break;
            case MusicTracks.CreditsMusic:
                song = _musicContentManager.Load<Song>("CreditsMusic");
                break;
        }

        if(song != null)
        {
            MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = true;
        }
        _currentlyPlayingTrack = trackToPlay;
    }

(MusicTracks is an enum).

Is this the correct way to make sure I'm not using more RAM/Resources than required? Or should I be looking into XACT? To be clear, I don't need to play multiple Songs at the same time (I do need to play 1 Song and a few SoundEffects though) and I don't need any crazy effects apart from setting the Volume of the music independently from the soundeffects, which should be straight forward with MediaPlayer.Volume.


texts: Structuring server-side networking with entity-component systems

texts:
I've been working on an online game, and recently have been working on converting the base of the game to use the Artemis Entity System Framework. I'm having a bit of difficulty conceptualizing exactly how the server networking should be changed to work with this approach.

My original approach was to have each session receive packets, attach session information to them and then push them to a master queue. I then had a seperate thread (let's call it InputHandler) which was responsible for removing packets from the master queue and processing them. During the packet handling, this thread can add packets to be sent to clients to an output queue. I then have another thread (let's call it OutputHandler) read from the output queue and dispatch the packets to the appropriate sessions (for example if a packet needs to be sent to all sessions or a single sesion).

My initial idea when converting to use Artemis was to have yet another thread (WorldProcessor) take care of doing all the entity processing (this is where AI, general logic, automatic saving, etc. would be done). However I realized that I could no longer do things such as adding entities from the InputHandler thread as it could cause concurrency issues.

Would a better idea be to do the world processing in the InputHandler thread? I thought this could maybe be done by having a Networking system which would try to handle as many packets as possible during a given time frame and then pass control to the other sytems. Another approach I considered was having the InputHandler add events to a queue in the WorldProcessor which would then process these events during the system processing, but I feel this is adding another layer of complexity and that there must be a better way.

I was hoping you could give me some insight or some tips on how to go about connecting the networking and the world processor in a thread-safe fashion.


texts: Correct way to calculate Perspective Matrix

texts:
I have seen at least 3 different ways to calculate the perspective matrix and I'm confused as to which one I should be using and what the differences are?

OpenGL says to do it this way:

f = cotangent(fov * 0.5)

f / aspect, 0, 0, 0
0, f, 0, 0
0, 0, (far + near)/(near - far), (2 * far * near)/(near - far)
0, 0, -1, 0

glm does it this way:

range = tan(fov * 0.5) * near;
left = -range * aspect;
right = range * aspect;
bottom = -range;
top = range;

(2 * near) / (right - left), 0, 0, 0
0, (2 * near) / (top - bottom), 0, 0
0, 0, (far + near) / (far - near), -1
0, 0, (2 * far * near) / (far - near), 0


texts: Unity / How do I change the color of an object based on its depth?

texts:
The objective here is to change the color of the nearest object.
(the nearer the object, the more "colorful" the object gets rendered; and the farther away, the more "grey" the object gets rendered), so far away objects are completely grey and close objects are in full color.
How I'm thinking about this so far:
You know, every frame, there is this certain float value, which determines if a pixel should be drawn or not. (aka z-buffer)
Can anyone tell me the variable - name of it?
Or how can I access it?
Can I even access it?
Edit:

The GPU is comparing two values: the depth of the new fragment you're
drawing (a) and the depth value of whatever's already been drawn in
that spot of the depth buffer (b).
Typically if b <= a it skips
drawing the fragment because it's behind whatever's already been
rendered previously.

I think I need both (a) and (b) variables - since I always need the nearer one.
Im not sure though...
I think its also fine if I could only access the (b) and check every frame if the previous b was smaller.


texts: Integrating SQLite to Cocos2d-x at Xcode

texts:
I have downloaded SQLite C/C++ interface to work with Cocos2d-x. Created a database by Firefox SQLite plugin. Then tried the following code

    // sqlite implementation
    sqlite3 *db;

    if(sqlite3_open("testdb.sqlite",&db) == SQLITE_OK){
        NSLog(@"Opened db Successfully");
    } else {
        NSLog(@"Failed to open");
    }

Output is # Failed to open

How to solve the issue?


texts:
using Unity I have an open world (infinite) which is proceduraly generated in chunks.
In this world I want to proceduraly load objects/trees/grass by raycasting them around the player position and unload them when the player is far.

My questions are :

What is the most optimized way of loading/unloading large quantities of objects around a player ?
Since I'd like players to be able to interact/come back to objects, I'm thinking of using a blue noise seed to load objects, and unloading them by replacing them with an empty. Is that common practice ?

I've looked in a lot of places for ressources but couldn't find much, I'd really appreciate any kind of link to tutorials, videos, pseudo-code ideas and common practices for open worlds as I am not very experienced in video game design, but mildly familiar with code.

Thanks !


texts: How to get asset/model name from (custom) Content Processor in XNA 4.0

texts:
I'm trying to make multiple animations for multiple models in XNA 4.0 and I need to get the name of the model/asset from the content processor which is a custom one (XNA default I think), I'm trying doing this by the split method which requires reading from a file the animations but I need to get the model's name to match it with the files because I'll have several files for several models.

public override ModelContent Process(NodeContent input,
                                         ContentProcessorContext context)
    {
        ValidateMesh(input, context, null);

        // Find the skeleton.
        BoneContent skeleton = MeshHelper.FindSkeleton(input);

        if (skeleton == null)
            throw new InvalidContentException("Input skeleton not found.");

        // We don't want to have to worry about different parts of the model being
        // in different local coordinate systems, so let's just bake everything.
        FlattenTransforms(input, skeleton);

        // Read the bind pose and skeleton hierarchy data.
        IList<BoneContent> bones = MeshHelper.FlattenSkeleton(skeleton);

        if (bones.Count > SkinnedEffect.MaxBones)
        {
            throw new InvalidContentException(string.Format(
                "Skeleton has {0} bones, but the maximum supported is {1}.",
                bones.Count, SkinnedEffect.MaxBones));
        }

        List<Matrix> bindPose = new List<Matrix>();
        List<Matrix> inverseBindPose = new List<Matrix>();
        List<int> skeletonHierarchy = new List<int>();

        foreach (BoneContent bone in bones)
        {
            bindPose.Add(bone.Transform);
            inverseBindPose.Add(Matrix.Invert(bone.AbsoluteTransform));
            skeletonHierarchy.Add(bones.IndexOf(bone.Parent as BoneContent));
        }

        // Convert animation data to our runtime format.
        Dictionary<string, AnimationClip> animationClips;
        animationClips = ProcessAnimations(skeleton.Animations, bones);

        //split animations
        animationClips = SplitAnimations(animationClips["Take 001"], @"F:\Education\GP\GP\Animations\defs.txt");

        // Chain to the base ModelProcessor class so it can convert the model data.
        ModelContent model = base.Process(input, context);

        // Store our custom animation data in the Tag property of the model.
        model.Tag = new SkinningData(animationClips, bindPose,
                                     inverseBindPose, skeletonHierarchy);

        return model;
    }

I want to replace the "defs" with the model/asset name to make it load the correct animations.
Sorry if my question is vague or redundant.
Thanks in advance.
Is there something wrong with the question ? ._.!


texts:
We are looking for the solution for game server for instantiating game instance on nodes.

We tried to use this solution, but it has scalable problems, as you can see on diagram:

Cause only 1 instance of Zone Master can be instantiate in same time and it doesn't support replication. So if it shuts down, players cant' play anymore.

So we are trying to find better scalable solution. Any suggestion?

P.S. game has more than 10k users online


texts: How to design a game engine in an object-oriented language?

texts:
Whenever I try and write a game in any object-oriented language, the first problem I always face (after thinking about what kind of game to write) is how to design the engine. Even if I'm using existing libraries or frameworks like SDL, I still find myself having to make certain decisions for every game, like whether to use a state machine to manage menus, what kind of class to use for resource loading, etc.

What is a good design and how would it be implemented? What are some tradeoffs that have to be made and their pros/cons?


texts: Why don't game developers release their source code?

texts:
I was wondering why don't developers of AAA games release their source codes after their game has sold out and support is long gone?

Of course there is this list, where you can find a lot of AAA games with available source code.

I just don't seem to understand why don't other companies do this with their old games? They certainly don't support it any more, and sales are negligible. I am not even sure, if releasing the source would negatively impact a games sells.

I am sure a lot of games, that are doomed by gamespy's closure, could be saved by the community, had their source codes been released.


texts: Finding the normals of the planes of a View Frustum

texts:
Say I have a perspective view matrix function that takes in aspect, fovy, near, and far... Transforming the view into a frustum. Typical OpenGL stuff, right. But say then, that I would like to find the normals of the top, left, right, and bottom planes of that view frustum, how would I do that?

Edit: I forgot, the camera has a vector position, and a vector direction ...


texts: Is it reasonable to use a 2D texture as a lookup table in GLSL

texts:
I need a lookup table in a shader. The input values would be color values and the output other color values. Something like:

uniform float lut[256];

color = vec3(lut[int(color.r*255.)], lut[int(color.g*255.)], lut[int(color.b*255)]);

does what I need but certain implementations of OpenGL ES do not allow arrays with variable indexing so finally I've arrived to the conclusion that the most portable way is to have a 2D texture as the LUT. A texture of 256x256 could store many different lookup tables, each one (256 entries) in a single row.

In order to load a row in the texture (c++) I would use:

glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);

to store a table in the first row (I assume that internally in the texture I'd have the value repeated in R, G and B)

To fetch the LUT in the fragment shader I'd use texture2D(lut,vec2(index, constRow))   (index in the range 0-1 and constRow = 0 being the row in the texture where it is stored the lut).

Is that a reasonable way to implement that?

Update:
In order to fetch values in the texture-LUT you need normalized indexes (0.0-1.0), so to access row 7 I have to index it as texture2D(lut, vec2(index, 7./255.)); From what I see the result is (or may be) an interpolation with the two other consecutive rows.


texts: How can I get Unity to do letterbox/pillarbox to maintain aspect ratio?

texts: I'd like my game to have the same aspect ratio at all cost, including keeping all UI elements fixed in the same place. I'm totally ok with losing screen space in the interest of fixing the aspect ratio.


texts: Can I incorporate a small fraction of a song into my iOS game?

texts: I was wondering if I can use a small portion of a song without running into any copyright issues. I would give full credit to the artist as well.


texts: Rotate an image and get back to its original position - opengles glkit

texts:
I need to rotate an image in opengles GLkit and get it back to its original position in GLkit.

rotation += 5;
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(5), 1, 0, 0);
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(rotation), 1,0,0);

I need to move it in x axis for certain amount and getting back to its original position from where it started. How should i do it?


texts: Unity inspector not showing variables of custom component that inherits from a built-in class

texts:
I made a class AdvancedButton that inherits from the built-in class Button:
public class AdvancedButton : Button
{
    public bool advancedTest = false;
}

The Unity inspector only shows the variables of Button, but not the variable advancedTest. Is this normal or am I missing something?


texts: Increase Precision on multiplayer location drawin

texts:
I'm building a multiplayer snake-like game with Javascript. I'm having problems with the precision of the opposite players location not reacting fast enough. Which in turns makes the worm "crash", but only for some players, where the change in position happened too late due to latency.

My current game logic sends the change in direction, eg: "Up","Left" as soon as player #1 reacts.

Player #2 then receives Player#1 new direction, and sets his worm to now travel "up" (the direction received).

Since this introduces latency and that the change in direction might be applied too late, i'm wondering what other possibilities is available?

One might be to send current coordinates, or have the game loop on the server aswell, to make sure all movement changes is synced properly.


texts: CompileFromFile syntax error upon compilation

texts:
I am using visual studio c++ 2003 edition and I am trying to use the function CompileFromFIle function from DirectX SDK February 2010 SDK to add bloom to my source code for a mod I am working on and I get this error upon building the release build what is the issue. How do I fix this error?

Output build errors:

c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(839) : error C2061: syntax error : identifier '__out'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(843) : error C2061: syntax error : identifier '__in'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : error C2059: syntax error : ')'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Here is my code cpp file to look at also:

#define _WIN32_WINNT 0x600
#include "stdafx.h"
#include <stdio.h>

#include "C:\Users\john\Desktop\fear public tools 108\Source \Game\ClientFxDLL\D3Dcompiler.h"

#pragma comment(lib,"d3dcompiler.lib")

HRESULT CompileShader( _In_ LPCWSTR srcFile, _In_ LPCSTR entryPoint, _In_   LPCSTR profile, _Outptr_ ID3DBlob** blob )
{
if ( !srcFile || !entryPoint || !profile || !blob )
   return E_INVALIDARG;

*blob = nullptr;

UINT flags = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
flags |= D3DCOMPILE_DEBUG;
#endif

const D3D_SHADER_MACRO defines[] =
{
    "EXAMPLE_DEFINE", "1",
    NULL, NULL
};

ID3DBlob* shaderBlob = nullptr;
ID3DBlob* errorBlob = nullptr;
HRESULT hr = D3DCompileFromFile( srcFile, defines,    D3D_COMPILE_STANDARD_FILE_INCLUDE,
                                 entryPoint, profile,
                                 flags, 0, &shaderBlob, &errorBlob );
if ( FAILED(hr) )
{
    if ( errorBlob )
    {
        OutputDebugStringA( (char*)errorBlob->GetBufferPointer() );
        errorBlob->Release();
    }

    if ( shaderBlob )
       shaderBlob->Release();

    return hr;
}

*blob = shaderBlob;

return hr;
}

int main()
{
// Compile vertex shader shader
ID3DBlob *vsBlob = nullptr;
 HRESULT hr = CompileShader( L"BloomCombine.hlsl", "VSMain",   "vs_4_0_level_9_1", &vsBlob );
if ( FAILED(hr) )
{
    printf("Failed compiling vertex shader %08X\n", hr );
    return -1;
}

// Compile pixel shader shader
ID3DBlob *psBlob = nullptr;
hr = CompileShader( L"BloomExtract.hlsl", "PSMain", "ps_4_0_level_9_1",    &psBlob );
if ( FAILED(hr) )
{
    vsBlob->Release();
    printf("Failed compiling pixel shader %08X\n", hr );
    return -1;
}

printf("Success\n");

// Clean up
vsBlob->Release();
psBlob->Release();

return 0;
}


texts: Panel gets transparent when accessing the offsetMin of RectTransform

texts:
I need to place 3 panels side by side in my application. It was working fine with Render mode Screen space - Overlay. Now due to some other requirement, I had to change the Render mode to Screen space - Camera. Now when I access the offsetMin of RectTransform of the panels so that it shifts to the right, the panel gets transparent.
I commented the code where I'm accessing and the Panel doesnt get transparent then.
I'm not sure why it is happening.
The requirement is place a 3D model in canvas, so I had to change the Render mode. If there is a way to place 3D model in canvas with Screen space - Overlay. That would be great as well.


texts:
I have a notebook that has 2 graphics card one Intel and one nvidia graphics cards.
When I want to start my game I right click on the exe file and select run with graphics processor->Nvidia but my engine stills run with my Intel graphics card on d3d9.
Is there any way to choose the graphics card with code?


texts: Stop Unity UI Buttons from being clicked when a Facebook Window is overlayed

texts: Having an odd issue. When I play with the Facebook SDK for Unity, and the Windows popup like the login window or the Friend Selector window, if I use the mouse to click in the window I end up clicking the Unity 4.6 UI buttons underneath it. Anyone know how to avoid this?


texts: Unity solution not compatible with Visual Studio

texts:
Since updating to the most recent version of Unity 5.4.0f3 Personal Edition, whenever I double click on a script, it launches Visual Studio, but I get an error saying that this version of Visual Studio (Community Studio 2015) is unable to open my project. Please see the screenshots attached for the actual error message. Monodevelop also launches with it's own error message.

I am still able to open the individual script manually using the menu in VS but it's a little frustrating that it doesn't open automatically, and more annoying is that the intellisense/code completion features no longer work. Anyone know how to fix this? I have Visual Studio Tools for Unity installed and have tried running the installer to repair this tool also.


texts: What is classified as a "High Level Design Decision"?

texts:
I'm a student studying game development and I have an assignment about level design due in a few days, the last question is about identifying high level design decisions from a game scenario, but the scenario is a very simple outline of a stealth game.

What is a "High Level Design Decision"?


texts: LWJGL Game crashes on some other machines

texts:
I just tried running my game on a friend's laptop, but for some reason it crashes. The exported .jar runs fine on my machine, and some others too. I can see that is has something to do with the glDrawArrays function, that is this code:

glPushMatrix();

glTranslatef(pos.x*world.chunkSize.x, 0.0f, pos.y*world.chunkSize.z);

glBindBuffer(GL_ARRAY_BUFFER, vao_id);

glVertexAttribPointer(world.game.positionAtt, 3, GL_FLOAT, false, 36, 0);
glVertexAttribPointer(world.game.normalAtt, 3, GL_FLOAT, false, 36, 12);
glVertexAttribPointer(world.game.texCoordAtt, 2, GL_FLOAT, false, 36, 24);
glVertexAttribPointer(world.game.lightAtt, 1, GL_FLOAT, false, 36, 32);

glDrawArrays(GL_TRIANGLES, 0, arraySize / 9);

glBindBuffer(GL_ARRAY_BUFFER, 0);

glPopMatrix();

As said, the exact same .jar runs fine on my system, and some more I have tried it on.

My friend's pc has Intel HD Graphics 3000, with GLSL version 1.40 and OpenGL 3.1.0.

Crash dump: http://pastebin.com/X8x4xX8j

Thanks in advance.


texts:
We're developing a mobile endless runner game, on Unity3d where you can challenge your Facebook friends. The only interaction between the players is the challenge - one player challenges the other, then each player plays when he wants, and after both players finish (when their character dies), their scores are compared to determine the winner.
What system would you recommend that would allow us to implement this functionality, considering scalability, cost and ease of use?
Thanks in advance!


texts:
Here is the setup:
> KinematicBody2D (Player)
- > Camera2D
- > Node2D (SoundFX)
- - > Timer (1 sec)
- - > AudioStreamPlayer2D (Beep)

It works fine at the beginning of the scene, but the sound fades out when the player moves away. Whyt is that and how to fix it?
I have tried to make the AudioStreamPlayer2D a child of a CanvasLayer node, without success.


texts:
I have a painting app for texture artists that I am working on. I am able to paint to a flat canvas that updates the texture of a 3d object in an object viewer. Now I want to be able to paint directly to the 3d model.

One way I can think of is to get the uv coordinate from the mouse position, and use that as the position to paint onto my 2d canvas, which updates the 3d models texture.

Oh and only one object at a time is active, so that should make things a little simpler.

Is this the right approach? If it is then how should I start. Or is there a simpler/better way of painting directly to a 3d model? How does zbrush do it?


texts: How to create a delay/timer and fire an action once it expires in C# Monogame?

texts:
First off I'm somewhat new to C# but I'm working on a game in C# Monogame and I'm trying to get timers working. There was a similar question answered around here a while back but I found that the solution doesn't work for me, perhaps an older version or I'm missing something, so I wrote similar timer and timer manager classes myself.

I ended up with a wait(time) function (that seems to work from looking through the debugger but not sure) now I'm wondering how can I get an action to be executed when the timer created by that expires.

Ideally I'd like something like

timerManager.Wait(10)
{
    //do stuff once done waiting
}

Here's my timer classes - Timer.cs and TimerManager.cs

TimerManager gets instantiated in my player class and wait is called in the update function by keyboard input.

if(keyState.IsKeyDown(Keys.Space))
{
    if(canJump)
    {
        vAccel = jumpSpeed * -1;
        stripManager.setCurrentAction(PlayerActions.jump);
        timerManager.Wait(1);
    }
}

So my question is how can I get an action to trigger, ideally with a set of {} as shown above. I'm aiming to having a class I can reuse for any sort of delay I need in my game.


texts:
I have a custom editor to which I want to be able to draw a basic line graph. I have much of the functionality down, but I have only been able to test as much via the debug. I am yet to figure out how to draw the actual lines to the inspector.

How do I draw lines to a custom inspector?

I have found plenty of online resources, in regards to custom drawing to the editor. However, everything I find pertains specifically to drawing in the scene view; nothing seems to work inside of an actual inspector.

The two general methods I have found involve using Handles.DrawLine and the GL library. Neither appear to work; however, I have only been able to test functionality with blind coordinates, so far. I can not find anything in regards to actually determining the local coordinates of the area on the inspector where I wish to draw. Perhaps I need to start with an initial "origin" position, Perhaps I need to start with a local area defined by a Rect. I simply don't know.

It has also been a while since I had to use OpenGL, directly. It is entirely possible I am simply doing it wrong, to begin with. Here is my current graph method:

private void DrawVelocityGraph(float[] velocityValues, float minimumVelocity,
    float maximumVelocity)
{
    float velocityValue = velocityValues[0];
    float increment = 0;
    Vector3 lineStart = Vector3.zero;
    Vector3 lineEnd  = new Vector3(horizontalIncrement, velocityValue * verticalIncrement);

    GL.Begin(GL.LINES);

    for(int i = 1; i < velocityValues.Length; i++)
    {
        if(velocityValue == velocityValues[i]
            && (velocityValue == minimumVelocity || velocityValue == maximumVelocity))
        {
            Handles.color = VelocityGrapherColours.outOfRangeColour;
        }
        else
        {
            velocityValue = velocityValues[i];
            Handles.color = VelocityGrapherColours.lineColour;
        }

        lineStart = lineEnd;
        lineEnd.x += increment;
        lineEnd.y = velocityValue * verticalIncrement;

        GL.Vertex(lineStart);
        GL.Vertex(lineEnd);
    }

    GL.End();
}


texts: Array of map data renders the map the opposite way


texts: How do I implement a fixed delta time step with a SDL_Delay(15ms) precision

texts:
So I am using SDL2.0 for making a Game Engine.
Where I am having a problem is using SDL_Delay().

SDL_Delay's minimum delay time is 15ms, I've tried everything, and my FPS is Stuck at 64 because of this. I have seen another post about this but it does not seem to answer the question with SDL_Delay.

I can turn on VSYNC, and I Get a fixed 60FPS, Please explain what the SDL Library is doing that I cannot implement Myself?

This is very weird, I dont think I need to post my code for this, the code is not wrong,
Its the SDL_Delay(), wether it be SDL_Delay(1) or SDL_Delay(15) , it will always delay for 15ms, does anyone know a way of fixing this so I can still use SDL_Delay.

I have seen on SDL Documentation they say this is expected, because of OS Scheduling.

Then I read OS Scheduling does this to save power consumption...
I have High Performance turned on my computer, not Power Saver.

Does anyone know a workaround for this? I am very hardheaded and do not want to use VSYNC.

Or I might just have to. LOL Thanks in advance!!

Edit: https://wiki.libsdl.org/SDL_Delay


texts: Is there a way to turn collision detection system off completely in Unity?

texts:
My world setup is 2D Top-Down. All collisions are disabled from the collision matrix.

There are no collisions in the scene as I wanted, but as I perceive, Unity is still trying to calculate collisions in the background. So I'm experiencing serious frame rate drops because of Physics2D.Simulate when I have about 2k colliders moving over each other on the scene.

I followed the suggestions about colliders and rigidbodies on the API exactly (so I know the stuff about not to move static colliders without rigidbody, that's not the case here), but I somehow can't manage to tell Unity that I don't want her to calculate "possible" collisions.

I only want colliders for Raycast2D, OverlapCircle and making movements a bit realistic.

Thanks in advance for all suggestions.


texts: Tile Texture If Dimensions of Sprite Are Larger Than Texture

texts:
I have a sprite that acts as a wall in a game that I am building. I would like to have the brick texture repeat itself instead of stretch to fit the height of the screen. I tried:

Texture lSideTexture = new Texture(Gdx.files.internal("wall.png"));
lSideTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);

lSideSprite = new Sprite(lSideTexture);
lSideSprite.setPosition(-50, -100 * (height/width) / 2);
lSideSprite.setSize(5,100 * (height/width));

But I am still getting a texture that has been stretched to fit the dimensions rather than repeated.

Any ideas?


texts: GraphView: Dragging a Blackboard causes it to get stuck offscreen

texts:
I'm playing around with learning GraphView, and running into some strange problems with the Blackboard component. Here's a very simple repro:
using UnityEditor.Experimental.GraphView;
using UnityEngine.UIElements;

public class MyGraphView : GraphView
{
    public override Blackboard GetBlackboard()
    {
        var result = new Blackboard(this);
        /* COMMENTED OUT BLOCK #1
        var c = result.capabilities;
        result.capabilities = c & ~Capabilities.Movable;
        */
        /* COMMENTED OUT BLOCK #2
        result.RegisterCallback<MouseDownEvent>(OnMouseDown);
        result.RegisterCallback<MouseUpEvent>(OnMouseUp);
        result.RegisterCallback<MouseMoveEvent>(OnMouseMove);
        */
        return result;
    }

    public override void ReleaseBlackboard(Blackboard toRelease)
    {
        toRelease.RemoveFromHierarchy();
        /* COMMENTED OUT BLOCK #3
        toRelease.UnregisterCallback<MouseDownEvent>(OnMouseDown);
        toRelease.UnregisterCallback<MouseUpEvent>(OnMouseUp);
        toRelease.UnregisterCallback<MouseMoveEvent>(OnMouseMove);
        */
    }

    private static void OnMouseDown(MouseDownEvent e)
    {
        e.StopImmediatePropagation();
    }

    private static void OnMouseUp(MouseUpEvent e)
    {
        e.StopImmediatePropagation();
    }

    private static void OnMouseMove(MouseMoveEvent e)
    {
        e.StopImmediatePropagation();
    }
}

using System.Collections.Generic;
using System.Linq;
using UnityEditor;

public class MyGraphEditor : GraphViewEditorWindow
{
    protected MyGraphView _view;

    public override IEnumerable<GraphView> graphViews {
        get
        {
            yield return _view;
        }
    }

    private void OnEnable()
    {
        _view = new MyGraphView();
        this.rootVisualElement.Add(_view);
        _view.style.height = new StyleLength(new Length(100, LengthUnit.Percent));
    }

   [MenuItem("Tools/Graph Editor Test")]
   public static void ShowWindow()
    {
        var graphViewWindow = CreateInstance<MyGraphEditor>();
        var graphView = graphViewWindow.graphViews.FirstOrDefault();
        if (graphView != null)
        {
            var blackboard = graphView.GetBlackboard();
            graphView.AddElement(blackboard);
        }
        graphViewWindow.Show();
    }
}

Clicking the new menu item causes the window to open, just a blank editor window with a blank Blackboard. Clicking on the title bar of the Blackboard and attempting to drag it, though, causes it to immediately disappear. Checking in the UIElements Debugger shows that this is because it's somehow gotten its World Bound Y set to -79, so it's disappeared off the top of the window.
A bit of checking in the reference source suggests that if the Blackboard was not Movable, it couldn't be dragged around. Not ideal, but a temporary workaround at least. But if you uncomment the code that sets this up, (commented out block #1,) it breaks the editor entirely: clicking on the Blackboard causes Unity to stop responding to mouse clicks. Attempting to minimize the damage with the other two commented out blocks has no effect.
Anyone have any idea what's going wrong here and how to fix it? What do I need to do to have a Blackboard that can be dragged around properly?


texts:
I am a very beginner in game development. All I want to achieve in the beginning is a free scrollable background like in a strategy game with my custom graphics. In my case it is supposed to be a 2d city map where the user can select buildings.
How can I achieve that as easy as possible in android? With OpenGL? Die you have any examples especially for this scrolling functionality?


texts: Legal concerns with orchestrating a music submission contest

texts:
My team and I are getting pretty far along in the development of our latest game and have been thinking about audio. We decided to host an audio submission contest where we will offer a little cash and some equity stake in the game as prizes. We are also giving away copies of the game to participants. We hope not only to find audio for our game, but to meet some cool sound artists and promote the game a bit through the process.

First of all, is this even a good idea? What are some potential dangers in doing this? Will it even be well received among artists?
Secondly, I wrote up some Terms and Conditions in my best legal-speak to try to protect us and clarify how the contest will be run. Are these sufficient to make sure everyone involved is treated fairly and is legally protected? They are as follows:

All submissions (The Submission) must be licensed under a Creative Commons Attribution 3.0 Unported License (CC-BY-3.0)
By applying a CC-BY-3.0 license, you (The Submitter) expressly give Detour Games (and all members wherein) permission to copy, distribute, transmit, modify, adapt, and make commercial use of The Submission.
The Submitter must own all rights to The Submission and be within their rights to license it as specified and submit it.
The Submitter claims responsibility for the legality of The Submission. If The Submission is found to infringe on the rights of a person or entity other than those of The Submitter, Detour Games will not be held liable as all responsibility and liability for the legality of The Submission is that of The Submitter's.
No more than two free copies of The Game per submitter.
All flat cash prizes will only be disbursed pending the success of our first $5,000 Kickstarter campaign. These prizes will be disbursed 30 days after Detour Games receives the Kickstarter funds.
All equity prizes (percentage of profits) are defined as the given percent of total profits after costs for a period of one year (12 months) after the release of RAW. These prizes will be disbursed semi-annually.
All prize money will be disbursed through either an electronic fund transfer through a service such as PayPal or by a mailed money order. It is The Submitter's responsibility to cooperate with Detour Games in the disbursement of the funds.
Detour Games reserves the right to change these Terms and Conditions at any time without notice.
By participating in the contest, The Submitter agrees to and accepts all terms and conditions listed.

What else could I do (legally) to protect everyone involved?


texts: Learning game and effect related mathematical tricks

texts:
I'm trying to learn how to code some "effects" more succinctly.

For example, I have sprite clouds in my game, and their transparency is determined with the following formula on their update-method, which is called repeatedly.

float transp = Math.abs(MathUtils.sin(0.2f * time) * 0.4f);

This works OK. However, let's say, that when the transparency reaches < 0.2, I want it to stay there, for some time, and so that the duration is randomized.

I could of course hack this with some "ugly" variables or something, but like I said, I'm trying to learn how to do stuff like this more to the point, hopefully with one-or-few-liners. In other words, more elegantly, more mathematically. Maybe more functionally would be the right description.

Perhaps some demoscene code could be a good starting point for learning things like this.

Anyone have any code or good examples or references to articles of such "dirty math tricks" (or this particular case)?


texts: Opengles 2.0, Replace the black region in the image to make it transparent

texts:
I have two textures, Source image A and Overlay B, B is drawed on top of A, I want to replace the black color in B, then make the region of A visible, what should I do?

This is my shader language:

 varying highp vec2 textureCoordinate;
 varying highp vec2 textureCoordinate2;
 uniform sampler2D inputImageTexture;
 uniform sampler2D inputImageTexture2;
 void main()
 {
 lowp vec4 base = texture2D(inputImageTexture, textureCoordinate);
 lowp vec4 overlay = texture2D(inputImageTexture2, textureCoordinate2);

 if (overlay.r == 0.0 && overlay.g == 0.0 && overlay.b == 0.0)
 {
     gl_FragColor = base;
 }
 else
 {
     gl_FragColor = overlay;
 }
}

but the result is not right.

This is my overlay

when I mix the source and overlay by using the shader, I got the result like the following, What should I do to make it works right?