One of the tasks in this year's GCI - and from my point of view so far the hardest task - was investigating the Serpent AI system and showing a bot playing Terasology. So, the first thing I would like to tell you - if you want to try that that yourself, think about it again. It might have been just for me, but there is so MUCH complications even INSTALLING Serpent AI I still have to decide whether it was worth it. Also, small disclaimer, I'm on linux, so your experience on windows might not be the same.
Dependencies
Large part of my frustration probably comes already from the first of dependencies, which is Python 3.6. On SerpentAI's wiki there is suggested to use pyenv for installation and handling of python, but I have rather decided to compile python 3.6 myself. That said about python. Next dependency is Redis server. No problem in installing this, but one caveat - once installed, it launches itself and constantly uses up about 800MB RAM, which may be (and for me, was) a problem. Tesseract was also alright - it is mainly a library, and only has a few dependencies itself. A bit more problematic dependency was Kivy, having lots of dependencies itself. In the end, after all the dependencies were installed, the final installation was just a piece of cake, being it installation through pip. I ditched the optional dependency, not needing it, and also not having the required hardware.
Setting up
Setting the Serpent AI to be capable of at least launching Terasology turned out to be very hard in the end. That's because Serpent requires an executable to launch. I tried using the files downloaded from terasology.org, I tried hooking it to generated jar files in terasology workspace, but nothing worked, so in the end, I had to mark as an executable a simple shell script, which then 'cd''d to workspace location, and performed a './gradlew jar game'. Detencting of the game's windows worked then without any problem.
Something to do in the game's window
For the final task, the bot has had to interact with the window somehow. I walked through Serpent's helloworld tutorial, which by the way gave me a lot of frustration because of how the important bits are hidden between the loads of the text. The final interaction bot performed with the game, consisted of clicking on predefined coordinates, which by the way corresponded to buttons required to click to create new world.
Final note
Because the serpent failed to detect when the game finishes loading, I had to manually modify its launch script and set it to sleep for 20 seconds after it thinks the game is loaded. Because the same script is however invoked when launching a bot, there is a 20 sec delay on that.
Video : https://drive.google.com/file/d/1rpzWpRh0denUncUAc9XfHyzuwC96BcdK/view?usp=sharing
Dependencies
Large part of my frustration probably comes already from the first of dependencies, which is Python 3.6. On SerpentAI's wiki there is suggested to use pyenv for installation and handling of python, but I have rather decided to compile python 3.6 myself. That said about python. Next dependency is Redis server. No problem in installing this, but one caveat - once installed, it launches itself and constantly uses up about 800MB RAM, which may be (and for me, was) a problem. Tesseract was also alright - it is mainly a library, and only has a few dependencies itself. A bit more problematic dependency was Kivy, having lots of dependencies itself. In the end, after all the dependencies were installed, the final installation was just a piece of cake, being it installation through pip. I ditched the optional dependency, not needing it, and also not having the required hardware.
Setting up
Setting the Serpent AI to be capable of at least launching Terasology turned out to be very hard in the end. That's because Serpent requires an executable to launch. I tried using the files downloaded from terasology.org, I tried hooking it to generated jar files in terasology workspace, but nothing worked, so in the end, I had to mark as an executable a simple shell script, which then 'cd''d to workspace location, and performed a './gradlew jar game'. Detencting of the game's windows worked then without any problem.
Something to do in the game's window
For the final task, the bot has had to interact with the window somehow. I walked through Serpent's helloworld tutorial, which by the way gave me a lot of frustration because of how the important bits are hidden between the loads of the text. The final interaction bot performed with the game, consisted of clicking on predefined coordinates, which by the way corresponded to buttons required to click to create new world.
Final note
Because the serpent failed to detect when the game finishes loading, I had to manually modify its launch script and set it to sleep for 20 seconds after it thinks the game is loaded. Because the same script is however invoked when launching a bot, there is a 20 sec delay on that.
Video : https://drive.google.com/file/d/1rpzWpRh0denUncUAc9XfHyzuwC96BcdK/view?usp=sharing