Changes between Version 4 and Version 5 of PetraBot


Ignore:
Timestamp:
Sep 22, 2014, 9:25:22 PM (10 years ago)
Author:
mimo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PetraBot

    v4 v5  
    1717Each new cc is the root of a new base, which is governed by its own baseManager. This manager handles workers assigned to that base (for gathering, hunting, fishing, ...) through the file worker.js. It is also responsible for checking base's resources levels, building new dropsites if necessary, repairing its hurt structures.
    1818 == !DefenseManager ==
     19
    1920The defenseManager is responsible for the response to attacks (either directed towards the AI itself or towards its allies). It also deals with unit garrisoning (either garrisoning ranged units inside a "fighting" structures or garrisoning hurt units inside healing structures).
     21
    2022== !GarrisonManager ==
     23
    2124It keeps track of all units garrisoned except those garrisoned in ships for transport.
     25
    2226== !NavalManager ==
     27
    2328The navalManager is in charge of maintaining the fleet (except trader ships which are dealt with in tradeManager) and managing the transport of units (done in transportPlan.js).
     29
     30Presently, transport plans are limited to configurations such as land-water-land.
     31
    2432== !ResearchManager ==
    2533It looks for new tech available and decides on which one to research.
     
    3139The queueManager has several individual queues under its control, which each have a priority (dynamically adjustable). Plans (queueplan-building.js, queueplan-research.js and queueplan-training.js, all deriving from queueplan--.js) are created when necessary by the modules and are added to a suitable queue. The plans persist and are never destroyed until they are executed.
    3240
    33 The queueManager controls resource allocation so it is proportional to priority. It attempts it do this fairly while not locking other queues, e.g. if building an outpost (stone + wood) and there is not enough stone, the queue manager may make a lower priority house with the surplus wood. Note that this only happens between queues, the next item in a queue will block everything following it. For this reason it is generally best to have lots of separate queues.
     41The queueManager controls resource allocation so it is proportional to priority. It attempts to do this fairly while not locking other queues, e.g. if building an outpost (stone + wood) and there is not enough stone, the queue manager may make a lower priority house with the surplus wood. Note that this only happens between queues, the next item in a queue will block everything following it. For this reason it is generally best to have lots of separate queues.
    3442
    3543Note: This is the only code that ever trains or builds things. If the word is used within other modules then it means adding to to queue system in order to be trained or built.
     
    3745= [=#accessibility Accessibility]
    3846
     47The accessibility module, included in the common API, provides two maps of connected tiles, the first one for land passability, the other one for water passability. In these maps, an index is attributed to each cell such that two cells connected by a land path have the same index in the land map, and two cells connected by a water path have the same index in the naval map.
     48
     49These indexes are extensively used inside Petra. For example, when a unit is asked to gather on a field, it first looks for fields with the same index as its own, and if none is found but with different accessibility index, the unit will require a transport to the navalManager.
     50
    3951= Variability of AI strategy =
    4052
    4153In order to vary the strategy of the AI, several personality traits are used in the form of numbers between 0 and 1. Those already implemented include:
    4254  * aggressive: the higher this number, the more rushes in early game
    43   * cooperative: the higher this number, the more helpful the AI will be when an allied is attacked. It is foreseen to make this number dynamic, increasing it (very slowly) with the tributes received.
    44   * defensive: the higher this number, the more prone to build defensive structure (ready, but to be committed after A17 is released)
     55  * cooperative: the higher this number, the more helpful the AI will be when an allied is attacked. It is foreseen to make this number dynamic, increasing (very slowly) when receiving a tribute from an ally or when being helped by an ally when under attack (ready, but to be committed after A17 is released).
     56  * defensive: the higher this number, the more prone to build defensive structure.
    4557
    4658Presently, these numbers are randomly chosen during the bot initialisation.