CultLib/src/GameCult.Geometry
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens 9ea134aca9 Geometry: name the cache formatter on each CultRecordRef member
The MessagePack source generator cannot resolve CultRecordRef<T> on its own and
emitted a broken formatter reference; MessagePackKnownFormatter on the open
generic did not change that. An explicit MessagePackFormatter per member is the
same formatter the cache resolver uses, so the wire stays a key string.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 02:25:27 +02:00
..
CultGeometryDocuments.cs Geometry: name the cache formatter on each CultRecordRef member 2026-09-30 02:25:27 +02:00
CultGeometryIsoSurface.cs Collapse CultVec2, CultVec3 and CultRect into CultMath float2, float3 and rect 2026-09-29 16:18:09 +02:00
CultGeometryPrimitives.cs Add canonical System.Text.Json converters for every CultMath value type 2026-09-29 16:57:31 +02:00
CultGeometryQuadMesh.cs Fix surface-nets mutation findings F1/F3/F4/F7/F8 (production code) 2026-09-25 19:29:45 +02:00
CultGeometryQuadNormals.cs Add surface nets extraction and face-weighted normals to GameCult.Geometry 2026-09-25 18:06:29 +02:00
CultGeometrySurfaceNets.cs Collapse CultVec2, CultVec3 and CultRect into CultMath float2, float3 and rect 2026-09-29 16:18:09 +02:00
GameCult.Geometry.csproj Geometry: fix the Caching.MessagePack project reference path 2026-09-30 02:15:56 +02:00
ISOSURFACE-PROVENANCE.md Add CultGeometry isosurface extraction 2026-08-26 17:37:22 +02:00
README.md Collapse CultVec2, CultVec3 and CultRect into CultMath float2, float3 and rect 2026-09-29 16:18:09 +02:00
SURFACE-NETS-PROVENANCE.md fix: reject non-finite isoValue and origin in Extract 2026-09-25 20:31:44 +02:00

GameCult.Geometry

The project is known as CultGeometry. GameCult.Geometry is its clean .NET package and namespace identity.

GameCult.Geometry owns reusable procedural geometry algorithms together with the CultCache-native documents that carry their domains, build requests, selected cuts, and mesh chunk artifacts.

It is the schema authority for the shared CultGeometry* records. GameCult.Geometry.Csg owns CSG production behavior and proves wire parity against those records; it does not independently evolve their identities.

Its first engine-neutral algorithm is CultGeometryIsoSurface.Extract, a marching-tetrahedra extractor over regular scalar grids. It uses CultMath for numeric primitives and emits CultGeometryTriangleMesh; Godot, Unity, native workers, and other consumers adapt that neutral result into their own runtime objects. See ISOSURFACE-PROVENANCE.md for the clean-port boundary.

The package is deliberately substrate-shaped:

  • CultCache owns document identity, schema compatibility, references, and local persistence.
  • CultNet can distribute these documents through the normal raw document lane.
  • CultMesh can use them as worker-visible shared state for simulation and geometry pipelines.
  • JSON is not a runtime transport here. It may publish schema descriptions at the xeno boundary, but the live machine eats and emits typed CultCache documents.

Value Primitives

The small value layer is for cross-runtime query contracts, physics probes, native slices, and UI surfaces. Vectors and rectangles are CultMath's float2, float3 and rect, and GameCult.Caching.MessagePack serializes them.

  • CultCircle: 2D influence/query brush with rect intersection helpers.
  • CultSphere: 3D query primitive with whole-vector center and XY projection.

Aetheria object viewports, gravity influence brushes, Ymir overlap/cast query fixtures, and Unity native render views should use these shapes or generated runtime equivalents instead of bespoke { minX, minY, maxX, maxY } payloads.

Runtime Path

CultGeometry CSG (GameCult.Geometry.Csg) emits domain documents, selected-cut manifests, and chunk artifacts as MessagePack CultCache documents. A Godot runtime, local worker, or remote geometry process receives the same records through CultMesh/CultNet and reads them back as CultGeometry* types.

using GameCult.Caching;
using GameCult.Geometry;
using GameCult.Mesh;
using GameCult.Networking;

var geometryDocuments = new CultNetDocumentRegistry(CultDocumentRegistry.Shared)
    .Register(CultNetDocumentBinding.ForDocument<CultGeometryDomainDocument>())
    .Register(CultNetDocumentBinding.ForDocument<CultGeometryBuildRequest>())
    .Register(CultNetDocumentBinding.ForDocument<CultGeometrySelectedCutManifest>())
    .Register(CultNetDocumentBinding.ForDocument<CultGeometryChunkArtifact>());

using var node = await CultMesh.CreateNodeAsync("ragnarok-geometry.ccmp", new CultMeshNodeOptions
{
    DatabaseOptions = new CultNetDatabaseOptions
    {
        RuntimeId = "godot-runtime",
        DocumentRegistry = geometryDocuments
    }
});

using var chunks = node.Database
    .Watch<CultGeometryChunkArtifact>()
    .Subscribe(change => ApplyChunk(change.Document));

The record key is part of the contract. Rust and C# must compute the same key for the same geometry record, so stable fingerprints use the Rust canonical field order and invariant float text. If this drifts, the same chunk becomes two different chunks depending on which runtime touched it first. That is not a cache miss; that is split-brain geometry.

Documents

  • CultCircle, CultSphere: shared value primitives for query and view contracts.
  • CultGeometryDomainDocument: one hierarchical domain tree, suitable for Ragnarok/Fensalir-style feature DSL output.
  • CultGeometryBuildRequest: one LOD/frustum/budget request for workers.
  • CultGeometrySelectedCutManifest: the selected domain cut, deferred children, fallback rows, and diagnostic contribution rows.
  • CultGeometryChunkArtifact: render mesh, optional collider mesh, source domain/claim identities, build counters, and transition clipping seed.