Chaotic AI in Games

The tiniest flap of a butterfly’s wing can cause a hurricane elsewhere. This is one of the more effective visualizations of what is more commonly known in popular culture as the Butterfly Effect. In formal theory it describes the sensitivity of dynamic systems to initial conditions. The smallest of changes may not be visibly different at first, but lead into very divergent results in the long term. This is Chaos – when the present determines the future, but the approximate present does not approximately determine the future.

What is a Game but a simulation of rules? Player input processed through gameplay systems into visual and mechanical output. Even when isolated to just human player input predictability is not guaranteed. In more complex games the initial conditions like analog input, physics, and AI systems are difficult to replicate in real cases. Quality Assurance teams rely on larger numbers of users and iteration to make replicable results. Tool-assisted speedruns rely on mechanical precision to break games consistently. Chaos happens even when systems are designed to be deterministic, fully dependent on initial conditions. Even when random elements are controlled through seeding the results become only less unpredictable.

The term AI or Artificial Intelligence gets thrown around in media a lot these days but it has different connotations in different fields. In fiction AI more often than not refers to our future overlords – the singularity. Highly advanced programs that approach or are even beyond human intelligence. It’s a fun concept but reality is quite far from it. Academic AI is much more about machine learning and data collection. Given sufficient time, data, and human ingenuity through the design of algorithms we can teach machines to do something like a human would. Recognition for images, speech, context. This is what huge tech companies dedicate themselves to, behind the guise of there services.

Video Game AI is much simpler. It’s less of an intelligence and can be more accurately described as an Accumulation of Ifs. Just logical statements. It is directing an Agent’s actions within the relatively small domain of the Game. The very basics are just If/Then statements – but string together hundreds of conditionals across time and this produces high magnitudes of variance. Chaos descends on these systems. Especially with AI that reacts to variable human Player actions and its environment. You are now feeding the results of multiple dynamic systems each other. Sure, there are ways of mitigating randomness in these AI systems. Creating deterministic randomness from seeding is one. Well designed state machines and algorithms too. That’s why the Game’s problem domain matters. There’s no one magic AI code that can learn to play all types of games. Each has to be tailor-made, specialized. A turn-based tactics game would be a lot different from a precision platformer. In fighting games, creating reasonable and realistic AI has always been the challenge even though they are meant to be played against other human players.

Combine three-axis movement, fighting game controls, and weapon customization for AI. That’s quite a task. Add Player expectations on top of that and it’s a daunting problem of communication. Most of the time Players have no idea of the technicalities behind the scenes. Because that’s not their role. They only have to play the game. The Developer’s job is to provide an adequate experience – “The illusion of choice” and whatnot. To the Players the insides of a Game are a black box and they make their own assumptions about them. I’ve seen players come to the conclusion that the AI somehow “learns” over time by processing previous data. They expect it to be smart. In practice, though, it just picks it actions from a box or one from many boxes. Anything more than that would be an academic effort. An approximate is enough.

Another situation I encounter often with a living playerbase is something I would call “Update Placebo”. When Players receive any kind of news they expect a lot of changes. The few days right after an update is a window where QA and Players have heightened perceptions for even the smallest of details. They can uncover issues that have been buried by some other bug before. Sometimes they might be right, or maybe jumping into the wrong conclusions. In either case there is a measurable reaction from Players to the Developer’s authority of making such changes. Altering some small probability hidden deep in the code might have unforeseen consequences in other parts of the Game. Suddenly you get a wall of text from Players about things that were not actually changed. That is Chaos.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s