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.

Newcomers DBPro Corner / frames per seconds improvement needed (DBP)

Author
Message
Tito
19
Years of Service
User Offline
Joined: 26th Sep 2005
Location:
Posted: 6th Oct 2005 20:47
ma top-down view arcade game is doing what it should , for a debug version, but the fps becomes verry low when there're lots of enemies.
But the gameplay requires lots of enemies...

so, can any1 test my code and tell me what is the biggest problem ?
(i know many object causes low fps, so looking for suggestion in fixing that but keeping same gameplay = lots of enemies )

any comments on the way to structure code are also welcome.
actually, all comments are welcome

gameplay :
drive around and kill all enemies + spawnpoints
(currently 4 spawnpoints with each max 99 enemies)
small spheres are powerups (bulletspeed/time_between_bullets/health)

controls :
qsdz/cursor = move
leftmouse = shoot
rightmouse = reload
scroll wheel = camera height
control = lock turret on car
enter = change to FPS (switch code needs help!! )

this is the full source :
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 6th Oct 2005 22:33 Edited at: 6th Oct 2005 22:37
Not looked at your source yet - will do that next, but to set DB do run as fast as it can, you can use:

Sync Rate 0

though you need to remember that this removes the Sync rate limit which can cause many programs to run too fast on very fast machines.

[Edit] Sorry - won't run for me. Array error first - had to change powerup$(i,4) = "waiting" to powerup$(i,3) = "waiting" as you'd only DIM'ed it with (100,3).

I then ran it again and Object Not Found error.

I'll leave it with you...

TDK_Man

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 7th Oct 2005 01:06
Not looked at the code either, but the solution to masive amounts of enemis is to "multiplex".

For example, break your enemies up into 3 groups. Each set get moved just once every 3 cycles. 1 - 20 in cycle 1, 21 - 40 in cycle 2, and 41 - 60 in cycle 3. Then you start again.

An even better way is to move them all the time, but multiplex any checking. For example, check all health in cycle 1, check whether they should change direction in cycle 2, and check whether they are dead in cycle 3.

If you have a HUD, that can be updated far less frequently too. Sometimes it's clearer to update a HUD readout once a second than it is to be always correct. For example, a race position could flicker wildly as cars passed to and fro, better to update once a second.

Just examples, but I hope you get the idea.

The admiral
22
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 7th Oct 2005 04:20
From what I can see you have a lot of cameras and your using lots of dbpros internal 3d commands which slow down programmes a lot. So if you can use textured planes rarther than the ink,box etc commands it would help alot. Why do you need so many cameras?

The admiral
Tito
19
Years of Service
User Offline
Joined: 26th Sep 2005
Location:
Posted: 7th Oct 2005 18:38
thx for the replies so far !!

batvink :
the multiplex thing seems the way to go. I'll just have to figure out which cycles to make so the movement of the enemies seems fluently and all bullethits get registered.

tdk :
sync rate is set at 0 for the moment for testing/speeding up, but i thought putting it at 30 or 60 when the game s 'finished'.
does that make sense ?
Quote: "you'd only DIM'ed it with (100,3)"

thx
Quote: "I then ran it again and Object Not Found error."

weird... I copy pasted the code from the forum in a new project and it did run, even without fixing the DIM...

the admiral :
really ? that would be great news cause I thought things would get worse when I start replacing boxes with models.
can u please comfirm so I get this right...
1. are 6 textured planes put togheter to make a box faster to render then an "ink'd box/cube" ?
2. can replacing the boxes/cubes with .x models drasticly speed things up ?


thx!
Heckno
20
Years of Service
User Offline
Joined: 8th Sep 2004
Location: Palm Coast, FL
Posted: 8th Oct 2005 03:12
Quote: "the admiral :
really ? that would be great news cause I thought things would get worse when I start replacing boxes with models.
can u please comfirm so I get this right...
1. are 6 textured planes put togheter to make a box faster to render then an "ink'd box/cube" ?
2. can replacing the boxes/cubes with .x models drasticly speed things up ?"


why not try it for youself, write a small code that would measure fps for each item...
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th Oct 2005 03:51
Quote: "I copy pasted the code from the forum in a new project and it did run, even without fixing the DIM..."


It's probably down to the versions of update we are using.

I'm still using 5.8 but if you have an earlier version, or you've updated with 5.9, then as it's a beta (as far as I know), then anything could be different!

TDK_Man

The admiral
22
Years of Service
User Offline
Joined: 29th Aug 2002
Location:
Posted: 8th Oct 2005 04:25
The key thing is that the ink command is slow. I dunno what you were using it for but if your doing a hud its better to use objects.

The admiral
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 8th Oct 2005 14:58
your "Image_Size=256" is to big to use that way with a matrix try making it smaller
rem -------- make rnd grasslike texture
Image_Size=64
for x = 0 to Image_Size
for y = 0 to Image_Size
dot x,y,rgb(0,rnd(156),0)
next x
next y
get image 2,0,0,Image_Size,Image_Size

You can do it if you try

Login to post a reply

Server time is: 2024-11-13 21:20:42
Your offset time is: 2024-11-13 21:20:42