Spaces:
Running
Running
metadata
title: AI Town Clone
emoji: ποΈ
colorFrom: purple
colorTo: blue
sdk: static
pinned: false
tags:
- ml-intern
ποΈ AI Town Clone β Virtual World with AI Inhabitants
A mobile simulation game where AI characters live, interact, remember, and evolve β built with the Stanford "Generative Agents" architecture.
Architecture
Expo (React Native) + Convex (Realtime Backend) + OpenAI (GPT-4o-mini)
Key Features
- πΊοΈ Town Builder β 2D Skia canvas with pan/zoom/tap-to-place buildings
- π€ 8 AI Characters β Each with unique personality (Big Five model), backstory, and memory
- π§ Memory System β Vector-indexed RAG retrieval with recency Γ importance Γ relevance scoring
- π¬ Chat β Talk to any character; they remember past conversations
- π Autonomous Simulation β Characters observe, plan, act, and converse every 30 seconds
- πΈοΈ Relationship Graph β Characters form opinions about each other based on interactions
- π Reflection β Characters generate high-level insights when enough happens (Stanford paper threshold: 150)
- π€οΈ Town Events β Weather changes, festivals, gossip, random acts of kindness
Files
| File | Purpose |
|---|---|
convex/schema.ts |
Database schema (9 tables, vector indexes) |
convex/memory.ts |
Memory stream with RAG retrieval |
convex/agent.ts |
Agent brain: observe β reflect β plan β act |
convex/characters.ts |
Character CRUD + user chat (RAG-powered) |
convex/world.ts |
Game tick, time, weather, events |
convex/town.ts |
Town grid + building management |
components/town/TownMap.tsx |
2D Skia renderer with gestures |
components/chat/ChatScreen.tsx |
Chat UI with typing indicator |
components/characters/RelationshipGraph.tsx |
Visual relationship web |
lib/seed-data.ts |
8 characters + 8 buildings |
Setup
git clone https://huggingface.co/spaces/Muthukumarank/ai-town-clone
npx convex init && npx convex deploy
# Set OPENAI_API_KEY in Convex dashboard
npx expo start