AI part 4
top of page
  • Join our Discord!
  • Join our Kickstarter!

AI part 4

Updated: Nov 29, 2022

Welcome to the fourth AI devlog.


Today we take a look at the basic structure of AI at a glance.



Who decides?



First up is the AIInit.lua. All functions of the AI ​​are initialized here.

The additional modules such as "Player Notification", "Missions" or "Cross AI" are still in the planning stage and will later control AI functions for the player and missions.


The executive area is divided into 3 main functions.

The decision-making for the AI ​​strategies is located in the AI ​​strategy manager.

This is where all the AI's functions are called based on the current situation on the battlefield.

In addition, the "Cross AI" support functions for the player and scripts for later single or multiplayer missions are executed here.


In the Location Creator, bases are built at neuralgic points on the map.

This means that the AI ​​at position x,y can give orders to all units within a radius of 200 meters.

Number of bases or the position is not limited and can be used anywhere on the map.


Normally the AI ​​is able to work with a balanced economy.

But in emergencies such as the destruction of economy buildings, it may be necessary to redistribute resources to ensure trouble-free reconstruction.

This is what the Ecomanager is designed for.

From here, units can be paused or, in an emergency, withdrawn from the construction site.



Who plans?



Once the decisions have been made about which strategies to pursue, they must now be executed.

For this purpose, there is a location manager and executor for each base or base extension.


The manager uses the selected strategy to search for all platoon formers.

It checks if the build conditions are correct (eg low power, base under fire), and compiles a list of platoon formers to execute.

This list is processed by the executor.

Each platoon former has a platoon function assigned to it, which is called by the executor and supplied with the platoon former's data.



Who works?



The individual platoon functions are the actual workhorses of the AI.

After the location executor has started a platoon function, the first thing to do is to search for units that are necessary for the platoon.


A platoon that has a construction order for a building will first look for all available technicians.

If technicians are available, a building site for the new building is sought.

If we have a building site, we look for the technician who can reach the site the fastest.

This technician (or several) is added to the platoon and then gets the construction order.

After the building has been completed, all units are removed from the platoon and are available for new tasks.


Other platoons are responsible for upgrading buildings, for example.

These platoons also first look for units that can be used.

A platoon with an upgrade order will of course look for buildings that can be upgraded.

Here it is ensured that buildings closest to the center of the base are upgraded first.


Other platoons control groups of units to attack, repair buildings or operate nuclear missiles.


And already we have an AI that can build a base, takes care of the building of tanks and sends them diligently towards the enemy.



Thank you for your attention, I hope you enjoyed it.


Regards, Uveso.


2,360 views1 comment

Recent Posts

See All
bottom of page