Part 3: Octopus AI
I had an idea recently when reading through the great mass of documentation I download but never have enough time to finish reading, and I came across something concerning how many micro robots could be controlled for use in search and rescue.
So I came upon the thought that this could be used with Agents and an octopus type player. Instead of assigning Agents tasks such as construction and repair and attack etc, there would be simple generalised agents that would control a small base, and would orchestrate raids and attacks upon nearby enemies. In essence they would be an AI unto themselves not bothered about other Agents with their own bases. The overall AI would have a guider, one that issued targets to the Agents that would be attacked, having a higher priority than the raids that I Agents would usually do. Allied octopus AI├óÔé¼Ôäós would share these targets, acting as a single AI.
A base agent would therefore control a surrounding area. It would extend this area until it became too large and a new agent is spawned with construction units and the area of territory at the edge is given to the new agent which then tasks itself with building it├óÔé¼Ôäós own base there to further extend its territory until it becomes too large and another agent is spawned and so on.
Each agent creates a factory and the resources to support it at max production, as well as several construction units (2 for each factory at least), and defences. The aim of the agent is to spread its territory and lower threats to the territory, while churning out as many units as possible. The AI aims not to meet production in resources but to overproduce by 120%. Base Agents are only bothered about the resources they themselves produce and thus ignore energy and metal from other bases when dealing with how much they need and produce. Each base Agent gains the aim to produce more and more advanced technology when they spawn more agents as well as a target to produce a WMD or other very long-range weapon.
Tactical agents from part 1+2 are also applicable to base agents since base agents will choose these agents then send them off to nearby targets.
One more thing, Base Agents would specialise in a type of unit, such as land, sea, amphibious and air which the overall AI would choose.
PseudoCode:
Code: Select all
Int FactoryNum
Int ConstNum
Int GDefenceNum
Int AADefenceNum
string Agentspeciality //sea, land, air
int MetalIN
int MetalOUT
int EnergyIN
Int EnergyOUT
Int SpawnNum
Init(string agentspeciality){
If (factNum<constNum){
Build(├óÔé¼┼ôfactory├óÔé¼┬Ø);
Resource();
Goalcheck();
}
If (ConstNum>FactNum){
Build(├óÔé¼┼ôConst├óÔé¼┬Ø);
Resource();
GoalCheck();
}
}
Build (string type){
If (type=├óÔé¼┬Øfactory├óÔé¼┬Ø){
//put in building choice and unit micro management here
}
//same for metal energy const and so on
}
Resource(){
If (MetalIN<(MetalOUT*1.2)){
Build(Metal);
}
If (EnergyIN<(EnergyOUT*1.2)){
Build(Energy);
}
}
Spawn(){
SpawnNum = SpawnNum++
Int spawnedbase
Spawnedbase = CreateAgent(├óÔé¼┼ôbase├óÔé¼┬Ø);
Send(find(├óÔé¼┼ôidle├óÔé¼┬Ø,├óÔé¼┬Øconst├óÔé¼┬Ø), spawnedbase)
GoalCheck()
}
GoalCheck(){ // checks to see if the goals are met and if so spawns a new base
Loop(unitNum>0){
If (factNum<constNum){
Build(├óÔé¼┼ôfactory├óÔé¼┬Ø);
Resource();
NextLoop
}
If (ConstNum>FactNum){
Build(├óÔé¼┼ôConst├óÔé¼┬Ø);
Resource();
NextLoop
}
If (GdefenceNum<FactNum*2){
Build(Gdefence);
NextLoop
}
If (AAdefenceNum<FactNum*1.5){
Build(AAdefence);
NextLoop
}
If ((EnergyIN<(EnergyOUT*1.2)) && (MetalIN<(MetalOUT*1.2))){
Anyways I would appreciate feedback on this.