diff --git a/entities.py b/entities.py index c03c7ca..56fdc20 100644 --- a/entities.py +++ b/entities.py @@ -72,7 +72,7 @@ class Enemy(Entity): def __init__(self, env): super(Enemy, self).__init__(env) self.col = (255, 0, 0) - self.damage = 10 + self.damage = 100 def on_collision(self, other): if isinstance(other, Agent): diff --git a/env.py b/env.py index d189a4e..27101ba 100644 --- a/env.py +++ b/env.py @@ -26,6 +26,7 @@ class ColumbusEnv(gym.Env): self.screen = None self.width = 720 self.height = 720 + self.start_pos = (0.5, 0.5) self.speed_fac = 0.01/fps*60 self.acc_fac = 0.03/fps*60 self.agent_drag = 0 # 0.01 is a good value @@ -139,6 +140,7 @@ class ColumbusEnv(gym.Env): self.entities = newEntities def setup(self): + self.agent.pos = self.start_pos for i in range(18): enemy = entities.CircleBarrier(self) enemy.radius = self.random()*40+50 diff --git a/gym_binding.py b/gym_binding.py new file mode 100644 index 0000000..c572530 --- /dev/null +++ b/gym_binding.py @@ -0,0 +1,13 @@ +from gym.envs.registration import register +from env import * + +def register(): + register( + # unique identifier for the env `name-version` + id="Columbus-Test317-v0", + # path to the class for creating the env + # Note: entry_point also accept a class as input (and not only a string) + entry_point=env.ColumbusEnv, + # Max number of steps per episode, using a `TimeLimitWrapper` + max_episode_steps=500, + ) diff --git a/humanPlayer.py b/humanPlayer.py index 99bcae1..bb44b6b 100644 --- a/humanPlayer.py +++ b/humanPlayer.py @@ -8,6 +8,7 @@ from observables import Observable, CnnObservable def main(): env = ColumbusEnv(fps=60, observable=CnnObservable()) + env.start_pos = [0.6, 0.3] playEnv(env) env.close()