OpenBW / openbw

OpenBW - free and open-source Best Wargame
152 stars 24 forks source link

Q: Using OpenBW to generate screenshots/info of maps/replays #31

Closed msikma closed 2 years ago

msikma commented 2 years ago

Hi there. I'm writing some Javascript code to get information from replay files, for use in a Discord bot.

I decided to look into OpenBW to see if I could use it to get additional information that screp can't, like maybe I could even get things like the final game stats. I'm also very interested in making full map screenshots automatically.

However, I run macOS so I'm not sure if I'm doing it correctly - I built according to these instructions, with OPENBW_ENABLE_UI just to try out, and it completed successfully, but I don't see a UI when I actually run BWAPILauncher (although it runs without reporting any errors). I have the files set up exactly as in the "Running" section, except that I don't have an AI set up (I just have bwapi-data/bwapi.ini) since I don't need it.

In my ideal situation I'd be able to run OpenBW and get a full size screenshot of a map, or run it on a replay file and get information from it, without opening a graphical interface. Is there anything like an example of how to accomplish something like this? I would appreciate any pointers anyone could give!

dgant commented 2 years ago

For headful operation, I think you also need OPENBW_ENABLE_UI enabled when you run BWAPILauncher:

OPENBW_ENABLE_UI=1
BWAPILauncher [...args]

To analyze replays, create a BWAPI bot and have it "play" the replay. Some examples of doing this:

Unfortunately there is no BWAPI wrapper for JavaScript, so your BWAPI replay analyzer will have to be in C++.

Feel free to stop by https://discord.gg/DqvHsq9 for faster answers to questions like these.