When designing Trudy's main terrain editor, 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 typical 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 main goal of the editor is 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 will be done via our other tool: the scene editor.