Ladders: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(Rewrote the entire article to correct a lot of things. Enjoy.)
Line 1: Line 1:
{{abstract mapping}}__NOTOC__
{{abstract mapping}}__NOTOC__
{{hl2}} [[Ladders]] in [[Source]] games are more complex than those of earlier games, but they provide better control for the level designer and player alike.  [[Ladders]] in [[Counter-Strike: Source]] are implemented differently than those in [[Half-Life 2]] and other mods. See [[#Counter-Strike/DoD: Source Method|below]] for [[Counter-Strike: Source]] [[ladder]] implementation.
{{hl2}} How ladders are created depends on which [[Source]] game they are intended for. Ladders in [[Half-Life 2]] and [[Half-life 2: Deathmatch]] are created a little differently than those of earlier games to provide better control for the level designer and player alike, while ladders in [[Counter-Strike: Source]] and [[Day of Defeat: Source]] are implemented pretty much the same way as the older games.
For how to create ladders for [[Counter-Strike: Source]] and [[Day of Defeat: Source]], see [[#Counter-Strike/DoD: Source Method|below]].


=Half-Life 2/DM Method=
=Ladders for Half-Life 2/DM=


To create a [[ladder]] you must define the volume in which the player will move through space while on the [[ladder]]. This includes a starting and end position. The volume is described via the <code>func_useableladder</code> entity. The entity has two positions: a starting point and an ending point <i>(See Fig. 1a)</i> . These can be typed into the key-value fields, or more typically the ladder can be defined by using the visual ladder tool, visible when the entity is selected (it's the center circle) <i>(See Fig. 1b)</i> . Using this tool you can drag the start and end point of the ladder into appropriate positions in the 2D view. The ladder's start and ending point may be of arbitrary orientation and length <i>(See Fig. 1c)</i>. Simply pull the endpoints where you want them and the player will move between these points while on the ladder. Watch out that the ladder volume does not touch any models or brushes otherwise it will not be usable.
To create a ladder you must define the volume in which the player will move through space while on the ladder. This volume can be defined in two ways: Using the <code>func_useableladder</code> entity, or using the now obsolete <code>func_ladderendpoint</code> entity (which is only briefly described below to provide understanding of the workings of older maps).
 
The <code>func_useableladder</code> entity can be divided into two sub entities: a starting point and an ending point <i>(See Fig. 1a)</i> . Their positions can be typed into the key-value fields, or more typically the ladder volume can be defined using the visual ladder tool, by dragging its center circle that is visible when the entity is selected <i>(See Fig. 1b)</i> . Using this tool you can drag the start and end point of the ladder into appropriate positions in the 2D view. The ladder's start and ending point may be of arbitrary orientation and length <i>(See Fig. 1c)</i>. Simply pull the endpoints where you want them and the player will move between these points while on the ladder.


{| border=0 cellspacing=0 cellpadding=0
{| border=0 cellspacing=0 cellpadding=0
| [[Image:hammer_ladders1.jpg|frame|left|Fig. 1a - Ladder points]]
| [[Image:hammer_ladders1.jpg|frame|left|Fig. 1a - Ladder points (using two (now obsolete) func_ladderendpoints)]]
| [[Image:hammer_ladders2.jpg|frame|left|Fig. 1b - Changing orientation]]
| [[Image:hammer_ladders2.jpg|frame|left|Fig. 1b - Changing orientation]]
| [[Image:hammer_ladders3.jpg|frame|left|Fig. 1c - Slanted ladder points]]
| [[Image:hammer_ladders3.jpg|frame|left|Fig. 1c - Slanted ladder points]]
|}
|}


The ladder's volume must be clear of obstructions. If a solid brush surfaces passes through the space you define, the ladder may not be climbable.
As you place the endpoints, make sure that you place them a couple of units away from the visible ladder brush (or any other brush or model) because if any four sides of the ladder volume is even touching against a surface of a brush or a model, this will make that part of the ladder volume unclimbable.
 
The now obsolete <code>func_ladderendpoint</code> entity just consists of a single endpoint. A ladder volume is created by linking two <code>func_ladderendpoint</code>s together using their properties. A ladder volume is created between two <code>func_ladderendpoint</code>s by naming one of the endpoints and having the other endpoint point to its name in its <i>Other</i> value. (It is not neccessary for the second endpoint to point back at the first as stated in properties.)
 
==Dismounts==


[[Image:hammer_ladders4.jpg|frame|left|Fig. 1d - Dismounts]]
[[Image:hammer_ladders4.jpg|frame|left|Fig. 1d - Dismounts]]


Along with the volume of movement, the ladder also needs "dismount" points (See Fig. 1d). These points are defined using the <code>info_ladderdismount</code> or <code>func_ladderendpoint</code> entity. These are markers in space that define where a player can exit a ladder from. They are most easily thought of as hints to good positions to place the player in. When a player reaches the top or bottom of a ladder, the code attempts to find the nearest dismount point to where the player is standing and in the direction the player is looking. If there is a dismount point within a certain threshold tolerance, the player will automatically dismount the ladder and move onto that dismount point. The entity has a keyvalue field called <i>LadderName</i> which holds the name of the ladder it is used by. Like the ladder volume, the dismount points must be free of obstruction and allow the player to stand at their position without intersecting solid world geometry.
Along with the volume of movement, you can also provide dismount points for the ladder (See Fig. 1d) to allow easier and more controlled dismounts. These points are marked using the <code>info_ladder_dismount</code> entity. While next to and facing one of these markers, the player can press his use key to dismount to the position of the marker (typically when ladders run between more than two floors). If he has reached one of the ends of the ladder, he can also simply walk off the ladder by facing one of the markers nearby and walking forward.
You can use multiple <code>info_ladder_dismount</code> markers for each dismount place to provide more directions to exit the ladder in.
 
To avoid possible confusion between nearby ladders using different dismount markers, each <code>info_ladder_dismount entity</code> has a property value called <i>LadderName</i> which can be used to contain the name of the ladder it belongs to.
 
Like the ladder volume, the dismount points must be free of obstruction and allow the player to stand at their position without intersecting solid world geometry.


Generally these are best placed around the base of the ladder from center, left and right.<br style="clear:both" />


==Testing==


Once the <code>func_useableladder</code> entity and its <code>info_ladderdismount</code> points have been placed, you can compile your map and test them. Using the <code>sv_showladders</code> console command, you can cause the engine to draw debugging information about the ladder system (Note: You'll have to restart a map if one is already running when you enable this console command). This information will show you the start and end points of the ladder, as well as the dismount points <i>(See Fig. 2a)</i>.
==In-game Testing==


If any of these entities is not setup properly (commonly due to interpentration with solid world geometry or the prop model of the ladder itself), it will display this. <i>(See Fig. 2b)</i>.
Once you have created your ladders, you can compile your map and test them. If you wish, you can also display the ladder entities in-game along with some debug information by opening the console and typing <code>sv_showladders 1</code> to enable this, and then load or reload (by typing <code>restart</code>) the map you wish to view.
This will show you all the start and end points of the ladders (<code>func_useableladder</code> and <code>func_ladderendpoint</code> entities), as well as the dismount points (<code>info_ladder_dismount</code> entities) <i>(See Fig. 2a)</i>, and can help you determine if these entities are set up properly, if ladder entities are colliding with solid world geometry or the prop model of the ladder itself <i>(See Fig. 2b)</i>, and which <code>func_ladderendpoint</code> entities connect to eachother.


{| border=0 cellspacing=0 cellpadding=0
{| border=0 cellspacing=0 cellpadding=0
| [[Image:hammer_ladders5.jpg|frame|left|Fig. 2a - In-game visualization]]
| [[Image:hammer_ladders5.jpg|frame|left|Fig. 2a - In-game visualization (<code>sv_showladders 1</code>)]]
| [[Image:hammer_ladders6.jpg|frame|left|Fig. 2b - End point stuck in floor]]
| [[Image:hammer_ladders6.jpg|frame|left|Fig. 2b - Endpoint stuck in floor]]
|}
|}


=Counter Strike:Source and Day of Defeat:Source Method=
==How Ladders Work In-game==
To create a ladder for a CS:S mod, create a prop_static with a ladder model (props_c17). You can also create a brush-based ladder using a simple brush and a ladder texture. In front of the object/brush you want to be climbable, create another brush as close as you can to it, but without touching. Make sure the face is the same width/height as the climbable object. Assign the material '''tools/toolsinvisibleladder''' to this brush and then hit CTRL+T to create an entity. Select func_ladder from the Object Properties dialog. You now have a climbable face which is in front of the object/brush. This gives the illusion that you are climbing the model ladder, where in fact you are scaling the invisible ladder entity just in front of it.  
 
The safest way to mount a ladder in Half-life 2 is to approach its invisible ladder volume and within reaching distance press the use key. This will automatically position you on the ladder. (You can also walk into the ladder volume, with greater risc of missing it and falling down any hole.)
 
To dismount a ladder you can always either jump off, or press your use key. If the ladder has <code>info_ladder_dismount</code>s, you can also simply walk off from its endpoints, and pressing your use key while next to and facing an <code>info_ladder_dismount</code> will also allow more controlled dismounts anywhere on the ladder.
 
=Ladders for Counter Strike: Source and Day of Defeat: Source=
To create a ladder for these games, either create a prop_static with a ladder model (like props_c17) or create a brush-based ladder using a simple brush and a ladder texture. In front of the object/brush you want to be climbable, create another brush as close as you can to it, but without touching. Make sure the face is the same width/height as the climbable object. Assign the material '''tools/toolsinvisibleladder''' to this brush and then tie it to an entity (CTRL+T). Select <code>func_ladder</code> from the Object Properties dialog. You now have a climbable face which is in front of the object/brush. This gives the illusion that you are climbing the model ladder, where in fact you are scaling the invisible ladder entity just in front of it.


{| border=0 cellspacing=0 cellpadding=0
{| border=0 cellspacing=0 cellpadding=0

Revision as of 16:03, 27 January 2006

Template:Abstract mapping Half-Life 2 How ladders are created depends on which Source game they are intended for. Ladders in Half-Life 2 and Half-life 2: Deathmatch are created a little differently than those of earlier games to provide better control for the level designer and player alike, while ladders in Counter-Strike: Source and Day of Defeat: Source are implemented pretty much the same way as the older games. For how to create ladders for Counter-Strike: Source and Day of Defeat: Source, see below.

Ladders for Half-Life 2/DM

To create a ladder you must define the volume in which the player will move through space while on the ladder. This volume can be defined in two ways: Using the func_useableladder entity, or using the now obsolete func_ladderendpoint entity (which is only briefly described below to provide understanding of the workings of older maps).

The func_useableladder entity can be divided into two sub entities: a starting point and an ending point (See Fig. 1a) . Their positions can be typed into the key-value fields, or more typically the ladder volume can be defined using the visual ladder tool, by dragging its center circle that is visible when the entity is selected (See Fig. 1b) . Using this tool you can drag the start and end point of the ladder into appropriate positions in the 2D view. The ladder's start and ending point may be of arbitrary orientation and length (See Fig. 1c). Simply pull the endpoints where you want them and the player will move between these points while on the ladder.

Fig. 1a - Ladder points (using two (now obsolete) func_ladderendpoints)
Fig. 1b - Changing orientation
Fig. 1c - Slanted ladder points

As you place the endpoints, make sure that you place them a couple of units away from the visible ladder brush (or any other brush or model) because if any four sides of the ladder volume is even touching against a surface of a brush or a model, this will make that part of the ladder volume unclimbable.

The now obsolete func_ladderendpoint entity just consists of a single endpoint. A ladder volume is created by linking two func_ladderendpoints together using their properties. A ladder volume is created between two func_ladderendpoints by naming one of the endpoints and having the other endpoint point to its name in its Other value. (It is not neccessary for the second endpoint to point back at the first as stated in properties.)

Dismounts

Fig. 1d - Dismounts

Along with the volume of movement, you can also provide dismount points for the ladder (See Fig. 1d) to allow easier and more controlled dismounts. These points are marked using the info_ladder_dismount entity. While next to and facing one of these markers, the player can press his use key to dismount to the position of the marker (typically when ladders run between more than two floors). If he has reached one of the ends of the ladder, he can also simply walk off the ladder by facing one of the markers nearby and walking forward. You can use multiple info_ladder_dismount markers for each dismount place to provide more directions to exit the ladder in.

To avoid possible confusion between nearby ladders using different dismount markers, each info_ladder_dismount entity has a property value called LadderName which can be used to contain the name of the ladder it belongs to.

Like the ladder volume, the dismount points must be free of obstruction and allow the player to stand at their position without intersecting solid world geometry.


In-game Testing

Once you have created your ladders, you can compile your map and test them. If you wish, you can also display the ladder entities in-game along with some debug information by opening the console and typing sv_showladders 1 to enable this, and then load or reload (by typing restart) the map you wish to view. This will show you all the start and end points of the ladders (func_useableladder and func_ladderendpoint entities), as well as the dismount points (info_ladder_dismount entities) (See Fig. 2a), and can help you determine if these entities are set up properly, if ladder entities are colliding with solid world geometry or the prop model of the ladder itself (See Fig. 2b), and which func_ladderendpoint entities connect to eachother.

Fig. 2a - In-game visualization (sv_showladders 1)
Fig. 2b - Endpoint stuck in floor

How Ladders Work In-game

The safest way to mount a ladder in Half-life 2 is to approach its invisible ladder volume and within reaching distance press the use key. This will automatically position you on the ladder. (You can also walk into the ladder volume, with greater risc of missing it and falling down any hole.)

To dismount a ladder you can always either jump off, or press your use key. If the ladder has info_ladder_dismounts, you can also simply walk off from its endpoints, and pressing your use key while next to and facing an info_ladder_dismount will also allow more controlled dismounts anywhere on the ladder.

Ladders for Counter Strike: Source and Day of Defeat: Source

To create a ladder for these games, either create a prop_static with a ladder model (like props_c17) or create a brush-based ladder using a simple brush and a ladder texture. In front of the object/brush you want to be climbable, create another brush as close as you can to it, but without touching. Make sure the face is the same width/height as the climbable object. Assign the material tools/toolsinvisibleladder to this brush and then tie it to an entity (CTRL+T). Select func_ladder from the Object Properties dialog. You now have a climbable face which is in front of the object/brush. This gives the illusion that you are climbing the model ladder, where in fact you are scaling the invisible ladder entity just in front of it.

In the image above you can see the (static) prop ladder placed against a brush.

In front of the prop ladder is the func_ladder textured with tools/toolsinvisibleladder.

  • There are 5 types of ladders for CS:S in this example: LaddersCSS.zip (7k)
  • While on a ladder in CS:S your shooting accuracy will be significantly reduced.