Jump to content

  • Log In with Google      Sign In   
  • Create Account

Mussi

Member Since 12 Oct 2004
Offline Last Active Today, 04:48 AM

Posts I've Made

In Topic: Confused About Frames Per Second

Yesterday, 12:29 PM

You're right, I did actually modify it so that the render call only happens when it runs an update of the game state, because why render if nothing has changed?

I'm not sure what you mean by tweening though.

 
Something has changed, time. The idea of having a fixed time step is separating the update rate of your simulation from rendering. Time does pass between your simulation steps and whatever you render to the screen should reflect that. As you have noticed, if you dial down the simulation rate, everything seems to jitter and not be as smooth as you'd expect it to be. The solution to this is to interpolate everything between the previous state and the current state (tweening) based on how much time has passed since the previous state.
 
Put in code, it looks something like this:

accumulator += deltaTime;
while(accumulator >= simulationStepTime)
{
    // store current position as previous position
    // update game state and current position
    accumulator -= simulationStepTime;
}

float interpolation = accumulator / (float)simulationStepTime;
V3 interpolatedPosition = (1 - interpolation) * previousPosition + interpolation * currentPosition;
DrawObjectAt(interpolatedPosition);

Now you can dial your simulation rate to 1Hz and it'll still look smooth as long as your FPS is 25+. The trade-off is that lower rates introduce more latency, in the case of 1Hz it would take up to 1 second before you notice any changes, but with decent rates (20Hz+, less than 50ms latency) you shouldn't notice any difference with any other game out there.


In Topic: c++ gui library suitable for game?

11 May 2016 - 06:41 PM

and if I want to wirte an editor with opengl content, can I use imgui?

 

Sure, have a look here and see what others have created with it.


In Topic: A Brain Dump of What I Worked on for Uncharted 4

11 May 2016 - 05:05 AM

Lovely read, thanks for sharing! :)


In Topic: Procedural wall angle detection & intersection point

08 May 2016 - 03:18 AM

I'm not sure I understand what you're trying to do, but if you can brute force it you already have a sort of solution it seems? Have you tried splitting meshes up into ground and not ground before hand so that you don't have to do that at runtime? You could also use a quadtree or an octree to only test against meshes that are nearby instead of all of them (a simple bounding sphere range check might also do it). Another solution might be to use meshes that are approximations of the meshes being displayed, less triangles to sift through.

In Topic: Returning by value is inevitable?

26 April 2016 - 12:08 PM

Anyone care to explain what is wrong with the static variable solution? I've used this for years and always thought it was a convenient and fast solution.

 

It's not faster nor more convenient than RVO. Also, it breaks on multi-threading.


PARTNERS