Download presentation
Presentation is loading. Please wait.
Published byJuniper Jennings Modified over 9 years ago
1
Design of a real time strategy game with a genetic AI By Bharat Ponnaluri
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 Don't FightFight Don't Fight(0,0,0)(-t+1,-t,0) Fight(t,-t+1,0)(-t,-t,2*t)
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 –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 1.Determine random combinations of heuristics and constants(chromosomes) 2.Test chromosomes 3.Remove suboptimal chromosomes 4.Mutate surviving chromosomes 5.Swap data between surviving chromosomes 6.If chromosomes are optimal,end algorithm 7.Otherwise, repeat steps 1-7
12
Advantages and Disadvantages Advantages o Can function without user input o Can optimize a large number of constants o Usually is very good at optimizing stuff o Can determine unknown solutions Possible disadvantages o Genetic algorithms are complicated o Take a significant amount of computing power o 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 CooperateDefect Cooperate1,1-10,3 Defect3,-10-5,-5
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
20
Testing results Numbers greater than 1 are not good From last working version(before new heurstics) Number of Troops On Map Rendering Time Update TimeAI 101.10 0.060.55 15002.50 0.070.63 2500 2.85 0.080.56
21
Conclusion Speed is an issue Debugging was unexpectedly difficult
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.