Simple Adversary#


This environment is part of the MPE environments. Please read that page first for general information.


from pettingzoo.mpe import simple_adversary_v2



Parallel API


Manual Control



agents= [adversary_0, agent_0,agent_1]



Action Shape


Action Values

Discrete(5)/Box(0.0, 1.0, (5))

Observation Shape


Observation Values


State Shape


State Values


In this environment, there is 1 adversary (red), N good agents (green), N landmarks (default N=2). All agents observe the position of landmarks and other agents. One landmark is the ‘target landmark’ (colored green). Good agents are rewarded based on how close the closest one of them is to the target landmark, but negatively rewarded based on how close the adversary is to the target landmark. The adversary is rewarded based on distance to the target, but it doesn’t know which landmark is the target landmark. All rewards are unscaled Euclidean distance (see main MPE documentation for average distance). This means good agents have to learn to ‘split up’ and cover all landmarks to deceive the adversary.

Agent observation space: [self_pos, self_vel, goal_rel_position, landmark_rel_position, other_agent_rel_positions]

Adversary observation space: [landmark_rel_position, other_agents_rel_positions]

Agent action space: [no_action, move_left, move_right, move_down, move_up]

Adversary action space: [no_action, move_left, move_right, move_down, move_up]


simple_adversary_v2.env(N=2, max_cycles=25, continuous_actions=False)

N: number of good agents and landmarks

max_cycles: number of frames (a step for each agent) until game terminates

continuous_actions: Whether agent action spaces are discrete(default) or continuous