DrInfy / sharpy-sc2

Python framework for rapid development of Starcraft 2 AI bots
MIT License
68 stars 28 forks source link

Planetary Fortress: Work distribution #11

Open lladdy opened 4 years ago

lladdy commented 4 years ago

See this game: https://aiarena.net/matches/153533/ For some reason after the planetary fortress is built worker distribution sends workers back to the main base instead of having them mine at the PF.

Is this intended?

merfolk commented 4 years ago

Sending workers away from a base with a Planetary Fortress is definitely not intended. 😄

Worker distribution probably does not consider PF as a proper base. The bug might also be part of Zone class.

I can take a look into this perhaps later today, unless someone else finds the cause before that.

merfolk commented 4 years ago

Zone.our_townhall looks like it should take PFs into account.

Can you debug PlanDistributeWorkers class and its get_worker_to_reassign() method? That's my primary suspect.

lladdy commented 4 years ago

I did some brief tests. I'm not convinced this is actually to do with the Planetary Fortress anymore. I think it might possibly be something to do with the main base being prioritized for worker distribution? It seems to send the PF workers to mine gas commonly in the main base. Unsure why.

merfolk commented 4 years ago

Okay, so it might just be that the PlanDistributeWorkers is not optimized for cases when the bases are far apart.

When I was originally implementing PlanDistributeWorkers, I thought about taking into account the distance a worker needs to travel but it's not considered ATM.

DrInfy commented 4 years ago

My guess here is that the system takes workers out of gas to build new buildings, which results in distribute workers pulling workers from mineral mining without considering distance. The same happens with just mining happening in natural.