GoingMyWay / ViZDoomAgents

😈 Train ViZDoom agents by Reinforcement Learning 👻
11 stars 4 forks source link
deep-reinforcement-learning reinforcement-learning tensorflow vizdoom

ViZDoom FPS AI based on A3C algorithm

Scenarios

Solved Scenarios

Note that, except for deadly corridor and death match, A3C has gained not bad results on the rest scenarios

Requirements

Documents

The structure of the code

In every scenario, there is a network.py script, an agent.py script and a main.py file to run the code

All the configurations are in the configs.py file in each scenario. Or you can use the shell scripts to run it. The contents in both configs.py and shell scripts are self-explained.

The check_point directory stores checkpoint data of the neural network in each specific step, and the summaries directory stores events files contain data while helps developers to understand what's going on with the model only during training stage. You can use tensorboard command to visualise the data, for example

setsid tensorboard --logdir=D3_battle --port=7400 > logs.D3_battle 2>&1

Note that, if you want to train the model, no GUI will be prompted out since game window will not visible as you can see in the code game.set_window_visible(self.play), when training self.play is False.

So, after training a model, how can I run it locally? You should set IS_TRAIN in config.py to False and set the model_file value, for instance 'model-30150.ckpt'.

To get started, you can run the code of the code of healthpack gathering scenario to get familiar with the code.

If you have any problem, please open an issue!

The code of A3C framework was modified from awjuliani's repo.

Some suggestions for developers

Some useful commands

Get the runing processes' directory

$ for id in `ps -ef | grep main.py | awk '{print $2}'`; do ls -l /proc/${id}/cwd ; done    
ls: cannot access /proc/10800/cwd: No such file or directory
lrwxrwxrwx 1 doom doom 0 Aug 30 23:19 /proc/23963/cwd -> /home/doom/Code/battle_new
lrwxrwxrwx 1 doom doom 0 Aug 29 19:30 /proc/38867/cwd -> /home/doom/Code/battle
lrwxrwxrwx 1 doom doom 0 Sep  2 00:10 /proc/39261/cwd -> /home/doom/Code/battle_decay
lrwxrwxrwx 1 doom doom 0 Sep  2 00:10 /proc/39706/cwd -> /home/doom/Code/battle_new_2

Get the utilization of GPU for every 5 seconds

while true; do nvidia-smi --query-gpu=utilization.memory --format=csv && nvidia-smi --query-gpu=utilization.gpu --format=csv; sleep 5; done

Some helpful links

Videos

You can watch the videos of the results on Youtube.