← All Workshops

MudEngine Part 3: File-Based World Loading

Play!

Run the REPL just like in Part 2. The world is now loaded from game.toml instead of being hardcoded — but the gameplay is identical.

The real power comes when you edit game.toml and add new rooms.

Run the REPL
cargo run
Play session (expected output)
> look
Town Square
A bustling town square with a fountain at its center. Cobblestones gleam from the morning rain.

Exits: north east

> north
Market Street
A narrow lane lined with wooden stalls. The scent of fresh bread and spices hangs in the air.

Exits: south

> east
You cannot go east from here.

> south
Town Square
A bustling town square with a fountain at its center. Cobblestones gleam from the morning rain.

Exits: north east

> east
Temple Courtyard
Ancient stone pillars surround a quiet courtyard. Moss clings to weathered statues.

Exits: west

> quit
Farewell, adventurer!
mud-engine-repl/game.toml
[[rooms]]
id = 4
name = "Dark Forest"
description = "Twisted trees block out the sky. Eyes gleam in the shadows."
exits = [
    { direction = "south", destination = 2 },
]
🎯 Add your own rooms

Open game.toml and add the Dark Forest room (paste the snippet above into the file). Then add a matching exit in Market Street (id = 2) so you can reach it:

exits = [
    { direction = "south", destination = 4 },
    { direction = "south", destination = 1 },
]

Wait — that last edit is wrong! A room cannot have two exits with the same direction. You would need to change one to "north" instead. The TOML loader validates this at startup — try it and see what happens.