SprayPaintPlus Networking¶
SprayPaintPlus ships two custom LaunchPadBooster INetworkMessage types (client-to-server) to carry per-can color state and per-player modifier state, plus two server-authoritative sync flows that layer on top of vanilla Consumable update ticks and AttackWithMessage paths.
Message types¶
Two LaunchPadBooster INetworkMessage types, both client-to-server:
-
SprayCanColorMessage:
{ SprayCanId: long, ColorIndex: int }. Sent when a client scrolls to change color. Server validates ColorIndex range, finds the SprayCan by ReferenceId, and applies the color. The update broadcasts to all clients via the normalConsumablenetwork update path. -
PaintModifierMessage:
{ Modifiers: byte, PlayerHumanId: long }. Sent when modifier key state changes. Server stores inPlayerModifiers[PlayerHumanId]. Read duringNetworkPainterPatch.Prefixto decide single/network/checkered mode.
Sync flow for color changes¶
- Client detects scroll in
ColorCyclerPatch.Prefix. - Client updates the spray can's visual locally (immediate feedback).
- Client sends
SprayCanColorMessageto the server. - Server validates, applies color via
UpdateSprayCanServer, which sets the visual and raisesNetworkUpdateFlags. - Next tick,
Consumable.BuildUpdatefires; theConsumableBuildUpdatePatchpostfix writes the color index into the stream. - All clients receive the update;
ConsumableProcessUpdatePatchreads the color index and applies it visually.
Sync flow for painting¶
- Client attacks a structure with a spray can (vanilla input).
- Vanilla sends
AttackWithMessageto the server. - Server-side tracker prefix captures the Human ReferenceId.
- Vanilla calls
OnServer.SetCustomColorfor the targeted item. NetworkPainterPatch.Prefixintercepts, looks up modifiers for the painter, and paints the network/room/grid.- Each painted item's
SetCustomColorsets its ownNetworkUpdateFlags, broadcasting the color change to all clients through vanilla's update tick.
Verification history¶
- 2026-04-20: page created from the Research migration. Sources: F0018 (message types), F0019 (color-change sync flow), F0020 (painting sync flow).
Open questions¶
None at creation.