Delta Time - Streamlined Time Keeping For Games

jordan4ibanez jordan4ibanez002 at gmail.com
Sun Aug 21 23:53:29 UTC 2022


I have taken in the notes here and allowed devs to have more 
control over the delta max so that the game can slow down and get 
more accurate calculations if everything is going horribly wrong:
```
// Allows devs to set the max delta time before the game starts 
to slow down
void setMaxDelta(double newDeltaMax) {
     maxDelta = newDeltaMax;
}

// Allows devs to set the specific FPS where the game will start 
to slow down if it drops below
void setMaxDeltaFPS(double FPS) {
     maxDelta = 1.0 / FPS;
}
```
By default: it's 0.2 in real terms or 5 FPS in game terms. Any 
lower FPS/higher delta than that and the game logic will slow down


More information about the Digitalmars-d mailing list