Skip to content

Commit

Permalink
Little docs update
Browse files Browse the repository at this point in the history
Former-commit-id: 6082c27
  • Loading branch information
mwydmuch committed May 4, 2017
1 parent 91017d6 commit b0c840d
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 19 deletions.
32 changes: 16 additions & 16 deletions doc/DoomGame.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ Checks if the ViZDoom game instance is running.
---
### <a name="setAction"></a> `setAction`

| C++ | `void setAction(std::vector<int> const &actions)` |
| C++ | `void setAction(std::vector<float> const &actions)` |
| :-- | :-- |
| Lua | `void setAction(IntTensor/table actions)` |
| Java | `void setAction(int[] actions)` |
| Lua | `void setAction(DoubleTensor/table actions)` |
| Java | `void setAction(double[] actions)` |
| Python | `void set_action(list actions)` |

Sets the player's action for the next tics.
Expand All @@ -212,10 +212,10 @@ If `updateState` is not set the state will not be updated.
---
### <a name="makeAction"></a> `makeAction`

| C++ | `double makeAction(std::vector<int> const &actions, unsigned int tics = 1)` |
| C++ | `double makeAction(std::vector<double> const &actions, unsigned int tics = 1)` |
| :-- | :-- |
| Lua | `number makeAction(IntTensor/table actions, number tics = 1);` |
| Java | `double makeAction(int[] actions, int tics = 1);` |
| Lua | `number makeAction(DoubleTensor/table actions, number tics = 1);` |
| Java | `double makeAction(double[] actions, int tics = 1);` |
| Python | `float make_action(list actions, int tics = 1);` |

Method combining usability of [`setAction`](#setAction), [`advanceAction`](#advanceAction) and [`getLastReward`](#getLastReward).
Expand Down Expand Up @@ -311,10 +311,10 @@ See also:
---
### <a name="getLastAction"></a> `getLastAction`

| C++ | `std::vector<int> getLastAction()` |
| C++ | `std::vector<double> getLastAction()` |
| :-- | :-- |
| Lua | `IntTensor getLastAction()` |
| Java | `int[] getLastAction()` |
| Lua | `DoubleTensor getLastAction()` |
| Java | `double[] getLastAction()` |
| Python | `list get_last_action()` |

Returns the last action performed.
Expand Down Expand Up @@ -373,11 +373,11 @@ See also:
---
### <a name="addAvailableButton"></a> `addAvailableButton`

| C++ | `void addAvailableButton(Button button, unsigned int maxValue = 0)` |
| C++ | `void addAvailableButton(Button button, double maxValue = 0)` |
| :-- | :-- |
| Lua | `void addAvailableButton(Button button, number maxValue = 0)` |
| Java | `void addAvailableButton(Button button, int maxValue = 0)` |
| Python | `void add_available_button(Button button, int maxValue = 0)` |
| Java | `void addAvailableButton(Button button, double maxValue = 0)` |
| Python | `void add_available_button(Button button, float maxValue = 0)` |

Add `Button` type (e.g. `TURN_LEFT`, `MOVE_FORWARD`) to `Buttons` available in action
and sets the maximum allowed, absolute value for the specified button.
Expand Down Expand Up @@ -422,11 +422,11 @@ See also:
---
### <a name="setButtonMaxValue"></a> `setButtonMaxValue`

| C++ | `void setButtonMaxValue(Button button, unsigned int maxValue = 0)` |
| C++ | `void setButtonMaxValue(Button button, double maxValue = 0)` |
| :-- | :-- |
| Lua | `void setButtonMaxValue(Button button, number maxValue = 0)` |
| Java | `void setButtonMaxValue(Button button, int maxValue = 0)` |
| Python | `void set_button_max_value(Button button, int maxValue = 0)` |
| Java | `void setButtonMaxValue(Button button, double maxValue = 0)` |
| Python | `void set_button_max_value(Button button, float maxValue = 0)` |

Sets the maximum allowed, absolute value for the specified button.
Setting maximum value equal to 0 results in no constraint at all (infinity).
Expand Down Expand Up @@ -471,7 +471,7 @@ See also:
---
### <a name="addAvailableGameVariable"></a> `addAvailableGameVariable`

| C++ | `void setAvailableGameVariables(td::vector<GameVariable> variables)` |
| C++ | `void setAvailableGameVariables(std::vector<GameVariable> variables)` |
| :-- | :-- |
| Lua | `void setAvailableGameVariables(table variables)` |
| Java | `void setAvailableGameVariables(GameVariable[] variables)` |
Expand Down
89 changes: 86 additions & 3 deletions doc/Types.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,54 @@
(`C++ type / Lua type / Java type / Python type` **name**)

- `unsigned int / number / unsigned int / int` **id**
- `unsigned int / number / unsigned int / int` **tic**
- `std::vector<float> / DoubleTensor / double[] / numpy.double[]` **gameVariables / game_variables**
- `BufferPtr / ByteTensor / byte[] / numpy.uint8[]` **screenBuffer / screen_buffer**
- `BufferPtr / ByteTensor / byte[] / numpy.uint8[]` **depthBuffer / depth_buffer**
- `BufferPtr / ByteTensor / byte[] / numpy.uint8[]` **labelsBuffer / labels_buffer**
- `BufferPtr / ByteTensor / byte[] / numpy.uint8[]` **automapBuffer / automap_buffer**
- `std::vector<Label> / table / Label[] / list` **labels**

See also:
- [`DoomGame: getState`](DoomGame.md#getState),
- [examples/python/basic.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/basic.py),
- [examples/python/buffers.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/buffers.py).


## <a name="enums"></a> Enums

---
### <a name="mode"></a> `Mode`

Enum type that defines all supported modes.

- **PLAYER** - synchronous player mode
- **SPECTATOR** - synchronous spectator mode
- **ASYNC_PLAYER** - asynchronous player mode
- **ASYNC_SPECTATOR** - asynchronous spectator mode

In **PLAYER** and **ASYNC_PLAYER** modes the agent controls ingame character.

In **SPECTATOR** and **ASYNC_SPECTATOR** modes ingame character should be controlled by the human and the agent gets information about human action.

In **PLAYER** and **SPECTATOR** modes the game waits for agent action or permission to continue.

In **ASYNC** modes the game progress with constant speed (default 35 tics per second, this can be set).

All modes can be used in singleplayer and multiplayer.

See also:
- [`DoomGame: getMode`](DoomGame.md#getMode),
- [`DoomGame: setMode`](DoomGame.md#setMode),
- [`DoomGame: getTicrate`](DoomGame.md#getTicrate),
- [`DoomGame: setTicrate`](DoomGame.md#setTicrate).


---
### <a name="screenformat"></a>`ScreenFormat`

Enum type that defines all supported **screenBuffer** and **automapBuffer** formats.

- **CRCGCB** - 3 channels of 8-bit values in RGB order
- **RGB24** - channel of RGB values stored in 24 bits, where R value is stored in the oldest 8 bits
- **RGBA32** - channel of RGBA values stored in 32 bits, where R value is stored in the oldest 8 bits
Expand All @@ -76,9 +102,27 @@
- **DOOM_256_COLORS8** - 8-bit channel with Doom palette values


In **CRCGCB** and **CBCGCR** format **screenBuffer** and **automapBuffer** store all red 8 bit values then all green values and then all blue values, each channel is considered separately. As matrices they have shapes [3, y, x].

In **RGB24** and **BGR24** format **screenBuffer** and **automapBuffer** store 24 bit RGB triples. As matrices they have shapes [y, x, 3].

In **RGBA32**, **ARGB32**, **BGRA32** and **ABGR32** format **screenBuffer** and **automapBuffer** store 32 bit sets of RBG + alpha values. As matrices they have shapes [y, x, 4].

In **GRAY8** and **DOOM_256_COLORS8** format **screenBuffer** and **automapBuffer** store single 8 bit values. As matrices they have shapes [y, x].

**depthBuffer** and **lablesBuffer** always store single 8 bit values, so they always have shapes [y, x].

See also:
- [`DoomGame: getScreenFormat`](DoomGame.md#getScreenFormat),
- [`DoomGame: setScreenFormat`](DoomGame.md#setScreenFormat),
- [examples/python/buffers.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/buffers.py).


---
### <a name="screenresolution"></a>`ScreenResolution`

Enum type that defines all supported resolutions - shapes of **screenBuffer**, **depthBuffer**, **labelsBuffer** and **automapBuffer** in **State**.

- **RES_160X120** (4:3)
- **RES_200X125** (16:10)
- **RES_200X150** (4:3)
Expand Down Expand Up @@ -116,18 +160,32 @@
- **RES_1600X1200** (4:3)
- **RES_1920X1080** (16:9)

See also:
- [`DoomGame: setScreenResolution`](DoomGame.md#setScreenResolution),
- [`DoomGame: getScreenWidth`](DoomGame.md#getScreenWidth),
- [`DoomGame: getScreenHeight`](DoomGame.md#getScreenHeight).


---
### <a name="automapmode"></a> `AutomapMode`

Enum type that defines all **automapBuffer** modes.

- **NORMAL** - Only level architecture the player has seen is shown.
- **WHOLE** - All architecture is shown, regardless of whether or not the player has seen it.
- **OBJECTS** - In addition to the previous, shows all things in the map as arrows pointing in the direction they are facing.
- **OBJECTS_WITH_SIZE** - In addition to the previous, all things are wrapped in a box showing their size.

See also:
- [`DoomGame: setAutomapMode`](DoomGame.md#setAutomapMode),
- [examples/python/buffers.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/buffers.py).


---
### <a name="gamevariable"></a> `GameVariable`

Enum type that defines all variables that can be obtained from the game.

#### Defined variables
- **KILLCOUNT**
- **ITEMCOUNT**
Expand All @@ -151,6 +209,7 @@
- **PLAYER_COUNT** - Number of players in multiplayer game.
- **PLAYER1_FRAGCOUNT** - **PLAYER8_FRAGCOUNT** - Number of N player's frags


#### User (ACS) variables
- **USER1** - **USER60**

Expand All @@ -159,15 +218,24 @@ global int 0 is reserved for reward and is always threaded as Doom's fixed point
Other from 1 to 60 (global int 1-60) can be access as USER1 - USER60 GameVariables.

See also:
- [ZDoom Wiki](http://zdoom.org/wiki/ACS)
- [`Utilities: doomFixedToDouble`](Utilities.md#doomFixedToDouble)
- [ZDoom Wiki: ACS](http://zdoom.org/wiki/ACS),
- [`DoomGame: getAvailableGameVariables`](DoomGame.md#getAvailableGameVariables),
- [`DoomGame: setAvailableGameVariables`](DoomGame.md#setAvailableGameVariables),
- [`DoomGame: addAvailableGameVariable`](DoomGame.md#addAvailableGameVariable),
- [`DoomGame: getGameVariable`](DoomGame.md#getGameVariable),
- [`Utilities: doomFixedToDouble`](Utilities.md#doomFixedToDouble),
- [examples/python/basic.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/basic.py),
- [examples/python/shaping.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/shaping.py).


---
### <a name="button"></a> `Button`

Enum type that defines all buttons that can be "pressed" by agent.

#### <a name="binarybuttons"></a> Binary buttons

Binary buttons have only 2 states "not pressed" if value 0 and "pressed" if value greater then 0.
Binary buttons have only 2 states "not pressed" if value 0 and "pressed" if value other then 0.

- **ATTACK**
- **USE**
Expand Down Expand Up @@ -208,6 +276,7 @@ Binary buttons have only 2 states "not pressed" if value 0 and "pressed" if valu
- **SELECT_PREV_ITEM**
- **DROP_SELECTED_ITEM**


#### <a name="deltabuttons"></a> Delta buttons

Buttons whose value defines the speed of movement.
Expand All @@ -219,3 +288,17 @@ For example: value 10 for MOVE_LEFT_RIGHT_DELTA means slow movement to the right
- **MOVE_FORWARD_BACKWARD_DELTA**
- **MOVE_LEFT_RIGHT_DELTA**
- **MOVE_UP_DOWN_DELTA**

In case of **TURN_LEFT_RIGHT_DELTA** and **LOOK_UP_DOWN_DELTA** values correspond to degrees.
In case of **MOVE_FORWARD_BACKWARD_DELTA**, **MOVE_LEFT_RIGHT_DELTA**, **MOVE_UP_DOWN_DELTA** values correspond to Doom Map unit (see Doom Wiki if you want to know how it translates into real life units).

See also:
- [Doom Wiki: Map unit](https://doomwiki.org/wiki/Map_unit),
- [`DoomGame: getAvailableButtons`](DoomGame.md#getAvailableButtons),
- [`DoomGame: setAvailableButtons`](DoomGame.md#setAvailableButtons),
- [`DoomGame: addAvailableButton`](DoomGame.md#addAvailableButton),
- [`DoomGame: setButtonMaxValue`](DoomGame.md#setButtonMaxValue),
- [`DoomGame: getButtonMaxValue`](DoomGame.md#getButtonMaxValue),
- [examples/python/basic.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/basic.py),
- [examples/python/delta_buttons.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/delta_buttons.py),
- [GitHub issue: Angle changes by executing certain commands](https://github.com/mwydmuch/ViZDoom/issues/182).

0 comments on commit b0c840d

Please sign in to comment.