2016-05-17 00:46:03 -07:00
|
|
|
import logging
|
|
|
|
from gym.envs.doom import doom_env
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2016-07-12 01:25:48 -04:00
|
|
|
|
2016-05-17 00:46:03 -07:00
|
|
|
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
|
2016-06-14 18:57:47 -04:00
|
|
|
[10] - MOVE_RIGHT - Move to the right - Values 0 or 1
|
|
|
|
[11] - MOVE_LEFT - Move to the left - Values 0 or 1
|
2016-05-17 00:46:03 -07:00
|
|
|
Note: see controls.md for details
|
|
|
|
|
|
|
|
Rewards:
|
|
|
|
+101 - Killing the monster
|
|
|
|
- 5 - Missing a shot
|
2016-06-14 18:57:47 -04:00
|
|
|
- 1 - 35 times per second - Kill the monster faster!
|
2016-05-17 00:46:03 -07:00
|
|
|
|
|
|
|
Goal: 10 points
|
|
|
|
Kill the monster in 3 secs with 1 shot
|
|
|
|
|
2016-06-14 18:57:47 -04:00
|
|
|
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)
|
|
|
|
|
2016-05-17 00:46:03 -07:00
|
|
|
Ends when:
|
|
|
|
- Monster is dead
|
|
|
|
- Player is dead
|
|
|
|
- Timeout (10 seconds - 350 frames)
|
2016-06-14 18:57:47 -04:00
|
|
|
|
|
|
|
Actions:
|
|
|
|
actions = [0] * 43
|
|
|
|
actions[0] = 0 # ATTACK
|
|
|
|
actions[10] = 1 # MOVE_RIGHT
|
|
|
|
actions[11] = 0 # MOVE_LEFT
|
2016-05-17 00:46:03 -07:00
|
|
|
-----------------------------------------------------
|
|
|
|
"""
|
|
|
|
def __init__(self):
|
2016-06-14 18:57:47 -04:00
|
|
|
super(DoomBasicEnv, self).__init__(0)
|