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 / my game is very slow

Author
Message
Jonathan
20
Years of Service
User Offline
Joined: 29th Dec 2003
Location: England
Posted: 30th Dec 2003 00:08

the game is slow and jerky heres my code, I would much apreciate it if you went over it and identified any errors, thanks
Philip 1337
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 30th Dec 2003 00:29
Try setting
sync rate 50

or maybee you have a slow/old graphics card

Jonathan
20
Years of Service
User Offline
Joined: 29th Dec 2003
Location: England
Posted: 30th Dec 2003 00:41
setting sync rate to 50 doesn't help
my graphics card is a 3dfx voodoo 3 card 3dfx went out of buisness a year or so ago but this shouldn't be too much trouble for this card should it?
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 30th Dec 2003 00:57
if it's jerky, try sync rate 0

I am mischeivious
RoooooOoooooKoooooKoooooRoooooOoooooKoooooKooooo!
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 30th Dec 2003 01:56
I think "Set Camera range 5000" is a bit to high, try lowering it


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 30th Dec 2003 05:27
Yep 5k is a bit high. Scale your game down a bit. What are your other system specs?

RPGamer


Dont forget to Join the Forums!
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 30th Dec 2003 05:31
After a quick look over of your code

1.
Having checks every loop for if x#> if z#> and so on will slow things down. Try only checking for collision if

A) You are close
B) Base it on a timer

2.
Avoid using SLEEP in main loops

3.
Its hard to tell without some information on those models. How many polys are they each? What size textures are you using?

4.
Hide objects if they arent in screen

5.
After that set sync on 50

Hope that helps

RPGamer


Dont forget to Join the Forums!
Jonathan
20
Years of Service
User Offline
Joined: 29th Dec 2003
Location: England
Posted: 30th Dec 2003 15:49
thanks for the help but it still works very slowly, how would basing the collision detector on a timer affect the speed?
I used the modles from the darkbasic files so you should be able to find the relevant information there.
I tried halving the matrix size but it still works slowley.
I already do hide all objects that arn't on screan.
The only sleep in the main loop is the one that makes sure the monster falls down completly, I removing but it didn't do anything anyway.
anyway I really apreciate the help, thanks
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 30th Dec 2003 15:54
Checking for collision is slow, so if you do it with a timer, your game only has to check for collision when the if statement is true, example:

time=0

do
if time = 100 then check_for_collision : time=0 else inc time
loop


Quote: "
Amd 2500+ | 1024mb pc2700 | A7N8X-X | Geforce4 ti 4200 128mb
"
Jonathan
20
Years of Service
User Offline
Joined: 29th Dec 2003
Location: England
Posted: 30th Dec 2003 16:49
I tried using the timer technique but it still runs exactly the same slow speed
thanks for the help anyway.
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 30th Dec 2003 18:49
Whats your system specs?


Dont forget to Join the Forums!
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 30th Dec 2003 19:09
I found these goobers...

1 - set camera range 1,5000
change this to
set camera range 3,3000

this probably will not improve speed much, but it should help.
Generally, set camera range to be "in front of the camera"
hence 3 and about 50% farther than the fog range (you have fog at 1000)

2 - It is not required to repeatedly call Loop object.
Set a flag (interger) to track if you should be looping or not.
Checking you flag is much faster than commanding the Loop and repeatedly setting the play speed. Instead check it this way

If Looping=0
Loop Object .....
Set Object Speed .....
endif
then, to handle the die animations...
if Looping=1
Play object .....
Set Object speed ....
endif
You may also need flags for each animation type (idle,walk,...)
But this should improve speed some.

3 -
Also, make your matrix smaller. 70x70 may seem small, but consider this 70x70=4900 plains, 2 tringles per plain = about 10000 polies
and you still don't have effects and critters ....
Keep the size at 10000x10000 (if you want) but lower the "grids" to about 20x20 and see the speed increase.

4 - Hard to tell from your code, How many DB primatives
are you using? DB does not like primatives. You would be better off making your trees and houses in MS3D and loading them as an .x file.
That will speed things up a bit.

5 - How many Zombies?
Looking at your code it looks like alot
"for r=1 to (10*a#)"
if you really need that many, just make 4-5 and have a "clone" value.
You know, to track how many times a creature was actually killed.
Lets say for example you use a max of 6. Then each time this creatured is killed, you dec the clone value and relocate the creature out of view in a random location. If the counter goes to zero, the creature will no longer be respauned. This will increase game speed alot.

internet gaming group
current project http://home.comcast.net/~norman.perry/Archon.html
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 30th Dec 2003 22:38
If you have an old processer your game will run slowly. What is its clock speed? Your video card is also a very out of date card, it will barely run DBP.

Your code is okay but Mentor's optimization tips are good.

--Mouse: Famous (Avatarless) Fighting Furball

I am the chainsaw paladin.
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 31st Dec 2003 02:29
really i think what's slowing it down is your pc, a voodo3 is going to really sruggle with dark basic, if you upgrade i recomend getting a card from ati's radeon range, very good cards and value for money, shop around though because there can be huge price differences between shops, if you don't mind shopping online go to:
http://www.ebuyer.com
and get one from the radeon 9000 range

http://www.larinar.tk
AMD athlon thoroughbred 2200, 512Mb ram, 40Gb HD, ati saphire radeon 9600 atlantis w/128mb ddr ram, good creative-labs soundcard, cd-rw + dvd drives.
Alastair Zotos
20
Years of Service
User Offline
Joined: 30th Dec 2003
Location: a bin
Posted: 31st Dec 2003 02:33
sync rate 300
thats the best one

fart like you've never farted before!!!
(five seconds later)
Dude that stinks!!! get out of my house!
Jonathan
20
Years of Service
User Offline
Joined: 29th Dec 2003
Location: England
Posted: 2nd Jan 2004 14:02
Thanks for the help
I knew my card was out of date but didn't realise it was quite that bad (thanks for the site reference)
hopefully when I get a new 3d graphics card things should speed up and I will implen the sugestions
thanks I really apreciate the help you lot have given me
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 2nd Jan 2004 18:40
Quote: "sync rate 300
thats the best one"


ROFLMAO!!! Lol thats terrible. NEVER EVER NEVER NEVER NEVER set sync rate that high. That is the limit to how many frames you are allowing the game to process per second. That means on a state of the art PC, the game would refresh 300 times per second making the game INCREDIBLY fast and unplayable.

A sync rate of 50 or 60 is usually best, because that limits the fastest PCs to run 50 or 60 FPS, which is just about perfect for most games.

Lesson: Never use Sync rate 0, or sync rate of above 60

RPGamer


Dont forget to Join the Forums!
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 6th Jan 2004 06:04
NOT TRUE! It is just fine to set the sync rate to 0

HOWEVER, you must incorporate a timer function into your game. There must be a variable that is inversaly proportional to the frame rate. For example:

fps#=30.0/screen fps()

Then, every time that you move something, or make a value bigger, you multiply the amount that you are incrementing this by fps#. You must then make sure that all of your variables are floating point numbers instead of integers. This will allow the highest possible frame rate, and still make everything go the same speed on all systems. Here is a link to my website with my game. I use this system for my 6500 line RTS game, it is not that hard to implement.

http://www.freewebs.com/boltsoftware

Good Luck

The earth is but one country, and mankind its citizens.
-- Gleanings from the Writings of Bahá'u'lláh
walaber
20
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 8th Jan 2004 05:01
yeah, in general you should not limit the speed of your game with the sync rate command, like BOLT says. if you limit the sync rate to 50, people with faster computers will miss out on what could be a smoother experience, becuase you're just wasting processor time.

you might say that using Full Screen Exclusive Mode, there is no way the game will run faster than 50/60 fps anyway, so what's the difference? the difference is also clear when you think about SLOW computers. for example you base all of your game movements/speeds on 50fps... then someone with a slow computer plays your game, and they only get 20fps... in effect they will be playing your game in "slow motion", like slowing down a movie meant to be played at 24fps to 12fps.

however if you use the timer() system like BOLT metioned, the game elements will move at the same speed whether you get 10 or 500 fps. 10fps will just be jerky, and harder to play, encouraging the user to go out and buy a better video card

Go Go Gadget DBPRO!

Login to post a reply

Server time is: 2024-09-21 15:52:30
Your offset time is: 2024-09-21 15:52:30