Uint8 Doesn't Replicate / Trigger OnRep function if Zero

This seems like it should be a bug, but it may be intentional so posting here just in case. This issue effects a LOT of UE4’s replication, especially serialized rotators. In my case it affects quantized floats.

Essentially, if a Replicated uint8 is changed on the server to be zero from a previous value - it either doesn’t replicate to clients, or it doesn’t trigger the OnRep function on a client.

To get around this, I have had to add a value of ‘1’ to my packed uint8, and remove it again on the client side. This instantly fixes the problem - but of course this limits some of the useful range of the uint8, so this needs to be resolved.

Hello,

Could you please provide the code that you are working with so that we can attempt to reproduce this issue?

Hi Sean,

Apologies for the delay. I have attached the code I am working with. The comments should show how to reproduce the issue. It’s possible I believe to modify ShooterGame to see the issue. Unfortunately it’s quite hard to provide an example in this case!

link text

Hello,

I have investigated this issue further, and have discovered that this is a known issue in our system with OnRep functions not firing on the client (UE-11876).

Have a great day

Thanks Sean,

I don’t suppose you’d be able to provide the details for that case so I can avoid those issues for the meantime could you?

Cheers!

I would really like to know the answer to this as well. This is a pretty major issue and a C++ hotfix or workaround (even if just some code pasted into an answer from an Epic engineer) would be really helpful.

This issue is still being investigated by our developers, and there is currently no timeline for when a fix will be released. I will be sure to provide updates regarding this issue as they become available.

Hi TheJamsh,

I took a look at UE-11876, but I think it’s actually unrelated to this issue. Based on the attached code, OverheatData is being modified in the OnRep function. Any modification of replicated variables on a client can cause problems with future replication of that variable, as well as OnReps, since it throws off the server’s assumption about what value the client has.

I would recommend trying to refactor the OnRep function to not modify OverheatData. Granted, I’m only looking at this small snippet, but it looks like it should be possible to use OverheatData to update HeatProgressRatio without writing to OverheatData. Let us know if this fixes the issue!

Hey Ryan,

Thanks for looking at the code, I will go through and check it again based on your advice.

Out of interest then, does this mean that the Server uses the OnRep functions itself to determine what it thinks the client currently has? Or does the Client send it’s version of the variables to the server to validate them - and the server then decides whether to send the values out or not?