Skip to content

Commit

Permalink
Updated README.md and different parts of the documentation, added FAQ.md
Browse files Browse the repository at this point in the history
Former-commit-id: b3ab99f
  • Loading branch information
mwydmuch committed Apr 12, 2018
1 parent 0a325bc commit 0aacdda
Show file tree
Hide file tree
Showing 10 changed files with 361 additions and 16 deletions.
31 changes: 27 additions & 4 deletions README.md
Expand Up @@ -5,10 +5,9 @@ ViZDoom allows developing AI **bots that play Doom using only the visual informa

ViZDoom is based on [ZDoom](https://github.com/rheit/zdoom) to provide the game mechanics.

**ViZDoom is the platform for [Visual Doom Competition @ CIG 2017](http://vizdoom.cs.put.edu.pl/competition-cig-2017).** :goberserk:
**ViZDoom is the platform for [Visual Doom Competition @ CIG 2018](http://vizdoom.cs.put.edu.pl/competition-cig-2018).** :goberserk:

![vizdoom_deadly_corridor](https://github.com/mwydmuch/ViZDoom/blob/master/gifs/vizdoom_corridor.gif)
![vizdoom_deathmatch](https://github.com/mwydmuch/ViZDoom/blob/master/gifs/vizdoom_deathmatch.gif)

## Features
- Multi-platform,
Expand All @@ -29,7 +28,7 @@ ViZDoom API is **reinforcement learning** friendly (suitable also for learning f

## Cite as

>Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek & Wojciech Jaśkowski, ViZDoom: A Doom-based AI Research Platform for Visual Reinforcement Learning, IEEE Conference on Computational Intelligence and Games, pp. 341-348, Santorini, Greece, 2016 ([arXiv:1605.02097](http://arxiv.org/abs/1605.02097))
> Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek & Wojciech Jaśkowski, ViZDoom: A Doom-based AI Research Platform for Visual Reinforcement Learning, IEEE Conference on Computational Intelligence and Games, pp. 341-348, Santorini, Greece, 2016 ([arXiv:1605.02097](http://arxiv.org/abs/1605.02097))
### Bibtex:
```
Expand Down Expand Up @@ -67,6 +66,8 @@ For Windows we are providing compiled runtime binaries and development libraries
- [Lua 5.1 & LuaJIT (64-bit)](https://github.com/mwydmuch/ViZDoom/releases/download/1.1.5pre/ViZDoom-1.1.5pre-Win-Lua51-LuaJIT-x86_64.zip)
- [Java (64-bit)](https://github.com/mwydmuch/ViZDoom/releases/download/1.1.5pre/ViZDoom-1.1.5pre-Win-Java-x86_64.zip)

See **[Installation of Windows binaries](doc/Building.md#windows_bin)**


## Examples

Expand All @@ -82,6 +83,9 @@ Python examples are currently the richest, so we recommend to look at them, even
**See also the [tutorial](http://vizdoom.cs.put.edu.pl/tutorial).**


## Tutorials


## Documentation

Detailed description of all types and methods:
Expand All @@ -92,7 +96,26 @@ Detailed description of all types and methods:
- [Exceptions](doc/Exceptions.md)
- [Utilities](doc/Utilities.md)

[Changelog](doc/Changelog.md) for 1.1.X version.
Additional documents:

- **[FAQ](doc/FAQ.md)**
- [Changelog](doc/Changelog.md) for 1.1.X version.

Also full documentation of engine and ACS scripting language can be found on
[ZDoom Wiki](https://zdoom.org/wiki/).

Useful parts:

- [ACS](https://zdoom.org/wiki/ACS)
- [CVARs](https://zdoom.org/wiki/CVARs) (Console Variables)
- [CCMDs](https://zdoom.org/wiki/CCMDs) (Console Commands)


## Awesome Doom tools

- [SLADE3](http://slade.mancubus.net/) - Doom map (scenario) editor for Linux, MacOS and Windows.
- [Doom Builder 2](http://www.doombuilder.com/) - another Doom map editor for Windows.
- [OBLIGE](http://oblige.sourceforge.net/) - Doom random map generator and [PyOblige](https://github.com/mwydmuch/PyOblige) is a simple Python wrapper for it.


## Contributions
Expand Down
195 changes: 195 additions & 0 deletions cmake_modules/FindPythonLibsNew.cmake
@@ -0,0 +1,195 @@
# - Find python libraries
# This module finds the libraries corresponding to the Python interpreter
# FindPythonInterp provides.
# This code sets the following variables:
#
# PYTHONLIBS_FOUND - have the Python libs been found
# PYTHON_PREFIX - path to the Python installation
# PYTHON_LIBRARIES - path to the python library
# PYTHON_INCLUDE_DIRS - path to where Python.h is found
# PYTHON_MODULE_EXTENSION - lib extension, e.g. '.so' or '.pyd'
# PYTHON_MODULE_PREFIX - lib name prefix: usually an empty string
# PYTHON_SITE_PACKAGES - path to installation site-packages
# PYTHON_IS_DEBUG - whether the Python interpreter is a debug build
#
# Thanks to talljimbo for the patch adding the 'LDVERSION' config
# variable usage.

#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
# Copyright 2012 Continuum Analytics, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================

# Checking for the extension makes sure that `LibsNew` was found and not just `Libs`.
if(PYTHONLIBS_FOUND AND PYTHON_MODULE_EXTENSION)
return()
endif()

# Use the Python interpreter to find the libs.
if(PythonLibsNew_FIND_REQUIRED)
find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED)
else()
find_package(PythonInterp ${PythonLibsNew_FIND_VERSION})
endif()

if(NOT PYTHONINTERP_FOUND)
set(PYTHONLIBS_FOUND FALSE)
return()
endif()

# According to http://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter
# testing whether sys has the gettotalrefcount function is a reliable, cross-platform
# way to detect a CPython debug interpreter.
#
# The library suffix is from the config var LDVERSION sometimes, otherwise
# VERSION. VERSION will typically be like "2.7" on unix, and "27" on windows.
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
"from distutils import sysconfig as s;import sys;import struct;
print('.'.join(str(v) for v in sys.version_info));
print(sys.prefix);
print(s.get_python_inc(plat_specific=True));
print(s.get_python_lib(plat_specific=True));
print(s.get_config_var('SO'));
print(hasattr(sys, 'gettotalrefcount')+0);
print(struct.calcsize('@P'));
print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION'));
print(s.get_config_var('LIBDIR') or '');
print(s.get_config_var('MULTIARCH') or '');
"
RESULT_VARIABLE _PYTHON_SUCCESS
OUTPUT_VARIABLE _PYTHON_VALUES
ERROR_VARIABLE _PYTHON_ERROR_VALUE)

if(NOT _PYTHON_SUCCESS MATCHES 0)
if(PythonLibsNew_FIND_REQUIRED)
message(FATAL_ERROR
"Python config failure:\n${_PYTHON_ERROR_VALUE}")
endif()
set(PYTHONLIBS_FOUND FALSE)
return()
endif()

# Convert the process output into a list
string(REGEX REPLACE ";" "\\\\;" _PYTHON_VALUES ${_PYTHON_VALUES})
string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES})
list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST)
list(GET _PYTHON_VALUES 1 PYTHON_PREFIX)
list(GET _PYTHON_VALUES 2 PYTHON_INCLUDE_DIR)
list(GET _PYTHON_VALUES 3 PYTHON_SITE_PACKAGES)
list(GET _PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION)
list(GET _PYTHON_VALUES 5 PYTHON_IS_DEBUG)
list(GET _PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P)
list(GET _PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX)
list(GET _PYTHON_VALUES 8 PYTHON_LIBDIR)
list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH)

# Make sure the Python has the same pointer-size as the chosen compiler
# Skip if CMAKE_SIZEOF_VOID_P is not defined
if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}"))
if(PythonLibsNew_FIND_REQUIRED)
math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8")
math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8")
message(FATAL_ERROR
"Python config failure: Python is ${_PYTHON_BITS}-bit, "
"chosen compiler is ${_CMAKE_BITS}-bit")
endif()
set(PYTHONLIBS_FOUND FALSE)
return()
endif()

# The built-in FindPython didn't always give the version numbers
string(REGEX REPLACE "\\." ";" _PYTHON_VERSION_LIST ${_PYTHON_VERSION_LIST})
list(GET _PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
list(GET _PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
list(GET _PYTHON_VERSION_LIST 2 PYTHON_VERSION_PATCH)

# Make sure all directory separators are '/'
string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX ${PYTHON_PREFIX})
string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES})

if(CMAKE_HOST_WIN32)
set(PYTHON_LIBRARY
"${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib")

# when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the
# original python installation. They may be found relative to PYTHON_INCLUDE_DIR.
if(NOT EXISTS "${PYTHON_LIBRARY}")
get_filename_component(_PYTHON_ROOT ${PYTHON_INCLUDE_DIR} DIRECTORY)
set(PYTHON_LIBRARY
"${_PYTHON_ROOT}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib")
endif()

# raise an error if the python libs are still not found.
if(NOT EXISTS "${PYTHON_LIBRARY}")
message(FATAL_ERROR "Python libraries not found")
endif()

else()
if(PYTHON_MULTIARCH)
set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}/${PYTHON_MULTIARCH}" "${PYTHON_LIBDIR}")
else()
set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}")
endif()
#message(STATUS "Searching for Python libs in ${_PYTHON_LIBS_SEARCH}")
# Probably this needs to be more involved. It would be nice if the config
# information the python interpreter itself gave us were more complete.
find_library(PYTHON_LIBRARY
NAMES "python${PYTHON_LIBRARY_SUFFIX}"
PATHS ${_PYTHON_LIBS_SEARCH}
NO_DEFAULT_PATH)

# If all else fails, just set the name/version and let the linker figure out the path.
if(NOT PYTHON_LIBRARY)
set(PYTHON_LIBRARY python${PYTHON_LIBRARY_SUFFIX})
endif()
endif()

MARK_AS_ADVANCED(
PYTHON_LIBRARY
PYTHON_INCLUDE_DIR
)

# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the
# cache entries because they are meant to specify the location of a single
# library. We now set the variables listed by the documentation for this
# module.
SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")

find_package_message(PYTHON
"Found PythonLibs: ${PYTHON_LIBRARY}"
"${PYTHON_EXECUTABLE}${PYTHON_VERSION}")

set(PYTHONLIBS_FOUND TRUE)
13 changes: 12 additions & 1 deletion doc/Building.md
Expand Up @@ -6,6 +6,7 @@
* [Windows](#windows_deps)
* [Installation via PyPI(pip/conda)](#pypi)
* [Installation via LuaRocks](#luarocks)
* [Installation of build Windows binaries](#windows_bin)
* [Building (not recommended)](#build)
* [Linux](#linux_build)
* [MacOS](#macos_build)
Expand Down Expand Up @@ -145,6 +146,16 @@ luarocks make
```


## <a name="windows_bin"></a> 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`


## <a name="build"></a> Building

### <a name="linux_build"></a> Linux
Expand Down Expand Up @@ -200,7 +211,7 @@ cmake -DCMAKE_BUILD_TYPE=Release \

### <a name="windows_build"></a> Windows

Setting up the compilation on Windows is really tedious so using the precompiled binaries is recommended.
Setting up the compilation on Windows is really tedious so using the [precompiled binaries](#windows_bin) is recommended.

`vizdoom` directory from Python builds contains complete Python package for Windows.
You can copy it to your project directory or copy it into `python_dir/lib/site-packages/vizdoom` to install it globally in your system.
Expand Down
18 changes: 10 additions & 8 deletions doc/ConfigFile.md
@@ -1,5 +1,5 @@
# Configuration files
Instead of configuring the ViZDoom in code, you can load it from configuration file(s). Each file is read sequentially, so multiple entries with the same key will overwrite previous entries.
Instead of configuring the ViZDoom in code, you can load it from the configuration file(s). Each file is read sequentially, so multiple entries with the same key will overwrite previous entries.

## <a name="format"></a> Format
Each entry in a configraution file is a pair of **key** and **value** separated by an equal sign (**"="**). The file format should also abide the following rules:
Expand All @@ -10,7 +10,7 @@ Each entry in a configraution file is a pair of **key** and **value** separated
* underscores in **keys** are ignored (*episode_timeout* is equivalent to *episodetimeout*),
* string values should **not** be surrounded with apostrophes or quotation marks.

A violation of any of these rules will result in ignoring **only** the line with the error and sending a warning message to stderr (""WARNING! Loading config from: ...").
A violation of any of these rules will result in ignoring **only** the line with the error and sending a warning message to stderr ("WARNING! Loading config from: ...").

### <a name="list"></a> List of values
**available_buttons** and **available_game_variables** are special parameters, which use multiple values and instead of a single value they expect a list of values separated by whitespaces and enclosed within braces ("{" and "}"). The list can stretch throughout multiple lines as long as all values are separated from each other by whitespaces.
Expand Down Expand Up @@ -55,6 +55,8 @@ Each list assignment (**KEY = { VALUES }**)clears values specified for this key
* `ViZDoomPath/vizdoom_path`
* `windowVisible/window_visible`

See also: [`DoomGame`](DoomGame.md) for config keys and functions related to them.


### <a name="sample_config"></a>Sample configuration file content:

Expand Down Expand Up @@ -86,16 +88,16 @@ episode_timeout = 300

# Available buttons
available_buttons =
{
MOVE_LEFT
MOVE_RIGHT
ATTACK
}
{
MOVE_LEFT
MOVE_RIGHT
ATTACK
}

# Game variables that will be in the state
available_game_variables = { AMMO2}

# Default mode - game is controlled from the code
# Default mode - the game is controlled from the code
mode = PLAYER

# Difficulty of gameplay ranging from 1 (baby) to 5 (nightmare)
Expand Down
16 changes: 16 additions & 0 deletions doc/DoomGame.md
Expand Up @@ -27,6 +27,7 @@
* [getAvailableButtonsSize](#getAvailableButtonsSize)
* [setButtonMaxValue](#setButtonMaxValue)
* [getButtonMaxValue](#getButtonMaxValue)
* [getButton](#getButton)

## [GameVariables methods](#vars)
* [getAvailableGameVariables](#getAvailableGameVariables)
Expand Down Expand Up @@ -475,6 +476,21 @@ See also:
- [`Types: Button`](Types.md#button)


---
### <a name="getButton"></a> `getButton`

| C++ | `double getButton(Button button)` |
| :-- | :-- |
| Lua | `number getButton(Button button)` |
| Java | `double getButton(Button button)` |
| Python | `float get_button(Button button)` |

Returns the current state of the specified button (`ATTACK`, `USE` etc.).

See also:
- [`Types: Button`](Types.md#button)


## <a name="vars"></a> GameVariables methods

---
Expand Down

0 comments on commit 0aacdda

Please sign in to comment.