Hello, I am working on an RTS project with multiplayer functionality. This means I will need lots of actors/characters that are able to replicate over the server. I ran across this issue - movement and location replication would usually only work for about 5 - 10 seconds, then it would stop working. I am running the “Move” command on the server. Setting the “Always Relevant” option in class defaults to true fixes this issue, but I don’t know whether it would be too big a load for the network if there were a couple hundred actors with this. Thanks in advance : )
You should not replicate units. You need to replicate player which sends commands to units.
Proper course of action here would be to figure out why units are phasing out of relevancy.
Read up on actor relevancy here Actor Relevancy and Priority | Unreal Engine Documentation
Debug / print those variables on a tick/timer to figure out what’s going on. Units around your field of vision should be relevant and updating.
If you want units to keep updating even when they are far away and you are not looking at them (eg. minimap), AlwaysRelevant could be an option but I suggest adding custom logic to update units NetUpdateFrequency in real time, so that units you are looking at update smoothly, while units far away update like every couple seconds on the minimap.
Alternatively, keep relevancy in but replicate just an array of locations for the minimap, which should be much lighter than replicating all the units.
Net Cull Distance (NCD) is a good starting point. Think of it as a sphere around your character that helps determine relevancy. Anything inside is relevant (considered for replication), nothing outside is considered, unless “Always Relevant” is set to true on the specific actor.
Characters should have the highest priority and their NCD should be set to account for the distance needed.
For example if you want characters that are 100m away to be considered, then NCD should be set for a minimum of 100m.
How far out is a game design choice. Small map arena games use smaller values. Large open worlds with long sight lines use higher values.
e.g.
Player Unknowns Battle Grounds (PuBG) has a 960 to 980m NCD and a render cull that’s pretty close to that.
You definitely want to dial in your values here. Don’t just throw in a huge number and be done with it. There’s a performance cost attached.
Debugging will be a bit easier once you have your NCD dialed in.
@mykola.shatokhin
Thanks for the answer, but can I ask you to elaborate a bit more? I’m new and don’t really understand what you mean by replicating the player. Did you mean only replicate the commands, and then all clients basically give the replicated commands from other players to the units?
@Chatouille
Thanks for the reply, appreciate it : ) will read into it and try out the things you are suggesting.
@Rev0verDrive
Thank you for that, will try it : )
P.S. Sorry if this seems dumb but I’m a real noob what concerns multiplayer and thought it would be better to ask early than have to redo it when the project is almost done : )