Due to a sudden burst in spammer activity, account creation has been temporarily disabled. Sorry for the inconvenience to any new potential contributors.

AI Agents

From AGEWiki

Revision as of 10:48, 2 November 2012 by Lodilefty (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

AI Agents

AI Agent is a way of guiding the AI that is more directed than the method of using commands like AI.SetAggro or AI.SetLocalInterest. These commands will alter the AI behavior by rendering it more or less aggressive over a theater, or regarding some regions as very interesting (or not interesting), but you don't get to specify which force does what.

On the contrary, adding an AI Agent will alter the behavior of a given stack significantly. AI Agents are added to a specific leader, changing the way he behaves by generating agendas* for this leader that are compliant with the Agent goal.

It is important to understand that the Agent is not preventing the leader from getting agendas by the normal, generic method. The Agent will generate agendas for the leader that are strong and will often prevail, but that's all.

Agenda (definition)*

An agenda is a mission created by the AI engine, for a given stack. The Agenda is a proposal, i.e the mission is not yet chosen definitively for the turn (or turns). Generally a force will receive from 1 to 3 such proposals per turn, and will pick one.

Often, the more interesting one is picked but not always, for sake of unpredictability.

AI Agents add their own agendas to the list of agendas the stack will pick from. These agent-generated agendas will often supercede, in normal circumstance, the others generic agendas, but not always (lack of supply, etc.)

Current Status

The AI Agent code is still much in development. It can do things of interest, but consider this functionality as a work in development. We are waiting for some 'serious' actual use of agents before adding functionalities. It serves nothing to add code nobody uses in the end!


Leader & AI Agent

For now, an AI Agent must go on a leader, and only one Agent should be active on a leader at a given time. You can consider the agent as an advisory, although he can also be seen as a parasite that will force the leader to do things that can be contrary to the best perceived interest of the stack (the leader is called internally the host). This is also a difference with the previous commands, an AI Agent can generate an agenda that can result in the suicide of a stack. AI.ChgLocalInterest can't do that.

Agents definition

Definitions for agents are created using a XLS file, that will generate aia files. These definitions will allow many parameters to be set by default, when you script an agent. Not using this data configuration would have forced to specify all parameters of each agent, each time you add one (and it is possible that some years from now, agents will have dozens of potential parameters).

Database Fields

General Information

  • UID: from 0 to XX. 0 will be used for Erroneous Agent detection.
  • Name: Internal Name to use. Don't appear anywhere (no need to localize)
  • Kind: Agent kind, it combines two concepts: on what or who the agent is, and what it does. The accepted values are:
    • $agkUndefined = -1 (this will result in an error if used)
    • $agkOLRegionsList= 0 (the agent is an "On Leader Region List" agent)
Basically, for now, only 0 is allowed...
Internally, from the kind, the code will deduce on what the agent is, but you don't have to care about that.
This internal field is called Agent Host Kind, for your personal knowledge.

Objective Rule

How the objective is determined. Obviously some rule won't apply, when there will be different agent kinds,
for now, as we have only one kind, all rules are compatible with  kind 0:
  • ObjectiveRule
    • aorUndefined = -1;
    • aorRandom = 1; // one hostile objective among all objectives is picked at random
    • aorFIFO = 2; // the first hostile objective listed in the list is picked, if not achieved
    • aorFollowTrack = 3; // controlled objectives are not skipped, and next one is the one after our current position

Other fields

  • DormantOnAllDone  : boolean; // if no objectives at all, switch to dormant (forever) (false by default)
  • RemObjOnAchieve  : boolean; // Remove objective from list if reached by self and controlled = achieved (true by default)
  • RemAllControlObj  : boolean; // Remove each turn any objective that is not enemy, whatever our position (false by default)
  • SkipHealth  : integer; // Agent is skipped for a single turn (tested each turn) if avg health is this % or lower within the host group
  • SkipCohesion  : integer; // Agent is skipped for a single turn (tested each turn) if avg cohesion is this % or lower within the host group
  • Priority  : integer; // Indicate the priority between agents, common values are 100 (low), 500 (high), 1000 (very high) [Default = 300]
  • LowHits  : integer; // if units max hits is under this value, try to get extra units
  • HighHits  : integer; // the reverse, release units if too much max hits (= hits if all units are full strength, not current hits)
  • Attributes  : string; // string attributes attrib1 value1|attrib2 value2 ...

If an agent is skipped, then only generic agendas will be added to the stack.

Examples and comments

UID = 1
Name = Sea Patrol
Alias = aiaMainFleetPatrol
Kind = 0
ObjectiveRule = 3
RemObjOnAchieve = 0
SkipHealth = 35
SkipCohesion = 35
Priority = 500
LowHits = 150
HighHits = 1000

This one is doing a (sea) patrol, because objective rule is 3, meaning "controlled objectives are not skipped, and next one is the one after our current position". This is necessary, as seas are never possessed by anyone, and you want the agent to force the leader to go in each region one by one.

RemObjOnAchieve is set to 0, so that the list of regions is never trimmed down. The other parameters remain with default values. Basically if you script an agent with the command to make a round trip (region1 > region2 > region3 (with region3 being adjacent to region1)), the leader will do that endlessly...

...Until the generic algorithms kick in, for example resupply or repair. If there is a need to resupply or if cohesion is low, then chances are that the fleet will return to a port. Same if an opportunity to sink an enemy fleet is there.

UID = 2
Name = Control Once - Large
Alias = aiaControlOnceLarge
Kind = 0
ObjectiveRule = 3
DormantOnAllDone = 1
RemObjOnAchieve = 1
SkipHealth = 35
SkipCohesion = 35
Priority = 500
LowHits = 500
HighHits = 1000

This one uses again the follow track objective rule, but removes the region it is in once reached (RemObjOnAchieve), and is inactive once there are no more regions.

Basically the force will describe a path, perhaps picking up troops along way (if LowHits kick in) and then the agent 'disappear' and the force is free to operate.

The FIFO objective rule works almost the same except friendly regions are skipped, so you can beeline against the enemy. Or you can have a patrol that only try to keep all objectives under control.

Adding Agent

You can only add an agent that goes onto a leader, with this command

AI.AddLeaderAgent

For now, the agent can't be removed, but it can go inactive by itself, depending of its settings.
Forums