Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds --ladderversion flag, which runs game on version 4.10 #114

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bot_loader/game_starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ def play(self):
"--requirewin", help="Requires victory for the specified player number (1 or 2) or raise exception."
)


parser.add_argument(
"--ladderversion", help="Uses v4.10 as on the ladder. Ensure you have v4.10 and run the download script.", action=argparse.BooleanOptionalAction, default=False
)

args = parser.parse_args()

player1: str = args.player1
Expand Down Expand Up @@ -190,12 +195,18 @@ def play(self):
else:
LoggingUtility.set_logger(log_level=self.config["general"]["log_level"])

sc2_version = None
if(args.ladderversion):
sc2_version = "4.10"

GameStarter.setup_bot(player1_bot, player1, player2, args)
GameStarter.setup_bot(player2_bot, player2, player1, args)

print(f"Starting game in {map_name}.")
print(f"{player1} vs {player2}")



runner = MatchRunner()
result = runner.run_game(
maps.get(map_name),
Expand All @@ -205,6 +216,7 @@ def play(self):
game_time_limit=(30 * 60),
save_replay_as=f"{folder}/{file_name}.SC2Replay",
start_port=args.port,
sc2_version=sc2_version
)

if args.requirewin:
Expand Down
4 changes: 2 additions & 2 deletions bot_loader/killable_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time

from typing import Any
from sc2.sc2process import kill_switch
from sc2.sc2process import KillSwitch

"""
Process that is automatically killed by sc2.
Expand All @@ -15,7 +15,7 @@ def __init__(self, process: Any, tmp_dir: str = None) -> None:
self._tmp_dir = tmp_dir
self._process: Any = process
super().__init__()
kill_switch.add(self)
KillSwitch.add(self)

def _clean(self) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion sharpy/managers/core/unit_value.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from typing import Union, Optional, List, Callable
from typing import Union, Optional, Dict, List, Callable

from sc2.data import Race, race_townhalls
from sharpy.general.unit_feature import UnitFeature
Expand Down