Sign in to follow this  
Roots

An improved 2D map editor for RPGs [Hero of Allacrost]

Recommended Posts

Roots    1625

I just wanted to show off what I have been working on for the last couple of months. My project has had a map editor for several years, but it was very tedious to use and made map design a real headache. I finally got fed up with it and decided to invest my time to improve it as much as I could. This is the result.

 

https://www.youtube.com/watch?v=2Su31AWg3t4

 

I more or less rebuilt this application from the ground up, as the software architecture was really poor and the code was a mess. This was done in C++ and QT4.8. The code is open source (GPL) so if you want to take a peak at it, you can find it here: https://sourceforge.net/p/allacrost/code/HEAD/tree/trunk/game/src/editor/

 

 

 

The most interesting feature of this editor IMO are map contexts, which allow for several maps to exist within the same map. The primary motivation for this feature was so that when you walk in a building, for instance, you don't have to load an entirely new map just to show the interior of the building. The transition is seamless and instant as you walk in and out of the door of a building. It works really nice in the game. But it's also quite a challenge to support this feature in both the editor and the game.

 

 

 

Here's a video showing a much older version of our editor. You can see just how much this tool has evolved, and how time-consuming it used to be for us to create maps.

 

http://vimeo.com/1887665

 

Share this post


Link to post
Share on other sites
Roots    1625

Spent this weekend using my new editor to make a new map for our next release and in the process hunt down and kill some bugs. Here's some screenshots of the map in progress using the editor. It's working great and the map is looking pretty nice so far.

 

 

http://imgur.com/a/ttfGE

Share this post


Link to post
Share on other sites

The idea of contexts seem intuitive and interesting. Thanks for sharing! I get a similar result in my WIP editor, by making each layer have the option to be hidden or visible according to in-game flags, but the interface for my way is much messier. 

 

My use-case is not interior vs exterior, but have an area change over-time based on in-game events. i.e. player visits a town, player returns later when its being burned town (ashes, fire, smoke, debris layers made visible), player returns still later (no smoke, no fire, but still ashes, and debris layers turned on), and so on.

 

So I'd (in theory) have "ash", "smoke", "fire" layers that get toggled on and off. While logically this make sense, editor-wise it'll be more confusing. Your idea of contexts is alot simpler, so I'll still use individual layer toggling, but steal your idea of 'contexts' and "bundle together" flags into contexts for easier editing. (i.e. bundle {ash, smoke, fire, debris} into "VillageBurning" context for easier editing and scripting). Or just add layers to more than one context.

Edited by Servant of the Lord

Share this post


Link to post
Share on other sites
Roots    1625

Thanks for the feedback. I'm glad you like the contexts feature. It's one of the very first I conceptualized when this game was little more than a bag of ideas and a short story. My thought was that the only reason why other RPGs had separate maps for the interior of buildings was due to the size/memory constraints on old hardware. This feature definitely is not simple to implement though, especially in the map editor.

 

 

We can do the same thing that you do in your use case (add multiple layers to a map that are enabled conditionally). And I'm sure we will just use that technique in our maps in addition to contexts when appropriate. The problem with using "special" layers for us is that we store our collision data separately from the tile layers, although the collision grid is computed by the editor based on which tiles are placed where, and that data is then loaded into the map. We could always change the collision grid dynamically through scripting, but that's kind of a messy hack and also dangerous, because if the map tiles change you'll have to remember to change the script for the map as well (the map files our editor creates are separate from the map scripts that add sprites, events, etc. to the map).

 

 

Glad you find the feature useful and yes by all means, do implement it in your own game. Our code is open source so if you want to figure out how it's done (in either the game or the editor), you just have to do some hunting and reading. One final note: the reason we limit our number of contexts to 32 maximum for any given map is because in our collision grid, we store 32-bit integers and use bit-wise arithmetic to determine if a sprite collides on the context it's in. This means we only have a single 2D array of integers to maintain for the entire collision data of the whole map instead of one for every context. It's not a big deal to have one collision grid separate for each context, but it just seemed more elegant to do it that way than to have a lot of 2D boolean arrays for a map.

Share this post


Link to post
Share on other sites
Sign in to follow this