tasoulis12
Posts: 1
Joined: Mon Mar 26, 2018 4:57 pm

Help using the MAME LUA API for deep learning project

Tue Mar 27, 2018 2:17 pm

Hello there,

TL;DR: Trying to build a Tekken 1,2,3 and TAG playing AI. Need to find out where to find useful values loaded in memory, some good documentation for the MAME LUA API and whatever I can load ROMs to MAME from within the LUA script. I also have a non-MAME specific question about machine learning on how to set my neural network's hyper-parameters and architecture.

Anyone here into Artificial Intelligence or Machine Learning? I found out that you can interface with MAME using LUA and I think LUA can interface with Python. I've been
I am trying to see if a single neural network can generalize in between playing different Tekkens. I will be emulating 1,2,3 and Tag on MAME in succession or in random order. I am planning to use a Deep Q Neural Network which, every time step, will take as input a tensor with values 1. What game is being played (1-4), 2.Your HP (0-100), 3.Opponents HP (0-100), 4. Time Remaining (0-99 seconds) and 5. a flattened array of the rgb values of each pixel rendered (0-255) and will output 1. direction of analog stick (1-center, 2-left, 3-left/up, 4-up, 5-right/up, 6 - right, 7-right/down, 8-down, 9-left/down) and 2. up to two buttons pressed together (1-A,2-B,3-C,4-D,5-AB,6-AC,7-AD,8-BC, 9-BD,10-CD). I will program the neural network using Python with Tensorflow, although I might consider Keras if it makes life easier. I'll have it run at 10 FPS (so each second will have 10 timesteps, 10 decisions being taken).

Now, I'm on the hunt for memory cells that might show useful info such as score, hp, time. Using the LUA interface, you can get the value of cpu register D0 using cpu.state["D0"].value or memory cell 0xC000 using mem:read_i8(0xC000). It's around those memory addresses that I see activity (non-0 values). But are there too many memory locations to search manually for anything meaningful. Any ideas on how I find the values I need?

I also haven't seen a comprehensive documentation with all the methods that the MAME LUA API offers. I want my LUA script to load different Tekken ROMs after some conditions are met to keep training my AI in Tekken 1,2,3 and TAG. I can't find a method in the MAME LUA API for loading ROMs. Is it possible to do that, or do I have to write a batch file?

The only references I could find on the MAME API are these two:
http://docs.mamedev.org/techspecs/luaen ... hlight=lua
https://github.com/TASVideos/mame-rr/wi ... gFunctions

I'm also not sure how to load my LUA script with MAME. According to first reference, I save my LUA script as a text file, called it Tekken.txt, and run it by typing on the command prompt:

Code: Select all

mame64 -autoboot_script Tekken.txt
But the script doesn't seem to load, only MAME.

One more thing not specific to MAME if there are any neural network experts reading this. I also need to set the correct hyper-parameters and network architecture. Any network I make will initially know nothing about the game, it will mostly stand still or try random buttons. It might take a lot of games to make the AI do something interesting, if it is configured correctly. At uni, they always told us that setting the correct values is a subject of open research and we should try randomly until we get it right. This is not an option here, so I'll need a metric to evaluate my neural network from the get go.

Any help will be appreciated :)

Image

Return to “MAME Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests