Hi, I got a few issues with my game frameworks, and I can't find the best solution to the problem.
Here's a long story short of my problem:
-my framework use fixed timestep updates (the physics engine require this)
-the "rendering" information (animation states, rotation, position) is also updated in the update(float t) function, which is called every n ms (fixed timesteps)
-the render() function then renders the game based on all "rendering" information
However, with "low" tickrate (20 Hz, 25 Hz), it looks soo jittery. I can't handle it. here's how the main loop looks (pseudo code)
int run()
{
float lasttick=get_ticks()*0.001, curtick, dt=1.0/20; //it's 20 Hz update rate
float accum=0.0f;
while(running)
{
curtick=get_ticks()*0.001;
accum+=curtick-lasttick;
lasttick=curtick;
while(accum >= dt)
{
do_input();
simulate(dt);
accum-=dt;
}
render();
}
return 0;
}
result? incredibly stable physics simulation (for now I merely do spring rope simulation, and when I used variable timesteps, it sometimes ASSPLODE! but fixed it now thanks to fixed timesteps).
However, the rendering is a bit "jerky", I could understand this since I only update their position every 50 ms, which is insufficient to trick my eyes into thinking that it's moving fluidly instead of jumping abruptly. How does one usually solve this?