Skip to content

Commit d38f643

Browse files
committed
docs: add CLAUDE.md for development guidance and architecture overview
1 parent cf5a1a4 commit d38f643

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed

CLAUDE.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Common Development Commands
6+
7+
### Building and Running
8+
9+
```bash
10+
# Build all binaries and frontend
11+
make install
12+
13+
# Run the game controller
14+
go run cmd/ssl-game-controller/main.go
15+
16+
# Run with hot-reload development mode
17+
make dev
18+
19+
# Build frontend only
20+
cd frontend && npm run build
21+
22+
# Run frontend development server
23+
cd frontend && npm run dev
24+
```
25+
26+
### Testing and Quality
27+
28+
```bash
29+
# Run all Go tests
30+
make test
31+
32+
# Run frontend linting
33+
cd frontend && npm run lint
34+
35+
# Run frontend type checking
36+
cd frontend && npm run type-check
37+
```
38+
39+
### Protocol Buffer Generation
40+
41+
```bash
42+
# Regenerate protobuf code after modifying .proto files
43+
make proto
44+
```
45+
46+
### Docker
47+
48+
```bash
49+
# Build Docker images for game controller and ref client
50+
make docker
51+
52+
# Run complete test environment with autoRefs
53+
docker compose up
54+
```
55+
56+
## Architecture Overview
57+
58+
This is the SSL Game Controller for RoboCup Small Size League - a Go backend with Vue.js frontend that manages robot
59+
soccer matches.
60+
61+
### Core Components
62+
63+
**Game Engine** (`internal/app/engine/`): Central state machine that processes all game state changes through a
64+
queue-based system. Maintains current match state and coordinates with various processors for rule enforcement.
65+
66+
**State Machine** (`internal/app/statemachine/`): Translates change requests into new game states. Handles all game
67+
transitions including commands, stages, cards, and game events.
68+
69+
**State Store** (`internal/app/store/`): Append-only persistent storage for all state changes, enabling replay and
70+
revert functionality.
71+
72+
**Communication Layers**:
73+
74+
- Frontend communicates via WebSocket API (`/api/control`) using protobuf messages
75+
- External clients connect via TCP with protobuf protocols for teams, autorefs, remote control, and CI integration
76+
- UDP multicast publishes referee messages to all match participants
77+
78+
### Key Protocols
79+
80+
**Client Types** (all in `proto/rcon/`):
81+
82+
- `ssl_gc_rcon_team.proto`: Team communication (timeouts, substitutions, advantage choice)
83+
- `ssl_gc_rcon_autoref.proto`: Automated referee game event proposals
84+
- `ssl_gc_rcon_remotecontrol.proto`: Manual referee control
85+
- `ssl_gc_ci.proto`: CI integration for testing
86+
87+
**Core Data** (in `proto/state/`):
88+
89+
- `ssl_gc_state.proto`: Complete game state representation
90+
- `ssl_gc_game_event.proto`: 80+ types of game events and violations
91+
- `ssl_gc_referee_message.proto`: Standard SSL referee message format
92+
93+
### Frontend Structure
94+
95+
**Technology**: Vue.js 3 + TypeScript + Quasar UI framework
96+
**State Management**: Pinia stores in `frontend/src/store/`
97+
**Components**: Organized by feature in `frontend/src/components/`
98+
99+
- `control/`: Manual game control buttons
100+
- `match/`: Live match display and event management
101+
- `team/`: Team-specific settings and information
102+
- `game-events/`: Game event input forms and displays
103+
104+
### Adding New Teams
105+
106+
For new teams, add the team name to `defaultTeams` in `internal/app/engine/config.go` and submit a pull request.
107+
108+
### Development Modes
109+
110+
**System Mode** (default): Uses system time
111+
**Vision Mode**: Uses ssl-vision timestamps for simulation integration
112+
**CI Mode**: Full control via TCP for automated testing - recommended for simulator integration
113+
114+
CI mode enables:
115+
116+
- No multicast network traffic (set `network.publish-address` to empty)
117+
- Controlled data flow and timing
118+
- Direct ssl-vision tracking data input
119+
- Integration with test frameworks
120+
121+
### External Dependencies
122+
123+
- **ssl-vision**: Provides field geometry (required)
124+
- **Tracker source**: Ball/robot positions for advanced rule checking (TIGERs AutoRef or ER-Force AutoRef)
125+
126+
Without tracker source, the following features are disabled:
127+
128+
- Ball placement progress checking
129+
- Robot count validation
130+
- Game continuation readiness
131+
- No progress detection
132+
- Goalkeeper change validation

0 commit comments

Comments
 (0)