Skip to content
Snippets Groups Projects
Commit 9f93af25 authored by Edvin Bergström's avatar Edvin Bergström
Browse files

Added Library and Coordinator to the Navigation. Also moved text from...

Added Library and Coordinator to the Navigation. Also moved text from ExtendAPI.md to docs/contributiong.rst
parent 48aa5083
No related branches found
No related tags found
No related merge requests found
{% extends "!layout.html" %}
{% block menu %}
{{ super() }}
<a href="py-modindex.html">modindex</a>
{% endblock %}
\ No newline at end of file
......@@ -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
......@@ -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
......@@ -81,3 +81,4 @@ below:
print(p1.distance(p2)) # prints: 2.8284...
.. toctree::
\ No newline at end of file
......@@ -150,3 +150,4 @@ to:
where ``SomeOtherBot`` is a bot defined in the same way as ``MyAgent``.
.. toctree::
\ No newline at end of file
......@@ -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
......@@ -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
......@@ -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
......@@ -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:
......
.. _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
......@@ -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
......@@ -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
......@@ -133,3 +133,5 @@ Unit
.. automethod:: stop_dance
Stop and dance
.. toctree::
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment