Designing the AI - Hubris as a Game Mechanic
The holidays are over (for us, at least) and development on Firstborn is ramping up for another year. This week we get inside the heads of the monstrous Firstborn with a look at how their AI works, and the design decisions behind it.
Going into development on Firstborn, I knew a lot of thought would need to go into the AI, but I wasn't sure where to start. I hadn't designed AI for a strategy game before, and there were a lot of factors to consider. It was time for some research!
Systemic AI - The Rat Problem
My initial thought was that the key factor was for the AI to play well. This was to be a strategy game, after all, so it seemed important that the AI should employ -well, strategy. I played a whole bunch of strategy games with various kinds and levels of AI, and quickly found that many used a systemic approach. That is, there was one AI overseeing the enemy forces, coordinating their movement and attacks for optimal or near-optimal results.
This made sense, and I began to design a systemic AI for Firstborn, but I continued my research to see what else I could learn. By chance, I happened to play a strategy title in which one of the early battles pitted me against rats. The rats were big, and rather nasty looking, so I decided to retreat to some higher ground.
I expected the rats to charge my position and be forced to contend with my height advantage. But they didn't. Instead, they milled around in apparent confusion just out of range of my attacks. That was fine, I had time. I made sure my warriors were well-entrenched, and ended my turn. At once, the rats swung into motion in a remarkably coordinated attack. Rats bull-rushed my party off the hill, ensuring that my units were separated, and that the high ground now belonged to my verminous foes.
It was a great fight, and in the end I prevailed, but afterwards I found myself feeling a little nonplussed. Something bothered me about the way the rats had so masterfully undone my strategy, but what?
And then it hit me: they were rats! That same fight would have felt totally on-point if I had been pitted against wicked mercenaries, or a cunning goblin tribe, but seeing rats employ such clever tactics had just felt odd.
So maybe near-optimal play wasn't the key factor for the AI I wanted to create. Rather, I wanted an AI that felt right for the Firstborn. But how would the Firstborn fight? It was time for more research!
Golden Axe - A Different Approach to AI?
I was working on the lore for the game at the same time I was designing the AI, and the two started to converge. In the world I was creating, the Firstborn were a race of sadistic immortals, completely impervious to conventional weapons. Theoretically, they should have exterminated humanity with relative ease, but they had one notable weakness: hubris.
The Firstborn's colossal arrogance had ever been their downfall, but was there a way to express that through the game's AI? I started looking around to see if any games had successfully created an AI that was undone by it's own cockiness. My search didn't turn up much, and ultimately I shifted my focus to working on the art style for a couple of weeks while I pondered the problem. I was looking for artistic reference among some of my childhood favourites when I found an answer.
The Golden Axe series has always been a favourite of mine. Something about the world, and especially the combat, had always appealed to me. Playing through again, I finally realised what it was about the combat that I liked so much. The enemies in Golden Axe were often almost absurdly powerful, but they could be outplayed.
Twice as tall as the player, with immense reach and enormous health pools, the giants and monsters of Golden Axe were genuinely intimidating opponents. They seemed arrogant, too, with some going so far as to chuckle malevolently whenever they knocked the player down. For all their power, however, these mighty beasts had almost no awareness of the environment. With a little patience and some careful planning, it was possible to send many of them tumbling off a cliff before the fight even began.
Intentionally or otherwise, the Golden Axe series had created powerful enemies often undone by their own overconfidence. I loved feeling like I was overcoming impossible odds by dint of finesse and strategy, and this feeling was exactly what I wanted to capture with the enemies in Firstborn, but there was a small problem. Golden Axe was an arcade beat-em-up. How could I create a similar feeling in a turn-based strategy game?
Unit-Based AI - Pieces in a Puzzle
I stated by looking for differences in AI design between action and strategy games. As far as I could tell, the AI for action games was often much more unit-centric, with each enemy fighting to the best of its ability as an individual, but showing a more limited awareness of its allies than was typically seen in strategy games.
I had the beginnings of an idea. I wanted to create a strategy game where the AI didn't employ an overarching strategy. I wanted an asymmetry where strategy wasn't the common ground, but rather was the only advantage the player had against an otherwise superior opponent.
Everything else in the game world followed predictable rules that the player could master, so why not the behaviour of the enemies as well? I removed the systemic AI, and instead had each enemy follow a set pattern of behaviour without any regard for its companions. Firstborn warriors would charge into battle, archers would keep their distance are rain arrows down upon the heroes, giants would swing their weapons with wild abandon.
After some initial tests, the unit-based AI just felt right. The Firstborn still felt like dangerous and effective opponents, but they could be tricked into making mistakes. They wouldn't go so far as to stumble off cliffs like some of the enemies in the early Golden Axe titles, but they could be lured into disadvantageous positions or even baited into hurting each other.
The new AI system created the feeling I wanted in terms of gameplay, but did it fit the game's world? For me, the answer was a resounding "yes". Vain, malicious and self-centered, each Firstborn would do its level best to claim the glory of slaughtering the heroes, without any regard for its companions. The Firstborn were not strategists, they didn't need to be. Inhumanly strong and quick, and immune to mortal weapons, they would attack without fear or remorse. And it would be their downfall.
Thank you for reading and I hope you enjoyed this week's Firstborn development blog!
Join us next week as we take a look at the Firstborn AI in action and discuss some of the new features coming in 2017.