Strategic

strategic behaviors

  1. Capture building
  2. Equip garrison (army split/transfer)
  3. Pickup item
  4. Transfer item
  5. Attack / follow
  6. Recon
  7. Wait
  8. Patrol

strategic advisers

  1. Diplomacy memory matrix (1-2-1 relationship, impluse mods, time decay)
  2. Object/location memory with time decay
  3. Threat memory
  4. n-dim Personality model with fuzzy deduction (weighted) (0.5 * aggressiveness + 0.3 * conqueror-coeff → + exploration )
  5. extension of Personality model - motivation graphs: weighted stimuli network
  6. blackboard model with priorities
  7. economic model - calc resources availability to the certian date according to current survey. plan development and beast purchases
  8. ambush / defence planners (?)
  9. timed events
  10. partial plan traces outcome memory - tracks success and failure of the performed plans, affects plan selection by evaluating efficiency value
  11. multiple tiers of planning, that is tactical behavior depends on strategic plans
  12. opponent anticipation - predicting player behavior from his actions
  13. naive bayes classifier (NBC / AIW3-622) - for example can predict the (probability) outcome of the army encounter based on context parameters of the previous cases. Works best with discrete inputs. for example (Pl-Atl,Pl-Def, Highest-lvl-u, Am-power)..
  14. K-nearest classifier may be used instead of bayesian in special cases
  15. hidden markov models - to predict player behavior (AIW3-634)
  16. preference based player modeling (AIW3-647)

Goal trees and think cycle

AI Wizdom 3 / p. 321

  1. Select apropriate ego
  2. Identify and prune inactive and finished goals.
  3. Calculate base priority for each active goal
  4. Assign inital resources to the goals (distribute according the rules)
  5. Optimize resource allocations to increase total current priority
  6. Make every goal which has enough resources as assigned to make execution possible and send commands to the actors

Case Based Reasoning

Case Based Reasoning = Analogy + (Case) Adaptation + (Knowledge) Retrieval + Learning

Closer look

What cases contain

The approach is to store and reuse traces of how those solutions are derived. By capturing and replaying the reasoning trace involved in selecting problem-solving operators, rather than the problem solving steps themselves, the derivational analogy approach facilitates application of stored traces of processing to wider class of problems. Systems may also reuse reasoning traces for introspective reasoning and learning.

How to retrieve

A problem description was formed and used to select a relevant case. However, the indices needed are inextricably tied to the contents of the case library (which may change). Consequently, CBR research is also investigating the role of bottom-up influences to guide retrieval, favoring features that are useful to discriminate between cases in memory.

Adaptation

Developing case adaptation criteria is a central open challenge for CBR. The case adaptation process in CBR systems is usually done by rule-based systems. Consequently, correct case adaptation requires that those rules capture both a theory of case adaptation, and the needed aspects of the domain theory to carry out changes. As a result, developers defining adaptation rules must re-confront the knowledge acquisition problem for rule-based systems. Additional problem may arise because available cases can lack the internal structure needed for effective adaptation. Nevertheless, difficulties with case adaptation have led many CBR systems to simply dispense with adaptation, replacing retrieve-evaluate-adapt cycle with retrieve and propose systems. Such systems exploit the memory process developed in CBR research, while relying on a human user to adapt and evolve solutions.

Similarity assessment

One issue in similarity assessment is how to determine the right features to compare. Decisions about which features are important are often based on explanations of feature relevance. Another problem what for some tasks, input problem descriptions are not sufficient to determine the similarity of old and new situations.

Techniques

Building AI isn’t easy task itself, so here will come break down to small specific techniques and methods...

Expect more to come!

Types: Event-driven FSM AI DSL (?) Coroutines & lazy multitasking


Blackboard system for inter-agent communication and contributing toward the partial solution.


Solving resource allocation problem (extend one to one problem)


— high level - strategy & economics manager —-

— city management - builder —

rules based decision maker ( sort of expert system )

target(params): requirements > action; example: hire(unit_lvl1,num): require( dwelling_lvl1, resources_to_hire( unit_lvl1, num ), availability( unit_lvl1, num ) ) » hire ..



— hero management - tactician —-

Planning & Micromanagement

Planning and realistic micromanagement 1) in strategy games is troublesome but definitely doable. Lets look in details:

Hierarchical decision making

Imainge we have a limited set of top-level request or tasks which AI might need to acomplish. No matter how difficult the tasks they could be decribed in terms of requirements and results or inputs and outputs respectively.

Task Acquire ‘X’ Peasants
Requires X*5 Gold
Requires Peasant Hut
Result X Peasants
Result -X*5 Gold

Task Build Peasant Hut
Requires 20 Gold
Requires 10 Wood
Result Peasant Hut
Result -20 Gold
Result -10 Wood

Task Exchange Wood for Gold
Requires X*2 Gold for wood
Requires Black Market
Result -X*2 Gold
Result X Wood

Task Build Black Market
Requires 30 Gold
Result Black Market built
Result -30 Gold

Diplomacy & Alignment

Fuzzy decision making

Memory-enhanced & Memory-less models

43 Sun Tzu warfare strategy rules

  • 1. Support your armies with supplies that are gained in conquest
    • Enabling actions: Capture resources; Attack
    • Recognition rule: The user’s forces have just defeated an opponent’s forces by attacking them, followed by the capturing opponent resources near the location of the battle.
  • 2. Deceive your enemy by feigning inaction, preparation, and disorder of your army
    • Enabling actions: Pretend preparation; Pretend disorder
    • Recognition rule: The user’s forces are adjacent to opponent forces, but not yet in battle. The user then pretends preparation or pretends disorder.
  • 3. Bait your enemy into advancing by providing a false opportunity
    • Enabling actions: Provide false information
    • Recognition rule: The user’s forces are near an opponent’s forces, but not yet in battle. The user then provides false information to the opponent.
  • 4. Cause an enemy to attack at an inopportune time by irritating them
    • Enabling actions: Taunt opponent
    • Recognition rule: The user? forces are adjacent to an opponent’s forces, but not yet in battle. The user then taunts the opponent? forces.
  • 5. Reduce the readiness of your enemy by occupying their time with distractions
    • Enabling actions: Distract enemy
    • Recognition rule: The user? forces are near an opponent? forces, but not yet in battle. The user then distracts the enemy.
  • 6. Reduce the risk of draining the state? wealth by conducting only short campaigns
    • Enabling actions: Attack, Move forces to location
    • Recognition rule: The user moves forces from the user? base, executes an attack, and returns the forces to the user? base within a threshold period of time.
  • 7. Reduce the costs of war by striking vital targets of the enemy first
    • Enabling actions: Destroy/disable enemy resources
    • Recognition rule: The user’s forces destroy/disable enemy resources of high value without attacking closer targets.
  • 8. Conquer your enemy as a whole to avoid the problems of partial victory
    • Enabling actions: Accept surrender
    • Recognition rule: The user accepts the surrender of the central leadership of an opponent without accepting the surrender of an opponent’s provincial or territorial leadership.
  • 9. Surround your enemy when your forces greatly outnumber them
    • Enabling action: Move forces to location
    • Recognition rule: The user’s forces are adjacent to an opponent’s forces, which are of significantly smaller size. The user moves their forces such that the opponent’s forces are positioned in their center.
  • 10. Schedule attacks when the defenses of your enemy are down or reduced
    • Enabling actions: Attack
    • Recognition rule: The user’s forces attack adjacent opponent forces at a moment when the defensive strength of the opponent is lower than average.
  • 11. Divide your army when you are several times strongerthan your enemy
    • Enabling actions: Move forces to location; Attack
    • Recognition rule: The user’s forces are adjacent to an opponent’s forces that are significantly smaller, the user moves a portion of their forces to a different location and attacks the opponent with the remaining forces.
  • 12. Attack an enemy if you believe your forces are equal in strength to the enemy
    • Enabling actions: Attack
    • Recognition rule: The user’s forces are adjacent to an opponent’s forces that are of nearly equal size. The user executes an attack on the opponent.
  • 13. Avoid attacking an enemy if you believe the enemy overpowers your forces
    • Enabling actions: Defend
    • Recognition rule: The user’s forces are adjacent to an opponent’s forces that are of greater size. The user does not execute an attack on this force for a period of time that is greater than some threshold.
  • 14. Flee when your forces are greatly overpowered by those of an enemy
    • Enabling actions: Flee/retreat
    • Recognition rule: The user’s forces are adjacent to an opponent’s forces that are many times greater. The user flees or retreats to a different location.
  • 15. Have a strong defense in place and wait for an opportunity to attack
    • Enabling actions: Defend; Attack
    • Recognition rule: The user’s forces are adjacent to an enemy’s forces, which are attacking the user. The user repeatedly executes a defense over a period of time, and then executes an attack when variable conditions for success are met.
  • 16. Gain the support of the nearby civilians when fighting an enemy army
    • Enabling actions: Befriend civilians
    • Recognition rule: The user executes an attack on an opponent after attempting to befriend civilians in locations near the location of the battle.
  • 17. Overcome the defenses of an enemy by conducting a sustained siege
    • Enabling actions: Siege stronghold; Supply forces
    • Recognition rule: The user repeatedly executes a siege on an opponent’s stronghold while delivering supplies to the forces conducting the siege.
  • 18. Use long-distance signaling to coordinate the actions of large armies
    • Enabling actions: Signal own forces; Wait for signal
    • Recognition rule: The user causes part of their forces to do some other action after waiting for a signal, which is delivered by a different part of the user’s forces, who also do some action after signaling.
  • 19. Be more prepared than your enemy by reaching the battlefield first
    • Enabling actions: Move forces to location; Attack
    • Recognition rule: The user executes an attack on opponent forces after occupying the location of the battle for a greater period of time than the target of the attack.
  • 20. Move your troops only through neutral or uncontested territory
    • Enabling actions: Move forces to location
    • Recognition rule: The user moves their forces outside of the territory they defend where the location of the troops is never in an area that is defended by an opponent’s forces.
  • 21. Position your troops in locations that are unassailable
    • Enabling actions: Move forces to location
    • Recognition rule: The user moves their forces to a location where it is not possible that an opponent can attack the user while they are there from any other location.
  • 22. Ensure that your forces are faster than the enemy to keep the option of retreat
    • Enabling actions: Flee/retreat; Attack
    • Recognition rule: The user attacks the opponent forces when the speed of the user’s forces is greater, and does not attack the opponent forces when it is less, over a period of time greater than some threshold.
  • 23. Force an entrenched enemy to move by attacking somewhere else
    • Enabling action: Attack; Move forces to location
    • Recognition rule: The user’s forces are adjacent to an opponent’s forces that hold an unassailable position. The user moves their forces to a different location to attack other forces of the opponent.
  • 24. Prevent attacks by displaying unexplainable behavior to the enemy
    • Enabling action: Pretend disorder; Pretend preparation
    • Recognition rule: The user’s forces are adjacent to opponent forces, but before attacks have been initiated. The user begins to pretend disorder or pretend preparation.
  • 25. Cause an enemy to spread their defenses by enabling many points of attack
    • Enabling action: Move forces to location
    • Recognition rule: The user moves their forces to multiple locations adjacent to opponent units and resources and has not yet initiated an attack.
  • 26. Rouse an enemy with false starts in order to reveal their intended counterplans
    • Enabling actions: Pretend to attack
    • Recognition rule: The user’s forces are adjacent to an opponent’s forces, but have not yet attacked. The user executes a command to pretend to attack.
  • 27. Send light troops when speed is more important than force
    • Enabling action: Move forces to location
    • Recognition rule: The user separates their forces in two such that one portion has a speed that is significantly faster than the other, then moves the faster force to some location.
  • 28. Get advice from local guides when traveling through foreign territory
    • Enabling actions: Befriend civilians; Ask for directions; Move forces to location
    • Recognition rule: The user moves forces into a territory that they do not control, then befriends civilians in this territory,then asks for directions through the territory.
  • 29. Leave an enemy a means of retreat to prevent desperate defensive action.
    • Enabling actions: Move forces to location; Attack
    • Recognition rule: The user moves their forces to locations adjacent to an opponent and executes an attack, where it is never the case that the opponent cannot execute a flee/retreat action.
  • 30. Schedule your attacks when an enemy is half mired in bad terrain
    • Enabling actions: Attack
    • Recognition rule: The user’s forces have a position adjacent to an opponent’s forces, which are moving across terrain that isdifficult to pass. The user initiates an attack at a moment when half of the opponent’s troops are in the difficult terrain.
  • 31. Delay the movement of your troops across terrain that will improve.
    • Enabling actions: Move forces to location
    • Recognition rule: The user moves forces to a position adjacent to terrain that varies in difficulty over time. The user then moves these forces into the terrain at a moment when the condition of the terrain is better than when the forces first arrived.
  • 32. Position your enemy between your troops and terrain that is difficult to cross
    • Enabling actions: Move forces to location
    • Recognition rule: The user moves forces to a location adjacent to an opponent’s forces, such that the opponent is adjacent to bad terrain on the opposite side.
  • 33. Guard the territory that contains the supply lines of your forces
    • Enabling actions: Patrol territory, Supply forces
    • Recognition rule: The user is sending supplies to forces, where the supplies are traveling over terrain that is being patrolled by a portion of the user’s forces.
  • 34. Overtake a greater enemy by capturing something that they value highly
    • Enabling actions: Capture resources
    • Recognition rule: The user captures a resource of an opponent with a much greater force, where the resource is among those that are ranked highest in value.
  • 35. Put your forces at risk to strengthen their determination to succeed
    • Enabling actions: Move forces to location; Disable own resources
    • Recognition rule: The user disables resources used in an attack or moves forces to a disadvantageous location when otherspositions are available, and then attacks an opponent’s forces.
  • 36. Mystify your troops with false reports and appearances to ensure plan secrecy
    • Enabling actions: Pretend disorder; Pretend preparation; Act bizarre
    • Recognition rule: The user causes their leadership units to pretend disorder or preparation, or disseminate false information to their own subordinate troops.
  • 37. Attack an enemy over and over again to progressively weaken their defenses
    • Enabling actions: Attack
    • Recognition rule: The user unsuccessfully executes an attack on an opponent’s force repeatedly over a period of time in the same manner.
  • 38. Destroy any records that would allow your enemy to learn your plans
    • Enabling actions: Destroy planning records
    • Recognition rule: The user causes the leadership units to destroy planning records.
  • 39. Close frontier passes and stop the passage of emissaries to block information flow
    • Enabling actions: Block pathway; Prohibit emissary movement
    • Recognition rule: The user blocks all pathways that enable units other than their forces to enter or exit the user’s territory, and then prohibits emissary movement.
  • 40. Use spies that hold positions high in the chain of command of enemy forces
    • Enabling actions: Enlist spy
    • Recognition rule: The user attempts to enlist a spy that is a leadership unit in an opponent’s force.
  • 41. Use the spies of your enemy as double agents
    • Enabling actions: Enlist spy
    • Recognition rule: The user attempts to enlist a spy that is a revealed spy of an opponent.
  • 42. Provide false information to enemy spies when you know who they are
    • Enabling actions: Provide false information
    • Recognition rule: The user provides false information to a unit that is a spy for an opponent.
  • 43. Gather information about enemy tactics from soldiers that survive lost battles
    • Enabling actions: Gather war stories
    • Recognition rule: The user causes leadership units to gather war stories from user forces that have executed a retreat or fleeing action from a battle.

Augmenting strategic play (Age of Empires example)

Accept surrender (supported): Enemies can become allies using during the game through various diplomacy mechanisms. Ask for directions (unsupported): A new command could ask neutral, newly aligned, or converted units to reveal portions of the map that they have seen. Attack (supported): Clicking on a target when a unit is selected causes it to attack. Befriend civilian (supported): Unaligned units at the beginning of a game become allied when a unit approaches them. Block pathway (supported): Villagers can construct walls to block the travel of units. Capture resources (supported): Monks can convert enemy units including some buildings. Defend (supported): Military units can be commanded to adopt a defensive stance. Destroy planning records (unsupported): A new technology of town centers or castles should disable an opponent’s spy technology. Destroy/disable enemy resources (supported): Enemy buildings and special units can be attacked and destroyed. Destroy/disable own resources (supported): A player’s units and buildings can be deleted. Distract enemy (unsupported): A new command for a military unit should cause enemy units in a defensive stance to move toward a specified location. Enlist spy (supported): Spies is a technology that reveals explored enemy territory. A more strategic implementation would create special spy units that could pass unnoticed in enemy territory, and could be enlisted as double agents. Flee/retreat (unsupported): A new combat stance should cause units to quickly move away from any enemy unit, perhaps at the cost of defensive strength. Gather war stories (unsupported): A new command should allow military units that have returned from battle to improve defensive technologies, or improve the ability of military units that they are grouped with. Move forces to location (supported): Clicking on a destination moves individual or groups of units. Patrol territory (supported): Military units can be commanded to patrol a specified territory. Pretend disorder (unsupported): A new combat stance should cause military units to move in unpredictable ways, possibly increasing their defensive strength. Pretend preparation (unsupported): A new combat stance should cause military units to appear to be preparing an attack, possibly increasing their defensive strength. Pretend to attack (unsupported): A new combat stance should cause military units to appear as if they are attacking, possibly increasing their defensive strength. Prohibit emissary movement (supported): Gates can be ordered locked and trade carts & ships can be commanded not to travel. Provide false information (unsupported): A new technology for town centers or castles should cause opponents with spy technology to report incorrect map information. Siege stronghold (supported): Siege weapons (and other military units) can attack enemy buildings. Signal own forces (unsupported): While the game allows signaling of allied forces in multiplayer games, it should also allow the triggering of units waiting for a signal (see Wait for signal, below). Supply forces (unsupported): A new command for trade carts should cause them to move between town centers and distant military units or siege weapons, replenishing their strength upon each arrival. Taunt opponent (supported): Preset taunts can be sent to other teammates & opponents using the chat interface, although it is unclear if computer players react to these taunts. Wait for signal (unsupported): A new command for a military unit should delay a specified command until a signal is received (see Signal own forces, above).

Pattern matching for making soft decisions

Defined as

  • World state: world[...]
  • World symbols: [TYPE={bool,int,real},NAME=str}
  • Rule patterns: [ ANY | CONST | B-EXP ] ...
A  B  C  D
3  x  x  1 [a
x  x  x  5 [b
1  2  3  4 [c
1  2  x  4 [d

order: 
# b
switch D
	case 5: ret "b"
	case 1:
		if A == 3 ret "a"
		brk
	case 4:
		if ( A == 1 && B == 2 ) 
			if  ( C == 3 ) ret "c"
			else ret "d"
ret ""


Format definition of magic system

  • if NEGATION_in_effect → bail out
  • calc DISPELL_POSSIBILITY

Battle estimates

  • POWER_BALANCE - absolute balance of estimated army power {-1..1}, |1| ~ 50%
  • UNIT_BALANCE - relative balance of number of units
  • $SPELL_CASTED - is spell already casted or not
  • $POWER_DECAY_TREND - how fast army is decreasing (per turn)
  • etc
1) In turn-based strategy games, micromanagement is a style of play where the player manages the fine details of the game, as well as overall strategy.
 
pocket_heroes_ai_project.txt · Last modified: 2008.04.30 03:05 by admin
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki