这篇条目有关 Source引擎。如需详情,点击这里。

Zh/Working ladders: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
m (SirYodaJedi moved page Zh/Working Ladders to Zh/Working ladders)
No edit summary
Line 1: Line 1:
{{lang|Working Ladders}}
{{LanguageBar|Working Ladders}}{{source topicon}}
{{tabsBar|main=gs2|base=Working ladders}}
{{back | Category: Level Design | Level Design}}
{{toc-right}}
{{Finishtranslation}}
{{Finishtranslation}}
注意:
此页面正在翻译
== 简介 ==
在所有的 {{L|Source}} 游戏里 (除了 {{L|Team Fortress 2}} 和 {{L|Portal 2}},这2款游戏没有梯子) a ladder in-game consists of the prop or brush that the player perceives as the ladder, and the invisible entity/brush system in front of it that actually makes the ladder climbable. This gives the illusion that the player is climbing the visible ladder, where in fact he is scaling the invisible ladder entity/brush just in front of it.


=== 梯子道具/笔刷 ===
在'''大多数'''{{src|4}}引擎制作的游戏中(伴有少数例外),游戏中一个由{{L|Prop|道具}}或{{L|Brush|笔刷}}组成的可见梯子模型会被玩家视作梯子,而在梯子模型前的不可见{{L|Entity|实体}}或{{L|Brush|笔刷}}则使其真正意义上可供攀爬。这使人认为玩家所爬之物为可见的梯子模型,而不是真正提供攀爬能力的不可见{{L|Entity|实体}}或{{L|Brush|笔刷}}。若要创建一个可见的梯子模型(若要使其可供攀爬,请看下文点实体梯子/笔刷梯子的部分),你可以使用:
* 一个具有梯子模型(例如<tt>models/props_c17/metalladder001.mdl</tt>)的{{ent|prop_static}}实体。
* 一个具有梯子纹理(例如<tt>metal/metalladder001a</tt>)的{{L|Brush}}。
一个梯子的攀爬系统的差异取决于不同{{src|4}}引擎游戏的需要。在{{hl2|2}}及{{hl2dm|2}}中梯子 are created a little differently than those of earlier games to provide better control for the level designer and player alike, while ladders in {{css|2}}, {{dods|2}}, and most multiplayer Source games are implemented pretty much the same way as {{hl1|2}} and {{quake2|2}}.


要创建一个可见的梯子,你可以创建一个模型是梯子模型(类似''models/props_c17\metalladder001.mdl'')的 {{L|prop_static}} 或者创建一个以为基础、材质为梯子材质(类似 ''metal/metalladder001a'')的梯子。
{{clr}}


=== 攀爬系统 ===
== Point entity ladders ==
How the ladder's climbing system is created depends on which Source game it is intended for. Ladders in {{L|Half-Life 2}} and {{L|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 {{L|Counter-Strike: Source}} and {{L|Day of Defeat: Source}} are implemented pretty much the same way as the older games.
===Creating the ladder===
For how to create ladders for Counter-Strike: Source and Day of Defeat: Source, see [[#Ladders_for_Counter_Strike:_Source_and_Day_of_Defeat:_Source|below]].
:''Used in:'' {{hl2series|4}}, {{sineps|4}}, {{dmmm|4}}


== 半条命2系列里的梯子实体 / 半条命2 死亡竞赛 ==
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 using the {{ent|func_useableladder}} entity. (there is also obsolete {{ent|func_ladderendpoint}} which might be encountered in older maps).


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 {{L|func_useableladder}} entity, or using the deprecated {{L|func_ladderendpoint}} entity (which is only briefly described below to provide understanding of the workings of older maps).
The <tt>func_useableladder</tt> 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 keyvalue 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 points of the ladder into appropriate positions in the 2D view. The ladder's start and ending points 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.
 
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 keyvalue 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.


{| border=0 cellspacing=0 cellpadding=0
{| border=0 cellspacing=0 cellpadding=0
| [[File:hammer_ladders1.jpg|frame|left|Fig. 1a - Ladder points (using two <code>func_ladderendpoint</code>s)]]
| [[File: hammer_ladders1.jpg | thumb | left | 200px | Fig. 1a - Ladder points]]
| [[File:hammer_ladders2.jpg|frame|left|Fig. 1b - Changing orientation]]
| [[File: hammer_ladders2.jpg | thumb | left | 225px | Fig. 1b - Changing orientation]]
| [[File:hammer_ladders3.jpg|frame|left|Fig. 1c - Slanted ladder points]]
| [[File: hammer_ladders3.jpg | thumb | left | 240px | 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.
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 are 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 necessary for the second endpoint to point back at the first as stated in properties.)


=== Dismounts ===
=== Dismounts ===
[[File: hammer_ladders4.jpg | thumb | left | Fig. 2 - Dismounts]]


[[File:hammer_ladders4.jpg|frame|left|Fig. 2 - Dismounts]]
Along with the volume of movement, you can also provide dismount points for the ladder (''see Fig. 2'') to allow easier and more controlled dismounts. These points are marked using the {{ent|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 <tt>info_ladder_dismount</tt> markers for each dismount place to provide more directions to exit the ladder in.


Along with the volume of movement, you can also provide dismount points for the ladder ''(See Fig. 2)'' to allow easier and more controlled dismounts. These points are marked using the {{L|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.
To avoid possible confusion between nearby ladders using different dismount markers, each <tt>info_ladder_dismount</tt> entity has a property value called <tt>LadderName</tt>, which can be used to contain the name of the ladder it belongs to.
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.<br style="clear:left;"/>


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.<br style="clear:left;"/>
{{clr}}


=== In-game testing ===
=== 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 <code>sv_showladders 1</code> to enable this, and then load or reload (by typing <tt>restart</tt>) the map you wish to view.
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 (<tt>func_useableladder</tt> entities), as well as the dismount points (<tt>info_ladder_dismount</tt> entities; ''see Fig. 3a''). It can also 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. 3b'').
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. 3a)'', 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. 3b)'', and which func_ladderendpoint entities connect to each other.


{| border=0 cellspacing=0 cellpadding=0
{| border=0 cellspacing=0 cellpadding=0
| [[File:hammer_ladders5.jpg|frame|left|Fig. 3a - In-game visualization (<code>sv_showladders 1</code>)]]
| [[File: hammer_ladders5.jpg | thumb | left | 195px | Fig. 3a - In-game visualization]]
| [[File:hammer_ladders6.jpg|frame|left|Fig. 3b - Endpoint stuck in floor]]
| [[File: hammer_ladders6.jpg | thumb | left | 200px | Fig. 3b - Endpoint stuck in floor]]
|}
|}


=== How ladders work in-game ===
=== How ladders work in-game ===
The safest way to mount a ladder 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 risk of missing it and falling down any holes.)


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 risk 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 <tt>info_ladder_dismount</tt>s, you can also simply walk off from its endpoints, and pressing your use key while next to and facing an <tt>info_ladder_dismount</tt> will also allow more controlled dismounts anywhere on the ladder.


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.
== Brush ladders ==
=== Object-brush–based ladders===
[[File: Cssladderprop01a.png | thumb | right | Fig. 4 - {{ent|func_ladder}} textured with <tt>tools/toolsinvisibleladder</tt> in front of a {{ent|prop_static}} ladder.]]
[[File: Func_ladder_Sideways_Dismount.png | thumb | right | Example of a ladder top that dismounts to the side, showing that the top of the ladder is 56 units above the new floor you dismount to.]]


== 反恐精英:起源, 胜利之日:起源和盖瑞模组(gmod)的梯子 ==
:''Used in:'' {{l4dseries|4}}, {{css|4}}, {{dods|4}}, {{Gmod|4}}, {{vtmb|4}}, {{ship|4}}, {{bms|4}}, {{hls|4}}, {{jbep3|4}}


在你想要攀爬的物体/固体前面创建另一个固体,尽可能靠近它,但不要接触它。确保面与可攀爬物体的宽度/高度相同。将材质'''tools / toolsinvisibleladder'''应用于此固体,然后将其转换为实体(CTRL + T)。从“对象属性”对话框中的实体代码栏中选择{{L|func_ladder}}。现在你有一个可攀爬的梯子,位于物体/固体的前面
Create another brush in front of the object/brush you want to be climbable, as close as you can to it, but without touching it. Make sure that the face is the same width/height as the climbable object. Assign the material {{ent|Tool textures|alt=tools/toolsinvisibleladder}} to this brush, then tie it to an entity (via {{key|Ctrl|T}}). Select {{ent|func_ladder}} from the Object Properties dialog. You now have a climbable face in front of the object/brush. While on a ladder in ''Counter-Strike: Source'', your shooting accuracy will be significantly reduced.


{| border=0 cellspacing=0 cellpadding=0
Ladders can also be dismounted sideways. For example, climbing a ladder that dismounts to the left side of the ladder prop, as opposed to climbing over the <tt>func_ladder</tt> brush.<br>
| [[File:Cssladderprop01a.png|frame|left|Fig. 4 - {{L|func_ladder}} textured with '''tools/toolsinvisibleladder''' in front of a {{L|prop_static}} ladder.]]
Those ladders should have the ladder brush extend about 56 units above the floor it will dismount to, but not touch any roof above the ladder.<br>
|}
If the <tt>func_ladder</tt> does not reach high enough, you cannot dismount onto the floor and fall down instead. If the <tt>func_ladder</tt> comes too close to a roof, or any solid prop above, the AI will stick to that roof/prop, because AI always climbs to the very top of a ladder and won't think about when dismounting makes most sense.
 
{{tip|If the [[developer console]] complains about an unknown [[info_ladder]] entity when loading the map in-game, use the [[#Non-Object Brush-Based Ladders|CSGO method for creating ladders]] instead to avoid cutting [[visleaves]].}}
{{important|Leave at least a unit gap between the ladder and any detail brushes to prevent it from eating brush faces. This is not an issue in {{Left 4 Dead series}}, which keeps brush ladders as a separate entity.}}
{{note|
* Any texture can be used on func_ladder; VBSP automatically assigns ladder contents to func_ladder brushes. Any faces that would normally be rendered will still be visible in-game. (for example, {{vtmb}} ladders use the <tt>tools/toolsinvisible</tt> texture.)
* Ladders that touch each other will be turned into one single ladder. If you need to block navigation on one ladder, it would block navigation on both ladders. Add gaps between ladders.
* [[L4D_Level_Design/Versus_Maps#Making_Infected_Ladders_Visible|Infected-only ladders]] in the {{L4dseries|2}} use the <tt>tools/climb_versus</tt> texture. Ladders that are accessible to both survivors/infected teams may simply use [[Working_Ladders#Non-Object_Brush-Based_Ladders|non-object brush based ladders]]. See also how to [[L4D_Level_Design/Ladders|create ladders for the ''Left 4 Dead'' series.]]
}}
{{bug|hidetested=1|If the brush crosses any water surfaces, the player interacting with it can exhibit weird behavior, teleport the player while in the water to the end of the ladder. This has been encountered in a partial submersion of the ladder brush.{{todo|In what circumstances exactly does it happen?}} }}
{{clr}}
 
===Non-object brush-based ladders===
[[File: CSGO_Ladder.PNG | thumb | 300px | right | {{ent|func_detail}} textured with <tt>tools/toolsinvisibleladder</tt> in front of a {{ent|prop_static}} ladder.]]


While on a ladder in CS:S your shooting accuracy will be significantly reduced.
:''Used in:'' {{INFRA|4}}, {{CSGO|4}}
:''Also works in:'' {{css|4}}, {{dods|4}}, {{gmod|4}}, {{hls|4}}


The similar ladders using in Half-Life 1, but there is '''AAATRIGGER''' texture used instead of '''tools/toolsinvisibleladder'''.
This ladder type is set up and works in exactly the same way as object brush ladders, but it shouldn't be tied to a <tt>func_ladder</tt> entity, or it will make the ladder nonexistent in-game. To make it, create a brush in front of the object/brush you want to be climbable, as close as you can to it but without touching it.  


== Ladders for Counter Strike: Global Offensive ==
Make sure that the face is the same width/height as the climbable object and then assign the material <tt>tools/toolsinvisibleladder</tt> to this brush. You now have a climbable face which is in front of the object/brush. No other setup is required for your ladder to work in game.
Create a brush in front of the object/brush you want to be climbable, as close as you can to it, but without touching it. Make sure that the face is the same width/height as the climbable object. Assign the material 'tools/toolsinvisibleladder' to this brush.  


{| border=0 cellspacing=0 cellpadding=0
{{important|
| [[File:CSGO_Ladder.PNG|thumb|600px|left|Fig. 5 - {{L|Brush|World Brush}} textured with 'tools/toolsinvisibleladder' in front of a {{L|prop_static}} ladder.]]
* Since <tt>tools/toolsinvisibleladder</tt> still cuts [[visleafs]], make sure to tie the ladder brush to a <tt>func_detail</tt> or other brush entity.
|}
* Leave at least a unit gap between the ladder and any detail brushes to prevent it from eating brush faces.
}}
{{tip|
* Any brush texture can be made climbable by adding the {{cmd|%CompileLadder}} compile parameter.
* toolsinvisibleladder and any other %CompileLadder material will make the entire brush act like a ladder, even if it is only on a single face of the brush. Other faces of the brush will still show their textures in game.
* If only one side of the brush should be climbable, then the {{mono|ladder}} [[$surfaceprop]] can be used instead (tested in {{css}}; may not work in all games. Some games also have a {{mono|woodladder}} $surfaceprop for different climbing sounds).
* In games where non-object brush based ladders work, models with [[collision mesh]]es can be made climbable like ladders by using the {{cmd|$contents|"ladder"}} [[QC command]].}}
{{clr}}


Note that you '''MUST NOT''' tie it to a {{L|func_ladder}}, just leave it as a world brush You now have a climbable face which is in front of the object/brush.
=== Brush-based ladder workaround ===
[[File:TF2 ladder.png|thumb|left|300px|A series of small <tt>toolsclip</tt> blocks will replicate a ladder without requiring ladder entities.]]
''Used in:'' {{tf2|4}}, {{portal2|4}}


== 求生之路1和求生之路2的梯子 ==
Some Source games do not support the standard ladder entity; however, it is possible to fake a ladder by creating a very narrow staircase.
阅读并参考教程,去创建求生之路1和求生之路2的梯子:
*{{L|L4D_Level_Design/Ladders|Creating Ladders for the Left 4 Dead series}}
*[[L4D_Level_Design/Versus_Maps#Making_Infected_Ladders_Visible|Creating Infected only Ladders]]


== Optimizing Ladders ==
To start off, make a <tt>prop_static</tt> and set the world model to <tt>models/props_c17/metalladder002.mdl</tt> or similar. You can also make a ladder prop out of brushes or use a ladder texture on a single brush face.
The ladder props, like every prop_static, default to using {{L|VPhysics}} for collision detection, which will provide more detailed physics collisions, but in some cases this might not be preferable. In multiplayer maps and very resource demanding maps using VPhysics props costs precious resources, and you might want to sacrifice good physics to avoid potential lag. Here are some good methods to minimize resource cost:


*If the ladder is for HL2 or HL2:DM, and the ladder is straight, the best method depends on whether somebody is going to be able to shoot through the ladder. If they are not (like if the ladder is against a wall) you could simply change the ''Collisions'' keyvalue to ''Use Bounding Box''. If they are, you could change the keyvalue to ''Not Solid'' and place an invisible Clip (''toolsclip'') to detect collision with it instead.
Next, create a brush 16 units high using a [[clip texture]]. Use the clip brushes to make a stack of blocks, making sure each higher block is one unit "behind" the lower one. The players will climb these 16-unit-high brushes as stairs. To keep them from going too far out once you reach the bottom select the no clip blocks group them and then compress them as long as the top step sticks out past where the prop ends and each block still has a small lip it will work just fine. There you have it—a good-looking, climbable ladder.


*If you are creating a slanting ladder for HL2 or HL2:DM, a bounding box will not rotate with the prop, and will obstruct the climbing system, in which case you are better off making the ladder prop ''Not Solid'' and place an invisible, rotated Clip (''toolsclip'') or Player Clip (''toolsplayerclip'') textured brush alongside the ladder (depending on whether or not somebody is going to be able to shoot through it).
Video Showing how to create it: [https://www.youtube.com/watch?v=58YF5OXVYgQ TF2 mapping: Ladders in TF2]


*If the ladder is for a CS:S or DoD:S map, you could change the ''Collisions'' keyvalue to ''Not Solid'' and make the func_ladder brush cover the ladder prop, rotating it if necessary.
{{important|Ladders made this way can be climbed up, but not down. Consider placing water at the bottom of the ladder to cushion the landing.}}
{{clr}}


In multiplayer maps it's also an understood expectation to be able to move freely parallel to the surface that a ladder covers. When it comes to brush based ladders, you can get away with turning the ladder brush into a non-solid {{L|func_brush}} to avoid players getting temporarily "stuck" against the side of the ladder, but when it comes to prop ladders, they are often too protruding from the wall to make a player standing inside a ladder believable. In that case you are probably better off using two Player Clip textured wedges at the sides of the prop, guiding the player to the front of the prop.
== Optimizing ladders ==
The ladder props, like every {{ent|prop_static}}, default to using [[VPhysics]] for collision detection. This will provide more detailed physics collisions, but in some cases this might not be preferable. In multiplayer maps and very resource-demanding maps, using VPhysics props costs precious resources, and you might want to sacrifice good physics to avoid potential lag. Here are some good methods to minimize resource cost:
*If the ladder is for {{Hl2|2}} or {{Hl2dm|2}}, and the ladder is straight, the best method depends on whether somebody is going to be able to shoot through the ladder. If they are not (like if the ladder is against a wall), you could simply change the <tt>Collisions</tt> keyvalue to "Use Bounding Box." If they are, you could change the keyvalue to "Not Solid" and place an invisible Clip brush to detect collision with it instead.
*If you are creating a slanting ladder for {{Hl2|2}} or {{Hl2dm|2}}, a bounding box will not rotate with the prop, and will obstruct the climbing system, in which case you are better off making the ladder prop ''Not Solid'' and place an invisible, rotated Clip- or Player Clip–textured brush alongside the ladder. Alternatively, if not using <tt>prop_static</tt>, you may turn off SmartEdit and set the prop's <tt>solid</tt> keyvalue to 3, which will cause it to use a properly-rotated version of the prop's bounding box.
*If the ladder is for a {{css|2}} or {{dods|2}} map, you could change the <tt>Collisions</tt> keyvalue to "Not Solid" and make the <tt>func_ladder</tt> brush cover the ladder prop, rotating it if necessary.


If nothing else, you could turn a brush ladder into a {{L|func_detail}} to avoid unnecessary brush leafs.
In multiplayer maps, it's also an understood expectation to be able to move freely parallel to the surface that a ladder covers. When it comes to brush based ladders, you can get away with turning the ladder brush into a non-solid {{ent|func_brush}} to avoid players getting temporarily "stuck" against the side of the ladder, but when it comes to prop ladders, they often protrude from the wall too much to make a player standing inside one believable. In that case, you are probably better off using two Player Clip–textured wedges at the sides of the prop, guiding the player to the front of the prop.


== Examples ==
If nothing else, you could turn a brush ladder into a {{ent|func_detail}} to avoid unnecessary visleafs.
=== HL2/HL2:DM ===
*[http://nudel.omega2k3.de/maps/?s=download&act=view&fileID=21 LaddersHL2.zip] (6k)
*{{L|ladder_simple}} - A prefab containing a complete ladder setup.
<!-- SDK nuts has closed. When (and if) these tutorials are ported onto the VDC, please link to them instead!
*[http://www.sdknuts.net/akg/tutorials/wiseladder.asp HL2 Ladders]
-->
=== CS:S/DoD:S ===
*[http://type3studios.com/downloads/tutorials/SdkNutsTutorials/LadderCSS.zip LaddersCSS.zip] (7k)


== See also ==
== See also ==
*{{L|func_useableladder}}
*{{ent|func_useableladder}}
*{{L|func_ladderendpoint}}
*{{ent|info_ladder_dismount}}
*{{L|info_ladder_dismount}}
*{{ent|func_ladder}}
*{{L|func_ladder}}
*[[Brush ladders]] Tutorial on implementing Brush ladders for your Source Engine mod


{{ACategory|Level Design}}
[[Category:Level Design]]
{{ACategory|Tutorials}}
[[Category:Tutorials]]

Revision as of 18:21, 6 September 2025

English (en)Deutsch (de)Español (es)한국어 (ko)Polski (pl)Русский (ru)中文 (zh)Translate (Translate)
Level Design
Info content.png
This page has not been fully translated.
You can help by finishing the translation.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)

大多数起源 起源引擎制作的游戏中(伴有少数例外),游戏中一个由道具(en)笔刷(en)组成的可见梯子模型会被玩家视作梯子,而在梯子模型前的不可见实体(en)笔刷(en)则使其真正意义上可供攀爬。这使人认为玩家所爬之物为可见的梯子模型,而不是真正提供攀爬能力的不可见实体(en)笔刷(en)。若要创建一个可见的梯子模型(若要使其可供攀爬,请看下文点实体梯子/笔刷梯子的部分),你可以使用:

  • 一个具有梯子模型(例如models/props_c17/metalladder001.mdl)的prop_static实体。
  • 一个具有梯子纹理(例如metal/metalladder001a)的Brush(en)

一个梯子的攀爬系统的差异取决于不同起源 起源引擎游戏的需要。在半衰期2 半衰期2半衰期2:死亡竞赛 半衰期2:死亡竞赛中梯子 are created a little differently than those of earlier games to provide better control for the level designer and player alike, while ladders in 反恐精英:起源 反恐精英:起源, 胜利之日:起源 胜利之日:起源, and most multiplayer Source games are implemented pretty much the same way as 半衰期 半衰期 and Quake II Quake II.

Point entity ladders

Creating the ladder

Used in: Half-Life 2 series Half-Life 2 series, SiN Episodes SiN Episodes, Dark Messiah of Might and Magic Dark Messiah of Might and Magic

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 using the func_useableladder entity. (there is also obsolete func_ladderendpoint which might be encountered in 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 keyvalue 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 points of the ladder into appropriate positions in the 2D view. The ladder's start and ending points 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
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 are even touching against a surface of a brush or a model, this will make that part of the ladder volume unclimbable.

Dismounts

Fig. 2 - Dismounts

Along with the volume of movement, you can also provide dismount points for the ladder (see Fig. 2) 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 entities), as well as the dismount points (info_ladder_dismount entities; see Fig. 3a). It can also 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. 3b).

Fig. 3a - In-game visualization
Fig. 3b - Endpoint stuck in floor

How ladders work in-game

The safest way to mount a ladder 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 risk of missing it and falling down any holes.)

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.

Brush ladders

Object-brush–based ladders

Fig. 4 - func_ladder textured with tools/toolsinvisibleladder in front of a prop_static ladder.
Example of a ladder top that dismounts to the side, showing that the top of the ladder is 56 units above the new floor you dismount to.
Used in: 求生之路系列求生之路系列 求生之路系列, 反恐精英:起源 反恐精英:起源, 胜利之日:起源 胜利之日:起源, Garry's Mod Garry's Mod, Vampire: The Masquerade – Bloodlines Vampire: The Masquerade – Bloodlines, The Ship: Murder Party The Ship: Murder Party, 黑山 黑山, 半衰期:起源 半衰期:起源, Jabroni Brawl: Episode 3 Jabroni Brawl: Episode 3

Create another brush in front of the object/brush you want to be climbable, as close as you can to it, but without touching it. Make sure that the face is the same width/height as the climbable object. Assign the material tools/toolsinvisibleladder to this brush, then tie it to an entity (via Ctrl+T). Select func_ladder from the Object Properties dialog. You now have a climbable face in front of the object/brush. While on a ladder in Counter-Strike: Source, your shooting accuracy will be significantly reduced.

Ladders can also be dismounted sideways. For example, climbing a ladder that dismounts to the left side of the ladder prop, as opposed to climbing over the func_ladder brush.
Those ladders should have the ladder brush extend about 56 units above the floor it will dismount to, but not touch any roof above the ladder.
If the func_ladder does not reach high enough, you cannot dismount onto the floor and fall down instead. If the func_ladder comes too close to a roof, or any solid prop above, the AI will stick to that roof/prop, because AI always climbs to the very top of a ladder and won't think about when dismounting makes most sense.

Tip.png提示:If the developer console complains about an unknown info_ladder entity when loading the map in-game, use the CSGO method for creating ladders instead to avoid cutting visleaves.
Icon-Important.png重要:Leave at least a unit gap between the ladder and any detail brushes to prevent it from eating brush faces. This is not an issue in 求生之路系列求生之路系列, which keeps brush ladders as a separate entity.
Note.png注意:
  • Any texture can be used on func_ladder; VBSP automatically assigns ladder contents to func_ladder brushes. Any faces that would normally be rendered will still be visible in-game. (for example, Vampire: The Masquerade – Bloodlines ladders use the tools/toolsinvisible texture.)
  • Ladders that touch each other will be turned into one single ladder. If you need to block navigation on one ladder, it would block navigation on both ladders. Add gaps between ladders.
  • Infected-only ladders in the 求生之路系列求生之路系列 求生之路系列 use the tools/climb_versus texture. Ladders that are accessible to both survivors/infected teams may simply use non-object brush based ladders. See also how to create ladders for the Left 4 Dead series.
Icon-Bug.png错误:If the brush crosses any water surfaces, the player interacting with it can exhibit weird behavior, teleport the player while in the water to the end of the ladder. This has been encountered in a partial submersion of the ladder brush.
待完善: In what circumstances exactly does it happen?

Non-object brush-based ladders

func_detail textured with tools/toolsinvisibleladder in front of a prop_static ladder.
Used in: 基建危机 基建危机, 反恐精英:全球攻势 反恐精英:全球攻势
Also works in: 反恐精英:起源 反恐精英:起源, 胜利之日:起源 胜利之日:起源, Garry's Mod Garry's Mod, 半衰期:起源 半衰期:起源

This ladder type is set up and works in exactly the same way as object brush ladders, but it shouldn't be tied to a func_ladder entity, or it will make the ladder nonexistent in-game. To make it, create a brush in front of the object/brush you want to be climbable, as close as you can to it but without touching it.

Make sure that the face is the same width/height as the climbable object and then assign the material tools/toolsinvisibleladder to this brush. You now have a climbable face which is in front of the object/brush. No other setup is required for your ladder to work in game.

Icon-Important.png重要:
  • Since tools/toolsinvisibleladder still cuts visleafs, make sure to tie the ladder brush to a func_detail or other brush entity.
  • Leave at least a unit gap between the ladder and any detail brushes to prevent it from eating brush faces.
Tip.png提示:
  • Any brush texture can be made climbable by adding the %CompileLadder compile parameter.
  • toolsinvisibleladder and any other %CompileLadder material will make the entire brush act like a ladder, even if it is only on a single face of the brush. Other faces of the brush will still show their textures in game.
  • If only one side of the brush should be climbable, then the ladder $surfaceprop can be used instead (tested in 反恐精英:起源; may not work in all games. Some games also have a woodladder $surfaceprop for different climbing sounds).
  • In games where non-object brush based ladders work, models with collision meshes can be made climbable like ladders by using the $contents "ladder" QC command.

Brush-based ladder workaround

A series of small toolsclip blocks will replicate a ladder without requiring ladder entities.

Used in: 军团要塞2 军团要塞2, 传送门2 传送门2

Some Source games do not support the standard ladder entity; however, it is possible to fake a ladder by creating a very narrow staircase.

To start off, make a prop_static and set the world model to models/props_c17/metalladder002.mdl or similar. You can also make a ladder prop out of brushes or use a ladder texture on a single brush face.

Next, create a brush 16 units high using a clip texture. Use the clip brushes to make a stack of blocks, making sure each higher block is one unit "behind" the lower one. The players will climb these 16-unit-high brushes as stairs. To keep them from going too far out once you reach the bottom select the no clip blocks group them and then compress them as long as the top step sticks out past where the prop ends and each block still has a small lip it will work just fine. There you have it—a good-looking, climbable ladder.

Video Showing how to create it: TF2 mapping: Ladders in TF2

Icon-Important.png重要:Ladders made this way can be climbed up, but not down. Consider placing water at the bottom of the ladder to cushion the landing.

Optimizing ladders

The ladder props, like every prop_static, default to using VPhysics for collision detection. This will provide more detailed physics collisions, but in some cases this might not be preferable. In multiplayer maps and very resource-demanding maps, using VPhysics props costs precious resources, and you might want to sacrifice good physics to avoid potential lag. Here are some good methods to minimize resource cost:

  • If the ladder is for 半衰期2 半衰期2 or 半衰期2:死亡竞赛 半衰期2:死亡竞赛, and the ladder is straight, the best method depends on whether somebody is going to be able to shoot through the ladder. If they are not (like if the ladder is against a wall), you could simply change the Collisions keyvalue to "Use Bounding Box." If they are, you could change the keyvalue to "Not Solid" and place an invisible Clip brush to detect collision with it instead.
  • If you are creating a slanting ladder for 半衰期2 半衰期2 or 半衰期2:死亡竞赛 半衰期2:死亡竞赛, a bounding box will not rotate with the prop, and will obstruct the climbing system, in which case you are better off making the ladder prop Not Solid and place an invisible, rotated Clip- or Player Clip–textured brush alongside the ladder. Alternatively, if not using prop_static, you may turn off SmartEdit and set the prop's solid keyvalue to 3, which will cause it to use a properly-rotated version of the prop's bounding box.
  • If the ladder is for a 反恐精英:起源 反恐精英:起源 or 胜利之日:起源 胜利之日:起源 map, you could change the Collisions keyvalue to "Not Solid" and make the func_ladder brush cover the ladder prop, rotating it if necessary.

In multiplayer maps, it's also an understood expectation to be able to move freely parallel to the surface that a ladder covers. When it comes to brush based ladders, you can get away with turning the ladder brush into a non-solid func_brush to avoid players getting temporarily "stuck" against the side of the ladder, but when it comes to prop ladders, they often protrude from the wall too much to make a player standing inside one believable. In that case, you are probably better off using two Player Clip–textured wedges at the sides of the prop, guiding the player to the front of the prop.

If nothing else, you could turn a brush ladder into a func_detail to avoid unnecessary visleafs.

See also