Skip to content

gRPC Protocol ​

Channel on localhost:50051. Single .proto source of truth at proto/heartwood/v1/heartwood.proto.

15 RPCs ​

Connection ​

RPCDirectionDescription
HandshakeC# → GoInitial connection: world ID, server info, registered species list
HeartbeatC# → GoEvery 10s: current game time → Go runs population ticks, returns directives

Chunk Lifecycle ​

RPCDirectionDescription
ChunkLoadedC# → GoChunk entered player range: send existing VS entities in chunk, receive spawn directives
ChunkUnloadedC# → GoChunk left player range: send final entity states for persistence

Entity Sync ​

RPCDirectionDescription
SyncEntitiesC# → GoEvery 5s: all managed entity positions/states → receive spawn/despawn directives
EntityEventC# → GoEvent-driven: entity died, was attacked, etc.

World Data ​

RPCDirectionDescription
UpdatePlayersC# → GoPlayer positions (used for spawn distance checks)
ExportTerrainC# → GoChunk terrain data for habitat patch building

Queries ​

RPCDirectionDescription
QueryEntitiesC# → GoGet entities near a position
QueryPopulationC# → GoGet population state for a region
QueryTerrainC# → GoGet terrain data for a chunk

Climate/Habitat ​

RPCDirectionDescription
ExportRegionDataC# → GoClimate data for a region (temperature, rainfall, forest cover)
QueryPatchesC# → GoGet habitat patches near a position

Settlements ​

RPCDirectionDescription
SyncSettlementsC# → GoSettlement data for NPC village population modeling

Streaming ​

RPCDirectionDescription
EventStreamGo → C# (server-streaming)Push ecosystem events to connected clients in real time

Reconnect recovery ​

When the bridge reconnects after a disconnect:

  1. Scans all loaded VS entities for heartwood:uuid tags
  2. Re-registers found entities with Go
  3. Sends immediate full entity sync
  4. Re-exports terrain and region data for all loaded chunks
  5. Backfills ChunkLoaded for all currently-loaded chunks

Released under the MIT License.