texts:
Is it possible to delay the effects of a script that is attached to a game object?

I have 2 characters in a scene, both receiving live motion capture data, so they are both animated identically. I have rotated one by 180 degrees and placed it in front of the other one, to create the impression that they are copying/mirroring each other.

Each has several scripts attached to them, of course...

Now, I would like to be able to delay one character a bit (e.g. 1 sec) to make it look more realistic, as if one character is observing the other character and then copying its exact movements.

Is it possible to do this by somehow using the Invoke method on the other character's Update perhaps? Or any other possibilities to achieve what I described?

EDIT :: I used a buffering mechanism, as suggested by all the helpful comments and answers, instead of delaying, because delaying would have resulted in the same network data being used, except after a delay, but I needed the same old data being used to animate a second character to create the impression of a delayed copying...

private Queue<Vector3[]> posQueue;
private Queue<Quaternion[]> rotQueue;
int delayedFrames = 30;

void Start()
{
    posQueue = new Queue<Vector3[]>();
    rotQueue = new Queue<Quaternion[]>();
}

void Update()
{
    Vector3[] latestPositions;
    Quaternion[] latestOrientations;

    if (mvnActors.getLatestPose(actorID-1, out latestPositions, out latestOrientations))
    {
        posQueue.Enqueue(latestPositions);
        rotQueue.Enqueue(latestOrientations);

        if ((posQueue.Count > delayedFrames) && (rotQueue.Count > delayedFrames))
        {
            Vector3[] delayedPos = posQueue.Dequeue();
            Quaternion[] delayedRot = rotQueue.Dequeue();

            updateMvnActor(currentPose, delayedPos, delayedRot);
            updateModel(currentPose, targetModel);
        }
    }
}


texts: how to work more efficient with UI elements

texts:
im working on a mobile android game that has many levels and same UI. for every level i have to assign the object and function of every button in every scene level.

is there more effiecient way that there will be no need to assign all functions in every scene?

thank you for helping


texts: FPS drop after moved from Textures to TextureAtlas in LibGDX

texts:
I've started using LibGDX some time ago and I was making a test project to get used to this library. I've created some images and added them to the assets folder and loaded each image as a Texture using the AssetManager. Everything was working fine and I had 60 FPS.

I wanted to work in a more efficient way so I packed all my images into an atlas using the TexturePacker tool. I loaded the atlas using the AssetManager again and started using TextureRegions instead of Textures.

After this change I've started to notice sudden drops in FPS from 60 to 50 and even 30 once. I've tried to change the pixel format to RGBA4444, I've made sure that the min and mag filter were both seth to Nearest, but still I see those annoying frame drops.

I'm not doing anything heavy in the game itself, it's currently some actors in a stage. I got some MoveActions and Animation, but nothing special yet.

Does anyone have a clue what can cause the FPS drop?

Thanks


texts: Would someone please explain Octree Collisions to me?

texts:
I've been reading everything I can find on the subject and I feel like the pieces are just about to fall into place, but I just can't quite get it.

I'm making a space game, where collisions will occur between planets, ships, asteroids, and the sun. Each of these objects can be subdivided into 'chunks', which I have implemented to speed up rendering (the vertices can and will change often at runtime, so I've separated the buffers). These subdivisions also have bounding primitives to test for collision. All of these objects are made of blocks (yeah, it's that kind of game). Blocks can also be tested for rough collisions, though they do not have individual bounding primitives for memory reasons. I think the rough testing seems to be sufficient, though.

So, collision needs to be fairly precise; at block resolution. Some functions rely on two blocks colliding. And, of course, attacking specific blocks is important.

Now what I am struggling with is filtering my collision pairs. As I said, I've read a lot about Octrees, but I'm having trouble applying it to my situation as many tutorials are vague with very little code.

My main issues are:

Are Octrees recalculated each frame, or are they stored in memory and objects are shuffled into different divisions as they move? Despite all my reading I still am not clear on this... the vagueness of it all has been frustrating.
How far do Octrees subdivide? Planets in my game are quite large, while asteroids are smaller. Do I subdivide to the size of the planet, or asteroid (where planet is in multiple divisions)? Or is the limit something else entirely, like number of elements in the division?
Should I load objects into the octrees as 'chunks' or in the whole, then break into chunks later? This could be specific to my implementation, I suppose.

I was going to ask about how big my root needed to be, but I did manage to find this question, and the second answer seems sufficient for me. I'm afraid I don't really get what he means by adding new nodes and doing subdivisions upon adding new objects, probably because I'm confused about whether the tree is maintained in memory or recalculated per-frame.


texts: Using one Vive controller: default to left hand?

texts:
We're making a sailing game in VR for Vive Pro, where you hold the rudder with your left hand using a Vive controller. We use just one controller because there's nothing to do with your other hand, and the rudder is on the left side of the player (it's a seated setup). The second controller will be charging, or it will be off while the game is being played.

We use the Player prefab that comes with the Steam VR Unity Plugin, that has GameObjects for both the left and right hand, with the option to show controllers and/or hand skeletons that move according to what controls you're using on the controllers.

The problem is that when only one controller is on and detected by Steam VR, it decides to show the right hand, instead of the left hand that we're holding it with.
When both controllers are switched on and connected, it works as expected. The left hand controller is at the player's left side as long as the unused controller is located at the player's right side.

I tried putting a left handed skeleton on the right hand controller gameObject in the Player prefab, but that resulted in an unresponsive skeleton (not visualising the interaction of the player with the controller).

How can we make it so that when using only one controller, it shows as the left hand?

So what we want is like in this picture, hold the controller with one hand (normally the left hand) except always showing a left virtual hand in the application, and still mimicking whatever controls the user is pressing on the real controller.


texts: Where is the "Scripts Window" menu in Blender 2.59?

texts:
I'm trying to import a script into Blender, and I have the script in my directory and I pushed F8 to reload scripts, but the instructions for running this script say:

  In the "Scripts Window" run "Scripts → Export → OGRE Meshes".

I've seen other similar instructions for other scripts. But the toolbar only contains "File/Add/Render/Help." Changing the "screen layout" to Scripting doesn't reveal any additional options, either.

I'm sure I'm just missing something obvious. Please help!


texts: Implementing jumping and heightmaps in 2D RPG/Adventure style games?

texts:
I've been putting together, albeit slowly, a traditional style game engine in flash/AS3 along the lines of Alundra/Final Fantasy 3/etc etc..

Everything so far is working smoothly (maps from XML data, collision, animation, etc) but I am having trouble gaining height/jumping.

See the image from Alundra to understand the style I am talking about:

I would like for platforms to be jumped on. I am trying to brainstorm different ways to approach this. The player can obviously jump  and move at the same time, so every tile would need a 'height' property I'm guessing, and vertical collision would be checked against the tile's height?

Are there any resources/tutorials or even starting points around this that people would like to share? Someone suggested a graph - see the last forum post here http://www.gamedev.net/topic/605520-building-a-map-and-navigating/


texts: C# Monogame/XNA: Workinging with positions on 2D tile-based game

texts:
Lately, I have started working on a simple MMORPG 2D tile based world (for learning purpose only).
I started working on the server (networking, messages encoding/decoding and ect), and assumed 2 integer will be sufficient for sprite positions.
My pros for using integers:

Easy mapping sprite <-> tile.
Reduce used memory for client updates (bandwidth): on neighbor sprite move, I can send only the delta offset from the previous location - one byte for each offset (X & Y).

On the other hand, when I reached the client implementation, I couldn't figure out how to implement smooth scrolling and move speed, since the position on every update are two integers, which are bound to specific location inside a tile (using Camera2D transformation).
I want to be able to see sprite movements between tiles, based on the sprite speed (and tile type).
My camera code:
public class Camera2D
{
    private Vector2 _pos;
    private int _viewportWidth;
    private int _viewportHeight;
    private float _textureWidth;
    private float _textureHeight;

    public Matrix Transformation
    {
        get
        {
            return Matrix.CreateTranslation(new Vector3(-this._pos.X-this._textureWidth/2,
                                                        -this._pos.Y-this._textureHeight/2, 0)) *
                   Matrix.CreateTranslation(new Vector3(this._viewportWidth * 0.5f,
                   this._viewportHeight * 0.5f, 0));
        }
    }

    public Camera2D(int viewportWidth, int viewportHeight, float tlieWidth, float tileHeight)
    {
        this._viewportHeight = viewportHeight;
        this._viewportWidth = viewportWidth;
        this._tileHeight = tileHeight;
        this._tileWidth = tlieWidth;
        this._pos = new Vector2(0, 0);
    }

    public void Follow(Sprite sprite)
    {
        this._pos.X = sprite.Position.X;
        this._pos.Y = sprite.Position.Y;
        this._textureWidth = sprite.Texture.Width;
        this._textureHeight = sprite.Texture.Height;
    }
}

My tiles data structure looks like:
Tile[,] _mapTiles;

Where:
class Tile
{
    private int _id;
    private List<Character> _standingCharacters;
    private ViewPoint _viewPoint;
}

I thought about sending clients the sprites' speed and make all the simulation in the client, but I don't think it's feasible due to the difference of clients' network, which will cause to massive synchronization problems.
My motto so far: the server should relies only on itself and be responsible for the simulation, while the client will get updates and render based on them (and internal client prediction).
Another idea I had:
I can manage in addition to the 2 integers (X,Y), additional in-tile offset in size of two bytes:
Position(X,Y,inTileOffsetX,inTileOffsetY) = (X + inTileOffsetX / 128,Y + inTileOffsetY / 128)

The speed can be controlled via the inTileOffset updated value, meaning I will have maximum 128 possible speed rates.
How do you think I should tackle the described problem?


texts: cocos2d-x v2.1 CCSpeed, CCRepeatForever, and CCAnimation jerky at high speed

texts:
I worked to port Tim Roadley's cocos2d-iphone example from (Box2D Driven Cocos2D Animation) to cocos2d-x to learn cocos2d-x for a project. It is all relatively simple to do, but I am suffering from one obstinate problem. When the ball speeds up, the animation gets very jerky. This problem does not exist in Tim's cocos2d example.

From my investigation and close watching of the animation, it skips frames at the end of the animation sequence when the speed is high (above 4 or 5 in my code).

Here is Tim's original code and some context:

// LOAD ANIMATION FRAMES FROM SPRITESHEET
NSMutableArray *rollFrames = [NSMutableArray array];
for(int i = 1; i <= 120; ++i) {
    [rollFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"Ball%i.png", i]]];
}

// CREATE ANIMATION ACTION
speedAction = [CCSpeed actionWithAction:
              [CCRepeatForever actionWithAction:
              [CCAnimate actionWithAnimation:
              [CCAnimation animationWithFrames:rollFrames delay:0.1]]] speed:3.5];

// CREATE BALL SPRITE
ball = [TRBox2D spriteWithSpriteFrameName:@"Ball1.png"];
[ball setPosition:ccp((screenSize.width/2), (screenSize.height/2))];
original = ball.position;  // used to determine ball trajectory
[ball runAction:speedAction];
[ball setTag:isTheBall];  // used so we can pick out this sprite during the physics loop
[ball setScale:0.7];

Here is my translation, again with some context:

// LOAD ANIMATION FRAMES FROM SPRITESHEET
CCArray *spriteFrames = CCArray::create();
for (int i = 1; i <= 120; i++) {
    std::stringstream spriteName;
    spriteName << "Ball" << i << ".png";

    CCSpriteFrame *spriteFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(spriteName.str().c_str());
    spriteFrames->addObject(spriteFrame);
}

CCAnimation *animation = CCAnimation::createWithSpriteFrames(spriteFrames, 0.1);
CCAnimate *animate = CCAnimate::create(animation);
CCRepeatForever *repeat = CCRepeatForever::create(animate);
speedAction = CCSpeed::create(repeat, 3.5f);

spriteFrames->release();

// CREATE BALL SPRITE
ball = (PhysicsSprite *)PhysicsSprite::createWithSpriteFrameName("Ball1.png");
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
ball->setPosition(ccp((screenSize.width/2), (screenSize.height/2)));
original = ball->getPosition();

ball->runAction(speedAction);

ball->setTag(1);
ball->setScale(0.7f);

Tim's example uses COCOS2D_VERSION==0x00010001 (v1.0.1)
I am using COCOS2D_VERSION==0x00020100 (v2.1.0)

I dug through the CCSpeed, CCRepeatForever, and CCAnimate. The major difference I find is in CCActionInterval.cpp where CCAnimate was changed to use "new animation format that supports delays per frame" (commit d0ab4515a4736bdf31aaed6394d95f8ea02beea1). If I revert this change to the previous "animation format" which does not support delays per frame, the sprite animates flawlessly at higher speeds.

Now to my question, am I mis-interpreting how the animation actions are intended to work in cocos2d-x 2.1? Have I missed something that is causing my jerky animation? It does not seem like changing some of the core code is the right answer, though bugs do exist.


texts: What's the equivalent of UIBezierPath in Cocos2d-x?

texts:
I'm beginner in Cocos2d-x , and i want to implement this tutorial with Cocos2d-x v.3 cpp, but the problem i dont know if there's UIBezierPath in cocos2d-x.

Could you help me to draw the Bezier Arrow please?


texts: How to implement a multi-platform Java 2D game engine's graphics?

texts:
I'm not sure whether this question should be posted here. I'm trying to make a basic generic game engine in Java. Here's what I have so far.

public abstract class Device {
    public abstract void startDevice();
    public abstract void closeDevice();
    public abstract int getWidth();
    public abstract int getHeight();
    public abstract void displayImage(Image im);
}
public class Game {
    public final Device device;
    public synchronized void gameStart() { ... }
}
public abstract class GameEntity implements Serializable {
    public abstract void create(Game g);
    public abstract void updateAndDraw(Game g, Graphics2D g2d);
    public abstract void destroy(Game g);
}

So far, I have implemented two concrete classes for Device, SwingDevice and J2meDevice, and it's working fine. Now the problem is I want to implement AndroidDevice. Everything will work just fine except for that I have enforced using java.awt.Image and java.awt.Graphics2D to paint Game's graphics offline. Then I forward this Image to the device for rendering.

Is there any way I can absolutely decouple the Device's graphics from the rest of the engine?

I have two solutions but I doubt they'll fully achieve what I need:

Stick with the java.awt.Image. Devices that support OpenGL will not fully utilize their hardware capabilities as drawing is done on CPU. And it might not work on platforms on which can't import java.awt (I doubt their existence).
Create my Graphics2D-like interface. This will make defining new devices harder and again it might hide some of the device's features.


texts: How to enable and disable scripts on a Game Object?

texts:
This worked briefly yesterday, I believe I did something to mess this up. All my inputs that I put in are correct; therefor, it must be the code. I want to switch players. While the red cube's script is enabled and can move under the movement script I want the blue cubes movement script to be disabled and vice versus. Can you give me some insight into what I'm doing wrong? Please and thank you!!

using UnityEngine;
using System.Collections;

public class PlayerMovementScript : MonoBehaviour {

    public float speed = 2f;
    public float height = 2f;

    public Component playerMovement;
    public GameObject redCube;
    public GameObject blueCube;

    void Start()
    {
        var bc = blueCube.GetComponent<PlayerMovementScript>();

        bc.enabled = !bc.enabled;
    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetButton ("Right"))
        {
            transform.Translate(Vector3.right * speed * Time.deltaTime);
        }

        if (Input.GetButton ("Left"))
        {
            transform.Translate(Vector3.left * speed * Time.deltaTime);
        }

        if (Input.GetButton ("Jump"))
        {
            transform.Translate(Vector3.up * height * Time.deltaTime);
        }

        var bc = blueCube.GetComponent<PlayerMovementScript>();
        var rc = redCube.GetComponent<PlayerMovementScript>();

        if (Input.GetButton ("Switch"))
        {
            bc.enabled = !bc.isActiveAndEnabled;
            rc.enabled = !rc.enabled;
        }
    }
}


texts: How do games make fire and smoke effects?

texts: I was wondering around, searching internet about particle system and fire effects but I haven't found any good answers. On some games I have realized that some sort of movie is being shown as the fire, which is pretty good but not for the fires which are close to the viewer. Please let me know how to make realistic fire and smoke effect in a game. Also if you have a good sample code or good description of how to make these kinds of cool fires please note them too.


texts: What engine/technology should I work with to accomplish my unique design goal?

texts:
I'm looking to begin a procedurally generated open-ended sandbox game and would like some educated opinions on a good starting point. (Take a look at the "Engine Specifications" if you don't want to read the whole post) I do not expect there to be an engine/set of libraries that meets all my requirements, but instead meet some essential ones (like rendering/collisions). I realize I will be building many engine components from scratch and appreciate any extra advice you want to include in your answer.
A little background
I am a fairly experienced programmer with intimate knowledge of modern design practices and know most popular programming languages like C++ and C#.
I've dealt with other 3D engines before like the Source Engine (C++) and UDK (UnrealScript) for some personal projects. I'd like to think most of my knowledge is of FPS game design and what the standard components are of FPS oriented game engines.
My design goal
In a nuteshell: I plan for my game to be a procedurally generated open-ended sandbox game that consists of large blocks as the basic geometry. The player will play in the first person.
These uniformly sized blocks will be large enough so that it can act as a segment to a hallway that the player could walk through. A block could also act as a wall to a building, be completely solid, or be completely empty. These blocks are changeable, removable, and placable.
By now this should sound familiar but its important to understand some critical and defining aspects of the game:
Engine Specifications

Blocks themselves contain collisions meshes within themselves; a wall can be placed on any of the 4 sides of the cube and a ceiling/floor on the remaining top and bottom faces.

Example of block collision configurations:

Blocks contain (unless they are empty or fully solid) independent visual meshes on each of their sides that contain collision meshes. They will be relatively simplistic and contain generally low resolution textures (the right resolution would come from benchmarking tests).

No complex shaders, effects, or lighting will be implemented. Only very basic implementations for performance.

Blocks contain basic navigation information and when connected to eachother, form a navigation network of nodes. The blocks themselves act as nodes and their connectivity to other nodes are determined by wall placement and so on.

Basic node based pathfinding will be implemented for AI.

The most challenging aspect will be multiplayer I presume.

Ray tracing

Simple particle engine

Physics simulation not likely, just basic fps movement physics

I realize I have a sizable workload in front of me as most engines are not geared for this type of game and so common design paradigms will be sparse. However, I believe there is an engine out there that I can work with to speed things up.
Game engines I have knowledge of

Gamestudio (clight)
Source Engine (C++)
UDK (UnrealScript)
Panda3D (C++/Python)
Torque3D (C++/TorqueScript)
Unity (C#)

I don't really prefer to use any of the ones I've listed for different reasons (mostly because they're FPS engines), but if you think one of them would be a good choice let me know.
Do you know of a game engine or technology bundle that would best help me implement my specifications? Apologies for the lengthy post.
Note: I wouldn't mind investing a few thousand dollars if it justifies itself.


texts: Turning the Turret towards Player Object

texts:
I  am trying to turn the enemy turret towards player object using the Armory 3D game engine with Blender. The script is written using Haxe. I am using the following code with both the player object and enemy object. Both have their Z values set to be the same (in this case zero):
public function turnTowardsPlayer()
{
var A:Transform = enemyObj.transform;
var B:Transform = player.transform;

var A1:Vec2 = new Vec2(A.loc.x,A.loc.y);
var B1:Vec2 = new Vec2(B.loc.x,B.loc.y);

// Finds the Direction Vector.
var res:Vec2 = B1.sub(A1);
// Calculates the angle to turn the turret.
var rot_Z = PI + atan2(res.x,res.y);
rot_Z = -rot_Z;
trace("  --------  ");
trace("rot_Z  in radians "+rot_Z);
trace( "Rot.Z in degrees " + (rot_Z * 180/PI));
trace("  --------  ");
enemyObj.transform.setRotation(0,0,rot_Z);
}

The above code works well if there is no change in Z value.
Made following changes to take in to account of change in Z value.
var A2:Vec2 = new Vec2(A.loc.y,A.loc.z);
var B2:Vec2 = new Vec2(B.loc.y,B.loc.z);

var res_1:Vec2 = B2.sub(A2);
trace("res_1.Z   " + res_1.y);
var rot_X =  atan(res_1.y/res_1.x);
//rot_X = rot_X;
trace("rot_X  in radians "+rot_X);
trace( "Rot.X in degrees " + (rot_X * 180/PI));
enemyObj.transform.reset();
enemyObj.transform.setRotation(rot_X,0,rot_Z);

The above addition works only for a certain degree of accuracy. When the player moves either far right or far left from the initial position, the enemy bullet misses the player object. In the initial position the player is directly opposite to the enemy and the bullets from enemy hit the player correctly, with Z = 2m (in Blender units).


texts: Moving AutoParallaxBackground's ParallaxEntity in X and Y direction

texts:
Currently I can move AutoParallaxBackground's "ParallaxEntity" in one axis. Like:

final AutoParallaxBackground autoParallaxBackground = new AutoParallaxBackground(0, 0, 0, 12);
autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(0.0f, new Sprite(0, 0, resourcesManager.gameBackgroundRegion, vbom)));
autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(-3.0f, new Sprite(0, 300, resourcesManager.gameCloudFarRegion, vbom)));

This will make the "gameCloudFarRegion" move left to right.

I want to move something from Top to bottom or bottom to top, I mean Y axis.

How can it be done?


texts: Game Loop getting 58-62 FPS. Why not exactly 60FPS? (SDL/C++/OSX)

texts:
Here's my game loop:

uint64 target_fps = 60;
  uint64 ticks_per_s = SDL_GetPerformanceFrequency();
  uint64 target_ticks_per_f = ticks_per_s/target_fps - (ticks_per_s/1000); //aim for (target - 1ms) to err on side of > 60fps

  uint64 ticks_per_cur_f = 0;
  uint64 t_last_render = 0;
  uint64 t_last_update = SDL_GetPerformanceCounter()-target_ticks_per_f;
  int max_updates = 3;
  int updates = max_updates-1;

  while(!done)
  {
    while(
      t_last_update > SDL_GetPerformanceCounter() - target_ticks_per_f &&
      t_last_render > SDL_GetPerformanceCounter() - target_ticks_per_f
    )
    {
      SDL_Delay(1);
    }

    //update
    updates = 0;
    while(updates < max_updates && t_last_update < SDL_GetPerformanceCounter() - target_ticks_per_f)
    {
      t_last_update += target_ticks_per_f;
      updates++;
      pollEvents(); //possibly sets done = true
      simData();
    }
    if(updates >= max_updates) t_last_update = SDL_GetPerformanceCounter();

    if(t_last_render < SDL_GetPerformanceCounter() - target_ticks_per_f)
    {
      ticks_per_cur_f = SDL_GetPerformanceCounter()-t_last_render;
      t_last_render = SDL_GetPerformanceCounter();
      render();
      SDL_GL_SwapWindow(window);
      glFinish();
    }
  }

It's a fixed timestep (to simplify/make consistent any updates).

It essentially just does this:

Wait (SDL_Delay()) until enough time has passed requiring either an update or a render
While "last update" was > 16ms ago, update() and add 16ms to when "last update" was (maxing out at 3 updates assuming it got really far behind)
If "last render" was > 16ms ago, render (and set "last render" to "now")
Repeat

Even when I do nothing in update() or render(), it fluctuates anywhere between 58FPS and 62FPS. Why would this be?
I understand that SDL_Delay only has a fidelity of 1ms, but I even set "target ticks" to be 1ms less than necessary to try to account for this.

Any ideas?

Thanks!


texts: how does server communication work in a flash game with a php backend

texts:
I am trying to create a browser game using actionscript/flash. Currently, I'm trying to understand how I would go about creating a back-end which interfaced with my MySQL database.

As far as I understand, If I create a php file on a webserver called test.php and then navigate to a webpage hosted on the server eg. www.example.com/test, the php script will run and display the result in my browser.

This would use http. Is this how communication between client and server usually works in a flash game? for example, if the game needed to query the db. Would actionscript have to essentially invoke the url of the php script that would execute the query? it could then parse the data and use it.

If this is the case, then is JSON considered a good way to transfer data over http?


texts:
i'm making a game, one npc is a car with spear in head, he try to hit the enemy (yellow pot in image) with the spear point.

here is the promble ,the car is physics-based , it has veloctiy ,max angular velocity ,can turn around the car's center, the npc can only change drive direction. since the positions of car and enemy can be very random (the enemy will not move once respawn), how can the car make the spear hit?


texts: Car licensing if real cars appear in FMV cutscenes?

texts:
We are doing 2D game which will feature Full Motion Video for cutscenes in between the levels. Game is car oriented, although its not a racing game but it will feature some of the driving in it, and we would like to film some real cars for our cutscenes. There will be some "exclusive" cars on our shoot like Porsche, Lambo and Range Rover and we are really concerned about licensing logistics, especially about Porsche and whole EA exclusivity. Bear in mind that no characters will mention cars by its name or model designation and we are ready to remove any badging in post. Still concern is out there.

As far as the driving in game goes we will be using drawn sprites that only resemble physical models to some degree.


texts:
I made a game with OpenGL 4.3(core profile) and C++. I used GLFW3 for window and context management. I am also using bunch of third party library which are also available for linux.

What things do i need to consider if i want to port the game and how can i make it support all windows and linux?


texts: What is the exact difference between the game and game engine?

texts:
I thought game engine are something like Unity or Unreal. They have a editor with scene editor, some Physics library, some scripting editor and tools to improve the workflow of developer. Furthermore, I thought game engine should independent of the actually game.(i.e.) The game engine should not have any game logic in it.

However, I watched this game engine video and I am totally confused. https://www.youtube.com/watch?v=GK7ntA7a2vk . In the game engine video, I don't see the game engine anywhere because it seemed as though the professor developed the game straightaway.

I hope someone can explain the exact difference between a game engine and the actual game.


texts: Using components in the XNA Game State Management example?

texts:
In the game state management example at the App Hub, they say that if you want to use components in the example you can extend the GameScreen to host other components inside itself.

I'm having a very hard time trying to tie this up.
I tried extending the GameScreen class by adding a public property of public List<DrawableGameCompnent> components { get; set; } and then add my components to that list when I initialize the current screen as well as looping over the components in the LoadContent, Update and Draw methods. However, this doesn't feel like the correct way to go - mainly because it doesn't work when I get to the implementation of my GameplayScreen.

Any thoughts?


texts: Computer generated 2d graphics for games - how to get started

texts:
I've seen a lot of nice 2d games recently, like Geometry wars that have really nice computer generated graphics.

I would like to know how is it done so game looks really nice even if it is composed only from really primitive graphic objects. All those lights, glowing particles, transformations etc.

Do you have any tips, info, books, articles that would uncover some details about creating graphics this way?

And what about development for all the mobile platforms, any good frameworks for this kind of work?


texts: What is the workflow of modeling 3D rooms?

texts:
I'm always struggling with creating flexible, reusable rooms for my underground-set games. When creating reusable rooms I have encountered the following problems:

Size - levels can have wildly different sizes and separate objects for all of the sizes seems repetitive and unnecessary
Holes in the room - i.e. windows, doors. There may be rooms with exactly the same size but different placement of doors, windows, etc... that only multiplies the amount of possible combinations

Possible solutions:

Not creating whole rooms but creating separate walls, floors, roofs so I can mix and match in the engine later?

Those parts would still require different sizes, unless I am to put 1 object per square meter or similar

Creating flexible Blender model so I can quickly change it export different variations of the room?

Thanks for any ideas, opinions, experiences


texts: Minimizing bandwidth for player movement

texts:
I am programming a multiplayer game and I am concerned about the bandwidth dedicated to player movement. Imagine a 2D top down game where players can move towards any angle using the joystick. The way I do it currently is to round directional vectors to the nearest 0.25 and send a new movement packet when the vector is different. (meaning a player moves into a different direction) Rounding to nearest 0.25 provides a fairly good approximation and the position is synchronized on every new movement packet because these packets contain the new x,y of the player.

This scheme works well for keyboard controls because this directional vector changes a lot less often than with a joystick. However, when a joystick is rotated quickly, this ups the bps up to around 500 bytes per second. Imagine 100 players packed together in a map, where everyone is quickly moving around using the joystick: 500 bps per player becomes 50000 bps because it has to be sent to every other players. Multiply this by 100 for each players, and you have about 5 megabytes of just movement packets being transferred every second.

Is there any way I can do more prediction on the client and greatly reduce bandwidth?


texts: Help w/ iPad 1 performance for tile-based DOM Javascript game

texts:
I've made a 2D tile-based game with DOM/Javascript. For each level, the map data is loaded and parsed, then lots of tiles ( elements) are drawn onto a larger "map" element. The map is inside of a container that hides overflow, so I can move the map element around by positioning it absolutely. Works a treat on desktop browsers, and my iPad 2.

My problem is that performance is really bad on iPad 1. The performance hit is directly related to all the tile elements in my map, because when I remove or reduce the number of tiles drawn, performance improves. Optimizing my collision detection loop has no effect.

My first thought was to batch groups of tiles into containers, then hide/show them based on proximity to the player, however this still causes a huge hiccup when the player moves and a new group of tiles is displayed (offscreen). Actually removing the out-of-sight elements from the DOM, then re-adding them as necessary is no faster.

Anyone know of any tips that might speed up DOM performance here? My map is 1920 x 1920 pixels, so as far as I know should be within the WebKit texture limit on iOS 5/iPad. The map is being moved with CSS3 transforms, and I've picked all the other obvious low-hanging fruit.


texts: Sprite vs 3d Model in Flash Facebook Game

texts:
I'm looking at creating a real time strategy/tower defense mashup game for facebook (and other platforms like google+) along the same feel, but of course different mechanics, as backyard monsters.

The model animations will hopefully be fairly thorough, with maybe three different animations (walking, attacking, resting) and 30 different monsters to model. The models themselves will be VERY simple and likely low texture since I'm not an animator, so I'm looking for the solution that's the best balance between ease of use and processor cost.

When creating a game like this is it generally better to go a full fledged 3d model route for the "monsters" or is it better to model the animations in an external editor and turn them into a sprite?


texts: How can I prevent text rendering from looking ugly when in motion?

texts:
I'm drawing a name above the player's head in a 2D top-down view game. The code to draw the string looks like this:

Vector2 textPos = new Vector2(
  (positionX * 2 * world.Map.TileWidth + (16 -(SmallFont.MeasureString(mName).X / 2))),
  (positionY * 2 * world.Map.TileWidth - 32));

spriteBatch.DrawString(SmallFont, mName, textPos, Color.White, 0, Vector2.Zero,
  1, SpriteEffects.None, 1);

The text is drawn to the position right above the player's head just fine, and it follows the player as he moves just fine as well. But the problem is that when the player moves, the text kind of gets thicker and ugly. I tried screen capping it but the screenshot doesn't capture the problem (because it's just taking a single frame, I presume).

How can I fix this?


texts: How to set widget size that is independent of screen resolution/density in kivy

texts:
I had coded a simple click game with Python-kivy to android.

You should click dots which are popping out randomly at screen. I set their size 20px to 60px as your level. But it seems when I try on different device screen resolution change the hardness of game. low resolution phones have higher change. I also look at some game (2048 - piano tiles etc) they are also have the same problem.

Should I keep ignore the resolution or try to solve this problem? If so how?


texts: How to make variables restart when the game restarts?

texts:
My game is all in one scene so when my player dies and the user clicks restart the game (when it shows the game over screen) the script below doesn't restart with it so the enemies are still going fast when the user is replaying the game. How do I make it restart when the game restarts?

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

This is used in my score script. The Movement.movespeed is a reference to my movement script attach to my enemies making them go faster when the player collects 10 points.


texts: Framebufferobject crashes when I do pop without resetting the framebuffer to the original

texts:
glPushAttrib(GL_ALL_ATTRIB_BITS);
glBindTexture(GL_TEXTURE_2D, 0);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
gl::drawFilled(mesh_);
//glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

glAssert();
glPopAttrib();
glAssert(); // <= crashes here

If I uncomment the line //glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); it works, how come?


texts: Can drawing to an FBO be done purely with a depth input texture, or do I also need a color attachment?

texts:
I am trying to implement Exponential Shadow Maps and I've got it almost working. The part I am stuck on is the "optional" separable Gaussian blur of the depth map to give soft-looking shadows.

I am using an OpenGL Framebuffer Object attached to a temporary depth map, and I am trying to use a screen quad (two triangles) with the original depth map as an input texture. Then, I am doing the same for the second stage of the blur, with the input and output reversed. Unfortunately, this results in a depth buffer filled with 1.0 which suggests to me that nothing is being drawn.

In this example code I've found, they are using a color and depth attachment in order to draw to a screen quad with a blur shader. (unfortunately the only OpenGL example I could find)

I want to know if this is necessary or that they are only attaching and blurring the color buffer because they are storing their depth values in it.

In other words, I would like to know if it is actually possible to only use a depth buffer Framebuffer Object attachment in this scenario.


texts:
I am importing an extremely detailed mesh (provided by a client) and it consists of something like 16 million triangles. For rendering performance I've been using the ID3DXMesh interface's Optimize and OptimizeInPlace methods. I'm using GenerateAdjacency with an epsilon of around 0.0025, and there doesn't seem to be much optimizing going on. Even with an epsilon of around 50.0 there's no significant increase in performance.

Am I misunderstanding Optimize? Isn't it supposed to get rid of unused faces based on the adjacency buffer? If that isn't the case, what other methods/algorithms/libraries could I use that would reduce level of detail?

Here's my code:

this->m_pMesh->GenerateAdjacency( 0.0025f, l_ulpAdjacencyBuffer );
this->m_pMesh->OptimizeInplace( D3DXMESHOPT_COMPACT | D3DXMESHOPT_ATTRSORT |D3DXMESHOPT_VERTEXCACHE, l_ulpAdjacencyBuffer, 0, 0, 0);


texts:
I've spent a lot of time working with perlin/simplex noise for different styles of map gen, but I'm having a hard time finding advice/resources on how to populate the map with "world decor" that have some patterns to them... not just a random flower or tree.

I can control where on the map they spawn based on the height/temp values, but what are some good ways to control "patterns" the items spawn in?

For example, I want a specific plant to always spawn in clusters, but I want it to look natural and random - a bunch all together in a cluster and some individuals further out. I don't want all spawn instances to look the same.

A good reference is the Minecraft ore spawner - they're always in random configurations with some min/max size variations. Larger veins are even more rare.


texts: How can I make different levels in a game?

texts:
Let's say I was working on a platform game. Each level has an exit. When the player reaches the exit, the game switches to the next level.

What would be the best way represent and switch to the next level?

One idea I had is to make a Level class. This class handles most of the game logic and has most of the program's code, but doesn't paint anything on the screen.

For each level, I create a class that extends (inherits) Level class. All of these classes would inherit everything from Level, but paint different things on the screen.
When the player finishes a level, finishedLevel() method is activated inside class Main, and this class creates an instance of the next level.

Is this approach reasonable, or is there a better one?


texts: Particle trajectory smoothing: where to do the simulation?

texts:
I have a particle system in which I have particles that are moving to a target and the new targets are received via network. The list of new target are some noisy coordinates of a moving target stored in the server that I want to smooth in the client.

For doing the smoothing and the particle I wrote a simple particle engine with standard euler integration model.

So, my pseudo code is something like that:

# pseudo code

class Particle:
    def update():
        # do euler motion model integration:
        # if the distance to the target is more than a limit
        # add a new force to the accelleration
        # seeking the target,
        # and add the accelleration to velocity
        # and velocity to the position

        positionHistory.push_back(position);
        if history.length > historySize :
            history.pop_front()

class ParticleEngine:

    particleById = dict() # an associative array
                          # where the keys are the id
                          # and particle istances are sotred as values

    # this method is called each time a new tcp packet is received and parsed
    def setNetTarget(int id, Vec2D new_target):
        particleById[id].setNewTarget(new_target)

    # this method is called each new frame
    def draw():
        for p in particleById.values:
            p.update()

            beginVertex(LINE_STRIP)
            for v in p.positionHistory:
                vertex(v.x, v.y)
            endVertex()

The new target that are arriving are noisy but setting some accelleration/velocity parameters let the particle to have a smoothed trajectories.

But if a particle trajectory is a circle after a while the particle position converge to the center (a normal behaviour of euler integration model).

So I decided to change the simulation and use some other interpolation (spline?) or smooth method (kalman filter?) between the targets. Something like:

switch( INTERPOLATION_MODEL ):
    case EULER_MOTION: ...
    case HERMITE_INTERPOLATION: ...
    case SPLINE_INTERPOLATION: ...
    case KALMAN_FILTER_SMOOTHING: ...

Now my question: where to write the motion simulation / trajectory interpolation? In the Particle? So I will have some Particle subclass like ParticleEuler, ParticleSpline, ParticleKalman, etc..? Or in the particle engine?


texts: Hemicube algorithm d3d9 or d3d11, float valued colors

texts:
The hemicube algorithm renders the scene to 5 sides of a half-cube, from the perspective of each polygon.

Assume you place the hemicube around me and render to the 5 sides.  The idea is, we can see exactly how much of each other polygon in the scene I see, and so determine the amount of light I receive from those respective polygons.

The way I did this before was using DWORD colors, and assign a different (integer) color to each poly, called its id.  This allows for 16M colors using DWORDS.  It worked fine with the fixed function pipeline, because I was able to choose D3DDECLTYPE_D3DCOLOR in the vertex declaration, render to texture, and tally up the polygon coverage counts.

Now that I've switched over to shaders, I can't seem to make DWORD colors work anymore.  All that works is 3x 32-bit float-type colors (I am using Cg, so float4's.)

Is there a way to force D3D9 or D3D11 to use integer colors in a shader, and if not, how can I guarantee the colors I choose as "ids" for the respective polygons will end up being distinct colors in the texture I render to?


texts: How can I get rid of "missing DLL" problems?

texts: I made some games with Visual C++ 2015 and OpenGL. When I ran it on my machine there was no problem, but when I ran it on other machines it shows that some DLLs are missing. I want to know how to make sure that it won't happen next time and what things should I consider so that I can avoid file missing problems?


texts: What exactly does XMMatrixPerspective{L,R}H do?

texts:
There are generally three functions to create a perspective matrix in DirectXMath, XMMatrixPerspective{L,R}H, XMMatrixPerspectiveFov{L,R}H and XMMatrixPerspectiveOffCenter{L,R}H. I'm kind of confused what XMMatrixPerspective exactly does.

I'm currently generating a perspective matrix using

DirectX::XMMatrixPerspectiveFovRH(to_rad(80.0f), (float)winX / (float)winY, 0.1f, 100.0f);

which works fine, I can see the cube I'm drawing in front of me. If I replace this with a DirectX::XMMatrixPerspectiveRH(winX, winY, 0.1f, 100.0f), I don't see anything on the screen. So the question is, what exactly does the matrix represent? What is it's field of view? And why don't I see my cube? If this function uses some sort of default fov value, I'd expect to see my cube - even if possibly stretched - as my view matrix looks straight at it.

Unfortunately, the docs only say "creates a projection matrix" but nothing about how one is supposed to work with that matrix.

E: I figured out, I'm not supposed to pass the window coordinates. It expects the size of the near-clipping plane. However after playing around for a bit with values, how is this function supposed to be used? I really can't see any reason to use this over the one where you pass in a fov.


texts: How to avoid subpixel values in a resolution independent 2D game with orthographic projection?

texts:
I'm trying to do resolution independent rendering of moving sprites in a 2D game. My plan is work in a fixed coordinate system in my world (for example 960x540) and use orthographic projection to scale that up or down to fit the viewport. I do letterboxing to handle different aspect ratios.

According to most tutorials, I am free to use whatever dimensions I like for the view frustum, but I found that in many cases that leads to the problem that I end up using subpixel values on the viewport. For example a vertex at (62,62) in a coordinate system of 960 x 540 ends up at (51.6666667,51.6666667) on a viewport with the dimensions 800 x 450.

I noticed two kinds of problems with that:

the texture sampling changes all the time for objects that are in motion depending on where the vertices are in relation to a pixels center
my objects get stretched horizontally or vertically by a pixel from time to time due to rounding

What is the best practice to avoid this (while maintaining resolution independence in terms of movement speeds and so on)? And where would be the best place to do address this? Before passing the vertices to the shaders or inside the vertex shader?


texts: how to sync two players to start at the same time for a head-to-head networking game?

texts:
I am developing a game similar to "Street Fighter" and two players can fight each other via Internet.

The networking model is "lockstep" by trying to sync user controller status for each frame.

When a game starts, the basic sequences are:

Random matching
Game Start
Player A sends out a message to B every 30ms, and vice versa.

The question is, in step 2, "Game Start", these two players must start at the same time "physically".

I am thinking to negotiate a timestamp (based on UTC) for two players to start the game right upon it. However, I am suspecting the timestamp might be device dependent. Maybe it's possible for a device to report a timestamp that is 10 seconds or 100 seconds behind the other player.

Therefore, I am wondering what's the best solution for this kind of situation when implementing a networking game like this (no server involved)?


texts: 2D SAT How to find collision center or point or area?

texts:
I've just implemented collision detection using SAT and this article as reference to my implementation. The detection is working as expected but I need to know where both rectangles are colliding.

I need to find the center of the intersection, the black point on the image above. I've found some articles about this but they all involve avoiding the overlap or some kind of velocity, I don't need this.

I just need to put a image on top of it. Like two cars crashed so I put an image on top of the collision. Any ideas?

## Update

The information I've about the rectangles are the four points that represents them, the upper right, upper left, lower right and lower left coordinates. I'm trying to find an algorithm that can give me the intersection of these points.


texts: 360 degree Shooting using Pythagoras problem Unity 2D C#

texts:
I have used pythagoras to give the bullet a velocity in the bullet class. Velocity is applied when Instantiated();

 private Rigidbody2D rB;
 private Vector2 velocity;
 private float bulletSpeed = 15f;

 rB.velocity = new Vector2(bulletSpeed * (Mathf.Cos(transform.rotation.z)), bulletSpeed * (Mathf.Sin(transform.rotation.z)));

I call the instantiation from the Gun class.

if (Input.GetButtonDown("Fire1"))
        {
            bullet = Instantiate(bullet, bulletObjectPos.transform.position, transform.rotation);
        }

Its giving me funny velocities for the angle i shoot from when the placeholder Gameobject class is rotated, shown below:

Do i need to do more to the velocity? like conversions to radians or something? Or is doing the Pythagoras thing all wrong. I've been scouring the internet all day.Thanks for any help.

The 'Bullets' travel from the muzzle to their location on the images


texts: Changing DisplayMode seems not to update Input&Graphic Dimension

texts:
I'm writing a small game using Slick and Nifty-GUI.
At the program startup I set the DisplayMode using the following lines:

AppGameContainer app = new ...
app.setDisplayMode( 800, 600, false );
app.start();

I wrote a Nifty-ScreenController for my settings dialog in which the user can select the desired DisplayMode. When I try to set the new DisplayMode within this controller class the game window gets resized correctly but the Graphics and Input objects aren't updated accordingly. Therefore my rendering code just uses a part of the new window.

I tried to set different DisplayModes in the main method to test if it's generally possible to invoke this method multiple times. It seems that changing the DisplayMode only works before I call app.start().

Furthermore I tried to update the Graphics & Input object manually but the init and setDimensions methods are package private. :(

Does someone know what I'm doing wrong and how to change the DisplayMode correctly?


texts:
I'm having a problem with the generation of a shadowmap that is converted to RGBA. The following glsl code is used to put the depth into the depthbuffer :

/**
 * float/rgba8 encoding/decoding so that we can use an RGBA8
 * shadow map instead of floating point render targets which might
 * not be supported everywhere
 *
 * http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
 * http://www.gamedev.net/topic/486847-encoding-16-and-32-bit-floating-point-value-into-rgba-byte-texture/
 *
 * Only store values between 0.0 and 1.
 */
vec4 encodeDepth(float floatValue) {
    const float toFixed = 255.0 / 256;
    vec4 comp;
    comp.r = fract(floatValue * toFixed * 1);
    comp.g = fract(floatValue * toFixed * 255);
    comp.b = fract(floatValue * toFixed * 255 * 255);
    comp.a = fract(floatValue * toFixed * 255 * 255 * 255);
    return comp;
}

float decodeDepth(vec4 rgba) {
    const float fromFixed = 256.0 / 255;
    float val = rgba.r * fromFixed / (1);
    val += rgba.g * fromFixed / (255);
    val += rgba.b * fromFixed / (255 * 255);
    val += rgba.a * fromFixed / (255 * 255 * 255);
    return val;
}

The code that creates the depth buffer is the following:

bool DepthBuffer::init(const glm::ivec2& dimension) {
    _dimension = dimension;

    glGenFramebuffers(1, &_fbo);
    GL_setName(GL_FRAMEBUFFER, _fbo, "depthfbo");
    ScopedFrameBuffer scopedFrameBuffer(_fbo);

    glGenTextures(1, &_depthTexture);
    GL_setName(GL_TEXTURE, _depthTexture, "depthtexture");
    glBindTexture(GL_TEXTURE_2D, _depthTexture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, dimension.x, dimension.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    glBindTexture(GL_TEXTURE_2D, 0);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _depthTexture, 0);
    GL_checkError();

    const GLenum drawBuffers[] = { GL_COLOR_ATTACHMENT0 };
    glDrawBuffers(SDL_arraysize(drawBuffers), drawBuffers);

    const GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if (status != GL_FRAMEBUFFER_COMPLETE) {
        Log::error("FB error, status: %i", (int)status);
        return false;
    }

    return true;
}

I am calculating the light space positions in the worlds vertex shader like this:

v_lightspacepos = u_light * worldpos_vertex;

u_light is a the projection*view matrix of the sun light camera.

v_lightspacepos is then used to perform the shadow sampler lookup via:

vec2 calculateShadowUV() {
    // convert from -1, 1 to tex coords in the range 0, 1
    vec2 uv = v_lightspacepos.xy / v_lightspacepos.w;
    return uv * 0.5 + 0.5;
}

float calculateShadow(float ndotl) {
    vec2 smUV = calculateShadowUV();
    float depth = v_lightspacepos.z;
    return sampleShadowPCF(u_shadowmap, smUV, u_screensize, depth, ndotl);
}

calculateShadow is then used like this:

float ndotl = dot(normal, u_lightdir);
float shadow = calculateShadow(ndotl);

The sun light camera projection matrix is calculated like this:

static const glm::mat4 normalizeDepth = glm::scale(glm::translate(glm::mat4(), glm::backward), glm::vec3(1.0f, 1.0f, 0.5f));
_projectionMatrix = normalizeDepth * glm::ortho(bbox.getMinX(), bbox.getMaxX(), bbox.getMinZ(), bbox.getMaxZ(), nearPlane(), farPlane());

Does anyone see anything wrong here? I'm debugging this code since days now and am not able to identify the problem. See the attached screenshot for the error. The black area will move with the camera. Shadows are (somewhat) working except for the black area and the "wrong" shadowmap.


texts:
My game loop uses a fixed time step to do "physics" updates, say every 20 ms. In here I move objects. I draw frames as frequently as possible. I work out a value between 0 and 1 to represent the proportion of the physics tick that is complete and interpolate between the previous and current physics state before drawing. It results in a smoother game assuming the frame rate is higher than the physics update rate.

I am currently doing the collision detection in the physics update routine. I was wondering should it instead take place in the interpolated draw routine where the positions match what the user sees? Collisions can result in explosions by the way.


texts: is there an easier way to do this? perhaps a formula?


texts: Unity Shader: Make water on terrain transparent without fading

texts:
I want to create a shader for a terrain to make the water fully transparent but not invisible or faded.

In this example I would want the purple square to be seen through water but not through the land.

I want the water to look exactly the same as before.

I want objects underneath the terrain to be visible through the water.

I already have a shader to make objects underneath the water look like they are seen through water.

I want to use a single camera as I would need a slow script on each of the cameras.


texts: How to scale an object in one direction without moving the opposite edge?

texts:
I am using Unity. In my game, I have an SpriteRenderer and I'd like it to increase its size

I'd like it to lengthen to the right, without moving the left edge.

I tried changing its scale to something bigger than its original scale and it changes into something like this, growing to both the left and the right:

I also tried to increase its position together with its scale but then it didn't work.

  Editor's note: this is where you tell us how it "didn't work". What exactly did you try, what results did you get, and how did those results differ from what you wanted?

My Object is configured like this in UnityEngine:


texts: When does OpenGL Perform Perspective Divide

texts: When does OpenGL divide by W? Is this done automatically within the vertex shader? It is my understanding that the vertex shader outputs the final vertex position, so I presume no transformations can be made after this point...


texts: SDL2: Unable to get center of screen when drawing more than one texture?

texts:
so I've been trying for the last four hours to get this to work and although I can get to the center of the screen when printing one texture using:

TextureManager::getInstance()->drawTexture("block_brown",
    SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - 101 / 2,
    SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 /2,
    101,
    171,
    Game::getInstance()->getPrimaryRenderer(),
    SDL_FLIP_NONE);

I get the following result:

I can keep the center of up to two textures in a row and after that it gets out of hand and I completely lose it. I'm using the following for the two:

for (int i = 0; i < 2; i++) {
    for int j = 0; j < 2; i++) {
        TextureManager::getInstance()->drawTexture("block_brown",
            SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - i * 101,
            SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 / 2,
            101,
            171,
            Game::getInstance()->getPrimaryRenderer(),
            SDL_FLIP_NONE);

which produces the following result:

As you can see, it looks to be in the center of the window, but if I try to add more than two in a row or more than one in a column, I then have to start fighting it to keep it in the center.

So my question is, how would one manage to get the textures to stay central, no matter how many I add?

EDIT:

This is the final result I'm ultimately looking for:

When I start trying to add layers I then have to start fighting it again to keep it central?

This the result I'm having right now:

The more I think about this, the more I think I'm going completely the wrong way and doing it completely wrong.


texts: Should developers make their games easier with new versions?

texts:
It seems that the game Angry Birds is becoming gradually easier with new versions. Maybe so people get the illusion of progress and satisfaction of breaking new records?

I would like to know if gradual small modifications of games to enhance the sense of improvement and learning by users is known/common/standard practice in game developing. (I don't mean to say that there is anything wrong with such a practice.)


texts: What are names like "net.minecraft.blocks" called?

texts: I'm trying to find these types of names for certain Minecraft blocks to add them to a block whitelist for one of my mods. Is there an actual name for these? If not, how would I go about finding a list of or searching for them?


texts: Help me to fine tune my diamond-square algorithm

texts:
Check this map i generated:

I seeded a sine wave to act as a mountain range. The lower portion of the sine wave looks fine, but the upper side is thin, the algorithm did not do its magic there (expanding with some noise the seeded values to generate wider mountain ranges and then some hills (brown and light brown)).

Also, the whole continent shape is not affected by the sine wave. Ideally, it should be like a "S" as the mountain range pretends to be.

I bet this is how the diamond square algorithm takes the values it uses to make the average.

If not seed the center point of the map,  i can not generate a continent, it just makes a pelinesque noise of random hills.

Basically, i'm having some hard time trying to control the noise with seeds and toying with amplitude and randomness reduction values.

I need some experienced people in world generation and noise to help me out!

Thanks!

(PS: red dots are rivers).


texts:
I stumbled across this game on itch.io: Backland
After trying to find information on how to accomplish the same graphics, I found this tutorial: Youtube Video

How can I accomplish this 3-dimensional, pixelated look in a game?

Other possibly relevant information:
I have been using the Godot engine, but I would appreciate information that can be used anywhere
I am well versed in programming, but I am new to everything else related to game development


texts: How can I get multiple bullets on screen?

texts:
I've finally gotten this laser thing to work for my Space Shooter, and so far I've come across a slight problem. I've gotten the laser to position itself at the starting position correctly and move vertically perfectly. Anyway, whenever I hit the space-bar (which is the controls for shooting), it shoots the bullet/laser out, but I have to wait until the bullet clears to shoot another one.

What I want it to do is keep producing bullets until the user releases their hand on the space-bar... here's the code I have so far:

if(spacebar)
// this bool variable is set to true once the user presses the space bar
{
    int frame2 = 0;

    if(once2 == 0)
    {
        projectilex2 = x + 19;
        projectiley2 = y + -35;
        //Positions the bullet at the nose of the ship
    }

    if(frame2 == 3)
    {
        frame2 = 0;
    }

    apply_surface(projectilex2, projectiley2, ShootStuff, screen, &lazers[0]);

    frame2 ++;
    projectiley2--;

    once2++;
    if(once2 == 250)
    {
        once2 = 0;
        spacebar = false;
    }
 //This will eventually get better. My shoot function is horrible lol :/
}

Does anyone have any ideas as to how I can accomplish this without having to wait for the bullet to clear before I can shoot another one :( ?


texts:
Hi so I have this tile set generated procedurally at the start of the scene. When I activate the point light in the middle of the screen I keep getting this grid in the game view, i tried changing the size of the tiles but no luck if I change them before pressing play in the game view.
But if I do it at run time from the inspector the bug goes away , hiding the square of the tile that I have moved...for that tile in particular even just moving it a bit solves it.
This happens in edit and game mode ,and the grid is made of loads of sprites put together.
The import settings of these sprites is dont generate mip maps, no compression. And each of the tiles have the default shader sprite diffuse.
I deactivated gizmos but no luck either

Any idea what can this be ? anything related with baking the light or something? thank you for your help!


texts: How to set the user mass data of dynamic body in andEngine. My problem is that in my game when i increase the speed of running player, the player on jump cover very long distance with x-axis. This distance changes with the speed. Any solution please..


texts:
I'm trying to create a clickable object. I wrote a pseudo code to try it. When I add a new member to object it works fine, that is when I hold the mouse cursor on the rectangle determined it returns true even it's moved around. But once the rectangle moves out of the visible area and returns back to the visible area, the if statement  return false when I hold the cursor on the rectangle determined(I'm using an int variable for camera effect.). I'm using SDL 2.0.3.

This is the loop:

multiset<IDrawable*, Drawable_compare> objects;

for(auto i = objects.begin(); i != objects.end(); ++i)
{
  if((*i)->Collision(*MouseX, *MouseY) == true)
  {
    (*i)->Update();
    cout<<"true"<<endl;
  }
  else
  {
    cout<<"false"<<endl;
  }
}

These are the base and derived classes:

class IDrawable
{
public:
  IDrawable();
  virtual ~IDrawable(void) = 0;

  virtual bool Collision(int Mouse_X, int Mouse_Y) = 0;
};

.

class Object1: public IDrawable
{
public:

  Sprite *Object1 = new Sprite(
    sdl_set->GetRenderer(),
    "data/Trees/Tree1.png",
    X_pos, Y_pos,
    100, 200,
    CamX, CamY,
    SelectionRect(0, 0, 100, 200) );

  bool Collision(int Mouse_X, int Mouse_Y)
  {
    return (Object1->MouseOver(&Mouse_X, &Mouse_Y));
  }
};

This is the sprite class:

class Sprite
{
public:

  void CSprite::Update()
  {
    SelectionRectangle.SetX(rect1.x + *CamX);
    SelectionRectangle.SetY(rect1.y + *CamY);
  }

  bool CSprite::MouseOver(int *MouseX, int *MouseY)
  {
    return !(
       ( (SelectionRectangle.GetRectangle().x + SelectionRectangle.GetRectangle().w )
          < *MouseX )
    || ( *MouseX < SelectionRectangle.GetRectangle().x )
    || ( ( SelectionRectangle.GetRectangle().y + SelectionRectangle.GetRectangle().h )
          < *MouseY )
    || ( *MouseY < SelectionRectangle.GetRectangle().y) );
  }
};

This is the class to determine a selectable area:

class SelectionRect
{
public:

  SelectionRect(int x, int y, int w, int h);
  ~SelectionRect(void);

  SDL_Rect GetRectangle() { return SelectRect; }

  void SetX(int x) { SelectRect.x = x + OffsetX; }
  void SetY(int y) { SelectRect.y = y + OffsetY; }

  void SelectionRect::SetRectangle(int x, int y, int w, int h);

};

What might be causing this? How can I correct my code?

Thanks.

Edit : I did some trial and error work and found out that when I use the alternative MouseOver() function no problem occurs. What do you think the reason is?

My Draw() function for objects:

void CSprite::Draw()
{
    Camera1.x = rect1.x + *CamX;
    Camera1.y = rect1.y + *CamY;

    SDL_RenderCopy(renderer,image, NULL, &Camera1);

}

Alternative MouseOver function:

bool CSprite::MouseOver(int *MouseX, int *MouseY)
{
        cout<<"Called"<<endl;

        return !(Camera1.x + Camera1.w < *MouseX || *MouseX < Camera1.x || Camera1.y + Camera1.h < *MouseY || *MouseY < Camera1.y);
    }


texts:
My question is pretty general. What is the simplest way to code an RNG system or algorithm that easily accommodates additions and changes? For example, let's say I have an RNG system that will spawn an item based on the random value that is rolled. Then I guess some basic, slapped-together solution could look like

if (randomNumber > 0 && randomNumber <= 0.2)
{
    // spawn something
}

if (randomNumber > 0.2 && randomNumber <= 0.4)
{
    // spawn some other thing
}

or for the chance to spawn multiple items, maybe

if (randomNumber < 0.4)
{
    // spawn something
}

if (randomNumber < 0.2)
{
    // spawn some other thing
}

Now, let's say I add lots and lots of possible items that can spawn in the game. It would be a hassle to go back and modify all these values while maintaining their relative rarities, etc. How do I make a more flexible RNG system?


texts: Load scene without being in build settings and without using AssetBundle

texts:
This is the closest I've gotten:

    EditorSceneManager.OpenScene(
        AssetDatabase.GUIDToAssetPath(
            AssetDatabase.FindAssets(
                "t:SceneAsset " + MenuSceneName,
                new string[] { "Assets" }
            )[0]
        )
    );

However this generates an error at runtime:

InvalidOperationException: This cannot be used during play mode, please use SceneManager.LoadScene()/SceneManager.LoadSceneAsync() instead.

I can't follow its suggestion because those functions require the scene to be in build settings or an asset bundle. So, is there any other option?

I wonder how (and if) Addressables achieve this? Note: I'm not willing to switch to Addressables - I'm quite enjoying working with AssetBundles.

Why?

My game uses AssetBundles for general loading of EVERYTHING, so there's only one blank scene in build settings. However, during development I'd rather not have to continuously build and load from AssetBundles, so I'm trying to dynamically load scenes WITHOUT having to add them to build settings.


texts: Dealing with more complex entities in an ECS architecture

texts:
Preamble: I'm working on a level editor for my engine, which uses an ECS architecture. I have around a dozen component types so far, mostly dealing with graphics, like lighting components, model, and other mesh related things like skeleton and collider components.

My engine only supports 1 of each component type per entity, and systems can deal with optional components as well.

Today I realized I was uncertain on how I should tie-together the building block components used for basic entities into a more complex one.

For example, let's say I want to make a torch / flaming stick, using the components found in a model entity and a lighting entity.
If the model's origin is in the center of the shaft, then the light and fire would appear at the center of the model.
Further, if I wanted a weird torch with fire on one end of the stick and smoke on the other, they would both need different offsets before rendering.

Do I need to create a system just for torch's, adjusting all the components to fit the model? This doesn't sound like it scales well to different models needing 'decorations'.

Should I instead be creating an attachment component, with its own offset variables? What dictates which components of an entity use the offset? Should I be making attachment types for every component type that could need an offset?
Or rather should most components just have a spatial offset as another parameter the user can control?

Anyone know any commonly used solutions?


texts: How to make the bounced light brighter in unity?

texts: I'm using indirect lighting to lit a room. The light is coming through the window, but still the inside is too dark compared to the real light . if i bring up the environment or light intensity, it will look the exterior is burnt out ( too bright)... it's already on the limit. How to just make the bounced light (indirect light) brighter ?


texts:
Im just starting to code my game in unity and have been reading up that rpc calls are not validated and can run havoc on the server. For example a modified client can connect to your server and just disconnect everyone by sending:

networkView.RPC("disconnecteverybody", RPCMode.All);

[RPC] void disconnecteverybody () {
Network.Disconnect();
}

Is there a way to validate packets?


texts: What are the pros/cons of using a 3d engine for 2d games?

texts:
What pros or cons should a beginner be aware of when deciding between a 2d game engine (like Slick2D/Flixel/FlashPunk) and a 3d engine (like Unity) for 2d game development?

I am just getting started in indie game development, though I have dabbled a bit with Game Maker, Flash, and XNA in the past. I've heard a lot of positive things about Unity, and its cross-platform nature makes it appealing, but as I understand, it's a 3d engine at its core.

For a strictly 2d game, are there any compelling reasons to work with a 3d engine like Unity? Or would it just add unneeded complexity to my initial learning experience?


texts:
I have been using them as a black box for a while, I'm just learning about of the maths but I'd just like some definitive answers to this question.

So far the only benefit I've come across personally is the ability to SLERP between two angles - to achieve the same effect with a vector you need quite an ugly work around (intrinsically linking 0 and 2PI together).


texts: Correcting imported animation to avoid hand going through the face of character

texts:
I've imported an animation from Mixamo called standing draw bow.
When I use it with my character in Unity the hand goes through the face of my character.
Is there a way to move hand a little outside the face of the character using Blender or Unity?  Or am I required to make up the animation myself?
I tried modifying parameters Mixamo offers but doesn't resolve the problem.
I actually tryed to solve the problem with IK by adding a Multi-Parent constraint ( cause i didn't manage to have multi-postion constraint to work ) and tried to move lowerarm_r Bone a little bit off the face of the character but it only did force the bow to stay in the position and rotation of the "Target" while being buggy in certain keyframes. my aim is to force that bone to not rotate more than certain degree to not go through the face while executing the animation. I believe the problem is coming from the fact that animation is made for normal head character not big head ones.


texts: Net code: What are your expected and max latency and packet loss targets?

texts:
When doing the net code for a video game what sort of latency targets and packet loss rates do you design around?

To be more specific I have my net code working local network only at the moment.  I plan on using WANEM to simulate packet loss and latency but I am not sure what I should use for max and average values.


texts: C# - XNA - Making a Modular Screen / State Manager

texts:
I'm not entirely sure how to ask this question since its somewhat broad, but also a bit specific to my code.

I'm making a game in C# XNA and attempting to have the parts of it be fairly modular so that they can be used in any other relevant programs I create down the road.  For instance, I have an InputHandler accessible from any class in my program that simply checks the state of the keyboard and mouse and has various methods to find out specifically if a key / button is held down, pressed, or released, etc.

The groundwork of my program was made by following these tutorials:
Part 1
Part 2
and Part 4

(Its not a mistake that I don't have a link to part 3 as that dealt with adding in Xbox 360 gamepad functionality only, which isn't something I needed in my testing.)

In those tutorials there is a GameScreen Game Component made which is what all the other screens / states inherit from.

The way the tutorial handles screen management is that a type of screen is created in the Game1 class and then only in the Game1 class can you Hide / Show a screen or change which screen is active.

For instance, when the program is first run in the LoadContent section of Game1 a StartScreen(which inherits from GameScreen) is created.  The StartScreen is then set to be the ActiveScreen and is set to Show.

My problem is that in my StartScreen I'm handling the checks for what menu option a user selects, but I can't actually hide the current screen and change to the one that was selected because that can only be done from the Game1 class.

I could just handle all of my input checking for the different screens in the Game1 class by using an if statement based on not only what menu option is selected, but also what screen is active, but that would mean a lot of clutter in my Game1 class and it would kind of ruin my goal of making my game components modular by having all of the stuff relevant to a given screen being handled within that screens code.

My question is essentially what I should do to address this...

I tried several times to make a separate ScreenManager Game Component that is accessible from everywhere much like my InputHandler, but each time that ended in disaster with numerous errors that I simply don't have the experience or grasp on lingo to troubleshoot.

My most recent attempt at making a separate one ended with me being able to choose which screen was active, but not being able to use the ".Hide()" method that is part of the GameScreen base class.  I also had numerous "accessibility" errors.

I also tried to simply make my screens themselves be public.  For instance, in my Game1 class I have variables for GameScreen activeScreen and StartScreen startscreen.  I've tried making those two variables be Public or even Public Static, but I still couldn't use them anywhere outside of Game1.

I've looked at numerous other posts and tutorials on making a Screen Manager or how to handle State Management, but that only served to confuse me more.  They were either WAY over my head, like the Microsoft State Management sample, or they were understandable and working, but far too different from the one I have now for me to grasp how to apply it to my current code.

Is there something easy and obvious that I'm stupidly overlooking or is there some key concept at work that I'm unaware or failing to grasp?

Or am I going about it all in the wrong way entirely?


texts:
After extensive Googleing I have not come up with a way to access Apple ID's or Google ID's from unity running in respective devices. Either ID's or something else unique to the accounts logged in.

I dunno if this is possible with unity or maybe a plugin exists. If not how would you go about getting this.


texts: How can I read texel data on a separate thread in D3D11?

texts:
In D3D10, I load a staging texture onto my GPU memory, then map it in order to access its texel data on the CPU. This is done on a separate thread, not the thread I render with. I just call the device methods, and it works.

In D3D11 I load the staging texture onto my GPU, but to access it (i.e. Map it) I need to use the Context, not the device. Can't use the immediate context, since the immediate context can only be used by a single thread at a time. But I also can't use a deferred context to Read from the texture to the CPU:

"If you call Map on a deferred context, you can only pass D3D11_MAP_WRITE_DISCARD, D3D11_MAP_WRITE_NO_OVERWRITE, or both to the MapType parameter. Other D3D11_MAP-typed values are not supported for a deferred context."

http://msdn.microsoft.com/en-us/library/ff476457.aspx

Ok, so what am I supposed to do now? It is common to use textures to store certain data (heightmaps for instance) and you obviously have to be able to access that data for it to be useful. Is there no way for me to do this in a separate thread with D3D11?


texts: How would you have 1 soldier model and then change the weapon depending on what class is chosen without having to load all the weapons at once and without having to load a new soldier for every weapon?


texts: How to put a "mask" in front of the camera in Ogre?

texts:
Is there any easy way to put kind of a "mask" in front of the camera in an Ogre 3d application, so that parts of the scene are always covered by that mask? The idea is that I want to have an effect as if you would look through a keyhole, or as if you would look through a tube. There should be a black border around the center of the screen, so that the user only sees that center.

Ideally, I would be able to dynamically change the diameter of this circle through which the user looks on the scene. Thus that black border on the sides of the scene would become wider or narrower.

Any ideas how to implement that in Ogre?


texts: Are bounding volumes created by artists?

texts:
I'm interested in where in the tool chain bounding boxes are created. Are they made by the artists? In the modeling tool? How are they exported? Can Maya/3DS Max/Blender/... mark geometry as bounding box? How does that work in Collada/FBX?)

Or is there a tool which calculates them? Are they calculated at run time?

I basically know how bounding volumes work, but I'm a little bit confused on where to get them from.


texts: How to randomly place entities that don't overlap?

texts:
I am creating a randomly-generated environment for a game I'm developing. I am using OpenGL and coding in Java.

I am trying to randomly place trees in my world (to create a forest), but I don't want the models to overlap (which happens when two trees are placed too close to each other). Here's a picture of what I'm talking about:

I can provide more code if necessary, but here's the essential snippets. I am storing my objects in an ArrayList with List<Entity> entities = new ArrayList<Entity>();. I am then adding to that list using:

Random random = new Random();
for (int i = 0; i < 500; i++) {
    entities.add(new Entity(tree, new Vector3f(random.nextFloat() * 800 - 400,
    0, random.nextFloat() * -600), 0, random.nextFloat() * 360, 0, 3, 3, 3);
}

where each Entity follows the following syntax:

new Entity(modelName, positionVector(x, y, z), rotX, rotY, rotZ, scaleX, scaleY, scaleZ);

rotX is the rotation along the x-axis, and scaleX is the scale in the x-direction, etc.

You can see that I am placing these trees randomly with random.nextFloat() for the x and z positions, and bounding the range so the trees will appear in the desired location. However, I would like to somehow control these positions, so that if it tries to place a tree too close to a previously placed tree, it will recalculate a new random position. I was thinking that each tree Entity could have another field, such as treeTrunkGirth, and if a tree is placed in the distance between another tree's location and it's treeTrunkGirth, then it will recalculate a new position. Is there a way to accomplish this?

I am happy to add more code snippets and details as necessary.


texts:
I know that this is a vage question, but how do day night cycles work in video games? How do I get started programming one? I have researched for a while, but the only thing I saw was "unity 3-d day night cycle". I need just a basic concept.

Edit:
I mean how to make it appear visually. I'm sorry for not saying that first.


texts: Why is my Canvas/RawImage not included in my Camera's RenderTexture output?

texts:
In my Unity2D game, I'm using a second camera to "screenshot" the current view.  I then display this screenshot within the game.  This works the first time I take a screenshot.  When taking the second screenshot, I expect the first screenshot to show up in the second, creating a screenshot-within-a-screenshot effect.  However, this doesn't happen - the previous screenshot doesn't show up in the next.

Here's a more visual description:

Before taking any screenshots:

After taking the first screenshot and displaying it in the bottom-left corner:

After taking the second screenshot:

Notice that this screenshot looks identical to the previous one.  Here's what I expected:

It seems like my Canvas/RawImage that is displaying the screenshot isn't being captured by my second camera.  Why is this?

Some additional details: my canvas is set to Screen Space - Camera.  I'm using Unity 5.6.1f1.


texts: Button with hexagon shape not recognizing mouse click

texts:
I made a hexagonal button, with a png image, the problem is that if i click outside of the image of the hexagon(but still inside of the squared area that defines the whole button), the click is registered , if i click inside of the button nothing happens, now i just read in the docs about the property Click Mask, so i made the same image of the hexagon shape into a bitmap, but this error text comes up:
The selected resource (StreamTexture) does not match any type expected for this property (BitMap).

I used this linkt as a guide to create the bitmap, http://www.herongyang.com/Windows/GIMP-JPEG-Save-Image-in-BMP-Format.html, still i don't know what i'm missing.
Also used MS Paint to save it as bitmap, but that din't work either.
Why i can't load the image as Click Mask in Godot?
I attached the image for testing.


texts: Is there any engine for Javascript like box2dweb that does not use Canvas? I need to build a game that works in HTML4 browsers.


texts: Dynamically Deformable Terrain In Game Engine

texts: I am looking for a game engine that is open to the public for free or at a payed price that allows for any reasonable way of doing deformable terrain over a network. The closest I have found to this is in udk where one can build a terrain in 3ds, cut it up, and import different chunks into udk, and fracture them. Unfortunately after a few hours work I discovered that this doesn't seem to work too well for what I am trying to do. Can anyone recommend a game engine, or even a rendering engine that supports this? Programming other features into a rendering engine is not an issue for me.


texts: Why do I have additional glBindBuffer() calls?

texts:
I have a OpenGL2/OpenGLES2 application and it among others renders a sphere using the following pseudocode:

Update vertices data on CPU
call glBufferSubData(GL_ARRAY_BUFFER, ...) to update them on GPU size
in a loop calls glDrawElements

Now I'm checking it under RenderDoc and see additional calls to glBindBuffer between glDrawElements:

glBindBuffer(GL_ARRAY_BUFFER, 0)
glBindBuffer(GL_ARRAY_BUFFER, my_vbo_id)
glDrawElements

Why I see those additional calls? Why GL driver (or GL library?) inserts them?


texts: Fresh new MonoDevelopment install "assembly not found for framework .NET Framework 4.5"

texts:
I'm using Ubuntu 18.04.4 LTS and I went through the instructions on this page: https://www.monodevelop.com/download/ very specifically, (yes, I made sure to use the steps for the correct operating system, and I did all of the steps at the bottom, I have all certificates and performed all fo the updates).
I then opened monodevelop and went into tools and downloaded the monogame extension.
Then I was able to create a new solution of type MonoGame... the options are: Cross Platform, iPhone/iPad, Android, Windows, Mac, and tvOS.  Apparently there isn't even support for Android at all so I don't know why that's even an option.  I then tried Cross Platform, and am now trying Windows Application... And when a make a solution for either of these files and just try to build the initial boiler plate code that they give me, I get the following error as demonstrated in the image below.  Does anyone know how to get these assemblies?  And why are all of these files missing?  I deleted Monodevelop from my machine and reinstalled it from scratch and tried again using a new solution and it's all the same.  Is game development for MonoGame using MonoDevelop on a Linux machine even possible?


texts: Problems with Rotation Matrices on Certain Axes

texts:
Here is what my rotation matrix looks like:

public Matrix4f initRotation(float x, float y, float z)
{
    Matrix4f rx = new Matrix4f();
    Matrix4f ry = new Matrix4f();
    Matrix4f rz = new Matrix4f();

    x = (float)Math.toRadians(x);
    y = (float)Math.toRadians(y);
    z = (float)Math.toRadians(z);

    rz.m[0][0] = (float)Math.cos(z);rz.m[0][1] = -(float)Math.sin(z);rz.m[0][2] = 0;                rz.m[0][3] = 0;
    rz.m[1][0] = (float)Math.sin(z);rz.m[1][1] = (float)Math.cos(z);rz.m[1][2] = 0;                 rz.m[1][3] = 0;
    rz.m[2][0] = 0;                 rz.m[2][1] = 0;                 rz.m[2][2] = 1;                 rz.m[2][3] = 0;
    rz.m[3][0] = 0;                 rz.m[3][1] = 0;                 rz.m[3][2] = 0;                 rz.m[3][3] = 1;

    rx.m[0][0] = 1;                 rx.m[0][1] = 0;                 rx.m[0][2] = 0;                 rx.m[0][3] = 0;
    rx.m[1][0] = 0;                 rx.m[1][1] = (float)Math.cos(x);rx.m[1][2] = -(float)Math.sin(x);rx.m[1][3] = 0;
    rx.m[2][0] = 0;                 rx.m[2][1] = (float)Math.sin(x);rx.m[2][2] = (float)Math.cos(x);rx.m[2][3] = 0;
    rx.m[3][0] = 0;                 rx.m[3][1] = 0;                 rx.m[3][2] = 0;                 rx.m[3][3] = 1;

    ry.m[0][0] = (float)Math.cos(y);ry.m[0][1] = 0;                 ry.m[0][2] = -(float)Math.sin(y);ry.m[0][3] = 0;
    ry.m[1][0] = 0;                 ry.m[1][1] = 1;                 ry.m[1][2] = 0;                 ry.m[1][3] = 0;
    ry.m[2][0] = (float)Math.sin(y);ry.m[2][1] = 0;                 ry.m[2][2] = (float)Math.cos(y);ry.m[2][3] = 0;
    ry.m[3][0] = 0;                 ry.m[3][1] = 0;                 ry.m[3][2] = 0;                 ry.m[3][3] = 1;

    m = rz.mult(ry.mult(rx)).getM();

    return this;
}

And here is how I've been implementing it for tests (using default orthographic perspective):

public class Renderer {

private WorldMesh mesh;
private Mesh _mesh;

private Matrix4f transform;

private Shader shader;

public Renderer(){

//Setup Meshes

    mesh = new WorldMesh();

    _mesh = ResLoader.loadMesh("pyramid.obj");

    mesh.addToBuffers(_mesh);

//setup Shader

    shader = new Shader();

    shader.addVertexShader(ResLoader.loadShader("basicVertex.vs"));
    shader.addFragmentShader(ResLoader.loadShader("basicFragment.fs"));
    shader.compileShader();

    shader.addUniform("transformation");

//temporary transformation matrix

    Matrix4f tran = new Matrix4f().initTranslation(0, 0, 0);
    Matrix4f rot = new Matrix4f().initRotation(0, 0, 0);     //problem is definitely with the rotation matrix;
    Matrix4f scale = new Matrix4f().initScale(1, 1, 1);

    transform = tran.mult(rot.mult(scale));

}

public void update(){}

public void render(){

    RenderUtils.clearScreen();

    shader.setUniform("transformation", transform);

    shader.bind();

    mesh.draw(true);
}

}

and finally here is my vertex shader:

#version 330

layout (location = 0) in vec3 position;

uniform mat4 transformation;

void main(){

    gl_Position = transformation * vec4(position, 1.0);
}

The problem is that setting a rotation on any other axis other than Z (for some reason z axis rotation is working fine) does not function properly. An X axis rotation seems to be doing both an x and y rotation at the same time, causing a weird stretching affect. A Y axis rotation causes the mesh to completely disappear.

The funny thing is that I've used this code over and over again and some projects don't give me a problem.

The order of multiplication seems in order, and I made sure that OpenGL knows to transpose the matrix I give it when setting the uniform.

Any ideas as to what could be causing the x and y axis rotations to completely fail?


texts:
I am toying around with a Boogaloopers clone (http://www.youtube.com/watch?v=zuaRi_fhdlQ).

I have a small problem with the lassoing.

Here's my current naive algorithm. The problem with this is that the player can swipe a U-shaped pattern with the mouse, and it is detected as a polygon, since the isPointInPolygon-method connects the first and last points together. I wonder if there's a simple way to fix this?

private void collisionDetection() {

    Player p = Player.getPlayer();

    Array<Beam> beams = p.getBeams();

    if (beams.size < 3)
        return;

    for (int i = 0; i < beams.size; i++) {

        Beam b1 = beams.get(i);

        for (int k = i + 1; k < beams.size; k++) {

            Beam b2 = beams.get(k);

            // Don't do collision detection with adjacent beams
            if (p.areConnected(b1, b2))
                continue;

                if (Intersector.intersectSegments(b1.getStart(), b1.getEnd(), b2.getStart(), b2.getEnd(), null)) {

                Array<Vector2> path = p.getPath();
                if (path.size < 3)
                    continue;

                boolean destroyed = false;

                // Destroy any monsters inside the polygon
                for (int j = 0; j < entities.size; j++) {
                    Entity e = entities.get(j);

                    if (e instanceof Player)
                        continue;

                    if (Intersector.isPointInPolygon(path, e.getPosition())) {
                        destroyed = true;
                        e.destroy();
                    }
                }

                if (destroyed) {
                    SFX.play("sfx-destroy");
                }

                return;
            }
        }
    }
}


texts: Intellisense with PhaserJS Library in Visual Studio Code

texts:
I am trying to use Visual Studio code along with PhaserJS but am confused about why the  isn't working.

I've read through http://www.johnpapa.net/intellisense-witha-visual-studio-code/ am think I am doing it correctly but still don't get auto-complete.  When Phaser gets a green underline and lightbulb, the bulb doesn't include a create reference so I created one above manually.


texts: How to apply constraints to limb movements of a 3D human model?

texts: I'm animating a 3D human model using playcanvas game engine according to the quaternion data provided by IMU sensors. How can I limit the movements of the limbs of the human model to avoid unrealistic postures? Is there a mathematical method to limit joint angels?


texts:
I'm trying to have my game spawn enemies when ever the player reaches a way point.

Right now, I have this functionality working. When my player gets to the first way, the enemies spawn. He only moves on once he has killed all of the enemies on the screen are dead. However, when he gets to the second way point, no enemies spawn.

Right now, in my collision class I call the following line of code:

Destroy(gameObject)

Whilst this work for the first way point, the second one wont spawn anything as the game object my collision class has been attached to has been destroyed. However, all of my enemies are prefabs and I thought the destroy function would only destroy that instance of the prefab. No matter when you called the instantiate method, it would only destroy that instance.

I'm spawning my enemies with the following method:

  public GameObject SpawnEnemies()
{
    Vector3 _position = new Vector3(transform.position.x, transform.position.y, transform.position.z);

    // instantiate particel system
    Instantiate(_particle, _position, Quaternion.identity);

    _clone = (GameObject)Instantiate(_enemy, _position, transform.rotation);
    _ai = _clone.GetComponent<HV_BaseAI>();
    _ai._waypoints = _wayPoints;

    return _clone;
}

Then I'm finding out how many of the enemies are still alive with the following code in my collision method:

  GameObject g, f; // enemies I want to spawn
    g = GameObject.FindGameObjectWithTag("SectionController");
    f = GameObject.FindGameObjectWithTag("SectionController");

    HV_SectionController tempSectionControllerGroundEnemies, tempSectionControllerFlyingEnemies;
    tempSectionControllerGroundEnemies = g.GetComponent<HV_SectionController>();
    tempSectionControllerFlyingEnemies = f.GetComponent<HV_SectionController>();

    tempSectionControllerGroundEnemies._numberOfGroundEnemies.Remove(gameObject); // remove enemies from list
    tempSectionControllerFlyingEnemies._numberOfFlyingEnemies.Remove(gameObject);
    //Destroy(gameObject);

    _numberOfGroundEnemies = tempSectionControllerGroundEnemies._numberOfGroundEnemies.Count;
    _numberOfFlyingEnemies = tempSectionControllerFlyingEnemies._numberOfFlyingEnemies.Count;

Then when I want to move on I do the following check:

 if (_groundEnemiesRemaining == 0)
        {
            MoveToNextSection();
            _sectionStartTime = Time.time;
        }

i know the above line is checking only one type of enemy at the moment, but its the ground enemies I'm having issues with at the moment.

Does anyone know how I can delete the enemy prefab I'm spawning from my first section, once they've been hit, then have it respawn at the next section without the error:

  The object of type 'GameObject' has been destroyed but you are still
  trying to access it.


texts:
I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. Also, a line is removed once it is full (all 10 cells contain some block). I was trying to figure out which parameters I might choose in order to optimise how the game is played. Some obvious parameters which I thought of:

a) A piece should be placed in a position where it forms the maximum number of full lines, as they can be removed in the next step.

b) A piece should be placed to minimise the 'bumpiness' or roughness of the topmost surface, i.e, it should be as level as possible.

c) This is arguable, but the AI should try to keep as minimum height as possible.

d) The number of columns containing atleast one block should be minimised.

But the AI is still not playing good enough and keeps getting stuck. I would like to know if there are some other important parameters which I may be missing?


texts: Is XNA good for professional development for the Xbox 360?

texts:
I want to start off developing for my Xbox 360, and I've heard of the XNA framework that can target both the PC and Xbox. This sounds like an attractive option since my clients can use the game/app on normal computers as well.

However I'm very new to the Xbox scene. Is XNA only for hobbyist development, and is it not recommended for semi-professional or corporate application development? Does XNA lack the capabilities of a C++ developed solution, or dos it badly reduce performance of a game/app running on the Xbox?

Is it possible to target the Xbox using C#, and without XNA? What are the advantages?

Low-level programming would be in C++ directly working with DirectX. What are the advantages?