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 / Sprites Vs Planes for HUD

Author
Message
Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 9th Feb 2011 03:59
Im working on my FPS and was wondering which was faster for a HUD that displays health, ammo, ect... Would it be faster FPS wise to create a plane and texture it with an image that could be edited with memblocks or use sprites pasted to the screen?

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 9th Feb 2011 10:00
It would be much easier and faster to use sprites, IMO.

Malevolence: The Sword of Ahkranox
The infinite RPG
http://www.msoa-game.com
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 9th Feb 2011 10:37
Faster for you, or faster for the computer to render?
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 9th Feb 2011 10:40
Anyway, if you ask me, it's the same since for a while sprites has been turned into the same 3d elements like planes.

I use planes, because they are easier to adjust for certain resolutions, and have better options for appearance.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Feb 2011 11:53
Transparent planes aren't as fast as sprites. Sprites are just pasted straight onto the render bitmap. I'm no expert but I'm sure that's the case.

My game Backlash had a lot of speed issues because I used a lot of transparent planes. A game with the same number of sprites would not suffer at all.

I would have thought using sprites would be just as easy or easier to scale for different resolutions. Combined with d3d commands or Diggseys a2 commands HUDs can be quick to render and easy to produce in 2D.

IMO

Madscientist
16
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 9th Feb 2011 18:48
Okay, thanks for the input. Sprites it is then.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 9th Feb 2011 19:22 Edited at: 9th Feb 2011 19:23
Sprites are rendered as a quad in the same way as planes are. (And my a2DrawImage command uses a very similar method) However, sprites are already in screen-space so don't need to be transformed and so are slightly faster to render than planes.

[b]
Kiaurutis
15
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 18th Feb 2011 09:55 Edited at: 18th Feb 2011 11:41
U can use simple images too, for background: paste image x,y - easier than easy
and sprites for those images which can change like health bar: if hp changes u just size sprite num, x+-change, y
If u want to have variable resolution in your game, use all the sprites. When changing resolution, recalculate "base" sizes of all sprites and resize all of them once. In this case u will have to recalculate x, y positions of sprites too. In my program i use constants declared at beginning for all images and sprites, so i don't get lost later. for variable resolution u just use variables.
here is example:


IMHO to paste image is far faster for pc to do than to paste image on plane and render it

P.S. @Madscientist can U check this:
http://forum.thegamecreators.com/?m=forum_view&t=179613&b=1&p=0
that's what for i am writing here
u don't provide any email or smth so i couldn't contact u differently

[EDIT]
i found some interesting info about dark basic rendering:

DirectDraw versus Direct3D


Did you know that DarkBASIC programs use DirectX? That's right—when you write a program with DarkBASIC, you are writing DirectX 7.0 programs without any effort! Possibly the most difficult aspect of DirectX programming is initializing DirectX components, such as DirectDraw. DarkBASIC actually utilizes Direct3D for almost all graphics output. It works this way because DirectX 7.0 separates the 2D and 3D graphics libraries. DirectDraw handles 2D graphics such as bitmaps and sprites, while Direct3D handles 3D graphics such as textures and polygons. These two systems aren't compatible! You can't draw using DirectDraw, for example, and then render a 3D character on the same screen. DirectX 7.0 just doesn't work that way.

Instead, DarkBASIC uses 3D mode for everything—including 2D graphics commands. This might be part of the reason why DarkBASIC is considered a 3D programming language. Although DarkBASIC has many built-in 2D graphics commands, it was clearly designed for rendering 3D graphics. Some 2D commands seem to run slowly; this is another side effect of DarkBASIC's use of Direct3D for all of the graphics commands. This might sound amazing, but DarkBASIC may be able to draw a textured polygon faster than it is able to draw a simple line on the screen!

From Beginner's Guide to DarkBasic Game Programming

Join The dark Side! We have cookies
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 18th Feb 2011 12:43
@Kiaurutis:
I'm fairly sure that snippet is from a Book written about Dark Basic Classic, not Professional. I'm not entirely sure they work in the same way. And DBP definately uses DirectX 9.0c, not 7

And to all, I find that using a pasted sprite is the easiest and quickest way, rather than fiddling around with planes. I scale the sprite to handle different screen resolutions.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Feb 2011 13:42
IanM has recently changed the way sprites are rendered in DBP and although I might be mis-quoting him again I seem to remember him saying that using sprites is quicker particularly if you use a lot of sprites (because of the changes).

Kiaurutis
15
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 19th Feb 2011 10:37 Edited at: 19th Feb 2011 13:06
Beginner's Guide To DarkBASIC Game Programming (2003)

Quote: "This book was most certainly not written for experienced programmers. If you have a knack for new software and you are able to install DarkBASIC and within minutes write a simple program without breaking a sweat, then you are too advanced for this book. However, if you have experience writing code but would like to know more about DarkBASIC Professional (the latest version from Dark Basic Software Ltd, which was released in late 2002), then I think you will find this book useful because it covers both versions. (In fact, the book is possibly a little slanted toward DarkBASIC Professional.)"


Join The dark Side! We have cookies

Login to post a reply

Server time is: 2026-07-17 14:13:04
Your offset time is: 2026-07-17 14:13:04