- Fix Day display: server sends phase in datetime_str, index.html uses state
directly instead of fragile regex parse that defaulted to Day 1
- Fix DB growth: snapshots DELETE-then-INSERT by name, prune old events/convos
- Fix console errors: pointer-lock→pointerlock, demo mode stops WS reconnect
and REST polling, mat() guards against undefined color
- FPV NPC chat: E key starts conversation, NPC freezes and faces player,
chat dialog with text input and Web Speech API microphone, contextual
NPC responses (name, age, occupation, mood), ESC to end chat
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Persist LLM probability across restarts; fix Gemini model fallback
- Add `settings` table to SQLite DB for key-value config persistence
- On startup: load saved llm_call_probability from DB (env var still wins);
env var value is also written back so other workstations inherit it
- On slider change: persist new value to DB immediately
- GeminiClient: auto-fallback to gemini-1.5-flash when configured model
returns 400/404 "not found" on the serverless endpoint; tracks unavailable
models per-instance so future calls skip straight to fallback
- Add _GEMINI_FALLBACK_CHAIN and MODEL_GEMINI_FLASH_FALLBACK constants
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- database.py: catch JSONDecodeError when loading snapshot from DB
- server.py: wrap load_simulation() in try/except — any error starts fresh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix startup crash on empty/missing GitHub state file
- websocket.py: send full state snapshot immediately on client connect
so new browsers instantly see the current city state (Day/time/agents)
instead of a stale Day 1 6:00 until the next tick fires
- server.py: tick delay now reads SOCI_TICK_DELAY env var (default 0.5s
instead of hardcoded 2.0s) — LLM call latency naturally paces ticks
on cloud deployments; set to 0 to run as fast as LLM allows
- database.py + snapshots.py: data directory now reads SOCI_DATA_DIR env
var (default "data") so Render's persistent disk (/var/data) can be
mounted and state survives across redeploys
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auto-resume on startup; fix Groq sleep bug and env var model selection
- Simulation now resumes from the last autosave by default on every run
- Replace --resume flag with --fresh to force a new simulation
- snapshots.py: JSON fallback now works for unnamed (latest) loads too
- llm.py: remove stray asyncio.sleep(wait) in Groq complete_json 429 handler
- llm.py: Groq and Ollama now respect GROQ_MODEL / OLLAMA_MODEL env vars
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Initial implementation of Soci city population simulator
LLM-powered simulation of 20 diverse AI people living in a city.
Architecture: world (clock, city map, events), agents (persona, memory,
needs, relationships), actions (movement, activities, conversation, social),
engine (simulation loop, scheduler, entropy management, Claude API),
persistence (SQLite), and API server (FastAPI REST + WebSocket).
All 12 integration tests pass with mock LLM.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>