ai-tem testing ai in commercial game with emulator

27
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

Upload: miranda-tyler

Post on 04-Jan-2016

48 views

Category:

Documents


6 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: AI-TEM TESTING AI IN COMMERCIAL GAME  WITH EMULATOR

AI-TEMTESTING AI IN COMMERCIAL GAME

WITH EMULATOR

Worapoj Thunputtarakul and Vishnu Kotrajaras

Department of Computer EngineeringCHULALONGKORN University, Bangkok, Thailand

Department of Computer Engineering, CHULALONGKORN University, Thailand

Page 2: 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

Page 3: 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

Page 4: 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

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

Page 5: 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

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.

Page 6: 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

Emulator & ROM

+ =

Game cartridge ROM Dumper Game ROM

Game console Game emulator Emulated game

ROM DATA

Page 7: 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

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

Page 8: 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

AI-TEM with VBA

Why VBA?- Open Source- Many supporting tools - Many interesting games- Familiar

AI-TEM, VBA, VBA Link

http://vba.ngemu.com http://vbalink.wz.cz/index.htm

Page 9: 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

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

Page 10: 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

The Working of AI-TEMGame State Observer

1P Position XAddress: 0x20007C2

Value(16 bits): 002C(h)002C = 44

Game state NormalizerNormalize 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…}

AICharacter Classm_side:m_healthPoint:m_posX:m_posY:m_animation:

Page 11: 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

Example STZ3 Game state AddressGame State Data Address Data Size Example

*

character 1 position x axis 0x20007C2 16 bits 288**

character 1 char ID 0x20008EA 8 bits 0

character 1 bullet position x axis

0x200C0DA 16 bits 430**

character 1 HP Bar 0x2000818 8 bits 144

character 1 Animation 0x20007D0 32 bits 4992**

character 2 position y axis 0x20043D6 32 bits 95**

*Example, not exactly real value. **After normalized.

1

1

2

2

3

3

4

4

5

5

6

6

Page 12: 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

Example STZ3 RYU Animation DataPunch

Shoryuken

Etc

*Value after normalized

Page 13: 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

Example Python InterfaceFunction• 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)

Page 14: 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

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.

Page 15: 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

Fight for the future…• Next scope for STZ3. Other ISM.• Other Emulators: Arcade, PlayStation.• Other Games.• Other features.

Page 16: 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

Thank you ~http://www.cp.eng.chula.ac.th/~g48wth/aitem.htm

[email protected] [email protected]

Page 17: 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

Tools supporting AI-TEM

Movie Record

Save / LoadStateAI

Automatic data collectionHelp 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 Tools

Modified Tools

Page 18: 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

Auto Animation Collection Tool (for STZ3)For every character:• Force value in

address 20007C2 to change character animation

Capture frame

RyuValue

0*

RyuValue

N*… … … …

EagleValue

0*

EagleValue

N*…

Customize (.ini file)- Destination Folder- Number of Frames capture- Character list

*Example only

Page 19: 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

(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

Page 20: 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

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, 16bitsEqual, Hexadecimal

2 Search for addresses of which values increase.

Cont...

1 Begin...

Page 21: 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

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.

Page 22: 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

Beware of Data Size when search

Continue to move forward.And search for address which value increase.

Address 20007C2 8 bits: FF16 bits: 01FF

Address 20007C2 8 bits: 2016 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.

Page 23: 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

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

Page 24: 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

About Coordinating ReferencePic1

Pic2 Left side Pic3 Right side

Red line is reference point for address 20007C2

RYU sprite size 32p 1-4Line3: middle of sprite

2C(h) = 44, 10p + 12p = 22p = 44u

Page 25: 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

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.nethttp://www.gameboy-advance.net/site/legal_info.htm

Page 26: 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

[email protected] [email protected]

Thank you ~http://www.cp.eng.chula.ac.th/~g48wth/aitem.htm

Page 27: 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