Add example script to re-use a SC2 instance
When developing bots, it can be annoying to wait for SC2 to launch before the bot connects to it.
Following idea could speed up development:
- Script to launch a SC2 instance (
readystate) - Script to launch the bot and let the bot connect to the SC2 instance, and play the game
- Script to terminate the bot and disconnects it from the SC2 instance, then puts SC2 back into the
readystate
This way you have to launch script 1) once, then can use scripts 2) and 3) over and over without having to wait for SC2 to launch.
The fastreload.py script seems to achieve this somewhat: https://github.com/BurnySc2/python-sc2/blob/develop/examples/fastreload.py
Also: https://github.com/BurnySc2/python-sc2/blob/40765d879f27b409b7d5db19b462020b6571f740/sc2/main.py#L717
That is very nice. Have any ideas how i can implement there some random? Like: race_choice = random.choice([Race.Terran, Race.Protoss, Race.Zerg, Race.Random]) map_name = random.choice(["Ephemeron", "DeathAuraLE", "EternalEmpireLE", "EverDreamLE", "GoldenWallLE", "IceandChromeLE", "NightshadeLE"])
it is working for: sc2.run_game(sc2.maps.get(map_name), [ #Human(Race.Terran), bot, Computer(race_choice, Difficulty.Hard) # CheatInsane VeryHard Hard Medium Easy ], realtime=False, save_replay_as="Example.SC2Replay")
but no luck here