Skip to main content

DIAMBRA™ Arena. Built with OpenAI Gym Python interface, easy to use, transforms popular video games into Reinforcement Learning environments

Project description

diambra

DocumentationWebsite

LinkedinDiscordTwitchYouTubeTwitter

Paper

DIAMBRA Arena

DIAMBRA Arena is a software package featuring a collection of high-quality environments for Reinforcement Learning research and experimentation. It provides a standard interface to popular arcade emulated video games, offering a Python API fully compliant with OpenAI Gym format, that makes its adoption smooth and straightforward.

It supports all major Operating Systems (Linux, Windows and MacOS) and can be easily installed via Python PIP, as described in the installation section below. It is completely free to use, the user only needs to register on the official website.

In addition, it comes with a comprehensive documentation, and this repository provides a collection of examples covering main use cases of interest that can be run in just a few steps.

Main Features

All environments are episodic Reinforcement Learning tasks, with discrete actions (gamepad buttons) and observations composed by screen pixels plus additional numerical data (RAM values like characters health bars or characters stage side).

They all support both single player (1P) as well as two players (2P) mode, making them the perfect resource to explore all the following Reinforcement Learning subfields:

standardRl competitiveMa competitiveHa selfPlay imitationLearning humanInTheLoop
Standard RL Competitive
Multi-Agent
Competitive
Human-Agent
Self-Play Imitation Learning Human-in-the-Loop

Available Games

Interfaced games have been selected among the most popular fighting retro-games. While sharing the same fundamental mechanics, they provide slightly different challenges, with specific features such as different type and number of characters, how to perform combos, health bars recharging, etc.

Whenever possible, games are released with all hidden/bonus characters unlocked.

Additional details can be found in the dedicated section of our Documentation.

doapp sfiii3n tektagt umk3 samsh6sp kof98umh
Dead
Or
Alive ++
Street
Fighter III
3rd Strike
Tekken Tag
Tournament
Ultimate
Mortal
Kombat 3
Samurai
Showdown
5 Special
The King of
Fighers '98
Ultimate
Match Hero

Many more are coming soon...

Index

Installation

  • Create an account on our website, it requires just a few clicks and is 100% free

  • Install Docker Desktop: Linux | Windows | MacOS

  • Install DIAMBRA Command Line Interface (avoid using a virtual environment*): python3 -m pip install diambra

  • Install DIAMBRA Arena (using a virtual environment is strongly suggested): python3 -m pip install diambra-arena

*: If you use [ana]conda and have the base environment active, make sure to deactivate it with conda deactivate

Quickstart & Examples

DIAMBRA Arena usage follows the standard RL interaction framework: the agent sends an action to the environment, which process it and performs a transition accordingly, from the starting state to the new state, returning the observation and the reward to the agent to close the interaction loop. The figure below shows this typical interaction scheme and data flow.

rlScheme

Download Game ROM(s) and Check Validity

Check available games with the following command:

diambra arena list-roms

Output example:

[...]
 Title: Dead Or Alive ++ - GameId: doapp
   Difficulty levels: Min 1 - Max 4
   SHA256 sum: d95855c7d8596a90f0b8ca15725686567d767a9a3f93a8896b489a160e705c4e
   Original ROM name: doapp.zip
   Search keywords: ['DEAD OR ALIVE ++ [JAPAN]', 'dead-or-alive-japan', '80781', 'wowroms']
   Characters list: ['Kasumi', 'Zack', 'Hayabusa', 'Bayman', 'Lei-Fang', 'Raidou', 'Gen-Fu', 'Tina', 'Bass', 'Jann-Lee', 'Ayane']
[...]

Search ROMs on the web using Search Keywords provided by the game list command reported above. Pay attention, follow game-specific notes reported there, and store all ROMs in the same folder, whose absolute path will be referred in the following as your/roms/local/path.

Specific game ROM files are required, check validity of the downloaded ROMs as follows.

Check ROM(s) validity running:

diambra arena check-roms your/roms/local/path/romFileName.zip

The output for a valid ROM file would look like the following:

Correct ROM file for Dead Or Alive ++, sha256 = d95855c7d8596a90f0b8ca15725686567d767a9a3f93a8896b489a160e705c4e

Make sure to check out our Terms of Use, and in particular Section 7. By using the software, you accept the in full.

Base script

Running a complete episode with a random agent requires less than 20 python lines:

 import diambra.arena

 env = diambra.arena.make("doapp")

 observation = env.reset()

 while True:
     env.render()

     actions = env.action_space.sample()

     observation, reward, done, info = env.step(actions)

     if done:
         observation = env.reset()
         break

 env.close()

To execute the script run:

diambra run -r your/roms/local/path python script.py

Additional details and use cases are provided in the Getting Started section of the documentation.

Examples

The examples/ folder contains ready to use scripts representing the most important use-cases, in particular:

  • Single Player Environment
  • Multi Player Environment
  • Wrappers Options
  • Human Experience Recorder
  • Imitation Learning

These examples show how to leverage both single and two players modes, how to set up environment wrappers specifying all their options, how to record human expert demonstrations and how to load them to apply imitation learning. They can be used as templates and starting points to explore all the features of the software package.

diambraGif

Reinforcement Learning Libs Compatibility

DIAMBRA Arena is built to maximize compatibility will all major Reinforcement Learning libraries. It natively provides interfaces with the two most import packages: Stable Baselines (both version 2 and 3) and Ray RLlib. Their usage is illustrated in detail in the documentation and in the DIAMBRA Agents repository. It can easily be interfaced with any other package in a similar way.

Native interfaces, that can be installed with the dedicated options listed below, have been tested with the following versions:

  • Stable Baselines 3 | pip install diambra-arena[stable-baselines3] (Docs - GitHub - Pypi): 1.6.1
  • Ray RLlib | pip install diambra-arena[ray-rllib] (Docs - GitHub - Pypi): 2.0.0
  • Stable Baselines | pip install diambra-arena[stable-baselines] (Docs - GitHub - Pypi): 2.10.2

AI Tournaments

We are about to launch our AI Tournaments Platform, where every coder will be able to train his agents and compete. There will be one-to-one fights against other agents, challenges to collect accolades & bages, and matches versus human players.

Join us to become an early member!

diambraAITournament

Our very first AI Tournament has been an amazing experience! Participants trained an AI algorithm to effectively play Dead Or Alive++. The three best algorithms participated in the final event and competed for the 1400 CHF prize.

References

Support, Feature Requests & Bugs Reports

To receive support, use the dedicated channel in our Discord Server.

To request features or report bugs, use the GitHub Issue Tracker.

Citation

Paper: https://arxiv.org/abs/2210.10595

@article{Palmas22,
    author = {{Palmas}, Alessandro},
    title = "{DIAMBRA Arena: a New Reinforcement Learning Platform for Research and Experimentation}",
    journal = {arXiv e-prints},
    keywords = {reinforcement learning, transfer learning, multi-agent, games},
    year = 2022,
    month = oct,
    eid = {arXiv:2210.10595},
    pages = {arXiv:2210.10595},
    archivePrefix = {arXiv},
    eprint = {2210.10595},
    primaryClass = {cs.AI}
 }

Terms of Use

DIAMBRA Arena software package is subject to our Terms of Use. By using it, you accept them in full.

DIAMBRA™ is a Trade Mark, © Copyright 2018-2023. All Right Reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diambra-arena-2.1.0rc4.tar.gz (114.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diambra_arena-2.1.0rc4-py3-none-any.whl (114.6 kB view details)

Uploaded Python 3

File details

Details for the file diambra-arena-2.1.0rc4.tar.gz.

File metadata

  • Download URL: diambra-arena-2.1.0rc4.tar.gz
  • Upload date:
  • Size: 114.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for diambra-arena-2.1.0rc4.tar.gz
Algorithm Hash digest
SHA256 c13d23124873841d2c80ef232e1d52fe3ee58addf7f068734d94b04844b19a19
MD5 fcbd8c16ce39b464a66c3e62d51adf58
BLAKE2b-256 8c991a6709b8a67a25d1955842e6be42aab7bb1cbd920ede40b94f01d2a65fe4

See more details on using hashes here.

File details

Details for the file diambra_arena-2.1.0rc4-py3-none-any.whl.

File metadata

File hashes

Hashes for diambra_arena-2.1.0rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 664ad82a89d6a7336a8891b9de06547d8cd737ccca8a78a0b7f363dcf7c1c84a
MD5 6ade210d40abe4174dbea1caf8f6d61e
BLAKE2b-256 884e94a997a21e862bae17b950ff27947d9e746d29d599e2a7a0307229063f1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page