Sign in to follow this  
Waaayoff

Question regarding an article on Gamedev about Tiling?

Recommended Posts

Article From my understanding, all tiles are stored as bitmaps and are all then combined into a single bitmap. The tiles locations are stored in a text file which is usually prefered to an array. Why is that? And it talks about loading all the tiles into a single bitmap. So this bitmap is empty at first? how can you have an empty image? Also, if let's say i have hundreds of 32*32 Tiles, do i place ALL of them onto a single Bitmap?? Lastly, It uses the function BltFast since the author is using DirectDraw. What's the equivalent in Direct3D? Lots of questions, i know. But how else am i supposed to learn ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by Waaayoff
From my understanding, all tiles are stored as bitmaps and are all then combined into a single bitmap.

That 'single bitmap' is your screen buffer. The article seems to group multiple tiles together into single bitmaps though, likely to reduce rendering state changes. Read up on 'texture atlases' for more information.

Quote:
The tiles locations are stored in a text file which is usually prefered to an array. Why is that?

It's data-driven versus hard-coded. Note that tiles read from a file are still stored in memory at some point - possibly into an array. The point is that if you're reading your tile data from a file, you don't need to recompile your game in order to change a level. You only need to modify a file.

Quote:
And it talks about loading all the tiles into a single bitmap. So this bitmap is empty at first? how can you have an empty image?

You create this bitmap with an image editor. ;)

Quote:
Also, if let's say i have hundreds of 32*32 Tiles, do i place ALL of them onto a single Bitmap??

You could, yes, but you can also split them up, whatever you want/need. Note that things like this can easily be automated with some scripting.

Quote:
Lastly, It uses the function BltFast since the author is using DirectDraw. What's the equivalent in Direct3D?

I don't know - I haven't used Direct3D. Either way, you'll probably want to batch render calls, rather than using some kind of direct mode. Sending a lot of information to the 3D card all at once is faster than sending small amounts spread across many calls. Either way, isn't there some kind of rendering engine that can take care of the 'details' for you? Something like Haaf's Game Engine, for example...

Share this post


Link to post
Share on other sites
Quote:
Quote:
Also, if let's say i have hundreds of 32*32 Tiles, do i place ALL of them onto a single Bitmap??

You could, yes, but you can also split them up, whatever you want/need. Note that things like this can easily be automated with some scripting.


Sadly i haven't learned any scripting languages yet.

Quote:
isn't there some kind of rendering engine that can take care of the 'details' for you? Something like Haaf's Game Engine, for example...


Well i like to know how to do stuff. Hate having Engines take care of stuff with me not knowing how.

Thanks for your reply :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Waaayoff
Lastly, It uses the function BltFast since the author is using DirectDraw. What's the equivalent in Direct3D?


If you want something very easy to set up and get running, take a look at ID3DXSprite for DirectX 9; for DX10 and above, look at ID3DX10Sprite.

The other solution is to roll your own renderer. You'd probably want to do this if you want a little more control over what happens behind the scenes, but it'll be hard to optimize it as well as ID3DXSprite is.

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