Skip to content

Memory System

Throughout the game we work with a single, global `Memory object.

This memory manges..

  • Stores chat messages and settings

  • Stores the player’s progression

  • Persisted in browser’s LocalStorage

  • No server-side storage of user data

  • Managed through memory.getMemory()

  • Is reactive inside .svelte files

  • Doesn’t require custom mutations

  • See lib/memory.svelte.ts for the full capabilities.

import {getMemory} from '$lib/memory.svelte'
const memory = memory.getMemory()
console.log(memory.settings)
console.log(memory.messages?.length)
memory.addMessage(memory.createMessage(...))
console.log(memory.messages?.length)
memory.reset()
console.log(memory.messages?.length)

Also see lib/messages.js and lib/settings.js for the types that explain exactly what we store.

As the memory is persisted to local storage in your browser, we can’t access it on the server side. This is on purpose.