Simulation runs in fixed steps of 1/50 s (50 steps a second) instead of 1/20 s, with at most twelve catch-up steps in one frame
This commit is contained in:
1 parent
dd4bb75b24
commit
35ddfa134c
4 files changed
+9
-9
No files matched your search
+5
-5
@@ -22,7 +22,7 @@ The server does not simulate; it relays:
|
||||
|
||||
1. Clients send their **commands** (dig, build, cast, hand, orders, ...) to the server.
|
||||
2. Every 100 ms the server sends **turn N**: the commands of all players for that turn.
|
||||
3. Each client applies turn N and simulates two fixed steps of 50 ms. Turns arrive in order; a client waits
|
||||
3. Each client applies turn N and simulates five fixed steps of 20 ms. Turns arrive in order; a client waits
|
||||
for the next turn, so a missing player stalls everybody - exactly the "pause while missing" rule.
|
||||
4. Clients send a **checksum** of the game state every few seconds; a mismatch (desync) is reported.
|
||||
|
||||
@@ -38,10 +38,10 @@ per turn. Fog of war, particles and the camera are local and not part of the sha
|
||||
`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.
|
||||
- **Steps**: the simulation runs in fixed steps of `STEP` = 20 ms, 50 steps a second (`Game::update` feeds real
|
||||
time into them, `Game::apply_turn(cmds, steps)` is the lockstep entry point; one server turn of 100 ms is five
|
||||
steps). 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
|
||||
|
||||
Reference in new issue
Block a user