Race condition between world partition streaming and actor net relevancy cause actors to fall through the world

Hi,

I’m looking into a bug with our game where replicated actors become net relevant before world partition streaming completes.

To give a high-level summary of the setup:

  1. It’s a networked game using a dedicated server instance.
  2. We make use of World Partition to stream the Level on Client. Entire world is loaded on Server.
  3. For network relevancy we make use of the replication graph. The affected actors are part of a 2D Spatialized Dynamic node(not sure if relevant, better to mention it).

This doesn’t always cause issue but when the following conditions are met on the server:

  1. The replicated actor also replicates movement/transform.
  2. The actor is “at rest”, standing on terrain.
  3. It is a dynamic or kinematic body affected by gravity.

and the actor then becomes net relevant to the client:

  1. Receives and instantiates the replicated actor.
  2. The world partition cell which the actor is in haven’t loaded yet.

These conditions lead to a situation (as far as I can tell) where the client simulates physics on the actor, resulting it in falling down. Since there is no ground to catch it, it continues falling. At the same time the server instance is at rest, resulting in no movement updates (and by extension, no corrections). This leads to the actor representation de-syncing between client and server.

Typing it out like this it feels like a common issue that can happen with any dynamic/kinematic actor where networking and world partition are involved. We don’t know of any or have found any engine-level systemic solution to this problem and so we are compelled to ask: Is this actually a natural race condition in the engine? Or is it possibly something we have done incorrectly with our setup of world partition and the replication graph?

--Current Work-around--

That said we have a “work around” of the server replicating the sleep state to the client and the client then temporarily disabling simulation for the actor if it is “sleeping” and surrounding world partition isn’t loaded yet. We can apply this generally to dynamic actors but we want to hold off on committing until we know whether we actually need to solve this ourselves or if there is something we have done wrong initially, or simply have missed the already existing solution.

Steps to Reproduce
--Repro--

Unfortunately I haven’t been able to create an in-editor reproduction. I have a reliable repro in a packaged build involving separate meshes (not part of the large landscape meshes). The problem is that due to the many system components working together in this bug I don’t have detailed information on how our world partition is set up and the specific replication going on. But if there are specific things you need to know I’ll make sure to find out and provide what information I can to help build a consistent repro in a general project.

I have detailed more information on the setup in Description and the findings we have on our own.

Hello,

I think you will need to query the area to ensure it is loaded by using IsStreamingCompleted. This article provides an example: https://dev.epicgames.com/community/learning/knowledge\-base/4yOE/unreal\-engine\-world\-partition\-how\-to\-handle\-actors\-falling\-through\-the\-world.

Thanks,

Ryan

We plan to investigate whether we could offer a generic solution to help physics-simulated actors respond to any overlapping levels streaming in/out, but haven’t been able to make it a priority.

-Ryan

Hi Ryan,

As I said in the post we are already doing this as our solution, but I guess this is good confirmation it is the correct way to do it. I also take that the implication is that the engine doesn’t come with an existing general solution to this problem? Which I find surprising since it doesn’t really require any project specific behaviors to occur. It’s a natural race condition of the systems interacting with each other.