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.
Comments
krasi0 on :
Jay Scott on :
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 :
Jay Scott on :
Antiga / Iruian on :