Skip to main content

A platform for running interactive experiments in the browser with standard simulation environments.

Project description

Multi-User Gymnasium (MUG)

PyPI - Version PyPI - Downloads

MUG logo

Multi-User Gymnasium (MUG) converts Gymnasium and PettingZoo environments into browser-based, multi-user experiments. It enables Python simulation environments to be accessed online, allowing humans to interact with them individually or alongside AI agents and other participants.

Multiplayer Configuration

For P2P multiplayer experiments, MUG uses WebRTC for low-latency peer-to-peer connections. When direct P2P connections fail (due to firewalls, NAT, or restrictive networks), a TURN server provides relay fallback.

Setting up TURN credentials:

  1. Sign up for a free TURN server at Open Relay (metered.ca) (free tier: 20GB/month)

  2. Set environment variables with your credentials:

    export TURN_USERNAME="your-openrelay-username"
    export TURN_CREDENTIAL="your-openrelay-api-key"
    
  3. Enable WebRTC in your experiment configuration:

    from mug.configurations import RemoteConfig
    
    config = RemoteConfig()
    config.webrtc()  # Auto-loads from TURN_USERNAME and TURN_CREDENTIAL env vars
    

Alternative: Using a .env file

Create a .env file (add to .gitignore):

TURN_USERNAME=your-openrelay-username
TURN_CREDENTIAL=your-openrelay-api-key

Then load it in your experiment:

from dotenv import load_dotenv
load_dotenv()

config = RemoteConfig()
config.webrtc()

Testing TURN relay:

To force all connections through TURN (useful for testing):

config.webrtc(force_relay=True)

Acknowledgements

The Phaser integration and server implementation are inspired by and derived from the Overcooked AI demo by Carroll et al. (https://github.com/HumanCompatibleAI/overcooked-demo/tree/master).

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

multi_user_gymnasium-0.1.2.tar.gz (251.2 kB view details)

Uploaded Source

Built Distribution

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

multi_user_gymnasium-0.1.2-py3-none-any.whl (216.1 kB view details)

Uploaded Python 3

File details

Details for the file multi_user_gymnasium-0.1.2.tar.gz.

File metadata

  • Download URL: multi_user_gymnasium-0.1.2.tar.gz
  • Upload date:
  • Size: 251.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.14

File hashes

Hashes for multi_user_gymnasium-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fd83f23ca30576701ed660820a227fee10768bed215d0f3d753072fb3ac9b1bf
MD5 fafeddb9db7d18c685819983a85e708b
BLAKE2b-256 ac5bf042fb0128296f5468a94c698e9c148e93cc4515c89caa90a0bc0404db48

See more details on using hashes here.

File details

Details for the file multi_user_gymnasium-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for multi_user_gymnasium-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad61db7d61b66759cdafbd7c26d85e0c9e8405abeb77dd21edb46516238d78c5
MD5 99db06f4e9a9b8d2c3927fc9a321253d
BLAKE2b-256 44746f1bbf9098ee96e1796fd54cbe58df0febeb261398e415153e27dc9c5043

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