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 Professional Discussion / Why does this run so choppy?

Author
Message
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 00:32
I have a main menu, and at the bottom the screen I have a tool bar (a single image 1024x46) and a logo position in the center of the screen. But I'm getting a really low FPS, and the menu runs very choppy! Why is this? I have a hunch it could be because of the huge image at the bottom, but I'm not sure. Is there anyway to fix this? Here's my code for the menu:

(Thanks in advance for the help... )

` === MAIN MENU ===
Menu:

` Set resolution and frame rate.
Set Display Mode 1024, 768, 32
Sync On : Sync Rate 100

Do

CLS

` Load and display menu.
Load Image "MNU\OPTIONS.BMP", 1
Load Image "MNU\LOGO.BMP", 2
Load Image "MNU\NEW.BMP", 3
Load Image "MNU\STORY.BMP", 4
Load Image "MNU\CREDITS.BMP", 5
Load Image "MNU\EXIT.BMP", 6

Center Text 15, 0, STR$(MouseX())
Center Text 15, 50, STR$(MouseY())

` Place the images.
Paste Image 2, Screen Width()/2-150, Screen Height()/2-250

` Animate and enable menu.
` 0) Change if mouse is not over an option.
If MouseY 97 and MouseX() 700 and MouseY() 287 and MouseX() 700 and MouseY() 531 and MouseX() 700 and MouseY() 799 and MouseX() 700 and MouseY()
TheCyborg
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 14th Mar 2003 00:45
OMG!

Let me guess... you are new?

1) To get maximum speed (if thats what you want), use sync rate 0 instead of 100 to get the maximum possible speed.

2) Never EVER put load image inside a loop (this is your real problem). In your example, the images will load into memory every single frame, overwriting itself. If you got a FPS at 25, then you are loading 6 images 25 times per second into memory.



TheCyborg Development.
http://TheCyborg.Amok.dk
The Ultimate Source To DarkBASIC Programming.
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 00:47
Wow...thanks. Yeah I am new, been using DBPro for a week. I figured out the load image stuff a while ago, that was just a stupid mistake, LOL. Thanks for the Sync Rate Stuff too.

BTW, your also now in the credits of this game. Lol.

(I'm such a moron )

HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 00:50
Okay, now I have another question. Because of your ability to move the mouse around on the main menu, whenever you start the game your looking at the ceiling (I'm doing an FPS). How can I fix this? I tried using Point Camera but it didn't make a difference for some reason.

Thanks in advance (again)

HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 00:52
Actually whenever you start the game your looking in a different direction, depending on where you had your mouse last. So how can I fix this so the camera is always in a fixed location?

TRS80Model1
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 14th Mar 2003 01:06
You should reset your mouse pos. to where you would like it with "position mouse" command if you are using it that way.
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 01:08
Okay, I'll try it. Thanks!

HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 01:13
Hmm, didn't work. Maybe my code can give you more of an idea. Here it is:



TRS80Model1
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 14th Mar 2003 01:20
If you are looking where the mouse last was when you are on the menu, then reset the mouse position after leaving your menu and before drawing your level, this is something you will have to figure out cause its under your nose, and may teach you something about your style.

Look at it for a while then ask again.
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 01:37
Alrighty-o

Thanks

HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 01:46
Okay. I've taken a look at it, and it seems that this line,

Rotate Camera Camera Angle X(0)+(MouseMoveY()/2.0),Camera Angle Y(0)+(MouseMoveX()/2.0),0

is the problem. However, this line rotates the camera according to your mouse movement. After a few tests I realized that the cursor's position on the screen before you run the program determines where the camera will be pointed when you finally start the game from the menu. I have no clue why this is! Any ideas?

TRS80Model1
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 14th Mar 2003 02:08
Where do you want to look when you start:position mouse x,y

will put the mouse on a coord. on the screen, then mouse move should take it from there. If it doesn't then I'm the moron here and someone else maybe should take a crack at answering the question.
TRS80Model1
23
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 14th Mar 2003 02:11
Maybe use a variables to control then work off them with that mouse move command.
bitJericho
23
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 14th Mar 2003 02:21
trs-80 model 1?!?! Cmon dude at least go for the CoCo!
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 04:01
AAHHH!!!! This is driving me insane! It seems like there's no solution to this problem! (don't mind me ventilating)

in the meantime if you feel like you can be of some service, read my above posts for more info

thanks,
hz

HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 04:08
Here's some updated code with comments on what is giving me problems where, too



HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 04:23
Dear God. I solved it. And it was needlessly complicated. Turns out i had to reset the Camera Angles and Mouse Move values because when you moved the mouse on the main menu, it for some reason counted that as moving the camera.

I need to learn to be patient with technology.

HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 05:14
I have another quick question...right now I'm working on looping a sound, but it doesn't loop evenly. There's always a split-second pause in between the loops. I know this is a dark basic issue because I looked at the sound in an editor and played it, and it looped seamlessly. Any ideas? Chanx

TheCyborg
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 14th Mar 2003 12:22
There are no workaround for the loop bug... But I only seem to have this problem with music files (mp3) not sound (wav).

I just hope this will be fixed when patch 4 will be released (I can't wait anymore).

TheCyborg Development.
http://TheCyborg.Amok.dk
The Ultimate Source To DarkBASIC Programming.
TheCyborg
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 14th Mar 2003 12:23
BTW i must say for a newbie you really understand how to organize your code....

TheCyborg Development.
http://TheCyborg.Amok.dk
The Ultimate Source To DarkBASIC Programming.
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 14th Mar 2003 22:37
Thank you very much, I will take that as a compliment . I may be new to DarkBASIC, but I'm definitely not new to programming in general. However DBPro is the first highly impressive IDE I've come across in a while.

Good work DBPro Team

Login to post a reply

Server time is: 2026-07-18 06:40:46
Your offset time is: 2026-07-18 06:40:46