A Gymnasium-compatible reinforcement learning environment for Elden Ring
Project description
EldenGym 🎮
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
🔧 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:
random_policy.ipynb- Random agent baselinellm_agent.ipynb- LLM-based agent
🛠️ 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
- Built with Gymnasium
- Documentation powered by MkDocs Material
📧 Contact
- Issues: GitHub Issues
- Discussions: GitHub Discussions
⭐ 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff57f69ae0f2081728877a8557dfa4ceb060bf213b1af5bc853adb28d664919b
|
|
| MD5 |
5c4303b231598bee6c23c63412e20225
|
|
| BLAKE2b-256 |
bf0a0cd9bfcc1734212c48cf941d6d2168043d521ebe8332819e50d48281e32e
|
Provenance
The following attestation bundles were made for eldengym-0.4.1.tar.gz:
Publisher:
publish.yml on dhmnr/eldengym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eldengym-0.4.1.tar.gz -
Subject digest:
ff57f69ae0f2081728877a8557dfa4ceb060bf213b1af5bc853adb28d664919b - Sigstore transparency entry: 813409833
- Sigstore integration time:
-
Permalink:
dhmnr/eldengym@ee9a0bbbfb2b221f89bd925846039ff7d6c70fdc -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/dhmnr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ee9a0bbbfb2b221f89bd925846039ff7d6c70fdc -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a72224b41ede0adeed820857cb789c4e1964f5f7d6e516febb87c1ae024f6c55
|
|
| MD5 |
9cbea664a053f8c249e5e865f7ff4f67
|
|
| BLAKE2b-256 |
661a19fff38165401c5762218dfb567198b47decd206d7470c77813032330803
|
Provenance
The following attestation bundles were made for eldengym-0.4.1-py3-none-any.whl:
Publisher:
publish.yml on dhmnr/eldengym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eldengym-0.4.1-py3-none-any.whl -
Subject digest:
a72224b41ede0adeed820857cb789c4e1964f5f7d6e516febb87c1ae024f6c55 - Sigstore transparency entry: 813409834
- Sigstore integration time:
-
Permalink:
dhmnr/eldengym@ee9a0bbbfb2b221f89bd925846039ff7d6c70fdc -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/dhmnr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ee9a0bbbfb2b221f89bd925846039ff7d6c70fdc -
Trigger Event:
release
-
Statement type: