Multiplayer step B: every player order is a command (dig, build, cast, hand, orders) and the simulation runs in fixed 50 ms steps, so single player and a match take the same path
This commit is contained in:
1 parent
d6bcce3a76
commit
1ec7492189
8 files changed
+635
-101
No files matched your search
+24
-3
@@ -29,13 +29,34 @@ The server does not simulate; it relays:
|
||||
Only the commands travel over the network, so bandwidth is tiny and no game state has to be serialised
|
||||
per turn. Fog of war, particles and the camera are local and not part of the shared state.
|
||||
|
||||
## What is there already
|
||||
|
||||
- **Per-master state** (`game.rs`): every master has his own gold, mana, hand, research, payday, flag,
|
||||
core... `Game::switch_to(side)` puts one master in the active fields, the simulation walks through all
|
||||
masters step by step. A single player game has no stored masters and is unaffected.
|
||||
- **Commands** (`commands.rs`): every order a player gives is an `Act` (`Dig`, `Room`, `Tower`, `Trap`,
|
||||
`Cast`, `Flag`, `Pickup`, `Drop`, `Slap`, `Attack`, `Guard`, `CancelOrders`, ...) wrapped in a
|
||||
`Command { side, seq, act }`. Creature targets are *ids*, so they mean the same on every client.
|
||||
The tools in `main.rs` only queue commands now - nothing touches the world directly.
|
||||
- **Steps**: the simulation runs in fixed steps of `STEP` = 50 ms (`Game::update` feeds real time into
|
||||
them, `Game::apply_turn(cmds, steps)` is the lockstep entry point). Commands are applied at step
|
||||
boundaries, so single player and a match run exactly the same path. Particles, effects and the camera
|
||||
keep running in real time: they are local and not part of the shared state.
|
||||
- **Who speaks**: messages, hints and interface sounds belong to the master who is being processed
|
||||
(`Game::speaking`); what another master orders never shows up on my screen.
|
||||
- Savegames, tests and the standalone file are unchanged: `cargo test --release` covers the command path
|
||||
(including "the same actions on both paths build the same world").
|
||||
|
||||
## Steps
|
||||
|
||||
| # | Step | Status |
|
||||
|---|---|---|
|
||||
| A | Simulation per master: gold, mana, research, rooms, hand, flag, traps, payday... per side; up to four masters (red, green, blue, yellow) | planned |
|
||||
| B | All player actions as commands (`Command` + `Game::apply`), single player uses the same path; fixed time step | planned |
|
||||
| C | Server: lobby and match relay over WebSocket (axum), turns, pause on disconnect, AI takeover on leave, chat | planned |
|
||||
| A | Simulation per master: gold, mana, research, rooms, hand, flag, traps, payday... per side; up to four masters (red, green, blue, yellow) | built |
|
||||
| B | All player actions as commands (`Command` + `Game::apply`), single player uses the same path; fixed time step | built |
|
||||
| C | Server: lobby and match relay over WebSocket (axum), turns, pause on disconnect, AI takeover on leave, chat | next |
|
||||
| D | Client: *Multiplayer* menu (lobby, create, join, ready, teams), WebSocket bridge in `dc_plugin.js`, chat, gold sending | planned |
|
||||
| E | Alliances and coop rules, AI masters for free and abandoned slots | planned |
|
||||
| F | Coop campaign: 20 missions with story (EN/DE) | planned |
|
||||
|
||||
Still open on the way to C: player owners (today side 1 is the humans' and 2/3 the rivals' - four
|
||||
player sides need their own `Owner`s), the turn/turn-boundary client loop, and the state checksum.
|
||||
Reference in new issue
Block a user