AI-TEM TESTING AI IN COMMERCIAL GAME WITH EMULATOR Worapoj Thunputtarakul and Vishnu Kotrajaras Department of Computer Engineering CHULALONGKORN University, Bangkok, Thailand Department of Computer Engineering, CHULALONGKORN University, Thailand
Forecast (Abstract) Have you ever wanted to develop AI for popular games, console games? When you develop AI for games, how can you test it? Is it hard to find a testbed? Are you bored of testing only PC games? Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Outline The problem of finding Game AI tesbed The concept & framework of AI-TEM Experiment: Using AI-TEM Conclusion & Future work Discussion
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator The Problem Criteria of Testbed game. Not too simple. Has many ways to play. Allows AI to show off its cleverness. High quality, Nominee name, Accepted games. What will you do to have that Testbed? Develop a game for testing from scratch. Use tool sets from some games. Find open source games. Find a game company that can give you source of their game. Use Testbed.
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Inspiration of AI-TEM Want to test AI in Winning Eleven, Street Fighter, The King of Fighter. Robot, press controller, see the game. (R.O.B, Gyromite?) Emulator & ROM can do that! Observe game state, send controller signal.
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Emulator & ROM += Game cartridgeROM DumperGame ROM Game consoleGame emulatorEmulated game ROM DATA
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator AI-TEM Framework Emulator (VBA) Game (ROM) Menu Control Game State Observer Game State Normalize AI Python Interface Input Controller Artificial Intelligence Testbed in Emulator
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator AI-TEM with VBA Why VBA? - Open Source - Many supporting tools - Many interesting games - Familiar AI-TEM, VBA, VBA Link
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Test game, Street Fighter Zero3 One of the best fighting game. Also known as Street Fighter Alpha3. Has many ways to play. Can separate expert from novice. Classic game, 1998 – Credits: shinken209 From youtubeCredits: CybeRAkumA From youtube * Video from Arcade Version
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator The Working of AI-TEM Game State Observer 1P Position X Address: 0x20007C2 Value(16 bits): 002C(h) 002C = 44 Game state Normalizer Normalize by subtract 44 1P Position X = 0 AI (run loop) Char1.m_posX = 0 Int delta = abs(char1.m_posX – char2.m_posX); If (delta <= 10) { // do attack… } AI Character Class m_side: m_healthPoint: m_posX: m_posY: m_animation:
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Example STZ3 Game state Address Game State DataAddressData SizeExample* character 1 position x axis0x20007C216 bits288** character 1 char ID0x20008EA8 bits0 character 1 bullet position x axis0x200C0DA16 bits430** character 1 HP Bar0x bits144 character 1 Animation0x20007D032 bits4992** character 2 position y axis0x20043D632 bits95** *Example, not exactly real value. **After normalized
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Example STZ3 RYU Animation Data Punch Shoryuken Etc *Value after normalized
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Example Python Interface Function CPGetData(PyObject *self, PyObject *args) CPPressCustomCombo(PyObject *self, PyObject *args) Data ID GET_ANIMATION GET_POSX GET_GAUGE Object ID STZ3_P1 STZ3_HP_BAR_P1 STZ3_ISM_BAR_P2 p1x = stz3.CPGetData(ptr, GET_POSX, STZ3_P1) p2x = stz3.CPGetData(ptr, GET_POSX, STZ3_P2) delta = abs(p1x - p2x) mytuple = ((PRESS_DOWN, 2), (PRESS_DOWN|PRESS_RIGHT, 2), (PRESS_RIGHT, 2), (PRESS_B, 2), (0, 10)) if delta > 150: stz3.CPPressCustomCombo(ptr, mytuple)
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Discussion Is it hard to use? About Finding Address. Game State Address is specific for game. About Collecting Game Data for reference. (Animation data, Position range, Sprite size) Which AI to test? (Method, Topic) What game type? (Fighting, Soccer, FPS, RTS, …) VBA in AI-TEM.
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Fight for the future… Next scope for STZ3. Other ISM. Other Emulators: Arcade, PlayStation. Other Games. Other features.
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Thank you ~
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Tools supporting AI-TEM Movie Record Save / Load State AI Automatic data collection Help collecting game state data for use in AI Help debugging AI Supporting AI Module - Help collecting game state data for use in AI - Help debugging AI - Help in training AI, Automatic Battle tool (new) Game State Observer Memory viewer Cheat search Memory Compare Modified to be Game State Observer Help finding address for use in Game state Observer Supporting Game State Observer - Finding Game State Address - Modified to be Game State Observer VBA Original ToolsModified Tools
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Auto Animation Collection Tool (for STZ3) For every character: Force value in address 20007C2 to change character animation Capture frame Ryu Value 0* Ryu Value N* …… … … Eagle Value 0* Eagle Value N* … Customize (.ini file) - Destination Folder - Number of Frames capture - Character list *Example only
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator (New) Auto Battle Tool (for STZ3) Automatic long run battle. Use for some AI that needs it. (Ex. Learning type AI) Customize (.ini file) - Number of Matches - Time for each match - VS Characters - ISM, Rounds - Built-in AI or Python AI *New tool, not mentioned in paper
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Search for Game State Address (1) Search produces 14,756 results, “Please refine better” Search produces 1,368 results, “Please refine better” Example: Position Address Use VBA Cheat search. Old value, 16bits Equal, Hexadecimal 2 Search for addresses of which values increase. Cont... 1 Begin...
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Search for Game State Address (2) Search produces less than 1,000 results, Search produces interesting result. 4 Search for addresses of which values decrease. 3 Still Search for addresses of which values increase. 5 Check 20007C2 in memory viewer… It’s OK.
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Beware of Data Size when search Continue to move forward. And search for address which value increase. Address 20007C2 8 bits: FF 16 bits: 01FF Address 20007C2 8 bits: bits: 0220 Notice: 8bit value is decrease because overflow. 8 bits will not found. 16 bits will found. *Example only: Value not match to real situation.
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Memory Compare Tool & Game State Data Dump -WriteGMDFile -> *.GMD -N GMD files -Memory Compare Tool -Set condition -6 Result files 8, 16, 32 bits. Signed, Unsigned
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator About Coordinating Reference Pic1 Pic2 Left side Pic3 Right side Red line is reference point for address 20007C2 RYU sprite size 32p 1-4 Line3: middle of sprite 2C(h) = 44, 10p + 12p = 22p = 44u
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Legal Information Is emulation really legal? Ok, so it's legal, but is it right? Are ROM images legal? Is distributing ROM images legal? From: GAMEBOY-ADVANCE.net
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator Thank you ~
Department of Computer Engineering, CHULALONGKORN University, Thailand AI-TEM: Testing AI in Commercial Game with Emulator