I answer this a bit late, but from the point of view of the gameβs security, the simulation should only be performed on the server / host (i.e., do not trust clients, they can be a hoax):
Clients should only send their movements / commands to the server (which discards bad inputs or pinches them within the game, so the client saying "I work at a speed of 10,000 m / s" is pinched by the server to say 10 m / s).
The server / host only informs clients about things happening in their field of view (i.e. the player at coordinates 0,0 does not receive information about two AIs fighting each other at 200.0 if he can only see a radius of 50 units around him).
This is the second part that saves bandwidth - a server / host simulation can have thousands of objects to manage, but customers only need to know about 100 or 200 things in their own field of vision.
The only wrinkle in the situation is such things as dynamic fire (bullets, missiles, etc.), whose range may be greater than the radius of the client's presentation. The server / host informs the clients about the origin and initial trajectory / target, then the clients simulate their path according to the same rules, but the killings are only valid in the simulation on the server / host.
Serializing the client world and compressing it before passing it can also be a huge victory, especially if your class properties are only Public, where necessary. (I usually avoid XML, but we greatly improved compression ratios in one application by serializing to XML and compressing it compared to binary serialization and compressing it. I suspect that the limited range of ASCII characters used was YMMV.)
AlwaysLearning
source share