BurnySc2 / python-sc2

A StarCraft II bot api client library for Python 3
MIT License
509 stars 157 forks source link

Error when run examples on linux #193

Closed Felixvillas closed 8 months ago

Felixvillas commented 8 months ago

I got an error as follows when I run python examples/terran/mass_reaper.py at centos 7.8.2003.

File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/examples/terran/mass_reaper.py", line 398, in <module>
    main()
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/examples/terran/mass_reaper.py", line 390, in main
    run_game(
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/main.py", line 496, in run_game
    result: Result = asyncio.run(_host_game(map_settings, players, **kwargs))
  File "/lustre/S/tianzikang/anaconda3/envs/llm/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/lustre/S/tianzikang/anaconda3/envs/llm/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/main.py", line 369, in _host_game
    result = await _play_game(players[0], client, realtime, portconfig, game_time_limit, rgb_render_config)
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/main.py", line 226, in _play_game
    result = await _play_game_ai(client, player_id, player.ai, realtime, game_time_limit)
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/main.py", line 145, in _play_game_ai
    result = await initialize_first_step()
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/main.py", line 118, in initialize_first_step
    game_info = await client.get_game_info()
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/client.py", line 186, in get_game_info
    return GameInfo(result.game_info)
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/game_info.py", line 221, in __init__
    self.pathing_grid: PixelMap = PixelMap(self._proto.start_raw.pathing_grid, in_bits=True)
  File "/workspace/S/tianzikang/my_project/sc2Exper/python-sc2/sc2/pixel_map.py", line 21, in __init__
    assert self.width * self.height == (8 if in_bits else 1) * len(
AssertionError: 32384 259072

I haven't encountered a similar bug on Windows before. And how can I fix this bug in centos?

Thanks~

Felixvillas commented 8 months ago

Sorry to bother. @BurnySc2 Have you reproduced this bug? It seems that the correct value for in_bits should be 1, but in reality, it is 8 that caused this error.

BurnySc2 commented 8 months ago

Sorry to bother. @BurnySc2 Have you reproduced this bug? It seems that the correct value for in_bits should be 1, but in reality, it is 8 that caused this error.

The only situation I can imagine where this could be happening, is if you are using a very old StarCraft2 Version (older than 4.10 I believe). It used to be the case that the pathing grid had 8 bits per True/False value.

Felixvillas commented 8 months ago

Sorry to bother. @BurnySc2 Have you reproduced this bug? It seems that the correct value for in_bits should be 1, but in reality, it is 8 that caused this error.

The only situation I can imagine where this could be happening, is if you are using a very old StarCraft2 Version (older than 4.10 I believe). It used to be the case that the pathing grid had 8 bits per True/False value.

Thanks. My game version is 4.6.2.69232. I'll try the newer game version.

Felixvillas commented 8 months ago

I changed my linux StarCraft2 Version from 4.2.6 to 4.10, then it fixed this bug and works. Thanks~ I'll close this issue.