Search Unity

Systems that create ecosystems: Emergent game design

December 7, 2021 in Games | 10 min. read
Hero
Hero
Share

Is this article helpful for you?

Thank you for your feedback!

With simple scripts, game designers can create systems in their games that result in interesting and unexpected gameplay – a kind of organized chaos to delight and captivate players. We sat down with game designer Christo Nobbs, who explains his approach to designing for emergent gameplay with the help of a few key Unity features. 

Based on years of talking to individual creators and game studios, we know that when game designers create gameplay and design mechanics in Unity, they can demonstrate the vision for the game clearly and in greater detail to the rest of the team.

We created a new e-book, The Unity game designer playbook, for game designers who want to learn how to prototype, craft, and test gameplay in Unity. New and experienced game designers can use this guide as they begin to add Unity skills to their profile.

Christo Nobbs, a senior technical game designer who specializes in systems game design and Unity (C#), was a contributor to the e-book. In this blog post, the first in a series for game designers, he expands on some of the tips and examples for designing systems that he provided in the e-book.

Test project
Image from a test project to illustrate a fire propagation system and the potential chaos that could result.

In game design, a useful system should have a clear function, hold data, and be modular. This way, not only can it interact with another system, it also interacts with itself on other GameObjects in varying ways. When thinking about a systemic game system, it can often also help to envision it not as a complete architecture but as a piece of functionality that can run recursively through the game.

By combining such systems, you can create unique ecosystems that react to the player’s actions and are balanced using “design levers” (as opposed to hidden, hard-coded values). These levers are put in place to manipulate their data, resulting in systemic gameplay.  

Most games will have at least one system within them, whether it is a singular mechanic with values to adjust through gameplay or a network of systems. In a strategy game such as Age of Empires, wherein a player has to learn how to leverage and manipulate resources to progress and beat opponents, it’s complex ecosystems that govern the gameplay.

Ultimately, it’s up to the game designers themselves to decide how they want a player to proceed through a game. Should the gameplay be set on a guided, linear path, or should it be driven by one or a combination of systems that allow for organic, emergent results?

Modular systems can drive interesting gameplay

When designing a small system, its modularity and ability to interface with itself and other systems should be prioritized because these features can drive interesting gameplay loops. You want to think about the possible chains of reactions that can result from one system colliding with itself via another object, or by two simple systems creating a juxtaposition to play within. Always aim to create systems whose function is clear to the player, so they have a reasonable chance to learn how any given system works to gain an advantage.

Oxygen Not Included
Oxygen Not Included by Klei

One example of a chain reaction is from the game Oxygen Not Included, where the goal with the main loop is to balance a number of systems to achieve a state of symbiotic utopia to keep progressing. Another example comes from Divinity Original Sin 2, by Larian Studios, where mobs that explode to attack can no longer do so if the player gets them wet, thus making the fight easier. Or, the player can set the ground on fire to protect themselves from the mob when it runs at them. 

A modular system can bring more value to your game because you can use parts of one system to create another, different system. One Unity feature that Christo uses for almost everything is Animation Curves. As he says, “the processing of their data is almost always the same. They give more control than a single value to balance. And you can add easing to mechanics or even override system limits to fine tune a detail.”

A modular approach to design also enables you to brief programmers as accurately as possible, making it more efficient for them to edit and debug gameplay systems and reuse them in different configurations throughout the game. 

Design levers

Design levers are useful for adjusting values to manipulate an outcome, for example to increase or reduce the difficulty of gameplay so that it’s rewarding and provides the level of complexity you’re aiming for. With design levers, you can play test and adjust repeatedly until you get the intended result.

Design levers can be used in the concept and prototype stages of game development, through to post-production polish. Christo says he adds design levers when he maps out his ideas in a flow diagram. Aim to think early on in your project about which switches and levers your system needs so that you can fine-tune it and explore gameplay possibilities without relying heavily on refactoring code later on.

The following image is of a graph representing simple gameplay wherein enemies are in-situ on start, and the player enters locked and loaded. Essentially, they have to kill enemies, but by manipulating the design levers you can transition the gameplay to shift the focus. In one setup, gameplay is centered on high-score, rapid killing of many enemies in the time limit, while in another, the emphasis is on killing a set amount of enemies in a shorter time, leaving time for players to pick up dropped loot before being extracted.

Gameplay design
A simple gameplay design

This system could also be used to create a complete bullet storm with excellent drops and different ammo types with their own properties. By adding more design levers such as a timeout for the respawn, you can extend the system further.

A system for crafting weapons in Escape from Tarkov

Escape from Tarkov by Battlestate Games provides another good example of systemic game design in Unity. The game has a crafting system for creating a weapon with its own data set, as seen in the image below. This data set impacts the characteristics of the gun and overall gun gameplay, similar to the player’s health. If the player suffers a broken limb or ailment, their gun becomes harder to use, while a healthy player has better control over the weapon.

Weapon from Escape from Tarkov
The weapon crafting system in Escape from Tarkov

The relationship between one system, weapons, and the other, health, encourages the player to not only value their life, but also better-performing weapons. No one wants an AK with no dust cover or stock bouncing around as they miss shot after shot, a clear sign that the weapon is a bad option in its current configuration. 

There is also a wide selection of ammo types that have different properties, as well as of armor. The type of ammo and armor on your opponent determines where on their body you have to shoot them to inflict the most damage, creating meta gameplay. These systems, each with their set of visual cues, are balanced to create the gameplay “essence” their designers were looking for.

Escape from Tarkov
Escape from Tarkov systems are designed to achieve realism.

ScriptableObjects as design levers

One way to set up design levers in Unity is with ScriptableObjects. These can be used as containers of data that are saved as assets and referenced from scripts without creating dependencies to other objects in a Scene.  

You can create multiple ScriptableObject assets that hold different value sets that you can share and swap out to change entire sections of gameplay, similarly to presets. Your changes are saved in Play Mode with ScriptableObjects, so once you exit you don’t have to go back to any notes and implement changes. 

For example, when prototyping a character, you can change the feel of the character by replacing the ScriptableObject asset with one holding a different set of values. This is a potential gateway into prototyping buffs and debuffs or connecting character selection to profiles.

Let’s say you are making a shooter game and have implemented a gun system with arbitrary values for actions like recoil, fire rate, accuracy, fire modes, audio settings, VFX settings, and so on. You can create any number of new gun profiles and adjust their settings in Play Mode, where your changes are saved, all at once. You can also send these preset ScriptableObjects to and from your team members for their feedback, which is useful when you are trying to find the right feel for the gameplay. 

Design levers can replace single variables in code as public properties, and they can be limited by their range using Unity’s RangeAttribute, which limits floats or integers in your script to a certain range while enabling them to be shown as sliders in the Inspector. The intent is to manipulate the levers on the fly, not just in Play Mode, so it’s also applicable if you are executing in Edit mode or testing a tool.

Panels
1) The range, tooltip, and header attributes. Inspectors can be customized to your design needs. 2) A custom inspector created with Odin, available on the Asset Store 3) Data saved on ScriptableObjects that can serve to create different data sets or profiles, in this case, different special attacks

In survival games, among other genres, a player expects a range of choices that result in logical and reasonable consequences, prompting them to come up with a solution to each challenge. How could you design a system so that both the challenges and solutions are to some degree a result of emergence? 

Let’s look at an example where the player needs to stay in an area to survive, such as in the game Don’t Starve by Klei studio. The player can stay near a fire to prevent the enemy from attacking. The fire can also be used for cooking food and keeping players warm. However, if the fire gets too close to the player, food, or flammable objects, it will burn them. 

What kind of system is needed to create chain reactions like the one described above? You could just create a Volume for the player to stand in that gives them heat over time, or make a linear fire propagation as a system. But why not approach it with a more system-centric designer lens? You want to compel the player to react in a situation that is the result of a chain reaction of individual fire-propagation systems colliding with one another and with other systems that exist in the game world.

Capsule Colliders
The Capsule Colliders indicate the area where heat can be applied from one GameObject to another, provided they have the fire propagation system component attached, creating a chain reaction. When a GameObject is on fire, the area turns red, indicating that heat is being applied. The GameObjects receiving heat have turned yellow, indicating they are heating up, before igniting and turning red.

You could have a system in which trees grow in a defined area of terrain around a pond over time. These trees will sprout, then grow until the space limit is reached. When they mature, the trees can be cut down and turned into wood, which, of course, is also flammable.  

The player can use this wood to construct items, such as a fancy wooden chair, or build a small campfire with it next to the pond to get warm and dry after a swim. But then what happens if you give the player the ability to light the campfire?

The flammable system on the wood is not complex, but if something is on fire, it emits heat in a radius, and if that heat value is over the limit for the nearby wooden item or tree, these things will catch fire too (simple propagation). Thus the player, in lighting their campfire, has set fire to their nice wooden chair. The player now has to grab the chair and throw it in the water to put out the fire, but while they do that, the campfire sets fire to the nearest tree, and now you have a forest fire on your hands. 

Even a small and contained system such as this example can create fun and “unscripted” experiences for players. Also, it’s essential to keep the focus on your desired outcome for the player, rather than on a design that’s too closely tied to reality, which will give you less ability to create unexpected results. 

In this example, in Unity, you can create emergent possibilities by storing your design levers in a ScriptableObject placed on anything you want to catch fire. Let’s start by looking at wood in a world where a dead tree is already on fire next to the water’s edge but is leaning towards the water, and our player needs to get warm.

In this example, the wood has a ScriptableObject on it with various values.

Panel
Code

Let’s look at these values in more detail: 

  • Default temperature: A placeholder value, if nothing to inherit from a global state. If globally high or low, we can impact the feel of the whole system as higher temperatures could create a forest fire, assuming all trees use the fire propagation system.
  • Current temperature: The temperature of an item as it heats up or cools down, which determines if an item has combusted or not (if current temperature value is over the resistance value)
  • Combustion Temperature: The temperature an item must reach before it catches on fire
  • Heatup Rate: How quickly the item heats up when in the radius of another heat source 
  • Cooldown Rate: How quickly the item returns to its “un-heated” temperature, which could be referred to as retention, or thermal quality, as long as the name of the design lever is self descriptive
  • Burn Rate: How fast the item will burn over time
  • Fuel: How much fuel the item has when burning
  • Heat Strength: The strength of heat within the radius
  • Heat Radius: Heat’s reach or extension

With some supporting gameplay code, you can have one object next to another catching fire. You can store profiles of your prototypes and try wildly different setups until you find the breaking points, then clamp those values down with attributes.

Prototyped with assets from the Asset Store
Prototyped with assets from the Asset Store

There is no design for fire being blocked by water, but if there is nothing flammable on the water, the fire will not spread if it can not reach the other side unless you add a new system. 

This example of a fire propagation system provides various ways to create the same outcome by playing with the fuel, burn rate, and heat strength. And you can create new outcomes, for example by replacing fuel with “health,” to gain a constant range for controlling when a tree falls without losing functionality. When a tree reaches low health, it will have a high probability of falling. Now, when a burning tree reaches low health, it may fall, creating absolute chaos when left unmanaged by the player in an area of combustible objects. 

As you start adding more systems to your environment, you will create an ecosystem of systems that can react with one another. Assuming the player can harvest, build, and craft items with wood and that all inherit our fire propagation system, chaos could be around the corner if you’re not careful! 

Panel

You can create a highly volatile fire propagation configuration by reducing the Combustion Threshold and increasing the Heatup Rate so objects combust more quickly. Increase the radius to get a faster and more uncontrollable spread. The Heatup Rate is limited from 0 to 50 to provide granularity; the Heat Strength can be used to multiply this value, but you want to keep it within a reasonable range. A Heat Strength of 4 will expand the Heatup Rate to a range 0 to 200, which is overkill and would result in a forest fire in mere seconds. Since the player won’t have time to react to control the blaze, it’s not a great gameplay experience.

Panel

Raising the Combustion Threshold to 300 provides a better-balanced fire propagation system. The player can do other tasks before a blaze breaks out, and when it does, they have time to react and control it if they’re quick. Especially if they have the ability to cut trees down, construct barriers, or have access to an equally systemic and simple water system.

You can extend the fire propagation system further by introducing a resistance value for objects within the heat radius of a fire. This would allow you to have fires of varying temperatures, or to introduce fire-resistant coatings to structures as a possible upgrade. It’s probably overkill, but it’s an example of how to think about gameplay design in a systematic manner that can give the player more possibilities to survive and thrive in a cold forest environment when interacting with the fire system.

A very memorable moment Don’t Starve from Klei, when a forest fire breaks out
A very memorable moment Don’t Starve from Klei, when a forest fire breaks out

The example of fire propagation systems shows how you can take a linear mechanic idea and transform it into an interesting experience that allows the player to solve challenges through learning and understanding the game’s systems. And when your system does not need to mimic reality, this frees you from having to accommodate additional complexity and abstractions. 

With this simple example, this post explores how you can design modular, small, and simple systems with interactivity that creates a greater ecosystem for gameplay that can be balanced out with design levers that you can tweak and iterate on with input from your colleagues. These elements can create unexpected moments of fun, delight, and suspense for your players, helping to make your game a truly unique experience. 

Get many more tips, instructions, and inspiration for designing and juicing up gameplay in Unity in our new e-book available for free.  

December 7, 2021 in Games | 10 min. read

Is this article helpful for you?

Thank you for your feedback!