Creating Self-Learning AI using Unity Machine Learning
Juhola, Olli-Pekka (2019)
Juhola, Olli-Pekka
2019
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-2019102820276
https://urn.fi/URN:NBN:fi:amk-2019102820276
Tiivistelmä
Tarkoituksena oli kehittää tekoäly yksinkertaiselle pelille käyttämällä kahta erillistä menetelmää Unity-pelimoottorin kanssa ja verrata tuloksia toisiinsa. Toteutustapoina käytettiin Unity-pelimoottorin omaa navigointi- ja polkujen hakujärjestelmää sekä Unityn valmistamaa työkalua, joka mahdollistaa koneoppimisen käytön Unityprojekteissa. Päätavoitteena oli saada aikaan toimivia prototyyppejä käyttämällä molempia menetelmiä tekoälyn etsiessä ja kerätessä kolikoita ympäristössä sekä pystyä osoittamaan, kuinka molemmat menetelmät toteutettiin. Seurauksena oli, että kehitettiin kaksi toimivaa peliä erilaisilla tekoälyn menetelmillä, ja molemmat tekoälyagentit etsivät ja keräsivät kolikot toivotulla tavalla. Koneoppimismenetelmässä käytettiin vahvistettua oppimista tekoälyn koulutuksessa, jolloin agentti ei tiennyt pelistä mitään muuta kuin miten liikkua. Tämän jälkeen se harjoitteli itsenäisesti ympäristössä satoja kertoja minuutissa saadakseen selville pelin ytimen. Unityn navigointi- ja polunmääritysmenetelmä luotiin Unityn navigointiverkkojärjestelmällä, jonka avulla tekoäly ymmärsi, minne pystyi liikkumaan ja tiesi kolikoiden sijainnin automaattisesti. Nämä kaksi menetelmää asetettiin toisiaan vastaan yksinkertaisessa testissä, jotta pystyttiin näkemään, kuinka monta kolikkoa molemmat tekoälyn menetelmät keräsivät muutaman minuutin aikana. Kullakin menetelmällä kerätyistä kolikoista koneoppinut tekoäly sai huomattavan määrän enemmän kolikoita ja pystyi lyömään Unity-moottorin oman navigointi- ja polkujärjestelmän. Koneoppimisen käyttö tekoälyn luomisessa Unity-pelimoottorissa oli vaikeampaa, mutta tulokset olivat paljon kiehtovampia The objective was to develop artificial intelligence for a simple game by using two distinct
methods with the Unity Game Engine and comparing the results with each other.
The implementation methods used were Unity Game Engine’s own Navigation and Pathfinding system and a toolkit made by Unity that allows the use of Machine Learning inside
Unity projects. The main goal was to achieve working prototypes using both methods with
the artificial intelligence seeking out and collecting coins in the environment and to
demonstrate how both methods were implemented.
As a result, two functioning games were developed with the two different artificial intelligence methods and in both, the artificial intelligent agent will seek out and collect the
coins as it should. The Machine Learning method used reinforced learning in the training of
the artificial intelligent agents, where the agent did not know anything about the game except how to move after which it trained itself in the environment hundreds of times in a
minute to figure out the core of the game. Unity Navigation and Pathfinding method was
created using Unity’s Navigation Mesh system, which allows the artificial intelligence to figure out where it can move as well as know the location of the coins immediately.
The two methods were placed against each other in a simple test to see how many coins
both artificial intelligence methods would collect during a few minutes. The amount of
coins collected by each method resulted in a fascinating score for the Machine Learnt artificial intelligence, which was able to beat Unity Engines own Navigation and Pathfinding
system hands down. The use of Machine Learning in creating artificial intelligence in Unity
was trickier to create; however, the results there were much more fascinating.
methods with the Unity Game Engine and comparing the results with each other.
The implementation methods used were Unity Game Engine’s own Navigation and Pathfinding system and a toolkit made by Unity that allows the use of Machine Learning inside
Unity projects. The main goal was to achieve working prototypes using both methods with
the artificial intelligence seeking out and collecting coins in the environment and to
demonstrate how both methods were implemented.
As a result, two functioning games were developed with the two different artificial intelligence methods and in both, the artificial intelligent agent will seek out and collect the
coins as it should. The Machine Learning method used reinforced learning in the training of
the artificial intelligent agents, where the agent did not know anything about the game except how to move after which it trained itself in the environment hundreds of times in a
minute to figure out the core of the game. Unity Navigation and Pathfinding method was
created using Unity’s Navigation Mesh system, which allows the artificial intelligence to figure out where it can move as well as know the location of the coins immediately.
The two methods were placed against each other in a simple test to see how many coins
both artificial intelligence methods would collect during a few minutes. The amount of
coins collected by each method resulted in a fascinating score for the Machine Learnt artificial intelligence, which was able to beat Unity Engines own Navigation and Pathfinding
system hands down. The use of Machine Learning in creating artificial intelligence in Unity
was trickier to create; however, the results there were much more fascinating.