Scripting from another language
You do not need F# to drive an FSBar Hub session. The Hub's scripting
surface is a plain gRPC service, fsbar.hub.scripting.v1, reachable on
loopback. This page walks a non-F# reader from "what are the proto
files" to "first live frame" in a new language of choice.
A runnable Python reference lives at
scripts/examples/python/hub_full_client.py.
The F# sibling is
scripts/examples/24-hub-full-client.fsx.
Where the proto files live
All wire contracts for the scripting surface are authored as .proto
files in this repo. They are the authoritative schema — every F#
and non-F# client alike generates bindings from them.
Path |
Contents |
|---|---|
|
The |
|
|
|
|
|
Shared enums + helper messages referenced transitively. |
Generate against the entire proto/ tree — the files import each
other, so partial codegen will fail.
Per-language codegen
Run the commands from the repo root. Output directories are
created automatically when the tool supports it, otherwise create them
first (mkdir -p <dir>).
Language |
Codegen command |
Output lands in |
|---|---|---|
Python (required row) |
|
|
Go |
|
|
TypeScript / Node |
|
in-memory service descriptor; no files on disk |
Alternative worth knowing: buf generate (uses buf.gen.yaml) wraps
any of the above with configuration files; we document the raw
protoc path here to keep the moving parts minimal.
Connect to the Hub
The Hub scripting service is loopback-only, insecure — no TLS, no auth. Remote or authenticated scripting is out of scope today. Target:
|
You must raise the channel's send and receive message-size caps to
64 MiB. Map-data responses (GetHeightmap, GetSlopeMap, …) exceed
the default 4 MiB gRPC cap on any non-trivial SupportedMap.
Python one-liner:
|
The equivalent option names in other stacks:
Stack |
Option |
|---|---|
Go ( |
|
Node ( |
|
F# / .NET |
|
RPC catalog
The scripting surface groups into five capability families. The full
authoritative list lives in proto/hub/scripting.proto; this table is
a planning view.
1. Session lifecycle
Configure a lobby, launch a session, manage engine speed, stop.
RPC |
Kind |
Purpose |
|---|---|---|
|
unary |
Set map, teams, AI seats. |
|
unary |
Dry-run validation without mutating Hub state. |
|
unary |
Start the engine; returns a |
|
unary |
Force-stop the running session. |
|
unary |
Autohost admin channel (feature 039 anchor). |
2. State + events stream
One server-streaming RPC carries both decoded per-tick state and typed gameplay events. Feature 046 FR-001 / FR-002 anchor.
RPC |
Kind |
Purpose |
|---|---|---|
|
server-streaming |
Each |
3. Map data
All grids read from the warmup-cached RunningSession.MapGrid +
MetalSpots. Feature 046 FR-004 / FR-006 anchor. Because grids are
repeated float / repeated int32 with width + height, you
need the 64 MiB channel caps.
RPC |
Kind |
Purpose |
|---|---|---|
|
unary |
|
|
unary |
Row-major heights. |
|
unary |
Half-resolution slope grid. |
|
unary |
Visibility grids. |
|
unary |
Engine resource-intensity grid. |
|
unary |
|
4. Unit-def queries
Feature 046 FR-005 anchor — merges the BarData encyclopedia with the
live UnitDefCache.
RPC |
Kind |
Purpose |
|---|---|---|
|
unary |
Legacy slim |
|
unary |
Full |
5. Command submission
Feature 046 FR-007 anchor.
RPC |
Kind |
Purpose |
|---|---|---|
|
unary |
Single |
|
unary |
Up to 1024 |
Enemy health discriminator
EnemyUnitState.health_info is a proto oneof with exactly two arms:
|
Totality (feature 046 FR-003): exactly one arm is always set. Treat the three cases distinctly — do not collapse them:
Case |
Meaning |
|---|---|
|
Enemy currently visible ( |
|
Enemy visible and dying this tick — not the same as "unknown". |
|
Radar-only contact (def may or may not be disclosed) or a frozen last-known position after the enemy dropped from both LOS and radar. |
Always match on the oneof (e.g. in Python, msg.WhichOneof("health_info")).
A client that reads the health field without checking presence will
see 0.0 for radar-only enemies and silently misclassify them as dead.
See also
scripts/examples/24-hub-full-client.fsx— F# sibling walkthrough for the same five capability families.scripts/examples/python/hub_full_client.py— runnable Python reference.scripts/examples/python/README.md— Python prerequisites + expected output + troubleshooting.proto/hub/scripting.proto— authoritative service + message definitions.proto/highbar/*.proto— shared envelope + command types.
FSBarV1_Archived