Inspiration
What if the Turing Test wasn’t an experiment — but a party game? Our idea is to hide an AI player into ultimate party games and see if human players can spot who is the AI player!
Inspired by the classic social deduction game Undercover, we add a second hidden layer. Players aren’t just trying to find the Undercover anymore — they’re also trying to spot the AI player. With that extra layer, conversation becomes the battlefield, and the game becomes faster, tenser, and far more surprising!
What it does
UndercoverAI is a multiplayer social deduction game with 3 human players and 1 hidden AI player, powered by the Gemini 3 model.
At the start of the game, a pair of related but different words is selected:
- 3 players receive the same word (Civilians)
- 1 player receives the other word (Undercover)
- One of the four players is randomly assigned as the AI player
The game proceeds in repeated rounds:
Description Phase
Players take turns describing their word. The AI speaks naturally when it’s its turn.Discussion Phase
Open conversation to debate who might be the Undercover.Voting Phase
Players vote to eliminate one suspect.
If a Civilian is eliminated, the game continues to the next round.
The game ends when:
- The Undercover is voted out (Civilians win), or
- Only one Civilian remains in game (Undercover wins)
After the game ends, all human players enter a “Guess the AI” Phase. Each player privately guesses who was the AI player and earns extra credit for a correct guess.
The AI’s identity is revealed at the end.
In conclusioin, the game features two layers of deduction:
- Spot Undercover
- Spot the AI player.
How we built it
UndercoverAI is built as a full-stack, real-time multiplayer web application.
Frontend
- The frontend is built with React, TypeScript, and Vite, styled using Tailwind CSS.
- Real-time game state is managed with React Context, while Socket.io keeps all players synchronized during gameplay.
Backend
The backend runs on Node.js with Express and Socket.io, handling:
- Room creation and joining
- Game state and phase transitions
- Player descriptions, discussion messages, and voting
- Results and the final AI-guessing phase
AI Player
The AI player is powered by the Google Gemini API (gemini-3-pro-preview model).
It receives the same information as a human player, including its word, role, previous descriptions, and discussion history, and generates:
- In-turn descriptions based on prior players’ clues
- Free-form discussion messages
- As a Civilian: sharing suspicions
- As the Undercover: attempting to mislead
- As a Civilian: sharing suspicions
- Strategic votes based on analysis of the conversation
Game Logic
All core game logic runs server-side in a dedicated game manager, which handles:
- Role and word assignment
- Round progression and eliminations
- Voting logic and win conditions
The AI’s display name is randomized each game so it can’t be identified by label.
Deployment
We have deployed the application on a server with public url http://45.32.123.219:3000/. The users can also locally deploy it following guidelines in github repository.
Challenges we ran into
Making the AI feel human Instead of being a perfect AI, we want the AI player to behave more like a real human player with random personalities and join the conversation with a human-like pace. The AI player should try to make it perform like other players to hide itself.
Controlling AI behavior
The AI player should always follow the game rule without revealing its rolw. The AI player should also behave consistently through out the entire game, without feeling like different players in different phases. These requires careful prompt design, context filtering and strict rules on what information the model receives.
State synchronization
Keeping roles, words, votes, and phases consistent across all clients—especially during the final “Guess the AI” phase—required a single source of truth on the server and well-defined real-time event contracts.
Turn order and phase management
Coordinating four players (three humans and one server-driven AI) across multiple phases—while handling eliminations, timeouts, and transitions—was complex, particularly ensuring eliminated players stop playing but can still guess the AI.
What we learned
Prompting for believability
Making the AI stay in character without leaking information required careful prompt design and iteration, balancing constraints with natural conversation.
Real-time multiplayer systems
We learned how to manage shared state, real-time events, and disconnections while keeping gameplay consistent across all players.
Game design balance
Fairness, pacing, and engagement needed repeated playtesting to ensure the AI felt challenging but not overpowered.
Gemini API in practice
Integrating Gemini for live gameplay taught us how to manage context, rate limits, and response quality under real-time constraints.
What's next for Undercover AI
Multimodal gameplay
Beyond text, we want to introduce voice and video modes. The AI player wouldn’t just think like a human, but also speak and present itself like one—mimicking human voice patterns and visual behavior. This opens the door to multimodal reasoning and future fine-tuning using real gameplay data.
Statistics and leaderboards
We plan to track performance on both sides:
- Human players: correct AI guesses, Civilian wins, Undercover wins
- AI player: win rate, survival time, and how often it avoids being identified
These metrics would power public leaderboards and deeper insights into human–AI interaction.
Beyond Undercover
The idea of hiding AI players isn’t limited to one game. We want to bring AI participants into other social deduction and party games, such as Avalon, and make “guessing the AI” a reusable mechanic across many game designs.
Built With
- api
- css
- express.js
- gemini3-pro
- javascript
- node.js
- react
- socket.io
- typescript
- vite
Log in or sign up for Devpost to join the conversation.