Dentosal / python-sc2

A StarCraft II bot api client library for Python 3
MIT License
587 stars 182 forks source link

Prevent action if unit already has that action #249

Closed tweakimp closed 5 years ago

tweakimp commented 5 years ago

Many python bots suffer from sending the same action many times, for example if an army is sent over the map and gets the same attack command every frame.

We should filter out unnecessary commands in do_actions or combine_actions

mindme333 commented 5 years ago

This is something I personally do within my own bot.

On Wed, Feb 27, 2019 at 1:26 PM FW notifications@github.com wrote:

Many python bots suffer from sending the same action many times, for example if an army is sent over the map and get the same attack command every frame.

We should filter out unnecessary commands in do_actions or combine_actions

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Dentosal/python-sc2/issues/249, or mute the thread https://github.com/notifications/unsubscribe-auth/ATQirZD9rzh1fC4nREwy_ZmTG_IpLlXEks5vRunZgaJpZM4bVYiU .

Lambdanaut commented 5 years ago

So if the order_target corresponds to the new action, just don't do the new action?

tweakimp commented 5 years ago

the action has to be the same,too in your example, if you attack a point and then move to that point, you wouldnt do the move

Lambdanaut commented 5 years ago

okay, makes sense. I think if we do this we should add an optional flag to force_action in case there is some edge case.

tweakimp commented 5 years ago

Do you think the single actions should have this option or the do_actions function? That means: do you want to force every action for that do_actions call or only specific actions?

Lambdanaut commented 5 years ago

I think it makes sense to change both of them, if it's not too much work.

tweakimp commented 5 years ago

Fixed in https://github.com/Dentosal/python-sc2/pull/252