SsimnJS Docs

Examples

Four ready-made widgets to place, play and copy from - settings, a shop, a code keypad and a radio.

The kit ships four example widgets in WorldUIKit/Widgets, each with its layout and logic in a Verse file of the kit folder. They are built like screen UIs: every control is a Custom Button, so the online editor and the AI skill find them, and they show every state themselves from their fields.

To place one: drag its WBP into the level (scale 10, facing the players), select it, and add interactive_widget_component and its two components, world_ui_kit_<name>_layout and world_ui_kit_<name>_logic.

ExampleWBPComponentsStates
SettingsWBP_WorldUIKit_Demoworld_ui_kit_demo_layout, world_ui_kit_demo_logicShared
ShopWBP_WorldUIKit_Shopworld_ui_kit_shop_layout, world_ui_kit_shop_logicPerPlayer
KeypadWBP_WorldUIKit_Keypadworld_ui_kit_keypad_layout, world_ui_kit_keypad_logicShared
RadioWBP_WorldUIKit_Radioworld_ui_kit_radio_layout, world_ui_kit_radio_logicShared

Settings

A settings panel: a Music toggle, three Difficulty choices, a Volume slider with − and + steppers, Play and Reset. It is the widget of the quick start.

  • Fields: <Name>Hover on every control, <Name>Pressed on the steppers, Play and Reset, <Name>On on Music and the choices, VolumeFill on the Width Override of the fill bar's SizeBox, VolumeText on the value text.
  • Settings: none.
  • To copy: state layers shown by Render Opacity; a fill bar driven by <Name>Fill; Reset written with SetOn and SetValue, for the player who clicked (?Player := option{Event.Player}).

Shop

A shop with two tabs: Items (buy a blade, a shield or a potion) and Skins (pick a skin, then Equip). Each player has their own tab, gold and skin: set States to PerPlayer on interactive_widget_component. The layout makes per-player copies (NewCopy), so each player sees their own copy of the widget.

  • Fields: hover on every control, pressed on the buy buttons and Equip, on for the tabs and skins; Screen (int) on the Active Widget Index of the WidgetSwitcher that holds the two pages; Gold (int, on a text) and Message (message), written by the logic itself.
  • Settings: StartGold on world_ui_kit_shop_logic (100).
  • To copy:
    • tabs that switch a WidgetSwitcher through the Screen field;
    • per-player data in the logic (a [player]int map) shown on the player's own copy with WidgetFor:
Show(Kit:interactive_widget_component, Who:player, Text:string):void =
    if (W := Widgets.WBP_WorldUIKit_Shop_entity[Kit.WidgetFor(?Player := option{Who})]):
        set W.Gold = GoldOf(Who)
        set W.Message = InteractiveText(Text)
  • the gold appears the first time a player aims at the shop (SubscribeHovered);
  • IsOn["SkinRed", ?Player := option{Who}] reads the skin that player selected.

Keypad

A code lock everyone shares: twelve keys, the typed code shown as stars, a light that turns green when the code is right, a red flash when it is wrong.

  • Fields: hover and pressed on every key; Code (message, the stars), Unlocked (float, the light) and Error (float, the red flash), written by the logic on the placed widget (WidgetFor() without a player).
  • Settings: Code ("1234") and UnlockSeconds (3) on world_ui_kit_keypad_logic.
  • To copy: UnlockedEvent, an event(player) of the logic component, signalled with the player who typed the right code. Another component can wait for it to open a door:
if (Keypad := Entity.GetComponent[world_ui_kit_keypad_logic]):
    Who := Keypad.UnlockedEvent.Await()

A token cancels the pending relock when a new code is entered.

Radio

A shared music player: Prev and Next, a Play / pause toggle, a vertical Volume slider and the name of the track.

  • Fields: hover on every control, pressed on Prev and Next; PlayOn on two widgets: the opaque On layer that hides the PLAY label, and the PAUSE label above it; VolumeFill on the Height Override of the fill's SizeBox (a vertical slider fills upwards); VolumeText; Track (message), written by the logic.
  • Settings: Tracks on world_ui_kit_radio_logic (three names).
  • To copy: one field that swaps two labels; a vertical slider; a text written when the round starts (SubscribeRoundStarted) and on each skip.

Your own widgets

The examples are references: copy their WBP to start yours, or read their Verse file to see a layout generated by the editor and a logic written by hand. Never edit the kit's own files: an update replaces them.

On this page