[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-78978":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":16,"stars90d":14,"forks30d":14,"starsTrendScore":17,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},78978,"OpenPixel-RPG","tensor2023\u002FOpenPixel-RPG","tensor2023","AI-powered UGC pixel-art JRPG: input any address or photo, describe a style, and get a complete interactive world with AI-generated local NPCs.",null,"TypeScript",140,9,28,0,7,112,1,3,false,"master",true,[],"2026-06-12 02:03:49","\u003Cp align=\"center\">\n  \u003Ch1 align=\"center\">OpenPixel-RPG\u003C\u002Fh1>\n  \u003Cp align=\"center\">\u003Cstrong>AI-powered pixel-art open-world JRPG — turn any place on Earth into a playable pixel world.\u003C\u002Fstrong>\u003C\u002Fp>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\".\u002FGeoPixel\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg\" alt=\"License: MIT\">\u003C\u002Fa>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode.js-18%2B-339933?logo=node.js&logoColor=white\" alt=\"Node.js 18+\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-5.x-3178C6?logo=typescript&logoColor=white\" alt=\"TypeScript\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FReact-19-61DAFB?logo=react&logoColor=white\" alt=\"React 19\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FGemini-2.5%20%7C%203.1-4285F4?logo=google&logoColor=white\" alt=\"Gemini 2.5 \u002F 3.1\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBaidu%20Maps-API-2932E1?logo=baidu&logoColor=white\" alt=\"Baidu Maps API\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FStatus-Alpha-orange\" alt=\"Alpha\">\n\u003C\u002Fp>\n\n---\n\n## Overview\n\nTurn any place on Earth into an interactive pixel-art JRPG.\n\n**OpenPixel-RPG** is an AI-powered pixel-art open-world UGC game. Input any location name, or upload your own photo, describe the art style you want, and OpenPixel-RPG generates a complete interactive pixel map with local NPCs. Under the hood, Google Gemini models handle everything: world design (`gemini-2.5-pro`), map & sprite generation (`gemini-3.1-flash-image`), vision quality review (`gemini-3.1-pro`), and runtime character simulation (`gemini-2.5-flash`). Every NPC runs on a custom agent simulation system — no LangGraph or LangChain, just a hand-built perceive-decide-act loop where characters perceive their surroundings, make decisions via LLM, form memories, and produce emergent narratives no one scripted. You can also play \"god\" at any time: inject events, edit character memories or traits, and watch the world shift in response.\n\nBorn from [isometric.nyc](https:\u002F\u002Fisometric.nyc), this project replaces the NYC-specific data pipeline with globally available OSM Overpass + satellite + Google 3D Tiles, uses Baidu Maps for street-level scene reference, and deeply integrates [WorldX](https:\u002F\u002Fgithub.com\u002FYGYOOO\u002FWorldX)'s AI world engine.\n\n![Game Tutorial](video\u002F教程.png)\n\n> Game tutorial here\n\n---\n\n## Three Modes\n\n### Mode 1 — Upload & Play\n\nUpload your own photo, and OpenPixel-RPG turns it into a pixel-art JRPG world.\n\n![Mode 1 Demo](video\u002Fmode1_demo.gif)\n\n> [Watch full video](https:\u002F\u002Ftensor2023.github.io\u002Fxueqinggao.github.io\u002Fvideo\u002Fmode1_demo.mp4)\n\n**How it works:**\n1. Select a local image from your device.\n2. The 3D View shows your image — set a **Pixel Style** prompt, then click **Generate Pixel Map**.\n3. Once the pixel map loads, click **Generate GeoPixel Game** and wait.\n4. Click **Enter World** (or the browser loads it automatically) to start playing.\n\n### Mode 2 — NYC Landmark Exploration\n\nEnter a Manhattan landmark name, and OpenPixel-RPG fetches pre-generated pixel tiles from [isometric.nyc](https:\u002F\u002Fisometric.nyc) to build an interactive map.\n\n![Mode 2 Demo](video\u002Fdemo.gif)\n\n> [Watch full video](https:\u002F\u002Ftensor2023.github.io\u002Fxueqinggao.github.io\u002Fvideo\u002FDemo2.mp4)\n\n**How it works:**\n1. Click **City Map**, then input a location (e.g. Times Square, Central Park, Empire State Building, Brooklyn Bridge, and many more).\n2. Wait for the tile to load.\n3. Select **Fast Mode** (bottom-right), then click **Generate GeoPixel Game**.\n4. Once loaded, click **Enter World**.\n\n### Mode 3 — Anywhere on Earth\n\nInput any address on Earth, and OpenPixel-RPG generates an interactive pixel map using OSM whitebox + satellite imagery + AI style transfer.\n\n![Mode 3 Demo](video\u002Fmode3_demo.gif)\n\n> [Watch full video](https:\u002F\u002Ftensor2023.github.io\u002Fxueqinggao.github.io\u002Fvideo\u002Fmode3_demo.mp4)\n\n**How it works:**\n1. Input an address and click **Load Map**.\n2. The 3D View loads a satellite image. Drag to fine-tune the area. Set a **Pixel Style** prompt.\n3. Click **Generate Global Map** — the backend runs a three-step pipeline:\n   - **Step 1 — OSM Whitebox**: Queries the OpenStreetMap Overpass API for all building footprints with height\u002Flevels data. Renders an isometric PNG showing building roof faces (light grey) and walls (shaded by orientation). Contains only building geometry — no roads, water, or labels. Serves as the geometric blueprint.\n   - **Step 2 — 3D Tiles Render**: Captures a Google 3D Tiles isometric screenshot for real-world color\u002Ftexture reference.\n   - **Step 3 — AI Pixel Map**: Feeds the whitebox (geometry), 3D Tiles render (color), and style prompt to Gemini (`gemini-3.1-flash-image-preview`), which generates a pixel-art map respecting the building layout of the whitebox and the color palette of the real-world view.\n4. Click **Generate WorldX Game** to build the playable world with NPCs.\n5. Click **Enter World** (or it loads automatically) to start playing.\n\n| Mode | Description | Status |\n|------|-------------|--------|\n| **Mode 1** — Upload & Play | Upload a photo → AI generates pixel map → playable JRPG world. | Done |\n| **Mode 2** — NYC Exploration | Input an NYC landmark → fetch isometric.nyc pixel tile → GeoPixel pipeline. | Done |\n| **Mode 3** — Anywhere on Earth | Input any global address → OSM whitebox + satellite + Google 3D Tiles → AI pixel map → playable world. | Done |\n\n---\n\n## Getting Started (port 5173)\n\n```bash\n# 1. Enter the G_gen_pixel directory\ncd G_gen_pixel\n\n# 2. Install frontend dependencies\nnpm install\n\n# 3. Install Python dependencies\npip install -r requirements.txt\n\n# 4. Configure API keys\ncp .env.example .env\n# Edit .env with your Google Maps, Gemini, and DashScope API keys\n\n# 5. Start all services\n# Terminal 1: Vite frontend (port 5173)\nnpm run dev\n\n# Terminal 2: Main backend (port 5001)\npython server.py\n\n# Terminal 3: Global map backend (port 5002, for Mode 3)\npython global_server.py\n```\n\nOpen `http:\u002F\u002Flocalhost:5173` in your browser, choose a mode, and go.\n\n---\n\n## AI Architecture\n\n### LLM Models — Gemini\n\nAll AI workloads run on Google Gemini models via TokenRouter. Each role uses a specialized model:\n\n| Role | Model | Purpose |\n|------|-------|---------|\n| **Orchestrator** | `gemini-2.5-pro-preview` | One-shot world design from a user prompt — creates character profiles, zones, world rules, and action templates. |\n| **Image Generation** | `gemini-3.1-flash-image-preview` | Map pixel-art generation (Mode 1\u002F3) + character sprite sheet generation. |\n| **Vision Review** | `gemini-3.1-pro-preview` | Quality review pass — checks generated map images for artifacts and consistency before they go live. |\n| **Simulation** | `gemini-2.5-flash-preview` | Runtime character behavior — action decisions, multi-turn dialogue, reflection, and memory consolidation. |\n| **Character Sprites** | `gemini-2.5-flash-image` | NPC sprite sheet generation for in-game characters (walk cycles, idle poses). |\n\n### Custom Agent Simulation System\n\nNo external agent frameworks (LangGraph, LangChain) — fully custom perceive-decide-act loop running tick-by-tick for every NPC:\n\n| Component | Responsibility |\n|-----------|---------------|\n| `SimulationEngine` | Drives the tick loop — each tick, every NPC perceives, decides, acts, and remembers. |\n| `buildPerception()` | Builds each NPC's perception context from nearby entities, recent events, current emotion, and world state. |\n| `DecisionMaker` | Calls the Simulation LLM to select an action (move, talk, emote, use item, etc.) based on personality + perception. |\n| `DialogueGenerator` | Produces multi-turn NPC-to-NPC and NPC-to-player conversations with memory-aware context. |\n| `MemoryManager` | Stores individual memories, applies decay over time, and periodically consolidates related memories via LLM reflection. |\n| `emotion-manager` | `updateEmotion()` \u002F `decayEmotion()` \u002F `getEmotionLabel()` — tracks valence and arousal per character, updated by events and dialogue outcomes. |\n\nEach NPC autonomously: **perceives** the environment → **decides** what to do → **executes** the action → **forms memories** → **reflects** on experiences. You can also play \"god\" at any time: inject events, edit memories or traits, and watch the social dynamics shift in response.\n\n**NPC Generation flow:** Click **Spawn NPC** in the game world → input location → the Orchestrator calls Gemini to design a character with local knowledge, personality, and backstory → sprite generated via `gemini-2.5-flash-image` → NPC appears on the map (~30s). Walk up and press **Z** to interact. Click **Spawn NPC** again to edit or delete existing NPCs.\n\n### OSM Whitebox — Global Map Generation Pipeline (Mode 3)\n\nWhen you generate a pixel map for any location on Earth, the first step is building the **OSM whitebox**:\n\n- Queries the **OpenStreetMap Overpass API** for all building footprints in the selected area (coordinates + `height` \u002F `building:levels` tags).\n- Renders an isometric PNG at 1280×960 with the same camera angles as the 3D Tiles viewer:\n  - **Roof faces**: light grey with outlines for shape clarity.\n  - **Wall faces**: shaded by orientation — right-facing walls get medium grey, left-facing walls darker grey.\n  - **Background**: near-black for contrast.\n- **Contains**: building geometry only — footprints, heights, and 3D shapes. No roads, water, vegetation, labels, or terrain.\n- **Why it's needed**: The whitebox acts as a **geometric blueprint** for the AI. When Gemini generates the pixel-art map, it's instructed to place every white shape as a building at exactly the same position. Without this constraint, AI image generation would produce aesthetically pleasing but geographically inaccurate buildings. The whitebox ensures the output preserves real-world building layouts.\n\n### Baidu Maps API\n\nThe Baidu Maps API provides street-level scene context for the reference collage pipeline:\n\n- **Baidu Maps Static Image API** (`staticimage\u002Fv2`): Given a coordinate, fetches a street-block scene image (实景图) at zoom level 17.\n- Used in the `Map_gen_RPG` pipeline to build a reference collage — satellite view on the left, Baidu street scene on the right — giving the AI both top-down and ground-level visual references.\n- Optional — the pipeline continues gracefully if the `BAIDU_MAP_AK` key is not configured.\n- Legacy: early versions used Baidu Maps WebGL API to capture 3D building whitebox screenshots (NYC-only, deprecated in favor of OSM Overpass for global coverage).\n\n---\n\n## Acknowledgments\n\nThis project stands on the shoulders of two incredible open-source projects:\n\n- **[isometric-nyc](https:\u002F\u002Fgithub.com\u002Fcannoneyed\u002Fisometric-nyc)** ([isometric.nyc](https:\u002F\u002Fisometric.nyc)) — The first open-source project to combine AI generation with isometric pixel city maps at scale. It proved \"vibe-engineering\" could work, and its NYC tile pipeline is the foundation of Mode 2.\n- **[WorldX](https:\u002F\u002Fgithub.com\u002FYGYOOO\u002FWorldX)** — The AI world engine that powers character generation, dialogue, memory, and emergent narrative. One sentence in, a living world out.\n\nOpenPixel-RPG extends isometric-nyc's NYC pipeline to global coverage and integrates GeoPixel's character simulation for a complete AI JRPG experience.\n\n---\n\n## Project Structure\n\n```\nOpenPixel-RPG\u002F\n├── G_gen_pixel\u002F            # Mode 3 frontend + backends (5173 \u002F 5001 \u002F 5002)\n│   ├── server.py              # Main API: geocode, satellite, pixel generation, WorldX jobs\n│   ├── global_server.py       # Mode 3 API: OSM whitebox + three-image pipeline\n│   ├── whitebox\u002F              # OSM Overpass global whitebox generation\n│   ├── src\u002F                   # Vite frontend (main.js, three-column UI)\n│   ├── index.html             # Three-column layout (View+Pixel \u002F Global \u002F Game)\n│   ├── hyperparams.json       # Unified config (grid cells, canvas size, etc.)\n│   └── cache\u002F                 # Satellite image disk cache\n├── GeoPixel\u002F                # AI world engine (Mode 1\u002F2 NPC + agent simulation)\n│   ├── client\u002F                # React 19 + Phaser game client\n│   ├── server\u002F                # Node.js backend (Express + WebSocket + SQLite)\n│   │   ├── src\u002Fsimulation\u002F        # Custom agent simulation engine (perceive-decide-act loop)\n│   │   ├── src\u002Fcore\u002F              # World manager, character manager, memory manager\n│   │   └── src\u002Fllm\u002F               # LLM client (Simulation + Dialogue + Reflection)\n│   ├── orchestrator\u002F          # LLM world orchestration (Gemini 2.5 Pro)\n│   └── generators\u002F            # Map & character image generation (Gemini 3.1 Flash)\n├── WorldX-main\u002F             # WorldX game engine (map pipeline, game runtime)\n│   ├── generators\u002Fmap\u002F        # index-from-image.mjs (Steps 2–6: compress → TMJ output)\n│   └── client\u002F                # WorldX React + Phaser frontend\n├── Map_gen_RPG\u002F             # Satellite → pixel map pipeline (Baidu scene + ref collage)\n│   └── fetch_baidu_scene.py   # Baidu Maps Static Image API for street-level reference\n├── Blog\u002F                    # Documentation & tutorials (Chinese)\n├── Paper\u002F                   # Academic paper draft\n├── ref\u002F                     # Reference projects (isometric-nyc, etc.)\n└── video\u002F                   # Demo videos & GIFs\n```\n\n---\n\n## License\n\nMIT © OpenPixel-RPG contributors\n","OpenPixel-RPG 是一个基于AI的像素艺术开放世界JRPG项目，能够将地球上的任何地点转化为可互动的游戏世界。其核心功能包括通过输入地址或上传照片并描述所需风格来生成完整的互动像素地图和本地NPC。技术上，该项目使用了TypeScript开发，并集成了Google Gemini模型进行世界设计、地图与精灵生成、视觉质量审查及角色模拟等任务。此外，它还利用百度地图API提供街景参考，并深度整合了WorldX的AI世界引擎。适合用于创建个性化游戏体验、教育工具或者作为地理信息可视化的创新应用。",2,"2026-06-11 03:57:20","CREATED_QUERY"]