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

Abstract

<p class="AbstractTitle"><strong>Abstract</strong></p><p class="BodyAbstract">Racing 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).</p><p class="BodyAbstract"><strong>Keywords</strong><strong>:</strong> Braking Decision, Racing Game Starter Kit, Naïve Bayes, Machine learning, Unity engine</p><p class="BodyAbstract"> </p><p class="AbstractTitle"><strong>Abstrak</strong></p><p class="BodyAbstract">Genre 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).</p><p class="BodyAbstract"><strong>Kata kunci</strong><strong>:</strong> Keputusan Pengereman, Racing Game Starter Kit, Naïve Bayes, Pembelajaran Mesin, Unity Engine</p>