求生之路2 扩展突变系统(Expanded Mutation System, EMS)

From Valve Developer Community
Revision as of 21:45, 5 January 2020 by Dazainerau (talk | contribs) (Squirrel脚本语言)
Jump to: navigation, search
English

本页面内容由Dazai Nerau译自英文版页面. 欢迎任何人补充新内容或者修改其中的错误.

注: 英文版页面已被锁定, 无法添加多语言链接, 希望有权限者协助添加.

BETA 版

本文及其他有关教程描述了在Left 4 Dead 2 Beta中发现但尚未被广泛公布的功能. Valve随时可能主动地或者因响应Beta版测试者的反馈而改进这些功能, 导致它们产生本文作者无法预测的变化.

突变系统变得更好了!

这次发布的Left4Dead2版本对于编写突变模式的功能进行了很大的改进. 我们姑且称之为扩展突变系统(EMS)好了. 早期的突变系统允许玩家通过对现有游戏规则和导演系统变量进行较小的改动的方式来创建新的突变模式. 而EMS提供了新的手段来使得制作较以往更为有趣与复杂的突变模式成为了可能. 最强大的新功能是对Squirrel脚本语言的深度集成, 从今以后突变模式的作者可以把他们自己的Squirrel脚本写成:

  • 指导导演系统的流程与节奏
  • 产生和控制实体
  • 增强既存实体的行为
  • 将脚本代码与任意游戏事件相关联
  • 设置 "慢轮询(SlowPoll)" tick函数以进行周期性的规则/状态更新
  • 显示包含基于游戏而更新的字符串和变量的HUD
  • 在既存地图上添加或移除实体以实现简单的重复利用
  • 就像在电视上一样:还有更多好康!


扩展突变系统现在已经能足够灵活地支持玩家创建出与全新的游戏模式一样复杂的突变模式.

Squirrel脚本语言

EMS中, 突变脚本使用Squirrel语言编写, 就是辣个看起来像C和Lua杂交出来的语言. 你必须先学会Squirrel语言, 才能理解或者写出突变模式的脚本.

Squirrel语言官网 包含了关于Squirrel语言从入门到入土的各种资料. 如果你对于Squirrel语言一无所知, 建议你最好还是去瞅瞅它.

至少, 你也得知道Squirrel脚本文件的扩展名是.nut - 这样的话, 只要我们讨论的文件以.nut结尾, 你就应当知道我们讨论的文件中包含了Squirrel脚本代码. xD

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!