Heresy RTS AI system implementation

Over the last few weeks I have been hard at work on an AI system that governs how AI actors behave and interact in the game. While the previous post focused on peaceful part of the game, today we will see some combat.

Overview of the AI system

What I want for my game is to have a map that feels alive. In a way I want the map to “play by itself”, even without the intervention of the player. To achieve this I created an NPC Player AI that governs the camps that may be scattered around the map.

The system works based on one main script that may be parameterized and customized in a way that allows for the creation of different factions. The screenshot below shows this script with most of its fields exposed. I will not go into much detail about its inner workings, but these parameters can give you a lot of additional context. Based on this configuration I created two basic camps: bandits and goblins, which can be seen fighting each other in a video under this article.

AI player config

How AI players function

The AI on NPC players switches between several states over the course of the game, based on faction relations, wealth and the number of units produced. Most of the time it will generate wealth, upgrades and units. When it has enemies it will switch into a war mode and send an attack force against the enemy base. If the force is destroyed it will switch back to the economy mode. The player may visit faction  bases to trade. Each faction has its preferred goods which can be used to buy favour. The factions have their unique equipment sets, base defences and boss units. Once a boss unit is defeated, the given NPC player “stops working” and the base becomes abandoned.

AI player demo

The following video shows goblins and bandits going at each other. The Player AIs are setup for very quick resource generation, so the attack are constant and relentless. The full version will feature a population system which will make combat a less frequent occurrence.

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Social media & sharing icons powered by UltimatelySocial