Scoring and results
Intermediate score and final result use different messages.
Score
score.update carries score, shots, hits and time_left_ms. Use integers; hits cannot exceed shots. Define shots as accepted impact events and hits as successful impacts on a game target. Shots missing the physical surface are not registered.
Result
session.complete contains status and a result with score, shots, hits, duration_ms and player_count. Player count must match the current session. Repeated HTML5 complete calls return false without sending another message. A validation error does not consume the completion guard.
Guarantees
A successful call means the message was handed to WebSocket, not durably stored. The protocol has no separate result ACK or safe replay operation after reconnect. Do not invent leaderboard fields that Launcher or Cloud supposedly always persist; extensions require changes and verification of the shared contract.
Code example
Integration excerpt: game-specific variables belong to the application. Playground contains the runnable reference.
await sdk.updateScore({score: 50, shots: 7, hits: 5, time_left_ms: 10000});
await sdk.complete({score: 80, shots: 10, hits: 8, duration_ms: 45000});