Logo FSBarV1_Archived

Callbacks Module

Engine callback functions that query live game state via the HighBar V2 proxy. Each function sends a callback request over the Unix domain socket and returns the parsed result. All functions require an active NetworkStream connection to the proxy.

Functions and values

Function or value Description

getBuildOptions stream defId

Full Usage: getBuildOptions stream defId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    defId : int - The unit-definition ID of the builder.

Returns: int array An array of unit-definition IDs that this unit can build.

Queries the engine for the build options of a unit definition (what it can build).

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

defId : int

The unit-definition ID of the builder.

Returns: int array

An array of unit-definition IDs that this unit can build.

getBuildSpeed stream defId

Full Usage: getBuildSpeed stream defId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    defId : int - The unit-definition ID.

Returns: float32 Build speed value (higher means faster construction).

Queries the engine for the build speed of a unit definition.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

defId : int

The unit-definition ID.

Returns: float32

Build speed value (higher means faster construction).

getCornersHeightMap stream

Full Usage: getCornersHeightMap stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: float32 list Flat list of corner height values in row-major order.

Queries the engine for the corners heightmap as a flat list in row-major order. Returns (mapWidth+1) x (mapHeight+1) vertex-resolution height values suitable for constructing a MapGrid.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: float32 list

Flat list of corner height values in row-major order.

getEconomyCurrent stream resourceId

Full Usage: getEconomyCurrent stream resourceId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    resourceId : int - Resource index (0 = metal, 1 = energy).

Returns: float32 Current resource amount.

Queries the engine for the current stockpile of a resource.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

resourceId : int

Resource index (0 = metal, 1 = energy).

Returns: float32

Current resource amount.

getEconomyIncome stream resourceId

Full Usage: getEconomyIncome stream resourceId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    resourceId : int - Resource index (0 = metal, 1 = energy).

Returns: float32 Income rate per frame.

Queries the engine for the per-frame income rate of a resource.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

resourceId : int

Resource index (0 = metal, 1 = energy).

Returns: float32

Income rate per frame.

getEconomyStorage stream resourceId

Full Usage: getEconomyStorage stream resourceId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    resourceId : int - Resource index (0 = metal, 1 = energy).

Returns: float32 Maximum storage capacity.

Queries the engine for the maximum storage capacity of a resource.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

resourceId : int

Resource index (0 = metal, 1 = energy).

Returns: float32

Maximum storage capacity.

getEconomyUsage stream resourceId

Full Usage: getEconomyUsage stream resourceId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    resourceId : int - Resource index (0 = metal, 1 = energy).

Returns: float32 Usage rate per frame.

Queries the engine for the per-frame usage rate of a resource.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

resourceId : int

Resource index (0 = metal, 1 = energy).

Returns: float32

Usage rate per frame.

getGameStateSnapshot stream

Full Usage: getGameStateSnapshot stream

Parameters:
Returns: GameStateSnapshotResult

Issues one CALLBACK_GAME_GET_STATE = 15 RPC and returns a per-tick atomic snapshot: friendlies + LOS enemies + radar-only enemies + 8-field economy record (spec 045, HighBarV2 032). Replaces the legacy per-unit / per-enemy / per-resource refresh loop — exactly one RPC regardless of army size.

Raises ProxyVersionMismatchException when the proxy rejects callback 15 with "Unknown callback id" — no legacy fallback.

Raises InvalidOperationException with a descriptive message on other failures (cap exceeded, proxy error). The caller's prior GameState is left untouched; no partial application.

Raises EngineDisconnectedException on connection loss (unchanged).

stream : NetworkStream
Returns: GameStateSnapshotResult

getHeightMap stream

Full Usage: getHeightMap stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: float32 list Flat list of height values in row-major order.

Queries the engine for the full heightmap as a flat list in row-major order. The heightmap has dimensions (mapWidth) x (mapHeight) in heightmap squares.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: float32 list

Flat list of height values in row-major order.

getLosMap stream

Full Usage: getLosMap stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: int list Flat list of LOS values in row-major order.

Queries the engine for the line-of-sight map as a flat list in row-major order. Non-zero values indicate cells currently visible to our team.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: int list

Flat list of LOS values in row-major order.

getMapHeight stream

Full Usage: getMapHeight stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: int Map height in heightmap squares.

Queries the engine for the map height in heightmap grid squares (1 square = 8 elmos).

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: int

Map height in heightmap squares.

getMapWidth stream

Full Usage: getMapWidth stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: int Map width in heightmap squares.

Queries the engine for the map width in heightmap grid squares (1 square = 8 elmos).

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: int

Map width in heightmap squares.

getMaxWeaponRange stream defId

Full Usage: getMaxWeaponRange stream defId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    defId : int - The unit-definition ID.

Returns: float32 Maximum weapon range in elmos.

Queries the engine for the maximum weapon range of a unit definition.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

defId : int

The unit-definition ID.

Returns: float32

Maximum weapon range in elmos.

getMetalSpots stream

Full Usage: getMetalSpots stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: (float32 * float32 * float32 * float32) array An array of (x, y, z, metalValue) tuples in world coordinates.

Queries the engine for all metal extraction spots on the map. Each spot is returned as (x, y, z, value) where value indicates metal richness.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: (float32 * float32 * float32 * float32) array

An array of (x, y, z, metalValue) tuples in world coordinates.

getMyAllyTeam stream

Full Usage: getMyAllyTeam stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: int The integer ally-team ID for this AI's alliance group.

Queries the engine for this AI's ally-team ID.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: int

The integer ally-team ID for this AI's alliance group.

getMyTeam stream

Full Usage: getMyTeam stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: int The integer team ID assigned to this AI.

Queries the engine for this AI's team ID.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: int

The integer team ID assigned to this AI.

getRadarMap stream

Full Usage: getRadarMap stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: int list Flat list of radar coverage values in row-major order.

Queries the engine for the radar coverage map as a flat list in row-major order. Non-zero values indicate cells covered by our team's radar.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: int list

Flat list of radar coverage values in row-major order.

getResourceMap stream

Full Usage: getResourceMap stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: int list Flat list of resource density values in row-major order.

Queries the engine for the resource distribution map as a flat list in row-major order. Higher values indicate richer metal deposits.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: int list

Flat list of resource density values in row-major order.

getSlopeMap stream

Full Usage: getSlopeMap stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: float32 list Flat list of slope values (0.0 = flat, 1.0 = vertical) in row-major order.

Queries the engine for the slope map as a flat list in row-major order. The slope map has dimensions (mapWidth/2) x (mapHeight/2), at half heightmap resolution.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: float32 list

Flat list of slope values (0.0 = flat, 1.0 = vertical) in row-major order.

getStartPos stream teamId

Full Usage: getStartPos stream teamId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    teamId : int - The team ID to query the start position for.

Returns: float32 * float32 * float32 A tuple of (x, y, z) world coordinates in elmos.

Queries the engine for the start position of a given team.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

teamId : int

The team ID to query the start position for.

Returns: float32 * float32 * float32

A tuple of (x, y, z) world coordinates in elmos.

getUnitDef stream unitId

Full Usage: getUnitDef stream unitId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    unitId : int - The engine-assigned unit ID.

Returns: int The unit-definition ID that describes this unit's type.

Queries the engine for the unit-definition ID of a unit instance.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

unitId : int

The engine-assigned unit ID.

Returns: int

The unit-definition ID that describes this unit's type.

getUnitDefCost stream defId

Full Usage: getUnitDefCost stream defId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    defId : int - The unit-definition ID.

Returns: float32 The total resource cost of the unit.

Queries the engine for the resource cost of a unit definition.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

defId : int

The unit-definition ID.

Returns: float32

The total resource cost of the unit.

getUnitDefName stream defId

Full Usage: getUnitDefName stream defId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    defId : int - The unit-definition ID.

Returns: string The string name of the unit definition.

Queries the engine for the internal name of a unit definition (e.g., "armcom").

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

defId : int

The unit-definition ID.

Returns: string

The string name of the unit definition.

getUnitDefs stream maxCount

Full Usage: getUnitDefs stream maxCount

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    maxCount : int - Maximum number of unit-definition IDs to retrieve.

Returns: int array An array of unit-definition IDs.

Queries the engine for all available unit-definition IDs.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

maxCount : int

Maximum number of unit-definition IDs to retrieve.

Returns: int array

An array of unit-definition IDs.

getUnitHealth stream unitId

Full Usage: getUnitHealth stream unitId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    unitId : int - The engine-assigned unit ID.

Returns: float32 Current health points as a float.

Queries the engine for the current health of a unit.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

unitId : int

The engine-assigned unit ID.

Returns: float32

Current health points as a float.

getUnitMaxHealth stream unitId

Full Usage: getUnitMaxHealth stream unitId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    unitId : int - The engine-assigned unit ID.

Returns: float32 Maximum health points as a float.

Queries the engine for the maximum health of a unit.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

unitId : int

The engine-assigned unit ID.

Returns: float32

Maximum health points as a float.

getUnitPos stream unitId

Full Usage: getUnitPos stream unitId

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    unitId : int - The engine-assigned unit ID.

Returns: float32 * float32 * float32 A tuple of (x, y, z) world coordinates in elmos.

Queries the engine for the current world position of a unit.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

unitId : int

The engine-assigned unit ID.

Returns: float32 * float32 * float32

A tuple of (x, y, z) world coordinates in elmos.

Type something to start searching.