Skip to content

GameScene beta ​

Interface of @v12-engine/client/app

ts
export interface GameScene<A extends object = {}> extends Scene<A>

A scene that plays a game (asGameScene makes one, gameScene puts one together): which game module, which map, who plays. The rules live in the engine and the game modules, never here. Shown by the app as every scene is (open: playScene, run with its HUD); its client made by what plays games itself with load (the editor's Play here, in canvases it keeps over the editor)

Members ​

error ​

ts
error?: ErrorLook;

The screen when the game could not be loaded or stopped (see ErrorLook). The client's when left out

exit ​

ts
exit?: SceneExit;

Where the HUD's button out of the game goes, like back to a menu. The list of scenes when not said

load ​

ts
load(context: SceneContext<A>): Promise<GameClient>;

Makes the game's client in the canvases of context, and resolves when it is ready to play

loading ​

ts
loading?: LoadingLook | ((args: SceneArgs<A>) => LoadingLook | undefined);

The screen while the game loads: words of its own, a background (CSS), or all of it drawn by the game (mount, told how far the files are as they come). A scene that says one comes in at once showing it. Without, the scene before is held until the game is on, and the client's is seen where there was none before, or past patience

onCrash ​

ts
onCrash?: (report: CrashReport) => void;

Told when the game could not be loaded or stopped, with what is known of it: for a crash report (CrashReport)

replays ​

ts
replays?: ReplayChoice | ((args: SceneArgs<A>) => ReplayChoice);

Whether a game played in the page is recorded and kept as a replay (ReplayChoice: in this browser, with checkpoints, handed elsewhere). Yes, in this browser, when left out. Decided in code for each game, from what the scene was opened with: not a tutorial, not a game loaded to try something

saves ​

ts
saves?: {
        name?: (args: SceneArgs<A>) => string;
        autosave?: AutosaveOptions;
    };

Whether the game can be saved and loaded from its HUD (see saveGame): a save opens this scene again from it (SceneArgs.from), which the scene loads as it was. name is what a save is called before the time in the game is added, from what the scene was opened with. autosave: the game saves by itself, every so many seconds of it (AutosaveOptions). No saving when left out