Logo FSBarV1_Archived

FSBar.Client Namespace

Type/Module Description

AdminChannel

Low-level client for the Spring/Recoil engine's autohost UDP interface (feature 039, see specs/039-hub-admin-channel/contracts/autohost-wire.md). Owns a single UdpClient bound on 127.0.0.1, encode/decode, and a receive pump on a dedicated thread. Intended to be consumed by FSBar.Hub.AdminChannelHost, which layers coalescing and hub-level status semantics on top.

ArchiveCache

Parses the engine-generated `ArchiveCache20.lua` to recover the engine-registered map name for each installed `.sd7` map archive. The engine does NOT accept archive filename stems as the `MapName` in start scripts — it requires the map's *declared* name (e.g. "Avalanche 3.4"), which is typically `name_pure + " " + version` but can include bespoke formatting inside `mapinfo.lua`. The engine's archive cache is the authoritative source for this string; this module mirrors the exact value the engine will match against at start time.

BarClient (Module)

Convenience module functions for creating and starting BarClient instances.

BarClient (Type)

High-level client for orchestrating a BAR AI game session. Manages the full lifecycle: engine launch, proxy connection, handshake, frame stepping, and cleanup.

BasePlan (Module)

Declarative building layout: resolves named slot lists into placement decisions that honour terrain, clearance, builder reach, and wall-in constraints.

BasePlan (Type)

A named, reusable base plan consumed by resolvePlan.

Callbacks

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.

Chokepoint

A detected chokepoint descriptor.

ChokepointId

Stable identifier for a chokepoint, derived deterministically from the grid dimensions and ridge cell index. Two calls to findChokepoints with the same inputs produce the same Id values.

ChokepointQuery

Query parameters bounding a chokepoint search.

Chokepoints

Distance-transform-based chokepoint detection. Returns stable-ID, width-annotated descriptors for corridors that approach a specified base centre.

Commands

Connection

DiscoveredEngine

Represents a validated engine installation found during directory scanning.

DiscoveredGame

Represents a resolved game version from the rapid versioning system.

EconomyRecordSnapshot

Eight-field resource snapshot returned inside a GameStateSnapshotResult.

EconomySnapshot

Snapshot of a single resource type's economy.

EngineConfig (Module)

Functions for creating and querying EngineConfig values.

EngineConfig (Type)

Configuration record for a BAR engine session. Controls engine launch parameters, socket communication, game setup (map, factions, opponent), and timeout behavior.

EngineDisconnectedException

EngineDiscovery

Functions for discovering and resolving BAR engine installations.

EngineLauncher

EngineMode

Specifies whether the BAR engine runs headless (no GUI) or with a graphical window.

EngineResolution

The result of the full engine resolution process.

Events

Functions for converting protobuf engine events to typed GameEvent values.

FriendlyUnitSnapshot

Friendly unit entry in a GameStateSnapshotResult (spec 045).

GameEvent

Discriminated union representing all game events that the BAR engine can emit during an AI session. Each case corresponds to a protobuf event from the HighBar V2 proxy.

GameFrame

A single simulation frame received from the engine, containing the frame number and all events that occurred during that frame.

GameState (Module)

Functions for creating and updating game state.

GameState (Type)

Central game state record, updated each frame from the event stream.

GameStateSnapshotResult

Per-tick atomic game-state snapshot returned by CALLBACK_GAME_GET_STATE = 15. Replaces the legacy per-unit / per-enemy / per-resource refresh loop in GameState.processEvent's GameEvent.Update branch.

HandshakeInfo

LosEnemySnapshot

LOS-visible enemy entry in a GameStateSnapshotResult. Has a concrete Health because the engine reports it.

MapCache

Thread-safe caching layer for MapGrid and passability data. Avoids redundant engine callbacks by caching results using Lazy for safe concurrent access.

MapCacheFile

 Persistent, file-based cache for static per-map analysis primitives.

 Distinct from  — that module is a
 thread-safe in-memory session cache for engine-callback round-trips.
 This module serialises  plus the
 chokepoint list to a deterministic JSON file on disk so a fresh clone
 of the repository can load a precomputed analysis in under 25 ms
 instead of spending ~250 ms re-parsing the .sd7 at every trainer start.

 Feature: specs/026-permanent-map-cache/
 Clarifications:
   - Staleness detection: manual integer codeVersion, exact match.
   - Mismatch policy: hard abort via LoadError (no fallback).
   - CI enforcement: out of scope; runtime abort is the backstop.

MapGrid (Module)

Functions for loading, refreshing, and querying MapGrid data. Provides terrain classification, passability analysis, and active patterns for pattern matching.

MapGrid (Type)

Bundled map data layers from the BAR engine, stored as 2D arrays. Contains height, slope, resource, line-of-sight, and radar data. Dimensions are in heightmap grid squares unless otherwise noted.

MapQuery

Elmo-coordinate query functions for MapGrid data. All functions accept world-space elmo coordinates and handle the conversion to grid indices internally.

MoveType

Unit movement type for passability computation. Each type has different slope and water traversal thresholds.

OwnStructureFootprint

Footprint of a placed own structure used as an impassable mask overlay when pathing. Consumed by both Pathing and WallIn.

Path

A resolved path from start to goal (or a partial path under budget exhaustion).

PathBudget

Search budget limiting wall-clock time, node expansions, and slope weighting.

PathFailure

Reasons findPath can return Error.

Pathing

Slope-aware A* pathing over a MapGrid with friendly-structure masking. Pure over inputs; never blocks beyond the configured budget.

PathStatus

Completion status of a findPath call.

PlanProgress

Plan-consumption state. Immutable — replaced after each incremental resolve.

PlanSlot

One structure slot in a named plan.

PositionChooser

Strategy for picking a slot's world position during plan resolution.

Protocol

ProtocolMismatchException

Raised by Protocol.sendCallback when CallbackResponse.RequestId does not match the in-flight CallbackRequest.RequestId. Distinct from EngineDisconnectedException so callers can tell "proxy sent the wrong response" apart from "socket went away".

ProxyVersionMismatchException

Raised when the HighBar proxy does not advertise a callback id that FSBar requires (currently only CALLBACK_GAME_GET_STATE = 15 from spec 045). Pre-0.1.5 proxies reject callback 15 with "Unknown callback id" and the session terminates — no legacy fallback. RequiredVersion names the minimum HighBarV2 proxy version in the message ("0.1.5").

RadarOnlyEnemySnapshot

Radar-only enemy entry in a GameStateSnapshotResult. Carries NO Health field by design — radar contacts cannot have a concrete health value and callers must never synthesize one.

ResolutionSource

Indicates how the engine was resolved.

ResolveContext

Inputs to resolvePlan packaged so callers can pre-compute expensive values (chokepoints, metal spots) once and reuse them across successive resolve calls.

ResolvedSlot

Output of resolvePlan: one record per input slot.

ScriptGenerator

Generates Spring engine startup scripts from an EngineConfig.

SessionState

Represents the lifecycle state of a BarClient session.

SlotFailure

Reason a slot failed to resolve. Used for diagnostic logging and retry decisions.

SmfMap

A parsed Spring Map File (SMF). Structurally compatible with MapGrid so downstream primitives can consume either source without branching.

SmfParseError

Errors surfaced by the SMF parser. Callers pattern-match for diagnostics.

SmfParser

Parses BAR Spring Map Files (.sd7 / .smf) from disk into an SmfMap value that downstream primitives can consume without a running engine.

Terrain

Terrain classification based on height and slope data. Used to categorize map cells for AI decision-making.

TrackedEnemy

A known enemy unit tracked by the game state.

TrackedUnit

A friendly unit tracked by the game state.

UnitDefCache (Module)

Functions for loading and querying unit definitions.

UnitDefCache (Type)

Cache of all unit definitions, providing instant lookup by ID or name.

UnitDefInfo

Cached unit definition data loaded from the engine at initialization.

WallIn

Pure connectivity predicate that shares passability rules with Pathing. Used by BasePlan.resolvePlan and directly by bots evaluating ad-hoc placements.

WallInQuery

Query parameters controlling wouldWallIn semantics.

WallInReason

Why a proposed placement would wall in the base.

WallInResult

Result of a wouldWallIn check.

Type something to start searching.