A Simple Second Map
Once you've created A Simple First Map, it's time to try something new with the skills you have learned.
For this tutorial you must know:
- How to create, move, resize and delete brushes.
- How to texture brushes.
- How to create entities and lights.
- How to save, compile and run a map.
If you don't know how to do any of those things, you are advised to re-read the A Simple First Map tutorial. Unlike the first tutorial, the hollow tool is not going to be used at all - instead, every brush is going to be created individually.
This tutorial covers:
- How to create a map consisting of two rooms
- The basics of leaks
- How to create a moving door
- How to add a map object
- How to add ambience
Contents
Building Rooms
This map is going to consist of two rooms and a small doorway between them.
Planning
The best way to start is to create floor brushes that match the shape of the map we're going for. In this case, we need three brushes - one for the floor of each room, and a smaller one for a corridor that will join the two rooms together.
To make both rooms the same size, you can create one brush, select it, then use space to duplicate it, and move the duplicated brush into the appropriate place.
This is also an appropriate time to assign a texture. In this example, I have used 'concrete/concrete_floor01'.
Walls
With the floor placed, create twelve more brushes to form the walls. Place them around the floor brushes, making sure there aren't any gaps between the bottom of the wall brushes and the wall brushes. Any gap can cause a leak. Use the different 2D top/front/side views (ctrltab) to place these brushes correctly.
This is also an appropriate time to add a player start entity. In this case, we've added an info_team_gdf_spawn entity which we can use to make sure the walls are tall enough.
Remember this map is not ready to compile yet! The lack of a ceiling means that this map is not yet sealed, and will leak.
Ceiling
Finally, the ceiling can be added. The simplest way to do this is to select the three floor brushes, use space to duplicate them, and then move them into place above the walls.
Remember to ensure that there are no gaps between any brushes. Use the 3D camera to go inside and make sure all the brushes are lined up correctly. If you notice any gaps to the outside, move and stretch the appropriate brushes to close them.
This is a good time to add a light or two to the map.
Now save the map and try to compile it. If all goes well, the console (O) will show plenty of blue output as seen in the screenshot.
Leaks
Depending on how careful you were in building your room, you may or may not have a leak in your map. If you do have a leak, the compiler will show a bright red message saying 'leaked', and the 3D view will draw a line going through the leak.
In the screenshot here, the the red line (with the arrows) goes through a small gap in the floor.
To fix this leak, we just need to resize one of the floor brushes so the hole is sealed.
When you compile the map again, and you've fixed the leak, it should now compile correctly. However, if you have more than one leak, the compile will fail again, but with a new set red line indicating the source of the next leak that needs to be fixed.
Creating a Door
There are many different ways to create a door. In this example, we're going to create a very basic door that involves making a brush that moves up and down when approached by a player.
Note: There are two types of entities. Firstly 'point entities', like lights and player spawn points, which cannot be resized. Secondly 'brush entities', which are simply brushes that are given some sort of ability.
Creating a door brush entity
This door is created exactly like any other brush. Make sure it fits exactly into the corridor between the two rooms.
The brush is assigned the texture 'metal/metal_door_2' texture.
With the door brush selected, rmb on it to bring up the entity list, and select 'func_door'. This will turn the door brush into a 'func_door' entity, which means that in-game, it will slide open and closed when players approach.
Configuring the door entity
With the door selected, press N to show the Property Editor that allows the properties of this brush entity to be altered. Then expand the 'Available Keys', 'func_door' section at the top of the window. This reveals the properties of the door that can be edited that affect its behaviour.
The value that needs to be changed is move_delta. This defines how far and in which direction the door moves when it is triggered, and is defined as a 3D vector. For example, the 3D vector '16 32 128' means '16 units forward, 32 units right, and 128 units up'. Since we want this door to move upwards, we want to use a value of '0 0 128', which will make it move upwards 128 units when triggered.
To set this value, click on move_delta and at the bottom of the window where it says 'Value: No default given.', enter 0 0 128 and confirm with ENTER. If you scroll down to the bottom of entity properties window, you should now see move_delta0 0 128.
The 3D view should also show the position to which the door will move when opened.
If you want, you can compile the map now and test out the door you have created. Remember to spawn as a GDF though (as the map only contains an info_team_gdf_spawn entity). If all is well, the door will open upwards as you approach it, and close by itself.
Texturing the door
The door currently isn't textured very well; it doesn't match up with the corners of the brush and so it doesn't look like a door at all.
This can be fixed by choosing more appropriate textures, using the face-selection tool to apply a different texture to each side of the brush, and using the Surfaces Inspector or Texture Editor tools to align the textures correctly.
For this example, we'll be using the Surfaces Inspector.
= Aligning Textures
First, select the front face of the door (by using ctrlshiftlmb in the 3D view) so it is highlighted red. Then select the face on the other side as well, so we can edit both faces at the same time.
Press S to bring up the Surfaces Inspector. This window allows you to shift the texture along the face, scale it up and down, rotate it, or even just make the tools fit the texture to the surface for you.
The Surfaces Inspector works in a peculiar way. For example if you press the 'up/down' buttons next to each 'Shift' control (which by default, are set to the value '8'), the selected faces will have their textures shifted by 8 pixels. If you type in the value '32' instead of '8', and then use the 'up/down' buttons, the texture will be shifted by 32 pixels instead. Try this out to make sure you understand the concept.
The 'Scale' control works in a similar manner - by default, they're set to '0.5', so when you press the 'up/down' buttons, the texture will either be scaled down by 0.5 (to half their size), or scaled up by 0.5 (to double their size).
Adding Map Objects
Map objects are 3D models (usually made by a 3D artist) that you can add to your map to make the world appear more detailed. Map objects range from trees, to destroyed vehicles, barrels, light fittings, electrical boxes, tables, pylons, street lamps, aerials and all sorts of objects that you wouldn't want to create from brushes.
To see all the map objects that are available in the SDK, try opening the map /maps/sdk/model_gallery.world, which contains every single model you can use.
rmb on a 2D view to bring up the entity menu, but instead of selecting an entity, instead choose 'New Model Static...'. This will bring up a file chooser allowing you to browse all the available models. For this example, we're going to add a light fitting, which is found in /models/mapobjects/valley/valley_warehouselight_nosupports.lwo. Note that the preview window in the file chooser can be manipulated using the mouse buttons.
The object will now appear in your map. Since it's a light fitting, move it into an appropriate place for a light fitting, such as near the ceiling, and create (or move) a light entity underneath it.
Adding an Ambience
Empty maps are, by default, pitch-black. However, this produces interiors that are not convincing. To counter this, maps should have either atmosphere entities (if they're outside) or light_ambient entities (if they're inside), which help light up an area with a constant colour.
To add an ambience to this map, simply create a light_ambient entity and place it anywhere inside the map. Now set it's ambientCubemap property to (for example) area22_interior_office_building02. You may notice the Property Editor automatically gives you a dropdown list to choose from as soon as you start typing. If you use the real-time renderer (F3) the 3D view will also show you the ambience you have chosen.