Files
Gymnasium/gym/envs/doom/doom_basic.py
Philip Paquette aff7a643cc Doom - Same Action Space Across Environments (#157)
* Doom - Added reward_threshold and timestep_limit for all environments

* Doom - Returning all available game variables

* Doom - Moved _seed to doom_env to avoid repetition in every environment

* Doom - Added ALT_ATTACK and made all action_space equivalent (same controls between environments).

* Doom - Actions can either be a short list of allowed actions or the full list of 41 commands

* Doom - Returning black observation space on error or is_finished, rather than empty list (which was triggering an error)

* Doom - HighLow.sample() returns the small list.

* Doom - Updated difficulty for some missions

* Doom - Fixed inconsistency between controls.md and deathmatch.cfg

* Doom - Issue #168 - Remove sleep statement from DoomEnv render

* Doom - Only using full action space (43 keys)

- Added 'normal', 'fast' and 'human' mode
- Set non-deterministic to True
- Set video.frames_per_second to 35
- Properly returning game variables

* Replaced warnings.warn by logger.warn

* Doom - Added NUM_ACTIONS and action_idx instead of x

* Doom - Added NUM_ACTIONS and action_idx instead of x

* Doom - reset() only calls game.new_episode() after first call

* Doom is now deterministic

* Doom - Partial fix for issue #167 - DoomDeathmatch environment crashes sporadically

* Doom - Standardized envs, simplified _reset

* Doom - Removed temporary fix for issue #167

* Doom - Added scoreboard summary and description
2016-06-14 15:57:47 -07:00

48 lines
1.7 KiB
Python

import logging
from gym.envs.doom import doom_env
logger = logging.getLogger(__name__)
class DoomBasicEnv(doom_env.DoomEnv):
"""
------------ Training Mission 1 - Basic ------------
This map is rectangular with gray walls, ceiling and floor.
You are spawned in the center of the longer wall, and a red
circular monster is spawned randomly on the opposite wall.
You need to kill the monster (one bullet is enough).
Allowed actions:
[0] - ATTACK - Shoot weapon - Values 0 or 1
[10] - MOVE_RIGHT - Move to the right - Values 0 or 1
[11] - MOVE_LEFT - Move to the left - Values 0 or 1
Note: see controls.md for details
Rewards:
+101 - Killing the monster
- 5 - Missing a shot
- 1 - 35 times per second - Kill the monster faster!
Goal: 10 points
Kill the monster in 3 secs with 1 shot
Mode:
- env.mode can be 'fast', 'normal' or 'human' (e.g. env.mode = 'fast')
- 'fast' (default) will run as fast as possible (~75 fps) (best for simulation)
- 'normal' will run at roughly 35 fps (easier for human to watch)
- 'human' will let you play the game (keyboard only: Arrow Keys, '<', '>' and Ctrl)
Ends when:
- Monster is dead
- Player is dead
- Timeout (10 seconds - 350 frames)
Actions:
actions = [0] * 43
actions[0] = 0 # ATTACK
actions[10] = 1 # MOVE_RIGHT
actions[11] = 0 # MOVE_LEFT
-----------------------------------------------------
"""
def __init__(self):
super(DoomBasicEnv, self).__init__(0)