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 / Very Low Frame rates when displaying 'front end' menu

Author
Message
PeeJayGee 2004
20
Years of Service
User Offline
Joined: 31st Jan 2004
Location: TN, USA
Posted: 30th Jan 2012 01:49
I've decided to come back to DBPro after 8 years and have a mess around with it, trying to write a game {i won't go into details here} but I've always been the type of person who tries to get the program/routine to work for me.. So here is my dilema..

a simple 1024 by 768 screen, with a .x logo spinning the middle of the screen, mp3 playing and I wanted to anticipate early on possible screen resolutions, so I wrote a function that allows me to pass over things about the line of text I want to display on the menu, pass over the x the y, the string, the font and whether it's center'd on the screen. all I wanted to display was 'Start Game' 'Options' and 'Quit', so I had my game loop

gosub rotatelogo
mylinetext (x,y,"text","arial black",fontsize,r,g,b,r,g,b,centered)

now just the rotatelogo, I get 250+fps, I add one line to display text and it drops down to 128+, with just 4 lines of text I'm getting 15fps.

So, I don't know if I've got my sync, sync rate, etc all that setup wrong, whether functions dont work too well for what I want, whether pulling the 'font' each time is slowing it down..

I'm stumped, just a simple front end, but with reusable code (for within the game) is all I need..

Any tips and/or pointers would be appreciated.

and I'm sorry for the way I lay out mycode, I know it will probably be criticized, but it's my style..



Don't jump, if you do you will only fall, and hurt yourself
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Jan 2012 08:46
I believe repeatedly calling the SET TEXT SIZE and SET TEXT FONT commands in a loop will result in low fps. I had trouble with this a while back and had to switch to sprites for the menu items instead.

Millenium7
19
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 30th Jan 2012 16:26
+1 to the above, like it is RIDICULOUS how much 'set text [anything]' will slow your program down

Here's the scary part: use a third party DLL and completely replace any and all commands related to text in your game

Here's the relief: A2Text does this extremely well and functionality wise is much better, with a very small learning curve thanks to these simple instructions

example being...

PeeJayGee 2004
20
Years of Service
User Offline
Joined: 31st Jan 2004
Location: TN, USA
Posted: 30th Jan 2012 23:51
Quote: "A2Text does this extremely well and functionality wise is much better"


I've searched google and the DBPro forums, unable to find a link to a website and/or a download to get A2Text

Can you help?

Don't jump, if you do you will only fall, and hurt yourself
Millenium7
19
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 31st Jan 2012 04:36
sorry it's called advanced2d, here you go http://forum.thegamecreators.com/?m=forum_view&t=179096&b=5
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 31st Jan 2012 10:57 Edited at: 1st Feb 2012 01:06
Ooh, Advanced2D must have slipped by me? I'm used to using Cloggy's D3D plugin for uber fast text drawing.

Millenium7
19
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 31st Jan 2012 15:31
I was tossing up between the 2 but decided on advanced2d because (unless i'm mistaken) you need to sort of... initialise? d3dfunc every time you do things with it. Whereas advanced2d has it's initial setup by assigning to an integer array and that's it. You then simply call a single command to put text on the screen, much neater
PeeJayGee 2004
20
Years of Service
User Offline
Joined: 31st Jan 2004
Location: TN, USA
Posted: 1st Feb 2012 01:02
Quote: "sorry it's called advanced2d, here you go http://forum.thegamecreators.com/?m=forum_view&t=179096&b=5"


Thanks for that, I'll download it and get to work..

Any other freebies/plugins you'd advise, with all due respect to TCG, if I can get something for free, I might as well use it...

I feel sooooo rust being away from DBPro for 8 years, it's going to be a slow process to get back in it...

Don't jump, if you do you will only fall, and hurt yourself
PeeJayGee 2004
20
Years of Service
User Offline
Joined: 31st Jan 2004
Location: TN, USA
Posted: 1st Feb 2012 02:11
Hmmmmmm, I litterally copied and pasted the code you provided into my source, and the text doesn't display...

Wonder what I'm doing wrong...

Don't jump, if you do you will only fall, and hurt yourself
Millenium7
19
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 1st Feb 2012 07:41
strange, pasted directly into a new file it shows text just fine for me. Musn't have installed something correctly

Have you tried it on a new file first? literally all I did was append 'wait key' onto the key of the code provided
PeeJayGee 2004
20
Years of Service
User Offline
Joined: 31st Jan 2004
Location: TN, USA
Posted: 6th Feb 2012 15:32
Quote: "strange, pasted directly into a new file it shows text just fine for me. Musn't have installed something correctly"


Your right, it worked when i did that (and obv added a do loop)

Sorry, I took so long to reply, had a little issue with myaccount (which TGC fixed) and I couldn't get into here...doh!!

I'll have to look see what I'm doing wrong when I add it into my source!!

Don't jump, if you do you will only fall, and hurt yourself
PeeJayGee 2004
20
Years of Service
User Offline
Joined: 31st Jan 2004
Location: TN, USA
Posted: 6th Feb 2012 16:01
set display mode 1024,768,32

I'm guessing that clears variables, as when I rem'd out that line, it worked..

Don't jump, if you do you will only fall, and hurt yourself
Millenium7
19
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 6th Feb 2012 17:04 Edited at: 6th Feb 2012 17:09
i don't think it 'clears' variables, however keep in mind that advanced2d is not actually using 'text' commands, a2text actually pastes a sprite to the screen. I'm not sure how the initial integer setup works, but I believe it's essentially pasting text to the screen in the background, taking a snapshot of it, and saving each individual character into memory as a seperate sprite. When calling the command to paste "test" it pastes a "t" sprite, "e" sprite "s" sprite and so on

It's possible that changing the display mode somehow screws up the data that was initially captured at a different resolution

My suggestion: try set display mode, then do the integer setup, then paste text. My prediction is it will work
then try integer setup, paste text, set display mode, paste text again and compare

either way you must call a 'sync' command after pasting text as well, otherwise they won't be drawn to the screen
nonZero
12
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 6th Feb 2012 21:33
Quote: "set display mode 1024,768,32

I'm guessing that clears variables, as when I rem'd out that line, it worked.."

Not the variables...

Quote: "It's possible that changing the display mode somehow screws up the data that was initially captured at a different resolution"

...the video memory (Not sure if it wipes 3D objects though, haven't tried but I assume so).

Dunno about these plugins specifically, but run a test in DBPro native commands and it'll crash you



I'm afraid you have to decided on your resolution at the start of your code and if you do need to change it afterwards, you have to reload oll your graphics. I think this is not just germane to DBPro native commands either (I'm thinking DX in general - although I'll stand corrected) but I don't use plugins so I can't give you a 100% on that. Anyway, thought that info may be of use, prolly not, but maybe.

Login to post a reply

Server time is: 2024-05-09 13:21:04
Your offset time is: 2024-05-09 13:21:04