texts:
I'm using a view matrix to do camera movement and rotation.

viewMatrix = new Matrix4f();
viewMatrix.setIdentity();
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1,0,0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0,1,0), viewMatrix, viewMatrix);
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0,0,1), viewMatrix, viewMatrix);
Matrix4f.translate(new Vector3f(x * (-1), y * (-1), z * (-1)), viewMatrix, viewMatrix);

I'm manipulating the rotation values around each axis here:

//left and right
public void rotateY(float amount)
{
    ry += amount;
}

//Up and down
public void rotateUp(float amount)
{
    rx += amount;
    if(rx < -90)
        rx = -90;
    if(rx > 90)
        rx = 90;
}

This all works fine. Now i'm trying to create a more "free" camera so that i always turn left an right and don't simply rotate around the Y-Axis.

For the rotation up you simply remove the if-cause. But for the rotation sidewards you need to calculate the parts for the x- and the z-axis using sin and cos. That's where i get confused. How can i rotate sidewards correctly?


texts: I have a box with a hole in it. Is it posible to add a collider only to the dark blue showed at the img? (But only at the borders, not a box collider. Let's say i want some object to get in the box, but cannot touch the blue bars). And how to?


texts: Is multitexturing really just "using more than one texture"?

texts:
This might seem stupid, but it bugs me. From what I understand, multitexturing is just using more than 1 texture per shader (usually to blend them somehow). So instead of creating 1 texture, I create 2 or more which is... pretty obvious!

Why is there a special term for that? Is there more to it than just "using more than 1 texture"? Am I missing something?


texts: How to make the camera follow the player in Libgdx?

texts:
In Play class I have the viewport of game height=320 and game width=240unitswith camera cam. I have set the camera(cam) viewport width to 10 and viewport height to 7.I have another camera hud whose viewport width is game width and viewport height is game height. In render method, I have set Spritebatch to a projection matrix of hud.combined.Here is how the game looks like

I want the camera to follow the player. I have tried this

cam.position.set(player.getPosition().x,player.getPosition().y,0);

After doing this, the tilemap is bouncing and i can see the black portion of the screen


texts: Using atan2 to calculate angle between two vectors

texts:
I understand that:

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

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

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

My question is very simple:

Will the two following formulas produce the same number?

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

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

Thanks


texts: How can I map thumbsticks to cardinal directions?

texts:
I've got a tile based game that has notions of moving up, down, left, right and the diagonals (by alternating horizontal/vertical movement).

I've found that if I use the default ThumbStick<Direction> buttons that XNA provides I'm often moving diagonally instead of in a straight line. E.g. moving the thumbstick left, often just triggers 'down' too (but only just).

How can I map moving a thumbstick to the 8 discrete directions so this accidental diagonal movement doesn't occur?

I'm starting to think about favouring up/down/left/right over diagonals (as you more frequently move straight in my game), however, I'm not sure how do put this into code.


texts: A friend and I want to try making an iPhone game, but we don't really have a budget to speak of. From what I've found, I need the iOS SDK, and that costs money. Is there really no way to make an iPhone game on a $0 budget? If not, can I do so for the Android?


texts: Quaternion.Lerp does not actually rotate object when called inside an "if" clause

texts:
Let's say I have a RotatableObject class, which inherits from MonoBehaviour. Here is its Start() method:

private void Start() {
    this.startingLocalRotation = this.transform.localRotation;
    this.finalLocalRotation = Quaternion.Euler(this.startingLocalRotation.eulerAngles.x, -150f, this.startingLocalRotation.eulerAngles.z);

    // Initialize other private fields
}

It has a method called Rotate(), defined as follows:

private void Rotate() {
    this.transform.localRotation = Quaternion.Lerp(this.startingLocalRotation, this.finalLocalRotation, 0.2f);
}

Given the following Update() method, the object rotates as expected:

private void Update() {
    this.Rotate();
}

However, if I make the following changes to Update(), then the object does not actually rotate, even though the Rotate() method is hit:

private void Update() {
    if (this.SomeCondition) {
        this.Rotate();
    }
}

this.SomeCondition always has the value true over multiple frames.

What is my mistake, and how can I fix it?

EDIT:

In response to this comment:

  When you say "the object rotates as expected" do you mean that the
  object rotates from starting angles until final angles and then stops
  rotating (without the if) ?

Yes.

  could you provide some more details about what SomeCondition is?

this.SomeCondition is determined by the state of another object, say, Puppy. E.g. if puppyInstance.Mood == Mood.Happy, then this.SomeCondition is true.

  Did you try replacing the condition with the word true

No, I have not tried that. However, when stepping through the call stack in debug mode, I can see that this.SomeCondition is true and Rotate() is called -- I managed to step into the Rotate() method itself.

EDIT:

I tried the first approach described in this answer. However, it did not produce the effects that I was aiming for.

I set a breakpoint here:

transform.localRotation = Quaternion.Lerp(
   startingLocalRotation,
   finalLocalRotation,
   _rotationProgress
);

Every single time the breakpoint was hit in the Update() call, I could see that the value of _rotationProgress was steadily increasing. However, the value of transform.localRotation never actually changed -- it was always (-0.7, 0.7, 0.0, 0.0).

If I updated transform.localRotation outside of an if clause, however, that game object rotates as expected -- transform.localRotation gets updated as _rotationProgress gets updated.

EDIT:

Never mind, I am an idiot. The problem lies elsewhere in the code. The suggested approach works and I have accepted it as the answer.


texts:
I'm an mobile and web developer. I got interested in game development couple of weeks ago and I'm really looking forward to work on a mobile game.

I will be doing everything including the game design part. The problem is that I never designed something from scratch. Simple and static objects are not my concern, my main concern is dynamic objects, like a moving character. Should I draw multiple images of the character in different steps or am I missing something?

I'm not looking for something advanced, all I need to know some details about drawing and design for 2d games development.


texts: In SDL2, how do I determine if a key was pressed or released this frame?

texts:
Determining if a key is currently down is easy. Just return keys[scancode]:

switch (ev.type) {
    case SDL_KEYDOWN:
        keys[ev.key.keysym.scancode] = true;
        break;
    case SDL_KEYUP:
        keys[ev.key.keysym.scancode] = false;
        break;
}

Determining if a key was pressed or released this frame is another thing. I just don't know where to start here. It would be accessed by keyPressed(scancode) / keyReleased(scancode), what's a good way to do this?

Of course it would also be easy to do if I just handled it inside of the event handler itself but I'm just using functions anything can call to check the keys.


texts: Clipping wrong results in C++ DIRECTX 11

texts:
Im trying to do some clipping but having some weird results. The triangle is not getting clipped how it should be. Here are some images.
The second image is how it should.

video of what is happen VIDEO OF WHAT IS HAPPENING

What is wrong with my code that is making the triangle wrong way.

CLIPPING ALGORITHM

ClipVertex( const Vector3& end )
{
    float BCend = mPlane.Test(end);
    bool endInside = ( BCend >= 0.0f );

    if (!mFirstVertex)
    {
        // if one of the points is inside
        if ( mStartInside || endInside )
        {
            // if the start is inside, just output it
            if (mStartInside)
                mClipVertices[mNumVertices++] = mStart;

            // if one of them is outside, output clip point
            if ( !(mStartInside && endInside) )
            {
                float t;
                Vector3 output;
                if (endInside)
                {
                    t = BCend/(BCend - mBCStart);
                    output =  end - t*(end - mStart);
                }
                else
                {
                    t = mBCStart/(mBCStart - BCend);
                    output = mStart + t*(end - mStart);
                }
                mClipVertices[mNumVertices++] = output;
            }
        }
    }
    mStart = end;
    mBCStart = BCend;
    mStartInside = endInside;
    mFirstVertex = false;

}

PLANE EQUATION

Plane clipPlane( 1.0f, 0.0f, 0.0f, 0.0f );

In directx 11 in a Left Handed system


texts: How can I stop players from cheating on puzzle levels by finding solutions on the web?

texts:
In a level based, puzzle-like, game, how can we prevent the gamers to be searching on the Internet for solutions to a specific level? I'd like to let players fairly compare their scores.

I've thought about adding some randomness to the levels, but that has the downside of losing control over how hard the level is, and how it feels.

Are there specific strategies to solve this issue?


texts: Cannot get a handle on a GameObject velocity through another GameObject in Unity

texts:
I'm trying to make a brick breaker game in Unity, using 2D. I have an object that randomly spawns when a brick is destroyed. One of them is a "slowdown" object to slow down the projectile. However, whenever I "catch" the spawn with my paddle, it seems as if I don't have the same instance of the ball.

For instance, I Debug.Log the velocity of the ball through RandomSpawns.csscript, it will show as (0,0). At the same time, if I show the ball velocity through ball.cs, it will show the right velocity

RandomSpawning.cs:

using UnityEngine;
using System.Collections;

public class RandomSpawns : MonoBehaviour
{
    public paddle paddle;
    public LoseCollider loseCollider;
    public ball ball;
    public Brick brick;

    public string nameOfSpawn;

void Update()
{

    // Finds object with Spawn tag and if lower than paddle y pos, means
    // that player missed the spawn -->destroy to not reset the game

    if (GameObject.FindGameObjectsWithTag("Spawn") != null)
    {
        if (this.transform.position.y < paddle.transform.position.y)
        {
            Destroy(gameObject);
        }
    }
}

void OnTriggerEnter2D(Collider2D collision)
{
    if (collision.gameObject.tag == "paddle")
    {
        triggeredEffect();
        Debug.Log("Right here");
        Destroy(this.gameObject);
    }
}

void triggeredEffect()
{
    if (string.Equals(nameOfSpawn, "slowdown"))
    {
        Debug.Log("current velocity " + ball.GetComponent<Rigidbody2D>().velocity);
        Vector2 velocity = ball.GetComponent<Rigidbody2D>().velocity;
        ball.GetComponent<Rigidbody2D>().velocity = velocity * 0.5f;
        Debug.Log("slowdown: new velocity" + ball.GetComponent<Rigidbody2D>().velocity);
    }
}

I also tried using this, to no avail:

 GameObject ball = GameObject.Find("ball");
 ball currentBall = ball.GetComponent<ball>();
 Debug.Log("current velocity " + currentBall.GetComponent<Rigidbody2D>().velocity);
 Vector2 velocity = currentBall.GetComponent<Rigidbody2D>().velocity;
 currentBall.GetComponent<Rigidbody2D>().velocity = velocity * 0.5f;
 Debug.Log("slowdown: new velocity" + currentBall.GetComponent<Rigidbody2D>().velocity);

This just gives me an "Object reference not set to instance of object" error.

ball.cs:

using UnityEngine;
using System.Collections;

public class ball : MonoBehaviour
{
    private paddle paddle;
    private bool hasStarted = false;
    private Vector3 paddleToBall;

    void Start ()
    {
        paddle = GameObject.FindObjectOfType<paddle>();
        paddleToBall = this.transform.position - paddle.transform.position;
        print(paddleToBall);
    }

    // Update is called once per frame
    void Update ()
    {
        if (!hasStarted)
        {
            this.transform.position = paddle.transform.position + paddleToBall;
            if (Input.GetMouseButtonDown(0))
            {
                this.GetComponent<Rigidbody2D>().velocity = new Vector2(.5f, 10f);
                hasStarted = true;
            }
        }
    }

    void OnCollisionEnter2D(Collision2D collision)
    {
        Vector2 tweak = new Vector2(Random.Range(0f, .2f),Random.Range(0f, .2f));
        if (hasStarted)
        {
            GetComponent<AudioSource>().Play();
            GetComponent<Rigidbody2D>().velocity += tweak;
        }
    }
}


texts:
First, a quick overview of my problem: I have a game entity which has a quaternion to represent its rotation/orientation. It also has a 3D vector in world space for its linear velocity. From the perspective of the entity there are also 3 virtual axes (the standard z=forward/backword, y=up/down, x=left/right).

With those relevant pieces, I want to find the amount of velocity relative to one of the entity's virtual axes (i.e. how fast is it moving to its right) so that I can display that to the player and/or apply a counteracting force in that direction.

I have a vague idea that I need to transform the unit vector corresponding to the direction I'm querying by the orientation quaternion and then calculate the angle between the result and the velocity vector. Then with that angle figure out how much of the velocity magnitude is in the target direction (maybe using cosine?).


texts: Is there a term for an incorrect interpretation of game memory?

texts:
In Prince of Persia, using cheats in certain rooms can access "secret" rooms with strange graphics, like in this video. This effect is caused by the game referencing parts of memory which are invalid or containing garbage. For games running on MS-DOS with little bounds checking and no virtualisation, such memory access doesn't result in a crash, but in the game trying to interpret it as a valid and relevant memory instead.

If the data doesn't cause any other crash (e.g. divide by zero), the game might interpret the memory as an entirely new location in the game (room, level), possibly even with new graphics (with "random" pixels) or enemies.

I would like to know how this effect of misintepreting incorrect parts of memory as valid game locations is called.

The affected games that I know about:

Prince of Persia, using cheats or modified rooms to enter undefined rooms with weird tiles or enemies.
Commander Keen 4, saving with the viewport near the level edge displays garbage graphics after subsequent load.
Dangerous Dave, entering a non-existing warp zone displays parts of other levels or weird tiles.

I am also curious about other games where this can be found.


texts: how to improve sprite animations to reduce FPS

texts:
My game has different, and detailed animations throughout the game. For example, the main character has an idle stance, so its not just painted still, giving him some life. Death animation, hurt animation, etc... even the background scenario has animations(which I don't think I went with the best approach here, but, it's working for now, this will be in another thread if not answered here)
Anyways, the thing is, while the main character had these animations only that character was in the game at that time, so everything ran smoothly. After adding another character, the enemy, the burden of animations seems to overcharge the FPS and just slows the game down. The most obvious of this problems was that the spritesheet I was using was 1 per character, I figured how to use spritebatchnode efficiently and now 1 spritebatchnode covers the 2 characters animation set.
The FPS tried to get back to normal, but its still laggy at times. This worries me because my game design has more enemies to the game, meaning that it will have this issue in a bigger scale.
So I believe that its because of my animation approach, its poor, and inefficient making my game run slow.

I have been trying to find the answer online with no luck, and I don't my approach is the best. I tried working some solutions by my own, but they end up in the same thing. THE ONLY, the only way I find how to reduce this problem is to make my sprites smaller, its not a big deal, but I wouldn't like this solution.


texts: Unity: 'Quaternion.RotateTowards' animation is too fast (instantaneous)

texts:
I have a 'block-on-a-hinge' scenario where I just want it to smoothly rotate into the position of a stair step. I messed with this for a day and finally verified that my start and end angles are correct. The problem now is that the rotation animation is instantaneous instead of smooth over time. How can I adjust this so the rotation takes about 2 seconds? Plugging this into the 'maxDegreesDelta' argument felt intuitive but didn't do anything at all:

endAngle * Time.deltaTime / 2.0f

See the Documentation

video footage

The block itself is parented to this empty (hinge location):

The parent of all the hinges is just 10 blocks in a row rotated by \$-\arctan{\left(\frac{4}{3}\right)}\$ (so that is the angle to be undone):

Here is the script:

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

public class SpinningStep : MonoBehaviour
{
    [SerializeField]
    GameObject triggerObj;
    bool disabled = false;
    Quaternion startAngle;
    Quaternion endAngle;
    // Start is called before the first frame update
    void Start()
    {
        startAngle = transform.localRotation; // correct
        Debug.Log(startAngle.eulerAngles);
        endAngle = startAngle * Quaternion.Euler(Mathf.Rad2Deg * Mathf.Atan(4.0f / 3.0f),0,0);
        Debug.Log(endAngle.eulerAngles); // FINALLY correct!
    }

    // Update is called once per frame
    void Update()
    {
        disabled = GameObject.Find(triggerObj.name).GetComponentInChildren<ItemBox>().disabled;

        if (disabled)
        {
            gameObject.transform.rotation = Quaternion.RotateTowards(startAngle, endAngle, Time.deltaTime);
        }
    }
}

EPILOGUE - Corrections:

This script, based off of feedback and answer from DMGregory, eliminates initialization errors for the triggerObj and gives smooth time animation:

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

public class SpinningStep : MonoBehaviour
{
    [SerializeField]
    ItemBox triggerObj;
    bool disabled = false;
    Quaternion startAngle;
    Quaternion endAngle;
    // Start is called before the first frame update

    float rotationSpeed;

    void Start()
    {
        float travelDegrees = Mathf.Rad2Deg * Mathf.Atan(4.0f / 3.0f);
        startAngle = transform.rotation;
        endAngle = startAngle * Quaternion.Euler(travelDegrees, 0, 0);

        // Speed in degrees per second.
        rotationSpeed = travelDegrees / 2.0f;
    }

    void Update()
    {
        if (triggerObj.disabled)
        {
            transform.rotation = Quaternion.RotateTowards(
                  transform.rotation,
                  endAngle,
                  rotationSpeed * Time.deltaTime  // Our third argument is a degree limit.
            );
        }
    }

I knew that how I was getting the trigger was garbage and wanted to ask, because I had trouble making it work, but I wanted to keep this question focused. Very silly oversight not using the name of the script as the type. Thanks!


texts: Reusing entities across screens: game data vs. object modelling

texts:
I'm working on a 2D RPG. I currently have a MainWorldScreen which has a Player entity, and some MapObjects that he can collide against. The player has a few components (sprite, keyboard input) etc. that implement specific logic for it to work in the main world screen.

The problem now arises when I start working on a "battle" screen. The crux of it is, should I reuse/extend my Player entity or create one entity per screen?

Up to now, components are all behaviour based -- sprites to display something on-screen, input components to capture and expose events to handle input, etc. My entities are a composition of components that implement game logic (eg. move on keyboard click).

If I did this as "pure" object-oriented, I would probably have a larger Player class which had all the combined attributes needed for all screens -- list of equipment, health, etc. and each screen would only take what it needs.

However, since I have components, if I reuse my player entity, it doesn't make much sense to reuse it; I will have to remove and re-add new components, since screens use completely different data, and I don't really know where the player state should go (eg. equipment).

What's the right way to handle this? Should I go with one Player entity per screen (at least with these two screens)? Should I keep player state in the entity, and just add/remove components depending on the screen when I pass it from screen to screen?


texts:
I started a 2D Tilegame programmed with libgdx which needs potentially infinite tiles. That means when the player arrives the border of the map it should be possible to generate even more tiles. So a simple 2D Array is not the best datastructure for that purpose.
A better solution I found here in the comments from dlras2:
A way to store potentially infinite 2D map data?

it seems like he put 2D arrays in 2D arrays and that again and again, that reduces a lot of memory compared to one array for all tiles:

The problem is that I dont know before how many times the arrays will be encapsulated so it should be easily possible to wrap a new Array around if it is needed.

dlras2 also posted his code in C#, but I dont understand anything from it. Do you have an idea how to implement such a datastructure of recursive Arrays in Java? Or how to translate the whole C# code into Java? I hope the other stuff like putting tiles in the right array I'll solve by my selve.


texts:
I try to implement refilling lives functionality after exit application. Every live is refilling after 25 minutes, but unfortunately only if the user is in the game.
Here is the sample code:

private void ResetOneLive()
    {
        if (currentLives < MAX_LIVES)
        {
            if (!resetLiveTime.HasValue || DateTime.Now < resetLiveTime.Value)
            {
                if (resetLiveTime.HasValue)
                {
                    TimeSpan remaining = resetLiveTime.Value - DateTime.Now;
                    string timerCountdownText = string.Format("{0:D2}:{1:D2}", remaining.Minutes, remaining.Seconds);
                    timeToNextLive.text = timerCountdownText;
                    if (timerCountdownText == "00:00" && resetLive)
                    {
                        this.currentLives += 1;
                        Debug.Log("+1 live");
                        PlayerPrefs.SetInt(PLAYER_PREFS_LIVES, this.currentLives);
                        resetLive = false;
                    }
                }
            }
            else
            {
                //for develop purpose set 10 sec
                resetLiveTime = DateTime.Now.AddSeconds(10);
                resetLive = true;
            }
        }
    }

In the game I call this function in Update(). I tried to call it OnApplicationQuit and OnApplicationPause but it does not work.

Can someone tell me how i can implement that functionality?


texts: Unity3d - AudioSource is not playing if gameObject is removed after play was started

texts:
I am not able to play my audio source if I deactivate the panel where the AudioSource is attached to AFTER it.

    _audioBtnEnter = tmpBtnGeneral.GetComponent<AudioSource>();
    _audioBtnEnter.Play();
    tmpBtnGeneral.SetActive(false);

I would totaly understand if this would not be possible:

    tmpBtnGeneral.SetActive(false);
    _audioBtnEnter.Play();

But why does the first code not trigger the audio play?

Is this a race condition problem?


texts: How to implement path-finding with a large number of blocking agents following similar paths?

texts:
I want to implement a demo like creeps laning in Dota 2.
So for simplicity, there is Left team and Right team, they are enemies.

Units from Left team move toward Right base, and units from Right team move toward Left base.
In their path, if those units encounter unit from enemy team, they will start to fight the enemy unit.
One unit could attack an enemy unit.
In their path, those units should avoid ally unit, they should not collide each other.

For 2 and 4, I want to have the feature that is: When encounters any enemy, one unit should seek its path to be able to fight the enemy unit. Consider this image:

There are some units blocked by their ally, so when an unit blocking the path disappear, another closest ally unit should move on, or move to attack their nearest enemy unit.

I wonder if A* should be applied for the demo. My demo is more simple than Dota 2, it does not have static obstacles, it just has dynamic obstacles (moving units). My main question is, What strategies/algorithms should I apply to implement my demo?

Thanks


texts:
For example sake:

Let's say there are 10 rooms in the world.
And let's say the world is inhabited by 10 entities.
And each entity has it's own "daily routine" where it performs
certain actions in the room and also might navigate between the rooms
as well.

Given that the player can only be in one room at a time, what is a good way to keep track of the actions the other entities are performing in other rooms offscreen?

The most straightforward option is to check on each of the 10
entities on every frame, check their position/state and determine
whether or not the entity should be in the room where player is
located in at any given time.  ( This however feels really resource
heavy especially as the room/entity amount is increased. )
Another option is to keep track of the time that has passed since
the start of the game, then each of the entities checks whether its
pattern intersects with the room the player is on, and if it does it
checks against the time whether or not the entity is supposed to be
in the same room at this particular time, entities whose patterns do
not intersect with the current room the player is located in do
nothing until the player enters a room which their pattern
intersects and only at that point calculate whether or not they
should render. ( But if they interact with the room, then they will
have to always check the state of the rooms which intersect their
route in order to determine their location at that point in time,
which is not that great. )
The third option I came to would be to first of all only look at the
    routes which intersect the player location (as described
    previously), secondly upon entering a room, check if the player is
    in that room, if not then to only check the state of the room and
    how long will it take to proceed to the next room. For example a
    janitor NPC enters the room, checks the state of the room, sees that
    there is a spillage made by player, calculates how much time it will
    take to clean that up and how long the pathing will take etc. And
    until the mentioned time is due to enter the next room we only check
    if the player is in the room. The exact location of the NPC for
    rendering purposes would only be calculated when the player enters
    the room.

After brainstorming a while I came to the third option, but I was wondering if perhaps there is a known or better way to handle things like these?


texts:
I want to animate UI elements, like HP bars, by moving and resizing them. How can I efficiently resize sprites every frame?

I am using the LibGDX framework.


texts: Broad topics needed for teaching game development

texts:
I am going to be doing a presentation on game development to an iPhone user group in the near(ish) future. My audience are iPhone developers, but not necessarily very experienced ones, and this is meant to be an introduction.

My question is, what broad topics are needed to understand game development? I acknowledge that this is fairly subjective, but I really am hoping for a comprehensive list of high-level topics that apply to a broad enough swath of games that anyone interested in the topic SHOULD know about them. I would be ecstatic with some pointers to any resources that attempt to make a list such as this this. (I have looked, but my google-fu is failing me tonight.)

Here's what I have so far:

The Game Loop

a sub-note about event driven games

2D Animation

sprites/texture maps

3D Animation

importance of frameworks
modeling software

Particles and particle effects
hit detection
AI

Obviously I will not be covering all these topics with any depth, more like simply defining them so that after my talk, the audience will (hopefully) be able to wrap their heads around how any given game might be developed.

What am I missing?


texts:
I want to create a list of buttons with ScrollPane , but I cant create a ScrollPane . In the constructor method in the examples Skins are used (.atlas , .json files) but how to create these files?

Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));

Is there a program to generate this json ? As I noticed a lot of Scene2D elements need skins.


texts: Collision detection in games in 3D - edge to edge cross product

texts:
I am having trouble understanding why, in a game collision detection, separating axis determination requires checking for the cross product of edges of the two polytopes as additional potential separating axes. In 2D the process is much more intuitive, in that it only checks the edges normals as potential separating axes.

I have been thinking about this very hard but I cannot visualize this at all, nor can I find a good motivating example or explanation.


texts: "Squeezing" a game object based on distance to another game object

texts:
I am trying to "squeeze" a gameObject. When distance starts to be 6.98, execute this code: "The smaller the distance between gameObject1 and gameObject2, the thinner and longer this gameObject is". Somehow, this code has no effect. Why?

public Transform gameObject1;
public Transform gameObject2;

void Update ()
{
    float distance_squeeze = Vector3.Distance(gameObject1.position,
                                              gameObject2.position);
    if(distance_squeeze < 6.98F)
    {
        transform.localScale = new Vector3(-distance_squeeze, distance_squeeze, 1);
    }
}


texts: Unity rope/cable physics / anchor points

texts:
I'm creating a cable in Unity, which should behave realistically. I found 2 different ways to approach the problem.

First was to simply rigg a subdivided cylinder in Blender, Cinema4D or whatever editor you like and you set up hinge joints between the bones in Unity.

Second approach was to apply a Cloth Component in Unity. I tried the second approach with the cloth component. The physics work nice, but I don't know, how to make anchor points for the cloth object. I'm just able to add colliders, but the object is slipping away pretty fast from them.

So my first question is, which approach has the most benefits above the other and which benefits do they have. Second question, how can I create anchor points for my cloth object.


texts:
I wonder if someone could provide some guidance.

Im attempting to create a pendulum like behaviour in 2D space in Unity without using a hinge joint.

Essentially I want to affect a falling body to act as though it were restrained at the radius of a point, and to be subject to gravity and friction etc.

Ive tried many modifications of this code, and have come up with some cool 'strange-attractor' like behaviour but i cannot for the life of me create a realistic pendulum like action.

This is what I have so far:

    startingposition = transform.position;          //Get start position
    newposition = startingposition + velocity;      //add old velocity
    newposition.y -= gravity * Time.deltaTime;      //add gravity
    newposition = pivot + Vector2.ClampMagnitude(newposition-pivot,radius); //clamp body at radius???
    velocity = newposition-startingposition;        //Get new velocity
    transform.Translate (velocity * Time.deltaTime, Space.World);   //apply to transform

So im working out the new position based on the old velocity + gravity, then constraining it to a distance from a point, which is the element in the code i cannot get correct. Is this a logical way to go about it?


texts: How can I measure ms between frame to reproduce it

texts:
Hello I'm coding a extension to an existing game - not really an extension since a re-code all so the it looks like another adventure for player - and to achieve it I use existing tilesets and so, but my main problem is for animated tilesets, I can't find anywhere the frame rate, sometimes I assumed it was simply 60fps (16.67ms between frame) because I figured out testing that it should be somewhere between 15ms and 20ms, but I have to good way to figure it out, I wanted to use something like OBS in 1000 fps but it doesn't seem available, in any other recording app neither. How would/did you guys do what I need to?
Thanks in advance and gl in your own projects!

EDIT1: I'm trying to find the intended frame rate of the animation (that is, how long the author of the animation expected each frame to stay on screen?) ; Because sometimes it's really really short like around 15ms how can I do that? My question is not about global fps but some animated tile fps


texts:
GLuint VertexArrayID;
glGenVertexArrays(1, &VertexArrayID);
glBindVertexArray(VertexArrayID);

As you can see from the above code, some tutorials use this before using opengl. But a tutorial that I am following, directly uses glGenBuffers  method and it works just fine. Hence I am totally confused what glGenVertexArrays. It is sad that it defines how buffer is used, but noone says in what way. Can you help me understand ?


texts: How do I draw a name above monsters head?

texts:
My player HUD works perfect, but when I move, the monster name moves with me instead of getting attached to the monster.
Player has a HUD and I'm using Scene2D.ui to pull it off and works great.
I use unit scale, that's why I got 2 camera. One for UI stuff and other for game.
 public void update(float deltaTime) {
    // update creatures
    world.getPlayer().onThink(deltaTime);
    for (Monster monster : world.getMonsters()) {
        monster.onThink(deltaTime);
    }

    // update camera to the player
    camera.position.set(world.getPlayer().getPosition(), 0);
    camera.update();
}

@Override
public void render(float deltaTime) {
    // clear screen
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // seprate update logic
    update(deltaTime);

    // set camera to what we see
    worldRenderer.renderer.setView(camera);
    worldRenderer.renderer.render();

    // draw world
    game.spriteBatch.setProjectionMatrix(camera.combined);
    worldRenderer.render();

    // monster UI
    game.spriteBatch.setProjectionMatrix(uiCam.combined);
    for (Monster monster : world.getMonsters()) {
        uiCam.project(uiPosition.set(monster.getPosition().x, monster.getPosition().y, 0));
    }

    game.spriteBatch.begin();
    Assets.font.draw(game.spriteBatch, "Firefox", uiPosition.x / 2, uiPosition.y / 2);
    game.spriteBatch.end();

    // Player Hud
    game.spriteBatch.setProjectionMatrix(hud.stage.getCamera().combined);
    hud.stage.draw();
}

I'll appricate all kind of suggestions! If i could use Scene2D.ui for monsters aswell, would be great.
Cheers.


texts: Combine all animation state into one clip (.anim) file in unity

texts:
I have an animation controller where different animation states(clips) are available. Like this:

Now my aim is to convert all this states animation into a single clip (.anim file). Is this possible. ?
I am able to copy one animation clips frame using this. But it very time consuming.


texts: What is the best way to implement collision detection using Bullet physics engine and a track generated from a curve?

texts:
I am developing a small racing gam, the track is generated from a curve.

As said above, the track is generated, but not infinite. The track of one level could fit with no problem in memory and will contain a reasonably small amount of triangles.

For collisions, I would like to use Bullet physics engine and know what is the best way to handle collisions with the track efficiently.

NOTE : The track will be stored as a static rigid body (mass = 0). The player will be represented by a sphere shape for collisions.

Here is some possibilities i have in mind :

Create one rigid body, then, put all triangles of the track (except non collidable stuff) into it. Result : 1 body with many triangles (eg : 30000 triangles)
Split the track into several sections (eg: 10 sections). Then, for each section, create a rigid body and put corresponding triangles in it. Result : small amount of bodies with relatively small amount of triangles (eg : 1500 triangles per section).
Split the track into many sub-sections (eg : 1200 sections). Here one subsection = very small step when generating the curve. Again for each sub-section, create a body and put triangles in it. Result : many bodies with very small amount of triangles (eg : 20 triangles). Advantage : it could be possible to "extra data" to each of the subsection, that could be used when handling collisions.
Same as 2, but only put  sections N and N+1 in physics engine (where N = current section where the player is). When player reach section N+1, unload section N and load section N+2 and so on... Issue : harder to implement, problems if the player suddenly "jump" from one section to another (eg : player fly away from section N, and fall on section N + 4 that was underneath : no collision handled, player will fall into void )
Same as 4, but with many sub-sections. Issues : since subsections are very small there will be constantly new bodies added and removed to physics engine at runtime. Possibilities for player to accidently skip some sections and fall into the void are higher than 4.


texts: How can I make a character stand on slopes?

texts:
First of all, note that I want to understand the principle, so I would prefer explanations in plain english (but of course I have nothing against some code to complement these explanations).

I am wondering what is the way to make a character step correctly on a slope, let's start with two screenshots of the game Limbo to show you what I mean :

So, as you can see on these pictures, it looks like the spine of the character is actually perpendicular to the horizon and not to the surface of the ground and this observation leads me to my question:
How can you reproduce such a behavior with Sprite Kit ? Because if I attach a physic body to a node, I have the possibility to let it rotate, so I would get something like this :

If I disable the rotation I would get something more like this :

As you can see these ways to do both present important issues and doesn't looks natural at all. So how should I do to make it look natural ? I thought to create several sprites and several physics bodies and then attaching them all together with joints I don't think that it will look natural because if you look at this :

Although I can physically link these nodes, how will I do to make them look real graphically ? Because in the reality, for example, the thigh and calf are linked by a knee...

Any ideas ?


texts: What are some effective methods of documenting packet protocols?

texts: I'm working with a few developers on a hobby project and we have a lot of different APIs. What are some popular methods of creating documentation on the potential requests, and what can be expected to be returned? Is there any fancy automatic generation tools for this?


texts:
I have this code for a arraylist of entities.

All the entities use the same random and so all of them move in the same direction. How can I change it so it generates a new random number for each entity?

public void moveFemale() {
    for(int i = 0; i < 1000; i++){
        random = rand.nextInt(99);
    }

    if (random >= 0 && random <= 25) {
        posX -= enemyWalkSpeed; // right
    }

    if (random >= 26 && random <= 50) {
        posX += enemyWalkSpeed; // left
    }

    if (random >= 51 && random <= 75) {
        posY -= enemyWalkSpeed; // up
    }

    if (random >= 76 && random <= 100) {
        posY += enemyWalkSpeed; // down
    }
}

Is this correct?

public void moveFemale() {
    for (Female female: GameFrame.females){

        female.lastChangedDirectionTime += elapsedTime;

        if (female.lastChangedDirectionTime >= CHANGE_DIRECTION_TIME)
        {
            female.lastChangedDirectionTime = 0;

            random = rand.nextInt(100);

            if (random >= 0 && random <= 25) {
                posX -= enemyWalkSpeed; // right
            }

            if (random >= 26 && random <= 50) {
                posX += enemyWalkSpeed; // left
            }

            if (random >= 51 && random <= 75) {
                posY -= enemyWalkSpeed; // up
            }

            if (random >= 76 && random <= 100) {
                posY += enemyWalkSpeed; // down
            }
        }
        }
    }


texts: Are there performance benefits to using WaitForSeconds vs checking elapsed time in FixedUpdate in Unity?

texts:
I was considering that perhaps just checking the time and then doing some work in the Update function might look cleaner than calculating how long to wait for and calling yield new WaitForSeconds() on two interleaving processes, so I became curious whether there is a huge difference between the two options.

Doesn't WaitForSeconds just work by calling an iterator after a certain amount of time has elapsed? So I assume that a timer is checked on each update, and when the time has elapsed, the IEnumerator's movenext function is called.

However, I thought it couldn't hurt to ask someone just in case there is some huge difference in performance.


texts: OpenGL ES 2.0: Moving Camera in Orthogonal (2D) Projection

texts:
I have quite large 2D game scene. The scene is much larger than the screen of the LCD. Therefore, I have to move the camera (view) in desired directions, to display particular parts of the scene.

What is the correct way of moving viewport over the scene, in Orthogonal (2D) projection, please?

There are two solutions coming to my mind:

Using GluLookAt(), which is designed to move camera moslty in Perspective Projection, but it could work well for 2D as well. However, not all of the GluLookAt() parameters would be utilized in Ortho configuration.
Using opposite View Translate transformation. This would mean, if I need to move my 2D camera 10 units to the right(positive x axis), I would apply opposite Translate transformation to every scene vertex (negative x axis). This way, I would create illusion, the camera moves to the right.

These are the solutions coming from my mind. However, because, i am self taught, is there any correct and recommended way of moving camera over the 2D scene, please?


texts:
I currently have a simple Tetris-like game and have come across a problem I cannot solve.

Unlike Tetris where there is a single falling shape, I have multiple, potentially interlocking shapes that need to fall; I need to calculate their final positions. Consider the following:

To calculate the final position of the green shape, I simply scan down for every square until I hit another square or the edge of the board. Done
For multiple, simple shapes I work my way UP the board. Thus the red is found to not need moving, the orange goes down by one, the green down by three. Done
I don't know how to treat the interlocked green and red shapes. Using the logic of #2 we would end up "stuck" floating mid-air. If I scan down for the green shape, I encounter the red and thus do not move, and vice-versa for the red. The solution might be to treat the two shapes as one.
Similar to #3, in this scenario I could also succeed by treating the objects as one.
Unlike #3 and #4 I could not treat the shape as one as the orange shape would end up floating one-square too high...
Another variation of problem #6.

There could be other scenarios whereby I have many many shapes that interweave in more and more complex scenarios, but I think the above covers the most fundamental parts of the problem.

I feel like there's an elegant solution that I've yet to encounter / think up and would be very grateful at any insight, ideas or resources.

SOLUTION

The solution I've come up with is indeed elegant, based on @user35958's answer below, I have created the following recursive function (pseudo code)

function stop(square1, square2){
    // Skip if we're already stopped
    if(square1.stopped){
        return;
    }
    // Are we comparing squares?
    if(!square2){
        // We are NOT comparing squares, simply stop.
        square1.stopped = true;
    } else {
        // Stop IF
        // square1 is directly above square2
        // square1 is connected to square2 (part of the same complex shape)
        if(square1.x == square2.x && square1.y == (square2.y+1) || isConnected(square1, square2)){
            square1.stopped = true;
        }
    }
    // If we're now stopped, we must recurse to our neighbours
    stop(square1, squareAbove);
    stop(square1, squareBelow);
    stop(square1, squareRight);
    stop(square1, squareDown);
}

Animated GIF showing each pass of the solution

To summarise:

When "stopping" a square, we also stop:

ANY square above it. ALWAYS.
Neighbouring square that we are connected to (ie the same shape).

We stop the entire bottom row, and the function recurs up through the squares.
We repeat until all squares are stopped.
Then we animate.


texts: What are the most common AI systems implemented in Tower Defense Games

texts:
I'm currently in the middle of researching on the various types of AI techniques used in tower defense type games. If someone could be help me in understanding the different types of techniques and their associated advantages.

Using Google I already found several techniques.

Random Map traversal
Path finding e.g. Cost based Traversing Algorithms i.e. A*

I have already found a great answer to this type of question with the below link, but I feel that this answer is tailored to FPS. If anyone could add to this and make it specific to tower defense games then I would be truly great-full.

How is AI most commonly implemented in popular games?

Example of such games would be:

Radiant Defense
Plant Vs Zombies - Not truly Intelligent, but there must be an AI system used right?
Field Runners

Edit: After further research I found an interesting book that may be useful: http://www.amazon.com/dp/0123747317/?tag=stackoverfl08-20


texts: openGL ES - change the render mode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY on touch

texts:
i want to change the rendermode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY when i touch the screen.

WHAT i Need :
Initially the object should be stationary. after touching the screen, it should move automatically. The motion of my object is a projectile motion ans it is working fine.

what i get : Force close and a NULL pointer exception.

My code :

public class BallThrowGLSurfaceView extends GLSurfaceView{

MyRender _renderObj;
Context context;
GLSurfaceView glView;

public BallThrowGLSurfaceView(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    _renderObj = new MyRender(context);
    this.setRenderer(_renderObj);
    this.setRenderMode(RENDERMODE_WHEN_DIRTY);
    this.requestFocus();
    this.setFocusableInTouchMode(true);
    glView = new GLSurfaceView(context.getApplicationContext());
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    // TODO Auto-generated method stub
    if (event != null)
    {
        if (event.getAction() == MotionEvent.ACTION_DOWN)
        {
            if (_renderObj != null)
            {   Log.i("renderObj", _renderObj + "lll");
                // Ensure we call switchMode() on the OpenGL thread.
                // queueEvent() is a method of GLSurfaceView that will do this for us.
                queueEvent(new Runnable()
                {
                    public void run()
                    {
                        glView.setRenderMode(RENDERMODE_CONTINUOUSLY);
                    }
                });
                return true;
            }
        }
    }
    return super.onTouchEvent(event);
}

}

PS : i know that i am making some silly mistakes in this, but cannot figure out what it really is.


texts: How to blur image using glsl shader without squares?

texts:
I want to blur image with Gaussian blur algorithm. And I use the following shaders:

Vertex shader

attribute vec4 position;
attribute vec4 inputTextureCoordinate;

const int GAUSSIAN_SAMPLES = 9;

uniform float texelWidthOffset;
uniform float texelHeightOffset;

varying vec2 textureCoordinate;
varying vec2 blurCoordinates[GAUSSIAN_SAMPLES];

void main()
{
    gl_Position = position;
    textureCoordinate = inputTextureCoordinate.xy;

    // Calculate the positions for the blur
    int multiplier = 0;
    vec2 blurStep;
   vec2 singleStepOffset = vec2(texelHeightOffset, texelWidthOffset);

    for (int i = 0; i < GAUSSIAN_SAMPLES; i++)
   {
        multiplier = (i - ((GAUSSIAN_SAMPLES - 1) / 2));
       // Blur in x (horizontal)
       blurStep = float(multiplier) * singleStepOffset;
        blurCoordinates[i] = inputTextureCoordinate.xy + blurStep;
    }
}

Fragment shader

uniform sampler2D inputImageTexture;

const lowp int GAUSSIAN_SAMPLES = 9;

varying highp vec2 textureCoordinate;
varying highp vec2 blurCoordinates[GAUSSIAN_SAMPLES];

void main()
{
    lowp vec3 sum = vec3(0.0);
   lowp vec4 fragColor=texture2D(inputImageTexture,textureCoordinate);

    sum += texture2D(inputImageTexture, blurCoordinates[0]).rgb * 0.05;
    sum += texture2D(inputImageTexture, blurCoordinates[1]).rgb * 0.09;
    sum += texture2D(inputImageTexture, blurCoordinates[2]).rgb * 0.12;
    sum += texture2D(inputImageTexture, blurCoordinates[3]).rgb * 0.15;
    sum += texture2D(inputImageTexture, blurCoordinates[4]).rgb * 0.18;
    sum += texture2D(inputImageTexture, blurCoordinates[5]).rgb * 0.15;
    sum += texture2D(inputImageTexture, blurCoordinates[6]).rgb * 0.12;
    sum += texture2D(inputImageTexture, blurCoordinates[7]).rgb * 0.09;
    sum += texture2D(inputImageTexture, blurCoordinates[8]).rgb * 0.05;

    gl_FragColor = vec4(sum,fragColor.a);
}

This produces an image with a lot of blurred squares.

But. How to get something like this?


texts:
I'm making a 2D game for the Android phone, one that involves falling balls. I want to use a physics engine to properly simulate the balls falling and hitting other objects. I'm currently using Phys2D, but when the game runs in the emulator it doesn't look natural; slow and rough. Course, I don't know if this is because of the emulator or Phys2D seeing as how I don't own an Android phone (A real drawback not being able to test on the actual phone, I know, but I can't afford a smartphone).

Anyways, do you think the game would run faster and smoother on an actual android phone, or is it the engine I'm using, or how I'm using it. If it's the engine, any recommendations on Java physics engines?

UPDATE: If you want to test the game yourself, you can find the rough prototype here: http://bpcp.angelfire.com/BallDrop.apk


texts: How to implement soft edge areas with particles

texts:
My game is created using Phaser, but the question itself is engine-agnostic.

In my game I have several environments, essentially polygonal areas that player characters can move into and be affected by. For example ice, fire, poison etc'
The graphic element of these areas is the color filled polygon area itself, and particles of the suitable type (in this example ice shards).
This is how I'm currently implementing this - with a polygon mask covering a tilesprite with the particle pattern:

The hard edge looks bad. I'd like to improve by doing two things:
1. Making the polygon fill area to have a soft edge, and blend into the background.
2. Have some of the shards go out of the polygon area, so that they are not cut in the middle and the area doesn't have a straight line

for example (mockup):

I think 1 can be achieved with blurring the polygon, but I'm not sure how to go about with 2.

How would you go about implementing this?


texts:
I'm currently making a 2D Worm-clone in XNA, and have regrets about the way I've made my camera. I declare my camera in my Main class and the camera follows the player. In my draw I then begin my spritebatch using my camera transformations.

The problem is, EVERYTHING needs to be drawn in Main because they need to be drawn under the camera transformations (unless I send the camera to each classes constructor).

My question is, is there a way to make it so the Camera is basically global over my whole program, everything is "by default" affected by it? Or at least so it's not only in Main and I can have things that draw themselves.

I've searched for tutorials, but they all explain how to make the camera and to implement it in one draw function, not over a whole program with many different entities.


texts: What is the most efficient way to trigger an action based on proximity?

texts:
I am developing a 3rd person platformer that entails a grapple hook system.

This grapple hook system relies on a series of 'grapple-able' points.

I would like these points to shine every so often.

These points will shine when:

Within the player's view cone AND
Within a certain distance of the player.

This Grapple object class will contain the method Shine() to trigger the effect.

Initial research

My initial research was based upon using a cone trace from the player for these Grapple objects, then in each one found, calling the Shine method.

I could then tweak the cone's angle and height to better represent the view cone.

Problems

Unreal by default does not have a cone trace, and I'm not sure if using a multibox trace followed by an angle check is the most efficient solution.


texts: How to access sprite sheet via row and column

texts:
I'm currently designing a 2D game engine in C#, just had a quick question.

I have a SpriteSheet class that splits up a sprite into several different sprites (like a tileset for a example) and stores them in a list. Which is great, because now I can access sprites via it's corresponding index in the sheet.

However, I would really like to add a feature that will let me access a sprite by specifying the row and column it resides in (in the original sprite). I just don't know the equation to find where the sprite is in the list.

Here is what I have so far:

    public Sprite this[int index]
    {
        get { return this.sprites[index]; }
    }

    public Sprite this[int row, int column]
    {
        get
        {
            // Get the width and height of each individual sprite in the sheet.
            int cellWidth = this[0].Width;
            int cellHeight = this[0].Height;

            // Figure out and how many rows and columns are in the entire sprite sheet
            int rows = this.sprite.Width / cellWidth;
            int columns = this.sprite.Height / cellHeight;

            // Here is where I want to return the sprite located at the row and column specified.
            return this.sprites[ /* what do i put in here? */ ];
        }
    }

Also, I don't know if it will help but here is the method I use to fill the list with sprites:

    private void CreateSheet(Sprite sprite, int xOffset, int yOffset)
    {
        for (int y = 0; y < sprite.Height; y += yOffset)
        {
            for (int x = 0; x < sprite.Width; x += xOffset)
            {
                this.sprites.Add(sprite.Clone(new Rectangle(x, y, xOffset, yOffset)));
            }
        }
    }


texts: Should the HUD be Entites in a ECS ? And how to handle Events if so?

texts:
I'm building a GameEngine using Ashley and some how I can't figure out how.

I through I could use something like this. Or use the Signal/Listener from Ashley.
But how to Implement a interactive HUD? This is my current idea:

I have a System that only polls for inputs. If it detects an Input it would be a MouseClick so the PollySystem is sending out a MouseClickEvent witch the Coords. And a HUDClickedSystem will catch this event and checks if the click was inside a HUD Boundary and will Tag it with a clickedCompoment or not.
A Third system will look out for all entities with a clickedComponent and will react something like Respawn button clicked -> Respawn, Pause button clicked -> Pause etc.

This is a mix from the ideas here and here

I would love to have something like the Command pattern / Intent System  because I think it easy and straight forward but I can't figure out how to handle more than a flag ( Key pressed / Mouse pressed ).
But for this I need to know where the Mouse is pressed.


texts: Defining tileset for Tiled Terrain Brush — incorrect tiles selected at transitions

texts:
I'm using TilEd (https://mapeditor.org) to make maps, and so far have used the programs Terrain feature to create water/paths etc no problem.

I'm trying to create trees now, and I've been at it a whole day and cannot figure out what I'm doing wrong. Have tried countless variations of sizes but here's what i'm currently using:

Tileset:

Now here's the terrain setup, types TREES and GRASS

Here's what it looks like in the map editor, close, but issues:

Any tips on how to define the terrain in TilEd? Or maybe a link to a working trees terrain pattern so I can compare?


texts:
Can I make a model from a picture? A friend of mine would like to be an NPC in my game ! :P I would like to add him, but I never did 3D modelling!

Is it possible to make 3d model from photo/picture?


texts: How can a web game store points online without giving the user the possibility to do the same call but with more points?

texts:
Imagine I have an HTML5 web game where the user can get points by doing certain activities. The game can be played offline, so there's not necessarily a live internet connection (note: this makes this question other than existing questions). Game state will then be synchronized at a later moment.

How can the frontend tell the server that the user has indeed gained those points without giving the user the ability to cheat? E.g. by doing a REST call with a multitude of his points? How can the server tell the difference between a real call and a fake call?

What I can think of is to send not the points, but e.g. all the moves of the game, and then the server recomputes the game and calculates the gained points? But that is quite hard, and the game must be deterministic in order to give the client and server the exact same result from the moves.

Does anybody know how existing games implement this? Or how it could theoretically be done?


texts: A* path finding for road network - data structure to represent directivity

texts:
I have been reading A* path finding to apply on a road like network structure. Most of the code I saw is about A* on tile based maps. There is a short description at Amit's page here about what I am looking for. My question is about what data-structure should I use to define a road network map.

I have infromation like, node, cost,etc. But not sure how to represent both one directional and bidirectional roads. In a graph structure, can I mix directed and undirected edges or use two edges to represent that a segment of road can be traversed in both direction. Any good example available?

Thank you so much.


texts: Difference between using Tags and GetComponent

texts:
I was implementing a basic "check if the player enter the trigger" behaviour and I get myself wondering about this question:

What the difference between this:

And this:

I guess it is a performance issue for using GetComponent every time? If not, I dont really see the point of using tags in this kind of checks.


texts:
What's the best way to implement a detail feature, like a road, on a heightmap-based terrain?

Update: It's a bit hard to see in the image, but the road descends from the top of the quarry to do its base.


texts: Unity3d Pause RigidBody object, don't stop time

texts:
Time.timeScale = 0 obviously works to stop physics but it's also stoping my Invoke calls. How can I get around this to pause ONLY the game physics?

EDIT

Temporarily I'm using isKinematic = true on all of my rigid body objects via event trigger.


texts: Scene building for procedurally generated tile based world in Unity

texts:
i'm making a procedurally generated side-scrolling and destructible tile based world. So far I've got :
 - the values generator (for deciding which tile to place where)
 - a testing scene generating one object per tile (a mesh with 2d box collider, inactive at start)
 - map chunking (separating the map into chunks to show only what is visible)
 - visibility based on orthographic camera size (it's not much but the camera can zoom in or out)
 - the chunks are 32x32 tiles in size
 - the maximum chunks I've seen is around 25

This works fine for testing the world generation, however there is massive stuttering when moving around with camera zoomed out to the maximum. It's less when zoomed in, but it is still noticeable.

From testing, I've found out that its obviously the building in the scene that causes the major part of the stuttering.

I've been searching for better ways of building the scene but there are a few constraints that make most of the non viable :
 - The world is destroyable, so I need to be able to interact with each tile
 - There are textures coming on top of the tile texture depending on context (selection rectangle, decoration, glow...)
 - The tile texture itself is not a single sprite but a repeatable texture, so it needs to be places based on coordinates so it properly repeats itself.

So far I've looked at :
 - TileMaps
 - Mesh melding
 - Texture bombing

None of these seem to be able to fulfill the constraints fully.

Is there a way to fulfill the constraints while improving scene building or am I missing something? Please help.


texts: Efficient 2D grid overlay on tiles without each cell being its own GameObject

texts: So for my game I need the ability to add a grid overlay over my tilemap. Now I don't think that making the grid with each cell being its own GameObject with some SpriteRenderer would be hard to do but I know it would be extremely inefficient. I was thinking about using a LineRenderer to draw the grid lines but I don't know how to make the cells have their own traits since they wouldn't be their own individual instance and more of a product of the grid lines. In my case, the cells need their own color and should all have the ability to be accessed individually and that's where I need your help. Do you guys have an idea on how to make this efficient?


texts: How can I properly access the components in my C++ Entity-Component-Systems?

texts:
(What I'm describing is based on this design: What is an entity system framework?, scroll down and you'll find it)

I'm having some problems creating an entity-component system in C++.  I have my Component class:

class Component { /* ... */ };

Which is actually an interface, for other components to be created.  So, to create a custom component, I just implement the interface and add the data that will be used in-game:

class SampleComponent : public Component { int foo, float bar ... };

These components are stored inside an Entity class, which gives each instance of Entity a unique ID:

class Entity {
     int ID;
     std::unordered_map<string, Component*> components;
     string getName();
     /* ... */
};

Components are added to the entity by hashing the component's name (this probably isn't such a great idea).  When I add a custom component, it is stored as a Component type (base class).

Now, on the other hand, I have a System interface, which uses a Node interface inside.  The Node class is used to store some of a single entity's components (as the System isn't interested in using all of the entity's components).  When the System has to update(), it only need to iterate through the Nodes it stored created from different entities.  So:

/* System and Node implementations: (not the interfaces!) */

class SampleSystem : public System {
        std::list<SampleNode> nodes; //uses SampleNode, not Node
        void update();
        /* ... */
};

class SampleNode : public Node {
        /* Here I define which components SampleNode (and SampleSystem) "needs" */
        SampleComponent* sc;
        PhysicsComponent* pc;
        /* ... more components could go here */
};

Now the problem: let's say I build the SampleNodes by passing an entity to the SampleSystem.  The SampleNode then "checks" if the entity has the required components to be used by the SampleSystem.  The problem appears when I need access the desired component inside the Entity: the component is stored in a Component (base class) collection, so I can't access the component and copy it over to the new node.  I've temporarily solved the problem by casting the Component down to a derived type, but I wanted to know if there is a better way of doing this.  I understand if this would mean re-designing what I already have.  Thanks.


texts: Is there a decent Effect file editor plugin for Visual Studio?  I'm getting slightly frustrated with constantly copying and pasting from FX Composer.


texts: Can't understand these UV texture coordinates (range is NOT 0.0 to 1.0)

texts:
I am trying to draw a simple 3D object generated by Google SketchUp 8 Pro onto my WebGL app, the model is a simple cylinder.

I opened the exported file and copied the vertices positions, indices, normals and texture coordinates into a .json file in order to be able to use it on javascript. Everything seems to work fine, except for the texture coordinates which have some pretty big values, like 46.331676 and also negative values. Now I don't know if I am wrong, but isn't 2D texture coordinates supposed to be in a range from 0.0 to 1.0 only?

Well, drawing the model using these texture coordinates gives me a totally weird look, and I can only get to see the texture properly when I am very close (not really me, the cam) to the model, as if the texture has been insanely reduced in it's size and repeated infinitely across the model's faces. (yeah, I am using GL_REPEAT on that texture wrap thing)

What I noticed is that if I get all these coordinates and divide them by 10 or 100 I get a much "normal" look, but still not in the 0.0 to 1.0 range.

Here's my json file: http://pastebin.com/Aa4wvGvv

Here are my GLSL Shaders: http://pastebin.com/DR4K37T9

And here is the .X file exported by SketchUp: http://pastebin.com/hmYAJZWE

I've also tried to draw this model using XNA, but still not working. Using this HLSL shaders: http://pastebin.com/RBgVFq08

I tried exporting the same model to different formats, collada, fbx, and x. All those yields the same thing.


texts: Store metadata for tile in Tiled Map Editor

texts:
In my tilemap-based game, I need to associate lights with light switches, buttons with doors etc. I am using the Tiled map editor (mapeditor.org), but I have yet to find a way to store these associaltion. My idea is to store a number with each tile, so I can have groups of tiles that interact with each other.

Is there a way to store custom data with each tile in the Tiled map editor? Just to be clear: I don't want to store custom data with each tile type, but with individual instances of one tile type.


texts:
I have objects moving in OpenGL ES1 application. I want some of them to leave behind contrail – like if they would emit some radiation or something.

EDIT: the kind of contrail is:

light contrail – not smoke contrail,
the same effect occurs on LCD monitors with long pixel-switch time (it is called response time AFAIK).

HERE IS THE EXAMPLE IMAGE:
http://i.imgur.com/Fcb24.jpg


texts: Should all stats only exist on MySQL database for my Flash browser RPG?

texts: I'm creating a browser RPG in Flash which will have some multiplayer elements and in-app purchases so security is a high concern. Would it be better to have all game stats like health and such exist only in the MySQL database and retrieve them every time I need them? The game is turn based, but that would still require very frequent connections to the database. I could use local copies to cut down on the number of connections, but I imagine that would make it much easier for people to cheat.


texts: How can we achieve Earthquake Simulation in Unity - Simulation of P and S Waves

texts:
I Cannot use Water waves as P and S Waves are different than water waves. I tried to use it but not satisfied with the result.

I am trying to simulate how Earthquake takes place in real time which you cannot simulate in the real world. Here is the reference link to understand the basics of Earthquake and to understand better here is the better-simulated Example. I wanted to Simulate P and S Waves. My first attempt will be simulating with mesh instead of showing lines, I don't know how to compress mesh (P Waves) but I found out a good example to simulate wave like effect (S Waves).

The solution I am looking forward to is :

Any idea of how I can compress - decompress mesh in Unity (P Waves).
wave like effect (S waves), I have an example but it moves only Plane, in my case, i want to do more like a deformation of mesh, so it gives me an real effect like S Waves.


texts: Handling different screen densities in Android Devices?

texts:
Well, i know there are plenty of different-sized screens in devices that run Android.

The SDK I code with deploys to all major desktop platforms and android. I am aware i must have special cares to handle the different screen sizes and densities, but i just had an idea that would work in theory, and my question is exactly about that method, How could it FAIL ?

So, what I do is to have an ortho camera of the same size for all devices, with possible tweaks, but anyway that would grant the proper positioning of all elements in all devices, right? We can assume everything is drawn in OpenGLES and input handling is converted to the proper camera coordinates.

If you need me to improve the question, please tell me.


texts: Spawning large numbers of navmeshagents causes them to jump position

texts:
Cross posted on StackOverflow

I'm making a tower defense style game in 3D using Unity. I'm experiencing a frustrating issue with spawning large numbers of characters in an area of navmesh where if I spawn too many near the same location many of them will 'teleport' immediately after instantiation to near the navmesh destination.

Here's a doodle of one of the levels:

The black spot is the player base the NPCs have to get to. The green scenery has no navmesh and uses mesh colliders. Scenery is mostly steep hills forming a valley the NPCs should path through. It is composed of multiple meshes marked Unwalkable in navigation. The large blue spot is the first spawn location I tried, I later tried a larger area indicated in the right side of the image (see 'things I've tried' below).

When instantiating at the original spawn location if I spawn more than about 20 NPCs at once many of them will jump to the the area indicated by the red spots.
The NPCs have a radius of about 1.5m, as do their colliders and navmeshagents avoidance property.

Things I've tried:

Spawning to a random position inside a circle with a radius of 50m.
Adding a large new hidden area of navmesh as in the image above,
defining an array of vector positions spread well apart and spawning
at each position in turn so no two navmeshagents spawn near each
other.
Adding a delay to navmeshAgent.SetDestination(playerBase)
after instantiation hoping this would prevent the immediate jump to
near the destination.
Reducing navmeshagents avoidance radius. This sometimes
reduces the problem a little but still, even with a radius of 0.1 any
more than around 50 NPCs triggers the problem.
Turning avoidance off althogether (setting to none in navmeshagent), again, can spawn more but problem still happens
Turning off auto traverse links and auto repath in navmeshagent
Increasing the time between instantiations, a large gap of several seconds works but makes the game too easy
Not setting a destination - oddly they still teleport to near the player base,  so I guess destination is not a factor

How can I spawn large numbers of navmeshagents in a short timeframe, avoiding this 'teleporting' behaviour?


texts:
A physics engine return a deformed mesh (only geometry vertices).
I take this mesh to render the geometry (~500000 vertices).
What is the fastest solution and the least expensive to compute normal vertices every frame?
OpenCL? Geometry Shaders? In a CPU thread? Other?


texts: Get NPC to look at player with only head

texts:
I'm wondering how to get an NPC to look at the player,
I have tried everything.
Find look at rotation changes depending on character rotation.
Here is a fun drawing if letters are too complicated.


texts: I'm trying to instantiate game object as a child of canvas in scene but it doesn't work

texts:
My problem is that I've prepared a class. Inside of this class i have a function to create a new modal window in scene as a child of canvas. I have another script in this script i am trying to create an object of first class and calling OpenModalWindow function through that object. It acctually spawns the modal window in the scene but not as a child of canvas.
The First Class:
public class WindowController : MonoBehaviour {
    public delegate void function();

    private Transform canvasTransform = null;
    private GameObject modalWindowObj = null;

    private void Awake()
    {
        canvasTransform = transform;
    }

    public void OpenModalWindow(GameObject modalWindow, string modalText, string button1Text, string Button2Text, function button1Func, function button2Func)
    {
        modalWindowObj = Instantiate(modalWindow, canvasTransform) as GameObject;
        this.modalWindowObj.transform.SetParent(canvasTransform);
    }
}

The Second Class:
public class ModalBoxTest : MonoBehaviour
{
    [SerializeField] private GameObject modalWindowRef = null;
    private WindowController test = new WindowController();

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            test.OpenModalWindow(modalWindowRef, "deneme", "evet", "hayir", test1f, test2f);

        }
    }

    private void test1f()
    {
        Debug.Log("yes!");
    }

    private void test2f()
    {
        Debug.Log("no!");
        test = null;
    }
}


texts: Collision detection 3d rectangles using SAT

texts:
This question builds on a previous post asked by griffinHeart nov 2012. See link below.

How many and which axes to use for 3D OBB collision with SAT

Refering to the explanation/answer by Ken.

 What if the yellow cube had a rotation so the gap was hidden. This scenario does not necessarily mean that there is a collision/interception. The scenario would look something like this:

Which of the 9 edge - edge vectors would then show that there is no collision.

I am trying to implement an anti- coll algo between two 3d rectangles that might have a rotation around any axis (x, y, z). I am struggling with the projection part. How to project the points onto the face normals.

Hope someone can give me an answer that could lead to a solution. Thanks!


texts: Which features belong to the engine and which ones to a game?

texts:
Right now, I find myself implementing and testing new features for my 2D game engine, by directly coding them into the engine. Simultaneously, I have a showcase game with scripting support, which should call the engines functions. I attach e.g. a fixed tile movement to the Entity class in the engine, rather than scripting this specifically for the game. This is definitely breaking the idea of a general engine used for more than one game.

Are there any best practices to keep focusing on the correct implementation in the right parts (that is engine vs. game)?


texts:
In making a game, if I'm writing my own engine, at what sort of scale of team should I invest time in making a level editor tool? If it's just me on my own will it be worth it? Or when there's a team of two? ten?

By what metric do I judge if making the tool is "worth it"? Or is it always worth the time investment?


texts: How can I simulate a crash of OpenGL in GLKViewController to help track down a user's problem?

texts:
I am using GLKViewController for iOS app. On some devices, there are problems (possibly with OpenGL), that I am unable to solve, because I dont see this problem on none of my devices or emulator.

Is there a way, how to "manually" force OpenGL (GLKViewController) to crash, but not to crash app? Or is there any other way, why GLKViewController instance can become null?


texts: Trouble GamePad input on iOS but works perfect on Android

texts:
I am having trouble getting input from on iOS devices (iPhone 6 Plus and iPad). Here is my code,

    if (Input.GetKey (KeyCode.JoystickButton14))// A
    {
        chr_show = "A";
    }
    if (Input.GetKey (KeyCode.JoystickButton13))// B
    {
        chr_show = "B";
    }
         ...........................................

    if (Input.GetKey (KeyCode.JoystickButton11))// Select
    {
        chr_show = "SELECT";
    }

And in OnGUI()

    GUI.Label (new Rect(0,0,100,100), "Pressed Button : "+chr_show, guiStyle);

Code works perfect on Android device. I also have tried following:

        if (Input.GetButton ("JSButton"))// JSButton
        {
            chr_show = "JS Button 14";
        }

Please Help Me!


texts: I know that it's possible to see if a line segment or a swept shape (to make a "fat" line segment) intersects objects using MPR and GJK.  Is it possible in those situations to find out the distance down the ray cast that the collision occurred?  Thanks!!


texts:
I couldn't find any proper tutorials in the internet how to make one so I tried it myself. I've written a base "Skill" class with methods like Cast(), DealFlatDamage(), ShootProjectile() and they all work so far. But I also wanted to implement trigger methods for passive spells: OnDeath(), OnKilled(), OnProjectileHit().

First Question: Is this a wrong way to go? Because I couldn't find anything like this in the internet.

Second Question: The idea was to create new classes inheriting from this base class and the base class calling all the "On..."-methods of each derived class. How can I do this?

Would appreciate help!


texts:
I'm building a game with Ogre3d, I've got fog working properly with:
scenemanager->setFog(Ogre::FOG_LINEAR, Ogre::ColourValue( 0.23f, 0.725f, 1.0f ), 0, 18, 20 );

However I'm currently implementing a GUI system (libRocket) which is rendered on top of everything else, and this removes the fog, does anyone know how to fix this? (I'm using the default libRocket rendering system for ogre as included in the samples, but this problem also appears when using a semi-transparent overlay).


texts:
I have a matrix created with either orthoM or frustumM GL function, where the near plane is logically the surface of the tablet. I would like to translate touch locations to their location on the near plane (that is, from device coordinates to the world coordinates).

I assume this is a common enough activity so I'm wondering if a standard API function exists (or simple sequence) which can provide me with this data?


texts: Something like libgdx for C++ / cross-platform (with mobile) SDK

texts: Is there an SDK like libgdx which allows me to code in C++? I really like the features libgdx has, but would prefer to code in C++.  I've looked around but can't find anything. I found the commerical Maramlade project, but that doesn't support Linux at all, plus I'd prefer an open solution.


texts: What version of OpenGL should I code for, given compatibility and performance considerations?

texts:
When the OpenGL spec is updated, they only ever add features. So in theory, the latest and greatest hardware with support for the Core and Compatibility profiles should run super old OpenGL1.1 code just fine. This has turned out to be true. I've spent 12 months learning OpenGL1.1 and have a fair grasp on it.

I had a read of a few chapters of one of those fancy new OpenGL4.2 books. Almost all of the features that I rely on have been deprecated (like Display Lists), which lets me assume that there are better ways of doing all these things.

Lets consider that 1.1 is likely to be supported, in full, by ALL modern hardware. 1.1 was released in 1992. I'm not coding the hard way just to support 20 year old PCs. :-p I think its reasonable to assume most gamers are running hardware that bottoms out at about 5-year old mid range.

I think the newer methods are designed to universally be either one of two things: better performing, or easier to code. I read somewhere that its never both though! XD

What version of OpenGL is most widely supported by ~5ish year old hardware? What version makes most sense to use, given these considerations?


texts: 2D Game dev and Java. Other possibilities than OpenGL?

texts:
I recently started to program some basic OpenGL stuff in Java, but OpenGL and DirectX is too much to handle and to understand for me and I'm getting bored really fast.

Now I am wondering if there are other possibilities than OpenGL (or DirectX) to make simple 2D graphics and to get started in Game Development, even if its limited. I will probably use OpenGL anyway when I am more experienced.


texts: How to rotate just the object being touched in Unity?

texts:
For my first steps in Unity I am just trying to rotate some squares when I touch them.

 using UnityEngine;
using System.Collections;

public class testskript2 : MonoBehaviour {

    // Use this for initialization
    void Start () {
        //transform.Rotate(Vector3.forward * 2 * 100);
    }

    // Update is called once per frame
    void Update () {
        if (Input.touchCount == 1) {
            Ray r = camera.ScreenPointToRay(new Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y));
            RaycastHit hit0;
            if (Physics.Raycast(r, out hit0, 100f)) {
            transform.Rotate(Vector3.forward * Time.deltaTime * 100);
        }
    }
}
}

It isn't working this way. Any tips?


texts: How can I take advantage of the iPhone 4's higher resolution screen?

texts:
I've recently tested an OpenGL ES based 2D game on the iPhone 4.  I've done almost all of the development and testing so far on my 3G device.  The game works fine (except for a few multitasking things) on the new device.  I'd like to replace some of the artwork w/ "better" artwork that takes advantage of the iPhone 4's higher resolution.  How can I do this?

Is there a flag somewhere that tells the phone to scale up some or all of the image resources?


texts: I know it is possible to add friction to rev joints by enabling motor and adding maxMotorTorque. I want the same for prism joint but only maxMotorSpeed option is available which didn't quite work for me. Is there another way?


texts:
What technologies are used to develop games for tablets and iPhones?
Would Flash be commonly used?
Is HTML5 capable of animation and interactivity, or would a game file simply be placed within HTML5 code?
Is Flash and HTML5, and then wrapping the game for different phone/tablet operating systems a common combination?


texts:
I already have a MouseMotionListener with the mouseDragged method implemented. I can drag an object with the mouse, but it doesn't matter where I put the mouse inside the object, it will move it's origin point to the mouse.

I know that this is what the simple x = mouseX; y = mouseY code should do, but what is the code to drag the object relative to the position of the mouse inside the shape?

I tried this, but it doesn't work when the object is in the position 0:

x = mouseX - (mouseX - x);
y = mouseY - (mouseY - y);

The code doesn't work because when X and Y are 0, it is basically x = mouseX - mouseX; y = mouseY - mouseY, that is 0 both.
What is the algorithm that is "0-pos-proof" that I can use?


texts:
I'm making a turn based rpg and I have an attack allows for a party member to draw an enemy's focus towards it for a set number of turns. I feel an attack that draws all aggression from enemies is very strong, so I am unsure how to balance it.

Should taunted enemies get bonus attack stats to make up for the temporary loss of their AI and the ability to target weaker party members? Or is a party member being the focus of attacks something that should be rewarded, and the party member should be given temporary healing or defence to compensate for the risk they took?


texts: Get Tile Location On Screen (Java Slick and Tiled2D)

texts: I want to create a rectangle around each tile that's blocked value = true. How can I find the X and Y (on screen) coords of the each individual Tile?


texts: Unity - Autoscroll when selecting buttons out of viewport

texts:
I have a ScrollView element, that contains many buttons. I want that when I select buttons (via arrow keys), the panel scrolls so that the selected button is contained within the viewport.

How could I achieve this?

UPDATE

This is example of my structure (with 2 buttons only, but you get the gist...)


texts: Event-driven Communication in a Game Engine: Yes or No?

texts:
I am reading Game Coding Complete and the author recommends Event Driven communication among game objects and modules.

Basically, all living game actors should communicate with the key modules (Physics, AI, Game Logic, Game View, etc.) via an internal event messaging system. This means having to design an efficient event manager. A badly designed system eats CPU cycles, especially affecting mobile platforms.

Is this a proven and recommended approach? How should I decide whether to use it?


texts: How can I represent collection of distant but visit-able stars while using minimal resources?

texts:
I have recently started to plan a project in Unity that will be for Android. I have a database that consists of over 150,000 stars (may trim this down if I/O cripples the overhead). The game will hopefully consist of a free-to-explore universe creating the illusion that the user is flying in a realistic representation of the stars.

My biggest concern at the moment is how do I create a realistic environment with these starts, while keeping the resource impact on the phone to a minimum? Some people mentioned using octrees, would this be wise?

This is my first game that I am looking to create so any help would be much appreciated to this novice!


texts: Why have the player pick up loot manually?

texts:
From a game-design perspective, I was wondering what the mechanic of manually picking up items off the ground does for the player. Keep in mind that items that fall on the ground can most likely be put into one of two groups:

Equipment Items: depending on the character the player is creating, the majority of these items might be ignored and left on the ground. Players will only pick up the ones that they want to "spend" inventory space and time (by clicking and eventually having to go back to town) on.
Consumables: gold, gems, crafting materials, etc - which players generally always want to pick up and sometimes don't take up inventory space.

While I can see that making players choose which items to pick up is an interesting "collecting" mechanic for the Equipment group, why make the "Consumable" group require manual picking up as well?

Examples of games which do this: (most diablo-esque dungeon crawlers)

Diablo 3

Path of Exile

Grim Dawn

Torchlight 2


texts: Does multiple downsampling have a benefit?

texts:
So i came across this site and you can see these lines on the first and second paragraph:

For a crude but easy effect, draw the bright portions of the scene (eg, light sources) into an FBO, then downsample it using GL_LINEAR minification several times. For the final render, simply combine the original scene with the downsampled FBO's.
In the following example, the original scene is 128 x 128 and is downsampled 3 times. This requires 4 framebuffer objects. The original scene is shown in the upper-left and the final rendering in the upper-right.

Is there any reason i should downsample multiple times (128 -> 64 -> 32 -> 16) rather than downsample it once (128 -> 16)?
If you scroll down more, they even downsample it like 9 times. (128 -> ... -> 16 -> 128 -> ... -> 16 -> and so on). Why not do it like (128 -> 16 -> 128 -> 16 -> and so on)?


texts: My isometric game looks flat; how can I improve this?

texts:
Being bored I decided to make my game isometric by applying a simple filter effect.

    g.scale(1f, 0.5f);
    g.rotate(400, c.getHeight() / 2, 45);

It works great, but now everything appears... flat.


texts: SDL2 reporting 24-bit pixel format on a 32-bit desktop setup

texts:
I'm trying to figure out why calling SDL_GetWindowPixelFormat is returning SDL_PIXELFORMAT_RGB888, even though I'm creating the window with the flag "SDL_WINDOW_FULLSCREEN_DESKTOP", and my desktop uses 32-bit color.

Perhaps I'm misunderstanding what this flag means. I'm running my program on a Windows 7 machine, and I checked the display color-depth using
Control Panel -> Display -> Adjust Resolution -> Advanced Settings -> Monitor
(which displays "50 Hz, True Color 32-bit".)

I'm coding using SDL2 (version 2.0.6). I was expecting this call to return SDL_PIXELFORMAT_RGB8888 or some other 32-bit format. Any help appreciated on clarifying this. My code is below.

#include "SDL2/SDL.h"
#include <stdio.h>

SDL_Window* window;

int main(int argc, char* args[]) {

    SDL_Init(SDL_INIT_VIDEO);

    window = SDL_CreateWindow("TUTOR",
            SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
            0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);

    Uint32 global_pixel_format = SDL_GetWindowPixelFormat(window);
    const char* temp = SDL_GetPixelFormatName(global_pixel_format);
    printf(" SDL_Window created with pixel format %s\n", temp);

    SDL_Quit();

    return 0;
}


texts: Handling accelerate in different devices

texts:
I am adding tilt controls to my game. The sensor values I get are different in different android devices which results in random behavior.

Anyone knows how can I tackle this situation?

I tried normalizing acceleration but it is still the same.


texts: How to move a sprite on a slope in chipmunk Spacemanager

texts:
Possible Duplicate:
  How to move the object(tanker ) on slope image in chipmunk Spacemanager

I have used one polygon shape image (terrain) in my game. It's just like a mountain, and now I want to move the tanker on a mountain path from one side to the other and then turn around at the edge of the screen and go back. I don't understand the method to move the tanker on the slope (image) path in chipmunk spacemanager.

When collision detection happens like that, if any bomb falls on the slope (image of mountain) then I want to do a little damage to the slope (image of mountain) like this video.


texts: Authoritative Server for single player but with leaderboard

texts:
I made a Fps single player, timed survival with a leaderboard ( a bit like devil daggers and others).
I know would like to create a server that will prevent cheats such as avoiding collision or altering the timer.

My issue is I don't know the theory on how should my server behave. Should it run an instance of the game per player which will handle the collision and other stuff for that player ? is this viable

Any advice ?


texts: How to properly handle collision in a component-based game?

texts:
Trying to wrap my head around the ways to properly handle collision in a game designed around components.

I see many examples have some sort of PhysicsComponent that gets added to the entity's list of components but the actual implementation is confusing me.

For this to work, the PhysicsComponent would need access to the world around it. This doesn't make intuitive sense to me. Shouldn't a component be unaware of not only its container (the entity), but its container's container (the world)?

To me, it sounds like the level or scene should maintain a list of these entities and every game update, loop through the entities to determine which collide.

My question is firstly, whether or not this is good design, and secondly, how to determine which entities can collide. I suppose solid entities could implement an empty IRigidBody interface so the level could determine which entities in the list support collision. But is this breaking the component design?

Instead, should they contain an empty RigidBody component? This may actually be better because it may not always be empty and this approach is more future-proof. The only problem with this is the complexity. The scene would have to loop through not only every entity, but also every entity's components to determine if it had this RigidBody component.

Thirdly, when they do collide both entities should be informed somehow and I am unsure on how to accomplish this either.

Let's say that both entities contained a HealthComponent and when they collided both their healths would be decreased by some arbitrary value, 5. I suppose it would be the scene's responsibility to handle this when it detects a collision between two entities?

But then is the scene responsible for too much? I could see this possibly getting out of hand and becoming unwieldy when the scene is responsible for many things entities should not (?) have access to.

Edit: Question updated with more details.


texts: If you make a game for facebook do you have to have a "real website" on the domain name?

texts: Can you just use the domain to house your database and code?  Do you have to have a "real" front end webpage?


texts: how do I move an object based on rotation of another object?

texts:
This question is related to my other question about camera rotation.  I hope its acceptable to ask a second question.  I cannot figure out the math of how to calculate moving the camera to stay behind my player, based on the players rotation.

In the image above, the arrow represents a player with the direction of the arrow representing the direction the player is facing.  The red object represents camera. I want the camera to always remain behind the player. When the player turns, I want the camera to move behind the player. I cannot figure out the math for calculating where to move to.

Step 1 The arrow is at 0,0 and facing 0 (north). The red circle is at 0,-5

Step 2 the arrow is at 0,0 and turned 90 degrees to the right (facing east). The red circle should move to be "behind the arrow" aka to the left and up and at the same distance from the arrow as when it started. I am guessing that would be -5,0 in this case

Other Scenarios a) The arrow is at 0,0 and turned -30 degrees (turned to the left). The red circle should move right and up.

b) the arrow is at 0,0 facing south (180 degrees opposite of #1) and turns -30 degrees to right (on screen but left if you are the arrow). The red circle should move appropriately.

I have racked my brain over this for days and just cannot find an answer.
Thnx
Matt


texts:
I have not modded a single game in my life, but I really, really want to start. I'm a 3D animator (make no money from this, just a serious hobby) and a budding Object Orientated programmer (make all my money from my own web applications, I'm not a millionaire but I live comfortably and have bags of time on my hands) so I feel like I will be able to make some incredible mods.

Fallout is my favourite game series of all time, has a vibrant modding community, its open-world style means the sky's the limit (and occasionally further!), there are excellent modding tools available (such as the GECK), and Bethesda has an excellent attitude towards licencing (unlike those nazis over at EA), so I'm one-hundred percent sure that's what I want to mod.

However I have no idea what modding a game is like, and while the only way to find this out is by modding, what I'd really like to know is how do I determine when is the right time to mod? My heart wants to download the GECK (the fallout editor) right now and get stuck in, but I'm being sensible and writing this question.

The last fallout game (New Vegas) is nearly half a decade old (2010) and Fallout 4 is lurking in the future somewhere. I want to dive in modding new vegas, but where will I be when fallout 4 comes out? Will there be only a slight learning curve and then all the skills I've learned will be utilized to start modding really quickly in Fallout 4?

Or, in between games, are modders simply left in purgatory regarding future releases? Could I become a Fallout 3/NV mod ninja, and then have to learn everything again come Fallout 4? Or do companies such as Bethesda make an active effort to keep everything consistent?

I feel 3D engines are like web frameworks such as Zend and Rails. Basically, I've put all my eggs in Rails and have never looked back. I'm sure that as the web changes, Rails will change with it. I spend every moment of my professional life with Rails as I'm confident it will never die and I will be able to build on my existing skills until I retire. This attitude means I can really throw myself at projects, go the extra mile and learn new skills. However, will I not be able to do this with modding? Will there always be lurking doubt that come the next game, everything I've learned will be useless? Will every new game hit me with a learning curve?

Also (and this would me awesome if true but I kind of doubt it), are moden games similar
enough that if I'm a Fallout ninja, the learning curve wouldn't be too crazy if I then wanted to mod Crysis or Portal or even a non-fps like Civ5?