Choose your operating system:
Windows
macOS
Linux
Module |
|
Header |
/Engine/Plugins/Runtime/NetworkPrediction/Source/NetworkPrediction/Public/NetworkPredictionComponent.h |
Include |
#include "NetworkPredictionComponent.h" |
UCLASS(Abstract)
class UNetworkPredictionComponent : public UActorComponent
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 UE4 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 | Description | ||
---|---|---|---|
|
NetworkPredictionProxy |
Proxy to interface with the NetworkPrediction system. |
|
|
ReplicationProxy_ServerRPC |
ReplicationProxies are just pointers to the data/NetSerialize functions within the NetworkSim. |
Name | Description | |
---|---|---|
|
UNetworkPredictionComponent() |
Name | Description | ||
---|---|---|---|
|
CallServerRPC() |
Invoke the ServerRPC, called from UNetworkPredictionWorldManager via the TServerRPCService. |
|
|
CheckOwnerRoleChange() |
Helper: Checks if the owner's role has changed and calls InitializeForNetworkRole if necessary. |
|
|
FReplication... |
GetReplicationProxies() |
|
|
InitializeForNetworkRole |
Finalizes initialization when NetworkRole changes. Does not need to be overridden. |
|
|
InitializeNetworkPredictionProxy() |
Classes must initialize the NetworkPredictionProxy (register with the NetworkPredictionSystem) here. EndPlay will unregister. |
|
|
ServerReceiveClientInput ( |
The actual ServerRPC. This needs to be a UFUNCTION but is generic and not dependent on the simulation instance. |
Name | Description | ||
---|---|---|---|
|
EndPlay ( |
Ends gameplay for this component. |
|
|
InitializeComponent() |
Initializes the component. |
|
|
PreReplication ( |
Called on the component right before replication occurs |
Name | Description | ||
---|---|---|---|
|
PreNetReceive() |
Called right before receiving a bunch |