100% CPU
BlitzMax Forums/BlitzMax Programming/100% CPU
| ||
Hello, I am wondering if it is possible to make my game use less than 100% CPU in windowed mode? I know games run as fast as possible, but I wonder if anyone has any tricks that they use. Even if I just have an empty loop, it eats up 100%. Thanks in advance |
| ||
delay <number> Depending on how fast your game actually runs and how much CPU power your application can 'afford' to waste, use something like 'delay 10' or 'delay 100' in your main loop. |
| ||
An empty loop shouldn't be 100% in max anyway. Are you using flip? |
| ||
Or WaitEvent()? |
| ||
A loop without flip or anything takes up 100% of my 3700+ AMD. A simple Graphics and a while loop which waits for escape, no flip no drawing nothing instide the loop. |
| ||
Yup. Use events. Just like Blitz2D |
| ||
Yup. Use events. Just like Blitz2D You mean BlitzPlus? Cuz Blitz2d didn't have any events. |
| ||
A loop without any flips or anything is *supposed* to take up 100% of your cpu time. In a normal situation with flip, it should take no more than 10%. Anything running on an empty infinite loop is demanding 100% of the time! This is a non issue and nothing to worry about. Start actually MAKING a game - THEN compare. |
| ||
Does the flip command automatically release and remaining frame time to the system? Would be a nice feature, to keep things synchronized but also share any spare time. |
| ||
It releases a lot of time. Try it out and see. Thats my game though, your milage will differ. You can use waitEvent and set a timer to call a tick event too. |
| ||
Whatever. I meant BlitzPlus since it's not Blitz3D and not BlitzMax :) |
| ||
Does the flip command automatically release and remaining frame time to the system? It's driver dependant. Some drivers idle-wait for vsync, some busy-wait. |
| ||
Driver settings dependant you mean ... :-) |