A Simpler 3D Level Editor
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.
Trudy's Mechanicals is our upcoming 3D tactics game set in a giant, Steampunk dirigible. The challenge of making maps for Trudy was rather specialized, so we decided to develop a custom level editor to help with the task.
Our game's maps are largely 3D grids for the purposes of gameplay, so our goal was to create a tool that allowed us to quickly prototype and iterate on levels. We didn't need the malleability and granularity of typical AAA titles, so instead we took inspiration from Valve's awesome Puzzle Creator embedded into Portal 2.
While the Puzzle Creator is not a standalone tool -- it's heavily coupled with the game and run from within it -- its interface is much more streamlined and intuitive than most 3D editors. Extruding/recessing surfaces is a very quick way of mapping out geometric 3D spaces, and it's much less finicky than dragging-and-dropping 3D objects and transforming them to make a whole, or carving out spaces from a 3D block.
Our first iteration of the editor used SWT for the GUI and OpenGL for the 3D canvas. Eventually we switched over to Swing, but Java's UI libraries have proven somewhat problematic to work with. We've had to do a fair amount of tinkering and optimizing to get our editor functioning just the way we want it, but we're sticking to this approach for the time being.
Each cell in the editor is treated as a voxel with six possible faces, although it's not a perfect cube as a cell's height is visually half of its width/length. The reason for this is our need for more vertical granularity in the levels, but this is an arbitrary aesthetic distinction (the height represented by each voxel could just as easily have been twice as large).
The initial goal of the editor was to quickly greybox levels for play testing and eventually leave a full 3D model for artists to texture and append with various props and decorations. Here are the features we currently have online:
- Ambient occlusion used to give the terrain depth -- this helps a lot with visually parsing the topography.
- Voxel faces are tinted with slight variations of grey to help differentiate between them.
- Camera controls allow for zooming in and out and rotation along all axes (either by snapping to 45 degrees increments or free-roam controls).
- Any surface can be selected from any angle, and multiple surfaces can be selected at the same time.
- Surfaces can be extruded/recessed with proper merging (extruding two different surfaces into the same coordinate).
Camera rotation and surface manipulation.
- Clicking and dragging selects an arbitrary area of a single plane.
- Double clicking selects the whole uninterrupted surface area whether on the floor, wall, or ceiling.
- Holding Ctrl allows for appending to any selection using the existing methods.
- Missing floor tiles represent bottomless pits, but maps can be infinitely extended up and sideways in any direction.
Selecting multiple surfaces and slopes.
- Any floor-cell can be turned into a 22.5 degree or 45 degree slope. Finer slopes and edges will be modeled individually as needed since those two are the only ones that affect gameplay.
- Slopes can face any of the four cardinal directions, and can be rotated independently.
Painting using different colours.
- Any single surface can be painted with a colour to indicate its collision type or simply give aesthetic cues.
While the level editor is fairly powerful, we decided to leave some functionality out of it to keep it simple and potentially useful for future prototypes. Placing interactive props and scripting can be done via our other tool, the scene editor, but so far this has proven too time consuming.
While we were quite pleased with the final iteration of the Forge level, it took a very long time to edit to add cracks and recesses to its geometry (in order to prevent it from looking so cubic), lay out its UVs, place all of the props, and paint all of the textures. We are currently exploring ways of how to enhance the level editor itself to do some of this work, so let us know what you thinkand if you have any suggestions for us going forward!