With the previous two-part tutorial, we have learned to use the editor to a bare minimum. We toyed around with the different tools available and made our attempt at designing a reasonable scene. Nothing, however, was happened within it. In this tutorial we will introduce the basics of working with entities, remembering the usage of point entities and coupling it with brush entities. We will also cover entity I/O briefly, and we will lay the basic foundations of what you need to build interesting maps in the Source Engine. For this purpose, I have designed a simple dev textured map that we will use as our base to create a few entities. Download the version that is not solved, entity_tutorial.zip (containing our entity_tutorial.vmf) here or in the attachments below. When you load the map in Hammer, your first sight should be of a room with a few spawnpoints, a rock brick wall and a big orange brush textured with the 'Trigger' material. For reference, it should look like this: We will make sure that we are using the correct version by checking the entities actually in the map. For this, we will use the entity report menu. This menu is very helpful when your mapping projects start to grow, so it is a good idea to know that it exists and to use it if you start losing your mind at times. To access it, click on the 'Map' menu in the top bar and then open up the 'Entity report...'. You should get something like: Silly me! I forgot to mention that we also have a light placed, specifically an environmental one. We didn't cover this type of lighting in particular, so you might want to change the values and study where does the light come from. When you do, you will notice that it has to do with the 'SKYBOX' texture on top of us, from which environmental light is casted when the map is compiled. We also see a 'func_buyzone' and, if we click on that name in the report, we will see that the brush textured with 'Trigger' will light up: in that area players will be able to buy weapons. Now that we have some grasp of this initial area, we should start getting our hands dirty. We will create our first brush entity ever, selecting the brown-brick textured wall. With it selected, we want to make it become an entity. For this, we can use the menu on the side: Or we can use the Ctrl + T hotkey. For your own productivity's sake, you should probably get accustomed to using this hotkey. Now a dialog will show, exactly the same as the one we have already seen when dealing with the properties of point entities. As entity class, we notice it says 'func_detail', a few of which were listed in the entity report. We will put our mouse cursor there and change that to 'func_breakable'. A bunch of properties will then pop up: We will only change two of them, as pictured. In particular, I set the strength to be 100 and the material type to be cinderblock. You can try variations on this, compiling every time, to see the effect they have on the way the entity behaves. In fact, even if you're only following the tutorial step by step, you should compile at this point and hop into the map. Can you break the wall after a few shoots? Don't set too high of a strength or it'll be too hard! After this very simple starter we reach a little area with two different paths and brushes blocking them. You should also notice a button-looking thing in the middle of the room. We will set it up so that both of them are doors that open after 5 seconds of pressing the button. Furthermore, when the button is pressed, a console message will appear -- does this remind you of some particular gamemode? We will go in the order of the actions we want. First, we need the entity that will let us print out console messages. For that, we will create a point entity (you can remember how in the previous tutorial!), whose class will be point_servercommand in particular. We will give this entity a name, I usually go for 'Console' (without the 's) since I mostly use it for... Console to talk! As you'll notice, the position in which you place this entity is meaningless. Now, we will start with the doors. We want to have an example of each door type we can build: either sliding or rotating. As such, we will turn the white blocker into a sliding door and the grey blocker into a rotating door. In the same vein as with our previous func_breakable, we will select the brush and turn it into an entity. Use the hotkey this time, at least if you didn't before. The classname will be func_door this time around: We will set the flags up and configure a few of the properties. In particular, we will give it a name: SlidingDoor, a start sound for when it starts moving (I decided to use a random, funny sounding one), the delay before reset (-1 in our case, so it stays open) and the lip (that is, the amount of units which the door will not fully go into; 32 in our case). When this is all set up, we have a door that doesn't open when you touch it (like a default one) and will slide all the way but up to 32 units. In the same vein, we will set up our rotating door. We will give it a name: RotatingDoor, and a few properties (as specified in the next picture). Since rotation works counter-clockwise and we'd like the door to fit in the little space in the wall it has ahead, we will also set the flags to go into the reverse direction: In Source, entities rotate with respect to their origin. For entities, the origin is usually initialized at their center. Because of this, the door will rotate in a very odd way if we don't change it around. In this particular case, we will move the origin to the corner so that rotation happens with respect to it. To move the origin, we just need to move the little circular handle (in the top view), as shown in the next image: With this done, we have properly set up the three entities. We will now turn the button brush into a func_button, and set its flags so it doesn't move. Furthermore, we will set up the input/output. For that, we will click on the 'output' tab in the entity information view, and add a few fields, as shown below: Entity I/O (input/output) is very simple in Source and, once you get accustomed to it, you realize how easy it is to build complex situations with it. We have set it up exactly as we wanted: when the button is pressed, that is, OnPressed, we first send a Command through the Console entity, in particular a say command with some message. With a 5 second delay, the RotatingDoor and SlidingDoor entities receive an input to Open. Compile the map and check if everything goes as expected. Make sure you configured the entity attributes appropiately. When it does, move onto the next area, where both paths merge. You shall see an area that will remind you of an sliderace map (you can see an example of those kinds of maps in ze_random, at the end of the skyscrapper level). In this area we will introduce triggers. Triggers are volumetric brush entities that can fire I/O or have an effect on players, pushing, hurting or setting gravity on them, among other things. We will create our first sliderace area by using a push trigger. For that, create a brush covering the whole race track with the 'Trigger' material. Although trigger entities don't need to use this material, it is a good practice to do so for your own sanity, since it will let you distinguish what's going on easily. When you're done, you should have something like this: Again, turn the brush into an entity and set the class to be 'trigger_push'. We will need to adjust the force it applies, as well as the direction. Furthermore, push triggers have a small catch: they don't affect players by default. To solve that, go into the flags section and tick the 'clients' option. Clients are players in Source Engine lingo. When that's done, we will need to adjust the direction of the applied push. Since most of the time entities both look and apply their effects in the 2D top view plane, Source is conceived so this is easy to do. If we look at the top view, we want the push to go 'upwards' in it, so we will use the direction gizmo marked in red in the next picture: With it, we point in the direction we want to be going (in the top view) and we're done. Now, we want to make sure that we can make it to the other side of the big hole that rests there, but we also want to die if we fall into the pit. As an exercise to the reader, you will have to set up three different triggers here: one to set low gravity if you're coming from the sliderace, one to set normal gravity if you either fall or are coming from the opposite direction, and one to kill those that fall. For this task, you will need to use trigger_gravity and trigger_hurt. If you want two different brushes to be associated to the same brush entity (i.e., a breakable with several parts or the two parts of the gravity trigger meant to set default gravity), hold down the control (Ctrl) key while selecting the brushes before you turn them into entities. The result of this small challenge should look similar to this: With the trigger that sets low gravity being selected, the two-brush trigger that sets default gravity adjacent to it and the hurt trigger in the bottom of them pit. Finally, we will add one trigger to go back to the beginning after we win. That way, we will be able to cycle through our map and make sure everything is alright. For this we will need to set up a teleport destination. We will use a point entity, which we will name, placed at the area where we first started. Afterwards, we will place a small trigger in the end area. This should be fairly easy to you by this point. You will have to select the destination and, since we want to face in the direction of our trigger to make sure it doesn't feel confusing or nauseating, we will also enable that option: If we followed all the steps correctly, our small course-like map will be finished! You can make sure if you did by checking the solved version, which you will find here or in the attachments below. ---------------------------------------------- CHALLENGES (growing difficulty): We have left out one very important kind of trigger: trigger_multiple. It is typically used to manage trigger-based I/O. Set triggers on each area that display through console where you just entered. Notice that you can keep using the same point_servercommand entity, there is no need to make multiple instances of it. Our course map is too short and not very challenging. Make an area in which you have to jump on rotating cylinders to advance. You should use the func_rotating entity, and it will be advisable to place a trigger_hurt below so you die if you fall. You will have to configure the properties on your own, for which you might use the Valve Dev Wiki (some information in it might be out of date or plain wrong, beware!) Through parenting and using func_tracktrain, make a killer train that wanders our little map. It must include the train (a prop_dynamic entity), the tracktrain (which will move according to some preset tracks, path_tracks) and a trigger_hurt. Use the wiki and combine this entities to build our killer train. For simplicity, you can have it running in circles in the spawn area, so you can test it easily. Figure out how to connect everything. BONUS: Use logic entities (logic_auto, logic_case, ...) alongside with sound entities (ambient_generic) to give the killer train randomized killing sounds. Can you make it start and stop at random too? (check logic_timer!) How would you make it breakable so you can 'Kill' the killer train?