Impostor: Deduction Party Game

5 minutes read

Architecture: Pass & Play PWA Game
Stack: JavaScript (ES6+), Web Audio API, Tailwind CSS, Service Worker
Status: Production Ready

Purpose & Problem Statement

Social deduction games (such as Mafia, Secret Hitler, Spyfall, and Among Us) are renowned for sparking lively social dynamics. However, in real-world party scenarios, pubs, or off-grid cabin retreats, they regularly stumble upon three frustrating bottlenecks:

  1. App Store Friction & Onboarding Fatigue: Forcing 6 to 10 players to each download a 150MB native app, recover forgotten passwords, and connect to a room code kills party momentum before the first round even begins.
  2. Network Dependency: Basement bars, transit flights, and remote wilderness cabins often lack cellular data or dependable Wi-Fi connections.
  3. Screen Isolation vs. Human Connection: Instead of looking each other in the eye to analyze micro-expressions, speech hesitation, and body language, everyone is locked into their personal screens.

Impostor sidesteps these problems using an elegant single-device Pass & Play architecture:


Architecture & Technology Stack

The application is engineered without bulky third-party game engines (no Unity or Phaser overhead), relying exclusively on native web standards:

LayerChosen TechnologyArchitectural Rationale & Trade-offs
Core State EngineVanilla JavaScript (js/app.js)Deterministic finite state machine (FSM) enforcing transitions without memory leaks or race conditions
Audio SynthesizerWeb Audio API (js/audio.js)100% procedural sound synthesis in real time; zero downloaded audio files (0 KB network transfer) and zero touch latency
Visual StylingTailwind CSS + Custom TokensManila folder paper textures, typewriter typography, classified dossier stamps, and Midnight Archival dark mode
Keyword LexiconNormalized Data Array (js/data.js)917+ curated terms, 16 party categories, and 83 paired Undercover keyword tuples with tuned semantic proximity
Offline RuntimeService Worker (sw.js)Full PWA offline caching ensuring uninterrupted gameplay in off-grid settings

Technical Innovation: Procedural Web Audio Engine (js/audio.js)

Typical web games download dozens of megabytes of MP3/WAV audio assets. This traditional approach introduces audio latency (often 100–300 ms delays on mobile devices) and fails under poor network conditions.

Impostor generates all acoustic feedback mathematically in real time via the browser's native AudioContext:


Game Modes & Psychological Dynamics

  1. Classic Impostor: One or more infiltrators know nothing about the classified keyword. Loyal agents drop subtle clues. The Impostor must bluff conviction while deducing the context from peer statements.
  2. Undercover Mode (Semantic Dissonance): The infiltrator is given a related keyword from the same taxonomic cluster (Coffee vs. Tea, Minecraft vs. Roblox, Batman vs. Superman). The infiltrator initially believes they are an ordinary agent until subtle contradictions emerge during table discussions.
  3. Interrogation Arena & Final Stand: When voted out, an accused agent gets one last chance: if they accurately guess the agents' original keyword, they reverse the verdict and claim victory.
  4. Squad Manager: Persistent device storage for recurring player names with an automated callsign generator.
  5. Chaos Cards (Party Modifiers): Optional round constraints (e.g. single-word clues only, rhyming constraints, question-only interrogations).
  6. Custom Deck Builder & Evening Scoreboard: In-app creation and storage of custom secret word packs with cumulative team vs. impostor scoring.