Half-Life 2 Deathmatch Tutorial I: Making Sure Players Are Ready

Babel Babel Logo

I’m currently working on a mod for Half-Life 2 Deathmatch for our game development course at the FHS. I’ve decided it might be a good idea to share some of the things I’ve learned creating the game logic with Valve’s Hammer editor. Since nobody in our team can code, we have to entirely create the game with Hammer. Of course, this severely limits our possibilities, especially since we’re creating a multiplayer mod, and Valve disallowed pretty much all commands to be executed on clients. However, I found out that there are usually always a couple of things you can do to create interesting and different gameplay in HL2DM nevertheless. If I’m motivated enough, I’ll make an entire series of tutorials to cover the creation of our mod, but we’ll see. The tutorials are aimed at people who already know their way around the editor.

To start things off with, today’s tutorial is focused on how to make sure that in a team game, both teams are ready to start the match, and no team gets an unfair head-start, which is really essential in our mod. When a player spawns in his or hers teams’ spawn room, they will be faced with a closed door. There’s a button next to the door, which has to be activated. Once both buttons in the spawn rooms have been pressed, both doors will open simultaneously. There might be more elegant ways to do this, but this one works and it makes for an interesting “interface.” It prevents one team from getting to the tactically interesting spots of the map before the other team is ready.

  1. First of all, you need to create two small rooms in your level. These rooms contain the spawn points for both teams, so create info_player_combine and info_player_rebels entities in their respective rooms.
  2. Next we need doors – so carve in doors into the walls and create your door brushes. Change the brushes to func_door entities, and open the properties. They need names, change the one in the combine spawn room to door_combine and the one in the rebels spawn room to door_rebels. Set Delay Before Reset to -1 so that the doors will stay open for the rest of the game. Go to the Flags tab and disable “Touch opens.”
  3. We will need an entity that checks whether or not both teams have pressed their buttons. So place a math_counter entity somewhere in your map. Give it a name, like team_ready_counter. Maximum Legal Value should be set to 2.
  4. It’s also nice to have an indication showing that the other team is not ready yet, so also add a game_text to your level. In its properties, set the name to “waitmessage” and Message Text to something like “Waiting for other team.”
  5. Now create a small brush and place it in each room on the wall near the door that will function as a func_button. Set Delay Before Reset here to -1 as well. In the Output tab, click on Add and enter the following information for both buttons: My output named: OnPressed Targets entity named: team_ready_counter Via this input: Add With a parameter override of: 1. Also tick the Fire once only check box. Click on Add again, set the output to OnPressed and this time, target the entity named waitmessage and the input should be Display. Fire once only should be ticked again.
  6. Outputs of math_counter

  7. Now open up the properties of your math_counter again. In the Output tab, click on Add. Set the output to OnHitMax, the target is door_rebels and the input Open. Select the entry you just created, click Copy and then Paste, and change the target in the duplicate entry to door_combine so that the outputs look like this:
  8. Outputs of math_counter

And that’s it, you can compile and run the map now (after creating a larger room around everything to seal leaks of course), make sure that teamplay is enabled though, otherwise the map will crash if it doesn’t find regular deathmatch spawn points in it. After one player in each team pressed the respective button in their room, both doors should open simultaneously and the match can begin. Of course you could expand the concept, and create individual rooms, buttons and doors for each player, so that everyone has to be ready before the game really starts. However, this simpler setup should work anyway, since the players usually should wait for their teammates finishing loading the map anyway.

Tags: , ,

One Response to “Half-Life 2 Deathmatch Tutorial I: Making Sure Players Are Ready”

  1. terragot Says:

    Hey this is a great tutorial, I too am working on a mod myself. Having only worked on single player maps till now im finding the multiplayer support for tutorials and such pretty much none existant. Im an absolute begginer with the multiplayer entities and the team based content. I can’t wait for your next post and if you have anything that might help me please forward it to my email.

    regards

Leave a Reply

Enter this code