@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
58 lines • 1.91 kB
TypeScript
/**
* Marks an entity as replicated and stores its peer-shared `network_id`.
*
* Replication is opt-in: only entities with this component are visible to
* the network layer. Add it before adding any other replicated component;
* remove it to stop replication (the entity stays alive locally).
*
* `network_id` is assigned automatically by {@link NetworkSystem.link} when
* the component is added to an entity. If the value is non-negative at link
* time, the system uses it as an explicit hint (typical when a packet from a
* remote peer carries a `network_id` that must map to a fresh local entity).
*
* `owner_peer_id` is the peer that has authority over this entity. Default
* value `-1` means "the local peer" (server-spawned entities on the server,
* or unowned). Game logic uses this to decide whether to trust incoming
* mutations or to predict locally.
*
* @author Alex Goldring
* @copyright Company Named Limited (c) 2025
*/
export class NetworkIdentity {
/**
* Peer-shared identifier. Negative until {@link NetworkSystem.link} runs.
* @type {number}
*/
network_id: number;
/**
* Peer that authoritatively owns this entity, or -1 for "local / server-owned".
* @type {number}
*/
owner_peer_id: number;
/**
* Reserved for game-defined replication policy bits (priority class,
* always-relevant flag, interpolation profile, etc.). Layout is up to the game.
* @type {number}
*/
replication_flags: number;
/**
*
* @param {NetworkIdentity} other
* @returns {boolean}
*/
equals(other: NetworkIdentity): boolean;
/**
*
* @returns {number}
*/
hash(): number;
/**
* @readonly
* @type {boolean}
*/
readonly isNetworkIdentity: boolean;
}
export namespace NetworkIdentity {
let typeName: string;
}
//# sourceMappingURL=NetworkIdentity.d.ts.map