Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / my simple code is too processor-demanding, help please?

Author
Message
Jash
15
Years of Service
User Offline
Joined: 12th Oct 2009
Location:
Posted: 13th Oct 2009 06:06
hey I'm writing a relatively simple academic/2d game but it's eating up my processor time before the main loop is doing anything but dbSync. I'm only loading a background picture, a button, and a map image (sand.bmp). Only the background and the button are displayed when the game first starts. Here is the code that runs before the user presses a button to start code within the main loop:



just these images are pushing my 3.33ghs processor to 95+ percent. I can run complex games with no problem, all but this one.

I make the same kind of games as any Chemisty major would.
Serial Velocity
16
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 13th Oct 2009 12:51
For some reason, DBP and DarkGDK make the processor go to 90% and up, I have no idea why. Try inserting a Sleep( 1 ); and dbWait( 1 ); at the end of your main loop and see if that makes a difference.

Jash
15
Years of Service
User Offline
Joined: 12th Oct 2009
Location:
Posted: 13th Oct 2009 13:45
Thanks for the help. I used Sleep( 50 ); and that brought it all the way down to about 5% of my processor without a bad effect on gameplay. Sleep(1); didn't help much. For now, the problem is solved

I make the same kind of games as any Chemisty major would.
SFCBias
15
Years of Service
User Offline
Joined: 8th Aug 2009
Location: Hephzibah, GA, USA
Posted: 13th Oct 2009 13:56 Edited at: 13th Oct 2009 13:58
when i monitor my pc i see no real dramatic changes in CPU usage nor physical memory consumption, I notice about a 20 - 30% increase on the CPU and my physical memory stay pretty steady at what it was before the game was ran.

NOTE: Running Windows Vista Basic x86, 1.6 GHz processor, 2GB DDR2RAM

Also my game is(or should be ) alot more memory demanding than what is happening to your PC

if(You.AddCode.toPost)TGC.Users.CanHelp = true;
else return NoCodeMessage;
entomophobiac
22
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 13th Oct 2009 15:47
1. Make sure the images have a Power Of Two resolution; 256x256, 512x512, 512x256, etc.

2. Save it in a compressed format. Bitmaps (BMP) are not compressed. Preferable is to use the .DDS format, as the GPU won't need to decompress it or at least not as expensively as other formats.

If these procedures aren't followed, images can demand a huge chunk of graphics memory.
Jash
15
Years of Service
User Offline
Joined: 12th Oct 2009
Location:
Posted: 13th Oct 2009 22:12
I'll try that, but would that be less demanding on the processor also?

I make the same kind of games as any Chemisty major would.
Jash
15
Years of Service
User Offline
Joined: 12th Oct 2009
Location:
Posted: 17th Oct 2009 08:47
I'm using .DDS whenever I can now. The problem is that when converting to DDS, my images loose the transparancy color, so I can't use it if I need transparancy. The sleep and wait functions still seem to be the biggest help.

I make the same kind of games as any Chemisty major would.

Login to post a reply

Server time is: 2024-11-20 13:23:04
Your offset time is: 2024-11-20 13:23:04