rfg-modding / Nanoforge

A modding tool for Red Faction Guerilla Re-Mars-Tered
MIT License
31 stars 3 forks source link

Use Sleep(1) in frametime limiter #99

Closed Moneyl closed 1 year ago

Moneyl commented 1 year ago

Currently doing busy waiting. Don't need that level of precision. Should give up the CPU to other processes when we don't absolutely need it. NF C++ already did this. Rewrite doesn't since I based it on some code from a closed source game I was working on where having precise frame time was important.

Moneyl commented 1 year ago

Gonna hold off on this change for the moment. I tried it and noticed it was making camera movement visibly sluggish and choppy even when being more conservative with sleep times. Later on we can add an option to sleep when the window is unfocused. That way it's not eating a whole CPU core when sitting the background. See #102.