PP.Gaming

Delta-compression and state sync for real-time multiplayer. Minimize bandwidth by sending only changes.

Delta Compression

Send state updates as deltas instead of full snapshots. The client applies patches to maintain a local copy of the game state.

// Server: broadcast delta
server.gaming.broadcastDelta(roomId, {
  entityId: 'player-1',
  path: ['position', 'x'],
  value: 120
});

// Client: apply and reconcile
client.gaming.on('delta', (delta) => {
  state.apply(delta);
});

State Sync

New joiners request a full state snapshot; afterward they receive only deltas. Optional tick rate and interpolation settings.

server.gaming.room('match-1').setTickRate(20); // 20 Hz

client.gaming.join('match-1');
client.gaming.requestFullState('match-1').then(snapshot => {
  state.replace(snapshot);
});

For authoritative server logic, run game ticks on the server and broadcast deltas; see The PP Header for binary layout.