The menu, HUD, and render layer of a ghost client. Brand-neutral: patterns and composition, not any one project's
code. Keep this separate from gameplay logic (silentkit-modules) and loading (silentkit-runtime).
On taste — design, don't just assemble. This skill is the toolbox and the patterns, not a fixed look. In a fresh project, design a distinctive interface you think is genuinely good — pick a point of view (a color story, a type scale, a motion feel) and make it cohesive, not a generic grey menu. In an existing codebase that already has a click GUI, improve it in place — refine spacing, rounding, motion, hierarchy and consistency rather than ripping it out; match what's there and raise its quality. Either way, aim for something that reads as modern and intentional.
Scope is strictly visual. Everything here is presentation: pixels, layout, type, color, motion, sound, and the
surfaces the user touches. The moment a feature becomes behavior — what a module does, when it fires, how it talks to
the server — it belongs in silentkit-modules, not here. (A HUD element that draws combat state is interface; the
combat state itself is a module. A settings row is interface; what the setting changes is a module.) If you find
behavior creeping into this skill, move it to silentkit-modules.
1. The render abstraction (Render2D)
Everything the client draws goes through one small immediate-mode 2D API so modules never touch the engine's constantly-changing render internals directly. A thin per-version adapter implements it; everything else is stable.
Core surface (one instance per draw pass, carrying an alpha multiplier and letter-tracking so a whole subtree fades/spaces uniformly):
rect / roundedRect(x,y,w,h,r[,cornerFlags],color),roundedOutline(...,thickness,...),line,lineGradient,circle / circleOutline,arc(cx,cy,r,thickness,startDeg,sweepDeg,color), vertical/horizontal gradient fills.shadow(x,y,w,h,r,blur,color)for soft drop shadows andblurRect(region,r,tint)for frosted panels (falls back to a solid fill before the blur texture exists).text / textShadow / textCentered / textRight(str,x,y,color,font,size),textWidth(...), and afit(str,maxW,...)that ellipsizes — pluscomponent(...)for styled/translatable text. A per-glyph tracked draw lays styled text out on float advances so letter-spacing works.item(stack,x,y,size[,decorations])for inventory icons; the engine's sprite blit for effect icons.- Pixel snapping:
snapX/snapYround a coordinate to a whole physical pixel through the current pose, so hairline strokes and shared panel edges don't shimmer at fractional GUI scales. An anti-alias width (pixel()) scales edge softness to the backing scale.
A separate world projector turns world coordinates into GUI-space screen points: it captures the exact
modelview (camera × view-bob × hurt-shake, camera at the origin) and projection (dynamic FOV, nausea) the level is
drawn with this frame, so overlays (ESP, tracers, nametags, radar dots) line up with the moving world. It returns
{x, y, onScreen, distance, behind}; a 12-edge box helper and bearing math sit on top. For a 2D screen-projected box,
keep the corners that are in front of the camera and bound them, rather than dropping the whole box when one corner
crosses behind you (that discard is the classic projected-ESP flicker).
For overlays that should depth-test against the world (3D boxes, trajectory ribbons), add a small world-space
render abstraction alongside the projector instead of screen-projecting: build camera-relative geometry on the CPU and
submit it inside the level render pass. Lines become camera-facing ribbon quads — side = normalize(tangent × eyeRay),
world half-width = (halfPx+1px)·worldPerPx·depth so on-screen width is depth-independent, a 1px feather in a UV channel,
core width in a per-vertex LineWidth attribute — and any edge crossing behind the camera is clipped to a near plane
(lerping position and colour), never dropped. Register the render type as a visible/hidden pair that partitions the
screen by depth (reversed-Z: visible GEQUAL, hidden LESS), sharing one small depth bias so coplanar geometry doesn't
z-fight; callers draw the hidden (through-wall) pass faded. This one pair backs box-ESP, trajectories and markers.
Keep colors as ARGB ints with a withAlpha helper; never hardcode engine color objects. One adapter per engine
version means a UI change ships once, not N times. Where the engine exposes a pipeline/render-type system, back
Render2D with a few custom pipelines (rounded-rect, blur, line) rather than per-call GL state.
1a. Shaders, blur & graphics state
The look lives in a handful of small shaders/pipelines; the stability lives in disciplined render state.
- Rounded rects & outlines as SDFs. Draw a quad and compute coverage in the fragment shader from the signed
distance to a rounded box (
length(max(abs(p)-halfInner,0)) - radius), antialiasing with onesmoothstepacross a ~1px screen-space band. One pipeline draws every panel, row, chip, toggle and progress bar — crisp at any radius/ scale, no geometry tessellation, no stair-stepped corners. Per-corner radii (avec4) cover connected lists and tabs. - Frosted-glass blur (the signature move). Behind a translucent panel, sample a blurred copy of what's behind it, not a flat fill. Pipeline: capture the current framebuffer (or the menu backdrop) into an offscreen texture, run a cheap separable blur into it — a two-pass Kawase/dual-filter (down-sample → a few ping-pong passes → up- sample) is far cheaper than a wide Gaussian at the same softness — then in the panel shader sample that texture at the fragment's screen UV, tint, and composite. Recreate the blur targets on framebuffer resize; until the blur texture exists (first frame, or capture disabled), fall back to a solid translucent fill so nothing flashes. Expose a blur strength/radius on the Style page.
- Soft shadows & glow. A drop shadow is the rounded-rect SDF sampled with an expanded radius and a blur falloff (or a pre-blurred nine-slice); a focus glow is the same in an accent color. Keep them cheap — one quad, fragment- side falloff — and let alpha scale with the subtree's fade.
- Save and restore engine render state — religiously. You're drawing inside the engine's frame, so leave blend
mode, depth test/mask, cull, scissor and the bound shader exactly as you found them. Prefer the engine's pipeline/
render-type system (set a pipeline, let it manage state) over raw global GL calls; a stray
glEnablethat you don't reset corrupts the engine's own rendering a few draws later and is miserable to debug. Batch where you can — one pipeline, one vertex buffer per shape kind per pass — rather than a GL call per rect. - Scissor / clip for anything scrollable. Push a scissor rect around a scrolling list or a panel body so rows clip cleanly at the edges (and round the clip to whole physical pixels so the edge doesn't shimmer); pop it after.
- Pixel snapping & DPI. Snap panel/row/bar edges to whole physical pixels (
round(x·guiScale)/guiScale) so 1px strokes and rounded corners stay sharp on HiDPI/Retina; a sub-pixel-wide line reads as a grey fringe. Do the snap at draw time, not in layout, so animation stays smooth. - Optional post effects — a menu-open backdrop dim/vignette, a subtle scanline/noise for a theme — are one full-screen pass each; keep them behind a toggle and respect reduced-motion.
2. Fonts
Two viable strategies:
- Engine text renderer — simplest; good enough if the engine's font is acceptable and consistent across versions, and necessary as a fallback for glyphs/codepoints your own atlas doesn't cover (server scoreboards lean on exact space-glyph layouts, so detect non-covered codepoints and fall back to the engine's pixel font at native size with zero tracking).
- Self-contained glyph rasterizer — ship a TrueType/CFF rasterizer + a glyph-atlas cache. Costs more but renders identical UI across every engine version and at arbitrary scale, and frees the look from the engine's font. Use it when the brand/identity depends on exact type, or when you support many engine versions.
Either way: define named font roles (display, body/medium, semibold, mono) backed by a configurable
family, with a base size and a type scale; measure with textWidth for layout; give uppercase labels letter-spacing.
Let the user pick HUD and menu families independently, and prefer a crisp system rounded face where present (detect it;
fall back otherwise). Reserve digit widths in metered readouts (FPS, counts) so the layout doesn't twitch as numbers
change.
3. The click GUI — floating panels
A modern floating-panels menu reads as modern and is simple to compose:
- Panels are draggable, collapsible cards (a category list, the navigator, a settings pane). Each remembers its
rect; persist rects so layout survives restarts. Add snap-to-grid on drag and saved named layouts (and a
one-click auto-arrange). A shared
Panelbase handles the drag/collapse/header; concrete panels only draw their body. - Navigator — the root panel: a home list of categories, plus special sub-pages (Client Settings, Style/Theme, Accounts) that slide in. Sub-pages are second-level lists built from the existing Setting objects, so the GUI has almost no bespoke state — it renders modules' real settings.
- Module list — rows with a label, a toggle switch, and small badges (flags-here / needs-X / safe), driven by per-module metadata. Clicking a row opens its settings inline (or in the settings pane). A category panel + a module-rows renderer keep this generic.
- Settings rendering — one renderer per Setting type: a toggle, a slider (with an inline value you can type — back
it with a tiny expression evaluator so "3*8" works), a segmented mode control, a color picker (with a gradient/accent
editor), a keybind capture, a text field, an item-list editor, and a collapsible Section / tabbed / pop-out group.
Drive
.visibleWhen(...)so conditional rows fold away. A per-module filter box ("type 'color'") tames dense panels. Dropdowns and context menus render in a top-most pop-up layer so they're never clipped by a panel's scissor.
High-value additions (most already pay for themselves): a command palette / search panel (fuzzy launcher:
toggle any module, jump to a setting, run an action); a favorites / pinned quick-access panel; module context
menus (bind / favorite / reset / copy / share); a live hover preview / tooltip (HoverTip — a tiny demo or
description of what a module does); a server-info card; a density/scale/reduced-motion control for
accessibility; an in-menu changelog with a "new" dot on recently-added modules. Keep one-module-open-at-a-time as a
toggle so dense panels stay readable.
Layout measurements and list resizing
Use one measured layout snapshot for drawing, clipping, scrolling, resize limits and hit testing. Include headers, search/import/action rows, gaps and conditional content in the measured height. Store a preferred panel size separately from its screen-clamped visible size so a temporary small viewport does not erase the user's larger preference. Recompute bounds after filtering, config import and GUI-scale/viewport changes, then clamp scroll offsets. Test empty, one-row, populated, filtered and oversized lists, last-row access and resize drags at multiple scales. Popup hit testing and clipping must agree with the layer actually drawn.
4. HUD / overlay system
- A HudModule subtype renders to the screen each frame from a shared anchor + offset model (anchor to a screen corner/edge/centre, then a dx/dy), so elements reposition correctly at any resolution. A WorldOverlay renders in world space via the projector. A shared backdrop draws each element's background/corner/padding from the Style page unless the element overrides it. A HUD editor screen lets the user drag elements, with snapping to screen edges/centre and to the hotbar, and a grid.
- A thin single-line readout base (
TextHud: label + value, with a Layout setting — label-first / value-first / value-only / bracketed) covers the dozens of trivial readouts (FPS, ping, coords, biome, speed, health…) with almost no per-module code. - Standard elements: watermark, FPS, CPS, keystrokes, coordinates, armor, potions, ping, target plate, radar, compass, rearview mirror, now-playing, nearby-players, combat-predictor, notifications. Make them adaptive — a combat layout in a fight, an explorer layout while roaming — switched off a shared combat/world state.
- A HUD-overrides layer can intercept and restyle or hide vanilla HUD elements (hotbar, scoreboard, boss bar, effect icons) so your HUD and the engine's don't double up.
- Recording mode — hide the client's own visuals for clean screen capture (HUD and/or world overlays), toggleable; pair with a name-protect / streamer mode that swaps your username out of all drawn text.
- Mining-stat HUD tip: distinguish session blocks, rolling BPS, average/peak windows, blocks/hour, runtime and inventory space visually. Label currency rates as net money/hour or net tokens/hour when their source is a balance delta. Show a warmup/unavailable state instead of an unstable early rate or a fake zero after a data gap; use an estimate/source label when counts come from locally predicted breaks. Parsing, baselines and calculation remain in the behavior layer; render an immutable snapshot rather than collecting scoreboard data in draw calls.
- Staff-list tip: show observed status, evidence strength, distance and time observed separately. A loaded player, unlisted profile, team-only match and recent departure should not all look like confirmed online staff. Keep uncertain labels visible even in compact mode; expiry/debounce belong to the shared detector backend.
- Diagnostic-status tip: display startup, ready, stopped, fallback and unavailable as distinct states. A retained sprint latch with its key released is normal, and a client Self-Flag heuristic is different from a named server check. UI wording should preserve those distinctions rather than promising “safe” or treating timeout as success.
- Auto-align to the screen side, don't make the user toggle it. A text/list element should read right- or
left-aligned based on which half of the screen its on-screen center sits in (
elementLeftX + scaledWidth/2 > screenW/2), recomputed each frame — so dragging it across the screen in the editor flips its alignment for free, with no "align" setting to set. The same idea drives which side an accent bar / health bar sits on. - The "arraylist" (active-module list), done right. Rows sorted by width (or alphabetical), name in bold + a dim
suffix (mode/value/keybind), each row a rounded backdrop. The detail that makes it look clean at tight spacing:
connected rows — round only the outer corners of the whole stack (top of the first row, bottom of the last)
and square the shared inner edges, with the accent bar running the straight edge — instead of per-row pills whose
different widths leave a ragged, mismatched-corner stack. Slide rows in/out on toggle through the one
Smooth.
Behavior note: what populates these elements (the combat state, the module list, the packet counters) is a
silentkit-modulesconcern; this skill is only how they're drawn and arranged.
5. Theming
- Define every color as a token on a theme object (bg, card, line, fg, dim, faint, accent, accent-2, good, warn,
bad). Components read tokens, never literals. One accent change re-skins the whole UI. A
Stylemodule owns these plus corner radius, padding, panel opacity, blur strength/quality, border/shadow toggles and the font roles, and is the single source every render path reads. - Support palette presets and a gradient accent editor, plus share codes (serialize the theme to a string to copy in/out) so a look travels like a config. Support a chroma (time-animated hue cycle) and gradient text mode for list elements, laid along the list so it flows.
- Blur-behind panels, soft shadows, and subtle motion sell "polished"; keep animation deliberate (one orchestrated open, hover micro-interactions) — scattered effects read as noise. Keep a config version on the style blob and migrate old keys forward (renamed fonts, changed defaults) so a saved theme survives a redesign.
6. Animation
A small animation toolkit keeps motion consistent and frame-rate-independent:
- A
Smoothvalue that exponentially approaches a target each frame on realdt(the same1 − e^(−rate·dt)approach the gameplay layer uses) — use it for every fade, slide, bar fill, and hover state so nothing is a per-tick step or FPS-dependent. - An easing library (smoothstep, cubic, back/overshoot) and a small keyframe
Animationdriver for one-shot orchestrated transitions (the menu open). Gate all of it behind a reduced-motion / animation-speed control.
7. Sounds & feedback
A small UI-sound layer (soft clicks, toggles, hover ticks) with a volume + pack setting. Pair with the toast / notification queue (a shared ring buffer rendered as sliding toasts) so actions confirm themselves (toggle → toast), and so module-toggle feedback can stand down when the on-screen module list already shows the change. Keep all of it behind a master "UI sounds" switch.
8. Keybind UX
- A keybind manager page: every bind on one screen, double-bound keys flagged, and press-a-key-to-find.
- Support multi-bind (one key toggling several modules), a "hold vs toggle" bind mode, and binding from the module row directly. Capture via a key-event overlay; store as engine-neutral key tokens. Route all binds through one manager so conflicts and hold-mode are handled in one place.
9. Optional: web / remote control surface
If the client has a backend, mirror the menu on the web: the client holds a lightweight heartbeat that pushes its current config to a per-user row and polls for edits; the website renders the same settings and patches one module at a time. Make web edits land only while the client is online. Show saved preference, connection status and active viewing as distinct states; persist preview pause/cadence at the intended browser scope and retain them across replacement connections. Backend authorization and viewing leases belong in the behavior/runtime layer. This also gives a natural home for a phone companion (push notifications, a live map, remote loadout switch) and an update notifier (compare versions server-side, toast the client). Keep the transport generic (any small key/value backend).
10. Composition checklist
- One render abstraction; one adapter per engine version; a world projector that captures the frame's real matrices.
- Settings are the single source of truth — the GUI renders them, it doesn't duplicate state.
- Collapse overlapping toggles that answer one question into a single enum. When several booleans gate the same behaviour at different strengths (e.g. "only with a target in range" / "only when the crosshair is on one" / "only once the aim has settled"), they confuse more than they empower and can be set to nonsensical combinations — replace them with one ordered mode ("Off / In Range / On Crosshair / Aim Ready") and show each dependent sub-setting only for the mode that uses it. Carry old config keys forward on load so existing presets don't silently change behaviour.
- Tokens for every color; one accent drives the theme; design both light and dark if the engine can be either; version and migrate the style/config blob.
- Panels persist their layout; snap + saved layouts; auto-arrange; pop-ups in a top-most layer.
- Badges + command palette + per-module filter make a big module set navigable.
- HUD elements are anchor-placed and adaptive; a trivial-readout base covers the long tail; a recording mode hides the client's own visuals.
- Every fade/slide goes through one frame-rate-independent
Smooth; reduced-motion respected.