Skip to content

Restructure AntHill into AntHill.Core / AntHill.Demo / AntHill.Harness #352

Closed

Description

@nockawa

Context

AntHill (test/AntHill/) is the ant-colony simulation that exercises the Typhon engine, rendered with Godot. Today it is one Godot project (AntHill.csproj) plus a no-Godot console runner (profiling/AntHill.ProfileRunner.csproj) that compiles the sim code via <Compile Include> globs — a fragile seam that duplicates the source set instead of consuming a real library.

A feasibility assessment confirmed the Godot coupling is already cleanly separated: Engine/ECS/AI/Pheromone (24 files) are Godot-free; Scripts/ (13 files) is all-Godot; only HeightmapResource straddles, and it is already a .cs + .Godot.cs partial.

Goal — split AntHill into three projects under a new demo/AntHill/ root

  • AntHill.Core — class library: all gameplay + Typhon-engine code, zero Godot dependency.
  • AntHill.Demo — the Godot application; consumes AntHill.Core, owns rendering/UI.
  • AntHill.Harness — console app; consumes AntHill.Core for profiling / regression / validation runs. Supersedes AntHill.ProfileRunner.

This is Phase A — the structural split only. AntHill.Harness ships as today's profiler runner re-homed onto the library. Growing it into a general scriptable validation harness is Phase B — tracked separately.

Acceptance Criteria

  • AC1 — new layout demo/AntHill/{AntHill.Core,AntHill.Demo,AntHill.Harness}/; test/AntHill/ removed; git mv preserves history.
  • AC2 — AntHill.Core — Microsoft.NET.Sdk class library, net10.0, AllowUnsafeBlocks, RootNamespace=AntHill, assembly AntHill.Core; contains Engine/ (sim), ECS/, AI/, Pheromone/, GlobalUsings.cs; references Typhon.Engine + analyzers + generators; no Godot reference.
  • AC3 — HeightmapResource becomes a non-partial public sealed class in AntHill.Core (public ctor); the Godot generation/export half becomes HeightmapFactory in AntHill.Demo.
  • AC4 — AntHill.Demo — Godot.NET.Sdk app, assembly AntHill.Demo, project.godot assembly_name="AntHill.Demo"; Scripts/, Scenes/, HeightmapFactory.cs; ProjectReference → AntHill.Core; compiles.
  • AC5 — AntHill.Harness — Microsoft.NET.Sdk Exe, assembly AntHill.Harness; Program.cs from AntHill.ProfileRunner; ProjectReference → AntHill.Core replaces the <Compile Include> globs; builds + runs.
  • AC6 — Typhon.Engine InternalsVisibleTo updated to the three new assemblies; Typhon.slnx updated.
  • AC7 — dotnet build Typhon.slnx clean; AntHill.Harness --trace runs end-to-end; full Typhon.Engine.Tests suite green.

Related

  • Phase B follow-up: AntHill.Harness scriptable validation harness — see the linked issue.

Activity

  1. self-assigned this
    on May 16, 2026
  2. added
    refactoring
    technical-debt
    on May 16, 2026
  3. nockawa commented on May 16, 2026

    @nockawa
    CollaboratorAuthor

    Phase A — three-project split — complete ✅

    All acceptance criteria met. AntHill is now three projects under demo/AntHill/.

    Layout

    • demo/AntHill/AntHill.Core/ — Microsoft.NET.Sdk class library, assembly AntHill.Core. All gameplay + Typhon-engine code (Engine/, ECS/, AI/, Pheromone/, GlobalUsings.cs). Zero Godot reference. Grants InternalsVisibleTo to AntHill.Demo / AntHill.Harness (they were one assembly before the split).
    • demo/AntHill/AntHill.Demo/ — Godot.NET.Sdk/4.6.2 app, assembly AntHill.Demo. Scripts/, Scenes/, project.godot (assembly_name="AntHill.Demo"), HeightmapFactory.cs. ProjectReference → AntHill.Core.
    • demo/AntHill/AntHill.Harness/ — Microsoft.NET.Sdk Exe, assembly AntHill.Harness. Program.cs from AntHill.ProfileRunner (now namespace AntHill.Harness). ProjectReference → AntHill.Core replaces the old <Compile Include> globs. Supersedes AntHill.ProfileRunner.

    Key changes

    • HeightmapResource — was a cross-file partial; now a non-partial public sealed class in AntHill.Core with a public constructor. The Godot generation/export half is HeightmapFactory (static class) in AntHill.Demo. Callers in Main.cs / Terrain.cs updated.
    • Typhon.Engine InternalsVisibleTo — AntHill / AntHill.ProfileRunner → AntHill.Core / AntHill.Demo.
    • Typhon.slnx — new /demo/ folder with the three projects; the old test/AntHill/AntHill.csproj entry removed.
    • All source moved via git mv (history preserved — 60 renames); stale AntHill.sln / .DotSettings and Godot .uid cruft from the non-Godot projects dropped.

    Verified

    • dotnet build Typhon.slnx -c Debug — clean, 0 errors (incl. AntHill.Demo via Godot.NET.Sdk from NuGet).
    • AntHill.Harness --trace … --duration 4 with CPU sampling — completes with zero exceptions, header CpuSampleSectionOffset != 0, .nettrace deleted (the CPU Sampling Integration — in-process EventPipe capture + Call Tree view #351 CPU-sampling path works through the new library).
    • Full Typhon.Engine.Tests suite — green, 3703 passed / 34 skipped.

    Phase B (#353) — growing AntHill.Harness into a scriptable validation harness — builds on this.

    Ready for review + commit (not committed — per convention).

  4. moved this to Ready in Typhon devon May 16, 2026
  5. moved this from Ready to In Progress in Typhon devon May 16, 2026
  6. added a commit that references this issue on May 17, 2026
  7. moved this from In Progress to Done in Typhon devon May 17, 2026
  8. nockawa commented on May 18, 2026

    @nockawa
    CollaboratorAuthor

    Completed in PR #355 (commit a179e51 — "CPU Sampling Integration (#351) + AntHill refactoring (#352)"). The issue was left open because #355 didn't use a closing keyword for #352.

    Verified against the acceptance criteria:

    • AC1/2/4/5 — demo/AntHill/{AntHill.Core, AntHill.Demo, AntHill.Harness} all present with their .csproj files; test/AntHill/ no longer holds tracked content.
    • AC6 — Typhon.slnx references all three new projects.
    • AC7 — implied: PR CPU Sampling Integration (#351) + AntHill refactoring (#352) #355 is merged to main (CI green).

    Closing as done. Phase B follow-up tracked in #353.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

refactoringtechnical-debt

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions