+2

suggestion about how to handle the replay timing problems

Aruã Metello 12 years ago 0
This is mostly theoretical about how the game currently works, i am experienced on game programming/engine development but i dont have the source code to give a "straight suggestion".

aparrently, the game runs at a variable "tick rate", that matches the current frame rate (during the gameplay), and records (likely) the position of each object at each rendered frame, when the gameplay ocurs at lets say "300+fps" and the replay for some reason runs at "60fps locked", you experience some "slow motion camera effect". (the rate that the recorded frames are played during the replay is fixed? it is 60?)

in my computer, by default, the game runs at an uncapped framerate (using 2x HD6870 radeons here, AMD dont play nice with some apps when they ask for vsync, so you cant count on that), but also we cant count on "assured fixed frame rate" at all times.

* maybe we could simulate at a fixed timestep, and "slowdown" things if we cant really run the scene at realtime? (would be the best solution to maintain accuracy)

going more to the solution (cuting most of the theory here, even because my guess about the cause could be wrong) it would be to record a "realtime clock timestamp" at each recorded frame of the replay, when reproducing the replay, the gamecode will interpolate each object position between each frame of the replay as required, this would allow player controled slowdowns and would assure a "correct playback speed" at "all" times.

example: if the objects where recorded at 15~fps and the demo playback  is at a locked 60 (maybe because the physical simulation was killing the cpu during the gameplay), we would have in average "2 interpolated positions" between each actual frame contained in the replay list.

ps: not a big deal at all since this is an alpha, but also the demo can "run out of heap space" if you just let the game idle after fail/completion of an objective (huge demo that cant fit the available memory), maybe stop recording after some generous threshold?