Skip to content

Commit

Permalink
Merge pull request #573 from Farama-Foundation/setup-updates
Browse files Browse the repository at this point in the history
Setup.py, docs, and tests updates
  • Loading branch information
mwydmuch authored Dec 12, 2023
2 parents 5c7a203 + a2eed0e commit 527a934
Show file tree
Hide file tree
Showing 25 changed files with 474 additions and 164 deletions.
85 changes: 64 additions & 21 deletions docs/api/cpp/doomGame.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Then the rest of the players must also call this method to start a new episode.

Added in 1.1.0

Replays a recorded episode from the given file using the perspective of the specified player.
Players are numbered from 1, `player` equal to 0 results in replaying the demo using the perspective of the default player in the recording file.
Replays the recorded episode from the given file using the perspective of the specified player.
Players are numbered from 1, If `player` is equal to 0, the episode will be replayed using the perspective of the default player in the recording file.
After calling this method, the first state from the replay will be available.
All rewards, variables, and states are available during the replaying episode.
All rewards, variables, and states are available when replaying the episode.

See also:
- [examples/python/record_episodes.py](https://github.com/Farama-Foundation/ViZDoom/tree/master/examples/python/record_episodes.py)
Expand All @@ -74,7 +74,7 @@ See also:
| :-- | :-- |
| Python | `is_running() -> bool` |

Checks if the ViZDoom game instance is running.
Checks if the controlled game instance is running.


---
Expand Down Expand Up @@ -110,7 +110,7 @@ Checks if the game is in recording mode.

Added in 1.1.5

Checks if the game is in replaying mode.
Checks if the game is in replay mode.


---
Expand All @@ -121,7 +121,8 @@ Checks if the game is in replaying mode.
| Python | `set_action(actions: list | tuple | ndarray [float]) -> None` |

Sets the player's action for the next tics.
Each value corresponds to a button specified with [`addAvailableButton`](#addavailablebutton) method
Each value corresponds to a button previously specified
with [`addAvailableButton`](#addavailablebutton), or [`setAvailableButtons`](#setavailablebuttons) methods,
or in the configuration file (in order of appearance).


Expand All @@ -132,7 +133,7 @@ or in the configuration file (in order of appearance).
| :-- | :-- |
| Python | `advance_action(tics: int = 1, updateState: bool = True) -> None` |

Processes a specified number of tics. If `updateState` is set,
Processes the specified number of tics. If `updateState` is set,
the state will be updated after the last processed tic and a new reward will be calculated.
To get the new state, use `getState` and to get the new reward use `getLastReward`.
If `updateState` is not set, the state will not be updated.
Expand All @@ -145,8 +146,8 @@ If `updateState` is not set, the state will not be updated.
| :-- | :-- |
| Python | `make_action(actions: list | tuple | ndarray [float], tics: int = 1) -> float` |

Method combining usability of [`setAction`](#setaction), [`advanceAction`](#advanceaction) and [`getLastReward`](#getlastreward).
Sets the player's action for the next tics, processes a specified number of tics,
This method combines functionality of [`setAction`](#setaction), [`advanceAction`](#advanceaction) and [`getLastReward`](#getlastreward).
Sets the player's action for the next tics, processes the specified number of tics,
updates the state and calculates a new reward, which is returned.


Expand Down Expand Up @@ -314,10 +315,12 @@ See also:

| C++ | `void setAvailableButtons(std::vector<Button> buttons)` |
| :-- | :-- |
| Python | `add_available_button(buttons: list | tuple[Button]) -> None` |
| Python | `add_available_buttons(buttons: list | tuple[Button]) -> None` |

Sets given list of `Button`s (e.g. `TURN_LEFT`, `MOVE_FORWARD`) as available `Buttons`.

Has no effect when the game is running.

Config key: `availableButtons/available_buttons` (list)

See also:
Expand All @@ -336,6 +339,8 @@ See also:
Adds [`Button`](./enums.md#button) type (e.g. `TURN_LEFT`, `MOVE_FORWARD`) to available `Buttons` and sets the maximum allowed, absolute value for the specified button.
If the given button has already been added, it will not be added again, but the maximum value is overridden.

Has no effect when the game is running.

Config key: `availableButtons/available_buttons` (list)

See also:
Expand All @@ -354,6 +359,8 @@ See also:

Clears all available `Buttons` added so far.

Has no effect when the game is running.

See also:
- [`Enums: Button`](./enums.md#button)

Expand Down Expand Up @@ -383,6 +390,8 @@ Setting the maximum value to 0 results in no constraint at all (infinity).
This method makes sense only for delta buttons.
The constraints limit applies in all Modes.

Has no effect when the game is running.

See also:
- [`Enums: Button`](./enums.md#button)

Expand Down Expand Up @@ -437,7 +446,9 @@ See also:
| :-- | :-- |
| Python | `set_available_game_variables(variables: list | tuple[GameVariables]) -> None` |

Sets list of [`GameVariable`](./enums.md#gamevariable) as available `GameVariables` in the [`GameState`](./gameState.md#gamestate) returned by `getState` method.
Sets list of [`GameVariable`](./enums.md#gamevariable) as available `GameVariables` in the [`GameState`](./gameState.md#gamestate) returned by [`getState`](#getstate) method.

Has no effect when the game is running.

Config key: `availableGameVariables/available_game_variables` (list)

Expand All @@ -454,7 +465,9 @@ See also:
| :-- | :-- |
| Python | `add_available_game_variable(variable: GameVariable) -> None` |

Adds the specified [`GameVariable`](./enums.md#gamevariable) to the list of available game variables (e.g. `HEALTH`, `AMMO1`, `ATTACK_READY`) in the [`GameState`](./gameState.md#gamestate) returned by `getState` method.
Adds the specified [`GameVariable`](./enums.md#gamevariable) to the list of available game variables (e.g. `HEALTH`, `AMMO1`, `ATTACK_READY`) in the [`GameState`](./gameState.md#gamestate) returned by [`getState`](#getstate) method.

Has no effect when the game is running.

Config key: `availableGameVariables/available_game_variables` (list)

Expand All @@ -473,6 +486,8 @@ See also:

Clears the list of available `GameVariables` that are included in the [`GameState`](./gameState.md#gamestate) returned by [`getState`](#getstate) method.

Has no effect when the game is running.

See also:
- [`Enums: GameVariable`](./enums.md#gamevariable)
- [`ConfigFile: List`](./configurationFiles.md#list)
Expand Down Expand Up @@ -502,7 +517,7 @@ See also:
Returns the current value of the specified game variable (`HEALTH`, `AMMO1` etc.).
The specified game variable does not need to be among available game variables (included in the state).
It could be used for e.g. shaping. Returns 0 in case of not finding given `GameVariable`.
git lo

See also:
- [`Enums: GameVariable`](./enums.md#gamevariable)

Expand Down Expand Up @@ -665,7 +680,7 @@ See also:
| :-- | :-- |
| Python | `get_mode() -> Mode` |

Returns current mode (`PLAYER`, `SPECTATOR`, `ASYNC_PLAYER`, `ASYNC_SPECTATOR`).
Returns the current mode (`PLAYER`, `SPECTATOR`, `ASYNC_PLAYER`, `ASYNC_SPECTATOR`).

See also:
- [`Enums: Mode`](./enums.md#mode)
Expand All @@ -678,10 +693,12 @@ See also:
| :-- | :-- |
| Python | `set_mode(mode: Mode) -> None` |

Sets mode (`PLAYER`, `SPECTATOR`, `ASYNC_PLAYER`, `ASYNC_SPECTATOR`) in which the game will be running.
Sets the mode (`PLAYER`, `SPECTATOR`, `ASYNC_PLAYER`, `ASYNC_SPECTATOR`) in which the game will be running.

Default value: `PLAYER`.

Has no effect when the game is running.

Config key: `mode`

See also:
Expand Down Expand Up @@ -709,11 +726,13 @@ Returns current ticrate.

Added in 1.1.0

Sets ticrate for ASNYC Modes - number of logic tics executed per second.
Sets the ticrate for ASNYC Modes - number of logic tics executed per second.
The default Doom ticrate is 35. This value will play a game at normal speed.

Default value: 35 (default Doom ticrate).

Has no effect when the game is running.

Config key: `ticrate`

See also:
Expand All @@ -727,7 +746,7 @@ See also:
| :-- | :-- |
| Python | `set_vizdoom_path(filePath: str) -> None` |

Sets path to the ViZDoom engine executable vizdoom.
Sets the path to the ViZDoom engine executable vizdoom.

Default value: "{vizdoom.so location}/{vizdoom or vizdoom.exe (on Windows)}".

Expand Down Expand Up @@ -825,7 +844,7 @@ Config key: `DoomConfigPath/doom_config_path`
| :-- | :-- |
| Python | `getSeed() -> int` |

Return ViZDoom's seed.
Returns ViZDoom's seed.


---
Expand All @@ -835,7 +854,7 @@ Return ViZDoom's seed.
| :-- | :-- |
| Python | `set_seed(seed: int) -> None` |

Sets the seed of the ViZDoom's RNG that generates seeds (initial state) for episodes.
Sets the seed of ViZDoom's RNG that generates seeds (initial state) for episodes.

Default value: randomized in constructor

Expand All @@ -853,7 +872,7 @@ See also:
| :-- | :-- |
| Python | `get_episode_start_time() -> int` |

Returns start delay of every episode in tics.
Returns the start time (delay) of every episode in tics.


---
Expand All @@ -863,7 +882,7 @@ Returns start delay of every episode in tics.
| :-- | :-- |
| Python | `set_episode_start_time(tics: int) -> None` |

Sets start delay of every episode in tics.
Sets the start time (delay) of every episode in tics.
Every episode will effectively start (from the user's perspective) after the provided number of tics.

Default value: 1
Expand All @@ -890,6 +909,8 @@ Returns the number of tics after which the episode will be finished.

Sets the number of tics after which the episode will be finished. 0 will result in no timeout.

Default value: 0

Config key: `episodeTimeout/episode_timeout`


Expand All @@ -908,6 +929,8 @@ The buffers, as well as the content of ViZDoom's display window, will be affecte

Default value: `RES_320X240`

Has no effect when the game is running.

Config key: `screenResolution/screen_resolution`


Expand Down Expand Up @@ -938,6 +961,8 @@ The format change affects only the buffers, so it will not have any effect on th

Default value: `CRCGCB`

Has no effect when the game is running.

Config key: `screenFormat/screen_format`

See also:
Expand Down Expand Up @@ -970,6 +995,8 @@ Depth buffer will contain noise if `viz_nocheat` is enabled.

Default value: false

Has no effect when the game is running.

Config key: `depthBufferEnabled/depth_buffer_enabled`

See also:
Expand Down Expand Up @@ -1003,6 +1030,8 @@ LabelsBuffer will contain noise if `viz_nocheat` is enabled.

Default value: false

Has no effect when the game is running.

Config key: `labelsBufferEnabled/labels_buffer_enabled`

See also:
Expand Down Expand Up @@ -1037,6 +1066,8 @@ Enables rendering of the automap buffer, it will be available in the state.

Default value: false

Has no effect when the game is running.

Config key: `automapBufferEnabled/automap_buffer_enabled`

See also:
Expand Down Expand Up @@ -1280,6 +1311,8 @@ ViZDoom with window disabled can be used on Linux systems without X Server.

Default value: false

Has no effect when the game is running.

Config key: `windowVisible/window_visible`


Expand Down Expand Up @@ -1387,6 +1420,8 @@ It will be available in the state.

Default value: false

Has no effect when the game is running.

Config key: `objectsInfoEnabled/objects_info_enabled`

See also:
Expand Down Expand Up @@ -1421,6 +1456,8 @@ It will be available in the state.

Default value: false

Has no effect when the game is running.

Config key: `sectorsInfoEnabled/sectors_info_enabled`

See also:
Expand Down Expand Up @@ -1454,6 +1491,8 @@ Returns true if the audio buffer is enabled.

Default value: false

Has no effect when the game is running.

Config key: `audioBufferEnabled/audio_buffer_enabled`

See also:
Expand Down Expand Up @@ -1493,6 +1532,8 @@ Sets the sampling rate of the audio buffer.

Default value: false

Has no effect when the game is running.

Config key: `audioSamplingRate/audio_samping_rate`

See also:
Expand Down Expand Up @@ -1533,6 +1574,8 @@ Doom uses 35 ticks per second.

Default value: 4

Has no effect when the game is running.

Config key: `audioBufferSize/audio_buffer_size`

See also:
Expand Down
3 changes: 2 additions & 1 deletion docs/api/python/doomGame.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ DoomGame is the main object of the ViZDoom library, representing a single instan
.. autofunction:: vizdoom.DoomGame.get_game_variable
```

## Game Arguments methods
## Game arguments methods

```{eval-rst}
.. autofunction:: vizdoom.DoomGame.set_game_args
.. autofunction:: vizdoom.DoomGame.add_game_args
.. autofunction:: vizdoom.DoomGame.clear_game_args
.. autofunction:: vizdoom.DoomGame.get_game_args
```

## Reward methods
Expand Down
4 changes: 2 additions & 2 deletions docs/introduction/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ Compilation output will be placed in `build/bin` and it should contain the follo
* `bin/libvizdoom.a / vizdoom.lib` - C++ ViZDoom static library
* `bin/libvizdoom.so / vizdoom.dll / libvizdoom.dylib` - C++ ViZDoom dynamically linked library
* `bin/pythonX.X/vizdoom.so / vizdoom.pyd / vizdoom.dylib ` - ViZDoom Python X.X module
* `bin/pythonX.X/pip_package` - complete ViZDoom Python X.X package
* `bin/pythonX.X/vizdoom` - complete ViZDoom Python X.X package


### Manual installation

To manually install Python package copy `vizdoom_root_dir/build/bin/pythonX.X/pip_package` contents to `python_root_dir/lib/pythonX.X/site-packages/site-packages/vizdoom`.
To manually install Python package copy `vizdoom_root_dir/build/bin/pythonX.X/vizdoom` contents to `python_root_dir/lib/pythonX.X/site-packages/site-packages/vizdoom`.
Loading

0 comments on commit 527a934

Please sign in to comment.