texts: How do I connect the seams between my terrain?

texts:
I'm using c++ and D3D11 and I'm trying to create a (pretty) large terrain, lets say 4096x4096, maybe larger.
I've got the basics of terrain creation and already split it up into chunks.

But, when I'm rendering them (every chunk has its own vertex and index buffer, as well as its own heightmap), there are still little pieces missing between them. I read a lot about LOD(Level Of Detail) and GMM(Geometry Mipmap), but I can't really implement the theory I read.
At the moment, it looks like this:

I could really use some help, everything is welcome.
If you have some good tutorials on any of this, please share them.


texts: What tips or tricks do you have when it comes to making the OpenGL more efficient?


texts: Storing Users Character in MySQL Database

texts:
Just asking a quick question about storing Characters in a database.

I am currently implementing a MySQL Database to store character data, using this current structure

Character Table:

playerUsername: VARCHAR(255)
characterName: VARCHAR(255)
idCharacter: INT(11)

Which is working fine to get all the characters that a certain person has.

While implementing this I was wondering how I would go about storing the character model data, like in WoW or other MMO's. Do they store all the models you create locally? or is that somehow stored in the database.

I have found a few structures online but they mainly contain character names and id not how the individual models are stored.

Any help on this would be greatly appreciated


texts:
Currently, when I update the entities I calculate the time passed since the last update, and then pass that to their update function. They will in turn pass that duration to all their components.

    currentTime = clock.getTime()
    timePassed = currentTime - lastUpdate

This means that the physics components also gets a variable time step, but it appears this is bad and can lead to inconsistent simulations. Here's some details on this:

> When should I use a fixed or variable time step?

The answers suggest that the physics simulation time step should be constant and higher than the rendering time step. But since I can't ensure how well the game will perform, this can be rather difficult to achieve.

One answer suggests this:

  Use Gaffer's "fix your time step" approach. Update the game in fixed steps as in option 1, but do so multiple times per frame rendered - based on how much time has elapsed - so that the game logic keeps up with real time, while remaining in discrete steps.

This seems like a good approach to me, but I don't really understand how I should be doing it. Instead of doing:

physics.step(timePassed)

I should be doing the following?

while timePassed > 0:
     physics.step(1) # millisecond
     timePassed -= 1


texts:
If I try to use animation.Play() or have Play automatically ticked in the inspector on the animtion object, it gives me the follwing error:

The animation state could not be played because it couldn't be found!

I searched around the web and everywhere they say you need set the animation type to 'legacy', but I already changed type to legacy and it did NOT fix the problem.

Thanks in advance.


texts: Unity drop items enemy sprite size problem

texts:
how can i make items drop infront of the enemy without getting hidden under the enemy sprite due to the size of different enemies. I would also like to spread the drop items

How currently it is

How i would like it to be

My code:

public void TakeDamage(int damage)
{
    int dist = 10;
    Vector3 spawnPos = transform.position + transform.forward * dist;
    GroundItem.Create(new Item(3, 1), spawnPos);

    health -= damage
}

public class GroundItem : MonoBehaviour
{
    [SerializeField]
    private Item item;
    [SerializeField]
    private SpriteRenderer spriteRenderer = null;

    public static GroundItem Create(Item item, Vector3 position)
    {
        GameObject groundItemGO = Instantiate(GameManager.Instance.GetData.GetAssetDatabase.GetPrefabByName("GroundItemPrefab"), position, Quaternion.identity);
        GroundItem groundItem = groundItemGO.GetComponent<GroundItem>();
        groundItem.SetItem(item);
        return groundItem;
    }

    private void SetItem(Item item)
    {
        this.item = item;
        spriteRenderer.sprite = item.data.icon;
    }
}


texts: Collision detection using distance field for a dynamic object

texts: I am using a signed distance field for collision detection. The object I calculated the distance field for rotates between 0 and -30 degrees. The other object I want to check collision against is in a bounding volume hierarchy (BVH) of axis aligned boxes. The problem is that as the first object is rotating, I cannot use the initial calculated distance field for collision detection. One solution that I thought of is that I can rotate the Bounding volumes by an angle opposite to what the original object rotates and then check the collision but this can be computationally extensive. Is there any other better solution that I can use to check the collision with the rotating object?


texts: How to deal with raw values and percentages?

texts:
What is the standard practice for dealing with attribute modifiers in games where units have attributes, such as RTSs, MOBAs and RPGs? Specifically, in which order are "buffs" given to the unit?

Suppose the case where unit X has 10 blah-points (BP). It obtains two modifiers that add +10% blah-points, and another one that adds 30 blah-points. Finally, a enemy unit applies a -40% blah-points modifier. What is the usual way of processing this, for player familiarity's sake?

Aggregate by grouped type

  (10+30)*(1.0+0.1-0.4) = 28

Obtention order

  (10*(1.1)+30)*(0.6) = 24.6

Aggregate iteratively by type

  (10+30)*1.1*0.6 = 26.4

Some other way?


texts: 2D SAT Collision - Triangle and Square Problem

texts:
So I was just doing an example 2D SAT collision detection problem on paper when I encountered something unexpected. I ran the algorithm on a triangle and a square, and the result of the algorithm was that there was a collision, when indeed there was not. Take a look at this:

grey lines are the axes, red marks are extremes of projection endpoints (from both shapes) on each axis

I was under the impression that the SAT algorithm checked for overlapping vertices on all unique axes generated by both shapes sides' normals, and if no gap is found on any axis, then there is a collision. It looks like that does not work in this example. Can someone explain what I am missing? Maybe I'm understanding the algorithm wrongly.


texts: How can I create good looking football field lines?

texts:
I am trying to create a football field in a countryside with correct measurements of the lines. It's for my first person game. I have a terrain with mountains, trees, etc. and a flat surface for the field. What would be the best way to achieve good quality field like this?

I thought of these solutions:

paint the terrain - doesn't do the job, as the texture would need to be of resolution like 32k to make the lines not blured, seen from a first person view. It would also be inacurate painting it by hand.
create a textured plane and place it on top of the terrain with alpha mask - using raster graphics still would require massive resolution, but vector graphics might make sense here. It might be quite unhandy though and from a further distance might render badly.
project a vector graphics onto the terrain - this is probably the best of my ideas.

What would be the best approach and how to actually perform it?


texts:
I'm currently working on a Minecraft clone for a university project and I'm having some trouble loading a lot of chunks at the same time without reducing performances.
What I'm currently doing is:

Creating the VAO
Creating the VBOs
Buffering the data in the VBOs
Rendering them (that isn't causing any lag)
Destroying the VAO and VBOs when the chunk is no longer needed

I tried to look at other solved questions but they were too specific or too vague, or maybe I'm just dumb.
The chunks are made of 16x16x16 blocks and its VBOs contain only the vertices of the visible blocks (like Minecraft's doing).
I'm looking for a better way(in terms of speed and performance) to load them.


texts: How can I transform.Translate (Vector3.up * Time.deltaTime * 2); a GameObject for 10 units? I mean only make it go up 10 units (10 y units).


texts: Object Touch/Drag Problem: Object moving to next finger

texts:
My Code is as follows:

 foreach (Touch touch in Input.touches) {

        switch (touch.phase) {

        case TouchPhase.Began:

            touchPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            offset = touchPosition - GOCenter;

            break;
        case TouchPhase.Moved:
            touchPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);

            newGOCenter = touchPosition - offset;
            newGOCenter.y = 0.0f;
            newGOCenter.z = 0.0f;
            gameObject.transform.position = newGOCenter;

            gameObject.transform.position = new Vector3 (
                Mathf.Clamp (gameObject.transform.position.x, -boundary.xMinMax, boundary.xMinMax),
                0.0f,
                0.0f
            );

            break;
        default:

            break;
        }
    }

What i am doing is i am moving the player left and right along x-axis by dragging in the screen.

When i drag/move the player with one finger then it works as expected.

But when i keep another finger in the screen and take out the first finger from the screen the player comes of the second finger.

I want the player to be moved from the place where it was left instead of coming to the second finger.

[I have done]
- disabled multiTouch but it does not worked.
- user fingerIndex


texts: How can I avoid a busy-wait in this game loop implementation?

texts:
I've been developing a small framework for OpenGL and WinApi for some research purposes. My biggest problem right now is the game loop. Simplified I did something like this:
Main thread:

HANDLE hUpdate = (HANDLE)_beginthreadex(0, 0, updateThread, 0, 0, 0);
while (!done)
{
    if (PeekMessage(&msg, hWnd, 0, 0, PM_REMOVE))
    {
        if (msg.message == WM_QUIT)
        {
            done = TRUE;
        }
        else
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
    else
    {
        Draw();
    }
}

Update thread:

unsigned int __stdcall updateThread(void *params)
{
    QueryPerformanceCounter(&nextTick);
    QueryPerformanceCounter(&lastUpdate);
    while (!done)
    {
        LARGE_INTEGER currentTick;
        QueryPerformanceCounter(&currentTick);

        while (currentTick.QuadPart > nextTick.QuadPart)
        {
            double frameTime = ((currentTick.QuadPart - lastUpdate.QuadPart) * 1.0) / clock.QuadPart;

            QueryPerformanceCounter(&lastUpdate);
            Update(frameTime);

            nextTick.QuadPart += TIME_STEP * clock.QuadPart;
            QueryPerformanceCounter(&currentTick);
        }
    }
    return 0;
}

This way i got fixed time step while draw will be called as much as it can (kinda what I was looking for). The BIG problem is that everything is operating using busy wait, and it just swallows CPU and still no real game logic has been written. Can anyone tell me, or redirect me to some good, efficient implementation of game loop? While I was researching I came across information that Sleep() is bad for game loop.


texts: Slick2D Simple StateBasedGame not working

texts:
I recently started trying to work with outside Java libraries like Slick2D. This is my first time doing so, so I basically have no clue what I am doing.

I tried making a simple StateBasedGame that only displays a menu bar showing three options. The problem is that in my 'Game' class, the initStatesList() method isn't being called and I don't know why not. Here's the code:

Game class

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

public class Game extends StateBasedGame {
    public Game(String title) {
        super(title);
    }

    public static void main(String[] args) {
        Game game = new Game("Text Based");
    }

    @Override
    public void initStatesList(GameContainer arg0) throws SlickException {
        System.out.println("InitStates");
        addState(new Menu());
    }
}

Menu class:

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

public class Menu extends BasicGameState {

    private int ID = 1;

    @Override
    public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {
    }

    @Override
    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
        g.setColor(Color.white);
        g.drawString("Higher or Lower", 50, 10);

        g.drawString("1. Play Game", 50, 100);
        g.drawString("2. High Scores", 50, 120);
        g.drawString("3. Quit", 50, 140);

    }

    @Override
    public void update(GameContainer arg0, StateBasedGame arg1, int arg2) throws SlickException {

    }

    @Override
    public int getID() {
        return ID;
    }

}

I have no clue why it doesn't work...


texts: error not all code paths return a value unity bool c#

texts:
I'm new to unity, so  I've been having problems with my code here:

public bool FindItem(GameObject item)
{
    for (int i = 0; i < MyInventory.Length; i++)
    {
        if (MyInventory[i] == item)
        {
            //we found the item
            return true;
        }
        //if item not found
        return false;
    }
}

it shows this error : Assets/Script/Items/InventoryScript.cs(35,17): error CS0161: `InventoryScript.FindItem(UnityEngine.GameObject)': not all code paths return a value

I've been looking for answers on the internet but nothing seems to give me solution to this problem. so I was hoping you could help me, thanks again in advance ! :)


texts: Use PIX to find model Polygon count in XNA?

texts:
I'm using PIX from the DirectX SDK to monitor my XNA application.  I want to see the polygon count a model loaded in the application and was told this was information I could get from using PIX.

Problem is, I'm not sure how. I've looked through the documenation so maybe I'm just missing something obvious or maybe this is a feature I cannot use with my XNA application.

I could write code to get this information, but I was under the impression it would better practice to use a diagnostics tool instead of altering my code to retrieve the information.

Thanks.


texts:
I am a newb at GameMaker.  I have a 2D map which you can move around.  I want to add pins to the map, such that when the map moves, the pins stay in the same position relative to the map.  By default, the map will move, while the pins remain stationary.

I have tried creating a sub-layer of instances on my map instance layer, but the depth of the sub-layer is always greater than the parent layer.  I have tried overriding the depth, but it gives me a warning suggesting unpredictable results.

I have searched the internet, but all I could find was overkill code which I am hoping is not necessary.  (And none of those suggestions directly addressed my question.)

How can I make it so that my pins move around with the map?  I would like to avoid using code for something so simple.


texts: What's the state of the art in Space Partitioning for games?

texts:
I know about BSP trees, Octrees and Portal that where used for a long time. But modern games still use this systems or they are using new things?

If it's possible with pros and cons, considering rendering and collision detection.


texts:
I do not understand how to pause an animation of XNA. I can "Start" the animation of my model but not stop it. I use SkinningSample_4_0 sample dll

Here is my code to use.

Here is my code to use.

    protected override void LoadContent()
        {
            //Model - Player
            model_player = Content.Load<Model>("Models\\Player\\models");
            // Look up our custom skinning information.
            SkinningData skinningData = model_player.Tag as SkinningData;

            if (skinningData == null)
                throw new InvalidOperationException
                    ("This model does not contain a SkinningData tag.");

            // Create an animation player, and start decoding an animation clip.
            animationPlayer = new AnimationPlayer(skinningData);

            AnimationClip clip = skinningData.AnimationClips["ArmLowAction_006"];

            animationPlayer.StartClip(clip);

}

protected overide update(GameTime gameTime)
{
            animationPlayer.Update(gameTime.ElapsedGameTime, true, Matrix.Identity);
            KeyboardState key = Keyboard.GetState();

            //  If player don't move -> stop anim
            if (!key.IsKeyDown(Keys.W) && !keyStateOld.IsKeyUp(Keys.S) &&           !keyStateOld.IsKeyUp(Keys.A) && !keyStateOld.IsKeyUp(Keys.D))
            {
                //animation stop ? not exist ?
                animationPlayer.Stop();
                isPlayerStop = true;
            }
            else
            {
                if(isPlayerStop == true)
                {
                     isPlayerStop = false;
                     animationPlayer.StartClip(Clip);
            }
}


texts: Make continuos movements with controllers in LibGDX

texts:
I've been trying to make the OUYA controlers work with a LibGDX Framework Practice Game.

Everything is working perfectly expected for one thing : The movements are not continuos.

The problem is, when I press the DPAD or the Joystick into the right for example, it moves for the number of pixels I've defined and then stops, I need to release the button and press again.

When I use the Keyboard I put the code on the "render" method, using this method when I press the Right Arrow Key the sprite won't stop movie until I release the button, but since the controller use a ControllerListener I don't really know how to solve this issue.

This is what I have so far :

public class MyOntem extends ApplicationAdapter implements ApplicationListener, ControllerListener {
SpriteBatch batch;
Sprite sprite;

@Override
public void create () {
    batch = new SpriteBatch();
    sprite = new Sprite(new Texture("badlogic.jpg"));
}

@Override
public void render () {
    if (Gdx.input.isKeyPressed(Input.Keys.DPAD_RIGHT))
        sprite.setX(sprite.getX() + 10f);

    if (Gdx.input.isKeyPressed(Input.Keys.DPAD_LEFT))
        sprite.setX(sprite.getX() - 10f);

    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    batch.draw(sprite, sprite.getX(), sprite.getY());
    batch.end();
}

@Override
public boolean buttonDown(Controller controller, int buttonCode) {
    if(buttonCode == Ouya.BUTTON_Y)
        sprite.setY(sprite.getY() + 1);
    if(buttonCode == Ouya.BUTTON_O)
        sprite.setY(sprite.getY()-1);
    if(buttonCode == Ouya.BUTTON_U)
        sprite.setX(sprite.getX() - 1);
    if(buttonCode == Ouya.BUTTON_A)
        sprite.setX(sprite.getX() + 1);

    return false;
}

@Override
public boolean axisMoved(Controller controller, int axisCode, float value) {
    // Left Stick
    if(axisCode == Ouya.AXIS_LEFT_X)
        sprite.translateX(10f * value);
    if(axisCode == Ouya.AXIS_LEFT_Y)
        sprite.translateY(-10f * value);

    // Right stick
    if(axisCode == Ouya.AXIS_RIGHT_X)
        sprite.rotate(10f * value);
    return false;
}

Thank you in Advance.


texts: What is the difference between WaitForSecondsRealtime and a counter?

texts:
I am making my own button using the Unity UI code, but now I got to the OnFinishSubmit () coroutine
private IEnumerator OnFinishSubmit()
{
    float fadeTime = base.colors.fadeDuration;
    float elapsedTime = 0f;
    while (elapsedTime < fadeTime)
    {
        elapsedTime += Time.unscaledDeltaTime;
        yield return null;
    }
    this.DoStateTransition(base.currentSelectionState, false);
    yield break;
}

But I want to use a different code to delay time
IEnumerator FinishSumbit()
{
    yield return new WaitForSecondsRealtime(colors.fadeDuration);

    DoStateTransition(currentSelectionState, false);
}

Will this also work?
Why didn't the Unity developers use WaitForSecondsRealtime?


texts: Why is the Enemy not changing direction when entering the collider?

texts:
I'm really new to Unity, and I'm trying to make a 2.5D platform game. I want to make my enemies walk on a platform and turn when they reach the end of the platform so I placed two triggers at the beginning and at the end of it to change the direction of the enemy.

public class BanditScript : EnemyScript{
    // Start is called before the first frame update
    private Rigidbody rb;
    private Vector3 moveDir;
    private bool left;
    void Start(){
        left = true;
        speed = 1;
        player = GameObject.FindWithTag("Player");
        animator = GetComponent<Animator>();
        minDistance = 1;
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update(){
        IsNear();
        if (near) {
            //attack
            animator.SetBool("isAttacking", true);
            animator.SetBool("isMoving", false);
        }
        else {
            MoveOnPlat();
            animator.SetBool("isAttacking", false);
            animator.SetBool("isMoving", true);
        }
    }
    void MoveOnPlat() {
        animator.SetBool("isMoving", true);
        if (left)
            moveDir = transform.forward;
        else {
            moveDir = -transform.forward;
        }
        rb.velocity = moveDir * speed;
    }
    private void OnTriggerEnter(Collider other) {
        if (other.tag == "platEndL") {
            left = false;
            transform.rotation = Quaternion.Euler(0, 90, 0);
        }
        if (other.tag == "platEndR") {
            left = true;
            transform.rotation = Quaternion.Euler(0, -90, 0);
        }
    }
}

This is my class, the issue is that the enemy keeps moving in the same direction despite everything. Can you help me?


texts: GUI Text counter Skips numbers after a few seconds

texts:
The counter counts perfectly up until the first bump. After this it starts to add about 4-5 "points" instead of just 1.

using UnityEngine;
using System.Collections;

public class GameController : MonoBehaviour
{

    public GUIText scoreText;
    public int score;

// CONVERT FLOAT TO INT?

    void Start (){
    score = 0;
    StartCoroutine (FeetScoreCounter());
    }

    // STARTS COUNTING AFTER WAITFORSECONDS
    IEnumerator FeetScoreCounter() {
    yield return new WaitForSeconds (1);
    InvokeRepeating("scoreCounter", 2, 1);
}

// FOR EACH 5 SECONDS; score++ ???

    void Update () {
    scoreText.text = score + " ft";
 //     StartCoroutine (FeetScoreCounter());

}

void scoreCounter () {
    score += 1;
    StartCoroutine (FeetScoreCounter());
    score ++;
}

}

I want my counter to start counting when the game starts, to show how far up the balloon is. I am incapable of seeing why my code just randomly adds a whole lot more over time. Care to help?


texts: Unity3D sprites vs Mesh Quads - Depth, Blending, Shadows

texts:
I'm new to unity but not new to game development.  In my OpenGL ES 2.0 (mobile) games I create a vertex array of all my "sprites" and stuff it in a VBO.  Then draw them as I need them one at a time, back to front, and turning on and off depth test and blending as I go to build my scene.  Probably not super efficient (as maybe batch drawing) but I get 60fps on modern devices.

This particular scene has a "paper" background, writing ON that paper (same Z depth), then 3d objects over top of that. The 3d objects cast shadows on to the paper.  (I can post a screenshot if necessary.)

To accomplish this I render my shadow map of any object that casts shadows.  Then render my scene with a shadow shader on the paper, not on the stuff that's on the paper, but then back on for the 3d objects floating above or sitting on the paper.

Now I'm switching to Unity3D and porting this working game over.

I'm having 2 problems that I can't figure out.

Being new to unity I brought in my sprite sheets and set them "Advanced" but as sprites and sliced them up with the Sprite Editor.  But the Sprite Renderer doesn't have checkboxes for Casting or Receiving shadows.  Are sprites only for 2d games with no shadows and lighting?  Do I have to switch to all Mesh Quads and use the mesh renderer and manually handle all my "sprites"?
In Unity with the paper and all the stuff that is drawn on the paper at the same Z I'm having depth issues.  In my OpenGL version I do glDisable(GL_DEPTH_TEST); and enable blending, draw the "ink" stuff, and then re-enable depth and draw the rest of the 3d scene.  In Unity I can't figure out how to turn off depth or to get blending to work.  Since the ink has to be drawn ON the paper and thing drawn over that I can't use a different camera.


texts: How can I create a radial animation that hollows out a shape from the inside?

texts:
I want to create the radial/circular animation seen in the explosions in this .gif of Flat Heroes.

I made an image using Illustrator of a radial ring (as below), but I'm not sure if this is the right approach. How can this be done?

Also, I would like to know how this could be extended to make similar animations for other shapes like squares and triangles.


texts: Why does editing the client's memory in some MMOs allow them to cheat?

texts:
Why editing the memory of the game client works? Why so many "Hack protection" tools coming with the clients?

If I were to design a client-server game, everything would happen at the server (the simulation of the game world) and clients would be only passive consumers receiving status updates of the part of the world near their characters, sending only some information like keystrokes or move/action commands. Maybe I missing something here, but with that design, any hack like raising my STR by 200 in the client memory (if the value is present at all), just won't have any effect.

The only explanation I can think is that games in which memory editing works let parts of the simulation run in the client and the server then just synchronize all the clients periodically. I can understand that design for Real Time Strategy games with a fixed number of players once a match is configured, but, why in MMORPGs? Is it a strategy to reduce server load?


texts: why use Resources.Load() in changing the animator controller?

texts:
I wanted to change the AnimatorController of a gameobject during runtime, and when I searched for the method, it used this code:
animator.runtimeAnimatorController = Resources.Load("main/colors/controllercolors/ControllerRED") as RuntimeAnimatorController;

My question is, why don't we use a public AnimatorController and assign it from the animations folder, then set this equal to the runtimeAnimatorController ... Why use Resources.load? .. What's wrong with making a public variable rather than loading it from the Resources file?
I am asking cause no one on the forums or any other websites used the public variable method, which suggests that means that the first way is better.
public AnimatorController ac;

anim.runtimeAnimatorController = ac;
```


texts: How to render multiple projections of an object?

texts:
I want to display multiple projection of an object on the same screen. The projection should also change as the body rotates, kind of a dynamic projection of the body.

I am trying to make a character for pyramid hologram (as it has been named) which needs the projections.

Here is an example found on the Internet:

(Image source)


texts:
I am building a new game with AndEngine and for some reason i keep getting this debug statement in the Logcat:

  01-31 21:29:50.503: I/Choreographer(697): Skipped 152 frames!  The application may be doing too much work on its main thread.

Im not really sure what is causing this error exactly during my game. I am checking a lot of collisions, but they arent initiated until after the game play scene has started.

I also noticed on my Galaxy S3 the game causes my phone to "flicker" when swiping changing home screens and pulling down the task bar at the top.

I think this error has something to do with it, but I am not sure. What do you guys think?

Also each time the user goes to another level I initialized the collision detectors all over again. But I don't unregister or stop the last collisions that were started. I thought they would be automatically cleaned up when the new one is initialized.

What do you guys think?


texts: What are the tools required to learn in order to create atari 2600 Games

texts: I am a beginner in C++ and i would like to learn how to  create a clone of an Atari 2600 game and using an emulator allow it to run on my current PC. my question is what programming language do i need to know in order to get started, i am aware assembly maybe required but i do not have any background in assembly. so if someone could give me a briefing on the process or point me to the starting point i would appreciate it greatly. i apologize upfront if the question is not constructive.


texts: Reacting to rectangle on rectangle collisions

texts:
I don't know how to react to collisions between two axis aligned rectangles that have x, y, width and height values (x and y are from the centre of the box) to make them simply not overlap.

I figured I'd just make them move away from each other depending on how far they intersect in the opposite direction (left, right, up or down) of where they collided. If I check for collisions only on the x axis or only on the y axis it works fine, but when checking for both collisions crazy stuff happens.

This code executes when the first box collides with the second. It's in lua but feel free to answer in anything that isn't to too counter-intuitive.

if box1.x < box2.x then
    box1.x = box2.x - (box1.width / 2) - (box2.width / 2)
end

if box1.x > box2.x then
    box1.x = box1.x - (box1.x - box2.x - (box1.width / 2) - (box2.width / 2))
end

if box1.y < box2.y then
    box1.y = box2.y - (box1.height / 2) - (box2.height / 2)
end

if box1.y > box2.y then
    box1.y = box1.y - (box1.y - box2.y - (box1.height / 2) - (box2.height / 2))
end


texts:
When and how can I use the likeness of real people in my game? What are the legal restrictions involved?

Real people are rarely found in games because it's hard to present them tastefully, but they have sometimes appeared when the setting was suitable. Games have featured the likenesses of historical figures such as McNamara, Hitler, Kim Jong Il to take a few examples.

What factors affect how I can use these real people? Whether they are living? Whether the depiction is entirely factual? Do any disclaimers need to be used? Does it differ significantly across jurisdictions?


texts: Flare (particle system) showing weird semi-transparent rectangles instead of smoke when there's fog in the scene

texts:
I'm making an FPS game with some fog in the scene.

I've added a flare particle system (from the standard assets' prefabs) but it looks like it has some weird collision with the fog.

Whenever the fog is enabled I get these weird rectangles on top of the flare like in this screenshot:

I've noticed that when I turn off the fog they disappear, also I've noticed that when I turn off the Emission part of the particle system the rectangles disappear, but of course, also most of the wanted effect is gone.


texts: How do I understand a big c++ gaming project in SFML?

texts:
Currently I am doing SFML- c++ as a basement in game development before starting out Unreal

When I see a game project in  SFML,  the codebase is huge, like above 30 classes, 100 functions, how can I get an idea of the code project, any suggestions about the usual standard class names in SFML projects and their purpose would be helpful.


texts: Center Perspective Camera on Coordinates

texts:
I've got a PerspectiveCamera and set of coordinates (x,y,z).

How could I pan the camera to make these coordinates at the center of the screen?


texts: What is the best and simplest way to get input text from user in an OpenGL app?

texts: I have an OpenGL game and and I want to implement a simple way for the user to enter data/text in an input box. What is the easiest method to do this?


texts: What are diegetic, non-diegetic, spatial and meta user interfaces?

texts: Could anyone please explain to me the differences between "diegetic," "non-diegetic," "spatial," and "meta" user interfaces in terms of how they are represented in games and game development?


texts:
I have a UV render pass, where RG is the image and B is always set to 255:

I want to set the UV pass texture value to UV Coordinate; when I test it, the result should pixelate noise, like the below image:

I have tested it in other shader languages like cgprogramm, GLSL test in Unity
or useing Zdepth for mipmap but I can not get an anti-aliased result; all the results are the same:

float4x4 World;
float4x4 View;
float4x4 Projection;
float4x4 WorldInverseTranspose;

float4 AmbientColor = float4(1, 1, 1, 1);
float AmbientIntensity = 0.1;

float3 DiffuseLightDirection = float3(1, 0, 0);
float4 DiffuseColor = float4(1, 1, 1, 1);
float DiffuseIntensity = 1.0;

float Shininess = 200;
float4 SpecularColor = float4(1, 1, 1, 1);
float SpecularIntensity = 1;
float3 ViewVector = float3(1, 0, 0);

texture ModelTexture;
texture UvTexture;

sampler2D textureSampler = sampler_state {
    Texture = (ModelTexture);
    MinFilter = Point;
    MagFilter = Point;
    AddressU = Wrap;
    AddressV = Wrap;
};

sampler2D textureSamplerUV = sampler_state {
    Texture = (UvTexture);
    MinFilter = Linear;
    MagFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
    float4 Normal : NORMAL0;
    float2 TextureCoordinate : TEXCOORD0;

};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 Color : COLOR0;
    float3 Normal : TEXCOORD0;
    float2 TextureCoordinate : TEXCOORD1;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    float4 normal = normalize(mul(input.Normal, WorldInverseTranspose));
    float lightIntensity = dot(normal, DiffuseLightDirection);
    output.Color = saturate(DiffuseColor * DiffuseIntensity * lightIntensity);

    output.Normal = normal;

    output.TextureCoordinate = input.TextureCoordinate;
    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    //******* is here
    float4 textureColorUV = tex2D(textureSamplerUV, input.TextureCoordinate);

    float2 cord = float2(textureColorUV[0],textureColorUV[1]);

    float4 textureColor = tex2D(textureSampler, cord);

    return saturate(textureColor);
}

technique Textured
{
    pass Pass1
    {
        VertexShader = compile vs_1_1 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

How do I set the UV coordinate from a texture value in HLSL?


texts:
I know pixel might be right, but pixel means something different, especially if a "2D voxel" isn't exactly one pixel (it isn't, in my game).

I've also heard "texel," but that seems to refer to a repeating texture, which this isn't. I guess I'm just getting hung up on words, but is there a proper term for this?

(For an example of the thing I'm referring to, look at Terraria.)


texts: Good Tools & Methodologies for designing Game Arch

texts:
I'm currently developing a multiplayer and turnbased silverlight card game and using WCF Polling Duplex communication. I've almost finished the game but I'm still dealing with the methods and animations during the game end. Sometimes I'm loosing control and can't even debug and leave it for days to get some more motivation.

What I'm asking is that there should be some methods to design the gameflow on papers such as GameState charts or similar. I did some by myself to track states of some objects but it didn't work out. There should be some tools or methods to do this.


texts:
How can one extend a model processor inside Windows Forms. In a normal XNA game you would simply create a new class like so(I think...):

[ContentProcessor]
public class ExtendedModelProcessor : ModelProcessor
{
    protected override ModelContent Process(NodeContent input,
        ContentProcessorContext context)
    {
        ModelContent m = base.Process(input,context)
        //my own code
    }
}

How can I duplicate this inside Windows Forms project, I am working on a project from microsoft site, "WinFormsContentLoading sample". I tried creating a class like above, but didnt work, then I tried to change the processor on contentBuilder.Add(...,"ExtendedModelProcessor"). And I also tried creating a new .dll ContentExtensionLibrary and then adding it inside ContentBuilder class, under:

static string[] pipelineAssemblies =
{
    "Microsoft.Xna.Framework.Content.Pipeline.FBXImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.XImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.TextureImporter" + xnaVersion,
    "Microsoft.Xna.Framework.Content.Pipeline.EffectImporter" + xnaVersion,
    Application.StartupPath + "\\myDll.dll"
};

And adding the .dll to the same folder as the program. But nothing worked. How can I create an extension for ModelProcessor inside Windows Forms?

Thanks


texts: Skip processing individual triangles or vertices of the mesh

texts:
In my game I have a billiard table, and a floor below the table. In typical situation the table covers 80% of the screen, so only small amount of the floor is visible. And I render the table first, so invisible part of the floor is discarded by the depth buffer test.

But profiling with Nsight shows me drawing the floor takes significant amount of time, and it is spent in the rasterizer. It seems generating all those pixels of the floor and depth testing them takes a long time.

I'm wondering how to solve this problem and one thing I tried is to divide the floor (a rectangle with two triangles) to multiple rectangles, so some of them could be cancelled in an earlier stage. The problem is, this is still one model / mesh, just with more triangles and I don't know how to start.

What would be a way to achieve this in Monogame + HLSL? Somewhere in vertex shader? Or gemoetry shader (is it supported in monogame?)

Or is there any other way to optimize this?

UPDATE: the whole floor is needed and might be drawn depending on where the camera is, so I can't get rid of parts of it. In typical situations table top covers 80% of the screen because of perspective and looking down at an angle. The game is in 3D.


texts: Game Maker - How to change color palette using shader and texture?

texts:
How can I change the color of the application surface using a texture?

https://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes

https://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes#/media/File:CGA_palette_color_test_chart.png

My fragment shader looks like this:

varying vec2 v_vTexcoord;
varying vec4 v_vColour;

void main()
{
    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}


texts: Unity3d - Monitoring which script is bound to which gameobject

texts: How can we see the bounded scripts to gameobjects ? In a large project, it's hard to keep up monitoring by clicking each game object to see bounded scripts


texts:
I thought this was a great concept; a method that is activated from the constructor when the object is created and in the method, see code below, after 3 seconds call another object to remove it from a list, but unfortunately this isn't working the way I want! There seems to be some problems with the timer, because the call to remove the object is done immediately without any delay! Have I missed something or isn't this possible? Perhaps in another way?

public void ExplosionTimer(GameTime gameTime)
    {
        seconds += (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (seconds > 3)
            objectManager.ExplosionControl();
    }


texts: What's the right/standard way of achieving separation of concerns?

texts:
Some background:

I want to start developing games, and taking some of the advice given in this site, I've started with something simple and familiar, such as pong, tetris, etc. I want to take as much time as needed to make sure that I have the basics right before moving on to something bigger. I have medium programming experience but I realize making games is a different thing.

I find myself wondering many things like should this be in a separate class? Should this module handle this stuff or is it better to let other modules have that kind of functionality? For example, the bouncing of a ball in pong, right now is handled in the ball module, but maybe it's better that some other module did it.

Right now I have different modules: one for the graphics, one for the game logic, and others for the objects (depending on the kind of movement required, not all the objects are alike).
I know I am asking a lot, any tips you have will be very much appreciated.

Short question:

What's the right or standard way of separating the modules? What have you found most effective? Is it enough to just keep the drawing (graphics) and the logic separate? Is it necessary to have a lot of classes? (for example for the objects in the game, to handle the movement, etc)


texts:
I have a big map with isometric tiles(3d camera), how can i draw only visible tiles ?

Whats the best way to do that ? space partitionning (octrees etc...)?


texts: How to select random points within grid meeting min/max distance requirements from each other?

texts:
I have a 2D grid map that is relatively large. I'd like to pick some semi-random points all over it (say N points). The rule I want to ensure here, though, is that any selected points are at least M distance from every other selected point but no more than L distance from at least one other point.

Is there a fairly elegant way of doing this without having every new point's distance calculated for every existing point (being less computationally expensive as well)?

I imagine the rules could be met by something like partitioning the map out into rectangular segments and just kind of flood-fill randomly from one inner segment outwards, but I'm having a little trouble visualizing that where my L, M, and N values are randomly chosen (L is of course greater than or equal to M, but not entirely sure what the rules will be for M or N or even the size of the map).

The reason for this whole thing is a procedural waypoint system that I can then build a 2D dungeon crawler type map by using a path finding system to create tiles from waypoint to waypoint essentially.

If this is too vague or any other issues, just let me know and I'll happily try to explain further.

Edit: To give some hard numbers as an example, say the full grid is 2,000 by 1,000 total possible points. Assume you want 5,000 total waypoints spread fairly randomly across the map. Each of the 4,000 points need to be (euclidean distance) greater than 20 from every other point and less than 30 away from at least one other point.


texts: What are some current techniques for rendering deformable landscapes?

texts:
What are the current techniques than can be used for efficiently rendering 3D heightmap-based deformable landscapes?

For example, in the non-deformable landscape problem, ROAM used to be the way to these landscapes, but as GPUs advanced it lost favour to the newer geomipmapping/clipmaps (which is not as CPU-bound; but still had big enough wins for current generation GPUs).

Has there been any advancement in terms of deformable landscape rendering?  Not only in terms of rendering, but also throughput during deform operations.

Although I am personally targeting SM3.0/DirectX 9.0c, please don't restrict your answers to that.


texts: How to correctly draw a 2D polygon in Unity

texts:
I'm trying to draw a 2D polygon using GL.Line; however I'm not getting a polygon but separated lines instead. In the example below, I would expect a rectangle formed by the spheres:

My code is the following:

void OnPostRender( )
 {
     GL.PushMatrix ( );
     mat.SetPass ( 0 );
     GL.LoadOrtho( );

     GL.Begin( GL.LINES );
     GL.Color( Color.white );

     for ( int i = 0; i < spheres.Length; i++ )
     {
         currentVector = Camera.main.WorldToViewportPoint ( spheres[i].transform.position );
         GL.Vertex3 ( currentVector.x, currentVector.y , 0  );
     }

     GL.End();
     GL.PopMatrix();
 }

Also, I found this tutorial/example but is not exactly what i'm looking for, since in the example, all have the same origin point.

I'm asumming that the correct way of achieving what I want, would be to call the Gl.Vertex3 method once for each of the 2 points that form each line:

From A to B (GL.Vertex3 call 2 times)
From B to C (GL.Vertex3 call 2 times)
From C to D (GL.Vertex3 call 2 times)
From D to A (GL.Vertex3 call 2 times)

Is this the right way of doing this?

Thanks in advance.


texts: How to ensure a condition in a behaviour tree when processing following nodes?

texts:
Example tree (Source):

As far as I understood, a sequencer iterates over the children until one failed or all are successful. If one children returns "running", the sequencer will start to process from that child on the next tick.

Let's say "Do I have food?" takes longer than one tick because the AI has to walk to the fridge. When "Am I Hungry" was successful, it won't be processed anymore. Now while walking to the fridge, the hunger magically disappears. How do I prevent the tree from processing the other nodes even though I am not hungry anymore? Should every following node check the condition again? That doesn't seem to fit the idea of a behaviour tree.

How do I implement a condition that has to stay true while following nodes are processed?


texts:
I am making a 2D top-down game in Java using the Slick2D library. However, this question applies to all ways of making games of this nature.

My question is: How would I do a background for the world. Currently it looks like this:

Obviously, this isn't the best example, as the right side has an area that allows the player to walk into the 'background'. However, I am asking how this is done in other games, such as Pokemon.


texts: 3D Translation using only distance and angles

texts:
So I'm starting to foray into 3D game programming, but I've hit something of a snag.

I have an object I want to move around.  It should always move either forward or backward relative to its local Z axis, and otherwise change directions by changing its local X and Y rotations.

Now doing this in 2D is no problem.  When I only consider the X-Z plane, the following code works fine:

m_Position.x -= (float)sin(m_Rotation.y * Pi / 180) * Speed;
m_Position.z -= (float)cos(m_Rotation.y * Pi / 180) * Speed;

And when only considering the Y-Z plane, the following works fine:

m_Position.y += (float)sin(m_Rotation.x * Pi / 180) * Speed;
m_Position.z -= (float)cos(m_Rotation.x * Pi / 180) * Speed;

But when combining the two, they don't work.  Now I didn't expect them to work just straight up stuck together like that, since the Z value is getting conflicting signals.  But I'm not sure where to go from here.

I've read a bit about matrix math, and that seems the way to go, but the tutorials I have found are either difficult to follow, or they focus on rotating a point around the origin (or translating if you already have a translation vector, which is the thing I'm looking for).  The clearest one I've found is this, but I'm not sure how to adapt the rotate-around-origin matrix math to the move-in-direction-of-angle matrix math.

My extremely rudimentary understanding of matrix math would suggest that translations Ta and Tb along angles A and B, if A is a rotation around the Y axis and B around the X axis, would be represented as:

Xa = x*sinA + y*0 + z*0 + w*0
Ya = x*0 + y*1 + z*0 + w*0
Za = x*0 + y*0 + z*cosA + w*0
Wa = x*0 + y*0 + z*0 + w*1

Xb = x*1 + y*0 + z*0 + w*0
Yb = x*0 + y*sinB + z*0 + w*0
Zb = x*0 + y*0 + z*cosB + w*0
Wb = x*0 + y*0 + z*0 + w*1

But I don't know whether that's right, and what I have to do with them.  Multiply them together?  Add the resulting vectors?  Am I even close?

Can someone point me in the direction of good resources for learning this sort of thing?

EDIT:  Just to be clear, I have the object's current (X,Y,Z) and its (Roll, Yaw, Pitch).  I want it to move in from the former in the direction defined by the latter.  I know I can use OpenGL to do this transformation on a purely visual level by just rotating first and then translating, but I need to have access to the new (X,Y,Z) for things like collision detection, indexing, etc.

EDIT 2: I've created the following code after finding this, but I'm not 100% sure if it's correct, since there are also issues with my visual rotations at the moment.  It seems to work, at least superficially.  Thoughts?

float X = (float)sin(m_Rotation.y * Pi / 180) * (float)cos(m_Rotation.x * Pi / 180);
float Y = (float)sin(-m_Rotation.x * Pi / 180);
float Z = (float)cos(m_Rotation.y * Pi / 180) * (float)cos(m_Rotation.x * Pi / 180);


texts: How should data about past interactions be stored?

texts:
I have been developing a text-based rpg in C++, using sqlite as my database.

When it comes to interactions that change the world around the player in some permanent fashion I have been unable to find a satisfactory method of storing them.

Example

The player kills a character then if they return to the same area I do a check in my "game_data" table for "character_x_is_dead" and if the character is dead then the player sees the body on the floor, if they are alive then the player can talk to them.

Is there a better way to handle this type of thing without having to impose conditions on an area that are checked and then the correct output is picked from a list of possibilities? (I'm just thinking about how as the game gets bigger and the player does more things this table is just going to grow more and more with potentially a lot of the contents becoming no longer needed)

Edit - clarification about "list of interactions"

By this phrase I mean any interactions that may alter how the player is allowed to interact with an area, hopefully these examples might make it clearer:

The first time the player talks with the innkeeper at the starting town they get given some money - when they talk to the innkeeper the next time, the money adding event should not fire again.
After the player has gone through a dungeon, any chests they open should still be empty if they come back later.
If the player helps a character then the next time they talk to the character they give one of their positive responses instead of their standard ones.


texts: Why are there fewer glitches in current day games?

texts:
I remember that almost every single game in the early 2000s had at least a few amusing glitches, mostly related to animations, that often produced funny situations. I also remember that game magazines used to dedicate a section with the funniest screenshots people sent in.

As an example, I was just playing Far Cry from 2004 and out of nowhere, whenever I killed some bad guy, instead of dropping to the ground they'd start playing the running animation. This was getting me confused since I was trying to shoot them down from a large distance and didn't understand why they weren't dying.

I've rarely seen stuff like this in current-day games. Was there some change in the technique used to develop games that would make these programmer mistakes less likely?

P.S. I'm not talking about RPGs and other inherently complex genres. I'm talking about games like Far Cry; shooters like Battlefield 3, Modern Warfare 3, even Mass Effect. I've seen plenty of glitches in games like The Witcher 2, Skyrim, etc.


texts:
I am trying to write sf::mouse::getPosition(const Window &Relative To) in a function but I can't write the correct argument in it. Why is that?

Here is my Game.cpp File:
EDIT: I pasted the current code:

#include "Game.h"

Game::Game() : m_window("Multiplayer Space Shooter Game", sf::Vector2u(800, 600)) {
    // Setting up class members.
    m_shipText.loadFromFile("C:\\Users\\AliTeo\\Desktop\\Piksel çalışmaları\\ship_pixel2.png");
    m_ship.setTexture(m_shipText);
    m_ship.setOrigin(m_shipText.getSize().x / 2, m_shipText.getSize().y / 2);
    m_ship.setPosition(320, 240);
}
Game::~Game() {}
void Game::Update() {
    m_window.Update(); // Update window events.
    m_ship.move(m_speedX, m_speedY);
    m_ship.setRotation(90 + m_angle);
    HandleInput();
}
void Game::HandleInput() {
    sf::Mouse m_mouse;
    m_angle = atan2(m_mouse.getPosition(&m_window).y - m_ship.getPosition().y, m_mouse.getPosition(&m_window).x - m_ship.getPosition().x);
    m_angle *= 180 / m_PI;

    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right) && m_speedX <= m_speedLimit) {
        m_speedX += m_acceleration;
    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left) && m_speedX >= -1 * m_speedLimit) {
        m_speedX -= m_acceleration;
    }
    if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down) && m_speedY <= m_speedLimit) {
        m_speedY += m_acceleration;
    }
    else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up) && abs(m_speedY) >= -1 * m_speedLimit) {
        m_speedY -= m_acceleration;
    }
}
void Game::Render() {
    m_window.BeginDraw(); // Clear.
    m_window.Draw(m_ship);
    m_window.EndDraw(); // Display.
}
Window* Game::GetWindow() { return &m_window; }

m_window is a member of Game.h

no instance of overloaded function "sf::Mouse::getPosition" matches the argument list

#include "Window.h"
class Game {
public:
    Game();
    ~Game();
    void HandleInput();
    void Update();
    void Render();
    Window* GetWindow();
private:
    sf::Sprite m_ship;
    sf::Texture m_shipText;
    //sf::Vector2i mousePos = sf::Mouse::getPosition();
    Window m_window;
    const float m_PI = 3.1415f;
    float m_speedX = 0;
    float m_speedY = 0;
    float m_acceleration = 0.001f;
    //float m_friction = 0.001f;
    float m_speedLimit = 0.5f;
    float m_angle;
};


texts: How do I manually make a .pack file like TexturePacker (without using TexturePacker)?

texts:
I am using libGDX and apparently the only way I see for creating a UI is with texture packs.

I would say that since a texture pack is nothing more than JSON or XML file and a large png I could manually code a texture pack. How?


texts: Global variables in a multiplayer environment

texts:
I would like to know what's the best approach to solve this problem.
In a racing game, i need to create the final result chart.
In a single environment i've tought something like:

private string [] arrivalOrder;

void playerArrived(string playerName) {
   arrivalOrder[arrivalOrder.getLength()+1] = playerName;
}

I would like to know how to do in a multiplayer environment.

How the client can communicate to server "my player finishes the racing"?
Thanks


texts: Perspective division by zero yields unexpected results

texts:
Usually, this is how a shape in clip space is defined:

[0.25, 0.25, 0.0, 1.0]
[0.25, 0.75, 0.0, 1.0]
[0.75, 0.75, 0.0, 1.0]
[0.75, 0.25, 0.0, 1.0]

After perspective division to NDC space the result looks following:

However, when setting the w-component of the 2 rightmost vertices to 0:

[0.25, 0.25, 0.0, 1.0]
[0.25, 0.75, 0.0, 1.0]
[0.75, 0.75, 0.0, 0.0] // <-- Note that w=0 here
[0.75, 0.25, 0.0, 0.0] // <--

After perspective division (division of xyz components by w component), I'd expect both vertices to be "projected" to [+infinity,+infinity], since this is how it's described on MSDN:

  Divide by 0 produces +/- INF, except 0/0 which results in NaN.

However, the result doesn't indicate that. In fact, the vertices seem to be "projected" to completely different positions:

Any ideas of what's happening there? How would I get a hold of vertex data after perspective divide (stepping through the HLSL disassembly only gets me to the values in clip space)?

The reason I'm asking this is because I have actually seen this method of setting w-component to 0 used for projecting vertices away.


texts:
I want to make two image buttons (play, restart) in my main menu screen but I dont know how to do it. I tried this:

Texture playTexture = new Texture(...)
Image playImage = new Image(playTexture)
ImageButton playButton = new ImageButton(drawable?)

but I have no idea what is drawable.


texts: Unity Optimization: Creating Multiple Similar Scenes Effectively

texts:
I've been working on a mobile game that uses the same framework for each level in the game, and I was wondering what would be the most efficient way to store all those levels in Unity. Should I only use one scene and save all the level data somewhere in the filesystem so that each level can be loaded on demand? Or, should each level have its own scene in Unity? Or is there another, more efficient way to do this?

I just worry that creating multiple scenes with nearly identical assets will take up far too much memory and space on someone's device for such a simple game, but I can't figure out a better way to do it. Any ideas?


texts:
I'm making an MMO style game in my spare time for kicks, I've been researching more and more into networking for video games and I've mostly been learning about Quake and Sources networking implementation where they have an authoritative server with a snapshot system where the client receives snapshots that reflect the current state, and the clients will send their input to the server and the server will simulate the game, etc.

Is this what most MMO games use in terms of their networking? I ask this because as I'm implementing it, it seems very expensive if you want a lot of players*, whereas the networking architecture seems more like it was designed for Quake or Source games where it's mostly shooter type stuff where you only have maybe 10 players at a time, sometimes you have 30 or so.

* To elaborate here, I mean that having even 10 players it costs a lot to send snapshots back and forth in terms of bandwidth, it can pretty quickly add up to megabytes. Is this normal? Is this expensive? I don't do a lot of network programming so I'm not particularly sure what is cheap or expensive in terms of bandwidth.

I've currently implemented most of this system, though I've added regions so that the world is split up into multiple areas so that entities in region A don't care about the events, particles, and other entities, etc. in region B or C, D, and so on.


texts: How do I use delta time time-stepping in a triple-buffering scenario?

texts:
I am creating a graphics application in Metal. One of the things we are suggested to do is to use triple buffers in order to allow for the GPU and CPU to work more in parallel. Essentially instead of writing frequently changing data to the same spot in memory you alternate between three offsets and then pass in a drawing offset for the GPU that way the GPU is not reading something the CPU is currently trying to write.

One problem with this is that it means that what is drawn on screen will be from 2 frames ago.

So my question is what does this mean for time-stepping? Heaven forbid I have an incredibly variable frame-rate how do I make things seem smooth when the dt value I have for the CPU simulation frame is actually two frames behind?


texts: RaycastHit2D.point is acting weird when used with circlecast2d

texts:
When I make circleCast2d intersects with another circle collider, I get a RaycastHit2D.point that doesn't point at the tip of the collision as it states in the documentation. Instead it always points at the centre of the intersected junction or pointC as shown in the figure below.
I checked this numerous times with different values to make sure the error was not from my end.
Is this intended? If so is there another way where I can actually find the closest point from collider(B) to the centre of collider(A) which corresponds to point(D) in the figure?
This is a picture of what looks like:
A = circleCast
B = collided object
C = where RaycastHit2D.point is pointing at
D = where I'd like it to point.


texts: I am new to unity and i am trying to make a AR app. I have installed AR foundation, Arcore Xr plugin, Arkit XR plugin via package manager. Then if i go to the Hierarchy panel to add a AR session and right click, I am not seeing any XR option to add a AR session. What should i do now? Anyone please help me.


texts: Creating valid virtual creature with 3d Boxes

texts:
I'm creating this project in unity.Karl Sims, the creator of the project, published the paper describing the project. In order to create the 3d creature like in the video, I'm using 3d boxes and BoxColliders. The boxes are connected to each other with a ConfigurableJoint that limits their rotation limit on some axes. The creatures are then trained to learn different behaviors.

In order to create a new creature a tree is defined. A node in the tree includes data about itself like size or rotation limits, and connections to its children. Each connection includes the rotational limit of its children.

Collision is enabled between the nodes.

This system results in many different looking creatures. Some of them can't actually exist. For example, a creature with two nodes that are long boxes connected side to side really closely, but their connection also says one of them needs to be rotated by 90 degrees.
This creature will cause colliders to be in one another, which results in a fight between the Colliders pushing the boxes away, and the ConfigurableJoints pulling the boxes to each other. This results in the boxes moving around in an unnatural way. These creatures need to be eliminated.

I'm looking for a way to have as many valid creatures as fast as possible. Currently, I'm still using the same random creature generation method. After that, I add a Validator which that instantiates the creature's body and performs some checks.
The validation checks I tried are:
1. See if the creature is not moving
2. See if the colliders overlap with Physics.OverlapBox (I think this didn't work because regular creatures are also colliding and so it eliminated valid creatures)
3. See if there is an unreasonable force acting on the joint, which would indicate an overlap. This seems like the most promising, and I'm still testing it. The thing is that the creature learned to cheat this, during validation they didn't overlap, and when I added their control system (The brain of the creature) they push themselves to overlap.
4. Check for extreme accelerations out of nowhere. Had some success but the creatures adapted to the limit I set.

Currently, I'm leaning towards making the creature will a very small mass, so they don't need to apply a lot of force to move. I think this can help make detecting unreasonable forces easier.

Hopefully, I explained the problem in a manner that enables you to think about solutions. This is less of a code problem, but more of a unity collider and joints problem. I chose to not add code because it's just too much.

Edit:
Since I'm using an evolutionary algorithm, at each point in time, there is more than one creature. A regular evolution process is slow, but when a creature breaks the physics, it gains a big lead. Deleting creatures like that helped slow down the takeover of cheating creatures, but did not prevent it.

Many thanks.


texts: How do I render an animation where some frames appear twice?

texts:
I am animating a sprite. The sprite has 7 different frames, but the animation is 10 frames long. This is because 3 of the original frames appear twice in the animation:

3 -> 4 -> 5 -> 6 -> 4 -> 3 -> 2 -> 1 -> 0 -> 2

Frames 2, 3 and 4 appear twice. This avoids having to store duplicate frames in the spritesheet.

How can I render the animation in this sequence with repeated frames?


texts:
My game is driven by a scripting language, and the user can save at almost anytime in the middle of the script, so the instruction number of the script engine must be saved. The problem is that the game state breaks when the script is changed. If the script is A B C D E and the player saved at C (the 3rd), and then the script is changed into X Y Z A B C D E, then the player will load at Z. I think my game will be updated infrequently even after release.

I think breaking the script into sections and autosaving in each new section. (in case of incompatibility: restart at autosave) However, are there any other ways to make save files forward-compatible?  I want to hear some examples of especially RPGs with DLCs and patches.


texts: Level design algorithm/pattern for Linerunner etc

texts:
I am wondering: how does someone make levels for a game like Linerunner or any other game that uses similar patterns?

About Linerunner (game)
You are a stick man running, you have to jump or crawl without hitting boxes. Google Play is very illustrative.

The algorithm I am looking for
How does the game engine know that if it places a box here and here and here, the user will be able to make it without hitting any of the boxes? Two possible solutions came to mind, but neither of them seem very good.

Design the entire level.
Create an array of small patterns the user can win in and then join the patterns to create a level.

I hope someone understands what I am talking about, otherwise I am willing to explain in depth what I want to accomplish.


texts:
The current game I've been working on needs to have animated tiles. I have a code for Tile and TileMap from my previous game that I recycled. However, it does not support tile animations.

The tile animations are independent from each other. Now, I have an Animation class for my sprites that looks like this (parts are ommited/abstracted):

function Animation(spriteatlas, frames, animationDelay){
    this.spriteAtlas = spriteatlas;
    this.frames = frames;                     // array of number of frames
    this.animationDelay = animationDelay;     // array of delays

    this.currentAnimationIndex = 0;

    this.currentFrame = 0;
    this.delayCounter = 0;
}

Animation.prototype.startAnimation = function(index){
    this.currentFrame = 0;
    this.delayCounter = this.animationDelay[index];
}

Animation.prototype.update = function(){
    this.delayCounter--;
    if(this.delayCounter === 0){
        this.currentFrame++;

        if(this.currentFrame == this.frames[i]){
            this.currentFrame = 0;
        }
    }
}

Animation.prototype.render = function(ctx){
    // Render the appropriate sprite
}

The actual Animation class has much more packed into it, since it is a generic animation.

I can just add an instance of the Animation in every tile, but I think it is inefficient and/or wasteful. Moreover, not all tiles are animated. One may argue that, yeah, it just costs a little memory since this is just a small game. But I do want to know and learn about more efficient ways so I can use them in my next bigger projects.

What are the techniques I can use?


texts: Why can't I access LocalPlayer at runtime in a starterGui script, but I can in the console at runtime?

texts:
In
StartGui -> ScreenGui -> TextLabel -> Banner (a script)

I've got
local ever = false
while (not ever) do
 wait(1)
    local player = game:GetService("Players").LocalPlayer
    print(player)
end

When I Play, I see nil every second in the console.  But if I type = game:GetService("Players").LocalPlayer into the console, I see the name of my character.
What subtle thing am I missing?


texts: Unity - strange performance impact with moving objects

texts:
I'm trying to find the solution for 46 hours now and I'd be really happy if someone knows it!

I'm using a DOTween library for moving the objects. I also use LeanTween, cause I heard it's faster but none of these work for me in this case. I've used tweening libraries alot, but never faced an issue like this.

The bug appeared in my project, so to check it I created a blank one. An empty scene, with a camera and one cube with scale[10,2,10].

Now, I've added a simple script:

    Sequence sequence = DOTween.Sequence();

    sequence.Insert(0f, transform.DOMove(transform.position + new Vector3(10f,0f,0f),1f)).SetEase(Ease.Linear);
    sequence.Insert(1f, transform.DOMove(homePosition,1f)).SetEase(Ease.Linear);
    sequence.SetDelay(1f);
    sequence.SetLoops(-1);

The script moves the cube continously by 10 units to the right, and back (both in 1 second).

There's a noticable jitter.

This jitter is strange, cause it does not happen contantly. It choses a time and just freezes the cube in place for a really tiny amount of time which is noticable - when you see a smoothly moving object and it freezes for a moment.

As you can see, there's a linear interpolation, but I've tried with many (it's even better visible with other interplation types).

Now. The profiler is not the case, cause I've tested it on the empty project with one object on the scene.

Things I've already tried:

Turning off occlusion culling
Turning off everything I could
All the combinations of quality settings
LeanTween instead of DoTween

The one thing I came up with is the profiler's WaitForTargetFramerate.
By definition, when WFTF is huge it means that the app is doing well, cause it finished it's work and waits for the next frame. In my opinion in this case it's the reason of the bug.

I have a screenshot of the profiler window (with one cube, one directional light and this script attached to a cube):

Now, I'm not 100% sure, but I think that this jitter may happen on these V-Sync drops on the screen.

Everything is tested on the PC. On Android there's the same thing (a noticable jitter), but I didn't run the profiler.

If someone has any idea what may be the cause of this - I'd be grateful. I'll put a bounty here as soon as I can, cause I'm really tired! :)

@ DMGregory

This is before the 'jump' on the GPU chart:

and that's on the 'jump':

There's no RigidBody or Collider, but on my main project there are box colliders on these floors. I've also tried adding RB with the Interpolation checked. No difference.

@ Josh Hamilton

Even if this is a normal behavior, that the frame completed faster - there are games on Google Play and AppleStore without any glitches like this. In my main project (where I discovered the issue) the biggest problem is that this lag is happening when I move the camera to follow the player smoothly and the freeze it noticable like anywhere else. Like the entire enviroment was freezing for 1-3 frames.


texts: glfwCreateWindow function returning NULL

texts:
I am working on creating a game engine using GLFW. To begin, I set up a window class in C++ to test how making a window works. For some reason, when I call the glfwCreateWindow function, it returns NULL instead of GLFWwindow*. Here is my code (I have a header file that defines the class and then the c++ file that defines the class):

Here is the window.h header file:

#pragma once

#include <iostream>
#include <GLFW/glfw3.h>

namespace harmony { namespace graphics {

    class Window
    {
    private:
        const char* m_Title;
        int m_Width, m_Height;
        GLFWwindow* m_Window;
        bool m_Closed;
    public:
        Window(const char* name, int width, int height);
        ~Window();
        bool closed() const;
        void update() const;
    private:
        bool init();
    };

} }

And here is the c++ window.cpp file:

#include "window.h"

namespace harmony { namespace graphics {

    Window::Window(const char* title, int width, int height)
    {
        m_Title = title;
        m_Width = width;
        m_Height = height;
        if (!init())
            glfwTerminate();
    }

    Window::~Window()
    {
        glfwTerminate();
    }

    bool Window::init()
    {
        if (!glfwInit)
        {
            std::cout << "Failed to initialized" << std::endl;
            return false;
        }

        m_Window = glfwCreateWindow(m_Width, m_Height, m_Title, NULL, NULL);
        if (!m_Window)
        {
            std::cout << "Failed to create window!" << std::endl;
            return false;
        }
        glfwMakeContextCurrent(m_Window);

        return true;
    }

    bool Window::closed() const
    {
        return glfwWindowShouldClose(m_Window);
    }

    void Window::update() const
    {
        glfwPollEvents();
        glfwSwapBuffers(m_Window);
    }

} }

And lastly here's my main.cpp:

#include "window.h"

int main()
{
    using namespace harmony;
    using namespace graphics;

    Window window("Yay it works!", 800, 600);

    while (!window.closed()) {
        window.update();
    }
    return 0;
}

I looked it up and there are only a couple cases (in the source code of glfwCreateWindow) where it returns NULL, but I haven't found a good way to troubleshoot which one.


texts:
How should I go about making terrain collision system without hightmap ?

What I have tried is building a heightmap from a blender model, but that works only if the vertices are evenly spaced. Mine are not and I am not sure how to proceed from here.

How do i store the mesh info ? Do I store a Plane object for every triangle in the mesh and then plug those in some kind of grid/quad tree etc ? Is that the best thing to do ? My terrain has around 2000 faces, wouldn't that be too much ?


texts: Drawing sprites only under certain conditions - alternatives to using 'if statements'?

texts:
Within my game (which is Java/Android), I wish to draw a sprite only under certain conditions, so up until now, I've been using if statements to accomplish this.  Something like so:

if (powerUpActive){

    draw(shieldSprite);

}

So the above, uses a simple boolean primitive (powerUpActive) and only draws the sprite (shieldSprite) when the boolean is true.

This works, however, my logic code is littered with if statements and I'm not sure this is a good thing.  I keeps reading that too many if statements are a bad thing however, I can't work out how to accomplish this without using them.

Note, the above is just an example, I use many other boolean flags in my code

The only alternative that I can think of is to use a batch of sprites where I can specify the number to draw. (This is OpenGL ES 2.0 so I use a for loop to upload the vertices for the sprites I want to draw within the batch).  If I simply set the number to draw to 0, it won't draw any. However, it seems a little overkill to use a batch when I know there will only ever be one sprite in it.

public void draw(){

    for (int i = 0;i < numberToDraw; i++){

        //Code here to upload vertices
    }

    //Code here to draw sprite (draws nothing if numberToDraw is set to 0)

}

So I'm really not if there is a better way do things in java on condition without using if's or switch statements.


texts: animation in Rhythm game similar to Jubeat Plus

texts:
For a school assignment I am planning to make a game similar to Jubeat Plus on the iPad.
Right now, I have a counter that gives me each 16th note of a beat, I am reading out a Property List where I defined the time of each button when it should be pressed.

But I don't know how to add the animation. When a button should be pressed, the animation must be at some point already, whether it's a hit animation or a falling dot.

Can someone help me out please?
even a feedback whether I'm doing this right or wrong

I don't know if i'm thinking at the right way
Do I need to use the beats per minute, to calculate the seconds per beat.
When this time is near my animation time
I use the frame rate to animate my animation

Please correct me


texts:
I'm trying to build a 2D game for android and after I finished developing the game I noticed that there was lag present when moving objects around. I tested it on a phone much more powerful than my own Sony Xperia z2 and it had more lag, therefore I believe it's not related to RAM.

I've disabled vsync using profiler putting the movement in fixedupdate, lateupdate, and even built a new project.
This new project has only 1 scene and 3 scripts. One of scripts are attached  to this sprite to move it.
When running this project I still have lag; both on my laptop and on my mobile phone!

This is the script:

using UnityEngine;
using System.Collections;

public class PlayerMove : MonoBehaviour {
    public Vector2 movement;
    public Vector2 speed;
    private float myTimer;
// Use this for initialization
void Start () {
    speed=new Vector2(2,0);
}

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

}
public void handleMove(){
    if (Input.GetKey (KeyCode.UpArrow)) {
        speed.y=2;
        this.gameObject.rigidbody2D.velocity=speed;
        myTimer=.3f;
    }
    if (Input.GetKey (KeyCode.DownArrow)) {
        speed.y=-2;
        this.gameObject.rigidbody2D.velocity=speed;
        myTimer=.3f;
    }
    if (myTimer > 0)
        myTimer -= Time.deltaTime;
    else {
        speed.y=0;
        this.gameObject.rigidbody2D.velocity=speed;
    }
}
}

this is results of profiler


texts:
I am trying to load a model and it is loading it in reverse. When I am trying to rotate it 180 degrees it changes the lightning as well.
I am not sure what I need to do to change the position that eh model is facing when is being loaded.

This is the object loader:

if (!submarineShader->load("BasicView", "glslfiles/basicTransformations.vert", "glslfiles/basicTransformations.frag"))
{
    cout << "failed to load shader" << endl;
}
glUseProgram(submarineShader->handle());  // use the shader

glEnable(GL_TEXTURE_2D);

cout << " loading model " << endl;
if (objLoader.loadModel("submarine_/submarine v2/submarine5.obj", model))//returns true if the model is loaded, puts the model in the model parameter
{
    cout << " model loaded " << endl;

    model.calcVertNormalsUsingOctree();

    model.initDrawElements();
    model.initVBO(submarineShader);
    model.deleteVertexFaceData();

}
else
{
    cout << " model failed to load " << endl;
}


texts: I was expecting a circle to trace a path of parabola . why isnt that the case?

texts:
Why isn't the rendered shape a parabola?

@Override
public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.begin(ShapeRenderer.ShapeType.Filled);
    position.x += 1;
    position.y = position.x * position.x ;
    renderer.circle(position.x,position.y,radius);
    renderer.end();
}


texts: Raycasting mouse coordinates to rotated object?

texts:
I am trying to cast a ray from my mouse to a plane at a specified position with a known width and length and height.

I know that you can use the NDC (Normalized Device Coordinates) to cast ray but I don't know how can I detect if the ray actually hit the plane and when it did. The plane is translated -100 on the Y and rotated 60 on the X then translated again -100.

Can anyone please give me a good tutorial on this? For a complete noob! I am almost new to matrix and vector transformations.


texts: How do I render a PNG image with OpenGL?

texts:
I have an image (100×200 px) painted with Paint.NET and saved as a .png with 32-bit color depth. How can I render it using OpenGL 1.1  (with the LWJGL binding) or higher inside the display?

I tried creating a ByteBuffer, then loading the pixel color values inside that buffer, but I'm missing the OpenGL settings that need to be enabled. Some help?


texts:
My problem -

Each round, each of the 5 champions get to strike each of the 99 monsters once; however, their attacks are such that one third of each champion's attacks are ineffective, causing 0 damage; one third cause normal damage (1 point) and one third cause bonus damage (2 points). (The numbers have been simplified for the purposes of this example.) So, in total each of the monsters can get hit anywhere from 0-10 points of damage each round, but the amount will vary depending on whether the attack was ineffective, caused normal damage or caused bonus damage. As I'm trying to figure out the right percentages between ineffective, normal and bonus damage attacks (in the example above, they're each at one third, but I'm not sure that will make sense for the gameplay), I need to know how the damage will be distributed among the 99 monsters as I change the percentages associated with each of the three different types of attacks. In other words, if I use these x percentages, they will result in y monsters receiving 10 points of damage, z monsters receiving 9 points of damage, etc.) Does anyone know how I can do that?


texts: Is Flash (Flash/Flex/AIR) a still maintained technology (either officially / 3rd party) suitable for Web Player (linux) and mobiles?

texts:
Today I use Flash Player 11 since it's the last one released by Adobe, for linux-based OSs. The same applies to Flex/AIR platforms: I use Flex 4.1.4 and AIR 2.6, while Windows and Mac systems have newer versions (at least 4.6 and 3.1 respectively).

Is there a (trusted 3rd party) community making a good port (good stands for compatibility) of those newer versions to Linux-based OSs? Or is Flash/Flex/AS3 actually dying*?

(* my concern with this point is that I would not like to stick to an unmaintained technology in a mid-term future. Currently I'm learning Citrus Engine + Starling and I'd like to know if it is a bad).


texts: Should damage calculation in a competitive multiplayer game be done client-sided or server-sided?

texts:
I'm interested in creating a moba style game like League of Legends and need help with a situation.
More exactly: I have an item that gives the player 50 Attack Damage or an ability that does 50 Attack Damage. Is the information about how much damage the items/ champion abilities do kept in client side of the game or the server.

Option 1: I hit the enemy and the client tells the server to deduct 50HP from the enemy i hit
or
Option 2: I hit the enemy and the client tells the server only that I hit the enemy, then the server looks at the item I have/ ability used and based on code on the serves side deducts the 50HP


texts: How to render gameobjects with same size and same position in unity

texts:
canvas can be fixed for all screen sizes but I want to fit  gameobjects which is not in canvas, for all sizes of screen.

This is the transform of my game object

The game object's size and position variation

My question is how to render the gameobject with same size and same position for all screens


texts: Optimizing thousand objects manipulation

texts:
I am developing a clone Minecraft for the purpose of study. I am working with Java and LibGDX. I have read some other codes on web, and reading LibGDX tutorials and currently I could develop something on map using Perlin Noise, etc.
But my biggest problem is the render performance. I splitted my map in chunks, as Minecraft does, but even with few elements on screen (2.000 blocks) the FPS drops to 20 by second on Desktop. Even if I not looking for any block.
My logic is that:

Main() calls Region.draw() to draw all loaded region chunks (currently about 16 chunks);
Region.draw() calls each Chunk.draw() to draw all blocks on each chunks, about 128 blocks (total 2048 blocks).

I really do not see reason to performance be poor like that. I read that small things like that send a lot of instructions to GPU, like each vertices coordinates, etc. and it make sense. But Minecraft do thinks even more complicated like that and works without lag on my PC. I could simulate, on Minecraft, a render of 51.522 blocks without FPS issues. So I think that there are some method to avoid upload my blocks each time to GPU, and just call draw on it directly (I don't know if I am on right direction).
I'm studying 3D game development currently, and I have a similar problem on Unity (lot of objects, low performance).
What I missing?
My current code
My current render with 20 FPS:


texts: Issue implementing proper collision in XNA Game Studio 4.0

texts:
I am building a game in XNA 4.0, where a player moves about a 2 dimensional (vertical perspective) map consisting of blocks. My issue is creating proper collision between the payer and the blocks (basic game physics.) The player moves more than 1px per frame, so .Intersects() just isn't enough, I need physical contact collision that can function in a gravity environment. The current version I currently have is a piece of garbage and only works occasionally.

Basically, all that the collision system needs to do is stop gravity when the player lands on a block, and provide some decent physics when the player hits blocks (movement in that direction ceases). The idea behind my current solution is to move the next Position around until it finds a clear spot, but it doesn't work well. I have an idea why, just have no idea how to do it properly.

I know there must be a better way to do this. What would be the best method of making this kind of collision work properly?

Thanks


texts:
I have a startpoint, magnitude(length) and direction and want to find endpoint to construct the line
here is the code to make question more clear

private Vector2 GetEndPoint(Vector2 startPoint, Vector2 direction, float magnitude) {
    Vector2 endPoint = //some stfuff with parameters
    return endPoint;
}

And this is the visualization of what I want

Hope I am clear enough, any suggestions is welcomed


texts: Implementing skeletal animation and GPU skinning (DOOM MD5)

texts:
DISCLAIMER
This question has been completely rewritten to narrow the scope of the question in light of previous suggestions and answers, but the same problem still persists.

Currently I'm trying to implement skeletal animation (GPU skinning) in my project.

So far I have achieved single joint translation and rotation, and multi-jointed translation. The problem arises when I try to rotate a multi-jointed skeleton.

At the moment I'm following quite a few sources in trying to implement skeletal animation. The MD5 spec, a blog post with source code and I've also seen many other tutorials.

Currently when I try and load the popular "Bob Lamp" model, I get this result.

Some information about my implementation:

My maths is ordered with "vector to the left"
The vectors and rotations of animation frames are being converted into matrices
I pre-multiply the inverse bind pose and pose matrices

Here is my shader code.

#version 330 core

smooth out vec2 vVaryingTexCoords;
smooth out vec3 vVaryingNormals;
smooth out vec4 vWeightColor;

uniform mat4 MV;
uniform mat4 MVP;
uniform mat4 Pallete[55];

layout(location = 0) in vec3 vPos;
layout(location = 1) in vec2 vTexCoords;
layout(location = 2) in vec3 vNormals;
layout(location = 3) in int vSkeleton[4];
layout(location = 4) in vec3 vWeight;

void main()
{
    vec4 wpos2 = vec4(0.0);
    vec4 norm2 = vec4(0.0);
    vec4 wpos = vec4(vPos, 1.0);
    vec4 norm = vec4(vNormals, 0.0);
    vec4 weight = vec4(vWeight, (1.0f-(vWeight[0] + vWeight[1] + vWeight[2])));

    mat4 BoneTransform = mat4(0.0);
    for(int i = 0; i < 4; i++) {
        float fW = weight[i];

        if(fW > 0) {
            int jI = vSkeleton[i];
            vec4 tmpPos = wpos * (Pallete[jI]);
            wpos2 += fW * tmpPos;
        }
    }

    wpos2 /= wpos2.w;

    vWeightColor = weight;
    vVaryingTexCoords = vTexCoords;
    vVaryingNormals = normalize(vec3(vec4(vNormals, 0.0) * MV));
    gl_Position = wpos2 * MVP;
}

Another peculiar thing to mention is that multi-jointed animation works when the vertices are inline with the bones. As soon as the vertices move away from the bones, they deform incorrectly.

UPDATE
In response to @MickLH

My shader code now has wpos2 /= wpos2.w after the for loop. This is the result.


texts: I'm interested in tinkering with the AI in Civ 5.  I know there are XML files that can adjust the AI's strategies, but are there other easily moddable AI components?  The XML files contain comments that reference some CPP files, are those available to end users or are those comments just aimed at internals?


texts: A field initializer cannot reference the non-static field, method, or property 'CinemachineFreeLook.Variable'

texts:
engine: unity
coding language: c#
I am trying to control CinemachineFreeLook maxSpeed from another script in the struct AxisStat: public AxisState(float minValue, float maxValue, bool wrap, bool rangeLocked, float maxSpeed, float accelTime, float decelTime, string name, bool invert) It only accepts to type a number, but not a variable.
Whenever I create a public float variable and place it in maxSpeed, it keeps sending the error: error CS0236: A field initializer cannot reference the non-static field, method, or property 'CinemachineFreeLook.rSpeed'
Here is the default unity CinemachineFreeLook script code + the added code which I declare a float variable "rSpeed" at the beginning and added my variable in the AxisStat maxSpeed:
public class CinemachineFreeLook : CinemachineVirtualCameraBase
{
    public float rSpeed = 300f;

    /// Object for the camera children to look at (the aim target)
    [Tooltip("Object for the camera children to look at (the aim target).")]
    [NoSaveDuringPlay]
    public Transform m_LookAt = null;

    /// Object for the camera children wants to move with (the body target)
    [Tooltip("Object for the camera children wants to move with (the body target).")]
    [NoSaveDuringPlay]
    public Transform m_Follow = null;

    /// If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used
    [Tooltip("If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used")]
    [FormerlySerializedAs("m_UseCommonLensSetting")]
    public bool m_CommonLens = true;

    /// Specifies the lens properties of this Virtual Camera.
    /// This generally mirrors the Unity Camera's lens settings, and will be used to drive
    /// the Unity camera when the vcam is active
    [FormerlySerializedAs("m_LensAttributes")]
    [Tooltip("Specifies the lens properties of this Virtual Camera.  This generally mirrors the Unity Camera's lens settings, and will be used to drive the Unity camera when the vcam is active")]
    [LensSettingsProperty]
    public LensSettings m_Lens = LensSettings.Default;

    ///  Collection of parameters that influence how this virtual camera transitions from
    /// other virtual cameras
    public TransitionParams m_Transitions;

    /// Legacy support
    [SerializeField] [HideInInspector]
    [FormerlySerializedAs("m_BlendHint")]
    [FormerlySerializedAs("m_PositionBlending")] private BlendHint m_LegacyBlendHint;

    /// The Vertical axis.  Value is 0..1.  Chooses how to blend the child rigs
    [Header("Axis Control")]
    [Tooltip("The Vertical axis.  Value is 0..1.  Chooses how to blend the child rigs")]
    [AxisStateProperty]
    public AxisState m_YAxis = new AxisState(0, 1, false, true, 2f, 0.2f, 0.1f, "Mouse Y", false);

    /// Controls how automatic recentering of the Y axis is accomplished
    [Tooltip("Controls how automatic recentering of the Y axis is accomplished")]
    public AxisState.Recentering m_YAxisRecentering = new AxisState.Recentering(false, 1, 2);

    /// The Horizontal axis.  Value is -180...180.  This is passed on to the rigs' OrbitalTransposer component
    [Tooltip("The Horizontal axis.  Value is -180...180.  This is passed on to the rigs' OrbitalTransposer component")]
    [AxisStateProperty]
    public AxisState m_XAxis = new AxisState(-180, 180, true, false, rSpeed, 0.1f, 0.1f, "Mouse X", true);


texts: OpenGL equivalent of .fx files in GLSL or Cg?

texts:
There's a lot of learning material in the DirectX world that uses .fx files to manage shaders, and .fx seems to be well integrated with 3D packages such as Maya and 3D Studio Max

What do larger OpenGL projects use? Do they all have a bespoke format or are there any common standards in use that might have some tools to go with them?

I have found a 404 page on http://www.khronos.org/glfx/ and http://sourceforge.net/projects/glfx/files/ has no files at all in the download section.

Can you use .fx files with Cg as the languages are so close syntactically?  I hear that Cg has poor performance on the ATI Linux drivers but at least it my help me get going on my own Nvidia system.


texts:
I am building a simple multi-player fly-around-a-3D-world game in Javascript/webGL/websocket (Chrome, Firefox mostly).

How should I handle and process user input?

My preliminary design (untested) is to first just track which keys are down in the event handler:

var keys = [];

document.onkeydown = document.onkeyup = function(evt) {
   keys[evt.charCode] = evt.type == "keydown";
   keys[CTRL] = evt.ctrlKey;
   keys[SHIFT] = evt.shiftKey;
   websock.send(JSON({time: (new Date()).gettime(),
      down: evt.type == "keydown",
      key: evt.charCode,
      shift: evt.shiftKey, ctrl: evt.ctrlKey }));
};

and then, in my requestAnimationFrame callback, compute how many time-slices (say 20 per second?) have elapsed since the last render callback, and then compute that many time-steps using the booleans in the keys array to determine if to apply a left bank, right bank, up down and accelerate and so that time-step for each player.

How effective / responsive is this?  Is there a better way?  And is there a neater way to deal with latency than just backdating changes for other user's ships?


texts: What technique should I use for the AI for Go?

texts:
I am currently undertaking a project where I need to program AI for Go (the Asian strategy game) and I would like to know, how do I start? I am aware of the many approaches to AI for their applications to Go, such as the neural network, machine learning (supervised learning, etc), the Monte-Carlos method, or knowledge based AI. I am more interested in machine learning however I am short on time as I have about two months to complete it.

I am also considering minimax and alpha-beta pruning with brute force as a compromise in case I don't have enough time to do anything else. I am fully aware that it is not the best way to go about this but if I am short on time then I have no other choice.


texts: Switching between meshes vs Loading only specific mesh

texts:
I am currently developing an online multiplayer game on Unity. In the game, the character of each player will be assigned its mesh after the game receives parameters (their meshes' names) for each character from the server. Assigning each character's mesh can happen after the main scene is loaded. I am wondering whether:

I should make each character's object the same by having every mesh possible loaded into it and only activate the corresponding mesh for that player.
I should create a class that holds every mesh possible (like, mesh manager) and tell each character to use its mesh from that class.
I should delay the characters' meshes loading to wait for the parameter from the server first. Then, load the mesh after the scene has been loaded.

I am not sure if specific assets can be loaded outside of its scene in Unity. If anyone has any different solutions, feel free to suggest. Thanks in advance.


texts: Which of these two codes are 'better'? Making a local variable or a class variable?

texts:
Im making more games and asking more stupid questions.

Hopefully this one is very brief. I'm making a very basic class which just moves a Player object by applying force to a rigidbody, but it got me wondering, should I be making a class reference to the rb or just a local variable inside Update every frame? (bearing in mind it already exists in the Monobehaviour.GameObject unity parent class).

I'm wondering if doing many local variables would slow down the loop as a whole(by local I mean inside the function itself and not at the top of the class - hope im using the correct term) .

Here is what I mean, the two ways I was thinking of doing it:

public class Player : MonoBehaviour {

private void FixedUpdate()
{
    Rigidbody rb = GetComponent<Rigidbody>();

    float v = Input.GetAxis("Vertical");

    rb.AddForce(v * rb.transform.forward * Const.walkForce);
}
}

or...

public class Player : MonoBehaviour {
Rigidbody rb;

private void Awake()
{
    rb = GetComponent<Rigidbody>();
}

private void FixedUpdate()
{
    float v = Input.GetAxis("Vertical");

    rb.AddForce(v * rb.transform.forward * Const.walkForce);
}
}


texts:
I am programming a 2D game. When a ball is launched it should decelerate and eventually come to a stop. I have implemented the deceleration part but when the ball nearly stops it starts accelerating. I understand that I should implement some kind of condition for when it should stop (when velocity is 0), however all of my attempts have failed.
These are my variables:
v, v0 - velocity
acc - acceleration
dt - delta time
Here is a code sample of how the velocity gets updated on every game tick:
v.setX(v0.getX() + acc.getX()*dt);
v.setY(v0.getY() + acc.getY()*dt);


texts: Keeping the camera from going through walls in a first person game in Unity?

texts:
I'm using a modified version of the standard Unity First Person Controller. At the moment when I stand near walls, the camera clips through and lets me see through the wall. I know about camera occlusion and have implemented it in 3rd person games, but I have no clue how I'd accomplish this in a first person game, since the camera doesn't move from the player at all.

How do other people accomplish this?


texts: Is it bad practise to have an object for every tile?

texts:
In the game I am working on, many of my tiles must have special attributes (such as triggers when the player steps on them). I was wondering if it would be bad practise to create an object for every tile, so that I can do map.getTile(5, 3).setWalkable(true); (psuedocode).

The only alternative I can think of to this would be to create one instance of every tile, then just look at the properties of that type of tile, which might be okay.

Is it okay to have an object per tile?

I am using C++ with SFML, but I doubt that matters.
I know there is a similar existing question, but it doesn't answer how to manage the tiles if they do unique things.