Skip to content

Running Java Agents in Py Pommerman (Direct Server Connection)

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

Step 0

Both frameworks (Java and Python) will need to be run at the same time, so make sure they are both setup properly and can run independently on your machine.

Step 1

In Py-Pommerman, find file examples/simple_ffa_run.py and modify the agent list to the following:

agent_list = [
agents.HttpAgent(port=12344),
agents.SimpleAgent(),
agents.SimpleAgent(),
agents.SimpleAgent(),
]

This will have one Java agent (as player 0) playing against 3 SimpleAgent players from py-pommerman.

Step 2

In Java-Pommerman, modify line 86 in network/Server.java class to the desired agent, e.g.:

agent = new MCTSPlayer(0, id, new MCTSParams());

This will have an MCTS player with default parameters playing against the py-pommerman players.
Make sure the port number from the python file (12345 in this example) is the same in Java (line 32 in network/Server.java class).

Step 3

Finally, run the Java-Pommerman network/Server.java class, followed by the Py-Pommerman file (examples/simple_ffa_run.py).