Skip to content

Running Py Pommerman Docker Agents

Raluca D. Gaina edited this page Jun 4, 2019 · 1 revision

Step-by-step instructions for setup:

  1. Install Docker (Mac) (Windows) (Ubuntu). On Windows, Hyper-V is a requirement, so do allow that to be enabled when prompted (PC will restart).
  2. Start Docker. The Docker icon in the taskbar should be saying 'Docker is starting...'.
  3. Sign up for an account with Docker and log in.
  4. Docker icon in the taskbar should be saying 'Docker is running'. Make sure this is running before trying to run Docker agents!
  5. Open a terminal and run the following command to get previous competition entries (Details of entries):

docker pull multiagentlearning/{hakozakijunctions, eisenach, dypm.1/dypm.2, navocado, skynet955}

(select only 1 of the options to download; in the rest of this example we consider skynet955 was downloaded at multiagentlearning/skynet955).

  1. This should have the agents loaded in your Docker instance. Ready to run them!

Running py-pommerman from the command line

Open a terminal in the root directory of python Pommerman repository and run command:

pom_battle --agents=test::agents.SimpleAgent,test::agents.SimpleAgent,test::agents.SimpleAgent,docker::multiagentlearning/skynet955 --config=PommeFFACompetition-v0 --render

If pom_battle command is not recognized, run instead:

python pommerman/cli/run_battle.py --agents=test::agents.SimpleAgent,test::agents.SimpleAgent,test::agents.SimpleAgent,docker::multiagentlearning/skynet955 --config=PommeFFACompetition-v0 --render

If you get errors about beyond top-level importing, navigate to pommerman/cli/run_battle.py in an editor and modify lines 26-27 to say instead:

from pommerman import helpers
from pommerman import make

You should now see a game being played between 3 SimpleAgent players and the skynet955 controller.

Agents may be swapped to others in the framework in the format test::agents.AgentClass (simplified to player::arrows for human player and random::null for random player), or to other docker agents in the format docker::dockerPathName.

Further customization of run is possible, check pom_battle --help or python pommerman/cli/run_battle.py --help (Py-Pommerman docs)

Running py-pommerman in an IDE (e.g. PyCharm):

Navigate to examples/simple_ffa_run.py. In the agent_list (lines 17-21), include all the agents you want to play with. To recreate the above examples, set the list to:

agent_list = [
agents.SimpleAgent(),
agents.SimpleAgent(),
agents.SimpleAgent(),
agents.DockerAgent("multiagentlearning/skynet955", port=12345),
]

And run the file (examples/simple_ffa_run.py).

To include a connecting agent to Java-Pommerman, find instructions here.

To create a docker agent from a different controller existing in the python framework (e.g. SimpleAgent), make sure the agent in the examples/docker-agent/run.py file is set to the correct one (line 11). Then build the docker image with the following command line:

docker build -t {name} -f examples/docker-agent/Dockerfile .

This can then be included in executions of agents using the {name} of your Docker image.