Working Ladders

From Valve Developer Community
< Zh
Jump to navigation Jump to search
English (en)Deutsch (de)Español (es)한국어 (ko)Polski (pl)Русский (ru)中文 (zh)Translate (Translate)
Info content.png
This page has not been fully translated.

You can help by finishing the translation.

Also, please make sure the article tries to comply with the alternate languages guide.

注意: 此页面正在翻译

简介

在所有的 Source(en) 游戏里 (除了 Team Fortress 2(en)Portal 2(en),这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.

梯子道具/笔刷

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

攀爬系统

How the ladder's climbing system is created depends on which Source game it is intended for. Ladders in Half-Life 2(en) and Half-Life 2: Deathmatch(en) 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(en) and Day of Defeat: Source(en) 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.

半条命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 in two ways: Using the func_useableladder(en) entity, or using the deprecated func_ladderendpoint(en) 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 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.

Fig. 1a - Ladder points (using two 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 necessary for the second endpoint to point back at the first as stated in properties.)

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(en) 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. 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.

Fig. 3a - In-game visualization (sv_showladders 1)
Fig. 3b - 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 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 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.

反恐精英:起源, 胜利之日:起源和盖瑞模组(gmod)的梯子

在你想要攀爬的物体/固体前面创建另一个固体,尽可能靠近它,但不要接触它。确保面与可攀爬物体的宽度/高度相同。将材质tools / toolsinvisibleladder应用于此固体,然后将其转换为实体(CTRL + T)。从“对象属性”对话框中的实体代码栏中选择func_ladder(en)。现在你有一个可攀爬的梯子,位于物体/固体的前面

Fig. 4 - func_ladder(en) textured with tools/toolsinvisibleladder in front of a prop_static(en) ladder.

While on a ladder in CS:S your shooting accuracy will be significantly reduced.

The similar ladders using in Half-Life 1, but there is AAATRIGGER texture used instead of tools/toolsinvisibleladder.

Ladders for Counter Strike: Global Offensive

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.

Fig. 5 - World Brush(en) textured with 'tools/toolsinvisibleladder' in front of a prop_static(en) ladder.

Note that you MUST NOT tie it to a func_ladder(en), just leave it as a world brush You now have a climbable face which is in front of the object/brush.

求生之路1和求生之路2的梯子

阅读并参考教程,去创建求生之路1和求生之路2的梯子:

Optimizing Ladders

The ladder props, like every prop_static, default to using VPhysics(en) 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.
  • 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).
  • 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.

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(en) 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.

If nothing else, you could turn a brush ladder into a func_detail(en) to avoid unnecessary brush leafs.

Examples

HL2/HL2:DM

CS:S/DoD:S

See also