Home RTS- AI
Post
Cancel

RTS- AI

Introduction

Overview

Ritsaï is a Real-Time Strategy (RTS) game where you control an army and you aim to dismantle the adversary’s base. The opponent is controlled by an AI designed to win every challenge. Build factories, produce units, capture strategic points and the destroy the enemy’s factory.

Ritsai AI vs Player

Reason

Within the context of a school project, me and two friends (Guillaume and Lancelot) have undertaken the challenge of crafting a strategic AI to control armies and fight against players. We build all the hierachical strategic plan resulting in an opponent that emulates human-like tactics.

Development

Army Chain of Command

For an AI to properly control an army, it must be built internally as an army. So the idea was to use a hierarchical command to control units, with each level of command having a specific role in the final decision.

You can see here the chain of command we have set up ⬇️ Rts Chain

Observer

The Obersever doesn’t really have a rank. Its role is to study the battle and give usefull information about the current state. Who is winning? Who is the most powerful? Is there strategic point to capture? Lots of question that the observer will answer to.

The first information source is the army itself. We want to know wich team has the most units, how many factories are builded, who has the most resources, who is the most powerful.
For more detailed data, we’ve implemented tools to help analyze the field.

  • Influence Map -> Each spawned unit has an influence on the field. This influence is propagated and sumed up with the other influences giving an idea of the power of the armies. 2 units versus one seems to be better but what if we are talking about 2 spearmen versus a tank? That’s where the influence map is usefull.
  • Waypoint Graph -> Startegic waypoint are defined like road, choke point, resource tower or factory. They can give data about their state, for example a choke point know wich team control it or a resources tower the team it belongs to and the units around it.

All this data will be used for the Commander to find an appropriate strategic plan.

Commander

The highest rank in the chain. Its role is to find the best global strategy to set up to maintain control and be able to attack. Possible decisions are to attack the opponent, defend the base and produce ressources to build the army.

The decision system is built on the use of a decisional model tool: Utility System. Rts Utility System

Each utility is linked to a specific action to realise, in our case the strategic plan to established. Each action is evaluated depending on various conditions giving a final score. The higher the score, the better the action. The commander will give the best utility to the lower rank to apply the strategy.

Team Leader (The Producer)

Just below the Commander is the Team Leader. It’s role is simple, maximise the production efficiency. Given the strategic plan elaborated by the commander, it will choose to build new factories to strengthen the production and create units production plan based on the cost, the need of each unit and the best plan to execute over time.

Army Leader (The General)

Next to the Team Leader is the Army Leader. Given the strategic plan elaborated, it will create and dispatch squads with a set of rules. The goal is to balance correctly the influence of the army on the field by deploying new squads, filling existing squads and dismantle them when there is a need to rearrange.

Squad Leader (The Sergeant)

Below the Team Leader and the Army Leader is the Squad Leader. Obiously, its role is to control a squad according to the orders given by the Army Leader. It will try to find the best path and actions to navigate to its destination goal. We wanted to add a Goal-Oriented Action Planning system (GOAP) for the AI to be smarter but we didn’t have time to integrate it.

Unit

The lowest rank of the hierarchy but not the least, the Unit. Driven by a Finite State Machine (FSM), the Unit will directly apply reflex actions to interact on the field given the Squad Leader orders. It will be able to Idle, Attack, Defend, Capture points or Move for example.

Contents
Trending Tags