From c3d555287e11c0b286e5c42b5748e85011d1164d Mon Sep 17 00:00:00 2001 From: Marek Wydmuch Date: Wed, 20 Sep 2023 19:16:54 +0200 Subject: [PATCH 1/6] Add DoomGame.setGameArgs/set_game_args method --- docs/api/cpp/doomGame.md | 33 ++++++++++++++++++----- docs/api/python/doomGame.md | 1 + include/ViZDoomGame.h | 1 + src/lib/ViZDoomGame.cpp | 5 ++++ src/lib_python/ViZDoomMethodsDocstrings.h | 16 ++++++----- src/lib_python/ViZDoomPythonModule.cpp | 1 + 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/docs/api/cpp/doomGame.md b/docs/api/cpp/doomGame.md index 96cc0192c..016474405 100644 --- a/docs/api/cpp/doomGame.md +++ b/docs/api/cpp/doomGame.md @@ -316,7 +316,7 @@ See also: | :-- | :-- | | Python | `add_available_button(buttons: list | tuple[Button]) -> None` | -Set given list of `Button`s (e.g. `TURN_LEFT`, `MOVE_FORWARD`) as available `Buttons`. +Sets given list of `Button`s (e.g. `TURN_LEFT`, `MOVE_FORWARD`) as available `Buttons`. Config key: `availableButtons/available_buttons` (list) @@ -333,7 +333,7 @@ See also: | :-- | :-- | | Python | `add_available_button(button: Button, maxValue: float = 0) -> None` | -Add [`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. +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. Config key: `availableButtons/available_buttons` (list) @@ -437,7 +437,7 @@ See also: | :-- | :-- | | Python | `set_available_game_variables(variables: list | tuple[GameVariables]) -> None` | -Set 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` method. Config key: `availableGameVariables/available_game_variables` (list) @@ -509,14 +509,35 @@ See also: ## Game Arguments methods + +### `setGameArgs` + +| C++ | `void setGameArgs(std::string args)` | +| :-- | :-- | +| Python | `set_game_args(args: str) -> None` | + +Added in 1.3.0 + +Sets custom arguments that will be passed to ViZDoom process during initialization. +It is useful for changing additional game settings. +Using this method is equivalent to first calling [`clearGameArgs`](#cleargameargs) and then [`addGameArgs`](#addgameargs). + +Config key: `gameArgs/game_args` + +See also: +- [ZDoom Wiki: Command line parameters](http://zdoom.org/wiki/Command_line_parameters) +- [ZDoom Wiki: CVARs (Console Variables)](http://zdoom.org/wiki/CVARS) + + +--- ### `addGameArgs` | C++ | `void addGameArgs(std::string args)` | | :-- | :-- | | Python | `add_game_args(args: str) -> None` | -Adds a custom argument that will be passed to ViZDoom process during initialization. -Useful for changing additional game settings. +Adds custom arguments that will be passed to ViZDoom process during initialization. +It is useful for changing additional game settings. Config key: `gameArgs/game_args` @@ -532,7 +553,7 @@ See also: | :-- | :-- | | Python | `clear_game_args() -> None` | -Clears all arguments previously added with [`addGameArgs`](#addgameargs) method. +Clears all arguments previously added with [`setGameArgs`](#setgameargs) or/and [`addGameArgs`](#addgameargs) methods. ## Reward methods diff --git a/docs/api/python/doomGame.md b/docs/api/python/doomGame.md index d06055cea..6f25909c1 100644 --- a/docs/api/python/doomGame.md +++ b/docs/api/python/doomGame.md @@ -62,6 +62,7 @@ DoomGame is the main object of the ViZDoom library, representing a single instan ## Game Arguments methods ```{eval-rst} +.. autofunction:: vizdoom.DoomGame.set_game_args .. autofunction:: vizdoom.DoomGame.add_game_args .. autofunction:: vizdoom.DoomGame.clear_game_args ``` diff --git a/include/ViZDoomGame.h b/include/ViZDoomGame.h index f1e1d343d..e8dd5ca7d 100644 --- a/include/ViZDoomGame.h +++ b/include/ViZDoomGame.h @@ -104,6 +104,7 @@ namespace vizdoom { /* GameArgs getters and setters */ /*------------------------------------------------------------------------------------------------------------*/ + void setGameArgs(std::string args); void addGameArgs(std::string args); void clearGameArgs(); diff --git a/src/lib/ViZDoomGame.cpp b/src/lib/ViZDoomGame.cpp index 8ff421e4f..a933cc729 100644 --- a/src/lib/ViZDoomGame.cpp +++ b/src/lib/ViZDoomGame.cpp @@ -419,6 +419,11 @@ namespace vizdoom { return this->availableGameVariables.size(); } + void DoomGame::setGameArgs(std::string args) { + this->clearGameArgs(); + this->addGameArgs(args); + } + void DoomGame::addGameArgs(std::string args) { if (args.length() != 0) { std::vector _args; diff --git a/src/lib_python/ViZDoomMethodsDocstrings.h b/src/lib_python/ViZDoomMethodsDocstrings.h index 0155a0ab6..5cc8f9430 100644 --- a/src/lib_python/ViZDoomMethodsDocstrings.h +++ b/src/lib_python/ViZDoomMethodsDocstrings.h @@ -88,9 +88,9 @@ tic counter/time and total reward state keep their values.)DOCSTRING"; const char *getAvailableButtons = R"DOCSTRING(Returns the list of available `Buttons`.)DOCSTRING"; - const char *setAvailableButtons = R"DOCSTRING(Set given list of `Button`s (e.g. `TURN_LEFT`, `MOVE_FORWARD`) as available `Buttons`.)DOCSTRING"; + const char *setAvailableButtons = R"DOCSTRING(Sets given list of `Button`s (e.g. `TURN_LEFT`, `MOVE_FORWARD`) as available `Buttons`.)DOCSTRING"; - const char *addAvailableButton = R"DOCSTRING(Add `Button` to available `Buttons` and sets the maximum allowed, absolute value for the specified button. + const char *addAvailableButton = R"DOCSTRING(Adds `Button` 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.)DOCSTRING"; const char *clearAvailableButtons = R"DOCSTRING(Clears all available `Buttons` added so far.)DOCSTRING"; @@ -108,7 +108,7 @@ The constraints limit applies in all Modes.)DOCSTRING"; const char *getAvailableGameVariables = R"DOCSTRING(Returns the list of available `GameVariables`.)DOCSTRING"; - const char *setAvailableGameVariables = R"DOCSTRING(Set list of `GameVariable` returned by `getState` method.)DOCSTRING"; + const char *setAvailableGameVariables = R"DOCSTRING(Sets list of `GameVariable` returned by `getState` method.)DOCSTRING"; const char *addAvailableGameVariable = R"DOCSTRING(Adds the specified `GameVariable` returned by `getState` method.)DOCSTRING"; @@ -120,10 +120,14 @@ The constraints limit applies in all Modes.)DOCSTRING"; 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`.)DOCSTRING"; - const char *addGameArgs = R"DOCSTRING(Adds a custom argument that will be passed to ViZDoom process during initialization. -Useful for changing additional game settings.)DOCSTRING"; + const char *setGameArgs = R"DOCSTRING(Sets custom arguments that will be passed to ViZDoom process during initialization. +It is useful for changing additional game settings. +Using this method is equivalent to first calling `clearGameArgs`.)DOCSTRING"; - const char *clearGameArgs = R"DOCSTRING(Clears all arguments previously added with `addGameArgs` method.)DOCSTRING"; + const char *addGameArgs = R"DOCSTRING(Adds custom arguments that will be passed to ViZDoom process during initialization. +It is useful for changing additional game settings.)DOCSTRING"; + + const char *clearGameArgs = R"DOCSTRING(Clears all arguments previously added with `setGameArgs` methods.)DOCSTRING"; const char *getLivingReward = R"DOCSTRING(Returns the reward granted to the player after every tic.)DOCSTRING"; diff --git a/src/lib_python/ViZDoomPythonModule.cpp b/src/lib_python/ViZDoomPythonModule.cpp index 1e5bb5ea2..fefca23c6 100644 --- a/src/lib_python/ViZDoomPythonModule.cpp +++ b/src/lib_python/ViZDoomPythonModule.cpp @@ -670,6 +670,7 @@ PYBIND11_MODULE(vizdoom, vz){ CLASS_FUNC_2_PYT_WITH_ARGS("set_button_max_value", DoomGamePython::setButtonMaxValue, pyb::arg("button"), pyb::arg("max_value")) CLASS_FUNC_2_PYT_WITH_ARGS("get_button_max_value", DoomGamePython::getButtonMaxValue, pyb::arg("button")) + CLASS_FUNC_2_PYT_WITH_ARGS("set_game_args", DoomGamePython::setGameArgs, pyb::arg("args")) CLASS_FUNC_2_PYT_WITH_ARGS("add_game_args", DoomGamePython::addGameArgs, pyb::arg("args")) CLASS_FUNC_2_PYT("clear_game_args", DoomGamePython::clearGameArgs) From 3192306213ad94535a60e4a1234749b556d0b842 Mon Sep 17 00:00:00 2001 From: Marek Wydmuch Date: Sun, 24 Sep 2023 23:03:43 +0200 Subject: [PATCH 2/6] Add DoomGame.getGameArgs/get_game_args method --- docs/api/cpp/doomGame.md | 17 ++++++++++++++--- include/ViZDoomGame.h | 1 + src/lib/ViZDoomController.cpp | 4 ++++ src/lib/ViZDoomController.h | 1 + src/lib/ViZDoomGame.cpp | 17 +++++++++++------ src/lib_python/ViZDoomMethodsDocstrings.h | 11 ++++++++--- src/lib_python/ViZDoomPythonModule.cpp | 1 + 7 files changed, 40 insertions(+), 12 deletions(-) diff --git a/docs/api/cpp/doomGame.md b/docs/api/cpp/doomGame.md index 016474405..4e452cc77 100644 --- a/docs/api/cpp/doomGame.md +++ b/docs/api/cpp/doomGame.md @@ -502,12 +502,12 @@ 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) -## Game Arguments methods +## Game arguments methods ### `setGameArgs` @@ -519,7 +519,8 @@ See also: Added in 1.3.0 Sets custom arguments that will be passed to ViZDoom process during initialization. -It is useful for changing additional game settings. +It is useful for changing additional game settings. +Use with caution, as in rare cases it may prevent the library from working properly. Using this method is equivalent to first calling [`clearGameArgs`](#cleargameargs) and then [`addGameArgs`](#addgameargs). Config key: `gameArgs/game_args` @@ -538,6 +539,7 @@ See also: Adds custom arguments that will be passed to ViZDoom process during initialization. It is useful for changing additional game settings. +Use with caution, as in rare cases it may prevent the library from working properly. Config key: `gameArgs/game_args` @@ -556,6 +558,15 @@ See also: Clears all arguments previously added with [`setGameArgs`](#setgameargs) or/and [`addGameArgs`](#addgameargs) methods. +### `getGameArgs` + +| C++ | `std::string getGameArgs()` | +| :-- | :-- | +| Python | `get_game_args() -> str` | + +Returns the additional arguments for ViZDoom process set with [`setGameArgs`](#setgameargs) or/and [`addGameArgs`](#addgameargs) methods. + + ## Reward methods diff --git a/include/ViZDoomGame.h b/include/ViZDoomGame.h index e8dd5ca7d..8c5ce4793 100644 --- a/include/ViZDoomGame.h +++ b/include/ViZDoomGame.h @@ -107,6 +107,7 @@ namespace vizdoom { void setGameArgs(std::string args); void addGameArgs(std::string args); void clearGameArgs(); + std::string getGameArgs(); /* Rewards getters and setters */ diff --git a/src/lib/ViZDoomController.cpp b/src/lib/ViZDoomController.cpp index 3120f75e4..bb2a09bff 100644 --- a/src/lib/ViZDoomController.cpp +++ b/src/lib/ViZDoomController.cpp @@ -366,6 +366,10 @@ namespace vizdoom { this->customArgs.clear(); } + std::vector DoomController::getCustomArgs() { + return this->customArgs; + } + bool DoomController::isDoomRunning() { return this->doomRunning; } std::string DoomController::getMap() { return this->map; } diff --git a/src/lib/ViZDoomController.h b/src/lib/ViZDoomController.h index 2591c9cba..367dd9ae0 100644 --- a/src/lib/ViZDoomController.h +++ b/src/lib/ViZDoomController.h @@ -164,6 +164,7 @@ namespace vizdoom { void addCustomArg(std::string arg); void clearCustomArgs(); + std::vector getCustomArgs(); /* Rendering getters and setters */ diff --git a/src/lib/ViZDoomGame.cpp b/src/lib/ViZDoomGame.cpp index a933cc729..45d7c1a6f 100644 --- a/src/lib/ViZDoomGame.cpp +++ b/src/lib/ViZDoomGame.cpp @@ -30,6 +30,7 @@ #include "ViZDoomUtilities.h" #include +#include #include // for reading the shared object/dll path #include @@ -37,8 +38,6 @@ namespace vizdoom { - - DoomGame::DoomGame() { this->running = false; this->lastReward = 0; @@ -426,10 +425,10 @@ namespace vizdoom { void DoomGame::addGameArgs(std::string args) { if (args.length() != 0) { - std::vector _args; - b::split(_args, args, b::is_any_of("\t\n ")); - for (unsigned int i = 0; i < _args.size(); ++i) { - if (_args[i].length() > 0) this->doomController->addCustomArg(_args[i]); + std::vector argsVec; + b::split(argsVec, args, b::is_any_of("\t\n ")); + for (auto &arg : argsVec){ + if (arg.length() > 0) this->doomController->addCustomArg(arg); } } } @@ -438,6 +437,12 @@ namespace vizdoom { this->doomController->clearCustomArgs(); } + std::string DoomGame::getGameArgs() { + auto argsVec = this->doomController->getCustomArgs(); + std::string argsStr = boost::algorithm::join(argsVec, " "); + return argsStr; + } + void DoomGame::sendGameCommand(std::string cmd) { if (!this->isRunning()) throw ViZDoomIsNotRunningException(); this->doomController->sendCommand(cmd); diff --git a/src/lib_python/ViZDoomMethodsDocstrings.h b/src/lib_python/ViZDoomMethodsDocstrings.h index 5cc8f9430..f68a9a83b 100644 --- a/src/lib_python/ViZDoomMethodsDocstrings.h +++ b/src/lib_python/ViZDoomMethodsDocstrings.h @@ -118,17 +118,22 @@ The constraints limit applies in all Modes.)DOCSTRING"; const char *getGameVariable = R"DOCSTRING(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`.)DOCSTRING"; +It could be used for e.g. shaping. Returns 0 in case of not finding given `GameVariable`. +git lo)DOCSTRING"; const char *setGameArgs = R"DOCSTRING(Sets custom arguments that will be passed to ViZDoom process during initialization. -It is useful for changing additional game settings. +It is useful for changing additional game settings. +Use with caution, as in rare cases it may prevent the library from working properly. Using this method is equivalent to first calling `clearGameArgs`.)DOCSTRING"; const char *addGameArgs = R"DOCSTRING(Adds custom arguments that will be passed to ViZDoom process during initialization. -It is useful for changing additional game settings.)DOCSTRING"; +It is useful for changing additional game settings. +Use with caution, as in rare cases it may prevent the library from working properly.)DOCSTRING"; const char *clearGameArgs = R"DOCSTRING(Clears all arguments previously added with `setGameArgs` methods.)DOCSTRING"; + const char *getGameArgs = R"DOCSTRING(Returns the additional arguments for ViZDoom process set with `setGameArgs` methods.)DOCSTRING"; + const char *getLivingReward = R"DOCSTRING(Returns the reward granted to the player after every tic.)DOCSTRING"; const char *setLivingReward = R"DOCSTRING(Sets the reward granted to the player after every tic. A negative value is also allowed. diff --git a/src/lib_python/ViZDoomPythonModule.cpp b/src/lib_python/ViZDoomPythonModule.cpp index fefca23c6..b2aa2b6ce 100644 --- a/src/lib_python/ViZDoomPythonModule.cpp +++ b/src/lib_python/ViZDoomPythonModule.cpp @@ -673,6 +673,7 @@ PYBIND11_MODULE(vizdoom, vz){ CLASS_FUNC_2_PYT_WITH_ARGS("set_game_args", DoomGamePython::setGameArgs, pyb::arg("args")) CLASS_FUNC_2_PYT_WITH_ARGS("add_game_args", DoomGamePython::addGameArgs, pyb::arg("args")) CLASS_FUNC_2_PYT("clear_game_args", DoomGamePython::clearGameArgs) + CLASS_FUNC_2_PYT("get_game_args", DoomGamePython::getGameArgs) CLASS_FUNC_2_PYT_WITH_ARGS("send_game_command", DoomGamePython::sendGameCommand, pyb::arg("cmd")) From c6f98519245acb6f595f51ba5336a48f1f2d657b Mon Sep 17 00:00:00 2001 From: Marek Wydmuch Date: Mon, 25 Sep 2023 21:11:30 +0200 Subject: [PATCH 3/6] Add a test for game args methods --- docs/api/cpp/utils.md | 10 +++---- .../create_python_docstrings_from_cpp_docs.py | 2 +- tests/test_game_args.py | 28 +++++++++++++++++++ 3 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 tests/test_game_args.py diff --git a/docs/api/cpp/utils.md b/docs/api/cpp/utils.md index 965db509e..136c8d2a2 100644 --- a/docs/api/cpp/utils.md +++ b/docs/api/cpp/utils.md @@ -13,7 +13,7 @@ The declarations of all the enums can be found in the `include/ViZDoomUtils.h` h | :-- | :-- | | Python | `doom_tics_to_ms(tics: float, ticrate: int = 35) -> float` | -Changed in 1.1 +Changed in 1.1.0 Calculates how many tics will be made during given number of milliseconds. @@ -25,7 +25,7 @@ Calculates how many tics will be made during given number of milliseconds. | :-- | :-- | | Python | `ms_to_doom_tics(ms: float, ticrate: int = 35) -> float` | -Changed in 1.1 +Changed in 1.1.0 Calculates the number of milliseconds that will pass during specified number of tics. @@ -37,7 +37,7 @@ Calculates the number of milliseconds that will pass during specified number of | :-- | :-- | | Python | `doom_tics_to_sec(tics: float, ticrate: int = 35) -> float` | -Added in 1.1 +Added in 1.1.0 Calculates how many tics will be made during given number of seconds. @@ -49,7 +49,7 @@ Calculates how many tics will be made during given number of seconds. | :-- | :-- | | Python | `sec_to_doom_tics(sec: float, ticrate: int = 35) -> float` | -Added in 1.1 +Added in 1.1.0 Calculates the number of seconds that will pass during specified number of tics. @@ -70,7 +70,7 @@ you may want to convert them to floating point numbers. See also: - [`Enums: User variables` in `GameVariables`](./enums.md#user-acs-variables) -Python aliases (added in 1.1): `doom_fixed_to_float(doomFixed: int | float) -> float` +Python aliases (added in 1.1.0): `doom_fixed_to_float(doomFixed: int | float) -> float` ## Button functions diff --git a/scripts/create_python_docstrings_from_cpp_docs.py b/scripts/create_python_docstrings_from_cpp_docs.py index 4df563354..d4812c5c4 100755 --- a/scripts/create_python_docstrings_from_cpp_docs.py +++ b/scripts/create_python_docstrings_from_cpp_docs.py @@ -18,7 +18,7 @@ LINES_TO_IGNORE_REGEXES = [ r"---", # Lines r"^\|.+\|$", # Tables - r"^See also:.*$", # See also + r"^See also: .*$", # See also r"- \[.*\]\(.*\)", # List of links starting with - r"\* \[.*\]\(.*\)", # List of links starting with * r"^Added in .*$", # Added in annotations diff --git a/tests/test_game_args.py b/tests/test_game_args.py new file mode 100644 index 000000000..a299c4809 --- /dev/null +++ b/tests/test_game_args.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +# Tests for ViZDoom enums and related methods. +# This test can be run as Python script or via PyTest + +import vizdoom as vzd + + +def test_game_args(): + + game = vzd.DoomGame() + game.set_window_visible(False) + + args1 = "-deathmatch +timelimit 1 +sv_spawnfarthest 1" + args2 = "+name ViZDoom +colorset 0" + args_all = args1 + " " + args2 + + game.set_game_args(args_all) + assert game.get_game_args() == args_all + + game.clear_game_args() + game.add_game_args(args1) + game.add_game_args(args2) + assert game.get_game_args() == args_all + + +if __name__ == "__main__": + test_game_args() From dfc14fbe7ae3e511c54c021c14762e207bbd9231 Mon Sep 17 00:00:00 2001 From: Marek Wydmuch Date: Sun, 5 Nov 2023 01:57:53 +0100 Subject: [PATCH 4/6] Add support for +win_x/y CVARs for Linux/MacOS, fix #149 --- src/vizdoom/src/posix/sdl/hardware.cpp | 3 +++ src/vizdoom/src/posix/sdl/sdlvideo.cpp | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vizdoom/src/posix/sdl/hardware.cpp b/src/vizdoom/src/posix/sdl/hardware.cpp index 607b91484..c99c54600 100644 --- a/src/vizdoom/src/posix/sdl/hardware.cpp +++ b/src/vizdoom/src/posix/sdl/hardware.cpp @@ -54,6 +54,9 @@ EXTERN_CVAR (Bool, fullscreen) EXTERN_CVAR (Float, vid_winscale) EXTERN_CVAR (Bool, viz_noxserver) +CVAR(Int, win_x, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CVAR(Int, win_y, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) + IVideo *Video; void I_ShutdownGraphics () diff --git a/src/vizdoom/src/posix/sdl/sdlvideo.cpp b/src/vizdoom/src/posix/sdl/sdlvideo.cpp index a40a876b0..ad8dd76fe 100644 --- a/src/vizdoom/src/posix/sdl/sdlvideo.cpp +++ b/src/vizdoom/src/posix/sdl/sdlvideo.cpp @@ -105,6 +105,8 @@ EXTERN_CVAR (Bool, vid_vsync) //VIZDOOM_CODE EXTERN_CVAR (Bool, viz_window_hidden) EXTERN_CVAR (Bool, viz_noxserver) +EXTERN_CVAR (Int, win_x) +EXTERN_CVAR (Int, win_y) // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -375,7 +377,8 @@ SDLFB::SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin) if(!(*viz_noxserver)) { Screen = SDL_CreateWindow (caption, - SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), + (win_x <= 0) ? SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter) : win_x, + (win_x <= 0) ? SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter) : win_y, width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) | (*viz_window_hidden ? SDL_WINDOW_HIDDEN : SDL_WINDOW_RESIZABLE)); From 2eb903bb1b6eca7bf86c531eb5a18fdf7b7d9456 Mon Sep 17 00:00:00 2001 From: Marek Wydmuch Date: Sun, 5 Nov 2023 02:06:40 +0100 Subject: [PATCH 5/6] Update the examples --- examples/python/README.md | 16 ++++++--- examples/python/audio_buffer.py | 10 +++--- .../python/{automap.py => automap_buffer.py} | 4 +-- examples/python/basic.py | 4 +-- examples/python/buffers.py | 4 +-- examples/python/cig_multiplayer.py | 4 +-- examples/python/cig_multiplayer_bots.py | 10 ++---- examples/python/cig_singleplayer.py | 2 +- examples/python/cig_singleplayer_host.py | 2 +- examples/python/delta_buttons.py | 4 +-- examples/python/labels_buffer.py | 5 +-- examples/python/learning_pytorch.py | 2 +- examples/python/multiple_instances.py | 19 ++++++++--- examples/python/multiple_instances_advance.py | 34 ++++++++++++------- examples/python/objects_and_sectors.py | 4 +-- examples/python/pyoblige.py | 2 +- examples/python/record_episodes.py | 10 +++--- examples/python/scenarios.py | 4 +-- examples/python/seed.py | 4 +-- examples/python/shaping.py | 4 +-- examples/python/spectator.py | 4 +-- 21 files changed, 88 insertions(+), 64 deletions(-) rename examples/python/{automap.py => automap_buffer.py} (97%) diff --git a/examples/python/README.md b/examples/python/README.md index 69d308b67..a6937db5d 100644 --- a/examples/python/README.md +++ b/examples/python/README.md @@ -7,6 +7,9 @@ For the examples to work properly you need to install ViZDoom or create a link t ### [audio_buffer.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/audio_buffer.py) Demonstrates how to use the audio buffer. +### [automap_buffer.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/automap_buffer.py) +Demonstrates how to use the automap buffer. + ### [basic.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/basic.py) Demonstrates how to use the most basic features of the environment. It configures the engine, and makes the agent perform random actions. It also prints the current state and the reward earned with every action. @@ -25,14 +28,14 @@ Demonstrates how to configure and play the singleplayer game for CIG competition ### [delta_buttons.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/delta_buttons.py) Shows how delta buttons work (they may take values other than 0 and 1 and can be used for precise movement). -### [format.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/format.py) -Presents different formats of the screen buffer. [OpenCV](http://opencv.org/) is used to display the images. - ### [fps_test.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/fps_test.py) Tests the performance of the environment in frames per second. It should give you some idea how fast ViZDoom works on your hardware. -### [labels.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/labels.py) -Contains an example of how to implement basic Q-learning on the interface within PyTorch. +### [gymnasium_wrapper.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/gymnasium_wrapper.py) +Shows how to use ViZDoom Gymnasium wrapper. + +### [labels_buffer.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/labels_buffer.py) +Demonstrates how to use the labels buffer. ### [learning_pytorch.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/learning_pytorch.py), [learning_pytorch_test.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/learning_pytorch_test.py) Contains an example of how to implement basic Q-learning on the interface within PyTorch. @@ -58,6 +61,9 @@ Demonstrates how to record an episode and replay it. ### [record_multiplayer.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/record_multiplayer.py) Demonstrates how to record the multiplayer game and replay it. +### [save_load_game.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/save_load_game.py) +Demonstrates how to use save and load functionality build into the game engine. + ### [scenarios.py](https://github.com/mwydmuch/ViZDoom/blob/master/examples/python/scenarios.py) Presents different scenarios that come with ViZDoom environment. diff --git a/examples/python/audio_buffer.py b/examples/python/audio_buffer.py index 3a8f3c2a7..8204a6c6a 100755 --- a/examples/python/audio_buffer.py +++ b/examples/python/audio_buffer.py @@ -53,7 +53,7 @@ print( "[ERROR] Could not launch ViZDoom. If you see an error above about BiquadFilter and gain,\n" " try setting game.add_game_args('+snd_efx 0'). If that fails, see\n" - " https://github.com/mwydmuch/ViZDoom/pull/486" + " https://github.com/Farama-Foundation/ViZDoom/pull/486" ) exit(1) @@ -63,8 +63,10 @@ episodes = 3 audio_slices = [] for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") + game.new_episode() + while not game.is_episode_finished(): # Gets the state @@ -87,10 +89,10 @@ if audio_data.max() == 0: print( "[WARNING] Audio buffers were full of silence. This is a common bug on e.g. Ubuntu 20.04\n" - " See https://github.com/mwydmuch/ViZDoom/pull/486\n" + " See https://github.com/Farama-Foundation/ViZDoom/pull/486\n" " Two possible fixes:\n" " 1) Try setting game.add_game_args('+snd_efx 0'). This my disable some audio effects\n" - " 2) Try installing a newer version of OpenAL Soft library, see https://github.com/mwydmuch/ViZDoom/pull/486#issuecomment-889389185" + " 2) Try installing a newer version of OpenAL Soft library, see https://github.com/Farama-Foundation/ViZDoom/pull/486#issuecomment-889389185" ) # Save audio file wavfile.write("basic_sounds.wav", 22050, np.concatenate(audio_slices, axis=0)) diff --git a/examples/python/automap.py b/examples/python/automap_buffer.py similarity index 97% rename from examples/python/automap.py rename to examples/python/automap_buffer.py index a47b38e36..a586ba0eb 100755 --- a/examples/python/automap.py +++ b/examples/python/automap_buffer.py @@ -68,7 +68,7 @@ sleep_time = 28 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") seen_in_this_episode = set() # Not needed for the first episode but the loop is nicer. @@ -87,7 +87,7 @@ game.make_action(choice(actions)) - print("State #" + str(state.number)) + print(f"State #{state.number}") print( "Player position X:", state.game_variables[0], diff --git a/examples/python/basic.py b/examples/python/basic.py index a45015f50..780236f06 100755 --- a/examples/python/basic.py +++ b/examples/python/basic.py @@ -139,7 +139,7 @@ sleep_time = 1.0 / vzd.DEFAULT_TICRATE # = 0.028 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") # Starts a new episode. It is not needed right after init() but it doesn't cost much. At least the loop is nicer. game.new_episode() @@ -187,7 +187,7 @@ # r = game.get_last_reward() # Prints state's game variables and reward. - print("State #" + str(n)) + print(f"State #{n}") print("Game variables:", vars) print("Reward:", r) print("=====================") diff --git a/examples/python/buffers.py b/examples/python/buffers.py index 406b419c4..2ad199d68 100755 --- a/examples/python/buffers.py +++ b/examples/python/buffers.py @@ -89,7 +89,7 @@ sleep_time = 0.028 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") # Not needed for the first episode but the loop is nicer. game.new_episode() @@ -126,7 +126,7 @@ game.make_action(choice(actions)) - print("State #" + str(state.number)) + print(f"State #{state.number}") print("=====================") print("Episode finished!") diff --git a/examples/python/cig_multiplayer.py b/examples/python/cig_multiplayer.py index 8630c591e..4879811b3 100755 --- a/examples/python/cig_multiplayer.py +++ b/examples/python/cig_multiplayer.py @@ -60,11 +60,11 @@ frags = game.get_game_variable(vzd.GameVariable.FRAGCOUNT) if frags != last_frags: last_frags = frags - print("Player " + str(player_number) + " has " + str(frags) + " frags.") + print(f"Player {player_number} has {frags} frags.") # Check if player is dead if game.is_player_dead(): - print("Player " + str(player_number) + " died.") + print(f"Player {player_number} died.") # Use this to respawn immediately after death, new state will be available. game.respawn_player() diff --git a/examples/python/cig_multiplayer_bots.py b/examples/python/cig_multiplayer_bots.py index 6eadef21f..34d2bd97d 100755 --- a/examples/python/cig_multiplayer_bots.py +++ b/examples/python/cig_multiplayer_bots.py @@ -57,7 +57,7 @@ for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") # Add specific number of bots # (file examples/bots.cfg must be placed in the same directory as the Doom executable file, @@ -79,7 +79,7 @@ frags = game.get_game_variable(vzd.GameVariable.FRAGCOUNT) if frags != last_frags: last_frags = frags - print("Player has " + str(frags) + " frags.") + print(f"Player has {frags} frags.") # Check if player is dead if game.is_player_dead(): @@ -94,11 +94,7 @@ server_state = game.get_server_state() for i in range(len(server_state.players_in_game)): if server_state.players_in_game[i]: - print( - server_state.players_names[i] - + ": " - + str(server_state.players_frags[i]) - ) + print(f"{server_state.players_names[i]}: {server_state.players_frags[i]}") print("************************") # Starts a new episode. All players have to call new_episode() in multiplayer mode. diff --git a/examples/python/cig_singleplayer.py b/examples/python/cig_singleplayer.py index ca80cae46..a68790c07 100755 --- a/examples/python/cig_singleplayer.py +++ b/examples/python/cig_singleplayer.py @@ -52,7 +52,7 @@ # Use this to respawn immediately after death, new state will be available. game.respawn_player() - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Game variables: ", state.game_variables) print("Action:", last_action) print("Reward:", reward) diff --git a/examples/python/cig_singleplayer_host.py b/examples/python/cig_singleplayer_host.py index 161977924..b753bf4c4 100755 --- a/examples/python/cig_singleplayer_host.py +++ b/examples/python/cig_singleplayer_host.py @@ -90,7 +90,7 @@ last_action = game.get_last_action() reward = game.get_last_reward() - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Game variables: ", state.game_variables) print("Action:", last_action) print("Reward:", reward) diff --git a/examples/python/delta_buttons.py b/examples/python/delta_buttons.py index f8bf8322e..c3666deea 100755 --- a/examples/python/delta_buttons.py +++ b/examples/python/delta_buttons.py @@ -40,7 +40,7 @@ sleep_time = 0.028 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") game.new_episode() @@ -57,7 +57,7 @@ if not time % 50: action[3] = -action[3] - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Action made: ", action) print("=====================") diff --git a/examples/python/labels_buffer.py b/examples/python/labels_buffer.py index bda7a2be7..fdece48d3 100755 --- a/examples/python/labels_buffer.py +++ b/examples/python/labels_buffer.py @@ -101,7 +101,8 @@ def color_labels(labels): return tmp for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") + seen_in_this_episode = set() # Not needed for the first episode but the loop is nicer. @@ -147,7 +148,7 @@ def color_labels(labels): # Make random action game.make_action(choice(actions)) - print("State #" + str(state.number)) + print(f"State #{state.number}") print( "Player position: x:", state.game_variables[0], diff --git a/examples/python/learning_pytorch.py b/examples/python/learning_pytorch.py index eaf890bd6..1a4e0035a 100755 --- a/examples/python/learning_pytorch.py +++ b/examples/python/learning_pytorch.py @@ -113,7 +113,7 @@ def run(game, agent, actions, num_epochs, frame_repeat, steps_per_epoch=2000): game.new_episode() train_scores = [] global_step = 0 - print("\nEpoch #" + str(epoch + 1)) + print(f"\nEpoch #{epoch + 1}") for _ in trange(steps_per_epoch, leave=False): state = preprocess(game.get_state().screen_buffer) diff --git a/examples/python/multiple_instances.py b/examples/python/multiple_instances.py index 305ebfc8a..82cabec47 100755 --- a/examples/python/multiple_instances.py +++ b/examples/python/multiple_instances.py @@ -11,22 +11,27 @@ # Run this many episodes episodes = 1 config = os.path.join(vzd.scenarios_path, "multi_duel.cfg") +win_x = 100 +win_y = 100 def player1(): game = vzd.DoomGame() game.load_config(config) + + # Setup 2 players deathmatch game that will time out after 1 minute game.add_game_args("-host 2 -deathmatch +timelimit 1 +sv_spawnfarthest 1") - game.add_game_args("+name Player1 +colorset 0") + + # Use additional arguments to set player name, color and window position + game.add_game_args(f"+name Player1 +colorset 0 +win_x {win_x} +win_y {win_y}") game.init() actions = [[True, False, False], [False, True, False], [False, False, True]] for i in range(episodes): - - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") while not game.is_episode_finished(): if game.is_player_dead(): @@ -47,8 +52,14 @@ def player2(): game = vzd.DoomGame() game.load_config(config) + + # Join existing game game.add_game_args("-join 127.0.0.1") - game.add_game_args("+name Player2 +colorset 3") + + # Use additional arguments to set player name, color and window position + game.add_game_args( + f"+name Player2 +colorset 3 +win_x {win_x + game.get_screen_width()} +win_y {win_y}" + ) game.init() diff --git a/examples/python/multiple_instances_advance.py b/examples/python/multiple_instances_advance.py index e5c95f480..c33e83325 100755 --- a/examples/python/multiple_instances_advance.py +++ b/examples/python/multiple_instances_advance.py @@ -17,6 +17,8 @@ episodes = 1 timelimit = 1 # minutes players = 8 # number of players +win_x = 100 +win_y = 100 skip = 4 mode = vzd.Mode.PLAYER # or Mode.ASYNC_PLAYER @@ -65,13 +67,14 @@ def player_action(game, player_sleep_time, actions, player_skip): def player_host(p): game, actions = setup_player() + + # Setup multiplayer deathmatch game for {p} players that will time out after {timelimit} minutes game.add_game_args( - "-host " - + str(p) - + " -netmode 0 -deathmatch +timelimit " - + str(timelimit) - + " +sv_spawnfarthest 1 +name Player0 +colorset 0" + f"-host {p} -netmode 0 -deathmatch +timelimit {timelimit} +sv_spawnfarthest 1" ) + # Use additional arguments to set player name, color and window position + game.add_game_args(f"+name Player0 +colorset 0 +win_x {win_x} +win_y {win_y}") + # Add additional arguments game.add_game_args(args) game.init() @@ -81,7 +84,7 @@ def player_host(p): player_skip = skip for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") episode_start_time = None while not game.is_episode_finished(): @@ -100,10 +103,8 @@ def player_host(p): player_count = int(game.get_game_variable(vzd.GameVariable.PLAYER_COUNT)) for i in range(1, player_count + 1): print( - "Host: Player" + str(i) + ":", - game.get_game_variable( - eval("vzd.GameVariable.PLAYER" + str(i) + "_FRAGCOUNT") - ), + f"Host: Player{i}:", + game.get_game_variable(eval(f"vzd.GameVariable.PLAYER{i}_FRAGCOUNT")), ) print("Host: Episode processing time:", time() - episode_start_time) @@ -115,7 +116,14 @@ def player_host(p): def player_join(p): game, actions = setup_player() - game.add_game_args("-join 127.0.0.1 +name Player" + str(p) + " +colorset " + str(p)) + + # Join existing game + game.add_game_args("-join 127.0.0.1") + # Use additional arguments to set player name, color and window position + game.add_game_args( + f"+name Player{p} +colorset 0 +win_x {win_x + p % 4 * game.get_screen_width()} +win_y {win_y + p // 4 * game.get_screen_height()} " + ) + # Add additional arguments game.add_game_args(args) game.init() @@ -129,7 +137,7 @@ def player_join(p): while not game.is_episode_finished(): state = game.get_state() print( - "Player" + str(p) + ":", + f"Player{p}:", state.number, action_count, game.get_episode_time(), @@ -138,7 +146,7 @@ def player_join(p): action_count += 1 print( - "Player" + str(p) + " frags:", + f"Player{p} frags:", game.get_game_variable(vzd.GameVariable.FRAGCOUNT), ) game.new_episode() diff --git a/examples/python/objects_and_sectors.py b/examples/python/objects_and_sectors.py index 417b2ee78..bf6b0d7c4 100755 --- a/examples/python/objects_and_sectors.py +++ b/examples/python/objects_and_sectors.py @@ -61,7 +61,7 @@ sleep_time = 1.0 / vzd.DEFAULT_TICRATE # = 0.028 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") # Not needed for the first episode but the loop is nicer. game.new_episode() @@ -71,7 +71,7 @@ state = game.get_state() game.make_action(choice(actions)) - print("State #" + str(state.number)) + print(f"State #{state.number}") print( "Player position: x:", state.game_variables[0], diff --git a/examples/python/pyoblige.py b/examples/python/pyoblige.py index 277854db8..6243e8eab 100755 --- a/examples/python/pyoblige.py +++ b/examples/python/pyoblige.py @@ -116,7 +116,7 @@ last_action = game.get_last_action() reward = game.get_last_reward() - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Game variables: ", state.game_variables) print("Action:", last_action) print("Reward:", reward) diff --git a/examples/python/record_episodes.py b/examples/python/record_episodes.py index 46ec426c0..23dbc965d 100755 --- a/examples/python/record_episodes.py +++ b/examples/python/record_episodes.py @@ -40,14 +40,14 @@ # new_episode can record the episode using Doom's demo recording functionality to given file. # Recorded episodes can be reconstructed with perfect accuracy using different rendering settings. # This can not be used to record episodes in multiplayer mode. - game.new_episode("episode" + str(i) + "_rec.lmp") + game.new_episode(f"episode{i}_rec.lmp") while not game.is_episode_finished(): s = game.get_state() r = game.make_action(choice(actions)) - print("State #" + str(s.number)) + print(f"State #{s.number}") print("Game variables:", s.game_variables[0]) print("Reward:", r) print("=====================") @@ -73,7 +73,7 @@ for i in range(episodes): # Replays episodes stored in given file. Sending game command will interrupt playback. - game.replay_episode("episode" + str(i) + "_rec.lmp") + game.replay_episode(f"episode{i}_rec.lmp") while not game.is_episode_finished(): s = game.get_state() @@ -84,7 +84,7 @@ r = game.get_last_reward() # game.get_last_action is not supported and don't work for replay at the moment. - print("State #" + str(s.number)) + print(f"State #{s.number}") print("Game variables:", s.game_variables[0]) print("Reward:", r) print("=====================") @@ -97,4 +97,4 @@ # Delete recordings (*.lmp files). for i in range(episodes): - os.remove("episode" + str(i) + "_rec.lmp") + os.remove(f"episode{i}_rec.lmp") diff --git a/examples/python/scenarios.py b/examples/python/scenarios.py index b4c70618b..90a5cf59d 100755 --- a/examples/python/scenarios.py +++ b/examples/python/scenarios.py @@ -55,7 +55,7 @@ sleep_time = 0.028 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") # Not needed for the first episode but the loop is nicer. game.new_episode() @@ -67,7 +67,7 @@ # Makes a random action and save the reward. reward = game.make_action(choice(actions)) - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Game Variables:", state.game_variables) print("Performed action:", game.get_last_action()) print("Last Reward:", reward) diff --git a/examples/python/seed.py b/examples/python/seed.py index 11b1f1aaa..853dce21b 100755 --- a/examples/python/seed.py +++ b/examples/python/seed.py @@ -77,7 +77,7 @@ sleep_time = 0.028 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") # Seed can be changed anytime. It will take effect from next episodes. # game.set_seed(seed) @@ -94,7 +94,7 @@ # Check which action you chose! reward = game.make_action(choice(actions)) - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Game Variables:", vars) print("Last Reward:", reward) print("Seed:", game.get_seed()) diff --git a/examples/python/shaping.py b/examples/python/shaping.py index a279e27b3..30d445375 100755 --- a/examples/python/shaping.py +++ b/examples/python/shaping.py @@ -60,8 +60,8 @@ sleep_time = 0.028 for i in range(episodes): + print(f"Episode #{i + 1}") - print("Episode #" + str(i + 1)) # Not needed for the first episode but the loop is nicer. game.new_episode() @@ -86,7 +86,7 @@ shaping_reward = shaping_reward - last_total_shaping_reward last_total_shaping_reward += shaping_reward - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Health: ", state.game_variables[0]) print("Last Reward:", reward) print("Last Shaping Reward:", shaping_reward) diff --git a/examples/python/spectator.py b/examples/python/spectator.py index b7e7ffe23..951237be6 100755 --- a/examples/python/spectator.py +++ b/examples/python/spectator.py @@ -50,7 +50,7 @@ episodes = 10 for i in range(episodes): - print("Episode #" + str(i + 1)) + print(f"Episode #{i + 1}") game.new_episode() while not game.is_episode_finished(): @@ -60,7 +60,7 @@ last_action = game.get_last_action() reward = game.get_last_reward() - print("State #" + str(state.number)) + print(f"State #{state.number}") print("Game variables: ", state.game_variables) print("Action:", last_action) print("Reward:", reward) From 116a952018b3ee26a5037415e3b7b0761daeb281 Mon Sep 17 00:00:00 2001 From: Marek Wydmuch Date: Sun, 5 Nov 2023 02:10:39 +0100 Subject: [PATCH 6/6] Update the docstrings for the new set/get_game_args methods --- docs/api/cpp/doomGame.md | 4 ++-- src/lib_python/ViZDoomMethodsDocstrings.h | 2 +- tests/test_game_args.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 tests/test_game_args.py diff --git a/docs/api/cpp/doomGame.md b/docs/api/cpp/doomGame.md index 691b903a5..2a2993c14 100644 --- a/docs/api/cpp/doomGame.md +++ b/docs/api/cpp/doomGame.md @@ -519,9 +519,9 @@ See also: Added in 1.3.0 Sets custom arguments that will be passed to ViZDoom process during initialization. -It is useful for changing additional game settings. +It is useful for changing additional game settings. Use with caution, as in rare cases it may prevent the library from working properly. -Using this method is equivalent to first calling [`clearGameArgs`](#cleargameargs) and then [`addGameArgs`](#addgameargs). +Using this method is equivalent to first calling [`clearGameArgs`](#cleargameargs) and then [`addGameArgs`](#addgameargs). Config key: `gameArgs/game_args` diff --git a/src/lib_python/ViZDoomMethodsDocstrings.h b/src/lib_python/ViZDoomMethodsDocstrings.h index 388b242fc..195d3be43 100644 --- a/src/lib_python/ViZDoomMethodsDocstrings.h +++ b/src/lib_python/ViZDoomMethodsDocstrings.h @@ -124,7 +124,7 @@ git lo)DOCSTRING"; const char *setGameArgs = R"DOCSTRING(Sets custom arguments that will be passed to ViZDoom process during initialization. It is useful for changing additional game settings. Use with caution, as in rare cases it may prevent the library from working properly. -Using this method is equivalent to first calling `clearGameArgs`.)DOCSTRING"; +Using this method is equivalent to first calling `clearGameArgs`.)DOCSTRING"; const char *addGameArgs = R"DOCSTRING(Adds custom arguments that will be passed to ViZDoom process during initialization. It is useful for changing additional game settings. diff --git a/tests/test_game_args.py b/tests/test_game_args.py old mode 100644 new mode 100755 index a299c4809..d592dc083 --- a/tests/test_game_args.py +++ b/tests/test_game_args.py @@ -7,7 +7,7 @@ def test_game_args(): - + game = vzd.DoomGame() game.set_window_visible(False)