TAI Part3 :: Octopus AI

TAI Part3 :: Octopus AI

Various things about Spring that do not fit in any of the other forums listed below, including forum rules.

Moderator: Moderators

Post Reply
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

TAI Part3 :: Octopus AI

Post by AF »

TAI
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))){
		
		
I├óÔé¼Ôäód carry on but I├óÔé¼Ôäóm not sure how, perhaps someone could finish that off for me if I don├óÔé¼Ôäót edit this in future?

Anyways I would appreciate feedback on this.
User avatar
[K.B.] Napalm Cobra
Posts: 1222
Joined: 16 Aug 2004, 06:15

Post by [K.B.] Napalm Cobra »

Your defences need to be more adaptive, it would be nice if we could get auto generated classes based on stats of a unit, ie if range is greater than a certain value its classed as artillery, if its speed is over a certain value its classed as a rusher, and if it fires parabolic or straight line projectiles etc etc.

Oh, and your coding style is terrible. :lol:
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I was putting it in as an example. And yah unless I properly think ti all out ym coding goes all horrible, but I've not coded anything substantial in a very long time, so I'll have a nice long afternoon of thought after a good readup and ahve another go at something prettier
User avatar
Triaxx2
Posts: 422
Joined: 29 Aug 2004, 22:24

Post by Triaxx2 »

*laughs for a moment*

*realizes his coding is worse*

*stops laughing*
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

You know I could use several of the other Agents in this such as the movement Agent and group Agent, which I somehow forgot to mention.

Anyways, I realise now that I could spawn a new instance fo the AI as described in TAI part 1+2 giving it control of a base and limiting its view of the world to its surrounding sectors and those units it creates. Thus a communist TAI.

And with that I announce a great change of priorities from Network Security to Improoving ones to prevent further embarassment :oops: , yuk thats a horrible smiley
Post Reply

Return to “General Discussion”