Skip to content

Creating MARLO Agents

SP Mohanty edited this page Aug 16, 2018 · 7 revisions

Deprecated : Please follow the instructions at the official instructions at : http://marlo.readthedocs.io/

Some initial checks:

  • Ensure that you have the env directory MALMO_XSD_PATH pointing to the correct Schemas folder. If you are using the conda package for malmo, then you can do a : export MALMO_XSD_PATH=$CONDA_PREFIX/install/Schemas.

  • Also do ensure that you have a Minecraft client running on port 10000

You are in the correct place if you want to run a simple random agent or a multi-agent example.

You can also check our section about building Chainer-RL agents.

Random Sample Single-Agent

The following simple script should run a random agent in a single-player environment:

import gym
import marlo

env = gym.make('MinecraftBasic-v0')
env.init(
    allowContinuousMovement=["move", "turn"],
    videoResolution=[800, 600]
    )
env.reset()

done = False
while not done:
        env.render()
        action = env.action_space.sample()
        obs, reward, done, info = env.step(action)
        print(action)

env.close()

More documentation about configuration options in docs/init.md and available environments in docs/available_envs.md

Running the Multi-agent examples

The multi-agent examples can be run from the marlo directory.

Assuming malmo was installed with pip, you can start Minecraft on ports 1000 and 10001 by running the following in a cmd terminal or shell:

python3 two_agent_minecraft_launch.py 

Once two minecraft windows appear, run the multi agent example with:

python3 -m examples.multiagentexample --turn_based --rollouts 10  --mission_file mob_chase.xml