diff --git a/entities/player.py b/entities/player.py index a2add16..17a481a 100644 --- a/entities/player.py +++ b/entities/player.py @@ -34,7 +34,6 @@ class Player(pygame.sprite.Sprite): self.animation.import_assets(position) self.image = self.animation.image self.rect = self.animation.rect - # Setup Inputs self._input = InputHandler( self.sprite_type, self.animation_player) # , self.status) @@ -116,8 +115,10 @@ class Player(pygame.sprite.Sprite): self.state_features = [ # TODO: Find a way to normalize - # self.rect.center[0], - # self.rect.center[1], + self.rect.center[0]/3616, + self.rect.center[1]/3168, + self._input.movement.direction.x, + self._input.movement.direction.y, self.stats.health/self.stats.stats['health'], self.stats.energy/self.stats.stats['energy'] ] @@ -127,7 +128,7 @@ class Player(pygame.sprite.Sprite): for distance, direction, enemy in sorted_distances[:5]: enemy_states.extend([ - distance/sorted_distances[-1][1], + distance/sorted_distances[-1][0], direction[0], direction[1], enemy.stats.health/enemy.stats.monster_info['health'], @@ -173,7 +174,6 @@ class Player(pygame.sprite.Sprite): # Get the current state self.get_current_state() - # Choose action based on current state action, probs, value = self.agent.choose_action(self.state_features) diff --git a/main.py b/main.py index 192cffb..9218561 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1' if __name__ == '__main__': - n_episodes = 1000 + n_episodes = 1 figure_file = 'plots/score.png' score_history = [] @@ -15,7 +15,7 @@ if __name__ == '__main__': agent_list = [] - game_len = 5000 + game_len = 1 game = Game() diff --git a/tmp/ppo/actor_torch_ppo b/tmp/ppo/actor_torch_ppo deleted file mode 100644 index 60dc325..0000000 Binary files a/tmp/ppo/actor_torch_ppo and /dev/null differ diff --git a/tmp/ppo/critic_torch_ppo b/tmp/ppo/critic_torch_ppo deleted file mode 100644 index 03a0b45..0000000 Binary files a/tmp/ppo/critic_torch_ppo and /dev/null differ