Quote:Original post by Spoonbender
Quote:Original post by noooooon
Seems good to me, expect the "Consume 100% CPU" (ok for console, not for PC)
Why is this bad? Do we not want the game to run as smoothly as possible? How do you expect it to run as smoothly as possible, if you do not give it as many system resources as possible?
Why a game should allways take 100% CPU if it doesn't need it ?
Take that example :
Lets say my game is PONG and I want my frame rate to be locked at 120 fps, and my game Update at 60. I dont need and dont want more FPS. I have very few calculation (2 paddles and 1 ball) and very poor graphics. So I dont need and I dont want to use all the CPU. So what game loop do you propose me ?
Quote:
You answered it yourself. They cap the framerate, so if a frame takes less than 1/60th to draw, they wait before drawing the next. Result: Framerate at 60, and on fast CPU's, less than 100% CPU usage.
Yes and how ? How do they wait ? That my question...
Quote:It's wasting around 99% of the CPU time in the idle process. That is, *no one* are benefiting from it. None of the other running processes want the CPU time, so it's thrown away.
If you allow your game to soak up all available CPU time, it will simply take what would otherwise have been thrown away. Where's the loser in that?
There are many reasons not to use 100% of CPU :
- The player may use other applications that also use some CPU while he plays (teamspeak, IM, ...)
- The player is on a laptop. CPU consume energy. He could play longer.
- The player is a game developper or a tester in game studio. His CPU time could be use to make other things, like cross compilation for example.
- your game is used inside another windows application. For example you have a windows application to edit your game levels. You have a viewport that shoes level created inside your game in real time. You dont want this application to use 100% CPU, since its a windows application.
Now let me reverse the question. Why whould you use 100% CPU if you dont need to ? Just because you dont care ?
Quote:And the second reason: You want your game to run smoothly.
120 fps is smooth enough.
You can make a game at 120 fps that only need 1% of CPU.
Or you can make the same game that consume 100% CPU.