class

FAuthorityLeaseSystem

Module
Networking
Header
#include "Networking/Replication/AuthorityLease.h"
Namespace
Mowo

Type aliases

AliasDescription
using FLeaseListener = std::function<void(const FLeaseEvent&)>
using FClaimPriorityFn = std::function<int32_t(uint32_t peerId, EntityID item, int32_t priorityHint)>
using FClaimValidatorFn = std::function<bool(uint32_t peerId, EntityID item)>Runs before a claim is considered at all (reach, item state...).
using FMessageSink = std::function<void(uint32_t targetPeerId, NetworkId nid, uint16_t eventId, const uint8_t* data, size_t len, bool reliable)>targetPeerId 0 = the host. Unset = the world's ReplicationManager.

Properties

TypeNameDescription
static constexpr floatkJitterSlackSecondsHow far behind the elapsed time a pose may still be explained by arrival jitter: two packets that land in one host tick are not a doubling of speed. Default 0.05f.
static constexpr uint32_tkMaxRejectionsPerLeaseRefused poses inside one lease before the host takes the item back. Default 5.

Constructors

SignatureNameDescription
FAuthorityLeaseSystem() = defaultFAuthorityLeaseSystem
~FAuthorityLeaseSystem() override = default~FAuthorityLeaseSystem

Public functions

ReturnsNameDescription
voidInitialize
voidShutdown
voidUpdate
boolRequestLeaseClient: ask the host for the item.
boolPredictLeaseClient: start simulating the item as a predicted lease WITHOUT sending a request, because a gameplay request already carries it (a carry pickup).
boolReleaseLeaseClient: hand the item back with its current pose and velocity (a drop or a throw).
boolRevokeLeaseHost: take a client's lease back (HostReclaimed).
boolGrantLeaseHost: grant directly, under the same conflict rule as a request.
uint32_tGetLeaseHolderWho simulates the item: 0 = the host, otherwise the lessee's peer id.
boolIsHostHeld
boolIsLeasedLocallyThis client holds the lease and simulates the item.
boolIsSimulatingLocallyThis client simulates the item: a granted lease or one still predicted.
floatGetLeaseRemainingSeconds left on the lease as this machine knows it; 0 when none.
uint32_tAddListener
voidRemoveListener
voidSetClaimPriorityResolver
voidSetClaimValidator
voidSetRoleOverride
voidClearRoleOverride
ELeaseRoleGetEffectiveRole
uint32_tGetLocalPeerId
voidSetMessageSink
voidHandleMessageInbound message (the RPC observer's path, and the headless one).
voidServerHandlePeerLeftHost: the peer is gone; revoke everything it holds.
voidSetPoseSendRateHz
const FStats&GetStats
voidResetStats
ELeasePoseVerdictValidatePoseChecks incoming against the last accepted pose elapsed seconds ago.
floatReturnBlendWeightRemaining fraction of a return blend that started elapsed ago and lasts duration: smoothstep, 1 at the start, 0 at the end.

Function details

FAuthorityLeaseSystem

C++
FAuthorityLeaseSystem() = default

~FAuthorityLeaseSystem

C++
~FAuthorityLeaseSystem() override = default

Initialize

C++
void Initialize(World* world) override

Shutdown

C++
void Shutdown() override

Update

C++
void Update(float deltaTime) override

RequestLease

C++
bool RequestLease(EntityID item, int32_t priorityHint = 0)

Client: ask the host for the item. The answer arrives as a Granted or Denied event. Host: the host's own player claims it (host wins: a client lease on it is revoked).

PredictLease

C++
bool PredictLease(EntityID item, uint32_t requestSeq)

Client: start simulating the item as a predicted lease WITHOUT sending a request, because a gameplay request already carries it (a carry pickup). The host answers with GrantLease(item, peer, priority, requestSeq); a grant or deny carrying another seq is not this one.

ReleaseLease

C++
bool ReleaseLease(EntityID item)

Client: hand the item back with its current pose and velocity (a drop or a throw). Host: the host's own player lets go.

RevokeLease

C++
bool RevokeLease(EntityID item, ELeaseRevokeReason reason = ELeaseRevokeReason::HostReclaimed)

Host: take a client's lease back (HostReclaimed).

GrantLease

C++
bool GrantLease(EntityID item, uint32_t peerId, int32_t priority = 0, uint32_t requestSeq = 0)

Host: grant directly, under the same conflict rule as a request. requestSeq answers a client's PredictLease; 0 is an unasked grant.

GetLeaseHolder

C++
uint32_t GetLeaseHolder(EntityID item) const

Who simulates the item: 0 = the host, otherwise the lessee's peer id. Read from the replicated component, so it is right on every machine, late joiners included.

IsHostHeld

C++
bool IsHostHeld(EntityID item) const

IsLeasedLocally

C++
bool IsLeasedLocally(EntityID item) const

This client holds the lease and simulates the item.

IsSimulatingLocally

C++
bool IsSimulatingLocally(EntityID item) const

This client simulates the item: a granted lease or one still predicted.

GetLeaseRemaining

C++
float GetLeaseRemaining(EntityID item) const

Seconds left on the lease as this machine knows it; 0 when none.

AddListener

C++
uint32_t AddListener(FLeaseListener listener)

RemoveListener

C++
void RemoveListener(uint32_t handle)

SetClaimPriorityResolver

C++
void SetClaimPriorityResolver(FClaimPriorityFn fn)

SetClaimValidator

C++
void SetClaimValidator(FClaimValidatorFn fn)

SetRoleOverride

C++
void SetRoleOverride(ELeaseRole role, uint32_t localPeerId)

ClearRoleOverride

C++
void ClearRoleOverride()

GetEffectiveRole

C++
ELeaseRole GetEffectiveRole() const

GetLocalPeerId

C++
uint32_t GetLocalPeerId() const

SetMessageSink

C++
void SetMessageSink(FMessageSink sink)

HandleMessage

C++
void HandleMessage(uint32_t senderPeerId, NetworkId nid, uint16_t eventId, const uint8_t* data, size_t len)

Inbound message (the RPC observer's path, and the headless one).

ServerHandlePeerLeft

C++
void ServerHandlePeerLeft(uint32_t peerId)

Host: the peer is gone; revoke everything it holds. Also detected by polling the ReplicationManager's peer table when there is one.

SetPoseSendRateHz

C++
void SetPoseSendRateHz(float hz)

GetStats

C++
const FStats& GetStats() const

ResetStats

C++
void ResetStats()

ValidatePose

C++
static ELeasePoseVerdict ValidatePose(const FLeasePose& last, float elapsed, const FLeasePose& incoming, float maxSpeed, float teleportDistance, FLeasePose& out)

Checks incoming against the last accepted pose elapsed seconds ago. Accepted: within maxSpeed. Clamped: too fast but not a jump; out is pulled back onto the speed limit along the same direction. Rejected: a teleport, out = last. Reported velocities are clamped to maxSpeed in both accepted cases.

ReturnBlendWeight

C++
static float ReturnBlendWeight(float elapsed, float duration)

Remaining fraction of a return blend that started elapsed ago and lasts duration: smoothstep, 1 at the start, 0 at the end.

Generated from Networking/Replication/AuthorityLease.h via networking.json · Dec 5, 2026Version 1.1.0