Penerapan Algoritma A* Pathfinding dan Behavior Tree Pada Perilaku Non-Playable Character (NPC) pada Game Labirin “Dungeon Escape”

Authors

  • Wildan Fadilah Universitas Suryakancana
  • Diny Syarifah Sany Universitas Suryakancana

DOI:

https://doi.org/10.59841/saber.v3i4.3206

Keywords:

Artificial Intelligence, Behavior Tree, Game, NPC, Unity

Abstract

This study focuses on the development of an intelligent enemy behavior system in the 2D maze game Dungeon Escape by combining the A* algorithm for pathfinding and a Behavior Tree (BT) structure for decision-making. The main objective is to enhance Non-Playable Character (NPC) intelligence, enabling more adaptive and realistic interactions with players. The A* algorithm is implemented to allow NPCs to pursue players through the shortest and most efficient paths while avoiding obstacles on a grid-based map. Meanwhile, the Behavior Tree framework is designed to manage NPC actions based on dynamic conditions, such as attacking when in close proximity, chasing players within a certain detection radius, and retreating to the original guard position when the player leaves the active zone. The research methodology involves a comprehensive literature review, system design, and implementation using the Unity game engine. Testing procedures consist of both white-box and black-box approaches to evaluate the correctness, functionality, and efficiency of the system. The results indicate that all major game features—including player navigation, combat mechanics, key collection, enemy pathfinding, and user interface interactions—operate smoothly as expected. Furthermore, NPCs exhibit adaptive behavior by dynamically switching between patrolling, chasing, and attacking modes depending on the player’s location and proximity. Performance testing shows that the integrated A* and BT system runs efficiently without significant delays or instability, even in higher-level stages with more complex layouts. The final game prototype includes seven progressively challenging levels, offering players an engaging and dynamic gameplay experience. This study demonstrates that the combination of pathfinding and decision-making algorithms provides an effective solution for designing intelligent NPCs, improving both realism and entertainment value in 2D games. The findings are expected to serve as a useful reference for future research and development in AI-based game design, particularly in the context of Unity game projects.

References

Buckland, M. (2025). Programming Game AI by Example. Jones & Bartlett Learning.

Champandard, A. J. (2022). AI game development: Synthetic creatures with learning and reactive behaviors. New Riders.

Champandard, A. J. (2023). Understanding behavior trees. AiGameDev.com. Retrieved from https://aigamedev.com

Fikriansyah, M., Wahyu Wiriasto, G., & Rachman, A. S. (2023). Non-player character in fire fighter games using genetic algorithm. Jurnal Mnemonic, 6(1), 11-19. https://doi.org/10.36040/mnemonic.v6i1.5757

Isla, D. (2025). Handling complexity in the Halo 2 AI. Game Developers Conference. Retrieved from https://www.gdcvault.com

Menouar, H., Guvenc, I., Akkaya, K., Uluagac, A. S., Kadri, A., & Tuncer, A. (2017). UAV-enabled intelligent transportation systems for the smart city: Applications and challenges. IEEE Communications Magazine, 55(3), 22-28. https://doi.org/10.1109/MCOM.2017.1600238CM

Millington, I., & Funge, J. (2016). Artificial intelligence for games (2nd ed.). CRC Press.

Octavian, F., & Hermawan, L. (2023). Penerapan algoritma pathfinding A* dalam game Dual Legacy berbasis Android. Jurnal Buana Informatika, 14(01), 20-29. https://doi.org/10.24002/jbi.v14i01.6928

Pinter, D. (2020). Implementation of behavior tree in Unity 3D game engine. International Journal of Game Development, 6(2), 45-52.

Rabin, S. (2015). Game AI Pro 2: Collected wisdom of game AI professionals. CRC Press. https://doi.org/10.1201/b18373

Russell, S. J., & Norvig, P. (2020). Artificial intelligence: A modern approach (4th ed.). Pearson.

Sharma, M., Ontañón, S., Mehta, M., & Ram, A. (2022). Drama management and player modeling for interactive fiction games. Computational Intelligence, 22(2), 123-134. https://doi.org/10.1111/j.1467-8640.2006.00204.x

Togelius, J., & Yannakakis, G. N. (2016). Artificial intelligence and games. Springer.

Tozour, P. (2024). Search algorithms for AI. In S. Rabin (Ed.), AI game programming wisdom 2 (pp. 123-133). Charles River Media.

Widodo, W., & Ahmad, I. (2017). Penerapan algoritma A Star (A*) pada game petualangan labirin berbasis Android. Khazanah Informatika: Jurnal Ilmu Komputer dan Informatika, 3(2), 57-63. https://doi.org/10.23917/khif.v3i2.5221

Downloads

Published

2025-08-19

How to Cite

Wildan Fadilah, & Diny Syarifah Sany. (2025). Penerapan Algoritma A* Pathfinding dan Behavior Tree Pada Perilaku Non-Playable Character (NPC) pada Game Labirin “Dungeon Escape”. SABER : Jurnal Teknik Informatika, Sains Dan Ilmu Komunikasi, 3(4), 12–28. https://doi.org/10.59841/saber.v3i4.3206

Similar Articles

1 2 > >> 

You may also start an advanced similarity search for this article.