Skip to main content

aetheris_server/
lib.rs

1//! Aetheris server library.
2//!
3//! Contains the core logic for the authoritative game server, including
4//! the tick scheduler and configuration management.
5
6#![warn(clippy::all, clippy::pedantic)]
7
8#[cfg(not(target_arch = "wasm32"))]
9/// Authentication and session management for the game server.
10pub mod auth;
11pub mod config;
12#[cfg(not(target_arch = "wasm32"))]
13pub mod matchmaking;
14pub mod multi_transport;
15#[cfg(not(target_arch = "wasm32"))]
16pub mod telemetry;
17#[cfg(not(target_arch = "wasm32"))]
18pub mod tick;
19
20pub use multi_transport::MultiTransport;
21#[cfg(not(target_arch = "wasm32"))]
22pub use tick::TickScheduler;
23
24#[cfg(not(target_arch = "wasm32"))]
25#[cfg(feature = "phase1")]
26/// Bootstraps a Phase 1 world with the default engine components and optional extra registrations.
27pub fn bootstrap_phase1_world(
28    tick_rate: u64,
29    extra_registry: impl FnOnce(&mut aetheris_ecs_bevy::registry::ComponentRegistry),
30) -> aetheris_ecs_bevy::BevyWorldAdapter {
31    let mut world =
32        aetheris_ecs_bevy::BevyWorldAdapter::new(bevy_ecs::world::World::new(), tick_rate);
33    let mut registry = aetheris_ecs_bevy::registry::ComponentRegistry::new();
34    aetheris_ecs_bevy::registry::register_platform_components(&mut registry);
35    extra_registry(&mut registry);
36
37    for descriptor in registry.components.values() {
38        world.register_replicator(descriptor.replicator.clone());
39    }
40    world
41}