naia-server 0.25.0

A server that uses either UDP or WebRTC communication to send/receive messages to/from connected clients, and syncs registered Entities/Components to clients to whom they are in-scope.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use naia_shared::GlobalEntity;

use crate::{RoomKey, UserKey};

/// Events that drive scope re-evaluation.
/// Each variant encodes exactly the (user, entity) pairs that need attention.
pub(super) enum ScopeChange {
    /// User was added to a room — check all entities in that room for this user.
    UserEnteredRoom(UserKey, RoomKey),
    /// User was removed from a room — entities in that room may need despawning.
    UserLeftRoom(UserKey, RoomKey),
    /// Entity was added to a room — check all users in that room for this entity.
    EntityEnteredRoom(GlobalEntity, RoomKey),
    /// Explicit include/exclude via UserScope API.
    ScopeToggled(UserKey, GlobalEntity, bool),
}