Skip to content

Commit

Permalink
adding more movement types for discrete actions I have not looked int…
Browse files Browse the repository at this point in the history
…o continous actions, but when I get there there will probably be more actions to add.
  • Loading branch information
figgybit committed Mar 23, 2017
1 parent e147990 commit 467ae4d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions gym_minecraft/envs/minecraft_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

logger = logging.getLogger(__name__)

SINGLE_DIRECTION_DISCRETE_MOVEMENTS = [ "jumpeast", "jumpnorth", "jumpsouth", "jumpwest",
"movenorth", "moveeast", "movesouth", "movewest",
"jumpuse", "use", "attack", "jump" ]

MULTIPLE_DIRECTION_DISCRETE_MOVEMENTS = [ "move", "turn", "look", "strafe",
"jumpmove", "jumpstrafe" ]

class MinecraftEnv(gym.Env):
metadata = {'render.modes': ['human', 'rgb_array']}
Expand Down Expand Up @@ -180,13 +186,11 @@ def _create_action_space(self):
else:
raise ValueError("Unknown continuous action " + cmd)
elif ch == "DiscreteMovement":
if cmd in ["movenorth", "moveeast", "movesouth", "movewest"]:
if cmd in SINGLE_DIRECTION_DISCRETE_MOVEMENTS:
discrete_actions.append(cmd + " 1")
elif cmd in ["move", "turn", "look"]:
elif cmd in MULTIPLE_DIRECTION_DISCRETE_MOVEMENTS:
discrete_actions.append(cmd + " 1")
discrete_actions.append(cmd + " -1")
elif cmd in ["jump", "attack", "use"]:
discrete_actions.append(cmd + " 1")
else:
raise ValueError(False, "Unknown discrete action " + cmd)
elif ch == "AbsoluteMovement":
Expand Down

0 comments on commit 467ae4d

Please sign in to comment.