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 / Please review my code.

Author
Message
Jimmy 9 Toes
20
Years of Service
User Offline
Joined: 15th Sep 2004
Location: 2nd Star to the Right
Posted: 16th Sep 2004 05:38
Hello All!

My name is Jim and I'm new to DB and DB Pro. I just ordered the boxed set of DBPro yesterday and I'm using the evaluation version until it comes in the mail.

Anyway...

Whenever I'm new to a language I write a simple little program to put it through the riggers. It's always the same type of program. That is, a program that will bounce a random number of sprites all over the screen in random directions.

I keep increasing the number of sprites in order to see how smoothly the program will run.

Here's a link to my code: http://www.Pishlo.Net/dbpro/Mine.zip

Or you can view it here:


I've actually got the program running pretty smoothly with 500 sprites on my laptop (Pentium 4 2.4 Ghz ATI something or other video chip).

In fact, the equivalent program for Blitz Plus and Blitz 3D don't run as fast as it does on DBPro.

I was wondering if there was anyway I can optimize the code any further to make it even smoother. (Aside from using a particle emitter).

Thanks in advance.
-Jim
Dot Merix
20
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Canada
Posted: 16th Sep 2004 13:29
That's really quite neat..

I'm not exactly sure what you meant by smoother, do you mean smoother movement, more optimized code?

As far as i can tell from looking at the code it looks pretty well done

Good job and welcome to the community.

- Merix
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Sep 2004 02:22
Yeah, it looks perfectly fine, there are a couple of little optimisations you can make, but they probably won't make much of a difference, but...

CLS is pretty slow, it'd be faster to just use the backdrop and leave the sprites with backsaving on. Just checked with your code and as is I get between 134 and 140 fps, with the backsave on and using a backdrop I get 144 to 147.


Van-B


Muhahahahaha.
Dot Merix
20
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Canada
Posted: 17th Sep 2004 12:55 Edited at: 17th Sep 2004 13:05
What're your cpu specs VanB? I get about 75fps.. i added fps code so it looks like this.


When i run the code it says i get 74-75 fps..

I have a pretty good cpu, so i'm surprised that yours is running faster than me, though i suppose i'm not surprised.

[EDIT] Holy cripes.. i set it to window exclusive mode instead of full screen exclusive and got a big bump in fps.. It now runs at 230+ fps. I assume you have it set this way aswell VanB?

[Second edit] Wow, i set it up to 1050 sprites and it runs at 60+fps.. Very impressive. I cant see much reason you'd ever need to have that many sprites all on the screen at the same time anyways. So just to know that you can is interesting.

- Merix
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th Sep 2004 17:18
Yeah, fullscreen locks the FPS at the maximum your monitor can display, windowed mode is not limited - I usually use fullscreen windowed mode.

I have a 1.1ghz Athlon with 256mb and an FX5200.


Van-B


Muhahahahaha.
Jimmy 9 Toes
20
Years of Service
User Offline
Joined: 15th Sep 2004
Location: 2nd Star to the Right
Posted: 18th Sep 2004 07:54
Strange VanB.

I get much more fps if I use the CLS method.
{Backdrop off, and non-background saving sprites.}

Thanks for your help!
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 22nd Sep 2004 06:14
DarkBasic is slightly slower with 2D than 3D.

So textured plains i think would be faster.

But that' snot important now.

[img src=http://blanky.pt-web.net/ddd.gif] >::p

Login to post a reply

Server time is: 2024-09-23 00:32:13
Your offset time is: 2024-09-23 00:32:13