๐ช TRAELand
February 13, 2026 ยท View on GitHub

๐ฎ About
TRAELand ยท Year of the Horse Temple Fair is a 2D pixel-art top-down game set during Chinese New Year celebrations. Players explore a traditional temple fair, interact with AI-powered NPCs, and experience authentic Chinese New Year festivities including fireworks and sky lanterns.
โจ Features
๐ค AI-Powered NPCs
- 11 unique NPCs with distinct personalities powered by LLM (Large Language Model)
- Dynamic dialogue generation based on NPC personalities
- AI-generated hawking calls when no customers are nearby
- Intelligent bargaining and trading conversations
๐ Fireworks System
- Three themed firework patterns: Horse, Fish, 2026
- AI-generated blessings with programmer humor
- Example blessings: "No Bugs in Horse Year", "Memory Overflow of Fortune"
๐ฎ Sky Lantern Scene
- Stunning 3D scene powered by Three.js
- GPU Instancing for 3000+ background lanterns
- 5000 twinkling stars
- AI-generated 4-character blessings
๐ Auto-Shopping System
- 10 AI-controlled tourists with different personalities
- Smart decision-making for shop visits
- Realistic bargaining dialogues
- Queue management at popular stalls
๐ ๏ธ Tech Stack
| Category | Technology | Version |
|---|---|---|
| Game Engine | Phaser 3 | 3.90.0 |
| 3D Engine | Three.js | 0.160.0 |
| AI Service | Doubao/OpenAI | - |
๐ Project Structure
โโโ html/ # Frontend
โ โโโ js/
โ โ โโโ scenes/ # Game scenes
โ โ โโโ entities/ # Game entities (Player, NPC)
โ โ โโโ utils/ # Utilities (AI, Pathfinding, Effects)
โ โ โโโ data/ # Game data & NPC profiles
โ โโโ assets/ # Game assets
๐ Quick Start
Prerequisites
- Python 3.x (for local server)
- LLM API Key (Doubao or OpenAI)
Configure API Key
# Copy the environment template
cp .env.example .env
# Edit .env and fill in your API key
Available LLM providers:
| Provider | Environment Variables |
|---|---|
| Doubao | LLM_PROVIDER=doubaoDOUBAO_API_KEY=your-key |
| OpenAI | LLM_PROVIDER=openaiOPENAI_API_KEY=your-key |
Run Locally
# Start the game
cd html
python3 serve.py
# Open http://localhost:8000 in browser
๐ญ NPC Characters
| NPC | Role | Personality |
|---|---|---|
| Aunt Wang | Fried Tangyuan Seller | Gossipy, loves comparing |
| Boss Qian | Jewelry Seller | Marriage-obsessed |
| Clay Zhang | Clay Figurine Maker | Humble, worried about son |
| Li Million | Ring Toss Owner | Humble-bragger |
| Beast King | Pet Seller | Promotes civil service jobs |
| Matchmaker Wang | Vegetable & Matchmaking | Enthusiastic matchmaker |
| Firecracker Qin | Firework Seller | Loves festivities |
| Afanti | BBQ Skewer Seller | Humorous, generous |
๐ฏ Game Flow
Game Start
โ
10 tourists spawn with random personalities
โ
Each tourist:
โ AI decides next shop to visit
โ Walk to shop (A* pathfinding)
โ AI dialogue with NPC
โ Purchase & trigger effects
โ Repeat until money runs out
โ
All tourists return home
โ
Sky Lantern finale scene
๐จ Tourist Types
| Type | Characteristics |
|---|---|
| Foodie | Passionate about food |
| New Year Shopper | Budget-conscious, compares prices |
| Collector | Can't resist buying |
| Party Youth | Loves the crowd |
| Homebody | Forced out by parents |
| City Kid | Curious about rural fairs |
๐ง AI Functions
| Function | Description |
|---|---|
generateHawkingText() | Generate NPC hawking calls |
generateTradeDialogue() | Generate trading dialogues |
generateTouristResponse() | Generate tourist responses |
generateTouristDecision() | AI decides which shop to visit |
generateFireworkBlessing() | Generate firework blessings (with programmer jokes) |
generateKongmingBlessing() | Generate 4-character lantern blessings |
๐ Firework Blessing Examples
| Firework Type | Blessing Examples |
|---|---|
| Horse | "No Bugs in Horse Year", "Code Runs Like Horse" |
| Fish | "Bonus Overflow", "Happy Slacking", "Memory Surplus" |
| 2026 | "2026.release()", "git push NewYear" |
๐ License
Copyright (c) 2026 Bytedance Ltd. and/or its affiliates. All rights reserved. Licensed under the MIT License.
๐ด Year of the Horse ยท Programmer's Cyber Couplet
May your code be
As fast as Red Hare โโ O(1) algorithm, zero latency
As stable as Dilu โโ 100% test coverage, never crashes
As lasting as Jueying โโ Zero tech debt, maintained till retirement
while year_of_horse:
coffee.brew()
code.write()
if product_manager.change_requirements():
git.stash()
refactor()
else:
print("Hello, slacking~")
git.push("--force-with-lease") # No breaking main in Horse Year
Happy Year of the Horse! No Bugs, No Overtime! ๐ด๐๐ป