100% CPU usage

Blitz3D Forums/Blitz3D Programming/100% CPU usage

dgroncki(Posted 2004) [#1]
Someone who was playtesting my game mentioned he saw 100% CPU usage while the game was running, making it difficult to run background tasks. The game isn't doing anything obscure, but rather just in a normal game loop.

He wondered if there was a way to put the game into a sleep cycle of sorts to at least allow other apps a slice of the CPU. I didn't know of any capabilities with the Blitz language to do something like this. Anyone have any suggestions?


electronin(Posted 2004) [#2]
What exactly do you mean? is your game running in windowed
mode? or is it just too CPU intensive?


sswift(Posted 2004) [#3]
http://www.blitzbasic.com/Community/posts.php?topic=31084


dgroncki(Posted 2004) [#4]
Sorry for lack of info. I am actually doing a 2D game (Graphics mode not Graphics3D). I have alot of graphics in memory (png's, jpegs) and have a C++ dll running and whatever overhead that entails (it only stores one global variable).
It is running 800x600 windowed mode. Actually, when I minimize it I can do otherstuff without too much trouble. But since he asked I was just wondering if there was anything available in Blitz.
thanks again...Dave


napole0n(Posted 2004) [#5]
If you put a 'delay' statement in your loop, the CPU gets some more breathing space.


dgroncki(Posted 2004) [#6]
Thanks! I didn't know about the Delay command. I'll try it out.


napole0n(Posted 2004) [#7]
I think you need to put in 'delay 8' or 'delay 16' at least.


Rottbott(Posted 2004) [#8]
WaitTimer() would be better.


Bot Builder(Posted 2004) [#9]
What I do is have a target fps - and when it gos faster than the target, delay by a certain amount of time.


Rottbott(Posted 2004) [#10]
Bot Builder, that's what I meant.. that's what WaitTimer() does.