archive by month
Skip to content

even easy skills are difficult

Yesterday I thought, “You know, it would be easy to add a MacroLocation “center” so the bot could build proxies in the middle of the map. Why don’t I just do that?” It only took 10 minutes to hook all the pieces together, and a few more minutes to code up a quick version of center BBS to try it out with.

On the first try, I realized “Oh, 2 x barracks @ center doesn’t work because I never fixed that parsing bug.” You couldn’t have both a multiplier “2 x” and a macrolocation “@ center” at the same time, you had to say “barracks @ center” twice to get the same effect. So I went and fixed the bug, and now it works. That’s a good step.

On the second try, I noticed that the constructing SCVs were sent out from the base much too late. There is code that sends out builders early to try to start buildings as soon as possible, but it is not able to cope with buildings that are so far away. The result is that the barracks are constructed much later than they should be, which defeats the purpose of making them in the center of the map in the first place. The limitation does not seem easy to lift. The code to send builders early ties in with both the building manager and the worker manager, and it’s fragile; in the past, most things that touched it caused bugs. I need to figure out a more robust mechanism, throw out the old code and write it better. Or I could add a command to explicitly send builders early for proxy openings. Or something.

After a few more tries, I found an even worse problem. Where the center of the map is inaccessible, as on the map La Mancha, one or both of the barracks can be dropped. An SCV is assigned but it goes idle and never starts to build. Building placement is supposed to find the nearest clear area to build in, but in this case it apparently fails altogether, another bug.

Now you know why bots progress so slowly. Even an easy skill, only 10 minutes to code, can take days to debug. I’m not sure whether I’ll end up fixing the 2 problems any time soon. They definitely deserve to be fixed, but there are more serious bugs that deserve it more. In the meantime, “@ center” is available (well, it will be after the next release) but it is not useful.

In sort of related news, I ripped out the crufty old DistanceMap code inherited from UAlbertaBot and replaced it with shiny new DistanceMap code from UAlbertaBot—in a later version. When Dave Churchill removed BWTA he redid that part. The new version is much, much cleaner and was well worth borrowing. That portion of Steamhammer’s code will be easier to work with thanks to the improvement, and I loved being able to delete ugly stuff from MapTools. Though it was only a small refactoring, it took me a whole day to fix the bugs I introduced in making it. A valuable code improvement that is not even visible in the bot’s play can still take a lot of time.

Trackbacks

No Trackbacks

Comments

jtolmar on :

My bot builds a "resource schedule" by asking each worker how long until it expects to return resources. When the strategy tries to build a building, the bot figures out how far away it is, divides by the worker's speed, and tries to reserve enough resources for the building that many frames in the future. If it can afford it, it sends the worker. This isn't perfect (the worker is often a half second off in either direction) but is pretty robust. The future-reserving mechanism also helps cut corners in build orders; if the next probe I want isn't for another 50 frames, I might be able to afford it entirely using future resources, leaving enough current resources available to start a lower-priority zealot.

Dan on :

Having spent a fair amount of time implementing proxies with all three races: It's trickier than it looks!

Antiga / Iruian on :

Be careful when implementing proxies with P or T. I've tried doing in natural BBS / 9/9 or 9/10 gate and the placement failure rate is around 20-30% which makes in unusable in practice currently.

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.