Why do you have to fix your timestep instead of having a SetFPS function?

As a beginner to MonoGame, I am wondering why it requires you to fix your timestep instead of having a function like SetFPS() or something similar to make MonoGame get the correct FPS of your computer. Could you explain to me why it is this way?

You do not have to have a fixed time step in your game

You can turn on vertical sync, which will lock the draw and update rate to the refresh rate of your monitor (if your computer can keep up)

You can set your own update rate, 112fps, 65 fps or whatever you like. However your better off using an update/draw rate that matches your monitor

You can have an unlocked draw and update rate.

You will have to make the SetFps method yourself. However Monogame does let you set all these things.

2 Likes

its legacy stuff from single threaded games before phones had 8 cores and now i think almost no computers in use have <2 … there no point (that i can see), in drawing faster than the screen can refresh. now we should use at least 2 threads , one for more for game, physics , colliders, (unless u do pixel type collidision) AI, and then the draw at VSYNC. I would look into producer consumer pattern… that way u can use multiple threads without locks , and then copy the last good frame (just the visible data) , draw that, while updating the next frame. I dont use the Update function, my draw function doesnt have a lock anymore and i draw whatever last frame was reference after the other thread finished writing to it. my physics might update at 4000 fps!, while i draw at 60 or 120 or whenever it vync calls the draw, just the last finished frame data, AND as a bonus if you save some old frames you get an instant replay feature cheap. i use setTimerResulotion (windows only) , measure the time to update the back threads, and even the framerate that way. so i get an even frameratee or its 1000 fps, i can set ti to 120 or something playable now and enjoy great lock free mutlthreaded performance.