I was told that I should create a map editor, instead of hard coding out all the grids of my map. It sounds like a fun project and would make things easier in the long run, but I wouldn't even know where to start with it. It would be pretty simple, 3 cube types, a 1000x1000 grid, and the ability to stack cubes on top of each other. Exporting the map into something I can use in my game would be an issue though. Also creating the UI for the editor would be something completely new to me. Are there any links out there that can help with this?

  • \$\begingroup\$ Are you talking about 2D or 3D maps? You talk about cubes, but the grid you mention is a 2D grid. Also, exporting the map to something your game engine can use shouldn't be a problem: you just have to agree on a format. Perhaps the simplest example would be a plain text file containing the 1000x1000 grid, with each cell represented with a letter, denoting a different kind of "cube". \$\endgroup\$
    – vijoc
    Jul 5, 2013 at 6:16
  • \$\begingroup\$ 3D. I also draw the cubes in chunks so theyd have to be seperated by the chunks \$\endgroup\$ Jul 5, 2013 at 6:47
  • \$\begingroup\$ Take a look at this Q+As: stackoverflow.com/questions/1509566/… \$\endgroup\$
    – ott--
    Jul 5, 2013 at 8:48

1 Answer 1


This is a pretty broad question, but I'll try to give you a few pointers. See if they're of any help to you.

Exporting/importing map data

In order to be able to use the maps created with your map editor, you will need to define a data format for the map data. The exact format is irrelevant, but it can be as simple as a plain text file or a xml file. You should create a MapSerializer class, which should have the functions serialize and deserialize.

The serialize function should take the map structure as a parameter. If you've already hard coded some maps to your game, then you already have this representation defined. The output of the function should be the serialized, e.g. string formatted, representation of your data.

deserialize method should then do the exact opposite: take the serialized map data, e.g. a string, and produce the representation you use in your game internally.

Actual editor

The interface should likely use your rendering engine to represent the current state of the map, with controls to move around the map freely. You can use ray tracing to find the spot in the 3D world where the user clicks.

Separating the cubes to chunks is not necessary in the map editing phase, you can do that when loading/drawing the map.

  • \$\begingroup\$ Awesome!! This helps a lot \$\endgroup\$ Jul 5, 2013 at 8:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .