4.3 KiB
AGENTS.md
Project
Nox — Unity 6 party-based RPG. Code lives under Assets/Code/ with namespaces Nox.Core, Nox.Game, Nox.Input, Nox.Platform, Nox.Util. In-house packages under Packages/com.jovian.* are first-party code, not third-party.
Unity & Tools
- Unity: 6000.3.7f1 (C# 9.0, .NET Framework 4.7.1)
- URP: 17.3.0
- Input System: 1.18.0 (com.unity.inputsystem)
- Editor only — no CI/CD, no CLI build command. Build via Unity Editor → Windows target
Nox.exe. - Solution:
trail-into-darkness.slnat root. Rider is primary IDE (com.unity.ide.rider).
Boot Sequence
Boot.cs[RuntimeInitializeOnLoadMethod]loads"Initializer"addressable prefab (or"Startup"scene in FullBoot mode)EntryPoint.Start()coroutine initializes platform, creates game states, addsGameStateRunnerMonoBehaviourGameStateRunnerticks current state:SplashGameState→MainMenuGameState→GameModeGameState
Editor-only: BootMode.cs (Nox.EditorCode) controls boot mode (Full Boot, Scene Boot, Unity Default).
State Architecture
Dual-layer state:
- Game States (
IGameState): Application flow. Lifecycle:EnterGameState()→Tick()/LateTick()→ExitGameState()→Dispose() - Play Modes (
IPlayMode): GameModes insideGameModeGameState. Same tick lifecycle.
Central store: GameDataState holds ActiveGameState, ActivePlayMode, ActiveParty, platformSelector, activeSessionId.
Scene authoring: SceneReference MonoBehaviour per scene sets initial GameState. Enables standalone scene playback in editor.
Addressable Keys
Assets loaded by string key. Do not change keys without checking all callers: "Initializer", "AdventureMapPrefabs", "PauseMenuPrefabs", "AdventureSettings", "CharacterBaseSettings", "PerkRegistry", "CharacterRegistry", "BootstrapReferences".
Character System
Factory chain initialized from ScriptableObjects: CharacterSystemsFactory.Create() builds PerkFactory → CharacterAttributesFactory → CharacterStatsFactory → CharacterFactory → PartyFactory. Config loaded via Addressables.
Persistence
Jovian.SaveSystem package handles JSON serialization to Application.persistentDataPath. Nox wrapper: NoxSaveData.RestoreSavedData() loads NoxSavedDataSet (playMode, party, position, adventure data, game log). Save slots managed by SaveSlotManager.
Platform Abstraction
IPlatform interface with DesktopPlatform and UnityEditorPlatform implementations. Each initializes platform-specific IInput. Switched via PlatformSelector.
In-House Jovian Packages
com.jovian.savesystem— JSON persistencecom.jovian.encounter-system— data-driven encounters,IEncounterKindpayloads,EncounterLinkrefs,QuestProgressgating. Designer tool:Jovian → Encounters → Encounter Browsercom.jovian.calendar— in-game calendarcom.jovian.ingame-logging— runtime game logcom.jovian.popup-system— popup/dialog UIcom.jovian.zonesystem— zone/region managementcom.jovian.logger— dev loggingcom.jovian.utilities/com.jovian.inspector-tools— editor utilities
C# Style (from .editorconfig)
- 4 spaces, LF endings
varpreferred when type is apparent- Target-typed
new()when type is evident - No space after keywords in control flow:
if(notif ( - Braces on same line;
else/catch/finallyon new line - Block-scoped namespaces, usings outside namespace
- PascalCase types/methods/properties, camelCase all fields (public and private),
Iprefix interfaces - Expression-bodied: yes for properties/accessors/lambdas; no for constructors/methods/operators/local functions
- No
this.qualifier; language keywords (intnotInt32)
Planning Docs
Non-trivial features planned in docs/plans/ as paired files: {date}-{name}-design.md + {date}-{name}-implementation.md. Check here before starting new feature work.
Gotchas
- No test suite exists despite
com.unity.test-frameworkin manifest - No runtime build/lint/typecheck commands — all validation happens in Unity Editor
- Generated
.csprojfiles are Unity output, not source of truth for assembly structure Assets/Code/is the only code location to modify; never editPackages/com.jovian.*core unless working on that package