Open 3D Engine Multiplayer Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
IFilterEntityManager provides an interface for filtering entities out from replication down to clients. More...
#include <IFilterEntityManager.h>
Public Member Functions | |
AZ_RTTI (IFilterEntityManager, "{91F879F2-3DAF-43B8-B474-B312D26C0F48}") | |
virtual bool | IsEntityFiltered (AZ::Entity *entity, ConstNetworkEntityHandle controllerEntity, AzNetworking::ConnectionId connectionId)=0 |
IFilterEntityManager provides an interface for filtering entities out from replication down to clients.
By default, all entities with NetBindComponent on them are replicated to all clients. (There is a built-in distance filtering, where only entities within vicinity of a player are sent to that player. This is controlled by sv_ClientAwarenessRadius AZ_CVAR variable.)
There are use cases where you want to limit the entities sent to a client, for example "fog of war" or "out of line of sight" anti-cheating mechanic by omitting information clients should not have access to.
By implementing IFilterEntityManager interface and setting it on GetMultiplayer()->SetFilterEntityManager() entities can be filtered by IsEntityFiltered(...) returning true.
Note: one cannot filter out entities in Level prefab (spawned by LoadLevel console command). Level prefabs are fully spawned on each client. Filtering of entities is applied to dynamically spawned prefabs, and specifically entities must have NetBindComponent on them.
|
pure virtual |
Return true if a given entity should be filtered out, false otherwise. Important: this method is a hot code path, it will be called over all entities around each player frequently. Ideally, this method should be implemented as a quick look up.
entity | the entity to be considered for filtering |
controllerEntity | player's entity for the associated connection |
connectionId | the affected connection should the entity be filtered out. |