HighwayEnv
HighwayEnv copied to clipboard
Multi-agent setting in highway-v0
While creating a multi-agent setting in highway-v0 after modifying it to continue till all agents crash or finish the duration of an episode, when the first agent (observer_vehicle) collides, the rendering stops moving.
In this scenario can the observer vehicle be changed to the next uncrashed agent or can there be multiple windows showing the progress of each agent?
While creating a multi-agent setting in highway-v0 after modifying it to continue till all agents crash or finish the duration of an episode, when the first agent (observer_vehicle) collides, the rendering stops moving.
Indeed, the rendered window will keep tracking the first controlled vehicle. Note that the simulation continues, and each controlled vehicle keeps getting new observations.
In this scenario can the observer vehicle be changed to the next uncrashed agent
Yes, you can change the code which moves the centre of the rendered window to the first uncrashed controlled vehicle, instead of the first controlled vehicle. Change this function:
https://github.com/eleurent/highway-env/blob/ab209de9c1a0da7524e74eb817beec04e6415a0d/highway_env/envs/common/graphics.py#L149
to use something like
uncrashed_vehicles = [v for v in self.env.controlled_vehicles if not v.crashed]
return uncrashed_vehicles[0] if uncrashed_vehicles else self.env.controlled_vehicles[0]
or can there be multiple windows showing the progress of each agent?
I'm afraid not, pygame only supports a single window.