def __init__(self, my_character='pikachu', their_character='dk', my_character_color='CUP', their_character_color='CLEFT', opponent_bot_level=10, map='DreamLand'): # TODO: Make player number configurable in the future. self._set_characters(my_character, their_character) self._set_characters_color(my_character_color, their_character_color) self._opponent_bot_level = opponent_bot_level # Agent and opponent cannot be the same character and color. assert (self._my_char_pos != self._their_char_pos or self._my_char_color != self._their_char_color) self._set_map(map) super(SmashEnv, self).__init__() self._my_damage_tracker = damage_tracker.DamageTracker(self.frame_skip, playernum=1) self._their_damage_tracker = damage_tracker.DamageTracker( self.frame_skip, playernum=2) self.action_space = spaces.MultiDiscrete([ [-128, 127], # Joystick X [-128, 127], # Joystick Y [0, 1], # A [0, 1], # B [0, 0], # RB- unused [0, 1], # LB [0, 1], # Z [0, 1] ]) # C
def _reset(self): self._my_damage_tracker = damage_tracker.DamageTracker(self.frame_skip, playernum=1) self._their_damage_tracker = damage_tracker.DamageTracker(self.frame_skip, playernum=2) self._last_dmg_step = 0 # Nothing to do on the first call to reset() if self.reset_count > 0: # Make sure we don't skip frames while navigating the menus with self.controller_server.frame_skip_disabled(): # TODO: Possibly allow exiting an in-progress map? pass return super(SmashEnv, self)._reset()