Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

5 Answers

up vote 9 down vote accepted

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.

share|improve this answer
    
+1. It's a great tool. It's also open source, so you can extend it if you require. –  Jānis K Aug 26 '10 at 18:23
    
thats really a good tool, i tested it and had not a single problem importing it into my game. –  Simiil Aug 27 '10 at 5:56
1  
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 –  Simiil Aug 27 '10 at 5:58
add comment

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:

http://blender.org

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:

~/.blender/scripts/ademo_export.py

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.
share|improve this answer
add comment

A common way could be to just a string for example

0,0,0,0,0,0,1,1,1,0,0,0,2

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

share|improve this answer
    
This is pretty much exactly how "Excite Bike" did it's custom maps back on the Nintendo. vc.nintendolife.com/games/nes/excitebike –  Stephen Furlani Nov 1 '10 at 12:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.