TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
When featurizing units, we represent each 2D cell as having one unit. More...
#include <jitter.h>
Inherits cherrypi::BaseJitter.
Inherited by cherrypi::LayeredJitter.
Public Member Functions | |
Jitter (State *st, Rect const &crop, bool allowSameType) | |
Position | operator() (Unit *u) const override |
Public Member Functions inherited from cherrypi::BaseJitter | |
BaseJitter () | |
virtual | ~BaseJitter ()=default |
Protected Member Functions | |
Jitter () | |
void | fillJitter (State *st, Rect const &crop, std::function< bool(Unit *, Unit *)> const &compatible) |
Protected Attributes | |
std::unordered_map< Unit *, Position > | jitteredPos_ |
When featurizing units, we represent each 2D cell as having one unit.
Of course, StarCraft isn't so neat and tidy. Multiple units can be stacked on one location; sometimes ground units, but frequently air units as well.
In order to featurize units on a 2D grid, we apply jitter to shake those units out into a one-to-one cell-to-(unit or no unit) mapping. Units get moved into nearby cells for featurization.
This jitter class treats all units indiscriminately. If allowSameType is true, then we allow units of the same type to be on the same tile (no matter if they are jittered or not).
Warning: This will not behave as expected for tanks since sieged and unsieged are two different units. However, stacked tanks should be almost impossible in normal situations.
Note that neutral units will always be ignored.
|
inlineprotected |
|
protected |
Implements cherrypi::BaseJitter.