User:Brandished/Sandbox 1: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(updated)
Line 10: Line 10:
* A fog controller
* A fog controller


Here's the map's layout and set up.
Here we have our sample map layout.


To start with we'll add an info_director and a env_fog_controller.  Make sure to the "Fog Enable" property is set to "Yes".
Well make the room on the far left the starting point by adding an <code>info_player_start</code> entity to there.  Next, let's add an info_director and a env_fog_controller, make sure the fog_controller's "Fog Enable" property is set to "Yes".


If your spawn area has a "prop_door_rotating_checkpoint" to exit by, make sure the model is set to models/props_doors/checkpoint_door_01.mdl, the keyvalue "body" has value of 1, the Spawn Position is set to "Closed" (spawnpos keyvalue 0), and the "Starts Open" flag is unchecked.
For a supplies area will create a small brush to act as a table and add:
 
* health kits, 4 <code>weapon_first_aid_kit_spawn</code> entities
To give the players a starting point, add an <code>info_player_start</code>.
 
Supplies area:
* health kits, usually 4 <code>weapon_first_aid_kit_spawn</code> entities
* 2 weapons; <code>weapon_smg_spawn</code> and <code>weapon_pumpshotgun_spawn</code>.
* 2 weapons; <code>weapon_smg_spawn</code> and <code>weapon_pumpshotgun_spawn</code>.
* an ammunition resupply, <code>weapon_ammo_spawn</code>
* an ammunition resupply, <code>weapon_ammo_spawn</code>


Now for an exit lets add a prop_door_rotating_checkpoint entity. For it's properties, name it "checkpoint_exit", set its "body" property to "1", the "Spawn Position" to "Closed" (spawnpos keyvalue 0), the "model" to "models/props_doors/checkpoint_door_01.mdl", and the uncheck the "Starts Open" flag.
Now for an exit add a "prop_door_rotating_checkpoint" entity. For it's properties, name it "checkpoint_exit", set its "body" property to "1", the "Spawn Position" to "Closed" (spawnpos keyvalue 0), the "world model" to "models/props_doors/checkpoint_door_01.mdl", and the make sure the "Starts Open" flag is unchecked.
 
That should finish the starting point, but before we move on, lets add a info_landmark to the room as well, name it landmark_1. Well go more into detail on this later.


== Rescue closets ==
== Rescue closets ==
Bringing dead players back into the game.  Players respawn in a random closet that only their teammates can let them out of. Respawning players come back with basic equipment and without full health.
Next well need a place for dead players to respawn referred to as rescue closets. Rescue closets are fairly basic and only consist a room containing three <code>info_survivor_rescue</code> entities with a <code>prop_door_rotating</code> to enter or exit by.


Rescue closets are fairly basic and only consist a room with containing three <code>info_survivor_rescue</code> entities with a <code>prop_door_rotating</code> to enter and exit by.
== The safe house and changing levels ==
Each campaign is divided into several chapters marked off by safe rooms, which are checkpoints where players can heal, re-arm, and dead players can return if they weren't already rescued.


== The safe house and changing levels ==
To start with, well add another "prop_door_rotating_checkpoint" entity for the safe houses entrance.  This one is set up a bit different then the last one.  Open its properties and set the name to "checkpoint_entrance", the "body" property to "0", the "Spawn Position" to "Open Forward" (spawnpos keyvalue 1), the "world model" to "models/props_doors/checkpoint_door_02.mdl", and the make sure the "Starts Open" flag is checked.
Each campaign is divided into several chapters marked by safe rooms, which are checkpoints where players can heal, re-arm, and dead players can return.
 
* <code>prop_door_rotating_checkpoint</code>
Lastly, well set up the transition from one map to the next using another <code>info_landmark</code> and a <code>trigger_changelevel</code>
* <code>info_landmark</code>
 
* <code>trigger_changelevel</code>
First add the <code>info_landmark</code>, the open it's properties and name it "landmark_2".  Now create a large brush to cover the floorspace inside the safehouse and tie it to the <code>trigger_changelevel</code> entity, make sure the brush comes in contact with the floorspace inside the room (doesn't necessarily have to overlap the floor space, but it does have to at least touch it). Open the changelevel's properties and set the landmark name to the one we just created, "landmark_2" and for the "next map" property, enter "map_02".
{{note|Make sure the <code>info_landmark</code> is named and that the landmark name is specified inside the <code>trigger_changelevel</code> settings along with the name of the next map to be loaded. Keep in mind the <code>trigger_changelevel</code> has to come in contact with the floor space inside the safe house due to how nav generation works.  The trigger brush doesn't necessarily have to overlap the floor space, but it does have to at least touch it, or a good portion of where the nav square(s) will be generated. If the <code>trigger_changelevel</code> doesn't come in contact with the floor space, you will have nav errors when the map is loaded. For the <code>prop_door_rotating_checkpoint</code>, make sure the model is set to <code>models/props_doors/checkpoint_door_02.mdl</code> and the "Starts Open" option is checked inside the "flags" tab.}}


== Building a navigation mesh ==
== Building a navigation mesh ==
Line 46: Line 44:
The map will be reloaded after you type nav_generate
The map will be reloaded after you type nav_generate


After running nav_generate we no longer have the nav error message on the screen when the map loads.  Lets take a look at what nav_generate did:
After running nav_generate we no longer have the nav error message on the screen when the map loads.  With nav_edit 1 still enabled, lets take a look at what nav_generate did.  Open the console and type:
 
: select_with_attribute DOOR
: select_with_attribute DOOR
 
::Notice the 4 nav squares that were highlighted, this tells the bot AI there is a door in this location.
Now 4 nav squares should be highlighted...


: select_with_attribute CHECKPOINT
: select_with_attribute CHECKPOINT
: select_with_attribute RESCUE_CLOSET
: select_with_attribute RESCUE_CLOSET
: select_with_attribute ESCAPE_ROUTE
: select_with_attribute ESCAPE_ROUTE

Revision as of 17:31, 2 January 2009

For this tutorial we will be making a simple 2 level campaign that never ends. Sounds fun, right? Well, maybe not, but the purpose really isn't to have a full campaign, but to explain the basics of level construction in L4D.

First, lets cover what our L4D campaign will need to work right:

  • A director
  • A starting point
  • 2 safe house doors
  • Some weapons, ammo, and health
  • A rescue closet
  • A change-level
  • A fog controller

Here we have our sample map layout.

Well make the room on the far left the starting point by adding an info_player_start entity to there. Next, let's add an info_director and a env_fog_controller, make sure the fog_controller's "Fog Enable" property is set to "Yes".

For a supplies area will create a small brush to act as a table and add:

  • health kits, 4 weapon_first_aid_kit_spawn entities
  • 2 weapons; weapon_smg_spawn and weapon_pumpshotgun_spawn.
  • an ammunition resupply, weapon_ammo_spawn

Now for an exit add a "prop_door_rotating_checkpoint" entity. For it's properties, name it "checkpoint_exit", set its "body" property to "1", the "Spawn Position" to "Closed" (spawnpos keyvalue 0), the "world model" to "models/props_doors/checkpoint_door_01.mdl", and the make sure the "Starts Open" flag is unchecked.

That should finish the starting point, but before we move on, lets add a info_landmark to the room as well, name it landmark_1. Well go more into detail on this later.

Rescue closets

Next well need a place for dead players to respawn referred to as rescue closets. Rescue closets are fairly basic and only consist a room containing three info_survivor_rescue entities with a prop_door_rotating to enter or exit by.

The safe house and changing levels

Each campaign is divided into several chapters marked off by safe rooms, which are checkpoints where players can heal, re-arm, and dead players can return if they weren't already rescued.

To start with, well add another "prop_door_rotating_checkpoint" entity for the safe houses entrance. This one is set up a bit different then the last one. Open its properties and set the name to "checkpoint_entrance", the "body" property to "0", the "Spawn Position" to "Open Forward" (spawnpos keyvalue 1), the "world model" to "models/props_doors/checkpoint_door_02.mdl", and the make sure the "Starts Open" flag is checked.

Lastly, well set up the transition from one map to the next using another info_landmark and a trigger_changelevel.

First add the info_landmark, the open it's properties and name it "landmark_2". Now create a large brush to cover the floorspace inside the safehouse and tie it to the trigger_changelevel entity, make sure the brush comes in contact with the floorspace inside the room (doesn't necessarily have to overlap the floor space, but it does have to at least touch it). Open the changelevel's properties and set the landmark name to the one we just created, "landmark_2" and for the "next map" property, enter "map_02".

Building a navigation mesh

For survivor bots and infected to be able to move, you will need to create a navigation mesh ("mapname.nav" file) for your map. To build a basic mesh you need to have the map already compile and loaded, then open up the console in game and type the following:

sv_cheats 1
nav_edit 1
nav_mark_walkable
nav_generate

The map will be reloaded after you type nav_generate

After running nav_generate we no longer have the nav error message on the screen when the map loads. With nav_edit 1 still enabled, lets take a look at what nav_generate did. Open the console and type:

select_with_attribute DOOR
Notice the 4 nav squares that were highlighted, this tells the bot AI there is a door in this location.
select_with_attribute CHECKPOINT
select_with_attribute RESCUE_CLOSET
select_with_attribute ESCAPE_ROUTE