Problem Statement

As AI becomes increasingly sophisticated, understanding how machines perceive human communication is crucial. Who's the Human? addresses three key challenges:

  1. Reverse Turing Test Education: Instead of humans detecting AI, this game flips the script - can AI detect humans? This novel approach helps users understand AI's perception of human behavior and provides real-time feedback on linguistic patterns.

  2. Lack of AI Transparency: Users don't understand how AI analyzes communication. Traditional AI systems are black boxes. This game makes AI behavior transparent by showing exactly what patterns it detects (grammar, message length, informality, rephrasing patterns, etc.).

  3. Privacy in AI Applications: Traditional AI-powered games require server infrastructure, raising privacy concerns and creating cost barriers. Client-side AI enables private, cost-free gameplay where user data never leaves their device.

Solution

A social deduction game where 1 human player attempts to blend in with 3 AI-powered personas in real-time chat. The AI analyzes 15+ linguistic patterns in every message:

  • Message structure: Length (< 18 words = human tell), brevity, vagueness
  • Grammar patterns: Missing punctuation, lowercase starts, perfect vs. flawed grammar
  • Language style: Informal shortcuts ("ur", "idk"), repeated letters, ellipsis usage
  • Conversational behavior: Originality vs. rephrasing, adding value vs. just agreeing, participation levels
  • Emotional tells: Multiple punctuation ("!!!"), repeated letters ("sooo")

After each round, players receive detailed analysis:

  • Detection Flags: Exact patterns that gave them away (e.g., "Used 'idk'", "Only 12 words", "No ending punctuation")
  • Example Messages: Their suspicious messages highlighted
  • Improvement Tips: Specific actionable advice (e.g., "Write 20-30 words per message", "Use proper punctuation")

Key Features

10 Diverse Themes: Space Crew, Pizza Night, Gaming Squad, Café Talk, Gym Squad, Road Trip, Movie Night, Mystery Dinner, College Dorm, Office Party

3 Difficulty Levels:

  • Easy: AI makes 50% random guesses
  • Medium: AI uses pattern detection with 75% accuracy
  • Hard: AI is ruthless with 100% pattern-based detection

3 Game Paces: Relaxed (12-18s), Normal (8-12s), Fast (5-8s) AI response times

Dynamic AI Personas: Each game generates unique AI characters with distinct personalities, backstories, and communication styles

Real-Time Pattern Analysis: 15+ weighted indicators with sophisticated scoring system

Educational Feedback: Transparent AI decision-making with specific examples

AI Human-Like Errors: 20% chance AIs make human mistakes (brief messages, informal language, grammar errors) to confuse detection - makes gameplay unpredictable

Complete Privacy: 100% client-side processing, no data leaves device

Offline-Capable: Works without internet after initial load

Mobile-Responsive: Plays on any device

Technical Innovation

AI Implementation:

  1. Persona Generation: System prompts define character traits, each AI gets unique name, personality, bio
  2. Contextual Responses: AI analyzes conversation history, references other players, maintains flow
  3. Pattern Detection: Local analysis (not API calls) for instant voting, 15+ weighted indicators
  4. Suspicion Generation: AIs explain reasoning based on detected patterns with specific examples

Performance Optimizations:

  • Parallel AI operations (Promise.all) for simultaneous actions
  • Local pattern analysis instead of API calls (reduced voting from 10s to <1s)
  • Message truncation at sentence boundaries for coherence
  • Race condition fixes to prevent duplicate messages

Chrome Built-in AI APIs Used

Primary API: Prompt API (Gemini Nano)

Usage 1: Dynamic AI Persona Generation

  • Creates unique characters at game start with distinct personalities
  • System prompts define traits (e.g., "pragmatic engineer", "creative artist")
  • Generates names, bios, communication styles
  • Temperature: 0.8, topK: 3 for variety

Usage 2: Contextual Chat Message Generation

  • Analyzes last 3-5 messages for context
  • Generates 20-30 word responses that either react to others or add new perspectives
  • Extracts participant names to prevent hallucinations
  • Post-processes: truncates at sentence boundaries, enforces capitalization/punctuation
  • Validates against existing names to avoid referring to non-existent players

Usage 3: Human-Like AI Behavior (Innovation)

  • 20% chance per message to add human elements:
    • Brief messages (remove last sentence)
    • Informal contractions ("you're", "can't")
    • Grammar mistakes (no punctuation, lowercase start)
    • Repeated letters ("sooo")
    • Ellipsis usage
  • Makes AI players occasionally detectable, adding unpredictability

Usage 4: Real-Time Pattern Detection (Local Analysis)

  • Analyzes 15+ linguistic patterns:
    • Message length scoring (+10 for <15 words, +5 for <18 words)
    • Informal language detection (+12 for "ur", "idk", "lol")
    • Grammar mistakes (+12 for missing punctuation/lowercase)
    • Rephrasing detection (+8 for >60% word overlap with previous messages)
    • Just agreeing without value (+9 for "yeah", "true" + low word count)
    • Perfect grammar penalty (-5 for AI-like perfection)
  • Weighted scoring system balances difficulty
  • Adaptive: Easy (50% random), Medium (75% pattern), Hard (100% pattern)

Usage 5: Educational Feedback Generation

  • Generates detailed analysis when human is eliminated
  • Extracts top 3 detection flags with examples
  • Provides specific tips based on detected patterns
  • Example output: "Used 'idk' (informal)" + "Only 12 words" + tip "Write 20-30 words"

Key Benefits of Client-Side AI Approach

Zero Server Costs: Unlimited free gameplay, no infrastructure needed ✅ Complete Privacy: Conversations never leave user's device, GDPR-friendly ✅ Offline-Capable: Works without internet after initial load ✅ Instant Responses: No network latency, sub-second voting ✅ Infinitely Scalable: No rate limits, no quotas ✅ Proactive AI Patterns: Can run continuously without cost concerns


Challenges & Solutions

Challenge 1: Balancing AI Detection Difficulty

Problem: Initial AI was either absurdly easy to fool or impossibly hard, making gameplay frustrating.

Solution: Implemented sophisticated weighted scoring with 15+ pattern indicators across 3 difficulty modes. Iteratively tested and adjusted weights (e.g., reduced penalty for perfect grammar from -12 to -5) to achieve ~75% accuracy in medium mode.

Result: Balanced gameplay that's challenging but fair, with high replay value.

Challenge 2: Natural AI Conversations

Problem: Early AI responses were generic, disconnected, didn't reference each other.

Solution: Rewrote prompts to require AIs to either react to someone's point OR add new perspective. Added conversation history tracking, extracted participant names explicitly, provided good/bad examples in prompts.

Result: AIs now have genuine back-and-forth discussions that feel like real group chats.

Challenge 3: Race Conditions in Message Scheduling

Problem: Sometimes AIs would respond to their own messages due to delayed state updates (setTimeout 100ms delay).

Solution: Removed setTimeout, made message tracking immediate. Update lastMessageIndex and aiCurrentlySending right after message is added to store.

Result: AIs properly wait for 2 other messages before speaking again, no self-responses.

Challenge 4: AI Response Speed

Problem: Initial voting/suspicion phases had 5-10 second delays, breaking game flow.

Solution: Replaced AI API calls with local pattern analysis for voting logic. Used Promise.all() for parallel processing of all AI actions.

Result: Voting phase reduced from 10+ seconds to <1 second while maintaining sophisticated detection.

Challenge 5: Message Quality Control

Problem: AI generated too-long messages, referred to non-existent players, or used third-person self-references ("Casey thinks..." when Casey is speaking).

Solution:

  • Smart truncation at sentence boundaries (max 35 words)
  • Dynamic name extraction with validation warnings
  • Regex-based self-reference removal
  • Fallback responses for errors

Result: 100% clean, contextually appropriate messages.

Challenge 6: User Doesn't Understand Why They Lost

Problem: Players eliminated without knowing what gave them away, hard to improve.

Solution: Created comprehensive analysis showing exact patterns ("Used 'ur'", "Only 12 words"), displaying suspicious messages as examples, providing specific tips ("Use proper punctuation", "Write 20-30 words").

Result: Elimination became a learning opportunity, increasing engagement and replayability.


What We Learned

Technical Insights

  • Chrome's Prompt API can power complex, stateful applications beyond simple Q&A
  • Client-side AI enables entirely new categories of privacy-first applications
  • Pattern-based analysis can effectively complement AI-generated content
  • Careful prompt engineering with examples is crucial for consistent behavior
  • Temperature and topK settings significantly impact response variety
  • Parallel processing (Promise.all) is essential for responsive AI interactions

Design Insights

  • Users need immediate, specific feedback to understand AI behavior
  • Game balance requires extensive iteration and user testing
  • Educational value significantly enhances entertainment value
  • Transparency in AI decision-making builds trust and engagement
  • Manual control (button to proceed) is better than automatic transitions

AI Behavior Insights

  • Gemini Nano maintains conversational context effectively across messages
  • System prompts must be specific and include examples
  • Validation layers prevent hallucinations (fake names, off-topic responses)
  • AIs naturally write in polished, structured style vs. casual human texting
  • Humans exhibit predictable patterns: brevity, informal language, grammar mistakes, rephrasing

What's Next

Short-term (3-6 months)

  • Voice Chat Mode: Integrate Speech Recognition API for verbal gameplay
  • Multiplayer: 2-3 humans vs. AI using WebRTC
  • Custom Themes: User-created discussion topics
  • AI Personality Editor: Customize AI traits and styles
  • Leaderboards: Track win rates and streaks

Long-term (6-12+ months)

  • Chrome Extension: Browser-integrated quick-play
  • Educational Platform: Partner with schools for communication classes
  • Research Tool: Anonymized data for AI-human interaction studies
  • Language Learning: Multi-language support with Translator API
  • Corporate Training: Professional communication skill development

Built With

Share this project:

Updates