Skip to content

Conversation

@SamOgon-one
Copy link
Contributor

@SamOgon-one SamOgon-one commented Oct 27, 2022

client.py is appropiate place for unit unload function, most imports are already here and also many self._execute funcions are here

Note:
In unload example https://github.com/BurnySc2/python-sc2/blob/2e5d29671cf6ebcf78b1764c8153916b01c096ca/examples/protoss/single_unit_unload_test.py there is unit index option, which I think is unnecessary. Use scenario: we want to unload specific unit (ex. immortal out of stalkers), we iterate over transporter passengers to identify unit type or tag, so we have unit selected already which we pass to unload function, never store its index.

client.py is appropiate place for unit unload function, most imports are already here and also many self._execute funcion are here

Note:
In unload example https://github.com/BurnySc2/python-sc2/blob/2e5d29671cf6ebcf78b1764c8153916b01c096ca/examples/protoss/single_unit_unload_test.py there is unit index option, which I think is unnecessary. Use scenario: we want to unload specific unit (ex. immortal out of stalkers), we iterate over transporter passengers to identify unit type or tag, so we have unit selected already which we pass to unload function, never store its index.
Comment on lines +131 to +132
self.client.unload_unit(transporter_unit, cargo_unit)
self.client.unload_unit(transporter_unit) # unloads first one
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you prefer this function to be in the client.py instead of bot_ai.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bot_ai.py would be my second choice
In my first comment I list why client.py is my choice, what are arguments in favor of bot_ai.py?

Comment on lines +146 to +161
await self._execute(
action=sc_pb.RequestAction(
actions=[
sc_pb.Action(
action_raw=raw_pb.ActionRaw(
unit_command=raw_pb.ActionRawUnitCommand(ability_id=0, unit_tags=[transporter_unit.tag])
)
),
sc_pb.Action(
action_ui=ui_pb.ActionUI(
cargo_panel=ui_pb.ActionCargoPanelUnload(unit_index=unload_unit_index)
)
),
]
)
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This executes the command instantly. Is there a better way to bundle it with other unit commands?
Currently actions such as unit.move(position) and structure.train(unittype) are collected and sent once to the API at the end of the step. Is it also possible with this?

Copy link
Contributor Author

@SamOgon-one SamOgon-one Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be rare situation where someone use more than one unload command in same frame over a game.
The most usage I have seen is a bot that has 4 prisms and with human eye his unloads aren't synchronized.

@BurnySc2
Copy link
Owner

BurnySc2 commented Jan 9, 2023

there is unit index option, which I think is unnecessary
I have updated #108 with a TODO so that the index is no longer required and consider again merging it into develop.
This PR is targeting develop branch instead of the branch from the #108 PR, so I'm going to close this PR for now.

@BurnySc2 BurnySc2 closed this Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants