thekalkkuna
01-09-2009, 01:19 PM
Sorry if this matter has been beaten to death. I'm asking anyway =P. I couldn't actually find stuff related to this exact issue.
I'm pondering about the sort of game loop where the usually so called "update" is run at a constant rate and the view is rendered whenever possible. As I've understood it, it might happen that the frames are rendered faster than the world/physics/whatever is updated, in which case the frame would just render several times the same scene unless we interpolate (or extrapolate if we don't want to lag behind a maximum of one update interval) stuff with the value that represents the relative position (in time) between update ticks.
Now then, as I've no real experience about these sort of things, I was initially under the impression that the updating should take care of the world and the rendering is just a dumb imaging of it. Obviously when interpolating say a movement between the update steps, this isn't the case. If I have a moving object, do I then, in practice, have to sort of calculate twice (or more if update gets called more than once per draw) the new location of the object? First calculation round being the result of update, which is deterministic and in sync with everything and then the second round caused by the need for interpolation for the actual rendering only? This can't be right? I've got it all wrong?
Should it be like this, any suggestions or links as to how to design what actually gets interpolated in addition to being updated in the "world update"? Obvious answers are animation and transformations, and not stuff like AI decisions, but is there something else that should be considered?
I'm pondering about the sort of game loop where the usually so called "update" is run at a constant rate and the view is rendered whenever possible. As I've understood it, it might happen that the frames are rendered faster than the world/physics/whatever is updated, in which case the frame would just render several times the same scene unless we interpolate (or extrapolate if we don't want to lag behind a maximum of one update interval) stuff with the value that represents the relative position (in time) between update ticks.
Now then, as I've no real experience about these sort of things, I was initially under the impression that the updating should take care of the world and the rendering is just a dumb imaging of it. Obviously when interpolating say a movement between the update steps, this isn't the case. If I have a moving object, do I then, in practice, have to sort of calculate twice (or more if update gets called more than once per draw) the new location of the object? First calculation round being the result of update, which is deterministic and in sync with everything and then the second round caused by the need for interpolation for the actual rendering only? This can't be right? I've got it all wrong?
Should it be like this, any suggestions or links as to how to design what actually gets interpolated in addition to being updated in the "world update"? Obvious answers are animation and transformations, and not stuff like AI decisions, but is there something else that should be considered?