- Document the technical feasibility of rebuilding Crusader using C#, .NET 10, and SDL3. - Outline the executive summary, platform assessment, recommended architecture, and delivery plan. - Define mod support and creator workflow, including debugging scope and principal risks. - Establish clear milestones and gates for project phases, from technical spike to No Regret integration.
55 lines
No EOL
5.1 KiB
Markdown
55 lines
No EOL
5.1 KiB
Markdown
---
|
|
description: 'Development guidance for the C# and SDL3 Crusader rebuild project'
|
|
applyTo: '../Crusader-Rebuild-Sharp/**'
|
|
---
|
|
|
|
# Crusader Rebuild Sharp
|
|
|
|
Apply these rules only when working in the `Crusader-Rebuild-Sharp` workspace folder. The folder's absolute path may differ on other machines; locate it through the open workspace and use relative paths. This guidance is based on the [rebuild feasibility study](../../docs/remorse-csharp-sdl3-rebuild-feasibility.md).
|
|
|
|
## Project Goals
|
|
|
|
- Target C# and .NET 10 with SDL3 for desktop Windows, Linux, and macOS.
|
|
- Deliver No Remorse first; add No Regret as a separate, later game profile.
|
|
- Treat retail game data as user-provided input. Never include retail executables or assets in the repository, and never modify the user's source data in place.
|
|
- Keep the game core independent of SDL and operating-system APIs. Contain SDL calls in the host/application boundary and use fixed simulation ticks.
|
|
|
|
## Reverse-Engineering Evidence
|
|
|
|
- Use the live Ghidra project for the exact executable variant as the primary static reference. Inspect its current decompilation, disassembly, callers/callees, xrefs, symbols, data types, and comments.
|
|
- The live Ghidra project has near-complete No Remorse function coverage. Use it to build the implementation inventory, but do not equate function coverage or a descriptive symbol with verified behavior.
|
|
- Treat the exported C as an older, secondary snapshot for navigation and historical comparison. If it disagrees with live Ghidra, re-check the exact function and target build in Ghidra; do not carry the stale export forward as authority.
|
|
- Use controlled runtime observations and deterministic tests to validate or falsify static interpretations, especially for indirect calls, scheduler behavior, USECODE, and state changes.
|
|
- Keep evidence traceable: record Ghidra program/build identity, address, variant, evidence type, confidence, implementation status, and validation result for each substantial behavior.
|
|
- Treat ScummVM, Pentagram, and other implementations as comparison material, not as authority over the target binary.
|
|
|
|
## Architecture and Variants
|
|
|
|
- Keep shared mechanics in `CrusaderRebuild.Core`; keep SDL3 and platform integration in the application/host layer.
|
|
- Represent No Remorse and No Regret with explicit profiles for build, language, startup, mission metadata, globals, and intrinsic tables. Do not assume that matching names or addresses imply matching behavior.
|
|
- Preserve original field widths and unknown binary data where they affect compatibility. Use typed host identities instead of segmented pointers unless a verified behavior requires emulation.
|
|
- Keep rendering state separate from simulation state. Do not accept a static preview or host-only actor shortcut as a playable-game milestone.
|
|
- Validate lengths, offsets, indices, counts, and references before consuming retail or mod data. Preserve opaque fields during round-trip editing.
|
|
|
|
## USECODE, Debugging, and Mods
|
|
|
|
- Build the USECODE debugger against this project's VM state. Add instruction, event, and call-frame hooks early; support break/continue/step and inspect only values whose runtime representation is understood.
|
|
- Do not depend on the dormant No Remorse retail debugger bootstrap or copy DOS far-pointer debugger objects as the new runtime design.
|
|
- Label synthetic source-line mappings as synthetic. Do not claim authentic source correspondence when the executable/archive provides no verified line metadata.
|
|
- Keep intrinsic tables and script compatibility variant-specific. Custom USECODE may call only operations implemented and registered by the rebuild; do not load native executable plug-ins from mods.
|
|
- Make mod resolution deterministic and report which package supplied each resource. Validate game/build compatibility and include the ordered mod identity in save compatibility checks.
|
|
- Write saves, caches, generated assets, captures, and logs outside retail data roots and away from source-controlled code.
|
|
|
|
## Documentation and Progress
|
|
|
|
- Do not add README files, design documents, progress reports, or other documentation under `Crusader-Rebuild-Sharp` unless the user explicitly asks for documentation there.
|
|
- Document rebuild progress in the decomp project at `docs/rebuild-sharp/`. Put verified milestones, Ghidra evidence, changed subsystems, build/test results, and unresolved questions there. Keep source code in the rebuild project and progress documentation in the decomp project.
|
|
- Do not update legacy or unrelated decompilation notes unless requested or directly required by the progress entry.
|
|
|
|
## Validation
|
|
|
|
- Run `dotnet build` from the rebuild solution root to compile all projects, including the SDL application.
|
|
- Run `dotnet test` for the test suite. Add focused fixtures for format parsers, VM behavior, mod resolution, and deterministic simulation changes.
|
|
- Keep retail-data tests opt-in and local; synthetic fixtures must allow build and test workflows without a retail installation.
|
|
- Test platform-specific SDL deployment on each claimed operating system before describing that platform as supported.
|
|
- Do not create Git commits unless the user explicitly requests one. |