diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 000000000..6d4addf81 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,42 @@ +name: Build and Deploy Docs +on: + push: + branches: [master] + +permissions: + contents: write + +jobs: + docs: + name: Generate Website + runs-on: ubuntu-latest + env: + SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install docs dependencies + run: pip install -r docs/requirements.txt + + - name: Install ViZDoom + run: pip install -e . + + - name: Build + run: sphinx-build -b dirhtml -v docs _build + + - name: Move 404 + run: mv _build/404/index.html _build/404.html + + - name: Update 404 links + run: python docs/_scripts/move_404.py _build/404.html + + - name: Remove .doctrees + run: rm -r _build/.doctrees + + - name: Upload to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: _build diff --git a/.gitignore b/.gitignore index 9ec396527..a1a7f833d 100644 --- a/.gitignore +++ b/.gitignore @@ -126,3 +126,6 @@ src/vizdoom/zlib/x64/ # Dockerfiles tmp_dockerfiles + +# Documentation +docs_html diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 76e92d5af..202b5b8fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,8 +26,12 @@ repos: rev: v2.2.2 hooks: - id: codespell + exclude: > + (?x)^( + .*\.svg + )$ args: - - --ignore-words-list=msdos,MSDOS,LTS,STLE,parms,bord,partialy,nd,siz,ore,CLER, + - --ignore-words-list=msdos,MSDOS,LTS,STLE,parms,bord,partialy,nd,siz,ore,CLER - repo: https://github.com/python/black rev: 22.10.0 hooks: diff --git a/README.md b/README.md index 7a849529d..d15eb08b9 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ [![PyPI version](https://badge.fury.io/py/vizdoom.svg)](https://badge.fury.io/py/vizdoom) ![Build](https://github.com/mwydmuch/ViZDoom/workflows/Build/badge.svg) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

- +

ViZDoom allows developing AI **bots that play Doom using only visual information** (the screen buffer). It is primarily intended for research in machine visual learning, and deep reinforcement learning, in particular. ViZDoom is based on [ZDoom](https://github.com/rheit/zdoom) to provide the game mechanics. -![vizdoom_deadly_corridor](http://www.cs.put.poznan.pl/mkempka/misc/vizdoom_gifs/vizdoom_corridor_segmentation.gif) +![ViZDoom Demo](https://raw.githubusercontent.com/Farama-Foundation/ViZDoom/master/docs/_static/img/vizdoom-demo.gif) ## Features @@ -26,7 +26,7 @@ ViZDoom is based on [ZDoom](https://github.com/rheit/zdoom) to provide the game - Access to the list of actors/objects and map geometry, - Off-screen rendering, - Episodes recording, -- Time scaling in async mode. +- In-game time scaling in async mode. ViZDoom API is **reinforcement learning** friendly (suitable also for learning from demonstration, apprenticeship learning or apprenticeship via inverse reinforcement learning, etc.). diff --git a/doc/Changelog.md b/doc/Changelog.md deleted file mode 100644 index 80b360dea..000000000 --- a/doc/Changelog.md +++ /dev/null @@ -1,286 +0,0 @@ -# Changelog - -## Changes in 1.1.14 - -#### Support for Apple Silicon -- Fixed building on Apple Silicon Macbooks. - -#### Gym -- OpenAI Gym environment wrappers were updated to the Gym v0.26 API version. - ---- - -## Changes in 1.1.13 - -#### Releases -- The pybind11 library and freedoom2.wad are now part of the source release instead of being downloaded during building. - -#### Consts -- Added new consts: `DEFAULT_FPS` (= `DEFAULT_TICRATE`), `DEFAULT_FRAMETIME_S` (= `1.0 / DEFAULT_TICRATE`), `DEFAULT_FRAMETIME_MS` (= `DEFAULT_FRAMETIME_S * 1000`); - ---- - -## Changes in 1.1.12 - -#### New OpenAI Gym wrapper -- Added a new wrapper for OpenAI Gym. - ---- - -## Changes in 1.1.11 - -#### Python -- Fixed issues with installing/building Python package. - ---- - -## Changes in 1.1.10 - -#### Python Bindings -- Fixed support for Python 3.10 -- Removed dependency on Numpy and simplified the process of building Windows wheels. - -#### Input/output -- Added support for tuples and ndarrays as arguments in many functions, where previously only lists were accepted. - ---- - -## Changes in 1.1.9 - -#### Audio buffer -- Added `audio_buffer` to `State` and related methods `is/setAudioBufferEnabled`, `get/setAudioSamplingRate`, `get/setAudioBufferSize`. - -#### Save/load methods -- Added `save` and `load` methods that allow saving/loading game to/from a file. - -#### Misc -- Added `viz_bots_path` CVAR that allows specifying path to custom bots configuration. - ---- - -## Changes in 1.1.8 - -#### Objects and sectors -- Added `is/setObjectsInfoEnabled`, `is/setSectorsInfoEnabled` methods to Python and C++ than enable information about all objects or/and sectors (map layout) present in the current episode/level. -- Added `objects` and `sectors` fields to `GameState` in Python and C++. - -#### Config files -- Added missing GameVariables introduced in 1.1.5 to Config parser. -- Added missing GameVariables introduced in 1.1.7 to Config parser. -- Added `objectsInfoEnabled/objects_info_enabled` - -#### Python, Java, Lua -- Dropped support for Python 2.7 -- Dropped support for Java bindings -- Dropped support for Lua/Torch bindings - ---- - -## Changes in 1.1.7 - -#### Python & Julia -- Added missing `is_multiplayer_game` method to Python and Julia binding. - -#### CVARS -- Added `VIEW_HEIGHT`, `CAMERA_POSITION_X`/`Y`/`Z`, `CAMERA_ANGLE`, `CAMERA_PITCH`, `CAMERA_ROLL` and `CAMERA_FOV` GameVariables. - ---- - -## Changes in 1.1.6 - -#### Julia specific -- Julia binding added. - -#### Server state -- Added `getServerState` method that returns `ServerState` object. - -#### Multiplayer -- Added timeout for network game synchronization controlled by `viz_connect_timeout` CVAR. -- Fixed `viz_spectator` CVAR. - -#### Python specific -- Added Python interpreter version check. - ---- - -## Changes in 1.1.5 - -#### Automap -- Added `viz_am_scale` CVAR (CVAR version of `am_scale` CCMD). -- Added `viz_am_center` CVAR (and `am_center` CCMD). - -#### Buttons and actions -- **Added `getButton` method.** - -#### Episode recording and replaying -- Added `isRecordingEpisode` and `isReplayingEpisode` methods. - -#### GameVariables -- **`KILLCOUNT` counts all kills, including multilayer kills.** -- **`HITCOUNT`, `HITS_TAKEN`, `DAMAGECOUNT`, `DAMAGE_TAKEN` game variables added.** - -#### Labels -- **Added appending "Dead" prefix to label's name when actor is a corpse.** -- **Added bounding box information to Label object in `x`, `y`, `width` and `height` fields.** -- **Added `objectAngle`, `objectPitch`, `objectRoll`, `objectVelocityX/Y/Z` fields to Label object.** - -#### Windows specific -- Fixed problem with building on Windows 8.1 and 10. -- Added scripts for downloading freedoom2.wad and assembling Python packages. - -#### Rendering -- Fixed minor rendering issue in depth and labels buffers. -- Fixed order of color values in `RGB/BGR` modes of `ScreenFormat`. - ---- - -## Changes in 1.1.4 - -#### Automap -- Added `am_scale` CCMD. - -#### Scenarios -- Fixed `KILLCOUNT` GameVariable for ChainsawMarine in `defend_the_center` and `deathmatch` scenarios. - -#### Python specific -- **Ported Python binding to pybind11 as a replacement for Boost.Python.** -- Fixed problems with `pip install` detecting Python interpreter, includes and libraries from different Python versions. - ---- - -## Changes in 1.1.3 - -#### Rendering options -- Added `setRenderScreenFlashes` and `setRenderAllFrames` methods. -- Added `viz_ignore_render_mode` CVAR which disables overriding rendering settings. - -#### GameVariables -- **Added `ANGLE`, `PITCH`, `ROLL`, `VELOCITY_X`/`Y`/`Z` GameVariables.** - -#### Missing config keys -- Added support for `DEATHCOUNT`, `USER31` - `USER60`, `PLAYER_NUMBER`, `PLAYER_COUNT`, `PLAYER1_FRAGCOUNT` - `PLAYER16_FRAGCOUNT`, `POSITION_X`/`Y`/`Z` GameVariables in the config file. -- Added support for `ALTATTACK` Button in the config file. - -#### Java specific -- Fixed `makeAction`. -- Added missing `POSITION_X`/`Y`/`Z` Game Variables. - -#### Python specific -- Added manual GIL management for better performance when used with Python threads. - -#### Windows specific -- Fixed building for Windows 10. - ---- - -## Changes in 1.1.2 - -#### Multiplayer -- Added `isMultiplayerGame` method. -- Added `viz_respawn_delay` CVAR, which allows controlling the delay between respawns in multiplayer game. -- Added `viz_spectator` CVAR which allows connecting to multiplayer game as a spectator. -- **Maximum number of connected players raised to 16, `PLAYER9_FRAGCOUNT` - `PLAYER16_FRAGCOUNT` GameVariables added.** - -#### Missing methods -- Added `isRunning`, `isDepthBufferEnabled`, `isLabelsBufferEnabled` and `isAutomapBufferEnabled` missing methods to Python and Lua bindings. - ---- - -## Changes in 1.1.1 - -#### GameState -- Added `tic` field. -- `GameVariable.DEATHCOUNT` fixed. - -#### Lua specific -- Fixed crash when calling `getState` in a terminal state. - -#### Python specific -- Fixed minor memory leak -- Fixed crash when calling `getState` in a terminal state. - ---- - -## Changes in 1.1.0 - -#### Buffers - -- Depth buffer is now a separate buffer in state and `ScreenFormat` values with it were removed - `is/setDepthBufferEnabled` added. -- Added in frame actors labeling feature -`is/setLabelsBufferEnabled` added. -- Added buffer with in game automap - `is/setAutomapBufferEnabled`, `setAutomapMode`, `setAutomapRoate`, `setAutomapRenderTextures`, `AutomapMode` enum added. - - -#### GameState - -- `getState` will now return `nullptr/null/None` if game is in the terminal state. -- `imageBuffer` renamed to `screenBuffer`. -- Added `depthBuffer`, `labelsBuffer` and `automapBuffer` and `labels` fields. - - -#### Rendering options - -- The option to use minimal hud instead of default full hud - `setRenderMinimalHud` added. -- The option to enable/disable effects that use sprites - `setRenderEffectsSprites` added. -- The option to enable/disable in game messages independently of the console output - `setRenderMessages` added. -- The option to enable/disable corpses - `setRenderCorpses` added. - - -#### Episode recording and replaying - -- The option to record and replay episodes, based on adapted ZDoom's demo mechanism - -recording `filePath` argument added to `newEpisode`, `replayEpisode` added. -- The option to replay demo from other players' perspective. - - -#### Ticrate - -- The option to set number of tics executed per second in ASNYC Modes. -- New `ticrate` optional argument in `doomTicsToMs`, `msToDoomTics`. -- `doomTicsToSec` and `secToDoomTics` added. - - -#### Paths - -- **Paths in config files are now relative to config file.** -- setting **vizdoom_path** and **doom_game_path** is no longer needed - they default to location(installation) of vizdoom.so. - - -#### Others - -- ZDoom engine updated to 2.8.1. -- **Basic support for multiplayer in PLAYER and SPECTATOR Modes.** -- Improved exceptions messages. -- Bugs associated with paths handling were fixed. -- Many minor bugs were fixed. -- Possibility to change scenario wad during runtime (only first map from WAD file). -- Added `viz_debug` CVAR to control some diagnostic messages. - - -#### C++ specific - -- A lot of overloaded methods turned into a methods with default arguments. -- `getState()` now returns `GameStatePtr (std::shared_ptr)` instead of `GameState`. -- Buffers are now copied. -- GameState's buffer has now `ImageBufferPtr (std::shared_ptr)` type - `Buffer (std::vector)`. -- GameState's gameVariables are now vector of doubles instead of ints. - - -#### Lua specific - -- Lua binding added. -- Support for LuaRocks installation for Linux and MacOS. - - -#### Java specific - -- GameState buffers type changed to byte[]. -- Performance improved. -- Java exceptions handling fixed. -- Few functions fixed. - - -#### Python specific - -- Consts added to Python. -- Aliases for `doom_fixed_to_double` - `doom_fixed_to_float` added. -- Support for pip installation for Linux and MacOS. diff --git a/doc/DoomGame.md b/doc/DoomGame.md deleted file mode 100644 index e8ee8859b..000000000 --- a/doc/DoomGame.md +++ /dev/null @@ -1,1619 +0,0 @@ -# DoomGame - -## [Flow control methods](#flow) -* [init](#init) -* [close](#close) -* [newEpisode](#newEpisode) -* [replayEpisode](#replayEpisode) -* [isRunning](#isRunning) -* [isMultiplayerGame](#isMultiplayerGame) -* [isRecordingEpisode](#isRecordingEpisode) -* [isReplayingEpisode](#isReplayingEpisode) -* [setAction](#setAction) -* [advanceAction](#advanceAction) -* [makeAction](#makeAction) -* [isNewEpisode](#isNewEpisode) -* [isEpisodeFinished](#isEpisodeFinished) -* [isPlayerDead](#isPlayerDead) -* [respawnPlayer](#respawnPlayer) -* [sendGameCommand](#sendGameCommand) -* [getState](#getState) -* [getServerState](#getServerState) -* [getLastAction](#getLastAction) -* [getEpisodeTime](#getEpisodeTime) -* [save](#save) -* [load](#load) - -## [Buttons settings methods](#buttons) -* [getAvailableButtons](#getAvailableButtons) -* [setAvailableButtons](#setAvailableButtons) -* [addAvailableButton](#addAvailableButton) -* [clearAvailableButtons](#clearAvailableButtons) -* [getAvailableButtonsSize](#getAvailableButtonsSize) -* [setButtonMaxValue](#setButtonMaxValue) -* [getButtonMaxValue](#getButtonMaxValue) -* [getButton](#getButton) - -## [GameVariables methods](#vars) -* [getAvailableGameVariables](#getAvailableGameVariables) -* [setAvailableGameVariables](#setAvailableGameVariables) -* [addAvailableGameVariable](#addAvailableGameVariable) -* [clearAvailableGameVariables](#clearAvailableGameVariables) -* [getAvailableGameVariablesSize](#getAvailableGameVariablesSize) -* [getGameVariable](#getGameVariable) - -## [Game Arguments methods](#args) -* [addGameArgs](#addGameArgs) -* [clearGameArgs](#clearGameArgs) - -## [Rewards methods](#rewards) -* [getLivingReward](#getLivingReward) -* [setLivingReward](#setLivingReward) -* [getDeathPenalty](#getDeathPenalty) -* [setDeathPenalty](#setDeathPenalty) -* [getLastReward](#getLastReward) -* [getTotalReward](#getTotalReward) - -## [General game configuration methods](#settings) -* [loadConfig](#loadConfig) -* [getMode](#getMode) -* [setMode](#setMode) -* [getTicrate](#getTicrate) -* [setTicrate](#setTicrate) -* [setViZDoomPath](#setViZDoomPath) -* [setDoomGamePath](#setDoomGamePath) -* [setDoomScenarioPath](#setDoomScenarioPath) -* [setDoomMap](#setDoomMap) -* [setDoomSkill](#setDoomSkill) -* [setDoomConfigPath](#setDoomConfigPath) -* [getSeed](#getSeed) -* [setSeed](#setSeed) -* [getEpisodeStartTime](#getEpisodeStartTime) -* [setEpisodeStartTime](#setEpisodeStartTime) -* [getEpisodeTimeout](#getEpisodeTimeout) -* [setEpisodeTimeout](#setEpisodeTimeout) - -## [Output/rendering setting methods](#rendering) -* [setScreenResolution](#setScreenResolution) -* [getScreenFormat](#getScreenFormat) -* [setScreenFormat](#setScreenFormat) -* [isDepthBufferEnabled](#isDepthBufferEnabled) -* [setDepthBufferEnabled](#setDepthBufferEnabled) -* [isLabelsBufferEnabled](#isLabelsBufferEnabled) -* [setLabelsBufferEnabled](#setLabelsBufferEnabled) -* [isAutomapBufferEnabled](#isAutomapBufferEnabled) -* [setAutomapBufferEnabled](#setAutomapBufferEnabled) -* [setAutomapMode](#setAutomapMode) -* [setAutomapRotate](#setAutomapRotate) -* [setAutomapRenderTextures](#setAutomapRenderTextures) -* [setRenderHud](#setRenderHud) -* [setRenderMinimalHud](#setRenderMinimalHud) -* [setRenderWeapon](#setRenderWeapon) -* [setRenderCrosshair](#setRenderCrosshair) -* [setRenderDecals](#setRenderDecals) -* [setRenderParticles](#setRenderParticles) -* [setRenderEffectsSprites](#setRenderEffectsSprites) -* [setRenderMessages](#setRenderMessages) -* [setRenderCorpses](#setRenderCorpses) -* [setRenderScreenFlashes](#setRenderScreenFlashes) -* [setRenderAllFrames](#setRenderAllFrames) -* [setWindowVisible](#setWindowVisible) -* [setConsoleEnabled](#setConsoleEnabled) -* [setSoundEnabled](#setSoundEnabled) -* [getScreenWidth](#getScreenWidth) -* [getScreenHeight](#getScreenHeight) -* [getScreenChannels](#getScreenChannels) -* [getScreenPitch](#getScreenPitch) -* [getScreenSize](#getScreenSize) -* [isObjectsInfoEnabled](#isObjectsInfoEnabled) -* [setObjectsInfoEnabled](#setObjectsInfoEnabled) -* [isSectorsInfoEnabled](#isSectorsInfoEnabled) -* [setSectorsInfoEnabled](#setSectorsInfoEnabled) -* [isAudioBufferEnabled](#isAudioBufferEnabled) -* [setAudioBufferEnabled](#setAudioBufferEnabled) -* [getAudioSamplingFreq](#getAudioSamplingFreq) -* [setAudioSamplingFreq](#setAudioSamplingFreq) -* [getAudioBufferSize](#getAudioBufferSize) -* [setAudioBufferSize](#setAudioBufferSize) - - -## Flow control methods: - ---- -### `init` - -| C++ | `bool init()` | -| :-- | :-- | -| Python | `bool init()` | - -Initializes ViZDoom game instance and starts a new episode. -After calling this method, the first state from a new episode will be available. -Some configuration options cannot be changed after calling this method. -Init returns true when the game was started properly and false otherwise. - - ---- -### `close` - -| C++ | `void close()` | -| :-- | :-- | -| Python | `void close()` | - -Closes ViZDoom game instance. -It is automatically invoked by the destructor. -The game can be initialized again after being closed. - - ---- -### `newEpisode` - -| C++ | `void newEpisode(std::string recordFilePath = "")` | -| :-- | :-- | -| Python | `void new_episode(str recordFilePath = "")` | - -Changed in 1.1.0 - -Initializes a new episode. The state of an environment is completely restarted (all variables and rewards are reset to their initial values). -After calling this method, the first state from the new episode will be available. -If the `recordFilePath` is not empty, the new episode will be recorded to this file (as a Doom lump). - -In a multiplayer game, the host can call this method to finish the game. -Then the rest of the players must also call this method to start a new episode. - - ---- -### `replayEpisode` - -| C++ | `void replayEpisode(std::string filePath, unsigned int player = 0)` | -| :-- | :-- | -| Python | `void replay_episode(str filePath, int player = 0)` | - -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. -After calling this method, the first state from the replay will be available. -All rewards, variables, and states are available during the replaying episode. - -See also: -- [examples/python/record_episodes.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/record_episodes.py) -- [examples/python/record_multiplayer.py](https://github.com/mwydmuch/ViZDoom/tree/master/examples/python/record_multiplayer.py) - - ---- -### `isRunning` - -| C++ | `bool isRunning()` | -| :-- | :-- | -| Python | `bool is_running()` | - -Checks if the ViZDoom game instance is running. - - ---- -### `isMultiplayerGame` - -| C++ | `bool isMultiplayerGame()` | -| :-- | :-- | -| Python | `bool is_multiplayer_game()` | - -Added in 1.1.2 - -Checks if the game is in multiplayer mode. - - ---- -### `isRecordingEpisode` - -| C++ | `bool isRecordingEpisode()` | -| :-- | :-- | -| Python | `bool is_recording_episode()` | - -Added in 1.1.5 - -Checks if the game is in recording mode. - - ---- -### `isReplayingEpisode` - -| C++ | `bool isReplayingEpisode()` | -| :-- | :-- | -| Python | `bool is_replaying_episode()` | - -Added in 1.1.5 - -Checks if the game is in replaying mode. - - ---- -### `setAction` - -| C++ | `void setAction(std::vector const &actions)` | -| :-- | :-- | -| Python | `void set_action(list actions)` | - -Sets the player's action for the next tics. -Each value corresponds to a button specified with [`addAvailableButton`](#addAvailableButton) method -or in the configuration file (in order of appearance). - - ---- -### `advanceAction` - -| C++ | `void advanceAction(unsigned int tics = 1, bool updateState = true)` | -| :-- | :-- | -| Python | `void advance_action(int tics = 1, bool updateState = True)` | - -Processes a 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. - - ---- -### `makeAction` - -| C++ | `double makeAction(std::vector const &actions, unsigned int tics = 1)` | -| :-- | :-- | -| Python | `float make_action(list actions, int tics = 1)` | - -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, -updates the state and calculates a new reward, which is returned. - - ---- -### `isNewEpisode` - -| C++ | `bool isNewEpisode()` | -| :-- | :-- | -| Python | `bool is_new_episode()` | - -Returns true if the current episode is in the initial state - the first state, no actions were performed yet. - - ---- -### `isEpisodeFinished` - -| C++ | `bool isEpisodeFinished()` | -| :-- | :-- | -| Python | `bool is_episode_finished()` | - -Returns true if the current episode is in the terminal state (is finished). -[`makeAction`](#makeAction) and [`advanceAction`](#advanceAction) methods will take no effect after this point (unless [`newEpisode`](#newEpisode) method is called). - - ---- -### `isPlayerDead` - -| C++ | `bool isPlayerDead()` | -| :-- | :-- | -| Python | `bool is_player_dead()` | - -Returns true if the player is dead. -In singleplayer, the player's death is equivalent to the end of the episode. -In multiplayer, when the player is dead [`respawnPlayer`](#respawnPlayer) method can be called. - - ---- -### `respawnPlayer` - -| C++ | `void respawnPlayer()` | -| :-- | :-- | -| Python | `void respawn_player()` | - -This method respawns the player after death in multiplayer mode. -After calling this method, the first state after the respawn will be available. - -See also: -- [`isMultiplayerGame`](#isMultiplayerGame) - - ---- -### `sendGameCommand` - -| C++ | `void sendGameCommand(std::string cmd)` | -| :-- | :-- | -| Python | `void send_game_command(str cmd)` | - -Sends the command to Doom console. It can be used for controlling the game, changing settings, cheats, etc. -Some commands will be blocked in some modes. - -See also: -- [ZDoom Wiki: Console](http://zdoom.org/wiki/Console) -- [ZDoom Wiki: CVARs (console variables)](https://zdoom.org/wiki/CVARs) -- [ZDoom Wiki: CCMD (console commands)](https://zdoom.org/wiki/CCMDs) - - ---- -### `getState` - -| C++ | `GameStatePtr (std::shared_ptr) GameState getState()` | -| :-- | :-- | -| Python | `GameState get_state()` | - -Changed in 1.1.0 - -Returns [`GameState`](Types.md#gamestate) object with the current game state. -If the current episode is finished, `nullptr/null/None` will be returned. - -See also: -- [`Types: GameState`](Types.md#gamestate) - - ---- -### `getServerState` - -| C++ | `ServerStatePtr (std::shared_ptr) ServerState getServerState()` | -| :-- | :-- | -| Python | `ServerState get_state_state()` | - -Added in 1.1.6 - -Returns [`ServerState`](Types.md#serverstate) object with the current server state. - -See also: -- [`Types: ServerState`](Types.md#serverstate) - - ---- -### `getLastAction` - -| C++ | `std::vector getLastAction()` | -| :-- | :-- | -| Python | `list get_last_action()` | - -Returns the last action performed. -Each value corresponds to a button added with `[addAvailableButton](#addAvailableButton)` (in order of appearance). -Most useful in `SPECTATOR` mode. - - ---- -### `getEpisodeTime` - -| C++ | `unsigned int getEpisodeTime()` | -| :-- | :-- | -| Python | `int get_episode_time()` | - -Returns number of current episode tic. - - ---- -### `save` - -| C++ | `void save(std::string filePath)` | -| :-- | :-- | -| Python | `void save(str filePath)` | - -Added in 1.1.9 - -Saves a game's internal state to the file using ZDoom's save game functionality. - - ---- -### `load` - -| C++ | `void load(std::string filePath)` | -| :-- | :-- | -| Python | `void load(str filePath)` | - -Added in 1.1.9 - -Loads a game's internal state from the file using ZDoom's load game functionality. -A new state is available after loading. -Loading the game state does not reset the current episode state, -tic counter/time and total reward state keep their values. - - -## Buttons settings methods - ---- -### `getAvailableButtons` - -| C++ | `std::vector