Sign in to follow this  

Creating a Map Editor Tutorial?

This topic is 2842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Are there any articles or tutorials out there that teach me how to create a Map Editor? (I googled it, no luck) From my understanding, a 2d/3d map editor is simply a program where you can drag a tile/model and place it somewhere, when your done save your map as a picture (for 2d, for 3d i don't know save it as what) and then load it in your game. Am i right or wrong? Also, what's the difference between a map editor and a level editor?

Share this post


Link to post
Share on other sites
Quote:
Original post by Waaayoff
Are there any articles or tutorials out there that teach me how to create a Map Editor? (I googled it, no luck)

Not that I'm aware of, no. What sort of editor do you want to build, what did you try, and where did you get stuck?

Quote:
From my understanding, a 2d/3d map editor is simply a program where you can drag a tile/model and place it somewhere, when your done save your map as a picture (for 2d, for 3d i don't know save it as what) and then load it in your game. Am i right or wrong?

Depends on what kind of editor you want, really. However, saving as a 2D level as a single image is not a smart idea - how will you modify it later on? Instead, store the position of those tiles and their filenames in your level file.

Quote:
Also, what's the difference between a map editor and a level editor?

Different name, same thing.

Share this post


Link to post
Share on other sites
I haven't started yet. Mainly because i didn't want to find out half way that what i'm doing isn't the best idea. Like saving it as an image for example ;)

Is the map editor only used for Obstacles or is it a good idea to place stuff like monsters etc..?

You didn't talk about 3d editors? same thing? just store position and filename?

And lastly, store as in a text file?

Thanks :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Waaayoff
I haven't started yet. Mainly because i didn't want to find out half way that what i'm doing isn't the best idea. Like saving it as an image for example ;)

Is the map editor only used for Obstacles or is it a good idea to place stuff like monsters etc..?

You didn't talk about 3d editors? same thing? just store position and filename?

And lastly, store as in a text file?

Thanks :)

It depends actually, if you're doing a tile based game, you'd probably want to have some kind of map editor that lets you visually put any tile on any coordinates on your map, like grass tile in <1, 2> and wall tile in <2, 2> (like choosing a tile you want to place and put it on the map) so you can design your level visually. Even if you're not doing tile-based game, you can always use it to create "collision map" for you map (probably tile-based), to mark monster location, mark player's starting position, etc. So yeah, it's a good idea to place any stuff.

It really depends on what you want to have on your "map file", how would you output it, and how you're gonna read it in the game. You can easily just produce a space-separated tile number in a .txt file for your map, and may be some more information regarding map size or image name. Or you could do it a lot more advanced by outputting a binary file, even a compressed file.

And for 3D editor, well, it depends on how you're making your scene/level. My 3D editor simply save the name of the model, location and rotation, the bounding box for the collision, sorting all the objects. etc, basically, everything that shouldn't be computed in-game to reduce loading times. Another editor just simply allow to produce wall and floor with a certain texture.

EDIT: Try RPGMaker map editor, you should get a good idea about how a level editor should be

Share this post


Link to post
Share on other sites
If you want to start off simple you could use a spreadsheet to design your map. When I first started to program I assigned numbers to the cells where I wanted to display a texture e.g. wall was 1, grass was 2 and water 3 and put the relevant number into each cell always enuring the map was square. After I created my map I saved it as a comma seperated variable (.csv).

Now you have to load the file from within your game code. .csv is easy to read and all you have to do is store it into a 2d array as you read it. Now when you texture your grid you look in your array and see what number is there and place the texture you need in the grid. Easy!

Hope that helped or at least give you an idea.

Share this post


Link to post
Share on other sites
Have a scan through the following for Tilemap editors...
Old Blitzbasic tutorials
If you're after basic 2d stuff then don't get put off by the age or the fact it is Blitzbasic.
Apologies if you're beyond that stage though.
There are a few Tilemap engines with source code as well. Mappy might be a good start.

Share this post


Link to post
Share on other sites
I created one in C# using XNA last year for a game I was working on. The concept was fairly simple. I started out by defining a list of TileTypes, which in my system was actually just a unique integer and a list of flags (collidable, image ref and so on). On top of this, the map was simply a list of layers, and a layer was an array of fixed-size tiles which referenced the typeid.

The first thing I did after figuring out the internal structures was to hard code a few test maps into the program and figure out how I'd handle things like drawing, scrolling and point testing. This was easily the most important as you need it for collision within your game and for the editor itself in which you'd need to figure out which tile the mouse pointer (or other pointing device) was on.

I was using XNA, so I set the XBox controller up to allow scrolling through tiles which showed up as a "brush" in the position that they'd be placed.

After all that was figured out and working, I worked out a decent file format and wrote the load/save/reset routines. The file format I used was based on XML and was something like:


<map>
<tileTypes>
<tileType id="0" img="" collidable="False" />
<tileType id="1" img="gfx/tile1.png" collidable="True" />
</tileTypes>
<layers>
<layer id="1">
<tiles>
<row><tile id="1" /><tile id="1" /><tile id="1" /><tile id="1" /></row>
<row><tile id="1" /><tile id="0" /><tile id="0" /><tile id="1" /></row>
<row><tile id="1" /><tile id="0" /><tile id="0" /><tile id="1" /></row>
<row><tile id="1" /><tile id="1" /><tile id="1" /><tile id="1" /></row>
</tiles>
</layer>
</layers>
</map>


I didn't have much of a GUI as it was simple and actually designed to run within the game (so I could pause and edit the map).

Share this post


Link to post
Share on other sites

This topic is 2842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this