google-deepmind / meltingpot

A suite of test scenarios for multi-agent reinforcement learning.
Apache License 2.0
582 stars 118 forks source link

How to handle local communication #150

Closed ColdFrenzy closed 1 year ago

ColdFrenzy commented 1 year ago

Hello,

I'm using a previous version of Meltingpot and in the substrate configuration file, there was the following code:

config.individual_observation_names = [
      "RGB",
      "READY_TO_SHOOT",
      # Debug only (do not use the following observations in policies).
      "POSITION",
      "ORIENTATION",
  ]
  config.global_observation_names = [
      "WORLD.RGB",
  ]

I saw that you removed the debug observations to speed up the stepping. I would like to use an RL algorithm with local communication, and to do so, I need to check the relative position/distance between two agents. Is there a proper way to obtain this information?

jzleibo commented 1 year ago

Is what you really want a list of players near the focal player on each timestep? You can directly report that data as an observation without using the absolute positions. The way to do it is to add a component on the avatar that runs a query for avatar objects in a rectangle (or whatever shape you like) around the focal avatar on each step. Then add an observation that reports this list out of the environment.

If you do want the absolute positions then just add the component that reports them and turn on the observations (basically undoing the commit that removed them).

ColdFrenzy commented 1 year ago

Ok everything clear, thanks for the answer