270 likes | 401 Views
AITEM: Testing AI in Commercial Game with Emulator. AI-TEM TESTING AI IN COMMERCIAL GAME WITH EMULATOR. Worapoj Thunputtarakul and Vishnu Kotrajaras Department of Computer Engineering CHULALONGKORN University , Bangkok , Thailand.
E N D
AITEM: Testing AI in Commercial Game with Emulator AI-TEMTESTING 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
AI-TEM: Testing AI in Commercial Game with Emulator 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 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 cartridge ROM Dumper Game ROM ROM DATA + = Game console Game emulator Emulated game Department of Computer Engineering, CHULALONGKORN University, Thailand
Menu Control Python Interface Game State Normalize Game State Observer Game (ROM) AI Emulator (VBA) Input Controller AI-TEM: Testing AI in Commercial Game with Emulator AI-TEM Framework 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 AI-TEM, VBA, VBA Link Why VBA?-Open Source- Many supporting tools - Many interesting games- Familiar http://vba.ngemu.comhttp://vbalink.wz.cz/index.htm 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 – 2006. Credits: shinken209 From youtube Credits: CybeRAkumA From youtube * Video from Arcade Version Department of Computer Engineering, CHULALONGKORN University, Thailand
AI (run loop) Char1.m_posX = 0 AI Int delta = abs(char1.m_posX – char2.m_posX); If (delta <= 10) { // do attack… } Character Class m_side: m_healthPoint: m_posX: m_posY: m_animation: 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 Department of Computer Engineering, CHULALONGKORN University, Thailand
1 4 4 1 5 5 2 2 3 3 6 6 AI-TEM: Testing AI in Commercial Game with Emulator Example STZ3 Game state Address *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 ~ http://www.cp.eng.chula.ac.th/~g48wth/aitem.htm Worapoj.T@student.chula.ac.th Vishnu@cp.eng.chula.ac.th Department of Computer Engineering, CHULALONGKORN University, Thailand
AI Automatic data collection Help collecting game state data for use in AI Game State Observer Memory Compare Help finding address for use in Game state Observer Save / Load State Cheat search Help debugging AI Movie Record Modified to be Game State Observer Modified Tools VBA Original Tools Memory viewer AI-TEM: Testing AI in Commercial Game with Emulator Tools supportingAI-TEM SupportingGame State Observer- Finding Game State Address- Modified to be Game State Observer Supporting AI Module- Help collecting game state data for use in AI- Help debugging AI- Help in training AI, Automatic Battle tool (new) 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 Customize (.ini file) - Destination Folder - Number of Frames capture - Character list Ryu Value 0* Ryu Value N* Eagle Value 0* Eagle Value N* … … … … … Capture frame *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) Example: Position Address Use VBA Cheat search. Old value, 16bits Equal, Hexadecimal 1 Begin... Search produces 14,756 results, “Please refine better” 2 Search for addresses of which values increase. Search produces 1,368 results, “Please refine better” Cont... Department of Computer Engineering, CHULALONGKORN University, Thailand
AI-TEM: Testing AI in Commercial Game with Emulator Search for Game State Address (2) 3 Still Search for addresses of which values increase. Search produces less than 1,000 results, 4 Search for addresses of which values decrease. Search produces interesting result. 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 Address 20007C2 8 bits: FF 16 bits: 01FF Continue to move forward. And search for address which value increase. Address 20007C2 8 bits: 20 16 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 Red line is reference point for address20007C2 RYU sprite size 32p 1-4 Line3: middle of sprite Pic2 Left side Pic3 Right side 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 http://www.gameboy-advance.net/site/legal_info.htm Department of Computer Engineering, CHULALONGKORN University, Thailand
AI-TEM: Testing AI in Commercial Game with Emulator Thank you ~ http://www.cp.eng.chula.ac.th/~g48wth/aitem.htm Worapoj.T@student.chula.ac.th Vishnu@cp.eng.chula.ac.th Department of Computer Engineering, CHULALONGKORN University, Thailand
AI-TEM: Testing AI in Commercial Game with Emulator Department of Computer Engineering, CHULALONGKORN University, Thailand