Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bd2a086
chore(engine): upgrade target to Unity 6 LTS, fix deprecated FindObje…
Sen1F Jun 3, 2026
2e504c1
feat(phase1): Unity project setup, scenes, packages, asmdef
Sen1F Jun 3, 2026
efef1cf
feat(phase1): first playable — player movement, camera, scene setup c…
Sen1F Jun 3, 2026
b7d44c2
chore(phase1): close Phase 1 — bundle ID, CI pipeline, compile-fix sync
Sen1F Jun 3, 2026
5a2e51f
feat(phase2): SceneRouter, AppStateMachine, GameLoop, CombatContext, …
Sen1F Jun 3, 2026
320bfbb
fix(phase2): audit — compile errors, operator precedence, async-void,…
Sen1F Jun 3, 2026
837b932
fix(audit2): 13 bugs — element mismatch, bus leak, field name, DateTi…
Sen1F Jun 3, 2026
b27fd7b
feat(design): EnemyArchetype.Boss, DeathSacrificeEvent — low HP + min…
Sen1F Jun 3, 2026
2b5a7f1
feat(design): group-fight = all living zone enemies at combat start, …
Sen1F Jun 3, 2026
bc3a2ab
fix(audit3): DateTime fields, WorldManager singleton, player cache, G…
Sen1F Jun 3, 2026
58f0575
feat(design): sacrifice group = aggroed/alerted enemies only via Enem…
Sen1F Jun 3, 2026
633139a
feat(ui): death messages — dramatic, contextual, two-line body + verd…
Sen1F Jun 3, 2026
badd694
fix(audit4): touch input, bus-clear scope, SceneRouter in Awakening, …
Sen1F Jun 3, 2026
14f69a3
fix(compile): ISaveManager.IsDirty missing from interface, FindObject…
Sen1F Jun 3, 2026
577348c
fix(compile): clear all editor errors and warnings — IsDirty interfac…
Sen1F Jun 3, 2026
bc7d945
fix(editor): auto-register tags in TagManager before assignment, fix …
Sen1F Jun 3, 2026
e912c28
feat(editor): FenrirNavMeshSetup — one-click NavMeshSurface bake for …
Sen1F Jun 3, 2026
147ac7d
fix(asmdef): add Unity.AI.Navigation reference to Fenrir.Editor assembly
Sen1F Jun 3, 2026
94fb0f5
refactor(editor): merge 7 setup scripts into single FenrirSetup.cs — …
Sen1F Jun 3, 2026
b777fb2
fix(ci): skip Unity build gracefully when license secrets missing, fi…
Sen1F Jun 3, 2026
51afaf0
chore(ci): remove Unity build job — Personal license activation unsup…
Sen1F Jun 3, 2026
0507d75
fix(editor): spawn AshWolf at 14u — outside 8f detection range, fix N…
Sen1F Jun 3, 2026
71f4c25
fix(editor): destroy-recreate AshWolf on setup, add Player/Enemy phys…
Sen1F Jun 3, 2026
a3b0764
fix(editor): revert broken layer setup, fix push via trigger collider
Sen1F Jun 3, 2026
50cea61
fix(editor): auto-restore URP pipeline asset in Setup Project
Sen1F Jun 3, 2026
855b2a2
chore(repo): gitignore Unity crash artifacts, remove recovery leftovers
Sen1F Jun 12, 2026
6f72b7f
feat(scenes): save Setup Project output — wired scenes, Player/Enemy/…
Sen1F Jun 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 18 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,31 @@ name: CI

on:
push:
branches: [main, develop]
branches: [main, develop, "feature/**", "fix/**", "chore/**"]
pull_request:
branches: [main, develop]

jobs:
# ── Phase 0: docs validation ──────────────────────────────────────────────
docs:
name: Lint Markdown
# ── Markdown lint (always runs) ───────────────────────────────────────────────
lint-docs:
name: Lint docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g markdownlint-cli
- run: markdownlint "**/*.md" --ignore node_modules

- name: Install markdownlint-cli
run: npm install -g markdownlint-cli

- name: Lint docs
run: markdownlint "**/*.md" --ignore node_modules

# ── Phase 1+: Swift / Xcode build ─────────────────────────────────────────
# Uncomment when the Xcode project lands in /src
#
# swift:
# name: Build & Test (iOS)
# runs-on: macos-14 # Xcode 15
# steps:
# - uses: actions/checkout@v4
#
# - name: Select Xcode
# run: sudo xcode-select -s /Applications/Xcode_15.4.app
# ── Unity build + EditMode tests ─────────────────────────────────────────────
#
# - name: Build
# run: |
# xcodebuild build-for-testing \
# -project src/Fenrir.xcodeproj \
# -scheme Fenrir \
# -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.5' \
# CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
# NOTE: Unity 6 Personal licenses no longer support automated activation.
# Unity dropped the .ulf manual activation and Hub OAuth cannot be scripted.
# Unity build + tests run locally via Window → General → Test Runner → EditMode.
#
# - name: Test
# run: |
# xcodebuild test \
# -project src/Fenrir.xcodeproj \
# -scheme Fenrir \
# -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.5' \
# CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
# To re-enable this job in future (Unity Pro serial or Unity Build Automation):
# 1. Obtain a Unity Pro serial or configure Unity Build Automation
# 2. Add UNITY_LICENSE / UNITY_EMAIL / UNITY_PASSWORD secrets
# 3. Uncomment the unity-build job below
# ─────────────────────────────────────────────────────────────────────────────
24 changes: 15 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# ───────────────────────────────────────
# Unity generated
# ───────────────────────────────────────
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
# Unity generated (any depth — covers src/ProjectFenrir/ and repo root)
# ───────────────────────────────────────
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Uu]ser[Ss]ettings/

# Unity cache and packaging
*.pidb.meta
Expand Down Expand Up @@ -59,3 +59,9 @@ DerivedData/
# ───────────────────────────────────────
*.local.json
.env
Unity_v6000.4.9f1.alf

# Unity crash artifacts
mono_crash.*.json
**/Assets/_Recovery/
**/Assets/_Recovery.meta
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

| Layer | Choice | Rationale |
| --- | --- | --- |
| Engine | Unity 2022 LTS | Proven stable, long-term support, strong iOS export |
| Engine | Unity 6 LTS | Proven stable, long-term support, strong iOS export |
| Render pipeline | URP (Universal Render Pipeline) | Mobile-optimised, supports custom shaders, good lighting |
| Language | C# (.NET Standard 2.1) | Unity standard |
| Input | Unity New Input System | Touch-native, action-map based |
Expand Down Expand Up @@ -294,7 +294,7 @@ Tested on-device only. Unit tests use `IKeychainBridge` mock returning a fixed s

## Phase 1 Deliverables

- [ ] Unity 2022 LTS project created, URP configured
- [ ] Unity 6 LTS project created, URP configured
- [ ] `_Project/` folder structure scaffolded
- [ ] New Input System package installed and configured
- [ ] `Bootstrap.unity` scene with `ServiceLocator` skeleton
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Context file for Claude Code. Read this before touching any file in the repo.

## What this project is

**Project Fenrir** is a semi-open-world action RPG for iOS built in Unity 2022 LTS (URP).
**Project Fenrir** is a semi-open-world action RPG for iOS built in Unity 6 LTS (URP).
The core mechanic is a **hidden trait system**: the player's behavior shapes 10 invisible traits which, when thresholds are met, trigger an **evolution** — a permanent, character-defining transformation.

Full design docs are in the repo root:
Expand All @@ -28,7 +28,7 @@ Read the relevant doc before changing anything in its domain.

| Layer | Choice |
| --- | --- |
| Engine | Unity 2022 LTS + URP |
| Engine | Unity 6 LTS + URP |
| Language | C# (.NET Standard 2.1) |
| Rendering | URP (Universal Render Pipeline) |
| Input | Unity Input System (Enhanced Touch) |
Expand Down
213 changes: 213 additions & 0 deletions DEVELOPMENT_DIARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# Project Fenrir — Development Diary

A running log of what was built, why, and what's next. Written for quick re-orientation after any gap.

---

## Session 1 — Game Definition & Design Layer

**Date:** 2026-06-01

### What we did

Defined the entire game from scratch. Started with a 5-phase roadmap and worked through every major design question before writing a single line of code.

**Documents produced:**

- `GDD.md` — full game design document covering concept, pillars, systems, MVP scope
- `LORE.md` — world history, the Fenrir Principle, locked canon decisions
- `HIDDEN_TRAIT_SYSTEM.md` — 10 traits, signal map, frequency dampening, death taxonomy
- `EVOLUTION_SYSTEM.md` — tier structure, 4 MVP evolutions, fit scoring, UX sequence
- `COMBAT_SYSTEM.md` — input scheme, energy, abilities, enemy archetypes, Emberlord boss
- `WORLD_DESIGN.md` — 6 Ember Forest zones, shrines, NPCs, day/night, trait signals
- `AWAKENING_SYSTEM.md` — character creation, Keychain seed architecture, reroll rules
- `ARCHITECTURE.md` — Unity technical spec, folder structure, module contracts
- `ROADMAP.md` — phased plan with checklists
- `CHANGELOG.md`, `CONTRIBUTING.md`, `README.md`

**Key design decisions locked:**

- 10 hidden traits (Aggression, Mercy, Curiosity, Sacrifice, Dominance, Loyalty, Wisdom, Exploration, Recklessness, Patience) — all start at 50, range 0–100, never shown to player
- Trait signals come from behavior (combat style, dialogue choices, exploration, purchases) — not from explicit choices
- Frequency dampening kicks in after 5 identical events per session — prevents grinding
- Evolution Tier 1 is permanent. First evolution locks forever.
- Seeds stored in iOS Keychain — survive app deletion, never sync to iCloud
- One reroll per character slot ever — even survives character deletion
- Delete + recreate = original seed element restored
- Supreme rarity = ~0.1% total (~1 in 1,000), equivalent to pulling R9 in EAFC
- 5 death types each emit different trait signals (Ambush = no shift)
- 20-minute real-time day/night cycle, 4 phases

**Repo setup:**

- Private GitHub repo created: `Sen1F/project-fenrir`
- Git commit hook enforcing conventional commits: `type(scope): subject`

---

## Session 2 — Unity C# Scaffold (Phase 1 Foundation)

**Date:** 2026-06-02

### What we built

Wrote the entire Unity C# source tree from scratch — 56 files across 12 modules. No Unity project open yet, pure code.

**Modules written:**

| Module | Key files |
| --- | --- |
| Config | `Element.cs` (16 elements + tiers + opposites), `GameConfig.cs` (all constants), `TraitWeightsConfig.cs` (36 event→trait mappings) |
| Traits | `TraitKey.cs`, `TraitProfile.cs`, `BehaviorEvent.cs` (36 concrete events), `BehaviorEventBus.cs`, `ITraitAccumulator.cs`, `TraitAccumulator.cs` |
| Core | `Bootstrap.cs`, `ServiceLocator.cs`, `TaskExtensions.cs` |
| Evolution | `EvolutionCandidate.cs`, `EvolutionChecker.cs`, `EvolutionSequencer.cs`, `EvolutionSignatureConfig.cs`, `IEvolutionChecker.cs`, `ShrineController.cs` |
| Save | `SaveData.cs`, `ISaveManager.cs`, `SaveManager.cs`, `KeychainBridge.cs` |
| Awakening | `AwakeningSequencer.cs`, `ElementDistribution.cs`, `ElementSeedService.cs` |
| Entities/Player | `PlayerController.cs`, `PlayerHealth.cs`, `PlayerEnergy.cs`, `PlayerCombat.cs`, `PlayerTraitEmitter.cs` |
| Entities/Enemies | `EnemyBase.cs`, `EnemyAI.cs`, `EnemyHealth.cs`, `EnemyCombat.cs`, `EnemyTraitEmitter.cs` |
| Combat | `AttackData.cs`, `AttackResolver.cs`, `CombatSystem.cs`, `HitStateManager.cs` |
| Input | `InputHandler.cs`, `GestureRecognizer.cs`, `TouchMapper.cs` |
| World | `DayNightCycle.cs`, `DayPhase.cs`, `WorldManager.cs`, `RegionLoader.cs` |
| UI | `HUD.cs`, `EnergyBar.cs`, `JournalController.cs` |
| Audio | `AudioManager.cs` (expanded with day/night + combat music wiring) |
| StateMachine | `AppState.cs`, `GameState.cs`, `PlayerState.cs` |
| Analytics | `EventLogger.cs` |

**Native iOS plugins** (already existed from earlier):

- `KeychainPlugin.swift` — C-callable shims for Unity DllImport, Keychain read/write
- `iCloudPlugin.swift` — optional iCloud KV store for save sync (player opt-in only)

**JSON configs** (all complete):

- `TraitWeights.json` — 36 event→trait delta mappings
- `EvolutionSignatures.json` — 4 MVP evolution signatures with trait thresholds
- `EnemyDefinitions.json` — 5 enemies + Emberlord boss with phases

**Unit tests written:**

- `TraitAccumulatorTests.cs` — dampening, clamping, carryover
- `TraitProfileTests.cs` — neutral factory, clamp, session counts
- `EvolutionCheckerTests.cs` — eligibility, element gate, fit score
- `ElementDistributionTests.cs` — determinism, diversity, no Element.None
- `SaveManagerTests.cs` — round-trip, version, overridePath isolation

**Bugs fixed during scaffold:**

- `BehaviorEventBus` redesigned — original lambda-wrap approach made `Unsubscribe` impossible; replaced with wrapper map keyed by original handler identity
- `Bootstrap` was subscribing `BehaviorEventBus.Subscribe<BehaviorEvent>` (base type, never fires) — fixed to explicitly subscribe all 36 concrete event types
- `FindObjectOfType` deprecated in Unity 6 — replaced all with `FindAnyObjectByType`
- `[RequireComponent]` only takes 1 type per attribute — split multi-type decorators

**CLAUDE.md written** — context file for Claude Code CLI so future terminal sessions have full project context without re-explaining.

---

## Session 3 — Unity Project Setup

**Date:** 2026-06-02

### What was set up

Created the actual Unity project and wired everything up.

**Steps:**

1. Created Unity 6 LTS (6000.4.9f1) project via Unity Hub — Universal 3D template (URP)
- Location: `/Users/seni/Documents/Claude/Projects/Project Fenrir/src/ProjectFenrir`
- No Unity VCS — using existing Git repo
2. Updated engine target from Unity 2022 LTS → Unity 6 LTS across all docs and code
3. Added packages to `manifest.json`:
- `com.unity.cinemachine` 3.1.4
- `com.unity.textmeshpro` 3.2.0
- `com.unity.burst` 1.8.18 (pinned to fix internal Burst editor compilation errors)
- Input System, AI Navigation, Test Framework already included by template
4. Copied scripts, plugins, StreamingAssets, and Tests into Unity project
5. Wrote assembly definitions:
- `Fenrir.Runtime.asmdef` — all game scripts
- `Fenrir.Editor.asmdef` — editor-only scripts
- `Fenrir.Tests.EditMode.asmdef` — EditMode tests
6. Wrote `FenrirSceneSetup.cs` editor script — runs via **Fenrir → Setup Scenes**
- Creates Bootstrap, Awakening, EmberForest scenes
- Adds all GameObjects with correct components
- Adds all 3 scenes to Build Settings
7. Fixed compile errors:
- `SaveData` lists changed from `string[]` to `List<string>` (needed `.Add()` / `.Contains()`)
- Missing `using Fenrir.Config` in Bootstrap
- `[RequireComponent]` multi-type syntax fixed in PlayerCombat
8. **Fenrir → Setup Scenes** run successfully — all 3 scenes created, 0 errors

**Current scene hierarchy (EmberForest):**

```text
Player (PlayerController, PlayerHealth, PlayerEnergy, PlayerCombat, PlayerTraitEmitter, HitStateManager, CharacterController)
InputSystem (InputHandler, GestureRecognizer, TouchMapper)
WorldManager (WorldManager)
DayNightCycle (DayNightCycle)
CombatSystem (CombatSystem)
AudioManager (AudioManager, MusicLayer, SFXPool)
HUD (Canvas, HUD, EnergyBar, JournalController)
EventSystem
Directional Light
Main Camera
```text
---

## Session 4 — First Playable Milestone
**Date:** 2026-06-02

### What we did

Got the game to a playable state in the Editor for the first time.

**Scene work:**
- Wrote three editor utilities: `FenrirSceneSetup`, `FenrirSceneFinalize`, `FenrirWireReferences` — idempotent scene scaffolding scripts runnable from the Fenrir menu
- `FenrirSceneFinalize` handles: ground plane (200×200 units), player capsule mesh, Cinemachine camera with OrbitalFollow + RotationComposer, EventSystem fix, Player tag, SceneValidator attachment
- Added `SceneValidator.cs` — runs on Start in dev builds, logs clear errors for every missing critical component instead of crashing with NullRefs

**Compile fixes (6 total):**
- `SaveData`: `string[]` → `List<string>` for `.Add()` / `.Contains()` compatibility
- `Bootstrap`: missing `using Fenrir.Config`
- `PlayerCombat`: `[RequireComponent]` multi-type attribute split
- `SFXPool`: null prefab crash — now self-creates an AudioSource template if none assigned
- `MusicLayer`: `Reset()` only fires in Editor — added `Awake()` fallback for runtime
- All `FindFirstObjectByType` → `FindAnyObjectByType` (Unity 6 deprecation)

**Robustness pass:** Added `Awake()` auto-find fallbacks to `InputHandler`, `TouchMapper`, `GestureRecognizer`, `WorldManager`, `AudioManager` — eliminates NullRefs when serialized refs fail to persist across editor script runs.

**Input System:** Set Active Input Handling to `Input System Package (New)` in Project Settings. Replaced `StandaloneInputModule` with `InputSystemUIInputModule` on EventSystem.

**Packages added:** Cinemachine 3.1.4, TextMeshPro 3.2.0-pre.10, Burst 1.8.18 (pinned — Unity 6 template ships with a broken Burst version).

**Git:** Working on branch `chore/repo-setup`. Push with `git push origin chore/repo-setup`.

**Result:** Player capsule visible, WASD movement working, Cinemachine camera follows player, `SceneValidator` confirms all critical refs found, 0 compile errors.

---

## Current Status

**Phase 1 — Foundation:** ✅ Complete

### Done ✅
- Full design layer (all docs, all decisions locked)
- Full C# scaffold (61 files across 13 modules)
- Unity 6 LTS project, packages, assembly definitions
- 3 scenes in Build Settings (Bootstrap, Awakening, EmberForest)
- First playable — movement + camera working
- SceneValidator runtime guard
- Unit test framework wired (5 test files)
- CLAUDE.md for Claude Code CLI context

### Phase 2 — Next Steps (priority order)

1. **Run unit tests** — Window → Test Runner → EditMode → Run All (expect all green)
2. **Trait system smoke test** — add a `TraitDebugHUD` that shows live trait values in play mode; verify `DodgeUsedEvent` fires and `Patience` increases on Space key
3. **Spawn dummy enemy** — place an `EnemyBase` capsule in EmberForest, verify J-key attack reduces its HP and `LightAttackLandedEvent` fires
4. **Save round-trip** — play, move, quit, reopen scene, verify position/state restored
5. **iOS build target** — switch platform, set Bundle ID to `com.fenrir.game`, test on device
6. **Phase 2 proper** — load `TraitWeights.json` and `EvolutionSignatures.json` from StreamingAssets at runtime (currently using C# defaults); wire `EvolutionChecker` to shrine trigger

---

*Updated: 2026-06-02*
Loading
Loading