If you haven’t already, please follow through Your First Level - Part 1
For this section we’ll be placing actors, so we’ll be mostly working in the 3D view. Close the geometry tools window (click on the Camera Mode button) and save your work.
First we’ll place a light. It’s easy – right-click on the ground, then click on Add Actor->Add Light (Point).
The light should appear where you clicked. Go into “Lit” mode, and you’ll see your room appear with lighting now (though it looks a little strange since the light is right on the floor.)
Move the light up from the floor so it’s in the middle of the room. You can also make the light’s radius bigger and smaller using the Scale tool. Give it a try.
The last thing we need to do before we run is to “Bake” lighting. Right now the light is calculated dynamically, which is expensive and unnecessary. If we bake it, it calculates texture maps for any light and shadows in the scene, which is much cheaper. Click on the “Build Lighting” tool – it’s right next to Build Geometry. The default settings in the Options window are fine, so hit OK.
Baking should go pretty fast since this is a really simple scene, but for a finished level, it can take up to an hour. (Depending on your machine, the size of the level, and the complexity of the lighting of course.)
One last thing before we can play – create a “Player Start”. Same as adding a light, right-click on the floor, then click Add Actor->Add PlayerStart. The player start should appear at the proper height off the ground.
Save your work. To run the level, click on the “Play in Editor” button in the top-right corner of the window. (It looks like a little joystick.)
At this point you should be able to create a second room and a hallway without any more guidance, but I’ll take this opportunity to show a few more tricks. Save your work, and then save it as a new file, DM-CSGTest04.upk.
We’ll create the second room first, and then the hallway.
Instead of building the second room from scratch, let’s select the first room and everything in it, then clone it over. In one of the 2D views, ctrl-alt-drag a selection box around the entire room. We want the player start and light too, they’ll be useful later.
Then alt-drag on the move tool to copy the room over to the right side.
Press the “Rebuild Geometry” button and go to unlit mode, and you should see both rooms in your 3D view. (Remember, there are no lights outside, so the outer surfaces will show up black!)
Time to create the hallway. We could clone a room again and shrink it down using the Geometry Editor tools. But let’s build it from scratch.
Clicking on the “Cube” button on the left will reset the builder brush to the default 256x256x256 cube.
… but if you right-click on it, you get a dialog box where you can type in how big you want it. Measure how far apart your rooms are, and fill that into the properties. (Mine were 512 units apart in the Y dimension.) 256 is fine for the corridor’s width and height (X and Z.)
Click on Build, place the builder brush between your rooms, and click on CSG:Add.
Now like with the rooms, use the Geometry Tools resize the builder brush to be just slightly smaller than the additive brush, and most importantly, make sure it’s long enough to connect the interiors of the rooms. Click on CSG:Subtract.
Go back inside of the rooms in the 3D view and turn on Lit mode. You should see a corridor connecting your rooms.
Add some extra lights to the hallway. Instead of going through all that right-click nonsense, you can hold the “l” key (“l” for “light”) and click on the floor. Rebuild lighting, save your work, and test your level!
It’s time to get rid of that gray checkerboard pattern covering the walls and floor.
You can apply either a Material or a Material Instance to a surface. (We’ll discuss the differences later.) Both types of materials show up in the generic browser with a green border.
Let’s find a material that we can apply to our CSG surfaces. Open the generic browser, and in the filter list, check “Material” and “Material Instance Constant”. (If you have anything else checked, like “Static Mesh”, uncheck it.)
Click on some packages. (Any of the ones starting with “HU_” contain Human environment assets, which is a good start.) You’ll see a few materials show up, but not many – that’s because the packages haven’t been fully loaded yet. Select a package, right-click on it, and select “Fully Load”.
You can select multiple packages at the same time by ctrl-clicking on their names, or by shift-clicking to select a block. Select all of the HU_ packages now, and fully load them. You’ll have a lot more materials to choose from.
Applying a material to a surface is really easy. Select the surface (click on it in the 3D view) then click on a material in the generic browser. The material will appear. Try it now.
Ok, I didn’t pick a very good material, but it works.
One thing to watch out for – some materials have transparent parts. For instance, fully load the HU_Deco3 package, scroll to the bottom, and look at M_HU_Deco_SM_VentFence01. It’s a chainlink fence material, and you can see between the wires. This is a good example of what not to apply to a surface!
Now, you COULD select surfaces in your level one by one and apply materials, but there are some tools for selecting multiple surfaces at once.
First, you can select multiple surfaces at once by holding the ctrl key and clicking on them one by one. Try that now. (You can also ctrl-click a selected face to unselect it.)
There are also a bunch of options under the right-click menu.
I won’t go into detail, but try a few of these options and see what they do. You might want to start with “Matching Texture” – that’ll select all checkerboard surfaces. You could also try “Matching Brush” to select the entire room, or “Adjacent Walls” to select all connected walls.
Take a few minutes now and replace all checkerboard surfaces in your level with appropriate-looking floors, walls, and ceilings.
Extra credit if yours looks better than this!
Now let’s look at how to change the alignment, rotation, or scale of your material. Select a face and go to View->Surface Properties (or hit F5).
The best way to learn the tool is to try it out for yourself.
Panning and Rotating are easy, just click the button you want and the material updates on the surface. (You can shift-click on a button to move or rotate the opposite direction.)
Changing the Scale is nearly as easy, but once you select a scale option, you need to press the “Apply” button just to the right of the scale. The default scale is 1, and larger numbers mean the material will cover a larger area.
The other thing you can control on this menu is the surface’s lighting properties, but we’ll discuss that more when we talk about lighting.
Now, I’ll cover this in much more depth later, but it would be fun at this point to add some bots to the level. Make sure your map name starts with “DM-“ and save your work.
In the editor, click the “Build All” button (to the right of Build Lighting.)
Save your game and run it. Open up the console by pressing “Tab”, and type “addbots 1”. A bot should appear, and you can kill it!
To add more bots, add more PlayerStart nodes, rebuild all, run the level, and type “addbots [number]” in the console.
Have fun with it! Try adding some additional rooms, and make a more interesting layout. See if you can make ramps to rooms at different heights, or raised platforms inside of a room.