SsimnJS Docs

Shared and per-player states

One state for everyone, or one state per player, with or without per-player copies of the widget.

The States setting of interactive_widget_component decides who shares the state of the toggles, choices, sliders and screen.

StatesUse it forWhat players see
Shared (default)A door panel, a vote, a scoreboard control.One state for everyone: when a player switches a toggle, everyone sees it switched.
PerPlayerA settings menu, a shop, a personal inventory.Each player has their own states and screen, and only sees their own.

Per-player states and your WBP

The kit draws nothing on your widget: your WBP shows the states from its fields. Those fields belong to the widget, and the placed widget is the same for everyone.

Per-player copies solve this. When your layout writes WBP fields, the editor also writes a NewCopy method (option Per-player copies, on by default). Each player then gets their own copy of the widget, at the spot where you placed it, visible to them only. Its fields show that player's hover, clicks and states, animations included.

Your layoutHover and clicksToggles, choices, slidersScreens
WBP fields, per-player copiesPer player, on each copyPer player, on each copyPer player
WBP fields, no copiesShared: shown while at least one player aimsThe starting state, sharedSame WBP screen for everyone
No WBP fieldNot shownNot shownYour WBP does not switch screens

PerPlayer needs copies

Without copies, each player still has their own states (events and the Verse API use them), but the widget can only show the starting state. The kit writes a hint in the log.

How copies work

  • When the round starts, each player gets a copy of the widget, filled with their state, then shown to them only. Players who join later get theirs when they arrive; a player who leaves takes their copy away.
  • The widget you placed becomes the model of the copies. While the round runs, it steps 10 km below its spot, out of sight, and comes back at the next start. Nothing to set up: never add a field to hide it.
  • Copies left by a previous run (after a live update) are removed when the round starts.

Entities placed under the widget entity move with it while copies are in use. Keep other entities elsewhere.

To write your own fields on the copy a player sees, use WidgetFor (Verse API).

Verse

Methods that read or change a state take an optional player:

# The state of the player who clicked.
Volume := Event.Widget.GetValue("Volume", ?Player := option{Event.Player})
Event.Widget.SetOn("Music", false, ?Player := option{Event.Player})

# Without a player: every player (and the players who join later).
Kit.SetOn("Music", false)

SetEnabled and SetPrompt always apply to everyone. See Verse API.

On this page