969c0480ba
Engine wire change: Report.battle switched from []uuid.UUID to
[]BattleSummary{id, planet, shots} so the map can place battle
markers without N extra fetches. FBS schema + generated Go/TS
regenerated; transcoder + report controller updated; openapi
adds the BattleSummary schema with a freeze test.
Backend gateway forwards engine GET /api/v1/battle/:turn/:uuid as
/api/v1/user/games/{game_id}/battles/{turn}/{battle_id} (handler
plus engineclient.FetchBattle, contract test stub, openapi spec).
UI:
- BattleViewer (lib/battle-player/) is a logically isolated SVG
radial scene that consumes a BattleReport prop. Planet at the
centre, races on the outer ring at equal angular spacing, race
clusters by (race, className) with <class>:<numLeft> labels;
observer groups (inBattle: false) are not drawn; eliminated
races drop out and survivors re-distribute on the next frame.
- Shot line per frame: red on destroyed, green otherwise; erased
on the next frame. Playback controls: play/pause + step ± +
rewind + 1x/2x/4x speed (400/200/100 ms per frame).
- Page wrapper (lib/active-view/battle.svelte) loads BattleReport
via api/battle-fetch.ts; synthetic-gameId prefix routes to a
fixture loader, otherwise REST through the gateway. Always-
visible <ol> text protocol satisfies the accessibility ask.
- section-battles.svelte links every battle UUID into the viewer.
- map/battle-markers.ts: yellow X cross of 2 LinePrim through the
corners of the planet's circumscribed square (stroke width
clamps from 1 px at 1 shot to 5 px at 100+ shots); bombing
marker is a stroke-only ring (yellow when damaged, red when
wiped). Wired into state-binding.ts; click handler dispatches
battle clicks to the viewer and bombing clicks to the matching
Reports row.
- i18n keys for the viewer in en + ru.
Docs: ui/docs/battle-viewer-ux.md, FUNCTIONAL.md §6.5 + ru
mirror, ui/PLAN.md Phase 27 decisions + deferred TODOs (push
event, richer class visuals, animated re-distribution).
Tests: Vitest unit (radial layout + timeline frame builder +
marker stroke formula + marker primitives), Playwright e2e for
the viewer (Reports link → viewer, playback step, not-found),
backend engineclient FetchBattle (200 / 404 / bad input), engine
openapi freezes (BattleReport, BattleReportGroup,
BattleActionReport, BattleSummary, Report.battle items).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
249 lines
4.3 KiB
Plaintext
249 lines
4.3 KiB
Plaintext
// report reflects model/report/Report data object
|
|
include "common.fbs";
|
|
|
|
namespace report;
|
|
|
|
table RouteEntry {
|
|
key:uint64;
|
|
value:string;
|
|
}
|
|
|
|
table TechEntry {
|
|
key:string;
|
|
value:float32;
|
|
}
|
|
|
|
table Route {
|
|
planet:uint64;
|
|
route:[RouteEntry];
|
|
}
|
|
|
|
table Player {
|
|
name:string;
|
|
drive:float32;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
population:float32;
|
|
industry:float32;
|
|
planets:uint16;
|
|
relation:string;
|
|
votes:float32;
|
|
extinct:bool;
|
|
}
|
|
|
|
table Science {
|
|
name:string;
|
|
drive:float32;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
}
|
|
|
|
table OtherScience {
|
|
race:string;
|
|
name:string;
|
|
drive:float32;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
}
|
|
|
|
table ShipClass {
|
|
name:string;
|
|
drive:float32;
|
|
armament:uint64;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
mass:float32;
|
|
}
|
|
|
|
table OthersShipClass {
|
|
race:string;
|
|
name:string;
|
|
drive:float32;
|
|
armament:uint64;
|
|
weapons:float32;
|
|
shields:float32;
|
|
cargo:float32;
|
|
mass:float32;
|
|
}
|
|
|
|
table ShipProduction {
|
|
planet:uint64;
|
|
class:string;
|
|
cost:float32;
|
|
prod_used:float32;
|
|
percent:float32;
|
|
free:float32;
|
|
}
|
|
|
|
table IncomingGroup {
|
|
origin:uint64;
|
|
destination:uint64;
|
|
distance:float32;
|
|
speed:float32;
|
|
mass:float32;
|
|
}
|
|
|
|
table Bombing {
|
|
number:uint64;
|
|
planet:string;
|
|
owner:string;
|
|
attacker:string;
|
|
production:string;
|
|
industry:float32;
|
|
population:float32;
|
|
colonists:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
attack_power:float32;
|
|
wiped:bool;
|
|
}
|
|
|
|
table UnidentifiedPlanet {
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
}
|
|
|
|
table UninhabitedPlanet {
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
size:float32;
|
|
name:string;
|
|
resources:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
}
|
|
|
|
table LocalPlanet {
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
size:float32;
|
|
name:string;
|
|
resources:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
industry:float32;
|
|
population:float32;
|
|
colonists:float32;
|
|
production:string;
|
|
free_industry:float32;
|
|
}
|
|
|
|
table OtherPlanet {
|
|
owner:string;
|
|
x:float32;
|
|
y:float32;
|
|
number:uint64;
|
|
size:float32;
|
|
name:string;
|
|
resources:float32;
|
|
capital:float32;
|
|
material:float32;
|
|
industry:float32;
|
|
population:float32;
|
|
colonists:float32;
|
|
production:string;
|
|
free_industry:float32;
|
|
}
|
|
|
|
table UnidentifiedGroup {
|
|
x:float32;
|
|
y:float32;
|
|
}
|
|
|
|
table OtherGroup {
|
|
number:uint64;
|
|
class:string;
|
|
tech:[TechEntry];
|
|
cargo:string;
|
|
load:float32;
|
|
destination:uint64;
|
|
origin:uint64 = null;
|
|
range:float32 = null;
|
|
speed:float32;
|
|
mass:float32;
|
|
}
|
|
|
|
table LocalGroup {
|
|
number:uint64;
|
|
class:string;
|
|
tech:[TechEntry];
|
|
cargo:string;
|
|
load:float32;
|
|
destination:uint64;
|
|
origin:uint64 = null;
|
|
range:float32 = null;
|
|
speed:float32;
|
|
mass:float32;
|
|
id:common.UUID (required);
|
|
state:string;
|
|
fleet:string;
|
|
}
|
|
|
|
table LocalFleet {
|
|
name:string;
|
|
groups:uint64;
|
|
destination:uint64;
|
|
origin:uint64 = null;
|
|
range:float32 = null;
|
|
speed:float32;
|
|
state:string;
|
|
}
|
|
|
|
// BattleSummary identifies one battle the report recipient
|
|
// participated in or could see on a planet. `planet` lets the map
|
|
// place a battle marker without fetching the full BattleReport;
|
|
// `shots` lets the marker scale its stroke with the protocol length.
|
|
table BattleSummary {
|
|
id:common.UUID (required);
|
|
planet:uint64;
|
|
shots:uint64;
|
|
}
|
|
|
|
table Report {
|
|
version:uint64;
|
|
turn:uint64;
|
|
width:uint32;
|
|
height:uint32;
|
|
planet_count:uint32;
|
|
race:string;
|
|
votes:float32;
|
|
vote_for:string;
|
|
player:[Player];
|
|
local_science:[Science];
|
|
other_science:[OtherScience];
|
|
local_ship_class:[ShipClass];
|
|
other_ship_class:[OthersShipClass];
|
|
battle:[BattleSummary];
|
|
bombing:[Bombing];
|
|
incoming_group:[IncomingGroup];
|
|
local_planet:[LocalPlanet];
|
|
ship_production:[ShipProduction];
|
|
route:[Route];
|
|
other_planet:[OtherPlanet];
|
|
uninhabited_planet:[UninhabitedPlanet];
|
|
unidentified_planet:[UnidentifiedPlanet];
|
|
local_fleet:[LocalFleet];
|
|
local_group:[LocalGroup];
|
|
other_group:[OtherGroup];
|
|
unidentified_group:[UnidentifiedGroup];
|
|
}
|
|
|
|
// GameReportRequest is the signed-gRPC request payload for
|
|
// `MessageTypeUserGamesReport`. Gateway transcodes this into the
|
|
// engine's `?player=&turn=` query string after resolving the caller's
|
|
// race name from the runtime player mapping; only `game_id` and `turn`
|
|
// travel on the wire.
|
|
table GameReportRequest {
|
|
game_id:common.UUID (required);
|
|
turn:uint32;
|
|
}
|
|
|
|
root_type Report;
|