|
Title: This is the best way to make simple maps? Post by: 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) Quote 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?. :beer: Title: Re: This is the best way to make simple maps? Post by: RandyGaul 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. Title: Re: This is the best way to make simple maps? Post by: Tortoiseius 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. Title: Re: This is the best way to make simple maps? Post by: SuperDisk 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 Chambered To 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! :coffee: Title: Re: This is the best way to make simple maps? Post by: Udderdude 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 Chambered To 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! :coffee: 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. Title: Re: This is the best way to make simple maps? Post by: SuperDisk 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.
Title: Re: This is the best way to make simple maps? Post by: RandyGaul 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: Code: 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. Title: Re: This is the best way to make simple maps? Post by: nikki on July 14, 2012, 03:38:11 AM I remember this (http://tilemap.co.uk/mappy.php) from a few years ago, you should be able to export csv (comma separated values) with it.
Title: Re: This is the best way to make simple maps? Post by: PompiPompi 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/ (http://www.mapeditor.org/) Title: Re: This is the best way to make simple maps? Post by: agersant on July 14, 2012, 03:56:44 AM I use Tiled (http://www.mapeditor.org/) and I found it very easy to use. Their map format is simple enough and well documented.
Title: Re: This is the best way to make simple maps? Post by: Raptor85 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
Title: Re: This is the best way to make simple maps? Post by: emlow on July 20, 2012, 08:11:09 AM I also recommend the Tiled (http://www.mapeditor.org/) map editor. You can download PyTMX (https://github.com/bitcraft/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.
Title: Re: This is the best way to make simple maps? Post by: Sean Hogan (seagaia) on July 20, 2012, 10:14:46 AM Learn a tile editor, manual map editing does not scale well (when you want to do many levels that get larger, or have many tile types, you will be in for a world of hurt). It also helps to be able to visualize the level as you are designing it. The .txt method may work fine for some percentage of games, it really depends. But it's good to know how to use a tile editor anyways.
And learn to read XML if that's what you are exporting some things as - it's not too tough, and it will be useful in the future when you really need it or other types of markup languages. Title: Re: This is the best way to make simple maps? Post by: Charybdis 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.
Title: Re: This is the best way to make simple maps? Post by: vinheim3 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.
Title: Re: This is the best way to make simple maps? Post by: rivon on July 21, 2012, 01:28:53 AM Anyone of the Tiled users here, do you have your game in C++? And if yes, do you use the base64+zlib compression? And if yes, could you post your loading code please? I'm currently writing a loader for a game I'm working on and it always reads some rubbish data, even though it should work just ok. I use the uncompress function from zlib and some base64 decoding code I found on the net but which should work pretty much ok.
|