Doom with DRQN

Now, let us see how to make use of the DRQN algorithm to train our agent to play Doom. We assign positive rewards for successfully killing the monsters and negative rewards for losing life, suicide, and losing ammo (bullets). You can get the complete code as a Jupyter notebook with the explanation at The credits for the code used in this section go to Luthanicus (

First, let us import all the necessary libraries:

import tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltfrom vizdoom import ...

Get Hands-On Reinforcement Learning with Python now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.