Culled Player Object isn’t synced with Host State
Key Problem
UploadCurrently Inonly Progressable to get position/value based on client side, not synced with actual host data, and visual representation also not synced.
Expected Output/Definition of Done
Sync culled local object with actual host state.
Key Solution
Credits to @Naufal Pratama
-
Just as seen in video below, fusion has internal interface ISimulationEnter and ISimulationExit that works as callback of Interest Management.
both interfaces works nicely as callback for Area Of Interest (Entering and Exiting to be exact.), however, problem arises when one exiting AOI.
-
When an Object exit AOI, we cull that object and prevent that object from receiving an update from the server. this behavior makes that object become idle, not doing anything, furthermore when implementing both callback interfaces object’s mesh may be disabled. since that object does not receive network updates from its original object so the object position may out-of-sync in the other player's local environment.
-
Some handling-on-thought is (not tested), stop local network objects from registering as entering AOI when approached by network objects.
How to Solve
- First, we need a root object for every player that is not culled to anyone, so we can request the actual character position from there (in this repo, we named it PlayerRoom).
- Every time SimulationEnter called, we do a request first from its player root for the actual position. We also need to request it more than once to ensure that we get the actual data.
- PlayerRoom must always update its character position in FixedUpdateNetwork to make it more reliable.
What things that has been done but not works?
- [Networked] variable of culled object is still received but with last state that synced with client.
- We only can send RPC to the owned player, but we can’t get the replied RPC to our client from there, because this client object is belongs to them.
- If we force using RPC to update the data in player root, we still need waiting for uncertain time (based on connection) to get the actual data.
RPC