Adventure AI

From VCMI Project Wiki
Revision as of 19:23, 4 October 2012 by Warmonger (talk | contribs) (Goal decomposition)
Jump to: navigation, search

VCAI is the module responsible for player actions on adventure map.

Basic activity

AI starts with "WIN" ultimate goal and tries to accomplish it, based on win condition for certain scenario. Additionally, it performs typical actions (like building in town each turn. THis should be replaced with actual reasoning.

Strategy

Additional goals can be saved to be completed in the future. There is a list of locked heroes who are tied to particular important goals.

Goal decomposition

AI Chooses first sub-goal that may lead to completion of current goal (function striveToGoal). Decomposition is performed until there is possibility to complete the goal directly (goal is elementar). Typical elemntar action is moving hero to certain tile. Currently the first matching goal is chosen and set as target. Then AI tries to accomplish it. End of action is indicated by exception. After making an action, AI continues to decompose the main goal until all possibilities are exhaused (infinite while loop). Some goals can be abstract. When abstract goal is chosen, it becomes main goal itself. This way abstract goal can result in multiple actions from AI, until all possible actions are exhausted.

Hero goals

If returned goal is related to hero, this goal is then assigned to specific hero. Heroes continue their goals in subsequent turns, until it's complete. Every action that may result in completing teh goal must inform AI about such opportunity so that hero goal is erased. TODO: Hero goal management and preemption should be handled in organized way to avoid trashing.

List of goal types