[TUTORIAL] Making a sports or sports-like map

Discussion in 'Tutorials & Resources' started by The Asylum, Nov 29, 2008.

  1. The Asylum

    aa The Asylum

    Positive Ratings:
    By popular demand, here's how to make a map that's won or lost by shooting or meleeing a physics object into a "goal" of any sort.

    First, if you're not going to base your map off of an already existing sport (such as soccer, hockey, etc), I suggest you just start sketching the concept you have in mind first. Remember: Practice safe design. Use a concept.

    Got it? Good. Now for this simple tutorial, we'll start with a hollowed out brush.


    Of course you'll also need an info_teamspawn somewhere.

    Now then, let's make a "goal" using another hollowed out brush, ungrouped and with one (or two, if you want the bottom gone too) side deleted.

    Do the same for the other goal, only let's give each goal a different texture for each team, so we know which is which.

    Now with our two goals in place, let's make our ball. Or puck. Or whatever it is you want people to score with. Select "cylinder" or "Sphere" from the solids drop-down menu, and add or subtract however many points you want your physics object to have- the more points, the smoother it will be.

    Note if you're making a ball: For some reason, Hammer will make a sphere that vbsp won't like at all. Just go to Map >> Check for Problems, and it'll fix the offending verticies for you.

    Now, select your ball, right click it, and tie it to an entity: func_physbox

    There's really only two things you need to change here: the name, and the Mass Scale. The name of the object is up to you (I'll call it "ball" from here on in), and you should put the mass scale as 0.1. Of course you don't have to, but this is the general setting that I'd reccommend for you.

    Now then, create a new entity, and make it a point_servercommand. You'll have to name it. Now go make another entity, a logic_auto. You dont have to name this one, but you will have to go into it's Outputs tab.

    OnMapSpawn >> (your point_servercommand) >> phys_pushscale 30

    You can change the "30" to whatever number you want, but I'd just leave it at 30. Without this, the ball will move very lethargically, and pretty unresponsive to being shot/hit

    Next, making your ball score. Using the trigger texture, make a brush that fills a goal (Let's start with the BLU goal first). Then, make two entites, both of them a game_round_win, one for either team. You can also make a third one set to None(sudden death) if you plan on using a team_round_timer. Name them differently, and then go back to your trigger brush.

    Tie your trigger brush to a trigger_multiple, and in it's Flags tab, uncheck Clients, and check "Physics Objects." Now, your trigger won't fire outputs when a player enters them, but when your ball does. In it's output tabs, make:

    OnTrigger >> (whatever you named your red game_round_win) >> RoundWin

    Clone that trigger brush now, and fit it into the other goal, and reverse it's team designation

    On Trigger >> (your blu game_round_win) >> RoundWin

    Compile your map now. By getting the ball into the opposing team's goal, you should win. Or if you hit your ball into your own goal, you'll lose.


    Now then, if you want to make it so that players have to score multiple times to win (Let's say, 3), then you must make two math_counters. Name them differently for each team, and set their max legal value field to 3. In their output tabs, create:

    OnHitMax >> (your corresponding game_round_win) >> Roundwin

    IMPORTANT!! Don't assume that you're done yet. Remember your trigger brushes? One goal will still trigger the round_wins. Go into their output tabs, and edit their lone outputs

    OnTrigger >> (your corresponding math_counters) >> Add >> (with a parameter override of) 1

    Now, it's set so that every time a ball touches the trigger, it will add 1 to the math_counter. Once that math_counter hits 3, it will tell the it's game_round_win to tell the game that they've won.

    But of course, as it stands now, the trigger will fire multiple times as long as the ball is touching it. What I reccomend doing is:

    Move your trigger_multiples to an out-of-reach area on your map (create a new section if you have to). Back to your goals now, create a new trigger brush, and tie them to trigger_teleport. Be sure to uncheck "Clients" and check "Phyiscs Objects" in their Flags tabs. Now, in their remote destination field, enter something like "Blu_teleport"

    Back to your trigger_multis now, above them create two new entities: two info_target(s). name each what you specified as a remote destination (blu_teleport and red_teleport)l, and place them over the corresponding trigger brushes. Do make sure that the two sets of info_targets and trigger_multis are seperated by a solid brush, so no ball can "cross over" and score for the other team as well. Also, make sure that the ball will drop well below the bottom of the triger brush, so when it hits the ground, it will no longer be touching it.

    Now as it stands: When a ball enters, let's say, RED's goal, that ball will be teleported to "red_teleport", which will drop the ball into the trigger brush that tells "blu_counter" to add 1 to it's running tally. On the flipside, if the ball enters BLU's goal, it will be teleported to "blu_teleport", dropping through the trigger that tells RED's math_counter to add 1 to it's running total.

    Sound complex? Very much so, but totally necessary. You don't want a Soldier or a Demo using their explosives to bounce a ball back out of the goal, past the trigger brush again, and score a two-for-one, now do you?

    Now then, getting your teleported ball back to the playing field. What I'd reccomend doing is creating yetr another trigger_teleport below your trigger_multis, teleporting that to yet another info_target (which we'll call ball_respawn). That way, after dropping through a trigger_multi brush, it will then pass into the teleport trigger, whisking it away back onto the playing field to be scored with again.

    Note that: Should you be working with short walls and there's a danger of the ball going up and over and out of the playing field , you can use additional teleport triggers in this manner to put the balls back where they belong.

    I'm working on a prefab, which will be uploaded shortly. I'm sorry if I've been a bit confusing with this tutorial. Hopefully I haven't left you completley clueless.
    Last edited: Nov 30, 2008