180 likes | 307 Vues
This project aims to develop an AI capable of competently playing the open-source puzzle game Penguin Attack, created by Jason Buck and Tom Kircher. The AI will function as a network client, sending and receiving game state information from a server to play effectively against opponents. To achieve this, the AI must analyze the game state for potential combos and generate move sequences, ensuring it can last at least three minutes in a game. The system is designed in Java, focusing on network communication and game strategy evolution.
E N D
A Penguin Attack AI Jason Buck CS 470 1
Project Overview • Goal • Develop an AI that can play a competent game of Penguin Attack • Why • Ensures an opponent is always available
What is Penguin Attack? • Created by myself and Tom Kircher • Open source implementation of a Nintendo puzzle game • Designed for network play
Project Requirements • Network • AI is a network client • Sends moves • Game server sends game state information • Sends game state information • Sends control signals
Project Requirements (continued) • AI • Search game state for potential combos • Generate move sequence to achieve combos • Can send a string of sequential characters • Often sends one-character strings • Must be competent • Typically able to last 3 min against me
System Design • Written in Java • Not ideal, but “good enough” • Network component • Largely isolated from AI • Connects to the server • Receive and store messages from the server • Send moves/commands from the AI to the server
System Design (Continued) • AI • Parse game state data • Update internal representation • 2D-array of ADT “PenguinAttackBlock” • Generate move sequence
Protocol • Redesigned since proposal • Client requests state information as needed • Commands are b, c, and t • Client sends move sequences • Commands are u, d, l, r, s, m • Client can notify server with quit • All other notifications are server to client
Protocol (Continued) • Server notifications: • start • pause ... start • win • lose • closing connection
Protocol (Continued) Mouse position: <2 1> Board State: b{ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 0n1. 1n1h _ _ _ _ 0n5. 1n3h1n4h _ _ 0n1.0n4. 2n5h1n2h1n5h0n3.0n4.0n1. _ _ _ 0n2.0n2.0n5. _ _ 0n1.0n3.0n3.0n4. 0n5.0n1.0n2.0n4.0n4.0n5. 0n4.0n3.0n5.0n1.0n2.0n1. 0n1.0n3.0n1.0n4.0n4.0n2. 0n1.0n2.0n3.0n3.0n2.0n2. 0n5.0n5.0n4.0n4.0n1.0n1. 0n3q0n3q0n4q0n4q0n1q0n4q } Timing: [1000 2000]
Algorithms • playPenguinAttack() loops through: raiseStackToSafeHeight(); breakGarbage(); raiseStackToSafeHeight(); levelOffStack(); raiseStackToSafeHeight(); breakGarbage(); raiseStackToSafeHeight(); makeCombosAndChains();
Evolutionary Prototyping • Strategy needed to be refined • Different leveling algorithms • Keep improving the strategy • Much time spent testing • Prototype was never ‘complete’ to my satisfaction • Never figured out how to make intentional chains • Didn’t find a way to deal with ‘accidentals’
Schedule • Didn’t keep detailed records of what happened when • Worked on it whenever course load allowed • Made majority of progress during spring break • Spent way more time than budgeted
What’s next? • Will continue beyond the semester • Preventing accidentals and intentionally making chains; AI will be brutal • Analyze the board in different ways while waiting (Threads) • Improve efficiency (Synchronized clock? Maintain own board state?) 17