-
Notifications
You must be signed in to change notification settings - Fork 29
Extending Your Existing Bot With Sharpy
DrInfy edited this page Jul 5, 2020
·
3 revisions
If you have an existing bot, but want to take advantage of some features in sharpy-sc2, you can convert your bot to sharpy somewhat easily.
Let's consider this following AwesomeBot
class AwesomeBot(BotAI)
def __init__(self):
# my awesome init
async def on_step(self, iteration):
# my awesome code
You should convert your old bot logic into an act to keep the bot file clean of external logic. The end result could look something like this:
class AwesomeAct(ActBase)
def __init__(self):
# my awesome init
super().__init__()
async def execute(self) -> bool:
# my awesome code
return True
class AwesomeBot(KnowledgeBot)
def __init__(self):
super().__init__("Awesome Bot")
async def create_plan(self) -> BuildOrder:
return BuildOrder(AwesomeAct())
For the code inside the new AwesomeAct
find & replace self
with "self.ai" and your bot should be ready to use all the features in sharpy.
- Plans and Build Order
- Settings, debug and logging
- Structure and Life Cycle
- Unit Roles
- Unit Cache
- Running Games
- Converting Sharpy bot from before 2.0 version
- Converting Sharpy KnowledgeBot to SkeletonBot
- Converting Python bot to minimal Sharpy bot
- OLD: Extending Your Existing Bot With Sharpy
- Packaging For Ladders
- Extending Sharpy
- Advanced Build Order tricks
- Machine Learning With Sharpy