diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 0000000000000000000000000000000000000000..eca68a0e79ecee259c30a89b057d8958c7f68fbc --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,6 @@ +{% extends "!layout.html" %} + + {% block menu %} + {{ super() }} + <a href="py-modindex.html">modindex</a> + {% endblock %} \ No newline at end of file diff --git a/docs/constants.rst b/docs/constants.rst index f75b8535ddfbc859aa49b75c7110fb012100ea6d..a4e6275503d69b560cc017b8c1ee0eb89580e112 100644 --- a/docs/constants.rst +++ b/docs/constants.rst @@ -46,3 +46,6 @@ Race The following attribute means a randomly selected race from the three above: .. attribute:: Race.Random + + +.. toctree:: \ No newline at end of file diff --git a/docs/contributing.rst b/docs/contributing.rst index 853063d021db997dbda0cd6a6f8100b9cdfe40d7..3aa8a8297e315e6078da07097a743cbb4a8e3ff8 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -38,6 +38,27 @@ The source code for all additional dependencies (including pybind11) are registe The system is built using cmake, see the file `CMakeLists.txt <https://gitlab.liu.se/starcraft-ai-course/pycommandcenter/blob/master/CMakeLists.txt>`_ in the project root. +If a function already exist but you can't use it in python, check and see if it's exist in the library files (pybind). + +#. Create a declaration of your function in the header file. +#. Create a definition of your function in the source file. +#. Depending on which object you decided to extend, you should also add this function to the library file. The library is the pybind, making it possible to use your function in python. +#. Update the documentation. There are instructions on how you build and test the documentation. + +Example: +We want to add function to unit, returning a bool depending on if it's holding a mineral. We have discovered a function in the SC2 API containing this information (sc2_client.ccp). This is a helper function, it doesn't belong to any object. + +#. In unit.h: bool isCarryingMinerals() const; +#. In unit.cpp: bool Unit::isCarryingMinerals() const { return sc2::IsCarryingMinerals(\*m_unit); } +#. We can access m_unit in the unit file and with sc2::Function() we can access any function in the blizzard API that doesn't belong to any object. The same goes for any object, for example sc2::Point3D makes us able to access the Point3D object. +#. In lib_unit.cpp: .def_property_readonly("is_carrying_minerals", &Unit::isCarryingMinerals) +#. In the folder named docs we update the documentation. In this case, we update the file unit.rst. + +Common problems: + +#. The return in python is a memory address: Make sure that it returns a correct type. +#. The compiler complains about files I have not even touched: Make sure that the startUp is library and you have release x64. If you just added a new function in pybind, check it. +#. The bot crashes whit a exit code -1073741819 (0xC0000005): Make sure that you dont read null values. Document the new features / changes you have made ------------------------------------------------- @@ -61,3 +82,5 @@ Read the comments on your merge request and make the necessary changes In this step someone will review your changes and make comments. These comments might ask you to make changes to the code or documentation. These changes must be done before the merge request is accepted. Therefore it is important to make merge requests several days before eventual deadlines. Once the merge request has been accepted the code is now part of PyCommandCenter. Congratulations and thank you for your contribution to the project! + +.. toctree:: \ No newline at end of file diff --git a/docs/coordinates.rst b/docs/coordinates.rst index 294d8eea35bef9b8f6b70dac75a921702c1acb91..fb74871e26f4a5a45f9a16451ae9910756e8b20f 100644 --- a/docs/coordinates.rst +++ b/docs/coordinates.rst @@ -81,3 +81,4 @@ below: print(p1.distance(p2)) # prints: 2.8284... +.. toctree:: \ No newline at end of file diff --git a/docs/gettingstarted.rst b/docs/gettingstarted.rst index 037793e338f9110230000d487491afb6ac174866..c68a47300c4efa3530aec4bfe6a2f6f9428f5800 100644 --- a/docs/gettingstarted.rst +++ b/docs/gettingstarted.rst @@ -150,3 +150,4 @@ to: where ``SomeOtherBot`` is a bot defined in the same way as ``MyAgent``. +.. toctree:: \ No newline at end of file diff --git a/docs/helpers.rst b/docs/helpers.rst index 15cc665061d3ba8606024b55399998a459dd264b..68802b440ee021816569900ad82f6520ae54db31 100644 --- a/docs/helpers.rst +++ b/docs/helpers.rst @@ -188,3 +188,5 @@ BuildingPlacer If you want to place a town hall, take a look at attribute `depot_location` of :class:`library.BaseLocation`. If you want to place a refinery, take a look at attribute `geysers` of :class:`library.BaseLocation` and the method build_target of :class:`library.Unit`. + +.. toctree:: \ No newline at end of file diff --git a/docs/idabot.rst b/docs/idabot.rst index ad95df7bd7b4bcf3b5a9208f911bda67ebddf81f..6a4c6be2f210cfc04ad3b0ccc10ce43ad113caf2 100644 --- a/docs/idabot.rst +++ b/docs/idabot.rst @@ -191,3 +191,4 @@ The debug-methods are a great tool for speeding up the process. Set the amount (Float) of shield to the unit +.. toctree:: \ No newline at end of file diff --git a/docs/idareplayobserver.rst b/docs/idareplayobserver.rst index 8d34f274cccc955fb370770ea0ef63b9ff8e2154..d2379aefe762981f6bd342a26c7c96c4304a485e 100644 --- a/docs/idareplayobserver.rst +++ b/docs/idareplayobserver.rst @@ -27,7 +27,7 @@ IDAReplayObserver .. method:: IDAReplayObserver.on_unit_created(self) - This method is called when the an unit is created, that includes when an unit leaves a refinery. + This method is called when the an unit is created, that includes when an unit leaves a refinery. This only works if replay perspective is not set to 0. .. method:: IDAReplayObserver.on_unit_destroyed(self) @@ -45,3 +45,4 @@ IDAReplayObserver +.. toctree:: \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 73c52df20b09d553c9c7773975845f3afe2803d1..da345dada9ea6d61e89b35860c335efcdd0aef95 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,6 +22,8 @@ Table of contents :maxdepth: 3 gettingstarted + Library<_autosummary/library> + Coordinator<_autosummary/library.Coordinator> helpers idabot unit @@ -31,7 +33,7 @@ Table of contents replays idareplayobserver replayunit - + .. autosummary:: :toctree: _autosummary :hidden: diff --git a/docs/replays.rst b/docs/replays.rst index 0ca0179f6011a90ef1c6b52b4e86baa30f73e20d..af3307805042078bc4de4903642b827ee6a2e08e 100644 --- a/docs/replays.rst +++ b/docs/replays.rst @@ -1,3 +1,5 @@ +.. _replays: + Replays ======= This page will describe two different techniques for handling replays. The @@ -101,4 +103,6 @@ that no action can be preform just observations. if __name__ == "__main__": - main() \ No newline at end of file + main() + +.. toctree:: \ No newline at end of file diff --git a/docs/replayunit.rst b/docs/replayunit.rst index 57dd6deb74c6ff8e26e0be63ea021dc1341aac3d..7d27a67eb9e9e956856a5bced9a4a11723f47285 100644 --- a/docs/replayunit.rst +++ b/docs/replayunit.rst @@ -64,13 +64,12 @@ ReplayUnit .. autoattribute:: tile_position .. autoattribute:: unit_type - Returns the id of the unit_type - - .. autoattribute:: unit_type_name - - Returns the name of the unit_type + Returns the :class:`library.UnitType` of the unit .. autoattribute:: weapon_cooldown .. autoattribute:: is_carrying_minerals Returns if this unit is currently holding minerals + + +.. toctree:: \ No newline at end of file diff --git a/docs/types.rst b/docs/types.rst index dd9986f59ffb4543fb5b1165a395d28ff6b5a251..1227e4b87db0148a47be1d818a784188e00a98e8 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -53,3 +53,4 @@ EffectID is for things like ravager bile, or fungal or even a scan. :members: :undoc-members: +.. toctree:: \ No newline at end of file diff --git a/docs/unit.rst b/docs/unit.rst index 16aa1d46c7c8d7ef33073845d400bb05cf11f9ee..55a65d72c4c4f55dfd892d81ad19027c5bbaefc1 100644 --- a/docs/unit.rst +++ b/docs/unit.rst @@ -133,3 +133,5 @@ Unit .. automethod:: stop_dance Stop and dance + +.. toctree:: \ No newline at end of file