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.

DarkBASIC Professional Discussion / Help optimizing code

Author
Message
John H
Retired Moderator
23
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 13th Oct 2003 00:16
Having problems today. Head throbbing. Check this code out.

The following code executes PERFECTLY. It does EVERYTHING I want it to do only it runs INCREDIBLY slow. Here is the code.






and the function





What this code does:

When I walk up the the knife, when I press ENTER a dialog box comes up and says "You have recieved a knife!" It doesnt check for the enter key being pressed while TIME <8, which prevents accidental double presses. When the user presses enter again, the message box dissapears.

Whenever the message box is on screen, the program goes incredibly slow. I think the function is being executed every loop, which slows things down. I want this to stop going so slow (by slow I mean 50 FPS to 20 FPS) and not delay the entire proggy (looks crappy when seagulls way down )

Any help?

RPGamer

Current Project: Eternal Destiny
We need a texture artist!
If your interested email me - [email protected]
John H
Retired Moderator
23
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 13th Oct 2003 00:40
Found the prob. Appears that TEXT is slower than molasses in January (or whatever your cold month is) So I guess im gonna have to write a Sprite text system.

RPGamer

Current Project: Eternal Destiny
We need a texture artist!
If your interested email me - [email protected]
mimesis
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Norway
Posted: 13th Oct 2003 01:44
A)Text command it's far from slow
B)A Sprite text system is much slower

I cant test your code now ,sorry

Me, You, DBP and everything else, were made in the same place. The Stars!
I wonder what kind of matter DBP bugs are made of ... antimatter ??
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 13th Oct 2003 02:49 Edited at: 13th Oct 2003 02:50
It is the INK RGB() command which is the likely culprit, not TEXT().

I think that INK RGB() only causes slow down if you then use a command which uses a colour set by the RGB command, eg TEXT

John H
Retired Moderator
23
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 13th Oct 2003 07:09
I fixed the code. I made a routine that before hand takes input and creates a sprite with the text and background. Now the code runs perfectly and smooth

RPGamer

Current Project: Eternal Destiny
We need a texture artist!
If your interested email me - [email protected]

Login to post a reply

Server time is: 2026-07-26 04:26:37
Your offset time is: 2026-07-26 04:26:37