A-Life: An Insight into Ambitious AI
A-Life: An Insight into Ambitious AI
A-Life is the brain behind everything that happens within the S.T.A.L.K.E.R. video game series. Learn how it works and why it's revolutionary.
Join the DZone community and get the full member experience.Join For Free
The S.T.A.L.K.E.R. game series developed by GSC Game World is somewhat of an underrated gem with a global cult following. They are a trilogy of games that take on the role of depicting an alternate history. Within this world, the Chernobyl Incident occurs twice, rather than once. The second time Chernobyl is hit with a blast of radiation, it changes the landscape around it, causing all sorts of issues. There is no clear cause within the game lore but the area is contaminated beyond any repair, leaving it extremely hostile and teeming with unknown creatures born from mutation and other elements. The Chernobyl exclusion zone is then explored by various factions known by some in the game world as Stalkers: hunters of rare artifacts that have formed in this zone. To accommodate this extraordinary world, the developers at GSC developed an interesting A-Life AI system.
What Is A-Life?
A-Life is the brain behind everything that happens within the fictional zone of alienation, which is a term used for the Chernobyl exclusion zone within the game and in real life. It controls how things happen and how things react to the player’s actions. There is a limit to this, however, and this is labeled as offline and online A-Life as a way to prevent performance issues.
Actions carried out by the player cause ripples through the actions of the AI, updating as the player traverses the world. The idea behind the simulation is to make it seem like AI between loading zones are moving and active. It works extremely well, even though (to some degree) it is just smoke and mirrors from GSC Game World — a convincing simulation of how a human would react if put into the shoes of an NPC.
This is a screen from the SDK showing the layout of AI pathing. AI has free reign over most of the same land the player has access to.
A-Life has a natural function of branching to it. AI within S.T.A.L.K.E.R. has a set of rules it must follow based on NPC type and what their role is in relation to the player. Based on this, the AI will react in various ways. Due to how A-Life works, a cascading set of reactions can take place based on game events and what the player does.
For example, if a bandit enemy is set on a random patrol in a group and is ambushed by the player yet doesn’t die, this bandit has the possibility of joining another group or continuing on his original path.
In addition to this example, if the player comes across the bandit wounded and is then healed by the player, the previous rules change due to the relation to the player from an act of kindness.
Compared to other AI, S.T.A.L.K.E.R. simulates human-like decision making. Instead of waiting for the player to enter the vicinity, the AI is proactive and based on certain rules will make decisions on their own. The exception being important NPCs that facilitate the main story tasks. NPCs that are essential to main story progression are static in their placement and only move from their post once their quest line has ended.
Player and NPC Rankings. The player starts from the bottom, and you rank up by obtaining points whilst other NPCs can compete through their AI actions.
Offline and Online A-Life
There are two planes of existence in S.T.A.L.K.E.R. — one that runs in Online A-Life and the other in Offline A-Life. It sounds silly at first, but it makes sense because S.T.A.L.K.E.R. does not consist of one single open world map but rather an assortment of locations based on the same geographical location.
Online A-Life Status can be linked to all AI within a certain radius from the player’s location. Everything outside of this radius is considered Offline. The radius around the player in the vanilla, unmodded game is roughly 150 meters. This radius can vary — it has varied in the later games in the series but also has been changed via community modding. The A-Life system is working in the background and taking note of everything that happens in the Online so that it can make changes to the Offline AI.
A-Life takes all the Online information that it has and makes changes to everything offline whilst the game time passes. The reason for this is that as the player progresses through the game, enemies and monsters move around in other places, meaning events can also occur away from the player. The game engine computes this information on a graph but it isn’t something the player can see happening. Dmitriy Iassenev, who is one of the lead programmers on the S.T.A.L.K.E.R. series, calls this the “detailed graph.”
Smart Terrains are zones that are layered out through the game world and apply new rules to existing AI once they enter these zones. Many features were actually left out, which were related to systems like this. What made the cut were factions, stalker activities such as defending encampments, or sitting around fireplaces.
Another feature is a points/ranking system that includes the player character and every single AI character within the active saved game. This can be seen when entering the game’s PDA menu. A ranking is given to you at the start, being relatively low; points are mostly gained from kills.
As seen here, links are made between spawns to help facilitate the smart terrain(s) of a level.
Post-release of each of the games, the community set out to restore many elements that existed in the game code. Open Xray is an expansion of the Xray Engine 1.6, which was used in the last game, Call of Pripyat. The goal is to have a version of the game that can be made more stable and allow for modders to push what is possible in the content they create.
Many modders from Russia and some from the West collaborated and created some vast tweaks that ranged from simple maintenance patches for the base game and even a reverse-engineered engine fork called Open Xray. Many features and additions were added to the series that GSC Game World never thought would see the light of day.
What Does This Mean for Us Devs?
Stalker’s A-Life AI is what creates emergent gameplay. Emergent gameplay can happen when games generate complex systems that are not directly predefined beforehand. The systems that make up A-Life are presented to the player naturally without the need for a direct push.
A-Life never reached its full potential because the developers needed to hold parts of it back, but its overall effect on the game was clearly noticed. It was part of the reason why players kept calling it an immersive experience. The elements that make up the game were glued together by the AI and this is what drove the experience for players.
This, of course, is a vast undertaking for most developers — indie or even major. Creating systems that play out scenarios by themselves is quite the feat and a challenge to perfect. However, having such a goal in development even if not fully realized will benefit your game greatly, like it did for GSC Game World. After many community mods, the S.T.A.L.K.E.R. games are still known as some of the buggiest games. Devoid of this, though, this series is the perfect example to learn from. GSC Game World had immense ambition and not many developers seven years onward have attempted to surpass this level of ambition.
Published at DZone with permission of Alex Cicala , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.