Unit counts above 100 for my RTS are laggy

Hey guys,

I recently switched over from Photon Fusion to Coherence to try and accomodate more units for my RTS.

As you see from the video, it looks fine until around 75+ units, but then it starts tof all apart.

Brit recommended I post the issue here to see if anyone has any suggestions:

I only want to support 300-400 units in total, but I realise this might be a tall order without going deterministic.

I’d prefer not to implement GGPO if I can avoid it, but it seems like it might be my only option.


A couple questions to better understand your setup:

  • what bindings are you syncing between all the characters?
  • is there collision between the players?
  • do you have any interpolation customizations?
  • is there any log output on the local RS?

Thanks for the video!

Thanks, Brit!

I will put together a quick minimalistic prototype and post a demo here so we can better assess :slight_smile:

Looks like the connection is temporarily lost at 1:07 or a spike of some sort that disrupts replication for like half a second.

Have you done any network optimization? You can click the Optimize button on CoherenceSync and change sample rate and bit rate per prefab and binding. Make sure any bindings that are updated each frame (position, rotation) are slimmed.

Reducing sample rate is an easy way to increase unit count, but it incurs additional latency for interpolated entities. We will release support for NPC prediction in an upcoming release of coherence sdk, which minimizes both latency and bandwidth use in these scenarios.

Instead of implementing GGPO and determinism, you can increase unit count by applying “good enough” client-side prediction (pathfinding etc for units) and sync entities at very low rate for network correction.

Thanks so much for the feedback!

I rejoined the game from the other client during the test at 1:07, so maybe that’s it.

I will try do the optimisation you suggested and see if that helps :slight_smile:

Guys, your engine is amazing!!!

I made a quick prototype to make sure it wasn’t my project, turns out it was:


@mattgamedevguy after seeing your post I was intersted to see how my RTS game faired with ~100 units, and for the most part things seem to be performing relatively well enough. I haven’t done any of the sync optimizations recommended above yet, but I suspect that could help.

What I did find was that I had to increase the pool size for my “command” classes to 100+, so that when I issue commands to the units to move it does not incur memory allocations to instantiate those classes. Probably other improvements that could be made in this area as well, but I haven’t profiled the Simulator yet to check where memory may be being allocated/performance issues existing.

Would be very interested to hear more where you find opportunity to improve your performance and what approaches you take.


@mattgamedevguy and @Kevin I am happy to see the progress in your videos, looks really good! :slight_smile:


Thanks so much for your help bud!

1 Like

This looks really cool!

I’m probably not doing it the right way, but I keep a networked variable for each player which stores the ids of all selected units so that I don’t have to issue move commands for each individual unit.

Other than that, just followed the advice above :blush:

All the best with your project dude, it looks great!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.