diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 7dc1bdc..e80c696 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -66,6 +66,9 @@ International-friendly framing. Explained via science (Nibirium, biotech, consci ### Backend +- **Current baseline:** Supabase + Go LLM Gateway remains the default until a backend ADR replaces it. +- **Nakama OSS:** Approved for a focused spike if research supports it. Do not adopt Nakama, Hiro, Satori, OpenAuth, or any new auth / social stack without an ADR and JOY approval. +- **Hiro / Satori:** Commercial / license-dependent candidates only. Do not assume they are open-source drop-in dependencies. - **Supabase Auth** (reuse DOS.Me pattern, do not invent new auth) - **Supabase Postgres** (durable state: profile, inventory, quest progress, NFT lock state, cultivation tier) - **Supabase Realtime** (chat global, presence, friend, party invite, notification - NOT for combat / movement sync) @@ -303,7 +306,7 @@ OUT of scope for vertical slice: 2. **NEVER let LLM mutate authoritative game state.** Server validates all intent. 3. **NEVER put API keys (Anthropic, OpenAI, Convai, ElevenLabs) in Unity client.** All LLM calls go through Go gateway. 4. **NEVER use Host Mode for production.** Server Mode dedicated only. -5. **NEVER add Nakama, OpenAuth, or new auth / social stack.** Reuse Supabase + DOS.Me patterns. +5. **NEVER add or replace backend / auth / social stack without an ADR and JOY approval.** Supabase + DOS.Me patterns remain the baseline. Nakama OSS may be spiked if the ADR keeps Fusion authoritative gameplay, Supabase identity compatibility, and clear exit criteria. 6. **NEVER change Unity Asset Serialization away from Force Text.** Breaks LFS + diff. 7. **NEVER claim "done" without reviewer pass** (JOY is non-coder, cannot review code himself). 8. **ALWAYS edit BOTH `.claude/CLAUDE.md` and `AGENTS.md` together when updating project context.** They are sister files - Claude Code auto-loads CLAUDE.md, Codex CLI / Cursor / Copilot auto-load AGENTS.md. Edit one without the other = drift; the un-updated file lies to whichever agent reads it. Both files MUST be identical except for the sister-file comment header at line 1. @@ -316,5 +319,6 @@ OUT of scope for vertical slice: - Hunter NFT integration approach: Option 1 (preset hero) vs Hybrid 1+3 (modular pieces) - Phase 2 LLM model split (when to use Haiku vs Sonnet) - Voice NPC vendor (OpenAI Realtime vs ElevenLabs vs self-host) +- Backend platform selection: Supabase-first thin backend vs Nakama OSS game backend + Supabase identity bridge. Hiro / Satori require license and pricing review before adoption. - Dedicated server hosting (Hetzner specs, region) - Photon Fusion 2 license tier when scaling beyond Cloud free 20 CCU diff --git a/.gitignore b/.gitignore index 54c89ff..550ac7b 100644 --- a/.gitignore +++ b/.gitignore @@ -91,6 +91,10 @@ backend/dist/ # Photon credentials (if checked-in template) PhotonServerSettings.asset.local +# Paid Unity Asset Store assets (installed locally via Package Manager > My Assets) +Unity/Assets/ExplosiveLLC/ +Unity/Assets/ExplosiveLLC.meta + # Claude Code worktrees (ephemeral, per-session branches) .claude/worktrees/ diff --git a/AGENTS.md b/AGENTS.md index 4b8288b..b8181bf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -66,6 +66,9 @@ International-friendly framing. Explained via science (Nibirium, biotech, consci ### Backend +- **Current baseline:** Supabase + Go LLM Gateway remains the default until a backend ADR replaces it. +- **Nakama OSS:** Approved for a focused spike if research supports it. Do not adopt Nakama, Hiro, Satori, OpenAuth, or any new auth / social stack without an ADR and JOY approval. +- **Hiro / Satori:** Commercial / license-dependent candidates only. Do not assume they are open-source drop-in dependencies. - **Supabase Auth** (reuse DOS.Me pattern, do not invent new auth) - **Supabase Postgres** (durable state: profile, inventory, quest progress, NFT lock state, cultivation tier) - **Supabase Realtime** (chat global, presence, friend, party invite, notification - NOT for combat / movement sync) @@ -303,7 +306,7 @@ OUT of scope for vertical slice: 2. **NEVER let LLM mutate authoritative game state.** Server validates all intent. 3. **NEVER put API keys (Anthropic, OpenAI, Convai, ElevenLabs) in Unity client.** All LLM calls go through Go gateway. 4. **NEVER use Host Mode for production.** Server Mode dedicated only. -5. **NEVER add Nakama, OpenAuth, or new auth / social stack.** Reuse Supabase + DOS.Me patterns. +5. **NEVER add or replace backend / auth / social stack without an ADR and JOY approval.** Supabase + DOS.Me patterns remain the baseline. Nakama OSS may be spiked if the ADR keeps Fusion authoritative gameplay, Supabase identity compatibility, and clear exit criteria. 6. **NEVER change Unity Asset Serialization away from Force Text.** Breaks LFS + diff. 7. **NEVER claim "done" without reviewer pass** (JOY is non-coder, cannot review code himself). 8. **ALWAYS edit BOTH `.claude/CLAUDE.md` and `AGENTS.md` together when updating project context.** They are sister files - Claude Code auto-loads CLAUDE.md, Codex CLI / Cursor / Copilot auto-load AGENTS.md. Edit one without the other = drift; the un-updated file lies to whichever agent reads it. Both files MUST be identical except for the sister-file comment header at line 1. @@ -316,5 +319,6 @@ OUT of scope for vertical slice: - Hunter NFT integration approach: Option 1 (preset hero) vs Hybrid 1+3 (modular pieces) - Phase 2 LLM model split (when to use Haiku vs Sonnet) - Voice NPC vendor (OpenAI Realtime vs ElevenLabs vs self-host) +- Backend platform selection: Supabase-first thin backend vs Nakama OSS game backend + Supabase identity bridge. Hiro / Satori require license and pricing review before adoption. - Dedicated server hosting (Hetzner specs, region) - Photon Fusion 2 license tier when scaling beyond Cloud free 20 CCU diff --git a/Unity/Assets/Photon/FusionAddons.meta b/Unity/Assets/Photon/FusionAddons.meta new file mode 100644 index 0000000..94030ad --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 96a3ae57e12f52f4fbc86fb0bf0c7799 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC.meta b/Unity/Assets/Photon/FusionAddons/SimpleKCC.meta new file mode 100644 index 0000000..9459fa4 --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 192928a4ca0f54f45b70fc70a1bacc83 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.Editor.dll b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.Editor.dll new file mode 100644 index 0000000..c74d389 --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.Editor.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:474408151adf7975e28dc6cb18008277e494c6f3faa7db67dd72c9ec2bbca426 +size 7680 diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.Editor.dll.meta b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.Editor.dll.meta new file mode 100644 index 0000000..ee40310 --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.Editor.dll.meta @@ -0,0 +1,88 @@ +fileFormatVersion: 2 +guid: a465ada18102a154b9e2db2b3d0b3f7e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 1 + Exclude Win: 1 + Exclude Win64: 1 + Exclude iOS: 1 + - first: + Android: Android + second: + enabled: 0 + settings: + AndroidSharedLibraryType: Executable + CPU: ARMv7 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + iPhone: iOS + second: + enabled: 0 + settings: + AddToEmbeddedBinaries: false + CPU: AnyCPU + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.dll b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.dll new file mode 100644 index 0000000..4de3fe7 --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8fab447d3d071a39a49c8b33f2557be976f01b7a030e642ccdb262e8b72bc5f1 +size 75776 diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.dll.meta b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.dll.meta new file mode 100644 index 0000000..5c65f83 --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/Fusion.Addons.SimpleKCC.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 977dbcf975465374990f471e1497f563 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/release_history.txt b/Unity/Assets/Photon/FusionAddons/SimpleKCC/release_history.txt new file mode 100644 index 0000000..570c34d --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/release_history.txt @@ -0,0 +1,96 @@ +Photon Fusion Simple KCC Addon - Release History + +Last tested with Fusion SDK 2.0.6 Stable 1034 + +2.0.15 +- Fixed jitter when landing on collider edge - clearing DynamicVelocity.y when step-up is triggered in StepUpProcessor. + +2.0.14 +- Fixed Transform and Rigidbody position when simulating forward tick next frame after Render(). +- Fixed incorrect step-up activation when touching wall colliders but not pushing against. + +2.0.13 +- Compatibility fixes for shared mode plugin export. +- RealVelocity and RealSpeed now resets to zero after calling SimpleKCC.SetActive(false). +- SimpleKCC.ResetVelocity() now also resets RealVelocity and RealSpeed. + +2.0.12 +- KCC editor scripts compatibility with Fusion SDK 2.0.2. + +2.0.11 +- Improved teleport - the information is now reliably synchronized over the network. +- Removed TeleportThreshold from KCC Settings. +- Max prediction error and anti-jitter distance check is now set to 1 meter. +- Fixed SimpleKCC.HasTeleported and SimpleKCC.HasJumped for proxy objects (reliable implementation based on counters). +- Fixed SimpleKCC.HasTeleported and SimpleKCC.HasJumped - they are now set only once in first Render after FUN in which teleport/jump happened. +- SimpleKCC.SetPosition() now accepts optional parameters 'teleport' and 'allowAntiJitter'. + +2.0.10 +- Exposed MaxPenetrationSteps and CCDRadiusMultiplier in Simple KCC settings. +- Increased range of CCD radius multiplier from 25-75% to 10-90%. +- Improved precision of collision resolver for specific cases (corridors, 3 collisions with almost perpendicular penetration vectors). +- Refactoring of penetration correction algorithm, improved performance scalability. +- Added SimpleKCC.ResetVelocity() to reset state. +- Fixed proxy collider being destroyed on clients when SimpleKCC.IsActive is false. + +2.0.9 +- Improved multi-collider penetration correction. +- Fixes step-up. Now it requires horizontal movement push-back to activate. + +2.0.8 +- KCCSettings.ForcePredictedLookRotation is now synchronized over network by default and affects input authority only. +- Fixed teleport detection in network transform only interpolation. +- Look rotation is now snapped when teleport is detected. +- Removed temporary fix for incorrect interpolation data - fixed in 2.0.0 Stable 834. + +Version 2.0.7 +- KCC collider is now also controlled by KCC.IsActive. If the flag is set to false, the collider will be despawned. +- Exposed KCC.InvokeOnSpawn() - can be used for initialization upon KCC.Spawned() callback. +- Added KCC.SetLookRotation() with min/max pitch look rotation. +- Removed RenderTimeframe override on proxy interpolation. + +Version 2.0.6 +- Fixed stuck on the edge when finishing step-up. +- Added input accumulators - FloatAccumulator, Vector2Accumulator, Vector3Accumulator. + - These classes support accumulation of raw values, their smoothing and tick-aligned delta consumption. + - Typical use-case is accumulation of mouse delta passed through a network struct. + - The tick-aligned accumulation ensures that snapshot interpolated value in Render() will be smooth. +- Fixed downward sphere cast check in step-up. +- Added SimpleKCC.ProjectOnGround(). This is useful when calculating XZ input => XYZ velocity to move along ground tangent. + +Version 2.0.5 +Important +============================================================ +! Simple KCC proxy is no longer simulated by default. If you call Runner.SetIsSimulated(Object, true) from other script, the KCC will behave as predicted. +! Jump impulse vector in Move() function converted to float => XZ is not supported. +! Gravity vector in SetGravity() function converted to float => XZ is not supported. + +Changes +============================================================ +- Added gizmos when KCC is selected. +- Added KCCSettings.ForcePredictedLookRotation - skips look rotation interpolation in render for local character and can be used for extra look responsiveness with other properties being interpolated. +- Added KCCSettings.ProxyInterpolation - controls interpolations of networked properties from network buffer, and propagation to Collider, Transform and Rigidbody components. +- Added KCCSettings.CompressNetworkPosition - optional network traffic reduction for non-player characters. Full precision position is synchronized by default. +- Improved step detection configuration (added min push-back to trigger step-up, toggle to require ground target point, variable ground check radius). Backport from Advanced KCC 2.0. +- Removed Runner.SetIsSimulated(Object, true) from KCC - proxies are no longer simulated. +- Removed networked keep-alive flag. +- Performance optimizations for proxies. +- Fixed projection of depenetration vector, resulting in jitter on slopes. + +Version 2.0.4 +- Changed root namespace from Fusion.SimpleKCC to Fusion.Addons.SimpleKCC. + +Version 2.0.3 +- Performance and network traffic optimizations. +- Fixed interpolation in Shared Mode. +- Added support for position and rotation handles. +- Compatibility with latest Fusion SDK. + +Version 2.0.2 +- Performance optimizations. + +Version 2.0.1 +- Exposed KCC Settings. + +Version 2.0.0 +- Initial release. diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/release_history.txt.meta b/Unity/Assets/Photon/FusionAddons/SimpleKCC/release_history.txt.meta new file mode 100644 index 0000000..e09aec3 --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/release_history.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f4b413b5ce4f20d488e9fe7cf207a21d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/simple_kcc_build_info.txt b/Unity/Assets/Photon/FusionAddons/SimpleKCC/simple_kcc_build_info.txt new file mode 100644 index 0000000..a354c4d --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/simple_kcc_build_info.txt @@ -0,0 +1,3 @@ +version: 2.0.15 1024 +date: 2025-11-03 16:31:05 +git: main (a4a4ff6) \ No newline at end of file diff --git a/Unity/Assets/Photon/FusionAddons/SimpleKCC/simple_kcc_build_info.txt.meta b/Unity/Assets/Photon/FusionAddons/SimpleKCC/simple_kcc_build_info.txt.meta new file mode 100644 index 0000000..0c84922 --- /dev/null +++ b/Unity/Assets/Photon/FusionAddons/SimpleKCC/simple_kcc_build_info.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4dbd84bb484c6e54193dc133ef632606 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Unity/Assets/_SecondSpawn/Prefabs/Player_NetworkCube.prefab b/Unity/Assets/_SecondSpawn/Prefabs/Player_NetworkCube.prefab index 2cfbe51..8119b2b 100644 --- a/Unity/Assets/_SecondSpawn/Prefabs/Player_NetworkCube.prefab +++ b/Unity/Assets/_SecondSpawn/Prefabs/Player_NetworkCube.prefab @@ -10,10 +10,11 @@ GameObject: m_Component: - component: {fileID: 999036358833122982} - component: {fileID: 8687074654810685659} - - component: {fileID: 4513379572288692258} - component: {fileID: 6036230797588115926} + - component: {fileID: 7123456789012345679} - component: {fileID: 8357749372956170795} - component: {fileID: 8359936860818564255} + - component: {fileID: 7123456789012345678} m_Layer: 0 m_Name: Player_NetworkCube m_TagString: Untagged @@ -44,27 +45,6 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5762444949739102863} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!65 &4513379572288692258 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5762444949739102863} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} --- !u!23 &6036230797588115926 MeshRenderer: m_ObjectHideFlags: 0 @@ -114,6 +94,33 @@ MeshRenderer: m_SortingOrder: 0 m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!54 &7123456789012345679 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5762444949739102863} + serializedVersion: 5 + m_Mass: 1 + m_LinearDamping: 0 + m_AngularDamping: 0.05 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 1, y: 1, z: 1} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 1 + m_UseGravity: 0 + m_IsKinematic: 1 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 --- !u!114 &8357749372956170795 MonoBehaviour: m_ObjectHideFlags: 0 @@ -124,13 +131,14 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: -1552182283, guid: e725a070cec140c4caffb81624c8c787, type: 3} - m_Name: + m_Name: m_EditorClassIdentifier: Fusion.Runtime.dll::Fusion.NetworkObject SortKey: 3133618377 SendPriority: 1 - Flags: 262146 + Flags: 262402 NestedObjects: [] NetworkedBehaviours: + - {fileID: 7123456789012345678} - {fileID: 8359936860818564255} ForceRemoteRenderTimeframe: 0 --- !u!114 &8359936860818564255 @@ -143,13 +151,48 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: f24eeab6b4af9434ea9eef6a45ab299a, type: 3} - m_Name: + m_Name: m_EditorClassIdentifier: SecondSpawn.Networking::SecondSpawn.Networking.NetworkPlayer - _NetworkedPosition: {x: 0, y: 0, z: 0} - _NetworkedRotation: {x: 0, y: 0, z: 0, w: 0} _CultivationTier: 0 _Hp: 0 _Stamina: 0 _IsAgentControlled: RawValue: 0 _moveSpeed: 5 +--- !u!114 &7123456789012345678 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5762444949739102863} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -1869825851, guid: 977dbcf975465374990f471e1497f563, type: 3} + m_Name: + m_EditorClassIdentifier: Fusion.Addons.SimpleKCC.dll::Fusion.Addons.SimpleKCC.SimpleKCC + _stateAuthorityChangeErrorCorrectionDelta: 0.15 + _settings: + Shape: 1 + IsTrigger: 0 + Radius: 0.5 + Height: 2 + Extent: 0.035 + ColliderLayer: 0 + CollisionLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + ProxyInterpolationMode: 0 + MaxPenetrationSteps: 8 + CCDRadiusMultiplier: 0.75 + AntiJitterDistance: {x: 0.025, y: 0.01} + CompressNetworkPosition: 0 + ForcePredictedLookRotation: 1 + StepHeight: 0.3 + StepDepth: 0.2 + StepSpeed: 1 + StepMinPushBack: 0.5 + StepGroundCheckRadiusScale: 0.5 + StepRequireGroundTarget: 0 + SnapDistance: 0.4 + SnapSpeed: 4 diff --git a/Unity/Assets/_SecondSpawn/Scripts/Gameplay/PlayerController.cs b/Unity/Assets/_SecondSpawn/Scripts/Gameplay/PlayerController.cs index ee10123..0ca259d 100644 --- a/Unity/Assets/_SecondSpawn/Scripts/Gameplay/PlayerController.cs +++ b/Unity/Assets/_SecondSpawn/Scripts/Gameplay/PlayerController.cs @@ -5,14 +5,16 @@ namespace SecondSpawn.Gameplay /// /// Top-down ARPG player controller stub. /// - /// Will eventually wrap Opsive Ultimate Character Controller for combat, - /// movement, and ability dispatch. Server-authoritative per Pillar 4 - /// (see docs/design/01-pillars.md): the client predicts visually but - /// the dedicated Photon Fusion 2 server validates every action. + /// Starts as a project-owned movement contract. Fusion Simple KCC and + /// Opsive Ultimate Character Controller can be evaluated against this + /// baseline later. Server-authoritative per Pillar 4 (see + /// docs/design/01-pillars.md): the client predicts visually but the + /// dedicated Photon Fusion 2 server validates every action. /// /// TODO (slice phase 2): - /// - Wire Opsive UCC abilities to the server intent schema - /// (backend/gateway/internal/intent/intent.go). + /// - Spike Fusion Simple KCC based on Photon Pirate Adventure patterns. + /// - Evaluate Opsive UCC abilities only after the smaller Fusion-native + /// movement path is proven. /// - Hook input via Unity Input System (already imported as /// InputSystem_Actions.inputactions). /// - Bridge to NetworkRunnerSetup for Networked state authority. diff --git a/Unity/Assets/_SecondSpawn/Scripts/Networking/NetworkPlayer.cs b/Unity/Assets/_SecondSpawn/Scripts/Networking/NetworkPlayer.cs index 1063cc4..449fe11 100644 --- a/Unity/Assets/_SecondSpawn/Scripts/Networking/NetworkPlayer.cs +++ b/Unity/Assets/_SecondSpawn/Scripts/Networking/NetworkPlayer.cs @@ -1,4 +1,5 @@ using Fusion; +using Fusion.Addons.SimpleKCC; using UnityEngine; namespace SecondSpawn.Networking @@ -17,10 +18,9 @@ namespace SecondSpawn.Networking /// [Networked] properties (session layer). /// [DisallowMultipleComponent] + [RequireComponent(typeof(SimpleKCC))] public sealed class NetworkPlayer : NetworkBehaviour { - [Networked] public Vector3 NetworkedPosition { get; set; } - [Networked] public Quaternion NetworkedRotation { get; set; } [Networked] public int CultivationTier { get; set; } [Networked] public float Hp { get; set; } [Networked] public float Stamina { get; set; } @@ -28,15 +28,22 @@ public sealed class NetworkPlayer : NetworkBehaviour /// True when the offline AI agent is driving this character (Pillar 1). [Networked] public NetworkBool IsAgentControlled { get; set; } - [SerializeField, Tooltip("Movement speed in units/second. Will be replaced by Opsive UCC stats in slice phase 2.")] + [SerializeField, Tooltip("Movement speed in units/second. Simple KCC owns authoritative movement for this spike.")] private float _moveSpeed = 5f; + private SimpleKCC _kcc; + + private void Awake() + { + _kcc = GetComponent(); + } + public override void Spawned() { + _kcc ??= GetComponent(); + if (HasStateAuthority) { - NetworkedPosition = transform.position; - NetworkedRotation = transform.rotation; CultivationTier = 1; // Awakening - starting tier per docs/design/04-cultivation-system.md Hp = 100f; Stamina = 100f; @@ -46,22 +53,29 @@ public override void Spawned() public override void FixedUpdateNetwork() { - // Server-authoritative input application. Client never mutates - // [Networked] state directly; client only sends INetworkInput - // suggestions which the server validates here. + if (_kcc == null) + { + return; + } + + var moveVelocity = Vector3.zero; + + // Server-authoritative input application. The client sends + // INetworkInput suggestions; Simple KCC owns predicted and + // replicated movement state for the character body. if (GetInput(out NetworkInputData input)) { var move = new Vector3(input.HorizontalAxis, 0f, input.VerticalAxis); - if (move.sqrMagnitude > 0f) + move = Vector3.ClampMagnitude(move, 1f); + + if (move.sqrMagnitude > 0.0001f) { - NetworkedPosition += move.normalized * _moveSpeed * Runner.DeltaTime; + _kcc.SetLookRotation(Quaternion.LookRotation(move), preservePitch: false, preserveYaw: false); + moveVelocity = move * _moveSpeed; } } - // Apply networked transform to GameObject so all clients see the - // server-authoritative position. - transform.position = NetworkedPosition; - transform.rotation = NetworkedRotation; + _kcc.Move(moveVelocity, jumpImpulse: 0f); } } } diff --git a/Unity/Assets/_SecondSpawn/Scripts/Networking/SecondSpawn.Networking.asmdef b/Unity/Assets/_SecondSpawn/Scripts/Networking/SecondSpawn.Networking.asmdef index 54db47d..ec31798 100644 --- a/Unity/Assets/_SecondSpawn/Scripts/Networking/SecondSpawn.Networking.asmdef +++ b/Unity/Assets/_SecondSpawn/Scripts/Networking/SecondSpawn.Networking.asmdef @@ -5,6 +5,7 @@ "Fusion.Runtime", "Fusion.Common", "Fusion.Realtime", + "Fusion.Addons.SimpleKCC", "Unity.InputSystem" ], "includePlatforms": [], diff --git a/Unity/Packages/manifest.json b/Unity/Packages/manifest.json index 7ba6d86..d880700 100644 --- a/Unity/Packages/manifest.json +++ b/Unity/Packages/manifest.json @@ -1,7 +1,7 @@ { "dependencies": { "com.coplaydev.unity-mcp": "https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main", - "com.unity.ai.assistant": "2.7.0-pre.3", + "com.unity.ai.assistant": "2.8.0-pre.1", "com.unity.ai.inference": "2.6.1", "com.unity.ai.navigation": "2.0.12", "com.unity.collab-proxy": "2.12.4", diff --git a/Unity/Packages/packages-lock.json b/Unity/Packages/packages-lock.json index dc2d9da..f718263 100644 --- a/Unity/Packages/packages-lock.json +++ b/Unity/Packages/packages-lock.json @@ -17,7 +17,7 @@ "dependencies": {} }, "com.unity.ai.assistant": { - "version": "2.7.0-pre.3", + "version": "2.8.0-pre.1", "depth": 0, "source": "registry", "dependencies": { diff --git a/docs/README.md b/docs/README.md index 08783ac..dd6c290 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,13 +19,15 @@ This documentation is the canonical public design and architecture source for th The current implementation focus is a thin, networked player-controller prototype: - Minimal Fusion controller first. -- Opsive Ultimate Character Controller evaluated after the baseline works. +- Simple KCC spike from Photon Pirate Adventure patterns second. +- Opsive Ultimate Character Controller evaluated only after that smaller Fusion-native path is tested. - No large Unity asset imports until the movement, camera, and authority contract are verified. Relevant docs: - [Overview Design](design/06-overview-design.md) - [Networked Player Controller Prototype](design/07-player-controller-prototype.md) +- [Pirate Adventure Reference Review](design/09-pirate-adventure-reference-review.md) ## Signature Features @@ -37,7 +39,5 @@ Relevant docs: ## Documentation Rules - English is the canonical language for docs, code, commits, PRs, ADRs, and roadmap. -- Vietnamese notes may live under `docs/vi/` when needed, but English docs remain the source of truth. -- If Vietnamese notes and English docs conflict, the English canonical docs win. +- GitBook handles translated views from the English canonical docs. - `/docs` is public-facing through GitBook. Do not place private credentials, internal-only secrets, or unpublished partner details here. - diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 272492f..eff2242 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -16,6 +16,7 @@ - [Overview Design](design/06-overview-design.md) - [Networked Player Controller Prototype](design/07-player-controller-prototype.md) - [Time-as-Currency](design/08-time-as-currency.md) +- [Pirate Adventure Reference Review](design/09-pirate-adventure-reference-review.md) ## Architecture Decision Records @@ -33,5 +34,5 @@ - [Agent Handoff](setup/agent-handoff.md) - [Fusion Install](setup/fusion-install.md) +- [Paid Asset Setup](setup/paid-assets.md) - [Unity Conventions](setup/unity-conventions.md) - diff --git a/docs/design/03-systems-index.md b/docs/design/03-systems-index.md index e4b63cf..5506762 100644 --- a/docs/design/03-systems-index.md +++ b/docs/design/03-systems-index.md @@ -29,7 +29,7 @@ This index enumerates every system the game needs, categorizes by Core/Gameplay/ | # | System | Category | Priority | Status | Design Doc | Depends On | | --- | ---- | ---- | ---- | ---- | ---- | ---- | | 1 | NetworkRunner / Photon Fusion 2 setup | Core | MVP | Not started | (TDD pending) | - | -| 2 | Player Controller (minimal baseline, Opsive UCC evaluation later) | Core | MVP | Drafted | [07-player-controller-prototype.md](07-player-controller-prototype.md) | NetworkRunner | +| 2 | Player Controller (minimal baseline, Simple KCC spike, Opsive UCC evaluation later) | Core | MVP | Drafted | [07-player-controller-prototype.md](07-player-controller-prototype.md) | NetworkRunner | | 3 | Camera (top-down ARPG) | Core | MVP | Not started | (TDD pending) | Player Controller | | 4 | Input system (Unity Input System) | Core | MVP | Not started | - | Player Controller | | 5 | Zone scene management (1 zone vertical slice) | Core | MVP | Not started | (TDD pending) | NetworkRunner | @@ -97,7 +97,7 @@ This index enumerates every system the game needs, categorizes by Core/Gameplay/ ### Core Layer (depends on foundation) -6. Player Controller baseline / Opsive evaluation (#2) - depends on: NetworkRunner +6. Player Controller baseline / Simple KCC spike / Opsive evaluation (#2) - depends on: NetworkRunner 7. Camera (#3) - depends on: Player Controller 8. Input system (#4) - depends on: Player Controller 9. Zone scene management (#5) - depends on: NetworkRunner @@ -166,7 +166,7 @@ Aligned with [02-vertical-slice-spec.md](02-vertical-slice-spec.md) build phases | 1 | NetworkRunner setup (#1) | Phase 1 | M | Reference MetaDOS BR template | | 2 | Auth (#22) | Phase 1 | M | Reuse DOS.Me Supabase pattern | | 3 | Profile persistence (#18) | Phase 1 | S | | -| 4 | Player Controller baseline / Opsive evaluation (#2) | Phase 2 | M | Build minimal Fusion controller first; evaluate Opsive in isolation after baseline | +| 4 | Player Controller baseline / Simple KCC spike / Opsive evaluation (#2) | Phase 2 | M | Build minimal Fusion controller first; evaluate Simple KCC next; evaluate Opsive in isolation after that | | 5 | Camera + Input (#3, #4) | Phase 2 | S | Standard URP | | 6 | Zone scene management (#5) | Phase 2 | M | | | 7 | Combat (#6) | Phase 2 | L | Server-authoritative critical | @@ -196,7 +196,7 @@ Effort estimate: S = 1-3 days, M = 4-7 days, L = 1-2 weeks, XL = 2-4 weeks (solo | Metric | Count | | ---- | ---- | | Total systems identified | 36 | -| Design docs started | 4 (cultivation, overview design, player controller prototype, time-as-currency) | +| Design docs started | 5 (cultivation, overview design, player controller prototype, time-as-currency, Pirate Adventure reference review) | | Design docs reviewed | 0 | | Design docs approved | 0 | | MVP systems with TDD started | 0 | diff --git a/docs/design/06-overview-design.md b/docs/design/06-overview-design.md index 1d52b5b..d125354 100644 --- a/docs/design/06-overview-design.md +++ b/docs/design/06-overview-design.md @@ -65,15 +65,16 @@ The slice does not need large content volume. It needs a tight loop that proves ## Player Controller Direction -The current direction is **minimal networked controller first, Opsive evaluation second**. +The current direction is **minimal networked controller first, Fusion Simple KCC spike second, Opsive evaluation third**. Opsive Ultimate Character Controller is already purchased and may still be useful for combat, animation, ability handling, or camera tooling. It is not currently treated as mandatory for the first prototype because: - Fusion authority and input flow must be proven before adding a heavy third-party controller. - Top-down ARPG movement may be simpler than the full Opsive UCC feature set. - Unity 6.5 beta compatibility must be validated before betting the prototype on it. +- Photon's Pirate Adventure sample already demonstrates a smaller Fusion-native top-down controller path with Simple KCC. -The first prototype should create a small, project-owned movement contract. Opsive can then be imported and judged against that contract. +The first prototype should create a small, project-owned movement contract. Simple KCC can then be tested against that contract. Opsive can be imported later and judged against both. --- @@ -118,9 +119,10 @@ These are still vertical slice systems. They are only excluded from the first pl | 1 | Minimal networked player controller | Player spawns and moves in Play Mode without console errors. | | 2 | Top-down camera | Camera follows the local player and keeps the placeholder readable. | | 3 | Prototype control feel pass | Movement feels crisp enough for ARPG iteration. | -| 4 | Opsive evaluation branch | Import Opsive in isolation and compare value/cost against the baseline. | -| 5 | Combat prototype | Add one basic attack only after movement is stable. | -| 6 | Persistence/auth prototype | Supabase profile and login once local gameplay loop exists. | +| 4 | Simple KCC spike | Import official Fusion Simple KCC addon and compare it against the baseline. | +| 5 | Opsive evaluation branch | Import Opsive in isolation and compare value/cost against the baseline and Simple KCC spike. | +| 6 | Combat prototype | Add one basic attack only after movement is stable. | +| 7 | Persistence/auth prototype | Supabase profile and login once local gameplay loop exists. | --- @@ -142,6 +144,7 @@ These are still vertical slice systems. They are only excluded from the first pl | ---- | ---- | ---- | ---- | | WASD, click-to-move, or both for first prototype? | JOY | Before movement polish | WASD first, click-to-move later. | | Use Cinemachine for camera now? | Codex | During camera task | Use it if already available; otherwise simple custom follow. | +| Does Simple KCC become the MVP controller? | Codex + Claude reviewer | After Simple KCC spike | Likely candidate if it stays console-clean and server-authoritative. | | Does Opsive become core or optional? | Codex + Claude reviewer | After isolated Opsive branch | Optional until proven worth the integration cost. | | What is the first Hunter visual? | JOY | After movement baseline | Placeholder until MetaDOS skin import path is reviewed. | diff --git a/docs/design/07-player-controller-prototype.md b/docs/design/07-player-controller-prototype.md index cbb93e5..254c586 100644 --- a/docs/design/07-player-controller-prototype.md +++ b/docs/design/07-player-controller-prototype.md @@ -1,9 +1,9 @@ # Prototype Design: Networked Player Controller -*Status: Draft* +*Status: In progress* *Created: 2026-05-14* *Author: Codex* -*Last Verified: 2026-05-14 against Phase B Fusion smoke test and `05-networking-architecture.md`* +*Last Verified: 2026-05-15 against local Photon Pirate Adventure 2.0.12 sample review and Simple KCC 2.0.15 package metadata* > **Quick reference** - Layer: `Core` - Priority: `MVP` - Key deps: `Photon Fusion 2`, `Unity Input System`, `ZoneTest_Hub`, `SecondSpawnConfig` @@ -19,13 +19,14 @@ This is not the combat system. This is the movement and authority contract that ## Design Decision -Build a **project-owned minimal networked controller first**. Evaluate Opsive Ultimate Character Controller only after this baseline is working. +Build a **project-owned minimal networked controller first**, then convert the placeholder player to Photon Fusion Simple KCC before evaluating Opsive Ultimate Character Controller. Opsive should prove value against a working Fusion-native controller path rather than become the baseline by default. Rationale: - The game is open-source multiplayer, so authority rules are more important than controller feature depth. - The first prototype needs known behavior that agents can reason about. -- Opsive may still be useful, but it should prove value against a working baseline rather than become the baseline by default. +- Pirate Adventure shows a useful Fusion-native top-down path with Simple KCC, FSM states, runner physics queries, and compact network input. +- Opsive may still be useful, but it should prove value against the project baseline and Simple KCC spike rather than become the baseline by default. --- @@ -102,10 +103,10 @@ Camera-relative movement can be added after the first pass if the camera angle m | ---- | ---- | ---- | | `NetworkRunnerSetup` | Starts Fusion dev session and owns runner lifecycle. | Existing Phase B | | `NetworkInputProvider` | Collects movement input per Fusion tick. | Existing Phase B, may extend | -| `NetworkPlayer` | Applies authoritative movement and owns networked player state. | Existing Phase B, may extend | +| `NetworkPlayer` | Applies Fusion input to Simple KCC and owns session player state. | Existing Phase B, extended | | `PlayerSpawner` | Spawns one player object per joined player. | Existing Phase B | | `PlayerCameraFollow` | Keeps camera pointed at local player. | New if no suitable existing component | -| `Player_NetworkCube.prefab` | Placeholder networked player prefab. | Existing Phase B, may evolve | +| `Player_NetworkCube.prefab` | Placeholder networked player prefab with Simple KCC. | Existing Phase B, evolved | --- @@ -147,11 +148,19 @@ These are prototype values, not final game balance. - [ ] Confirm player stops predictably. - [ ] Record remaining feel issues in this doc. -### Phase 4: Opsive Evaluation Branch +### Phase 4: Simple KCC Spike -- [ ] Import Opsive UCC in a separate branch/commit only after baseline passes. +- [x] Import the official Fusion Simple KCC addon in a separate branch/commit only after baseline passes. +- [x] Convert movement from raw networked position updates to KCC-backed movement. +- [ ] Validate with Unity 6.5 beta and current Fusion 2.1.1 release candidate. +- [ ] Compare movement feel and authority clarity against the baseline. +- [ ] Decide whether Simple KCC becomes the MVP controller. + +### Phase 5: Opsive Evaluation Branch + +- [ ] Import Opsive UCC in a separate branch/commit only after the Simple KCC spike. - [ ] Check Unity 6.5 beta compatibility and console state. -- [ ] Compare Opsive movement/combat/camera value against the baseline. +- [ ] Compare Opsive movement/combat/camera value against the baseline and Simple KCC spike. - [ ] Decide whether Opsive becomes core, optional, or deferred. --- @@ -186,6 +195,8 @@ These are prototype values, not final game balance. | ---- | ---- | | Combat Prototype Design | After player movement and camera are stable. | | Camera Design | If camera behavior becomes deeper than one follow component. | +| Pirate Adventure Reference Review | Completed after local sample inspection. | +| Simple KCC Spike Report | After official Simple KCC addon import and smoke test. | | Opsive Evaluation Report | After isolated Opsive import and smoke test. | | Offline AI Agent Movement Contract | Before AI agent can control the same player actor. | @@ -195,8 +206,8 @@ These are prototype values, not final game balance. | This Document References | Target Doc | Specific Element Referenced | Nature | | ---- | ---- | ---- | ---- | -| Prototype shape | `06-overview-design.md` | Minimal controller first, Opsive evaluation second | Scope dependency | +| Prototype shape | `06-overview-design.md` | Minimal controller first, Simple KCC spike second, Opsive evaluation third | Scope dependency | +| Reference sample | `09-pirate-adventure-reference-review.md` | Pirate Adventure controller and FSM patterns | Pattern dependency | | Networking rules | `05-networking-architecture.md` | Network input and server authority | Rule dependency | | Pillar priority | `01-pillars.md` | Server-authoritative gameplay | Rule dependency | | Unity conventions | `../setup/unity-conventions.md` | Prefab, scene, and asmdef organization | Ownership handoff | - diff --git a/docs/design/09-pirate-adventure-reference-review.md b/docs/design/09-pirate-adventure-reference-review.md new file mode 100644 index 0000000..29b495e --- /dev/null +++ b/docs/design/09-pirate-adventure-reference-review.md @@ -0,0 +1,172 @@ +# Reference Review: Photon Fusion Pirate Adventure + +*Status: Draft* +*Created: 2026-05-14* +*Author: Codex* +*Local Source Reviewed: `C:\Users\JOY\Downloads\fusion-pirate-adventure-2.0.12.zip`* + +> **Quick reference** - Layer: `Prototype` - Priority: `MVP` - Key deps: `Photon Fusion 2`, `Fusion Simple KCC`, `Fusion FSM` + +--- + +## Verdict + +Do **not** buy an extra paid top-down Fusion template yet. + +Photon's Pirate Adventure sample is enough as the first controller reference for SECOND SPAWN. It is closer to our immediate need than Opsive UCC or a paid top-down shooter template because it demonstrates a complete Fusion top-down loop: + +- local input gathered into a compact Fusion input struct +- player state machine +- Simple KCC movement +- attack hit windows +- interactables +- pickups and hazards +- enemy search and chase behavior +- NavMesh-driven enemy movement +- Multi-Peer friendly runner dictionaries + +Use it as a reference, not as code to copy. + +--- + +## Compatibility Snapshot + +| Area | Pirate Adventure | SECOND SPAWN Current State | Notes | +| ---- | ---- | ---- | ---- | +| Unity version | Unity `2021.3.45f2` | Unity `6000.5.0b7` | Sample must be treated as a pattern source, not imported wholesale. | +| Fusion version | `2.0.12 Stable 1861` | `2.1.1 Release-Candidate 2037` | API drift is possible. Validate in Unity after each integration step. | +| KCC | Simple KCC addon `2.0.15` DLL | Installed at `Unity/Assets/Photon/FusionAddons/SimpleKCC/` | Strong candidate for next controller prototype branch. | +| Topology | Shared Mode | Server Mode production, Host Mode dev | Do not copy Shared Mode authority assumptions. | +| Input system | Unity Input System `1.7.0` | Unity 6 project default input setup | Reuse the struct shape, not the generated action asset. | +| Art and sample assets | Pirate and third-party sample assets | SECOND SPAWN original assets | Do not import sample art into the public repo. | + +--- + +## Useful Patterns To Adopt + +### 1. Fusion Input Shape + +Pirate Adventure keeps player input small: + +- movement vector +- network buttons +- one place that gathers local input +- gameplay code reads only the tick input + +SECOND SPAWN already has `NetworkInputData`. Keep evolving that shape instead of binding gameplay directly to keyboard, mouse, UI, LLM, or AI-agent sources. + +### 2. Simple KCC For The Next Movement Branch + +Pirate Adventure uses `Fusion.Addons.SimpleKCC.SimpleKCC` for player movement. The useful pattern is: + +- normalize movement input +- build an XZ movement direction +- set look rotation from movement direction +- call `SimpleKCC.Move(...)` inside Fusion simulation state +- keep movement state-specific, for example idle, run, fall, hit, attack + +This matches SECOND SPAWN better than jumping straight to Opsive UCC because the authority surface stays small and readable. + +### 3. State Machine Boundary + +Player and enemy behavior are separated into small states: + +- `PlayerIdleState` +- `PlayerRunState` +- `PlayerAttackState` +- `PlayerHitState` +- `PlayerDeathState` +- `EnemyIdleState` +- `EnemyChaseState` +- `EnemyAttackState` + +This is useful for SECOND SPAWN because cultivation, reincarnation, AI-agent control, and combat can plug into state transitions without one large controller script. + +### 4. Runner Physics Scene Queries + +Combat and interaction checks use the runner physics scene: + +- overlap capsule for pickups and hazards +- overlap sphere for interactables +- overlap sphere for attack hit windows +- raycast for enemy line of sight + +This is the right mental model for Fusion. Query the simulation scene the runner owns, not random global gameplay state. + +### 5. Enemy MVP Pattern + +Pirate Adventure enemies are simple but useful: + +- search nearest valid player +- validate distance and line of sight +- store target as networked state +- enable NavMeshAgent only on state authority +- stop movement during attack windows + +This is enough for the first dungeon trash enemy prototype before Behavior Designer enters the project. + +--- + +## Patterns To Avoid + +### Shared Mode Authority + +The sample uses Shared Mode and client-owned state authority. SECOND SPAWN production uses dedicated Server Mode. Do not copy: + +- `GameMode.Shared` as the project default +- Shared Mode master-client authority transfer logic +- client-side authority assumptions for enemy or player ownership + +### Wholesale Sample Import + +Do not import the whole Pirate Adventure project. It targets an older Unity version, older Fusion build, sample art, sample scenes, and Shared Mode assumptions. + +### Sample Economy Names + +Pirate Adventure uses money and level as sample progression. SECOND SPAWN uses: + +- `BodyTime` +- `SECOND token` +- cultivation tier +- reincarnation state +- durable inventory and quest state in Supabase + +Keep the gameplay naming aligned to SECOND SPAWN. + +--- + +## Recommended Next Step + +Create a feature branch from `dev` for a **Simple KCC controller spike**: + +1. Keep `Player_NetworkCube.prefab` or replace it with a capsule placeholder. +2. Convert current raw position movement into KCC-backed movement. +3. Add a tiny player movement state layer only if it stays simpler than the current script. +4. Verify Play Mode console is clean. +5. Run reviewer pass before merging. + +Opsive UCC should move after this spike, not before it. If Simple KCC covers the MVP movement feel, Opsive can be reserved for animation, camera, or combat evaluation instead of becoming the core controller dependency. + +--- + +## Decision Implication + +For the vertical slice, the controller path should now be: + +1. Minimal Fusion movement baseline. +2. Simple KCC spike based on Pirate Adventure patterns. +3. Combat state prototype. +4. Opsive UCC evaluation only if it clearly improves animation, abilities, or combat authoring enough to justify integration cost. + +This keeps SECOND SPAWN friendly to solo development and AI agents: fewer hidden asset-store assumptions, smaller code surface, and clearer server-authoritative rules. + +--- + +## Cross-References + +| This Document References | Target Doc | Specific Element Referenced | Nature | +| ---- | ---- | ---- | ---- | +| Controller plan | `07-player-controller-prototype.md` | Simple KCC spike before Opsive import | Scope dependency | +| Overview plan | `06-overview-design.md` | Playable feel before asset complexity | Scope dependency | +| Networking rules | `05-networking-architecture.md` | Server-authoritative Fusion architecture | Rule dependency | +| Systems map | `03-systems-index.md` | Player Controller entry | Tracking dependency | diff --git a/docs/setup/fusion-install.md b/docs/setup/fusion-install.md index df1e2dc..19436fc 100644 --- a/docs/setup/fusion-install.md +++ b/docs/setup/fusion-install.md @@ -45,7 +45,18 @@ Fusion ships several Plugins/ subfolders + a `Photon/` runtime folder. These con 3. Save (Ctrl+S). 4. Also paste the same App ID into `Assets/_SecondSpawn/Settings/SecondSpawnConfig.asset` -> `PhotonAppId` field (once that .asset exists - see "Create SecondSpawnConfig asset" below). -## Step 5: Create the SecondSpawnConfig asset +## Step 5: Install Fusion Simple KCC + +Fusion Simple KCC is the first controller addon for the player movement spike. + +1. Download `fusion-simple-kcc-2.0.15.unitypackage` from Photon. +2. Import it into the Unity project. +3. Expected installed path: `Assets/Photon/FusionAddons/SimpleKCC/`. +4. Confirm `simple_kcc_build_info.txt` reports version `2.0.15`. + +This addon is OK to commit with the Photon SDK. It is not a gameplay template sample. + +## Step 6: Create the SecondSpawnConfig asset The ScriptableObject definition was scaffolded in commit `f04aa3b` but the `.asset` instance requires Unity Editor focus to compile the new `SecondSpawn.Settings` assembly. If it still does not exist: @@ -60,14 +71,14 @@ The ScriptableObject definition was scaffolded in commit `f04aa3b` but the `.ass - **PhotonAppId**: from Step 1 - **DosChainRpcUrl**: leave blank for now -## Step 6: Verify it builds +## Step 7: Verify it builds 1. Menu: **File > Build Settings**. 2. Target: PC Standalone (Windows or Linux). 3. Click **Build**, save to `D:\Projects\Second-Spawn\Unity\Build\` (gitignored). 4. If the build succeeds with no compile errors, Fusion 2 is installed correctly. -## Step 7: Tell the AI agent +## Step 8: Tell the AI agent Open a Claude Code session in this repo: diff --git a/docs/setup/paid-assets.md b/docs/setup/paid-assets.md new file mode 100644 index 0000000..9b28946 --- /dev/null +++ b/docs/setup/paid-assets.md @@ -0,0 +1,51 @@ +# Paid Asset Setup + +*Status: Draft* +*Created: 2026-05-14* +*Author: Codex* + +> **Quick reference** - Layer: `Setup` - Priority: `Local Development` - Key deps: Unity Package Manager, Unity Asset Store account + +--- + +## Purpose + +SECOND SPAWN is a public repository. Paid Unity Asset Store content must stay out of Git while remaining usable in JOY's local Unity project and private build machines. + +--- + +## Installed Local Assets + +| Asset | Source | Local Path | Git Policy | Current Use | +| ---- | ---- | ---- | ---- | ---- | +| RPG Character Mecanim Animation Pack | Unity Package Manager > My Assets | `Unity/Assets/ExplosiveLLC/` | Ignored, do not commit raw files | Prototype character and animation library | + +--- + +## Import Steps + +1. Open the Unity project at `Unity/`. +2. Open `Window > Package Manager`. +3. Select `My Assets`. +4. Download and import `RPG Character Mecanim Animation Pack`. +5. If the pack asks to load Input and Layer presets, skip it for now. SECOND SPAWN uses its own Fusion and Input System path. +6. Verify Unity console after import. + +--- + +## Repository Rules + +- Do not commit raw paid assets, including models, textures, animations, prefabs, demo scenes, sample scripts, or sample controllers from paid packs. +- Do commit project-owned scripts that integrate with locally installed assets. +- Do commit project-owned prefabs only when they do not embed paid asset source data. +- Do keep placeholder/open assets available so public contributors can open the project without licensed paid assets. +- Do document any required paid asset in this file before using it in a prototype. + +--- + +## Animation Integration Rules + +- Fusion or Simple KCC owns movement and networked position. +- Animation clips render state and intent only. +- Disable root motion for networked movement unless a future prototype explicitly proves an authority-safe root-motion workflow. +- Keep Animator parameters small and driven from project-owned controller state.