← All Workshops

MudEngine Part 3: File-Based World Loading

From hardcoded to data-driven

In Part 2 we hardcoded three rooms inside World::new(). That works for a tiny world, but every MUD has hundreds or thousands of rooms — you cannot put them all in source code.

The standard approach in game development is data-driven design: define the world in a data file and load it at runtime. This lets you edit rooms without recompiling, share worlds between projects, and even let players create their own maps.

In this part we replace the hardcoded rooms with a game.toml file. The REPL itself stays the same — same commands, same look/go/help/quit loop — but the world is loaded from disk on startup.

game.toml rooms + exits World::from_file() deserialize + index resolution World { rooms, player_room } REPL loop (same as Part 2) stdout STDIN