- moba_env is a mini moba game, which can be integrated into gym env.
- You can use this env to train AI for moba game.
- All moba logic is implemented in go lang, which is easy to maintain.
- gamecore is the folder containing all the moba game logic,
- gym_moba is the folder containing the interface needed to integrate the gamecore logic into gym env.
- go
- gym env
- tensorflow 1.14.0
- opencv2, you can install by pip:
pip install opencv-python --user
- golang opengl support, need to run the following commands:
sudo apt-get install libgl1-mesa-dev libxinerama-dev libxcursor-dev libxi-dev xorg-dev
go get github.com/go-gl/gl/v4.1-core/gl
go get github.com/go-gl/glfw/v3.2/glfw
go get github.com/go-gl/mathgl/mgl32
go get github.com/ungerik/go3d/vec3
- golang tensorflow support, follow the following steps:
download TensorFlow C library, and extract to local lib and include path, e.g.sudo tar -C /usr/local -xzf (downloaded file)
reference:https://www.tensorflow.org/install/lang_c
execute command in terminal:go get github.com/tensorflow/tensorflow/tensorflow/go
- Enter gamecore folder, run:
go build ./
- Under moba_env folder, run:
pip install -e gym_moba --user
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib.
- Under moba_env folder, run python3 ../ppo.py, if you want to play the game, just change the is_train = False in main function.
- To modify test skill, please make modification as follows:
in vi.go file, 'UseSkill' function, enable your tuning skill, disable other skills by short return
in ppo_multihead.py file, 'predict' function, disable the direction mask of your tuning skill by commenting the 'actions[2] = -1' line, while maintaining masks of other skills. - To manually control agent to defeat enemy, please edit main.go file, modify this line as follows(set _gym_mode to false):
_gym_mode := flag.Bool("gym_mode", false, "a bool")
Control tips:Left mouse button = set move target, Right mouse button = set skill target, when using skill, you need to press key 1 or 2 or 3 or 4 first(correspond to skill 1, 2, 3, 4), then press right mouse button to set skill target direction - If you want to slow down the training in order to view the agent learning process clearly, you can modify moba_env.py, change
-slow_tick=false
to-slow_tick=true