BattleHandle

Handle for an in-progress asynchronous battle.

Provides typed event access for real-time observation and control methods for battle management. Obtain via BattleRunner.startBattleAsync.

Must be closed when the battle is done to release bot processes and allow subsequent battles on the same BattleRunner.

Properties

Link copied to clipboard

Fires periodically (every 500 ms) and on every BotListUpdate during the boot phase, reporting how many bots have connected versus how many are expected.

Link copied to clipboard
val onBotListUpdate: Event<BotListUpdate>

Fires when the connected bot list changes.

Link copied to clipboard
val onGameAborted: Event<GameAbortedEvent>

Fires when the game is aborted.

Link copied to clipboard
val onGameEnded: Event<GameEndedEvent>

Fires when the game ends with final results.

Link copied to clipboard
val onGamePaused: Event<GamePausedEvent>

Fires when the game is paused.

Link copied to clipboard
val onGameResumed: Event<GameResumedEvent>

Fires when the game resumes from pause.

Link copied to clipboard
val onGameStarted: Event<GameStartedEvent>

Fires when the game starts (all bots ready).

Link copied to clipboard
val onRoundEnded: Event<RoundEndedEvent>

Fires when a round ends.

Link copied to clipboard
val onRoundStarted: Event<RoundStartedEvent>

Fires when a new round begins.

Link copied to clipboard
val onTickEvent: Event<TickEvent>

Fires on each game tick with full observer state.

Link copied to clipboard
val serverFeatures: Features?

Server features advertised during the handshake. Available immediately after the battle handle is obtained from BattleRunner.startBattleAsync.

Functions

Link copied to clipboard

Blocks until the battle completes and returns structured results.

Link copied to clipboard
open override fun close()

Unsubscribes internal event handlers and releases the battle slot.

Link copied to clipboard

Takes the server out of debug mode, returning to normal auto-advancing. Equivalent to calling resume, which also implicitly disables debug mode.

Link copied to clipboard

Puts the server into debug mode: after each turn is processed the server pauses and waits for nextTurn before advancing. Use disableDebugMode or resume to exit.

Link copied to clipboard
fun nextTurn()

Advances one turn while paused (single-step debugging).

Link copied to clipboard
fun pause()

Pauses the battle.

Link copied to clipboard
fun resume()

Resumes a paused battle.

Link copied to clipboard
fun setBotPolicy(botId: Int, breakpointEnabled: Boolean? = null, debuggingEnabled: Boolean? = null)

Sends a bot-policy-update for the given bot.

Link copied to clipboard
fun stop()

Stops the battle.