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 Discussion / Lag problem

Author
Message
Guitarman
21
Years of Service
User Offline
Joined: 31st Jan 2004
Location:
Posted: 13th May 2004 21:08
Ok I was wondering.... I am willing to write large sized programs, but when they get large numbers of objects or long coding it takes a while and lags, even with the sync command. (I use sync 0, so if i can get faster let me know.)
This may be a common or stupid problem, but if someone could please help me.....
GameKit
22
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 15th May 2004 01:12 Edited at: 15th May 2004 01:14
There are a few things that may be lagging your game...
*Sprites (Especialy in DBClassic)
*High Polygon Models
*2-D Commands
*Large Screen Resolution or High Color Depth

You may want to try this code to speed up your program...

This only works if you have a large amount of objects. If your objects are very large (like one big 3-D level) then I wouldn't recomend this code... Also, If the camera gets too close to an object it might suddenly dissapear...

[Edit]
You might also try adding fog and hiding objects outside of the fog distance...

Well... I hope I helped...

Previously known as "Game_Creator".
The question is, why am I talking to myself? ...... And more importantly, why am I waiting for a reply?
DARKGuy
21
Years of Service
User Offline
Joined: 28th Nov 2003
Location:
Posted: 15th May 2004 12:42
or use a different update method and optimize the code a bit (for's, loops and functions), sometimes helps!, not that I've ever programmed an internet game but it's just a logic thing I think...

:: Pentium 300 Mhz, old 8Mb video card, 64Mb RAM, 5 gb & 1.6 gb HD's, W98 SE, Sound Blaster AWE 32 ::
_Nemesis_
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: Liverpool, UK
Posted: 18th May 2004 01:33
Make sure you're using sync where it is needed. Too many of them will obviously slow your program down.
There should be one at the end of loops.
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 18th May 2004 02:24
Optimizing works too.

Look at AI for example:


do
group_turn = group_turn + 1
if group_turn = 4 then group_turn = 1

for a=100*group_turn to 100*group_turn+99
`do something with the enemies
next a


sync
loop


instead of checking and moving objects 100-399 real-time, you can seperate them in groups (1,2 and 3). This will run ~3 times faster

Quote: "
UPDATED

Amd 2800+ 1024mb pc3200 A7N8X - Deluxe Ati Radeon 9800PRO 256mb
"
Arkheii
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 18th May 2004 03:24 Edited at: 18th May 2004 03:30
if you have a for loop that checks for 99 objects, do this instead:



I read that in some Intel optimization essay.

Oh, and try to stay away from processor intensive math functions like sqrt() if you are only going to use it to compare 2 values. More often than not you can get away without using it.

Login to post a reply

Server time is: 2025-05-23 19:27:51
Your offset time is: 2025-05-23 19:27:51