17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-05 20:39:09 +01:00

multiplayer: replicate what a vehicle is heard and seen doing

The horn never reached anybody else. It is not a command a bystander can carry
out: OnCommand_hornlowactivate sets MoverParameters->WarningSignal from inside a
cab, and a peer that is not sitting in that cab has no TTrain for the vehicle,
so the command was dropped on arrival. Only the result of it can travel, and it
was not being sent.

The vehicle state now carries what a vehicle is heard and seen doing rather than
only what it is being told to do: the horn flags, the emergency brake horn and
its alarm chain, the wheel revolutions and the engine revolutions. The last two
are what turn the driven wheels and set the engine note, so somebody else's
locomotive no longer sounds and looks like it is standing still while it rolls
past.

The state also goes out a little sooner, every sixth frame instead of every
tenth: a horn can be pressed and let go inside a couple of frames, and an update
that arrives after it is over is no use.
This commit is contained in:
2026-09-07 08:25:08 +00:00
parent a0537356bb
commit d0306f3d4a
3 changed files with 34 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ namespace network
{
// layout of the snapshot container. a reader refuses a blob it does not understand
constexpr uint32_t SNAPSHOT_VERSION = 2;
constexpr uint32_t SNAPSHOT_VERSION = 3;
// the sections a snapshot is built from. a reader skips over any id it does not know,
// which is what makes the format extensible: a peer built before a section existed can