Hello guys, I’m having problems with Network Relevancy in my MOBA game which uses a special Pawn/PlayerController + Character/AIController setup:
the Character becomes network irrelevant on the client, allthough all involved actors (Pawns & Controllers) are synced to the current Character location (on Server & Client).
- How does Network Relevancy exactly work? (Is there any more logic than “Object becomes irrelevant outside of NetCullDistance”?)
- Based on which object/location is the Network Relevancy of other objects evaluated? (Distance to which object used for the “> NetCullDistance check”)
- Where can I find the Network Relevancy logic in the source code?
Some background info: in order to get a MOBA control scheme (3rd person top-down view, move to mouse click location using pathfinding) to work within the UE4 Client/Authoritative Server architecture, I created a special controller setup with ClassBlueprints:
a custom “ProxyPlayerController” (extending PlayerController) and a custom “ProxyPawn” (extending Pawn) are set as default PlayerController and Pawn classes in the GameMode.
the ProxyPlayerController calculates the target position on a mouse click (using “GetHitResultUnderCursorByChannel()”) and sends an RPC “MoveToLocation” to the Server.
the ProxyPawn spawns a “MyAIController” (extending AIController) and a “MyCharacter” (extending Character) on “BeginPlay” on the Server and possesses the MyCharacter instance by the MyAIController instance. Also the ProxyPawn saves the MyAIController and MyCharacter instance references in corresponding public variables.
all “MoveToLocation” RPCs called in ProxyPlayerController on the Server are passed to the MyAIController (via ProxyPlayerController.GetControlledPawn() -> cast to ProxyPawn -> GetMyAIController()). MyAIController finally calls the UE4 function AIController.MoveToLocation(), in order to move the controlled MyCharacter to the target location using pathfinding on the Authoritative Server. MyCharacter’s movement is network replicated to all clients (even the “own” client).
the ProxyPawn has additional logic which updates its location to that of the referenced/replicated MyCharacter instance (on Server and “own” Client) via LERP. ProxyPawn also has the actual CameraComponent attached, which allows to “observe” the replicated MyCharacter.
Everything works fine until I decrease the “NetCullDistanceSquared” of MyCharacter to a value half of the map size: now the MyCharacter “observed” by the ProxyPawn becomes network irrelevant on the client (and destroyed), as soon as he’s too far away from location 0,0 (UActorChannel::CleanUp() is called) and then the Camera pops back to 0,0. I added log output to all involved actors (ProxyPawn, ProxyPlayerController, MyCharacter, MyAIController) and all instance locations are identical on the Server and Client and MyCharacter therefor should be within the “NetworkCullDistance”!
I already tried out all the available checkboxes without luck:
PlayerController.PlayerCameraManagerClass (none or PlayerCameraManager), AutoManageActiveCameraTarget
I don’t want to increase the “NetworkCullDistance” or enable “AlwaysRelevant” because I need to reduce network traffic in the future.
Thank you very much for any help and sorry for the wall of text. If required I can upload the corresponding blueprints and will gladly give more info!