![]() ![]() Hardly any games sit and wait for user input. Games update the world in real time which means something is being processed at all times in the background. ![]() There is no such thing as an idle loop in most games. This allows the game to perform required tasks while there is no (user) input (ie update position of objects based on time, redraw screen, etc then check again for input, rinse and repeat). This 'waiting' takes no CPU cycles (that are assigned to the apps process).Ī game uses PeekMessage() which check if there is a msg and it returns even if there is no msg for the process. Some real-time systems apps use this time to poll external devices (SCADA, multiports, etc) for data/state changes.Īn app uses GetMessage() which only returns to the app when there is a message to process (ie it monitors the OS msg queue waiting until a msg for the app appears). ![]() The 'something useful' the game is doing with the CPU cycles is updating the position of objects based on time and rendering these changes to the screen. This difference in msg pumps means that the game does not sit idle waiting for input like an app. It won't harm multi-tasking, but unless it's doing something useful with those cycles, it's a waste of energy.Do you understand the difference between Peek and Get message pumps? (and so can make an informed choice which to use when designing a program.) Wasted cpu cycles is wasted energy and heat.Īre you fine with applications hogging 100% cpu using idle priority? That's the same thing. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |