texts: How to create a 3D network-like interactive model?

texts:
link: Link to video. it's a small video only 1 min 40 sec
I have included a link to the video which shows what I am trying to achieve, I am a beginner and I don't have any idea to do it, also I am using this for something like showing the network I have to people and not for game development, If my question is not clear please comment I will try to clear the problem with my question


texts: How can I get my meshes to work with Bullet Physics?

texts:
The problem is that I'm trying to use my meshes with Bullet Physics for the collision part of my game.

When I attempted doing this method with my GLM(model loading library by nate robins) model, I get a segmentation fault in the debug, so I figured that it doesnt like the coordinate variables of the model.

If i use blender to export my model as a collision file, what type of file should I use?

I have heard of a .bullet exporter, but i dont know hot to integrate this python script into my Blender 2.5 program.


texts: How to use mount points in MilkShape models?

texts:
I have bought the Warriors & Commoners model pack from Frogames and the pack contains (among other formats) two animated models and several non-animated objects (axe, shield, pilosities, etc.) in MilkShape3D format.

I looked at the official "MilkShape 3D Viewer v2.0" (msViewer2.zip at http://www.chumba.ch/chumbalum-soft/ms3d/download.html) source code and implemented loading the model, calculating the joint matrices and everything looks fine.

In the model there are several joints that are designated as the "mount points" for the static objects like axe and shield. I now want to "put" the axe into the hand of the animated model, and I couldn't quite figure out how. I put the animated vertices in a VBO that gets updated every frame (I know I should do this with a shader, but I didn't have time to do this yet). I put the static vertices in another VBO that I want to keep static and not updated every frame.

I now tried to render the animated vertices first, then use the joint matrix for the "mount joint" to calculate the location of the static object. I tried many things, and what about seems to be right is to transpose the joint matrix, then use glMatrixMult() to transform the modelview matrix. For some objects like the axe this is working, but not for others, e.g. the pilosities.

Now my question: How is this generally implemented when using bone/joint models, and especially with MilkShape3D models? Am I on the right track?


texts: OpenGL quake 3 shader file for objects (for trees)

texts:
I decided to add to my game few trees, I already quake 3 model loader (md3) its for characters and method for texture drawing is store in *.ini file. I found a package of trees in MD3 and I have no problem with loading model alone, but there is a *.shader file and i have no idea how to load it to draw texture properly.

Tree pack: http://www.custommapmakers.org/wiki/index.php/Models:GR_Trees_set

I do not have to use exactly this format, I can write another loader, but trees in *.obj or
.3ds look even harder


texts: How do I implement delta-only data packet updates in UDP?

texts:
Edit: My current system is going to be to send constant player updates every 1/20th of a second, each containing the player's status and position. I will also send another packet (or as many needed) every 1/20th of a second with the information of all the bullets, using this format to save space (the number representing the space in a packet):

1: Owner's ID
1: Type
1: Amount of bullets (so I don't have to include this info each time)

3: X coord
3: Y coord

I am currently writing a co op game to play at LANs, and have run into the issue of dealing with many entities and game updates. I only have implemented player movement, and the packets sent include the player's position for 3 ticks (as packets are sent and received every 3 ticks).

I have also implemented a system to keep track of the delay between client and server (sending the tick the server/client is at and comparing it to with the receiver's local tick).

This has worked thus far, however I have run into trouble with sending bullet information. It would be unfeasible to send the position of the bullet every update, as I would only have room for ~160 bullets + players per packet.

I thought of just sending the information that a bullet has been created and enough information for the client to simulate the bullet flying, such as velocity, angle, lifetime, and owner, and sending information when the bullet has been destroyed (via impact, lifetime, or otherwise). This got me thinking if it is possible to only send the keystates of a client to other clients via the server, to reduce the space required for co-ordinates and to increase smoothness of movement(floats will be used in this case instead of the current ints, as I have found difficulty transmitting floats).

This raises the concern of packet loss, and that with it the game could easily go out of sync. I have read of sending acks, however I am unsure if this will give me the wanted result. I have also read about sending a full game state ever so often, and this seems to me to be the best solution. What should I do to fix the issue of space and to reduce the space required for transmitting movement? And if it's the full game state solution, how often should I resync the clients? 5 seconds? 10 seconds? How do other games do it? I have read that the steam engine almost never does this, however it has many systems set in place to prevent packet loss and resending lost packets and I feel that I am unable to code all that.


texts: Applying effects to an existing program that uses BasicEffect

texts:
Using the finished product from the tutorial here.

Is it possible to apply the grayscale effect from here:

Making entire scene fade to grayscale

Or would you basically have to rewrite everything?

EDIT: It's doing something now, but the whole grayscale seems extremely blue. It's like I'm looking at it through dark blue sunglasses. Here's my draw function:

protected override void Draw(GameTime gameTime)
{
   device.SetRenderTarget(renderTarget);
   graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

   //Drawing models, bullets, etc.

   device.SetRenderTarget(null);
   spriteBatch.Begin(0, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, grayScale);
   Texture2D temp = (Texture2D)renderTarget;
   grayScale.Parameters["coloredTexture"].SetValue(temp);
   grayScale.CurrentTechnique = grayScale.Techniques["Grayscale"];
   foreach (EffectPass pass in grayScale.CurrentTechnique.Passes)
   {
      pass.Apply();
   }
   spriteBatch.Draw(temp,
   new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth/2, GraphicsDevice.PresentationParameters.BackBufferHeight/2),
   null, Color.White, 0f, new Vector2(renderTarget.Width/2, renderTarget.Height/2), 1.0f,
   SpriteEffects.None, 0f);

   spriteBatch.End();

   base.Draw(gameTime);
}

Another edit: figured out what I was doing wrong. I have Blendstate.Additive in the spriteBatch.Draw() call. It should be Blendstate.Opaque, or it literally tries to add the blank blue image to the grayscale image.


texts: How do you find the "best" color palette for a game?

texts:
If I want to make a 3D game, and I want all my textures to be 8 bit, to save RAM, that is 256 indexed colors, including "transparent", how do I choose the colors?

Is there any recommended pre-defined palette? (Link?)

The end-rendering would use full colors, based on lighting, ...


texts: How to apply impulse to a body to make it fly away?

texts:
I'm playing around with jbox2d and can't really make a body "fly away" as if from an explosion.

From what I have found on the net, making the body fly away from the world center (0,0), should have been something like that:

b.applyLinearImpulse( new Vec2(0,0) , b.getPosition() );

But really it just doesn't do anything, any idea why? Also how do I change the strength of the impulse, like if it want to make it fly skyhigh or just move a bit?


texts: What are typical pitfalls when writing games with a managed Language like C#?

texts: What pitfalls did you encounter when writing games for the PC with a managed Language like C# and how did you solve them?


texts: How to order points on a 3D grid such that we can connect them in a line loop correctly

texts:
I want to recreate an effect as close as possible to X-Com: Enemy Unkown's movement range feedback:

(source: gameinformer.com)
The blue line delimits the tiles which the soldier can reach using a single action. We also are using a 3D grid approach in our game. We are not developing this with a pre-built engine, so I'd like some sort of algorithm which I am not aware of, not some engine's feature (unless it is well documented). We've discussed using things like quickhull, but quickhull generates a convex contour, while this contour can be concave or convex.
Any thoughts or ideas? Thank you for all your input
Edit: Yes, we already have the centers of the tiles which are the "edge" or outermost tiles of the walkable area. What we're not sure about is the following:

From the green center, given just the points, we could draw both the red and yellow contours. How do we know which one is the correct one? What data would we need?
Final edit: One of the programmers on my team figured out something which is good enough for our purposes. It is not exactly the same as the output of whatever X-Com is using.
We take the whole tiles given to us by the Dijkstra pathfinding algorithm on the set of tiles and start at one which we can guarantee is an edge. We define a forward direction and a perpendicular vector to that direction. The direction vector is the one used to walk between tiles and the perpendicular vector is used to check whether there is an adjacent tile in that direction to which the forwrad direction must be rotated to. If none of those point to a valid tile, we rotate away from the perpendicular vector. An accompanying image will follow so that we can explain it better for anyone else who wants to accomplish a similar effect.


texts: Starting out - should I make complete games or just play around?

texts: While starting out, I made clones of some arcade games (Tic tac toe, Pong, Snake, Tankwars, Breakout, Tetris, etc). Most of these games had just had the gameplay, I didn't code any of the starting screens, there were no features like high scores, etc. My question is, should I focus on polishing these games up or just start with more comlicated games?


texts: How to update vertices and indices in OpenGL

texts:
I want to change and update the vertices and indices of the 3D object.
I am new to openGL and I do not know if this the right place to ask this question.
I searched and read about that, and I found that I should bind the VAO and VBO and make that, but nothing changed in vertices and indices.
The vertices vector class type has the position, normal and uv coords and the vertices vector class type is int. I wonder how I can make changes to these two vectors when I translate or scale the model.
here is the code:
// Create buffers/arrays
glGenVertexArrays(1, &this->VAO);
glGenBuffers(1, &this->VBO);
glGenBuffers(1, &this->EBO);

glBindVertexArray(this->VAO);
// Load data into vertex buffers
glBindBuffer(GL_ARRAY_BUFFER, this->VBO);
// A great thing about structs is that their memory layout is sequential for all its items.
// The effect is that we can simply pass a pointer to the struct and it translates perfectly to a glm::vec3/2 array which
// again translates to 3/2 floats which translates to a byte array.
glBufferData(GL_ARRAY_BUFFER,this->vertices.size() * sizeof(vertex), &this->vertices[0], GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, this->indices.size() * sizeof(int), &this->indices[0], GL_STATIC_DRAW);

// Set the vertex attribute pointers
// Vertex Positions
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)0);
// Vertex Normals
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, normal));
// Vertex Texture Coords
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, uv));

glBindVertexArray(0);


texts: UI and line renderer layer order when using screen space - camera

texts:
I'm using a canvas with screen space - camera because I needed a line renderer that could work for my UI.

However, I need that line to render behind Image elements on my canvas and I'm not seeing any way to accomplish that.

Every UI element on my canvas behaves like its z:90 and "order in layer": 0 but those aren't really configurable values for a UI object. My line renderer, if z:90, must have a layer order > 0, or a z value < 90. In both cases, it shows on top of my UI.

I essentially have a canvas with a background image, which must be behind everything else, a line renderer (used to connect "dots"), and circle-shaped Images which must be on top.

Here's my hierarchy:

Canvas
  |- Background (Panel, no image, color)
  |- GameBoard
       |- LineRenderer (Layer: default, order: 0)
       |- Circle Clone(1)
       |- Circle Clone(2)
       |- etc...

What's bizarre is that if I turned off (active=false) the Background object, and my LineRenderer is z:90, order: 0, it works fine. It appears behind my UI elements correctly. Yet if this object is active, my LineRenderer appears on top of of the elements, despite no z/order changes.


texts:
I've got a homemade game engine that supports both Windows and Linux using Win32 and Xlib, respectively. By default, the engine will create the window and then switch it into fullscreen mode. When running in Linux, the main game loop updates with a very low framerate (2-7 FPS) that slowly keeps ticking downwards. If I alt-tab out and then alt-tab back in, the game will shoot up to and stay at a consistent 60 FPS.

Since my time since last tick (dt) keeps increasing during this time, my thought is it has something to do with the game not being properly registered as "fullscreen" when it's initially opened, leading the CPU scheduler to not give it full priority. That being said, that's entirely speculation. Does anyone have any idea what the cause of this could be? I can provide code samples if requested.

System info:
Linux Mint 17 Cinnamon 64-bit
Intel Core i7 @ 3.40GHz x 4
8GB DDR3 RAM
Nvidia GeForce GTX 680 with proprietary driver

Edit
My update loop is as follows:

while (gameIsRunning) {
    auto currentTime = std::chrono::steady_clock::now();
    auto dt = std::chrono::duration<float>{currentTime - lastFrame};
    if (dt >= engine->getFrameInterval()) { // getFrameInterval returns (1 / the target framerate) in seconds; in this case, 1/60s
        if (dt >= engine->getFrameInterval() * 2) {
            lastFrame = currentTime;
        } else {
            lastFrame += std::chrono::duration_cast<decltype(currentTime - lastFrame)>(engine->getFrameInterval());
        }

        // input, update, draw...
    }
}

After fooling around with it a bit, this creates a situation where the framerate will jump back up to 60FPS, tick down until it hits about 30FPS, and then jump back up to near 60FPS before ticking down again.


texts: What is an efficient 2D line-segment-versus-triangle intersection test?

texts:
In a 2D plane, I have a line segment (P0 and P1) and a triangle, defined by three points (t0, t1 and t2).

My goal is to test, as efficiently as possible ( in terms of computational time), whether the line touches, or cuts through, or overlaps with one of the edge of the triangle.

Everything is in 2D, so I can't expect the usual ray-triangle intersection test (3D version) to work.

Edit: Same question is asked on math.SE, but I think asking here is also appropriate  as this is as much mathematics as game development, and the approach may be different also.


texts:
I am currently integrating Lidgren into my Unity game. I need to move away from the built in networking capability in Unity because of the style of game I am making, basically MMO, I will have far too much information routing through the server just to get from one peer to another.

With Lidgren I am hoping that the peers that need to send information to each other can connect and send messages while maintaining the server connection.

My question is that if I have say 2 people already connected to each other with NetPeer and a third connects to one of them, will all three automatically be connected to each other as peers, or do i have to connect the third to both other players manually?


texts: Is there any reason not to save skinning animation data in texture?

texts:
I have thought about saving animation data in texture. I think I can save shader parameter setting and interpolation cost in CPU, and also enable animated instancing.

But I couldn't find no text mentioning about this, so I think there's some obvious reason people don't do this. Which I'm missing.

Can I know what I missed? Or is this just widely known technique?


texts: Progress bar in Super Hexagon using OpenGL ES 2 (Android)

texts:
I'm wondering how the progress bar in Super Hexagon was made.  (see image, top left) Actually I am not very sure how to implement a progress bar at all using OpenGL ES 2 on Android, but I am asking specifically about the one used in Super Hexagon because it seems to me less straightforward / obvious than others: the bar changes its colour during game play.

I think one possibility is to use the built-in Android progress bar. I can see from some Stackoverflow questions that you can change the default blue colour to whatever you want, but I'm not sure whether you can update it during the game play.

The other possibility I can think of for implementing a progress bar is to have a small texture that starts with a scale of 0 and that you keep scaling until it reaches the maximum size, representing 100%. But this suffers from the same problem as before: you'll not be able to update the colour of the texture during run-time. It's fixed.

So what's the best way to approach this problem?

*I'm assuming he didn't use a particular library, although if he did, it would be interesting to know. I'm interested in a pure OpenGL ES 2 + Android solution.


texts: How are the positions of skinned mesh vertices with multiple weighted parents stored?

texts:
I'm trying to wrap my head around the basics of skinning and skeletal animation.  I understand not every skeletal animation implementation works exactly the same, but I'm just trying to understand the generally accepted practice.

I'm not sure if I used the correct terminology for my question, but my issue is this - if I have a vertex with a single bone as a parent, I can just store the local coordinates to the parent.

So if my parent bone is at any random location and the vertex is located exactly where the parent bone is, I would store it's x,y location as 0,0.  If it were to move the vertex down the length of the bone parallel to it, regardless of the parent bone's angle and location, the local x value for the vertex would increase and the y would stay the same.  This makes sense, and the math to get from any arbitrary point in world space to that local position to it's parent is also very straightforward.  This position local to the parent also seems like the ideal way to store the vertex information for any given vertex with a single parent bone.

My question is if the vertex has multiple weighted parents, what xy location is stored?  Would I need to store the relative coordinates to each parent for each vertex, or is there some way to store a single coordinate that represents it's weighted position relative to all parents?  And if the math isn't simple enough to be explained here, what is the math required to get this multi-weighted relative coordinate called so I can go find more information?


texts: XNA - just a few more characters accepted in a SpriteFont

texts:
I have a SpriteFont in XNA, which has the standard 126 characters that are usable.

However i would like to use the "ಠ" symbol in the game.

So is there anyway of adding just a few more symbols that the spritefont accepts?

Cheers,
Randomman159


texts: Does StreamPeerTCP guarantee received packet is same from server?

texts:
I'm making simple Godot project that works with Node.js server. To receive and send packet to Node.js server, I used StreamPeerTCP.

First seems works, but after 2nd transmission from server, extract data from packet were broken and mess all other logics.

This wasn't happened when same logic tested with Unity C#:
https://github.com/rico345100/unity-multiplayer-with-nodejs/blob/master/Assets/Scripts/Network/NetworkManager.cs

Here's the repo I'm currently developing:
https://github.com/rico345100/godot-multiplayer-with-nodejs
https://github.com/rico345100/nodejs-tcp-server-for-godot

Used Godot 3.1.2 but also works with 3.2.rc6. Tested with Godot 3.1.2 and macOS 10.13.6.


texts: Why is the root of the character rig the pelvis?

texts:
When creating character rigs for video games we always set the root of the rig and all the kinematic chains to the pelvis of the character. Is their a specific reason that we do that or is it by convention?

What is the reasoning behind this?


texts: When to unload graphics object from main memory?

texts:
I writing my resource mangaer, and I consider about how it can work for graphics objects (like textures, meshes). I think about this :
I want to load texture (in pseudocode):

Texture t = resMgr.GetTex("image.png");

and GetTex make something like this:

load texture from disk to main memory
create texture object (load it to gpu memory)
unload texture from main memory

I consider about 3 step, does game engines that you know unload meshes/textures after load them into gpu memory ?


texts: Using an FSM, how do you clean up state related attributes that may be used from several states?

texts:
I'm making a game that plays a bit like Diablo, but you can harvest resources like in an RTS.

I have the following states in my FSM: IdleState, ApproachingTargetCoordinateState, ApproachingTargetEntityState, CuttingTreeState.

When a user clicks a tree, Player.targetEntity is set to the corresponding Tree instance (which inherits from Entity) and the player's state is set to ApproachingTargetEntityState. When the player reaches the tree, a transition is made to CuttingTreeState. Shortly after, the tree is cut down, and state is changed back to IdleState.

At this point, I'd like the Player.targetEntity reference to be removed because its no longer needed. Where should I put the logic that does this?

I could do this in the CuttingTreeState#exit() method but that would only work in situations where everything happens as described above. If for instance the user clicks a random coordinate (not a tree) before the player reaches CuttingTreeState, CuttingTreeState#exit() is never run and so Player.targetEntity is never removed.

I can't put it in ApproachingTargetEntityState#exit() either, as that would remove the reference to the tree before we get to CuttingTreeState.

Another solution would be to just not care about Player.targetEntity. But it just feels wrong to me that the attribute is set for example when the player is in the IdleState.

How can I solve this problem? What is usually done?


texts:
I'm now learning how to use directX (10 - 11), and i use materials from SDK samples, http://www.rastertek.com/ and http://takinginitiative.net/category/graphics-programming/directx-10-tutorials.
But i find it suprising that none has explainded the transition between fullscreen and windowed. I also seached with google, in GameDevelopment and StackOverflow, but no result.

What i'm asking is explanation or full exaples for both Window and DirectX "classes".

Thanks for help.


texts:
I have quite a few debug drawing methods in my engine that can generate geometry useful for debugging, like spheres and cubes.

At the moment I do not generate any normals for these shapes. Is there a general purpose method of generating face normals and per vertex normals for an arbitrary mesh? (I'd imagine you would need face normals to generate per vertex normals?)


texts: How do I get text width and height in Swing/AWT?

texts:
I'm making a game engine based on Java Swing and I wonder if I can get the text width/height.

Say, what I have is:

the text string
the font and text size (the Font object)

What I've done is:

g.drawString(...)

What I want to know is:

the width/height of the text that displayed on the screen


texts: How to display image in second layer in Cocos2d

texts:
I am very new at Cocos2d and is testing to displaying an image over the "Hello World" text on a second layer and need help to get it work. I guess it is some basic stuff here and appreciate any tips etc. with this.

I know that if i put the display-code (myLayer1) in the "init" it work or do the call [self goHere] from the "init" in myLayer1 it works but i want to call the "goHere" directly.

I have the following code:

HelloWorld.m:

#import "HelloWorldLayer.h"
#import "myLayer1.h"

// HelloWorldLayer implementation
@implementation HelloWorldLayer

+(CCScene *) scene
{
// 'scene' is an autorelease object.
CCScene *scene = [CCScene node];

// 'layer' is an autorelease object.
HelloWorldLayer *layer = [HelloWorldLayer node];
myLayer1 *layer1 = [myLayer1 node];

// add layer as a child to scene
[scene addChild: layer];
[scene addChild: layer1];

// return the scene
return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

    // create and initialize a Label
    CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];

    // ask director the the window size
    CGSize size = [[CCDirector sharedDirector] winSize];

    // position the label on the center of the screen
    label.position =  ccp( size.width /2 , size.height/2 );

    // add the label as a child to this Layer
    [self addChild: label];

    myLayer1 *a1 = [myLayer1 new];
    [a1 goHere];
    [myLayer1 release];

}
return self;
}

myLayer1.m:

#import "myLayer1.h"

@implementation myLayer1

-(void)goHere {

NSLog(@">>>>goHere<<<<");

CGSize size = [[CCDirector sharedDirector] winSize];

CCSprite *vv = [CCSprite spriteWithFile:@"hand.png"];
vv.position =  ccp( size.width /2 , size.height/2 );
[self addChild:vv z:3];
}

-(id) init
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {

}

return self;
}

@end


texts:
Like most people on this exchange concerned with UDP client server connections, I've gone through the Gaffer on Games article about implementing reliability. I understand how the ordering and acks and what not works (I think).

My issue is, some packets need to be re-sent until they are received, such as a packet stating that an entity has been created in the world. Others, such as updating the location of an entity don't need to be re-sent if a newer packet containing location data has already been sent.

What if, say, an entity is created and destroyed within a second. Say the create packet is lost but the destroy packet is received. The client has been told to destroy a non existent entity. If it just ignores this, when the create packet is re-sent, the entity will never be destroyed causing inconsistency.

All of this is per-client, so the actual game code should know nothing about it, only the networking code.

So how should this be handled? Do I flag certain packet types as resend. Do I send send a field in all dependent packets saying they depend on packet number x? Neither seem very elegant.


texts: Handling random with unique chance in Python

texts:
Okay, let's say you have a handful of enemies, each with their own 'rarity' to spawn.
For example:

monsterlist = []

snake = 'snake', 60
wolf = 'wolf', 80
antlion = 'antlion', 30

monsterlist.append(snake, wolf, antlion)

Now I want to spawn one at random:

totalchance = 0

for monster in monsterlist:
    totalchance += monster[1] #add each monster's rarity to totalchance
chance = random.randint(0, totalchance)

if chance <= targetlist[0][1]: #chance is <= than first entry's rarity
    #spawn first monster
elif chance <= targetlist[0][1] + targetlist[1][1]: #chance <= second target's rarity
    #spawn second monster
#etc

Assuming you have a large amount of monsters in monsterlist, this is going to take stupid amounts of code just to calculate chance to spawn, I like to assume there's a less annoying way to do this, right?


texts:
In my game, does my player object control the movement, or does the map object control it? (Or some other object?)

The player doesn't know about the map's contents to stop at solids, interact with objects etc. Am I doing it wrong?

I'm currently dispatching data from a virtual joypad.

EDIT:

What if I dispatched movement notifications to my player and had it check with the map before moving, but the player would do the actual moving? Would that work?

EDIT2:

At this point I'm thinking about a top down game. Just to clarify, I want the player to move in 4 directions, not 8, and to be centered on the tile which they are standing on.


texts: If somebody wanted to develop a system between two intersecting rectangles so that the rectangles would, in a gradual process, push eachother away from one another until no longer intersecting, with the repelling force being stronger depending upon how deep the intersection is... what would the math look like?


texts: Unity virtual joystick - jarring movement

texts:
I'm creating an infinite flyer game in which you control the plane using a mobile joystick. There are two controls one to rotate the plane and the other to move the plane. While rotating the plane there is a lot of jarring if I use Time.deltatime. There is no jarring when I don't use Time.deltatime. This is the line of code that use Time.deltatime - transform.rotation = _initialRotation * Quaternion.Euler(_pitchTime.deltaTime,-_yawTime.deltaTime, 0).
Here is the code in the Move script:
public class Move : MonoBehaviour
{
public Joystick joystick;
public Joystick joystick1;
float rotateVertical;
float rotateHorizontal;

public float sensitivity;
Quaternion _initialRotation;
float _pitch, _yaw;

float moveHorizontal;
float moveVertical;

void Start()
{
    _initialRotation = transform.rotation;
}
void Update()
{
    _pitch = _pitch + joystick.Vertical * sensitivity;
    _yaw = _yaw - joystick.Horizontal * sensitivity;

    transform.rotation = _initialRotation * Quaternion.Euler(_pitch*Time.deltaTime,-_yaw*Time.deltaTime, 0) ;

    transform.Translate(moveHorizontal * Time.deltaTime, moveVertical * Time.deltaTime, 0);
 }
}

There is also a camerafollow script attached.
[SerializeField] Transform target;
public Vector3 defaultDist = new Vector3(0f, 0, 7.5f);
[SerializeField] float distDamp = .1f;
public Vector3 velocity = Vector3.one;

Transform myT;

void Awake()
{
    myT = transform;
}

void LateUpdate()
{
    SmoothFollow();
}

void SmoothFollow()
{
    Vector3 toPos = target.position + (target.rotation * defaultDist);
    Vector3 curPos = Vector3.SmoothDamp(myT.position, toPos,ref velocity ,distDamp);
    myT.position = curPos ;
    myT.LookAt(target, target.up);
}


texts: How do I integrate bullet physics into my game?

texts:
I downloaded the release file found here, but I'm just not sure where to start. In my game I have a number of oblongs and a sphere, I want all of these to collide with one another. (They all have meshes and associated bounding volumes)

edit - I just realised the cuboids actually have AABB's associated with them. I guess I'll have to change that at least.

What are the steps I need to follow?


texts: GameStateManagement and inputs not being recognized

texts:
EDIT: I've removed a bit of code from the input class to make this more readable, and updated my StartScreen class, which is now at the bottom. I have the same issues though, but they are explained in my comments on the bottom of this page. It won't let me paste my additional code here (the format comes out crazy), so I've linked to pastebin with the code pastebin

I've been trying to implement the MS provided GameStateManagement sample with my game, but it has proven a bit difficult. Really, I'm using Oneksoft's Starter Kit, which uses the MS provided sample, so they are identical, except for my splash screen.

I'm able to get the splash screen to launch, where it informs the player to press A to advance the screen, but this doesn't seem to accept any of my inputs. I’ve also added Console.Writeline(“Pressing A”) under the IsMenuPressed method in Input.cs to verify that it is getting called, but for some reason it is constantly spamming my log, rather than just appearing each time I press it. Not sure why this is happening.

I have a bit too much code to post it all here, so I’ve attached a link to my .rar with my classes, but I’ll also leave a bit here which I thinkmay be applicable. https://www.dropbox.com/sh/6ek4uru2jc2ch0k/JTeBWN_3PQ

What do you guys think the issue is?

namespace Pong
{
    public class Input
    {
        public const int MaxInputs = 4;

        public readonly KeyboardState[] CurrentKeyboardState;
        public readonly GamePadState[] CurrentGamePadState;

        public KeyboardState[] LastKeyboardState;
        public GamePadState[] LastGamePadState;

        public readonly bool[] GamePadWasConnected;

        public Input()
        {
            // Get input state
            CurrentKeyboardState = new KeyboardState[MaxInputs];
            CurrentGamePadState = new GamePadState[MaxInputs];

            // Preserving last states to check for isKeyUp events
            LastKeyboardState = CurrentKeyboardState;
            LastGamePadState = CurrentGamePadState;
        }

        /// <summary>
        /// Checks for a "menu select" input action.
        /// The controllingPlayer parameter specifies which player to read input for.
        /// If this is null, it will accept input from any player. When the action
        /// is detected, the output playerIndex reports which player pressed it.
        /// </summary>
        public bool IsMenuSelect(PlayerIndex? controllingPlayer,
                                 out PlayerIndex playerIndex)
        {
            Console.WriteLine("Pressing A");
            return IsNewKeyPress(Keys.Space, controllingPlayer, out playerIndex) ||
                   IsNewKeyPress(Keys.Enter, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.A, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex);
        }

        /// <summary>
        /// Checks for a "menu cancel" input action.
        /// The controllingPlayer parameter specifies which player to read input for.
        /// If this is null, it will accept input from any player. When the action
        /// is detected, the output playerIndex reports which player pressed it.
        /// </summary>
        public bool IsMenuCancel(PlayerIndex? controllingPlayer,
                                 out PlayerIndex playerIndex)
        {
            return IsNewKeyPress(Keys.Escape, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.B, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.Back, controllingPlayer, out playerIndex);
}


texts: Google Cloud Messaging (GCM) for turn-based mobile multiplayer server?

texts:
I'm designing a multiplayer turn-based game for Android (over 3g).  I'm thinking the clients will send data to a central server over a socket or http, and receive data via GCM push messaging.
I'd like to know if anyone has practical experience with GCM for pushing 'real-time' turn data to game clients.  What kind of performance and limitations does it have?

I'm also considering using a RESTful approach with GAE or Amazon EC2.  Any advice about these approaches is appreciated.


texts: How do I find the point of impact with 2D per-pixel collision detection?

texts:
I'm creating a platformer and have implemented per-pixel collision detection. However, this has caused 2 obstacles that I've yet to figure out. The first obstacle, which this question is about, is that I don't know how to efficiently find the point of impact (my other problem will probably be a different question on this StackExchange).

I have my character fall or jump at a given rate in pixels. That is, every frame the character might fall 4 pixels or jump 4 pixels, for instance. If the character falls and intersects an object then the character should land on that object (and vice versa, if they're jumping and hit an object they should start falling again). However, if, for instance, a character falls 4 pixels and this puts them 3 pixels into an object, they'll stop falling but won't be in the proper location. The character should appear to stop at the first pixel of impact.

So, how can I efficiently find the point of impact? I only have a vague idea of only comparing the outline pixels, testing for collision, and incrementing them up or down by one until there's a collision, but it seems like it might be complicated to pull off.

If you want to know the platform, I'm developing using XNA for Windows Phone 7.


texts: Does Unity have a built in pathfinding system?

texts: I know that there a lot of plugins available for pathfinding in unity but I was just wondering if unity has a built in pathfinding system ?


texts: Scaling physics engines beyond single computational server

texts:
Currently working on a small home project of developing our own game. The game basics are just a straightforward space game, currently without any collision detection/resolution, just movement with position, velocity, and acceleration.
The game is an MMO(RPG), so currently designing & implementing the backend / server / platform side of things.
So the only items we need to store right now for each object is linear and angular 3D vectors. we're doing this for the position, velocity, and acceleration.
So far, so good.
The question now comes to scaling wise: let's say, a single container of the physics engine has the computational power to calculate 10 rooms of 1000 objects each. It continuously calculates the new velocity and positions of all the objects and that's about it.
So what if we want to scale? I want to go to 20 rooms of 1000 objects, theoretically this seems straightforward: spin up another container and room 1-10 on container1, room 11-20 on container2.
However, what if one of those rooms in container1 suddenly goes to 5000 objects, this would mean container1 can no longer feasibly calculate this, so it should be moved (instantly) to container3.
The objects would all be stored on a redis in-memory database for purposes of speedily operations. The goal is to not have any limits to a single room or the amount of rooms, and just scaling the amount of containers based on the amount of total objects that are moving around in the whole game.
Similarly, the scaling down should be handled as well, if 5 containers are each operating at 10% capacity, it should be moved to 1 container.
We were discussing things such as event bus where we insert a repeating event to "tick" on roomX, a container would take this event, look at the total amount of objects in the room, and then determine how much it can handle.
The problem which we have here is that there's no guarantee the container will be done with tick_0 when another container could be working on the same room for tick_1.
Are there any other techniques we should consider doing to try and get this to figure out a scaling solution?
Other relevant things to mention:

the rooms are unrelated to each other
current programming language is Golang
platform can be cloud agnostic (kubernetes with whichever pods are needed)
client side will use an existing physics engine, as the client only has to draw the current room it's in
physics engine is aimed to "tick" in between anywhere from 2-10/second, depending on the results and the computational cost of each item in the room

Looking for any help or pointers to get us underway with this issue! Places to discuss this would also be greatly appreciated.
Best regards


texts: Godot - How to set the AudioStreamPlayer to switch between tracks

texts:
Conditional Music Playback

What's important here is that I know how to switch the track that's being played back to another if some condition is met in the scene. If possible I also want to know where to store the other tracks.

I looked into the documentation and have yet to find a solution that allows me to for example:

set the new track's file path and play it or...
store the track names in maybe an array and set them for playback in the script. (still requires something to change the currently playing track)

How do I switch the tracks based on any condition?


texts: LibGDX strange status bar in background [BUG]

texts:
I released an app and I noticed that some devices has a strange "bug" which I don't know if it's caused by Android, me or LibGDX.

That bug is related to status bar, normally app let you see the bar (time, battery percentage ...). In my app the statusbar shouldn't be showed but it seems to exist in some devices.

What is strange is that the bar isn't the same of the device but a general bar with random time and battery percentage. Sometimes the bar showed is an older Android version.


texts:
I would like to create randomly generated track from one point to another with specified length of that track (it can be 2 more or less as a result of that function) in matrix. I have function called buildRoad(x,y,length) where x is width of my matrix and y is the height.

I separately generate start and end point.

I have to do it as a stack by use of Vector class, so every point is connected to each other horizontally or vertically (e.g. (0,1)->(0,2)->(1,2)).

And here is the point that I really don't know how to do: I don't know how to connect start and end with such a track. Track cannot cross. It would be easy, but it needs to be random. I've already made easiest and shortest route to the end and I tried to implement some kind of probability of choosing (randomly) direction where track will go on next step.

But when track turn into corner (because it can) it's dead end and I should try to build track again. And it can fail again and again. I just need an idea how to solve it.

EDIT:


texts: Selecting the entities needed for rendering

texts:
Currently I'm sorting and looping every entity on my level but I really don't need to. Only a small subset would be on screen.

If I could extract a list of entities from my main list that are on screen (or near the screen), that would be great, but I believe maintaining a different kind of list like a quad-tree or something might be in order, but I have no experience with such things.

How can I do this?


texts:
I've decided to learn OpenGL. I worked through several tutorials. I've found it far too complex performing a simple task like doing sprite animation in openGL.

Now I read about JOGL which seems to be more accessible. So I actually have two questions.

Can JOGL help me understand OpenGL better?
Also important to me, will I be able upload my JOGL applications to Greenlight, MS-marketplace etc.?


texts: How to load/unload chunks data where view port is currently focused on?

texts:
I have a 2D tile based engine with infinite procedural chunk generation.
But I can't invent an algorithm, that will fill only chunk tiles on view port (and destroy old). Pls help
ViewPort size can changing on the fly (2 - 100)
I can't load all chunks completely, because I need to analyze the tiles in the visibility zone

class Map {
  public List<Chunk> { get; set; }
  public int viewPortWidth = 2 ... 100;
  public int viewPortHeight = viewPortWidth;
  public Vector2Int playerPosition { get; set; }
}

class Chunk {
  Tile[] Tiles { get; set; }
  public int chunkWidth = 16;
  public int chunkHeight = chunkWidth;

  public Chunk(int _leftX, int _bottomY)
  {
    for (int y = 0; y < chunkHeight; y++)
    {
        for (int x = 0; x < chunkWidth; x++)
        {
            randomNumberGenerator.InitState(x + _leftX, y + _bottomY);
            chunk[x, y] = randomNumberGenerator.Range(100);
            Tiles.Add[chunk[x, y]];
        }
     }
}


texts:
I'm slightly confused about how Direct3D rendering works. Basically, as long as I render to one surface, everything is fine. But when I try rendering to multiple surfaces, it seems like everything is still rendered to one surface. I think there's something wrong with my calls.

For each update cycle this is what I do
1. device->BeginScene()
2. sprite->Begin(...)

...
A bunch of GetRenderTarget to store the old render target, then SetRenderTarget to set a new surface, and then things like CreateVertexBuffer, SetTexture, etc to draw on the new render target. Then resetting to the old render target.

sprite->Draw([the back buffer]) (the back buffer is actually another surface, not the actual back buffer. But here it is being drawn onto the actual back buffer, I think)
sprite->End()
device->EndScene()
device->Present(...)

Also, it seems like if I mix sprite drawing and non-sprite drawing onto a surface, that first one set of render commands is executed and then the other set, rather than in order by when each command was called.

If anyone could shed light on any of this, it would be much appreciated.

EDIT: To clarify, my render targets are mainly surface 0 of the texture created by D3DXCreateTexture or D3DXCreateTextureFromFileEx.


texts:
Lets assume that i have a set of path that an entity should follow :

const int Paths = 2
Vector2D<float> Path[Paths] = { Vector2D(100,0),Vector2D(100,50)   };

Now i define my entity's position in a 2D vector as follows :

Vector2D<float> FollowerPosition(0,0);

And now i would like to move the "follower" to the path at index 1 :

int PathPosition = 0; //Start with path 1

Currently i do this :

Vector2D<float>& Target = Path[PathPosition];
bool Changed = false;

if (FollowerPosition.X < Target.X) FollowerPosition.X += Vel,Changed = true;
if (FollowerPosition.X > Target.X) FollowerPosition.X -= Vel,Changed = true;
if (FollowerPosition.Y < Target.Y) FollowerPosition.Y += Vel;,Changed = true;
if (FollowerPosition.Y > Target.Y) FollowerPosition.Y -= Vel,Changed = true;

if (!Changed)
{
    PathPosition = PathPosition + 1;
    if (PathPosition > Paths) PathPosition = 0;
}

Which works except for one little detail : The movement is not smooth!! ...So i would like to ask if anyone sees anything wrong with my code.

Thanks and sorry for my english.


texts:
At the moment I am trying to create a tech demo in directX 9. I have a good understanding of basic lighting but, in my game/demo, I want to be able to create and light a scene like the following:

Could someone please help me and point me in the direction of a good base light class, or where I could learn how to implement one myself?


texts: Best way to distribute graphics, audio and levels with an SDL game?

texts:
I'm working on finishing up a game written in C++ with SDL I've been working on for awhile, and I'm starting to ponder how I'm going to distribute it. It has hundreds of images that are loaded and used throughout the game, as well as a couple dozen .wav files for audio effects.

What is the best way to distribute these? Should I just include the folders with all the files? Or is there a way I can package them into a single file, then open and extract them in my application?

What's the best way to go about this?


texts: Help computing visibility in old 3d game format

texts:
I am trying to compute visibility in an old 3d file format. I am using a BSP tree have finally gotten everything built and traversable.

Now I don't have any sort of PVS, potentially visible set to work with so I need to know the most efficient way to choose what polygons to render as there are literally thousands of them. I should ideally only render the polygons that are near me and then cull the non visible ones.

Does anyone have experience with this?


texts: PIXI v4 - Is possible to disable Multi Texture Batching in PIXI v4 ?

texts:
I would like to know if is possible to disable the multi texture batching in a PIXI V4 game.

Recently i jus update my game PIXI lib from version 3 to 4.2. I`m using cocoon Canvas + . It seems perfect on iOS and android version greater than 5.
In a old phone the texture batching is messing with the textures.

https://www.youtube.com/watch?v=t6wVYRm731I&feature=youtu.be

Please. Is possible to disable it.

I already tried

PIXI["settings"].SPRITE_MAX_TEXTURES = 1;
PIXI["settings"].SPRITE_BATCH_SIZE = 1024;

without success


texts:
I am trying to create a new JavaScript project on Cocos Code IDE but every time it immediately give me the error message:

  Unable to find python. Please, click the setting button to set the python path, then python 3.0 or later is not supported.

I click the button and I set the path to C:\Python27 which is the folder of my python installation, and I try again but I get exactly the same error. The version of my python installation is 2.7.8. I am using Windows8.1.

EDIT: It occurred to me that there is also another error message:

the python's version must be greater than or equal to 2.7.5 and less than 3.0

But I cannot understand why it does not accept my version(2.7.8).


texts: Why does my SFML game cause screen tearing on Linux?

texts:
I wrote a little game of a bouncing ball, using SFML and Box2D.

On Windows, the graphics animate smoothly. However, on my Linux machine, the animation stutters randomly. To be precise, I get a horizontal video tearing effect.

I use the Intel graphics driver. I tried multiple solutions I found online to solve video tearing but I haven't been able to solve this. I've never had video tearing before (even in other OpenGL apps): It appears now for the first time.


texts: Should I develop with mouse in mind if I plan on targetting more than PC?

texts:
Pretty simple question but I am not sure of the answer.

Should I develop user controls that use the mouse, or ignore the mouse completely and use only button controls.

An example would be:

  Clicking on an item to pick up vs. Moving close to the item and
  pressing a button to pick it up.

What are your opinions on this, especially if you want to target more platforms than just PC?


texts: Problems implementing a 3rd person static camera in Unity3d

texts:
I am building a space game that I would like to be controlled in third person.

Basically I would like the camera and the ship to remain tied together and remain the same distance from each other but for the camera to remain in the same position relative to the ship from the world perspective. This position of the camera relative to the ship can only be altered by mouse movement and not by ship movements.

Example of the functionality required would be:

User can rotate the the ship on the x, y, z axis and the camera can observe these rotations
User can position the camera on the right side of the ship using mouse movements and activate thrusters to observe the ship in the center of the screen and the background objects passing
User can fly ship into an asteroid and observe rigidbody collider cause the ship to bounce back and start to rotate violently in a direction but the camera will remain stable and at a constant distance to the ship

Explanation from technical sense:

The camera must remain at (0,0,-100) from the ship in world coordinates and this position only changed using mouse movement using local position
Putting camera and ship in the same player object allows to control local coordinate to (0,0,-100) but from world perspective the positing of the camera to ship actually changes

Currently the main problem is that I can only either have the camera stuck in a constant position relative to the ship (cannot change perspective with mouse) OR I can change perspective with mouse but the rigitbody physics get applied to camera (if I hit an asteroid the camera rotates with the ship)

I also tried to use a dummy camera to track mouse movements and to just add it to the constant camera but when the ship rotated very quickly it wasn't very accurate.

Any suggestions for what I could use in order to get accurate response?


texts: I'm developing a game where I need to paint half of a image when the user is either wrong or right. To paint the image, I'm using setTint() to paint the image the color I need, but it paints the whole image, is there any way I can paint only half, using setTint or another method?


texts: opengl - flickering of fragments even with disabled depth test

texts:
I'm trying to render a quad with a coloured border. I'm using texture coordinates to detect whether the fragment should be considered part of border or not. If it is part of border, then render it with green colour or else with black colour.

Here are my vertices / normals / tex coordinates.

    float vertices[] = {
        // posistions          // normals           // texture coords
      -0.5f, -0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  0.0f,  0.0f,
       0.5f, -0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  1.0f,  0.0f,
       0.5f,  0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  1.0f,  1.0f,
       0.5f,  0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  1.0f,  1.0f,
      -0.5f,  0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  0.0f,  1.0f,
      -0.5f, -0.5f, -0.5f,  0.0f,  0.0f, -1.0f,  0.0f,  0.0f,
    }

Here's my fragment shader

#version 330 core

in vec3 frag_pos;
in vec3 frag_nor;
in vec2 frag_tex;

out vec4 frag_color;

void main()
{
    vec2 origin = vec2(0.01, 0.01);

    float width =  1.0 - origin.x * 2.0;
    float height = 1.0 - origin.y * 2.0;

    if( (frag_tex.x >= origin.x && frag_tex.x < origin.x + width) &&
        (frag_tex.y >= origin.y && frag_tex.y < origin.y + height) )
    {
        frag_color = vec4(0.0);
    }
    else
    {
        frag_color = vec4(0.0, 1.0, 0.0, 0.0);
    }
}

And this is how I'm rendering

glDisable(GL_DEPTH_TEST);
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 6);

In right, I'm drawing the same quad with another pass-through fragment shader in wireframe mode.

As you can see the left quad is flickering while moving the camera. Any ideas how to fix this.


texts:
I can't find a sulotions that solves my problem, I've tried pretty much every tip I can find, but with no luck.

Error :

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: assets/enemy.png

From code:

enemyImg = new Texture(Gdx.files.internal("assets/enemy.png"));

I've linked the asset file from android to desktop as I am supposed to. But still, no luck, the asset file in my desktop-project doesn't even update when I add my image to my android projects asset file.

Please help so I can get started :)

EDIT: Managed to load png now, but I have to manually put the picture in the desktop projects asset folder, so would still appriciate an answer on how to do it automaticly


texts: What are some methods which can be applied to make arcade-highscore games fun/interesting?

texts:
Consider an arcade game where you shoot falling objects and the goal is to beat the high-score.

What are some methods you can apply to such games to make the player feel it is fun and wants to play it again and again?


texts: How to achieve a layered terrain simlar to Godus

texts:
I'm currently playing around with a few examples and techniques for terrain generation and suddenly remembered the game Godus - seen below.

Youtube clip of Godus

Looking at the material above, it seems to me that they aren't just using a classic heightmap system, as there appears to be some bevel or flexibility in the angle of the edge faces (shadows aside).

However, more technical approaches, such as GPU GEMS 3 marching cube example seem a bit over the top.

Could I achieve this aesthetic with a heightmap and clever manipulation of vertices in a vertex / tessellation shader, or is there a better approach?


texts:
Some of you may know fraxy...

Basically, I was watching this video: http://www.youtube.com/watch?v=uL7zWdDCtOE And there are some times where some sprites spin really fast (4:00 mark for example), and I cannot figure how the motion blur effect was done.

I looked in the game folder, and found the sprite, it certainly does not has the blur added to it (in fact, it is even a .bmp! Not a PNG or anything that supporta alpha natively), and the engine IF using OpenGL, may not be clear (the resolution is fairly low too), also nothing else is getting blurred (so the effect is localized to some sprites... if you pay attention there are other moving objects that get blurry too).

So, how they do this glowing blur?

EDIT: On the video I am talking about the two things "spinning" in the left and right edge of the screen, they are shooting, and the sprite of their bullets are the same as their own sprite, but if you pay attention as they spin their sprites leave a trail, actually if you put the video some seconds before, you will see with the screen more empty, and the effect can be seen clearly.

EDIT2: I don't think Fraxy use shaders, and I am sure it does not use OpenGL either (since it run on computers that don't run OpenGL games). I know it is easy to do with shaders, with per-pixel calculations, I am asking how to do WITHOUT them.


texts: What is the best way to render eletric wires (like in gta 4)?

texts:
From the top of my mind, I see 2 ways to do it :

classic mesh. (but that's likely to be a lot of tris for little screenspace)
bilboards (but the placements of the billboards may be tricky. still looks like the best solution)
a box with a shader (the parametric shape would be in the shader, seems tricky).

Any idea ?

refs :
Screenshot1
Screenshot2


texts: I am developing an RPG game where there is a main world map, locations such as towns or ruins on that map and buildings in those locations where players can interact to go into. For example, I have a map and my character goes to a local town where there is a inn that I can freely enter and interact in. Once I wish to leave the building, I leave and I'll be at the same position that I had once entered the building from, albeit facing the opposite direction. The one problem that I have with imagining a map system that could be complex like this are the coordinates. Is there a way of accomplishing this with the use of universal coordinates, such as only one x and y position throughout all 3 stages of this map system, or would I need to have 3 coordinates, a Map coordinate system for the world map, a Local coordinate system for the town or ruin and a Temporary coordinate system for when I am in a building? Also, is there something in libGDX that could help out with this?


texts:
I've been trying to create a camera that is controlled by the mouse and rotates around a fixed point (read (0, 0, 0)), both vertical and horizontal. This is what I've come up with:

camera.Eye = Vector3.Transform(camera.Eye, Matrix.CreateRotationY(camRotYFloat));

Vector3 customAxis = new Vector3(-camera.Eye.Z, 0, camera.Eye.X);
camera.Eye = Vector3.Transform(camera.Eye, Matrix.CreateFromAxisAngle(customAxis, camRotXFloat * 0.0001f));

This works quite well, except for the fact that when I 'use' the second transformation (go up and down with the mouse) the camera not only goes up and down, it also closes in on the point. It zooms in.

How do I prevent this?

Thanks in advance.


texts: Need some help with Unity 2d animation controller

texts:
So my animations don't transition right. I have a 2d top down prototype project and animations for 4 directional movement and an idle position. Right now i have the movement set up so the right animation activates when the player moves in one of 4 directions. problem is that the walking animation does not stop when the player stops, it doesn't transition over to the idle animation.

My animation controller looks like this:

The parameter between the animations are an integer that signals which direction needs to play, from 0 to 3. I have been messing around with a speed float parameter, but I don't really know how to get it to work.

if (Input.GetKey (KeyCode.D))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(moveSpeed,GetComponent<Rigidbody2D>().velocity.y);
            animator.SetInteger("Direction", 2);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.A))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(-moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
            animator.SetInteger("Direction", 0);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.W))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, moveSpeed);
            animator.SetInteger("Direction", 1);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.S))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, -moveSpeed);
            animator.SetInteger("Direction", 3);
            animator.SetFloat("MoveSpeed", 0);
        }

Here is my movement code if it helps.

If I'm missing something important that you need to help me, please tell me.


texts:
I am fairly new to XNA and I have questions in regards to textures.

Most of my of textures have a background color along with the overall image (white, black, or whatever). This is quite ugly as the users main character, ship, or bullets, ect, have this black or white background with it. Is there any function, tool, or anything that will enable me to crop the actual part of the image i want to use as the texture?

I am by no means good with and photo editors or anything graphic related.

I came up short with google, as most results led me no where.

All help is appreciated. Thank you.


texts: How do I rotate, inverting flipping one local axis direction of a game object transform using C#?

texts:
How do
I invert my arrow that is pointing Z forward to point backwards? The arrow has it own rotation and position. The arrow is also linked to it´s parent rotation and moving position in space. I wish to rotate flip direction of my arrow conserving the direction of it, so that it points in the opposite direction of one local axis (Z for example). Without losing the parent or it´s own direction in space.

transform.localRotation = Quaternion.... Z * -1

Is there more than one way to do this?

Probably by rotating in Y 180°?
I wish not to scale Y to -1.

transform.rotation = new Quaternion.AngleAxis(Vector3.up, 180f);


texts: How can I center a circle around a point on an HTML canvas?

texts:
I've got a job to make an engine and light game for canvas in HTML5. I like the things I make to be centered on the x,y positions I give it, I don't know why, it just helps me think about them clearer. I've got it set up for rectangles, all I had to do was subtract half the hieght and half the width from the x/y supplied like this:

c.fillRect(x-width/2,y-height/2,width,height);

But I'm rather stumped when trying to do this with arcs. At first I thought it would be simple, I just did this:

c.beginPath();
c.arc(x-rad/2,y-rad/2,rad,0,Math.PI*2,false);
c.closePath();

But here's how they look when I try them out, 4 rects of increasing width/height and 4 circles of increasing radius.

Does anyone know the math needed to calculate the correct offset for arcs?


texts:
I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the canting of the track at each point.

My problem is that I don't know how to calculate the correct canting / slope of the curve, in such a way that it would be optimal or at least visually nice for a car to 'slant in the corner'.

My idea was to use the direction of the 2nd derivatives of the curve, however while this approach looks fine for most of the track, there are points in which the 2nd derivative makes sharp 'twists' / very quick 180 degree flips. I also read about 'knots' of bsplines, but I don't know if such 'twist' in 2nd derivatives is a knot or knots are something else.

Can you tell me that using a BSpline:
1. How could I calculate a visually nice canting of a track for a racing game?
2. Is it possible to do this by using some simple calculations of centripetal force / gravity?
3. Is it possible to do this by using 1st, 2nd and 3rd derivatives of the BSpline curve?

I am not looking for the 'physically correct' canting angle for the track, I would just like to create something which is visually pleasing in a simple game.

I am using a framework which has a built-in class for BSpline, including support for 1st, 2nd and 3rd derivatives of the curve.


texts: Mute/Unmute Sound For All Game Scenes by pressing Button

texts:
My Question is simple i just want to Mute/Pause All Sound of the Game having different scenes.

From Scene 1 Which is a Main Menu I Have Two Button On/Off .
When i press On Button it stops or mute full game sound or music like Car sound etc in all Scenes.
When i press off button then Sound become active again in all scenes ..

I'm new in this field so please give me some help My Game is almost Complete But i can not Control or Mute All scene Sound at the same time..Waiting


texts: Interpolating between two networked states?

texts:
I have many entities on the client side that are simulated (their velocities are added to their positions on a per frame basis) and I let them dead reckon themselves. They send updates about where they were last seen and their velocity changes. This works great and other players see this work find. However, after a while these players begin to desync after some time. This is because of latency.

I'd like to know how I can interpolate between states so they appear to be in the correct position. I know where the player was LAST seen and their current velocity but interpolating to the last seen state causes the player to actually move -backwards-. I could not use velocity at all for other clients and simply 'lerp' them towards the appropriate direction but I feel this would cause jaggy movement. What are the alternatives?


texts:
Okay I bought this asset online so I would like not to show the whole script. The problem is this asset stopped working when I updated from unity 5.0 to 5.1.2. The script is for a controller GUI interface but it seems to be giving me an error :

  NullReferenceException: Object reference not set to an instance of an
  object UnityEngine.UI.Selectable.Select ()

on this line of code :

selectedOject.GetComponent<Button> ().Select ();

so there is a null reference and its no longer recognizing the child objects as buttons is what I'm assuming

if you want to have a better look at his set up he has a short video On youtube :
HERE

I would like to continue to use this script and continue updating Unity.


texts: Preparing A Grid in Unity (Procedurally)

texts:
I am trying to create a grid. But the renderer only renders ONE cell of the grid.

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

public class Cell
{
    public List<Vector3> Vertices;
    public List<int> Triangles;

    public Cell(int x, int y)
    {
        Vertices = new List<Vector3>();
        Triangles = new List<int>();

        Vertices.Add(new Vector3(x - 1, y + 1, 0));
        Vertices.Add(new Vector3(x + 1, y + 1, 0));
        Vertices.Add(new Vector3(x + 1, y - 1, 0));
        Vertices.Add(new Vector3(x - 1, y - 1, 0));

        Triangles.Add(0);
        Triangles.Add(1);
        Triangles.Add(3);
        Triangles.Add(1);
        Triangles.Add(2);
        Triangles.Add(3);
    }
}

public class GridComponent : MonoBehaviour
{
    public int resolution = 8;

    List<Cell> cells = new List<Cell>();

    List<Vector3> gridVertices;
    List<int> gridTriangles;

    Mesh gridMesh;

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

    void Start()
    {
        gridVertices = new List<Vector3>();
        gridTriangles = new List<int>();

        for (int x = 0; x < resolution; x++)
        {
            for (int y = 0; y < resolution; y++)
            {
                Cell cell = new Cell(x, y);
                cells.Add(cell);
            }
        }

        foreach (Cell cell in cells)
        {
            foreach (Vector3 vertex in cell.Vertices)
            {
                gridVertices.Add(vertex);
            }
            foreach (int triangle in cell.Triangles)
            {
                gridTriangles.Add(triangle);
            }
        }

        gridMesh.vertices = gridVertices.ToArray();
        gridMesh.triangles = gridTriangles.ToArray();
    }
}


texts:
I'm trying to create a simple rogue-like game in ncurses in a C program.

The idea here is that, I'd parse a file like this:

10X10 ds2 de2 dw5
12X12 ds3 de2 dw1
14X14 ds5 de1 dw5
10X10 ds5 de3 dw5
12X12 ds5 de2 dw5
14X14 dw2 de1 ds2

Where the first number is a door size(rows,columns), the second string being a door, where s = south, w = west, etc, so ds2 = door south 2 down (in the y direction).

Effectively, this looks like this when parsed, I have this:

Where (hopefully viewable), the plus signs at the end of each room, are the doors that lead to another room, so in the first room, the east door would lead to the room to the right, etc.

However, this is where I'm not sure how to go about implementing my logic. I need to make it when I step on a plus sign "effectively" a door, I'd teleport the player (the @ sign cursor) to the correct door.

Okay, great I know the locations of each doors, but how would I actually mvoe the cursor to the next room.

I can't simply hard code the distance between two rooms, as that's just ineffective and would take too long.

Just to clarify, what I mean about teleporting:
See this picture:

Where the user "@" symbol would move to the door (in the first room), then get teleported to the second room (12x12 room).  (AS seen in the next picture) (Again where the @ symbol is the user, moving the cursor around (w,a,s,d).

So to clarify: I need a way to move a cursor, between two rooms, without hardcoding the distance between rooms, unless there is an effective way to hard code the distances.

Any ideas?


texts: I've reached the saving part of my game, as in, you press save and it writes to a text file, but I've noticed that most games and programs out there use custom save formats, like Dwarf Fortress DAT files. What are these? are these just text files formatted for the program, or are they a lower level thing?


texts:
Earlier I required assistance getting to grips with how to retain the alpha channel of a transparent texture in my colourised texture shader program.

Whilst playing with that first version of my program (before obtaining the solution to my first requirement), I managed to enable transparency for the whole texture (effectively blending via GLSL), and I quite liked this, and I would now like to know if and how it is possible to retain this blending effect, on top of the existing output without affecting the original alpha channel - as I don't know how to input this transparency via the parameter that is already being provided with the textures alpha channel.

A basic example of the blending program I am referring to (minus any other functionality) is as follows...

varying vec2 texCoord;
uniform sampler2D texSampler;

void main() {
    gl_FragColor = vec4(texture2D(texSampler,texCoord).xyz,0.5);
}

Where 0.5 is the transparency (blending effect) of the whole texture.

This is the current version of my program, which provides the ability to colour a texture according the colour parameter passed to the program, and retains the alpha channel of the original texture.

varying vec2 texCoord;
uniform sampler2D texSampler;
uniform vec3 colour;

void main() {
    gl_FragColor = vec4(colour,1)
    * vec4(texture2D(texSampler,texCoord).xyz,texture2D(texSampler,texCoord).w);
}

I need to know if it is possible to apply transparency on top this program, without affecting the original alpha channel which I have already preserved.

I hope this makes enough sense, I am sure it is possible, and if so I should imagine it is rather simple, but this has me stumped. Any help much appreachiated.

Cheers, Chris


texts: How can I render text with modern OpenGL and stb_truetype, and why are the loaded textures black?

texts:
I've spent the past couple of days just desperately trying to get stb_truetype to render anything using the simple example provided https://github.com/nothings/stb/blob/master/stb_truetype.h#L242-L281, however, no matter what I tried, the texture being loaded always ends up being completely black.

I've tried writing the generated texture data back to a .png file as

lodepng::encode("foopng", temp_bitmap, 512, 512, LCT_GREY);

and the font actually gets rendered properly

However, when I inspect the loaded texture in Nsight (or CodeXL), it looks completely black, and upon inspection of the actual data in the texture in CodeXL, it shows zeros basically everywhere, except for one small blob of a few non-zero numbers (which is nothing like the saved PNG).

I also tried changing to a different font and the generated quad geometry does change, as do the generated texture coordintes by stbtt_GetBakedQuad(...) (I even tried to manually set the texture coordinates all the way from 0 to 1 on the edges of the quad).

I'm not sure if it's CodeXL and Nsight both mis-interpreting the contents of the texture, even though the data view in the screenshot shows each byte, but when rendering I also get everything rendered with this texture completely black.

Is the texture being loaded incorrectly, or am I doing something else wrong? I'm using OpenGL 4.4.


texts: Rendering arbitrary text in XNA using Windows API?

texts:
In Andrew's comment on my other question, he noted that it was possible to render text to a Texture2D using the Windows API, instead of drawing the text directly with a SpriteBatch. How is this done? I'm guessing there's an intermediate step before writing the image data to a Texture2D.

I'm asking because this would allow me to render Unicode characters on-the-fly, instead of needing to pre-render all the needed glyphs using a SpriteFont (too many glyphs in Korean and Japanese to make this route infeasible, sadly). Thanks!


texts: How to determine what difficulty is right for the game?

texts:
I am targeting mass casual audience as I am developing the hyper-casual game. The problem is that I have played Helix Jump and Color Bump 3d and those games have a pretty big difference in difficulty level (well at least for me). They are both considered hyper-casual, both target mass casual audience and both have market success.

If two so similar games have such decent difference in difficulty how to determine that the difficulty of my game is just right? It's easy to say that it's subjective but when you invest so much time in your project you need to have at least some benchmark to work with. How to define this benchmark?


texts: Is there any way to use a steering wheel in Unity? All I find online is people with the same problem. The numbering on the axis are not the same as with keyboard input. In some cases left is 1 and as you turn it more to the left it gradually goes down to 0 even though you are still turning left


texts: UE4 Crashes when editing migrated Nvidia Flex emmiter?

texts:
I'm new to Nvidia Flex, and I've been trying to migrate the TestPackages (the folder with the pre-made emmiters and soft/rigid bodies,) over to my project. I've only been migrating the TestPackages folder and nothing else. Then, when I try to edit one of the fluid emmiters (flexTestEmmiter.uasset), UE4 completely crashed and gives me a crash log which I've put below. Please help, I'm not sure what to do. And if you can, an in-depth explanation would be lovely, as I'm not very familiar with C++ or UE4 in general. Thank you! :)
https://pastebin.com/H9fSrFhV


texts: in box2d how to decrease joint's reaction force?

texts:
I'm trying to make a game like cut the rope and meet some problems.
when I create a float bubble and connect with a rope(a sets of bodies connected with revoluteJoint), the rope will become longer and when I destroy the bubble,rope gives a a big reaction force to candy, so how to decrease this reaction force?
to simulate bubble's floating, I did this

class Bubble extends PhyObject
{
     override function draw():void{
         if(this.combined){
            this.getBody().SetLinearVelocity(velocity);//velocity=new b2Vec2(0,-3.5);
         }
     }
     //other code
}
class Main{
    public function loop(){
        getAllPhyObject().forEach(function(phyObj){
              phyobj.draw();
        });
    }

}

so if bubble was combined with candy ,It "float".
I think maybe I can do this
pseudo code:

if(bubble is connected with rope)
{
    //dynamic adjust bubble's linear velocity with rope's reaction force
}

but I just cannot figure out how to dynamic adjust bubble's linear velocity.and is there a simpler way to solve this problem?
thanks!
update
finally I solved my problem,so I write it down and hope it help to you.
below code is grab from b2BuoyancyController and it works in my case.

    //buoyancy
    private function float():void {
        if (bodies.length < 1)
            return;
        var body:b2Body = bodies[0];
        if(body.IsAwake() == false){
            //Buoyancy force is just a function of position,
            //so unlike most forces, it is safe to ignore sleeping bodes
            return;
        }
        var normal:b2Vec2 = new b2Vec2(0, -1);
        var offset:Number = 20;
        var density:Number = 2;
        var velocity:b2Vec2 = new b2Vec2(0, 0);
        var linearDrag:Number = 2;
        var angularDrag:Number = 1;
        var gravity:b2Vec2 = toolkit.world.GetGravity().Copy();
        var areac:b2Vec2 = new b2Vec2();
        var massc:b2Vec2 = new b2Vec2();
        var area:Number = 0.0;
        var mass:Number = 0.0;
        for(var fixture:b2Fixture=body.GetFixtureList();fixture;fixture=fixture.GetNext()){
            var sc:b2Vec2 = new b2Vec2();
            var sarea:Number = fixture.GetShape().ComputeSubmergedArea(normal, offset, body.GetTransform(), sc);
            area += sarea;
            areac.x += sarea * sc.x;
            areac.y += sarea * sc.y;
            var shapeDensity:Number = 1;
            mass += sarea*shapeDensity;
            massc.x += sarea * sc.x * shapeDensity;
            massc.y += sarea * sc.y * shapeDensity;
        }
        areac.x/=area;
        areac.y/=area;
        massc.x/=mass;
        massc.y/=mass;
        if(area<Number.MIN_VALUE)
            return;
        //Buoyancy
        var buoyancyForce:b2Vec2 = gravity.GetNegative();
        buoyancyForce.Multiply(density*area)
        body.ApplyForce(buoyancyForce,massc);
        //Linear drag
        var dragForce:b2Vec2 = body.GetLinearVelocityFromWorldPoint(areac);
        dragForce.Subtract(velocity);
        dragForce.Multiply(-linearDrag*area);
        body.ApplyForce(dragForce, areac);

        //tmpForce
        if(candy.bodies.length>0){ //TODO 你妹!!!!!
            var tmpForce:b2Vec2 = candy.bodies[0].GetLinearVelocity();
            body.SetLinearVelocity(tmpForce);
            //tmpForce.x = 0;
            //tmpForce.Subtract(velocity);
            //tmpForce.Multiply(-linearDrag*area);
            body.ApplyForce(tmpForce, areac);
        }
        //Angular drag
        //TODO: Something that makes more physical sense?
        body.ApplyTorque(-body.GetInertia()/body.GetMass()*area*body.GetAngularVelocity()*angularDrag)
    }

tips:use force instated of impulse and changing linear velocity.


texts:
The bottom region of the screen is filled by a repeated texture:

grassTexture = new Texture(Gdx.files.internal("images/grass.png"));
grassTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
grassSprite = new Sprite(grassTexture, 0, 0, width,grassTexture.getHeight());

However, The grass should also be scrolled to the left (looping texture from edge to edge).
I have got this in the render() method:

scrollTimer += 0.0007f;
if (scrollTimer > 1.0f)
        scrollTimer = 0.0f;
grassSprite.setU(scrollTimer);
grassSprite.setU2(scrollTimer+1);
grassSprite.draw(spriteBatch);

The scrolling part now works. However, the grass texture is not repeated anymore. It looks like this:


texts: XNA - Update vertices property stored in a VertexBuffer

texts:
I've a class that creates a cube using VertexPositionColor and these vertices are stored in  a VertexBuffer. Now i would like to dynamically change the color of my vertices. In my class i have a reference to a VertexPositionColor array wich contain all my vertices. I've wrote a SetColor function wich accept a Color in parameter and update each Color property of my vertices. But when i call it, it doesn't work. This is normal because vertices are stored in VertexBuffer and is not updated.

So, how can i update vertices property and keep using VertexBuffer?


texts: How can I handle collision detection between many objects efficiently?

texts:
I have made a game that runs poorly. I suspect that the way that I programmed the collision detection in the game loop could be the problem.

My game has two player-controlled tanks which fire missiles; there are also power-ups, "gifts", that tanks can collect from the field. At every iteration of my game loop, I detect collisions like this:

Loop through all the missiles on the screen, and update their location (move them).
Loop through all of tank 1's missiles, and for every one check if collides with tank 2.
Loop through all of tank 2's missiles, and for every one check if collide with tank 1.
Loop through all the missiles on the screen, and check if collide with screen boundaries.
Check if the two tanks collide with each other.
Loop through all of the four "gifts" on the screen, and check if they touch a tank.

This method is presumably inefficient. How can I implement collision detection for all of these objects in a better fashion?


texts: What data structure should I use for a Diablo/WoW-style talent tree?

texts:
I'm considering implementing a talent-tree system for an online RPG, similar to that seen in World of Warcraft, where acquiring a skill unlocks the next "tier" beneath it in the tree.

Does anyone know of the best way of implementing this structurally in the database/code?


texts: Tower Defense: Sorting Algorithm with multiple weights (enemy AI)

texts:
I'm writing a sorting algorithm for a tower defense mobile game. As a quick synopsis, I have a "tower" that can shoot at incoming threats that are within X distance from the base of the tower.
Each incoming enemy, will have an associated {distance_from_tower} and {enemy_weight}. The {distance_from_tower} will be a value between 0 and X (X being the max range of the tower). The {enemy_weight} is a valued weight of "how important" it is to target that enemy mob. For example:
Three enemies:
Archer: {distance_from_tower} = 3 , {enemy_weight} = 1
Knight: {distance_from_tower} = 7 , {enemy_weight} = 5
Zombie: {distance_from_tower} = 10 , {enemy_weight} = 3
Currently, I have a simple sorting algorithm that only sorts enemies by their distance from the tower. (So, in the above example, the tower would target: Archer --> Knight --> Zombie)
Which is a "fine" first logical step, but I want my towers targeting to be more robust. I want the sorting to take into account both the {distance_from_tower} AND the {enemy_weight}. (For reference as well, these two values are updated at every Z seconds during the game, so they are constantly being recalculated).
I would like for the tower to be "smarter" and have a more robust sorting mechanism, that takes into account both weights, as said above. That could potentially lead to the tower targeting an enemy mob that is further away because the {enemy_weight} value of that respective enemy mob is of "high priority". (So, in the above example, the inclusion of using both weights could lead to the tower targeting in this order: Knight --> Archer --> Zombie).
I've been digging around for a few possible solutions, such as using a Travelling Salesman approach, Dijkstra's algorithm, or Floyd's algorithm, and I can't figure out the best way to go about sorting using both weights in a manner that makes sense to me. Any intuition or help is greatly appreciated! Thanks!


texts: How to I coordinate a camera with the eyes of a model?

texts:
I am currently working on an FPS in XNA and I wanted to know how I would position the camera at the eyes of the model and whenever the model rotated or moved it's head (where the eyes are), the camera would move along with it. Also, whenever the player moves the camera (with their mouse) the model would turn it's head and eventually it's body.

I believe this would reduce the need for constant transformations and the planning of cutscenes by having an animation play and the camera follow that animation. It would also cut the need for transforming the model constantly when I add a future multiplayer.

I'm also open to any other ideas, so please, leave a comment letting me know what you think would be good and efficient.


texts: Efficient Collision Detection With Numerous Objects at Once

texts: I am developing a 2D game with very large levels in which two teams(around 200 objects per team) fight against each other in planes, tanks, turrets,...etc. With every entity shooting bullets at their enemy it is expected that there would be a numerous amount of objects at one instant. What collision detection algorithm could I use to support collision for a massive number of entities at once? The objects are simple figures(rectangles and circles). Would a brute force approach suffice or break up the level into a grid?


texts: In game engine, how to get the vertices buffers of different vertex formats for render from the mesh file properly?

texts:
I'm a fresher on engine programming. I have a question of how we can get the vertices buffers of vertex formats from the mesh file.

For example, in OBJ file or FBX file, we save the positions, normals separately. So the whole mesh file is a structure of different arrays which contain the different attribute of the vertices.

But when we offer those data to the graphics card, we'll offer an array of vertex structs, here the vertex struct contains the position, normal, UV... for one vertex.

So, suppose we want to generate different vertex buffers for different shaders from the mesh file(the struct of arrays), then I think we can use 2 solutions:

generate a different array of structs, here the different struct will be the different formats of vertices.
The problem is: It takes a lot of memory to save the different vertex buffers.
generate a general array of struct, here the struct contains all of the vertex attributes we can get from the mesh file, and use offset to get the correct data for different vertex format.
The  problem is: will it be slow for shader program to access the vertex data?

Which one is the better way to do? Or is there any better solution?
Again, I'm just a fresher, So I hope my description is clear enough for the problem :-)

Thank you all very much!


texts: C# multi-player socket server (need clarification/suggestions)

texts:
I've been working on an 2D-RPG for a while and I recently decided to make it into an MMO (not really massive, but multi-player). Anyways, I'm attempting to write a game server in C#. Yes, I know I could use a commercial solution like SmartFoxServer or Photon, but I want to make it a learning curve by going through the pain of doing it myself. It's pretty much going to be a simple zone-room architecture that handles events and sends position updates a few times in a second.

A lot of articles I read recommended using UDP but I'm limited to TCP because my client will be a browser based flash file. I've pretty much worked out in my head how I want everything to work, the binary protocol and etc, but I'm stuck at the beginning.

I'm not quite sure how to start. I've read about 3 different types of socket communication in C#:

Blocking - I know I can't use this because the main thread will be blocked when accepting connections and etc.
Non-Blocking
Asynchronous

I don't know which is the better, or the obvious choice for what I'm trying to do. I want the server to be scalable and handle a few hundred concurrent connections. I tried to study SFS and it seemed like it had multiple thread pools, for accepting connections, receiving data and sending data respectively. I had it in my mind that I would do it the same way and use the ThreadPool class, but I'm not sure of the difference between non-blocking and asynchronous.

Can someone clarify to me the difference between the two and which one is the better choice for me. I would appreciate any link you think might help as well.


texts:
I'm trying to write some collision detection code.

ATM i have the code properly resolving Ellipsoid v. Ellipsoid collisions, and Box v. Box collisions, but Ellipsoid v. Box collisions doesnt work.

In general how do you test for interesection between these two.

What i've been doing is:

Finding the closest point on the ellipsoid to the box, and vice versa.

vector3 closestVertexOnBox = // Closest vertex on the box to the ellipsoid;
vector3 closestPointOnEllipsoid = // Closest vertex on the ellipsoid to the box

In this case ( ellipsoid v. box ) you have 4 axes.

The axis from the center of the circle to the nearest point on the box.
The X,Y,Z standard axes ( assuming its an AABB ) -

Put them all in an array

 vector3[] axes = { normalize( closestVertexOnBox - ellipsoid.origin ), unitX, unitY, unitZ }

Then for each axis in that array, Project the vector from the center of each shape, to its vertex closest to the other shape; onto each axis to find the projected half widths.

float minOverlap = infinity
vector3 overlapAxis;

for each axis in axes
{
    float prjBoxHalfWidth = Dot ( axis , closestVertexOnBox - box.origin )
    float prjEllipsoidHalfWidth = Dot ( axis , closestPointOnEllipsoid - ellipsoid.origin )

If the sum of any of the projected half widths are smaller than the projected distance between the two, then their is no collision

    float prjDistance = Dot( axis , box.origin - ellipsoid.origin )

    if(prjBoxHalfWidth + prjEllipsoidHalfWidth < prjDistance) return // no collision

Now get the axis with the least overlap out of all of them

    float overlap = prjBoxHalfWidth + prjEllipsoidHalfWidth - prjDistance

    if(overlap < minOverlap) {

         minOverlap = overlap;
         overlapAxis = axis;

    }

Then resolve the overlap

ellipsoid.origin += overlapAxis * minOverlap/2
box.origin -= overlapAxis * minOverlap/2

Thats pretty much my ( pseduofied ) code. If thats good, then i might have an error, but thats wrong, then what am i not taking into consideration or forgetting.


texts:
My Google-fu is failing me: is there a site in the same vein as Rent a Coder, but for hiring artists?  In particular, I'm looking for a site which fits the following criteria:

Allows me to specify the style and scope of the work I'm looking for beforehand
Allows artists to "bid" on the project, including time and cost estimates
Showcases the work of the bidding artists so that I can see what kind of quality I can expect from each bidder
Is designed specifically for smaller, short-term projects or one-off graphics

It seems that the original incarnation of Rent a Coder is dead (the above seems to be some sort of knockoff), and that it was probably killed by an unsustainable market full of unrealistically low bids for large projects by unskilled and unqualified "coders."  That being the case, such a site might be poorly suited to art as well.

The reason I'd like such a site, though, is that as a "bedroom programmer" with a small budget and little experience in this sort of thing, I have no idea where I should be looking for art or how much I should reasonably expect to pay.  Thus, a site with good competition where market prices are somewhat transparent would be ideal.

Any other suggestions about how best to acquire custom artwork as an indie developer are also appreciated.


texts: OpenGL different sized textures for the same framebuffer?

texts:
With OpenGL 3.3, is it allowed/okay to bind different sized textures to a frame buffer?

I.e.

glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D, GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture200x200,0);
glViewport(0,0,200,200);
/*....
some time later
... */
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D, GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture500x500,0);
glViewport(0,0,500,500);

I.e. texture200x200 is a 200x200 sized texture, and texture500x500 is 500x500, fbo is the same framebuffer each time.

My use case is a need to render to texture several times in a frame, and each of these textures is arbitrarily sized.


texts: (LibGDX/JAVA) How can I get a rectangle to rotate with this pendulum so I can start detecting collisions?

texts:
One of the objects in my game is a pendulum that swings in a semi-circle. This is done by having an update() method like this:

public void update() {
    angleAcceleration = +1.81 / length * Math.sin(angle);
    angleVelocity -= angleAcceleration * 0.1;
    angle -= angleVelocity * 0.1;
    // Update the animation and bounds check index
    pendRegIndex = (int) (pendulumRegions.length * ((0 + angle) / (angle * 2)));
    pendRegIndex = pendRegIndex >= pendulumRegions.length ? pendulumRegions.length - 1
            : pendRegIndex;
    pendRegIndex = pendRegIndex < 0 ? 0 : pendRegIndex;
}

where pengRegIndex is the index of the texture regions (used by my animator class) and pendulumRegions is the texture regions that bound a full swing of the pendulum. I also write this line in the draw method:

    public void draw(SpriteBatch batch) {
    batch.draw(pendulumRegions[pendRegIndex], getxPos() - sprite.getWidth()
            / 2, getyPos(), sprite.getWidth() / 2, 0, sprite.getWidth(),
            sprite.getHeight(), 1, 1,
            (float) (angle * MathUtils.radiansToDegrees));
    }

This class extends an abstract class GameObject which has a predefined method getRectangle() which is usually what I use for collision detection. However, the rectangle that gets drawn when I call the method for the pendulum is it's starting position rather than a rectangle that swings with the pendulum.

How can I test for collisions with this object? The line I use in draw() rotates the pendulum but I'm not sure how to rotate a rectangle to follow the same swing. Any ideas?

Grateful for any help.


texts: How does the Direct3D 9 rasterizer determine triangle coverage?

texts:
I'm working on a software rasterizer to use in my project. I have implemented one that works well, however, often my rasterizer under or overestimates triangle coverage. I need perfect emulation of the hardware rasterizer. I'm using the exact same rasterization rules from MSDN (including the top-left rule).

How does the Direct3D rasterizer determine which pixels are covered by a triangle? What's the algorithm being employed? Does it rasterizer use the pixel center coordinate or the pixel's top-left coordinate when determining triangle coverage?

When I use the pixel's top-left coordinate I get better results. I've also been determining the planes perpendicular to the triangle's edges, then admitting pixels if their coordinate is "behind" each plane.


texts: OpenGL Post Processing Introducing Artifacts on Certain Systems

texts:
Playing around with God-Rays in my framework, I was greeted with the following artifacts on my laptop:

The artifacts themselves act almost like noise, flickering around the image rapidly. They also appear in colors that are not in the source image whatsoever.

Running the program on a PC yielded the correct results with no artifacts whatsoever. The program also experienced the same artifacts on another identical laptop (these laptops are distributed by my faculty, so they are going to be as identical in hardware and software as you can get).

I'm just not sure how to approach an issue like this one. I imagine the source of this issue will be very tricky to find, so I am just hoping someone can offer some advice to put me on the right track to isolating the issue.

Some potential clues:

In Nvidia's Nsight frame capture system, the artifacts are not static! Even though I should be viewing a "screenshot" of the current frame-buffer, the artifacts are still dynamic and moving around like noise on an old TV.
Multiplying the final result of the GodRay directly influences the amount of artifacts. If multiplied by zero, they no longer appear.
The seam between the two triangles of the full-screen quad can be seen running from the top left to the bottom right.
I have up to date Drivers. Version 347.52 on the NVS 5400M. I have also tried 347.25, but there was no difference.
OpenGL is not generating any errors
I am using an OpenGL 4.5 Core profile
I have never had any graphical issues in other programs running on my laptop.

Fragment Shader

#version 450 core
#define NUM_SAMPLES 128

uniform float Exposure;
uniform float Decay;
uniform float Density;
uniform float Weight;
uniform vec2 LightPositionOnScreen;
uniform sampler2D uTex;

in vec2 texcoord;

out vec3 outColor;

void main()
{
    vec2 texCoord = texcoord;
    vec2 deltaTextCoord = LightPositionOnScreen - texcoord;
    deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * Density;

    float illuminationDecay = 1.0;

    for (int i = 0; i < NUM_SAMPLES; i++)
    {
        texCoord += deltaTextCoord;
        vec3 tap = texture(uTex, texCoord).rgb;
        tap *= illuminationDecay * Weight;

        outColor += tap;

        illuminationDecay *= Decay;
    }

    outColor *= Exposure;
}

Thanks for taking the time to read my post! I will update if the source of the issue is found.

Edit:
Issue solved by: chipgw

Initializing outColor to vec3(0.0, 0.0, 0.0) before the loop removed the artifacts.


texts: How do I display same “proportional” text size on different resolutions?

texts:
I draw some text on screen using ID3DXFont::DrawText. This text should be displayed the same regardless of screen resolution.

For example, if screen resolution is low, text wrapped and when it is higher text is not wrapped. How can I avoid such situation? I want text size to be connected to screen resolution so if resolution is lower I want the text to be relatively smaller so that no wrapping happens. Is there any way?

Thanks in advance