求生之路 2 拓展突变系统

来自Valve Developer Community
跳转至: 导航搜索
English (en)中文 (zh)
编辑



本页面由大康翻译于2023年7月19日 (UTC+8)。欢迎任何人补充新内容或者修改其中的错误。部分内容由机器翻译。


BETA 版本

这些文件描述了 Left 4 Dead 2 Beta 中的功能,但尚未广泛发布。随着 Valve 改进这些功能并响应测试人员的反馈,所有内容都可能发生变化。

更好的突变系统

此次发布的求生之路 2 具有一个大大改进的游戏《变种》创作系统。我们称之为扩展突变系统(Expanded Mutation System, EMS)。之前版本的突变系统允许用户通过对现有游戏规则和导演变量进行微小修改来创建新的突变模式。EMS 提供了新的工具,使构建比以前更有趣、更复杂的突变模式成为可能。最强大的新功能是 Squirrel 脚本语言的深度集成。突变模式作者现在可以编写自己的 Squirrel 脚本:

  • 指导导演的流程和节奏
  • 生成和控制实体
  • 增强现有实体行为
  • 将脚本代码附加到任何游戏事件
  • 设置“慢速轮询”勾选功能以进行定期规则/状态更新
  • 显示一个HUD,其中包含根据游戏更新的字符串和变量
  • 从现有地图中添加或删除实体以便于重复使用
  • 就像在电视上一样:多得多!

扩展突变系统现在足够灵活,可以支持创建在复杂性上与全新游戏模式相媲美的突变。

Squirrel 脚本语言

EMS 中,突变模式脚本使用 Squirrel 脚本语言编写,它与 C 和 Lua 都有相似之处。为了编写自己的游戏突变模式脚本,你需要了解 Squirrel。

官方的 Squirrel 语言主页 包含了 Squirrel 语言的下载、文档以及一个社区讨论板。如果你不熟悉 Squirrel,这是一个很好的开始。

在最后,你应该知道 Squirrel 脚本的文件拓展名是 .nut —— 因此,无论我们在哪里讨论一个以 .nut 结尾的文件,我们都知道在讨论一个包含 Squirrel 脚本代码的文件。随之而来的是欢声笑语。

限制

即使是这种奇特的新系统也有限制。一些游戏功能和数据仍然不在突变系统的范围内。这仍然是一个在求生之路 2 宇宙中创建不同风格游戏的系统,而不是制作其他游戏的工具。例如:

  • 没有支持创建新武器或角色的功能
  • 每个地图的导航网格都是预先计算的,在运行时无法更改
  • 某些类型的道具和对象被“烘焙”到现有地图中,无法更改或移除

开始吧!

作为一名突变模式的作者,你可能想从你想要创造的一个相当简单的体验开始。一旦你有了这些,你就可以开始调查什么是可能的,并将其映射到你的想法中。你可以做很多事情,但引擎和工具中也有很多隐含的规则和限制可能会阻碍你。在目前的情况下,扩展突变系统是一个关于在结构和限制范围内工作的工具。

另一方面,如果你有一个以前的突变系统无法实现的想法,扩展突变系统可能会提供你一直在等待的功能!

BETA Version

These documents describe features found in Left 4 Dead 2 Beta and have not yet been released widely. All material is subject to change as Valve improve these features and respond to feedback from beta testers.

The Mutation System just got better!

This release of Left4Dead2 features a vastly improved system for authoring game Mutations. We call it the Expanded Mutation System (EMS). The previous version of the Mutation system allowed users to create new Mutations by making minor alterations to existing game rules and Director variables. The EMS provides new tools that make it possible to build Mutations that are far more interesting and complex than previously possible. The most powerful new feature is a deep integration of the Squirrel scripting language. Mutation authors can now write their own Squirrel scripts to:

  • Direct the flow and pacing of the Director
  • Spawn and control entities
  • Augment existing entity behavior
  • Attach script code to any game event
  • Set up "slowpoll" tick functions to do periodic rules/status updates
  • Display a HUD with strings and variables that update based on gameplay
  • Add or remove entities from existing maps for easy re-use
  • And just like on TV: much, much more!


The Expanded Mutation System is now flexible enough to support the creation of Mutations that rival all-new game modes in complexity.

The Squirrel Scripting Language

In the EMS, Mutation scripts are written in the Squirrel scripting language, which bears similarities to both C and Lua. You'll need to understand Squirrel in order to write your own game Mutation scripts.

The official Squirrel Language home page contains Squirrel language downloads, documentation and a community discussion board. It's a great place to start if you are not familiar with Squirrel.

At the very least, you should understand that the file extension for Squirrel script code is .nut - so anywhere we talk about a file ending in .nut we are discussing a file that contains Squirrel script code. Hilarity ensues.

Constraints

Even this fancy new system comes with constraints. Some game features and data are still outside of the domain of the Mutation system. This is still a system for creating different flavors of gameplay within the Left 4 Dead 2 universe, not a tool for making other games. For example:

  • There are no features to support the creation of new weapons or characters
  • Navigation meshes for each map are precomputed and cannot be changed at runtime
  • Some types of props and objects are 'baked into' existing maps and cannot be altered or removed

Go!

As a Mutation author you probably want to start by thinking of a fairly simple experience you want to create. Once you have that, you can start investigating what is possible and mapping it to your idea. There is a lot you can do, but there are also plenty of implicit rules and limits within the engine and tools that may thwart you. In its current state, the Expanded Mutation System is a tool about working within the structure and limitations.

On the other hand, if you have an idea that wasn't possible to realize with the previous Mutation system, the Expanded Mutation System may just provide the features you've been waiting for!