Changes between Version 4 and Version 5 of PetraBot
- Timestamp:
- Sep 22, 2014, 9:25:22 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PetraBot
v4 v5 17 17 Each 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. 18 18 == !DefenseManager == 19 19 20 The 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 20 22 == !GarrisonManager == 23 21 24 It keeps track of all units garrisoned except those garrisoned in ships for transport. 25 22 26 == !NavalManager == 27 23 28 The 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 30 Presently, transport plans are limited to configurations such as land-water-land. 31 24 32 == !ResearchManager == 25 33 It looks for new tech available and decides on which one to research. … … 31 39 The 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. 32 40 33 The queueManager controls resource allocation so it is proportional to priority. It attempts itdo 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.41 The 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. 34 42 35 43 Note: 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. … … 37 45 = [=#accessibility Accessibility] 38 46 47 The 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 49 These 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 39 51 = Variability of AI strategy = 40 52 41 53 In 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: 42 54 * 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. 45 57 46 58 Presently, these numbers are randomly chosen during the bot initialisation.