├── .github └── workflows │ └── python-app.yml ├── .gitignore ├── .pre-commit-config.yaml ├── LICENSE ├── README.md ├── setup.py ├── tests └── test_basic.py └── vizdoomgym ├── __init__.py └── envs ├── __init__.py ├── scenarios ├── README.md ├── basic.cfg ├── basic.wad ├── bots.cfg ├── cig.cfg ├── cig.wad ├── cig_with_unknown.wad ├── deadly_corridor.cfg ├── deadly_corridor.wad ├── deathmatch.cfg ├── deathmatch.wad ├── defend_the_center.cfg ├── defend_the_center.wad ├── defend_the_line.cfg ├── defend_the_line.wad ├── health_gathering.cfg ├── health_gathering.wad ├── health_gathering_supreme.cfg ├── health_gathering_supreme.wad ├── learning.cfg ├── multi.cfg ├── multi_deathmatch.wad ├── multi_duel.cfg ├── multi_duel.wad ├── my_way_home.cfg ├── my_way_home.wad ├── oblige.cfg ├── predict_position.cfg ├── predict_position.wad ├── rocket_basic.cfg ├── rocket_basic.wad ├── simpler_basic.cfg ├── simpler_basic.wad ├── take_cover.cfg └── take_cover.wad ├── vizdoom_env_definitions.py └── vizdoomenv.py /.github/workflows/python-app.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions 3 | 4 | name: perform_tests 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up Python 3.8 20 | uses: actions/setup-python@v2 21 | with: 22 | python-version: 3.8 23 | - name: Install dependencies 24 | run: | 25 | python -m pip install --upgrade pip 26 | sudo apt-get update 27 | sudo apt-get install cmake libboost-all-dev libgtk2.0-dev libsdl2-dev python-numpy 28 | pip install flake8 pytest 29 | pip install -e . 30 | - name: Lint with flake8 31 | run: | 32 | # stop the build if there are Python syntax errors or undefined names 33 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 34 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide 35 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics 36 | - name: Test with pytest 37 | run: | 38 | pytest tests/ 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | local_settings.py 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # dotenv 83 | .env 84 | 85 | # virtualenv 86 | .venv 87 | venv/ 88 | ENV/ 89 | 90 | # Spyder project settings 91 | .spyderproject 92 | .spyproject 93 | 94 | # Rope project settings 95 | .ropeproject 96 | 97 | # mkdocs documentation 98 | /site 99 | 100 | # mypy 101 | .mypy_cache/ 102 | 103 | bin/ 104 | .idea/ 105 | pyvenv.cfg 106 | share 107 | lib64 -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | - repo: https://github.com/ambv/black 2 | rev: stable 3 | hooks: 4 | - id: black 5 | language_version: python3.6 6 | exclude: vizdoomgym/__init__.py 7 | - repo: https://gitlab.com/pycqa/flake8 8 | rev: 3.7.9 9 | hooks: 10 | - id: flake8 11 | args: ['--ignore=E501,F401'] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Simon Hakenes 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ViZDoomGym ![](https://github.com/shakenes/vizdoomgym/workflows/perform_tests/badge.svg) 2 | This is a wrapper to use [ViZDoom](https://github.com/mwydmuch/ViZDoom "ViZDoom repository"), a "Doom based AI Research Platform for Reinforcement Learning from Raw Visual Information" together with [OpenAI Gym](https://github.com/openai/gym "OpenAI Gym repository"). 3 | 4 | There is a branch with an alternative reward system for the Health Gathering scenario (each collected health pack yields +1 reward) 5 | 6 | ## Installation 7 | 8 | ``` 9 | sudo apt-get install cmake libboost-all-dev libgtk2.0-dev libsdl2-dev python-numpy 10 | git clone https://github.com/shakenes/vizdoomgym.git 11 | cd vizdoomgym 12 | pip install -e . 13 | ``` 14 | ## Usage 15 | Use one of the environments (see list below for all available envs): 16 | ``` 17 | import gym 18 | import vizdoomgym 19 | env = gym.make('VizdoomBasic-v0', **kwargs) 20 | 21 | # use like a normal Gym environment 22 | state = env.reset() 23 | state, reward, done, info = env.step(env.action_space.sample()) 24 | env.render() 25 | env.close() 26 | ``` 27 | 28 | ### Possible observations 29 | It is possible to get the depth buffer, the labels buffer, the player's position and viewing angle and the player's health as additional observations. If more than one observation is provided, the observations are returned as a list of numpy array (or floats, respectively). 30 | ``` 31 | env = gym.make('VizdoomBasic-v0, depth=True, labels=True, position=True, health=True) 32 | ``` 33 | 34 | 35 | ### List of available environments 36 | ``` 37 | VizdoomBasic-v0 38 | VizdoomCorridor-v0 39 | VizdoomDefendCenter-v0 40 | VizdoomDefendLine-v0 41 | VizdoomHealthGathering-v0 42 | VizdoomMyWayHome-v0 43 | VizdoomPredictPosition-v0 44 | VizdoomTakeCover-v0 45 | VizdoomDeathmatch-v0 46 | VizdoomHealthGatheringSupreme-v0 47 | ``` 48 | 49 | [Detailed information about the environments](https://github.com/shakenes/vizdoomgym/blob/master/vizdoomgym/envs/scenarios/README.md) 50 | 51 | ## Future plans 52 | - Support for more GameVariables such as health through kwargs 53 | - Provide more options for the observations (player position, health...) 54 | - Use a dictionary for all the observations 55 | 56 | Ideas for new features and of course PRs are always welcome! 57 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name="vizdoomgym", 5 | version="1.0", 6 | description="OpenAI Gym wrapper for ViZDoom", 7 | author="Simon Hakenes", 8 | author_email="simon.hakenes@ini.rub.de", 9 | install_requires=[ 10 | "gym", 11 | "vizdoom@https://github.com/mwydmuch/ViZDoom/tarball/1.1.8pre", 12 | "numpy", 13 | "pre-commit", 14 | ], 15 | ) 16 | -------------------------------------------------------------------------------- /tests/test_basic.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import gym 3 | import vizdoomgym 4 | import numpy as np 5 | 6 | 7 | class BasicTest(unittest.TestCase): 8 | def test_basic(self): 9 | env = gym.make("VizdoomBasic-v0") 10 | self.assertFalse(env.unwrapped.depth) 11 | self.assertFalse(env.unwrapped.labels) 12 | self.assertIsInstance(env, gym.Env) 13 | state = env.reset() 14 | self.assertEqual(len(state.shape), 3) 15 | self.assertIsInstance(state, np.ndarray) 16 | self.assertTrue(state.shape, env.observation_space.shape) 17 | done = False 18 | while not done: 19 | state, reward, done, info = env.step(env.action_space.sample()) 20 | self.assertEqual(len(state.shape), 3) 21 | self.assertIsInstance(state, np.ndarray) 22 | self.assertTrue(state.shape, env.observation_space.shape) 23 | self.assertIsNotNone(reward) 24 | self.assertIsInstance(done, bool) 25 | env.render() 26 | env.close() 27 | 28 | def test_kwargs(self): 29 | env = gym.make("VizdoomHealthGathering-v0", depth=True, labels=True) 30 | self.assertTrue(env.unwrapped.depth) 31 | self.assertTrue(env.unwrapped.labels) 32 | self.assertIsInstance(env, gym.Env) 33 | state = env.reset() 34 | self.assertEqual(len(state), 3) 35 | self.assertTrue(all(isinstance(s, np.ndarray) for s in state)) 36 | done = False 37 | while not done: 38 | state, reward, done, info = env.step(env.action_space.sample()) 39 | self.assertEqual(len(state), 3) 40 | self.assertTrue(all(isinstance(s, np.ndarray) for s in state)) 41 | self.assertTrue( 42 | all( 43 | s.shape == env.observation_space[i].shape 44 | for i, s in enumerate(state) 45 | ) 46 | ) 47 | self.assertIsNotNone(reward) 48 | self.assertIsInstance(done, bool) 49 | env.render() 50 | env.close() 51 | 52 | def test_health_and_position(self): 53 | env = gym.make("VizdoomHealthGathering-v0", health=True, position=True) 54 | self.assertIsInstance(env, gym.Env) 55 | state = env.reset() 56 | self.assertEqual(len(state), 3) 57 | self.assertTrue(all(isinstance(s, (np.ndarray, np.float64)) for s in state)) 58 | done = False 59 | while not done: 60 | state, reward, done, info = env.step(env.action_space.sample()) 61 | self.assertEqual(len(state), 3) 62 | self.assertTrue(all(isinstance(s, (np.ndarray, np.float64)) for s in state)) 63 | self.assertTrue( 64 | all( 65 | s.size == np.prod(env.observation_space[i].shape) 66 | for i, s in enumerate(state) 67 | ) 68 | ) 69 | self.assertIsNotNone(reward) 70 | self.assertIsInstance(done, bool) 71 | env.render() 72 | env.close() 73 | 74 | def test_all(self): 75 | env = gym.make( 76 | "VizdoomHealthGathering-v0", 77 | depth=True, 78 | labels=True, 79 | health=True, 80 | position=True, 81 | ) 82 | self.assertIsInstance(env, gym.Env) 83 | state = env.reset() 84 | self.assertEqual(len(state), 5) 85 | self.assertTrue(all(isinstance(s, (np.ndarray, np.float64)) for s in state)) 86 | done = False 87 | while not done: 88 | state, reward, done, info = env.step(env.action_space.sample()) 89 | self.assertEqual(len(state), 5) 90 | self.assertTrue(all(isinstance(s, (np.ndarray, np.float64)) for s in state)) 91 | self.assertTrue( 92 | all( 93 | s.size == np.prod(env.observation_space[i].shape) 94 | for i, s in enumerate(state) 95 | ) 96 | ) 97 | self.assertIsNotNone(reward) 98 | self.assertIsInstance(done, bool) 99 | env.render() 100 | env.close() 101 | 102 | 103 | if __name__ == "__main__": 104 | unittest.main() 105 | -------------------------------------------------------------------------------- /vizdoomgym/__init__.py: -------------------------------------------------------------------------------- 1 | from gym.envs.registration import register 2 | 3 | register( 4 | id='VizdoomBasic-v0', 5 | entry_point='vizdoomgym.envs:VizdoomBasic' 6 | ) 7 | 8 | register( 9 | id='VizdoomCorridor-v0', 10 | entry_point='vizdoomgym.envs:VizdoomCorridor' 11 | ) 12 | 13 | register( 14 | id='VizdoomDefendCenter-v0', 15 | entry_point='vizdoomgym.envs:VizdoomDefendCenter' 16 | ) 17 | 18 | register( 19 | id='VizdoomDefendLine-v0', 20 | entry_point='vizdoomgym.envs:VizdoomDefendLine' 21 | ) 22 | 23 | register( 24 | id='VizdoomHealthGathering-v0', 25 | entry_point='vizdoomgym.envs:VizdoomHealthGathering' 26 | ) 27 | 28 | register( 29 | id='VizdoomMyWayHome-v0', 30 | entry_point='vizdoomgym.envs:VizdoomMyWayHome' 31 | ) 32 | 33 | register( 34 | id='VizdoomPredictPosition-v0', 35 | entry_point='vizdoomgym.envs:VizdoomPredictPosition' 36 | ) 37 | 38 | register( 39 | id='VizdoomTakeCover-v0', 40 | entry_point='vizdoomgym.envs:VizdoomTakeCover' 41 | ) 42 | 43 | register( 44 | id='VizdoomDeathmatch-v0', 45 | entry_point='vizdoomgym.envs:VizdoomDeathmatch' 46 | ) 47 | 48 | register( 49 | id='VizdoomHealthGatheringSupreme-v0', 50 | entry_point='vizdoomgym.envs:VizdoomHealthGatheringSupreme' 51 | ) 52 | -------------------------------------------------------------------------------- /vizdoomgym/envs/__init__.py: -------------------------------------------------------------------------------- 1 | from vizdoomgym.envs.vizdoomenv import VizdoomEnv 2 | from vizdoomgym.envs.vizdoom_env_definitions import ( 3 | VizdoomBasic, 4 | VizdoomCorridor, 5 | VizdoomDefendCenter, 6 | VizdoomDefendLine, 7 | VizdoomHealthGathering, 8 | VizdoomMyWayHome, 9 | VizdoomPredictPosition, 10 | VizdoomTakeCover, 11 | VizdoomDeathmatch, 12 | VizdoomHealthGatheringSupreme, 13 | ) 14 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/README.md: -------------------------------------------------------------------------------- 1 | # Scenarios Decription: 2 | 3 | Scenarios contained in iwad files do not support action constraints, death penalty and living rewards. 4 | Every mention of any settings that are not included in iwads will be specified with "(config)". 5 | 6 | Note: Vizdoom does not support setting certain rewards (such as killing oponents) in .cfg files. These must be set in the .wad files instead 7 | 8 | ## BASIC 9 | The purpose of the scenario is just to check if using this 10 | framework to train some AI in 3D environment is feasible. 11 | 12 | Map is a rectangle with gray walls, ceiling and floor. 13 | Player is spawned along the longer wall, in the center. 14 | A red, circular monster is spawned randomly somewhere along 15 | the opposite wall. Player can only (config) go left/right 16 | and shoot. 1 hit is enough to kill the monster. Episode 17 | finishes when monster is killed or on timeout. 18 | 19 | __REWARDS:__ 20 | 21 | +101 for killing the monster 22 | -5 for missing 23 | Episode ends after killing the monster or on timeout. 24 | 25 | Further configuration: 26 | * living reward = -1, 27 | * 3 available buttons: move left, move right, shoot (attack) 28 | * timeout = 300 29 | 30 | ## DEADLY CORRIDOR 31 | The purpose of this scenario is to teach the agent to navigate towards 32 | his fundamental goal (the vest) and make sure he survives at the 33 | same time. 34 | 35 | Map is a corridor with shooting monsters on both sides (6 monsters 36 | in total). A green vest is placed at the oposite end of the corridor. 37 | Reward is proportional (negative or positive) to change of the 38 | distance between the player and the vest. If player ignores monsters 39 | on the sides and runs straight for the vest he will be killed somewhere 40 | along the way. To ensure this behavior doom_skill = 5 (config) is 41 | needed. 42 | 43 | __REWARDS:__ 44 | 45 | +dX for getting closer to the vest. 46 | -dX for getting further from the vest. 47 | 48 | Further configuration: 49 | * 7 available buttons: turn left, turn right, move forward, move backward, move left, move right, shoot (attack) 50 | * timeout = 2100 51 | * death penalty = 100 52 | * doom_skill = 5 53 | 54 | 55 | ## DEFEND THE CENTER 56 | The purpose of this scenario is to teach the agent that killing the 57 | monsters is GOOD and when monsters kill you is BAD. In addition, 58 | wasting amunition is not very good either. Agent is rewarded only 59 | for killing monsters so he has to figure out the rest for himself. 60 | 61 | Map is a large circle. Player is spawned in the exact center. 62 | 5 melee-only, monsters are spawned along the wall. Monsters are 63 | killed after a single shot. After dying each monster is respawned 64 | after some time. Episode ends when the player dies (it's inevitable 65 | becuse of limitted ammo). 66 | 67 | __REWARDS:__ 68 | +1 for killing a monster 69 | 70 | Further configuration: 71 | * 3 available buttons: turn left, turn right, shoot (attack) 72 | * death penalty = 1 73 | 74 | ## DEFEND THE LINE 75 | The purpose of this scenario is to teach the agent that killing the 76 | monsters is GOOD and when monsters kill you is BAD. In addition, 77 | wasting amunition is not very good either. Agent is rewarded only 78 | for killing monsters so he has to figure out the rest for himself. 79 | 80 | Map is a rectangle. Player is spawned along the longer wall, in the 81 | center. 3 melee-only and 3 shooting monsters are spawned along the 82 | oposite wall. Monsters are killed after a single shot, at first. 83 | After dying each monster is respawned after some time and can endure 84 | more damage. Episode ends when the player dies (it's inevitable 85 | becuse of limitted ammo). 86 | 87 | __REWARDS:__ 88 | +1 for killing a monster 89 | 90 | Further configuration: 91 | * 3 available buttons: turn left, turn right, shoot (attack) 92 | * death penalty = 1 93 | 94 | ## HEALTH GATHERING 95 | The purpose of this scenario is to teach the agent how to survive 96 | without knowing what makes him survive. Agent know only that life 97 | is precious and death is bad so he must learn what prolongs his 98 | existence and that his health is connected with it. 99 | 100 | Map is a rectangle with green, acidic floor which hurts the player 101 | periodically. Initially there are some medkits spread uniformly 102 | over the map. A new medkit falls from the skies every now and then. 103 | Medkits heal some portions of player's health - to survive agent 104 | needs to pick them up. Episode finishes after player's death or 105 | on timeout. 106 | 107 | 108 | Further configuration: 109 | * living_reward = 1 110 | * 3 available buttons: turn left, turn right, move forward 111 | * 1 available game variable: HEALTH 112 | * death penalty = 100 113 | 114 | ## MY WAY HOME 115 | The purpose of this scenario is to teach the agent how to navigate 116 | in a labirynth-like surroundings and reach his ultimate goal 117 | (and learn what it actually is). 118 | 119 | Map is a series of rooms with interconnection and 1 corridor 120 | with a dead end. Each room has a different color. There is a 121 | green vest in one of the rooms (the same room every time). 122 | Player is spawned in randomly choosen room facing a random 123 | direction. Episode ends when vest is reached or on timeout/ 124 | 125 | __REWARDS:__ 126 | +1 for reaching the vest 127 | 128 | Further configuration: 129 | * 3 available buttons: turn left, turn right, move forward 130 | * living reward = -0.0001 131 | * timeout = 2100 132 | 133 | ## PREDICT POSITION 134 | The purpose of the scenario is teach agent to synchronize 135 | missle weapon shot (involving a signifficant delay between 136 | shooting and hitting) with target movements. Agent should be 137 | able to shoot so that missle and monster meet each other. 138 | 139 | The map is a rectangle room. Player is spawned along the longer 140 | wall, in the center. A monster is spawned randomly somewhere 141 | along the opposite wall and walks between left and right corners 142 | along the wall. Player is equipped with a rocket launcher and 143 | a single rocket. Episode ends when missle hits a wall/the monster 144 | or on timeout. 145 | 146 | __REWARDS:__ 147 | +1 for killing the monster 148 | 149 | Further configuration: 150 | * living reward = -0.0001, 151 | * 3 available buttons: move left, move right, shoot (attack) 152 | * timeout = 300 153 | 154 | ## TAKE COVER 155 | The purpose of this scenario is to teach agent to link incomming 156 | missles with his estimated lifespan. Agent should learn that 157 | being hit means health decrease and this in turn will lead to 158 | death which is undesirable. In effect agent should avoid 159 | missles. 160 | 161 | Map is a rectangle. Player is spawned along the longer wall, 162 | in the center. A couple of shooting monsters are spawned 163 | randomly somewhere along the opposite wall and try to kill 164 | the player with fireballs. The player can only (config) move 165 | left/right. More monsters appear with time. Episode ends when 166 | player dies. 167 | 168 | __REWARDS:__ 169 | +1 for each tic of life 170 | 171 | Further configuration: 172 | * living reward = 1.0, 173 | * 2 available buttons: move left, move right 174 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/basic.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = basic.wad 6 | doom_map = map01 7 | 8 | # Rewards 9 | living_reward = -1 10 | 11 | # Rendering options 12 | screen_resolution = RES_320X240 13 | screen_format = CRCGCB 14 | render_hud = True 15 | render_crosshair = false 16 | render_weapon = true 17 | render_decals = false 18 | render_particles = false 19 | window_visible = true 20 | 21 | # make episodes start after 20 tics (after unholstering the gun) 22 | episode_start_time = 14 23 | 24 | # make episodes finish after 300 actions (tics) 25 | episode_timeout = 300 26 | 27 | # Available buttons 28 | available_buttons = 29 | { 30 | MOVE_LEFT 31 | MOVE_RIGHT 32 | ATTACK 33 | } 34 | 35 | # Game variables that will be in the state 36 | available_game_variables = { AMMO2} 37 | 38 | mode = PLAYER 39 | doom_skill = 5 40 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/basic.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/basic.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/bots.cfg: -------------------------------------------------------------------------------- 1 | { 2 | name Rambo 3 | aiming 67 4 | perfection 50 5 | reaction 70 6 | isp 50 7 | color "40 cf 00" 8 | skin base 9 | //weaponpref 012385678 10 | } 11 | 12 | { 13 | name McClane 14 | aiming 34 15 | perfection 75 16 | reaction 15 17 | isp 90 18 | color "b0 b0 b0" 19 | skin base 20 | //weaponpref 012345678 21 | } 22 | 23 | { 24 | name MacGyver 25 | aiming 80 26 | perfection 67 27 | reaction 72 28 | isp 87 29 | color "50 50 60" 30 | skin base 31 | //weaponpref 012345678 32 | } 33 | 34 | { 35 | name Plissken 36 | aiming 15 37 | perfection 50 38 | reaction 50 39 | isp 50 40 | color "8f 00 00" 41 | skin base 42 | //weaponpref 082345678 43 | } 44 | 45 | { 46 | name Machete 47 | aiming 50 48 | perfection 13 49 | reaction 20 50 | isp 100 51 | color "ff ff ff" 52 | skin base 53 | //weaponpref 012345678 54 | } 55 | 56 | { 57 | name Anderson 58 | aiming 45 59 | perfection 30 60 | reaction 70 61 | isp 60 62 | color "ff af 3f" 63 | skin base 64 | //weaponpref 012345678 65 | } 66 | 67 | { 68 | name Leone 69 | aiming 56 70 | perfection 34 71 | reaction 78 72 | isp 50 73 | color "bf 00 00" 74 | skin base 75 | //weaponpref 012345678 76 | } 77 | 78 | { 79 | name Predator 80 | aiming 25 81 | perfection 55 82 | reaction 32 83 | isp 70 84 | color "00 00 ff" 85 | skin base 86 | //weaponpref 012345678 87 | } 88 | 89 | { 90 | name Ripley 91 | aiming 61 92 | perfection 50 93 | reaction 23 94 | isp 32 95 | color "00 00 7f" 96 | skin base 97 | //weaponpref 012345678 98 | } 99 | 100 | { 101 | name T800 102 | aiming 90 103 | perfection 85 104 | reaction 10 105 | isp 30 106 | color "ff ff 00" 107 | skin base 108 | //weaponpref 012345678 109 | } 110 | 111 | { 112 | name Dredd 113 | aiming 12 114 | perfection 35 115 | reaction 56 116 | isp 37 117 | color "40 cf 00" 118 | skin base 119 | //weaponpref 012345678 120 | } 121 | 122 | { 123 | name Conan 124 | aiming 10 125 | perfection 35 126 | reaction 10 127 | isp 100 128 | color "b0 b0 b0" 129 | skin base 130 | //weaponpref 012345678 131 | } 132 | 133 | { 134 | name Bond 135 | aiming 67 136 | perfection 15 137 | reaction 76 138 | isp 37 139 | color "50 50 60" 140 | skin base 141 | //weaponpref 012345678 142 | } 143 | 144 | { 145 | name Jones 146 | aiming 52 147 | perfection 35 148 | reaction 50 149 | isp 37 150 | color "8f 00 00" 151 | skin base 152 | //weaponpref 012345678 153 | } 154 | 155 | { 156 | name Blazkowicz 157 | aiming 80 158 | perfection 80 159 | reaction 80 160 | isp 100 161 | color "00 00 00" 162 | skin base 163 | //weaponpref 012345678 164 | } 165 | 166 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/cig.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = cig.wad 6 | 7 | #12 minutes 8 | episode_timeout = 25200 9 | 10 | # Rendering options 11 | screen_resolution = RES_640X480 12 | screen_format = CRCGCB 13 | render_hud = true 14 | render_crosshair = true 15 | render_weapon = true 16 | render_decals = false 17 | render_particles = false 18 | 19 | window_visible = true 20 | 21 | # Available buttons 22 | available_buttons = 23 | { 24 | TURN_LEFT 25 | TURN_RIGHT 26 | ATTACK 27 | 28 | MOVE_RIGHT 29 | MOVE_LEFT 30 | 31 | MOVE_FORWARD 32 | MOVE_BACKWARD 33 | TURN_LEFT_RIGHT_DELTA 34 | LOOK_UP_DOWN_DELTA 35 | 36 | } 37 | 38 | mode = ASYNC_PLAYER 39 | 40 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/cig.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/cig.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/cig_with_unknown.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/cig_with_unknown.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/deadly_corridor.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = deadly_corridor.wad 6 | 7 | # Skill 5 is reccomanded for the scenario to be a challenge. 8 | doom_skill = 5 9 | 10 | # Rewards 11 | death_penalty = 100 12 | #living_reward = 0 13 | 14 | # Rendering options 15 | screen_resolution = RES_320X240 16 | screen_format = CRCGCB 17 | render_hud = true 18 | render_crosshair = false 19 | render_weapon = true 20 | render_decals = false 21 | render_particles = false 22 | window_visible = true 23 | 24 | episode_timeout = 2100 25 | 26 | # Available buttons 27 | available_buttons = 28 | { 29 | MOVE_LEFT 30 | MOVE_RIGHT 31 | ATTACK 32 | MOVE_FORWARD 33 | MOVE_BACKWARD 34 | TURN_LEFT 35 | TURN_RIGHT 36 | } 37 | 38 | # Game variables that will be in the state 39 | available_game_variables = { HEALTH } 40 | 41 | mode = PLAYER 42 | 43 | 44 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/deadly_corridor.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/deadly_corridor.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/deathmatch.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = deathmatch.wad 6 | 7 | # Rendering options 8 | screen_resolution = RES_320X240 9 | screen_format = CRCGCB 10 | render_hud = true 11 | render_crosshair = false 12 | render_weapon = true 13 | render_decals = false 14 | render_particles = false 15 | window_visible = true 16 | 17 | # make episodes finish after 4200 actions (tics) 18 | episode_timeout = 4200 19 | 20 | # Available buttons 21 | available_buttons = 22 | { 23 | ATTACK 24 | SPEED 25 | STRAFE 26 | 27 | MOVE_RIGHT 28 | MOVE_LEFT 29 | MOVE_BACKWARD 30 | MOVE_FORWARD 31 | TURN_RIGHT 32 | TURN_LEFT 33 | 34 | SELECT_WEAPON1 35 | SELECT_WEAPON2 36 | SELECT_WEAPON3 37 | SELECT_WEAPON4 38 | SELECT_WEAPON5 39 | SELECT_WEAPON6 40 | 41 | SELECT_NEXT_WEAPON 42 | SELECT_PREV_WEAPON 43 | 44 | LOOK_UP_DOWN_DELTA 45 | TURN_LEFT_RIGHT_DELTA 46 | MOVE_LEFT_RIGHT_DELTA 47 | 48 | } 49 | 50 | # Game variables that will be in the state 51 | available_game_variables = 52 | { 53 | KILLCOUNT 54 | HEALTH 55 | ARMOR 56 | SELECTED_WEAPON 57 | SELECTED_WEAPON_AMMO 58 | } 59 | mode = PLAYER 60 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/deathmatch.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/deathmatch.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/defend_the_center.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = defend_the_center.wad 6 | 7 | # Rewards 8 | death_penalty = 1 9 | 10 | # Rendering options 11 | screen_resolution = RES_640X480 12 | screen_format = CRCGCB 13 | render_hud = True 14 | render_crosshair = false 15 | render_weapon = true 16 | render_decals = false 17 | render_particles = false 18 | window_visible = true 19 | 20 | # make episodes start after 10 tics (after unholstering the gun) 21 | episode_start_time = 10 22 | 23 | # make episodes finish after 2100 actions (tics) 24 | episode_timeout = 2100 25 | 26 | # Available buttons 27 | available_buttons = 28 | { 29 | TURN_LEFT 30 | TURN_RIGHT 31 | ATTACK 32 | } 33 | 34 | # Game variables that will be in the state 35 | available_game_variables = { AMMO2 HEALTH } 36 | 37 | mode = PLAYER 38 | doom_skill = 3 39 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/defend_the_center.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/defend_the_center.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/defend_the_line.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = defend_the_line.wad 6 | 7 | # Rewards 8 | death_penalty = 1 9 | 10 | # Rendering options 11 | screen_resolution = RES_320X240 12 | screen_format = CRCGCB 13 | render_hud = True 14 | render_crosshair = false 15 | render_weapon = true 16 | render_decals = false 17 | render_particles = false 18 | window_visible = true 19 | 20 | # make episodes start after 10 tics (after unholstering the gun) 21 | episode_start_time = 10 22 | 23 | 24 | # Available buttons 25 | available_buttons = 26 | { 27 | TURN_lEFT 28 | TURN_RIGHT 29 | ATTACK 30 | } 31 | 32 | # Game variables that will be in the state 33 | available_game_variables = { AMMO2 HEALTH} 34 | 35 | mode = PLAYER 36 | doom_skill = 3 37 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/defend_the_line.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/defend_the_line.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/health_gathering.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = health_gathering.wad 6 | 7 | # Each step is good for you! 8 | living_reward = 1 9 | # And death is not! 10 | death_penalty = 100 11 | 12 | # Rendering options 13 | screen_resolution = RES_320X240 14 | screen_format = CRCGCB 15 | render_hud = false 16 | render_crosshair = false 17 | render_weapon = false 18 | render_decals = false 19 | render_particles = false 20 | window_visible = true 21 | 22 | # make episodes finish after 2100 actions (tics) 23 | episode_timeout = 2100 24 | 25 | # Available buttons 26 | available_buttons = 27 | { 28 | TURN_LEFT 29 | TURN_RIGHT 30 | MOVE_FORWARD 31 | } 32 | 33 | # Game variables that will be in the state 34 | available_game_variables = { HEALTH } 35 | 36 | mode = PLAYER -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/health_gathering.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/health_gathering.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/health_gathering_supreme.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = health_gathering_supreme.wad 6 | 7 | # Each step is good for you! 8 | living_reward = 1 9 | # And death is not! 10 | death_penalty = 100 11 | 12 | # Rendering options 13 | screen_resolution = RES_320X240 14 | screen_format = CRCGCB 15 | render_hud = false 16 | render_crosshair = false 17 | render_weapon = false 18 | render_decals = false 19 | render_particles = false 20 | window_visible = true 21 | 22 | # make episodes finish after 2100 actions (tics) 23 | episode_timeout = 2100 24 | 25 | # Available buttons 26 | available_buttons = 27 | { 28 | TURN_LEFT 29 | TURN_RIGHT 30 | MOVE_FORWARD 31 | } 32 | 33 | # Game variables that will be in the state 34 | available_game_variables = { HEALTH } 35 | 36 | mode = PLAYER -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/health_gathering_supreme.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/health_gathering_supreme.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/learning.cfg: -------------------------------------------------------------------------------- 1 | doom_scenario_path = basic.wad 2 | 3 | # Rewards 4 | living_reward = -1 5 | 6 | # Rendering options 7 | screen_resolution = RES_640X480 8 | screen_format = GRAY8 9 | render_hud = false 10 | render_crosshair = false 11 | render_weapon = true 12 | render_decals = false 13 | render_particles = false 14 | window_visible = false 15 | 16 | # make episodes start after 20 tics (after unholstering the gun) 17 | episode_start_time = 14 18 | 19 | # make episodes finish after 300 actions (tics) 20 | episode_timeout = 300 21 | 22 | # Available buttons 23 | available_buttons = 24 | { 25 | MOVE_LEFT 26 | MOVE_RIGHT 27 | ATTACK 28 | } 29 | 30 | mode = PLAYER 31 | 32 | 33 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/multi.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = multi_deathmatch.wad 6 | 7 | # Rewards 8 | death_penalty = 1 9 | 10 | # Rendering options 11 | screen_resolution = RES_640X480 12 | screen_format = CRCGCB 13 | render_hud = true 14 | render_crosshair = true 15 | render_weapon = true 16 | render_decals = false 17 | render_particles = false 18 | 19 | window_visible = true 20 | 21 | 22 | # Available buttons 23 | available_buttons = 24 | { 25 | TURN_LEFT 26 | TURN_RIGHT 27 | ATTACK 28 | 29 | MOVE_RIGHT 30 | MOVE_LEFT 31 | 32 | MOVE_FORWARD 33 | MOVE_BACKWARD 34 | TURN_LEFT_RIGHT_DELTA 35 | LOOK_UP_DOWN_DELTA 36 | 37 | } 38 | 39 | available_game_variables = 40 | { 41 | HEALTH 42 | AMMO3 43 | } 44 | mode = ASYNC_PLAYER 45 | 46 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/multi_deathmatch.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/multi_deathmatch.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/multi_duel.cfg: -------------------------------------------------------------------------------- 1 | doom_scenario_path = multi_duel.wad 2 | 3 | screen_resolution = RES_640X480 4 | screen_format = CRCGCB 5 | render_hud = true 6 | render_crosshair = false 7 | render_weapon = true 8 | render_decals = true 9 | render_particles = true 10 | window_visible = true 11 | 12 | available_buttons = 13 | { 14 | MOVE_LEFT 15 | MOVE_RIGHT 16 | ATTACK 17 | } 18 | 19 | mode = PLAYER 20 | doom_skill = 5 21 | 22 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/multi_duel.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/multi_duel.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/my_way_home.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = my_way_home.wad 6 | 7 | # Rewards 8 | living_reward = -0.0001 9 | 10 | # Rendering options 11 | screen_resolution = RES_640X480 12 | screen_format = CRCGCB 13 | render_hud = false 14 | render_crosshair = false 15 | render_weapon = true 16 | render_decals = false 17 | render_particles = false 18 | window_visible = true 19 | 20 | # make episodes start after 10 tics (after unholstering the gun) 21 | episode_start_time = 10 22 | 23 | # make episodes finish after 2100 actions (tics) 24 | episode_timeout = 2100 25 | 26 | # Available buttons 27 | available_buttons = 28 | { 29 | TURN_LEFT 30 | TURN_RIGHT 31 | MOVE_FORWARD 32 | MOVE_LEFT 33 | MOVE_RIGHT 34 | } 35 | 36 | # Game variables that will be in the state 37 | available_game_variables = { AMMO0 } 38 | 39 | mode = PLAYER 40 | doom_skill = 5 41 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/my_way_home.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/my_way_home.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/oblige.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | # Rendering options 6 | screen_resolution = RES_320X240 7 | screen_format = CRCGCB 8 | render_hud = true 9 | render_crosshair = false 10 | render_weapon = true 11 | render_decals = false 12 | render_particles = false 13 | window_visible = true 14 | 15 | # make episodes finish after 4200 actions (tics) 16 | episode_timeout = 4200 17 | 18 | # Available buttons 19 | available_buttons = 20 | { 21 | ATTACK 22 | USE 23 | SPEED 24 | STRAFE 25 | 26 | MOVE_RIGHT 27 | MOVE_LEFT 28 | MOVE_BACKWARD 29 | MOVE_FORWARD 30 | TURN_RIGHT 31 | TURN_LEFT 32 | 33 | SELECT_WEAPON1 34 | SELECT_WEAPON2 35 | SELECT_WEAPON3 36 | SELECT_WEAPON4 37 | SELECT_WEAPON5 38 | SELECT_WEAPON6 39 | 40 | SELECT_NEXT_WEAPON 41 | SELECT_PREV_WEAPON 42 | 43 | LOOK_UP_DOWN_DELTA 44 | TURN_LEFT_RIGHT_DELTA 45 | MOVE_LEFT_RIGHT_DELTA 46 | 47 | } 48 | 49 | # Game variables that will be in the state 50 | available_game_variables = 51 | { 52 | KILLCOUNT 53 | HEALTH 54 | ARMOR 55 | SELECTED_WEAPON 56 | SELECTED_WEAPON_AMMO 57 | } 58 | mode = PLAYER 59 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/predict_position.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = predict_position.wad 6 | 7 | # Rewards 8 | living_reward = -0.001 9 | 10 | # Rendering options 11 | screen_resolution = RES_800X450 12 | screen_format = CRCGCB 13 | render_hud = false 14 | render_crosshair = false 15 | render_weapon = true 16 | render_decals = false 17 | render_particles = false 18 | window_visible = true 19 | 20 | # make episodes start after 16 tics (after producing the rocket launcher) 21 | episode_start_time = 16 22 | 23 | # make episodes finish after 300 actions (tics) 24 | episode_timeout = 300 25 | 26 | # Available buttons 27 | available_buttons = 28 | { 29 | TURN_LEFT 30 | TURN_RIGHT 31 | ATTACK 32 | } 33 | 34 | # Empty list is allowed, in case you are lazy. 35 | available_game_variables = { } 36 | 37 | game_args += +sv_noautoaim 1 38 | 39 | mode = PLAYER 40 | doom_skill = 1 41 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/predict_position.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/predict_position.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/rocket_basic.cfg: -------------------------------------------------------------------------------- 1 | doom_scenario_path = rocket_basic.wad 2 | 3 | # Rewards 4 | living_reward = -1 5 | 6 | # Rendering options 7 | screen_resolution = RES_640X480 8 | screen_format = GRAY8 9 | render_hud = true 10 | render_crosshair = false 11 | render_weapon = true 12 | render_decals = false 13 | render_particles = false 14 | 15 | # make episodes start after 14 tics (after unholstering the gun) 16 | episode_start_time = 14 17 | 18 | # make episodes finish after 300 actions (tics) 19 | episode_timeout = 300 20 | 21 | # Available buttons 22 | available_buttons = 23 | { 24 | MOVE_LEFT 25 | MOVE_RIGHT 26 | ATTACK 27 | } 28 | 29 | game_args += +sv_noautoaim 1 30 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/rocket_basic.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/rocket_basic.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/simpler_basic.cfg: -------------------------------------------------------------------------------- 1 | doom_scenario_path = simpler_basic.wad 2 | 3 | # Rewards 4 | living_reward = -1 5 | 6 | # Rendering options 7 | screen_resolution = RES_640X480 8 | screen_format = GRAY8 9 | 10 | render_hud = true 11 | render_crosshair = false 12 | render_weapon = true 13 | render_decals = false 14 | render_particles = false 15 | 16 | # make episodes start after 20 tics (after unholstering the gun) 17 | episode_start_time = 14 18 | 19 | # make episodes finish after 300 actions (tics) 20 | episode_timeout = 300 21 | 22 | # Available buttons 23 | available_buttons = 24 | { 25 | MOVE_LEFT 26 | MOVE_RIGHT 27 | ATTACK 28 | } 29 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/simpler_basic.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/simpler_basic.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/take_cover.cfg: -------------------------------------------------------------------------------- 1 | # Lines starting with # are treated as comments (or with whitespaces+#). 2 | # It doesn't matter if you use capital letters or not. 3 | # It doesn't matter if you use underscore or camel notation for keys, e.g. episode_timeout is the same as episodeTimeout. 4 | 5 | doom_scenario_path = take_cover.wad 6 | doom_map = map01 7 | 8 | # Rewards 9 | living_reward = 1 10 | 11 | # Rendering options 12 | screen_resolution = RES_320X240 13 | screen_format = CRCGCB 14 | render_hud = false 15 | render_crosshair = false 16 | render_weapon = false 17 | render_decals = false 18 | render_particles = false 19 | window_visible = true 20 | 21 | # Available buttons 22 | available_buttons = 23 | { 24 | MOVE_LEFT 25 | MOVE_RIGHT 26 | } 27 | 28 | # Game variables that will be in the state 29 | available_game_variables = { HEALTH } 30 | 31 | # Change it if you wish. 32 | doom_skill = 4 33 | 34 | -------------------------------------------------------------------------------- /vizdoomgym/envs/scenarios/take_cover.wad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shakenes/vizdoomgym/3ab9052de6fb4172544d35103857e3577526b57c/vizdoomgym/envs/scenarios/take_cover.wad -------------------------------------------------------------------------------- /vizdoomgym/envs/vizdoom_env_definitions.py: -------------------------------------------------------------------------------- 1 | from vizdoomgym.envs.vizdoomenv import VizdoomEnv 2 | 3 | 4 | class VizdoomBasic(VizdoomEnv): 5 | def __init__(self, **kwargs): 6 | super(VizdoomBasic, self).__init__(0, **kwargs) 7 | 8 | 9 | class VizdoomCorridor(VizdoomEnv): 10 | def __init__(self, **kwargs): 11 | super(VizdoomCorridor, self).__init__(1, **kwargs) 12 | 13 | 14 | class VizdoomDeathmatch(VizdoomEnv): 15 | def __init__(self, **kwargs): 16 | super(VizdoomDeathmatch, self).__init__(8, **kwargs) 17 | 18 | 19 | class VizdoomDefendCenter(VizdoomEnv): 20 | def __init__(self, **kwargs): 21 | super(VizdoomDefendCenter, self).__init__(2, **kwargs) 22 | 23 | 24 | class VizdoomDefendLine(VizdoomEnv): 25 | def __init__(self, **kwargs): 26 | super(VizdoomDefendLine, self).__init__(3, **kwargs) 27 | 28 | 29 | class VizdoomHealthGathering(VizdoomEnv): 30 | def __init__(self, **kwargs): 31 | super(VizdoomHealthGathering, self).__init__(4, **kwargs) 32 | 33 | 34 | class VizdoomHealthGatheringSupreme(VizdoomEnv): 35 | def __init__(self, **kwargs): 36 | super(VizdoomHealthGatheringSupreme, self).__init__(9, **kwargs) 37 | 38 | 39 | class VizdoomMyWayHome(VizdoomEnv): 40 | def __init__(self, **kwargs): 41 | super(VizdoomMyWayHome, self).__init__(5, **kwargs) 42 | 43 | 44 | class VizdoomPredictPosition(VizdoomEnv): 45 | def __init__(self, **kwargs): 46 | super(VizdoomPredictPosition, self).__init__(6, **kwargs) 47 | 48 | 49 | class VizdoomTakeCover(VizdoomEnv): 50 | def __init__(self, **kwargs): 51 | super(VizdoomTakeCover, self).__init__(7, **kwargs) 52 | -------------------------------------------------------------------------------- /vizdoomgym/envs/vizdoomenv.py: -------------------------------------------------------------------------------- 1 | import gym 2 | from gym import spaces 3 | import vizdoom.vizdoom as vzd 4 | import numpy as np 5 | import os 6 | from typing import List 7 | 8 | turn_off_rendering = False 9 | try: 10 | from gym.envs.classic_control import rendering 11 | except Exception as e: 12 | print(e) 13 | turn_off_rendering = True 14 | 15 | CONFIGS = [ 16 | ["basic.cfg", 3], # 0 17 | ["deadly_corridor.cfg", 7], # 1 18 | ["defend_the_center.cfg", 3], # 2 19 | ["defend_the_line.cfg", 3], # 3 20 | ["health_gathering.cfg", 3], # 4 21 | ["my_way_home.cfg", 5], # 5 22 | ["predict_position.cfg", 3], # 6 23 | ["take_cover.cfg", 2], # 7 24 | ["deathmatch.cfg", 20], # 8 25 | ["health_gathering_supreme.cfg", 3], # 9 26 | ] 27 | 28 | 29 | class VizdoomEnv(gym.Env): 30 | def __init__(self, level, **kwargs): 31 | """ 32 | Base class for Gym interface for ViZDoom. Child classes are defined in vizdoom_env_definitions.py, 33 | that contain the level parameter and pass through any kwargs from gym.make() 34 | :param level: index of level in the CONFIGS list above 35 | :param kwargs: keyword arguments from gym.make(env_name_string, **kwargs) call. 'depth' will render the 36 | depth buffer and 'labels' will render the object labels and return it in the observation. 37 | Note that the observation will be a list with the screen buffer as the first element. If no kwargs are 38 | provided (or depth=False and labels=False) the observation will be of type np.ndarray. 39 | """ 40 | 41 | # parse keyword arguments 42 | self.depth = kwargs.get("depth", False) 43 | self.labels = kwargs.get("labels", False) 44 | self.position = kwargs.get("position", False) 45 | self.health = kwargs.get("health", False) 46 | 47 | # init game 48 | self.game = vzd.DoomGame() 49 | self.game.set_screen_resolution(vzd.ScreenResolution.RES_640X480) 50 | scenarios_dir = os.path.join(os.path.dirname(__file__), "scenarios") 51 | self.game.load_config(os.path.join(scenarios_dir, CONFIGS[level][0])) 52 | self.game.set_window_visible(False) 53 | self.game.set_depth_buffer_enabled(self.depth) 54 | self.game.set_labels_buffer_enabled(self.labels) 55 | self.game.clear_available_game_variables() 56 | if self.position: 57 | self.game.add_available_game_variable(vzd.GameVariable.POSITION_X) 58 | self.game.add_available_game_variable(vzd.GameVariable.POSITION_Y) 59 | self.game.add_available_game_variable(vzd.GameVariable.POSITION_Z) 60 | self.game.add_available_game_variable(vzd.GameVariable.ANGLE) 61 | if self.health: 62 | self.game.add_available_game_variable(vzd.GameVariable.HEALTH) 63 | self.game.init() 64 | self.state = None 65 | self.viewer = None 66 | 67 | self.action_space = spaces.Discrete(CONFIGS[level][1]) 68 | 69 | # specify observation space(s) 70 | list_spaces: List[gym.Space] = [ 71 | spaces.Box( 72 | 0, 73 | 255, 74 | ( 75 | self.game.get_screen_height(), 76 | self.game.get_screen_width(), 77 | self.game.get_screen_channels(), 78 | ), 79 | dtype=np.uint8, 80 | ) 81 | ] 82 | if self.depth: 83 | list_spaces.append( 84 | spaces.Box( 85 | 0, 86 | 255, 87 | (self.game.get_screen_height(), self.game.get_screen_width(),), 88 | dtype=np.uint8, 89 | ) 90 | ) 91 | if self.labels: 92 | list_spaces.append( 93 | spaces.Box( 94 | 0, 95 | 255, 96 | (self.game.get_screen_height(), self.game.get_screen_width(),), 97 | dtype=np.uint8, 98 | ) 99 | ) 100 | if self.position: 101 | list_spaces.append(spaces.Box(-np.Inf, np.Inf, (4, 1))) 102 | if self.health: 103 | list_spaces.append(spaces.Box(0, np.Inf, (1, 1))) 104 | if len(list_spaces) == 1: 105 | self.observation_space = list_spaces[0] 106 | else: 107 | self.observation_space = spaces.Tuple(list_spaces) 108 | 109 | def step(self, action): 110 | # convert action to vizdoom action space (one hot) 111 | act = np.zeros(self.action_space.n) 112 | act[action] = 1 113 | act = np.uint8(act) 114 | act = act.tolist() 115 | 116 | reward = self.game.make_action(act) 117 | self.state = self.game.get_state() 118 | done = self.game.is_episode_finished() 119 | info = {"dummy": 0.0} 120 | 121 | return self.__collect_observations(), reward, done, info 122 | 123 | def reset(self): 124 | self.game.new_episode() 125 | self.state = self.game.get_state() 126 | 127 | return self.__collect_observations() 128 | 129 | def __collect_observations(self): 130 | observation = [] 131 | if self.state is not None: 132 | observation.append(np.transpose(self.state.screen_buffer, (1, 2, 0))) 133 | if self.depth: 134 | observation.append(self.state.depth_buffer) 135 | if self.labels: 136 | observation.append(self.state.labels_buffer) 137 | if self.position: 138 | observation.append( 139 | np.array([self.state.game_variables[i] for i in range(4)]) 140 | ) 141 | if self.health: 142 | observation.append(self.state.game_variables[4]) 143 | elif self.health: 144 | observation.append(self.state.game_variables[0]) 145 | else: 146 | # there is no state in the terminal step, so a "zero observation is returned instead" 147 | if isinstance(self.observation_space, gym.spaces.box.Box): 148 | # Box isn't iterable 149 | obs_space = [self.observation_space] 150 | else: 151 | obs_space = self.observation_space 152 | 153 | for space in obs_space: 154 | observation.append(np.zeros(space.shape, dtype=space.dtype)) 155 | 156 | # if there is only one observation, return obs as array to sustain compatibility 157 | if len(observation) == 1: 158 | observation = observation[0] 159 | return observation 160 | 161 | def render(self, mode="human"): 162 | if turn_off_rendering: 163 | return 164 | try: 165 | img = self.game.get_state().screen_buffer 166 | img = np.transpose(img, [1, 2, 0]) 167 | 168 | if self.viewer is None: 169 | self.viewer = rendering.SimpleImageViewer() 170 | self.viewer.imshow(img) 171 | except AttributeError: 172 | pass 173 | 174 | def close(self): 175 | if self.viewer: 176 | self.viewer.close() 177 | 178 | @staticmethod 179 | def get_keys_to_action(): 180 | # you can press only one key at a time! 181 | keys = { 182 | (): 2, 183 | (ord("a"),): 0, 184 | (ord("d"),): 1, 185 | (ord("w"),): 3, 186 | (ord("s"),): 4, 187 | (ord("q"),): 5, 188 | (ord("e"),): 6, 189 | } 190 | return keys 191 | --------------------------------------------------------------------------------