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 / Very low FPS on Pacman

Author
Message
No Time To Code
16
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 23rd Dec 2008 05:02 Edited at: 29th Dec 2008 03:10
Just got DBC recently and this is my first post - "Hello all!". I'm am trying to do pacman based on the DBP tutorial on this forum. Except for using the images and the movement routine, I am trying to do the program myself but I am running into a problem with the framerate. I am at the point where the maze is created using sprites and the pacman is placed. My pacman is moving in sloooow motion. The FPS is 4! even without trying to move the pacman sprite.
My code is below. Any thought on why the ungodly slow FPS?
Thanks!

BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 23rd Dec 2008 12:00
Welcome!

When Posting code, please use the code button, it is a little easier on the eyes. Also, it is a good practice to indent your code
(it makes this
look like this
). It makes the code MUCH easier to read and people will be more likely to help you.

Now, for some things I noticed with your code


Well, DBC doesn't support globals.

As to your fps, it is hard to read your code (since I can't compile it I can't experiment on it). Here is what I would suggest right off the bat:
1. Keep your subroutines and your functions together in the order that they are called, rather than mixed together.

2. Put an END command at the end of the main code but before any subroutines and functions (stops potential errors from occurring)

3.

418 sprites is a LOT of sprites. Since it is just static scenery, I would suggest, instead, using paste sprite. While you can't check for collision, that alone could increase your framerate to at least 60.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Dec 2008 14:34
I think you are looking for the DBPro board. One above!

TheComet

Peachy, and the Chaos of the Gems

Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Dec 2008 18:18 Edited at: 23rd Dec 2008 18:26
no he said he is trying to make pacman in dbc using the dbp tutorial

Like Bn2 said it is very hard to read :/ haha but i didn't see a sync on and sync commands the sync on should be placed Toward the top of your code and sync at the bottum of your loop that should do it.

[edit]

Whoops just copied your code into darkedit and realized that there was a setup subroutine sorry

[\edit]
No Time To Code
16
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 24th Dec 2008 02:29
Thanks for your suggestions. Sorry about the code, I tried using the code button but I see I didn't work as expected. I guess I have to bracket the pasted text in between the

1. I do indent my code but since I posted it incorreectly, it didn't look that way.
2. I'm using DBEdit that does support the Global command but I think it just converts the variable to an array. I may just Dim them as array myself since DBEdit pops up some confirmation box every time I run the program.
3. I will try your suggestions about reordering the subs and functions and adding the END statement.
4. The 418 sprites are the tiles that make up the maze. I don't need collision on them so I will try to use paste sprite instead.

One other question, I updateed from v1.12 to 1.21 but if I use the DB IDE it shows v1.14. It does seem to support the new object commands so I think the update worked but that 1.14 confused me.

Thanks again everyone and wish me luck in finishing this program before I'm old and gray!
No Time To Code
16
Years of Service
User Offline
Joined: 22nd Dec 2008
Location:
Posted: 29th Dec 2008 03:22
BN2
I set the maze as one big sprite and used paste sprite and I was able to get the FPS up to 50. I've seen some people post FPS of 1000+ but I might be limited by my video card which is pretty old:
GeForce2 MX400 200MHz core
64 MB 128-bit SDRAM (166MHz)

I've only got the maze and pacman movement done so far so I'll see as I add code if the FPS goes way down again.
Thanks for your help!

Login to post a reply

Server time is: 2025-06-07 20:58:40
Your offset time is: 2025-06-07 20:58:40