3D level editors used to be better, or at least more fun.

2024-04-12

I recently started working on a level editor for my game engine, and I really like the workflow that the old mapping tools in the Quake scene provided.

Here's a quick video of my editor, taking some principles from these old editors.

You can see the CSG operations in action here, automatically merging two sectors.

I'm taking heavy inspiration from Quake, DOOM, and Unreal's editors here and I wanted to talk about why real quick.

What DOOM, Quake, and Unreal get right

So, why am I so inspired by these old tools? Yes, my nostalgic bias is chirping up, but these tools do a few things right.

1. Non-destructive workflows

Non-destructive workflows imply that you can move things around after the fact without having to clean up too much. This is great for competitive games, where you might want to move a window for playtesting, for example, without having to rebuild the wall around it.

DOOM is the outlier here-- with a very destructive workflow-- so let's start with DOOM's map editor as an example of destructive workflows. I'm using SLADE here, which is the best DOOM map editor I could find for MacOS.

I'll just make a room and add a crate to the corner.

DOOM represents all of its geometry using lines and sectors. Lines are lines, sectors are the enclosure defined by a set of connected lines.

By creating the sector and raising the height of the floor there, we can create a "crate" in the corner of the room.

slade crate in corner

Now, let's say we want to move the crate to the center of the room.

Well, the room is a triangle now 😔

In DOOM, when you merge geometry, the editor will truly merge the geometry together-- making it harder to move stuff around after the fact. This is the simplest example I can think of to represent this particular limitation of DOOM's editor.

Here's the same scenario in TrenchBroom-- a map editor for Quake.

That works out much better! This is a simple example of a non-destructive operation, and is one of the most powerful features of the Quake editing kit.

Other editors like RealtimeCSG take this a step further-- check out their video on some non-destructive operations possible with RealtimeCSG. This is the workflow I'm trying to get to with my engine.

2. CSG - Constructive solid geometry

You might look at the previous example and compare it to something like Blender. In Blender, that crate would be pretty easy to move around too.

But in this case, we're interested in what kind of geometry is generated when the crate isn't moved.

blender crate in corner, before building

Looks alright I guess, but let's look from another angle.

blender crate clipping through

The crate is poking out! Not a huge deal, but can get sloppy.

The extra faces poking out on the other side can be real problems for things like lightmap generation, where now we'll have to waste memory on these faces that aren't even visible to the player.

Let's fix this issue with constructive solid geometry.

By doing an intersection operation between the crate and the room, we can clip it against the edge of the room-- no matter how we choose to move it.

Not only does this remove the useless faces-- optimizing the lightmap and mesh used for gameplay-- but it also allows the compiler to trivially denote the "inside" and "outside" of a map.

If you've ever played a game like Quake 3-- a game where you can move incredibly fast with tech like rocket jumping and bunny hopping-- you will never fall through the map. The extra metadata defining the inside/outside of the map makes it near impossible to fall out of the map.

This property is pretty hard to get if your mapping primitives don't have some form of CSG applied. In Unity, for example, the computer will see your map as just a bunch of entities floating around with no sense about what is "inside" or "outside" of the world.

3. Convex world primitives by default

In a Quake-derived game engine, the default world primitive is the brush. A brush is a convex polyhedron-- so it's perfect for collision detection.

aim_ag_texture2

This means that the visual world geometry typically matches up 1:1 with the collision mesh, making maps that feel solid.

Games like Skyrim will probably be using auto-generated convex collision proxies for most game world objects. These are close, but not quite-- and you can feel it when you move around.

Future of my engine's editor

There's a few other things that I think these oldschool editors get right-- like automatic world space UV mapping for world face textures-- that I'm also adopting into my own stuff.

But this was just a quick writeup to share some thoughts on why I think these older editors are super fun to use, and you can find evidence of it all over the internet-- people who started with these tools, and enjoy them.

Here's one of my favorite random YouTube videos-- a pro level designer talking about the Blender addon he made to revive this workflow in Blender.

It's pretty cool to hear an expert in such a niche career path talk about his beliefs. Check it out if you're interested in this kind of stuff.