1 / 16

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 method of AI programming: Functions combinations of evaluation functions+constants Disadvantages of current method Difficult to generate good combinations

danil
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 method of AI programming: • Functions combinations of evaluation functions+constants • Disadvantages of current method • Difficult to generate good combinations • Difficult when brute force calculations are not feasible • A skilled player can often beat a handicapped AI with a signficant numerical advantage.

  3. Images from: http://www.twcenter.net/forums/showthread.php?t=359530

  4. How do GAs 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

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

  6. 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 • GAs are complicated • Take a significant amount of computing power • Networking will increase complexity

  7. 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

  8. 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

  9. Important Classes • Classes • FormualaGenerator: • Driver Program • GraphPanel: • Draws the graph of the average fitness and maximum fitness. • Makes the GA run periodically in synchornization with the graph. • Chromosome: • Represents the chromosomes/expressions.

  10. 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 • Sample Expressions for 150 • Static Mutation 1.0292804250299605 + ((2.7400839829565777 / 1.0605221382369576) * 7.741718241469524 * 7.316070011134583) - ((-0.9821438516501173) / 4.043144676725913) + (0.9986661909539591 * 6.634650893629718 * 0.3645726822807098) = 150.026535 --Dynamic Mutation 1.0292804250299605 + ((2.7400839829565777 / 1.0605221382369576) * 7.741718241469524 * 7.316070011134583) - ((-0.9821438516501173) / 4.043144676725913) + (0.9986661909539591 * 6.634650893629718 * 0.3645726822807098) = 150.026535

  11. Generating a formula for an input-output pair -Formula: x^4+x^3+x^2+x+1 -Sample Expressions -1*x/3-3*x+8-1*x+9-10*x*7-5*x*9/6*x+10*5*x*6*6*x-3/8*x+7-8*x+4*5*x*4-9*x+4-6 -9*x*9*2*x*9*3*x/3+5*x-5*1*x/9/2*x/7*8*x*1/7*x*5/8*x-4-7*x/5*4*x*4/1*x/4*6 -Conclusion: Polynomials are not recognized.

  12. Analysis of results • Using dynamic muation rates did not help • The GA generally works but occasionally crashes due to a bug which deletes all the chromosomes • The average change and static deviation in fitness does not change • Shows that the GA does not get stuck on local exterma.

More Related