Logo FSBarV1_Archived

LobbyConfig Module

Lobby builder types + validation + projection onto the existing FSBar.Client.EngineConfig / ScriptGenerator path. The hub lets users configure arbitrary team counts, mixed AI / human / spectator seats, and game modes (Skirmish / FFA / Team). The data model here is richer than what ScriptGenerator currently emits — the existing generator produces a fixed two-team AI-vs-AI skirmish script. `toEngineConfig` collapses a validated lobby down to that shape, and enforces any excess structure via a Phase-3 restriction documented on the `toEngineConfig` signature below. US4 / US-Team / US-FFA expansions widen the adapter as the generator learns to emit more elaborate scripts.

Types

Type Description

GameMode

Skirmish = a single match, two or more allied groupings. FFA = every team is exactly one seat; requires >= 3 teams. Team = explicit team-vs-team scoring.

LobbyConfig

The full lobby shape captured in `HubSettings.LastLobby` (Phase 3 will extend `HubSettings` with this field) and handed to `SessionManager.Launch`.

LobbyError

Validation failures. `validate` returns every failure it finds so the UI can render a single coherent error list per AS-1.3.

Seat

One participant in a `Team`. Handicap ∈ [-100, 100].

SeatKind

A seat is either an AI entry (with a configurable options map) or a human entry (just a player name — v1 does not drive real human connections, but the data model leaves room).

Spectator

A spectator seat — watches but does not play.

Team

One allied grouping. `AllyTeamId` groups teams that share victory conditions — two `Team`s with the same `AllyTeamId` are allies.

Functions and values

Function or value Description

defaults

Full Usage: defaults

Returns: LobbyConfig

Factory value: map empty (user must pick one), Skirmish mode, 1x speed, no graphical viewer, two teams each with one AI seat (team 0 = HighBarV2 / Armada, team 1 = BARb / Cortex), no spectators. The validator still rejects this value because `MapName = ""` fails the map-installed check.

Returns: LobbyConfig

formatError arg1

Full Usage: formatError arg1

Parameters:
Returns: string

Human-readable rendering of a `LobbyError`. Used by the Setup tab's error list and by diagnostics logs.

arg0 : LobbyError
Returns: string

toEngineConfig install config

Full Usage: toEngineConfig install config

Parameters:
Returns: Result<EngineConfig, LobbyError>

Collapses a validated lobby to an `FSBar.Client.EngineConfig` suitable for the existing script generator. **Phase-3 restriction**: the caller must have passed `validate` first *and* the lobby must be a simple 2-team, one-AI-seat-per- team skirmish. Human seats, spectators, >2 teams, or mode != Skirmish yield an `AdapterUnsupportedShape` error. When the generator learns richer scripts this function widens.

install : BarInstall
config : LobbyConfig
Returns: Result<EngineConfig, LobbyError>

validate install config

Full Usage: validate install config

Parameters:
Returns: Result<LobbyConfig, LobbyError list>

Returns the full list of validation failures. Errors are grouped roughly by increasing specificity — structural failures first, then per-seat, then mode-specific rules.

install : BarInstall
config : LobbyConfig
Returns: Result<LobbyConfig, LobbyError list>

Type something to start searching.