In this section we’ll build our first level using Unreal’s in-editor modeling system, CSG (short for Constructive Solid Geometry. Also referred to as BSP geo.)
Go to File->New. A window will pop up asking what geometry style you want – select Additive. (Not only is it more appropriate for most level designs, I’ve also seen some weird bugs with Subtractive mode in UE3)
Before we begin working, let’s pick a name and save our file. For purposes of this test, we’ll use “DM-CSGTest01”. Unreal figures out what game type you’re making based on the map name, so by choosing “DM-“, we’ll get a Deathmatch map, and all of the associated gameplay that comes with it (like default loadout.) Go to File->Save. Unreal works best if you put your map in a specific folder (which you may have to create) – My Documents\My Games\Unreal Tournament 3\UTGame\Unpublished\CookedPC\CustomMaps. (And name it DM-CSGTest01.ut3)
Let’s also do some viewport
configuration to make editing easier. Click on View->Viewport
Click on “Unlit” mode in your perspective view. Since we’re building a level from scratch, there won’t be any lights yet, so we need to be in unlit mode to see what we’re doing.
We’re going to use CSG geometry to rough out our level. It’s the in-editor 3D modeling tool. While you could rough out the level in a 3D application like Maya, Max, or even AutoCad, CSG gives you an incredibly fast turnaround when you begin working out the gameplay of your level. Corridor too long? Just grab the adjacent rooms and move them closer. It’s much easier than going back and forth between different software packages.
That said, CSG isn’t good for anything very detailed. It’s expensive, it’s hard to work with, and it’s prone to errors if the geometry gets too complicated. For that reason, it’s great for prototyping since you don’t WANT to add much detail in the early stages. It’s also suitable for some simple geometry in the final level, as you can see in some of Epic’s maps.
At the center of your empty level is a red wireframe cube. This is the Builder Brush. Think of it as a rubber stamp. Whatever shape and size it is, that’s the shape and size of the geometry that you’re going to stamp down.
Select the builder brush, then click on the CSG: Add button.
This stamps a cube down into the world.
If you move the builder brush out of the way, you see that the cube stays – in the 2D views, it appears as a blue wireframe box.
Now select the blue additive brush (in one of the 2D views) and move it to the side.
What gives?! The checkerboard cube didn’t move with it! When you modify existing CSG geo, Unreal requires you to “Rebuild Geo” – for a simple cube move this is plenty fast, but when you’ve got a whole level roughed out in CSG, you wouldn’t want Unreal to pause and recalculate all the time.
Click on “Build Geometry for Current Level”, toward the top-right of the screen. You’ll get some warnings (which are no big deal, and we’ll discuss later) but the cube appears where it should. Yay!
So say you wanted to create a room. You could place six additive cubes making up the walls, floor, and ceiling, but there’s a better way to do it. In addition to Additive geo, Unreal has Subtractive geo, and it does just what you’d think – it carves a hole in additive geo.
Select the builder brush, move it so that it’s partially intersecting with your additive brush, and click “CSG: Subtract”.
If you move the builder brush out of the way, you’ll see that there’s now a chunk taken out of your cube, and there’s a yellow subtractive cube in the 2D views.
Try moving the subtractive brush around. Again, you need to Rebuild Geometry in order for the changes to update in the 3D view.
Also, you can clone your additive or subtractive brushes by copying and pasting them (ctrl-c ctrl-v), or by alt-dragging one of the movement handles. Play around a little more, intersect some more shapes, and rebuild. Get a feeling for the tools.
You may notice that sometimes a subtractive brush cuts into one additive brush but not another.
This is because brushes are order dependent – they’re like a set of commands. “Build this!” “Now cut into it!” “Now build on top of that!” Kind of like in the diagram below.
If we want the subtractive brush to cut into both additive brushes, we can make it the last command in the list. Select the subtractive brush, right-click on it, and select Order->To Last.
Now the brushes are in the order we want…
And if we rebuild geometry, we get the results we want.
And yes, you could have also selected the #3 additive brush and clicked on Order->To First to get the same result.
Let’s face it, it would be tough to build a level solely out of cubes. Let’s look at some more advanced geometry editing. But first, save your work, create a new file, and save it as DM-CSGTest02.upk.
Create a new additive brush then click on the “Geometry Mode” button at the top-left corner of the window. This opens up the “Geometry Tools” dialog box. (You can close it again by clicking on the button to the left, “Camera Mode”.)
Working with edges is the easiest way to get started, so click on the “Edge” button, and select your additive cube.
Make sure you’re in “World” mode (not Local)…
Then select and edge and try moving it around.
Now our cube is an elongated rectangular box. (Don’t forget to rebuild geometry.)
You’ll notice that when you selected the edge in the 2D view, it actually selected two edges in the 3D view (in my case, the top and bottom.) This is really handy, and what you want most of the time. But you can also make a ramp shape by selecting only one of the edges in the 3D view and then moving it.
Editing vertices is also pretty powerful. Switch back to Vertex mode…
And you can select any vertex and move it around. You can also ctrl-click to select multiple vertices, or ctrl-alt click and drag to make a selection box.
Note that ctrl-alt-dragging works for anything in Unreal, not just geometry editing. (And you can ctrl-alt-rightclick-drag to deselect.)
Play with your shape some more, and get a sense for how to do some serious geometry editing!
Time to create our first room – something we can actually run around in! Save your work, create a new file, and save it as DM-CSGTest03.upk.
We want our room to be big enough for the player to run around in. The builder brush is 256x256x256 by default, and the player is 88 units tall. That’s going to feel a little cramped, so let’s make our cube more like 1024x1024 and 512 units tall. What we’re going to do is create an additive cube that’s the size we want, then hollow it out by using a slightly smaller subtractive cube.
Select the builder brush and make sure you’re in geometry mode. (Yes, the geometry editing tools work on the builder brush too.) Also, resize your grid to 32 units (either by using the controls in the bottom-right corner of the screen, or the bracket [ ] keys.) It’s important to build on the grid so that we have an easier time judging size, and so that when we expand our level later everything lines up nicely. (This is also why we’re using the geometry tools to resize the brush instead of non-uniform scaling it.)
Your setup should look something like this.
So we’re going to grab the builder brush’s edges and move them around until the brush is big enough – but how do we tell how big it is? There’s nothing that tells us the cube’s size directly. We can use the measure tool to drag in a 2D view and measure distances. Just click and drag with the middle mouse button.
Drag the builder brush’s edges until it’s the right size. Make sure you also check the side view, and make the brush 512 units tall.
Click CSG:Add, and your box will appear in the 3D view. Note that the checkerboard on the surface tiles a lot more on a bigger cube.
Now resize your builder brush (in both the top and side views) to fit just inside of the additive brush, and hit CSG:Subtract. If you fly the camera inside the cube you can see that it’s hollow!
We’re almost ready to play, but we need some default lighting, and we need to tell Unreal where the player is going to spawn.