Author: Jernej Habjan
Title:
Visual representation of RTS game, supported by deep reinforcement learning algorithm Alpha Zero written in python.
install Visual Studio
C:\Program Files\Python36
Install anaconda with python 3.6 -- make sure its 64 bit if using 64 bit windows
C:\ProgramData\Anaconda3
Install Python dev environment https://developer.nvidia.com/how-to-cuda-python
type this in anaconda prompt with admin rights
conda update conda
conda install numba
conda install cudatoolkit
conda install -c peterjc123 pytorch cuda90
Install cuda:
vertify cuda installation:
nvcc --version
make sure its added to env variables:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp
#### TensorFlow Gpu
Todo - check if i can only import whole conda environment from below tutorial
Install tensorflow in pycharm and not from conda cmd (launch it in admin)
Interpreter-> check "Use conda package manager button" on the right,
add package -> tensorflow-gpu, tensorflow, tensorboard, keras 2.13 - version is important!
conda install graphviz
conda install pydot
Download Graphviz executable from Here
Add path to environmental variables and !important! restart Pycharm
C:\Program Files (x86)\Graphviz2.38\bin
to export form conda cmd
conda list --explicit > requirements.txt
to install on other machine
conda create --name myenv --file requirements.txt
activate myenv
Requirements are in _Files folder as requirements.txt
actions = ["idle", "up", "down", "right", "left", "mine_resources", "return_resources", "attack", "find_enemy", "npc", "rifle_infantry", "town_hall", "barracks", "sentry", "mining_shack", "continue_building"]
That sums up to 16 actions
Point is for algorithm to learn to select town hall and execute action 'npc' before opponent does Actions:
actions = ["idle", "up", "down", "right", "left", "npc"]
Action sequence:
npc
npc
npc
Neural network must select town hall, execute action 'npc' to create workers and individually move them towards minerals and pick minerals up Actions:
actions = ["idle", "up", "down", "right", "left", "mine_resources"]
Action sequence:
npc
(while not at minerals)
move (in apropriate direction)
gather_resources
Player would have to successfully return picked up minerals to resource drain like Town Hall or Mineral Mine. Actions:
actions = ["idle", "up", "down", "right", "left", "mine_resources", "return_resources"]
Action sequence:
npc
(while not at minerals)
move (in apropriate direction)
gather_resources
(while not at resource drain)
move (in apropriate direction)
return_resources
Player receives 1 TownHall and 1 NPC at start with 0 money and has to gather enough resources to build barracks. Actions:
actions = ["idle", "up", "down", "right", "left", "mine_resources", "return_resources", "barracks", "continue_building"]
Action sequence:
(while not enough minerals for barracks)
(while not at minerals)
move (in apropriate direction)
gather_resources
(while not at resource drain)
move (in apropriate direction)
return_resources
barracks
(while barracks not built)
continue_building
Point is to set timeout to lower number, which would force player to build economy (building new workers) while gathering minerals. It would need to place mining_shack closer to minerals to more efficiently gather minerals. Actions:
actions = ["idle", "up", "down", "right", "left", "mine_resources", "return_resources", "npc", "mining_shack"]
Action sequence:
(while enough minerals)
npc OR mining_shack
(while not at minerals)
move (in apropriate direction)
gather_resources
(while not at resource drain)
move (in apropriate direction)
return_resources
Player receives 1 TownHall and 1 NPC at start with 0 money and has to gather enough resources to build Barracks and from it Rifle unit. Actions:
actions = ["idle", "up", "down", "right", "left", "mine_resources", "return_resources", "rifle_infantry", "barracks", "continue_building"]
Action sequence:
(while not enough minerals for barracks)
(while not at minerals)
move (in apropriate direction)
gather_resources
(while not at resource drain)
move (in apropriate direction)
return_resources
barracks
(while barracks not built)
continue_building
(repeat step for gathering minerals until enough for Rifle unit)
rifle_unit
Player receives 1 TownHall and 1 NPC at start with 0 money and has to gather enough resources to build Barracks and from it Rifle unit. Then has to move rifle unit towards enemy and with it keep attacking enemy units until they are destroyed. Actions:
actions = ["idle", "up", "down", "right", "left", "mine_resources", "return_resources", "attack", "find_enemy", "npc", "rifle_infantry", "barracks", "continue_building"]
Action sequence:
(while not enough minerals for barracks)
(while not at minerals)
move (in apropriate direction)
gather_resources
(while not at resource drain)
move (in apropriate direction)
return_resources
barracks
(while barracks not built)
continue_building
(repeat step for gathering minerals until enough for Rifle unit)
rifle_unit
(while not at enemy)
move (in apropriate direction)
(while enemy is alive)
find_enemy
(while found enemy is alive)
attack
Fix port forwarding on your router
Ue4
Steam
Windows firewall
open 127.0.0.1:7777
It's located in
UE4EngineSourceCode/engine/binaries/win64/UnrealFrontend.exe
- if you don't have it - visual studio - class view - unreal frontend - right click and build, and then you can access it
- open UnrealFrontend.exe
- add custom Launch profile:
- Project - browse to your project and select Uproject File
- Do you wish to build -try without , but if errors - yes - in development
Cook - by the book
Cooked maps show all - check all
package - don't
deploy - don't
rename it on top:
close this and click on newly created "launch profile"
if errors when launching, Run it as build, or not...
Add python36.dll (64 - bit) to
YourProject/Publish/WindowsNoEditor/TD2020/Binaries/Win64/
cd C:\Users\Jernej\venv\Scripts tensorboard --logdir=C:\TrumpDefense2020\TD2020\Content\Scripts\td2020\models\logsTD2020NNet
MIT License
Copyright (c) 2018 Jernej Habjan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.