Yes, to take advantage of our pooling system (and so also for coherence to spawn them for you with the correct position and rotation) they’d need to be network entities, so Prefabs with a CoherenceSync attached.
The question is then, how many (roughly of course) network entities can Coherence deal with? I recall Mirror was in the double digits and PUN 2 would start coughing once you get over a certain limit that wasn’t very high as well, if I am not mistaken.
I’d like to avoid having to write another networked object pooler.
(btw did you know that Unity has a system to make pools now?)
Yes, and it is… messy for a lack of a better word, for a simple job like a pooling system. But just out of curiosity does coherence support it out of the box? Or through the interface implementation mentioned earlier?
You can guess the answer: it depends! But generally speaking, we have done tests with thousands of entities and the Replication Server holds fine.
(case in point, Vampire Survivors )
Whether that works in the game while all the rest is running though, is different.
I believe our pool implementation is all custom. You can check it out in Packages/io.coherence.sdk/Coherence.Toolkit/CoherenceSyncConfigs/ObjectInstantiators.
Coherence can handle thousands of entities at the replication server level (right now RS hosted in our cloud are capped at 1000 entities to avoid abuse cases, but is configurable up to 32000).
The question is not how many entities can be handled, but the size of each entity and how the game is creating and destroying these entities.
To help developers, in the CoherenceSync component inspector you can see how much an entity created by this prefab will weight in bits. This is important when creating an entity, since when you create an entity, the entirety of its components will be serialized.
Once an entity has been created, the entity will only produce network updated once one of its components has changed, and only the values that has changed will be sent.
Coherence also has optimization options to reduce bandwidth usage of any particular entity, as well as a profiler module where you can profile network bandwidth usage.
At the end of the day, the amount of network traffic generated by a particular game largely depends on the game implementation and how they’ve decided to network their game.
Rest assured that coherence has all the toolset necessary for the developers to create even very network demanding games. Like Ciro mentioned, Vampire Survivors is a game where potentially you can create and destroy hundreds of entities per second, but with clever optimization it works fine even in the most demanding late game scenarios.
@miguel-coherence thank you for the clarification. I’ve seen the optimization part and the bits section. Love it honestly. One of the best features in a network component
On a side note, does it take into account parameters sent with messages through the behavior.
For anyone stumbling onto this page in the future: we now have documentation covering Object Pooling.
That was super fast! That must be a record how fast a documentation launches.
No, as of now there’s no UI for optimising network commands. You’d have to compress the data yourself, potentially leveraging ByteArrays (one of our syncable/sendable types).
Thanks! We try to edit fast when it’s fundamental gaps like these.
What you’re saying this is a calculation done when the object has CoherenceSync attached to it and doesn’t change. At least that is what I understood, please correct me if I am wrong.
My experience is different though. When I created the object (specifically when CoherenceSync was attached to it, as it was prefabed long before Coherence was in the project) it started at 92 bits. Then after that it was 128 or so when I added a few more components and reconfigured it. Now after some small refactoring it reached 224.
Hey Vallar, since the discussion was taking a different, very clear turn, I took the chance to break the topic into another discussion thread so I could test how it looks. I hope you don’t mind!
If after counting the fields it still doesn’t match, then it might be a bug on our end. In that case, let us know.
The Optimise window should give you an overview of all the synced fields and their precision.
To add to what Miguel said, that bandwidth is the max bandwidth used when ALL of the synced fields change value in one frame – something that happens on entity creation, for instance.
Generally speaking, not all fields should change all the time and we are smart enough not to send them if they don’t, so usually bandwidth consumption goes down during gameplay.