game-completion
Game Completion
Add proper game completion signaling so Puzzmo knows when the player has finished.
Steps
-
Find the game's win condition / completion check.
-
When the game is won, call
sdk.gameCompleted()with gameplay metrics:sdk.gameCompleted({ pointsAwarded: calculateScore(), elapsedTimeSecs: sdk.timer.timeSecs(), additionalTimeAddedSecs: sdk.timer.addedTimeSecs(), hintsUsed: hintsUsed, resetsUsed: 0, metric1: 0, metric2: 0, metric3: 0, metric4: 0, metricStrings: [], cheatsUsed: 0, }) -
After any victory animation completes, call
sdk.showCompletionScreen():sdk.showCompletionScreen( [{ type: "md", text: "**Congratulations!** You solved the puzzle!" }], gameplayData, true, // showRetry ) -
Make sure
gameCompletedis called BEFOREshowCompletionScreen. The host processes the completion data first, then displays the completion UI. -
The timer automatically stops when
gameCompletedis called - you don't need to stop it manually.
Success Criteria
npm run buildcompletes without errors- When the game is won,
gameCompletedfires with score data - After victory animation,
showCompletionScreenfires - The completion flow works: play -> win -> gameCompleted -> animation -> showCompletionScreen
More from puzzmo-com/oss
puzzmo-theme
Convert hardcoded colors to use Puzzmo theme tokens for light/dark mode support
10create-app-bundle
Create app metadata, thumbnail, and offline configuration for the Puzzmo platform
10add-deeds
Generate interesting gameplay statistics (deeds) sent on game completion
9setup-deploy
Configure the Puzzmo CLI for uploading game builds
9convert-to-vite
Convert a standalone HTML game into a Vite project with proper module structure
9setup-augmentations
Create augmentations.json with leaderboard configuration using deeds
9