Closed VovaTch closed 1 year ago
The issue with overshooting the worker count to 24 instead of the wanted 22 is due to 2 workers being in the Assimilator, which means they will not be included in self.workers
. This can be fixed by using
https://github.com/BurnySc2/python-sc2/blob/40dc00a01544d1405ad15b25ae6250a2e9382ec9/sc2/bot_ai_internal.py#L91
As for the count of the stalkers, I would count them with
stalker_count = self.units(UnitTypeId.STALKER).amount + self.already_pending(UnitTypeId.STALKER)
and for gateways
gateway_count = self.structures.of_type({UnitTypeId.GATEWAY, UnitTypeId.WARPGATE}).ready.amount + self.already_pending(UnitTypeId.GATEWAY)
However your gateway building example looks fine to me, or at least I cannot see an issue with it.
If that doesn't work, let me know. Also feel free to join the discord server, where you can ask questions more casually and it is more likely to have an response faster.
For build order bots you could also take a look at https://github.com/DrInfy/sharpy-sc2 which uses this library. This way you don't need to reinvent the wheel.
If that's the case for the workers, I can safely just deduct 1 worker per assimilator for the correct maximum amount of workers, it shouldn't affect much the middle-game and end-game I believe. In my bot I already counting the gateways and stalkers with ready.amount + already_pending, I guess the 'ready' makes problems? I'll try without it and I let you know.
About Sharpy, thanks! I'll take a look, I'm just a little concerned about how do I integrate Pytorch neural networks with it, but I guess I'll see.
Hi, I started with this package not long ago and I'm working on a Protoss bot trying to make it follow build orders written as a .yaml file. I came across an issue that I can't seem to control the amount of units and buildings the bot builds, i.e. it overshoots very often. For example, I'm trying to set a limit of 22 workers per mining base via:
The nexus always trains 24 instead of the desired 22 if going on one base. Another similar example is where I'm aiming for a 4gate build and the bot often goes to 5 gates.
Similarly it can overshoot the number of stalkers, I want to limit the amount to 5 and I get 7 for example. Am I missing something here? Is this a consequence of some parallel computation scheme here? This is problematic if I want a pinpoint accurate build-order following. I'm using Win11.