← All Workshops

MudEngine Part 7: Save & Load

Step 3 / 10

Create game.toml

The game.toml file lives in the project root (next to Cargo.toml). It defines all 9 rooms with their names, descriptions, and exits, plus an empty players table.

Each room has a numeric id — for the 3×3 grid these match the grid positions (0–8). Each exit has a direction and a destination room id.

Create the file:

mud-engine/game.toml
[[rooms]]
id = 0
name = "Forest Path"
description = "A winding path leads through ancient oaks. Sunlight filters through the canopy."
exits = [
    { direction = "south", destination = 3 },
    { direction = "east", destination = 1 },
]

[[rooms]]
id = 1
name = "Hilltop"
description = "From this vantage point you can see the entire valley. A cool breeze carries the scent of pine."
exits = [
    { direction = "south", destination = 4 },
    { direction = "west", destination = 0 },
    { direction = "east", destination = 2 },
]

[[rooms]]
id = 2
name = "Abandoned Tower"
description = "A crumbling stone tower stands alone. Vines crawl up its walls and crows nest in the windows."
exits = [
    { direction = "south", destination = 5 },
    { direction = "west", destination = 1 },
]

[[rooms]]
id = 3
name = "Dark Forest"
description = "Twisted trees block out most of the light. Strange sounds echo through the undergrowth."
exits = [
    { direction = "north", destination = 0 },
    { direction = "south", destination = 6 },
    { direction = "east", destination = 4 },
]

[[rooms]]
id = 4
name = "Town Square"
description = "A bustling town square with a fountain at its center. Cobblestones gleam from the morning rain."
exits = [
    { direction = "north", destination = 1 },
    { direction = "south", destination = 7 },
    { direction = "west", destination = 3 },
    { direction = "east", destination = 5 },
]

[[rooms]]
id = 5
name = "Temple Courtyard"
description = "Ancient stone pillars surround a quiet courtyard. Moss clings to weathered statues."
exits = [
    { direction = "north", destination = 2 },
    { direction = "south", destination = 8 },
    { direction = "west", destination = 4 },
]

[[rooms]]
id = 6
name = "Riverbank"
description = "A slow-moving river borders a muddy bank. Frogs croak from the reeds."
exits = [
    { direction = "north", destination = 3 },
    { direction = "east", destination = 7 },
]

[[rooms]]
id = 7
name = "Old Bridge"
description = "A weathered stone bridge crosses the river. Moss covers the ancient masonry."
exits = [
    { direction = "north", destination = 4 },
    { direction = "west", destination = 6 },
    { direction = "east", destination = 8 },
]

[[rooms]]
id = 8
name = "Graveyard"
description = "Rows of moss-covered headstones stretch into the fog. An iron gate creaks in the wind."
exits = [
    { direction = "north", destination = 5 },
    { direction = "west", destination = 7 },
]

# Players are added here at runtime by the server.
# Each entry looks like this:
#
# [[players]]
# id = "550e8400-e29b-41d4-a716-446655440000"
# name = "Alice"
# room = 4
#
# You can pre-populate players here and they will
# load when the server starts — but normally the
# server manages this section.
[[players]]
🔍 Grid reference
   Col 0      Col 1      Col 2
┌──────────┬──────────┬──────────┐
│ Forest   │ Hilltop  │ Abandoned│  Row 0
│ Path (0) │    (1)   │ Tower(2) │
├──────────┼──────────┼──────────┤
│ Dark     │ Town     │ Temple   │  Row 1
│ Forest(3)│ Square(4)│ Crt. (5) │
├──────────┼──────────┼──────────┤
│ River-   │ Old      │ Grave-   │  Row 2
│ bank (6) │ Bridge(7)│ yard (8) │
└──────────┴──────────┴──────────┘

Room IDs match the grid indices (0–8). The destination in each exit refers to another room's id, so the exit table is just a direction-to-room-id mapping.

Step 3 / 10