The use of a fixed time step

I’m working on a platformer with Monogame and I’m currently working on my (little) game engine.
I got inspired by the engine of Matt Thorson named Monocle and I see that he’s set the IsFixedTimeStep to false.

What are the effects ?

I mean i know what this do but there is no negative consequence on the update or the draw phase ?

Does the game still draw a static number of frames per second ?
Or maybe he fixed the timestep himself but I didnt see that anywhere.

So what is the best way to make my engine fast enough to hold a lot of entity (if fixed time step slow down my game) ?




This basically controls the FPS your game runs on.

By default it will lock to 60 fps.

This is because of Vertical Sync (Vsync), which wants to sync with your monitor update rate.

Here is an oveview

This is a setup i have for example

               _graphics.SynchronizeWithVerticalRetrace = false; //Vsync
                IsFixedTimeStep = true;
                TargetElapsedTime = TimeSpan.FromMilliseconds(1000.0f / targetFPS);

This way I can setup custom FPS.

IF you set both synchronizeWithVerticalRetrace and IsFixedTimeStep to false you will get the maximum fps possible by your machine (unlocked)

1 Like

Ok thank you all ! I now i know more about time step in monogame and I think i’m gonna fixed the time step and use IsRunningSlowly when im too slow to pass some useful draw or something else. Thanks :grin: !

by the way, in my experience it is better to use

_graphics.SynchronizeWithVerticalRetrace = false; //Vsync
IsFixedTimeStep = true;
TargetElapsedTime = TimeSpan.FromMilliseconds(1000.0f / 60);

than _graphics.SynchronizeWithVerticalRetrace = true

this will usually give smoother experience for me, even though both should target 60 fps, vsync will drop to 30 when you go below 60hz even just for a fraction of a second.

In monogame this will happen every few frames for example when garbage collection happens and so the game will appear stuttery.

Ok I will test the difference when my game can show and move objects. Thanks :thumbsup: