← All Workshops
MudEngine Part 4: Single-Player Dioxus GUI
Step 6 / 13
Plan the module layout
A MUD engine has two very different kinds of code:
- Game logic — pure rules: rooms, exits, movement. It does not know whether the player clicked a button or typed a command.
- Frontend components — Dioxus components that render the game state and turn user input into commands.
In a single main.rs these get tangled together. So we split them into two modules from the start:
src/game/— the game logic. For now just theWorldmodel; in Part 6 it grows message types, room data, and the server.src/components/— every Dioxus component in its own file.
This is the same engine/UI separation the workshop already emphasises — but now it is reflected in the file layout, not just the code.
📁 Target project layout
mud-engine/
└── src/
├── main.rs # entry point: mod declarations + launch(App)
├── game.rs # ⚙️ game module root — declares the game submodules
├── game/
│ └── world.rs # Direction, Room, World, look(), go()
└── components/ # 🖥️ Dioxus components (one file each)
├── mod.rs # module declarations
├── app.rs # App
└── world_grid.rs # WorldGrid
Step 6 / 13