Giter Site home page Giter Site logo

pybrood's People

Contributors

neumond avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

xtile tyrion3000

pybrood's Issues

Install issues

Problem after pip install:

Traceback (most recent call last):
  File "example.py", line 2, in <module>
    from pybrood import BaseAI, run, game, Color
  File "F:\Projects\Starcraft AI\workspace\pybrood test\bot\pybro\lib\site-packages\pybrood\__init__
.py", line 1, in <module>
    from .inner import *
ImportError: DLL load failed: The specified procedure could not be found.

Looks like the error when the compiler is the wrong version. So I'll try to compile from source.

It looks like bwapi/include/BWAPI/SetContainer.h:54 is one line too far - it should be line 53.
I have bwapi tag=v4.1.2 checked out.

Should say "Setup paths in generator/config.py"

To build, requires pip install jinja2 pyaml

pybind path in config doesn't do anything, as the comment indicates
need to put pybind in right place, ..\pybind11-2.0.0\include\pybind11

had to change line 58 of inner.vcxproj to:

<AdditionalIncludeDirectories>C:\Python35\include;..\..\pybind11-2.0.0\include;..\..\bwapi\bwapi\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

Now the example works, I'm wondering what the difference is in the precompiled version?

I'm using Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32

Unresolved reference 'game' Warning in PyCharm

The example code works fine, but PyCharm gives the warning Unresolved reference 'game'

warning

Furthermore if I want to "compile" the code using cython, I get

Error compiling Cython file:
------------------------------------------------------------
...
        units = game.getAllUnits()
        for u in units:
            print('Unit', u.getID(), u.getType().getName(), u.getPosition(),
                  u.getTilePosition())

        game.print('Hello world!')
            ^
------------------------------------------------------------

example.py:17:13: Expected an identifier

Removing the line lets cython compile the file correctly.

Not sure if this is intended (might be an implementation thing), but I just put this information here as an issue as it might be useful.

For now I just don't use cython and ignore PyCharm. Thank you for pybrood!

64-bit builds on pip

So far only 32-bit builds are available on pip. It would be good if there are 64-bit builds as well.

getLastCommand wrapped?

Is unit::getLastCommand() wrapping in pybrood? It seems that I cant find this in pybrood document. Thanks.

Fix for "Type not registered yet" error when importing from Python

It appears there are declaration order problems in the generated code. It could be related to the version of pybind11 I used (2.2.0) or compiler version (msvc2015). But these errors can be fixed with a few simple changes.

There were 3 lines which gave an error while importing the python module: ImportError: arg(): could not convert default argument into a Python object (type not registered yet?). Compile in debug mode for more information.

.def("isVisible", &BulletInterface::isVisible, py::arg("player") = (Player) nullptr)

It is referring to Player in the default paramter but it has not been registered yet. This one I fixed by naming the PlayerInterface wrapper definition and moving up above the BulletInterface:

py::class_<BWAPI::PlayerInterface, std::unique_ptr<BWAPI::PlayerInterface, py::nodelete>> player(m, "Player");
py::class_<BWAPI::BulletInterface, std::unique_ptr<BWAPI::BulletInterface, py::nodelete>>(m, "Bullet")
...
.def("isVisible", &BulletInterface::isVisible, py::arg("player") = (Player) nullptr)
...
player
    .def("getID", &PlayerInterface::getID)

The next 2 problems are in the UnitInterface wrapper. The default parameters cast nullptr to Unit, but Unit has not been registered yet.

.def("useTech", (bool (UnitInterface::*)(TechType, Unit)) &UnitInterface::useTech, py::arg("tech"), py::arg("target") = (Unit) nullptr)

.def("canUseTech", (bool (UnitInterface::*)(TechType, Unit, bool, bool, bool, bool) const) &UnitInterface::canUseTech, py::arg("tech"), py::arg("target") = (Unit) nullptr, py::arg("checkCanTargetUnit") = true, py::arg("checkTargetsType") = true, py::arg("checkCanIssueCommandType") = true, py::arg("checkCommandibility") = true)

These I fixed by naming the class again, changing the first 2 lines to:

py::class_<BWAPI::UnitInterface, std::unique_ptr<BWAPI::UnitInterface, py::nodelete>> unit(m, "Unit");
unit
    .def("getID", &UnitInterface::getID)

After making these changes, I was able to import the python module without errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.