Clarify goals & constraints
- Low bandwidth, high-latency mobile; need small payloads, live tweak support, backwards compatibility, and visually smooth mid-effect updates.
High-level format
- Binary TLV (type-length-value) container with message types: SCHEMA, FULL_EFFECT, DELTA, COMMAND, KEEPALIVE.
- Payloads compressed per-message with zstd (level tuned for CPU) and optional Brotli for web.
Schema & versioning
- Ship a compact schema (Protobuf/FlatBuffers) with a schema_id. Every message includes schema_id + semantic version.
- Server maintains backwards-compatible delta transforms; clients reject incompatible updates and request server conversion.
Delta updates
- Represent effects as a tree: emitters → modules → parameters (floats, vectors, enums).
- DELTA messages contain path + operation (set/add/mul/remove) + compact encoded value. Use sequence numbers + dependency graph to apply in order.
- For large arrays (curves/textures) use chunked diffs (RLE or binary diff).
Streaming priorities
- Priority levels: IMMEDIATE (parameter tweak that affects current frame), SOFT (future-spawned emitters), BULK (non-urgent assets).
- Transport: reliable for IMMEDIATE/DELTA ordering (TCP/QUIC), unreliable for BULK assets (UDP-like).
Client apply strategy to avoid popping
- For parameter changes: support lerp window metadata (apply_over_ms) included in DELTA. Client cross-fades between old and new values over that window.
- For emitter-level changes: spawn transitional emitters with blended lifetime; keep old emitters alive to fade out while new config ramps up.
- For curve/texture swaps: double-buffer resources; update lookup tables progressively (morphing curves).
- If atomic swap required, server can send precomputed blend frames or notify client to freeze-spawn at zero alpha then ramp.
API design (client)
- connect(endpoint, options)
- onSchema(schema_id) callback
- applyDelta(delta_msg) — returns a Promise when applied
- setBlendPolicy(path, default_ms)
- requestFull(effect_id)
- events: onUpdateApplied(path, seq), onIncompatibleUpdate(reason)
Operational notes
- Monitor RTT and adjust compression level and delta frequency.
- Use telemetry to detect visual artifacts and fall back to full replacement when deltas fail.
- Author tooling: diff preview, precomputed blends for artists to guarantee non-popping transitions.
This design balances compactness, live-tweak friendliness, and visual continuity for mobile-constrained games.