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 / "dbInk()" causes performance bottleneck...

Author
Message
Riktovitch
11
Years of Service
User Offline
Joined: 28th Oct 2012
Location:
Posted: 31st Dec 2012 06:24
I have a FPS game that is roughly 4000 lines of code. I spent about an hour trying to find the source of lag that was present on my brothers lower end computer. I've narrowed it down to the fact that whenever the GUI draws text to the screen, dbInk() is used to change the text color, and this causes 10+ millisecond delays which degrade performance. Sometimes from 60 frames per second to 20. I'm not sure what to do to fix this problem...

I am 100% positive that dbInk() is causing the delay because if I comment of that line of code the FPS will go back to 60.

if(awesome) return true;
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 31st Dec 2012 08:32
This is a known issue. You should limit the number of times you call dbInk(). If you need to have different colors, try rendering your text by color instead of changing the color whenever you render the text... If that makes sense.

pseudocode:


If you are only using one color, simply call dbInk() before the main loop..... Don't know how many colors you need, but I hope this helps.

The fastest code is the code never written.
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 31st Dec 2012 14:57 Edited at: 31st Dec 2012 14:57
Alternatively, you can use this source submitted by Hassan!

Works like a charm, as advertised!

Regards,
JTK

Login to post a reply

Server time is: 2024-04-19 16:26:19
Your offset time is: 2024-04-19 16:26:19