8.3 KiB
8.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
AIBIS Dream (also known as "AllOurBrokenParts") is a Unity-based narrative adventure game with investigative elements. The project uses Yarn Spinner for dialogue, features a custom framework with modular systems, and includes multiple mini-games and a modular repair/fix system.
Unity Version: 2022.3.7f1c1 (Universal Render Pipeline)
Architecture
Core Framework (Assets/Scripts/Framework/)
Modular framework with Kit-pattern utilities:
- ActionKit: Action sequencing and command pattern
- AudioKit: Audio management (includes FMOD integration)
- Config / Core: Configuration and core utilities
- EventSystemKit: Decoupled event system
- LogKit: Structured logging with categories
- PoolKit: Object pooling
- ResourceKit: Asset loading via
ResourceSystem(Addressables-based)- Note: New code must use
ResourceSystem, neverResources.Load. See Resource Loading Best Practices. Asset placement rules in Resource Management Spec.
- Note: New code must use
- SelectorKit: Weighted/batch/non-repeat random selection
- SingletonKit: Singleton base classes
- StateMachineKit: State management
- OtherKit: Miscellaneous utilities (
CameraKit,AnimatorKit,FadeKit,LocalizationKit, etc.) - Attribute: Custom editor attributes
Key Game Systems
- Game Loop (Scripts/Game Loop/):
GameManager(Singleton entry),StorageSystem(save + Yarn variables),SceneLoader,ChapterController,TalkSceneSO - Dialog System (Scripts/Dialog System/): Yarn Spinner integration —
DialogController,LineRunner,LocalisedLineProvider,BaseYarnCommand - SceneManagement (Scripts/SceneManagement/):
ActorKit/,AnimatorKit/,EnvironmentKit/,SpawnerKit/,TimelineKit/,SceneCenter/,DreamDoorSystem - UI (Scripts/UI/):
DialogUI/,Panel/,Form/,Components/,Cursor/,UIManager - MiniGame (Scripts/MiniGame/):
HuoShan/(language particles, EmotionWave),BlockPuzzle/,Peipei/(Eye, CutLine, Memory) - FixSystem (Scripts/FixSystem/): Legacy — HeatMap, PunchTape, Memory, screen effects
- FixSystemNew (Scripts/FixSystemNew/): Active repair system —
FixSystemCenter,BodyModule/,Cable/,WhackMole/,Screen System/,Open/,Clinic/ - AssetRefs (Scripts/AssetRefs/): Addressable key constants (
ConstRef,FixAssetRef,TimelineAssetRef)
Content & Localization
- Assets/GameContent/: Runtime assets by scope (
Common/,UI/,Scene_{Name}/,Feature_{Name}/) - Assets/Language/: Unity Localization tables (runtime active:
UIText/,Locales/,Sprite/;Dialog/、ActorName/、Params/currently kept as migration backups) - Assets/Resources/Yarn/: Current Yarn dialogue files (target migration to
Assets/Narrative/per spec, not yet complete) - Assets/StreamingAssets/Config/: CSV-driven localized gameplay data (
character.csvfor actor names,params.csvforl10n.*substitution terms) - Assets/Prototype/: HTML/JS prototypes for mechanic testing
Critical Dependencies
Unity Packages
- Yarn Spinner 2.4.2 (OpenUPM), Addressables 1.21.21, Cinemachine 2.9.7
- URP 14.0.8, TextMesh Pro 3.0.6, Timeline 1.7.5, Localization 1.4.5
- Visual Effect Graph 14.0.8, Visual Scripting 1.8.0
Third-Party
- FMOD (audio engine), DOTween (tweening), Shapes (vector graphics)
- More Mountains Feedbacks (game feel), Destructible 2D
Development Guidelines
Code Organization
- Each major system self-contained in its own folder under
Assets/Scripts/ - Kit-pattern utilities in
Framework/— reusable across systems - Singleton pattern for global managers (derived from
SingletonKit) - Favor composition over inheritance
- All runtime asset loading via
ResourceSystem— neverResources.Load
Scene Structure
- Scenes in
Assets/Scenes/;Persistencescene hosts global managers and Persistent Loader - Fix scenes:
{Character}FixScene(e.g.HuoShanFixScene,PeipeiFixScene,ExpressFixScene) - Test scenes:
languageTest,HuoShanExpressionTest,wavetest, etc.
Addressables
- Config in
Assets/AddressableAssetsData/; Groups:Core,Scene_*,Feature_*,Shared_*,Localization-* - Key format:
Category/Path(e.g.Animation/Peipei,Timeline/BlockPuzzle/PanelOpen) - Scene keys use bare PascalCase names (e.g.
ClinicOut) - Details in Resource Loading Best Practices
Yarn Dialogue Files
- Current path:
Assets/Resources/Yarn/(migration toAssets/Narrative/Yarn/planned) - Pattern:
{Character}_{Stage}.yarn; UTF-8 encoding required for Chinese
Yarn Line Tag Maintenance
- Line tags (
#line:xxxxxxx) must be unique across the entire file. Duplicate tags break Yarn Spinner localization. - Duplicates typically occur when copying an existing node to create a variant (e.g.
地铁ver1→地铁ver3). - Use the dedup tool (
Tools/dedup_yarn_tags.py) for bulk cleanup:# Preview duplicates from a specific node onward python Tools/dedup_yarn_tags.py Assets/Resources/Yarn/Fiction_Day1_begin/Fiction_Day1_begin.yarn --from-node 地铁ver4 # Fix duplicates from a specific line onward python Tools/dedup_yarn_tags.py Assets/Resources/Yarn/Fiction_Day1_begin/Fiction_Day1_begin.yarn --from-line 535 --fix # Scan an entire directory (preview only) python Tools/dedup_yarn_tags.py Assets/Resources/Yarn/ --scan-all
Yarn Script Generation
- Do NOT add
#line:tags when generating or editing Yarn dialogue. Leave all line-tag generation to the user's localization workflow (Unity Localization + Yarn Spinner import tools). - When creating new
.yarnfiles, write plain dialogue lines without any#line:suffixes.
Asset Naming
- Scripts: PascalCase (e.g.
DialogController.cs) - Addressable Keys:
Category/Path— no spaces, no extensions, ≤3 levels - Addressable Groups:
{Type}_{PascalCaseName}
Git & Commits
- LFS for large binaries; ignored: Library/, Temp/, Build/, *.csproj, *.sln
- Commit format:
<type>(<scope>): <subject>— subject in Chinese, type/scope in English - Extended types:
feat,fix,art,audio,scene,yarn,perf,refactor,style,docs,build,chore,test - See COMMIT_CONVENTION.md for full details
Key Build Commands
# Windows build
"C:\Program Files\Unity\Hub\Editor\2022.3.7f1c1\Editor\Unity.exe" -batchmode -quit -projectPath . -buildWindows64Player "Build/AIBIS_Dream.exe" -logFile Build/log.txt
Common Tasks
Adding a New Mini-Game
- Create
Assets/Scripts/MiniGame/{GameName}/ - Add assets to
Assets/GameContent/Feature_{GameName}/ - Create Addressable Group
Feature_{GameName} - Create test scene in
Assets/Scenes/
Adding Yarn Dialogue
- Create
.yarninAssets/Resources/Yarn/{Module}/ - Ensure YarnProject localization assets/CSV are updated (Unity
Assets/Language/Dialog/is backup-only during migration) - Reference in scene's
DialogueRunner; test withDialogController
Debugging & Performance
LogKitfor structured logging; Addressables Event Viewer for resource debugging- Monitor
SceneResourceLoader.TotalHandleCountfor leak detection - Always use PoolKit for frequent instantiation;
LoadUncachedAsync+EarlyReleasefor large Timeline assets - Use
LoadAsync<GameObject>+Instantiatefor prefabs, neverInstantiateAsync
Important Notes
- Narrative-focused game — dialogue and story take precedence
FixSystemNewis the active repair architecture;FixSystemis legacyStorageSystemserves as both save system and Yarn variable storage
Reference Documents
- Resource Loading Best Practices —
ResourceSystemAPI, Key/Group/Label naming, lifecycle - Resource Management Spec — Asset placement:
GameContent/,Narrative/,_Archive/ - Commit Convention — Commit message format and branch naming
- HuoShan Docs — Narrative flow, resources, test flowcharts
This document provides guidance for Claude Code when working with the AIBIS Dream codebase.