Sponsored By

The twelfth weekly devlog of Deterrence. This week I make a simple enemy AI, capturable points, and units deal damage to one another.

Matthew Gianfrancesco, Blogger

June 6, 2022

2 Min Read

Title_(9).png

A tower defense mixed with real-time strategy where you repel attacking sentient AI robots until they give up.

Simple RTS AI

To get enemy units moving, I created a simple enemy controller that acts like a player (aka artificial intelligence). The enemy controller will need to move groups of units all around the map, so a nested group class is needed to give commands to separate groups of units.

Devlog12Figure1.jpg

In order for the AI to tell these groups of units where to go, points of interest would need to be laid out on the map or defined in some way. Since this is a tower defense game, the enemies need to move towards the objects the player is defending. The enemy movement will use the same pathfinding as player units.

Devlog12Figure2.jpg

To add depth to how enemies move, the points of interest on the map are connected together in a waypoint system. This way, enemy units can have paths with multiple points of interest or paths that approach a point of interest from another direction (flank). The enemy controller will simply tell each group to move on to the next waypoint once the current waypoint is reached. If the current waypoint is a Landing Zone, then the group will wait until the landing zone is under enemy control before moving on.

Capturable Landing Zones

The landing zones will be a very important part of the game. Landing zones will be where the player gets supplies and calls in more units. The landing zones won't be able to be built by the player nor will enemies be able to destroy them; Instead, they'll be control points. A landing zone can be under player or enemy control, or be neutral.

Devlog12Figure3.jpg

Control works like most control points in RTS games: Units must be present at the control point to capture it. A landing zone with both enemy and player units on it will be contested and there will be no transfer of control. If units are moved away before the transfer of control is complete, control will return to the current team or fall back to neutral.

Devlog12Figure4.jpg

In the case that an enemy gains control of a landing zone while a chinook is delivering, I am still contemplating what to do. If you have any ideas, let me know in the comments.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like