So in monogame, in your Game1 class you can write something like this:
public Game1()
{
IsFixedTimeStep = true;
TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);
}
That sets the target time to 16 ms which means the frame rate will try to be 62.5 fps. (1000/16 = 62.5)
However, now I'm using C++ with raylib and there are various options that are rather complicated. But the gist of it is, you have three options. 1, use vsync. 2, use sleep. 3, the worst thing imaginable...spinlock your CPU to 100% because it's in an infinite loop that constantly checks the time to see if it's been 16 ms since the last update or draw.
The problem with sleep is, it's not that accurate. The OS gets to decide when to context switch processes and it will not wake up the process at the right time, so you could overshoot your sleep by a lot.
The problem with vsync is, different ppl have different monitor refresh rates. And some hardware does not support it at all.
The problem with spinlock CPU...constantly using 100% is dumb and wasteful.
Anyway, I am not aware of any general 4th option, so I would like to ask here, how does Monogame do it?