Expanded Mutation System

From Valve Developer Community
< Left 4 Dead 2‎ | Scripting(Redirected from L4D2 EMS)
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)


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!