Page 1 of 1

What Makes AI? [A Guide On Learning Supcom AI]

PostPosted: 04 Nov 2019, 03:22
by Azraeel
Supreme Commander AI

Supreme Commander AI is very unique, You never get one behavior out of it. A Simple line change in the code can make the AI act completely different. A Lot Of People don't know, How AI Truly Works in Supcom... So Today I Will Be Explaining :)

Lets start off with the basics

Supreme Commander AI works through LUA Code. These AI's work through Basetemplates, That grabs AIBuilders and AIBuilderGroups... AIBuilderGroups hold the information to build units, structures, defenses, and more! Priority is also important is decides what the AI does first!

AIBuilders look like this: Image

AIBuilders have Build Conditions that are programmed from the Editor File that holds the UnitCountBuildConditions.lua or EconomyBuildConditions.lua and etc

These affect when these Units, Structures, and etc are Built and why they are built. Builders can adaptive to if the enemy has "This or That." Example: If You set the Builder to build a Factory when the enemy has more factories then your ai does, or Building SMD when Nuke Launcher Spotted...

Next is Platoonformers... PlatoonFormers take Units, Structures, and etc and makes them do stuff like Attacking Building and more. They basically order units to do stuff...

Here is an Example: Image

This is a raid platoon, it does from Mass Marker to Mass Marker Looking for Enemy Mexes To Raid... It avoids bases in a radius and tries to skirt around and raid the enemy. It can also hold mexes to stop enemy from recapturing them.

Next is Platoon Templates... Platoon Templates are what can get assigned to the Platoon that the PlatoonFormer has assigned to it. It also has the plan of how it behaves. Plans are what are used to make it think.

Here is an Example: Image

Platoon Templates can have min and max number of units assigned to that Platoon. They can assign use a formation like Attack or Growth. It can also pick from Categories of units like Indirectfire units or directfire units.


Expansions are good for expanding swarm's eco and land. Expansions are entirely different bases that act on there own. They have there own Basetemplates and everything. Expansions can be very useful to the ai. Note: All Start Markers are counted as Expansions ;) . Engineers can set up these expansions using builders like this.


Expansions can have many requirements and have tons of builderdata.
BuildStructures = {

Determines what the engineer that sets up the base builds. Only the First Engineer!

LocationType = 'LocationType',
ThreatMin = -1000,
ThreatMax = 100,
ThreatRings = 1,

This determines if the engineer will go there, it will not go there if the threat is high :D. Meaning if units are there, the engineer will not go there.

Examples of AI Builders

This is a simple Land AI Builder that Allows him to build Tanks. He can have 25 Tanks in the Pool. The Pool holds all units that are currently not in a Platoon. This can allow him to use the Function

{ UCBC, 'PoolLessAtLocation', { 'LocationType', 25, categories.DIRECTFIRE * categories.LAND }},

To Get a Ratio of Tanks to Artillery and AA, this allows him to not overbuild AA or Artillery compared to Tanks.

I'll be updating this with more and more information as time goes on :shock:

Re: What Makes AI? [A Guide On Learning Supcom AI]

PostPosted: 26 Apr 2020, 17:17
by Azraeel
AI Builders


This is a standard Factory Builder. All AIs Have These Standard Factory Builders. My AI (Swarm) Can build up to 12 Factories in the Main base. Any extra factories will be built in Expansions. This allows him not to spam too factories, and also allows him to keep his base more clean.

He uses a storageratio to build these factories, For Example.

{ EBC, 'GreaterThanEconStorageRatio', { 0.5, 0.30}},

He can have 5% of the mass bar filled and 30% of the total energy bar filled and he can build one of these factories.