MudGym¶
A reinforcement learning environment for MUD2.
Setup¶
The game runs in Docker, so you'll need a Docker engine. The image ghcr.io/rolo/mudgym is pulled automatically on first use.
Install the mudgym package with your Python package manager of choice.
Quickstart¶
Single Agent¶
from mudgym import make_env
env = make_env()
observation, info = env.reset()
observation, reward, terminated, truncated, info = env.step("l,howl")
env.close()
Narrow road between lands.
You are stood on a narrow road between The Land and whence you came. To the north and south are the small foothills of a pair of majestic mountains, with a large wall running round. To the west the road continues, where in the distance you can see a thatched cottage opposite an ancient cemetery. The way out is to the east, where a shroud of mist covers the secret pass by which you entered The Land. It is raining.
You howl.
Multi-agent (MARL)¶
Two agents in the same world.
from mudgym import make_parallel_env
env = make_parallel_env(agents=2)
observations, infos = env.reset()
actions = dict.fromkeys(env.agents, "yodel")
observations, rewards, terminations, truncations, infos = env.step(actions)
for agent in sorted(observations):
print(agent, observations[agent]["room_name"], rewards[agent])
env.close()
player_0
You yodel.
A male voice in the distance yodels.
player_1
A female voice in the distance yodels.
You yodel.
License¶
The Python code and tooling in this repository are MIT licensed.
The MUD2 game, name, source code, and associated story remain the intellectual property of Richard Bartle and Roy Trubshaw and may not be used for commercial purposes.
Permission to use the MUD2 game for research purposes has been provided by Richard Bartle, with kind thanks.