로그인
KO
games/webrtc-demo / AGENTS.md · commit 87ad512
# webrtc-demo — notes for agentsThe example game of the engine extension `extensions/webrtc` (jumphp/webrtc, required through a path repository), published on theplayground as `webrtc-demo` (https://jumphp.net/webrtc-demo). **Read `../../AGENTS.md` first.**- **Scenes**: `TitleScene` (own menu: keys, mouse, touch; Language row cycles the 14 languages) → `LinkScene` (two peers A / B in this  game: 'chat' reliable PING → PONG with the round trip, 'cursor' unreliable) or `DuelScene` (catch the stars: `mode: bot` = a second peer of  this game is the bot, `mode: online` = after `JumPHP\Net\LobbyScene`, signals through the relay with `Signaling::overNet`).- **Duel protocol**: the host (offerer) runs `App\Game\Duel` and sends snapshots `{"t":"s",...}` 30/s on 'game' (unordered, 0 retransmits);  the other side sends `{"t":"p","p":[x,y]}`; 'event' (reliable) carries ping / pong / again.- **No WebRTC here** (headless tests, a desktop without GStreamer): `App\Net\Rtc::prepare()` puts `App\Net\LocalBackend` in, which pairs the  peers of this process with the same commands / events (1 frame of delay). Online play is refused then (title message).- Scenes call `$webrtc->backend()->poll()` in update(): game tests run frames without the loop timer the extension polls on.- **Languages**: `config/lang.yaml` (14 languages, keys = English; `state:*` = connection states). Fonts: `assets/fonts/ui.ttf` (Lato), and  for ja / zh / ko subsets of Noto Sans: after changing a text, `python3 tools/fonts.py <folder with NotoSansJP/SC/KR.ttf>` (see its header).- **Test params**: every scene takes `lang` (`JUMPHP_SCENE_PARAMS='{"lang":"ja"}'`); `LinkScene {demo}`, `DuelScene {mode, demo, seed}`.- **Site**: `bash tools/site/shots.sh` (pictures, thumbnail, icon) then `python3 tools/site/build.py` (site/ in 14 languages, sitemap).- `net_url` is jumphp.net's relay (`wss://jumphp.net/ide-relay/ws`); locally `bin/jumphp relay up` and `?net=ws://localhost:8090/ws`.