Blizzard / s2client-api

StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
MIT License
1.66k stars 281 forks source link

How shall I launch the built bot #121

Closed breadbread1984 closed 7 years ago

breadbread1984 commented 7 years ago

I successfully built the sample program. I launched it with the command ./bot -e ~/opt/StarCraftII/Versions/Base55958/SC2_x64 where ~/opt/StarCraftII/Versions/Base55958/SC2_x64 is the path to the executable of Linux Package 3.16.1. Then, I got the following errors

Launched SC2 (/home/.../opt/StarCraftII/Versions/Base55958/SC2_x64), PID: 29886 Connected to 127.0.0.1:8167 CreateGame request returned an error code: Invalid Map Path CreateGame request returned error details: map_path file doesn't exist. test: /home/.../下载/s2client-api/src/sc2api/sc2_coordinator.cc:507: bool sc2::CoordinatorImp::StartGame(): Assertion `is_game_created' failed.

It seems the bot program can't find the map package which I already unpacked into Maps directory. How can I launch the bot properly? Thx.

Proch92 commented 7 years ago

Yeah it's a bit messed up at the moment. Right now there are constants like this being used in the examples: const char* kMapBelShirVestigeLE = "Ladder/(2)Bel'ShirVestigeLE (Void).SC2Map";

The problem is it's a relative path and in most cases your path will not be the root of sc2 directory.

You can replace the constant in coordinator.startGame(...) with your full path.

Also, as a side note, specifying the map path in the command line gets ignored, which seems wrong in my opinion.

KevinCalderone commented 7 years ago

What string did you pass into StartGame? Can you also post the path to the map you are trying to run?

When you specify a relative path, it checks:

It also looks like the library assumes the "maps" folder is lower case. That will fail on linux if it is wrong. (We should probably change it to ignore case...)

Proch92 is also correct that it should just work if you use an absolute path instead.

Yes it does seem like setting the map on the command line is broken. Do you want to enter a separate issue for that?

breadbread1984 commented 7 years ago

Thanks for the help. I managed to launch the built bot successfully, giving full path to coordinator.

ayu-mail commented 6 years ago

楼主,我看你也是中国的吧,我个人也在做一款星际2的AI,偶尔也会遇到一些问题,加个好友相互学习研究下,也可以相互检测AI的实战水平,我的QQ:86000090 微信:ayu-wx