1 / 21

Design of a real time strategy game with a genetic AI

By Bharat Ponnaluri. Design of a real time strategy game with a genetic AI. Abstract. Current strategy game AI Involved combinations of heuristics and constants. The combinations need to be optimized for the AI to be effective

collind
Download Presentation

Design of a real time strategy game with a genetic AI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. By Bharat Ponnaluri Design of a real time strategy game with a genetic AI

  2. Abstract • Current strategy game AI • Involved combinations of heuristics and constants. • The combinations need to be optimized for the AI to be effective • Too many possible constants&combinations-->difficult optimization • Chess heuristic evaluations • Moves available • Is the king safe • Pawn structure • Material balance • Genetic AI • Can produce constants and combinations of heuristic algorithms quickly by eliminating suboptimal combinations.

  3. Introduction • Design of a simple real time strategy game • Build troops and try to take over cities • Like Risk in real time • Goal is to have an intelligent AI optimized with genetic algorithms • AI design • Coding of simple building block heuristic evaluation functions • Addition of constants(Agressiveness,stinginess) that determine behaviour • Chromosomes will be random combinations of • Heuristic evalution functions • Used to evaluate the quality of a possible course of action based on game data

  4. Personality Traits • Goal: To make the AI more interesting and humanlike • Traits • Agressiveness • Paranoia • Stinginess • Vengence • Trustworthiness

  5. Observation • AI will take advantage of other players' behavior • Examples • Assertivness • The AI will keep track of when a player retreats • The AI will attack a player which retreats a lot • Attacking game leader • One player is threatening to win • AI will track who tries to stop that player • Then the AI will let that player do the work

  6. Game Theory • Advantages • Not very complicated • Easily understandable by AI • Good model of human behavior

  7. Game Theory: War of attrition • Two players fighting over city • Backing down=loss in percieved assertiveness • Fighting=massive loss in strength • t=time that conflict lasts

  8. Sample chromosome • Chromosome •     enemyStrength()/2*myStrength()-3*fooA()/43.........+power() • Possible genes • public int fooA() • .... • public int enemyStrength() •     .... • public int myStrength()

  9. Heuristic evaluation functions • Heuristic evaluation functions • Used to evaluate the quality of a possible course of action based on game data • Example: • Public int getTrafficJamFactor() • Return ( 1.001^(number of cars))/roadSize

  10. Game Theory • Advantages • Easy to understand • Representes humanlike behavior • Simple for computer to follow

  11. How do genetic algorithms work • Replicate evolution • Steps • Determine random combinations of heuristics and constants(chromosomes) • Test chromosomes • Remove suboptimal chromosomes • Mutate surviving chromosomes • Swap data between surviving chromosomes • If chromosomes are optimal,end algorithm • Otherwise, repeat steps 1-7

  12. Advantages and Disadvantages • Advantages • Can function without user input • Can optimize a large number of constants • Usually is very good at optimizing stuff • Can determine unknown solutions • Possible disadvantages • Genetic algorithms are complicated • Take a significant amount of computing power • Networking will increase complexity

  13. Evolutionary Stable Strategies(ESS) • Gene pool of defectors means cooperating players will lose • Advantages • Diverse AI personalities • Disadvantages • May lead to suboptimal/boring AI's

  14. ESS: Example • Population of turtling AI's • AI's only counterattack or attack weak players • A more balanced AI will lose • Playing against a group of turtling AI's is boring

  15. Degree-Constrained Spanning Trees • Degree constrained spanning tree • All verticies are nodes • Maximum number of leaves per node • Genetic algorithm • Optimized weights for a heuristic evaluation function

  16. Tiddlywinks • Fit largest possible circle that does not overlap discs • Genetic algorithm • Generates random circles • Keeps the larger circles

  17. Generating a target number using a mathematical expression • Combination of numbers(1-9) and mathematical operators(-,+,*,/) adding up to a target number • Each number=4 bits • Chromosome • 0110 1010 0101 1100 0100 1101 0010 1010 0001 • 6+5*4/2 +1 • Suboptimal chromosomes-->result far from target number • Can be scaled for large numbers &decimals • No attempting to use brute force to test out random combinations.

  18. New Heurstics • Find Targets() • Average proximity • Income power factor • Troop power factor • Potential borders

  19. Testing results • Numbers greater than 1 are not good • From last working version(before new heurstics)

  20. Conclusion • Speed is an issue • Debugging was unexpectedly difficult

More Related