Package horizons :: Package ai :: Package aiplayer :: Package behavior :: Class BehaviorManager
[hide private]
[frames] | no frames]

Class BehaviorManager

source code

BehaviorManager holds BehaviorComponents. Entities such as CombatManager or StrategyManager ask BehaviorManager to perform and action, or create a mission object. BehaviorManager does these based on behavior probability and likelihood of success.

Instance Methods [hide private]
__init__(self, owner) source code
__init(self, owner) source code
save(self, db) source code
_load(self, db, owner) source code
request_behavior(self, type, action_name, behavior_list, **environment) source code
request_action(self, type, action_name, **environment) source code
request_strategy(self, type, strategy_name, **environment) source code
get_conditions(self) source code
get_best_behavior(self, behavior_iterable)
Get best behavior from behavior_iterable (linear time).
source code
Returns a random token for player profile.
source code
Class Methods [hide private]
load(cls, db, owner) source code
Class Variables [hide private]
  action_types = Enum('offensive', 'defensive', 'idle')
  strategy_types = Enum('offensive', 'idle', 'diplomatic')
  log = logging.getLogger("ai.aiplayer.behavior.behaviormanager")
Method Details [hide private]


source code 

Returns a random token for player profile. Token is used when requesting for a random behavior profile. Because it is guaranteed to get exactly the same player profile for given token, instead of storing whole Profile in database, we store a single number (token) which on load() generates same set of actions.