Made rewards make more sense and removed extra punishment for death
This commit is contained in:
parent
e45b2fb914
commit
27d87e9c92
3 changed files with 2 additions and 3 deletions
|
@ -161,7 +161,7 @@ class Player(pygame.sprite.Sprite):
|
|||
self.old_state_features = self.state_features
|
||||
|
||||
self.reward = self.stats.exp\
|
||||
+ self.stats.health/self.stats.stats['health'] - 1
|
||||
+ self.stats.health/self.stats.stats['health']
|
||||
# - nearest_dist/np.sqrt(np.sum(self.map_edge))
|
||||
|
||||
self.state_features = [
|
||||
|
|
1
level.py
1
level.py
|
@ -293,7 +293,6 @@ class Level:
|
|||
for player in self.player_sprites:
|
||||
if player.is_dead():
|
||||
print(f"\nPlayer {player.player_id} is dead\n")
|
||||
player.stats.exp = -10
|
||||
self.dead_players[player.player_id] = player.is_dead()
|
||||
|
||||
self.done = True if (self.dead_players.all() == 1
|
||||
|
|
2
main.py
2
main.py
|
@ -116,7 +116,7 @@ def main():
|
|||
|
||||
episode_reward[player.player_id][step] = player.reward
|
||||
|
||||
if not no_training and ((step % horizon == 0 and step != 0) or player.is_dead()):
|
||||
if not no_training and ((step % horizon == 0 and step != 0):
|
||||
|
||||
player.agent.learn()
|
||||
|
||||
|
|
Loading…
Reference in a new issue