Skip to main content

HASARD: A Benchmark for Harnessing Safe Reinforcement Learning with Doom

HASARD (Harnessing Safe Reinforcement Learning with Doom) is a benchmark for Safe Reinforcement Learning within complex, egocentric perception 3D environments derived from the classic DOOM video game. It features 6 diverse scenarios each spanning across 3 levels of difficulty.

🔗 Useful Links

Scenario Level 1 Level 2 Level 3
Armament Burden Level 1 Level 2 Level 3
Detonator’s Dilemma Level 1 Level 2 Level 3
Volcanic Venture Level 1 Level 2 Level 3
Precipice Plunge Level 1 Level 2 Level 3
Collateral Damage Level 1 Level 2 Level 3
Remedy Rush Level 1 Level 2 Level 3

Key Features

  • Egocentric Perception: Agents learn solely from first-person pixel observations under partial observability.
  • Beyond Simple Navigation: Whereas prior benchmarks merely require the agent to reach goal locations on flat surfaces while avoiding obstacles, HASARD necessitates comprehending complex environment dynamics, anticipating the movement of entities, and grasping spatial relationships.
  • Dynamic Environments: HASARD features random spawns, unpredictably moving units, and terrain that is constantly moving or periodically changing.
  • Difficulty Levels: Higher levels go beyond parameter adjustments, introducing entirely new elements and mechanics.
  • Reward-Cost Trade-offs: Rewards and costs are closely intertwined, with tightening cost budget necessitating a sacrifice of rewards.
  • Safety Constraints: Each scenario features a hard constraint setting, where any error results in immediate in-game penalties.
  • Focus on Safety: Achieving high rewards is straightforward, but doing so while staying within the safety budget demands learning complex and nuanced behaviors.

Policy Visualization

HASARD enables overlaying a heatmap of the agent's most frequently visited locations providing further insights into its policy and behavior within the environment. These examples show how an agent navigates Volcanic Venture, Remedy Rush, and Armament Burden during the course of training:

Augmented Observations

HASARD supports augmented observation modes for further visual analysis. By utilizing privileged game state information, it can generate simplified observation representations, such as segmenting objects in the scene or rendering the environment displaying only depth from surroundings.

Installation

HASARD supports modular installation to install only the dependencies you need:

# Core dependencies only (environments and basic functionality)
pip install HASARD

# With sample-factory support for training RL agents
pip install HASARD[sample-factory]

# With results analysis and plotting tools
pip install HASARD[results]

# Full installation with all optional dependencies
pip install HASARD[sample-factory,results]

To install from source:

git clone https://github.com/TTomilin/HASARD
cd HASARD
pip install .  # or pip install .[sample-factory,results] for extras

Getting Started

To get started with HASARD, here's a minimal example of running a task environment. This script can also be found in run_env.py:

import hasard

env = hasard.make('RemedyRushLevel1-v0')
env.reset()
terminated = truncated = False
steps = total_cost = total_reward = 0
while not (terminated or truncated):
    action = env.action_space.sample()
    state, reward, terminated, truncated, info = env.step(action)
    env.render()
    steps += 1
    total_cost += info['cost']
    total_reward += reward
print(f"Episode finished in {steps} steps. Reward: {total_reward:.2f}. Cost: {total_cost:.2f}")
env.close()

Training

For highly parallelized training of Safe RL agents on HASARD environments, and to reproduce the results from the paper, refer to sample_factory for detailed usage instructions and examples.

Acknowledgements

HASARD environments are built on top of the ViZDoom platform.
Our Safe RL baseline methods are implemented in Sample-Factory.
Our experiments were managed using WandB.

Citation

If you use our work in your research, please cite it as follows:

@inproceedings{tomilin2025hasard,
    title={HASARD: A Benchmark for Vision-Based Safe Reinforcement Learning in Embodied Agents},
    author={T. Tomilin, M. Fang, and M. Pechenizkiy},
    booktitle={The Thirteenth International Conference on Learning Representations},
    year={2025}
}

Metadata

Release files for HASARD 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for HASARD 0.2.0
File Size Uploaded Provenance Actions
HASARD-0.2.0.tar.gz 88.4 MB Without provenance Details for HASARD-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for HASARD 0.2.0
File Interpreter ABI Platform Actions
HASARD-0.2.0-py3-none-any.whl Python 3 none any Details for HASARD-0.2.0-py3-none-any.whl

Total release size: 177.2 MB

Release files / HASARD-0.2.0.tar.gz

Download URL HASARD-0.2.0.tar.gz
Size 88.4 MB
Tags Source
SHA-256 checksum
How to use checksums
df698fa83370e72867a82084a481d998dac4007af8a8d4c39b7697e7a1382852
BLAKE2b-256 checksum
How to use checksums
a70c1507bd1bc482227a0079d6d398de03f186fdea364513de94d0a77413b73f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.12

Release files / HASARD-0.2.0-py3-none-any.whl

Download URL HASARD-0.2.0-py3-none-any.whl
Size 88.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5f909ce0af8faa49cdb4fd10f58a7a047fa7889155bf85e3c19133e5c9aa22ea
BLAKE2b-256 checksum
How to use checksums
0021004aef74b8b27beb66803c1e41de7d4a1cab85bb10777922fa3a2f98c569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.12

Security for HASARD 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page