Skip to main content

User Interface

HELIX uses the WebUI system to render user interfaces. Your HUD, menus, scoreboards, and any other UI elements are built with standard HTML, CSS, and JavaScript, then displayed as an overlay inside the game. If you can build a webpage, you can build a HELIX UI.

Creating a WebUIโ€‹

A WebUI instance loads an HTML file (or URL) and displays it on the player's screen. The constructor takes a unique name for logging, a path to the HTML file or URL, and an optional input mode.

Blueprintโ€” Create a WebUI from a local HTML fileScroll to zoom ยท Drag to pan ยท Drag nodes to move
Event BeginPlayCreate WebUIName"MyHUD"HTML Path"MyPackage/UI/hud.html"WebUI

The first parameter is a unique name used for logging. The second is the HTML file path (relative to your package) or a full URL. An optional third parameter sets the input mode: 0 = Game Only, 1 = UI Only, 2 = Game and UI.

Communicating: Game to UIโ€‹

The real power of WebUI comes from the two-way communication between your game scripts and the HTML interface. Use SendEvent to send data from your game code into the UI's JavaScript.

Blueprintโ€” Send health data to the UIScroll to zoom ยท Drag to pan ยท Drag nodes to move
Event BeginPlaySend EventTargetMyHUDEvent Name"UpdateHealth"DataHealthData

The UI receives these events through the browser's message event system.

Communicating: UI to Gameโ€‹

Your UI can also send events back to the game -- perfect for menu button clicks, settings changes, or form submissions. Use RegisterEventHandler on the WebUI instance to listen for events sent from the HTML side.

Blueprintโ€” Register a UI event handler for respawnScroll to zoom ยท Drag to pan ยท Drag nodes to move
On WebUI Event: RequestRespawnArgumentCallbackRespawn Player

Input Focusโ€‹

When a UI element needs keyboard/mouse input (like a text field or a menu), you control the input mode on the WebUI instance. The input modes are: 0 = Game Only (no UI input), 1 = UI Only (full input to UI), 2 = Game and UI (mouse focus shared).

Blueprintโ€” Toggle input mode between UI and gameScroll to zoom ยท Drag to pan ยท Drag nodes to move
Event BeginPlaySet Input ModeTargetMyHUDMode1 (UI Only)Set Input ModeTargetMyHUDMode0 (Game Only)
tip

Keep your UI lightweight. Since WebUI runs in a browser engine, heavy DOM manipulation or large frameworks can impact frame rate. Vanilla JS or a lightweight library like Preact works great.

โœจ