Sign in to follow this  
Oni Sephiroth

Coding a Map Editor

Recommended Posts

I've been searching around on google and I can't seem to find any articles or anything on creating a map editor (preferably with C++). Does anyone have anything that could point me in the proper direction? EDIT: I should mention this is for a 2D project.

Share this post


Link to post
Share on other sites
Well, the first step is going to be to figure out exactly what kind of features you need. What sort of map is it? Tile based? Isometric? Platformer? What objects do you need to place? Traps? Bonuses? Powerups? Candy/generic points objects? Enemies? Teleporters? Nuclear warheads? Flying pigs?

Once you've gathered as much information as you can about what the editor needs to do, we can move on to how to implement the various elements.

Share this post


Link to post
Share on other sites
Well for the most part I know how the map will be structured. A layer based map with tiles and entities placed throughout each layer (I.E. The player, the npcs, hitboxes, a ladder..kind of like how the Source Engine handles entities). I have somewhat of an idea of what the form should look like, I'm just not sure where to start as far as coding goes.

Share this post


Link to post
Share on other sites
So basically what you're saying is have a space on the form to render the map, and as I'm working on controls and such, add the capabilities to actually render the map in that space?

Share this post


Link to post
Share on other sites
Quite the opposite actually, at least in my opinion.

Optimally, you want to be able to use the same map rendering code from your game as you use in the editor, to make sure that everything appears identically...and to ease the writing of the editor.

First, get the code to handle rendering of the maps. Then get that working inside of the form and build the controls around it.

Share this post


Link to post
Share on other sites
What leads to the question: What was first? The Editor or The Game?

Share this post


Link to post
Share on other sites
A portion of the game. Finishing the game before creating the tools is bad practice (designers can't work until your game is complete.) I'd say a good time to introduce tools would be when the code that relates to them has a fairly stable interface. Ie. When your base renderer is done, create a map editor.

Share this post


Link to post
Share on other sites
I agree with TriggerB, get the game somewhat functional (maps rendering, player walking around, maybe some enemies), then make the map editor, and then finish the game code while you make levels. That's what I'm doing anyway. Currently near the end of the "make map editor" phase (using C++, with FLTK as my GUI library).

Map editors are pretty straightforward if you understand event-based programming. I started by defining the basic structures. A project has a list of maps, maps have some tilesets and a list of layers, layers have an array of tiles. Then make a window with scrollbars that displays the map. When you get a click event in that window, translate the mouse position to a tile coordinate in the map and plot the currently selected tile there. Make a window that displays the tileset, have click events in there set the currently selected tile, and voila, basic map editor.

There is a pretty big amount of work to be done, but none of it is particularly difficult. Probably the hardest part for me was setting up the GUI library :p
Post here if you get stuck on anything specific.

Share this post


Link to post
Share on other sites

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