4.4 KiB
4.4 KiB
| name | description |
|---|---|
| simulation-development | Maintain and extend the VampireLike Simulation layer. Use when modifying `Assets/GameMain/Scripts/Simulation` or related runtime paths (`GameStateBattle`, enemy movement gate, entity lifecycle sync, separation solver), including P1.5 cleanup and P2 Job/Burst preparation. |
Simulation Development
Quick Start
- Read baseline design doc:
./references/SimulationDevelopmentSkill.md. - Read latest measured baseline:
../../docs/P1.5 Simulation-Supplement.md. - Confirm your change scope is one or more of:
SimDatacontracts (EnemySimData,ProjectileSimData,PickupSimData)- lifecycle sync (
SimulationWorld.EntitySync) - per-frame simulation (
SimulationWorld.Tick,TickEnemies) - presentation write-back (
SimulationWorld.Presentation) - enemy separation solver integration (
EnemySeparationSolverProvider)
- Keep rollback path available through
UseSimulationMovement.
Source Map
- Simulation core:
../../Assets/GameMain/Scripts/Simulation/SimulationWorld.cs - Lifecycle sync:
../../Assets/GameMain/Scripts/Simulation/SimulationWorld.EntitySync.cs - Presentation sync:
../../Assets/GameMain/Scripts/Simulation/SimulationWorld.Presentation.cs - Tick context:
../../Assets/GameMain/Scripts/Simulation/SimulationTickContext.cs - Index binding:
../../Assets/GameMain/Scripts/Simulation/EntityBinding.cs - Battle entry:
../../Assets/GameMain/Scripts/Procedure/Game/GameStateBattle.cs - Global component init:
../../Assets/GameMain/Scripts/Base/GameEntry.Custom.cs - Enemy old path gate:
../../Assets/GameMain/Scripts/Entity/EntityLogic/Enemy/MeleeEnemy.cs../../Assets/GameMain/Scripts/Entity/EntityLogic/Enemy/RemoteEnemy.cs
- Separation solver:
../../Assets/GameMain/Scripts/Utility/EnemySeperator/IEnemySeparationSolver.cs../../Assets/GameMain/Scripts/Utility/EnemySeperator/EnemySeparationSolverProvider.cs../../Assets/GameMain/Scripts/Utility/EnemySeperator/GridBucketEnemySeparationSolver.cs
- P1.5 baseline doc:
../../docs/P1.5 Simulation-Supplement.md
Non-Negotiable Invariants
- Maintain
EntityId <-> SimulationIndexconsistency. - Use swap-back removal (
move last -> remove last -> remap index). - Keep lifecycle registration/removal inside
EntitySyncevent flow; do not double-write containers from gameplay code. - Keep logic/presentation boundary:
- Simulation computes logical outputs.
- Presentation writes back
Transform.
- Keep A/B rollback path:
UseSimulationMovement == falsemust preserve old behavior path.
- Avoid new managed allocations in Tick hot paths.
Change Recipes
Add or Change SimData Fields
- Update target struct in
Simulation/SimData/. - Populate default/initial values in
EntitySynccreate methods. - Apply runtime updates in
Tickphase. - Consume outputs in
Presentationonly if visual write-back is needed. - Ensure backward compatibility when
UseSimulationMovementis off.
Extend Enemy Tick Behavior
- Keep deterministic stage order (
BuildInput -> Move/Separation -> StateUpdate -> WriteBack). - Preserve state semantics and avoid direct UI/event side effects in Tick.
- Keep
ProfilerMarkercoverage for each stage. - Keep Tick hot path data-driven (no direct
Transformread/write).
Implement Projectile/Pickup Tick (from placeholder to real behavior)
- Keep lifecycle path unchanged (
EntitySynchandles add/remove). - Add dedicated tick methods in
SimulationWorldfor each data type. - Keep outputs in data containers; write visuals in presentation phase.
- Ensure removal path and binding remap rules are identical to enemy path.
Refactor Toward Job/Burst
- Prioritize
Move/Separationstage parallelization. - Keep
ProfilerMarkerand stage boundaries stable for P1.5/P2 comparison. - Leave transform write-back to presentation-only stage.
- Keep managed allocations and virtual dispatch out of core loops.
Validation Checklist
UseSimulationMovement = falseandtrueboth run correctly.- No duplicate registration or stale index after entity hide/destroy.
- Battle loop remains stable (
Battle -> LevelUp -> Shop -> Battle). - No new per-frame GC spikes in
TickEnemies. - Main flow has no new Error/Exception logs.
- Update
./references/SimulationDevelopmentSkill.mdand../../docs/P1.5 Simulation-Supplement.mdif contracts, boundaries, or baseline data changed.