Replicating 25-40 AI Character + Physics + Projectiles

Hello,

I have a running multiplayer game so I understand all basics, but I have a hard time getting everything smooth.

Game consist of a small map, like Counter-Strike or other Tactical shooter map. A bit small as Counter-strike I think. There are long streets, so player can look everywhere.
In the map 25-35 AI Pawns (Characters) do some movement. Not fast, sometimes they stay also. At the moment I use default movement component to replicate movement.

  • I do nothing strange for AI, I do not replicate AI “pitch” or make the head moving to look for player, just default AI pawn movement component replicating.
  • I also try to get only RPCs when needed and also only “reliable” if needed of course.

Also I have 2-3 players, they of course also replicate their movement per movement component and also pitch, so the other player see if they look up and down.

I did also some network investigation (network profiling), and controlled if I use more RPCs or more replication of variables as I think I might. But all looks fine. Of course I see all the traffic of the AI movement and player movement and Player pitch, but nothing strange. Everything as I understand more “default” replication as it should be (without doing extra optimization).

Till here, everything is fine. But getting more AI or my biggest pin point, bringing in some “physical actor replications” it gets bad fast. I have some barrels and gas pipes in my map, they do physic replication but most of the time they are not moving. Stand in corners and waiting to get a hit. And when they get a hit and replicate their physics movement, then it will get really stuttering and laggy.
If I set the network latency a bit higher in test games, it gets more worse very fast.

I know of network culling and stuff, but my map is small and there are spots player can see everything. So I think I have to replicate movement all the time. And the AI should not stand still and change positions with some waiting times between. Because player can see everything, it have to be normal replicated character movement (i think).

Biggest pinpoint are the physical replications at the moment. I replicate simply per “replicate movement”. Its a default settings available in BP. So the BP and attached meshes get replicated on movement by physical interaction.
This “actor replication” feature seems to be not optimized. Much, much less optimized ■■■ the AI replicated movement component, which most of the time looks fine. But this “replicate actor movement” on actors together with my 30 AI actors makes the actor replication stuttering heavily.

It gets even more worse when a Player Character Client jump on a such a physic “replicate actor movement” enabled actor (sphere or capsule which can roll). No problem for server character, then physic is done nicely. But doing that on clients starts stuttering / jittering and sometime player characters also start getting heavy impulse and fly through the map.

I also have replicated projectiles, like rockets. Also “bouncing” Projectiles. That’s the third part of needed replicated things. Also here sometimes it gets a bit laggy / stuttering on clients. Especially after spawning the projectile until it is shown on client side, there is often a very good noticeable lag.
But because projectiles are bouncing, I can’t simply spawn fake projectiles on clients. Because physic bouncing movement have to be the same on all clients to see projectile on (nearly) the same place.

questions:

  • Is some network guru around here who can give some insights how to optimize such a situation?
  • How is it possible to make about 30-45 AI actors moving in the map. Beside this having some “physical actors replicating their moment when getting impulse” + bouncing "projectiles"
  • I heard a good solution about projectiles is to spawn them on clients + server and then lerp position. Do someone have a good tutorial for that or know a good market place asset which is doing that well?
  • Any advises for network configuration or any optimizations to get this done smooth altogether?

Thanks a lot for any help!

I hope its okay to bump after 10 days. If a network guru comes a long and can give some insights how to handle many replicating actors of different kinds, would be great to hear.