You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a lot of default ways of doing this algorithm in the DeltaCalculator companion object but none of them are ideal.
A better way of updating the game loop needs to be worked out. Custom algorithms can be made by extending DeltaCalculator like so:
classBasicConstantCalculator(frameRate:Double) : DeltaCalculator {
overridefun Updater.updateAndRender(lastFrame:Double, thisFrame:Double) {
// Both update and render have to be called inside this functionval delta = thisFrame - lastFrame
update(delta)
render()
}
}
Motive
There are two stages to the game loop
The update stage which should update physics/movement and logic
The render stage which draws everything to the screen in their already calculated positions
It is generally recommended to, firstly, have the update and render stages decoupled from one another and, secondly, have the update stage simulate a constant amount of time. Most physics engines require an update that takes a constant value and online multiplayer games will also depend on a constant update time. More information about this and how to partially solve this issue can be seen here.
Task
Create an implementation of DeltaCalculator that updates the game with constant delta and does not cause games to look jittery or unsmooth
The text was updated successfully, but these errors were encountered:
Info
The code currently has a way of setting custom logic for updating and rendering. This can be done while configuring the game:
There are a lot of default ways of doing this algorithm in the
DeltaCalculator
companion object but none of them are ideal.A better way of updating the game loop needs to be worked out. Custom algorithms can be made by extending
DeltaCalculator
like so:Motive
There are two stages to the game loop
It is generally recommended to, firstly, have the update and render stages decoupled from one another and, secondly, have the update stage simulate a constant amount of time. Most physics engines require an update that takes a constant value and online multiplayer games will also depend on a constant update time. More information about this and how to partially solve this issue can be seen here.
Task
Create an implementation of
DeltaCalculator
that updates the game with constant delta and does not cause games to look jittery or unsmoothThe text was updated successfully, but these errors were encountered: