summaryrefslogtreecommitdiff
path: root/serve/RACE_NOTES.md
blob: c2cfab92fce9e38159d503f85d4bed1722aa109b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# ЖОПО-СВО: ЗАБЕГ — race mode (added 2026-07-10)

SERVER (mp_server.py): authoritative race.
- init_race(): NCP=8 checkpoints in a ring, snapped to land, y=groundH+~30.
- FSM race["st"]: idle -> countdown(4s) -> racing -> done(14s) -> idle. Auto-starts when >=1 posed player.
- race_loop() @10Hz judges passes: horizontal <CP_R(28) & |dy|<CP_VR(60) -> advance cp; NCP*LAPS -> finish+time.
- Broadcasts {t:'race', st,cd,clock,laps,ncp,cps,stand,results}. Sends full snapshot to new joiner.
- Stores player dy (altitude) from state msg. LAPS=2, TIME_LIMIT=240.

CLIENT (serve/index.html, in the game <script> block):
- rcBuild/rcUpdate/rcTick + rcHud DOM. Gates = torus rings, g.lookAt(next) so you fly through.
  Active (next) gate = green pulsing. HUD: countdown / РУБЕЖ x/8·круг·место·дист / СВОДКА С ФРОНТА.
- hooks: onmessage +welcome(rcMyId) +race(rcUpdate); tick() calls rcTick().

VERIFIED headless: test_race.py flies a mock drone through all gates x2 laps -> done+results PASSED.
Client logic run against real server msgs (vm+stubs): 8 gates built, all 3 HUD states render.

RUN: python3 mp_server.py  -> http://127.0.0.1:8790
TODO next (war hazards over the skeleton): залп sweep section, herd as chicane, eruption = arty strike + updraft.