Skip to content

Real-time Events

The frontend and backend communicate through WebSocket events.

Common events

Event Meaning
TOWN_STATE Full snapshot when a client connects.
NPC_MOVED A resident started moving toward a target.
NPC_SPOKE A resident said something.
NPC_IDLE A resident idled or arrived.
NPC_EMOTE A resident displayed an emote.
NPC_REASONING A reasoning trace for the AI panel.
PLAYER_CHAT A visitor sent a message.
CLIENT_SETTINGS Browser preference update such as language.

Feed synchronization

The map bubble and Town Activity are both derived from realtime events. The feed deduplicates replayed or synchronized duplicates so one visible line does not appear several times.

Language switching

When the visitor changes language:

  1. the frontend sends client settings,
  2. backend updates preferred language,
  3. stale speech bubbles are cleared,
  4. stale old-language speech decisions are ignored,
  5. new NPC speech follows the selected language.