@seriousgaming/sdk
The library a Serious Gaming game imports: the types and helpers for engines, hooks, validators, endpoints and tick controllers, and the React wrappers and hooks for every kind of user interface.
You build, test and run a game with the CLI in @seriousgaming/sdk-tools. Its documentation starts at docs/index.md in that package.
The package is ES modules only: import it. Its exports carry no require condition, so CommonJS tooling that resolves with require.resolve does not find it.
Stability
A version with a prerelease suffix, such as 1.0.0-alpha.1, carries none of these guarantees: it can change in any way before the release it leads to.
From 1.0.0, these subpaths follow semantic versioning. A breaking change to anything they export waits for a major release:
| Subpath | What it holds |
|---|---|
. | Logic signatures, bundle types, uses callbacks, scheduling builders, seeded randomness, UTF-8 helpers, UndeclaredApiUseError |
./ui | The user interface wrappers, their hooks, and the types a surface reads |
./ui/testing | Render helpers and mocks for testing a surface, including mergingSetData and createMockBrand |
./testing | logicArgs, the offline stub callbacks, and createMockTeam, createMockParticipant and their plurals, for calling a logic function directly in a unit test |
./projection | The observable session state the dev server and the CLI report, and PROJECTION_VERSION |
./commands | The command set a client sends the dev server, and what each query answers with |
Two things in them are outside that guarantee:
- Members tagged
@internalin their TSDoc, such as the dev server's fault injection (FaultKind,ArmedFault, thearmFaultanddisarmFaultcommands and the projection'sfaults). They ship in the declarations, but may change in a minor release - The React context objects
./uiexports (UserInterfaceDataContextand the rest of the*Contextnames). The hooks that read them are covered; providing one directly is not, because a minor release may add a required field to a context's value. Test a surface with therender*helpers in./ui/testing, which supply every context for you
Adding a field to the projection or to a query's answer is not a breaking change, so a reader should ignore what it does not know. PROJECTION_VERSION changes only with a major release.
./e2e carries no such guarantee. It holds the Playwright helpers for testing a game against the dev server, which track the dev console and so move with sdk-tools.
The host half of the iframe protocol (@seriousgaming/sdk-tools/host) and the runtime helpers (@seriousgaming/sdk-tools/runtime) are not part of this package. They exist for the Serious Gaming platform and the SDK's own tooling, not for games.
Licence
Apache License, Version 2.0. See LICENSE and NOTICE.