In preparation for our not-too-distant subjugation by skull-faced machine-men, I thought I'd bone up on the latest advances in electro-brain design and stop by this year's GDC AI summit. Kicking off the summit was a trimuvirate of talks about the AI behind PCG-fave XCOM, stabby sequel Assassin's Creed 3 and the super-shiny “space ninjas with machine guns” shooter Warframe.
The talks showed a fascinating variety of uses for AI: XCOM's combat AI was the most immediately familiar, but supremely clever in insinuating the personality of enemy types - a far cry from the use of AI to determine Connor's foot placement in AC3. Warframe, meanwhile, deploys AI as a dungeonmaster, cobbling together levels from pre-built components to fit the needs of its players. It's smart stuff. Perhaps... too smart ? Read on to unpick alien plans, parkour and player-centric dungeon design.
Firaxis had a problem in updating the classic X-COM (UFO: Enemy Unknown to Brits): how do you balance the game's appeal to modern and nostalgic audiences? Luckily, it seems it was a problem that they managed to solve, in part by way of a complex and hybrid approach to the AI, as described by AI/Gameplay Programmer Alex Chang (pictured right). The challenge was to revive X-COM's classic enemies, whilst keeping their behaviour distinctive and entertaining in the limited action system of the new game.
Chang's team did this by means of a utility-based system – a system that gave a measure of 'usefulness' to every possible action. This means that, at any time in the game, the AI rated each ability for each alien on the basis of its defensive, offensive and 'intangible' benefits. Each race also had its own inherent biases and special abilities which also affected different behaviour; so the Muton's 'Blood Call' ability, which buffs nearby allies, would be heavily weighted to be used, if there were other Mutons nearby and if they weren't already buffed.
Given the limited movement system of XCOM, one of the choices the AI made at a given time was to move or use an ability. Similarly, the units would generate a movement map of the area around them, to see what area gave the maximum utility. In this case, utility was generated by taking into account distance to the location, whether the location flanked an enemy or got the alien closer to flanking an enemy, the cover bonus the location gave, proximity to other aliens (to avoid grenading or rockets), the number of visible enemies (with just one being optimal) and an alien behaviour specific value. If the optimal location was where the alien was already... it stayed where it was and chose to do something else.
Of course, this only really applied to the normal units – the sectoids, thin men, mutons and so on. Fliers had an entire extra range of behaviour choices, and melee enemies were configured to charge pretty much directly at the nearest troops. Fascinatingly, this latter includes mind-controlled troops.
Meanwhile the elite units – the Sectopod and Ethereal – also didn't care about cover, but also didn't care about getting near to the enemy. The Ethereal was programmed to hang back and stay close to its bodyguards; the Sectopod was programmed to get as many enemies into range as possible, given its ability to attack multiple times in a single turn. With these special utility rules, the weighting towards choosing individual abilities, and the differentiated behaviours based on custom weights, the team ended up with about 17 different AI behaviour sets.
This might not sound like an AI problem to us lay people, but the decisions on where Connor put his feet are hugely more complex than Ezio's lumpen feet – mainly, as far as we could tell, because Ubisoft Montreal is ramping up for the next generation consoles, which will no longer limit the complexity of their simulation. “The challenge was to change everything but change nothing,” said Aleissa Laidacker, Team Lead for AI and Gameplay, Ubisoft Montreal (pictured left). “The fans would have killed us.”
The four movements of the new Assassin's Creed engine were ground navigation, climbing, free-running and tree-running. While they were revamping these, they also revamped the animation system completely, making it totally procedural, as Laidacker demonstrated with sample videos showing Connor's reactions to varying conditions.
The basis for the movement style was the movie Apocalypto, with its wild forest-running. As much of Assassin's Creed 3 takes place in the heavily-wooded frontier, this was an important parallel, but it meant that Connor had to react correctly to the environment, whatever he was doing. This meant running, fighting and assassination animations all had to take place on uneven and even moving surfaces – considering the ships and sails, but also the rocky, bumpy surface of the frontier provinces.
Once the animation and AI team had made it so that Connor's feet could stand properly on uneven ground, Ubisoft Montreal's procedural animation guru, Simon Clavet was called in. His task was to ensure that the animation system could take advantage of this, by predicting where Connor's feet would end up as he was running and ensuring that his legs moved in the correct way. He did this by raycasting possible paths and making sure Connor's feet were ready to step over the highest point, and his pelvis was properly tilted. (This is scarily similar to the procedure the human body does automatically when we're walking.) Added to this, Front Strafing meant that Connor would step from side-to-side as ran; when players started turning, Connor would strafe first, meaning the animation wasn't disturbed if the player then turned him back.
The free-running model was also changed substantially for AC3. Every movement was given new animations, with short jumps chained together and long jumps separated off by 'settle' animations, so the animators could create new variations without having to think about how to integrate them.
Richard Dumas, the Technical lead (pictured right), explained that climbing was revamped by basing Connor's movement on that of professional speed climbers like Dan Osman, who can climb a 400m cliff in 4 minutes. “If he can, an assassin can too,” said Dumas. Connor doesn't settle after every move, like Ezio, but can flow from move to move, along the more organic surfaces of the frontier. Similarly, he doesn't just move up, down and sideways, but can move 360 degrees on the rockface, climbs vertical cracks in a totally different way, and has a dynamic system of how he positions his body, depending on how close to an edge his hands are or whether his feet are resting or dangling. Frankly, this was a crazy amount of work compared to its nearest climbing competitor... QWOP.
Finally, the newest form of movement was tree navigation. The trees came in three types. The unclimbable tree was smooth and branchless. The normal tree had anchors and horizontal branches, and could be climbed slowly. Finally, the V-shaped trees acted as fast elevators, and allowed players to hop up, from V to V, extremely quickly, so they could get back into position for assassinations.
To make it so that Connor (and the other characters and animals) had proper foot placement took the best part of three years work by AC3's AI department, and even now they're limited by the hardware power of the consoles. The movement behaviour was similarly involved. However, we're betting this totally dynamic system, which was under-used by AC3 because of console memory limitations, will make a more impressive reappearance in future editions of AC.
Digital Extremes' new shooter Warframe may suffer from the GameFace / WarFace / FaceGame associations, but it's out today on Steam and worth checking out. In it, players battle in thirdperson co-opagainst a variety of AI factions, which level and scale in difficulty with the players. Daniel Brewer, the Lead AI Programmer (who we forgot to photograph, left), took us through the development of its procedural levels, which are AI designed from pre-built components each time a level is started, and auto-balanced to ensure that they're always challenging.
When the level is first generated, the game takes pre-built elements and connects a start block to various objective blocks and intermediate blocks, where the majority of the combat takes place, and eventually generates an end block, producing something that can be entirely linear or sprawling. Once the blocks are stitched together, the game works out a navigation mesh through them all and then a combat mesh. Yet, because the team don't know the orientation of the blocks to the player's route through the level and because they don't want players to have the same experience every time, they had to be very careful in the design of the AI that manages the levels and enemies.
The combat mesh – called the tactical area map – shows the areas of potential conflict. It also allows the AI to draw a distance map between the start point and the objectives, so it knows if the players are heading the right way, whether there are AI agents in the way and, if there are, where there are obstacles they can defend or chokepoints to fall back to. As the players move, the game spawns more enemies, with a higher density in in the direction of the objective and in the direction of player movement, acting as a subtle hint to players. Areas the players have left are deactivated gradually, reducing processing power and allowing agents in those areas to be temporarily removed from the unit cap (they reactivate if players head back their way).
Similarly the game paces these spawns by judging how the players are coping with the enemies they're fighting. The game will keep ramping up agent spawns until there's a lot of dead agent and players have taken damage. Once it recognises that the players have been properly tried, it'll slow the spawns down again, giving the players a chance to mop up and then heal up. An area that's peaked like this is exhausted and players can pass safely through it – until it's reset by the game rules (such as the players reaching an objective.)