Unreal Networking

posted in: Non classé | 0

Full class for networking in Unreal
http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen_BW.pdf
And a local copy, just in case :
https://fargesportfolio.com/wp-content/uploads/2019/10/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen_BW.pdf

Tools for profiling :
Netprofile on/off

Using Replication over variable is clever : does not send data if same value is set (But trigger OnRep locally (on server side most of the time). With array, does not send all the array, but only modified values.
In cpp:
UPROPERTY(ReplicatedUsing=OnRep_SetPlayerType)
CAUTION : in CCP you must call the OnRep_SetPlayerType() when you set the variables, while you don’t need it on blueprint

OnRep :
– Coté serveur ou client local ça déclenche le onrep (évidement, si tu le set coté client pas de réplication chez les autres)
– Il FAUT un set (si c’est un array, faire un set sur l’array entier après) sinon pas de OnRep
– Si la variable ne se modifie pas, le onrep ne se trigger qu’en local