|
Tortoiseius
|
 |
« on: July 13, 2012, 10:56:31 AM » |
|
Hello everyone. Well, i'm not a professional game developer, and excuse me if my question is stupid /:. What is the best way to make simple 2d maps?, i use python and pygame module to make my games and for level design i use lists (arrays) with X values and then with a iteration the program creates objects depending of that X value. A very simple example: (i made an array to make a simple map with walls and a door) xxxxxxx xD0000x Where is 'x' the program creates a wall object. x00000x Where is 'D' the program creates a door. x00000x Where is '0' the program do not create anything. xxxxxxx I know there are MAP editors , but... i don´t know how to use it |: and i don't know if some X map editors are what i'm looking. They exists map editors that´s works with arrays?. or ... , can you recommend me a map editor easy to use?. 
|
|
|
|
« Last Edit: July 13, 2012, 11:09:51 AM by Tortoiseius »
|
Logged
|
HABÍA UNA VEZ UN NIÑO QUE APRENDIÓ A PROGRAMAR, FELIZMENTE HIZO SU PRIMER PROGRAMA EL CUAL ACCIDENTALMENTE DIVIDIÓ ENTRE CEROS Y MURIÓ. FIN :3
|
|
|
|
CecilSunkure
|
 |
« Reply #1 on: July 13, 2012, 11:02:06 AM » |
|
Well I've used Python and Pygame before, and the best way I found to make simple 2D maps was to just do it by hand. I never really had a reason to use any map editor as it would have just complicated things unnecessarily.
So I'd open up my .txt file in notepad and just write out the level by hand. You can use your program you wrote in pygame to load the map and check out what it looks like after you place some stuff down.
|
|
|
|
|
Logged
|
|
|
|
|
Tortoiseius
|
 |
« Reply #2 on: July 13, 2012, 11:07:35 AM » |
|
Well I've used Python and Pygame before, and the best way I found to make simple 2D maps was to just do it by hand. I never really had a reason to use any map editor as it would have just complicated things unnecessarily.
So I'd open up my .txt file in notepad and just write out the level by hand. You can use your program you wrote in pygame to load the map and check out what it looks like after you place some stuff down.
Well, now i know i'm not the only one who makes maps on txt files  . i will try to make my own map editor on pygame.
|
|
|
|
|
Logged
|
HABÍA UNA VEZ UN NIÑO QUE APRENDIÓ A PROGRAMAR, FELIZMENTE HIZO SU PRIMER PROGRAMA EL CUAL ACCIDENTALMENTE DIVIDIÓ ENTRE CEROS Y MURIÓ. FIN :3
|
|
|
|
SuperDisk
|
 |
« Reply #3 on: July 13, 2012, 12:07:11 PM » |
|
I love pygame! Of course, you can make your own map editor to make text charbased maps, but another solution is to have an image based map, each pixel with rgb values corresponds to various tile types, and the alpha channel for some sort of 'special value'. Notch used that method for his LudumDare entry Prelude of the ChamberedTo read from that style map, you would read it in to a surface, then use surface.get_at(pos) to get the pixel's data. Then, you could just use your favorite image editor instead of making a map editor! 
|
|
|
|
|
Logged
|
|
|
|
|
Udderdude
|
 |
« Reply #4 on: July 13, 2012, 12:14:31 PM » |
|
I love pygame! Of course, you can make your own map editor to make text charbased maps, but another solution is to have an image based map, each pixel with rgb values corresponds to various tile types, and the alpha channel for some sort of 'special value'. Notch used that method for his LudumDare entry Prelude of the ChamberedTo read from that style map, you would read it in to a surface, then use surface.get_at(pos) to get the pixel's data. Then, you could just use your favorite image editor instead of making a map editor!  This works up to a point. The downside is that once you have a certian number of colors, it starts to get kind of a pain to tell them all apart. On top of this, if the RGB values are even off by a little bit, it won't recodnise it. Unless you add some extra code to adjust for some small color variation. Personally, I prefer to stick with text maps.
|
|
|
|
|
Logged
|
|
|
|
|
SuperDisk
|
 |
« Reply #5 on: July 13, 2012, 12:30:24 PM » |
|
Another option is instead of text based maps, you could actually create a map in your program of choice, then serialize it with Pickle of Marshal.
|
|
|
|
|
Logged
|
|
|
|
|
CecilSunkure
|
 |
« Reply #6 on: July 13, 2012, 12:45:26 PM » |
|
Well I've used Python and Pygame before, and the best way I found to make simple 2D maps was to just do it by hand. I never really had a reason to use any map editor as it would have just complicated things unnecessarily.
So I'd open up my .txt file in notepad and just write out the level by hand. You can use your program you wrote in pygame to load the map and check out what it looks like after you place some stuff down.
Well, now i know i'm not the only one who makes maps on txt files  . i will try to make my own map editor on pygame. Cool, if you want to make a map editor you can have each tile be represented by an integer. Your map editor can load up your map and read in each integer, and then draw different images for the different tiles depending on what integer was read. Example map file: Width: 5 Height: 5 23 12 5 0 0 10 10 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 0 67 Having a file format like this would allow for 99 different types of tiles. Then if you need more than 99 types you can change the format so there's another space between each number, for 999 different types. If your game already does this to load maps then you've written a lot of the code you need. For the editor part, just create something to where you click on tiles and change the value somehow of where you clicked, then redraw that tile as the new type of image. Edit: Then once you're done editing you also need code to save the file. This would be pretty easy: you just write to the file the width and height, then loop through the array and write down the values for each tile.
|
|
|
|
|
Logged
|
|
|
|
|
nikki
|
 |
« Reply #7 on: July 14, 2012, 03:38:11 AM » |
|
I remember this from a few years ago, you should be able to export csv (comma separated values) with it.
|
|
|
|
|
Logged
|
|
|
|
|
PompiPompi
|
 |
« Reply #8 on: July 14, 2012, 03:56:17 AM » |
|
Tiled is also good, you need to read xml, but I am sure almost anything have a way to read XML. http://www.mapeditor.org/
|
|
|
|
|
Logged
|
 Kickstarter? no no no... it's Kicksucker...
|
|
|
|
agersant
|
 |
« Reply #9 on: July 14, 2012, 03:56:44 AM » |
|
I use Tiled and I found it very easy to use. Their map format is simple enough and well documented.
|
|
|
|
|
Logged
|
|
|
|
|
Raptor85
|
 |
« Reply #10 on: July 15, 2012, 08:24:05 AM » |
|
I normally just use xml/base64 to store the maps in a easy to hand-edit format and, at least at first, hand edit maps. Later once the game is pretty much working i tend to go back and add functionality for ingame map editing, i find it just simplifies everything to be able to edit the maps live in game
|
|
|
|
|
Logged
|
|
|
|
emlow
Level 0
|
 |
« Reply #11 on: July 20, 2012, 08:11:09 AM » |
|
I also recommend the Tiled map editor. You can download PyTMX which is a Python library that will load a Tiled map in to PyGame for you, so you don't have to worry about reading the xml format yourself.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Charybdis
|
 |
« Reply #13 on: July 20, 2012, 06:39:22 PM » |
|
I also vote for Tiled. Currently my system reads the xml data from tiled but when I first started, I used a simple text file system like that shown above. However, even then I used Tiled for making maps. I simply opened the xml file in a text editor and copied the data by hand into a text file. It's not ideal, but it is an option. Of course, the problem is that the tile data starts from 1, with 0 being empty. But that is easy to handle in your loading function.
|
|
|
|
|
Logged
|
|
|
|
|
vinheim3
|
 |
« Reply #14 on: July 20, 2012, 08:18:56 PM » |
|
In case you don't use Tiled, making your own map editor would be the best choice over text files or paint. It's convenient especially when it comes to bigger maps and having more objects, as it is simpler to look at and keep track of, and in the event that certain similar objects need different parameters or you want to put in your own scripts for them, you could easily incorporate that as a function in a map editor.
|
|
|
|
|
Logged
|
|
|
|
|