Congratulations!

Congratulations!

You've unlocked the about me and contact me pages!

Trophy Icon

Unlock Additional Pages:

Key Icon 1
Unlock Locked Icon

Feature Spotlight: AI Players (AW)

Ant War has artificial intelligence powering ai players and automated actions for a player’s army.

 

Unit Automation

Let’s start with automated actions for the player.

Any time the game registers that a worker becomes idle, it is told to find and harvest resources from nearby plants.

Any time a soldier becomes idle, it is told to either attack move to random positions on the ground near player owned workers (to protect them), or if the player has an “attack marker”, the soldier will be told to attack move to a random point on the ground near the marker. Markers act as an automated attack beacon. Alternatively, a player can choose to automate their soldiers to “patrol the field” which means that instead of the previous two actions, the soldier will attack random points on the map, so long as it’s outside.

 

AI Players

When players spawn, they start with a new queen unit. Human players will find dirt, dig in, and morph into 1 of 4 ant races. AI players do the same.

The game identifies all dirt units on the map that can be successfully reached and dug by the ai queen unit. It then orders the new queen to cast the dig command on a random unit in that group.

The new queen unit is then commanded to continue digging until it runs out of energy. If it is located on creep (required for building a base and morphing to a mature queen) it will do a random 1 to 4 roll and morph to one of the ant races. If there is no creep, it will continue digging and resting until there is. Except for some player made maps made with the custom map editor and 1 official troll map where there is no dirt, a new queen is always able to morph.

Queen Automation

Once the queen becomes mature, she will then be following an endless loop until she is dead or the game ends. The loop checks if the queen’s life is low. If it is, she attempts to evade combat until her life recovers.

If the queen has at least 75 health, she will do 1 of 5 actions if she is idle: Fight, Research an Upgrade, Build, Dig, or Move.

If enemy units are nearby, the queen will fight. If the queen is in a good location and at peace and has enough resources, she will research and upgrade.

If the AI has sufficient minerals (resources), the queen will look for a suitable creep spot nearby and build a structure. The type of structure selected to build is random.

Army Automation

Although the queen moves every second, the military is a little slower. The army is prompted every 3 seconds. The ai player loops through multiple checks prioritizing protecting the queen if enemies are near it, defending the base if enemies are near it, and attacking the enemy if not on the defense.

The ai keeps track of known enemy locations and attacks towards it, prioritizing areas where the ai has suffered unit loss. In addition, the ai will make scouts to detect invisible units and routinely rush them all around the map.

The ai does a continual threat analysis on all enemy players and prioritizes attacking the most dangerous player to the ai. This typically will be the player that is nearest to the ai and is doing the most amount of damage.

AI Difficulty and AI Cheating

The ai comes in 3 flavors: easy, medium, and hard. Easy doesn’t attack the player. It only defends. Medium will attack and get some help. Hard gets a ton of help and will attack early and for the rest of the game.

By help I mean the ai gets free money routinely. The ai takes that money and frequently spawns extra soldiers. So a hard ai in particular will swarm the player with a ton of soldiers.

The only other way an ai player gets help, is if the player attempts to hide. If the ai can’t find the player, the ai will be told the location of the nearest enemy structure and begin attacking the dirt between it and the player with its soldiers. The ai will eat away at the dirt until there are no dirt walls for the player to hide behind!