New env: ColumbusSingle

This commit is contained in:
Dominik Moritz Roth 2022-08-14 17:48:53 +02:00
parent b490c8ffd9
commit 61b5e654db

View File

@ -456,6 +456,26 @@ class ColumbusComp(ColumbusEnv):
self.entities.append(reward)
class ColumbusSingle(ColumbusEnv):
def __init__(self, observable=observables.CompositionalObservable([observables.RayObservable(num_rays=6, chans=[entities.Enemy]), observables.StateObservable(coordsAgent=True, speedAgent=False, coordsRelativeToAgent=False, coordsRewards=True, rewardsWhitelist=None, coordsEnemys=False, enemysWhitelist=None, enemysNoBarriers=True, rewardsTimeouts=False, include_rand=True)]), hide_map=False, fps=30, env_seed=None):
super().__init__(
observable=observable, fps=fps, env_seed=env_seed)
self.draw_entities = not hide_map
self.aux_reward_max = 10
def setup(self):
self.agent.pos = self.start_pos
for i in range(4 + math.floor(self.random()*4)):
enemy = entities.CircleBarrier(self)
enemy.radius = 30 + self.random()*70
self.entities.append(enemy)
for i in range(1):
reward = entities.TeleportingReward(self)
reward.radius = 30
reward.reward *= 2
self.entities.append(reward)
class ColumbusJustState(ColumbusEnv):
def __init__(self, observable=observables.StateObservable(), fps=30, num_enemies=0, num_rewards=1, env_seed=None):
super(ColumbusJustState, self).__init__(
@ -604,3 +624,9 @@ register(
entry_point=ColumbusComp,
max_episode_steps=30*60*2,
)
register(
id='ColumbusSingle-v0',
entry_point=ColumbusSingle,
max_episode_steps=30*60*2,
)