Making An In Game Level Editor


For the past two weeks, we have been working almost entirely on our in-game level editor. Our game is comprised of obstacles with timed explosions that the player must weave their character through in order to avoid dying. One of the most important features in the game for us is the ability for players to create and upload their own maps to the steam workshop. Rat Race is based heavily around the Bounds type of map from StarCraft UMS game type. Within starcraft itself, it also came with the ability to create and share your own maps, likely keeping that community alive over the years with its many different map types. 

The goal for us is similar, not only provided an interesting set of included maps, but also the ability for players to give each other a level of replayability that an indie studio like us couldn't provide otherwise. So, here is how we have started to create our editor.

First, let's dive into what our level format is. If you look below you will see we have a list of tiles, their positions, and tags for the start/end of a level or ob as we call it. Then you'll see the actual fire sequence. This tells our code which tiles to fire at which interval, with time in milliseconds. Also at the top, there is some metadata that we use to keep track of things like who made the map, which version it is, etc. Also at the end starts the layout data for the walls which we cut off for brevities sake.



Now up until recently, we had a pseudo-level editor working. We essentially would place and organize the tiles on a grid in the game view in unity and save/load with hotkeys. To do the fire sequencing data we would switch back to a scene view and edit object data at runtime. This process could be very tedious, especially for more complicated levels. But, it worked really well for the final assembly of our Level Designers levels. The whole reason we needed this final assembly step is that we decided very early on that our Level Designer could initially make her levels in a program called Boundmaker that saved files in an XML format. This XML file was filled with a lot of stuff we simply did not need for our game at this point. Which is fair because it was designed to integrate with the StarCraft map editor, not our game.

To speed this level design process up we created the Ob Editor. A robust tool with much of the same functionality of Boundmaker that works inside Unity builds. Here is a screenshot of the Ob Editor with a level open. Keep in mind the UI art is basically nonexistent at this point.



 The buttons along the bottom of the screen are the buttons for placing various tiles, playing the level you just made, save/loading the ob, and some useful functions in level editing. The top right shows you some information about which tile you selected, and editing the start and end of the level. Now the real crazy stuff is on the left with editing the firing sequence in the level. Clicking the Ob Step button hides this panel.

The buttons along the top allow navigation through the fire sequence with the ability to add or remove a step. The test fire button lets you see the explosions taking place. Time ms is how long the sequence will wait before firing the tiles selected to explode. Tiles show you which ones are firing in that sequence. Finally, adding the selected tile, well adds whatever firing tile you selected to the current sequence. All in all the trickiest parts of all of this included creating text fields with delete buttons dynamically whenever a tile is added or upon switching a step in the sequence.

All in all, we feel like this will be a useful tool to not only our team but players in the future.

Files

Rat Race Demo v0.8.0 107 MB
Mar 13, 2021
Rat Race Demo Linux v8 115 MB
Mar 13, 2021

Get Rat Race

Leave a comment

Log in with itch.io to leave a comment.