texts: Unity Third Person Controller Camera-Relative Script

texts:
I'm an newbie in game developing. So i have a script for a camera that i attach to the player. I was wondering how to make a Third Person Controller with WASD controls that moves in the direction that the camera is facing.
If you need it here's the camera script that i use

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

public class ThirdPersonCamera : MonoBehaviour {
    //define some constants
    private const float LOW_LIMIT = 0.0f;
    private const float HIGH_LIMIT = 85.0f;

    //these will be available in the editor
    public GameObject theCamera;
    public float followDistance = 5.0f;
    public float mouseSensitivityX = 4.0f;
    public float mouseSensitivityY = 2.0f;
    public float heightOffset = 0.5f;

    //private variables are hidden in editor
    private bool isPaused = false;

    // Use this for initialization
    void Start () {
        //place the camera and set the forward vector to match player
        theCamera.transform.forward = gameObject.transform.forward;
        //hide the cursor and lock the cursor to center
        Cursor.visible = false;
        Cursor.lockState = CursorLockMode.Locked;
    }

    // Update is called once per frame
    void Update () {
        //if escape key (default) is pressed, pause the game (feel free to change this)
        if (Input.GetButton("Cancel"))
        {
            //flip the isPaused state, hide/unhide the cursor, flip the lock state
            isPaused = !isPaused;
            Cursor.visible = !Cursor.visible;
            Cursor.lockState = Cursor.lockState == CursorLockMode.Locked ?
            CursorLockMode.None : CursorLockMode.Locked;
            System.Threading.Thread.Sleep(200);
        }

        if(!isPaused)
        {
            //if we are not paused, get the mouse movement and adjust the camera
            //position and rotation to reflect this movement around player
            Vector2 cameraMovement = new Vector2(Input.GetAxis("Mouse X"),Input.GetAxis("Mouse Y"));

            //first we place the camera at the position of the player + height offset
            theCamera.transform.position = gameObject.transform.position + new Vector3(0,heightOffset,0);

            //next we adjust the rotation based on the captured mouse movement
            //we clamp the pitch (X angle) of the camera to avoid flipping
            //we also adjust the values to account for mouse sensitivity settings
            theCamera.transform.eulerAngles = new Vector3(
                Mathf.Clamp(theCamera.transform.eulerAngles.x + cameraMovement.y * mouseSensitivityY, LOW_LIMIT, HIGH_LIMIT),
                theCamera.transform.eulerAngles.y + cameraMovement.x * mouseSensitivityX, 0);

            //then we move out to the desired follow distance
            theCamera.transform.position -= theCamera.transform.forward * followDistance;
        }
    }
}


texts: How can I achieve a zoom-like camera effect?

texts:
I have a top down 3D camera:

view = Matrix.CreateLookAt(new Vector3(0,0,20), Vector3.Zero, Vector3.Up);

Now I want to achieve the effect like when I zoom in the scene and only show a section at the middle of my actual scene. When I now move an object via CreateTranslation it looks more like moving an object in 2D.

What I have now is:

What I want is more like this:


texts: Why when using Linerenderer it's drawing a line also in scene view?

texts:
I want to draw lines using the Linerenderer only in the game view window.

I'm using Debug.DrawLine but only drawing Red lines but for some reason when the Linerenderer draw a line/s one of the Linerender lines is yellow it seems the green linerenderer is getting on the red one in the scene view window.

 Debug.DrawLine(Input.mousePosition, hit.transform.position, Color.red);

Is there a way to avoid it ? So Debug.DrawLine will draw only in sceneview and the Linerenderer will draw only in the game view window ?

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

public class RotateObjects : MonoBehaviour
{
    public GameObject[] objectsToRotate;
    public float speed = 0.1f;
    public Vector3 spinDirection;
    public bool useMouse = false;
    public bool automaticSpin = false;
    public LineRenderer linerendererPrefab;

    List<LineRenderer> lrs = new List<LineRenderer>();

    // Use this for initialization
    void Start()
    {
        for(int i = 0; i < objectsToRotate.Length; i++)
        {
            var lr = Instantiate(linerendererPrefab);
            lrs.Add(lr);
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (objectsToRotate.Length > 0)
        {
            for (int i = 0; i < objectsToRotate.Length; i++)
            {
                var hits = Physics.RaycastAll(Camera.main.ScreenPointToRay(Input.mousePosition), 100.0f);

            for (int x = 0; x < hits.Length; x++)
            {
                RaycastHit hit = hits[x];

                if (hit.collider.name == objectsToRotate[i].name)
                {
                    objectsToRotate[i].transform.Rotate(1, 1, 1);
                    Debug.DrawLine(Input.mousePosition, hit.transform.position, Color.red);
                    SpawnLineGenerator(Input.mousePosition, hit.transform.position, false);
                }
            }

            if(hits.Length == 0)
                SpawnLineGenerator(new Vector3(0,0,0), new Vector3(0,0,0), true);

            if (useMouse == true)
            {
                if (Input.GetMouseButton(0))
                {
                    Rotate(i);
                }
            }
            else
            {
                Rotate(i);
            }
        }
    }

    private void Rotate(int i)
    {
        if (automaticSpin == true)
        {
            objectsToRotate[i].transform.Rotate(1, 1, 1);
        }
    }

    void SpawnLineGenerator(Vector3 start, Vector3 end, bool reset)
    {
        for(int i = 0; i < lrs.Count; i++)
        {
            if (reset)
            {
                lrs[i].SetPosition(0, start);
                lrs[i].SetPosition(1, end);
            }
            else
            {
                lrs[i].SetPosition(0, start);
                lrs[i].SetPosition(1, end);
            }
        }
    }
}


texts: How can I trigger a buttton click event at regular intervals?

texts:
I am trying to make an idle clicker game like Adventure Capitalist. I have created the script for the buttons (say button-type: buy) that would increase the gold and the script to upgrade the gold per click (button-type :upgrade). Now I want to create a C# script for a button(button-type: auto clicker) that would enable me to automatically click those button at regular intervals?

These are my scripts:

public class Click : MonoBehaviour {

    public Gold gold;
    public float gpc;
    public Text goldCount;
    public float price;
    public int active = 0;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        goldCount.text = "$" + gold.gold;
    }

    public void Activate()
    {
        if(active == 0)
        {
            if(gold.gold >= price)
            {
                gold.gold -= price;
                active = 1;
            }
        }
    }

    public void Clicked()
    {
        if(active == 1)
        {
            gold.gold += gpc;
        }
    }
}

public class Gold : MonoBehaviour {
    public float gold;
    // Use this for initialization
    void Start () {

    }

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

    }
}

public class UpgradeManager : MonoBehaviour {

    public Click click;
    public Gold gold;
    public float upgradeCost;
    public int count;
    public int clickPower;
    public string itemName;
    // Use this for initialization
    void Start () {

    }

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

    }
    public void PurchasedUpgrade()
    {
        if(gold.gold >= upgradeCost)
        {
            gold.gold -= upgradeCost;
            count++;
            click.gpc = clickPower;
            upgradeCost = Mathf.Round(upgradeCost * Mathf.Pow(1.15f, count));
        }
    }
}


texts: How is it possible to call abstract methods from another class?

texts:
Im creating a game using LWJGL and just as a bit of organising I made an Abstract class called Game so I could extend Game in my main class The game class is like so -

public abstract class Game {
    public abstract void init();
    public abstract void render();
}

Really simple stuff, and my plan was to call the render and init method in my DisplayManger class so every whenever I my display is created and updates it runs these methods so all games extending my game class with have their methods run. My approach was like this but as you probably have figured out you cannot a abstract method from another class nor from a static method from inside my abstract, it needs to be static to call from another class. Here was my approach -

public class DisplayManager {
    public DisplayManager(int width, int height) {
        try {
            Display.setDisplayMode(new DisplayMode(width,height));
            Display.create();
        } catch (LWJGLException e) {
            e.printStackTrace();
        }
        Game.init();
        while (!Display.isCloseRequested()) {
            Game.render();
            Display.update();
        }
        Display.destroy();
    }
}

Does anyone know how I can call these two methods from this Display class?


texts: OpenGL noob: Using VBO to draw a colored triangle

texts:
I tried using straight vertex arrays to draw a triangle with different colors for each vertex and it works fine, but when I use VBO it won't work, so I'm doing something wrong.

// point 1
side_1.push_back(-2.0f); //x1
side_1.push_back(-2.0f); //y1
side_1.push_back(0.0f); //z1

// side color
side_color_1.push_back(0.8f); //r1
side_color_1.push_back(0.0f); //g1
side_color_1.push_back(1.0f); //b1

// point 2
side_1.push_back(2.0f); //x2
side_1.push_back(-2.0f); //y2
side_1.push_back(0.0f); //z2

...etc

// init code
////////////
glGenBuffers(2, &m_vertexBuffer[0]); //Generate a buffer for the vertices

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_1.size(),
                 &side_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_color_1.size(),
                 &side_color_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

// render code
////////////
glEnableClientState(GL_VERTEX_ARRAY);   // enable vertex array
glEnableClientState(GL_COLOR_ARRAY);    // enable color array

// bind the buffer to the VBO
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]);

glVertexPointer(3, GL_FLOAT, 0, 0);
glColorPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(sizeof(GLfloat) * side_1.size()));

glDrawArrays(GL_TRIANGLES, 0, 3);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);


texts: How should I make a jump-timing game's character static on screen?

texts:
I decided to learn Pygame and try to make a simple game inspired by Google's T-rex jump game. However, I stumbled upon a problem that I can not seem to figure out: How can I implement a scroller/camera that can keep up with my character and platform?

Now it just disappears off the screen. I have made it so the platform moves to the right with the same speed as the character. Here is a GIF of what it looks like at the moment:

Is this the best way to do it for a game like this where speed of the character is always constant or is there a better way that will make adding obstacles in the future more easy?


texts:
I have a problem where I'm performing an axis-angle rotation and am trying to constrain my rotations.  Specifically I have a skeleton (model/mesh with rig, transforms are hierarchy parented to pelvis which move the triangles of the mesh) and I am constraining the motions to prevent bad joint rotations (e.g. knees bending sideways or backwards).  The rotations in this case can pretty much be constrained by saying "do not rotate about X/Y/Z."

I'm using the Unity3D RotateAround function which rotates about a specified axis at a point by an arbitrary angle.  Given control over this point, axis, and angle how can I constrain this rotation to prevent "bad" rotations?


texts: Quaternion.RotateTowards not working as expected when parent object moves/rotates

texts:
I have a Tank with a rigidbody. A Turret Base is attached to the Tank via a Hinge Joint. The below TurretController script is attached to the Turret Base in order to rotate it to point towards the direction of the mouse.

The turret rotates flawlessly when the tank is stationary. But once I start moving the rotation behavior becomes very erratic: https://youtu.be/v1VuTbMtcCM

If anyone is able to help/explain this behavior it would be much appreciated!

/// <summary>
/// Rotates a turret towards a point at a fixed angular velocity.
/// </summary>
public class TurretController : MonoBehaviour
{
    public float m_DegreesPerSecond = 40f;

    private Vector3 m_TargetPosition;

    // Received from mouse move event
    public void Rotate(PointInputInfo inputInfo)
    {
        m_TargetPosition = inputInfo.Point;
    }

    private void RotateTurret()
    {
        Vector3 direction = Vector3.Scale(m_TargetPosition - transform.position, new Vector3(1, 0, 1));
        Quaternion targetRotation = Quaternion.LookRotation(direction, Vector3.up);
        Debug.DrawLine(transform.position, m_TargetPosition);

        // Rotate at a fixed angular velocity.
        transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime * m_DegreesPerSecond);
    }

    private void FixedUpdate()
    {
        RotateTurret();
    }
}


texts: calculate new vertex position given a transform matrix?

texts: How can I get the new position of my vertex given a 4x4 transform matrix or simply 9 floats (positionX, positionY, positionZ, rotationH, rotationP, rotationR, scaleX, scaleY, scaleZ)? Usually I can assign the matrix to my final mesh (or "node", or "object", or "geom"), but right now I need to do it manually.


texts: How to create a non-inflationary player progress system (RPG)?

texts:
As an ambitious RPG gamer, I've often came to the conclusion that something's off. You're fighting your way through a dungeon, loot some chests, fullfill some side quests to get the rewards and start to get stronger and stronger equipments and therefore stats to challenge even harder enemies. However, at some point you want to revisit one of the first places just to chill there .. and all the enemies are just .. meh. Of course, that's how it is, but in my opinion not how it should be.

Let me explain it this way: I want to create a game where getting +20 Strength is a bonus, a real progression, not the requirement to have the chance to even challenge stronger enemies. When both you and the enemy have +5 Health compared to the last fight, you didn't made any real progress since then. That's something that bothers me alot about games like Diablo that takes it to its extreme. As a player, I'd feel cheated.

Moreover, there's a term called mudflation. To explain that here's an example: Back when you start your journey, you fight a monster and get loot worth of 10 gold. 2 hours later, you made some progress and can now fight stronger monster that drop loot worth 50 gold. Let's say you have to spend 2 minutes to fight each of them, it's obvious which one's worse efficient-wise. The progress you made at the beginning starts to get smaller and smaller the further you progress through the game. "Oh, you saved 100 gold from the first hour? Sweet, now you get double that amount within 2 minutes slaying this high end monster." Meaning it's not only an issue of increasing numbers, but also of spend effort and time that gets worth less and less.

I want to create a game with visible progress, so just removing all stats and only relying on the player getting better game skills by playing the game isn't an option for me. However, I can't think of a system without said mudflation - even Dark Souls that relies heavily on the player's skill had to add some stats that you can't just ignore as a player, otherwise you won't be able to kill the end bosses within reasonable time.

Does anyone know a solution for that? I want the players to actually know they've made some progress (so just cosmetics as rewards isn't a solution either), but they shouldn't feel cheated.


texts:
I'm creating a game engine, and I'm trying to define a 3D model format I want to use. I haven't come across a format that quite does what I want.

My game engine assumes a shader model 5+ environment. By the time I'm finished with it, that won't be a very unreasonable requirement. Because it assumes such a modern environment, I'm going to try and exploit tessellation.

The most popular way, it seems, to procedurally increase geometry through tessellation is to tessellate to a height map. This works for a lot of things, but has limitations in that height maps still use up VRAM and also only have finite scalability.

So I want to be able to use curves to define what a mesh should tessellate to. The thing is, I have no idea what definition of curves I should use, how I should store it, and how I should tessellate to it. Do I use NURBS curves? Bezier? Hermite?

And once I figure that out, is there an algorithm to determine how the tessellation shader should produce and move vertices to match the curve as closely as possible? Is the infinite scalability and lower memory usage when compared to height maps worth the added computational complexity?

I'm sorry I'm kind if ignorant as to these matters. I just don't know where to start.


texts: C# Pathing algorithm for moving a object from point(X, Y) to point(X, Y)

texts:
Given a object which may move forward, backward, left and right at a given X,Y point. How to efficiently direct the object to a X,Y point using the given movement mechanics in the most efficient and human natural way.

The object is available for movement in real time, you may tell them to "startMoving|Direction|()" and "stopMoving|Direction|()" to any heading of 360 degrees. Though as a additional twist and the part I am having trouble with, is the facing of the object is never known, only its current location is known, so the algorithm must "detect" direction. The location of the object is updated in a separate thread in 500-1second intervals. A "Request" to update the location within the algorithm made be made at any point, but it is not immediately available and the algorithm must keep that in consideration. Doing something like requestAndWaitForCoordUpdate() is perfectly acceptable, however likely not needed.

In addition, no obstacles appear, it can be assumed you are on a MOSTLY open plane, stray to far from the direct straight line between the paths and you may run into obstacles. It is safe to assume that 1/4th the distance between a target and source, should be available in width on a given direct path.

I would also mention I am not sure A* applys in this scenario, if it does I am unsure how to implement it given the constraints. The only real variable here is the facing of the object.

Here is some example code:

public int[] currentCoords;
public void movement() {
  currentCoords[0] = 1005; // starting y coord
  currentCoords[1] = 1007; // starting x coord
  moveTo(1050, 1025);
}

public void moveTo(int x, int y) {
  ... how?
}

public void threadUpdatingCoords() {
   ... periodically check for source coord updates
   ... between 200ms and 1000ms apart.
}


texts: Use Stage's draw() method to invoke Actor's draw method in Libgdx

texts:
Question :
In the following snippet, I wish to draw different shapes such as rectangles, circles, triangles etc. I will be creating different class files for each of such objects, as I did for Rectangle class here.

I've been trying to invoke the draw method of Rectangle object from Stage object, but I am unable to do so. If I make a plain call to the draw method of the Rectangle object, I can draw the object.

Can some one suggest me how is this possible ?
Also, I had many other queries which I'd tried to put in comments. Please have a look at them and kindly help me in figuring out the concept beneath it.

Disclaimer : I am new to game programming, started with Libgdx.

Following is the Scan class :

package com.mygdx.scan.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.scenes.scene2d.Stage;

public class Scan extends ApplicationAdapter {
private Stage stage;
public static ShapeRenderer shapeRenderer;

@Override
public void create () {
    stage = new Stage();
    shapeRenderer = new ShapeRenderer();
    Rectangle rect1 = new Rectangle(50, 50, 100, 100);
    stage.addActor(rect1);

}

@Override
public void render () {
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    shapeRenderer.setProjectionMatrix(stage.getCamera().combined);
    shapeRenderer.begin(ShapeType.Filled);
    shapeRenderer.setColor(Color.BLACK);
    //new Rectangle(50, 50, 100, 100).draw();
    shapeRenderer.end();
    // This should call Rectangles draw method. I want a Shapetype.Filled Rectangle.
    // But I'm unable to invoke this method if I add the actor in stage object and invoke it's draw method.
    stage.draw();
}

public void dispose() {
    stage.dispose();
}
}

Following is the Rectangle Actor class :

package com.mygdx.scan.game;

import com.badlogic.gdx.scenes.scene2d.Actor;

public class Rectangle extends Actor {

float xcord, ycord, width, height;
public Rectangle(float x , float y , float width, float height) {
    this.xcord = x;
    this.ycord = y;
    this.width = width;
    this.height = height;
}

// This needs to be called in the Scan class. I just want the draw       method to be invoked.
// Also I wish to draw many such rectangles. What is the best practice to get hold of ShapeRenderer object from Scan class ?
// Should I use one instance of  ShapeRenderer object in Scan class or should I create ShapeRenderer object for each of the Rectangle object ??
// I also plan to repeat the activity for another object such as circles. So I would like to know the best practice here.
public void draw() {
    Scan.shapeRenderer.rect(this.xcord, this.ycord, this.width, this.height);
}

}


texts: Cost to licence characters or ships for a game

texts:
I am producing a game pitch document for a university game design class, and I am looking for examples of licencing cost for using characters or ships from other IP holders in a game. For example:

cost of using an X-Wing in a game, licencing from Lucas
cost of using the Enterprise in a game, licencing from Paramount
cost of using the Space Shuttle (if any), licencing from Nasa

EDIT

The closest information I can find is from an article about Nights of the Old Republic, but isn't nearly specific enough for my needs:

  What Kotick means by Lucas being the principal beneficiary of the
  success of The Old Republic is that there are most likely clauses in
  the license agreement that give percentages, points, or another
  denomination of revenue out to Lucas and his people just for the Star
  Wars name, and that amount is presumed to be a great deal of money.
  Kotick is saying that because the cost of the license is so
  prohibitive, as he has personally had experience with in his position
  as CEO of Activision Blizzard, that EA will not be able to be
  profitable because of the hemorrhaging of money to the licensor.

EDIT 2

Another vague source stating that FOX uses a "five-figure rule" (assuming between $10,000 -> $99,000)

  It seems FOX, like most studios, will not license individuals to
  create new works based upon their products. They will only commission
  individuals of their choosing if they elect to branch out into
  expanded product lines related to those licenses. Alternately, they
  are open to making the licencing available to large corporations with
  access to global markets, but only if those corporations agree to what
  Ms Friedman called a "five-figure guarantee". Presumably this means
  that the corporation seeking the licensing must agree to pay a
  5-figure sum for that license, and be confident that their product
  will sell enough volume to recoup that fee, and to produce sufficient
  profits to make the acquisition worth their while.


texts:
So I want to create a quad as a base for my game where I will put stuff on it ( trees rocks buildings etc ) ..Now how can I paint over the quad and put stuff on it?...Is it possible?

I wanted to use a terrain at first but I have been told there will performance issues and a quad would be a better choice. All sprites are going to be static too.


texts: What is the best method to update shader uniforms?

texts:
What is the most accepted way for keeping a shader's matrices up to date, and why?

For example, at the moment I have a Shader class that stores the handles to the GLSL shader program & uniforms. Every time I move the camera I then have to pass the new view matrix to the shader, then every different world object I must pass it's model matrix to the shader.

This severely limits me as I can't do anything without having access to that shader object.

I thought of creating a singleton ShaderManager class that is responsible for holding all active shaders. I can then access that from anywhere and a world object wouldn't have to know about what shaders are active just that it needs to let the ShaderManager know the desired matrices but I'm not sure this is the best way and there's probably some issues that will arise from taking this approach.


texts:
I'm working on a 2D game in which I would like to do collision detection between a moving circle and some kind of static curves (maybe Bezier curves).

Currently my game features only straight lines as the static geometry and I'm doing the collision detection by calculating the distance from the circle to the lines, and projecting the circle out of the line in case the distance is less than the circles radius.

How can I do this kind of collision detection in a relative straightforward way? I know for instance that Box2D features collision detection with Bezier curves. I don't need a full featured collision detection mechanism, just something that can do what I've described.

UPDATE: Thanks a lot for the great answers! I'll have to read up on Bezier curves to fully understand the method you've described. Then I'll get back to you.


texts: Which c/c++ model animation library for OpenGL

texts: I'm fairly new to game development, played around with xna before and just learning OpenGL & c now and I'm interested to know which c/c++ based model animation libraries are out there and which you would recommend? I don't have any particular model format in mind yet but probably a format that is supported by a free modelling tool like Blender.


texts: How to limit the speeding up of enemy movement?

texts:
Is there a way of limiting my speeding my enemy script every time my player collects 10 points. I have a movement script attached to my enemies and every time my player collects 10 points my enemies get faster. I want to put a limit on that so that the movement script (attached to my enemies) doesn't increase all the time even if the player continue to collect 10 more points and onwards. I want the limit to be 40, so even if the player continues to collect another 10 points the movement should stay at 40.

This is my speeding up my enemies script (this is used in my score script):

if (Score % 10 == 0){
    //Increment movespeed variable  from Movement script
    Movement.movespeed += 4;
}

And this is my movement script attached to my enemies:

public static int movespeed = 20;
public Vector3 userDirection = Vector3.right;

//public float lifetime;

void Start ()
{
    //Destroy (gameObject, lifetime);
}

public void Update()
{
    transform.Translate (userDirection * movespeed * Time.deltaTime);
}

How can I limit the movement speed so that it doesn't exceed the upper limit I want?


texts: Software for game system design overview

texts:
Yes so this is a question more oriented towards the planning / project part of game development. What software do you use to plan your game, I am talking about visual stuff like a mindmap application for making some neat diagrams and so on, sort of like database design only it's for the game instead, is there any good ones?

Thanks


texts: Raycast algorithm fails to collide with diagonal walls in specific locations

texts:
I'm having a problem with my ray-cast algorithm in a 2D tile-based universe. I feel the situation would be best explained with a picture, so here it is:

The ray, represented by the blue line, is passing "through" the wall to hit its target when the wall passes through a point where the quantized line moves diagonally and the wall is perpendicular to it. The raycast function is as such:

def raycast(pos, direction, level):
    dx, dy = direction
    t=0
    x, y = pos
    obj=None
    while not obj and t < 5000:
        t+=1
        x+=dx
        y+=dy
        obj=level.get_at((round(x),round(y)),True)
        pass
    return obj

Is there a simple, efficient way to eliminate this kind of edge case?


texts: How do I create a Loading Scene in SLick?

texts: I actually wanted just a fake loading scene. For a fake loading scene, how do I make a time variable or a time Method? I'm still a fresh java programmer!


texts: Is it possible to use ALSA or OSS on Windows?

texts: Has nobody written a wrapper over DirectSound or something yet?


texts: How can I use startcoroutine to change a variable value using while?

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

public class Outline : MonoBehaviour
{
    public float width;

    private Renderer rend;
    private float currentWidth;

    private void Start()
    {
        rend = GetComponent<Renderer>();
        currentWidth = rend.material.GetFloat("_Outline");

        StartCoroutine(ChangeOutline());
    }

    private void Update()
    {
        //SetOutLineWidth(width);
    }

    public void SetOutLineWidth(float width)
    {
        rend.material.SetFloat("_Outline", width);
    }

    IEnumerator ChangeOutline()
    {
        float timeToWait = 3f;

        while (currentWidth < width)
        {
            width += 0.01f;
            SetOutLineWidth(width);
            yield return new WaitForSeconds(timeToWait);
        }
    }
}

What I want to do is for example if I will set width variable value to 5 then change the value until the currentWidth is 5:

SetOutLineWidth(width);

If the currentWidth is 7 and I set width to 5 change the value from 7 to 5 slowly. If currentWidth is 7 and I set width to 10 again change it slowly to 10.
What I did now is making the width value keep raising and setting the Outline non stop.

What I want to do in general is to make two modes:

Change the width value and set the Outline slowly according to the time once on one direction.
Like 1 but make it ping pong mode once the outline value reached to width change it back slowly to the first value outline was and then back to width nonstop.


texts: Should the entity handle his own movement?

texts:
I am currently building a simple turn based game with a Room consisting of a 2D array of Tile objects. Those can be WallTile or FloorTile. Tile objects have a north, east, south and west  Neighbour. The FloorTiles have a Stack of Entities so I can easily draw the top entity.
Now I am wondering, my Player is an Entity, when the player moves, should the player handle that logic, or the Game that holds my Player?
In the first case it would be something along the lines of:
class Player : Entity {
    public Tile CurrentLocation

    public bool CanMoveTo(Direction) {
        // Let's say that direction is East
        return CurrentLocation.EastNeighbour == FloorTile
    }

    // This method does the actual move
    public void MoveTo(Direction)
}

In the second case it would be like this:
class Game {
    public Player Player;
    public Room Room;

    public void Update() {
        // Lets say we get direction from some input from somewhere
        if Room.TileAt(player.Y, player.X) is FloorTile then MoveThere()
    }
}

I am not quite sure what the nicest of the two options is. Initially I am thinking about the first solution. Any help or tips would be appreciated.


texts:
I'm trying to do mouse picking and actually it works but when I scale the object and click that point on the image it picks wrong one, this happens only after scaling an object and I'm sure matrices are correct, any idea?

    DirectX::XMFLOAT4X4 projection;
    DirectX::XMStoreFloat4x4(&projection, Graphics::projectionMatrix);

    float viewX = ((2.0f * Input::GetMouseX()) / MainWindow::GetDisplayResolution().width - 1.0f) / projection(0,0);
    float viewY = (1.0f - (2.0f * Input::GetMouseY()) / MainWindow::GetDisplayResolution().height) / projection(1,1);

    DirectX::XMMATRIX inverseMV = DirectX::XMMatrixInverse(nullptr,DirectX::XMMatrixTranspose(entity->Renderer_->MV_Matrix)); //MV is column order

    DirectX::XMVECTOR rayOrigin = DirectX::XMVector3TransformCoord(DirectX::XMVectorSet(0.0f,0.0f,0.0f,1.0f), inverseMV);
    DirectX::XMVECTOR rayDirection = DirectX::XMVector3Normalize(DirectX::XMVector3TransformNormal(DirectX::XMVectorSet(viewX, viewY, 1.0f, 0.0f), inverseMV));

    for (const auto& subMesh : entity->Renderer_->mesh->GetSubMeshes())
    {
        float distance = 0.0f;
        if (subMesh.AABB.Intersects(rayOrigin, rayDirection, distance))
        {
            for (unsigned int i = 0; i < subMesh.GetIndexCount(); i += 3)
            {
                DirectX::XMVECTOR p1 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i]]);
                DirectX::XMVECTOR p2 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 1]]);
                DirectX::XMVECTOR p3 = DirectX::XMLoadFloat3(&subMesh.positions[subMesh.indices[i + 2]]);

                if (DirectX::TriangleTests::Intersects(rayOrigin, rayDirection, p1, p2, p3, distance) && distance < minDistance)
                {
                    minDistance = distance;
                    *pickedEntity = entity;
                }
            }
        }
    }


texts:
I'm creating a procedural terrain system for Unity. And I'm looking for ways to efficiently cast self-shadows on it. If it wasn't procedural, I could simply bake a lightmap using Beast. But, I can't because the terrain mesh is created at runtime. What kind of methods can be done for this, I'm sure it has been done before. If possible, I'm looking for a solution that works for non-pro.

I was thinking that maybe some kind of onetime ray-tracing method might be a solution.


texts: What does glBlendFunc do when given an incorrect enumeration value?

texts:
In cocos2d-x, I am using particle system from plist with blend values: dst = 1, and src = 100 which is wrong enum for gl_blend.

Although app logged "OpenGL error 0x0500" but it still run and showed a good blend effect. And i can not find the right pairs of dst and src to recreate that effect.

So i hope someone can tell me how BlendFunc / gl_blend will work when it having bad src value. Base on that i hope i can recreate that effect without using wrong src value. Thanks


texts: Maya LT extrude tool won't work properly, is it buggy?

texts: First several hours with Maya LT and already stuck and frustrated. Trying to extrude faces (let's say future legs) but the position of faces from which I am extruding won't stay on its place, it changes and the extrusion happens from a new place, even from there I try to adjust this position, but the edge loop around the selected faces won't move, I try to delete that edge loop, it won't delete it, (tried 'delete', 'ctrl + Delete', delete Edges/Vertex menu option, deleting by vertices, there are no doubles it just removes the selection when I press delete) I managed only when I deleted the faces around that edge loop, which is quite annoying. Maybe someone had a similar issue and knows the solution or I am doing something wrong here? Any advice is appreciated!


texts: Is there already an accepted way to measure the "enjoyment/entertainment value" of a certain game?

texts:
I don't know if the question is legit, but I've tried my best. I've found this post here about measuring the creative/entertainment value of video game requirement. I've done some reading but I can't see if there already exists a specific way to measure such.

This one is research study about a model for evaluating player enjoyment. I don't know but, is it outdated? The study was conducted way back 2005.

Is there any any studies or researches you know that is somewhat related to this or some other way?


texts: Hidden operations of the Direct3D pipeline

texts:
I'm curious- what operations are there in Direct3D that aren't controlled directly through shader, or directly to do with shader manipulation- i.e., that occur behind the scenes.

So far, I've got just pixel interpolation.


texts: Updating Json files in a Unity game - What am I doing wrong?

texts:
I am working in Unity, on my first project. I am working on a turn-based RPG, and I am having a hard time figuring out my back end.

I'm currently using JSON files to store my data, which are then converted into objects and processed in C#. So far so good, but I have reached a road block when trying to save data back into a JSON file.

For example, lets say I have a character file such as: [{"name":"John", "CurrentHP": 100, "MaxHP": 100},{"name":"Paul", "CurrentHP": 200, "MaxHP": 200}]. After a combat, John loses 30 hp. How do I save this data back to that JSON file, so it reads as [{"name":"John", "CurrentHP": 70, "MaxHP": 100},{"name":"Paul", "CurrentHP": 200, "MaxHP": 200}]?

The tutorials I've watched all talk about serializing the object back into a JSON file, but this would involve deleting the whole file and creating a new one with the new information. This sounds like a very ineffective approach, especially for some large 'tables' in my game. There needs to be a way to update just one attribute from one of the IDs in a given JSON file.

How do I efficiently update individual JSON rows?


texts: How can I animate the stretching of a sprite over time?

texts:
My goal is to find the function to stretch a sprite like my example below, and then get it to animate during a certain time. It is like an interpolation, where the starting point is the original image, and the final point is the stretched image. Any idea?

Here is an example, hope it is clear.


texts: How can I render two scenes simultaneously on LibGDX?

texts:
In my LibGDX game, I'm trying to render two 'views' (one next to the other) at the same time.

The idea is to have each view rendered according to global coordinates, but everything inside would be relative to their parent view. (e.g.: if I draw a rectangle inside View 1 and its coordinates are x=0, y=0, It would appear in the upper corner of View 1).


texts: Input.GetAxis returns wrong sign only for 1 and -1

texts:
I'm using an Xbox 360 controller on Windows 10 with Unity, and the maximum values have the opposite sign as the rest of that side. For example, if I tilt the stick up, I get values from 0.1 to 0.99, but then I get a -1 when the stick is at maximum. Have I configured it to be this way by mistake? I have reproduced the issue in a clean project and using another controller.

void Update () {
    float pitch = Input.GetAxis("Vertical");
    Debug.Log (pitch);
}

I have discovered that if the axis is inverted (i.e. not as shown in the image) then returned values have expected signs. I will add this workaround as an answer for anyone else who may encounter this problem, but I will refrain from accepting it to allow for answers addressing the root cause.


texts: Isometric drawing "Not Tile Stuff" on isometric map?

texts:
So I got my isometric renderer working, it can draw diamond or jagged maps...Then I want to move on...How do I draw characters/objects on it in a optimal way?

What Im doing now, as one can imagine, is traversing my grid(map) and drawing the tiles in a order so alpha blending works correctly.

So, anything I draw in this map must be drawed at the same time the map is being drawn, with sucks a lot, screws your very modular map drawer, because now everything on the game (but the HUD) must be included on the drawer..

I was thinking whats the best approach to do this, comparing the position of all objects(not tile stuff) on the grid against the current tile being draw seems stupid, would it be better to add an id ON the grid(map)? this also seems terrible, because objects can move freely, not per tile steps (it can occupies 2 tiles if its between them, etc.)

Dont know if matters, but my grid is 3D, so its not a plane with objects poping out, its a bunch of pilled cubes.


texts: Facing issues trying to Parse JSON in Lua

texts:
Problem statement:

Need help trying to load a JSON file into a table array in Lua for Corona SDK development.

My Objective:

Call specific data from JSON file to my application by using key value pairs.

Current Behavior of application

Corona simulator console just return a table ID like --> table: 114AF7D8

Expected Behavior

Returns the name "Smith" when i print(DialogsTable.name[2])

A reference to the Lua code:

local json = require( "json" )

local DialoguesTable = {}

local path = system.pathForFile("simple.json", system.DocumentsDirectory )

function putJsonDataInTable(filename, base)
    local base = base or system.DocumentsDirectory
    local path = system.pathForFile(filename, base)
    local fh = io.open(path,"r")
    if fh then
        local contents = fh:read("*a")
        io.close( fh )
        local DialoguesTable = json.decode(contents)
        return DialoguesTable
    else
        return nil
    end
end
putJsonDataInTable()
print(DialoguesTable.name[2])

A reference to the JSON file:

{
 "name":["John","Smith"],
 "age":30
}


texts: How do games with a low tickrate but high framerate work?

texts: How do games with a low tickrate make things work? I.e. how do they manage to stay responsive despite the fact that interpolating gamestates for rendering adds input delay? Is there some method besides simple interpolation that allows for fps above the tickrate? E.g. Minecraft seems to work very well with a tickrate of just 20hz.


texts: How to make Volume Heat Distortion effect in OpenGL?

texts:
I'm working on adding volume effects to an existent, open-source game engine. At the moment, the engine only supports two dimensional "thruster" bitmaps with a planar heat distortion drawn over the bitmap.

Is it possible to make a Volume filling Heat Distortion? If so, what would be the general idea behind it?


texts: Converting between world coordinate systems

texts:
I have a mesh (verticies, indicies, normals).This mesh uses following world coordinate system:

Forward: x
Up: z
Right: y

I am trying to convert it to a different coordinate system:

Forward: z
Up: y
Right: -x

I swizzled verticies from xzy to zy-x and the geometry looks fine. But the same trick didn't work for normals. What I am missing? Should I use some kind of matrices?

Thank you for any help you can offer!

EDIT
Red lines - normals vizualization

Here is a part of code that shows normals:

GLKVector3 up = GLKVector3Make(0, 0, 1);
      GLKVector3 normalVec = GLKVector3Make(normalBuffer[i * stride +     normalOffset],
                                            normalBuffer[i * stride + 1 + normalOffset],
                                            normalBuffer[i * stride + 2 + normalOffset]);
      GLKVector3 axis = GLKVector3Normalize(GLKVector3CrossProduct(up, normalVec));
      float dotProduct = GLKVector3DotProduct(up, normalVec);
      normalNode.rotation = SCNVector4Make(axis.x, axis.y, axis.z, acos(dotProduct));


texts: Using XNA ContentPipeline to export a file in a machine without full XNA GS

texts:
My game uses the Content Pipeline to load the spriteSheet at runtime. The artist for the game sends me the modified spritesheet and I do a build in my machine and send him an updated project. So I'm looking for a way to generate the xnb files in his machine (this is the output of the content pipeline) without him having to install the full XNA Game studio.

I don't want my artist to install VS + Xna (I know there is a free version of VS but this won't scale once we add more people to the team).
I'm not interested in running this editor/tool in Xbox so a Windows only solution works.
I'm aware of MSBuild options but they require full XNA

I researched Shawn's blog and found the option of using Msbuild Sample or a new option in XNA 4.0 that looked promising here but seems like it has the same restriction: Need to install full XNA GS because the ContentPipeline is not part of the XNA redist.
So has anyone found a workaround for this?


texts:
I've run in to some problems with the D3DRS_DEPTHBIAS render state after converting an older game's D3D8 renderer to D3D9.

D3D9 replaced the old (and poorly supported) D3DRS_ZBIAS with D3DRS_DEPTHBIAS, but it doesn't seem possible to get it to work the same way that ZBIAS did. This game renders shadows and other "decals" onto the ground as flat textures, and to avoid the obvious z-fighting issues that would result would set D3DRS_ZBIAS to 2 when rendering decals in the D3D8 renderer (which I did not write).

The best approximation of the old D3D8 behavior that I've been able to come up with is setting D3DRS_DEPTHBIAS to -0.00003 when rendering shadows. This works fine for shadows on flat terrain that are relatively close to the camera, but when the camera is far above a shadowed object, the shadow will draw on top of the object itself. This can also happen even on near objects if they are on uneven terrain.

It doesn't seem possible to solve this by manipulating the DEPTHBIAS value alone, as no change fixes it entirely without causing other problems.

Is there any way to solve this? Failing that, is there a more modern technique for rendering decals that could be used? I would much rather avoid lots of rewriting as I'm not very familiar with D3D and didn't write any of the original code, but if that is the only option...


texts:
I am working on a 2D game with sprite sheets. I might be completely overlooking something here, but I can't figure out for the life of me how to use sprite sheets with z-buffer testing.

Here are the conflicting issues as I understand them:

A sprite in a spritesheet will have transparent pixels all around it that define where the sprite doesn't exist (since each frame in the sprite sheet "grid" is a rectangle, but the sprite is contained within that rectangle).
Transparency doesn't work with z-testing.

Therefore, it's impossible to use spritesheets with the z-buffer? I should just use painter's algorithm then?

Are both of those conclusions correct?


texts: Which programming language should I start with in game dev?

texts:
I am a front end web developer and I've always been interested in building games.  I work primarily with HTML, CSS, PHP, and JavaScript on a daily basis, so I'm not new to coding.  I would like to know which language/platform would be most useful for me to build a simple, 2D, art heavy game, like something you'd see on the Super Nintendo.

Thanks.


texts:
I want to identify my loaded assets, but I don't know which one should I choose. There are 2 options:

Name (string)

This is the easiest and also fast with unordered_map ( O(1) ), but way slower then using integers.
Easily understandable in the code.

Integers

Fastest.
Aren't understandable in code.

I know that strings are not so safe or fast, but is it that bad, or does it only count as bad in a AAA title? I could make enums, to use integers, but if I load the scene, assets, etc from a file at runtime, I can't use enums. Is there a way to make these integers readable if they are generated at runtime?

I know that this issue has a few threads all around the internet, but I couldn't find out how important in which cases is this.


texts: Particle systems and sprites, draw order issue

texts:
I have a particle system, and my character, which is a sprite.
I want to create a particle for smoke/dust raising from the ground, and I want my character to be able to move over it.

The problem is that the particles are all drawn in front or behind the sprite, even if the sprite is in the middle of the smoke:

If I move the sprite a little forward, all the particles are behind:

It's like all particles are sharing the same Z order of the particle system itself.

I have been facing this problem from a long time, and I tried using other shaders, new sorting layers, and messing with the particle system fudge, but the result is always the same.

I want the particles to be rendered in the correct order, those that are further away, behind the character; and those closer, in front of the character.

Any idea of what is happening here?


texts: Best platform for puzzle game development on the iPad

texts: I have a series of hidden object and puzzle games mapped out that I want to develop for the iPad and although I have written programs before, it's been a while. I've been trying to find the best platform to use and can't seem to find any helpful suggestions although HTML 5 seems to be the most mentioned. I will be using original graphics, perhaps some video cutscenes and music (think Dire Grove). Any suggestions?


texts:
I'm trying to delete quads in unity. The code here creates a procedural grid. Setting the gridSizeX to 5 and gridSizeY to 3, creates a 6 by 4 grid. I want to delete the first row of quads when I click the left mouse button (later will implement a trigger to delete). I have created a DeleteTriangle() method but it doesn't work properly. I would like to delete all the quads in the first row when I first click the left mouse button. When I click again, it should remove the next row and so on. Here is the code I have:
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class Grid : MonoBehaviour
 {
   Mesh mesh;
   Vector3[] vertices;
   int[] triangles;

   public float cellSize = 1;

   public int gridSizeX, gridSizeY;

   void Awake()
   {
     mesh = GetComponent<MeshFilter>().mesh;
   }

   void Start()
   {
    MakeGrid();
    UpdateMesh();
   }

   void Update()
   {
    if (Input.GetMouseButtonDown(0))
      {
        DeleteTriangle(0);
      }
   }

  void MakeGrid()
  {
    //set array sizes
    vertices = new Vector3[gridSizeX * gridSizeY * 4];
    triangles = new int[gridSizeX * gridSizeY * 6];

    //set tracker integers
    int v = 0;
    int t = 0;

    for (int x = 0; x < gridSizeX; x++)
    {
        for (int y = 0; y < gridSizeY; y++)
        {
            Vector3 cellOffset = new Vector3(x * cellSize, 0, y * cellSize);

            //populate the vertices and triangles arrays
            vertices[v] = new Vector3(-cellSize, 0, -cellSize) + cellOffset ;
            vertices[v + 1] = new Vector3(-cellSize, 0, cellSize) + cellOffset  ;
            vertices[v + 2] = new Vector3(cellSize, 0, -cellSize) + cellOffset  ;
            vertices[v + 3] = new Vector3(cellSize, 0, cellSize) + cellOffset  ;

            triangles[t] = v;
            triangles[t + 1] = triangles[t + 4] = v + 1;
            triangles[t + 2] = triangles[t + 3] = v + 2;
            triangles[t + 5] = v + 3;

            v += 4;
            t += 6;
         }
      }
    }

   void UpdateMesh()
   {
    mesh.Clear();

    mesh.vertices = vertices;
    mesh.triangles = triangles;
    mesh.RecalculateNormals();
   }

   private void DeleteTriangle(int id)
    {
      Mesh currentMesh = mesh;

      var triangles = currentMesh.triangles.ToList();

      triangles.RemoveAt(id );
      triangles.RemoveAt(id );
      triangles.RemoveAt(id );

      currentMesh.Clear();
      currentMesh.vertices = vertices.ToArray();
      currentMesh.triangles = triangles.ToArray();

      currentMesh.RecalculateNormals();
   }
 }


texts: 2D Terrain generation with controlled variations

texts:
Well, I'm trying to create a simple endless runner and -this may sound repetitive- I'm searching for ways to generate the terrain. The game will only have 3 types of ground tiles, ascending, descending and plain, and it should look (somewhat) like this:

So, what I want to say is that the terrain can only vary 1 unit of height.
I first thought of perlin noise, but I haven't found any information about restricting height variations. I've also thought about choosing randomly between the three posible tiles, but I still want that "natural randomness" that perlin noise can produce (very high hills, deep valleys, etc)
Any idea on how to procede?
Thanks! And please excuse my english.


texts: sfml - graphic not showing once i change the context setting

texts:
I am trying out sfml and want to draw simple 2D graphic on top of 3D object.

sf::ContextSettings settings;
settings.depthBits = 24;
settings.majorVersion = 4;
settings.minorVersion = 1;//opengl v4.1
settings.attributeFlags =  sf::ContextSettings::Core;

sf::RenderWindow window( sf::VideoMode(1200,800),"sfml", sf::Style::Default, settings);

sf::CircleShape qs;
qs.setRadius(400);
qs.setPosition(400,400);

while(window.isOpen()){
        sf::Event evnt;
        while (window.pollEvent(evnt)) {
            switch (evnt.type) {
                case sf::Event::Closed:
                    window.close();
                    break;
            }
        }
        glClearColor(0.2f, 0.3f, 0.3f, 1.0f);

        window.draw(qs);

        window.display();
    }

the sf::ContextSettings is set so that I can use openGL to draw 3D graphic. but with this settings, my qs not showing in the window. if I comment out the settings.majorVersion = 4; and settings.minorVersion = 1;, then it appear.

I am rather new and not sure how it works.

Is this possible to be resolved?
Is it correct to think that I want to use sfml for interface graphic and OpenGL for 3D? How do people normally do it?


texts: Roguelike Class Structure Makes Everything Effectively Global

texts:
A brief rundown of the hierarchy of the game data objects:

Configuration - loaded from XML files, has Descriptors, among other things

Atlas - has a Configuration, has a CreatureInstance(represents the player's creature instance), is an associative array of AtlasColumns

AtlasColumn - has an Atlas(parent), is an associative array of AtlasCells

AtlasCell - has an AtlasColumn(parent), is an associative array of Layers

Layer - has an AtlasCell(parent), is an associative array of LayerColumns

LayerColumn - has a Layer(parent), is an associative array of LayerCells

LayerCell - has a LayerColumn(parent), has a CreatureInstance, a array of ItemInstances, and a TerrainInstance

CreatureInstance/ItemInstance/TerrainInstance - has a LayerCell(parent), has a Descriptor

Descriptor - has an associative array of properties needed by an instance to do its particular function

The most important thing in the Configuration are the Descriptors.  A Descriptor has all of the properties that are needed by the various types of instances. It has properties that drive behavior, what it looks like on screen, and so on.

So here's the part that bothers me:

Everything... EVERYTHING, from Atlas to TerrainInstance can talk up and down the entire chain, the reason being that if, for example, the TerrainInstance is a square upon which a player steps and suddenly a number of monsters are conjured around him, the TerrainInstance needs to have access to the neighboring LayerCells.  Or for another example if a CreatureInstance when attacking the player's CreatureInstance is able to take items from the player's inventory, and relocate them somewhere else in the dungeon, it needs access to a different Layer or AtlasCell in order to put the item where it needs to go.

An alternative that would appear to be "better encapsulated" might be a messaging system that sends little message objects up and down the chain and handles things at the appropriate level, but is that really any BETTER than just having the objects be aware of one another?

The game I'm writing started out with mostly hardcoded item and creature types, and gradually morphed its way into something similar to the more flexible roguelike framework that I've detailed above. I'm finally switching from C# to Java for it(the language is immaterial, however), and I'd like to not have missed something glaringly obvious that will cause great pains later when I need to refactor it.

So, the question: is the apparent lack of encapsulation within the data/business objects of the game demonstrate a fatal flaw in the architecture?  And if so, what is that flaw and how can I correct it before I get too far along?


texts: Unity build issue - GooglePlayGamesManifest and GameServicesManifest

texts:
I have added leaderboard to my unity game for which I have used the google play services plugin. But when I try to build, this is the error I get:
 Execution failed for task 'processReleaseManifest'.
> Manifest merger failed : Attribute meta-data#com.google.android.gms.games.APP_ID@value value=
(\728999946156) from [:unityLibrary:GameServicesManifest.plugin] AndroidManifest.xml:10:13-42
is also present at [:unityLibrary:GooglePlayGamesManifest.plugin] AndroidManifest.xml:20:13-46 value=
(\u003728999946156).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:8:9-
10:45 to override.

Here's what's in the first manifest file:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by the Google Play Games plugin for Unity
 Do not edit. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="14" />
<application>
    <!-- The space in these forces it to be interpreted as a string vs. int -->
    <meta-data android:name="com.google.android.gms.games.APP_ID"
        android:value="\u003728999946156" />
    <!-- Keep track of which plugin is being used -->
    <meta-data android:name="com.google.android.gms.games.unityVersion"
        android:value="\u0020.20.20" />
    <activity android:name="com.google.games.bridge.NativeBridgeActivity"
        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>

and the second file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android = "http://schemas.android.com/apk/res/android"
package="com.google.example.games.mainlibproj">
<application>
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value = "\728999946156" />
<activity android:name="com.google.games.bridge.NativeBridgeActivity" android:theme =
"@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
</application>
</manifest>


texts:
I am a new Android game developer and I have only a limited knowledge about game development and all. I'd like to create a game just like Farmville
and I heard that tile map is the method used to code this game but I dont have support from others so I request you all to help me if you can. Please tell me how I could create such a game using eclipse and android SDK and let me know if there is any game engine that can be a support to my game and how to use it too. I looked at cocos2d android but its very complicated for a starter point of view.


texts: Ray-Triangle Intersection: does the direction of the triangle normal matter?

texts:
Found an article here about ray triangle intersection: https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution
It states that D of plane Ax+By+Cz+D = 0 can be found as triangleNormal.Dot(triangleVertex).
But depending on the sign of the normal, D would have a different value. Doesn't that make a difference as to which side of the origin the plane lays? Doesn't the normal of the triangle always need to face the origin for this equation to be correct?


texts: Detecting Left and Right Mouse clicks on UI Text objects that are dynamically created

texts:
So, in my game I create a bunch of UI Text game objects dynamically (in the C# script), but I just can not find out how to properly detect Left and Right mouse clicks on these UI Text that were dynamically generated.

I have tried adding Colliders and Colliders2D to the UI Text game objects for raycasting, but with no luck. And differently from UI Button, it seems that Unity has left proper "on mouse click" functions out from UI Text

Can anyone help out on how to accomplish that?

PS: no, I can not use UI Buttons, it has to be Texts. And the UI Texts have to be generated on the fly, not in the editor


texts: Language and learning of an MMO Game server

texts:
I am creating a MMO using XNA framework for the client and want to create the server using .Net sockets in C#. I am not a total rookie to network programming, but I am having trouble finding resources, and learning material on developing a game server or learning .Net Sockets. I scanned the MSDN library for quite a while but I feel a tutorial or a step by step book would not go amiss. I considered a WCF program for the server but I want a more educated persons opinion before traveling down that road.

What do you think? Is there a reference I overlooked? Would WCF be appropriate?


texts:
I have MOUSEX worked out perfectly, it  moves on the X axis, but when I add the Y axis, I can't use the MOUSEX axis.
using UnityEngine;
using System.Collections;

// This script moves the character controller forward
// and sideways based on the arrow keys.
// It also jumps when pressing space.
// Make sure to attach a character controller to the same game object.
// It is recommended that you make only one call to Move or SimpleMove per frame.

public class Move : MonoBehaviour
{
    CharacterController characterController;

    public float speed = 6.0f;
    public float jumpSpeed = 8.0f;
    public float gravity = 20.0f;
    public Transform charBody;
    private Vector3 moveDirection = Vector3.zero;
    public float mouseSense = 11f;
    public float runSpeed = 12f;
    public bool isRunning = false;
    float camRot = 0f;
    public Transform altCamera;

    void Start()
    {
        characterController = GetComponent<CharacterController>();
    }

    void Update()
    {
        if (characterController.isGrounded)
        {
            // We are grounded, so recalculate
            // move direction directly from axes

            moveDirection = transform.forward * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;
            moveDirection = transform.right * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;

            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
            }

            if (Input.GetKey(KeyCode.LeftShift))
            {
                moveDirection = transform.forward * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
                moveDirection *= runSpeed;
                moveDirection = transform.right * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
                moveDirection *= runSpeed;

            }
        }

        // Apply gravity. Gravity is multiplied by deltaTime twice (once here, and once below
        // when the moveDirection is multiplied by deltaTime). This is because gravity should be applied
        // as an acceleration (ms^-2)
        moveDirection.y -= gravity * Time.deltaTime;

        // Move the controller
        characterController.Move(moveDirection * Time.deltaTime);

        float MOUSEY = Input.GetAxis("Mouse Y") * mouseSense * Time.deltaTime;
        float MOUSEX = Input.GetAxis("Mouse X") * mouseSense * Time.deltaTime;

        charBody.Rotate(Vector3.up * MOUSEX);

    }
}

Here's my code.
but when i add:
camRot -= MOUSEY;
transform.localRotation = Quaternion.Euler(camRot, 0f, 0f);
camRot = Mathf.Clamp(camRot, -90f, 90f);

The MOUSEX axis doesn't work, and the MOUSEY moves up and down, with the MOUSE axis, but doesn't clamp and the MOUSEX doesn't rotate.
Help please?
Thanks


texts: Run-time Navigation Mesh Generation for 2D Tile Maps

texts:
I have a 2D tile map, where each tile is marked as blocking or non-blocking. Each tile is 16x16 pixels and sub-tile movement is possible. I'm attempting to generate a navigation mesh from this data, at run-time, using C++.

Is there any well known library that can be used to generate a navigation mesh, given a 2D tile map? Alternatively, is there any algorithm that can be used to intelligently generate a navigation mesh from the tile data?

As far as I can tell, all of the popular solutions are aimed at 3D maps and don't perform well when given the simplified case of a 2D map.


texts: Bullet: Apply any Transformation to RigidBody?

texts:
I'm using Bullet for CollisionDetection.
I load a scene from a Collada-File using Assimp.
Let's say I want to give every object in the scene a RigidBody with a box as CollisionShape.
Right now I first load the vertices of the object from the file into my Model-Object and then store the transformation matrix. After that I create the CollisionShape with the following code:

btVector3 rigidBodyPos;
btCollisionShape* collisionShape;

glm::vec3* minMax = getMinMaxVertexCoords();
glm::vec3 minCoords = minMax[0]; //The minmum/maximum x/y/z values in the Mesh
glm::vec3 maxCoords = minMax[1];
glm::vec3 middleSize = glm::vec3((maxCoords.x - minCoords.x) / 2, (maxCoords.y - minCoords.y) / 2, (maxCoords.z - minCoords.z) / 2);
glm::vec3 middlePos = glm::vec3((maxCoords.x + minCoords.x) / 2, (maxCoords.y + minCoords.y) / 2, (maxCoords.z + minCoords.z) / 2);

collisionShape = new btBoxShape(btVector3(middleSize.x, middleSize.y, middleSize.z));
rigidBodyPos = btVector3(middlePos.x, middlePos.y, middlePos.z);

Here's a look at my getMinMaxVertexCoords():

glm::vec3* Model::getMinMaxVertexCoords() {
    float maxValue = std::numeric_limits<float>::max();
    float minValue = std::numeric_limits<float>::lowest();
    glm::vec3 lowestVec = glm::vec3(maxValue, maxValue, maxValue);
    glm::vec3 highestVec = glm::vec3(minValue, minValue, minValue);
    for (Vertex v : getVertices()){
        //Apply Transform
        glm::vec4 pos = getModelMatrix() * glm::vec4(v.position, 1);
        glm::vec3 homogenizedPos = glm::vec3(pos.x / pos.w, pos.y /     pos.w, pos.z / pos.w);
        lowestVec.x = min(pos.x, lowestVec.x);
        lowestVec.y = min(pos.y, lowestVec.y);
        lowestVec.z = min(pos.z, lowestVec.z);
        highestVec.x = max(pos.x, highestVec.x);
        highestVec.y = max(pos.y, highestVec.y);
        highestVec.z = max(pos.z, highestVec.z);
    }
    glm::vec3 res[2] = { lowestVec, highestVec };
    return res;
}

The problem doing it this way is, if my scene contains a rotated cube, the collisionbox is obviously not rotated, but parallel to the axes.

I tried solving this by applying the transformation matrix only after creating the RigidBody (so when creating the CollisionShape the ModelMatrix is the identity matrix) and then transforming the RigidBody afterwards:

btTransform transform;
transform.setFromOpenGLMatrix(glm::value_ptr(getModelMatrix()));
_rigidBody->setWorldTransform(transform);

The problem with this however is that the box might be rotated now, but if the transformation contains a Scaling - which is very likely - Bullet does not accept it, and my RigidBody basically disappears (no collision is detected anymore).

Does anybody know a solution to this problem?


texts:
I have a platform with btBoxShape as shape, and I want to rotate it every certain amount of time to simulate a rotating platform.

Right now I rotate it with Ogre (my rendering engine) and use a custom btMotionState to synchronize it with bullet. The thing is that when a player goes on top of it (a player is a btRigidBody with mass 1) the body should stay in the same coordinate relative to the platform and rotate with it. Right now it is kinda bugged and it doesn't rotate properly, and I don't know the exact cause.

What should I do to achieve this effect?

Here is a video with an example of what I want to do: http://youtu.be/z60jiGldX48?t=1m2s


texts:
I am familiar with Unity and in the process of learning android SDK when the announcement about unity android basic came out.

What would be the advantages and disadvantages of using the android SDK directly versus development using Unity Android?


texts:
I'm developing a 2D tile based game and I have a few questions regarding it.

First I would like to know if this is the correct way to structure my Tile class:

namespace TileGame.Engine {
    public enum TileType {
        Air,
        Stone
    }

    class Tile {
        TileType type;
        bool collidable;

        static Tile air = new Tile(TileType.Air);
        static Tile stone = new Tile(TileType.Stone);

        public Tile(TileType type) {
            this.type = type;

            collidable = true;
        }
    }
}

With this method I just say world[y, x] = Tile.Stone and this seems right to me but I'm not a very experienced coder and would like assistance.

Now the reason I doubt this so much is because I like everything to be as optimized as possible and there is a major flaw in this that I need help overcoming. It has to do with saving and loading... well more on loading actually. The way it's done relies on the principle of casting an enumeration into a byte which gives you the corresponding number where its declared in the enumeration. Each TileType is cast as a byte and written out to a file. So TileType.Air would appear as 0 and TileType.Stone would appear as 1 in the file (well in byte form obviously). Loading in the file is alot different though because I can't just loop through all the bytes in the file cast them as a TileType and assign it:

for(int x = 0; x < size.X; x++) {
     for(int y = 0; y < size.Y; y+) {
          world[y, x].Type = (TileType)byteReader.ReadByte();
     }
}

This just wont work presumably because I have to actually say world[y, x] = Tile.Stone as apposed to world[y, x].Type = TileType.Stone. In order to be able to say that I need a gigantic switch case statement (I only have 2 tiles but you could imagine what it would look like with hundreds):

Tile tile;
for(int x = 0; x < size.X; x++) {
     for(int y = 0; y < size.Y; y+) {
          switch(byteReader.ReadByte()){
               case 0:
                    tile = Tile.Air;
                    break;
               case 1:
                    tile = Tile.Stone;
                    break;
          }
          world[y, x] = tile;
     }
}

Now you can see how unoptimized this is and I don't know what to do. I would really just like to cast the byte as a TileType and use that but as said before I have to say world[y, x] = Tile.whatever and TileType can't be used this way.

So what should I do? I would imagine I need to restructure my Tile class to fit the requirements but I don't know how I would do that. Please help!

Thanks.


texts: How can I improve the visibility of an object transform gizmo?

texts: I'm developing a 3DSMax like move gizmo, and I'm struggling with how difficult it is to see, especially on modern high resolution displays.  Is there a good way to make the RGB axis lines more visible when overlaid on top of a bright object?


texts: How to "hide" an adventure game in an RPG

texts:
I have a shakey idea for a game, and I need help fleshing out what mechanics could make this work.

I want to make a game that, on the surface, is a fun little exploration/dungeon crawler/rpg-lite sort of game. There's some story, a large map, and basic quests to go off to various dungeons and defeat all the monsters that are threatening the kingdom.

The idea is that a player can play through, and defeat the game by just going and defeating the monsters everywhere, and that should be a rewarding enough way to play the game.

However, I don't want that to be the only way to play the game. What if the monsters attacking the kingdom from a nearby "dungeon" are just misunderstood, or are being provoked? What if they could instead be made into allies?

For each set of set of monsters threatening the kingdom, I want the player to either be able to just go and kill them all, or find some other solution, but for killing all the monsters to be the only obvious thing to do.

The idea being that finding a different solution should feel very rewarding, or a suggestion that there are other solutions should come late in the game and provide motivation for the player to replay the game.

My question is: What sort of game mechanics could be used to provide an alternative way of progressing through the game while not making it obvious that the alternative exists? I think if a dialog tree open up with the first monster you met in each dungeon, it would telegraph the idea that there's an alternative solution. So how could there be a dungeon of monsters that you can wade into and immediately start fighting, while at the same time there being a non-violent solution?


texts: How to compile a Rasterizer Stage HLSL file

texts:
How can I compile the below HLSL file.
Im using
fxc "RS.hlsl" /Od /Zi /E "RS" /Fo "C:\dir\RS.cso"
I am getting error
error X3501: 'RS': entrypoint not found
compilation failed; no code produced
#define RS \
"RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | " \
"DENY_HULL_SHADER_ROOT_ACCESS | " \
"DENY_GEOMETRY_SHADER_ROOT_ACCESS), " \
"DescriptorTable(CBV(b0), visibility = SHADER_VISIBILITY_VERTEX), " \
"CBV(b1, visibility = SHADER_VISIBILITY_VERTEX), " \
"CBV(b2, visibility = SHADER_VISIBILITY_VERTEX), " \
"CBV(b0, visibility = SHADER_VISIBILITY_DOMAIN), " \
"CBV(b1, visibility = SHADER_VISIBILITY_DOMAIN), " \
"DescriptorTable(SRV(t0), visibility = SHADER_VISIBILITY_DOMAIN), " \
"CBV(b1, visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t0), visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t1), visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t2), visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t3), visibility = SHADER_VISIBILITY_PIXEL), " \
"StaticSampler(s0, filter=FILTER_ANISOTROPIC)"


texts: get coordinates of origin of coordinate system in second coordinate system by knowin matrices of one point in bith systems

texts:
Situation, two coordinate systems A, B. origins Oa, Ob. I have one point, for which i know modelview matrix (translatoin/orientation) in both systems. And what i need to get is modelview matrix of Ob in system A. Can please someone help me what to do with that two matrixes to get it?

thank you.


texts:
I am building a top-down game in unity which works well. In this game, I have a 3D object (red cube) which a player has to control and there are other cubes like white, yellow and black cubes which spawns in the interval of 5 seconds. In each 5 seconds, prefabs of these three villain cubes instantiates and follows the player.

There is also a text that says yellow, black and white and changes constantly. For instance, the text is now white and it changes to black within certain interval of time and changes to white in certain interval of time (this is random) So, the player has to collide with the cube same as the the text otherwise the player will die.

Now, the problem is I have built the game just fine and can't get to deactivate player when the player hits the unrelated cube.

The script is(for instantiating:-)

public class ColorChecker : MonoBehaviour {
    public GameObject[] text;
    public int hold;

    public float startTime;
    public float startTimebtwSpawn;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        startTimebtwSpawn -= Time.deltaTime;
        if (startTimebtwSpawn <= 0) {
            startTimebtwSpawn = startTime;
            hold = Random.Range (1, 4);
        }
        if (hold == 1) {
            text [0].SetActive (true);
            text [1].SetActive (false);
            text [2].SetActive (false);

        } else if (hold == 2) {
            text [1].SetActive (true);
            text [0].SetActive (false);
            text [2].SetActive (false);

        } else if (hold == 3) {
            text [2].SetActive (true);
            text [0].SetActive (false);
            text [1].SetActive (false);
        }
}
}

The script for destroying the object is:-

public class DestroyCubes : MonoBehaviour {
    public ColorChecker colorchecker;
    // Use this for initialization
    void Start () {

    }

    void OnCollisionEnter (Collision col){
        if (colorchecker.hold == 1 && col.gameObject.tag == "CubicMonster1") {
            Destroy (col.gameObject);
        } else if (colorchecker.hold == 2 && col.gameObject.tag == "CubicMonster2") {

            Destroy (col.gameObject);
        } else if (col.gameObject.tag == "CubicMonster3" && colorchecker.hold == 3) {
            Destroy (col.gameObject);
        }

    }
}

Now, I can obviously check if it is unrelated by a long code like

if (colorchecker.hold == 1 && col.gameObject.tag == "CubicMonster2" && so on){

Destroy (gameObject);

}

Rather than writing a long if statement like this, Is there a better way that I can handle this ?


texts: Blood covering ground in Unity 2D platformer

texts:
I have just started my adventure with Unity so my question may seem silly to experienced users but anyway I'll give it a try. If you could just give me couple of keywords I could search for in order to solve my problem I would be very grateful.

As a sample project I wanted to create 2D pixel platformer, something like Contra. All went well up to the moment when I wanted to add some blood dripping from my enemies. I got stuck on generating the blood particles and simulating them painting over the ground. The effect I want to achieve looks like this: (live example: http://jsfiddle.net/0pg0LpL1/4/embedded/result/ , animated gif: http://imgur.com/oTeDydV)

I am wondering what is the best approach to achieve such effect. I thought about generating the texture of blood stains on the fly and placing it before camera. It would look like this: scene < blood texture < camera. The blood texture would be generated from lines drawn by "flying" blood particles masked by the ground/platforms texture:

Blood particle traces:
http://imgur.com/a/0iIeQ
Ground mask: http://imgur.com/a/YKvCK
Masked traces (what I call blood
texture): http://imgur.com/a/M8z2v

What is the best approach to achieve such effect? I know that generating texture with Texture2D.SetPixels on each frame is not optimal. I also see challenge in having a blood texture large enough to span over entire level to keep memory of all the blood spilled. Also the solution with one blood texture will not work if I wanted to have moving platforms that should also be painted.

Thanks in advance for any suggestions.


texts: What is the right process to get compatibility or at least a workaround for the ‘Threaded optimization’ feature of NVIDIA?

texts:
It's peculiar this issue is not well understood on NVIDIA forums and project forums.

For example, the well known ioquake3 project based on id tech 3 requires to force 'Threaded optimization' off on the NVIDIA settings or there are severe FPS drops.

Do you know what a programmer has to do to acquire compatibility with the feature or at least a workaround to not get issues with it (e.g. turning it off explicitly via the application or other means)?

--

The main importance is that such projects get issues with it by default since not all users know they have to explicitly turn off the feature.


texts: Persistent realtime game authentication (JWT, Passport)

texts:
Context

I am building a MMO game in HTML5 with canvas.
I use NodeJS on server & JS from scratch on client.
I also use socket.io to manage realtime.
The game is persistent & each player keep their equipment / skills etc, even after logout.
To do that, the player need to register with email and password then login.
The client is a browser but could be other device like phone in future. I use HTTPS to encrypt communication.

Problem

In this context, I decide to use a token based authentication system.
I look to JWT from Auth0 and found : https://jwt.io/introduction/

I noticed : They are talking about the JWS implementation of JWT and not about JWE. After looking at https://github.com/auth0/node-jsonwebtoken I saw that it was the same thing, JWS and no JWE. I suppose that JWT module developed by Auth0 doesn't provide a JWE implementation of JWT but only a JWS implementation.

Am I right or did I miss something? In my particular case (game scenario), I don't know if it's mandatory to encrypt with JWE (I don't think sensitive data will be passed in the token), do you think JWS enough?

In the side of this research, I checked for Passport (http://www.passportjs.org/docs/). I read the documentation but I didn't find information about how they perform authentication when we remove session (http://www.passportjs.org/docs/downloads/html/#disable-sessions).

I tried to implement it with session: false but no token was returned.

I supposed I need to implement it by myself, but in this case what's the goal of passport for a token based authentication?

Then last question about socket.io

If I implement a JWS token based authentication to signed my request & HTTPS to encrypt the communication, how can I secure the bidirectional communication? It looks like two different channel of communication, is it easy to implement that with socket.io?


texts: Create an infinite scroll using CCParallaxNode in Cocos2D-X

texts:
I'm trying to create an infinite scroll using two images in a CCParallaxNode, making one move to the end of the scroll when it gets off the screen. I have tried several implementations but none has worked. The method setPosition is not available for the sprites once they have been added to the parallaxnode, and the array where the offset positions are stored is not documented so I don't know how to handle it.

Given that you cannot add the same child twice because the program crashes, I have tried to add a new sprite at the end whenever the old one dissappeared from screen. But the getPosition methods for either the sprites or the scroll doesn't seem to give accurate positions to calculate when a sprite is outside the screen. I ended up implementing a loop that added N sprites in a row and then "breaking" the program.

I was using a scaled image for the sprite with 512 width, scaled times 5. Screen size 1024x768

EDIT FOR CODE SNIPPET

init

voidNode = CCParallaxNode::node();
parta = CCSprite::spriteWithFile("backg.png");
parta->setScaleX( 5 );
parta->setAnchorPoint(ccp(0,0));
parta->setPosition(ccp(0,0));
voidNode->addChild(parta, -1, ccp(0.4f,0.5f), ccp(0,0));

maxscroll = parta->getContentSize().width*5;

CCMoveBy* moveRight = CCMoveBy::actionWithDuration(0.1f,ccp(-600, 0));
CCRepeatForever* repeat =
        CCRepeatForever::actionWithAction((CCSequence *)CCSequence::actions(moveRight,0));
voidNode->runAction(repeat);

update

// I tried with voidNode->getPos() and voidNode->m_tLastPosition.x too
int newPos = parta->getPosition().x;
if (maxscroll - abs(newPos) - initPos) < level->getContentSize().width*5){

// 1st: parta->setPosition wont work, even when goten as child
// 2nd: I dont now how to access the m_pParallaxArray to alter the offset positions

// 3rd implementation
parta = CCSprite::spriteWithFile("backg.png");
parta->setScaleX( 5 );
parta->setAnchorPoint(ccp(0,0));
voidNode->addChild(parta, -1, ccp(0.4f,0.5f), ccp(maxscroll,0));
maxscroll += parta->getContentSize().width*5;
}


texts: What tools do you use for 2D art/sprite creation?

texts:
What cheap/free tools do you use for 2D art and/or animation?

I don't really like Gimp's interface, Paint.NET is limited and GraphicsGale is sort of archaic. Cosmigo ProMotion looks like it could be good, anyone use it? Seems a bit pricey at $78/92 but of course cheaper than Photoshop.

I used to like Jasc Paint Shop Pro 7, but the newer versions Corel makes are more for photos.

2D Bones support would be handy also.


texts: When would a mesh collider be better than primitive colliders

texts:
I have been reading through the Unity Manual and have come across some interesting information about mesh colliders and primitive colliders. It got me wondering if using many primitive colliders would be better than using a mesh collider for say a character object?

I was also wondering if there was any information on exactly how inefficient a mesh collider is to say having 20 box or cylinder colliders on a character mesh. I am guessing that the number of polygons on the mesh would be a factor but it would be interesting to see some raw comparisons between how this efficiency scales per polygon (or per 100 polys or some unit of measurement)


texts: I am wondering what the best way to approach a "lighting" effect in 2D games is. For instance, if my main character is glowing, what techniques can I use to complete the visual effect of the character glowing when it is near other objects which would be affected by the light?


texts:
I'm really newbie on programming and I'm making some tests. I couldn't find nowhere on Internet how could I calculate the distance between two 3D objects' faces. Is there anyway?

Detailing, as an example, I have two 3D cubes. Each one has a vector3 position designating it's center on the 3D space and an orientation matrix. And each cube has a size (float width, float height and float length).

I could get a simple distance between them by calling Vector3.Distance(), but it doesn't consider its sizes, just the position. Then the distance would be between its centers.

Is there any way to calculate the distance between the faces? Thanks for any reply.


texts:
I'm working on a project for which I will need to create a large item database, with plenty of different types of items which will all have different data structures and attributes.  I'm hoping to either find or implement a tool which will help my collaborators and I create item data collaboratively, something like a database frontend, basically. I've considered setting up an instance of a rails backend like railsAdmin and creating models for each type of item we'll need (e.g. weapon, vehicle, etc) and allowing team members to simply create new database records and populate data fields, then pull the data out of the DB and convert it to whatever format we need down the road.

My question is whether anyone has any experience with another tool, preferably something web-based, which would allow users to edit records in a database while easily adding or removing fields for specific tables? How did you and your team catalog all the items for your last project?

Thanks in advance and apologies for my poorly worded query.


texts:
I would like to know how do experienced c# developers structure their multiplayer messages and operations.

Basically , in my project every UDP message is translated into an operation and I have to decide what will it trigger. Here is my current structure:

switch(newOperation.code){
  case MessageCode.Position:
    MessageHandler.instance.PositionUpdate(newOperation);
    break;
  case MessageCode.NewPlayerJoined:
    MessageHandler.instance.PlayerJoin(newOperation);

Basically , for each operation I'm creating an enum and a function that will handle the received packets.

Is there a more maintainable solution?


texts: My grid based collision detection is slow

texts:
Something about my implementation of a basic 2x4 grid for collision detection is slow - so slow in fact, that it's actually faster to simply check every bullet from every enemy to see if the BoundingSphere intersects with that of my ship. It becomes noticeably slow when I have approximately 1000 bullets on the screen (36 enemies shooting 3 bullets every .5 seconds). By commenting it out bit by bit, I've determined that the code used to add them to the grid is what's slowest.

Here's how I add them to the grid:

for (int i = 0; i < enemy[x].gun.NumBullets; i++)
{
   if (enemy[x].gun.bulletList[i].isActive)
   {
      enemy[x].gun.bulletList[i].Update(timeDelta);

      int bulletPosition = 0;
      if (enemy[x].gun.bulletList[i].position.Y < 0)
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450);
      }
      else
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450) + 4;
      }

      GridItem bulletItem = new GridItem();
      bulletItem.index = i;
      bulletItem.type = 5;
      bulletItem.parentIndex = x;

      if (bulletPosition > -1 && bulletPosition < 8)
      {
         if (!grid[bulletPosition].Contains(bulletItem))
         {
            for (int j = 0; j < grid.Length; j++)
            {
               grid[j].Remove(bulletItem);
            }
            grid[bulletPosition].Add(bulletItem);
         }
      }

    }
}

And here's how I check if it collides with the ship:

if (ship.isActive && !ship.invincible)
{
   BoundingSphere shipSphere = new BoundingSphere(
    ship.Position, ship.Model.Meshes[0].BoundingSphere.Radius * 9.0f);
   for (int i = 0; i < grid.Length; i++)
   {
   if (grid[i].Contains(shipItem))
   {
      for (int j = 0; j < grid[i].Count; j++)
      {
         //Other collision types omitted
         else if (grid[i][j].type == 5)
         {
            if (enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive)
            {
               BoundingSphere bulletSphere = new BoundingSphere(enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].position,
               enemy[grid[i][j].parentIndex].gun.bulletModel.Meshes[0].BoundingSphere.Radius);
               if (shipSphere.Intersects(bulletSphere))
               {
                   ship.health -= enemy[grid[i][j].parentIndex].gun.damage;
                   enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive = false;
                   grid[i].RemoveAt(j);

                   break; //no need to check other bullets

                }
             }
             else
             {
                grid[i].RemoveAt(j);
             }
          }

What am I doing wrong here? I thought a grid implementation would be faster than checking each one.


texts:
I noticed that many social games have the concept of "timeouts". In farm games etc. it obviously makes sense (stuff grows, etc.). But I also noticed that angry birds introduced this as well. Individual angry bird games are pretty much stateless, so it doesn't seem to make a lot of sense at first glance (and some users are upset because of this).

What is the purpose of this? Does it bring more money somehow? Does it help retaining the users? Is this a new concept? Does it have any other applications, particularly in non-game realms?


texts: How to create a sun billboard with Ogre3d

texts:
I've been working with a few different engines alongside trying to code my own project. Rather than rewrite an entire renderer, etc I am using Ogre3d. To begin with I am trying to implement a very basic scene with day/night cycle.

I've created a plane, added a simple model over the plane to simulate ground and an object. I've also created a directional light which I rotate to simulate a moving sun.

// Add a sunlight
sunNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode("sunNode");
sunNode->setPosition(0,0,0);

sun = OgreFramework::getSingletonPtr()->m_pSceneMgr->createLight("Sun");
sun->setPosition(0,0,0);
sun->setType(Ogre::Light::LT_DIRECTIONAL);
sun->setDiffuseColour(Ogre::ColourValue(0.7f,0.7f,0.7f));
sun->setSpecularColour(Ogre::ColourValue(0.7f,0.7f,0.7f));
sun->setDirection(Ogre::Vector3(0,0,1));
sunNode->attachObject(sun);

In the main loop, prior to rendering I rotate the sunNode with :

 // Rotate the sun
 sunNode->pitch(Ogre::Degree(0.05), Ogre::Node::TS_LOCAL);

This all works pretty much like a expected. However, I then moved onto adding a billboard to the sunNode in order to render the sun moving through the sky. Creating the billboardset, setting the texture, adding a billboard and attaching it to the sunNode, was pretty straight forward, however, when I compiled and ran the application, the billboard just sat at the lights position (0,0,0) and didn't move.

What would be involved in getting a billboard to track through the sky to render a simple sun?


texts: Legal restrictions if using Google Analytics on PC game?

texts:
I'm thinking of using Google Analytics to collect various user information (including hardware information) in my PC desktop game I'm making with Unity.I figured I can do this by setting up a new tracking property and using Measurement Protocol to send hits to Google Analytics using HTTP.

Are there any legal restrictions on this? After all, I will be collecting hardware information along with gamer behavior. Do I need to inform the user and / or ask for their allowance for this?


texts: What exactly does an installer do and why might I need one?

texts:
this is probably the noob-question of the day:

So I've written this game.

Now there's the .exe file that does the work, a folder with my beautiful, beautiful assets and a bunch of .dll files and other stuff that I probably shouldn't touch. To run the game, I copy the whole lot to the desired computer, double-click the .exe file and start shooting some dudes. Yay!

But what exactly is the difference between that and using an installer? What else does an installer do besides copying files and looking more professional than a .zip-file? Is there generally a lot of patching/configuring involved when trying to make a game run on a different computer? I tested my game on all windows computers I could get my greedy fingers on and it works great.


texts: the difference between diffuse texture and ambient occlusion texture

texts: is there any difference between diffuse texture which used in diffuse lighting and ambient occlusion map, or this is the same texture just different naming, because i see it mostly it looked the same?


texts:
It is possible to send the video flux of an OpenGL desktop app via UDP on Linux ? I looked up FBO and off-screen rendering but I still can't figure out how to extract the video flux and send it.

I'm working with C++ but if you have explanations in others langages go ahead.

Thanks.

My original post on stack overflow.


texts: How can I make grid tiles/plane transparent

texts:
I have made a grid using multiple planes. Now I want to place a image on this grid so that user cant see the grid I have made and I ll have access of all points of the image using grid.

The problem is I am unable to place image on it, it shows me grid that I made before. I have tried Materials/Shader -> Transparent/Diffuse, but some blocks are still visible. How can I make grid tiles transparent ?


texts: How should I check if a player has completed an achievement?

texts:
I'm making an MMO game and I just got to a point where I need to implement achievements... How do I do that? The most straight forward thing to do would be to run this once every 100ms,:

for a in achievements
    for p in players
        if a.meetsRequirements(p) then p.completeAchievement(a)

But that just raises even more complications. For example, how do I check if the achievement has actually been completed? Do the players have custom properties on themselves just for a specific achievement? I did this kind of thing with quests, because they are mainly "collect 100 wood", so active quests on a player check that. Also, there must be a better time to check it, this would periodically slow my server down, I think.


texts: Problem when animating MD5 model (GPU Skinning)

texts:
I'm trying to implement a GPU skinning version of the md5mesh.js by @tojiro (demo with CPU skinning) in WebGL (live demo of the project here, use WASD to move the camera around).

The main concept is as follows: I modified the Vertex buffer object in order to fit the information of bones indices and bone weights, then for every frame of the animation I modify the bone matrix (an array of transformation matrices for each bone) with the appropiate matrix (for each joint I create an identity matrix and multiply it by it's orientation and position, then I multiply the result by the inverse of the bind pose and it's ready to go to the shader).

This works OK when the boneMatrix array is filled with identity matrices (by concept it should render the bindPose and it does). However when I try to load an animation the movements appear messed up and clipped. I discarded a wrong/corrupt version of the md5mesh / md5anim by loading them in an MD5 viewer.

Here there is an example of what happens when the boneMat array is filled with identity matrices:

I think this is the way the model should look, but when I try to animate it...

The general movement of the mesh is correct but some vertices move with an strange direction / orientation which forces a lot of clipping to occur.

Maybe someone experienced in the matter can spot the problem directly from the image, if not I' willing to provide any part of my modifications on the md5Mesh lib.

In order to implement all of this I've followed this tutorial and took a lot of ideas from this implementation.

Any help will be appreciated, I've really hit a wall with this!

Thanks in advance.


texts:
I don't know if this is against the FAQ so if you close this, it'll be no surprise.
I have done research but all the tutorials I have seen have been to hard to follow; I reckon there are better ones out there.
If you could tell me, that would be great but if you close it, I understand.
Thank you