Add GameCult Mesh package home

This commit is contained in:
Meta Vens 2026-05-19 19:08:48 +01:00
commit d73c3d26e8
12 changed files with 792 additions and 0 deletions

View file

@ -0,0 +1,68 @@
# CultMesh Public API
Package: `GameCult.Mesh`
Brand: CultMesh
Namespace: `GameCult.Mesh`
## Entry Points
- `CultMesh.CreateNodeAsync(...)`
- `CultMesh.StartNodeAsync(...)`
- `CultMesh.CreateVerseCatalog()`
- `CultMesh.CreateClient(...)`
- `CultMesh.ConnectClient(...)`
`CultMeshNode` wraps the current local runtime pieces:
- `Cache`: the underlying `CultCache`
- `Server`: the underlying CultNet server
- `Database`: the distributed realtime database facade
- `DatabaseServer`: the schema-v0 database bridge
The package home and primary entrypoint are `GameCult.Mesh` / `CultMesh`.
Some lower-level database and wire-contract types still retain `CultNet` names
because they are shared with the transport package. Treat those as plumbing,
not the brand surface.
## Core Behaviors
### Verses
`CultMeshVerseDescriptor` describes a rule-bearing consensus graph. It includes
transport compatibility, rules hash, authority model, discovery endpoints,
known authority runtimes, optional parent Verse id, and plugin requirements.
`CultMeshVerseCatalog` is the local reactive catalog for discovered Verses.
It can publish discovery updates and find compatible transfer targets.
### Shard Authority
Each shard has one primary writer for now. Non-primary writes are rejected or
explicitly forwarded. Stale epochs fail loudly.
### Reactive Documents
Consumers subscribe to typed document changes through `CultNetDatabase` watch
methods. Subscriptions receive domain changes rather than storage envelopes.
### Client Prediction
`CultNetClientAuthorityScope` declares input documents a runtime may predict.
`PutPredictedAsync` writes local state and emits `Predicted`. When the
authoritative log arrives, the database emits `Reconciled`.
### Replica Catch-Up
Shard logs can be requested over schema-v0 and applied by replicas. Replica
cursors can be stored with `ICultNetShardReplicaCursorStore`.
### Simulation Witness Consensus
`CultNetSimulationObservation` records what a node saw for a simulation fact.
`CultNetSimulationObservationHub` collects those observations and emits
`CultNetSimulationConsensusCandidate` updates.
Candidates are opinions. Final world state still belongs in the authoritative
shard log.

View file

@ -0,0 +1,41 @@
# CultMesh Research Notes
CultMesh follows the research trail captured in
`research/cultnet-distributed-database/summary.md`.
The current design keeps these borrowed pieces:
- RethinkDB-style changefeeds for reactive document subscriptions.
- Firebase-like realtime ergonomics, without pretending offline multi-writer
conflicts are free.
- Dynamo-inspired shard metadata, hinted recovery, and anti-entropy direction.
- Raft-shaped primary authority per shard before automatic failover.
- SWIM-shaped membership later, once there is enough state worth gossiping.
- CRDTs only for document types with declared deterministic merge laws.
- Hashgraph's gossip-about-gossip as an event-provenance idea, not as a crypto
ledger import.
## Live Model
CultMesh is currently primary-shard authority plus replica catch-up:
1. A primary shard accepts ordered writes.
2. Followers pull shard logs and apply committed entries.
3. Clients can predict their own input documents inside explicit authority
scopes.
4. Witnesses publish immutable observations about simulation facts.
5. Nodes aggregate observations into deterministic consensus candidates.
6. Authoritative world state is still committed through shard logs.
7. Verses describe rule-bearing consensus graphs so compatible branches can
share transport without pretending their rules or authority are identical.
## Next Research Cut
The next hard problem is not more vocabulary. It is durable authority:
- persist authoritative shard logs
- define compaction and snapshot fallback
- add observation fanout across peers
- add Verse discovery gossip and subscription policy
- add simulation rollback/resimulation helpers
- then revisit membership, failover, and consensus protocol depth

View file

@ -0,0 +1,58 @@
# CultMesh Verses
A Verse is a rule-bearing consensus graph.
That phrasing is intentionally dry. It keeps the system honest.
The same transport can carry many Verses:
- `aetheria-main`: public Aetheria, operated by GameCult regional simulators.
- `aetheria-community-hardcore`: compatible transport, different rules.
- `aetheria-modded-skylands`: compatible branch with required runtime plugins.
- `p2p-arena-nightly`: peer-to-peer authority for a small experimental game.
## Descriptor
`CultMeshVerseDescriptor` owns:
- `VerseId`: stable id
- `DisplayName`: public-facing name
- `AuthorityModel`: operator cluster, federated cluster, peer-to-peer, or
subscribed overlay
- `Compatibility`: transport version, rules hash, compatible Verse ids, and
plugin requirements
- `DiscoveryEndpoints`: endpoints where nodes for the Verse can be found
- `AuthorityRuntimeIds`: known authoritative runtimes when cluster-shaped
- `ParentVerseId`: source Verse for overlays or branches
## Compatibility
Two Verses can share a transport without sharing rules.
Transfer is allowed when:
- transport versions match, and
- rules hashes match, or the destination explicitly lists the source Verse as
compatible
That lets a modded branch choose its boundary. It can accept transfers from
Aetheria Main, require a plugin pack, and still reject another branch with
incompatible rules.
## Authority
Authority is a Verse-level policy, not a transport accident.
- `OperatorCluster`: one known operator cluster is final authority.
- `FederatedCluster`: several regional or organizational clusters share
authority.
- `PeerToPeer`: participating peers directly contribute authority.
- `SubscribedOverlay`: the Verse follows another Verse and adds local rules,
mods, or presentation layers.
## Discovery
`CultMeshVerseCatalog` is a local reactive catalog. It can be filled from
static config, cloud discovery, peer gossip, or mod portals. It does not care
where the descriptor came from. That keeps discovery pluggable while the Verse
model stays stable.