Open tatref opened 5 years ago
The bot-simple example can require some command line arguments to get started properly especially in the headless linux version since there is no standard install location.
What versions and map packs do you have installed and what arguments are you passing into the example program?
Here is how I did the setup:
git clone https://github.com/awestlake87/sc2-rs
cd sc2-rs/
# Download SC2 + maps
wget http://blzdistsc2-a.akamaihd.net/Linux/SC2.4.1.2.60604_2018_05_16.zip
wget http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2018Season2_Updated.zip
wget http://blzdistsc2-a.akamaihd.net/MapPacks/Melee.zip
# Extract
unzip -P iagreetotheeula SC2.4.1.2.60604_2018_05_16.zip
unzip -P iagreetotheeula -d StarCraftII/Maps/ Ladder2018Season2_Updated.zip
unzip -P iagreetotheeula -d StarCraftII/Maps/ Melee.zip
Then I launch bot-simple with:
cargo build --examples
./target/debug/examples/bot-simple -d $PWD/StarCraftII -m $PWD/StarCraftII/Maps/Melee/Simple64.SC2Map
After some more digging, it seems that one of the Starcraft processes is not looking for the correct path. One is uppercase, and the other one is lowercase:
strace -f ./target/debug/examples/bot-simple -d $PWD/StarCraftII -m $PWD/StarCraftII/Maps/Melee/Simple64.SC2Map 2>&1 | grep -i sc2map
(...)
[pid 26808] open("/data/sc2-rs/StarCraftII/Maps/Melee/Simple64.SC2Map", O_RDONLY <unfinished ...>
(...)
[pid 26809] stat("/data/sc2-rs/StarCraftII/maps/Melee/Simple64.SC2Map", <unfinished ...>
Here, process ID 26809 looks for ../maps/..
, whereas process ID 26808 looks for ../Maps/..
(correct path). I'm not sure if this is directly related with sc2-rs.
Strange bug indeed!
Windows (and wine) allows that sort of thing to happen since the paths are case-insensitive. It could be that SC2 is the culprit since linux isn't their primary platform.
They do tell people to use a Maps
directory on their page, but my examples have been based on just having a lowercase maps/
in my StarCraftII directory.
I think this problem does originate outside of sc2-rs, but since pysc2 works OK, I think there is probably a way to get around it for the headless linux version. A quick hack to get it working in both cases might be to just symlink Maps
to maps
in your StarCraftII directory.
You are correct: after renaming the dir to maps/
, it works as expected, thanks! I couldn't find any public issue about that for the native Linux exe...
It's still unexpected that one of the processes find the Maps dir, but not the other one.
First off, congratulations for your work!
I tried to run the
bot-simple
example on a Linux, using the native Starcraft bin (without Wine).The example seems to start fine, but exists right away. Nothing is ever printed, and exit code is 0. I might be dump, but it seems to me that the into_future function in Melee does nothing if
break_on_ctrlc
is nottrue
I tried to fix it by adding a
self.run()
call (ctrl-C seems to be handled fine): https://github.com/awestlake87/sc2-rs/blob/75a4727cb30c5f1ccb12bfb65b9bc9fbfb4b0729/src/services/melee_service.rs#L207-L209The program starts fine, until:
Then nothing else happens. I added a bunch of prints in the bot code, but
on_event
andon_step
are never called.Using
pysc2_agent
from https://github.com/deepmind/pysc2 works fine, I get:Am I missing something?