5 Commits

Author SHA1 Message Date
Vladyslav Doloman
352da0ef54 Plan: refine networking — hybrid per-snake TLV selection, PART framing details, apples only in first part, and 1200-byte safety budget
- Clarify TLV selection between 2-bit and RLE per snake
- Define PART inner_type for STATE_FULL/STATE_DELTA and merging by update_id
- Apples included only in the first part (full and delta)
- Recommend ~1200-byte post-compression budget (<=1280 hard cap)
2025-10-07 20:46:16 +03:00
Vladyslav Doloman
65bf835b8d Plan: adopt live config updates + spawn/edge/compression/browser decisions
- Tick rate default 10 TPS; live config via config_update, periodic resend
- Spawn policy: prefer length 3 if a straight strip fits; else length 1; deny join if no free cell
- Apples per snake: default 1; min 1, max 12; cap 255 total; live config
- Wrap edges: live-configurable; head-only enforcement on transitions
- Compression: DEFLATE is handshake-only (restart + reconnect)
- Browser targets: latest Firefox required; latest Chrome desirable
- Protocol: join_deny; config_update packet; input_broadcast includes base_tick + rel offsets and apply_at_tick
2025-10-07 19:15:50 +03:00
Vladyslav Doloman
5b7c302008 Plan: compact per-snake encoding + QUIC TLV + fragmentation-safe recovery
- Adopt 2-bit-per-section body with head (x,y) and len (u16)
- TLV framing with QUIC varints for body payloads; support RLE alternative
  and chunked variants for oversized snakes
- Periodic recovery and large updates partitioned to keep each compressed
  datagram <1280 bytes; pack whole snakes first, split only when a single
  snake exceeds the limit
- Canonical padding and strict validation rules (zero-pad last byte)

Rationale: minimize bandwidth and avoid IP fragmentation while keeping
decoding simple and robust.
2025-10-07 18:36:47 +03:00
Vladyslav Doloman
06083da592 Plan: input_broadcast + opponent prediction for late updates
- Server relays player inputs immediately as input_broadcast to others
- Clients mirror per-opponent buffers to predict movement when state
  updates are late or dropped; reconcile on next authoritative update
- Add ordering/dedup rules and reconciliation guidance
- Update testing and milestones to include prediction paths

Rationale: reduce perceived latency and jitter under packet loss.
2025-10-07 18:36:47 +03:00
Vladyslav Doloman
03969ebd99 Plan: initial multiplayer Snake design (server, client, protocol)
- Add PROJECT_PLAN.md outlining the core design:
  - Server: Python 3 asyncio, authoritative tick loop
  - Client: WebTransport (datagrams), canvas rendering, spectator overlay
  - Mechanics: blocked head + tail shrink, apples, colors, 60x40 field,
    continuous play, length as score, input buffer rules, 180° policy
  - Networking: datagrams, seq numbers + wraparound, delta/full updates,
    1280-byte budget, up to 32 players, names ≤16 bytes
  - Testing strategy and milestones

Rationale: establish a shared baseline for scope and interfaces.
2025-10-07 18:36:46 +03:00