Horizon-Network-Common

Crates.ioHorizon-Network-Common
lib.rsHorizon-Network-Common
version0.2.0
created_at2025-12-02 19:24:02.921232+00
updated_at2025-12-02 20:24:53.082578+00
descriptionShared network types and protocols for Horizon ecosystem (Horizon, Atlas, Maestro)
homepage
repositoryhttps://github.com/Far-Beyond-Dev/Horizon-Network-Common
max_upload_size
id1962463
size72,459
Tristan Poland (Trident_For_U) (tristanpoland)

documentation

README

Horizon Network Common

Shared network types and protocols for the Horizon game server ecosystem.

Overview

This crate provides the common data structures and communication protocols used by:

Installation

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" }

Modules

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

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         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) │
└────────────────┘ └────────────────┘ └────────────────┘

Usage

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));

Key Types

Spatial Types

  • WorldCoordinate - 3D position with f64 precision
  • RegionCoordinate - Discrete 3D grid position (i64)
  • RegionBounds - AABB bounding box for regions

Server Types

  • ServerId - Unique server identifier (UUID)
  • ServerInfo - Server metadata and capabilities
  • ServerRegistration - Registration request from Horizon to Atlas
  • ServerHeartbeat - Periodic health/load updates

Player Types

  • PlayerId - Unique player identifier (UUID)
  • PlayerInfo - Player metadata and state
  • PlayerState - Complete player state for transfers
  • MovementData - Velocity/acceleration for prediction

Transfer Types

  • TransferToken - Cryptographically signed transfer authorization
  • TransferRequest - Request to move player between servers
  • TransferResult - Outcome of a transfer operation

Message Types

  • HorizonMessage - Messages from Horizon to Atlas
  • AtlasMessage - Messages from Atlas to Horizon
  • MaestroMessage - Messages from Maestro to Atlas
  • Envelope<T> - Message wrapper with metadata

License

MIT

Commit count: 0

cargo fmt