Skip to content
Dongshan Next Map Development logo

Dongshan Next Map Development

Expert guide for developing the Dongshan Next Map LBS game, covering 3-layer architecture, Zustand state management, custom Systems (LBS, Save, Quest), and HUD development.

SKILL.md

Full skill instructions

Dongshan Next Map Development Guidelines

This skill codifies the architectural patterns and systems of the Dongshan Next Map project. Follow these guidelines strictly to ensure code consistency and system stability.

🏗️ Architecture Overview

The project uses a strict 3-Layer Architecture.

graph TD
    UI[UI/​HUD Layer] -->|Reads| State[State Layer]
    UI -->|Calls| Systems[Systems Layer]
    Systems -->|Reads/​Writes| State
    Systems -->|Uses| API[API Layer]
    API -->|Queries| DB[Database Layer]

1. UI/​HUD Layer (Presentation)

  • Location: src/​components/​hud/
  • Role: Pure presentation. NO complex logic.
  • Rules:
    • Use fixed positioning for HUD overlays.
    • Set pointer-events: none on containers, auto on interactive elements.
    • Read data ONLY from Zustand stores.
    • NEVER directly modify Three.js objects; update store state instead.

2. Systems Layer (Logic)

  • Location: src/​systems/
  • Role: Reusable business logic and calculations.
  • Pattern: Static Classes with pure functions where possible.
  • Key Systems:
    • LBSManager: GPS <-> Three.js coordinate conversion.
    • InteractionSystem: Click detection and proximity triggers.
    • SaveSystem: LocalStorage and Cloud sync.
    • QuestSystem: Quest tracking and rewards.
    • InventorySystem: Item management.

3. State Layer (Data)

  • Location: src/​store/
  • Role: Single source of truth.
  • Tech: Zustand + Persist middleware.
  • Stores:
    • playerStore: User progress, inventory, stats.
    • gameStore: Scenarios, levels, active models, quests.
    • uiStore: Dialogs, menus, notifications.
    • locationStore: GPS coordinates, map state.

🛠️ Development Patterns

1. Adding a New Quest

To add a quest, you typically work with QuestSystem and gameStore.

import { QuestSystem } from '@/​systems/​QuestSystem';

// In a logic controller or initial load
QuestSystem.startQuest({
  id: 'quest_id',
  title: 'Quest Title',
  description: 'Quest Description',
  objectives: [
    {
      id: 'obj_1',
      description: 'Collect 5 items',
      type: 'collect', // or 'talk', 'explore'
      total: 5,
      progress: 0,
      completed: false
    }
  ],
  rewards: {
    experience: 100,
    coins: 50
  }
});

2. Handling Interactions

Do not write interaction logic in components. Use InteractionSystem.

import { InteractionSystem } from '@/​systems/​InteractionSystem';

// In your 3D component (e.g., inside an onClick handler)
const handleClick = () => {
  InteractionSystem.handleModelClick(modelId, userLocation);
};

3. Creating UI Components

Follow the HUD pattern to ensure separation from 3D.

// src/​components/​hud/​MyNewPanel.tsx
import { useUIStore } from '@/​store/​uiStore';

export default function MyNewPanel() {
  const isOpen = useUIStore(s => s.isMyPanelOpen);
  
  if (!isOpen) return null;

  return (
    <div className="fixed inset-0 z-50 pointer-events-none flex justify-center items-center">
        <div className="pointer-events-auto bg-black/​80 p-4 rounded text-white">
            {/​* Content */​}
        </​div>
    </​div>
  );
}

4. Coordinate Conversion

ALWAYS use LBSManager for positioning.

import { LBSManager } from '@/​systems/​LBSManager';

// Convert GPS to scene position
const position = LBSManager.latLngToXYZ(lat, lng, altitude);

⚠️ Critical Rules

  1. NO useState for Global State: If data needs to be shared or persisted, put it in a Zustand store.
  2. Separate UI from 3D: 2D UI elements should rarely be HTML/​CSS overlays, not generic HTML inside Three.js Canvas unless using regular HTML overlays is impossible.
  3. Static Systems: Keep systems stateless. They should read from stores and accept arguments.
  4. Type Safety: Always define interfaces for new data structures in src/​types/.

📚 Reference

  • Mapbox Integration: src/​components/​MapBase.tsx
  • 3D Layers: src/​components/​3d/​Game3DLayers.tsx
  • Store Definitions: src/​store/​*.ts
  • System Implementations: src/​systems/​*.ts

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View