[.net] Creating background for 2D game

Started by
3 comments, last by Jonas B 18 years ago
Hi, I'm trying to write a 2D vertical scrolling shooter. I have a question about how should I go about creating the game's background(scrolls vertically). should i create one big bitmap file containing the whole background(1 file/game stage), or should i create a bunch of small tiles and paste them together to form the background (i.e map[row,column] = {{.....},{.....}};). which way is better? I know for simple maps the map array method is better, but what if the background gets complicated(invloves too many different elements), then wouldn't it be too much trouble to paste it together with small tiles? Thanks for any comments.
Advertisement
Actually, for simple maps the one bitmap method would be better IMO. For any complicated map, go for the tiles.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

"wouldn't it be too much trouble to paste it together with small tiles?"

What do you mean by trouble?

* Performance-wise, you *might* have problems if there is lots and lots of overdraws involved, but I doubt it.
* The drawing code for a 2D scroller should be fairly simple regardless of which method you choose
* However, the demands on the editor you use for creating the environments/backgrounds will be higher. If this is your concern, let me know - you could use Endogine as an editor and export XML level files for your game. (Come to think of it, why not use Endogine for all of it!)

http://www.codeproject.com/csharp/Endogine.asp
Well, by saying too much trouble i meant it takes too much time to code the tile map, for example:
map[5x5] = {{1,1,2,2,1},
{5,2,1,1,5},
{3,3,2,2,5},
{1,2,2,2,1},
{3,3,3,3,5}};
as each number refers to a specific tile.
now, imagine if the map gets big which consisted of 50 rows x 15 columns and tons of different elements(rocks, grass, water, etc.), it would take forever to paste the tiles into a meaningful map/background.
However, if i load one bitmap as the background, the size of the bitmap will be huge(800 x 6000pixel).
There must be a better way to do this. Could someone pls enlighten me?
That's why you want to use a graphical editor. I'm sure there are editors out there that uses the grid design pattern you describe.

Myself, I wouldn't use grids but arbitrary locations for each "tile" (arbitrarily shaped sprite), as in this game I made a few years back:
http://www.jobe.nu/Pub/Test/Platform/Loader.htm

This is much more flexible, but the culling algorithm to avoid processing the "tiles" not in view is a bit harder than with a fixed grid.

This topic is closed to new replies.

Advertisement