Skip to content

Snapshots

DANGER

Snapshots are not yet working with the fiasco engine (tools package 0.2.0+) We are working on this. If your tool depends on sharing game state with the editor and other tools, consider using tools 0.1.x for now with the vintage sdk

In the fiasco app, tools share game state with the app and other tools using snapshots.

A snapshot is a binary buffer that contains the game state, including the scene and other data.

To listen for snapshots from the parent and other tools:

ts
import { Ipc, mountPausedGame } from '@vaguevoid/tools';

const canvas = document.createElement("canvas");
document.body.appendChild(canvas);
const game = await mountPausedGame(canvas);

// listen for snapshots and update/repaint the game state
Ipc.listenSnapshot(game, () => {
  console.log('snapshot received', game.context.scene, game.context.state)
})

game.unpause();

setTimeout(() => {
  console.log('sending snapshot to parent')
  // send a snapshot to the parent
  Ipc.sendSnapshot(game);
}, 1000)