Zh/L4D Level Design/Your First L4D Level: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
No edit summary
No edit summary
Line 270: Line 270:
[[Image:l4d_hammer_item_01.jpg|right|frame|caption|从对象列表中选择散弹枪。]]
[[Image:l4d_hammer_item_01.jpg|right|frame|caption|从对象列表中选择散弹枪。]]


Next we'll try placing a pump shotgun on the table in our room and rotating it so that it looks like it's in a natural position.
接下来,我们将尝试在我们房间的桌子上放置一个泵霰弹枪,并旋转它,使它看起来像在一个自然的位置。


Click on the {{Hammer entity}} in the '''Tool''' bar.
在'''工具'''栏里点击{{Hammer entity}}


Select <code>weapon_pumpshotgun_spawn</code> from the drop down menu under '''Objects'''.
从'''对象'''下的下拉菜单中选择<code>weapon_pumpshotgun_spawn</code>


{{clr}}
{{clr}}


[[Image:l4d_hammer_item_02.jpg|right|thumb|300px|caption|Placing the weapon_pumpshotgun_spawn.]]
[[Image:l4d_hammer_item_02.jpg|right|thumb|300px|caption|放置weapon_pumpshotgun_spawn实体。]]


Click on the floor underneath the table prop to place the shotgun entity.
点击桌面下方的地板以放置散弹枪实体。


{{note|In the Camera viewport, entities can only be placed on brush surfaces.}}
{{注意|在镜头视图里,实体只能被放置在笔刷表面。}}


{{clr}}
{{clr}}


[[Image:hammer_rotate1.png|frame|left|Circles at corners indicate that the object is ready to be rotated.]]
[[Image:hammer_rotate1.png|frame|left|角处的圆圈表示对象已准备好旋转。]]
[[Image:hammer_rotate2.png|frame|left|Click & drag a circle in any 2D view to rotate the object.]]
[[Image:hammer_rotate2.png|frame|left|在任何2D视图中单击并拖动圆形以旋转对象。]]


To rotate an object , you simply select the object you wish to rotate using the {{Hammer select}}, then click once on the object. You should see the object surrounded at the corners with circles. Mouse over a circle in any 2D view, then click and drag to rotate the object.
To rotate an object , you simply select the object you wish to rotate using the {{Hammer select}}, then click once on the object. You should see the object surrounded at the corners with circles. Mouse over a circle in any 2D view, then click and drag to rotate the object.

Revision as of 23:28, 29 December 2016

Template:Otherlang2

(译者:ljj)

笔刷是使用Hammer的“固体工具”创建的简单3D造型。笔刷用于在地图里创建大多数大型表面,例如天花板和地板。现在我们将使用笔刷来创建一个简单的房间。

创建一个地板笔刷

绘画一个笔刷。
  1. 在左侧工具栏选择“固体工具”。
  2. 现在,在2D俯视图里左键点击并拖动至右下方(如下图所示)。
  3. 当你拖动时你应该看到一个长方形或正方形的虚线框。
  4. 创建一个512x512个单位的正方形并放开鼠标左键。
  5. 在你的键盘上按 Enter以创建你刚才画的笔刷。

要返回选择模式,在工具栏里点击“选择”图标或者按Esc键。

在选择了笔刷的选择模式下,你可以通过左键点击出现在笔刷的边界上的任何框,并将它们拖出或拖进来改变笔刷的大小。

让我们将笔刷的厚度由默认的64个单位减少至16个单位(我们将作为一个地板来使用)。要做到这个,我们需要改变网格的大小。

网格

网格被显示在所有2D视图里面。默认情况下,所有对象都会对齐到网格。尽管你可以关闭它,但是保留它却被认为是很好的行为习惯,因为它防止在你的地图上出现泄漏或者其它错误。

默认网格大小为64个单位,这意味着每个网格线相隔64个单位。当前网格的大小显示在Hammer窗口的底部的状态栏上。

  • 点击缩小网格图标Hammer SmallerGrid.png将使网格调整为一半大小。你也可以按[键来缩小网格大小。
  • 点击增大网格图标Hammer LargerGrid.png将使网格调整为两倍大小。你也可以按]键来增大网格大小。

要使网格大小降至16个单位,按[键两次。看下Hammer窗口右下角的状态栏并确认那里显示Grid: 16。如果没有显示的话,按[]直到显示为止。

调整地板

在侧视图中降低笔刷高度。

现在网格应该足够小了。

切换到右下方的视图。当你的鼠标在它上方时他应该标记为侧面。拖动笔刷的顶部边框并向下使它有16个单位厚。

移动笔刷

在任何2D视图里点击并拖动以移动笔刷。

一旦笔刷被创建你可以移动它们。选择Selection tool Hammer select.png并且鼠标在一个2d视图里的笔刷之上,保持清晰的处理。指针将变成四个箭头指向所有四个方向 FourArrows.png,表明移动对象的选项。

单击并拖动移动笔刷以便在任何2d视图里移动笔刷。释放后,笔刷将移动到那个位置。

在Hammer里配置选项。

你也可以用箭头(光标)键移动对象。要做到这一点,我们需要在Hammer设置里更改一项设置以便能允许使用方向键:

  1. 工具菜单并点击选项以打开配置Hammer对话框。
  2. 点击2D视图选项卡。
  3. 这里有其他设置,不过现在,我们只需要标记复选框Arrow keys nudge selected object/vertex
  4. OK确认更改并关闭选项。

现在让我们通过放置鼠标光标到侧面视图并按下一次下箭头以移动地面笔刷16个单位。

在侧视图里移动一个笔刷。

Template:注意

在2D视图里导航

  • 您可以使用滚动条来获得视图。
  • 更快的方法,按住空格键然后左键点击并拖动以获得。
  • 使用鼠标滑轮来放大或缩小。

纹理

要在3D镜头视图中查看纹理,在3D镜头视图中的镜头文本上右键点击并选择3D纹理

在镜头视图中选择3D纹理模式。

在3D镜头视图中导航

在3D中移动有点不同于2D视图:

  • 按住空格和鼠标左键并拖动以便旋转镜头。
  • 按住空格和鼠标右键并拖动以便上/下左/右移动。
  • 按住空格和鼠标左右两个键并拖动以便向前向后移动。
  • 你也可以用WASD来分别向前移动向后移动向左平移向右平移
  • Z键切换“鼠标观察”模式的开关。移动你的鼠标光标到3D镜头视图的上方并按Z键。你现在可以移动你的鼠标了,就好像在游戏里面那样。
Note.png注意:W A S D这四个键可以与空格组合使用

3D相机视口中向上移动并向下看你刚刚创建的地板。

纹理栏里面的浏览按钮。

你会注意到有一个默认的纹理在你的地板上。你可能想更换它。要更换当前纹理,在纹理栏里面点击浏览按钮。

它会弹出纹理浏览器窗口。

通用的灰色开发者纹理。

在浏览器的底部的过滤的下拉列表框里,您可以根据名称过滤显示的纹理。在这个教程里,在下拉列表框里输入字词"dev_measure"(带下划线)。它将显示一个“开发者”纹理的列表,这使得更容易快速创建一些东西。

现在,找到名叫dev/dev_measuregeneric01b的纹理并双击它。


应用当前纹理到选择的笔刷。

它应该返回到编辑器的四个视图并将通用开发者纹理作为当前的纹理放置在纹理栏中。

在镜头视图里点击地板笔刷以选择之如果还没有被选择。它应该变成红色。

选择了这个笔刷后,在工具栏里点击Hammer ApplyCurrentTexture.png应用当前纹理图标以应用当前纹理到选择的笔刷。灰色开发者纹理应该显示在地板上,如图所示。

创建墙壁和天花板

现在让我们来看看如何创建房间的墙壁和天花板。最简单的方法就是“复制”地板笔刷。

复制

你也可以选择一个已存在的笔刷并复制来创建它们。

Note.png注意:复制前,你需要设置Arrow keys nudge selected object/vertex这个选项如果你在之前的教程没有这样做。你可以到Tools > Options > 2D Tab那里找到它。
复制笔刷以制作一间室。

要复制:

  1. 选择你已经创建的地板笔刷。
  2. 将你的光标移到侧面视图。
  3. 按住 Shift键并按下Up_arrow键以创建一个复制并向上移动一个单元格。

这将创建一个完全像现有地板上的地板刷。

您现在可以更改这个新画笔的大小和尺寸,以创建一个墙,抓住画笔上的角落手柄,并将其拖动到所需的大小。让我们来制作128个单位高和16个单位厚的墙壁吧。

Tip.png提示:要移动你所创建的笔刷,使用方向键或者单击并拖动笔刷的正中间来拖动到另外一个位置。

Now duplicate the wall 3 more times to outline the floor.现在复制墙壁3次,以勾勒出地板。

复制地板以创建一个天花板。

复制地板笔刷1次并提高它成为天花板。

Tip.png提示:保持你的关卡清洁将变得非常重要,当你开始在游戏中运行它。不要有重叠的画笔(相互交叉的画笔)是一个好主意。这可能使得多个面相互绘制而在游戏里出现“深度冲突”。

删除笔刷

要删除一个笔刷,通过Selection tool Hammer select.png来选择它并按Delete键。

多重选择

将通用橙色开发者纹理应用到墙壁上。

你会注意到,在镜头视图中,如果你在房间内导航,很难知道发生了什么,因为所有的墙壁、地板和天花板都是使用相同的纹理。接下来我们将墙改变为不同的纹理。

你可以按住Ctrl键并在镜头视图中依次点击每一个墙壁来选择所有的墙壁。你必须使用Spacebar镜头控制(或者使用Z打开鼠标观察模式)来旋转镜头,这样你就能选择每一个墙壁。

选择了所有的墙壁后,点击纹理栏里的浏览按钮。这一次,选择当前纹理旁边的一个名叫dev/dev_measuregeneric01的橙色纹理。双击它以选择它并关闭浏览器窗口。

使用工具栏里的Hammer ApplyCurrentTexture.png工具来应用这个橙色纹理到墙壁上。

保存文件

要保存一个关卡,你可以使用Ctrl+S或者文件菜单下的保存

你需要为地图取一个文件名称,并选择要放置它的目录。

对于本教程,命名该地图为"tutorial01"并保存它到mapsrc目录,该目录默认在:

C:\Program Files\Steam\steamapps\common\left 4 dead\sdk_content\mapsrc\

你的目录可能会略有不同,这取决于你在哪里安装Steam。

包含的示例地图

当你去保存你的地图,你可能已经注意到mapsrc路径下的其他目录。Left 4 Dead Authoring Tools自带了一些示例地图来帮助你。(译注:内容已经过期,请无视。)

目录 内容
mapsrc\No Mercy Apartments 包含来自求生之路的“毫不留情”战役的示例地图。
mapsrc\standards 包含许多关于合作和对抗模式地图的标准内容的示例地图。
mapsrc\Your_First_L4D_Level_Tutorial 包含该教程的所有部分的完整版本。
mapsrc\zoo “风格向导”地图为农村和城市类型的求生之路地图。

有些时候,本教程将引导您到这些目录中的不同地图。

Tip.png提示:在这些当中,“Your_First_L4D_Level_Tutorial”可能是最直接有用的。如果你很难完成本教程的其中一个部分,你可以参考此目录中的文件以了解该部分的完成地图应该是什么样子的。

放置实体

选择实体。
放置一个info_survivor_position实体。

接下来我们将放置一个实体在我们的关卡中:

  1. 工具栏上选择Entity tool Mt-entities.png
  2. 一旦Entity tool Mt-entities.png被启用,在对象栏上的实体选择列表变为激活。
  3. 保持类别条目为实体
  4. 单击对象下拉列表上的箭头并选择info_survivor_position
  5. 现在,在镜头视图里导航到房间里面的中间。
  6. 左键点击地板以放置该实体。

这会在房间的中间放置一个info_survivor_position实体。

这个info_survivor_position实体的模型是弗朗西斯。他在求生之路里是最高的角色,所以这是用来放置以检查你的规模的一个好的实体。

放置灯光实体

现在我们将在地图里放置照明源:

  1. 再次选择实体工具
  2. 对象栏上的对象下拉列表里选择light
  3. 这一次,把灯放在天花板上(在弗朗西斯头上)。
  4. 点击在工具栏里的Selection tool Hammer select.png或者按Esc键来返回到选择模式。
灯光的对象属性。

接下来我们将改变灯光的一些设置。通过在镜头视图中双击以打开灯光的属性,或着选择它(左键单击它)然后按Alt+ Enter键。这将打开对象属性对话框。

对象属性里,你可以改变该实体的属性值。例如,你可以改变该灯光的亮度。点击Keyvalues下的亮度那行,然后你会见到在右边下拉菜单里的一个设置数据。这个灯光的亮度的默认设置为255 255 255 200。头三个数字代表RGB值(颜色),而最后一个数字代表光的强度。

你可以点击Pick Color按钮来选择一种颜色而不是输入数值。

拾取一种灯光颜色。

简单点击你想要的灯光颜色然后点击OK

这会返回灯光的对象属性对话框。如果选择了亮度行,你应该看到对亮度行的亮度和右侧的下拉字段所做的任何更改。

点击应用按钮以保存你对实体的更改,然后点击窗口右上方的“X”。

放置静态实体

一个静态实体的对象属性。

实体也包括道具如家具、装饰和建筑的复杂部分。这里有各种不同种类的道具。Prop_static实体是静态的实体——它们不能移动,没有动画,无法不能打开或关闭。这里也有prop_dynamic实体,它能移动,有动画,可以启动和禁止。这里也有prop_physics实体,玩家可以与他们进行交互和表现,就好像它们在现实世界中。

要放置一个道具:

  1. 再次选择Entity tool Mt-entities.png
  2. 转到对象栏,将对象字段更改为prop_static
  3. 指向弗朗西斯模型前面的地板并左键点击以放置一个静态实体。你会见到一个表示prop_static的红色的立方体在模型附加到它之前。
  4. 点击在工具栏里的Selection tool Hammer select.png或者按Esc键来返回到选择模式。
  5. 双击红色立方体以打开属性。
  6. 双击World Model字段以打开模型浏览器
Warning.png警告:第一次加载模型浏览器窗口,它可能花费一些时间来加载所有模型。它可能不会立即看起来像下面你看到的图像。如果你找不到你要找的模型,给它一分钟完成加载。

选择模型

在模型浏览器里选择桌子模型。
  1. 在对话框底部的Filter字段中,输入"table"。这将显示所有在其名称中包含单词“table”的模型。
  2. 向下滚动到命名的那个:
    "props_furniture\it_mkt_table2.mdl"。
    它应该看起来像显示的图像。
  3. 点击OK以选择它并关闭浏览器返回到对象属性对话框。现在,你应该在World Model行里看见模型的名字。
  4. 点击应用按钮以设置对实体的更改。
  5. 关闭属性窗口。

你将在编辑器中的任何视图中看到刚刚放在房间中的桌子。

移动实体

将桌子放在房间的角落。

你可以像移动笔刷一样移动我们的桌子实体。在所选实体的边框内单击并用鼠标拖动它或者将鼠标放在任何视图上并用键盘上的方向键来移动它们。

将桌子移动到我们房间的一个角落,并将其放置在地板上。

旋转实体

从对象列表中选择散弹枪。

接下来,我们将尝试在我们房间的桌子上放置一个泵霰弹枪,并旋转它,使它看起来像在一个自然的位置。

工具栏里点击Entity tool Mt-entities.png

对象下的下拉菜单中选择weapon_pumpshotgun_spawn

放置weapon_pumpshotgun_spawn实体。

点击桌面下方的地板以放置散弹枪实体。

Template:注意

角处的圆圈表示对象已准备好旋转。
在任何2D视图中单击并拖动圆形以旋转对象。

To rotate an object , you simply select the object you wish to rotate using the Selection tool Hammer select.png, then click once on the object. You should see the object surrounded at the corners with circles. Mouse over a circle in any 2D view, then click and drag to rotate the object.

Rotating the shotgun in the Front viewport

Use your mouse wheel to zoom into the Front viewport and click once inside the bounding box of the pump shotgun model to make its four corners highlight with circles around each one.

Left-click and drag in a counter-clockwise motion to rotate the pump shotgun so that it's lying on its side.

Decreasing the grid spacing.

Zoom into the Side viewport and press the [ key 4 times to decrease the grid spacing. Click and drag inside the bounding box of the shotgun to move it to sit on top of the table. You don't have to place it exactly as long it is above the table and not inside it.

Rotating the shotgun in the Top viewport.

In the Top viewport, click inside the bounding box of the shotgun until it's in the rotate mode again. Left-click and drag one of the corners counter-clockwise until the shotgun sits almost parallel to the table.

Now you will have a shotgun that you can pick up from the table.

Adding to your room

Creating the hallway and second room.

Using the duplication, scaling and moving of the brushes you currently have in your room, you can now build a hallway and another room identical to the first.

Make sure to create openings into both rooms from the hallway.

You can also duplicate the light in the first room and move it to the middle of the second room.

Tip.png提示:Remember you can duplicate any object in your level by holding the Shift key and then moving the object by dragging it or using the arrow keys. It's much faster than always creating objects from scratch. You can even have multiple objects selected and clone them together. This is a much safer strategy for creating passageways than using the Carve tool.

After you've finished making your second room and hallway, save the level as "tutorial01.vmf" if you haven't already.

Add a player start

One last thing we'll want to do is add a player start entity to test out the map. This will be where the player will spawn in a simple level.

Placing an info_player_start.
  1. Select the Entity tool Mt-entities.png on the Tool Bar.
  2. Pick info_player_start from the Objects drop down list.
  3. Now, navigate in the Camera viewport to the center of the room next to the model of Francis.
  4. Left-click on the floor to place the player_start.

The exact position isn't critical. Just make sure it's in this general location. You can even rotate it another direction if you wish and the player will be facing that way when they spawn.

Running your level in the game

Change the Run Map parameters to match these settings, then click OK.

You have saved your map, but you will also need to compile it before it can be played in the game engine.

When a map is compiled, it is converted from the raw .VMF file that you just saved, into the .BSP format used by the game engine. The geometry is processed and the proper lighting and shadows are pre-calculated with several compile programs.

  • Open the File menu, and choose Run Map... or press the F9 key.
  • The Run Map dialog will open.
  • This dialog is used to set some basic compile parameters.
    1. Make sure that Normal is set under the Run BSP, Run VIS, and Run RAD settings.
    2. Under Additional game parameters:, make sure these settings are present, and type them in if not:
      -toconsole -dev -console +sv_lan 1
    3. Now click the OK button to start the map compile process.

The Compile Process Window will show the progress of the compile. When the compilation is done, the game you are mapping for will automatically launch, and load your map in the engine.

Note.png注意:If you wish to compile with High Dynamic Range lighting, simply check the box that says HDR. The time to compile the map will be twice as long, but that is completely normal.
Click Continue on this dialog.

Your level in the game should load up after compiling. It may take a minute or two.

  • When the game launches, the "Map is unplayable!" dialog will immediately appear. This is OK because we haven't created a navigation file for our level yet. You'll learn about navigation files later in the tutorial.
  • Press the Continue button.
Running the level in the game.

A screen shot of the running map. Note that without a navigation file, the Survivor bots won't respond fully.

Tip.png提示:Your .vmf source map is automatically saved to disk when you compile and run it with the Run Map command. However, it's a good idea to save every once in a while so you don't lose any work.

The Developer console

Making levels for Left 4 Dead sometimes involves using commands typed into the Developer Console window. The console can also be used to do things like spawn Infected zombies to test your level.

Enabling the developer console.

If you haven't already, make sure the console is enabled in the game:

  1. Press the Esc key in the game.
  2. Click on Options, then Keyboard/Mouse.
  3. Click on the Allow Developer Console and select "Enabled".
  4. Click on the Done Button.
  5. Click on Return to Game.

Using the developer console:

  1. Bring down your developer console ` (tilde).
  2. Type any console command and press the Enter key.
  3. Hide the console again with `.

Noclip mode

One console command you'll find constantly useful is noclip mode. This is a mode that let's you fly around the level without being stopped ("clipped") by anything in the level. It's useful to get around large levels quickly.

To enter noclip mode:

  • Press ` to enter the console.
  • Type noclip in the console and press Enter.
  • Fly around the level.
  • Type noclip again to leave noclip and walk around the level normally.

Some useful console commands

There are lots of console commands available. Here is a sampling.

sv_cheats 1
Turns on cheats. Necessary for many console commands.
director_stop
Stops the AI Director (no spawning for common Infected or Specials).
director_start
Starts the AI Director (spawning resumes).
nb_delete_all
Deletes all existing NPCs (Infected and Survivors).
map <name of map>
Loads a map or reloads the level you're in.
changelevel <name of map>
Loads a map while continuing the session.
god 1
Turns on god mode for all Survivors. The Survivors are invulnerable.
noclip
Allows you to fly through the world.
z_spawn
Spawn a common Infected zombie where the cursor is.
z_spawn smoker
Spawn a Smoker.
z_spawn hunter
Spawn a Hunter.
z_spawn boomer
Spawn a Boomer.
z_spawn tank
Spawn a Tank.
z_spawn witch
Spawn a Witch.
nb_blind 1
Make the infected blind to the player.
Note.png注意:nb_blind 1 isn't fool proof. If you bump into an infected, they will attack. If a mob is spawned, they will come after you.
sb_stop 1
Stop the survivor bot AI -- the Survivors will stop moving.
director_force_panic_event
Start a panic event (Infected mob).