[TUTORIAL] A Beginner's Guide:The Spawn Room

Discussion in 'Tutorials & Resources' started by Half-Life_Maniac, Dec 6, 2007.

  1. Half-Life_Maniac

    Half-Life_Maniac L3: Member

    Messages:
    122
    Positive Ratings:
    88
    In this tutorial, we'll make a safe place for players to spawn and resupply, while keeping enemies out.

    The Room

    Obviously, the first thing you'll want is a room, so go ahead and make one. I've got a floorspace of 384x304, but that is up to you of course. You don't want it too cramped, nor too open. I've left a gap to insert a door later on.

    [​IMG]

    Respawn & Resupply Ents

    We'll first add places for players to spawn. Place an info_player_teamspawn entity. Bring up its properties (alt+enter). The only settings you need to change are the Team and Angles. Since we're working with RED team for the moment, set the Team as Red. Use the compass so that the entity is facing the exit.

    Now clone (shift+drag) this entity until you have at least 16 in the room.

    Next, create a brush that fills the room, and tie it to the entity func_respawnroom. This area allows players to switch classes instantly, and prevents engineers building. In its properties, set its Team to Red and give it a logical name. I'm using "respawn_red1".
    Note: See how I've used "red" in the name? Make sure all your new entities follow this pattern. This will be important in the last part of the guide.

    For the resupply locker, first place a prop_dynamic. For its World Model, choose "models/props_gameplay/resupply_locker.mdl". Give it a name as well. "resupply_red1" will do.
    Then, create a func_regenerate surrounding the locker. Set its Team, and Associated Model to the name of the locker you just made. In our case, "resupply_red1".

    [​IMG]

    Doors

    A hole in the wall isn't going to be much good, so we'd best make a door to fill it up.
    Insert a prop_dynamic. Set its World Model as "models/props_gameplay/door_slide_large_dynamic.mdl". With this particular model, you get a door trim with animated sliding door. Give it a name, something like "door_red_respawn1_prop".
    Now create a func_door which fills the doorway, but slightly overlaps the prop door. This will be an invisible door which controls the prop door. Give it the following properties;

    Name: door_red_respawn1
    Render Mode: Don't Render
    Speed: 500
    Delay Before Reset: -1
    Move Direction: Up
    Lastly, check its Flags and ensure that Touch Opens is not ticked.

    Now we need to tell the prop door to play its opening animation when the func_door is opened. Bring up the Outputs of the func_door, and the two following outputs;

    My output named: OnOpen
    Target entities named: door_red_respawn1_prop
    Via this input: SetAnimation
    With a parameter override of: open

    My output named: OnClose
    Target entities named: door_red_respawn1_prop
    Via this input: SetAnimation
    With a parameter override of: close

    Finally, create a trigger_multiple that extends well past the door so that players can trigger the func_door to open as they approach. Since we also want this trigger to only work for one team (RED) we will need to use a filter entity. Place a filter_activator_tfteam somewhere on the map. Set its Team as Red, and name it "filter_red_team".
    Back on the trigger_multiple, Set the Filter Name to the name of the filter you just created. Also, set the Delay Before Reset to 0.

    Just another two outputs remain;

    My output named: OnStartTouchAll
    Target entities named: door_red_respawn1
    Via this input: Open

    My output named: OnEndTouchAll
    Target entities named: door_red_respawn1
    Via this input: Close

    Keeping the Enemy Out

    One last thing we can do with our door is place a func_respawnroomvisualizer. While invisible and non-solid to the team that owns the spawn, it appears as a no entry sign and blocks the enemy team from passing through the open door.
    Create the entity somewhere inside the doorway, filling the gap. All sides should be textured with tools/toolsnodraw except for the outer side, which should use overlays/no_entry. In its properties, the only thing you have to set is its Associated Respawn Room. For us, that'd be respawn_red1

    Lighting and Detail

    This is only a simple example map, but it wouldn't hurt to make this look a little more like an actual respawn room.
    The first thing we'll want is some lights. Place a light prop or two with the prop_static entity. I've used the model "models/props_lights/light_fluorescent_basement.mdl". Just underneath the light fixture, place a light_spot. For longer lights like I've used, you might want to use 2 light_spots. Choose a light blue/white colour, and a brightness of about 500.

    Place any other details you want. I've placed a couple of prop_static benches ("models/props_spytech/bench001a.mdl"), a func_detail door trim, as well as a RED team logo info_overlay ("signs/team_red").

    [​IMG]

    Last but not least, you should place an env_cubemap entity to ensure that any shiny surfaces reflect their surroundings correctly. No extr aproperties are required.

    Optimisation

    One final thing you can do is increase optimisation by the use of a func_area portal. What this does is prevents the engine from rendering anything on the opposite side of the door when it is closed (since usually, the engine will just assume the player can always see it, and render unnecessary parts of the map).

    Start with a solid textured completely in "tools/toolsareaportal" which fills the doorway. However, ensure that it is actually placed inside the door prop. You'll likely have to make it only 1 unit thick in order to fit.
    Tie it to the entity func_areaportal.
    Set its Name of Linked Door to the name of the respawn door, "door_red_respawn1".
    lastly, set its Initial State to match the state the respawn door will start in- Closed.

    [​IMG]

    One for BLU Team

    At the moment, only RED team has a spawn room, which is hardly fair for the BLUs.
    The first thing to do is select your whole room and clone (Shift&drag) it to another part of the map. Once you've done this, either keep your current selection, or select the old respawn and click the "New Visgroup" button (dotted red button on the upper toolbar). In the Visgroup window that pops up, enter a name of "Red Spawn". This will hide one of your spawn rooms in the editor, leaving us with what we'll turn into the BLU spawn.
    First, let's retexture it. With the Texture Application tool, select one of the floor or wall textures of your spawn, and then click the "Replace" button. Make sure the "Hidden objects too" box is not ticked, and then click the right-hand "Browse" button. Find and select the blue equivilent texture for whatever surface you selected, and click Ok. All textures of that type wil be replaced with your new texture.
    Repeat this process for all textures that need replacing.

    The last thing to do is to go through every entity and reconfigure it to work for BLU instead of RED.
    At least it would be if it weren't for this handy little feature!
    Just like in any word editor, there is a "Replace" function specific to entities.
    Go ahead and select Edit-Replace... (Ctrl+Shift+R).
    In the "Find what"" box, enter "red".
    In the "Replace with:" box, enter "blue".
    Make sure that the "Visable objects only" box is not ticked! Press "Replace All" when you're done.

    Every entity with a reference to the word "red" now uses "blue" instead.
    Unfortunately, this is not 100% effective. While this works for instances where you had to type either "red" or "blue" (such as a Name field) this process works. However, in cases where you need to actually select the team from a drop-down box, you'll have to manually go and set the correct team. Check your info_player_teamspawns, func_respawnrooms, func_regenerates, and filter_activator_tfteams.

    Finally, you can bring your original RED spawn back out of hiding by ticking its name in the little VisGroups window on the right. You should also select and hide/unhide the new BLU spawn so it has it sown visgroup as well. Doing this makes it easier to work with parts of the map at once.

    Hopefully this has been a helpful tutorial. The example map built for this tutorial can be be found here. (Save Target As..)
     
    • Thanks Thanks x 74
    Last edited: Dec 9, 2007
  2. Armadillo of Doom

    aa Armadillo of Doom Group Founder, Lover of Pie

    Messages:
    949
    Positive Ratings:
    614
    I can't believe this has been passed up. The spawn room seems like such a basic thing, but adds so much to the game. The setting of the map can be determined by the spawn room. Anyways, very good write up :) I especially dig the part on optimizing, cuz you can never have enough of that.
     
  3. lerlerson

    lerlerson L2: Junior Member

    Messages:
    75
    Positive Ratings:
    7
    Wow, very good, helpful tutorial for new mappers, and this would have really helped when I started, especially the Optimization part. I actually haven't done that, but I shall now.
     
  4. Half-Life_Maniac

    Half-Life_Maniac L3: Member

    Messages:
    122
    Positive Ratings:
    88
    Phew, nice to get some replies. I was starting to think it was too long for people to even bother reading. Also, I've noticed there's a bit of a problem with the map download link giving a 403 error, due to my host being rubbish. To get the map, right click the link and "Save Target As..."

    [Edit] Updated the tutorial with a new section on cloning your spawn, as well as fixed typing errors.
     
    Last edited: Dec 9, 2007
  5. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    I downloaded your room, copied everything as you said, replaced the "red" entities with "blue" as you said, added a hallway to connect both rooms and a few lights, loaded it up and everything is great except each team can open both doors.
     
  6. Nizzem

    Nizzem L2: Junior Member

    Messages:
    57
    Positive Ratings:
    0
    make sure your using a filter_activator_tfteam like specified in the tutorial and make sure you have the 'touch opens' flag unchecked on your func_doors
     
  7. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    Ok - it was the filter, it was not set to correct team..........now there is another problem. I cannot pass through the door. I checked the func_respawnroomvisualizer and it's set right but the no entry texture is on the portal brush. What now?



    What's odd is that when I remove both area portals, I can pass through Red door as Red player (blue door won't open for Red, that's good), but when I spawn as a Blue player, the door opens but I can't pass through. I checked the func settings and the visualizer and they appear to be correct for both. Grrrrr. I can shoot through it and see the particles outside in the hallway but cannot pass through it.
     
    Last edited: Dec 12, 2007
  8. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    Okay, found out what it was. The func_respawnroom brush on blue was set to red team. Still, I could only get it to work without the area portals.
     
  9. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    You might want to add the fact that the spawnpoints are floating.
    I noticed this when googling on my errors I got on "got a velocity too low on Z" in combination with: "spawnpoint (x y z) is not clear".
    Appears I'm falling in eternity... even without portals.

    Alas, when my room works, there will be cake.
     
  10. Half-Life_Maniac

    Half-Life_Maniac L3: Member

    Messages:
    122
    Positive Ratings:
    88
    You're not suggesting that spawn points should not float, are you?

    They should always be a short distance off the ground to prevent getting stuck, and have a clear space around them.
     
  11. Intraman

    Intraman L4: Comfortable Member

    Messages:
    191
    Positive Ratings:
    0
    Err just to clear things up. The info_player_teamspawn should be "floating" but the func_respawnroom should be touching the floor brush.
     
  12. AussieTemplar

    AussieTemplar Guest

    Positive Ratings:
    0
    Hey man.

    First of all, its my first time on these forums. Great Tutorial btw ;)

    Now, I wanted to create a room WITHOUT the door - so I left out everything that had to do with the door.

    I compiled, got in the game. I spawned, resupply worked fine etc. Then it seemed when I left func_respawnroom my game crashed. I did it over and over again, and it still crashed.

    Anything guys?
     
  13. Half-Life_Maniac

    Half-Life_Maniac L3: Member

    Messages:
    122
    Positive Ratings:
    88
    Perhaps you left the func_areaportal in there? That might cause problems if it's tied to a non-existing doorway.
    Try a Map- Check for Problems (alt+p) and look for any errors to do with outputs.
     
  14. AussieTemplar

    AussieTemplar Guest

    Positive Ratings:
    0
    Thanks for speedy reply.

    Nothing is left. No problems.
     
  15. AussieTemplar

    AussieTemplar Guest

    Positive Ratings:
    0
  16. Half-Life_Maniac

    Half-Life_Maniac L3: Member

    Messages:
    122
    Positive Ratings:
    88
    Mind telling us how you solved it? Just so anyone else who runs into the problem knows.
     
  17. Paddy

    Paddy L1: Registered

    Messages:
    40
    Positive Ratings:
    0
    Um im new to this and a little bit stuck! I think im making the functions wrong because they keep turning into walls aswell so you cant see the resupply unit and the door! can someone please explain how to do this?

    Thanks,

    Paddy
     
  18. Snipergen

    Snipergen L13: Stunning Member

    Messages:
    1,053
    Positive Ratings:
    150
    so you make a brush, give all sides the texture 'tools/toolstrigger', than you press ctrl+T to tie it to an entity (func_respawnblablabla)

    Okay? :)
     
  19. Paddy

    Paddy L1: Registered

    Messages:
    40
    Positive Ratings:
    0
    oh! that sounds like it makes sense thanks! i dint now you had to make the sides the tool/triiger thing!

    This forum is great for giving advice thanks guys!

    Paddy
     
  20. Paddy

    Paddy L1: Registered

    Messages:
    40
    Positive Ratings:
    0
    um sorry to post again so soon! but i created everything as said and when i ran it to test it the resupply locker doesn not appear but it does give you ammo and health! also the door doesnt work and appears broken as the textures go all funny and wierd.

    has anyone experienced this and been able to fix it before?

    thanks,

    Paddy