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.6.0.tar.gz (279.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.6.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eldengym-0.6.0.tar.gz
  • Upload date:
  • Size: 279.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.6.0.tar.gz
Algorithm Hash digest
SHA256 c9b1aa62ecf9ba1acdde73db9c399213991f84f2a38108fc2ba9adf24876eb19
MD5 e1fd76c1e327addcc0326e7841c8280a
BLAKE2b-256 e514f18b4ba98fa594b84b095cacd70aa4482593d85378977a09716989ab4d7d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: eldengym-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 29.8 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ca6f776d4542b702b996f095e004aa808e2cce7915ea9830318a8d46ec478cf
MD5 f985da1f9841e55040df95708fda6269
BLAKE2b-256 90065ff5e2fe60609473b308b8f0261c90160ca08130cdfd0671e71141859589

See more details on using hashes here.

Provenance

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