Shared network types and protocols for the Horizon game server ecosystem.
This crate provides the common data structures and communication protocols used by:
- Horizon - Game server instances (regions)
- Horizon-Atlas - Server meshing proxy and load balancer
- Horizon-Maestro - Container orchestration and deployment
Add to your Cargo.toml:
[dependencies]
horizon_network_common = "0.1"Or with git:
[dependencies]
horizon_network_common = { git = "https://github.com/Far-Beyond-Dev/Horizon-Network-Common" }| Module | Description |
|---|---|
spatial |
WorldCoordinate, RegionCoordinate, RegionBounds |
server |
ServerId, ServerInfo, ServerRegistration, ServerHeartbeat |
player |
PlayerId, PlayerInfo, PlayerState, MovementData |
transfer |
TransferToken, TransferRequest, TransferResult |
health |
HealthStatus, HealthCheck, ClusterHealth |
messages |
HorizonMessage, AtlasMessage, MaestroMessage |
┌─────────────────────────────────────────────────────────────────┐
│ Maestro │
│ (Container Orchestration) │
└─────────────────────────┬───────────────────────────────────────┘
│ SpawnServerRequest / SpawnServerResponse
▼
┌─────────────────────────────────────────────────────────────────┐
│ Atlas │
│ (Server Meshing Proxy + Player Routing) │
└────────┬────────────────┬───────────────────┬───────────────────┘
│ │ │
│ Registration │ Heartbeat │ Transfer
▼ ▼ ▼
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Horizon │ │ Horizon │ │ Horizon │
│ Region(0,0,0) │ │ Region(1,0,0) │ │ Region(0,1,0) │
└────────────────┘ └────────────────┘ └────────────────┘
use horizon_network_common::{
WorldCoordinate, RegionCoordinate, RegionBounds,
ServerInfo, ServerRegistration,
PlayerId, PlayerInfo,
};
// Create a region coordinate
let region = RegionCoordinate::new(1, 0, 0);
// Convert to world position
let world_pos = region.to_world_center(1000.0);
// Check if a position is in bounds
let bounds = RegionBounds::from_center(world_pos, 500.0);
assert!(bounds.contains(&world_pos));WorldCoordinate- 3D position with f64 precisionRegionCoordinate- Discrete 3D grid position (i64)RegionBounds- AABB bounding box for regions
ServerId- Unique server identifier (UUID)ServerInfo- Server metadata and capabilitiesServerRegistration- Registration request from Horizon to AtlasServerHeartbeat- Periodic health/load updates
PlayerId- Unique player identifier (UUID)PlayerInfo- Player metadata and statePlayerState- Complete player state for transfersMovementData- Velocity/acceleration for prediction
TransferToken- Cryptographically signed transfer authorizationTransferRequest- Request to move player between serversTransferResult- Outcome of a transfer operation
HorizonMessage- Messages from Horizon to AtlasAtlasMessage- Messages from Atlas to HorizonMaestroMessage- Messages from Maestro to AtlasEnvelope<T>- Message wrapper with metadata
MIT