diff --git a/agents/saved_models/A0 b/agents/saved_models/A0 index c18b620..994a351 100644 Binary files a/agents/saved_models/A0 and b/agents/saved_models/A0 differ diff --git a/agents/saved_models/C0 b/agents/saved_models/C0 index f5e8857..87c2d30 100644 Binary files a/agents/saved_models/C0 and b/agents/saved_models/C0 differ diff --git a/entities/components/animaton.py b/entities/components/animaton.py index 30f616d..d1223c9 100644 --- a/entities/components/animaton.py +++ b/entities/components/animaton.py @@ -45,6 +45,7 @@ class AnimationHandler: 'player', animation )) + print(f"hitbox: {self.hitbox}") elif self.sprite_type == 'enemy': diff --git a/entities/player.py b/entities/player.py index fa4c168..fd5fb20 100644 --- a/entities/player.py +++ b/entities/player.py @@ -1,4 +1,3 @@ -import os import pygame import numpy as np from random import randint @@ -154,16 +153,18 @@ class Player(pygame.sprite.Sprite): sorted_distances = np.zeros(self.num_features) nearest_dist, _, nearest_enemy = sorted_distances[0] + print(nearest_dist, nearest_enemy) self.action_features = [self._input.action] self.reward_features = [ self.stats.exp, - 2*np.exp(-nearest_dist**2), + 10/nearest_dist if nearest_dist > 10 else 1, 1/(np.exp((nearest_enemy.stats.health - - nearest_enemy.stats.monster_info['health'])/nearest_enemy.stats.monster_info['health'])) - 1, + nearest_enemy.stats.monster_info['health']) + / nearest_enemy.stats.monster_info['health'])) - 1, 1/(np.exp((len(self.distance_direction_from_enemy) - self.max_num_enemies)/self.max_num_enemies)) - 1, @@ -186,11 +187,18 @@ class Player(pygame.sprite.Sprite): for distance, direction, enemy in self.distance_direction_from_enemy: enemy_states.extend([ - np.exp(-distance), + + 10/distance if distance > 10 else 1, + direction[0], + direction[1], - enemy.stats.health/enemy.stats.monster_info['health'], - np.exp(-enemy.stats.exp**2), + + 1/(np.exp((nearest_enemy.stats.health - + nearest_enemy.stats.monster_info['health']) + / nearest_enemy.stats.monster_info['health'])) - 1, + + enemy.stats.exp, ]) self.state_features.extend(enemy_states) diff --git a/figures/actor_loss.png b/figures/actor_loss.png index 59145da..031ad58 100644 Binary files a/figures/actor_loss.png and b/figures/actor_loss.png differ diff --git a/figures/critic_loss.png b/figures/critic_loss.png index ce24bf2..c6cac6b 100644 Binary files a/figures/critic_loss.png and b/figures/critic_loss.png differ diff --git a/figures/score.png b/figures/score.png index 20c1a7b..d5d1bb6 100644 Binary files a/figures/score.png and b/figures/score.png differ diff --git a/figures/total_loss.png b/figures/total_loss.png index 50854b0..2ff68c3 100644 Binary files a/figures/total_loss.png and b/figures/total_loss.png differ