Docs/UiKit.md

UI kit

The game's 3D interface (VR and desktop: the same menus) is built from one kit of widgets and templates, so that every screen looks the same, places its widgets without coordinates written by hand, and never lets a text overflow, whatever the language.

Where What
Apps/Client/Scripts/Ui/ The widgets (Godot): UiTheme (tokens), UiText (fitted texts), UiControls (label, panel, button, bar, badge), UiRing (a hold filling), UiInputs (switch, choice, stepper, slider, text field, keyboard), UiDropdown (drop-down list, coloured options), UiVirtualKeyboard (AZERTY / QWERTY keyboard and numeric keypad, independent of the input), UiContainers (stack, grid, scrolling list, tabs), UiScreens (screen, dialog, three-screen menu), UiKitGallery (every widget, for these pictures: copy from it)
Apps/Client/Scripts/Nameplate.cs The nameplate template above players and mobs
Libs/Client.Core/Ui/ Engine-free and tested (Tests/Shared.Tests/UiKitTests.cs): TextFit (the size a text needs), UiLayout (stacks, grids, slider values, scroll bar, held stick), PlateText (nameplate texts), VirtualKeyboard (keyboard layouts and state, KeyInput)
Libs/Client.Core/Loc.cs, LocMessage.cs, Lang/*.json The texts by language, their values, plurals and numbers (see Translation and Localization)

The pictures below are taken by the game itself (./Tools/Dev/Build-DocImages.ps1 -Only ui, a few seconds, see Doc site). The keys in the examples (forge.make, option.volume...) are illustrations: the existing ones are in Lang/en.json.

Rules

  1. Build UI with the kit. No new Label3D, BoxMesh button or hand-placed Position in a screen: a widget of Scripts/Ui, placed by a UiStack, UiGrid, UiScreen or UiScreenSet. A widget that does not exist yet is added to the kit (with its section in UiKitGallery and its picture), not written inside a screen.
  2. Values from UiTheme. Sizes (ControlHeight, Gap, Padding...), font styles (UiFont) and colours by role (UiVariant: Primary light grey for the usual action, Accent blue for the main or selected one, Danger red for what destroys or leaves, Neutral dark grey, Muted darker: the look of a tablet's dark settings, colour only where it matters). No colour or number of a screen's own.
  3. Every player-facing text through Loc (Loc.Get("ui.cancel"), Loc.Format("plate.level", ("level", 12))), its English in Lang/en.json and the same key in every other Lang/*.json (a test checks it). Texts built in Client.Core (GameMenu, InventoryScreen...) move to Loc step by step.
  4. Texts are fitted, never sized by hand. A widget's text goes through UiText.Set (all the kit's widgets do), fitted by TextFit in this order: one line, shrinking a little (to 80 % of the style's size); then two lines, then three (as many as the widget allows and its height holds), each as large as it can down to the style's minimum; then smaller still, down to a floor; only then cut with "…". The floor (Client.Core/Ui/UiMetrics, with the styles' sizes): FontFloor 11 px for a label (about 2.2 cm a line: still read at a menu's 0.8 m in a headset), ButtonFontFloor 6 px for a button or a key (half: a button names one thing, often in one word, shown whole and small rather than cut). Give a text room for about 40 % more than its English (German, Dutch) and look at it in the pseudo language; --report-cuts prints every text the client cuts.
  5. Pictures follow the widgets. A new or changed widget: its section in UiKitGallery, ./Tools/Dev/Build-DocImages.ps1 -Only ui, and the images committed with the change.

Theme

UiTheme holds every value; a change there changes every screen.

Surfaces (UiShape): every button, row, field, switch and screen is a flat rounded rectangle of one colour, unshaded (the same in any light, like a tablet's screen). It is always drawn opaque, so a text in front of it always shows: its corners are cut away, and a fade (a row leaving a scrolled list, UiFade) or a see-through colour drops a share of its pixels (a fine dither). A switch is a pill with a round knob (blue when on), a slider a pill with a round knob. Colours: Surface (a screen), SurfaceRaised (a row), PrimaryColor, AccentColor, DangerColor, NeutralColor, MutedColor, Text, TextDim; titles are white (TitleColor).

Token Value Use
PixelSize 0.002 m menu texts (a Body line is about 4.5 cm high, read at 0.8 m)
PlatePixelSize 0.004 m nameplates (read from a few metres)
ControlHeight 0.09 m buttons, switch rows, fields
Gap / Padding 0.015 / 0.04 m between widgets / inside a screen's edge
Depth 0.012 m how far a button stands off its screen (sinks by 60 % when pressed): flat, like a tablet
Radius / PanelRadius 0.018 / 0.03 m rounded corners of a button, row or field / of a screen
TitleBand 0.1 m a screen's title
SideAngle 28° side screens turned towards the player
UiFont Preferred → smallest (px)
Title 30 → 20
Body 22 → 15
Small 18 → 13
Caption 15 → 11
Button 24 → 14
Plate / PlateSmall 40 → 24 / 28 → 16

Every widget is centred on its origin and knows its Size (IUiControl); z = 0 is the surface it stands on, its parts in front.

Widgets

UiButton

Buttons

var forge = new UiButton(Loc.Get("forge.make"), new Vector2(0.3f, UiTheme.ControlHeight), UiVariant.Accent, () => ActionRequested?.Invoke(MenuAction.ForgeMake));
forge.Enabled = nearForge;          // dim and inactive when false
forge.Variant = UiVariant.Primary;  // a selected tab, a switch: change the variant, not the colour
var plus = UiButton.Small("+", UiVariant.Primary, () => Step(1));
var oneLine = new UiButton(text, size, UiVariant.Primary, onClick, maxLines: 1);   // a list's row: default 3, see below
var draw = UiButton.Icon(FactIcon.Reroll, 0.13f, UiVariant.Accent, Draw, Loc.Get("chars.random")); // round, a picture, its hint

Long labels. A button's text (maxLines 3 by default; the button's height decides how many lines a size gets) first shrinks a little on one line (to 80 % of its style's size), then wraps on two lines, then three, each as large as the height holds down to the style's minimum, then shrinks to UiMetrics.ButtonFontFloor (6 px), and only then is cut with "…". A button of UiTheme.ControlHeight takes two lines of the Button font from about 16 px, three from about 11. A "…" therefore means one word longer than the button even at 6 px. Tiny is not good either: Toegankelijkheidsinstellingen in a 20 cm button (the Text fit row above, on purpose) is whole but hard to read; make such a button wider, or the text shorter in that language. The Lines row shows labels on two and three lines. maxLines: 1 only where one line is meant (a list's rows, a single-line field, a countdown).

Checked by tests, with the real font. Tests/Shared.Tests/UiFontMetrics.json holds the client font's widths (every character of every language, written by the client: godot --headless --path Apps/Client -- --font-metrics Tests/Shared.Tests/UiFontMetrics.json; a test says when a language brings a character it lacks). With it, TextFitTests fits every text of every language (pseudo included) in the kit's usual boxes and fails when one is cut while a smaller size or another line would have held it, and the real boxes whose sizes are engine-free (UiMetrics, KeyboardSizes, MenuSizes: the bag's sort buttons) with their real texts; KeyboardFitTests every key of every keyboard of the game (each size, layout, language, shift state; the keypad). The other screens: run the client with --report-cuts (and --lang de...) on them.

A UiButton is a VrWidgets.ClickableBox: lighter and raised under a laser (or the mouse), pushed in while pressed, and both rigs press it with no extra code. Resize changes its size (the footer of a screen shares its width between its buttons). UiButton.Icon is a round button with a UiGlyph and no word (the character screen's draw: two circular arrows); its Hint (any button's) shows under it on a plate of its own while it is pointed at, a tooltip (ClickableBox.Applied: the box's state changed, no per-frame code).

UiLabel

Labels

var name = new UiLabel(Loc.Get("menu.name"), width, UiFont.Body, align: HorizontalAlignment.Left);
var help = new UiLabel(text, width, UiFont.Small, maxLines: 4).TopAligned();   // a paragraph from the top of its box
name.Text = other;   // refitted

A label's box is its width × maxLines lines (at the preferred size; a height instead fixes it, and a smaller size then gets the lines that hold in it); the text is fitted as a button's (one line a little smaller, more lines, the floor, then "…"); a word is never split. Resize(width) gives it another width, its text fitted again, its left (or right) edge kept (2026-12-01: the menu's session bar, its name, level and gold taking all the room the buttons shown leave, never cut while there is room).

UiBanner: a message in front of the player

Banners

var banner = new UiBanner(0.8f);                                   // drawn over everything, no collider
banner.Set(Loc.Get("banner.error"), text, UiTheme.DangerColor);  // "title: text" on one line (empty title: the text alone), the accent's colour

One discreet line of small outlined text, centred, no panel, a short coloured bar under it as its only accent (blue a line of the game, red an error, gold the server's announcement; 2026-12-01: the Character tab's Messages screen is gone, and the first banner, a panel of three lines in front of the eyes, was far too big). Drawn over the world and the menus (UiText.SetOnTop), without a collider: the laser goes through. Shown by BannerController (one at a time for a few seconds, Client.Core.BannerQueue, tested): at the top of the view, centred, following the head; small, over the session bar while the menu is open. GameMenuController.Notify(line) (a line), NotifyError (a refusal, a failure: not enough gold, the bag full, no answer), NotifyQuiet (too frequent for a banner: an orb taken; the desktop HUD and the log), NotifyDev (the DEV tab's answers, "Dev locomotion ON": the log only); the server's announcement (the Monitor's Send to all) is a gold banner with its countdown. A banner with a topic (Banner.Topic, BannerController.Add(..., topic:)) replaces the one of the same topic shown or waiting instead of queueing after it (the wing's "Take-off in 8 s", pressed again).

UiRing: a hold

new UiRing(radius, thickness) { Progress = 0.4f }: a ring that fills from the top, clockwise, as something is held (pointing at a player 3 s: PlayerPointController); it faces the camera and shows through what is in front. Its sample is under the icons below.

UiIcon: the items' icons

Item icons

var icon = new UiIcon(new Vector2(0.08f, 0.08f)) { Item = ItemIcons.Of(item) };   // null: nothing drawn (an empty slot)
slot.Content.AddChild(icon);          // on a button's face, its level in the button's text under it
icon.Item = ItemIcons.Of(other);      // another item

An item's icon is a picture of its own model, taken by the game (ItemIconStudio: a small hidden stage with its own light, a camera without perspective and a see-through background), not an image file: a model that changes changes its icon. There is one icon per family (Client.Core.ItemIcons, ItemIconKey): a blaster's kind and rank, a piece of armour's slot, role and rank, a species' loot item (ItemIconKey.Loot, whatever its rank and level); the item's level, seed and traits are told beside it (the slot's text, the details). So the list is short and known: it is all drawn at the game's start, by sheets (24 icons at once, each in a little viewport of its own, one shared world where the models stand far apart: about 0.9 s for the 202 icons), behind the splash screen (LoadingController waits for ItemIconStudio.Done, at most 3 s, the icons of what the character carries first once its sheet is known: ItemIcons.Carried), and nothing is drawn later, whatever a screen lists (an inventory, later a market). They are kept on the disk (IconCache, user://icon-cache.bin, 2026-12-01: 232 icons took 6 s on a Quest 3 at every start): a start reads them on a worker thread (0.56 s on the Jetson instead of 2.6-6.2 s drawn), under a key of everything that changes a picture (the client's code, the MD5 of the models' .glb, Godot's version, the list of icons); another key or a broken file: drawn again and the file replaced; --no-icon-cache draws them anyway.

An icon is a family's, never one item's: a market with any number of items needs no more icons. If items ever get a look of their own (from a seed, like the pets), their icons must be drawn on demand (only the ones on screen, by sheets like these), kept in a disk cache, the family's icon shown meanwhile. A UiIcon whose picture is not drawn yet shows nothing and takes it as soon as it is there. Every item of the bag has one (2026-11-29): a camp's intel shows a map with a red cross (ItemIconKey.Intel), and a type or a pet this client does not know a closed crate (ItemIconKey.Unknown); ItemIcons.Of is null only for an empty slot. --icon-preview [M] shows them all on a board (a row per rank, then the loot items).

Pictures: UiGlyph, UiFactChip, UiChargeChart

Glyphs

UiGlyph: the kit's small pictures (a bin, damage, charge, ammo, burst, overheat, health, defence, weight, a check, two circular arrows to draw again (Reroll)...; the list is FactIcon in Client.Core/ItemCard.cs). UiGlyphIcon (2026-11-29) is one of them as a widget a UiStack places (new UiGlyphIcon(FactIcon.Check, 0.03f, UiTheme.Success): a quest's objective met). Each is a flat mesh of one colour drawn from a few shapes on a 24 × 24 grid (UiGlyph.Draw: Fill, Line, Disc, Ring): sharp at any size in a headset, no file to load. A new picture: a value of FactIcon and its case in Draw. UiGlyph.RankColor gives a rank its colour (E grey … S gold).

UiFactChip: one fact of an item (ItemFact: a picture, a short value, a sentence) on a small plate. It is a ClickableBox that does nothing when pressed: its owner reads Hovered and shows its Help beside it (UiTipBoard: a dark plate just over the pointed picture). With a badge it has two lines, its value over a small coloured text: its gain over what is equipped (ItemFact.Gain: "▲ 12 %" green, "▼ 8 %" red, UiFactChip.Badge) or a chance of the forge's ("41.7 % · likely" in its word's colour, UiFactChip.OddsColor).

UiChargeChart: a blaster's damage against its charge time (ChargeCurve), then what holding on does: a flat line (kept), a fall (the charge is lost), a red end with a flame (it overheats). One time axis for every blaster, 0 to 5 s (ChargeCurve.ScaleSeconds, a tick each second; 2026-12-01: each curve was stretched to its own charge time and every weapon drew the same picture): the full-charge bar stands at the real time (1 s at a fifth, 3 s at three fifths), the time under it, "5 s" at the axis' end. The longest charge, a sniper's 4.5 s +10 % by its seed, fits (checked by ChargeChartTests); a hold past 5 s (a sniper's 4.9 s + 1.5 s before it overheats) ends just inside the axis.

var bin = UiGlyph.Make(FactIcon.Trash, 0.05f, UiTheme.Text);      // on a button's Content
var chip = new UiFactChip(new ItemFact(FactIcon.Damage, "376–1.88K", Loc.Get("card.damage.help")), new Vector2(0.22f, 0.066f));
var chart = new UiChargeChart(new Vector2(0.7f, 0.19f));
chart.Show(ChargeCurve.Of(weapon));

An item's card and the forge's chances: UiItemCard, UiOddsBoard

Item card and chances

UiItemCard: an item's card, the same in the inventory (its right screen) and at the forge (its centre screen): its name in its rank's colour, where it is ("A pair, in the bag", "What the forge makes: its usual numbers"), what it is compared with ("▲▼ against your Sniper B · Lv 12"), a blaster's charge graph, then its facts as UiFactChips laid in rows of six units (a short fact two, a sentence three, a long one six), each better or worse than what is equipped with its badge.

Every value shows whole, at its full size (2026-12-02, bug report #40: "54 % d'endu…", tiny lines): Client.Core's FactLayout places them, engine-free: a value too long for its width takes a wider one (a third, half, the whole row), then wraps on two lines (four at the whole width), its chip as high as its lines; only a value too long even then shrinks, never below the Small style's minimum, never cut with "…". Short facts stay side by side, the chips of a row share its height and fill its width. ItemCardFitTests places every card (wings, blasters, armour, pets, intel) in every language with the real font. Facts taller than the card scroll (drag, stick, wheel; a thin bar on the right; a fact leaving the window fades out). Built from Client.Core's ItemCards.Of(item, board, stats) (a bag item) or ItemCards.Forge(choice, stats, board) (the forge's choice: typical numbers, the dice's range in each sentence). The same card again changes nothing (the pointer may be on a picture).

UiOddsBoard: what the forge's dice may give (ItemOdds.Of(choice, stats), exact from Shared.Gameplay.ForgeOdds): for each group (a blaster's traits, what its charge does when held, its ammo, how far its numbers move; an armour's bonuses, how far its values move) its title, then its outcomes two by two, each with its exact chance and its word in colour (certain green, likely teal, possible blue, rare purple, very rare orange: ItemOdds.Tier) or its range. Both are UiTipBoards: the pointed picture's sentence shows on a dark plate over it (under the graph; under it when there is no room over it, always within the board). The plate is at most TipMaxWidth (0.56 m) wide, its text wrapped at the Small style's size (never shrunk: more lines), UiTheme.TipPadding all round, as high as its lines. Its sentence explains the fact plainly, naming it first ("Top speed: 66 m/s. In a dive…"; a wing's effect: its type's own, wing.effect.<type>.help). Preview: --card-preview [wings|items|tip|scroll] (offline, with --login-shot PATH --wait 4 --lang de).

var card = new UiItemCard(new Vector2(0.74f, 0.6f), Loc.Get("card.none"));
card.Show(ItemCards.Forge(choice, stats, board));       // or ItemCards.Of(item, board, stats)
var odds = new UiOddsBoard(new Vector2(0.7f, 0.78f));
odds.Show(ItemOdds.Of(choice, stats));

Inputs: UiToggle, UiChoice, UiStepper, UiSlider, UiProgressBar

Inputs

They share one row shape: the setting's name on the left (fitted), its control on the right.

var turn = new UiToggle(Loc.Get("option.smooth_turn"), settings.SmoothTurn, width);   // the whole row is clicked; On / Off from Loc
turn.Changed += on => ToggleChanged?.Invoke(MenuToggle.SmoothTurn, on);
turn.Value = settings.SmoothTurn;                // after a refresh: does not raise Changed

var lang = new UiChoice(Loc.Get("option.language"), names, index, width);          // ◀ value ▶, wraps around
lang.Changed += i => Loc.SetLanguage(Loc.Languages[i]);

var level = new UiStepper(Loc.Get("forge.level"), "1", width);                     // − value +: a count (the forge's level, the arena's mobs)
level.Stepped += d => SetLevel(_level + d);
level.SetValue(_level.ToString());

var volume = new UiSlider(Loc.Get("option.volume"), 0.8f, width) { Steps = 20, Format = v => $"{v * 100:0} %" };
volume.Changed += v => settings.Volume = v;      // pressed and dragged with the laser or the mouse

// A setting's number: a slider over its steps, ◀ ▶ a step each (precise in VR), its value short on the right.
var turn = new UiSlider(GameMenu.ValueName(v), 0, width, steps.Length - 1, arrows: true) { Format = x => GameMenu.ValueText(v, StepOf(x)) };
turn.SetValueText(GameMenu.ValueText(v, now));    // the owner's text after a refresh (a new language)

var hp = new UiProgressBar(new Vector2(0.5f, 0.05f), UiTheme.Success, withText: true);
hp.Set(stats.Hp, stats.MaxHp);                   // "1250 / 3000"; big numbers short (12.5K)

A slider follows the pointer through ClickableBox.PointerAt (called by VrRig and DesktopRig on the press and every frame while held).

UiDropdown

Drop-down lists

var biomes = Biomes.All.Select(b => new UiOption(b.Name, GroundColor(b))).ToList();   // a colour per option (optional)
var go = new UiDropdown(Loc.Get("dev.go_to_biome"), biomes, 0, width, maxRows: 6);
go.Changed += i => BiomeChosen?.Invoke(Biomes.All[i].Biome);
go.SetOptions(other, index);   // new options: does not raise Changed

The field shows the chosen option, painted with its colour; pressed, the list opens under it, in front of the screen (over the widgets below), and scrolls like a UiScrollList when it has more than maxRows options. The chosen one has a yellow mark. On a coloured option the text is white while it reaches a 3:1 contrast (WCAG's level for large text), else dark (UiContrast: snow, sand, yellow and light greens get dark text). Long names take two lines, then shrink, then are cut. Picking closes the list and raises Changed; pressing the field again closes it; opening a list closes any other.

Use it instead of ◀ ▶ (UiChoice) when there are more than about four options, or when they have colours or long names.

UiTextField and UiKeyboard

Keyboard

var user = new UiTextField(Loc.Get("login.username"), TextEntry.Username(), 1.1f);
var pass = new UiTextField(Loc.Get("login.password"), TextEntry.Password(), 1.1f, secret: true);
var keys = new UiKeyboard(user.Entry);
keys.AddAction(Loc.Get("login.log_in"), UiVariant.Accent, Submit);
user.FocusRequested += f => { keys.Target = f.Entry; user.Focused = f == user; pass.Focused = f == pass; keys.Refresh(); };
keys.Typed += () => { user.Refresh(); pass.Refresh(); };

The typing rules (allowed characters, length, shift and caps lock) stay in Client.Core TextEntry. UiKeyboard is QWERTY only and tied to a TextEntry; new screens use UiVirtualKeyboard below (the VR login does).

UiTextArea: a text of several lines (the bug report's, Feedback.md), on the same board.

var text = new UiTextArea(Loc.Get("feedback.text"), new TextEntry(1000, c => c == UiTextArea.NewLine || PlayersScreen.ReportChar(c)), w, lines: 5);
keys.KeyPressed += key =>
{
    bool typed = key.Kind == KeyKind.Enter ? text.Entry.Type(UiTextArea.NewLine) : KeyInput.Apply(key, text.Entry);
    if (typed) text.Refresh();
};

Its TextEntry must allow UiTextArea.NewLine for Enter to start a line (the owner decides what Enter does: here a line, so Send is its own button). The box keeps its size (lines lines of the body's size); the lines (the line breaks kept, an empty line stays one) are wrapped in its width, and the text gets smaller as it gets more lines: the body's size (22) while they hold, then smaller, down to the body's minimum (15, about 3 cm high: easy to read at arm's length). Past that it scrolls by line, like a UiScrollList (KineticScroll): drag it, the right stick (up / down; sideways it still turns the player), the wheel, and a scroll bar on the right (the kit's UiScrollBar, shared with the list: grab its thumb, press its track) shown when the text is longer than the box. Typing or dictating (Refresh) brings the view back to the end, where the caret is; ScrollToLine(n) shows from a line. Each line shown is a label of its own (a Label3D drops an empty line). The layout is TextFit.Area and TextFit.FirstLine in Client.Core (the size chosen for a number of lines, the lines shown for a scroll offset; tested). Focused, it is lit with a caret; clicked, FocusRequested, as UiTextField. The gallery's sample (picture above) is a long text, smaller and scrolled from its third line.

UiVirtualKeyboard (AZERTY / QWERTY) and UiNumpad

Keyboards

Independent of the input: they do not know what they type into, whatever the system's keyboard. Each press raises KeyPressed with a VirtualKey (a character, or a command: Backspace, Enter, Space, Clear, Sign, Ok, Shift, Layout, Mic); the owner applies it where it wants. new UiVirtualKeyboard(layout, key, gap, mic: true) adds a microphone key beside Space (dictation: the owner starts and stops it, SetListening(true) turns the key red; the report's keyboard, see Players tab in Architecture.md).

The last row (KeyboardRows in Client.Core, as wide as the ten keys above): shift and erase are symbols, one key each; the layout's name (QWERTY, AZERTY: press it for the other) and Enter are words, two keys each; Space takes the rest (and the microphone one key). The game's key sizes are in KeyboardSizes (the login 10 cm, the character screen 7.4 cm, the bug report 6.5 cm, a player's report and a pouch's name 6 cm): KeyboardFitTests checks that no key's text is cut in any of them.

var keys = new UiVirtualKeyboard(layout: null);          // null: the language's usual one (French: AZERTY)
keys.KeyPressed += k =>
{
    if (k.Kind == KeyKind.Enter) Submit();
    else if (KeyInput.Apply(k, focused.Entry)) focused.Refresh();   // a TextEntry: its own rules (allowed characters, length)
};
keys.SetLayout(KeyboardLayouts.Azerty);                  // or the player presses the layout key next to Space

var pad = new UiNumpad(decimals: true, negative: true);  // 7 8 9 ← / 4 5 6 C / 1 2 3 ± / 0 . OK
string number = "";
pad.KeyPressed += k =>
{
    if (k.Kind == KeyKind.Ok) Confirm(number);
    else pad.SetDisplay(number = KeyInput.ApplyNumber(k, number));   // one point, the sign, no leading zero
    pad.CanSubmit = number.Length > 0;                   // OK dim until there is a value
};
  • Layouts: KeyboardLayouts (Client.Core/Ui/VirtualKeyboard.cs), 4 rows of 10 keys, each key with its character and its character with shift, as on the physical keyboard (AZERTY: & é " ' ( - è _ ç à on the top row, the digits with shift). A new layout (QWERTZ...) is one entry there, and KeyboardLayouts.All gives the order of the layout key.
  • Shift once: the next key; twice: capitals locked (letters only). The state (VirtualKeyboard: layout, shift, caps lock) is engine-free and tested (VirtualKeyboardTests).
  • Space and Enter are translated (ui.space, ui.enter), OK too (ui.ok).
  • UiNumpad with a display (SetDisplay) or without (withDisplay: false); . and ± dim when the number takes none. A whole number with limits can keep NumberEntry (the DEV keypad's rules) and only take the keys from UiNumpad.

Containers: UiStack, UiGrid, UiScrollList, UiTabBar

var column = new UiStack(UiAxis.Vertical, UiTheme.Gap, new Vector2(width, 0));   // 0: fits its content
column.Add(new UiToggle(...));      // placed under the previous one
row.Visible = false; column.Layout(); // a hidden widget takes no room
var slots = new UiGrid(5, new Vector2(0.11f, 0.11f));   // row by row from the top left
var list = new UiScrollList(width, rows: 4);            // see below; rows as wide as list.RowWidth
var tabs = new UiTabBar(titles, 1.36f); tabs.Selected += Select;

A container lays itself out again when a widget is added, and tells its own container (a grid filled after being put in a screen still moves the widgets under it).

UiScrollList: many settings

Scrolling list

var list = screen.Body.Add(new UiScrollList(screen.ContentWidth, rows: 5));
foreach (var setting in settings) list.Add(new UiToggle(setting.Name, setting.On, list.RowWidth));
list.ScrollTo(0);          // or list.Scroll(+1); list.Scrolled += offset => ...

As many rows as needed; rows of them show. To scroll:

It scrolls like a tablet (Client.Core.Ui.KineticScroll, tested):

  • Drag it with a finger, anywhere: press the trigger (or the mouse) on the list, its rows and their buttons included, and move: the rows follow the laser to the millimetre. Let go moving, it goes on and slows down (a fling); past an end it resists, then springs back. A press that moves less than 1.2 cm up or down with the mouse, 3 cm with a VR laser (pulling the trigger moves the hand), is still a click on what was pressed; a sideways slide never drags (Client.Core.Ui.TapOrDrag); a switch flips wherever its row is pressed, when let go (VrWidgets.Touch, used by VrRig and DesktopRig: a list is an IDragScroll). A slider and the scroll bar keep their own drag (ClickableBox.GrabsDrag).
  • Right stick (VR) while the right laser is anywhere on the list: it scrolls smoothly, as fast as the stick is pushed (quadratic: fine when pushed a little). Meanwhile its up / down does not fly up / down in dev locomotion; pushed more sideways than up or down it still turns the player (snap or smooth, as in Options) and does not scroll (bug report #84, 2026-12-02: Client.Core.Turning.TurnInput / ScrollInput).
  • Wheel (desktop): a smooth step of a row and a half.
  • The thin scroll bar on the right shows where it is; grab its thumb to jump far, a press on its track jumps there.

A row leaving the window fades out (UiFade) instead of being cut, and does not take the laser while less than 60 % shown. Any widget can make its parent list scroll: VrWidgets.Scroll / VrWidgets.Stick look for an IScrollable from the pointed collider up through its parents.

Settings screens (GameMenuVr, Options and DEV): like a tablet's settings, a column of sections on the left (GameMenu.Sections: Options: Movement, Glide...; DEV: Movement, Glide, World, Character; Audio later), the chosen one in blue; on the right its rows (GameMenu.Rows: switches UiToggle, numbers UiSlider with arrows, named values as a drop-down list UiDropdown (GameMenu.IsChoice: the health panel's when, the stream camera's mode), the sound devices' lists (MenuRow.Device: Options, Audio), the language's list (MenuRow.LanguageList: Options, Interface, first; 2026-12-01: it had a right screen of its own, over a list of the controls, both gone), buttons) in a UiScrollList; a row's name (GameMenu.ValueName) and its short value (GameMenu.ValueText: units, no sentence) are apart. Those tabs take a wider centre screen (1.5 m instead of 1 m: each tab its own width, the side screens follow).

Templates

UiScreen and dialogs

Screen

var screen = new UiScreen(Loc.Get("menu.options"), new Vector2(1f, 0.78f), closable: true);
screen.CloseRequested += Close;
screen.Body.Add(new UiToggle(..., screen.ContentWidth));   // the body: a column from the top
screen.AddText(Loc.Get("options.help"), maxLines: 3);       // a paragraph as wide as the body
screen.AddButton(Loc.Get("menu.log_out"), UiVariant.Primary, LogOut);   // the footer: buttons sharing the width
screen.AddButton(Loc.Get("menu.exit"), UiVariant.Danger, Exit);

Dialog

var ask = UiScreen.Dialog(Loc.Get("item.destroy_title"), Loc.Format("item.destroy_text", name),
    (Loc.Get("ui.cancel"), UiVariant.Neutral, null), (Loc.Get("item.destroy"), UiVariant.Danger, Destroy));
ask.CloseRequested += () => ask.QueueFree();   // every answer closes it

UiScreenSet: the menu

Menu

var menu = new UiScreenSet(new Vector2(1f, 0.78f), sideWidth: 0.6f, tabTitles);
menu.Tabs.Selected += ShowTab;
menu.Centre.Title = Loc.Get("menu.inventory");
menu.ShowSides(left: true, right: true);   // a tab without side screens hides them (their colliders too)

Not every tab uses the three screens (2026-12-01): the Options and DEV tabs have no right screen (the keypad and the DEV lists open there), the Character tab no messages screen (a banner instead: UiBanner). A tab's text on the centre screen (Character, Forge, Arena, Raids, Dungeon) and the Character tab's monster symbols are lines in a UiScrollList (wrapped, scrolling), never a paragraph running off the screen. The Quests tab's details keep Abandon on its own row at the bottom; above it the details are one line a row in a UiScrollList (title, giver and state, objectives, reward, cooldown, then the goal in full and the story, wrapped): they scroll, never cut, never under the button (2026-12-01, bug report #32). The session bar over the centre screen (who plays, then Update, Bug, Leave): its line (SessionBar.Who, the gold {gold:short}) stays on one line while it holds at the Body style's sizes, else goes on two, wrapped only after a "·" (its other spaces are no-break ones), never cut with "…" (bug report #25, 2026-12-02; --session-who NAME,LEVEL,GOLD shows a long name and a big gold).

The three screens and the tab row of GameMenuVr (big screen in front, side screens turned towards the player, tabs under the centre one tilted up). The tabs are icons (2026-11-29: their names were cut in some languages): each tab's UiGlyph (GameMenu.Icon: a sack for the inventory, a gem for the collection, a sheet with a ! for the quests, a bust, two busts for the players, a map, a cave, crossed swords for the raids, an anvil, a trophy for the arena, a cog for the options, a wrench for DEV; one each, checked by a test) on a UiButton; the pointed tab's name shows under the row (UpdateTabHint, a tooltip), and the open tab's name is its screen's title.

A fourth screen can open further left, hinged on the left one and turned as much again (AddFarLeft(title, width), ShowFarLeft(bool), 2026-11-28): the forge's and the arena's keypad for the level, so the right screen (the chances, the last fights) stays. The same on the right (AddFarRight(title, width), ShowFarRight(bool), 2026-12-02): the forge's Repair screen.

Nameplates

Mob nameplates

Player and NPC nameplates

Nameplate (one template, three kinds: PlateKind.Mob, PlateKind.Player, PlateKind.Npc), origin on the health bar:

  • Mob: name (rarity first, coloured by the level gap: Palette.ConColor), level badge, health bar (red), particularities and special attack countdown under the bar. All of it only while it fights (MobLabels.Fighting); idle, its plain white name and its bar, no badge (SetIdentity(name, level, showLevel: false)).
  • Player: title (optional, gold, above the name: may be long, it shrinks then is cut), name, guild (optional, <Guild>), level badge, health bar (green). Over all of it, the voice icons (SetVoice(micOff, deafened), drawn by VoiceIcons, which also draws the keyboard's microphone key): a microphone crossed out (its microphone is off), a headset crossed out (it hears nobody); nothing when both are on.
  • NPC (the safe zone's, NpcsView): its name and its role under it (gold, <Blacksmith>: SetRole(role)), no badge nor bar (SetIdentity(name, 0, showLevel: false)): the name stands on the origin.
var plate = new Nameplate(PlateKind.Player);
plate.SetIdentity(name, level);       // the badge grows with "Stufe 1450" before shrinking its text
plate.SetHealth(hp, maxHp);
plate.SetPlayerInfo(guild, title);    // null or empty: the line is gone (not sent by the server yet)
plate.Set(new PlateInfo { Kind = PlateKind.Mob, Name = "Elite Wolf", Level = 20, Hp = 40, MaxHp = 100, Tags = "Aura · Leaps" });

Lines that are missing take no room (stacks). The plate turns towards the camera around the vertical axis (a billboard material looks wrong in VR) and is drawn over the world within 30 m (UiText.SetOnTop: a tree's leaves, a mushroom's cap, a wall do not hide it), except behind a UI screen: when a ray from the plate to the camera meets a UI collider (layer 1, the laser's: the menu, a station's screen, a message panel, the bug report screen), the plate is drawn like any object and the nearer screen hides it. Drawn over everything, it would show on the screen, because the screen's surface is opaque (drawn first) and the plate's texts are see-through (drawn after, without a depth test); a plate half behind a screen's edge is hidden where the screen covers it. Guilds and titles are not in the protocol yet: when they are, EntityView passes them to SetPlayerInfo.

Small cards on the body: the quest watch

A card worn on the body (the quest watch above the wrist, WatchView, see The quest watch in Quests.md) is built with the kit at the menus' size, UiLabels in a UiStack on a UiShape sized to them (no UiPanel: no collider, the laser goes through what the player wears), then scaled down as a whole (WatchView.CardScale, 0.22: a 0.56 m card is 12 cm, read at 35 cm) and turned to the eyes each frame. Its texts are set ten times a second and only when they change; its place every frame (no allocation then). Colours from UiTheme (the main story's gold title, TextDim for a part met), opaque (a see-through UiShape dithers at that size).

Translation

Every language

  • Loc.Get(key): the current language's text, English when the key is missing there, the key itself when missing everywhere (easy to spot).
  • Loc.Format(key, ("damage", 40), ("seconds", 1.5)): a text with named values (Loc.Format(key, 40, 1.5) for {0}, {1}). Each language puts them where its grammar wants (German: alle {seconds} Sekunden {damage} Schaden).

Values, plurals and numbers

The syntax of a text (a subset of ICU MessageFormat, the one translation tools know; LocMessage):

Write Gives
{damage} the value; a number the language's way: 1.5 / 1,5, thousands grouped from 10 000 (1450, 12,500, 12 500, 12.500)
{damage:short} a big number short: 12.5K, 12,5 K, 3,4 M, 7,1 G (the same letters in every language since 2026-11-28; the game's numbers grow ×1.08 a level); under 10 a tenth shows (0.4, not 0)
{x:0.00} a .NET number format, with the language's separators
{seconds, plural, =1 {every second} one {# second} other {# seconds}} the case of the number: an exact =N first, else the language's category (English, German, Dutch: one = exactly 1; French: 0 to 1.99, 1,5 seconde); # is the number. other is required
{{ }} a brace

Loc.Number(n) and Loc.Short(n) write a number alone. A value not given shows its placeholder ({damage}: easy to spot).

  • Each Lang/<code>.json starts with its settings: _decimal (. or ,), _group (between thousands; French: a no-break space \u00A0, never cut at a line's end), _short (K|M|G|T in every language since 2026-11-28: one set of letters for the whole game, as Growth.Format; past T two letters, aa, ab… (not P, E, Z, Y: an E reads as an exponent), never an exponent; Loc.Number writes a number of a billion or more short too).
  • Lang/<code>.json (embedded in Client.Core): en (the reference), fr, de, nl. A new language: a new file with every English key and the same values (UiKitTests checks both, and that every text is well formed). Its plural rule: LocLanguage.Plural (one line per language that is not "one = exactly 1").
  • pseudo: English longer by about 40 %, accented and bracketed ("[Càáncéèl]"), to see what would overflow before anyone translates. Loc.Use("pseudo") (or "de") for a picture or a test (for the code running there only: the game's language and the tests running beside it keep theirs); in the game: godot --path Apps/Client -- --new-account --lang de (add --report-cuts: each text cut with "…" is printed, with its box).
  • Loc.Changed is raised when the language changes: a screen shows its texts again (UiToggle.Refresh for its On / Off, UiTabBar.SetTitle...).
  • Keys: area.what in lowercase (ui.cancel, plate.level, item.damage_over_time). Whole sentences with named values, never pieces glued together (word order changes between languages), and plurals with plural, never "second" + (n > 1 ? "s" : "").

What remains (a language setting, the menu's texts through Loc, server texts) is in Localization.

For agents: checklist

When you add or change any player-facing UI:

  1. Look for the widget in Scripts/Ui (and its use in UiKitGallery). Use it; do not copy its inside.
  2. Put it in a UiScreen body or footer, a UiStack, a UiGrid: no hand-written Position (only the z of a widget that must stand forward).
  3. Texts: a key in Lang/en.json and in every other Lang/*.json (a rough translation is better than none: say so in the PR), read with Loc.Get / Loc.Format.
  4. Size: leave room for longer languages; check the pseudo and de texts (the languages picture, or Loc.Use("pseudo") in the gallery).
  5. A widget hidden or shown after the screen was built: VrWidgets.SyncColliders(screen) (UiScrollList and UiScreenSet.ShowSides do it for their own widgets) so the laser does not hit an invisible button.
  6. No allocation in what runs every frame (AGENTS.md rule 14): set texts and layouts when a value changes, not in _Process (the widgets skip unchanged texts, Nameplate turns only).
  7. A new widget: its section in UiKitGallery, ./Tools/Dev/Build-DocImages.ps1 -Only ui, the picture here with a short example, and an engine-free part with a test when it has rules (Client.Core/Ui).
  8. dotnet build, dotnet test, and look at the pictures before the PR.

Not moved yet

The forge's and the arena's screens (ForgeStationView, ArenaStationView: the forge's opens on a click on Borin, standing on his left; the arena's near it) are built with the kit. In GameMenuVr, the Options and DEV tabs use the kit (sections, then a UiScrollList of UiToggle, UiSlider, UiChoice and UiButton rows), and every screen takes the kit's colours and rounded surfaces (VrWidgets.Panel and ClickableBox draw UiShape). The VR login (VrMenu) types with UiVirtualKeyboard (Enter logs in), its credits are a UiScreen and the DEV keypad (VrNumpad) with UiNumpad, their fields, titles and buttons still as before. The rest of the menu (screens, tabs, inventory, actions, biome list), the rest of VrMenu and VrNumpad, and Hud still use VrWidgets directly with hand-placed widgets, and their texts are English in code, not through Loc yet; they move to the kit screen by screen (the in-game menu first). New screens use the kit from the start.