Project Info
Inspiration
Multiplayer gaming is all about connection and fun, but toxic chat can ruin the experience. We've all seen it—arguments escalate, new players feel unwelcome, and moderators can't scale to every game session. We wanted to create an AI companion that could keep gaming communities positive, engaging, and safe without the need for expensive human moderation. Inspired by the nostalgic Talking Tom character, we built an AI moderator that's not just functional—it's genuinely fun to interact with.
What it does
Talking Tom Chat is an AI-powered chat moderator that game developers can integrate into their multiplayer games. Tom acts as a friendly companion who: Moderates conversations - Detects and gently defuses tension before conflicts escalate Engages players - Jumps into food discussions, tells personalized stories featuring all players, and playfully echoes messages Welcomes newcomers - Greets new players and helps them feel included Facilitates decisions - Helps groups make choices when discussions get stuck Speaks naturally - Uses Fish Audio TTS to deliver emotion-rich voice responses that match the conversation's mood Tom knows when to speak and when to stay silent, making him feel like a natural part of the conversation rather than an intrusive bot.
How we built it
Tech Stack: Backend: Python FastAPI with Socket.IO for real-time WebSocket communication AI Brain: Anthropic's Claude AI (Sonnet 4.5) with a carefully crafted system prompt that defines Tom's personality and behavior Voice: Fish Audio TTS API for natural, emotion-tagged speech synthesis Frontend: Next.js with TypeScript, React, and Tailwind CSS for a responsive, modern UI Deployment: Backend on Render.com, Frontend on Vercel Architecture: Real-time chat messages flow through Socket.IO Claude AI analyzes context and decides whether Tom should respond If responding, Claude generates speech with emotion tags (e.g., (happy), (excited), (calm)) Fish Audio converts the tagged text into natural-sounding voice Audio streams back to all players in the room Key Features: Priority-based response system (13 different triggers) Context-aware conversation analysis Emotion-tagged speech for authentic voice delivery Real-time multiplayer room management Cross-platform responsive design
Challenges we ran into
Getting the AI to "shut up" - Our biggest challenge was teaching Tom when NOT to talk. Early versions were too chatty. We solved this with a sophisticated priority system and a [[NO_OUTPUT]] token that tells Tom to stay silent. Getting the AI to "shut up" - Our biggest challenge was teaching Tom when NOT to talk. Early versions were too chatty. We solved this with a sophisticated priority system and a [[NO_OUTPUT]] token that tells Tom to stay silent. Fish Audio integration - Working with emotion-tagged TTS was new territory. We had to carefully map conversation contexts to appropriate emotion tags and ensure the tags were properly formatted according to Fish Audio's strict requirements. Fish Audio integration - Working with emotion-tagged TTS was new territory. We had to carefully map conversation contexts to appropriate emotion tags and ensure the tags were properly formatted according to Fish Audio's strict requirements. Real-time audio streaming - Serving audio files efficiently while maintaining low latency across Socket.IO connections required careful backend optimization and proper CORS configuration. Real-time audio streaming - Serving audio files efficiently while maintaining low latency across Socket.IO connections required careful backend optimization and proper CORS configuration. Deployment complexity - Managing separate frontend and backend deployments with proper environment variables, WebSocket support, and CORS policies across Vercel and Render took careful configuration. Deployment complexity - Managing separate frontend and backend deployments with proper environment variables, WebSocket support, and CORS policies across Vercel and Render took careful configuration. Prompt engineering - Crafting a system prompt that balanced personality, helpfulness, and silence was an iterative process. We went through many versions to get Tom's voice just right. Prompt engineering - Crafting a system prompt that balanced personality, helpfulness, and silence was an iterative process. We went through many versions to get Tom's voice just right.
Accomplishments we're proud of
Created a genuinely useful tool - Tom isn't just a gimmick; he actually improves group chat dynamics Achieved natural voice interactions - The emotion-tagged speech makes Tom feel alive and responsive Built a production-ready API - The backend is scalable and ready for real game integrations Designed an intuitive UX - Players can jump into rooms and start chatting immediately Implemented smart context awareness - Tom understands ongoing conversations and responds appropriately Successfully deployed - Full stack application running smoothly in production
What we learned
AI needs guardrails - Sophisticated gating logic is essential for AI companions to feel natural rather than annoying Voice changes everything - Adding emotion-rich TTS transformed Tom from a text bot into a character people actually enjoy Real-time is hard - WebSocket management, connection handling, and audio streaming require careful architecture Prompt engineering is an art - Small changes in system prompts can dramatically affect AI behavior User experience matters - Even powerful AI needs a great interface to be useful Deployment strategy - Separating frontend and backend into dedicated platforms (Vercel + Render) simplifies scaling and maintenance
What's next
Short-term: Game integrations - Partner with indie game developers to test Tom in real gaming environments Enhanced personality modes - Let developers customize Tom's personality for different game genres Analytics dashboard - Give developers insights into chat health and Tom's engagement metrics Multi-language support - Expand beyond English to reach global gaming communities Long-term: Voice commands - Let players interact with Tom using voice input Custom training - Allow developers to fine-tune Tom for their specific community culture Sentiment analysis - Provide real-time toxicity scores and proactive moderation Plugin marketplace - Create an ecosystem where developers can add custom Tom behaviors Mobile SDK - Native iOS/Android libraries for mobile game integration Advanced storytelling - Dynamic quest generation and interactive narratives featuring players Vision: Transform Tommy Chat into the go-to AI companion for every multiplayer game, making online gaming communities safer, more fun, and more engaging—one conversation at a time. Try it live: https://tommy-chat.vercel.app/ GitHub: https://github.com/Rushabh-Runwal/calhacks/tree/main Backend API: https://backend-talking-tom.onrender.com
🐱 Talking Tom Chat
A real-time, room-based group chat where you and friends can talk to an AI “Talking Tom” via text or voice. Messages are delivered instantly over Socket.IO. Voice notes are auto-transcribed and Tom replies with natural text-to-speech audio. Tom follows prompt-guided behavior: he speaks when addressed or helpful, avoids interrupting active threads, nudges the room if it’s quiet, and applies simple moderation.
- Low-latency, multiplayer rooms
- Text + voice messaging (VAD recording, ASR transcription, TTS replies)
- Context-aware AI persona with speaking rules and cooldowns
- Works on desktop and mobile
Features
- 💬 Real-time multiplayer chat (Socket.IO)
- 🎙️ Voice input with automatic speech detection
- 🔊 AI voice responses (Fish Audio TTS) + transcription (ASR)
- 🤖 JanitorAI-powered character with context-aware logic
- 👥 Room-based conversations with shareable codes
- 🛡️ Simple moderation prompts and anti-interruption behavior
- 📦 Audio caching and HTTP streaming for generated speech
Tech Stack
- Backend: Python 3.10+, FastAPI, python-socketio, Uvicorn
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- AI: JanitorAI
- Audio: Fish Audio SDK (TTS + ASR), FFmpeg
Prerequisites
- Python 3.10+
- Node.js 18+
- FFmpeg installed and on PATH
- Docker (optional, for Compose)
Quick Start
Option 1: Docker Compose (recommended)
# In repo root
Copy-Item backend/.env.example backend/.env
Copy-Item frontend/.env.example frontend/.env.local
# Edit both env files with your API keys and settings
docker-compose up --build
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- WebSocket: ws://localhost:8000/socket.io/
Option 2: Manual setup
Backend (Windows PowerShell):
cd backend
Copy-Item .env.example .env # edit with your API keys
python -m venv .venv
. .\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python start_server.py
Frontend:
cd frontend
Copy-Item .\.env.example .\.env.local # edit if needed
npm install
npm run dev
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- WebSocket: ws://localhost:8000/socket.io/
Usage
- Enter a username, then create or join a room via code.
- Send text or hold-to-record a voice message.
- Tom replies in text and usually with synthesized voice.
- Say his name to engage directly; he avoids interrupting active 1:1 threads.
API Overview
HTTP
- GET
/→ Health/info - GET
/rooms→ List rooms - POST
/rooms/create→ Create a room - GET
/audio/{filename}→ Stream cached TTS audio
Socket.IO (ws://localhost:8000/socket.io/)
- Client → Server:
joinRoom{ roomId, username }sendMessage{ roomId, username, content }sendVoiceMessage{ roomId, username, audio: base64 }
- Server → Client:
userJoined,userLeft,roomUsersroomMessages,newMessageerror
Tom’s Behavior (prompt-guided)
- Responds when addressed or when helpful to the group
- Avoids interrupting ongoing 1:1 exchanges
- Optional “silence nudge” after quiet periods
- Brief, friendly voice style; minimal fillers; no cat sounds in moderation
- Simple moderation: immediate warning on harassment; repeat → removal
Tune timings, cooldowns, and wording in the prompt/config (e.g., config/ai_prompt.py)
Environment Variables
Backend (backend/.env)
HOST=0.0.0.0
PORT=8000
FISH_API_KEY=your_fish_audio_api_key
JANITOR_API_KEY=your_janitor_ai_api_key
Frontend (frontend/.env.local)
NEXT_PUBLIC_API_URL=http://localhost:8000
Project Structure
.
├── backend/ # FastAPI + Socket.IO server
│ ├── config/ # AI prompt and settings
│ ├── models/ # Pydantic models
│ ├── services/ # JanitorAI + Fish Audio integrations
│ ├── audio_cache/ # Generated audio files
│ ├── main.py # App entry
│ ├── start_server.py # Uvicorn launcher
│ └── requirements.txt
│
├── frontend/ # Next.js app
│ ├── src/ # app/, components/, types/
│ ├── public/
│ └── package.json
│
└── docker-compose.yml
Troubleshooting
- Missing API keys: set
FISH_API_KEYandJANITOR_API_KEYinbackend/.env. - FFmpeg not found: install and add to PATH, then restart terminal.
- CORS/Socket errors: confirm
NEXT_PUBLIC_API_URLpoints to your backend URL. - No audio playback: ensure
audio_cache/is writable and files are being created.
License
MIT
Backend URL: https://backend-tommy.onrender.com
Analysis
View
Metric
- 26
- 8
- 3
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- FastAPIIn code
- Next.jsIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
7 of 7 appear in the indexed code.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
94 KB
Source files
27
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
Rushabh-Runwal/calhacks
82 files · 79.4 MB · @ dcb39ea
Structure
Interface
8 files · 10%Screens, components and styles rendered to the user.
Application logic
10 files · 12%Domain rules, services and shared utilities.
Data & schema
1 file · 1%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript37%
- Python31%
- Markdown17%
- CSS11%
- Shell2%
- YAML1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
frontend/package.json
npm · 16- @ricky0123/vad-web
- nanoid
- next
- react
- react-dom
- socket.io
- socket.io-client
- +9 more
backend/pyproject.toml
pypi · 11- fastapi
- ffmpeg-python
- fish-audio-sdk
- httpx
- python-dotenv
- python-socketio
- uvicorn[standard]
- +4 more
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.