Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Gamasutra: The Art & Business of Making Gamesspacer
Developing AI in Darwinia
View All     RSS
August 22, 2019
arrowPress Releases
August 22, 2019
Games Press
View All     RSS

If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Developing AI in Darwinia

April 18, 2009 Article Start Previous Page 2 of 2

Dynamic Targets

Up until this point, the AITarget network had been static; it had been generated once at the start of the level and remained that way for the entire match, but this way no longer adequate – we needed a way for targets to move, and to appear and disappear from the network during the game.

At first we tried to manually link new targets (or re-link moving targets) to the other nearby AITargets, but this proved unreliable and in the end we settled with simply regenerating the network whenever an AITarget was changed, added or removed.

There were concerns that this might cause an unacceptable hit to performance, but after a little optimisation these fears proved to be unfounded, and this method was far more reliable as it was the same function that generated the network originally.

The AI was now able to capture power-ups (and even use them fairly well after some simple rules governing the use of each specific power-up were added -- issues involving the ‘accidental' nuking of an ally's Spawn Points were quickly resolved) and could now correctly play the Capture the Statue mode. The biggest challenge was yet to come, though.

Storm the Beach

One of the earlier game modes that was planned, but scrapped after we couldn't get it to work, made a sudden resurgence after some inspiration from the development team. It was called Assault, and was based on the idea of the beach landing scene in Saving Private Ryan – waves of men storming a heavily fortified enemy base.

On each map is a massive WMD set to go off after a certain amount of time, wiping out the attacking force (and conveniently leaving the defending team untouched), and the attackers are tasked with disarming it by capturing various points across the map. Obstacles such as walls, laser fences and gun turrets blocked the attacker advance, and would have to be bypassed in order to get to the objective. And there-in lay the problem.

With the current system, there was no way for us to tell the AI that it had to send Darwinians to a bank of Solar Panels in order to shut off a laser fence before trying to rush a bank of gun turrets. In fact, there was no way for us to tell it to do anything in any kind of order at all, and no simple fix was going to change that.

After a little brainstorming, we came up with a flexible objective system. Each specific goal on the map would be given an associated Objective, and each objective would be linked with a number of Markers that pointed out the specifics of that objective.

For example, the first objective on a number of maps is to capture a number of Solar Panels that are providing power to a Laser Fence, in order to lower the fence so that you can advance onwards. So the first Objective item on the map would have (for example) four markers associated with it, each one placed on top of one of these Solar Panels.

These markers would then manipulate the AITarget network, giving nearby targets a high priority so that the attacking army would march directly towards it. Once each one of these Solar Panels belonged to the attacking team at the same time, the objective would become complete, and the next Objective item would become active.

Objectives also work for the defending team, although instead of telling the AI which targets need attacking next, they specify where the defenders should fall back to. So once the aforementioned Solar Panels had been captured, the defending AI's objectives would tell it to abandon the Solar Panels, and fall back to the choke point at the recently lowered Laser Fence.

Objective Markers

The Objective Markers were also made context sensitive, and given a number of options. So if there was a marker in an open space, the objective for that specific marker would be to clear out the nearby area of enemy Darwinians. If the marker was placed on top of a Gun Turret, the objective would be to capture or destroy the Gun Turret.

They could also be flagged as pick-up/drop-off points for Armour units (fast moving Armoured Personnel Carriers that can ferry up to 100 Darwinians across the oceans between islands), allowing the AI to safely drop off groups of Darwinians at a sufficient distance from dangerous Gun Turrets, or giving them a single point to ease pick-ups.

A similar setup is also used for the Rocket Riot game mode, where teams have to capture groups of Solar Panels in order to power fuel pumps, to supply fuel to a rocket which must then be boarded and launched.

The result is a system which allows the AI to complete objectives in a linear order, even if they aren't placed in a linear order on the actual map.


The entire AI system in Darwinia+ is one that has evolved over the course of its seven-plus years of development (work on the first version of Darwinia started in 2002), instead of a system that was designed with a final end goal in mind. The result is a system that is flexible, and works, but far from perfect.

The problem of creating an AI that manages hundreds of individual units divided up into a dozen or more lose combat groups, whilst being challenging to play against without breaking the game rules (the AI absolutely cannot do anything the player can't) was certainly a challenge, but it's one that I think we have ended up managing quite well.

Article Start Previous Page 2 of 2

Related Jobs

Wizards of the Coast
Wizards of the Coast — Renton, Washington, United States

Lead Client Software Engineer
Wizards of the Coast
Wizards of the Coast — Renton, Washington, United States

Lead Server Software Engineer - Arena
Wizards of the Coast
Wizards of the Coast — Renton, Washington, United States

Sr Lead Software Engineer - Arena
Disbelief — Cambridge, Massachusetts, United States

Senior Programmer, Cambridge, MA

Loading Comments

loader image