Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Making 2D-Platformer Levels


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 TheVirtualDragon   Members   -  Reputation: 237

Like
0Likes
Like

Posted 16 August 2012 - 07:42 AM

Suppose you are making a 2D platform game. You are now at the stage where you need to design the levels. This game you are making can be tile based or have epic graphics. It also uses Box2D/Chipmunk/<Insert your favourite physics engine here> to manage the collisions and physics.

Well, I am doing exactly just that and until now, I have been drawing 50 by 50 tiles in Gimp, then loading them in to my game and drawing them according to a little text file which defines the level (e.g. a "2" means grass tile). But now, I have had a thought. Wouldn't it be easier if you just opened up Gimp/Photoshop and actually drew the level your self? This would be very easy to do: open a tile, copy it and paste it on to your level and then move it around depending on where you want it. Then you could save it as .png and load it in to your game. Then, you could tell the physics engine where the ground is etc. (basically creating bodies in the case of Box2D).

So, is this a better way to create levels in a game (like the one described)? You could easily move and edit the tiles around or even eliminate the need for tiles altogether and have a vectorial game. Then you could just load the saved image and display it and that would be it.
What's This?: basically, it's my blog. Click on it.

Sponsor:

#2 nox_pp   Members   -  Reputation: 490

Like
0Likes
Like

Posted 16 August 2012 - 08:06 AM

You can do that, but it raises some issues. Firstly, the levels are no longer dynamic. You can't edit them in a map editor, for instance...and that's one of the strengths of tile-based games. Also, you'd probably want to chunk the map, assuming it's the size of a level in a typical platformer, so that you could load and unload pieces of it at different times as the player progressed through the level.

Between Scylla and Charybdis: First Look <-- The game I'm working on

 

Object-Oriented Programming Sucks <-- The kind of thing I say


#3 TheVirtualDragon   Members   -  Reputation: 237

Like
0Likes
Like

Posted 16 August 2012 - 09:32 AM

Good point, but I presume this is how vectorial levels as explained in the last part of this post:

http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/

Are made then?
What's This?: basically, it's my blog. Click on it.

#4 nox_pp   Members   -  Reputation: 490

Like
0Likes
Like

Posted 16 August 2012 - 12:52 PM

Yes, in general, you would want to break the level art into pieces and load them on an as-needed basis. You may even need to break it up anyway if it's sufficiently complex and difficult for your image editing program to handle (We've had this problem.) For a small level though, you can probably get away with loading a single image.

Between Scylla and Charybdis: First Look <-- The game I'm working on

 

Object-Oriented Programming Sucks <-- The kind of thing I say


#5 TheVirtualDragon   Members   -  Reputation: 237

Like
0Likes
Like

Posted 20 August 2012 - 01:41 PM

Also, I had this other idea:

1. Use Gimp / Inkscape as a level editor and save the level as a png file
2. Use The Python Imaging Library to load the image and iterate through it
3. Compare each 50x50 portion of the file to the tiles in a tile set.
4. If a the images are the same (if the 50x50 area of the level is, for example, a grass tile) then write to a .json file (or something similar) which will be used to store data about the level.

This method isn't that useful for graphics, but if you are using something like Box2D, then you can easily save where the bodies are and where the collisions will happen, just by looking at a tile map.

So would this be a good way to do things?

Edited by TheVirtualDragon, 20 August 2012 - 01:43 PM.

What's This?: basically, it's my blog. Click on it.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS