The Glest Wiki

AI or artificial intelligence is the "mind" which controls CPU players in Glest. AI in Glest is rule based, following a set of rules at intervals.

Ruleset[]

Rule name Interval Function
AiRuleWorkerHarvest 2s Finds an idle harvester unit and tells it to harvest a resource.
AiRuleRefreshHarvester 20s Finds a harvester that is harvesting and re-assigns it to harvest a resource based on new priorities.
AiRuleScoutPatrol 10s If there are a minimum of 8 fighting units, send a unit out to scout the map (one of the other players start location).
AiRuleUnBlock 3s If there are blocked units (units that are surrounded by other units) then tell units surrounded the blocked unit(s) to move away.
AiRuleReturnBase 5s If there are idle units send them back to the base.
AiRuleMassiveAttack 1s If there are enemies in the sight of the AI player and the AI players base has at least 8 fighting units; then attack enemies anywhere on the map. If the AI players base has less than 8 fighting units, attack enemies within 25 cells of the base first.
AiRuleAddTasks (CPU Mega) 5s If there are no existing tasks queued or there are less than 4 worker units try to add one of the following tasks (in priority order shown below):

1. If there are less than 4 worker units, produce more workers.
2. Maintain units

Workers:
  • If worker units < 5 produce workers
  • If worker units < 10 produce more workers
  • If worker units ratio to all units < 20% produce more workers
  • If worker units ratio to all units < 30% produce more workers
Fighters:
  • If fighter units < 10 produce fighters
  • If fighter units ratio to all units < 20% produce more fighters
  • If fighter units ratio to all units < 30% produce more fighters
  • If worker units >= 10 produce more fighters
  • If worker units >= 15 produce more fighters
  • If fighter units < 8 produce more fighters (also if > 9 buildings produce more fighters, also if > 12 buildings produce even more fighters)
Buildings:
  • if building count < 6 or building ratio to all units < 20%, build a new building
  • if building count < 10 and worker count > 12, build a new building
Upgrades:
  • if upgrade count == 0 and worker count > 5, start an upgrade
  • if upgrade count == 1 and worker count > 10, start an upgrade
  • if upgrade count == 2 and worker count > 15, start an upgrade
  • If fighter units >= 8, start an upgrade
AiRuleAddTasks (CPU Easy) 5s If there are no existing tasks queued or there are less than 4 worker units try to add one of the following tasks (in priority order shown below):

1. If there are less than 4 worker units, produce more workers.
2. Maintain units

Workers:
  • If worker units < building count + 2 produce workers
  • If worker units > 5 and worker ratio to all units < 20% produce more workers
Fighters:
  • If fighter units < 10 produce fighters
  • If fighter units ratio to all units < 20% produce more fighters
  • If fighter units ratio to all units < 30% produce more fighters
  • If worker units >= 10 produce more fighters
  • If worker units >= 15 produce more fighters
Buildings:
  • if building count < 6 or building ratio to all units < 20%, build a new building
  • if building count < 10 and fighter count >= 8, build a new building
Upgrades:
  • if upgrade count == 0 and worker count > 6, start an upgrade
  • if upgrade count == 1 and worker count > 7, start an upgrade
  • if upgrade count == 2 and worker count > 9, start an upgrade
AiRuleAddTasks (other difficulties) 5s If there are no existing tasks queued or there are less than 4 worker units try to add one of the following tasks (in priority order shown below):

1. If there are less than 4 worker units, produce more workers.
2. Maintain units

Workers:
  • If worker units < 5 produce workers
  • If worker units < 10 produce more workers
  • If worker units ratio to all units < 20% produce more workers
  • If worker units ratio to all units < 30% produce more workers
Fighters:
  • If fighter units < 10 produce fighters
  • If fighter units ratio to all units < 20% produce more fighters
  • If fighter units ratio to all units < 30% produce more fighters
  • If worker units >= 10 produce more fighters
  • If worker units >= 15 produce more fighters
Buildings:
  • if building count < 6 or building ratio to all units < 20%, build a new building
  • if building count < 10 and worker count > 12, build a new building
Upgrades:
  • if upgrade count == 0 and worker count > 5, start an upgrade
  • if upgrade count == 1 and worker count > 10, start an upgrade
  • if upgrade count == 2 and worker count > 15, start an upgrade
  • If fighter units >= 8, start an upgrade
AiRuleProduceResourceProducer 5s + 60s If the faction uses a resource on the map and it is consumable and we have < 0 produce a harvester for that resource. If the faction uses a resource on the map and it is static and we have < 20 produce a harvester for that resource.
AiRuleBuildOneFarm 10s Find a unit that can produce a unit which has resource cost for a consumable resource if we have none of them (eg, need at least 1 farm).
AiRuleProduce 2s If we have a queued task to produce something, then this command will decide exactly what should be produced.
AiRuleBuild 2s What this rule does: If we have a queued task to build something, then this command will decide exactly what should be built.
AiRuleUpgrade 2s If we have a queued task to upgrade something, then this command will decide exactly what should be upgraded.
AiRuleExpand 30s If there are resources on the map used by the faction and we have 'seen' that resource, expand close to that resource, otherwise send scout to look for resources
AiRuleRepair 10s If we have a damaged 'base', and we have units that can repair it, then send them to repair the base. Otherwise just look for the first damaged unit and try to repair it.

See also[]