Yuan Works Development Blog - Video game development, tutorials, design, and news

Time to build the Map Editor!

Hi again!

If you remember last time, we were in the process of  defining what was important for Little Ninja’s new Map Editor. If you haven’t read the last article, it’s a good idea to take a look at it since I’ll be taking off right where I left it :)

Map Terrain Design (Part 2)

Last time we were overviewing the different terrain angles. After taking a look at my favorite platform-adventure games, I decided to keep three types of angles, remember?

Angles for map editor terrain

One may think that most platform games have a wider array of possible angles. However, in fact, I came to realize that a great number of games only use the 45° and ~26° inclination — Cave Story or Metroid, for example.

Now that I have chosen the three types of angles, it’s time to choose the different terrain directions. Fortunately, this is a very easy choice as tiles can only be transformed (rotated or flipped) into four different configurations, creating the following set of tiles:

Map Editor tile transformation

Now that we have terrain type, angle, direction, we’re all set to start making our Map Editor™ ! Before starting, let’s do a test-run on our current terrain:

Mockup tile map

As you can see, the combination of tiles allows a quite versatile design, while keeping it “simple”. While our Ninja trap does not look too smooth, remember that this is our mask! Further addition of foreground tiles will do the trick, believe me (I can’t wait for Yuan to give me some tiles). Actually, Yuan has already started drawing the prototype sprite art for Little Ninja.

Map Terrain Structure Overview

So, let’s review what we have until now: each tile contains information about direction, angle, and type of terrain. From a technical side, I decided to use:

2 bits for direction (2 ^ 2 = 4 combinations)
5 bits for angle (2 ^ 5 = 32)
5 bits for terrain type (2 ^ 5 = 32)

That gives us a total of 12 bits. In order to fill 2 bytes (that is, 16 bits), we have 4 bits left: we’ll use them for special cases. So, what’s a special case? I don’t know, and that’s exactly why I’m saving those 4bits.

For now, the only important types of terrains are empty and solid tiles (character collides against them), with all the variation of angles and directions. This is my tile palette for now:

Map editor tile palette

Our transparent color is always magenta (aka: ugly pink), but from now on I’m probably not gonna use it because, as the name implies, it IS ugly. Anyway, our Map Editor’s interface is quite simple: a simple editor where you choose the width and height of the map, select a tile from our tile palette, and draw tiles on the actual map! :)

Anyway, the editor is finished (for now) and here’s a video:

This movie requires Flash Player 9

Oh, I also added a grid as well as a foreground grid. Nothing complex but certainly useful. The Save and Open functions are crucial since we need to load the map on the actual game code. It’s just a simple file with information about each tile, as well as the width and height of the map. I’ll be using my test.map for the next part.

Little Ninja Test Map

Anyway, that’s it for today. Next time I’ll be loading the actual map on the game, and start adding the most basic player controls (walk and run). The current map editor clearly needs a lot more work, but that will come later :)

What do you think about it? Please let me know if the post was too long or simple, etc., or if I should describe the programing-related issues more clearly. Thanks!

7 Responses to “Time to build the Map Editor!”

  1. Vinícius Says:

    Nice! What programming language do you use to code the game and tools?

  2. Yuan-Hao Says:

    The game is programmed in C and C++, while the tools are programmed in C#, since it’s overall faster to program using a high level language. Before Wind and Water, I used Visual Basic (since Visual Studio.net had not been invented yet) for the same reasons :)

  3. Abe Haskins Says:

    I have been really enjoying your these articles, I think perhaps a secondary blog so you can have one for posts like this, fairly simple, and another for the coding aspect, in turn the second blog would be much more complex, for experienced coders who are interested in what your doing. I think this articles length is just about right, and the time between posts seems to be pretty good too.

    Abe

  4. Yuan-Hao Says:

    Yes, in fact some articles could get a little too technical for the average visitor, so I’ll try to categorize and customize the blog for a more easier navigation between Yuan’s posts, my usual design posts, and more technical ones.

    Thanks for the suggestions :)

  5. Vinícius Says:

    I’m interested in game programming and I think that would be great more technical posts. As a beginner I’m always looking for some techniques and code to learn.

  6. Into the Platform Game Engine :: Yuan Works Development Blog Says:

    [...] how to design the most basic parts of a platform game engine. On our last post, I finished a simple Map Editor, now it’s time to put Ninja Stick Figure into [...]

  7. cmb Says:

    what program do use?

Leave a Reply