Serialises a world to a versioned JSON snapshot.
Optional
import { createWorld, encodeSave } from '@datamoc/mw_games/mwl';const snapshot = encodeSave(createWorld(), { version: 1 });console.log(typeof snapshot); // 'string' Copy
import { createWorld, encodeSave } from '@datamoc/mw_games/mwl';const snapshot = encodeSave(createWorld(), { version: 1 });console.log(typeof snapshot); // 'string'
Serialises a world to a versioned JSON snapshot.