DidGeminiFoolYou?: AI Social Deduction Game

🎮 Try It Out

Play DidGeminiFoolYou? Now →

GitHub Repository →

Demo Video →

Can You Spot the AI Before It Eliminates You?

DidGeminiFoolYou? is a multiplayer social deduction game where 4-6 players have to identify an AI impostor hiding among them. But here's the twist: this isn't a passive AI, when threatened with elimination, it fights back. Powered by Gemini 3's advanced reasoning, the AI analyzes player behavior, calculates threat levels, and strategically eliminates whoever poses the greatest danger to its survival.

Unlike traditional social deduction games where the impostor simply tries to blend in, DidGeminiFoolYou?features an overpowered AI that uses special powers to defend itself. Players must not only identify the impostor but survive its calculated counterattacks.


🎮 How to Play

Game Setup

  1. Join a Lobby - 4-6 players enter the game room
  2. Select Difficulty - Choose Easy mode (AI gets 1 power) or Hard mode (AI gets 2 powers)
  3. AI Assignment - One random player is secretly designated as the AI impostor

Round Flow

Each game consists of 4-6 rounds (matching the number of players):

1. Question Phase (30-60 seconds)

  • All players see the same question (e.g., "What's your favorite programming language?")
  • Everyone submits one answer within the time limit
  • Answers are displayed anonymously

2. Anonymous Voting Phase (15-30 seconds)

  • Players vote for who they think is the AI
  • Voting is completely anonymous—no one knows who voted for whom
  • The AI cannot see vote data, only the final results

3. Results & AI Power Phase

  • Vote counts are revealed
  • If the AI receives the most votes: It triggers its special power
    • Gemini 3 analyzes all player answers from that round
    • Calculates suspicion scores (0-100%) for each player
    • Strategically eliminates the player with the highest threat score
  • If a human receives the most votes: That player is eliminated normally

4. Next Round

  • Remaining players proceed to the next question
  • The cycle repeats until a win condition is met

Win Conditions

  • Humans Win: Successfully identify and eliminate the AI impostor
  • AI Wins: Survive until the final round or eliminate enough players to ensure victory

Difficulty Modes

  • Easy Mode: AI has 1 special power (one elimination opportunity)
  • Hard Mode: AI has 2 special powers (two elimination opportunities)

💡 Inspiration

The inspiration for DidGeminiFoolYou? came from two fascinating concepts: the Turing Test and AI behavioral mimicry.

The Turing Test in Gaming

Alan Turing's famous test asks: "Can a machine convince a human it's human?" We flipped this into a game mechanic. Instead of a lab experiment, we created a high-stakes social environment where an AI must blend in with real players through natural conversation, appropriate responses, and strategic behavior.

Beyond Simple Mimicry

Most AI implementations simply try to match patterns or follow rules. We wanted to explore something deeper: Can an AI analyze human behavior well enough to identify threats to its survival? This goes beyond mimicry. Its strategic reasoning, pattern recognition, and adaptive decision-making in real-time.

The Human Element

Social deduction games like Among Us and Werewolf thrive on human psychology: reading behavior, detecting lies, building trust. By adding an AI powered by Gemini 3's advanced reasoning, we created a new dynamic. Players aren't just trying to catch the imposter, but they're facing an opponent that can:

  • Analyze their writing style across multiple rounds
  • Identify analytical thinkers who ask probing questions
  • Calculate who poses the biggest threat based on behavioral patterns
  • Execute strategic eliminations rather than random guesses

The game becomes a test: Can humans detect AI behavior before the AI detects and eliminates them?


🚧 Challenges We Faced

Technical Execution: Real-Time Multiplayer Architecture

  • WebSocket Synchronization: Building a real-time multiplayer game required implementing WebSocket connections for all 4-6 players simultaneously. The challenges included:

  • State Management: Ensuring all clients stayed perfectly synchronized (same question, same timer, same player list)

  • Connection Handling: Managing player disconnections, reconnections, and lobby state persistence

  • Race Conditions: Preventing vote timing exploits and ensuring fair answer submission windows

  • Latency Issues: Handling variable network delays across players in different locations

We solved this by implementing a centralized game state manager on the Node.js backend that acts as the single source of truth. All game events (question start, answer submission, voting, elimination) are broadcasted through WebSocket channels with acknowledgment checks.

Implementing AI Special Powers

The overpowered AI mechanic was the most complex feature to implement correctly. Challenges included:

1. Triggering Logic

  • Detecting when AI receives the most votes (handling ties, edge cases)
  • Preventing power usage after all powers are exhausted
  • Tracking power usage across rounds in game state

2. Suspicion Score Calculation

  • Sending comprehensive game data to Gemini 3 (all answers, rounds, players)
  • Processing growing context as rounds progress (500 tokens → 3500+ tokens)
  • Parsing structured JSON output from Gemini 3's analysis
  • Handling API timeouts and errors gracefully

3. Strategic Elimination

  • Ensuring the highest-threat player is selected correctly
  • Updating game state after elimination (player list, round progression)
  • Synchronizing elimination across all connected clients simultaneously

4. Difficulty Balancing

  • Testing Easy (1 power) vs Hard (2 powers) to ensure fairness
  • Preventing the AI from being too weak or too overpowered
  • Calibrating round numbers to match player counts

Gemini 3 API Integration Complexity

Context Window Management: We needed to structure this data efficiently to maximize Gemini 3's analytical capabilities while staying within token limits.

Answer Generation Consistency

The AI needed to generate answers that:

  • Sound human and contextually appropriate
  • Maintain consistency with its previous answers
  • Don't reveal obvious AI patterns (too perfect grammar, always first to answer, etc.)

Anonymous Voting Implementation

Ensuring true anonymity required:

  • Storing votes server-side without exposing voter identity
  • Preventing client-side inspection from revealing vote data
  • Only sending vote counts (not individual votes) to clients
  • Ensuring the AI cannot access voting patterns (it analyzes behavior, not votes)

🚀 What's Next

We have ambitious plans to expand DidGeminiFoolYou? into a more sophisticated AI behavioral testing platform:

1. Advanced Gemini Features

Overpowering Gemini with New Capabilities

  • Multi-Modal Analysis: Allow Gemini to analyze not just text but player avatars, timing patterns, and response speeds
  • Personality Modes: Give the AI different strategies (aggressive eliminator, defensive blender, manipulative gaslighter)
  • Adaptive Difficulty: Dynamic AI behavior that adjusts based on player skill level in real-time

Improved Gemini Implementation

  • Handling Edge Cases: Better processing of unclear answers, sarcasm, jokes, or nonsensical responses
  • Contextual Awareness: Understanding game-specific memes, inside jokes, or cultural references
  • Emotional Intelligence: Detecting frustration, confidence, or deception in player writing styles

2. Live Discussion Mode

Real-Time Chat Integration

Transform the game from turn-based Q&A into a live social experience:

  • Open Discussion Rounds: Players can chat freely for 60 seconds before voting
  • AI Live Monitoring: Gemini 3 monitors the chat in real-time, analyzing conversation flow
  • Human-Like Participation: The AI responds naturally when addressed, asks questions, defends itself, and builds alliances
  • Dynamic Threat Assessment: Suspicion scores update live based on who's accusing whom, who's staying silent, who's defensive

This would make the AI feel genuinely alive—not just answering questions, but actively participating in social dynamics.

3. UI/UX Improvements

Visual Polish

  • Animated AI power activation sequences with particle effects
  • Real-time suspicion score visualization (live updating threat bars)
  • Character customization (avatars, colors, profiles)
  • Mobile-responsive design for tablet/phone gameplay

Accessibility

  • Screen reader support
  • Colorblind-friendly modes
  • Keyboard navigation for all interactions
  • Adjustable timer lengths for players who need more time

Quality of Life

  • Game history/replay system to watch how the AI analyzed you
  • Tutorial mode for new players
  • Spectator mode for eliminated players
  • In-game tips for detecting AI behavior

4. New Game Modes

  • Team Mode: 2 AIs vs 6 humans, AIs can coordinate but don't know each other's identity
  • Reverse Mode: 1 human pretends to be AI among 5 AIs
  • Teaming with AI: 1 AI and 1 Human player team up to win

🛠️ Built With

Frontend

  • React - Component-based UI architecture
  • WebSocket API - Real-time bidirectional communication
  • React Context - Global game state management

Backend

  • Node.js + Express - RESTful API and WebSocket server
  • AWS EC2 - Hosted on Ubuntu server instance
  • WSS Protocol - Secure WebSocket connections

AI Integration

  • Gemini 3 API - Advanced reasoning and behavioral analysis
  • Multi-turn Context - Accumulating game history across rounds
  • Function Calling - Structured JSON outputs for game integration

🔧 Gemini 3 API Usage

DidGeminiFoolYou? uses the Gemini 3 API to power an AI impostor that analyzes player behavior and makes strategic decisions based on accumulated game data.

Every round, the API receives the complete game history: all player answers from previous rounds, the current question, game settings (difficulty, round number, player count), and behavioral metadata. As the game progresses, this context grows—Round 1 has minimal data, but Round 6 includes answers from six questions across multiple players. Gemini 3's large context window processes this expanding dataset without issue.

The API serves two key functions:

First, generating answers: The AI uses Gemini 3 to create convincing human-like responses by analyzing previous player answers and maintaining consistency with its established behavior patterns.

Second, calculating threat scores: When the AI receives the most votes, it triggers a deep analysis. Gemini 3 examines all accumulated answer data—writing styles, question-asking patterns, analytical behavior—to calculate which player poses the greatest threat (0-100% score). The player with the highest score gets eliminated.

The API's analytical reasoning processes multi-round behavioral data to make strategic, calculated decisions rather than random choices.


🎯 Accomplishments

  • Successfully implemented real-time multiplayer synchronization for 4-6 concurrent players
  • Created an AI impostor that genuinely feels intelligent and strategic, not scripted
  • Balanced difficulty so the game is challenging but winnable for both humans and AI
  • Achieved sub-3-second response times for Gemini 3 threat analysis even with 3500+ token contexts
  • Built a fully functional anonymous voting system that prevents vote manipulation
  • Deployed a production-ready application on AWS EC2 with WSS encryption

📚 What We Learned

  • Real-time multiplayer is hard: WebSocket synchronization, race conditions, and state management required extensive testing and refactoring
  • Context window management matters: Structuring data efficiently for Gemini 3 was critical as game history grew exponentially
  • Prompt engineering is an art: Getting Gemini 3 to generate human-like responses while maintaining strategic analysis required iterative prompt refinement
  • Balancing AI difficulty: Too weak and the game is boring; too strong and it's unfair. Finding the sweet spot took extensive playtesting
  • Anonymous systems require careful design: Preventing vote manipulation while maintaining anonymity required server-side validation

👨‍💻 Built By

[Diwash Kuskusmiya] - Full Stack Developer


📜 License

This project was created for the Gemini 3 Hackathon.

Built With

Share this project:

Updates