Modify BattleRunner.java to connect to external server and emit structured output #133

Closed
opened 2026-08-30 11:38:43 +02:00 by SirStone · 2 comments
Owner

Wayfinder child of: #126

Context

The current tools/battle_runner/RunBattle.java uses BattleRunner.create() with .embeddedServer(). The test framework (#126) needs it to connect to an external TR server (started separately by the Nim framework with -I flag) and print structured output to stdout that Nim can parse.

Requirements

  • Modify BattleRunner.create() to connect to an external server URL (passed as CLI arg or env var)
  • Define a structured stdout output format (recommend JSON-lines) that includes: round results, winners, scores, per-bot results, total ticks
  • This output format is the contract that #127's parser implements — co-design them
  • Accept battle configuration as CLI args: bot paths, number of rounds, arena size
  • Exit cleanly when battle completes

Blocked by

Nothing

Blocks

#127, #130

## Wayfinder child of: #126 ### Context The current `tools/battle_runner/RunBattle.java` uses `BattleRunner.create()` with `.embeddedServer()`. The test framework (#126) needs it to connect to an **external** TR server (started separately by the Nim framework with `-I` flag) and print structured output to stdout that Nim can parse. ### Requirements - Modify `BattleRunner.create()` to connect to an external server URL (passed as CLI arg or env var) - Define a structured stdout output format (recommend JSON-lines) that includes: round results, winners, scores, per-bot results, total ticks - This output format is the **contract** that #127's parser implements — co-design them - Accept battle configuration as CLI args: bot paths, number of rounds, arena size - Exit cleanly when battle completes ### Blocked by Nothing ### Blocks #127, #130
SirStone added the wayfinder:map label 2026-08-30 11:38:50 +02:00
Author
Owner

Spec addition from grilling

The structured stdout format is the contract between Java and Nim. Recommend JSON-lines, one JSON object per event:

  • {"event":"ready"} — server connected
  • {"event":"round_end","round":1,"results":[{"name":"Bot1","score":100,"rank":1},...]}
  • {"event":"battle_end","winners":["Bot1"],"total_rounds":10,"results":[...]}

This format must be co-designed with #127 (the Nim parser). Implement parser and emitter together or define the schema first.

BattleRunner process timeout: 30s after last output line.

## Spec addition from grilling The structured stdout format is the **contract** between Java and Nim. Recommend JSON-lines, one JSON object per event: - `{"event":"ready"}` — server connected - `{"event":"round_end","round":1,"results":[{"name":"Bot1","score":100,"rank":1},...]}` - `{"event":"battle_end","winners":["Bot1"],"total_rounds":10,"results":[...]}` This format must be co-designed with #127 (the Nim parser). Implement parser and emitter together or define the schema first. BattleRunner process timeout: **30s** after last output line.
SirStone added wayfinder:task and removed wayfinder:map labels 2026-08-30 11:48:28 +02:00
Author
Owner

Implemented in commit 57a1915.

Implemented in commit 57a1915.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SirStone/SirRoboGarage#133