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.4.1.tar.gz (237.4 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.4.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for eldengym-0.4.1.tar.gz
Algorithm Hash digest
SHA256 ff57f69ae0f2081728877a8557dfa4ceb060bf213b1af5bc853adb28d664919b
MD5 5c4303b231598bee6c23c63412e20225
BLAKE2b-256 bf0a0cd9bfcc1734212c48cf941d6d2168043d521ebe8332819e50d48281e32e

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldengym-0.4.1.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.4.1-py3-none-any.whl.

File metadata

  • Download URL: eldengym-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 19.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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a72224b41ede0adeed820857cb789c4e1964f5f7d6e516febb87c1ae024f6c55
MD5 9cbea664a053f8c249e5e865f7ff4f67
BLAKE2b-256 661a19fff38165401c5762218dfb567198b47decd206d7470c77813032330803

See more details on using hashes here.

Provenance

The following attestation bundles were made for eldengym-0.4.1-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