The goal of this project is to develop inteligent agents that play Super Smash Bros. Melee on the Dolphin Emulator.
- Python3.11
- Felk’s fork of the dolphin emulator with Python Scripting support: https://github.com/Felk/dolphin/releases/tag/scripting-preview3
- The lastest version of aldelaro5's dolphin memory engine: https://github.com/aldelaro5/Dolphin-memory-engine/tags
- A legally obtained copy of Super Smash Bros Melee
- Open the directory containing the Dolphin executable (dolphin-scripting-preview3-x64)
- Clone this repo in the root directory
- Boot up the Dolphin executable and you should see the following:
- Click "Add New Script" and navigate to SSBM_AI/python-stubs/src and select "main.py"
- It should now appear in "Running Scripts"
- The script will now execute when you run the game.
If you want access to the log to see potential errors, warnings, or debug statements, in the toolbar click "View" --> "Show Log" and "Show Log Configuration". You should see new tabs next to the "Scripts" tab for both of these. Click on the "Log Configuration" tab and make sure to toggle on the "Scripting" checkbox.
Your logs will show up in the "Log" tab.
- With the game up and running, run the Dolphin Memory Engine:
- To load in the game memory for SSBM, click File → Open, then navigate to the
python-stubs\Memory Files\and selectSSBM NTSC 1.02.dmw - You should now see 3 groups in the bottom window for global addresses, player data, and stage data. These sections store all known variables and their respective memory addresses. Run the game alongside this to see how the values change.
- Review the provided API within the folder
python-stubs/dolphinto see how to programmatically access the game controller, memory, GUI, etc. This is how the agent will be interacting with the environment.
In addition to the desktop application, we can also use the dolphin memory engine (DME) through a python package. This will be particularly useful when working with multi-level pointers since these addresses don't stay constant. See python-stubs\src\fetch_memory_addresses.py for reference of how this is used.
All memory addresses (constant or not) are stored in python-stubs\src\config.ini
The python package can be installed with pip install dolphin-memory-engine
For some variables, the memory address is a pointer that can have multiple levels and the final address is not always constant between games. For example, the (x,y) position is stored at a different address when playing on Battlefield vs Pokemon Stadium
To address this issue, you will want to run python-stubs\src\fetch_memory_addresses.py with the game running AND a match started. This script will write the current addresses to config.ini