Difference between revisions of "Adventure AI"
(→Strategy) |
(→Basic activity) |
||
Line 1: | Line 1: | ||
VCAI is the module responsible for player actions on adventure map. | VCAI is the module responsible for player actions on adventure map. | ||
= Basic activity = | = 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. | + | 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. At the end of each turn, heroes who have remaining movement points try to visit all unvisited objects within their range (wander function). |
== Strategy == | == 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 and try to realize them each turn. | 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 and try to realize them each turn. |
Revision as of 20:14, 27 December 2013
VCAI is the module responsible for player actions on adventure map.
Contents
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. At the end of each turn, heroes who have remaining movement points try to visit all unvisited objects within their range (wander function).
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 and try to realize them each turn. There is a list of reserved objects tied to heroes. If a hero tries to visit an object but can't reach it this turn, object is reserved. Other heroes will not try to visit that object until it's reached (or reserving hero is lost).
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.
List of goal types
Fuzzy evaluation
Since 0.94c AI used fuzzy logic to compare the multiple goals. Each goal returns the list of all possible subgoals via getAllPossibleSubgoals function. Then these goals are evaluated and best sub-goal is chosen for further processing. Each goal holds its last calculated value in "priority" field.
Locked heroes and preemption
Priorities of locked goals for heroes are stored and used in fuzzy comparison. The greater the priority, the less likely it is to choose particular locked hero. However, preemption is always possible. This way no heroes would get stuck on their goals if they are found outdated and suboptimal in new situation.