inexorgame-obsolete / deprecated-cube-engine-inexor

UNMAINTAINED: Please have a look at the vulkan-renderer
https://inexor.org
zlib License
11 stars 1 forks source link

Fix the Clock #392

Open a-teammate opened 7 years ago

a-teammate commented 7 years ago

Currently the design of all updates in the engine is as follows:

extern int totalmillis;                 // elapsed wall time since program start (in real milliseconds)
extern int elapsedtime;                 // elapsed wall time since last updatetime() (in real milliseconds)

// note: virtual game milliseconds is scaled with the gamespeed and effected by a paused game.
extern int curtime;                     // elapsed frame time since last updatetime() (in virtual game milliseconds)
extern int lastmillis;                  // elapsed frame time since program start (in virtual game milliseconds)

and curtime basically controls most game stuff, totalmillis controls anything which needs to function independently of the current match.

There are (highly probably) serious issues with that: http://www.koonsolo.com/news/dewitters-gameloop/ http://gafferongames.com/game-physics/fix-your-timestep/

Tl;dr: bc of rounding errors based on the relative updated time you can shoot/get shot "through walls" on fast computers (and more).

_Furthermore maxfps is heavily broken, too. fixed in branch removestandalone2