Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 1.9 KB

README.md

File metadata and controls

54 lines (40 loc) · 1.9 KB

sharpy-sc2 integration

Prerequisites

It is expected the user has already installed sharpy-sc2.
See Chance for a working example of this integration.

Getting started

If you're starting from scratch, consider starting from sharpysc2_example.py.
It should work out of the box.

Initialize the QueensSc2 manager

To integrate into an existing sharpy bot, initialize an instance of QueensSc2Manager in your bot's configure_managers method.

You can pass an initial policy like so:

    def configure_managers(self) -> Optional[List["ManagerBase"]]:
        queen_policy = {
            # policy here
        }
        return [QueensSc2Manager(queen_policy)]

This is all that is required for queens-sc2 to function.

Policy setting

You can use SetQueensSc2Policy in your sharpy build order to set the policy during the game.

    async def create_plan(self) -> BuildOrder:
        # in case you need access to the manager...
        queens_manager = self.knowledge.get_manager(QueensSc2Manager)

        early_game_queen_policy = {
            # define your early game policy here
        }

        mid_game_queen_policy = {
            # define your mid game policy here
        }
        
        return BuildOrder(
            SetQueensSc2Policy(early_game_queen_policy, policy_name="early_game_queen_policy"),
            
            # Early game build here...
            
            SetQueensSc2Policy(mid_game_queen_policy, policy_name="mid_game_queen_policy"),
            
            # Mid game build here...
        )

Alternatively, you can also set the policy via the manager by calling queens_manager.set_new_policy(queen_policy).

Example bot

See sharpysc2_example.py for a working example of using this integration.