Skip to content

feat(snake): integrate EduPlay educational-question SDK at game-over#392

Open
lloydho wants to merge 1 commit into
digitsensitive:masterfrom
lloydho:eduplay-port
Open

feat(snake): integrate EduPlay educational-question SDK at game-over#392
lloydho wants to merge 1 commit into
digitsensitive:masterfrom
lloydho:eduplay-port

Conversation

@lloydho
Copy link
Copy Markdown

@lloydho lloydho commented May 21, 2026

Replaces the bare scene.start('MainMenuScene') on snake-death with an EduPlay question break.

EduPlay shows a Duolingo-style educational question instead of a rewarded ad at natural pause points. Game developers integrate the SDK; parents subscribe and fund developer payouts.

What this PR does

  • Adds @eduplay/sdk-web (+ its peer @eduplay/sdk-core) as deps in src/games/snake/.
  • Initializes the client + preloads the first question at game boot (src/games/snake/src/eduplay.ts).
  • Replaces the immediate scene restart on player-death with showAdBreak({ onResume }) — when the ad dismisses (answer submitted), the game returns to the main menu just like before.

Mock mode for evaluation

The integration uses mock: true + a placeholder placement ID (pl_mock00000000000000000000). The hosted /break page serves bundled canned questions; no API call is made. To ship for real, replace those values with output from https://app.eduplay.com.

A note on dependency paths

@eduplay/sdk-web and @eduplay/sdk-core are not yet on the npm registry (EduPlay's Phase-1 launch is in progress). The committed package.json declares them with local file: paths because that's how the build was actually verified. Once published, these become semver ranges. Anyone reproducing the build today needs the EduPlay monorepo checked out at the path encoded in package.json — please flag if this is a blocker and we'll publish to npm sooner.

Build verification

  • cd src/games/snake && yarn install && yarn run build-prod exits 0.
  • Bundle delta: +10,333 bytes (~10 KiB minified) over pristine snake.
  • The 3 warnings emitted are pre-existing Phaser-size warnings unrelated to this PR.

Acceptance for upstream

This PR is filed as evidence for EduPlay's Track J evaluation (validating SDK ergonomics on a real OSS Phaser 3 game). Upstream-acceptance is not required for the evaluation to succeed — happy to close if it doesn't fit the repo's direction.

Filed against eduplay's parent: https://github.com/lloydho/eduplay/issues/59

Replaces the bare scene.start('MainMenuScene') on snake-death with an
EduPlay educational-question break (Duolingo-style question instead of
an ad at the natural game-over pause).

- src/games/snake/src/eduplay.ts (NEW): EduPlay client init + showAdBreak
  helper, mock mode for evaluation (no real placement ID required).
- src/games/snake/src/game.ts: side-effect import of eduplay.ts.
- src/games/snake/src/scenes/game-scene.ts: showAdBreak({ onResume })
  at the death branch in update(), guarded by adBreakTriggered flag.

Mock mode means no live API call — replace 'mock: true' and the
placeholder placement ID with values from https://app.eduplay.com to
ship for real.

The @eduplay/sdk-web and @eduplay/sdk-core deps are wired via local
file: links because the packages are not yet on npm (Phase-1 EduPlay
launch is in progress). The package.json `file:` paths are honest about
the build provenance; once the packages are published these become
semver ranges. Build-verified locally with `yarn run build-prod` (exit
0, +10.3 KiB bundle delta over pristine).

Filed as part of EduPlay's Track J evaluation port. See
lloydho/eduplay#59 for the parent task.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant