Files
Jiaqi Liu 5d0f564a00 Add a standalone battle editor and battle system for PAL3 and PAL3A (#99)
* build: migrate C# formatting and add offscreen editor test support

Host IMGUI tests on a detached panel without creating a native editor window.

* feat(core): decode native battle records, geometry and animation metadata

Read the two game variants’ battle tables and model data, with binary-reader and original-resource coverage.

* feat(battle): implement deterministic combat rules and action settlement

Implement actors, inventory, formation, action timing, status interruption, AI, stage ownership and deterministic replay. Keep the domain and its regression suite independent of Unity.

* feat(battle): project native HUD state and input commands

Add the presentation assembly and tests for command routing, lineup selection, floating numbers and stage messages.

* feat(rendering): add battle lighting, actor appearance and native shadows

Support baked and toon lighting, actor and weapon rendering, display refresh rate and resource ownership.

* feat(effects): drive battle effects through shared resource previews

Bind battle control nodes to action owners. Share preview lighting, geometry and effect resources with the existing Unity editors.

* refactor(game): isolate story battle targeting and actor lifetimes

Preserve scene ownership, bound story battle targeting and stop debug attacks when their actor leaves the scene.

* feat(editor): compile original game data into battle scenarios

Build per-variant animation and ability catalogs, encounter music, scene lighting profiles, random parties, equipment and test inventory from the original resources.

* feat(editor): play battle sessions with animated previews and synced media

Drive the preview scene, camera, effects, hit feedback, result choreography, music and movies from simulation snapshots and events.

* feat(editor): add the battle workbench, native HUD and input controls

Expose scenario authoring, replay, diagnostics, responsive command menus and mouse, touch and gamepad targeting. Include the editor workflow and HUD integration tests.
2026-11-21 22:28:47 +08:00

2.4 KiB

Battle core

This assembly is independent of Unity and original binary readers. It owns captured battle definitions, deterministic rules, authoritative state, fixed-clock execution, commands and replay.

Directory Responsibility
Configuration Mutable authoring DTOs and deep-copied initial setup.
Contracts Immutable actor/ability/equipment definitions and state snapshots.
Runtime Commands, ordered inputs/events, replay and variant state. Session contains the one authoritative state writer, split by mechanism.
Rules Verified original calculations and policy; AI selection is grouped under AI.
Stage Logical body/movement/camera/effect protocols and scheduling. These timings determine Work callbacks and rule execution, so they stay in the core.
Presentation Separate engine-independent assembly for semantic HUD intent, focus, selection and visual projections; references the battle kernel.
Results Immutable results and the result/body presentation protocol.

The resource adapter compiles metadata before play. The core never searches resources, polls devices or derives simulation time from rendering. UI queries must not advance state or consume RNG. Snapshots and replay inputs must preserve ownership and ordering.

IBattleRules currently customizes the small basic battle ruleset. Full original battles compose the verified mechanic rules; this is not yet an arbitrary rule-plugin interface. Extend an actual mechanic through definitions/commands and its explicit execution boundary, then update deterministic replay coverage. Replay always uses the current implementation with captured setup, definitions and inputs; it has no rules-version negotiation or legacy execution paths. Resource fingerprints identify the captured data.

Pal3.Battle.Presentation owns semantic HUD intent, focus, selection and menu state. Unity resource/rendering and editor interaction live in Editor/BattleEditor. The existing story-side Pal3.Game/GameSystems/Battle remains a separate placeholder until inventory, story outcome and save adapters are connected to this kernel.

Presentation/ is physically nested here but owns its own asmdef, so Unity excludes it from the kernel assembly. A standalone SDK project must likewise exclude Presentation/**/*.cs from the kernel and build that folder as a separate project referencing the kernel.