4 Commits

Author SHA1 Message Date
f0231733a2 feat: WebGL context loss recovery for iPad PWA (#14)
Applies Replit PR #21 feature on top of current main:
- buildWorld()/teardown() lifecycle for world rebuild on context restore
- disposeWorld(), disposeAgents(), disposeEffects(), disposeInteraction()
- getAgentStates()/applyAgentStates() for state preservation across rebuilds
- webgl-recovery-overlay in index.html
- Canvas reuse on reinit (existingCanvas param in initWorld)
- Preserves: visibility-change pause, visitor init, debounced resize
2026-03-19 02:01:23 +00:00
745208f3c8 feat: Integration Phase 2 — config.js, live WS client, auth, agent hot-add (#7, #11, #12)
- js/config.js: connection config with URL param + env var override
  - WS URL, auth token, mock mode toggle
  - Computed isLive and wsUrlWithAuth getters
  - Resolves #7 (config.js)
  - Resolves #11 (Phase 1 shared-secret auth via query param)

- js/websocket.js: refactored to use Config for live/mock switching
  - Live mode: real WS with reconnection + exponential backoff
  - Auth token appended as ?token= on WS connect
  - agent_joined handler dispatches to addAgent() for hot-add
  - sendMessage() public API for UI → backend communication

- js/agents.js: dynamic agent hot-add and removal
  - addAgent(def): spawns 3D avatar at runtime without reload
  - autoPlace(): finds unoccupied circular slot (radius 8+)
  - removeAgent(id): clean dispose + connection line rebuild
  - Connection distance threshold 8→14 for larger agent rings
  - Resolves #12 (dynamic agent hot-add)
2026-03-19 01:09:59 +00:00
70f590ab9a perf: QA sprint v2 — 8 optimizations + responsive fixes
Fixes:
- #29 agents.js: share geometries across agents (3 shared vs 12 duplicates)
- #30 agents.js: single connection line material, dispose old geometries
- #31 agents.js: add Agent.dispose() for proper GPU resource cleanup
- #32 main.js: debounce window resize with rAF (1 call/frame vs dozens)
- #33 main.js: pause rAF loop on visibilitychange (battery savings on iPad)
- #34 effects.js: skip every 2nd rain update on low tier (halves iterations)
- #35 index.html: responsive HUD with clamp(), mobile stack layout <500px
- #36 vite.config.js: code-split Three.js into separate cacheable chunk

Build output:
- App code: 28.7KB (was bundled into 514KB single chunk)
- Three.js: 486KB (cached independently after first visit)
- FPS: 31 (up from 28-29)
2026-03-19 00:27:13 +00:00
Replit Agent
fe2d9a31e3 docs: add direction field to README custom-agent example 2026-03-18 23:52:06 +00:00