Replies: 2 comments 9 replies
-
I would recommend opening your bot .dll in |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
I've been searching for an appropriate place to ask this question, so hopefully this is a good place and someone can generously help me. I've been trying to develop an AI using pytorch to use in a BWAPI module bot. I've created a simple simulation environment for SC:BW in C++ so that I could train the pytorch models in my simulation rather than having to fiddle with constantly going in and out of the actual game. To use pytorch I've been running python code directly from C++ (#including <Python.h>), this link shows an example of how I've been using this:
https://stackoverflow.com/questions/37399930/how-do-you-run-a-python-script-from-a-c-program
I've finally gotten the AI model to a place where I'm ready to try using it within BWAPI, but I've run into some complications. I can include <Python.h> in the Example AI Module project and get it to run in the game no problem. But the moment I put in any function that actually makes use of Python.h (for instance, Py_Initialize() or PyObject_CallMethodObjArgs()) the AI module fails to load when starting the game ("Failed to load the AI Module ExampleAIModule.dll").
As this wasn't working, I also tried using TorchScript, which is a C++ library for importing wrapped Torch models, but I couldn't get that to compile.
Would any geniuses out there happen to know if this sort of thing should work with BWAPI, and what I might be missing? I'm not too familiar with compiling projects into DLLs so I'm hoping that it's a relatively simple fix but I know how complicated and messy these libraries and environments can be. I can provide more information if needed, as a quick explanation: I'm on windows 10, using VS 2017, I have 'Python310-32\include' folder included in the C/C++ Additional Include Directories options for the ExampleAIModule project and 'Python310-32\libs' added to the Linker Additional Library Directories options for the same project. With this and #include <Python.h> it compiles and runs in game just fine. But if I uncomment "Py_Initialize();" in the Module it will compile just fine and then fail to load once in game.
I'm guessing I'm not the first to try this sort of approach. I love programming and I love Starcraft so I'd be very bummed to abandon this project now, huge thanks for any help in advance.
Beta Was this translation helpful? Give feedback.
All reactions