W3 / DevelopersSDK 4.6.0Source & examples ↗

SDK 4.4: interaction and interpolation

Install @w3booster/sdk@4.4.0, update your lockfile and rebuild. The matching W3Booster recorder, desktop and compositor supply these capabilities. Public numeric fields and protocol 4.0 remain unchanged.

Interactive overlay regions

Mark a container with w3-interactive; its visible rectangle and descendants consume mouse input by default. The rest of the screen remains click-through. The SDK initializes the bridge automatically for in-game launches. Apps without a data client can initialize it explicitly before registering event handlers:

import { initializeOverlayInput } from '@w3booster/sdk/overlay-input';

// Initialize before mounting application handlers. The in-game host activates it.
const interaction = initializeOverlayInput();
const button = document.createElement('button');
button.className = 'w3-interactive';
button.textContent = 'Settings';
document.body.append(button);

// On app teardown:
export function dispose() {
  button.remove();
  interaction.close();
}

Hidden, removed, disabled and moved elements update their regions automatically. Use data-w3-input="disabled" to disable a container. The class alone does not make an element draggable: implement a pointer drag and capture the pointer as usual. Input remains consumed through that gesture, including outside its region.

For conditional handling, add data-w3-input="conditional". Synchronous preventDefault(), stopPropagation() or stopImmediatePropagation() on pointerdown or mousedown consumes the gesture. Otherwise the host forwards the down and paired release to Warcraft. A click handler is too late to retract a down already delivered to the game. Install the bridge before application handlers. Native HTML drag-and-drop, touch and keyboard focus are outside this mouse contract. OBS/browser sources do not gain this input bridge.

The desktop displays a red dot at the bottom right when it consumes input. Click-through already enabled in Windows continues while Electron is busy. A frozen main process cannot switch an interactive window back to click-through until it recovers. See the full input contract for geometry, event ordering, cursors and hang limitations.

Health, mana and active progress

Render the existing current, remainingSeconds and progress values normally. The SDK derives immutable snapshots at 50 ms intervals using the recorder's 200 ms simulation-clock samples. It interpolates all observed unit health, hero mana, active production, construction and building upgrades. Queue membership, completion and unknown timers stay authoritative; reaching a numeric bound does not invent a completed unit or building.

Replay speed and pause changes use measured simulation clocks. Human power-building uses the engine's actual rate, not a guessed worker-count formula. Damage, mana spending and rate changes supply corrected anchors. Extrapolation is bounded to one second and stops on disconnect or stream gaps. Reconnects receive full state with current anchors. Do not add another prediction timer in your app.

The interpolation contract explains stale streams, clock domains and lifecycle behavior.

Inventory charges and native hero-bar space

Optional Hero.inventoryCharges aligns live remaining counts with inventory slots, including duplicate items. Zero is observed empty; missing values remain unavailable. Catalog ItemType.initialCharges describes normal starting capacity, not the live count. Optional GameContext.heroBarLastOccupiedSlot exposes the last occupied native portrait slot, preserving gaps and shared allied portraits. See the catalog guide and data model.