diff --git a/CMakeLists.txt b/CMakeLists.txt index ff1168b14..c39356a95 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ set(ViZDoom_VERSION_ID ${ViZDoom_VERSION_MAJOR}${ViZDoom_VERSION_MINOR}${ViZDoom # Building options #----------------------------------------------------------------------------------------------------------------------- -option(BUILD_PYTHON "Build ViZDoom Python (3) binding" OFF) -option(BUILD_JULIA "Build ViZDoom Julia binding." OFF) +option(BUILD_PYTHON "Build ViZDoom Python (3) binding" ON) +option(BUILD_ENGINE "Build ViZDoom Engine" ON) # CMake options @@ -86,7 +86,7 @@ if (MSVC) endif () -# Main library and engine +# Main library #----------------------------------------------------------------------------------------------------------------------- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -155,17 +155,16 @@ set_target_properties(libvizdoom_shared PROPERTIES PROJECT_LABEL "shared library") + +# ViZDoom Engine +#----------------------------------------------------------------------------------------------------------------------- + add_subdirectory(${VIZDOOM_SRC_DIR}/vizdoom) -# Python and Julia +# Python bindings #----------------------------------------------------------------------------------------------------------------------- if (BUILD_PYTHON) add_subdirectory(${VIZDOOM_SRC_DIR}/lib_python) endif () - -if (BUILD_JULIA) - add_subdirectory(${VIZDOOM_SRC_DIR}/lib_julia) -endif () - diff --git a/README.md b/README.md index 626352c6c..ca8b03429 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,15 @@ ViZDoom is based on [ZDoom](https://github.com/rheit/zdoom) to provide the game ## Features - Multi-platform (Linux, macOS, Windows), -- API for Python, C++, and Julia (thanks to [Jun Tian](https://github.com/findmyway)), and also Lua and Java for older versions, +- API for Python and C++, - [OpenAI Gym](https://www.gymlibrary.dev/) environment wrappers (thanks to [Benjamin Noah Beal](https://github.com/bebeal), [Lawrence Francis](https://github.com/ldfrancis), and [Mark Towers](https://github.com/pseudo-rnd-thoughts)), -- Easy-to-create custom scenarios (visual editors, scripting language and examples available), -- Async and sync single-player and multi-player modes, +- Easy-to-create custom scenarios (visual editors, scripting language, and examples available), +- Async and sync single-player and multiplayer modes, - Fast (up to 7000 fps in sync mode, single-threaded), - Lightweight (few MBs), - Customizable resolution and rendering parameters, - Access to the depth buffer (3D vision), -- Automatic labelling game objects visible in the frame, +- Automatic labeling of game objects visible in the frame, - Access to the audio buffer (thanks to [Shashank Hegde](https://github.com/hegde95)), - Access to the list of actors/objects and map geometry, - Off-screen rendering, @@ -26,6 +26,8 @@ ViZDoom is based on [ZDoom](https://github.com/rheit/zdoom) to provide the game ViZDoom API is **reinforcement learning** friendly (suitable also for learning from demonstration, apprenticeship learning or apprenticeship via inverse reinforcement learning, etc.). +Julia (thanks to [Jun Tian](https://github.com/findmyway)), Lua, and Java bindings are available in other branches but are no longer maintained. + ## Cite as > M Wydmuch, M Kempka & W Jaśkowski, ViZDoom Competitions: Playing Doom from Pixels, IEEE Transactions on Games, vol. 11, no. 3, pp. 248-259, 2019 @@ -67,7 +69,7 @@ or ### Ubuntu To install ViZDoom on Ubuntu run (may take few minutes): ``` -sudo apt install cmake libboost-all-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libjpeg-dev libbz2-dev libfluidsynth-dev libgme-dev libopenal-dev zlib1g-dev timidity tar nasm +sudo apt install cmake libboost-all-dev libsdl2-dev libfreetype6-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libjpeg-dev libbz2-dev libfluidsynth-dev libgme-dev libopenal-dev zlib1g-dev timidity tar pip install vizdoom ``` We recommend using at least Ubuntu 18.04+ with Python 3.7+. @@ -83,27 +85,22 @@ python setup.py build && python setup.py install Note that `pip install vizdoom` won't work with conda install and you have to follow these steps. ### macOS -To install ViZDoom on macOS (Intel) run (may take few minutes): +To install ViZDoom on macOS (for Intel and Apple Silicon) run (may take few minutes): ``` brew install cmake boost openal-soft sdl2 pip install vizdoom ``` We recommend using at least macOS High Sierra 10.13+ with Python 3.7+. - -To install ViZDoom on macOS with Apple Silicon (M1 or M2) run: -``` -brew install cmake boost openal-soft sdl2 -pip install git+https://github.com/mwydmuch/ViZDoom.git -``` +On Apple Silicon (M1 and M2), make sure you are using Python for Apple Silicon. ### Windows -To install pre-build release for Windows 10 or 11 64-bit and Python 3.6+ just run (should take few seconds): +To install pre-build release for Windows 10 or 11 64-bit and Python 3.7+ just run (should take few seconds): ``` pip install vizdoom ``` ### Gym wrappers -If you wish to use OpenAI Gym environments, install ViZDoom with +If you wish to also install OpenAI Gym environments, install ViZDoom with ``` pip install vizdoom[gym] ``` @@ -114,7 +111,6 @@ See [documentation](doc/Gym.md) and [examples](examples/python/gym_wrapper.py) o - [Python](examples/python) (contain learning examples implemented in PyTorch, TensorFlow and Theano) - [C++](examples/c%2B%2B) -- [Julia](examples/julia) Python examples are currently the richest, so we recommend to look at them, even if you plan to use other language. API is almost identical for all languages. diff --git a/doc/Building.md b/doc/Building.md index 0da5c4aa4..e1d34cbb3 100644 --- a/doc/Building.md +++ b/doc/Building.md @@ -16,15 +16,15 @@ ## Dependencies -Even if you plan to install ViZDoom via PyPI or LuaRocks, you need to install some dependencies in your system first. +Even if you plan to install ViZDoom via PyPI you need to install some dependencies in your system first. ### Linux -* CMake 3.1+ +* CMake 3.4+ * Make * GCC 6.0+ * Boost libraries 1.65.0+ -* Python 3.5+ with Numpy for Python binding (optional) +* Python 3.7+ for Python binding (optional) Additionally, [ZDoom dependencies](http://zdoom.org/wiki/Compile_ZDoom_on_Linux) are needed. @@ -40,14 +40,7 @@ sudo apt-get install libboost-all-dev # Python 3 dependencies sudo apt-get install python3-dev python3-pip -pip3 install numpy # or install Anaconda 3 and add it to PATH - -# Julia dependencies -sudo apt-get install julia -julia -julia> using Pkg -julia> Pkg.add("CxxWrap") ``` If you do not have a root access, you can use a conda (e.g. [miniconda](https://docs.conda.io/en/latest/miniconda.html)) environment to install dependencies to your environment only: @@ -64,10 +57,10 @@ python setup.py build && python setup.py install ### MacOS -* CMake 3.1+ +* CMake 3.4+ * Clang 5.0+ * Boost libraries 1.65.0+ -* Python 3.5+ with Numpy for Python binding (optional) +* Python 3.7+ for Python binding (optional) Additionally, [ZDoom dependencies](http://zdoom.org/wiki/Compile_ZDoom_on_Mac_OS_X) are needed. @@ -77,27 +70,19 @@ To get dependencies install [homebrew](https://brew.sh/) # ZDoom dependencies and Boost libraries brew install cmake boost openal-soft sdl2 -# Python 3 dependencies -brew install python3 -pip3 install numpy -# or install Anaconda 3 and add it to PATH - -# Julia dependencies -brew cask install julia -julia -julia> using Pkg -julia> Pkg.add("CxxWrap") +# You can use system python or install Anaconda 3 and add it to PATH ``` ### Windows -* CMake 3.1+ +* CMake 3.4+ * Visual Studio 2012+ * Boost 1.65+ -* Python 3.5+ with Numpy for Python binding (optional) +* Python 3.7+ for Python binding (optional) Additionally, [ZDoom dependencies](http://zdoom.org/wiki/Compile_ZDoom_on_Windows) are needed. -Most of them are gathered in this repository: [ViZDoomWinDepBin](https://github.com/mwydmuch/ViZDoomWinDepBin). +Most of them (except Boost) are gathered in this repository: [ViZDoomWinDepBin](https://github.com/mwydmuch/ViZDoomWinDepBin). +You can download Boost from [here](https://www.boost.org/users/download). ## Installation via PyPI (recommended for Python users) @@ -118,18 +103,10 @@ pip install git+https://github.com/mwydmuch/ViZDoom.git ``` -## Installation of Windows binaries - -For Windows we are providing a compiled environment that can be download from [releases](https://github.com/mwydmuch/ViZDoom/releases) page. -To install it for Python, copy files to `site-packages` folder. - -Location of `site-packages` depends on Python distribution: -- Python: `python_root\Lib\site-packges` -- Anaconda: `anaconda_root\lib\pythonX.X\site-packages` - - ## Building +Instructions below can be used to build ViZDoom manually. + ### Linux >>> Using [pip/conda](#pypi) is the recommended way to install ViZDoom, please try it first unless you are sure you want to compile the package by hand. @@ -138,22 +115,11 @@ In ViZDoom's root directory: ```bash mkdir build cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON=ON -DBUILD_JAVA=ON -DBUILD_LUA=ON -DBUILD_JULIA=ON +cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ENGINE=ON -DBUILD_PYTHON=ON make ``` -where `-DBUILD_PYTHON=ON` and `-DBUILD_JULIA=ON` CMake options for Python and Julia bindings are optional (default OFF). To force building bindings for Python3 instead of the first version found use `-DBUILD_PYTHON3=ON`. - -To build Julia binding you first need to install CxxWrap package by running `julia` and using `Pkg.add("CxxWrap")` command (see [Linux dependencies](#linux_deps)). Then you need to manually set `JlCxx_DIR` variable: - -```sh -mkdir build -cd build -cmake .. -DCMAKE_BUILD_TYPE=Release \ --DBUILD_JULIA=ON \ --DJlCxx_DIR=~/.julia/vX.X/CxxWrap/deps/usr/lib/cmake/JlCxx/ -``` - +where `-DBUILD_ENGINE=ON` and `-DBUILD_PYTHON=ON` CMake options are optional (default ON). ### MacOS @@ -164,15 +130,15 @@ Run CMake and build generated Makefile. ```sh mkdir build cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON=ON -DBUILD_JULIA=ON +cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_ENGINE=ON -DBUILD_PYTHON=ON make ``` -where `-DBUILD_PYTHON=ON` and `-DBUILD_JULIA=ON` CMake options for Python and Julia bindings are optional (default OFF). To force building bindings for Python3 instead of the first version found use `-DBUILD_PYTHON3=ON`. +where `-DBUILD_ENGINE=ON` and `-DBUILD_PYTHON=ON` CMake options are optional (default ON). -Users with brew-installed Python/Anaconda **may** need to manually set `PYTHON_EXECUTABLE`, `PYTHON_INCLUDE_DIR`, `PYTHON_LIBRARY` variables: +Users with brew-installed Python/Anaconda **may** (in some cases) need to manually set `PYTHON_EXECUTABLE`, `PYTHON_INCLUDE_DIR`, `PYTHON_LIBRARY` variables: -It should look like this for brew-installed Python (use `-DBUILD_PYTHON3=ON`, `include/pythonX.Xm` and `lib/libpythonX.Xm.dylib` for Python 3): +It should look like this for brew-installed Python: ```sh mkdir build @@ -185,7 +151,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \ -DNUMPY_INCLUDES=/usr/local/Cellar/python/X.X.X/Frameworks/Python.framework/Versions/X.X/lib/pythonX.X/site-packages/numpy/core/include ``` -Or for Anaconda (use `-DBUILD_PYTHON3=ON`, `include/pythonX.Xm` and `lib/libpythonX.Xm.dylib` for Python 3): +Or for Anaconda: ```sh mkdir build @@ -198,17 +164,6 @@ cmake .. -DCMAKE_BUILD_TYPE=Release \ -DNUMPY_INCLUDES=~/anacondaX/lib/pythonX.X/site-packages/numpy/core/include ``` -To build Julia binding, you first need to install CxxWrap package by running `julia` and using `Pkg.add("CxxWrap")` command (see [MacOS dependencies](#macos_deps)). Then you need to manually set `JlCxx_DIR` variable: - -```sh -mkdir build -cd build -cmake .. -DCMAKE_BUILD_TYPE=Release \ --DBUILD_JULIA=ON \ --DJlCxx_DIR=~/.julia/vX.X/CxxWrap/deps/usr/lib/cmake/JlCxx/ -``` - - ### Windows Setting up the compilation on Windows is really tedious so using the [precompiled binaries](#windows_bin) is recommended. @@ -223,10 +178,9 @@ Run CMake GUI, select ViZDoom root directory and set paths to: * BOOST_LIBRARYDIR * PYTHON_INCLUDE_DIR (optional, for Python/Anaconda bindings) * PYTHON_LIBRARY (optional, for Python/Anaconda bindings) -* NUMPY_INCLUDES (optional, for Python/Anaconda bindings) * ZDoom dependencies paths -In configuration select BUILD_PYTHON, BUILD_PYTHON3 and BUILD_JAVA options for Python and Java bindings (optional, default OFF). +In configuration select `DBUILD_ENGINE` and `DBUILD_PYTHON` (optional, default ON). Use generated Visual Studio solution to build all parts of ViZDoom environment. diff --git a/doc/Changelog.md b/doc/Changelog.md index 4e814ad84..d393fe308 100644 --- a/doc/Changelog.md +++ b/doc/Changelog.md @@ -1,5 +1,15 @@ # 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 diff --git a/doc/ConfigFile.md b/doc/ConfigFile.md index 4f55bab0f..b837bedf8 100644 --- a/doc/ConfigFile.md +++ b/doc/ConfigFile.md @@ -34,7 +34,7 @@ Each list assignment (**KEY = { VALUES }**)clears values specified for this key * `DoomConfigPath/doom_config_path` * `DoomGamePath/doom_game_path` * `DoomMap/doom_map` -* `DoomScenarioPath/set_doom_scenario_path` +* `DoomScenarioPath/doom_scenario_path` * `DoomSkill/doom_skill` * `episodeStartTime/episode_start_time` * `episodeTimeout/episode_timeout` diff --git a/doc/DoomGame.md b/doc/DoomGame.md index 03b7a10af..7599da2ba 100644 --- a/doc/DoomGame.md +++ b/doc/DoomGame.md @@ -110,7 +110,7 @@ * [isSectorsInfoEnabled](#isSectorsInfoEnabled) * [setSectorsInfoEnabled](#setSectorsInfoEnabled) * [isAudioBufferEnabled](#isAudioBufferEnabled) -* [is/setAudioBufferEnabled](#setAudioBufferEnabled) +* [setAudioBufferEnabled](#setAudioBufferEnabled) * [getAudioSamplingFreq](#getAudioSamplingFreq) * [setAudioSamplingFreq](#setAudioSamplingFreq) * [getAudioBufferSize](#getAudioBufferSize) diff --git a/doc/FAQ.md b/doc/FAQ.md index 7c33ae49f..e2d79e1a7 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -159,7 +159,9 @@ with ViZDoom. You have several options you can try (one of these steps has worke ## How to display ViZDoom's window when running it on WSL (Windows Subsystem for Linux) -GUI apps do not work out-of-the-box on WSL on Windows 10. To make it work you need: +Please note that as running ViZDoom on WSL seems to be working fine, it is not officially supported. + +GUI apps do not work out-of-the-box on WSL on Windows 10/11. To make it work, you need: * Download and install X-Server (VcXsrv) on Windows: https://sourceforge.net/projects/vcxsrv/. * Start it using Command Prompt (cmd.exe) on Windows: `"C:\Program Files\VcXsrv\vcxsrv.exe" :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl -dpi auto` (`"C:\Program Files\VcXsrv\vcxsrv.exe"` is default install location). @@ -168,3 +170,8 @@ GUI apps do not work out-of-the-box on WSL on Windows 10. To make it work you ne **Original issue:** * https://github.com/mwydmuch/ViZDoom/issues/491 + + +## What is a difference between ViZDoom, ZDoom and GZDoom + +ViZDoom is based on the last version of ZDoom (2.8.1). ZDoom was discontinued in 2016, and the development switched to GZDoom, which provides a new 3D renderer implemented in OpenGL. ViZDoom, however, sticks to the original 2D software renderer, which is much faster for small resolutions than OpenGL. Because of that, ViZDoom modernized the ZDoom engine by adding support for Apple Silicon and removing old unused parts of the code base (e.g., by removing Assembler parts). diff --git a/doc/Utilities.md b/doc/Utilities.md index 4d299dda2..9c37430cc 100644 --- a/doc/Utilities.md +++ b/doc/Utilities.md @@ -1,7 +1,5 @@ # Utilities -In Java utilities functions are static methods in DoomGame class. - * [doomTicsToMs](#doomTicsToMs) * [msToDoomTics](#msToDoomTics) * [doomTicsToSec](#doomTicsToSec) diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index eb60101dd..000000000 --- a/docker/README.md +++ /dev/null @@ -1,42 +0,0 @@ ->>> Files in this directory might be outdated. However official vizdoom docker images are available on [dockerhub](https://hub.docker.com/r/vizdoom/vizdoom) and in [git repo](https://github.com/mihahauke/vizdoom_docker) - -# ViZDoom Dockerfiles - -Provided dockerfiles (all images use Ubuntu 16.04): - -* **python3** - Python3, ViZDoom with dependencies and X11 support. By default runs Python [basic example](examples/python/basic.py). -* **tensorflow** - Python3, ViZDoom with dependencies, Tensorflow and X11 support. By default runs [tensorflow learning example](examples/python/learning_tensorflow.py). -* **torch** - Torch, ViZDoom with dependencies and X11 support. By default run Lua [basic example](examples/lua/basic.py). - -## Building - -```bash -# Uses Dockerfile in python3 directory to create image tagged vizdoom -docker build python3 -t vizdoom - - -# Uses Dockerfile in tensorflow directory to create image tagged vizdoom_tf -docker build tensorflow -t vizdoom_tf - -``` - -## Running (requires building beforehand) - -``` -# '--net=host -e DISPLAY=${DISPLAY} --privileged' required for GUI -# Run basic example in container named 'basic' -docker run -ti --net=host -e DISPLAY=${DISPLAY} --privileged --rm --name basic vizdoom - -# Run tensorflow learning example in container named 'vizdoom_tf' -nvidia-docker run -ti --privileged --net=host -e DISPLAY=${DISPLAY} --rm --name vizdoom_tf vizdoom_tf - -# Run bash in interactive mode -docker run -ti --privileged --net=host -e DISPLAY=${DISPLAY} --rm --name basic vizdoom bash - -``` - -## Other dockerfiles: - -* Ubuntu 17.04, Anaconda3-4.4.0 by @guiambros - * Dockerfile: https://gist.github.com/guiambros/1ee62876fb309207b02eb69c8c7b39fa - * Shell script: https://gist.github.com/guiambros/8847ae6d23299a395c3d8a566996a16f diff --git a/docker/python3/Dockerfile b/docker/python3/Dockerfile deleted file mode 100644 index 90031f0ec..000000000 --- a/docker/python3/Dockerfile +++ /dev/null @@ -1,65 +0,0 @@ -FROM ubuntu:16.04 - -# ViZdoom dependencies -RUN apt-get update -RUN apt-get install -y \ - build-essential \ - bzip2 \ - cmake \ - curl \ - git \ - libboost-all-dev \ - libbz2-dev \ - libfluidsynth-dev \ - libfreetype6-dev \ - libgme-dev \ - libgtk2.0-dev \ - libjpeg-dev \ - libopenal-dev \ - libpng12-dev \ - libsdl2-dev \ - libwildmidi-dev \ - libzmq3-dev \ - nano \ - nasm \ - pkg-config \ - rsync \ - software-properties-common \ - sudo \ - tar \ - timidity \ - unzip \ - wget \ - zlib1g-dev - -# Python3 -RUN apt-get install -y python3-dev python3 python3-pip -RUN pip3 install pip --upgrade - - -# Enables X11 sharing and creates user home directory -ENV USER_NAME vizdoom -ENV HOME_DIR /home/$USER_NAME -# -# Replace HOST_UID/HOST_GUID with your user / group id (needed for X11) -ENV HOST_UID 1000 -ENV HOST_GID 1000 - -RUN export uid=${HOST_UID} gid=${HOST_GID} && \ - mkdir -p ${HOME_DIR} && \ - echo "$USER_NAME:x:${uid}:${gid}:$USER_NAME,,,:$HOME_DIR:/bin/bash" >> /etc/passwd && \ - echo "$USER_NAME:x:${uid}:" >> /etc/group && \ - echo "$USER_NAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER_NAME && \ - chmod 0440 /etc/sudoers.d/$USER_NAME && \ - chown ${uid}:${gid} -R ${HOME_DIR} - - -RUN git clone https://github.com/mwydmuch/ViZDoom ${HOME_DIR}/vizdoom -RUN pip3 install Cython -RUN pip3 install ${HOME_DIR}/vizdoom - -USER ${USER_NAME} -WORKDIR ${HOME_DIR} - - -CMD cd vizdoom/examples/python; python3 basic.py diff --git a/docker/tensorflow/Dockerfile b/docker/tensorflow/Dockerfile deleted file mode 100644 index 9e7e77b33..000000000 --- a/docker/tensorflow/Dockerfile +++ /dev/null @@ -1,69 +0,0 @@ -FROM ubuntu:16.04 - -FROM nvidia/cuda:8.0-cudnn5-devel - -# ViZdoom dependencies -RUN apt-get update -RUN apt-get install -y \ - build-essential \ - bzip2 \ - cmake \ - curl \ - git \ - libboost-all-dev \ - libbz2-dev \ - libfluidsynth-dev \ - libfreetype6-dev \ - libgme-dev \ - libgtk2.0-dev \ - libjpeg-dev \ - libopenal-dev \ - libpng12-dev \ - libsdl2-dev \ - libwildmidi-dev \ - libzmq3-dev \ - nano \ - nasm \ - pkg-config \ - rsync \ - software-properties-common \ - sudo \ - tar \ - timidity \ - unzip \ - wget \ - zlib1g-dev - -# Python3 -RUN apt-get install -y python3-dev python3 python3-pip -RUN pip3 install pip --upgrade - - -# Enables X11 sharing and creates user home directory -ENV USER_NAME vizdoom -ENV HOME_DIR /home/$USER_NAME -# -# Replace HOST_UID/HOST_GUID with your user / group id (needed for X11) -ENV HOST_UID 1000 -ENV HOST_GID 1000 - -RUN export uid=${HOST_UID} gid=${HOST_GID} && \ - mkdir -p ${HOME_DIR} && \ - echo "$USER_NAME:x:${uid}:${gid}:$USER_NAME,,,:$HOME_DIR:/bin/bash" >> /etc/passwd && \ - echo "$USER_NAME:x:${uid}:" >> /etc/group && \ - echo "$USER_NAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER_NAME && \ - chmod 0440 /etc/sudoers.d/$USER_NAME && \ - chown ${uid}:${gid} -R ${HOME_DIR} - - -RUN git clone https://github.com/mwydmuch/ViZDoom ${HOME_DIR}/vizdoom -RUN pip3 install Cython -RUN pip3 install ${HOME_DIR}/vizdoom -RUN pip3 install tensorflow-gpu -RUN pip3 install matplotlib scipy scikit-image tqdm - -USER ${USER_NAME} -WORKDIR ${HOME_DIR} - - -CMD cd vizdoom/examples/python; python3 learning_tensorflow.py diff --git a/docker/torch/Dockerfile b/docker/torch/Dockerfile deleted file mode 100644 index 04ec6a895..000000000 --- a/docker/torch/Dockerfile +++ /dev/null @@ -1,86 +0,0 @@ -FROM ubuntu:16.04 # CPU ONLY - -# GPU -> see: https://github.com/NVIDIA/nvidia-docker -#FROM nvidia/cuda:7.5-cudnn5-devel -# or -#FROM nvidia/cuda:8.0-cudnn5-devel - -# Install all dependencies -RUN apt-get update && apt-get install -y \ - build-essential \ - bzip2 \ - cmake \ - git \ - libboost-all-dev \ - libbz2-dev \ - libfluidsynth-dev \ - libgme-dev \ - libgtk2.0-dev \ - libjpeg-dev \ - libopenal-dev \ - libsdl2-dev \ - libwildmidi-dev \ - nasm \ - nano \ - sudo \ - tar \ - timidity \ - unzip \ - wget \ - zlib1g-dev - -# Clone Torch, install dependencies and build Torch (building blas may take a while) -RUN git clone https://github.com/torch/distro.git /root/torch --recursive && \ - cd /root/torch && \ - bash install-deps && \ - ./install.sh - -# Export environment variables manually -ENV LUA_PATH='/root/.luarocks/share/lua/5.1/?.lua;/root/.luarocks/share/lua/5.1/?/init.lua;/root/torch/install/share/lua/5.1/?.lua;/root/torch/install/share/lua/5.1/?/init.lua;./?.lua;/root/torch/install/share/luajit-2.1.0-beta1/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua' -ENV LUA_CPATH='/root/.luarocks/lib/lua/5.1/?.so;/root/torch/install/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so' -ENV PATH=/root/torch/install/bin:$PATH -ENV LD_LIBRARY_PATH=/root/torch/install/lib:$LD_LIBRARY_PATH -ENV DYLD_LIBRARY_PATH=/root/torch/install/lib:$DYLD_LIBRARY_PATH -ENV LUA_CPATH='/root/torch/install/lib/?.so;'$LUA_CPATH -ENV TERM xterm - -# Install more dependencies via luarocks -RUN luarocks install torchffi && \ - luarocks install image - -# Install CUDA libraries -RUN luarocks install cutorch && \ - luarocks install cunn && \ - luarocks install cudnn - -# Clone ViZDoom and build + install via luarocks -RUN git clone https://github.com/mwydmuch/ViZDoom.git /root/vizdoom && \ - cd /root/vizdoom && \ - luarocks make - -# Expose ViZDoom's multiplayer port -EXPOSE 5029 - -# Code below allows sharing X11 socket with container -# Replace 1000 with your user / group id -RUN export uid=1000 gid=1000 && \ - mkdir -p /home/developer && \ - echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ - echo "developer:x:${uid}:" >> /etc/group && \ - echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ - chmod 0440 /etc/sudoers.d/developer && \ - chown ${uid}:${gid} -R /home/developer - -USER developer -ENV HOME /home/developer - -# Set workdir -WORKDIR /root/vizdoom/examples/lua - -# Expose th command -CMD ["th"] - -# Examples of usage: -# BUILD THIS DOCKER: docker build -t torch+vizdoom . -# RUN THIS DOCKER WITH X11: docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix torch+vizdoom th basic.lua - diff --git a/examples/julia/basic.jl b/examples/julia/basic.jl deleted file mode 100644 index 5fb4d094a..000000000 --- a/examples/julia/basic.jl +++ /dev/null @@ -1,84 +0,0 @@ -using CxxWrap - -wrap_modules("../../bin/libvizdoomjl") - -const vz = ViZDoomWrapper - -game = vz.DoomGame() - -vz.set_doom_scenario_path(game, "../../scenarios/basic.wad") - -vz.set_doom_map(game, "map01") - -# Sets resolution. Default is 320X240 -vz.set_screen_resolution(game, vz.RES_640X480) - -# Sets the screen buffer format. Not used here but now you can change it. Defalut is CRCGCB. -vz.set_screen_format(game, vz.RGB24) - -# Enables depth buffer. -vz.set_depth_buffer_enabled(game, true) - -# Enables labeling of in vz objects labeling. -vz.set_labels_buffer_enabled(game, true) - -# Enables buffer with top down map of the current episode/level. -vz.set_automap_buffer_enabled(game, true) - - -# Sets other rendering options (all of these options except crosshair are enabled (set to True) by default) -vz.set_render_hud(game, false) -vz.set_render_minimal_hud(game, false) # If hud is enabled -vz.set_render_crosshair(game, false) -vz.set_render_weapon(game, true) -vz.set_render_decals(game, false) # Bullet holes and blood on the walls -vz.set_render_particles(game, false) -vz.set_render_effects_sprites(game, false) # Smoke and blood -vz.set_render_messages(game, false) # In-vz messages -vz.set_render_corpses(game, false) -vz.set_render_screen_flashes(game, true) # Effect upon taking damage or picking up items - - -# Adds buttons that will be allowed. -vz.add_available_button(game, vz.MOVE_LEFT) -vz.add_available_button(game, vz.MOVE_RIGHT) -vz.add_available_button(game, vz.ATTACK) - -# Adds vz variables that will be included in state. -vz.add_available_game_variable(game, vz.AMMO2) - -# Causes episodes to finish after 200 tics (actions) -vz.set_episode_timeout(game, 200) - -# Makes episodes start after 10 tics (~after raising the weapon) -vz.set_episode_start_time(game, 10) - -# Makes the window appear (turned on by default) -vz.set_window_visible(game, true) - -# Turns on the sound. (turned off by default) -vz.set_sound_enabled(game, true) - -# Sets the living reward (for each move) to -1 -vz.set_living_reward(game, -1) - -# Sets ViZDoom mode (PLAYER, ASYNC_PLAYER, SPECTATOR, ASYNC_SPECTATOR, PLAYER mode is default) -vz.set_mode(game, vz.PLAYER) - -vz.init(game) - -actions = [[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]] -episodes = 10 -sleep_time = 1.0 / vz.DEFAULT_TICRATE - -for i in 1:episodes - println("Episode #$i") - vz.new_episode(game) - - while !vz.is_episode_finished(game) - state = vz.get_state(game) - r = vz.make_action(game, rand(actions)) - println("Reward $r") - sleep(sleep_time) - end -end diff --git a/scripts/build_windows.bat b/scripts/build_windows.bat index 5633dfe8d..abe031433 100644 --- a/scripts/build_windows.bat +++ b/scripts/build_windows.bat @@ -44,9 +44,9 @@ for %%P in (36 37 38 39 310) do ( :: CMake command :: %%% Minimal version - :: set CMAKE_CMD=-G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_ROOT="%BOOST_ROOT%" -DNO_ASM=ON + :: set CMAKE_CMD=-G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_ROOT="%BOOST_ROOT%" :: %%% Version with all additional sound deps - set CMAKE_CMD=-G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_ROOT="%BOOST_ROOT%" -DNO_ASM=ON -DMPG123_INCLUDE_DIR="%MPG123_INCLUDE_DIR%" -DMPG123_LIBRARIES="%MPG123_LIBRARIES%" -DSNDFILE_INCLUDE_DIR="%SNDFILE_INCLUDE_DIR%" -DSNDFILE_LIBRARY=%SNDFILE_LIBRARY% + set CMAKE_CMD=-G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_ROOT="%BOOST_ROOT%" -DMPG123_INCLUDE_DIR="%MPG123_INCLUDE_DIR%" -DMPG123_LIBRARIES="%MPG123_LIBRARIES%" -DSNDFILE_INCLUDE_DIR="%SNDFILE_INCLUDE_DIR%" -DSNDFILE_LIBRARY=%SNDFILE_LIBRARY% set CMAKE_CMD=!CMAKE_CMD! -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE="!PYTHON_EXECUTABLE!" -DPYTHON_INCLUDE_DIR="!PYTHON_INCLUDE_DIR!" -DPYTHON_LIBRARY="!PYTHON_LIBRARY!" diff --git a/scripts/test_windows_wheels.bat b/scripts/test_windows_wheels.bat index a9e1a9def..96ef911ab 100644 --- a/scripts/test_windows_wheels.bat +++ b/scripts/test_windows_wheels.bat @@ -1,34 +1,48 @@ @echo off setlocal enabledelayedexpansion +:: Set to current ViZDoom version +set VIZDOOM_VERSION=1.1.14 + :: Build wheels for all Python versions for %%P in (37 38 39 310) do ( set PYTHON_VERSION=%%P set PYTHON_VERSION_DOT=!PYTHON_VERSION:~0,1!.!PYTHON_VERSION:~1! echo Testing wheels for Python !PYTHON_VERSION_DOT! ... - + + :: Modify these lines to point to your Python location (C:\PythonX is usually a default) set PYTHON_LOCATION=C:\Python!PYTHON_VERSION! set PYTHON_EXECUTABLE=!PYTHON_LOCATION!\python.exe !PYTHON_EXECUTABLE! -m pip uninstall -y vizdoom !PYTHON_EXECUTABLE! -m pip install --upgrade pip - !PYTHON_EXECUTABLE! -m pip install scipy opencv-python pytest gym==0.23.0 pygame==2.1.0 + !PYTHON_EXECUTABLE! -m pip install scipy opencv-python pytest + + set WHEEL_FILE=dist\vizdoom-!VIZDOOM_VERSION!-cp!PYTHON_VERSION!-cp!PYTHON_VERSION!-win_amd64.whl + if exist !WHEEL_FILE! ( + !PYTHON_EXECUTABLE! -m pip install !WHEEL_FILE![gym] + ) - !PYTHON_EXECUTABLE! -m pip install dist\vizdoom-1.1.12-cp!PYTHON_VERSION!-cp!PYTHON_VERSION!-win_amd64.whl - !PYTHON_EXECUTABLE! -m pip install dist\vizdoom-1.1.12-cp!PYTHON_VERSION!-cp!PYTHON_VERSION!m-win_amd64.whl + :: This can be removed after end of support for Python 3.7 + set WHEEL_M_FILE=dist\vizdoom-!VIZDOOM_VERSION!-cp!PYTHON_VERSION!-cp!PYTHON_VERSION!m-win_amd64.whl + if exist !WHEEL_M_FILE! ( + !PYTHON_EXECUTABLE! -m pip install !WHEEL_M_FILE![gym] + ) + + :: Test wheel from test PyPI index rem !PYTHON_EXECUTABLE! -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ vizdoom :: Run some examples - rem !PYTHON_EXECUTABLE! examples\python\basic.py - rem !PYTHON_EXECUTABLE! examples\python\buffers.py - rem !PYTHON_EXECUTABLE! examples\python\audio_buffer.py + !PYTHON_EXECUTABLE! examples\python\basic.py + !PYTHON_EXECUTABLE! examples\python\buffers.py + !PYTHON_EXECUTABLE! examples\python\audio_buffer.py :: Run tests !PYTHON_EXECUTABLE! -m pytest tests\test_enums.py - !PYTHON_EXECUTABLE! -m pytest tests\test_get_state.py - !PYTHON_EXECUTABLE! -m pytest tests\test_make_action.py !PYTHON_EXECUTABLE! -m pytest tests\test_gym_wrapper.py + !PYTHON_EXECUTABLE! -m pytest tests\test_labels_buffer.py + !PYTHON_EXECUTABLE! -m pytest tests\test_make_action.py !PYTHON_EXECUTABLE! -m pip uninstall -y vizdoom ) diff --git a/setup.py b/setup.py index 68d80d5d8..307a7a139 100644 --- a/setup.py +++ b/setup.py @@ -102,7 +102,6 @@ def run(self): cmake_arg_list.extend( ["-G", generator, - "-DNO_ASM=ON", "-DMPG123_INCLUDE_DIR={}".format(mpg123_include), "-DMPG123_LIBRARIES={}".format(mpg123_lib), "-DSNDFILE_INCLUDE_DIR={}".format(sndfile_include), diff --git a/src/lib_julia/CMakeLists.txt b/src/lib_julia/CMakeLists.txt deleted file mode 100644 index 79056aa7b..000000000 --- a/src/lib_julia/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -find_package(JlCxx REQUIRED) - -add_library(vizdoomjl SHARED ViZDoomJuliaModule.cpp) -target_link_libraries(vizdoomjl JlCxx::cxxwrap_julia ${VIZDOOM_LIBS} libvizdoom_static) -set_target_properties(vizdoomjl - PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${VIZDOOM_OUTPUT_DIR} - LIBRARY_OUTPUT_DIRECTORY_RELEASE ${VIZDOOM_OUTPUT_DIR} - LIBRARY_OUTPUT_DIRECTORY_DEBUG ${VIZDOOM_OUTPUT_DIR} - LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${VIZDOOM_OUTPUT_DIR} - LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${VIZDOOM_OUTPUT_DIR}) \ No newline at end of file diff --git a/src/lib_julia/ViZDoomJuliaModule.cpp b/src/lib_julia/ViZDoomJuliaModule.cpp deleted file mode 100644 index 3ca204a5f..000000000 --- a/src/lib_julia/ViZDoomJuliaModule.cpp +++ /dev/null @@ -1,461 +0,0 @@ -#include "ViZDoom.h" -#include - -using namespace vizdoom; - -namespace jlcxx -{ -template <> -struct IsBits : std::true_type -{ -}; -template <> -struct IsBits : std::true_type -{ -}; -template <> -struct IsBits : std::true_type -{ -}; -template <> -struct IsBits : std::true_type -{ -}; -template <> -struct IsBits