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 / "How Do I Speed My Game Up?" ... Here's Some Tips:

Author
Message
Drew Cameron
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 5th Jul 2004 01:59 Edited at: 9th Jul 2004 03:05
For a huge speed increase use "sync rate 0" at the top of your program.

Additionally, replace;



in the main loop with;



It will double the programs run speed as it will only draw every second loop and therefore speed up processing hugely.

Dumbo - now awaiting models from Andrew11!

http://www.ddrw.dbspot.com/new
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 5th Jul 2004 19:00
Hmmm...

Drew, I'm so sure that that is a speed increase.

Setting Sync Rate to 0 gives you the maximum performance that your video card can handle, but setting sync on doesn't seem to give me any speed increase at all.

For example;

Gives me about 40


Also gives me about 40


Gives me about 60 ( the max frames my Vid card can handle )


And your second point isn't really a speed increase.
It is simply doing two loops before updating the screen, which, in some cases could be bad.

For example, if an object is moving extremely fast across screen, and you don't sync between the loops, it could appear to jump from one spot to another.

Provide some code that can prove Sync On is a speed increase as opposed to not having it, and I'll add it as a note to the start.

Thanks for the post.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Arkheii
20
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 5th Jul 2004 20:48
Jess, I'll need someone else to confirm it as well, but your fullscreen window code sped up one of my slower, older programs, from 35fps to 40+. Works wonders for me

Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 5th Jul 2004 21:39
Heh, never knew it was that effective.

All it is really is just a way of setting the window to be the same resolution as the desktop, then making it cover the entire screen.

I guess that could be an add on to the speed tips then, hehe

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
eat much pie
20
Years of Service
User Offline
Joined: 9th Apr 2004
Location: Within the mind of a lowly mortal...
Posted: 6th Jul 2004 02:21
I use DBPro, so I don't know if this will be of any use. But, instead of using the intersect object command (or whatever equivelant you have) use this dll that Paul Johnston made. You can use it in commercial products, as long as his name is in the credits. Goto: http://forum.thegamecreators.com/?m=forum_view&t=31051&b=5

It's very fast and you can also find out the normals data of the face collided with, along with the point of collision.

Hooray for Sparky!!!

Checkpoint Router: my very own AI routing program: http://www.angelfire.com/theforce/eatmuchpie
Doom weaver
19
Years of Service
User Offline
Joined: 5th Jul 2004
Location:
Posted: 6th Jul 2004 12:36
just an idea...
if you have many objects attached to your characters, just check if the character is in veiw. if he or she is not, hide the character and everything he or she is holding. That way you can do far less checks whether an object is on screen, because one objects position directly affects anothers.
Drew Cameron
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 9th Jul 2004 03:04 Edited at: 9th Jul 2004 03:07
@ Jess - I meant sync rate 0, not sync on in my code snippet, my mistake. They both sound similar and when you're not concentrating these things happen...

About the second point - Sync skipping *can* be a good option to include for really slow machines. I would prefer a game that jumps slighlty but plays than one which plays at 10fps It's a last resort but it works none the less. My Dumbo normally game runs at 60 on my high end computer but only 10 on my old one... but with this option I can get it up to about 35 with hardly any jumping or whatever. I would not recommend it for normal use.

Sorry for the confusion, just my two cents...

Dumbo - now awaiting models from Andrew11!

http://www.ddrw.dbspot.com/new
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 9th Jul 2004 12:21
Drew, alrighty, but I have to say that they still are not exactly speed ups.

Sync Rate 0 simply sets it so that the Video Card updates as fast as it can manage, and "sync skipping" is just that, skipping a sync. All you're doing is two loops per sync. There's not much to do with Speed increases in either of them.

Thanks anyway for the imput.

I might add it in later depending on what others say.

Anyone want me to put it in?

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Drew Cameron
20
Years of Service
User Offline
Joined: 30th Jan 2004
Location: Scotland
Posted: 9th Jul 2004 18:35
Well maybe it's just me, but the sync skipping gave me a massive speed increase

Don't feel obliged to add it, it's not the best tip here...

Dumbo - now awaiting models from Andrew11!

http://www.ddrw.dbspot.com/new
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 24th Jul 2004 13:04
Update: Added Bibz1st exe version speed tip

Thanks for all the input guys, really helpfull

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
ico2
20
Years of Service
User Offline
Joined: 3rd Jan 2004
Location:
Posted: 4th Sep 2004 06:09
i didn't have time to read the whole lot to see if sumwun has already mentioned this.
absoloutly under no circumstances use more than 1 sync command per loop, only the main loop should have the sync in, not any other function called from it, otherwise life gets difficult.
even though using more sync statements makes the reported frame rate go up, it makes the actual game speed slower.
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Sep 2004 15:45
ico2,
All the updated info is on the main page, anything that isn't exactly a speed tip, I give my reasons why it's not quite, then leave it as that

For your tip, that is true, but the idea of the Sync command is that it updates the screen with all the new visual information created since the last call to Sync.

If you put three syncs into your main loop, it'll update the screen three times per loop. Which, yes, does cost more time ( about 16ms per update, depending on your GFXcard and other stuff ), but that is not really a problem, that's just bad programming.

Also, if you use Sync more than once, yes, the frame rate goes up, because there is an internal error with DBC, where if Sync or Screen FPS() is called more than once per loop, the reported FPS is totalled up untill the next loop starts.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Cian Rice
19
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 12th Dec 2004 11:13
Jess, I was wondering if you could explain a problem I'm experiancing. In an FPS I have just started yesterday, I added it so when the bullet colides with an enemy it takes damage and after a few shots dies, and when I added the collision in my game went from 80-90 FPS to 10-20, any explanantion as to why this could be happening?

Have a heart and join my message board.
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 14th Dec 2004 15:54
It could be a few differen't things.

The built in DB collision commands aren't exactly ideal. It's better if you can write your own ( such as circle, or box checking ), or can use a DLL.

Also, if you put up some code, I may be able to point out something that you're doing wrong

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
dugzilla
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 15th Dec 2004 21:17
Jess,maybe you can help with a few things I don't fully understand
yet.
1. Can you make a dll that includes media files?
(example: x-files,sound,music,images)
Would this speed up my game?

2. Can you use memblocks in the same manner. Storing not only
variables for multi-use but files as well.
Would this speed up my game?

Most of the stuuf you wrote in 1st post I found out by testing
but still am only catering to medium to fast computers. I'm still
getting a grip on memblocks and dlls. My levels I make are not
that detailed and yet take up a lot of resources. I've optimized
as much as possible there and now need to optimize code to fullest
extent. Please help me understand this a bit more. Thanks!
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 16th Dec 2004 17:50
Hey Dug,

I'm not sure about making a dll that contains media, but I can say that if you could, it wouldn't speed up the loading process anymore.
This is because DB takes all the media when using the "Load..." commands, and converts them into its own internal format which works best for the app.

With MemBlocks, I am not even sure if there is a way to Load them in, without doing it manually ( opening a file, reading the info, and putting it into a MemBlock ), is there?
If you mean that you just want to read in some information, and hold it in 'storage', then, sure a MemBlock can do that for you, no worries. But, it won't really give you a speed increase, other than you not having to manually open a file, read in the data, then close the file.

Another good thing with the MemBlocks ( I may have said this ), is that you can use the 'Make MemBlock From ...' commands and then have direct access to the metadata of the information you converted to a MemBlock.
Such as a Sound, you can access the data that makes it up, or a Model, you can access all the informaion that goes up to make a Mesh.

With DB, you probably shouldn't be aiming for too low end machines.
Code can be optimized a fair bit when it comes down to it, but even after that, you'll still have some troubles getting DB apps running on really low spec machines.

I usually Guestimate, saying that about a P2, 1Ghz, with 128MB would be the lowest I'd bother trying it on.
But, again, that's different for different situations.

Just think about your code logically, and in 'Computer' terms ( as if you were a computer ).
The computer is stupid, it follows EXACTLY what you tell it, it doesn't have common sense, and thus, anything that may hurt it ( ie, extreme memory usage etc ), it will still go right ahead and do it.
Run through what you have on paper ( even if it is really massive, then do the individual modules seperately ), and think "Well, this For Loop can be combined with that one... And, I have this variable which I can use as a flag, so that it doesn't neeed to do all of this part here when it's not needed" etc etc.

Hope that helps a bit

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
dugzilla
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location:
Posted: 16th Dec 2004 19:46
Jess,Thanks for the insight. I have dbpro and think I'm as far as I
can go with speed so it'll have to do. Thanks again....
Cian Rice
19
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 18th Dec 2004 22:18
Thanks for the info on collision Jess. I think I'll just go and get Spark DLL and see if that improves it.

Have a heart and join my message board.And now my messageboards work again!Woot!
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 18th Dec 2004 22:57
Any time mate Glad to help



Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Plazmeh
19
Years of Service
User Offline
Joined: 7th Jan 2005
Location:
Posted: 8th Jan 2005 21:45
Very nice tutorial
3beth
20
Years of Service
User Offline
Joined: 13th Feb 2004
Location: Good ole Kentucky
Posted: 7th May 2005 18:22 Edited at: 10th May 2005 14:08
Anime Blood,
My humblest apologies for saying what I said before I re edited this post. I was very wrong I should of written you in private, I was just panicked, and my mouth overloaded my head. I hope you will find it in your heart to forgive me. Now Jess its your turn.

sincerely,

3beth

I do love you guys believe it or not.

beth_collins@uksoft.zzn.com

Beth=The ditsy blonde. I like men and programming, but mainly programmed men! http://uksoft.planetdns.net/29/index.php my dirty little forum
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 8th May 2005 16:59
Thanks Plazmeh!

3beth,
Do not ever make threats on this forum again.

Also, I find nothing wrong with his website. You cannot simply download virus and spyware ( other than cookies ) without explicitly clicking on something in the first place, so if your computer got infected, it's your own fault for not being smart enough/not having the right software to combat it.

Any further discussions you may wish to have, email me at;
sweet_prozack@hotmail.com

Jess.


Team EOD :: All-Round Nice Guy
dbHelp
Mikada
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location: Kentucky
Posted: 12th May 2005 15:45
Hi Jess,

I see Beth made her apology, thats good.

Wonder if anything else is happening here.

sincerely,

Michael

Mike Cohoon
KYP
19
Years of Service
User Offline
Joined: 5th May 2005
Location: 01110000
Posted: 15th Jun 2005 02:26
wow, this thread is just what i need. in the game im working on, to have smooth collision, i make the objects static objects but i cant delete them. in a racing level where there doesnt need any gravity, there is no static objects so i can delete them. however, i made a huge mistake... i hid all the static objects with a big sphere 'boulder'. no wonder it runs so slow...

program 'till your butt falls off, and never give up.

working on a game: Squirell wars. around 10% done.
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 15th Jun 2005 03:14


Glad you found it uselful

Jess.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
billy777
21
Years of Service
User Offline
Joined: 9th Jan 2003
Location:
Posted: 13th Aug 2005 00:20
Thanks Jess for this thread and special thanks to Drew Cameron for that revised sync code - it works awesome!

Bill
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 13th Aug 2005 04:23
Anytime, Bill

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
new programmer
18
Years of Service
User Offline
Joined: 20th Dec 2005
Location: right behind you.
Posted: 1st Jan 2006 21:04
invisible thread WOOT!

Les Horribres
18
Years of Service
User Offline
Joined: 20th Nov 2005
Location: My Name is... Merry
Posted: 2nd Jan 2006 09:02 Edited at: 12th Jan 2006 04:13
^dbnewbe^

This is the Offical FPSC ANJL HeadQuarters v 1.0
The best place to put your HQ deep in enemy territory, so that they won't suspect it when they see it.



Thanks Given to SarusX


Rule 5 will be updated to
Thou shalt post in the ways dictated by The ANJL.*

*This confusing rule controls your entire posting method, in it's current interpretation it means no leet or stared swearing, and always post demos, screenies, and Videos in formats coveinent to others.

Merranvo, The Cool One

Anti-Noob Justice League, an ANJL of Mercy.
Undercover Steve
18
Years of Service
User Offline
Joined: 6th Jun 2005
Location: Vancouver, Little Canada(Washington)
Posted: 27th Jan 2006 19:14
Merranvo, your a noob. A horrible noob.

We have fallen Into an abyss! Dear God captian! There all Bars.
Les Horribres
18
Years of Service
User Offline
Joined: 20th Nov 2005
Location: My Name is... Merry
Posted: 28th Jan 2006 05:34
You found my secret hide out! Now we can flame eachother in a deleted topic.

Merranvo, The Cool One
Noob Justice League, Cause We Have More Fun
Support Merra XJ9, cause the name is cooler.
Darkbasic MADPSP
18
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 28th Jan 2006 13:24 Edited at: 28th Jan 2006 23:36
lol um i don't think this is deleted

Edit:
Attack the anjl? why would we...

Edit2:
What?!?!?! this isn't listed

where i went on holiday to
www.portaventura.es and also http://themepark.nl/ubbthreads/showflat.php?Cat=0&Board=UBB7&Number=661483&page=0&fpart=all
Les Horribres
18
Years of Service
User Offline
Joined: 20th Nov 2005
Location: My Name is... Merry
Posted: 28th Jan 2006 21:40
Yeah, it is deleted.

Merranvo, The Cool One
Noob Justice League, Cause We Have More Fun
Support Merra XJ9, cause the name is cooler.
FoxBlitzz
20
Years of Service
User Offline
Joined: 19th Nov 2003
Location: United States
Posted: 28th Jan 2006 23:40
It seems to think there's three pages.

AMD Athlon 64 X2 4200+
1GB DDR-SDRAM (May increase to 2GB one day)
512MB ATI Radeon X1800 Series - Finally! A card that does pixel shaders correctly!
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 29th Jan 2006 00:11
Lol. Look below
84 message... I wish

Attachments

Login to view attachments
re faze
19
Years of Service
User Offline
Joined: 24th Sep 2004
Location: The shores of hell.
Posted: 29th Jan 2006 08:46
also, generate random numbers ahead of time and store them in an array as to avoid calculating them at runtime

Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Jan 2006 15:54 Edited at: 29th Jan 2006 16:05
Something wrong with this page.

Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Jan 2006 04:36
test


"Computers are useless, they can only give you answers."
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Jan 2006 04:39
test2


"Computers are useless, they can only give you answers."
re faze
19
Years of Service
User Offline
Joined: 24th Sep 2004
Location: The shores of hell.
Posted: 30th Jan 2006 05:44
seems fine now, what a weird anomaly!

Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Feb 2006 19:35
this just upgraded to v1.01 because i just posted

The Cowboy Game progress 17% (paused)
HorizShootiz progress 20% - optimising code
re faze
19
Years of Service
User Offline
Joined: 24th Sep 2004
Location: The shores of hell.
Posted: 2nd Feb 2006 23:14 Edited at: 2nd Feb 2006 23:15
that's funny, my posts show up...
but hey, I pwn!

Admin 7737
17
Years of Service
User Offline
Joined: 14th May 2006
Location: Japan... I WISH!!
Posted: 21st May 2006 09:15
Kl

-----------------------------------------------------------
Im in A race With 5 People And I'm in third, I over Take 2nd, In what position am I? (Email me for the Answer!)
ciril
17
Years of Service
User Offline
Joined: 25th May 2006
Location: los angeles, ca
Posted: 2nd Jun 2006 03:40
outstanding tips! THanks

The way I check performance is - lowering / extreme adding some value.
And testing. Always works.

@ as ciril

3.0 pentium 4 / 2 gb ram / geforce sli (6800 gt x 2) / 23" hd apple
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Jun 2006 13:54
Reducing the numbers of colours in your images, and bitmaps increases speed by a lot. You can ususally convert a 32bit image to 256 colours, and there will be no difference. Sprites all have their own pallette, so 256 colours per sprite is still practically the same as 32bit graphics. This is a huge speed increase, well worth trying.

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 30th Jul 2006 00:05
Not sure if anyone has mentioned this as I read through the start , then skipped a couple of pages. Creating instances of objects rather than loading multiple objects makes a huge difference to speed. The only problem is no anim data can be used. Not sure if clone object retains this or keeps up speed as well, but possibly it would. I'm sure to find out on the project I'm working on at present, as I feel it needs some optimising somehow and my normal methods have all benn used.
SimSmall
19
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 2nd Aug 2006 08:20
Clone object is not a DBC command
Code Dragon
17
Years of Service
User Offline
Joined: 21st Aug 2006
Location: Everywhere
Posted: 19th Sep 2006 22:37 Edited at: 31st Oct 2006 01:17
I'm not sure if this works in DBC, but make memory is even faster than memblocks.

[edit]

Also, dword variables are faster than word and byte variables. This is probobly because a 32 bit operating system is used to dealing with dwords.

Confucius say click the link to become a master game developer.
http://www.dexterity.com/articles/
SimSmall
19
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 20th Oct 2006 22:50
[Flame]That's also not a command in DBC .... DB and DBP are not the same thing![/Flame]

Login to post a reply

Server time is: 2024-05-06 09:04:40
Your offset time is: 2024-05-06 09:04:40