Jump to content
  • Advertisement
Sign in to follow this  
p997

[.net] Creating background for 2D game

This topic is 4504 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

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.

Share this post


Link to post
Share on other sites
Advertisement
Actually, for simple maps the one bitmap method would be better IMO. For any complicated map, go for the tiles.

Share this post


Link to post
Share on other sites
"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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!