MounteaInventoryEquipment icon indicating copy to clipboard operation
MounteaInventoryEquipment copied to clipboard

For reliable replicated data, prefer client replication event instead of extra client rpc

Open leetNightshade opened this issue 4 months ago • 1 comments

I see for things like item removal you have client rpcs like PostItemRemoved_Client(...), but considering that data is replicating to the client with such thing like OnRep_InventoryItems() you can just trigger the client events in the replication callback rather than generating extra network traffic via client RPCs.

Do you or anyone else object to this?

It's just you may need to restructure your callback/data to get the specific item in question. In this case you don't capture the before data, so you have no idea what changed.

(I feel like I should open a separate issue for FInventoryItemArray, rather than relying on OnRep_InventoryItems() you should use the FFastArraySerializer events PreReplicatedRemove()/PostReplicatedAdd()/PostReplicatedChange().)

leetNightshade avatar Aug 04 '25 21:08 leetNightshade

I plan to review the whole replication process. For adding items, that is kinda easy, the main issue comes from removing items. Do you have any idea how to optimize the current code? If so I will be very happy to learn!

pavlicekdominik avatar Aug 29 '25 09:08 pavlicekdominik