Module |
|
Header |
/Engine/Plugins/Runtime/NetworkPrediction/Source/NetworkPrediction/Public/NetworkPredictionComponent.h |
Include |
#include "NetworkPredictionComponent.h" |
[UCLASS](Programming/UnrealArchitecture/Reference/Classes#classdeclaration)(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 InstantiateNetworkedSimulation must be implemented. Ticking and RPC sending will be handled automatically, but the subclass will need to supply input to the simulation (via TNetworkedSimulationModelDriver::ProduceInput).
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 | ||
---|---|---|---|
|
TUniquePtr< INe... |
NetSimModel |
The Network sim that this component is managing. This is what is doing all the work. |
|
OwnerCachedNetRole |
||
|
ReplicationProxy_ServerRPC |
ReplicationProxies are just pointers to the data/NetSerialize functions within the NetworkSim. |
|
|
ServerRPCHandle |
Name | Description | |
---|---|---|
|
UNetworkPredictionComponent() |
Name | Description | ||
---|---|---|---|
|
CheckOwnerRoleChange() |
Helper: Checks if the owner's role has changed and calls InitializeForNetworkRole if necessary. |
|
|
INetworkedSi... |
GetNetworkSimulation() |
|
|
FNetworkSimu... |
GetSimulationInitParameters ( |
Doesn't need to be overridden. Expected to be used in ::InitializeForNetworkRole implementation. |
|
InitializeForNetworkRole ( |
Finalizes initialization when NetworkRole changes. Does not need to be overridden. |
|
|
INetworkedSi... |
InstantiateNetworkedSimulation() |
Classes must instantiate their own NetworkSim here. The UNetworkPredictionComponent will manage its lifetime. |
|
IsLocallyControlled() |
Attempts to determine if the component is locally controlled or not, meaning we expect input cmds to be generated locally (and hence need to prepare the input buffer for that) |
|
|
Reconcile() |
||
|
RegisterServerRPCDelegate() |
||
|
ServerRecieveClientInput ( |
The actual ServerRPC. This needs to be a UFUNCTION but is generic and not dependent on the simulation instance. |
|
|
TickServerRPC ( |
Called via ServerRPCDelegate, ticks serverRPC timing and decides whether to send the RPC or not. |
|
|
TickSimulation ( |
||
|
UnregisterServerRPCDelegate() |
Name | Description | ||
---|---|---|---|
|
InitializeComponent() |
Initializes the component. |
|
|
PreReplication ( |
Called on the component right before replication occurs |
|
|
TickComponent ( |
Function called every frame on this ActorComponent. |
|
|
UninitializeComponent() |
Handle this component being Uninitialized. |
Name | Description | ||
---|---|---|---|
|
PreNetReceive() |
Called right before receiving a bunch |