@edclass/web-game-kit
v0.1.3
Published
EDClass HTML5 game SDK — EDG1 wire codec, typed content, round state, simulator transport
Keywords
Readme
@edclass/web-game-kit
The EDClass HTML5 game SDK — the typed boundary between your game and the EDClass platform: the EDG1 wire codec, answer-free content parsing, command lifecycle, round state, and an in-process simulator for offline development.
It is not a game engine, a renderer, or a UI library — bring your own (three.js, Phaser, canvas, plain DOM). It has no rendering dependency, never touches the DOM, and never opens a network connection.
Install
npm install @edclass/web-game-kitShips as dist/ with full TypeScript declarations. No EDClass source, no
credentials, no platform dependency. MIT licensed.
Quick start
import { GameSession, SimulatorTransport } from '@edclass/web-game-kit'
// The simulator plays the server's role, so it holds the answers.
// Content delivered to a real game is answer-free by construction.
const session = new GameSession(
new SimulatorTransport({
questions: [
{
questionId: 'q1',
questionType: 'mcq',
title: 'Capital of France?',
body: 'Pick one.',
choices: [
{ id: 'a', label: 'Paris', isAnswer: true, marking: 1 },
{ id: 'b', label: 'Lyon' },
],
},
],
}),
)
const content = await session.waitForContent() // INIT — render nothing before this
const result = await session.submitAnswer('q1', ['a'])
console.log(result.status, result.feedback?.isCorrect)
await session.complete()
session.dispose()The simulator is also importable on its own: import '@edclass/web-game-kit/testing'.
What you get
GameSession— the run lifecycle:waitForContent,submitAnswer/submitFillingAnswer/submitDndAnswer,retry,forfeitQuestion,reportCheckpoint,complete,reportFatal,dispose.SimulatorTransport— a full in-process server: validates your content, enforces the one-answer lock, and marks with real per-draggable weights, so games are testable without mocks.parseGameContentand the typed, answer-freeGameContent/GameQuestionmodels (mcq,filling,dnd, …).RoundState— optional question sequencing and per-question resolution tracking.encodeWireFrame/decodeWireFrame— the deterministic EDG1 codec.
Documentation
The full integration kit — the build-a-game guide, the EDG1 protocol reference,
and the avatar-rendering guide — is delivered separately as the documentation
kit (edclass-web-game-kit-docs-<version>.zip). Ask your EDClass contact for it.
Start with the kit-integration guide, then the protocol reference.
License
MIT — see LICENSE.
