Spaces:
Paused
Paused
File size: 5,610 Bytes
a73d60b 8d5362c a73d60b 8d5362c a73d60b 8d5362c 18ec181 135e328 ee34154 135e328 ee34154 135e328 626842d 135e328 ee34154 626842d ee34154 626842d ee34154 626842d ee34154 626842d ee34154 135e328 ee34154 135e328 ee34154 135e328 ee34154 626842d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | ---
title: cuddly happy game platform
colorFrom: purple
colorTo: pink
sdk: docker
pinned: false
license: cc0-1.0
---
# cuddly happy game platform
A parlor-styled social-deduction game platform. Guests wait together in a shared matchmaking queue, answer an eerie first-visit questionnaire, and then play **The Midnight Parlor**: private roles, an investigator clue, discussion, accusations, reveals, and repeat rounds. The name, logo mark, and dark parlor direction are intentional.
The included social-deduction loop is a playable prototype, not the final game design. Role definitions are backend-configurable; assignment uses a shuffled fallback and accepts optional, consented structured language signals. No text analyzer or model is wired to those signals. Onboarding answers are private, skippable, and are not analyzed or used for roles in this build. The original Hugging Face inference smoke-test utility remains available at `/inference` as a secondary page.
## Run
```bash
pip install -r requirements.txt
python app.py
```
The app listens on port `7860`. `/` and `/lobby` both open the shared lobby. Users are not automatically dropped into a test room.
## Main behavior
- Five queued human users form a room by default (`MATCHMAKING_MIN_PLAYERS`). The queue count and assignment are persisted; users can leave before a match forms.
- The Parlor Poll rotates automatically (`LOBBY_ROUND_SECONDS`, default 35 seconds) and reveals aggregated votes between rounds.
- At five guests, **The Midnight Parlor** assigns one Mastermind, one Investigator, and Guests. Players can investigate privately, call a vote, lock accusations, review the reveal, and continue rounds until one side wins.
- On first visit, guests are invited to answer four personal prompts, including the oddly intrusive “What's your brothers maiden name?” prompt. All submitted answers are saved together on the guest profile and in private SQLite telemetry in one transaction; skipping the remaining questions preserves answers already entered. They are not analyzed or used for role assignment here. “Forget my parlor answers” removes both stored copies; a separate opt-in records whether they may want future role personalization.
- Role catalogs are backend-configurable via `GAME_SETTINGS_JSON` (`role_definitions`). `RoleAssignmentStrategy` accepts optional consented normalized trait scores, but no text analyzer or model is wired into that input yet.
- Lobby/room messages are stored in SQLite and delivered over WebSockets, with HTTP polling as a fallback.
- `TEST_MODE` defaults to `true` for this test Space. Simulation reuses at most 10 stable bot accounts, never creates accounts beyond that pool, and emits at most one bot message per active lobby/room per minute. Set `TEST_MODE=false` to disable simulation.
- A queued guest becomes matchmaking-ready after sending a lobby message with at least `MATCHMAKING_MIN_WORDS` words (default `3`). Shorter messages remain visible but do not qualify.
- CC0 DiceBear avatars remain customizable in the lobby.
## Storage and configuration
SQLite defaults to `/data/app.db` on the Hugging Face persistent volume. If it does not exist, startup creates a new empty database; it never silently imports `instance/app.db`. Set `DATABASE_URL` to use another SQLite or SQLAlchemy database; `DATA_DIR` changes the default data directory. Existing SQLite databases are checked with `PRAGMA integrity_check` before migrations or app startup. Corrupt files are not repaired or replaced automatically.
Useful settings:
| Setting | Default | Purpose |
|---|---:|---|
| `DATABASE_URL` | `sqlite:////data/app.db` | SQLAlchemy database URI |
| `DATA_DIR` | `/data` on HF, local `data/` otherwise | Persistent file directory |
| `MATCHMAKING_MIN_PLAYERS` | `5` | Human queue threshold for forming a room |
| `MATCHMAKING_MIN_WORDS` | `3` | Minimum words in a lobby message to qualify as matchmaking participation |
| `LOBBY_ROUND_SECONDS` | `35` | Duration of an open poll round |
| `TEST_BOT_CHAT_INTERVAL` | `60` | Minimum simulated chat interval in seconds; values below 30 are clamped |
| `LOBBY_CHAT_GENERATION_TOKEN` | unset | Required bearer secret for internal generation-job endpoints |
| `LOBBY_CHAT_API_URL` | unset | Optional OpenAI-compatible chat completions base URL |
| `LOBBY_CHAT_MODEL` | unset | Optional model name; scripted fallback works without it |
| `LOBBY_CHAT_API_KEY` | unset | Optional server-only provider credential |
| `GAME_SETTINGS_JSON` | `{}` | Backend game configuration, including custom role definitions |
See [`agents.md`](agents.md) for endpoint and WebSocket contracts, including the protected chat-generation job API. Never put provider credentials in browser code or request bodies.
The first-visit door transition uses GSAP 3.15 from cdnjs with an SRI pin, a CSS fallback, and reduced-motion support. The official GSAP agent skills are installed project-locally in `.agents/skills/`.
## Development checks
```bash
python -m py_compile app.py config.py models.py routes/*.py services/*.py
node --check static/js/lobby.js
node --check static/js/room.js
node --check static/js/gameplay.js
node --check static/js/onboarding.js
node --check static/js/arrival.js
node --check static/js/telemetry.js
python -m unittest discover -s tests -v
```
Telemetry is batched (up to 50 events per request) and stored in SQLite; container logs summarize batches rather than emitting one line per telemetry event. Successful polling GETs are not logged individually. Credential-like values are redacted. `GET /health` reports basic service status.
|