Skip to main content

LevDoom

LevDoom is a benchmark with difficulty levels based on visual modifications, intended for research in generalization of deep reinforcement learning agents. The benchmark is based upon ViZDoom, a platform addressed to pixel based learning in the FPS game domain.

For more details please refer to our CoG2022 paper. To reproduce the paper results, follow the instructions in the RL module.

Default

Installation

To install LevDoom from PyPi, just run:

$ pip install LevDoom

Alternatively, to install LevDoom from source, clone this repo, cd to it, and then:

  1. Clone the repository
$ git clone https://github.com/TTomilin/LevDoom
  1. Navigate into the repository
$ cd LevDoom
  1. Install the dependencies
$ pip install .

Environments

The benchmark consists of 4 scenarios, each with 5 levels of increasing difficulty. The full list of environments can be found in the LevDoom module.

Scenario Success Metric Enemies Weapon Items Max Steps Actions Stochasticity
Defend the Center Frames Alive ✓ ✓ ✗ 2100 6 Enemy behaviour
Health Gathering Frames Alive ✗ ✗ ✓ 2100 6 Health kit spawn locations
Seek and Slay Kill Count ✓ ✓ ✗ 1250 12 Enemy and agent spawn locations
Dodge Projectiles Frames Alive ✓ ✗ ✗ 2100 6 Enemy behaviour

Environment Modifications

LevDoom imposes generalization difficulty by modifying the base environment of a scenario. Each modification increases the difficulty level of the generalization task. There are 8 types of modifications across all scenarios.

Modification Description
Textures Varies the appearance of the walls, ceilings and floors
Obstacles Adds impassable obstructions to the map that impede the agent's movement
Entity Size Changes the size of enemies and obtainable items
Entity Type Changes the type of enemies and obtainable items
Entity Rendering Varies the rendering type of enemies and obtainable items
Entity Speed Increases the speed of enemies
Agent Height Vertically shifts the view point of the agent

Difficulty Levels

The number of combined modifications determines the difficulty level.

Scenario Level 0 Level 1 Level 2 Level 3 Level 4
Defend the Center Default Gore Stone Wall + Flying Enemies Resized Flying Enemies + Mossy Bricks Complete
Health Gathering Default Resized Kits Stone Wall + Flying Enemies Lava + Supreme + Resized Agent Complete
Seek and Slay Default Shadows Obstacles + Resized Enemies Red + Obstacles + Invulnerable Complete
Dodge Projectiles Default Barons Revenants Flames + Flaming Skulls + Mancubus Complete

Quick Start

LevDoom follows the Gymnasium interface. You can create an environment using the make function:

import levdoom

env = levdoom.make('DefendTheCenterLevel0-v0')

You can also directly create all environments of a level using the make_level function:

import levdoom
from levdoom.utils.enums import Scenario

level_envs = levdoom.make_level(Scenario.DODGE_PROJECTILES, level=3)

Examples

Find examples of using LevDoom environments in the examples folder.

Single Environment

import levdoom

env = levdoom.make('HealthGatheringLevel3_1-v0')
env.reset()
done = False
steps = 0
total_reward = 0
while not done:
    action = env.action_space.sample()
    state, reward, done, truncated, info = env.step(action)
    env.render()
    steps += 1
    total_reward += reward
print(f"Episode finished in {steps} steps. Reward: {total_reward:.2f}")
env.close()

Single Level

import levdoom
from levdoom.utils.enums import Scenario

max_steps = 100
level_envs = levdoom.make_level(Scenario.SEEK_AND_SLAY, level=1, max_steps=max_steps)
for env in level_envs:
    env.reset()
    total_reward = 0
    for i in range(max_steps):
        action = env.action_space.sample()
        state, reward, done, truncated, info = env.step(action)
        env.render()
        total_reward += reward
        if done or truncated:
            break
    print(f"{env.unwrapped.name} finished in {i + 1} steps. Reward: {total_reward:.2f}")
    env.close()

Citation

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

@inproceedings{tomilin2022levdoom,
  title     = {LevDoom: A Benchmark for Generalization on Level Difficulty in Reinforcement Learning},
  author    = {Tristan Tomilin and Tianhong Dai and Meng Fang and Mykola Pechenizkiy},
  booktitle = {In Proceedings of the IEEE Conference on Games},
  year      = {2022}
}

Metadata

Release files for LevDoom 1.0.3

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

Source distribution (sdist)

Source distribution for LevDoom 1.0.3
File Size Uploaded
levdoom-1.0.3.tar.gz 170.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for LevDoom 1.0.3
File Interpreter ABI Platform
levdoom-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 426.9 kB

Release files / levdoom-1.0.3.tar.gz

Download URL levdoom-1.0.3.tar.gz
Size 170.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9426e7c1718095d4ba94def3b696ec74f13aec92275e3793a37c17200a186574
BLAKE2b-256 checksum
How to use checksums
65a15668e247017024ccea72b513123fa3f92cccf27f39b280cba820dbfb8f81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Release files / levdoom-1.0.3-py3-none-any.whl

Download URL levdoom-1.0.3-py3-none-any.whl
Size 256.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d00f9ffadb295274ffc9af7745736c43539a566f33e0da8ff8d14d12a39d544
BLAKE2b-256 checksum
How to use checksums
45becb1d06f9c56f03943cfab795d5d732c0b8cab3aaa035bc457a3cbeb62378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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