Sign in to follow this  
Overdose7

Is good idea to use D3D for 2D game ? Advantages ?

Recommended Posts

Overdose7    122
Hello world. I was wondering if there is any list of advantages when using D3D for 2D only games... I want to rewrite one 2D game to D3D but I found a some big disadvantages: -Textures must be power 2, when drawing tiles 80*80 then texture will be resized to 128x128 pixels, that takes much more video memory especially when you have over 3000 tiles... Can anybody please tell me any other reasons why I should NOT use D3D for 2D game ? or why I should use ? Thanks for answers... and sorry for be ;)

Share this post


Link to post
Share on other sites
leet bix    116
The 2D rendering objects that DirectX has have been pretty much completely dropped as far as I know and it all must be done through 3D, most 2D games done in DirectX render textured quads, this offers a number of advantages; 1. Direct3D renders quads blazzingly fast, 2. you can order the depth of the quads with a simple z value assigned to each quad 3. it's pretty simple.
You question about texture size isn't a problem, you shouldn't have 3000 tiles in video memory at the same time, only load those that are displayed, there's no point in loading 3000 tiles all at once, also, chances are those tiles are not all unique, so you can render the same tile more than once and only load it once for your entire app.

Share this post


Link to post
Share on other sites
Overdose7    122
Thanks you for answer,

I was always thinking that drawing 2D graphics is slower in D3D than DD because DD is especially made for drawing 2D graphics so it should be pretty optimized...

With that texture problem, (that tiles was only example) I need to have them all loaded in memory, because that world is pretty big and preloading them at runtime is very slow, especially when its many small files... I may a develope a new format for that tiles, or just merge them into one big file because they are all in same size, but it doesnt change a fact that rule "power 2" is big disadvantage.


Do you have any other ideas of advantages that D3D could offer me in 2D game ?


Share this post


Link to post
Share on other sites
jpventoso    178
AFAIK, Direct3D is the right way to go on 2D right now. It has a lot of advantages like leet bix said, and DirectDraw has been deprecated lately.

Also, you can load all textures when the map/level/scene loads, put them in the MANAGED pool, and let Direct3D decide when to move them into video or not. That way, your video card wont run out of memory because Direct3D sends only the displayed textures to the vRAM.

HTH.

Share this post


Link to post
Share on other sites
dmatter    4821
A 256x256 texture atlas containing 3x3 sprites each of 80x80 with 5px separation between them and a 3px separation around the border utilises all 256 pixels in both directions, not too bad.

You might also be interested in Direct2D, which you can already play about with.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this