Skip to main content

View as Markdown · AI documentation index

Function: loadGameSchema()

loadGameSchema(entryPath, gameVersion): Promise<LoadedGame>

Defined in: loadEntry.ts:192

Imports a game's modules and captures the shape of its saves.

Parameters​

entryPath​

string

Path to the module to import, absolute or relative to cwd

gameVersion​

Explicit version, taking precedence over every other source. See VersionSource for the fallback chain.

string | null

Returns​

Promise<LoadedGame>

The captured schema, the registered migrations, and where the version came from

Remarks​

Entities and passages register as a side effect of being imported, so this only has to load the module and then ask the engine what it now knows. It never calls Game.init(): initialization opens the IndexedDB save database, which does not exist outside a browser.

Point entryPath at a module that registers entities and passages - typically src/game/registry.ts - rather than at the React entry point.

Throws​

Error with actionable guidance if the module cannot be imported