texts: Why shouldn't templates be used on video game consoles?

texts: I have overhead, several times, that templates should not be used on video game consoles; however, I never heard why, or understood why. Why shouldn't templates be used on video game consoles, and if they are to be used, what are some ways to avoid the negativity?


texts: Latency issue on multiplayer game networking

texts:
I am currently writing a 2D top-down shooting multiplayer game using Java.
I have a game loop at the client-side that does the following in order in each game tick (The client is running in a tick rate of 60 t/s):

client_gameloop{
    1. Send an input sample (an object storing info about what keys are pressed)
       to the server through a DatagramSocket
    2. Receive info on change in game state from the server
    3. Update the client-side game state through the received info
}

For the server-side, I have a game loop that does the following in order in each game tick (The server is running in a tick rate of 60 t/s):

server_gameloop {
    1. Read an input sample through a single DatagramSocket
    2. Using the input sample to apply physics to the game world and update the game state
}

When I try to connect the first client to the server, the game flows fluently with unnoticeable delay. However, when I try to connect the second client, both first and second client start to lag behind the server greatly (delay ranges from 5s to 10s). I am currently stuck on what causes the delay. Am I handling the sending and receiving of info between client and server in a wrong way that causes game state in the server-side not being able to synchronize with those of clients'?


texts: Is there any option other than Component Based for game architecture?

texts:
Having read a lot recently on Component Based systems (for games), i find it hard to go back to my earlier state of mind.

If static object hierarchies fail to model "objects with a dynamic set of properties" then:

Why are they even used for in the first place? (in game dev and software engineering in general).
Is there any other option other than going Component Based to realize a more dynamic and flexible object model ?


texts:
When reading on frame rate, i usually encounter the following suggestions:

render as fast as possible
render to 60 fps

I want to make a 2d game that runs in slow computers, and i've been surprised by how Cave Story smooth is and that it runs at 50 fps. Maybe. there is not much difference between 50 and 60, but if i dont have a reason to use 60, i'd rather set my frame rate to 50.

I'd like to know the drawbacks of this approach, specially applied to my usecase.


texts: UE-Sequencer - Foot slide with character movement

texts:
What is the best way to implement the character movement on the sequencer so there is no foot slide?
I would go with Root Motion but the animations I have are on place.
Thank you


texts: Can I use 3d models I have created in Hexagon made by Daz 3d in commercial games?

texts:
I have been modelling in Hexagon for a while. I want to know if I can use 3d models I have created in hexagon in a commercial game as I have been planning to do one myself.
I don't want to  get in trouble for using Hexagon 3d models I have created in my commercial game.
I searched  Google but could not find the answers I was looking for. I went to the DAZ studio website but I could not find anything answering my question


texts: Controlling the snake in a snake game with the mouse

texts: I am trying to implement a snake game in C# using the WPF forms. Well I know to implement the snake game, where the snake is controlled by the keyboard. But how would I do it, if I wanted to control the snake using a mouse rather than a keyboard?


texts: Transparent gui Shows another gui when it is not supposed to?

texts: I am making a game in roblox. and in that game i need a Main-menu. and the main-menu gui is basically transparent and there is more guis behind in another ScreenGui those gui's are not supposed to show until the main menu is turned off. I have a post on Scriptinghelpers.org about this and it seems nobody knows the answer. My Post: https://scriptinghelpers.org/questions/117430/object-transparency-showing-not-what-its-not-supposed-to


texts: Where's the line between homage and copyright infringement?

texts:
My current WIP game contains a music note collectible mechanic which allows players to play short tunes if collected in the right order (usually very obvious by the layout of the collectibles).
So far, I've kept it at references to Mozart or Beethoven, as this is what fits my game's theme. However, I was thinking of hiding, say, the first few notes of the Mario theme, or of Star Wars' Imperial March, in certain locations, as an homage.

Is this copyright infringement? I assume that having a whole copyrighted song reconstructed note by note like so would constitute a breach of copyright, but how about 10 recognisable notes?

Thanks! :)


texts: Export selected region of Unity tilemap to c# array?

texts: I have a small region of the map selected with the "Select an area of the grid" tool from the tile palette.  I'd like to be able to copy-and-paste this area for usage elsewhere in a programmatic way.  Since the location this region will be placed is determined via scripts, it's not sufficient to just directly copy and place these tiles down elsewhere - I think they need to take the form of a c# array so I can read through that and then use it elsewhere when the time comes.  How can I achieve this?


texts: Tilemap Collision Generation - Tracing Polygons with Slopes

texts:
I've been using Godot for my game, but it has a unfortunate quirks with tilemap collision where physics objects can bounce weirdly near tile seams and kinematic bodies can often get stuck in seams as well. For early alpha work, I've been able to get around this by not using tilemap collision and then tracing the contours by hand... Well this isn't going to scale well to 200 rooms (or whatever I end up having) and could easily lead to mismatched collision data, so I've decided that this process needs to be automated.

Tilemaps have a few different tile types - fully solid, diagonal slopes, and 2:1 slopes.

My first attempt matched each of these types to a half-tile size, marking each vertex as solid or not solid, and then combining all the vertices (with their overlap) into a single grid of vertices. I could then use all of these together by marching along the perimeter and probing ahead to detect corners. Turns out this works well for convex corners but has serious issues in concave corners, plus there isn't enough data to detect slopes properly, so it often resulted in extra slopey parts or cutting into slopes just slightly.

From there I decided to add some extra information on the vertex grid, such as whether a vertex is a slope edge and doing clever things surrounding the properties of how it overlaps, but it's quickly blowing up into a lot of specific cases.

I spent much of today thinking about adding vertex normals to each tile definition, but I realized it wasn't going to work without adding a bunch of different tile solidity types.

Are there better approaches than what I'm thinking that don't involve brittle/lossy intermediate representations or ridiculous amounts of special cases?


texts: Why the player is not rotating to the opposite direction?

texts:
This is before rotating the player is facing the target :

Then rotating but not facing me the player it seems like it's not finishing the rotating ?

In the script in the Update :
private void Update()
    {
        if(rot)
        {
            StartCoroutine(ScaleOverSeconds(player.localScale,
                new Vector3(0, 180, 0), player.localPosition, 1.5f));
            rot = false;
        }
    }

Then :
public IEnumerator ScaleOverSeconds(Vector3 scaleTo, Vector3 rotateTo, Vector3 moveTo, float seconds)
    {
        float elapsedTime = 0;
        Vector3 startingScale = player.localScale;
        Vector3 startingRotation = player.localEulerAngles;
        Vector3 startingPosition = player.localPosition;

        while (elapsedTime < seconds)
        {
            player.localScale = Vector3.Lerp(startingScale, scaleTo, (elapsedTime / seconds));
            player.localEulerAngles = Vector3.Lerp(startingRotation, rotateTo, (elapsedTime / seconds));
            player.localPosition = Vector3.Lerp(startingPosition, moveTo, (elapsedTime / seconds));

            elapsedTime += Time.deltaTime;

            yield return null;
        }
        player.localScale = scaleTo;
        player.localEulerAngles = rotateTo;
        player.localPosition = moveTo;
    }

In this case, I want the player only to rotate without scaling or changing position so I used layer.localScale and the player.localPosition when starting the Coroutine.


texts: Do you fill all your game data in huge excel tables? Are there any better method?

texts:
I really want to know how many game designers prefer to work with a huge table for all items, another table for all skills, and even another table for all mobs in a MMORPG. And these tables may grow to several hundred MBs with thousand records, but most records only use a few fields in a table.
I know some game designer works in this way. Are there any better method?


texts: How can I launch Visual Studio via a double-click on a C# script in Unity?

texts:
This is my first time using Unity and I am following the tutorial for the 2D RogueLike Game. Everythings seems to be working properly, apart that I cant get Visual Studio to launch, if I'm double click my c# scripts.

What I have tried so far:

Checked my preferences, that External Script Editor says "Visual Studio 2017"
Reinstalled Unity and Visual Studio.

Unity Version: 2019.3.0a2 Personal

Hope somebody can help me.

Additional information:

After double click, nothing seems to be happening, even my mouse doesnt show a load icon
When I create a new project, the bug (dont know if bug, or my fault) is still there.
I can open the .sln file from my project in Visual Studio. Visual Studio can even autocomplete unity based code then, before it was a "miscellaneous file" and didnt autocomplete code like for example "Transform" or "Rigidbody2D".


texts: How to create a random array of Transforms and Instantiate the random item?

texts:
I'm trying to make a rock that after you break it, it will spawn a random item from the minerals array. How can I pick a random item from the minerals array and then instantiate it?

    var rockHealth : int = 50;
    var rock : GameObject;
    var speed : int = 8;
    var rb : Rigidbody;

    var copper : Transform;
    var gold : Transform;

    var minerals : Transform[];
    minerals.push(copper);
    minerals.push(gold);

    function DeductPoints(hitpoints : int) {
     rockHealth -= hitpoints;
    }

    function Update() {
     if(rockHealth <= 0) {
         DestroyRock();
     }
    }

    function DestroyRock() {
     Destroy(rock);
     var position : Vector3 = Vector3(Random.Range(-1.0, 1.0), 0, Random.Range(-1.0,1.0));
     Instantiate("random mineral would go here", rock.transform.position + Vector3(0,0,0) + position, Quaternion.identity);
    }


texts: Easiest way to compute closest point between two triangular meshes

texts: What is the easiest (not most efficient or fastest) algorithm to find the closest points between two triangular meshes? What are the easiest early out algorithms in the broad phase? What kind of broad phase algorithm would you recommend if I only have 2 (large and complex) objects? Lastly, what is the again easiest way to compute the closest point between two triangles?


texts:
I do not know whether it's called a circle, or whether it's called a halo or whatever.

But, I do know that I want to know what is the game development world term for this.

So, how do we call it?


texts: How do I design a game framework for fast reaction to user input?

texts:
I've played some games at cca 30 fps and some of them had low reaction time - cca 0.1sec. I hadn't knew why.

Now when I'm designing my framework for crossplatform game, I know why. Probably they've been preparing new frame during rendering the previous.

RENDER  1 | RENDER  2 | RENDER  3 | RENDER  4
PREPARE 2 | PREPARE 3 | PREPARE 4 | PREPARE 5

I see first frame when second frame is being rendered and third frame being prepared. If I react in that time to 1st frame it will result in forth frame. So it takes 3/FPS seconds to appear results. In 30 fps it would be 100ms, what is quite bad.

So i'm wondering what should I design my framework to response to user interaction quickly?


texts: How can I programatically determine if I can create a hardware D3D device?

texts:
I have a D3D 11 application to which I would like to add support for software rendering. This is because in some circumstances it will be run on over remote desktop or on machines without GPUs. From the research I have done, it seems like my best bet is WARP.

It was surprisingly simple to change the app to use WARP:

hr = D3D11CreateDevice(
    NULL,
    D3D_DRIVER_TYPE_WARP, // was D3D_DRIVER_TYPE_HARDWARE
    NULL,
    creationFlag,
    featureLevels,
    ARRAYSIZE(featureLevels),
    D3D11_SDK_VERSION,
    &mDevice,
    &mFeatureLevel,
    &mDeviceContext
    );

It runs nicely. Where I'm struggling is determining when to set the driver type to WARP instead of hardware. Is there a function I can call that will tell me if hardware support is available on the system?

I'm using D3D 11 with the 9_1 feature level.


texts:
Does anyone know how to disable global fog from a particular camera?

I have two cameras in my scene; one is a mini map camera, where I need to disable global fog.

I have checked this answer and the wiki, but have found nothing that works.


texts: OpenGL ES 2.0 - How to batch draw particles that have unique translations, rotations, scales, and alphas?

texts:
I've combined all of my vertex data for many particles into a single array.  How would I batch draw all of those particles in a manner that preserves their unique translations?

Any code examples would be greatly appreciated.


texts:
How would I apply gravity to a bullet so that it would drop slightly the longer that it travels?

I somewhat understand how the gravity works, Im just asking for second opinions for more optimized ways of doing this.

VOID update()
{
    veloc_Y += gravity;//0.5f
    posX += veloc_X;
    posY += veloc_Y;

       if(posY > 650)
       {
           posY = 650.0f;
           veloc_Y = 0.0f;
           on_g = true;//lets my game know im on the ground
       }
}

so, would I apply gravity to bullet veloc_Y?

ex:

b_veloc_Y += gravity;
b_pos_Y += b_veloc_Y;

would this make my bullet drop?

thanks for help in advance


texts:
My Breakout game works fine so far, but I struggle with the collision detection... Well... just with the collision from the ball with the brick...
Here's the relevant code:

List<Brick> removeList = new ArrayList<>();
for (Brick b : bricks) {
    if (ball.intersects(b)) {
        float x = b.getX();
        float y = b.getY();
        float width = b.getWidth();
        float height = b.getHeigth();

        Line2D.Float left = new Line2D.Float(x, y, x, y + height);
        Line2D.Float right = new Line2D.Float(x + width, y, x + width, y + height);
        Line2D.Float top = new Line2D.Float(x, y, x + width, y);
        Line2D.Float bottom = new Line2D.Float(x, y + height, x + width, y + height);
        Rectangle2D bounds = ball.getShape().getBounds2D();

        if (bounds.intersectsLine(left)) {
            ball.setVelocityX(-ball.getVelocityX());
            ball.setX(b.getX() - ball.getWidth());
        } else if (bounds.intersectsLine(right)) {
            ball.setVelocityX(-ball.getVelocityX());
            ball.setX(b.getX() + b.getWidth());
        } else if (bounds.intersectsLine(top)) {
            ball.setVelocityY(-ball.getVelocityY());
            ball.setY(b.getY() - ball.getHeigth());
        } else if (bounds.intersectsLine(bottom)) {
            ball.setVelocityY(-ball.getVelocityY());
            ball.setY(b.getY() + b.getHeigth());
        }
        removeList.add(b);
    }
}
bricks.removeAll(removeList);
objects.removeAll(removeList);

I thought it would work like this, but sometimes the ball does the wrong collision e.g. when the ball comes from down and it hits the brick near the edge it would collide like it hit from the left!

Is something wrong with my code? Maybe it is the wrong approach?

EDIT
Like you can see in the code above I'll get the borders left, right, top and bottom from the x and y coordinates.
After that I check which border was intersected by the ball and determine from which side the brick was hit.


texts: Define a circle from a point on its circumference and an angle

texts:
I'm working on a 2D, top-down driving game with some basic AI vehicles.
The AI Vehicles move along a bidirected graph of positions. Each vehicle has a current position (from the graph) and a target position, but instead of linearly interpolating directly between the positions, the vehicles each have a maximum steering angle, and so must steer their way to the next point.

The vehicle is defined geometrically as follows:

The vehicle itself is a rectangle, comprising a center point (O), a width and a height.
The vehicle has both a front (F) and rear (R)
'axis' from which the wheels are extruded.
The vehicle is steered from the front axis, by an angle defined as (a). The vehicle's
The current heading is (A).
The current steering heading is (B).
The desired target is (T).

The vehicle's heading is only changed when both the steering angle is set and there is some forward motion (i.e. the vehicle cannot turn when standing still).

As long as the target T is sufficiently far enough away, over time the vehicles can be correctly steered towards the targets.

The problem is, when the target is defined too close to the front axis, the vehicle can never reach the target, as the turning arc is too large (they drive around the target indefinitely).

I think the solution is to first detect if the target is 'too close', and if so, the vehicle needs to reverse a little first, and then begin driving forwards again. I think this would be achivable by defining a circle adjacent to the vehicle to detect if the target point can be reached based on the maximum turning angle and current position - but I don't know how to create such a circle. Something like:

How can I create a circle (the origin and radius) from the current vehicle position and max turn angle?
Is there a different, potentially better solution?

Thanks a lot

edit
The following is how I update the position of the vehicle. In a nutshell, the positions of the front and rear wheels are first calculated, and their positions are independently updated. Then the new position of the car is worked out from there. I cut a little for brevity, but it should be enough to see how it works:

private void updateVehicle(BaseVehicle pCar) {

    final float lAccelerationAmt = 30;
    final float lWheelBase = 32;

    pCar.speed += lAccelerationAmt ;

    // Extrude front and rear axels
    pCar.frontWheels.x = pCar.x + lWheelBase / 2 * cos(pCar.rotation);
    pCar.frontWheels.y = pCar.y + lWheelBase / 2 * sin(pCar.rotation);

    pCar.rearWheels.x = pCar.x - lWheelBase / 2 * cos(pCar.rotation);
    pCar.rearWheels.y = pCar.y - lWheelBase / 2 * sin(pCar.rotation);

    // Move the vehicle
    pCar.rearWheels.x += pCar.speed * delta * cos(pCar.rotation);
    pCar.rearWheels.y += pCar.speed * delta * sin(pCar.rotation);

    pCar.frontWheels.x += pCar.speed * delta * cos(pCar.rotation + pCar.steerAngle);
    pCar.frontWheels.y += pCar.speed * delta * sin(pCar.rotation + pCar.steerAngle);

    // Extrapolate the new car location
    pCar.x = (pCar.frontWheels.x + pCar.rearWheels.x) / 2;
    pCar.y = (pCar.frontWheels.y + pCar.rearWheels.y) / 2;

    // update the vehicle heading
    pCar.rotation = atan2(pCar.frontWheels.y - pCar.rearWheels.y, pCar.frontWheels.x - pCar.rearWheels.x);

}


texts: How to use transposition tables with MTD(f)

texts:
I'm writing an AI for a card game and after some testing I've discovered that using MTD(f) on my alpha beta algorithm - a series of zero-window searches - is faster than just using alpha-beta by itself.

The MTD(f) algorithm is described well here http://people.csail.mit.edu/plaat/mtdf.html

The problem I have is that for each pass in the MTD(f) search (for each guess) I don't reuse any of the previous positions I have stored even though the write up on the link suggests that I should (in fact clearing the table between iterations speeds up the algorithm).

My problem is that when I store a position and a value in my transposition table I also store the alpha and beta values for which it is valid. Therefore a second pass through the tree with a different guess (and therefore alpha and beta) can't possibly reuse any information. Is this what is to be expected or am I missing something fundamental here?

For instance if for alpha=3 beta=4 we come to a result of 7 (obviously a cut-off) should I store that in the table as valid for alpha=3 to beta=6? Or beta=7?

(Copied from stack overflow in hope of answers)


texts:
At the moment I am trying to code a 2d game in java, where a jetski is riding on water. If you press on the screen the jetski should dive down and jump back up on release. How do I have to do this in Box2d? My idea was to put a rectangular body as the water and an other one as the jetski. Since I am new to box2d I don't really know how I should bring this into code.
I hope one of you can help.


texts: Unreal Expose Terrain Layers via a blueprint

texts:
I have the below play area and I have 4 terrain materials defined in a material and attached to the terrain.
What I want to achieve is a way to use a blueprint to expose the pathway layer through the entire maze while avoiding collisions.

Terrain

Terrain Material

This is what I wanted to achieve programattically via a blueprint with the path. By collision I mean it cant go through trees, rocks, bushes or walls with colliders on them.


texts: How do I make a character "jump" when leaving an up slope?

texts:
I have developed a game in Android using a tile-based system. I´ve implemented 22º, 45º and 67º up and down slopes and everything works (almost) perfect.
The problem now is that, when the character gets to the end of an up slope, it justs falls until it finds the ground. I want it to perform some kind of parabola depending on the slope and its speed. I think it´s better explained in the picture:

I already have a function that determines whether or not the character is leaving the slope, I just want some ideas of how to achieve that kind of "jump" in some pseudo-code or explanation because I don't know how to start. Any help would be appreciated.


texts: How to solve the overlap of two circles that collide

texts:
I have two circles, one of the circles is static the other is moving around. I have a method that checks whether the two circles collide. How to make the two circles don't overlap when colliding?

public void UpdateGame()
{
    //keyboard input and moving the circle here

    if(CollisionDetection(dynamicCircle,staticCircle)
    {
        ResolveOverlap(dynamicCircle,staticCircle);
    }
}

public class CircleBody
{
    public Vector2 position {get;set;} // top left corner
    public float CenterX;
    public float CenterY;
    public int Width { get; set; }
    public int Height { get; set; }
}

public bool CollisionDetection(CircleBody body1, CircleBody body2)
{
    float radius = body1.Radius + body2.Radius;
    float distanceBetweenTwoCircles = ((body1.CenterX - body2.CenterX) *
        (body1.CenterX - body2.CenterX)) +
        ((body1.CenterY - body2.CenterY) *
        (body1.CenterY - body2.CenterY));

    if(radius > Math.Sqrt(distanceBetweenTwoCircles))
    {
        return true;
    }
    return false;
}

public void ResolveOverlap(CircleBody body1, CircleBody body2)
{
    //answer to my question
}

If it wasnt clear by now here is my code for solving that with two rectangles I want the same thing to happen to the circles.

public void ResolveOverlap(RectangleBody body1, RectangleBody body2)
{
    double widthY = (0.5 * (body1.Width + body2.Width)) * (body1.CenterY - body2.CenterY);
    double heightX = (0.5 * (body1.Height + body2.Height)) * (body1.CenterX - body2.CenterX);

    if (widthY > heightX)
    {
        if (widthY > -heightX)
        {
            //collision - top
            body1.Position.Y = body2.Position.Y + body2.Height;
        }
        else
        {
            //collision - right
            body1.Position.X = body2.Position.X - body1.Width;
        }
    }
    else
    {
        if (widthY > -heightX)
        {
            //collision - left
            body1.Position.X = body2.Position.X + body2.Width;
        }
        else
        {
            // collision - bottom
            body1.Position.Y = body2.Position.Y - body2.Height;
        }
    }
}


texts: How do I render from one render target to another?

texts:
I have two render targets:

a fake backbuffer; a special render target where I do all my rendering.
a light render target; where I render my light fx.

I'm sure I'm rendering correctly on both.

The problem arises when I overlay the light render target onto the fake
backbuffer by drawing a quad covering it:

DxEngine.DrawSprite(0.0f, 0.0f, 0.0f,
    (float)DxEngine.GetWidth(), (float)DxEngine.GetHeight(),
    0xFFFFFFFF, LightSurface->GetTexture());

Regardless of what's in the light target, nothing is rendered onto the other target. I tried clearing the light target with full-white or full-black, but still get nothing.

Fake backbuffer created with

Direct3dDev->CreateTexture(Width, Height, 1, D3DUSAGE_RENDERTARGET,
    D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &Texture, nullptr);

Light render target created with

Direct3dDev->CreateTexture(Width, Height, 1, D3DUSAGE_RENDERTARGET,
    D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &Texture, nullptr);

I also tried to create both with D3DFMT_A8R8G8B8, again without difference.
Both targets have the same width and height.

Only the fixed pipeline is used

DirectX setup for rendering :

Direct3dDev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
Direct3dDev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
Direct3dDev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
Direct3dDev->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
Direct3dDev->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );
Direct3dDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
Direct3dDev->SetRenderState(D3DRS_LIGHTING, false);
Direct3dDev->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
Direct3dDev->SetRenderState(D3DRS_ZWRITEENABLE,D3DZB_TRUE);
Direct3dDev->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);

Direct3dDev->SetRenderState(D3DRS_ALPHABLENDENABLE,  true );
Direct3dDev->SetRenderState(D3DRS_ALPHAREF, 0x00000000ul);
Direct3dDev->SetRenderState(D3DRS_ALPHATESTENABLE, true);
Direct3dDev->SetRenderState(D3DRS_ALPHAFUNC,D3DCMP_GREATER);
Direct3dDev->SetRenderState(D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA );
Direct3dDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );

Direct3dDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
Direct3dDev->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
Direct3dDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
Direct3dDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
Direct3dDev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
Direct3dDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);

Direct3dDev->SetTextureStageState(0, D3DTSS_RESULTARG, D3DTA_CURRENT);

Direct3dDev->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU);

//ensure the first stage is not used for now
Direct3dDev->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);

How can I do this right?


texts: Is it illegal to decompile Unreal Engine maps from games?

texts:
I am currently in the process of learning to use Unreal Engine 4, and want to learn how certain games design their components. I know about the issues with decompiling Unreal Engine 3 to Unreal Engine 4, and are aware of the limitations. Is it legal to decompile maps for my own use, just as a learning opportunity, and not to profit from it in any way?

I searched online for advice, but the answers are wide and varying. Some claim that there is illegality, depending on where you live. Others claim nothing is illegal, as long as no attempt is made to profit from it, or claim it as your own.


texts: Matrix Translation Transformation Question

texts:
I've been reading a lot about computer graphics lately and because of it I'm building my own math library's for fun.  I was reading about Matrix Translation and Homogeneous Coords, and was wondering if these two both translate the x factor by 3.

{ 1, 0, 0, 3 } = { 1, 0, 0, 0 }
{ 0, 1, 0, 0 } = { 0, 1, 0, 0 }
{ 0, 0, 1, 0 } = { 0, 0, 1, 0 }
{ 0, 0, 0, 1 } = { 3, 0, 0, 1 }

I guess what i'm really asking is if I wanted to preform a translation would both of these be exceptible or only the first?


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


texts: Should device tilt give my object a starting speed or acceleration?

texts:
I'm developing a game for iPhones, which have a body placed in the bottom center of the sreen, and I want to move that body in horizontal axis by player tilting his device in y axis.

Everything okay with that, but I want the body to move in a physical-credible manner.

I have a formula for a velocity of the body:

V[current] = V[previous_step] + acceleration * dt;

I don't understand (totally) a couple of things:

If user tilt a device, and we have a float value aTiltVector, that changes through -1 to 1, and gives us a magnitude and direction of a tilt, should I add this vector at beginning as an acceleration, or startup velocity? Should I add this value to the velocity of the body or its acceleration?
How should my body stop? If we give an initial velocity and acceleration, how should it stop if no other force is impacting our body? It would roll down to the edge of the screen then.
How do you typically achieve that behavior?


texts: Why is my TransformFromPoint returning false values?

texts:
I have been using transformFromPoint a lot of time in my game.

Though recently I stuck at the following:

target.TransformFromPoint(target.localPosition)

The output should give me (-5,0,0) but its giving me (-10,0,0)

What may be the cause? I have removed everything from the script and debug the script via VS, but the same thing is occurring.

The script is on camera which is supposed to follow the player.

Here is the code,

public Transform target;
Vector3 tempTarget;
void LateUpdate()
{
  tempTarget = target.TransformPoint(target.localPosition);
  Debug.Log("pos " + tempTarget);
}


texts: When should design give way to marketing and vice versa?

texts:
When should a Designer draw the line in design decisions when marketing does step in?

Where should the bounds be set?

(For most part I know this is might mostly be situational. Gut feel like thing. But would like to get some inputs on this as well)


texts:
convert an animated model:
3dsMax(CAT) -> Export FBX -> fbx-conv -> model.g3dj
my code:
...
val model = modelLoader.loadModel(Gdx.files.getFileHandle("model.g3dj", Files.FileType.Internal))
val modelInstance = ModelInstance(model)
val controller = AnimationController(modelInstance)
controller.setAnimation("Take 001", -1, 0.5f, null)
...

docs:

setAnimation(java.lang.String animationId)
Set the active animation, replacing any current animation.

How to set animationId in the source file (FBX) ?
my research:
model.g3dj
{..., animation: { id: 'Take 001', ... } }
format: https://github.com/libgdx/fbx-conv/wiki/Version-0.2-%28draft%29
model.fbx
AnimationStack 'Take 001'
format: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=files/GUID-E5C89F5F-09D1-4C32-BA83-28F63D0B2A6C.htm,topicNumber=d30e11661
my question: How to set AnimationStack.name in 3dsMax?
https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/3DSMax/files/GUID-26323F8D-3CC2-4918-A60D-C9D6C558584E-htm.html


texts: I have a scene with buildings and a Nav Mesh Agent. Should all the buildings contain the Nav Mesh Agent obstacle component, or them having colliders and being higher than agents step height is enough for the agent to avoid them at all times?


texts: Making use of the Android GPU debugging tools

texts:
I tried following the manual to install the Android GPU debugging tools for android Studio 2.0. Unfortunately it has not been very successful.
I have been following the instructions of the official documentation which are still for version 1 of the gpu debugging tools here: http://tools.android.com/tech-docs/gpu-profiler
It also isn't that helpful otherwise.

I am using an arm based emulator for testing since the abi specific folders specified in the manual are for arm abi's only.
Also the red button above the gpu monitor that is used to start the debugging tools is grayed out for me and it tells me that the gpu debugging tools are not installed when I hover over it.

Are there any extra steps I need to follow to get it to work?


texts:
I have movable objects in a scene.  When Raycast hits an object, I have a hovering UI that moves to a retaliative distance from the hit object.  When the object is dragged, the UI's position is moved relative to the object.  The UI accesses script functions by way of the Button(Script) component.  I attached my functions to the buttons in the editor.

My issue is when the hovering UI is overlapping the view of another object, the UI moves to the object under the UI and never performed the function.
I would like for raycast never to hit the underlying object while my hovering UI is up, or at least to not hit the underlying object while the UI is in the way.

Both scripts are attached to the object tiles.

updatePentagon.cs

using UnityEngine;
using System.Collections;

public class updatePentagon : MonoBehaviour {
    public Transform target;
    public GameObject UI;
    private RaycastHit hit;
    private Plane dragPlane;
    private Vector3 dragPlaneNormal = Vector3.up;
    private float distanceToDragPlane = 0;
    Ray ray;

    void Update () {
        if (Input.GetMouseButtonDown (0)) {
            ray = Camera.main.ScreenPointToRay (Input.mousePosition);
            if (Physics.Raycast (ray, out hit, 100f) ) {
                //if ((hit.collider.tag == "tileUI")  ){
                    //UI.SetActive (true);
                    target = hit.transform;
                    dragPlane = new Plane (dragPlaneNormal, target.position);
                //}
            }
        }
        if (Physics.Raycast (ray, out hit)) {
            if (Input.GetMouseButton (0)) {
                ray = Camera.main.ScreenPointToRay (Input.mousePosition);
                if (target) {
                    if (dragPlane.Raycast (ray, out distanceToDragPlane)) {
                        target.position = ray.GetPoint (distanceToDragPlane);
                    }
                }
            }
        }
    }
}

updateTileUI.cs

using UnityEngine;
using System.Collections;

public class updateTileUI : MonoBehaviour {
    public GameObject tileHandler;
    updatePentagon updatePentagon;
    float UIoffset = .2f;
    Vector3 pos;

    void Start () {
        updatePentagon = GetComponent<updatePentagon> ();
        updatePentagon.target.Rotate(0, 36, 0);
        updatePentagon.target.Rotate(0, -36, 0);
    }
    void Update () {
    }
    void OnMouseDown(){
        updatePentagon = GetComponent<updatePentagon> ();
        pos = updatePentagon.target.position;
        pos.y = updatePentagon.target.position.y + UIoffset;
        tileHandler.SetActive (true);
        tileHandler.transform.position = pos;
        }
    void OnMouseDrag()
    {
        tileHandler.transform.position = updatePentagon.target.position + new Vector3(0, UIoffset, 0);
    }
    public void cancelUI(){
        tileHandler.SetActive (false);
    }
    public void turnRight(){
        updatePentagon.target.Rotate(0, 36, 0);
        }
    public void turnLeft(){
        updatePentagon.target.Rotate(0, -36, 0);
    }
    public void confirm(){
        //activate colliders
        tileHandler.SetActive (false);

    }
}


texts: I started my journey this way, am I on the right track?

texts:
I started my journey to learn games programming from the scratch (I'm a software developer but not in gaming field), I'm targeting iOS games development.

Currently I'm ready "O'reilly iPhone Game Development", then I'm considering reading "Apress Learn iPhone and iPad Cocos2D Game Development".

Am I on the right track? Should I read and learn OpenGL ES? If yes, when to start?

What is the Math type do I need for games development? Algebra and 2D Geometry?

Books like "Challenges for Game Designers" and "Game Design Workshop, 2nd Edition" are on my list also.

I really appreciate if you know a better path to follow.


texts: switch between player camera/non-camera positioning

texts:
Sorry if this sounds ambiguous. But I am writing a traditional top down game.
And normally the player would be centered in the middle while moving the orthographic camera. However, I would like this to be dynamic. Therefore, use player.setPosition(x,y) near screen boundaries but center on player if its far from screen boundary.

This is some sample code:

public void centerCamOnPlayer() {
         camera.position.set(player.getX() + (player.sprite.getOriginX()),
                             player.getY() + (player.sprite.getOriginY()),
                             0);
}

public void update() {
     boolean shouldCenterOnChar = ???;
     if (shouldCenterOnChar) {
         centerCamOnPlayer();
     } else {
         player.setPosition(x,y);
     }
}

Therefore render will call update(). However how do I determine the shouldCenterOnChar?
I tried using frustum.pointInFrustum but its only when the sprite moves completely out of screen. I'm sure there is a better way to switch dynamically. Any one has an idea? Tks!


texts: Default mipmap level & elements to use for CopyTexture in Unity Scripting?

texts:
I want to make a tiled map. I want to use the function CopyTexture to copy from a Texture2D (where is stored my tileset) to a RenderTexture.

I want to use the third overloading (with all the arguments) which allow me to choose from where in the source texture and where in the render texture I will copy. But I need to specify mipmap levels and elements.

I don't know what to use as mipmap levels and elements in this function. Thanks to everyone who can help me :)


texts: Is a responsive dimension game worth it?

texts:
I'm in the process of creating a Wario-Ware-like game that will be created for browsers first then likely ported to mobile. Here are the different ways I've considered setting up the dimensions of the game:

---Fixed width---

The natural go to, set width and height

Pros:

Easy to manage interaction in javascript
Don't have to worry about resizing
As a developer I know exactly how it will look and play

Cons:

It might not be playable on all platforms
It will almost always not make the best use of all of the space on the screen

---Several fixed widths---

I'm currently leaning towards this approach

Pros:

It can reach more platforms than having just one fixed width can
The developer(s) still have full knowledge of how the end product will look through testing on each size
It is fairly easy to change the javascript to match the varying set dimensions

Cons

It doesn't take up the full screen space on many screens
Have to develop javascript in a way where it works with several sizes

---Semi-Responsive---

Consistent dimension ratio, varying actual size. In my case It'd be landscape layout

Pros:

It makes good use of more of the screen
The fixed ratio makes developing easier than a non-fixed ratio

Cons:

On certain platforms it may not be playable depending on the dimensions of the game and of the device
Interaction is harder to manage in javascript than set dimensions

---Fully Responsive---

I'd force landscape mode if possible and keep a minimum height and width, but other than that it's fully responsive

Pros:

Makes use of the full screen
Able to be played on any device

Cons:

A bit harder to manage interaction in javascript

My questions:

What approach is commonly taken when it comes to making dimensions of browser based games? Is there another approach or mix of approaches that I didn't mention that would be useful? It seems that making it fully responsive would be best, but it'd be the most work

I'm also looking for any other advice on the subject

Sorry if this is too broad for this community or if it is tagged inappropriately, feel free to edit as necessary


texts: How do I make a game object move at an angle in an integer-indexed grid?

texts:
I'm making a game in SDL2 and C++. I want a way to make any game object move in a specific direction. I've thought of assigning each object a direction in radians, from 0 until 2 PI where 0 would represent movement in the positive x direction, and PI movement in the negative x direction (0.5 PI would be positive y, 1.5 PI negative y, etc).

My problem occurs when trying to translate these directions into actually moving an object on the screen - moving objects with directions of 0, 0.25 PI, 0.5 PI, 0.75 PI, etc are trivial, as one would either decrement or increment only x, or only y, or alternate x and y.

To approximate other angles of movement in x and y, I figured I could calculate how much each object should move in x, before it increments y, (or vice versa, depending on whether the direction is bigger or smaller than 0.25 PI, and assuming we're only considering the positive x and y quadrant ). And then restricting how many moves in x and y the object makes each time it is moved, in an attempt to preserve the speed of the object, though this would still result in an object moving along an axis moving slower than one moving in at an angle. Is this a reasonable solution?

Is there a more elegant or precise way of accomplishing this problem?


texts: All the while I can only find how to convert from FBX to XNB but not the other way around. Does anyone know how can I do that?


texts: Getting errors while compiling Irrlicht for Android

texts:
I was trying to compile the Irrlicht port for Android but I continue getting errors while following these instructions.

I created a jni folder inside my project folder and the contents looked like this,

PROJECT/jni/Application.mk
PROJECT/jni/l.sh
PROJECT/jni/MakeAndroid.py

Then I went into the console and navigated to the PROJECT/jni/project/jni folder. From there I typed "ndk-build" and I got the following errors,

Compile++ arm    : irrlicht <= importgl.cpp
Compile++ arm    : irrlicht <= app-android.cpp
Compile++ arm    : irrlicht <= android-activity.cpp
Compile++ arm    : irrlicht <= android-receiver.cpp
Compile++ arm    : irrlicht <= CIrrDeviceAndroid.cpp
Compile++ arm    : irrlicht <= CVideoModeList.cpp
Compile++ arm    : irrlicht <= CFPSCounter.cpp
Compile++ arm    : irrlicht <= CNullDriver.cpp
Compile++ arm    : irrlicht <= COGLESDriver.cpp
Compile++ arm    : irrlicht <= COGLESTexture.cpp
Compile++ arm    : irrlicht <= COGLESExtensionHandler.cpp
Compile++ arm    : irrlicht <= CColorConverter.cpp
Compile++ arm    : irrlicht <= CImage.cpp
Compile++ arm    : irrlicht <= CImageLoaderBMP.cpp
Compile++ arm    : irrlicht <= CImageLoaderJPG.cpp
Compile++ arm    : irrlicht <= CImageLoaderPCX.cpp
Compile++ arm    : irrlicht <= CImageLoaderPNG.cpp
Compile++ arm    : irrlicht <= CImageLoaderPSD.cpp
Compile++ arm    : irrlicht <= CImageLoaderTGA.cpp
Compile++ arm    : irrlicht <= CImageLoaderPPM.cpp
Compile++ arm    : irrlicht <= CImageLoaderWAL.cpp
Compile++ arm    : irrlicht <= CImageLoaderRGB.cpp
Compile++ arm    : irrlicht <= CImageWriterBMP.cpp
Compile++ arm    : irrlicht <= CImageWriterJPG.cpp
Compile++ arm    : irrlicht <= CImageWriterPCX.cpp
Compile++ arm    : irrlicht <= CImageWriterPNG.cpp
Compile++ arm    : irrlicht <= CImageWriterPPM.cpp
Compile++ arm    : irrlicht <= CImageWriterPSD.cpp
Compile++ arm    : irrlicht <= CImageWriterTGA.cpp
Compile++ arm    : irrlicht <= COGLES2Driver.cpp
In file included from /home/cmetrolis/NetBeansProjects/MyProject/jni/project/jni/COGLES2Driver.h:44,
         from /home/cmetrolis/NetBeansProjects/MyProject/jni/project/jni/COGLES2Driver.cpp:6:
/home/cmetrolis/NetBeansProjects/MyProject/jni/project/jni/COGLES2ExtensionHandler.h:18:23: error: GLES2/gl2.h: No such file or directory

I cut out a ton of the errors after this, but they mostly all say "No such file or directory". Any idea what I am doing wrong?


texts: Gameobjects disappearing when changing renderer.material.color

texts:
I'm generating an array of objects using this code:

    while(currentPosition.z < poolSize){
        var ringObj = GameObject.Instantiate(ring) as GameObject;
        ringObj.transform.position = currentPosition;
        ringObj.GetComponent<Renderer>().material.color =  new Color (1.0f, 0f, 0f);
        // Adds the ring to the pool.
        pool[(int)currentPosition.z] = ringObj;
        updateCurrentPosition ();
    }

This works fine without this line:

ringObj.GetComponent<Renderer>().material.color =  new Color(Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f));

Which should randomize the color of the object. The problem is that instead of doing this, the whole code would generate only one object (I can see it on the hierarchy view) with the standard material color and then stops the generation.
Also, the material is not changing color.

I can't understand why this happens. Can someone explain this to me, please?  I'm using Unity 5.3.4f1. Thank you.


texts: Is it possible to calculate or mathematically prove if a game is balanced / fair?

texts: This question is not focussed on video games but games in general. I went to a boardgame trade fair yesterday and asked myself if there is a way to calculate the fairness of a game. Sure, some of them require a good portion of luck, but it might be possible to calculate if some character is overpowered. Especially in role-playing games and trading card games. How, for example, can the creators of "Magic: The Gathering" make sure that there isn't the "one card that beats them all", given the impressive number of available cards?


texts:
I'm currently building a game engine renderer but I got stuck when I had to separate engine and client code.

I had been following OpenGL tutorials to learn about buffer creation, etc so all my code for rendering was in a single place and was tied to that specific example.

I created a VBO, a IBO/EBO, a VAO and a shader, then set the VertexAttribPointers for that VAO (and VBO layout) and rendered it. Everything worked fine.

Then I created C++ abstractions for all of those "objects" and recreated the example; that also worked.

So what I wanted to do know is to have each of my game objects create a VBO and an IBO, create a global VAO in my renderer (since all my objects share the same layout) submit them to the renderer and have them rendered. But I discovered I could not setup vertex attribute pointers without having a VBO bound (I have none bound since they get created after the renderer starts up).

So my question is:

How should I set up the VAOs and VBOs for the renderer to work?

I read in some places that what I have to do is to set up few VBOs (so as to have little binding calls and draw calls) and then store every object inside
that one giant buffer. (Of course while still creating different buffers for objects with different vertex layouts and different shaders). I also know that to do that you have to allocate a big buffer and then call buffer sub data to store the new data inside that one buffer, but what I don't know is how to store that data if it must be offset (because of its position in the world and how to update its position)

So if that's the case my next question is:

How do I create one giant buffer and then store different objects inside that one giant buffer and then render those stored objects with their respective positions? (For both static and dynamic objects).


texts:
I am trying to implement this formula to generate bump but I am facing some issue. The result doesn't look the same it's much darker.

Here is my result (without same parameters) but it is much darker and I don't get why.

And here is the associated code.

// randx, randy and frequencies are array with some random values for each sin wave.
for (int x = 0; x < _width; ++x)
{
    for (int y = 0; y < _height; ++y)
    {
        float color = 0.0f;
        for (int i = 0; i < _iterations; ++i)
        {
            val += Mathf.Sin(Mathf.Sqrt(Mathf.Pow(x - randx[i], 2.0f) + Mathf.Pow(y - randy[i], 2.0f)) * 1.0f / (2.08f + 5.0f * frequencies[i]));
        }
        color /= (float)_iterations;
    }
}

Any idea why I am getting this result ?
Thanks a lot !

EDIT: Thanks to @DMGregory it works by doing this.

float tmp = Mathf.Sin(Mathf.Sqrt(Mathf.Pow(x - randx[i], 2.0f) + Mathf.Pow(y - randy[i], 2.0f)) * 1.0f / (2.08f + 5.0f * frequencies[i]));
tmp = tmp * 0.5f + 0.5f;
val += tmp;


texts: How can I make the ui text child to be ignored from the raw image trigger event?

texts:
I have a rawimage prefab and one of his childs is a ui text :

And the script that use the event trigger :
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using UnityEngine;
using UnityEngine.UI;

public class MouseHover : MonoBehaviour
{
    public SaveLoad saveLoad;
    public SceneFader sceneFader;

    private bool loadGame = false;

    public void OnHover()
    {
        Debug.Log("Enter");

        loadGame = true;
    }
    public void OnHoverExit()
    {
        Debug.Log("Exit");

        loadGame = false;
    }

    private void Update()
    {
        if(loadGame)
        {
            if (Input.GetMouseButtonDown(0))
            {
                StartCoroutine(sceneFader.FadeAndLoadScene(SceneFader.FadeDirection.In, "Game"));

                loadGame = false;
            }
        }
    }
}

The problem is that even if there is a space between each of the raw images when I move the mouse over the raw images in the game view window when the mouse pointer is on the ui text at the bottom or on the same line of the ui text it's still showing "Enter" and it's showing "Exit" only when the mouse pointer leave the ui text.
Is there any way to keep the ui text child of the raw image but to ignore the ui text in the event trigger ?


texts:
Games.Leaderboards.loadPlayerCenteredScores(mGoogleApiClient,leaderboardId, LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC, 5).setResultCallback(new ResultCallback<Leaderboards.LoadScoresResult>()
{
    public void onResult(Leaderboards.LoadScoresResult arg0) {
    // TODO Auto-generated method stub

       int size = arg0.getScores().getCount();
        Log.e("ACHGOD", "SIZE="+Integer.toString(size));

        for (int i = 0; i < 3; i++) {
            LeaderboardScore lbs = arg0.getScores().get(i);
            // String name = lbs.getScoreHolderDisplayName();
            String score = lbs.getDisplayScore();
            Log.e("ACHGOD", "SCORE="+score);
            //Uri urlimage = lbs.getScoreHolderHiResImageUri();
        }
        // arg0.getScores().close();
        arg0.getScores().release();
    }
});

I am getting the integer score value here. But, I could not find any proper documentation regarding the score value, which I get.

Is it the high score? Or, is it the last submitted score? I am looking to get the highest score made by the currently logged-in user from the leaderboard.

Thanks in advance.


texts:
I found out that unity has deprecated the internal build system and has defaulted to gradle. I've not built with the gradle build system before, and now after upgrading to unity 2019.1 full version, I can't build an android project.
And, I installed the android module using unity hub, what can I do to fix this?
Screenshot1
Screenshot2
Screenshot3
Screenshot4
Screenshot5
Screenshot6


texts: Assigning relative force to a projectile fired while orbiting a sphere

texts:
Projectile Not Correctly Inheriting Parent Velocity (Unity3D)

So I am trying to incorporate the above person's changes into a script I am making although

I'm no great coder and
I'm not even sure their solution works best for what I am doing.

Essentially what I have right now is a high speed shooter where the player is being pushed around as a physics object on a sphere world rather than using translate for movement. I keep finding solutions that would work really well if I was just translating through xyz space. Using a physics object for my projectile has been working well (I can shoot in one direction and have the projectile hit my in the back after circling around) but once I get up to speed I'm in trouble.

I think I've successfully incorporated the projectile portion into my script but currently it keeps shooting on the positive z axis.

On top of that, I'm not even sure where to start incorporating the second half.

Emitter Script

using UnityEngine;
using System.Collections;

public class SpaceShoot : MonoBehaviour
{
public GameObject Bullet_Emitter;
public GameObject Bullet;
public GameObject target; // Player

public float Bullet_Forward_Force = 100;
public float Bullet_Life = 60;
public float fireInterval = 0.05f;

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
        InvokeRepeating("Fire", float.Epsilon, fireInterval);
    if (Input.GetKeyUp(KeyCode.Space))
        CancelInvoke("Fire");
}

void Fire()
{
    GameObject Temporary_Bullet_Handler;
    Temporary_Bullet_Handler = Instantiate(Bullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;

    Rigidbody Temporary_RigidBody;
    Temporary_RigidBody = Temporary_Bullet_Handler.GetComponent<Rigidbody>();

    Temporary_Bullet_Handler.transform.Rotate(Vector3.left * 90);

    Rigidbody target_rigidbody;
    target_rigidbody = target.GetComponent<Rigidbody>();

    Temporary_RigidBody.velocity = target_rigidbody.velocity;

    Temporary_RigidBody.AddForce(transform.forward * Bullet_Forward_Force);

    Destroy(Temporary_Bullet_Handler, Bullet_Life);
}
}

Edited script as it currently stands. It mostly does what I need although I'm trying to figure out a way to clamp the distance to the origin.


texts: Where can I find affordable legal advice for game software related inquiries?

texts:
I am working on simulation middleware which is applicable for game engine implementations.

What I would like to do is to make it freely available for use for all non-commercial purposes, while at the same time imposing some percentage of royalty on revenue (above a certain threshold) that is derived from my work. Something very similar to Epic's UDK licensing model.

To facilitate the use of my software, I plan to offer binaries (static libs) for several platforms, as well as obfuscated source code which I will freely distribute, in addition to documentation of the API. I simply want to impose the restriction that if you try to make money from it, I get a cut eventually.

I'm wondering if there are online forums and such where I am likely to find people who are willing to assist me in terms of learning what sort of things I have to do to get things down on the right kinds of documents. So far a site like this seems to be the most promising.


texts: Problems with converting from Screen Space to World Space

texts:
I have an unproject function I've written, which takes in x and y values between -1 and 1, and a z value between 0 and 1 (0 is near plane, 1 is far plane).  I create a vector off of this, and multiply it onto Matrix.Invert(ViewMatrix * ProjectionMatrix) to get the world-space coordinates of that screen position at that depth.  The problem I'm having is that the given depth values don't result in the right position (at least as I understand it).

Above is a rough sketch of what I'm seeing.  The black lines are the frustrum edges, red lines are near and far plane, and green line is the plane drawn at the given z depth.  My assumption was that the depth would be linear, with z = 0.5 being halfway between the near and far plane, however the values all sit very close to the near plane until z is real close to 1, at which point it rapidly approaches the far plane.  Am I doing my calculations wrong somewhere?  Or did I just misunderstand how projections work?


texts:
I have a shader that is supposed to work with either alpha blending or alpha testing, but the color values being passed in are premultiplied alpha values.

Is there an easy/standard way to have it produce the "correct" results for both alpha blending and alpha testing when using premultiplied alpha?

For example, if the final result of my shader is RGBA(1,0,0,0.75) straight alpha and therefore RGBA(0.75,0,0,0.75) premultiplied alpha, the result should be remain RGBA(1,0,0,0.75) when alpha testing.

Perhaps one option is "dividing out" the alpha channel if we are alpha testing, i.e. divide the R by A above so that we get 0.75/0.75 = 1.0, our original red value.  But this becomes non-deterministic when the alpha goes to 0.

Maybe I can clarify with an example:

Say the back buffer is RGBA(1,1,1,1), and i am rendering with a partially transparent green color RGBA(0,1,0,0.75) (straight alpha).  The color is passed in as premultiplied alpha as RGBA(0,0.75,0,0.75).  When alpha blending, i blend using one + invsrcalpha and get a final color of RGBA(0.25,1,0.25,1). So my green channel stays at 100%, because the back buffer had green at 100%, and so did my original green color, so no way to get less than 100% on the green channel.

When Alpha testing, there is no blending going on. Instead, my green color will be rendered straight to the back buffer as RGBA(0,0.75,0,1).  But the color I wanted was RGBA(0,1,0,1).


texts: Admob banner not getting remove from superview

texts:
I am developing one 2d game using cocos2d framework, in this game i am using admob for advertising, in some classes not in all classes but admob banner is visible in every class and after some time game getting crash also.

I am not getting how admob banner is comes in every class in fact i have not declare in Rootviewcontroller class. can any one suggest me how to integrate Admob in cocos2d game, i want Admob banner in particular classes not in every class,
I am using latest google admob sdk, my code is below:

Thanks in advance

`

-(void)AdMob{
NSLog(@"ADMOB");

CGSize winSize = [[CCDirector sharedDirector]winSize];
// Create a view of the standard size at the bottom of the screen.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-364,
                                           size.height -
                                           GAD_SIZE_728x90.height,
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];

}
else { // It's an iPhone

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-160,
                                           size.height -
                                           GAD_SIZE_320x50.height,
                                           GAD_SIZE_320x50.width,
                                           GAD_SIZE_320x50.height)];
}

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    bannerView_.adUnitID =@"a15062384653c9e";
}
else {
    bannerView_.adUnitID =@"a15062392a0aa0a";
}

bannerView_.rootViewController = self;
[[[CCDirector sharedDirector]openGLView]addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];

GADRequest *request = [[GADRequest alloc] init];
request.testing =  [NSArray arrayWithObjects:
                  GAD_SIMULATOR_ID, nil];                              // Simulator

[bannerView_ loadRequest:request];
 }

   //best practice for removing the barnnerView_

-(void)removeSubviews{
 NSArray* subviews = [[CCDirector sharedDirector]openGLView].subviews;
 for (id SUB in subviews){
    [(UIView*)SUB removeFromSuperview];
    [SUB release];
 }
 NSLog(@"remove from view");
  }

    //this makes the refreshTimer count
-(void)targetMethod:(NSTimer *)theTimer{

//INCREASE OF THE TIMER AND SECONDS
elapsedTime++;
seconds++;

//INCREASE OF THE MINUTOS EACH 60 SECONDS
if (seconds>=60) {
    seconds=0; minutes++;
    [self removeSubviews];
    [self AdMob];
  }
NSLog(@"TIME: %02d:%02d", minutes, seconds);
 }

`


texts:
Consider this model of a tank turret:

The following model has smooth, round surfaces that meet at sharp corners. This is achieved with a high number of subdivisions and marking certain edges as sharp in the software.

But I need to obviously get a low poly model for real time rendering. In the modeling tool I'm using, Blender, I have the option to shade any faces smoothly, but I can't seem to figure out how to get the smooth curved surfaces to come to sharp edges, so maybe I'm not on the right track.

How do I shade / model low poly smooth surfaces that come to sharp edges?


texts: How does sprite customization in 2D games work?

texts:
I´m working on the design of a new game concept at the moment and I would like to know how to handle a customization of sprites. (In 2D that is, hence the topic.)

This is my scenario: The player will have a tower containing 3 floors (or more). Each floor can be replaced by another "piece", i.e. a blue floor, a fire floor, a stone floor.

With the little knowledge of game development I have, creating a sprite for each possible combination is probably not a good idea, since the size of the game file will be HUGE.

So, how does developers solve this? Do you put a standard position and just replace the sprite itself? Any advice or information about this would be great.

Regards.


texts:
So I am making a simple game like "the impossible game" where the character just moves forward(from a 2D prespective) and the only thing you have to do is press the screen to jump at the correct time to avoid crashing into obstacles.

My record algorithm is quite simple:

   onJump()
   {
       events.append(player.pos.x);
   }

And my replay is:

   onUpdate()
   {
       if(player.x==events[nextevent])
            player.jump();
   }

Everything works O.K but sometimes in extreme situations(the player jumped just before he crash on an obstacle)while the player didn't actually crash, on replay the player crashes. I know this is happening because of the delta time(different delta on record and on replay).
How can I fix it without having the need to record my delta time too?

EDIT:it seems that many didn't actually understood my question ,the question is not how to implements a replay system (knight666 answer is full and complete and it deserves the accept but its not what i asked) but how to deal with the changes of delta time.for example ,lets say the player jumps just before he crash ,while he is still in the air he passes 1 pixel away from the obstacle and it doesn't crash, but in the replay cause the delta can happen to be different than the delta while it was recorded the player passes -1 pixel away from the obstacle and it crashes.


texts: Effective solution for showing the outline of the player sprite when behind objects or tiles that are meant to be in foreground

texts:
I'm very new to Unity and I'm now experimenting with possible ways to show the player outline when he/she is behind objects or tiles. This is what I came up with:
My setup

Built-in rendering pipeline
Renderers sorted using based on Order in Layer. All the Tilemaps and the Player are at the same Z
Transparency Custom Axis: (0, 1, 0). (All default sprite shaders are in the same Transparent Queue)
Three Tilemaps: Bottom (grass, order in layer -2), Middle: (fence, order in layer -1), Top (house and player, order in layer 0)

My solution

Create a Sprite GameObject (let's call it OutlineSprite) with the same sprite used by the player. Assign it as child of the PlayerSprite
Assign, to the OutlineSprite, a "Order in Layer" greater than anything else.
Assign, to the OutlineSprite, the same animator used for the Player sprite (and modify the c# script that sends notification to the animation controller whenever the player moves so that it sends notification to the OutlineSprite animation controller too)
Assign, to the OutlineSprite, a material which uses a shader able to render the outline of a given sprite (I just copy/pasted a shader I found online which does more or less what I wanted, I'm not anywhere near to understand how to write a shader right now)
Modify the player Sprite outline so that it exactly match the shape of the sprite
Put a Sprite Mask in every place you need to create this effect (in the screenshot is just over the house roof)
Configure the Player sprite to be "Visible outside mask" and the OutlineSprite to be "Visible inside mask"

This solution seems to do what I need but has many cons that I'd like to address, if possible.
Pro:

simple solution that doesn't require extensive knowledge of advanced concepts

Cons:

the player animation runs twice
tedious to manually configure the outline of all the animation sprites
tedious to manually place the sprite mask where needed

My question
Is there another (or multiple) solution to this problem that involve the least amount of changes and work (so that the setup fast and maintenance is minimal)? Ideally I'd like to only change the player's shader, if possible.


texts:
Currently studying Game Engineering at university and my lecturer has asked us to implement a collision manager. He asks us to use AABBvsAABB to build it, so then we can add the physics.

My question is and if anyone can answer it as simple as possible (as the notes he uses I am still lost).

What exactly is AABBvsAABB for collision detection?

Any links to sites that explain it or just some basic examples would be appreciated.
EDIT: links or examples that explain it in simple terms, I can't seem to find any :(


texts: Unity what are the rules for determining sizes of gameobjects

texts: I am making a game for windows phone. I am a newbie so currently I am unable to understand if I have to make a simple menu for a game targeting portrait mode always, what should I give the background size ,camera size ,button size , position? For example I have to set a background on renderer  full screen size in portrait mode and fis a gui test between it.. I am using 2d orthographic camera


texts: How do I render a cylindrical world space onto a flat, 2D view port in Unity?

texts:
The question is just a logical extension of this question.

So, how should I render a cylindrical world space onto a flat, 2D view port in Unity?

Thank you.


texts: How do I use warble to package libgdx and ruby?

texts:
My ruby code is as follows

include Java

Dir[File.expand_path "#{File.dirname(__FILE__)}/../libs/\*.jar"].each { |x| require x; puts "go"}

module LibGDX
        include_package "com.badlogic.gdx"
        include_package "com.badlogic.gdx.backends.lwjgl"
        include_package "com.badlogic.gdx.graphics"
end

class Game
        include LibGDX::ApplicationListener

        @LOG = Game.java.simple_name

        def create
                LibGDX::Gdx.app.log(@LOG, "Is a thing")
        end

        def resize width, height
                LibGDX::Gdx.app.log(@LOG, "Resizing game to #{width} by #{height}")
        end

        def render
                LibGDX::Gdx.gl.glClearColor(0, 0, 0, 0)
                LibGDX::Gdx.gl.glClear(LibGDX::GL20.GL_COLOR_BUFFER_BIT)
        end

        def pause
                LibGDX::Gdx.app.log(@LOG, "Pausing")
        end

        def resume
                LibGDX::Gdx.app.log(@LOG, "resuming")
        end

    def dispose
            LibGDX::Gdx.app.log(@LOG, "disposing")
    end
end

listener = Game.new

width = 800
height = 600

useOpenglES2 = false;

game = LibGDX::LwjglApplication.new(listener, "Game", width, height, useOpenglES2)

If I run this through jruby it works just fine but if I package it up with warble it skips all of the Game class's initialization and tells "AL lib: alc_cleanup: 1 device not closed" and stops.

Does anyone know the proper way to build a libGDX project with jruby and warble?

P.S. I know this seems like a very localized problem but I'm asking how to use jruby and libgdx with warble using my program as an example so... I think it's more broad then it seems... still getting used to stackexchange.


texts: OpenGL draw functions and multi-threading. How they work together?

texts:
I want to apply multi-thread in a simple way to control and draw 4000 objects.
I am using SDL and OpenGL.

control : locations, collisions, calculations ... etc

draw : OpenGL draw functions glDrawArrays,glDrawElements etc

For 4000 objects i think like this:

do you think it works ?


texts:
My goal is to make a completely 2D game using DirectX, but I'm new to it and I'm confused about all of the different APIs that are available.

From Wikipedia:

  Direct3D is used to render three-dimensional graphics, ... Integration
  with other DirectX technologies enables Direct3D to deliver such
  features as video mapping, hardware 3D rendering in 2D overlay planes,
  and even sprites, providing the use of 2D and 3D graphics in interactive media ties.

So I guess that I can use Direct3D to make HUD and GUI (2D) elements of the game using sprites, but can I use it for a completely 2D game or should I use Direct2D instead?

The reasons because I'd prefer to use Direct3D rather than Direct2D (please correct me if I'm wrong on any of this points) are:

I don't want to use an API that abstracts me too much from what's
going
Direct2D uses Direct3D at the end
I could find myself wanting to
learn 3D programming in the future

And in case that I could use (and maybe choose) Direct3D, since it is such a massive API, which subset of it would someone need to make a 2D game?

I hope the question is not too broad, thanks in advance.


texts: Modular building technique with angles? (A roof)

texts:
Ive been spending a bit of time lately studying the modular buildings of many games and reading/viewing several tutorials about it as well, but almost every example I see uses a plain square building that does not have any angled roof or similar.

In all my applications (CS6, Blender/Max, UDK) I adhere to the same grid spacing and I get pretty good results, but trying to make modular angled pieces is confusing me as I'm not sure the best way to approach it.

Below is some shots of my template sheet and workflow I have been doing. Should I do the roof separately or is it possible for me to keep it in the same texture sheet?

The main issue is below. I have made a couple modular roof pieces but when i try to use them, i end up needing to model multiple other parts to fill gaps based on what roof shape i want. I then model those 'filler' pieces and now i have that much less space left in my texture sheet and those pieces are usually not that reusable for anything else. This is where im not sure how to proceed.

If anyone has any links to documents or papers talking about this or advice, I would greatly appreciate it! =-)

My main roof pieces with the gaps

My power of 2 texture sheet, with 16x16 grid squares.

The texture sheet loaded into blender on a 16x16 plane and starting to separate and extrude.


texts: Unreal 4 - How to access and iterate through the polygons of a mesh?

texts:
I'm newbie with Unreal Engine 4. I need to create a function which calculates the volume of a mesh, based on the following example:

https://n-e-r-v-o-u-s.com/blog/?p=4415

To achieve that I created an actor blueprint containing a cone. I then created a function to calculate the volume of a tetrahedron composed by a polygon plus the center point of the scene, like that:

Now I want to iterate through each of the polygons composing the cone actor, one by one, and use the above function to calculate the total volume of the cone.

I found a possible beginning for a such iteration:

However I'm unable to find a way to create a loop which iterate through the Triangles array and extract the 3 vertices of each triangles composing the mesh.

I would be grateful if someone explained to me how to implement a such loop.

Or, if so, how to access correctly to the actor mesh vertex buffer object, and to iterate through each of the polygons composing it.


texts: Should Client->Server/Server->Client packets be separate?

texts:
When working on network packet structure for games, what is more efficient (in terms of code structure) for packet reading for client/server?

Currently, Our packet structure is to send the packet ID as an Int32, which is read when it is coming into the server.
But to minimize the amount of packet ID's we use, instead of having a (for example) LoginRequest AND a LoginResponse, we use just a Login packet. The data is structured differently whether it is the server, or client sending the packet.

Should we use an individual Packet for each Request/Response? Or is there a better way?

EDIT:

And by data being different for whether it is the client or server sending, it is different in terms of complete packet structure. So while it still has the same ID, it uses entirely different data types.

Example (Using a Lobby Request/Lobby Response as one packet)
Client Request

Packet Id (Int32) (Lets say ID = 5)
LobbyName (String)
LobbyPassword (String)
GameLobby (Boolean)

Server Response

Packet Id (Int32) (still ID = 5)
LobbyName (String)
GameLobby (Boolean)
MemberCount (Int32)


texts: How to properly handle top down 2D collision?

texts:
I can never seem to get this right, well polished at least. I'm creating a top down game in XNA, and collision has always been an issue for me to do properly. Detecting collision is fine, but resolving it is where I get messed up.

My approach so far:

Loop through rectangles polled by a quad tree
check if these rectangles intersect with the player
if yes then undo the velocity that we just applied to the player
if no then do nothing

This approach is less than ideal but it's close, I'm trying to allow players to move along the wall even if they're applying the force on the wall.

For example: if the player collides against a vertical wall, they should be able to move up and down even if they are still trying to move left/right.

I can't seem to find a good way to do this. Maybe I'm overthinking, but I tried doing vector subtraction on the centre's of the player and tile and seeing where the vector pointed. But that didn't give me much helpful information. I tried seeing if it was the x-axis or y-axis that was colliding but that didn't work as the player is bigger than the tiles.

Is there a way to find which axis is colliding so I can undo velocity on that specific axis?


texts: Implementing beat detection algorithm on mobile

texts:
So, I've been looking for a way to detect beats on a streamed song on mobile(like listening on Spotify or Youtube etc.) I've found the most used methods are either using already known songs or using spectral flux analysis, which would require knowing all the song in advance.

Since both my audio and my programming knowledge are limited I'm struggling both in implementing this algorithm (I've tried Allan Pichardo's  Beat detection algorithm ) and in thinking of another way of detecting onsets in an unknown song.

My goal is to be able to detect if the player moves "in sync" with the beats of a song, with a given margin of error such as in Crypt of the NecroDancer .

I've also given thought to a machine learning approach, where a trained model could tell if a given piece of a song is or not an onset, but don't know if it can be implemented on mobile, and if there is a dataset available to train on.

The final question would be, is the spectral flux analysis still the way to do this or would there be easier, more efficient methods?


texts: Can inserting/removing one point in a quadtree or octree cause multiple splits/collapses?

texts:
I was reading Robert Nystrom's Game Programming Patterns website and, in the section about spatial partitioning, particularly in the section on quadtrees, he mentions:

Objects can be added incrementally. Adding a new object means finding the right square and adding it. If that bumps that square above the maximum count, it gets subdivided. The other objects in that square get pushed down into the new smaller squares. This requires a little work, but it’s a fixed amount of effort: the number of objects you have to move will always be less than the maximum object count. Adding a single object can never trigger more than one subdivision.
Removing objects is equally simple. You remove the object from its square and if the parent square’s total count is now below the threshold, you can collapse those subdivisions.

I can't help but wonder if this is really right. Experimenting with certain simulators this one, when adding a point that is close to another one (and since it only allows one point per grid space) multiple subdivisions happen until they're fit. The same happens when you remove a point, with the subdivisions collapsing.
An example using the website:

With just another point, 5 subdivisions happen:

Was this perhaps a mistake on Nystrom's part? Or is it just a definition that can change from quadtree implementation to implementation? I'm also wondering if the same can happen with octrees.


texts: Tool to convert Textures to power of two?

texts:
I'm currently porting a game to a new platform, the problem being that the old platform accepted non power of two textures and this new platform doesn't.

To add to the headache, the new platform has much less memory so we want to use the tools provided by the vendor to compress them; which of course only takes power of two textures.

The current workflow is to convert the non power of tho textures to dds with 'texconv', then use the vendors compression tools in a batch.

So, does anyone know of a tool to convert textures to their nearest 'power of two' counterparts?

Thanks


texts:
So, I'm having a bit of an issue with transforming a GO after instantiation in the way that I want.

I have a main GO.  On death, it spawns secondary GOs.  All GOs involved are kinematic (because the AI controller moves them).  So I use lerps to move the secondary GOs on instantiation in a sort of fountain pattern.  However, because of the static movement, they get pushed through walls and other surfaces.

I thought I'd try using physics for this with a ForceMode.Impulse push, but to do that I have to make it non-kinematic.  To do that, I also have to set it's mesh to be non-convex.  Making the mesh convex causes a ~1000ms delay on instantiation while the PhysX engine parses the mesh.

So...  what other options do I have?  Is there any other way to use the basic transform lerps and still have it not pass through walls?  I'm assuming that the direct transform is causing collision to not happen.  Or maybe because I'm disabling the CharacterController until it reaches it's end position (otherwise it tries to move right away using AI).


texts:
I'm trying to tell if an actor exists at a screen position so I can do something if the actor is clicked on. To do this, I first need to get the screen coordinates of the actor so I can compare it to the coordinates where I click, however, I am having some difficulty. I am currently trying to do this:

Actor actor = ...
// The position where I clicked obtained from touchDown() in my InputAdapter
Vector2 screenPos = ...
Vector2 actorStagePos = actor.localToStageCoordinates(new Vector2(0,0))
Vector2 actorScreenPos = actor.getStage().stageToScreenCoordinates(actorStageCoordinates)
Rectangle actorScreenBounds = new Rectangle(actorScreenPos.x, actorScreenPos.y, actor.getWidth(), actor.getHeight());
if (actorScreenBounds.contains(screenPos))
{
    System.out.println("An actor is there")
}

However, the coordinates don't seem to be converting correctly. They end up slightly below and to the right of where they should be. At first, I thought this was caused because I'm scaling some of the Image actors, but it also did not work when nothing was scaled up.


texts: I'm developing a website that can display 3D models of motorbike. I haven't decided on which tool to use yet but it seems most of them support X3D and VRML files. So I'm searching for already-made models in either format but got no result so far, anyone know where I can find one? Thank you.


texts: Design pattern for world objects caching

texts:
I'm developing in Unity a voxel-generated terrain and I'm trying to find an extensible design pattern for voxels and more in general, world objects caching. E.g. storing in a 'ChunkCache' class only the nearest Chunks and updating it after a set amount of time

As of now, I'm using a static World class with the following members in pseudocode

static class World
   Player reference
   Enemies reference
   WorldCache reference
   etc.

The WorldCache instance contains a list of objects all deriving from the same base class 'Cache'. The implementation so far calls worldCache.update() method with an enum indexing this list of 'Cache' objects

WorldCache class
   List<Cache> differentTypesOfCache;

   void update(Enum whichCache) {
      differentTypesOfCache[whichCache].update();
   }

The problem I'm facing with this design pattern is different types of derived Cache classes need different types of information (e.g. a ChunkCache class will judge wether a chunk needs to be removed from the cache depending on the player's distance from the center of the chunk, whereas other types of derived Caches may need differing information) and as of now the only way to gather this information is to directly query the static World class members.

Also if a certain Cache object requires information from another Cache object, it starts to look spaghetti.

Is there a completely different pattern better suited for this scenario, or a way to modify the existing one for the better?


texts: In Unity unable to find second github branch

texts:
I'm using github for unity asset and for some reason I can't find new branch that was created on a different PC.
I tried refreshing, fetching, reinstalling asset, reinstalling asset and recloning repository.

Strangely, my laptop shows the branch, but not my personal home computer.

Any ideas why is this happening?


texts: Downprojecting an imaginary 4D mesh to the screen

texts:
As a mental exercise, I'm trying to imagine projecting an arbitrary 4D mesh onto the screen (2D).

I'm guessing a single 4D triangle would still consist of only 3 points, however each of those 3 points would be defined by column with 4 dimensions.

Would it make more sense to define a projection matrix to map 4D space to 3D space first and then have OpenGL do its own projection from that data to 2D space?

Or would it be best to just plan on projecting down from 4 to 2 directly?

Many thanks.


texts:
I'd like to start allowing for user-made content in my game. I'd like users to be able to add their own levels, entities and quests (along with all of the assets that are required). However, I'm unsure of the best way to do so.

Currently, the game loads its levels, entities, etc. from a JSON file. This file is embedded into the executable, and whenever the user starts a new game, it is created from this file. When the new game is saved, it is saved as a JSON file of the same format.

As an example, let's say that an add-on would be a folder containing the following:

A JSON file describing any new levels, new entities, new quests.
A single script file with one function that is called to make any modifications to the default game content, since it's not directly available. This would allow the addition of portals to new levels, characters to initiate new quests, etc.
Audio, images, scripts for entities.

An editor will be provided in order to create the add-on; the author can create entities, levels, etc., so that they don't need to edit the JSON file manually.

Should the player be able to:

Load add-ons at any point during the game (game == JSON save file)?
Remove an add-on? Would the add-on author (or I) have to keep track of every new level, entity and quest that the add-on added and remove them? What if the entity is already removed?

It seems that the safest way to allow add-ons is to mandate that they be added at the beginning of a new game and cannot be removed once added. If an add-on makes a new weapon available, for example, removing the add-on once the player has already picked up the weapon would leave the game buggy. However, this seems very prohibitive.

Is this a sane approach? Is there a better one? How much responsibility should I leave with the add-on author? How have games that were designed to be customised handled this?


texts: I am building a game that requires a full planet but it would be too complicated to create it as one mesh, so I decided that I will use procedural generation to create the (partially) editable landscape, rocks, trees, caves, etc. I was wondering on what server-side a procedural planet is generated? For example, is it generated when the player first plays the game, and is it the same for every player? Or is it completely rebuilt each time the player enters the game? If the answer is the latter, is there any way to somehow save the planet and make it into one map for everybody using the game and not change if they reload the game? If possible, I would strongly prefer any answers in Blueprints rather than C++. FYI: I haven't started building the game yet and am still researching my options for how to create the world. I didn't find much about saving the character's location anywhere so far.


texts: Unity3D - generating a set of rooms (scenes) and saving them

texts:
I'm having a problem wrapping my head around scenario like this.

Say I've got a scene called Room. Now, my game procedurally generates content of each room. Entering a new room to see new content, finishing it and going to the next one isn't much of a problem. However, I'd like to add ability to go back AND to generate a set of rooms (say, 5) along certain path. Now, how exactly can I achieve this?

The latter one, I can store somewhere information about each room whether it should have exits on left/right or top/bottom and just generate as player moves forward using this data. The tricky part is coming back. What would you guys recommend? Serializing the whole scene (will it even work in this case?), picking up and serializing my own information about the randomed scene? Not sure how to approach this.


texts: I see many examples of particle system in old style OpenGL with falling raindrops. Examples of rainfall that can interact with environment lighting and look realistic are hard to find. How to create realistic rainfall animation in modern OpenGL using shaders?


texts: Why do I see this "ghosting" effect with my sprite in SDL?

texts:
I'm using SDL to create a 2D side-scrolling platformer, but I'm getting ghosting from the sprite. I'm not used to programming with graphics or SDL so excuse any stupid remarks I make.

Here's the issue:

The tutorial I'm following:
http://gamedevgeek.com/tutorials/moving-sprites-with-sdl/

int main(int argc, char* argv[])
{
    SDL_Surface *screen, *temp, *sprite;
    int colorkey;

    SDL_Init(SDL_INIT_VIDEO); //Initialize SDL

    SDL_WM_SetCaption(WINDOW_TITLE, 0); //Window title

    screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0); //Create window frame

    SDL_EnableKeyRepeat(70, 70); //Keyboard Repeat

    temp   = SDL_LoadBMP("sprite.bmp"); //Load the actual sprite
    sprite = SDL_DisplayFormat(temp);
    SDL_FreeSurface(temp);

    /* setup sprite colorkey and turn on RLE */
    colorkey = SDL_MapRGB(screen->format, 160, 136, 128); //Make this RGB color transparent, so sprite isn't surrounded by a colored box
    SDL_SetColorKey(sprite, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);

    spriteRect.x = 150; //Initial X Position
    spriteRect.y = 150; //Initial Y Position

    /* set animation frame */
    srcRect.x = 0;
    srcRect.y = 0;
    srcRect.w = SPRITE_SIZE;
    srcRect.h = SPRITE_SIZE;

    gameover = 0;

    /* message pump */
    while (!gameover)
    {
        SDL_Event event;

        /* look for an event */
        if (SDL_PollEvent(&event)) {
            HandleEvent(event);
        }

        /* collide with edges of screen */
        if (spriteRect.x <= 0)
            spriteRect.x = 0;
        if (spriteRect.x >= WINDOW_WIDTH - SPRITE_SIZE)
            spriteRect.x = WINDOW_WIDTH - SPRITE_SIZE;

        if (spriteRect.y <= 0)
            spriteRect.y = 0;
        if (spriteRect.y >= WINDOW_HEIGHT - SPRITE_SIZE)
            spriteRect.y = WINDOW_HEIGHT - SPRITE_SIZE;

        SDL_BlitSurface(sprite, &srcRect, screen, &spriteRect);
        SDL_UpdateRect(screen, 0, 0, 0, 0);
    }

    /* clean up */
    SDL_FreeSurface(sprite);
    SDL_Quit();

    return 0;
}


texts: How to make the game wait for an animation to finish?

texts:
I'm teaching myself andengine while trying to make a match-3 puzzle, so far I have a grid of gems that I populate and can move then around. Matching gems and new gems falling is working already. My problem is that the game keeps flowing while animations runs. How can I make the flow suspend until movement is done?

I use entity modifiers for the gems animations. MoveYModifier for the fall and PathModifier for the swap.


texts: Properway to pass information from one system to another in an entity component system design

texts:
After having read some example programs (namely Pong, Snake and Pacman) I am now experiencing with ECS. I am wondering where to put the elements for a reward flow. Do you know good practices for implementing the following feature in an ECS spirit?
Example:
Let coins_reward be a component carrying an amount of coins to be rewarded, energy_gauge be a component storing the remaining energy of an entity and damage be a component storing the damage inflicted to an entity.
Let say that there are enemies on the map, each enemy has an energy_gauge, maybe a damage if he has been hit and maybe a coins_reward if he his supposed to reward the player for killing him.
Let propagate_damages be the system that propagate the damages:
propagate_damages()
{
    collect_and_do<energy_gauge, damage>(apply_damage);
}

apply_damage(entity e, energy_gauge g, damage d)
{
    g.value -= d.value;

    if ( g.value > 0 )
        return;

    coins_reward r = get_optional_component<coins_reward>(e);

    if ( !r )
        return;

    reward_player(r);
}

Now how should be implemented reward_player()?
I though about the following designs:

Immediately give the reward to the player. This one seems to be out of scope for propagate_damages. Following the single responsibility principle I would rather have the player's state updated in another system.
Spawn a new entity and give him the coins_reward component as well as a collectible component. Then in a collect_rewards system collect the entities with these components and give them to the player. This one feels weird to me because temporary entities are created to carry information for another system. It feels more like I need a message system. Is it usual to have entities whose whole lifetime fits in a frame? On the plus side if I assign a position to this entity then I may be able to spawn visual indicators of the rewards on the map in another system.
Have a reference to the collect_reward system inside propagate_damages and queue the rewards here. Then process collect_reward later in the frame. If I pass the position here I can also spawn indicators on the map. In this case there no entities created but it does not feel like ECS.

For now I would go with number 2 but the entity-as-message part does not feel good. Is it how you would do it? Experienced programmers, how would you solve this problem?


texts: Why the state of the duration is all the time 7 even if updating the state inside the while in the ienumerator?

texts:
I want to get the current coroutine state.

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

public class DepthOfField : MonoBehaviour
{
    public UnityEngine.GameObject player;
    public PostProcessingProfile postProcessingProfile;
    public bool dephOfFieldFinished = false;
    public LockSystem playerLockMode;

    private Animator playerAnimator;
    private float clipLength;
    private Coroutine depthOfFieldRoutineRef;
    private DepthOfFieldModel.Settings depthOfField;
    private DepthField state;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent<Animator>();

        AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        DepthOfFieldInit(clipLength);

        state = new DepthField();
    }

    public void DepthOfFieldInit(float duration)
    {
        depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    public IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            state.duration = duration;
            state.focalLength = val;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }

    public struct DepthField
    {
        public float focalLength;
        public float duration;
    }

    public void Save()
    {
        SaveGame.Save("depthoffieldstate", state);
    }

    public void Load()
    {
        Time.timeScale = 1f;
        depthOfField = postProcessingProfile.depthOfField.settings;
        DepthField state = SaveGame.Load<DepthField>("depthoffieldstate");
        depthOfField.focalLength = state.focalLength;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, state.duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }
}

Inside the while loop I'm doing :

state.duration = duration;
state.focalLength = val;

The focalLength value does change if for example I save onethe game start the focalLength value will be 299 and if I will save after the coroutine has finished the focalLength value is 1.

But the coroutine duration value is not changing it keep staying on 7 when saving even if the coroutine has finished and should be 0 it still 7.

The value 7 of the duration is coming from the clipLength.

I can't get the current duration time of the coroutine.
In the Load function I'm starting the coroutine over again but since I'm using the loaded focalLength value and duration value it should look like the coroutine is continue from the last saved point. But I can't get the correct duration value when saving.


texts:
I'm beginner in Android programming with Andengine framework. And my question:

How to rotate an image around its own center in AndEngine?

I use Body and AnimatedSprite.

Update

This is my code:

        final AnimatedSprite face;
        final Body body;
        face = new AnimatedSprite(pX, pY, this.mCircleFaceTextureRegion,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, face,
                BodyType.DynamicBody, FIXTURE_DEF);
        face.setUserData(body);
        face.animate(200);
        face.applyTorque(100);
        face.setUserData("monster");
        this.mScene.registerTouchArea(face);
        this.mScene.attachChild(face);
        this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face,
                body, true, true));

And here in the ContactListener when have a collision with other object.

private ContactListener createContactListener() {
        ContactListener contactListener = null;
        contactListener = new ContactListener() {
            @Override
            public void beginContact(Contact contact) {
                try {
                    Fixture x1 = null;
                    Fixture x2 = null;
                    x1 = contact.getFixtureA();
                    x2 = contact.getFixtureB();
                    if (x2.getBody().getUserData().equals("player")
                            && x1.getBody().getUserData().equals("monster")) {
                        x1.getBody().setFixedRotation(true);
                        hitsound.play();
                        mEngine.vibrate(100);
                        Log.i("CONTACT", "BETWEEN PLAYER AND MONSTER!");
                    }
                } catch (Exception e) {
                    Log.d("ErrorMessage", e.getMessage());
                }
            }
            @Override
            public void preSolve(Contact contact, Manifold oldManifold) {
            }
            @Override
            public void postSolve(Contact contact, ContactImpulse impulse) {
            }
            @Override
            public void endContact(Contact contact) {
            }
        };
        return contactListener;
    }

I have set  x1.getBody().setFixedRotation(true);. But position of this object isn't kept. What is wrong with my code?