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.

Author
Message
Dreq934
22
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 20th Feb 2012 17:08
I have what I consider a fairly simple main menu. As I am a software developer by trade, I have the logic itself very optimized to prevent things like creating/freeing objects on loop, performing needless calculations, etc. Anyway, I noticed, even with manual sync and no CLS or background repaint, it still manages to render at about 18fps (1920x1080). I'm using PASTE IMAGE and simple text rendering (even without text rendering it isn't much better). I then re-coded, using the exact same control-flow methodology in openGL with orthogonal projection, and got a yield of around 1,800fps. I was just wondering what I'm doing wrong with my 2D drawing operations? I would use textured quads but I see no way to enable orthogonal projection in DarkBasic.

Dark Basic Professional
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Feb 2012 17:19
Copy/Paste your code. 2D isn't that slow.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Feb 2012 17:25 Edited at: 20th Feb 2012 17:28
Sounds like you are changing font a lot. Changing font is EXTREMELY slow in DBPro because it rebuilds the font every time you change something. You may want to check out my Advanced2D plugin for generally much faster and more flexible 2D drawing, and if you want a nice UI for your game there's also my TopGui library (which uses Advanced2D).

[b]
Dreq934
22
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 20th Feb 2012 17:36
That may be it. When I commented out the font logic, I did NOT comment out the font settings stuff. I really just need to use font maps anyway.

Dark Basic Professional
Sergey K
22
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 21st Feb 2012 01:02
yeah i think its not the image you have problems with
it might be dbp's build-in font commands that do those problems
set font name,set font size, set font etc.. in loop slows really hard the pc.. dont use it

more 3d models .x/.obj and more foramts here:
[href]https://www.turbosquid.com/Search/Index.cfm?keyword=gogetax1&x=0&y=0[href]
Dreq934
22
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 21st Feb 2012 01:28
It's really weird that it's so incredibly slow... I've got my game going in OpenGL now, do the exact same amount of font work and it's blazing fast. I think the big problem is DBPro's inability to create display lists. I think if we could do that, it would greatly increase the performance of most games out there -- perform translations and render them.

Dark Basic Professional
JRNTexas
15
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 21st Feb 2012 01:34 Edited at: 21st Feb 2012 01:37
You might try D3D dll:

http://forum.thegamecreators.com/?m=forum_view&t=69221&b=5

I had a very similar problem. Font changes not only slowed my simple 2d program down, it made it use 40 - 60% of the CPU.

I switched to d3d dll and it went down to 2 - 6% of CPU and ran very fast.

And it was the only change I made to get much improved performance.
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Feb 2012 02:24
Quote: "It's really weird that it's so incredibly slow... I've got my game going in OpenGL now, do the exact same amount of font work and it's blazing fast. I think the big problem is DBPro's inability to create display lists. I think if we could do that, it would greatly increase the performance of most games out there -- perform translations and render them.
"


Direct3D works differently from opengl, it doesn't have or need concepts such as display lists. The reason it's so slow is this:
When you create a font for use by opengl or direct3d, you have to write the characters of the font to an image, and then use that image to draw the text because graphics cards can't directly render text.

What you would normally do is create a new image for each font so switching between them is as simple as changing the texture (very fast).

DBPro on the other hand just has one font in use at any given time, so when you change a font attribute, it deletes the old image (slow), creates a new blank one (slow) and fills it with all the possible characters drawn using the new font style (very slow).

The reason I suggested using Advanced2D is that it allows you to have multiple fonts at a time. The slow part of creating them only needs to happen once at the start of the program.

[b]
Dreq934
22
Years of Service
User Offline
Joined: 15th Dec 2003
Location: SC, USA
Posted: 21st Feb 2012 03:35 Edited at: 21st Feb 2012 03:39
In case someone is curious, here's the side by side. CEOld.exe is DBP made, and CelestialEmpires is Delphi/OpenGL. Using same resources and pretty much the same layout, as well as the same program control flow. Only the Quit button is relevant to this code as that is all I have Just click "Quit", then "Cancel" back and forth to see the response time.

What I do with the OpenGL version is create a "label" object, and when you set the text, it generates a texture just big enough to store said text, and renders to said texture. Then drawing simply rasterizes it to the screen via a textured quad in orthogonal projection mode -- and packaged ontop of that is of course display list rendering -- the UI is only re-rendered when something changes like a button hover.

Dark Basic Professional
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Feb 2012 12:45
A menu is usually a Photoshop job. I never see the need to create them on the fly, you aren't likely to change them. It's just slowing the progress of your game down to create an editable menu when all you need to do is draw it, and if you need to edit it, edit the drawing.

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Feb 2012 13:35
There are some precautions, recommendations with 2D in DBPro. Like try not to use a built in font, make a bitmap font system instead. It's faster to paste each letter than to use built in text, plus this means you have full control, you can easily add smooth fonts, anti-aliasing etc.
One other thing is to mimic the ascii set - don't cross reference your text. For instance, if you have 100 characters in your bitmap font, offset them by 32, so your first character is a space, then deduct 32 from the ascii value of each character in the text string, and use that to reference the image used for that character.

Menu systems are a great place to add shine, it can make a huge difference to overall game quality, so I'd say it's worth spending a lot of time on your front end.

Health, Ammo, and bacon and eggs!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Feb 2012 14:25 Edited at: 21st Feb 2012 14:30
Just as an example, here is one of my menus using just graphics, and I could add the glow effect later. The colour mask would be the menu collision routine. It is just as re-usable as an editable menu, you only need to draw a different mask each time. So long as you save the Photoshop file you can edit the text on a Photoshop layer.

Login to post a reply

Server time is: 2026-07-10 04:42:17
Your offset time is: 2026-07-10 04:42:17