17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 16:49:21 +02:00
Files
maszyna/network/snapshot.cpp
Hirek193 fb94dcfa2b multiplayer: replicate the machinery you hear, not only the machinery you set
A bystander heard nothing of somebody else's converter, compressors, brake air
or relays. Two different reasons for that, and they need two different answers.

The devices whose sound runs for as long as they do - the converter, the main
compressor, the pantograph compressor, the releaser - are outputs of a physics
that a peer only half runs for a vehicle it does not own. Their running flags
travel now, alongside the permits that were already going.

The clicks and hisses are a harder case: MoverParameters::SoundFlag is raised
and wiped inside a single frame, so sampling it when an update happens to be
put together would catch almost none of them. They are collected as the vehicle
finishes with them, just before it clears the field, and the accumulation rides
along with the next update. On arrival they are added to whatever the receiving
peer's own physics produced, and its sound handling plays them once and wipes
the lot, exactly as it does for its own.
2026-09-07 08:48:30 +00:00

32 KiB