ADR-0001: Language and Layer Split¶
Status: Accepted
Date: 2026-10-26
Context¶
Rogue Royale 3D uses Unreal Engine 5.8.3 with UnrealSharp and the NarrativeGMC integration of GMCv2 and GMAS. Andrew's standing language policy is C# first, with C++ for Unreal engine-facing work. The project needs a clear boundary between gameplay rules and data, engine-facing prediction/replay code, content wiring, and player-facing UI.
GMC movement solvers and GMAS ability tasks execute inside GMC's native prediction and rollback/replay loop: the client predicts, and on a server correction the move history is re-simulated in the same frame. That code is called from native C++ many times per frame, so it is engine-facing work in the policy's sense.
GAS is loaded only as a transitive dependency of Narrative Pro. Gameplay abilities use GMAS 1.4.1.
Decision¶
- C# via UnrealSharp is the default for gameplay rules and data outside the prediction/replay path.
- C++ owns GMC movement solvers, GMAS ability tasks, and anything on the prediction/replay path, as well as Unreal engine-facing work that requires it.
- Blueprint is for content wiring only.
- WebUI (HTML/CSS/JS with JsonLibrary) is for player-facing UI: HUD, menus, inventory.
- No gameplay code uses the GAS API directly; use GMAS 1.4.1 instead.
Consequences¶
- Packaging passes
-p:UnrealSharpGlueTarget=Gameon the package invocation;ManagedRogueRoyale.csprojkeeps itsEditordefault so editor builds are unchanged. A shipping build containing C# has not yet been packaged for this project, so that path still needs validation. - Plain
dotnet buildoutput is not loaded by the editor. Usetools/Build-RogueRoyale.ps1, which invokes RunUATBuildUserSolution, for editor-loaded builds. - C# gameplay rules should be structured so an xUnit test project can test them without the engine; keep engine integration separate from those rules.
- Prediction/replay work remains in C++, even when related gameplay rules or data are written in C#.
- Hit registration follows the open hit-authority decision: if it uses rollback or lag compensation it is on the replay path and is C++; if the server resolves hits without rewind, the resolution rules may be C#.
- UnrealSharp runs on Win64 and Mac only, so any server that hosts the C# rules, dedicated or listen, must run on Win64 or Mac.
Alternatives¶
- All-C++: Fits Unreal's native integration but does not follow Andrew's C# first policy for gameplay rules and data. Retain C++ where the engine and prediction/replay boundary require it.
- C# on the prediction path: Rejected. Every rollback re-simulation would cross the managed/native boundary per move per frame, on the hottest path in the game, and that cost has not been measured.
- Blueprint-first: Convenient for content assembly, but does not follow the C# first policy or provide the intended engine-independent xUnit test boundary. Retain Blueprint for content wiring only.