Implementation of Fuzzy Logic Algorithm to Improve NPC Decision-Making in 2D Adventure Games Using Unity
DOI:
https://doi.org/10.59934/jaiea.v4i3.1175Keywords:
Fuzzy Logic, NPC, 2D Game, Unity, Decision-MakingAbstract
In 2D adventure games, Non-Playable Characters (NPCs) play a crucial role in creating a more immersive and interactive experience. However, static and non-adaptive NPC behavior may reduce the game quality. This study aims to enhance NPC artificial intelligence by implementing the Fuzzy Logic algorithm in decision-making processes. The input parameters include the distance between the NPC and the player, the player's health level, and the player's level, with four possible outputs: chase, evade, defend, and wait. A fuzzy rule base consisting of 27 rules was developed and implemented in a Unity-based game. Testing was conducted on various input combinations to evaluate the NPC’s responses. Results indicate that NPCs respond more adaptively, such as evading when the player has high health and level at a close range, or waiting when the situation is unfavorable. This implementation improves interaction dynamics between NPCs and players, and adds strategic depth to the gameplay.
Downloads
References
I. Satrio, F. Santi Wahyuni, dan D. Rudhistiar, “PENERAPAN A* PATHFINDING DAN FSM (FINITE STATE MACHINE) PADA GAME ‘LOST CIVILIZATION’ BERBASIS ANDROID,” Jurnal Mahasiswa Teknik Informatika, vol. 6, no. 2, hlm. 1192–1199, 2022.
A. Qoiriah dan A. Haqi Annazili, “Implementasi Algoritma Fisher-Yates Shuffle Dan Fuzzy Tsukamoto Pada Game Petualangan Si Thole Berbasis Android Menggunakan Game Engine Unity,” Journal of Informatics and Computer Science), vol. 1, no. 4, hlm. 188–199, 2020.
R. Amalia, “GAME EDUKASI DAN CERITA INTERAKTIF SEJARAH KERAJAAN DI SUMATRA MENGGUNAKAN ALGORITMA FUZZY SUGENO UNTUK MENGATUR PERILAKU NPC,” Jurnal Informatika dan Rekayasa Perangkat Lunak (JATIKA), vol. 1, no. 2, hlm. 192–202, 2020.
I. Ilham Shagianto, G. Wahyu Wiriasto, D. Fikry Budiman, dan N. Made Seniari, “Aplikasi Game berbasis Andorid 2D dengan Logika Fuzzy pada NPC (Non-Player Character),” Journal of Electrical Engineering and Information technology, vol. 1, no. 1, hlm. 41–56, 2023.
C. Giovani Simbolon, A. Tri Hanuranto, dan A. Novianti, “DESAIN DAN IMPLEMENTASI PROTOTIPE PENDETEKSI DINI KEBAKARAN GEDUNG MENGGUNAKAN ALGORITMA FUZZY LOGIC BERBASIS INTERNET OF THINGS (IOT),” e-Proceeding of Engineering, vol. 7, no. 2, hlm. 3532–3539, 2020.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Journal of Artificial Intelligence and Engineering Applications (JAIEA)

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.