NPC Braking Decision for Unity Racing Game Starter Kit Using Naïve Bayes

Authors

  • Muhammad Aminul Akbar University of Brawijaya http://orcid.org/0000-0003-0794-7443
  • Tri Afirianto University of Brawijaya
  • Steven Willy Sanjaya University of Brawijaya
  • Ratih Kartika Dewi University of Brawijaya

DOI:

https://doi.org/10.21111/fij.v4i2.3591

Keywords:

Braking Decision, Racing Game Starter Kit, Naïve Bayes, Machine Learning, Unity Engine

Abstract

AbstractRacing video game genre was still being popular today. One way to develop racing games quickly is by using a template or kit that is on the game engine. Racing Game Starter Kit (RGSK) was being the most popular racing game template for Unity game engine. However, there was problem in racing game’s NPC especially in RGSK related to NPC vehicle’s braking decision. The commonly used method is the Brake Zone, but the developers must manually place the zone themselves in the designated locations for braking. The solution that can be applied for that problem is see the angle formed by the vector of the NPC vehicle with the vector from 2 next following waypoint then determine the best configuration angle threshold for NPC braking, but this also has its shortcoming in which to get the best result, a proper threshold configuration is needed in each track. To resolve the problem, researcher proposed the method of machine learning, Naïve Bayes for the braking decision. Naïve Bayes uses two output classes (brake or no brake) in which the data will be obtained from the player. We use data from players who can control racing car games well or have never hit a wall and have fast lap times. The purpose of this study is to provide an alternative braking method to RGSK that can provide fast lap times but does not affect the game's FPS and without the need to determine or change any parameters on each track. The test result using RGSK v1.1.0a in Unity Game Engine showed that the proposed method can be an alternative method in RGSK braking decisions. Our NPC has faster lap time and was able to prevent the vehicle from crashing with the outer wall without dropping the game’s FPS (Frames per Second).Keywords: Braking Decision, Racing Game Starter Kit, Naïve Bayes, Machine learning, Unity engine AbstrakGenre video gim balap masih populer saat ini. Salah satu cara untuk mengembangkan game balap dengan cepat adalah menggunakan template atau kit yang ada di game engine. Racing Game Starter Kit (RGSK) adalah templat game balap paling populer pada Unity Game Engine. Namun, terdapat permasalahan NPC pada gim balapan terutama di RGSK terkait dengan keputusan pengereman kendaraan NPC. Metode yang digunakan untuk eksperimen jenis ini adalah Zona Rem. Namun, pengembang harus secara manual menempatkan zona tersebut di lokasi tertentu pada setiap lintasan. Solusi dari masalah ini yang sudah diterapkan pada RGSK v1.1.0a yaitu dapat menggunakan sudut yang dibentuk oleh vektor kendaraan NPC dengan vektor dari 2 titik arah berikutnya, kemudian menentukan ambang sudut terbaik untuk pengereman NPC, tetapi ini juga memiliki masalah yaitu untuk mendapatkan hasil putaran terbaik atau cepat, perlu menentukan konfigurasi ambang batas yang tepat di setiap trek. Untuk mengatasi masalah tersebut, peneliti mengusulkan metode pembelajaran mesin, Naïve Bayes untuk keputusan pengereman. Naïve Bayes menggunakan dua kelas output (rem atau tidak ada mengerem) di mana data akan diperoleh dari pemain. Kami menggunakan data dari pemain yang dapat mengontrol permainan mobil balap dengan baik atau tidak pernah menabrak tembok dan memiliki waktu putaran yang cepat. Tujuan dari penelitian ini adalah untuk memberikan metode pengereman alternatif untuk RGSK yang dapat memberikan waktu putaran yang cepat namun tidak mempengaruhi FPS game dan tanpa perlu menentukan atau mengubah parameter apa pun di setiap trek. Hasil pengujian menggunakan RGSK v1.1.0a di Unity Game Engine menunjukkan bahwa metode yang diusulkan dapat menjadi metode alternatif dalam keputusan pengereman RGSK. NPC kami mempunyai waktu putaran yang lebih cepat dan mampu mencegah kendaraan agar tidak menabrak dinding luar tanpa menjatuhkan FPS game (Frame per Detik).Kata kunci: Keputusan Pengereman, Racing Game Starter Kit, Naïve Bayes, Pembelajaran Mesin, Unity Engine

References

[1] F. Totu, “100 million Need for Speed Games Have Been Sold to This Day.” .[2] Electronics Arts, “Need For Speed Payback.,” 2017. .[3] Unity, “Unity Asset Store.” .[4] J. Wang, “Classification of Humans and Bots in Two Typical Two-player Computer Games,” in 2018 3rd International Conference on Computer and Communication Systems (ICCCS), 2018, pp. 502–505.[5] I. Mabruroh and D. Herumurti, “Adaptive Non Playable Character in RPG Game Using Logarithmic Learning For Generalized Classifier Neural Network (L-GCNN),” Kinet. Game Technol. Inf. Syst. Comput. Network, Comput. Electron. Control, vol. 4, no. 2, p. 127, 2019.[6] Y. Sazaki, A. Primanita, and M. Syahroyni, “Pathfinding car racing game using dynamic pathfinding algorithm and algorithm A∗,” in Proceedings - ICWT 2017: 3rd International Conference on Wireless and Telematics 2017, 2018, vol. 2017-July, pp. 164–169.[7] C. Bennett and D. V. Sagmiller, Unity AI Programming Essentials. Packt Publishing Limited, 2014.[8] M. T. Chan, C. W. Chan, and C. Gelowitz, “Development of a Car Racing Simulator Game Using Artificial Intelligence Techniques,” Int. J. Comput. Games Technol., vol. 2015, pp. 1–6, 2015.[9] D. Loiacono et al., “The 2009 simulated car racing championship,” IEEE Trans. Comput. Intell. AI Games, vol. 2, no. 2, pp. 131–147, 2010.[10] Y. Sazaki, H. Satria, and M. Syahroyni, “Comparison of A∗ and dynamic pathfinding algorithm with dynamic pathfinding algorithm for NPC on car racing game,” Proceeding 2017 11th Int. Conf. Telecommun. Syst. Serv. Appl. TSSA 2017, vol. 2018-Janua, pp. 1–6, 2018.[11] I. Game, “Racing Game Starter Kit,” 2016. .[12] M. Botta, V. Gautieri, D. Loiacono, and P. L. Lanzi, “Evolving the optimal racing line in a high-end racing game,” 2012 IEEE Conf. Comput. Intell. Games, CIG 2012, pp. 108–115, 2012.[13] H. Tang, C. H. Tan, K. C. Tan, and A. Tay, “Neural network versus behavior based approach in simulated car racing game,” 2009 IEEE Work. Evol. Self-Developing Intell. Syst. ESDIS 2009 - Proc., vol. 117576, pp. 58–65, 2009.[14] J. E. Cechanowicz, C. Gutwin, S. Bateman, R. Mandryk, and I. Stavness, “Improving player balancing in racing games,” Proc. first ACM SIGCHI Annu. Symp. Comput. Interact. Play - CHI Play ’14, pp. 47–56, 2014.[15] K. Wang and W. Shang, “Outcome prediction of DOTA2 based on Naïve Bayes classifier,” Proc. - 16th IEEE/ACIS Int. Conf. Comput. Inf. Sci. ICIS 2017, no. 1994, pp. 591–593, 2017.[16] M. A. Jabbar and S. Samreen, “Heart disease prediction system based on hidden naïve bayes classifier,” 2016 Int. Conf. Circuits, Control. Commun. Comput. I4C 2016, pp. 1–5, 2017.[17] Y. An, S. Sun, and S. Wang, “Naive Bayes classifiers for music emotion classification based on lyrics,” Proc. - 16th IEEE/ACIS Int. Conf. Comput. Inf. Sci. ICIS 2017, no. 1, pp. 635–638, 2017.[18] W. Hamilton and M. O. Shafiq, “Opponent resource prediction in starcraft using imperfect information,” Proc. - 9th IEEE Int. Conf. Big Knowledge, ICBK 2018, pp. 368–375, 2018.[19] G. Synnaeve and P. Bessière, “A Bayesian model for opening prediction in RTS games with application to StarCraft,” 2011 IEEE Conf. Comput. Intell. Games, CIG 2011, pp. 281–288, 2011.[20] F. Thabtah, L. Zhang, and N. Abdelhamid, “NBA Game Result Prediction Using Feature Analysis and Machine Learning,” Ann. Data Sci., vol. 6, no. 1, pp. 103–116, 2019.[21] A. Ashari, I. Paryudi, and A. Min, “Performance Comparison between Naïve Bayes, Decision Tree and k-Nearest Neighbor in Searching Alternative Design in an Energy Simulation Tool,” Int. J. Adv. Comput. Sci. Appl., vol. 4, no. 11, pp. 33–39, 2013.[22] S. Raschka, “Naive Bayes and Text Classification I - Introduction and Theory,” pp. 1–20, 2014.[23] S. J. Russell and P. Norvig, Artificial Intelligence A Modern Approach; PearsonEducation. 2003.[24] K. T. Claypool and M. Claypool, “On frame rate and player performance in first person shooter games,” Multimed. Syst., vol. 13, no. 1, pp. 3–17, 2007.

Downloads

Submitted

2019-10-27

Accepted

2019-12-12

Published

2019-12-12

Issue

Section

Articles