xiaohongshu
xiaohongshu
Core gameplay loop focusing on crime investigation, evidence photography, and time loop mechanics. Use when working on investigation features, photo system, or game progression.
Full skill instructions
Genre: First-Person Detective / Time Loop Mystery
Core Loop: Witness crime → Photograph evidence → Analyze clues → Repeat day → Solve mystery
Setting: Small town/village with recurring day cycle
Perspective: First-person with camera mechanics
Time Period: One repeating day (6 AM - 10 PM)
Crime Definition (public/data/events/*.json):
{
"id": "crime_theft",
"name": "The Bread Theft",
"type": "crime",
"triggerTime": "03:00",
"location": {"x": 10, "y": 0, "z": 15},
"description": "Someone stole fresh bread from the bakery",
"suspects": ["thief", "beggar"],
"evidence": [
{
"type": "photo",
"subject": "thief",
"location": "bakery",
"timeWindow": ["02:45", "03:15"]
}
]
}
Investigation Definition (public/data/investigations/*.json):
{
"id": "bread_thief",
"title": "Who Stole the Bread?",
"description": "The baker reports bread missing every morning",
"objectives": [
{
"id": "photograph_suspect",
"description": "Photograph the suspect near the bakery",
"type": "photo",
"required": true
},
{
"id": "find_witness",
"description": "Find someone who saw the crime",
"type": "dialogue",
"npcId": "guard"
}
],
"solution": {
"culprit": "thief",
"motive": "Hunger",
"evidence": ["photo_thief_bakery"]
}
}
Theft:
Vandalism:
Mystery/Suspicious Activity:
enum InvestigationState {
Locked, // Not yet discovered
Active, // Currently investigating
Solved, // Completed successfully
Failed // Time ran out or wrong conclusion
}
Evidence Types:
Evidence Chain:
Observe → Photograph → Analyze → Connect → Conclude
Clue Properties:
interface Clue {
id: string;
type: "photo" | "dialogue" | "item" | "timing";
content: string;
timestamp: string;
location: Vector3;
relatedNPC?: string;
importance: "critical" | "supporting" | "minor";
}
src/systems/photoSystem.ts)Core Concept: Camera is the primary investigation tool
Features:
Trigger: Press 'C' key or Click photo button
Photo Data Structure:
interface Photo {
id: string;
timestamp: string; // Game time when taken
location: {x: number, y: number, z: number};
cameraAngle: {x: number, y: number};
visibleNPCs: string[]; // IDs of NPCs in frame
buildingsInFrame: string[]; // Nearby buildings
timeOfDay: "dawn" | "morning" | "afternoon" | "evening" | "night";
thumbnail?: string; // Screenshot data
}
Evidence Value Calculation:
// Photo is valuable if:
- Taken during relevant time window
- Shows suspect near crime scene
- Captures interaction between NPCs
- Documents timeline of events
Photo Scoring:
interface PhotoScore {
relevance: number; // 0-10 (related to active investigation)
timing: number; // 0-10 (right time window)
composition: number; // 0-10 (subject visibility)
rarity: number; // 0-10 (unusual event captured)
}
View Mode:
- First-person camera switches to "photo mode"
- UI overlay with viewfinder
- Focus indicator on NPCs
- Timestamp display
- Film count remaining
Photo Restrictions:
In-Game Album:
- Photos organized by time taken
- Filter by: NPC, location, time
- Compare photos across loops
- Mark important photos
- Add notes to photos
Photo UI (src/ui/photoStack.ts):
- Polaroid-style display
- Click to enlarge
- See timestamp and location
- Compare with evidence list
Critical Evidence:
✓ Suspect at crime scene during crime time
✓ Unusual NPC interactions
✓ Items out of place
✓ Contradictions with NPC testimony
Supporting Evidence:
○ NPC schedules/patterns
○ Location relationships
○ Timeline of events
○ Witness presence
The Core Mechanic: Day repeats until mystery is solved
Day Structure:
06:00 - Day Start (player wakes)
08:00 - Town wakes up, NPCs start routines
12:00 - Midday, peak activity
15:00 - Afternoon, schedules continue
18:00 - Evening, some NPCs head home
21:00 - Night, reduced activity
05:59 - Day End (forced loop or manual reset)
First Loop:
Subsequent Loops:
Final Loop (Solved):
Automatic Reset:
// Day ends at 10 PM
if (currentTime >= 22:00) {
triggerLoopReset();
}
Manual Reset:
// Player can reset via menu
// Useful if stuck or want to retry
resetToMorning();
Solved Reset:
// After solving, day continues or loop ends
if (investigationSolved) {
breakLoop(); // or continueWithoutLoop();
}
What Carries Over:
✅ Photos taken (evidence album)
✅ Dialogue options unlocked
✅ Player knowledge (journal entries)
✅ Investigation progress
✅ Clue connections made
✅ NPC relationship levels
What Resets:
🔄 NPC positions (back to 6 AM)
🔄 NPC dialogue state
🔄 World state (crimes haven't happened)
🔄 Player position (spawn point)
🔄 Time (6:00 AM)
🔄 Dynamic objects (doors, items)
interface LoopData {
loopNumber: number; // How many loops completed
daysInLoop: number; // Total days experienced
investigationsActive: string[];
investigationsSolved: string[];
totalPhotos: number;
criticalEvidenceFound: boolean;
}
Knowledge Growth:
Loop 1: Witness crime, confused
Loop 2: Know when crime occurs, prepare camera
Loop 3: Know suspect patterns, strategic photos
Loop 4: Have full timeline, present evidence
Player Journal:
interface JournalEntry {
loop: number;
time: string;
content: string;
type: "observation" | "clue" | "theory";
relatedPhotos: string[];
}
1. OBSERVE
├─ Watch NPCs following schedules
├─ Notice unusual behavior
└─ Identify suspects
2. DOCUMENT
├─ Take photos of evidence
├─ Screenshot crime scenes
└─ Capture NPC interactions
3. ANALYZE
├─ Review photos in album
├─ Compare with NPC schedules
└─ Build timeline
4. INTERROGATE
├─ Talk to NPCs
├─ Present photos as evidence
└─ Unlock new dialogue
5. CONCLUDE
├─ Identify culprit
├─ Present evidence
└─ Solve investigation
6. LOOP (if not solved)
├─ Reset day
├─ Retain knowledge
└─ Refine approach
Movement:
Interaction:
Investigation:
Dialogue States:
interface DialogueNode {
id: string;
text: string;
conditions?: {
hasPhoto?: string; // Requires specific photo
timeRange?: [string, string];
loopNumber?: number; // Unlocks after X loops
investigationState?: string;
};
responses: DialogueChoice[];
}
Evidence Presentation:
// Show photo to NPC for reaction
presentEvidence(photo: Photo, npc: NPC) {
if (photo.visibleNPCs.includes(npc.id)) {
// NPC recognizes themselves
return npc.reactions.photograph_self;
} else if (photo.relatedToNPC(npc)) {
// Photo shows something NPC knows about
return npc.reactions.photograph_related;
}
}
public/data/events/
├── crime_theft.json - Bread theft crime
└── [future crimes]
public/data/investigations/
├── bread_thief.json - Bread theft investigation
└── [future mysteries]
public/data/packs/
└── bakery_scenario.json - Complete scenario with NPCs, crime, investigation
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
ls -1 public/data/events/*.json
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
ls -1 public/data/investigations/*.json
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
for f in public/data/investigations/*.json; do
echo "Checking $f..."
node -e "JSON.parse(require('fs').readFileSync('$f'))" && echo "✓ Valid"
done
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
grep -n "class PhotoSystem\|interface Photo" src/systems/photoSystem.ts
src/systems/photoSystem.ts - Photo capture & storage
src/systems/npcSystem.ts - NPC behavior & schedules
src/systems/hourlyCycle.ts - Event triggering
src/systems/loopManager.ts - Game loop management
src/ui/photoStack.ts - Photo display UI
public/data/events/ - Crime definitions
public/data/investigations/ - Investigation definitions
public/data/packs/ - Complete scenarios
Player Agency:
Environmental Storytelling:
Emergent Narrative:
Respect Player Time:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
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...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
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...
Display project status, active tracks, and next actions
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.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience