Make the game
~~~~~~~~~~~~~
.. image:: /_static/cartpole_overview.png
:width: 100%
You will need to specialize 3 classes in C++.
* ``ACPPlayerState`` to expose `SetScore `_
to blueprint, this will be used to create a custom reward function
* ``ACPPawn`` to make the pawn hostile to everybody,
this makes ``AISense_Sight`` sense all the pawn that are in range
* ``ACPGameMode`` to provide a custom ``HasMatchEnded``
that is used to reset the environment
From there everything can be done in blueprint.
You will need to create the blueprints below.
* Level: ``CartPole``
* ``GameMode_CartPole`` inherited from ``CPGameMode``
* ``Pawn_Cart`` (inherited from ``Pawn``)
* ``Pawn_Pole`` (inherited from ``CPPawn``)
* PlayerState_Cart (inherited from ``CPPlayerState``)
* PlayerController_Cart (inherited from ``PlayerController``)
.. note::
Both ``PlayerState_Cart`` and ``PlayerController_Cart`` are left empty.
Your input handling could be moved to ``PlayerController_Cart`` if you wanted.
GameMode_CartPole
^^^^^^^^^^^^^^^^^
.. raw:: html
Pawn_Cart
^^^^^^^^^
* Add a ``FloatingPawnMovement`` component to enable the cart's movement
* The cart is composed of a single cube followed by a cylinder rotated 90 degrees i.e ``(0, -90, 0)``
* The cube is translated ``(200, 0, 0)`` so it can be seen from the default camera
.. raw:: html
Pawn_Pole
^^^^^^^^^
* The pole is a single cylinder
* Enable physics on the cylinder.
* You can modify Linear Damping and Angular Damping
properties to make the pole easier to balance.
.. raw:: html
You should now be able to play the game
.. comment
.. raw:: html
GameMode_CartPole
(inherited from CPGameMode
)
.. raw:: html
Pawn_Cart
(inherited from Pawn
)
.. raw:: html
Pawn_Pole
(inherited from CPPawn
)