ai-town-clone / README.md
Muthukumarank's picture
Update ML Intern artifact metadata
328c3cd verified
|
Raw
History Blame Contribute Delete
2.09 kB
---
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
```bash
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
```