Download

Procedural generation & handling multiplayer

I am trying to create a multiplayer rogue-like with procedurally generated levels. I am stuck on figuring out how to support a Diablo 3-like “rift” system.

In such a system, players can freely move about multiple “floors” that have been procedurally generated. These floors may contain persistent loot or enemies. Ideally, the players would not need to move as a group (ie server traveling from map to map), and should otherwise be able to communicate freely.

After a lot of time spent figuring out persistent levels, I do not think it will do what I need to unless there is some trick for separating areas between players. It seems like I could load/unload streaming levels to ensure they are only loaded when players are present in the area, but it seems like a performance hog to have potentially dozens of large areas all replicating to all clients, instead of each area replicating to the players on that floor.

I am almost thinking I will need to set up a server instance for each “floor”, but I am not sure if that would work for Listen Server (aka locally hosted).

How can I accomplish this?

Hm, you need to consider that Replication is still bound to specific factors. So you could limit the NetCullDistance a bit and the other floors wouldn’t replicate, even when loaded.
Only if they go near the floor, they will get replicated.

Other than that, as you seem to already found out, Servers can’t have multiple Maps loaded. Only if you stream them. So you would need a complete new Server per Map.
That’s only possible if you have something to manage Server Instances (would need coding outside of UE4) and also are using Dedicated Servers instead of ListenServers.

There is also a function you can override to limit replicating to your own rules. “IsNetRelevantFor” or something like that. It’s a base actor class function.

You could, for example, use the already existing Tag Arrays of Actors and Tag things that belong together. For example with the Name of the Floor.
So an actor would only be relevant for another if the Zone Tag exists on both.

But keep in mind that there are tons of actors that you would need to stick together, even if the floor isn’t matching, like PlayerState replication etc.

With my current architecture, this would actually be surprisingly easy to implement. I could essentially “stack” each floor, based on AABB. It sounds like I could set collision filtering and replication (to be safe) to be specific to each floor.

Is there anything else I would need to do to ensure they do not interact with each other in the World?