I thought about making a simple 2D Sidescroller game like SuperMario. Then i wondered about how to save, load or create the levels for the game. The first thing i thought of was drawing a simple blocky png which represents the level, an making all the parts where the player can walk a special color (maybe lilac). I would import the level in blocks or tiles so i could check for collision.

so my questions are:
are there better methods for this?
what are the professional methods for this?
should i do this with Tiles and a Map editor based on tiles? (for some reason i dont like this, but i guess if its the best method i would use it)
with a tile based level, how would you realize slopes, and how would you check them for collisions?


5 Answers 5


For an 2D MMO we use http://www.mapeditor.org/. We use several layers for background, background decoration, objects on the same level as the players and objects in front of the player. And an additional layer with just one red square to mark collisions.

I am not sure if this appoach or the software works out for an 2D side scroller but it may be worth to have a look at it.

  • \$\begingroup\$ +1. It's a great tool. It's also open source, so you can extend it if you require. \$\endgroup\$ Aug 26, 2010 at 18:23
  • \$\begingroup\$ thats really a good tool, i tested it and had not a single problem importing it into my game. \$\endgroup\$
    – Simiil
    Aug 27, 2010 at 5:56
  • 1
    \$\begingroup\$ ok so now i want to know how to make non-tile-based levels, like the worlds in worms, but i guess i'll ask this in a new question someday \$\endgroup\$
    – Simiil
    Aug 27, 2010 at 5:58

A common way could be to just a string for example


where 0 would be a block you can walk on 1 could be spikes and 2 could be the finish line

you would simply read this in through a text file (or have it hardcoded into the game) and draw the relative block that is associated to the number and have your colision logic to handle however it is setup.

Obviously you can choose whatever format you want and perhaps 0 means draw 5 walkable blocks.

This is just one way it could be achieved.

http://www.smudgedcat.com/tut_tiledlevel.html this link is of an example within c# using the XNA framework. it will give you a rough idea (it does NOT contain slopes, but a similar thing could be used to define this type of case)

Regards Mark


alt text

A lot of games use an open source application called Mappy. It has its own format that supports multiple layers and other features. You probably want to associate several types of data with a given tile.

I think the in-game level editor approach is very common. Developer Mode is an inside account of how the levels for a very popular game, Braid, were designed. The game has a development mode where levels can be constructed/modified. The levels themselves have a collision layer covered up with graphical tiles:

alt text

And I personally don't recommend it, but a 2D demo program for Allegro used some type of 3D modeling format and converted it to a custom in-game format. The advantage was it could model very smooth, continuous surfaces. (It was a 2D physics-based skate boarding game.)

To edit the level data of the Allegro demo game, we use the free and open source tool Blender. You can obtain it here:


Here are step by step instructions how it works:

1) Place the file ademo_export.py into your Blender scripts folder. It is the export script which will convert from .blend format to the .txt format used by the demo game. Under unix, the path will be:


2) Load the .blend file blender. Under unix, type this from the directory with the level.blend file:

blender -w level.blend

(The -w is to use windowed modes, which I prefer.)

3) Edit the level. In the menu, under

Help -> Scripts Help Browser -> Export -> Allegro Demo Game Level

you will find some useful tips.

4) Save the file (use compression before committing). Export it as .txt from the export menu, choosing Allegro Demo Game Level.

5) Update level.dat using level.txt, the new level should appear in the game.


The 'professional' methods would probably involve a very detailed map editor, probably in C#, which would give them full control over everything.

There are two main approaches; one is easier to do, but not as effective.

  • You could use a map editor; either writing your own or finding a pre-existing one such as mapeditor which nhnb mentioned. Writing your own would be good for a learning experience, but not so much for a finished product.
  • You could just type data into a text file. This is simpler, but it's not easy to read again. You could probably get the same from the map editor, but that would be automated. The downside again of this is that you can't add any special effects such as certain tiles (not tile types, but tile (13,45) for example) to do special things.

I've had similar thoughts( ie get back into writing games a hobby - job and other commitments...)

I'd seriously consider the route of developing the 'Map Editor' as part of the game/application.

If your game ever gets beyond your own PC then Community Content would be great boon.


Not the answer you're looking for? Browse other questions tagged .