[BUG?] Net Cull Distance doesn't work when the player pawn is not a Character

I have some actors that are set to be Replicated with some relatively small Net Cull Distance. If the player pawn is derived from Character, when it comes close enough to those actors, they become visible correctly. However, when the player pawn is not derived from Character, for example a vehicle or just derived from Pawn/DefaultPawn, those actors don’t become visible no matter how close the player comes to them.

It’s interesting that when the player pawn starts already close enough to those actors, they are replicated correctly.

Here’s a clean project where you can see this bug: Cahoots — Ann Arbor tech coworking
(use PlayerPawn pawn and come to the cylinder BSP, the sphere actors won’t become visible)

1 Like

Hi CodeSpartan -

Thank you for the sample project we are looking into this issue now. Can you also tell us what version of the engine you are using and what platform you are building on? Myself or a Colleague will get back to you as soon as we can test this issue further.

Eric Ketchum

Hi, thanks for the quick reply! I’m using 4.7.1 from GitHub, Windows 64

Just tested with 4.7.5 - no difference

Hi Code Spartan -

I was able to replicate (sorry) this issue and have entered a bug, UE-14949 for reference. As we continue to investigate a solution I will keep you informed here.

UPDATE: So I was talking with our Networking Team and currently the engine only supports replication with the Character Movement Component and not the Pawn Component. I can change the bug into a feature request if you wish, let me know.

Thank You

Eric Ketchum

This certainly could seem counter-intuitive to the users. Currently if a humanoid character is used for the player, distance-based replication for other actors works, but if the game developer wants to use a vehicle or some flying chicken character the distance-based replication for other actors won’t work for no apparent reason. So yes, please log this as either bug or a feature request. Thanks for investigating this.

Hi -

Done and Done. I will keep you informed as we continue investigating opening this feature up.

Thank You

Eric Ketchum

There is an easy solution to this that I have found out that worked for me. The test project I’m working relies on controlling non-Character class objects in a huge world.

I was getting the same issues and after a few debugging sessions in the code, I figured out that the cull distance it was comparing it to was the view target location.

The solution was to create a new PlayerCameraManager and simply untick the “Use Client Side Camera Updates”.

56295-playercameramanagersettings.png

3 Likes

I agree this is extremely counter-intuitive. I spent the last 3 hours searching for the reason why actors don’t replicate correctly to the client, and now I finally found the reason for this. The net cull distance option should at least clearly state that it has to be infinite if no character is used for the player.

Hi Wrenix,

I have unchecked “Use Client Side Camera Updates” in a custom PlayerCameraManager and set it as the PlayerCameraManagerClass in my PlayerController, but that did not fix it (it did not change anything).

Is this workaround still valid in 4.10? Thanks!

I have not updated my project for 4.10 as I’ve moved onto another project but that still works on 4.9.2 which is what my test project is set to. So it could be possible this is no longer valid if the issue is occurring.

My issue was that when I possessed a Vehicle and drove it within net cull distance range of another Vehicle that has actually moved from its spot on the other client that owns it, that Vehicle on my view didn’t teleport correctly to its position.

When you hover over the “Use Client Side Camera Updates” the dialog says “True if server will use camera positions replicated from the client instead of calculating them locally.” From the Relevancy documentation, the server determines which actors are relevant to the clients. If an actor passes all the checks to make it relevant for a client, at some point along the tests it would see if that actor is within net cull distance of the clients view camera position, and at this point, I assume that, allowing the server to calculate the camera positions locally will be the most logical solution as the server knows all, if those actors are owned by the server. If this was left on then I assume that only the Character class (Character Movement Component) sends camera positions to the server. For all other Pawn objects the server is using incorrect camera view positions as the positions aren’t sent.

Cheers, this seems to have fixed my issue.

Ok, I hacked it somehow. Seems that running the Movement Component’s Add Input Vector on the owner/multicast will tell Unreal that the actor location has updated.

So I added an Add Input Vector node just after my multicast replication(should work on run on Owner too).
This node simply takes the GetActorForwardVector x 0.000001 to get the smallest vector, so that Unreal still updates the location, but we don’t actually affect gameplay that much.

Thought a screenshot might help someone more, hopefully it’s self explanatory. Add a movement component to your pawn and then do the following on tick/however often you need.

Thanks a lot! This is exactly what I needed!

In my case I use my own spectator pawn without any movement component. It’s just attached to other player’s character to follow him. I use this pawn after player’s death, for example.

So I had to add floating pawn movement to implement your solution. It works fine!

I only changed random bool to flip flop (I know random bool is okay on large numbers, but flip flop is fully safe)

2 Likes

9 years have passed and the problem remains. For some reason I’m not surprised.