archive by month
Skip to content

Skynet’s LatencyTracker

Back when I was analyzing Skynet’s code, a class LatencyTracker came up. It sounds like it might have to do with latency in network games, doesn’t it? Latency is a confusing issue for bots, and Krasi0 asked me to look into it. It’s been on my to-do list ever since.

It turns out that LatencyTracker has nothing to do with network latency. It keeps track of the location and duration of storm and stasis. Oh well. :-(

It’s used in only a couple places in code like this. mUnit is of type BWAPI::Unit*. isStormInRange does what its name says: Is a storm calculated to be in range of the current unit? I’m not at all sure what the practical effect of this test is, since it looks redundant. Maybe it is working around a bug in some version of BWAPI, or maybe it is used with hypothetical units that BWAPI doesn’t know about. Or something.

bool UnitClass::isUnderStorm()
{
	if(exists())
		if(mUnit->isUnderStorm())
			return true;

	return LatencyTracker::Instance().isStormInRange(shared_from_this());
}

Trackbacks

No Trackbacks

Comments

krasi0 on :

Perhaps the code above serves the purpose of warning allied units of a pending psionic storm cast, so that they could evacuate on time?

With regards to the aforementioned command latency, oddly enough, it also plays a role in Single Player games, too with the value of 2. On SSCAIT, it has the value of 3 (not sure how they've managed to achieve that) and on a typical LAN game, it has the level of 6.
I recall BWAPI having a setting for latency compensation BWAPI::Broodwar->setLatCom();
which I have turned off, since it tends to mess up my build orders.
I don't even know if it has any practical use (for anyone out there developing a bot)?

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.