Jump to content
  • Advertisement
Sign in to follow this  
gamedream

3D render 2D Map

This topic is 5396 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Nowaday, 3D Technology is more popular and 2d technology would be out-date.... Therefore, I want to use D3D to render 2D such as map(isometric). In my mind, D3D technology such as texture, vertex buffer is for 3D game. If I want to make 2d Map or 2D game, Do I need to use Sprite Technology. I have read some book for DirectX to render 2D (tile map), they suggest use D3DXSpirte, Am I correct? We need to use D3DXSprite to render 2D Map? Actually, I cannot easy to find the resource about D3DXSpirte? Can anyone has refer web site? Thank You very much

Share this post


Link to post
Share on other sites
Advertisement
you might want to check out opengl instead, also very good vor 2d rendering
IMO it's a lot easier to use than d3d

check out the tutorials at nehe.gamedev.net

Share this post


Link to post
Share on other sites
I've recomended this book time and again because its just that good. Pick up "Focus on 2D in Direct3D" It covers everything you need to know.

At first it seems a little wierd to be using a 3D API for 2D, but honestly its the way to go these days. Hardware acceleration for 2D is spotty because the driving force that sells new graphics cards these days is 3D. So much so that you can often get better performance from a low-end graphics card usind 3D techniques than you can get out of using 2D techniques and APIs on any other card out there. On top of that you can use the additional capabilities of the 3D card for all sorts of neat special effects. Its easy once you get your head around it.

Also, while directX does provide D3DXSprite, it may be better to roll your own so you can batch tiles together for better performance. I may be incorrect, but I believe D3DXSprite is just a wrapper around a textured quad and DirectX won't batch them together.

Share this post


Link to post
Share on other sites
Don't use Sprites for tilemaps (Its easy to program but its soooo slow). For 2D the best method I've found is to generate your tiles with vertices when you load the level into a big vertex buffer. then draw the whole thing. That way you only need one SetTexture and one DrawPrimitives for each texture you use on map. Then just change the view matrix to scroll/zoom whatever. Its not worth figuring out which tiles you need to draw, its better to just let the videocard do all the work. I know this seems counter-intuitive but you can easily get hundreds of FPS with thousands of Tiles being drawn. I would only use Sprites for drawing characters and other animated things, but even then they are somewhat limited. You can do a lot more things by batching polys. The only advantage to using sprites is that they are easier to use.

Share this post


Link to post
Share on other sites
To: Stru

As your idea, you suggest use D3D to perform 2D Map?

But I have another question, if I need to make 2d map editor, if I use sprite to my 2d game, so I can easy to develop 2d map editor, but if I use your method, How can I do on the 2D map editor?

Thx so much

Share this post


Link to post
Share on other sites
Yes, I am suggesting you use D3D with vertices to make a 2D tilemap.

Making a map editor shouldn't be any harder with vertices than with sprites. You just load the map data from a 2D array and create a grid of vertices and texture them according to the data. If you don't want to mess with vertices for the editor you could make the editor use sprites and then convert the map data to vertices when you load it in the game. But this could be a problem if you have multiple tiles in a single texture because I think sprites load the whole texture and there is no way to load only a small region of a texture.

I am obsessive about framerate but you might not be, so I would go ahead and make the editor with sprites. And if its fast enough for you then use sprites in your game, if you think its too slow with sprites then use vertices for your game.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!