• Hammer Basics and Alien Swarm TileGen Creation Tutorial Part 2

    In part one of my tutorial, I showed the basics of building in Hammer and how to add rooms made in hammer to the Alien Swarm Tilegen. In this tutorial, I'm going to talk about building multiple rooms that you can tie together to form a full map. I want to warn you now, it's a fairly long tutorial.


    The first room I'm going to make is the starting area. If you remember from the first tutorial, I talked about lining up your room to the center of the grid and making your room in multiples of 256. I say this because the tilegen uses that to line up the parts of your map. If your rooms aren't lined up right, you won't be able to get through your level, or even place it on the grid correctly. Another thing to note is your walls, you should try and keep your walls at the same height and width through out the level. I loaded up a premade room from Alien Swarm, and the measurements they used for their walls was 16x160(WxH). This is what I'll be using in my rooms as well, just in case I decide to make a map using both my tiles and the premade tiles.
    One difference between this room and the room we made last time is that you'll need to keep an open space for the next room to connect to, as shown.

    Once you make your walls the way you want, then we can work on little details likes adding doors or pipes to the walls that don't do anything but look pretty. Most of these can be done under the class of 'Prop_Physics_multiplayer', but from time to time, you'll need to change it to 'prop_dynamic' for it to work right. The best way to tell is in the Entity Browser. When you find the world model you'd like to use, go to the info tab, and see what's checked. I'll include a screen shot to help you out here. Another thing to make note of is that most props will need to have motion disabled, or any fixtures you place on walls will just fall down. You can turn off motion for the object under the 'Flags' tab in the entity properties window.


    Another difference from tutorial is the lighting of the level. Lighting sets the mood and can drastically change the difficulty of a map. Putting in light is as simple as adding any other type of detail. The first thing you should do is set the global tone for the map. Do this by making an entity with the class name 'env_tonemap_controller'. This sets how low you want the environment light to be. Think of it as the sun. Even though it's an indoor map, hammer doesn't know the difference. So it uses a default brightness in the map which renders most lights unusable. Change the name of the 'tonemap_controller' to 'Tonemap_global' just so you know what it is. Now we're going to get into something a little confusing but very helpful, triggers.

    Make another entity and for class name put "logic_auto". Go to the output tab, and we'll start doing outputs to make the tonemap we just made work right. Outputs determine what things to trigger, when to trigger them, and what happens when it's triggered. Start by adding 4 new outputs. Select all the outputs and change the first two drop down boxes to 'OnMapSpawn' and 'tonemap_global'. These will determine when the trigger goes off and what entity it edits. So in other words, when the map launches, the entity named 'tonemap_global'(which we just made) will change something about what ever you set it as. You'll need one output set to 'SetTonemapRate' and '.25' as the input and parameter. One for 'SetAutoExposureMin'and '1'. One for 'SetAutoExposureMax' and '3'. And one for 'SetBloomscale' and '.3'. Use the screenshot to assist you.

    Now that that is set up, you can start adding lights to your room to give it a little ambiance. When your finished with this room, go ahead, and save it. Don't forget when saving to save the map with the area size before the name of the map. Mine will be '3x2_startroom'. Remember, it's by multiples of 256 so set your grid to 256 and just count the squares width by height.
    Now we can start our next rooms. I'm going to skip to the end of my map just to save some time. The concept for making rooms is the same, so just follow what you know.
    For my last room I'll make the player turn on the generator to get some lights working and the door panel for the end that they need to hack to open the door. Let's start by adding a door to the generator room.

    For this, I'm going to extend the width of my interior walls to 24 instead of 16. I'm going to do this because the door being used is slightly larger than 16 and can be seen through the wall when it closes. Once you get your walls right, add a door. The entity class is 'asw_door', and name the entity 'EndDoor_1'. In the properites look for 'door type' and 'can close to weld'. I'm making this door indestructable, and unable to weld shut. I'm doing this so that the players have to fight the swarm outside rather than bunker down in that room. Find the world model you want to use, and hit apply. After you line your door up with the middle of the wall, create an area around the door with a box to use as the door area. Select the box, and find the trigger texture in the texture browser. With the box selected, push 'ctrl+T'(or right click the box in the grid veiw, and select 'tie to entity'). Put 'trigger_asw_door_area' as the class name, and hit apply. Look for 'Use Target' in the properties menu, and select 'EndDoor_1' from the dropdown box that appears. Your door should now open when you step into the trigger box you just created.

    Next, we'll create our ending door. This door needs to be a 'prop_dynamic', and for the world model choose 'slow_heavy_door.mdl' (it's the model that comes up when you type in slow in the model browser). I'll name it 'EndDoor'. For this door, you'll need to make a 'func_brush" so that players can't walk through it. Do this by covering the door with a box with a 'clip' texture. Make sure the texture is as close to the door as possible. Tie this box to an entity as a 'func_brush' and name it 'Door_brush'. This door also requires a door area just like the last one did. Make one around the door and be sure to make the 'Use target' property 'enddoor'.

    I put two lights next to my enddoor that start dark. Make two light entities. Name them both 'lights1', and in the flags Tab, check 'Initially dark'.
    Throughout the room, I've added some spawns, and named them 'Spawners'. I've also added an extra spawner and named it 'SpawnersE'. Both of these need to have the 'Spawner state' set to 'Wait for inputs'.

    Next to the EndDoor, I'll put a panel. Make a Prop_dynamic, name it 'endDoor_panel', and use the world model 'panel02'. For this button to work, you'll need to create a button area much like the door area except the class name will be 'trigger_asw_button_are'. Name the area 'EndDoor_panel_area'. The properties we'll change are 'Panel Prop name' to 'endDoor_panel', 'Locked' to 'yes', and 'Has power' to 'No power'. The 'Time to charge', 'Num Wires', 'Wire Colums', and 'Wire Rows' all have to do with what the hacking process will look like. You can edit these to your desire. You need to have something there since my tutorial will, and I don't wanna confuse you or mess you up. In the output tab make two outputs each 'OnHackcompletion'. Tie the first one to "enddoor", tell it to 'SetAnimation', and in the parameters box, type in 'open'. Set the second output to 'spawners', and tell it to start spawning. So now, when you finish hacking the panel, the door will open, and the swarm will spawn. However, we need to give this panel power first.

    So, back to the generator room. Make a trigger box the size of the generator room (make sure it touches the outside of the door). Tie it to an entity, and set it to 'trigger_proximity'. Name it 'Doorclose', and set 'Start Disabled' to 'yes'. In the outputs tab, make an output set to 'OnEndTouchAll' on 'door1' to 'DisableAutoOpen'. This will seal the door after the power is on and the players leave the room.

    I have a panel on the wall I'm going to use as my generator button(named Generator). Create another trigger box entity like we just did. In the properties, there should be 'Use target'. Make the value for that 'Generator'. Make sure the panel has power and isn't locked. There is no need to touch 'Panel Prop name' since we won't be hacking this panel, just using it as a button. In the output tab we're going to make 4 outputs all 'OnButtonActivated'. The first output will be for the 'enddoor_panel_area', we're going to turn the power on. Next is for 'lights1'. On this, we'll turn them on. 3rd is for the 'SpawnersE' to start spawning. And the last one will be to enable the 'DoorClose' trigger we just made.

    Go back to the 'enddoor' entity. On its output tab we need to make an output for 'Door_brush', and set it to 'Disable'. Now, we're just about done; all that's left is to add an ending trigger to end the mission when we go through the door. Make a room on the other side of the door. In the room, place an entity with a class name of 'asw_objective_excape'. Name it 'map_objective'. Now fill the room with another trigger box. Set the entity class for it to 'trigger_multiple'. Go to the output tab and make the output 'Ontrigger' for 'map_objective' to 'MarineInEscapeArea'. The last thing we need to do is place the entity 'asw_tech_marine_req' somewhere in the room. This requires that there be a tech to start the map.

    You've now finished all you need to do for the map. If you saved all your maps like I showed you in the last tutorial, then adding them in should be a breeze. All that's left is adding them into the tilegen, placing them together, generating thumbnails, and then running the map, which I talked about in the last tutorial. I hope this helps, and I hope to see many tilesets being made in the future.
Title