![]() I choose to call sleep instead of busy-wait loop to give other threads and processes a chance to run while game is waiting. calling timeBeginPeriod(1) at game start (and timeEndPeriod(1) at end) should fix the problem (but have some consequences). pointed out, code is not guaranteed to works because sleep(1) may wait more than 1ms. There is a lot of info on this.ĮDIT : as Roy T. Then you have to separate code you want to run at 60fps from rendering code and make necessary changes to make sure that code is called at same fixed time intervals. Now, my valorant is set on low settings ( and at 1920x1080 res) and its fps is at 60-70fps. I changed my screen refresh rate into 60hz, and my fps improved a bit. Please note that if vertical sync is enabled, rendering will already be limited to 60fps.īut if you want to have your game logic locked at 60fps, no more no less, that's different. And the low client icon always appears in my game. Sleep(1) //yield cpu to other game thread or processes. Int elapsed_time = getcurrenttime() - oldtime If you want to limit the game rendering at max 60fps its very simple :Įach frame, just check if the game is running to fast, if so just wait : //to call each frame Depends what you mean by saying "you want to lock the game at 60fps".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |