|GameEngine: Fixed-Timestep GameLoop
|Page 1 of 1|
|Author:||Roland [ 18.09.2012, 11:23 ]|
|Post subject:||GameEngine: Fixed-Timestep GameLoop|
Since there sadly is no GameEngine specific subforum I'll post this topic here in the "General Discussion" forum:
Over the last couple of weeks implementing new components I started to realize I really should separate my render() and my GameUpdate().
The current GameEngine::Update() works like this (please correct me if I'm wrong!):
Update the GameEngine timer:
Update the component managers, which triggers
The complete game loop in the demo apps is:
Now the way I see it, with the current way the GameEngine works, it is rather difficult to separate my GameLoop (handling user input, updating the game state, handling AI, playing sounds, etc) from my render loop.
What I want is a fixed time step implementation, updating my game about 30 times per second, and render it as often is I can (and in the process, remove unnecessary timers, since at the moment we have the Horde3D timer, the GameEngine timer, the GLFW timer, and the bullet physics timer being used).
Basically this: http://lspiroengine.com/?p=378
More detailed information is linked to in the post:
http://gafferongames.com/game-physics/f ... -timestep/
To realize this, seperating the public GameEngine::Update() into
GameEngine::Update() //calling run() and update()
But now we have the problem of not having any interpolation regarding animation/transformation of entities.
Meaning if I update my game loop 30 times per second, and render at 120fps, particles, which get rendered by Horde3D, get updated every frame, but everything else would have the same position for 4 frames.
Hence I'd have to rewrite the scenegraph and animation component to support interpolation, and update those two components every frame as well, complicating the GameEngine::Update() function with "special cases".
So what I'm looking for from you guys is some input on whether my thought process is correct, what I missed, and ways to realize this.
|Page 1 of 1||All times are UTC + 1 hour|
|Powered by phpBB® Forum Software © phpBB Group