Back to Home
Father & Son Project

Truths & Lies: Building an AI Game with My 8-Year-Old Son

A dynamic two-truths-and-a-lie trivia game built with the Gemini API to teach prompt engineering—plus the unexpected challenge of classroom meme slang moderation.

Play Live Game Status: Active Family Project Co-Creator: My 8-Year-Old Son
Truths and Lies Application Interface Screenshot

Truths and Lies Interface Screenshot

Take a screenshot of your active application on your Mac (e.g. using Cmd+Shift+4) and save it as truths-and-lies.png inside the /public/images/ folder to replace this placeholder!

Project Tech Stack

Next.js 16TypeScriptGemini APINeon PostgresTailwind CSS

How It Started

Instead of just letting my 8-year-old son play games on an iPad, I wanted to show him how software gets made. We decided to build a digital version of “Two Truths and a Lie.” He served as the creative director: choosing trivia categories (like Sports Stars, Marvel Movies, and Animal Facts), designing achievement badges, and testing early rounds.

Rather than writing hundreds of trivia questions by hand, we hooked the game up to Google's Gemini API. Players choose a division (Kids, Teens, or Adults) and a category, and Gemini generates three plausible statements on the fly where exactly one is false.

Prompt Engineering & School Smartboards

What started as a simple living-room experiment evolved into a classroom learning tool with a few hilarious engineering lessons along the way:

  • Teaching an 8-Year-Old How Prompts Work: We spent afternoons discovering how to structure system instructions. He quickly saw that if you aren't precise, the AI will cheat—either by making the lie absurdly obvious or by accidentally revealing the answer in the JSON output.
  • Smartboard & QR Code Live Contests: We built a classroom mode for teachers. An educator can project the statements on a Smartboard for group discussions, or launch a 15-second speed contest where students scan a QR code on their phones to lock in their guesses.
  • The “Brainrot” Moderation Filter: As soon as we added live multiplayer lobbies, we ran into a real school problem: kids love disruptive nicknames. We had to build a dedicated safety pipeline using Gemini-2.5-flash to screen student lobby names in real time, specifically instructing the model to reject inappropriate words, meme numbers, and Gen Alpha slang (*skibidi*, *gyatt*, *rizzler*, *sigma*).
  • Zero-Friction Guest Access: In a classroom setting, no teacher wants 25 students creating email accounts. We built an automatic guest session flow so kids can scan the QR code and jump straight into the game.

Under the Hood

Strict JSON Prompting

Enforces strict JSON schema outputs from Gemini, cleanly separating statement text from the hidden lie index to prevent answer leaks on the client.

Real-Time AI Nickname Guard

Screens student lobby submissions with a low-latency Gemini prompt tuned specifically to catch cuss-word evasions, crude numbers, and classroom meme slang.

Live Speed Leaderboards

Calculates live scores based on both correctness and millisecond submission speed for high-energy classroom contest rounds.

Serverless Neon DB

Stores live lobbies, user streaks, and unlocked badges in a serverless relational database with lightweight JWT session management.

Ready to Play?

Test your instincts against AI-generated trivia across sports, history, pop culture, and science.

Play Live Game