Context
The Engine/ directory is duplicated between the two .NET ports of GameOfLife3D:
GameOfLife3D.NET/src/GameOfLife3D.NET/Engine/* (desktop / Silk.NET)
GameOfLife3DWeb.NET/Engine/* (Blazor WebAssembly)
The web port was created by copy-pasting the desktop port's engine and only changing the namespace. The two copies are already diverging:
DeserializeGrid input validation was added to the web copy only
GameState switched from { get; set; } to { get; init; } in the web copy
PatternInfo default Author value and sealed modifier differ between copies
A bug fix to one copy will silently miss the other. This was flagged as the top architectural recommendation in a recent code review of feature/gameoflife-net-web.
Goal
Single source of truth for Game of Life simulation logic, consumed by both ports via project reference.
Proposed Shape
- New project:
GameOfLife3D.Engine (targeting net10.0 or netstandard2.1, whichever keeps both ports happy)
- Contains:
GameEngine, Generation, GameState, PatternInfo, RulePresets, Vector2Int
- Namespace:
GameOfLife3D.Engine
- Both
GameOfLife3D.NET and GameOfLife3DWeb.NET add <ProjectReference> and delete their local Engine/ copies
- Tests move to
GameOfLife3D.Engine.Tests and cover both ports
Tasks
Out of Scope
- Any rule/engine behavior changes
- UI or renderer changes
References
- Code review from
feature/gameoflife-net-web branch
Context
The
Engine/directory is duplicated between the two .NET ports of GameOfLife3D:GameOfLife3D.NET/src/GameOfLife3D.NET/Engine/*(desktop / Silk.NET)GameOfLife3DWeb.NET/Engine/*(Blazor WebAssembly)The web port was created by copy-pasting the desktop port's engine and only changing the namespace. The two copies are already diverging:
DeserializeGridinput validation was added to the web copy onlyGameStateswitched from{ get; set; }to{ get; init; }in the web copyPatternInfodefaultAuthorvalue andsealedmodifier differ between copiesA bug fix to one copy will silently miss the other. This was flagged as the top architectural recommendation in a recent code review of
feature/gameoflife-net-web.Goal
Single source of truth for Game of Life simulation logic, consumed by both ports via project reference.
Proposed Shape
GameOfLife3D.Engine(targetingnet10.0ornetstandard2.1, whichever keeps both ports happy)GameEngine,Generation,GameState,PatternInfo,RulePresets,Vector2IntGameOfLife3D.EngineGameOfLife3D.NETandGameOfLife3DWeb.NETadd<ProjectReference>and delete their localEngine/copiesGameOfLife3D.Engine.Testsand cover both portsTasks
GameState,PatternInfo,DeserializeGridvalidation)GameOfLife3DWeb.NET.Tests/Engine/*into shared test projectPatternLoader(desktop-only today) belongs in shared library or stays in the desktop portOut of Scope
References
feature/gameoflife-net-webbranch