How onitaiaoi/where-daylight-pauses works
Purpose and Entry Point
This is a browser-based TypeScript game/application centered on player state, character interactions, UI screens, inventory, daily mood, and AI-backed chat. The primary bootstrap is src/main.ts, rendered through index.html. Core game constants and configuration are in src/core/GameConfig.ts and src/config.ts.
Application Composition
The app is organized as a client-side experience with feature-specific UI controllers rather than a server application. Major screens include the main HUD, character view, town map, rest house, passport, inventory, authentication, and NPC dialog:
• src/ui/MainHUD.ts
• src/ui/TownMapUI.ts
• src/ui/NpcDialogUI.ts
These modules likely own DOM construction/event handling for their respective game surfaces and are coordinated from the main runtime.
Player Identity and Persistence Boundary
Firebase is the persistence and identity boundary. src/firebase/config.ts initializes Firebase integration, while src/firebase/playerData.ts encapsulates reading and writing player-specific state. Authentication presentation is handled by src/ui/AuthUI.ts.
Primary flow: application startup initializes Firebase/configuration, authenticates or identifies a player, then loads player data for UI and game-state initialization. UI modules should depend on the player-data layer rather than directly coupling to Firebase.
Game State, Items, and Character Progression
Game-wide rules and player-facing state are defined across:
• src/core/GameConfig.ts
• src/config/itemRegistry.ts
• src/utils/inventoryUtils.ts
itemRegistry.ts is the canonical item-definition boundary; inventory operations should resolve item IDs through it rather than duplicating metadata. inventoryUtils.ts likely performs inventory transformations used by src/ui/InventoryUI.ts. Character and daily-state presentation are separated into src/ui/CharacterUI.ts and src/ui/DailyMoodUI.ts.
Conversational and AI Interaction
NPC/player chat is a distinct subsystem. src/ui/ChatUI.ts and src/ui/NpcDialogUI.ts provide interaction surfaces, while src/ai/geminiService.ts is the external AI-service adapter. Chat appearance/configuration is centralized in src/config/chatSkinsConfig.ts.
Control flow should remain: UI captures dialog input → AI service generates or retrieves a response → UI renders response and applies any allowed game-state effects. The Gemini adapter is the external-service boundary and should isolate provider-specific API behavior from UI modules.
Navigation and Gameplay Surfaces
The town map acts as the likely navigation hub (src/ui/TownMapUI.ts) between gameplay areas. The rest house and passport represent specialized gameplay/profile screens:
• src/ui/RestHouseUI.ts
• src/ui/PassportUI.ts
• src/ui/MainHUD.ts
MainHUD is the persistent cross-screen control/status layer; feature screens should avoid independently managing global navigation or shared player state.
Runtime and Assets
The runtime is a Node-managed TypeScript frontend project, indicated by package.json, root tsconfig.json, and installed dependencies in node_modules. Static client assets are served from public/assets/images. A nested daylight-pauses/ package has its own package.json and TypeScript configuration, indicating a separate or embedded package boundary that should not be assumed to share the root runtime configuration.
Main entry points: main.ts Application Bootstrap · playerData.ts Player Data · TownMapUI.ts Town Map · ChatUI.ts Chat UI
Components 22
Client Runtime
- HTML Entry
index.html - Application Bootstrap · Initializes the client runtime and coordinates screens.
src/main.ts - App Configuration
src/config.ts - Client Assets
public/assets/images - Daylight Pauses Package · Separate package with its own runtime configuration.
daylight-pauses
Game State
- Game Rules
src/core/GameConfig.ts - Item Registry · Canonical metadata for item IDs.
src/config/itemRegistry.ts - Inventory Operations
src/utils/inventoryUtils.ts - Chat Skins
src/config/chatSkinsConfig.ts
UI Surfaces
- Main HUD · Cross-screen controls and status.
src/ui/MainHUD.ts - Town Map · Navigation hub for gameplay areas.
src/ui/TownMapUI.ts - Character Screen
src/ui/CharacterUI.ts - Daily Mood
src/ui/DailyMoodUI.ts - Inventory Screen
src/ui/InventoryUI.ts - Rest House
src/ui/RestHouseUI.ts - Passport
src/ui/PassportUI.ts - Authentication
src/ui/AuthUI.ts - NPC Dialog
src/ui/NpcDialogUI.ts - Chat UI
src/ui/ChatUI.ts
External Boundaries
- Player Data · Encapsulates player-specific reads and writes.
src/firebase/playerData.ts - Firebase · Authentication and persistent player-state boundary.
src/firebase/config.ts - Gemini Adapter · Isolates provider-specific AI behavior from UI.
src/ai/geminiService.ts
Connections 26
- HTML Entry → Application Bootstrap: loads
- Application Bootstrap → App Configuration: reads
- Application Bootstrap → Game Rules: initializes with
- Application Bootstrap → Authentication: starts identity flow
- Authentication → Firebase: authenticates through
- Application Bootstrap → Player Data: loads player state
- Player Data → Firebase: persists via
- Application Bootstrap → Main HUD: mounts
- Application Bootstrap → Town Map: mounts
- Main HUD → Player Data: reads shared state
- Town Map → Character Screen: navigates to
- Town Map → Inventory Screen: navigates to
- Town Map → Rest House: navigates to
- Town Map → Passport: navigates to
- Town Map → NPC Dialog: opens
- Character Screen → Player Data: presents state
- Daily Mood → Player Data: presents state
- Inventory Screen → Inventory Operations: uses
- Inventory Operations → Item Registry: resolves item IDs
- Inventory Screen → Player Data: updates inventory
- NPC Dialog → Chat UI: uses
- Chat UI → Chat Skins: applies
- Chat UI → Gemini Adapter: sends dialog input
- Gemini Adapter → Chat UI: returns response
- NPC Dialog → Player Data: applies allowed effects
- Application Bootstrap → Client Assets: serves visuals