I am making an attempt to synchronize 3-4 thousand recreation objects’ positions and rotations. I want efficiency for my Unity recreation to stay comparatively excessive (30+fps) and to maintain the quantity of knowledge despatched as little as potential. Due to this fact I want an answer for sending massive quantities of knowledge from the server to the purchasers with as little information and overhead as potential. I do not wish to be paying large server prices and making the server lag as a result of an excessive amount of visitors being despatched.
To elucidate what I am making an attempt to do: I am making an attempt to synchronize the destruction of a constructing throughout purchasers. Additionally, essential be aware, I solely have to ship information to the purchasers, I needn’t ship any information again to the server (I assumed this might be easy for the server as all it needed to do was mass blast all purchasers with the present recreation object rework information).
I am conscious that there are methods to maintain visitors low or scale back the necessity to sync as usually resembling “consumer prediction and server facet reconciliation”, which I plan to look into at a later level (though this might add overhead that maybe I do not want).
I am conscious that there have been options in sure video games (I consider) that contain utilizing a number of servers to sync constructing destruction, however I might respect a single server answer if potential.
I am additionally conscious that there are most likely options for avoiding syncing pointless recreation objects {that a} consumer could not see resembling NetworkProximityChecker
, however assuming that every one recreation objects which might be being synced are seen and energetic, I want an answer for dealing with that (within the worst case situation that purchasers can see all the sport objects being synced sooner or later).
Issues I’ve thought of doing are avoiding utilizing NetworkTransform
s and even NetworkBehaviour
s altogether and sending easy NetworkBase
/NetworkMessage
(I consider it is known as) messages to the purchasers (to scale back information despatched). Or, go much more fundamental and use non-Unity libraries to ship information to purchasers (once more to keep away from overhead and an excessive amount of information being despatched that may create an excessive amount of massive visitors).
There is probably not an answer to this that works nicely – there isn’t any getting across the easy undeniable fact that Vector3
s and Quaternion
s have to be always despatched to every consumer, and there is not a method to keep away from that large quantities of knowledge being despatched.
I am utilizing Unity Mirror, though I may and doubtless will change to Unity’s netcode.
To this point, I’ve tried utilizing Unity Mirror’s NetworkIdentity
and NetworkTransforms
to sync all the mandatory object’s transforms. With two gamers the efficiency wasn’t too unhealthy, however not nice. With 4 gamers efficiency was fairly horrible, with fps across the mid teenagers.
I used to be anticipating this contemplating how a lot information was being despatched.
replace. recreation particulars:
to provide extra particulars in regards to the recreation; gamers will probably be strolling round a map of destructible buildings that may trigger obstacles for them. due to this fact i would like all of the damaged constructing components to be synced. i may solely sync components that’re near gamers, however within the uncommon occasion that there’s a lot of destruction all occurring in shut proximity to all gamers, this plan falls aside. I wish to guarantee the sport can deal with this unusual incidence.
i do know that relative to different video games sending a ton of knowledge will not be low-cost, however reducing the quantity of knowledge despatched by half may imply lowering price for operating the sport, rising efficiency (fps) by rather a lot, and lowering community visitors by rather a lot. Even small efficiencies i believe may come shut to creating or breaking the sport. For instance, a 15 – 20 fps recreation is not actually playable for my part however a 28 – 30 fps is. If I may improve efficiency throughout these worst case conditions of large destruction even that comparatively small quantity, that’d be sufficient.