How lihua23410/xqdj works
小球对战 is a local 1v1 spectator simulator: a browser chooses two fighters and a required field, then watches the Go engine advance the match and stream snapshots over WebSocket. main.go owns HTTP/WebSocket handling; internal/sim owns match state and collision simulation, while fighters and fields register through internal/unit. The browser renders snapshots and effects. The README also documents a headless win-rate matrix. Some subsystem links rely on README descriptions because their source was not sampled.
Main entry points: match.go Match state · main.go HTTP and WS · app.js Selection and renderer · unit Actor protocol
Components 13
Server orchestration
- HTTP and WS
main.go - Win-rate runner
cmd/winrate/main.go
Match engine
- Match state
internal/sim/match.go - Collision physics
internal/sim/physics.go - Actor protocol
internal/unit
Fighters and fields
- Fighter packs
character - Field packs
map
Browser display
- Embedded web assets
internal/web/embed.go - Selection and renderer
internal/web/app.js - Fighter effects
character
Other components
- Spectator
- WebSocket client
- Win-rate report
Connections 16
- Spectator → Selection and renderer: selects match
- Selection and renderer → WebSocket client: sends commands
- WebSocket client → HTTP and WS: WebSocket messages
- HTTP and WS → Match state: routes commands
- HTTP and WS → Embedded web assets: serves assets
- HTTP and WS → WebSocket client: broadcasts snapshots
- Match state → Collision physics: advances collisions
- Match state → Actor protocol: uses protocol
- Match state → Field packs: loads field registry
- Fighter packs → Actor protocol: registers actors
- Field packs → Actor protocol: registers fields
- Match state → Fighter packs: dispatches actors
- WebSocket client → Selection and renderer: delivers snapshots
- Selection and renderer → Fighter effects: loads pack effects
- Win-rate runner → Match state: runs matches
- Win-rate runner → Win-rate report: writes results