![]() |
|
CRAZY High CPU Usage |
SkaxCo
Member #8,323
February 2007
|
Some of you may recognize this game, as I have had many questions on it. Well, now it runs nicely, thanks to many of your help. ...hm...for a given value of "nicely" I guess. Problem is, it runs at 90%-95% CPU usage. I don't know why, and my code files are slightly scattered. (I will opload them later) Can some of you test out my game and check out CPU? EDIT: I actually uploaded the game. Instructions: Score: Score Far right bar: The power bar. Killing a zombie gets +1 power. Shrapnel costs 10, Fragmentation costs 25. When charged and enough power, a little yellow square will show up. On the left is for Shrap, right is for Frag. The blue bar that moves is the reload time. |
Kibiz0r
Member #6,203
September 2005
![]() |
My guess without looking at it would be that you're not calling rest(1) or similar, you're rendering whenever logic doesn't need to be updated instead of putting a cap on the FPS, or you're constantly processing logic, or maybe not even using a timer at all! Check all of those and reply. --- |
SkaxCo
Member #8,323
February 2007
|
Okay, I think this is all of the code...here it is: for(;;){}800 times SkaxCo.cry(because_high_cpu); if(dont_know_how_to_fix) SkaxCo.ask_for_help(nice_allegrocc_people); else{ SkaxCo.thank_for_help(nice_allegrocc_people); SkaxCo.fix_problem(high_cpu); }
|
Kibiz0r
Member #6,203
September 2005
![]() |
Well, you uploaded the exe and the code, but there's no data, so I can't run it. Aside from ugly code, I don't see anything wrong. --- |
Albin Engström
Member #8,110
December 2006
![]() |
Quote: it is pretty much: It pretty much froze to death... and what is that code??.. are you saying you're calling a for loop 800 hundred times? that's probably not the problem, unless you got some shit going on inside it. taking a look at the code
I'll let the elite take over. |
SkaxCo
Member #8,323
February 2007
|
MKAY: All new uploads; new program, new code. |
Kibiz0r
Member #6,203
September 2005
![]() |
Only uses about 30% CPU on my machine. Yaknow, for having such ugly code, it's a pretty attractive game. Good show, I anticipate good things coming from you in the future. --- |
SkaxCo
Member #8,323
February 2007
|
Hm...maybe just a slow computer. And thanks for the compliment! |
Steve Terry
Member #1,989
March 2002
![]() |
Runs at only 40% CPU on my machine as well so I'm guessing your machine is just a bit slow. Since it didn't run at 100% CPU and since I haven't looked at your code I'm going to assume you used rest(1) and the proper frame skip logic code. ___________________________________ |
Kibiz0r
Member #6,203
September 2005
![]() |
Quote: since I haven't looked at your code I'm going to assume you used rest(1) and the proper frame skip logic code.
Trust me. Even if you looked at the code, you'd still just be assuming. --- |
Paul whoknows
Member #5,081
September 2004
![]() |
2% CPU usage here. ____ "The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner. |
GullRaDriel
Member #3,861
September 2003
![]() |
The game is nice. GFX needs some polishing. CPU: IT goes alternatively from 2 to 50 % every second or so. "Code is like shit - it only smells if it is not yours" |
CIRCLE
Member #5,301
December 2004
|
task manager uses more cpu (0-1% barely noticable) then the game on my machine but I am on a gaming machine. I have made a game quite simular to what you are doing but balls instead of zombies over all I like it. -I edit a lot. Prepare thyself. |
Jonny Cook
Member #4,055
November 2003
|
I've seen uglier code. You could use some more white space though... it feels kind of stuffy in there. The face of a child can say it all, especially the mouth part of the face. |
SkaxCo
Member #8,323
February 2007
|
Yeah...this is crazy patchwork code. It started a while ago, then I "finished" it. Went back, added some stuff, updated other stuff...yeah, it got ugly. |
|