Navigation
API > API/Plugins > API/Plugins/NetworkPrediction
UNetworkPredictionComponent This is the base component for running a TNetworkedSimulationModel through an actor component. This contains the boiler plate hooks into getting the system initialized and plugged into the UE replication system.
This is an abstract component and cannot function on its own. It must be subclassed and InitializeNetworkPredictionProxy must be implemented. Ticking and RPC sending will be handled automatically.
Its also worth pointing out that nothing about being a UActorComponent is essential here. All that this component does could be done within an AActor itself. An actor component makes sense for flexible/reusable code provided by the plugin. But there is nothing stopping you from copying this directly into an actor if you had reason to.
| Name | UNetworkPredictionComponent |
| Type | class |
| Header File | /Engine/Plugins/Runtime/NetworkPrediction/Source/NetworkPrediction/Public/NetworkPredictionComponent.h |
| Include Path | #include "NetworkPredictionComponent.h" |
Syntax
UCLASS (MinimalAPI, Abstract)
class UNetworkPredictionComponent : public UActorComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → UNetworkPredictionComponent
Implements Interfaces
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UNetworkPredictionComponent() |
NetworkPredictionComponent.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ReplicationProxy_Autonomous | FReplicationProxy | NetworkPredictionComponent.h |
|
|
| ReplicationProxy_Replay | FReplicationProxy | NetworkPredictionComponent.h |
|
|
| ReplicationProxy_Simulated | FReplicationProxy | NetworkPredictionComponent.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void CallServerRPC() |
Invoke the ServerRPC, called from UNetworkPredictionWorldManager via the TServerRPCService. | NetworkPredictionComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void EndPlay
(
const EEndPlayReason::Type Reason |
NetworkPredictionComponent.h | ||
virtual void InitializeComponent() |
NetworkPredictionComponent.h | ||
virtual void PreReplication
(
IRepChangedPropertyTracker& ChangedPropertyTracker |
NetworkPredictionComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PreNetReceive() |
NetworkPredictionComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CheckOwnerRoleChange() |
Helper: Checks if the owner's role has changed and calls InitializeForNetworkRole if necessary. | NetworkPredictionComponent.h | |
FReplicationProxySet GetReplicationProxies() |
NetworkPredictionComponent.h | ||
virtual void InitializeForNetworkRole
(
ENetRole Role, |
Finalizes initialization when NetworkRole changes. Does not need to be overridden. | NetworkPredictionComponent.h | |
virtual void InitializeNetworkPredictionProxy() |
Classes must initialize the NetworkPredictionProxy (register with the NetworkPredictionSystem) here. EndPlay will unregister. | NetworkPredictionComponent.h | |
void ServerReceiveClientInput
(
const FServerReplicationRPCParameter& ProxyParameter |
The actual ServerRPC. This needs to be a UFUNCTION but is generic and not dependent on the simulation instance. | NetworkPredictionComponent.h |
|