Skip to main content

A Gymnasium-compatible reinforcement learning environment for Elden Ring

Project description

EldenGym 🎮

PyPI version Tests Documentation Python 3.10+ License: MIT

A Gymnasium-compatible reinforcement learning environment for Elden Ring.

🚀 Quick Start

import gymnasium as gym
import eldengym

# Create environment
env = gym.make("EldenGym-v0", scenario_name="margit")

# Standard RL loop
obs, info = env.reset()
for _ in range(1000):
    action = env.action_space.sample()
    obs, reward, terminated, truncated, info = env.step(action)

    if terminated or truncated:
        obs, info = env.reset()

env.close()

✨ Features

  • 🎯 Gymnasium API - Standard RL interface
  • 🎮 Multiple Action Spaces - Discrete, multi-binary, or continuous
  • 📊 Flexible Observations - RGB frames, game state, or both
  • High Performance - gRPC-based C++ backend
  • 🔧 Customizable - Easy reward functions and wrappers
  • 🏆 Boss Scenarios - Pre-configured boss fights

📚 Documentation

Read the full documentation →

🔧 Installation

From PyPI (Stable Release)

pip install eldengym

From Source (Development)

# Clone repository
git clone https://github.com/dhmnr/eldengym.git
cd eldengym

# Install with uv (recommended)
uv sync

# Or with pip
pip install -e .

🎮 Usage Examples

With Stable-Baselines3

from stable_baselines3 import PPO
import gymnasium as gym

env = gym.make("EldenGym-v0", scenario_name="margit")
model = PPO("CnnPolicy", env, verbose=1)
model.learn(total_timesteps=100_000)

Custom Reward Function

def custom_reward(obs, info, terminated, truncated):
    reward = 0.0
    if 'target_hp_delta' in info:
        reward += info['target_hp_delta'] * 10.0
    return reward

env = gym.make("EldenGym-v0", reward_function=custom_reward)

📖 Examples

Check out the examples directory:

🛠️ Development

# Install dev dependencies
uv sync --group dev --group test --group docs

# Run tests
uv run pytest

# Format code
uv run ruff format .

# Serve documentation locally
uv run mkdocs serve

📋 Requirements

  • Elden Ring (PC version)
  • Siphon Server (C++ gRPC backend)
  • Python 3.10+
  • Windows (for game interaction)

🤝 Contributing

Contributions are welcome! Please see our Contributing Guide.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📧 Contact


⭐ Star this repo if you find it useful!

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

eldengym-0.5.0.tar.gz (238.1 kB view details)

Uploaded Source

Built Distribution

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

eldengym-0.5.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file eldengym-0.5.0.tar.gz.

File metadata

  • Download URL: eldengym-0.5.0.tar.gz
  • Upload date:
  • Size: 238.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for eldengym-0.5.0.tar.gz
Algorithm Hash digest
SHA256 69e80ae9f6f38667358a7ae728d5be467223422dd6404e2d57cdf21efa018935
MD5 8b136d074fbb0f78b2759b92368ebced
BLAKE2b-256 5f56a10e9df109f216887bdfa189f83f866bad99c77c62fe12123e7c5db30a0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldengym-0.5.0.tar.gz:

Publisher: publish.yml on dhmnr/eldengym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file eldengym-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: eldengym-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for eldengym-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7145622e2bd07fe8d5678375c2dddf3b0b77e40fdc3f32311160a25dffb848b0
MD5 372d3e354a21c2ee12e4ec3ea40b96d7
BLAKE2b-256 96af4e965e2d4218a873caba839adf34bd82422ec89505ffac26e67d43b6fdf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldengym-0.5.0-py3-none-any.whl:

Publisher: publish.yml on dhmnr/eldengym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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