Alien Swarm Level Creation/Your first Alien Swarm map
This article needs to be cleaned up to conform to a higher standard of quality.
Mapping for Alien Swarm is very similar to mapping for any other Sourceengine game. It does a few things different, but the core structure is as simple and easy to learn. To give you an easy start I will document as much as I can and start out with the basics of the Hammer Editor. You will be able to create this map with zero knowledge. You can download the map at the end of this tutorial. Whenever you need to click something I will mark it in bold.
- 1 The Hammer Editor
- 2 The First Block
- 3 Let's make it a map
- 4 Adding a player
- 5 Adding a functional door
- 6 Lights
- 7 Objectives
- 8 Compiling the map
- 9 Download the tutorial map
- 10 See also
The Hammer Editor
I am sure you have already gone through the SDK Installation and we can start the SDK now.
This is what it looks like and all we need for this tutorial is the Hammer World Editor. So start it up.
It will take some time to load. Click on File and New to create a new map. Your editor will look like this:
I have marked the basic functions that we will need in this tutorial. Let me give you a short overview:
- The huge black boxes will show graphical representations of your map. In 3d and in 2d from a top, side and front view to cover everything that is going on in your map. At this point it would be wise to move your mouse in to the upper left corner of the 3d-view. Rightclick on camera and select 3D Textured. This makes sure that you see textured models in the 3d view instead of wireframes for example.
- The side, front and top views will give you wireframe views of your models.
- selection tool - This tool selects whatever you click at. Who would have thought.
- block tool - This tool creates three dimensional blocks. They are also called brushes.
- texture tool - This tool will help you to assign correct textures to your blocks.
- entity tool - Besides blocks the second thing you will need a lot are entities. (This one is not marked on the picture. It looks like a chess-figure and is below the camera.)
How to maneuver in this jungle
There are a few tricks that you can use to maneuver around. It took me quite some time so if you are slightly more handy than I am you have an advantage here.
- Note the green lines that form a cross in the two dimensional views. Where they meet is the center of your world. Start mapping there.
- You can use your mousewheel in every view to zoom in and out. Do so and use the next with it:
- I marked the two grid size buttons. With them you can make the grid smaller or wider. The grid is important as your brush will snap to it when you create, drag or resize objects. So with a smaller grid size you can create smaller items, or just do some fine tune larger objects.
- Safe as often as you can. If you mess something up you can load a previous version. ctrl + s for saving.
- You can undo your actions. For example if you marked several objects and the accidentally clicked somewhere else you can undo this and have the objects marked again. ctrl + z for undo.
The First Block
Click on the block tool and then drag a square with your mouse in the top view. You will see a dotted white line. You can release the mouse and adjust the size. I made mine 512 *1024 units and you should not be below that! Press Enter or rightclick the white dotted box and select Create Object. This will make a solid object out of your predefined block. If you do not do that last step your box would not be there.
It might be time now to learn about the 3d view. Move your mouse over the 3d view and push z on your keyboard. Now you control the camera that is looking at the 3d scene just like in a Firstperson Shooter. You zoom with your mousewheel strafe with a and d. You can also zoom out with s and zoom in with w. Adjust your camera like I did on the picture, then click z again to leave the 3d view camera.
Click on the selection tool (the red arrow) and make sure you have selected your box. The box is selected if it turns slightly red in 3d view or has a red line in 2d view.
Then click on the texture tool
This will pop up and you choose Browse
In this window you can search for textures. When it comes to textures there are two kinds of textures: The ones that you will see in game and the ones that are invisible in game but you can see in the editor. For our block we will use a texture that you see in game as well as in the editor. I chose the dev_measuregeneric01. It is a developer texture that has a simple color and shows measuring units. In order to find this texture I used the Filter option on the bottom of the screen. Just type in dev for this texture. Other searches that you will probably need in the future are: wall, floor, metal, water
So select dev_measuregeneric01 with a doubleclick. The window will close and throw you back to the previous window. Check if the orange texture is in the small preview window and the click Apply. The new texture should now be on the whole box. If it is not, then your box was not selected before you entered the texture tool.
Select your box. Rightclick on the selected box in any 2d view and chose Make Hollow. Enter -32 and click Okay. This will make your box hollow and leave you with four boxes. These boxes are now grouped. Since we want to take the top of this hollow box we need to ungroup them. You can either rightclick the selected box and the choose Ungroup or push ctrl + u. To select the box on the top click anywhere outside the box in any of the views. The click the top of the box in 3d view. Push delete on your keyboard. Again, feel free to move your mouse over the 3d view and push z to adjust your camera for this view.
Great work. This is where we start the leveling.
Let's make it a map
As the box looks nothing like a map we should first make some texture adjustments. Open the texture tool. With the texture tool open click on the bottom of your box. Only the bottom, and make sure the texture tool is open. You will now see that your bottom is slightly more red than the other sides of the cube. Select Browse and select the dev_measurewall01d with a doubleclick. Click Apply to apply the texture to the selected bottom. You will see this:
Alien Swarm does something different from other Source Games. Due to the third person perspective you will look a lot at the top of walls. Good thing we removed the roof already otherwise we would look at roofs and that would not be fun at all. Since the top of the walls are boring areas we will blacken them out with the second type of texture. Those that you see in the editor but you will not see ingame. Open the texture tool if you closed it otherwise leave it open. The following action will train your skills: You have four walls and each wall has one top. Select one topside of any wall in the 3d view with the texture tool open. Hold ctrl as you select all the other top faces of these walls. You can release ctrl as long as you do not mark anything else. For example you would release ctrl, then push z to adjust your camera in 3d view, push z to leave the camera and then push ctrl and hold it to select the next face. With all four faces selected click on Browse in the texture tool. Use the Filter to search for nolight and select the toolsnolight texture with a doubleclick. Then apply the texture to the marked faces by clicking Apply.
What I did not tell you is that you could also have selected one face after the other and apply the texture separately. But where is the fun in piano playing if you do not break your fingers?
Before we proceed with applying textures we will do two things to have our map look like this:
Adding a player
Click on the entity tool and then click inside your box in the 3d view. It will create the standard entity, which is a info_player_start and the starting position of the player. If you want you can rightclick the selected entity with the selection tool and choose Properties at the very bottom of the dropdown menu. In the top right of the window that opens up you will have a black circle with some kind of radar in it. Next to it is a field with a 0 in it. You can adjust your players direction with numbers from 0 to 359 (well, 360 degrees kind of is 0 again) or by dragging the white line in the radar. Click Apply and close the window when you are done.
You may have noticed that the background in my screenshot is gray and textured and no longer black. I added another brush here which we will definitely need later on. I added it now and textured it grey so that we can continue texturing the cube first without losing orientation in nolight-textures and the black background of the 3d view.
Select the block tool and drag a really huge box in top view around the box we already have. Mine is a bit small, so make it bigger. If you want to zoom out on your top view, now is the time to use the mousewheel. Before you create the box check the side and front views to adjust the height of the box. Make sure it captures the box we already have and is about 3 times bigger. Then hit enter or rightclick the white dotted box and select Create Object. Without clicking anything else, click the selection tool. This way you will instantly select the new box. Rightclick the new box on any 2d view and select Make Hollow enter -4 and click Okay.
Now select the new box, it will become slightly red, then select the texture tool and apply the dev_measurewall01d texture.
Now we can go back to texturing the rest of the first cube:
This is what we want. I textured every outer face of the cube in toolsnolight. The bottom and the back of the cube can be textured in toolsnodraw. The toolsnodraw texture is a texture that will not show up in game. The difference between NoDraw and NoLight is that NoDraw is invisible, while NoLight absorbs light and therefore becomes a clearly visible as solid black texture. As the player will definitely see the front of the level we use NoLight there. He might see the sides of the box so I suggest NoLight there as well. The player will (hopefully) never see the bottom and the back of the map so use a NoDraw texture here. I will not get into details how to apply the textures again. You probably know it by now. You will realize that the backside and the frontside consist of 4 areas that form the whole face. Select them all and apply the texture with heavy use of ctrl.
Adding a functional door
To keep things basic and give you a glimpse of everything here we will include a door with a basic trigger. Use the selection tool to select the info_player_start which looks like a green Gordon Freeman. We placed that earlier. Then us the top view and drag it while holding shift then release the mouse and then release the shift button. This way you will copy the object. Do the same with the front wall. The wall that you dragged into the middle of your room might need an orange texture on one side. Apply that.
Now select the copy-Gordon Freeman and rightclick it in 2d view and select Properties.
Change the class to asw_door (Asw_door) and click Apply. This way our info_player_start will become a door. Select World Model choose Browse and then use the Filter and enter heavy_door while having the MDL Files selected in the top left. This way you will search all the folders - which means all models. Select the doorleft.mdl click OK. Name the asw_door (which is just the class) by clicking on Name and enter door1. Before you close the properties window adjust the direction of the door so that the bolts face left. You do this by entering numbers like 90, 180, 270, 0 in the top right. Click Apply and close the Properties window.
Drag the door into the middle of the wall that sits in the middle of your room. Make sure it is aligned with the floor in the side or front view, It actually should be since the info_player_start was aligned with the floor. Adjust the gridsize so that the door sits right in the wall and does not stick out anywhere. Also make sure that the wall in the middle is only slightly higher than the door. Then select the middle wall. Click the block tool and drag a block like this in top view:
With the wall previously selected it will use the height of this wall for the new block - because in top view you cannot instantly give a value for the height. Make sure the new box has exactly the same dimensions as on the screenshot. It should slightly touch the door on one side and cut through the bolts on the other. Create the object by hitting enter and the rightclick it and select Carve. Carving will delete anything in the objects way - except entities. Which is a good thing since we want to keep the door and just get rid of the extra wall blocking our door. Delete the box that you used to carve with and you should be left with a door sitting between two walls. Perfect.
To open the door we will need a trigger area. Which means whenever a player walks into this area the door1 will be triggered to open. For this create a new box in the size of the area that you desire.
This is how big mines is. It has about the same dimension in every direction of the door since I want to open the door from either side. Apply a texture called toolstrigger to the whole box. The box should have the height of the door! Then rightclick the triggerbox and select Tie to Entity or press ctrl + t. This way the box is now some kind of entity that can carry more options than just mere dimensions and a texture. Edit Class to trigger_asw_door_area Edit Name to door1_trigger This way you will know that this trigger belongs to door1. Every door would need a new trigger and a new doorname. Edit Use Target to door1 This way the trigger will know which door to affect. Every object that you want to refer to from another object will need a unique name. That is why we named the door door1. You do not need to name every lightbulb in the universe, but name the doors.
Click Apply and the door is done.
For lights you can just copy the info_player_start entity again or create a new one using the entity tool. Rightclick the new entity Gordon and change the class to light. Note that there are different classes for light. light_dynamic for example uses more resources but can do more things than just glow. For our tutorial we keep it simple and use the simple light. Change the color to something grey by clicking on Brightness and then Pick color. The first three numbers correspond to the color's RGB values, respectively, and the last value refers to the light's intensity. If you leave it white the light will be superbright and you will not see anything in game.
Make sure the lights hang about one and a half times as high as your character and place one every few meters.
As we only have one player on the map and we want to keep it simple we will use a simple Escape Objective. Which means that whoever survives this difficult map enters a certain area and escapes the infestation. You guess right. The area will be a trigger again. so make a brush / block in the second room at the wall. Apply the toolstrigger texture.
Before we edit this trigger we will need an entity that defines the map objective. Create an entity and change the class to: asw_objective_escape also name this entity map_objective because we will refer to it in the trigger. The position of this entity does not matter at all. I usually keep them either close to the trigger they will be used with or at some place on the map where I gather a lot of map-defining entities.
Select the trigger and push ctrl + t or rightclick and then select Tie to Entity. Change the class of the trigger to trigger_multiple which is a trigger that can be triggered more than once as opposed to trigger_once. Name it map_objective_trigger (you see the concept in naming things right?) Then click on Outputs and Add a new one.
Use these settings: My output named: On Trigger Target entities named: map_objective // I told you we will refer to the objective entity name again. Via this input: MarineInEscapeArea
This is your map objective.
Spawning an Alien
To spawn an alien we keep things simple. Create an entity, make it a class asw_spawner. You can name it spawner1 but since we will not refer to it you do not have to name this one. Change Allow spawn if Marines are near to Yes since our map is not very large and we might be very close to the aliens spawn point. Change Alien Orders to Move to nearest Marine Everything else can use default options here. It will spawn only one unit (Num of aliens we can create = 1) but that is enough for now. The asw_spawner class is pretty self explanatory so feel free to experiment later.
Adding a structure_seal
Remember the grey box around our level? It is time that we bring the black back into the light. Select this hollowed box and apply the toolsnolight texture. Tie to Entity or push ctrl + t and change the class of this brush entity to func_brush. While you can define every name in the map as you like, this one is defined! Name this func_brush to structure_seal
Here is a screenshot:
This box is needed so you have an ending structure around your level. Otherwise it would be endless in every dimension (depending on how much time you have it still is endless on the 4th dimension). If you do not have this structure around every other object on your map your map will "leak". This means you will have parts of your map dripping out of your computer. No, it means you will get an error when compiling. And nobody likes errors.
Checklist and last adjustments
Run a checklist in your mind before you compile the map. It helps avoiding obvious errors
- Do I have a structure_seal?
- Are there lights on my map or will I be blind?
- Do I have a player spawn position?
- Does my player spawn on a solid ground?
- Are all my floors and walls textured?
Compiling the map
This part is easy. Push F9 or go to File -> Run Map. Make sure you will run the game after compiling. The game will autostart once it compiled the map and then you will be able to select a character in the lobby.
If you see red or yellow lines during compiling something went wrong. You can activate that you have to push a key after compiling to close the compile process and check for the errors. Some of them are easy to understand. Some. In this case you would not want to start the game after compiling. So tick that option.
It might be useful to safe the map in this folder: .\steamapps\common\alienswarm\swarm\maps\
Download the tutorial map
It should serve the purpose but I am sure you will soon find out how to do it way better.
Sincerely, your Casanova.