Main.SideBar (edit) |
Main /
NetworkSyncingBoson depends on all clients being in sync for network to be working. This mainly means that at every moment all units must be at exactly the same positions on all clients. Actually it means that nearly everything that influences the game flow must have the same values on all clients. Note that when I say "every moment" or in general when I speak about time in this context, I usually refer to the "advance calls" as measure of time. When client A has 10 units at 10:00 and client B has 6 units at 10:00, but 10 at 12:00, then this doesn't matter at all. It is only relevant that client A has 10 units at advance call n, and client B has these 10 units, too at advance call n. Even if the same call is made later than on client A. In a perfect world we would have no bugs and all clients would always be in sync. However even if we manage to write our code without any bugs (well - we do so!) then there still things that we don't have control of that may cause bugs in our code. For example recently we faced a problem with floating point variables: two different computers (both Athlon, one very old without SSE, the other more recent) did the same calculation (with _exactly_ the same values. we checked the bit representations of the variables) but had different results. This can come from the fact that different math processors may e.g. use different internal representations and therefore may slightly differ in precision. In such a case the two clients will be out of sync - although our code is totally bug free (it's a "bug" in the hardware). So in real world a two clients will go out of sync sooner or later (hopefully later). This may start very small (unit is at x=1.00001 instead of x=1.0) but may easily sum up to very large values, due to the way floating point calculations are being made. For us it is important to detect these problems for 3 reasons:
The first one is relevant for developing only. But the 2nd is important for the player, too. Otherwise he ends up and destroying the base of the enemy (i.e. winning) while on the computer of the enemy it's the other way round. (note: I have already faced this problem in boson, but also in a popular commercial game!) The third, finally, is where we can make the user happy. If we are able to make the clients be in sync again, then he will complain about the error messages that are disturbing, and about the pause that was required to fix the problem. But he will be able to continue the game without any grave problems. If don't fix the problem, then everything that's left would be to quit the game. So we have 3 problems that need to be solved:
It turns out that the 2nd problem can be solved while solving the 1st. However fixing the sync error is a separate problem. But we may optionally use the knowledge of where the error occurred to speed this problem up (you don't need to reload the whole game if you know that only the location of a single unit is wrong). So we split this into two parts:
Note that I got somewhat used to using the word "Syncing" for the whole process of finding sync checking, error searching and fixing. The word "Sync" is used by me usually for fixing the error only. |