A problem I am currently having with the addon I am writing is coordinating between multiple WoW clients.
Suppose the player is in a raid and wants to notify the rest of the raid that action A needs to be performed precisely T seconds from the time they send the message.
While sometimes sub-second precision may not be particularly important, let us assume it is vital for A (CCing and target switching are where it matters for my addon).
One approach (that taken by DBM) is to simply send the time using SendAddonMessage to the raid channel with a message containing T. Each member of the raid will then receive the number T and perform A in T seconds from the time they receive the message.
The obvious problem with this approach is latency. Depending on the quality of the connections, it would be quite possible for A to be performed 0.4 seconds late, which might be a significant problem.
One way of accounting for latency is to assume that it is constant and use the value provided by API GetNetStats for WorldLatency (I believe it should be world for this purpose, rather than home) of sender and compensate for that when sending message. The receiver then compensates using their WorldLatency to get the time at which they should perform A.
The problem with this approach is that, of course, latency is not constant. If either the sender or the receivers latency varies greatly, the receiver may perform A far too early or far too late. In some cases, performing A too early may be far worse than too late (for example, if A is CCing an enemy out of a cyclone).
Another approach would be for the sender to get the world time and send worldtime + T as the message, where worldtime is stored by a millisecond-precise timer. Unfortunately, GetGameTime() returns time only to minute precision, though polling could probably give the time to second precision. With or without polling, using GetGameTime will not solve the problem as inaccuracy is introduced by the latency of the server response.
The best of these solutions seems to be to compensate using WorldLatency. Perhaps I am missing a better solution or not accurately assessing the options I have considered. How would you solve the problem?
Post describing addon:
http://www.wowinterface.com/forums/s...ad.php?t=52373