archive by month
Skip to content

Steamhammer’s building placement

Well. So. I sort of got carried away and refactored the building placer. I guess it is a side effect of my instinct to improve any code that I touch. I fixed 3 different bugs. I squeezed out some redundant calculations, so the basic operation “can this building go here?” is faster. And I added a little mechanism to make it easy to throw in different special case building placement algorithms. I see the work as preparation for the more general placement planner that I’ll eventually write.

I think the 3 bugs were all inherited from UAlbertaBot. One was an off-by-one error that could give bad results for the right edge and bottom edge of the map. Another was a different off-by-one error that, half the time, caused the minimum space between buildings to be 1 tile more than configured. Fixing that makes building placement more compact and helps all races. The third bug was so rare that I have never seen it, but theoretically a macro hatchery might be bumped out of one base because it did not fit, and be placed in a neighboring base in a way that blocked the expansion hatchery location. Now I’ll never see it.

I wrote special case building placement for terran. Supply depots, academies, and armories are all 3x2 tiles and can be tightly packed. These buildings are placed in a single row along the edges of the map, as long as there is room. On most competition maps, the main bases are on the edge, so the special case kicks in. In between the slightly more compact building placement because of the bug fix, and the much more compact placement of early supply depots, Steamhammer’s terran gets farther into the game before it starts to sprawl buildings all over the map like Los Angeles. There’s no shortage of room for improvement (puns always intended), but I’m calling it good enough for now.

Now I want to figure out something equally effective... and equally simple for protoss.

Trackbacks

No Trackbacks

Comments

krasi0 on :

Yeah, I noticed the compact placement of supply depots, academies, and armories done by SAIDA and implemented something similar in my bot. It was a decent improvement in the home base compactness :)

Jay Scott on :

My reasoning was: Supply depots pack tightly. Do any other buildings fit in?

I thought of one possible extension. 2 starports, or starport and science facility, both with addons, placed vertically, are 6x6 tiles, a multiple of 3x2. They fit into the space of 6 supply depots—though they leave small gaps because the addons are not as tall as the main buildings.

Antiga / Iruian on :

One of the improvements in the little modification I had of SH I was working on is there is a section in the SH codebase for protoss on what buildings are allowed to touch each other. I changed it so all the tech buildings were allowed to touch and be stacked in a ball. It wasn't perfect but it was a start of a compromise that didn't have it sprawling as much into map center. With protoss the tech buildings are all perfectly the same size which helps, similar to depots.

Jay Scott on :

Ideally, of course, all protoss buildings should be allowed to touch each other. Only probes, gateway units, and reavers need space to move, and probes don’t need much space, so most building types don’t need free space around them at all. It’s a matter of figuring out how to group buildings so that there’s always a path to places you need to reach—and the path is wide enough to move a big army through if necessary. Placing gateways correctly seems like the main issue. I can see why templated blocks of buildings are alluring.

Antiga / Iruian on :

Mcrave's BWEB is starting to become pretty common especially among the higher end protoss bots, due to the easy placement / predone setups it provides.

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.