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

when run_game(Bot,Bot) face problem #178

Open
histmeisah opened this issue Sep 14, 2023 · 2 comments
Open

when run_game(Bot,Bot) face problem #178

histmeisah opened this issue Sep 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@histmeisah
Copy link

When i test the game with Bot AI vs Bot AI.I find the two Bots played in two different game in the same map,and even could send messages to each other.

My systerm is win11
python version python3.10
s2clientprotocol 5.0.11.90870.0
burnysc2 6.4.0

Then ,when i check the replay,it shows replay didnt synchronous

@BurnySc2
Copy link
Owner

Can you include a minimally failing example, or a bigger code snippet on how you are calling the functions?
Also have you tried the GameMatch runner?

class GameMatch:

An example can be found here:
def main():
result = run_multiple_games(
[
GameMatch(
map_sc2=maps.get("AcropolisLE"),
players=[
Bot(Race.Protoss, WarpGateBot()),
Bot(Race.Zerg, ZergRushBot()),
],
realtime=False,
game_time_limit=2,
)
]
)
logger.info(f"Result: {result}")

@histmeisah
Copy link
Author

histmeisah commented Sep 20, 2023

ok,sir.
And 2 bots play different games in the same map(maybe start 2 games),but can type words to each other
my failure example is here:

def protoss_agent_vs_rule(transaction, lock, map_name, isReadyForNextStep, game_end_event, done_event, opposite_race,
opposite_bot, replay_folder, process_id, args):
map = map_name

if not os.path.exists(replay_folder):
    try:
        os.makedirs(replay_folder)
    except OSError:
        print(f"create dictionary {replay_folder} failure,please check and run program again.")
        return

result = run_game(maps.get(map),
                  [Bot(Race.Protoss, Protoss_Bot(transaction, lock, isReadyForNextStep)),
                   Bot(map_race(opposite_race), map_rule_bot(opposite_bot))],
                  realtime=True,
                  save_replay_as=f'{replay_folder}/{args.current_time}_{map}_Player_race_PROTOSS_VS_RULE_AI_{opposite_bot}_{opposite_race}_process_{process_id}.SC2Replay')

with lock:

    transaction['done'] = True
    transaction['result'] = result
done_event.set()  # Set done_event when the game is over
game_end_event.set()  # Set game_end_event when the game is over

this code runs well in bot vs build in ai,but bugs occurs in bot vs bot.

@BurnySc2 BurnySc2 added the bug Something isn't working label Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants