AI-Driven Traffic Simulation using Unity: Implementing Finite State Machines for Adaptive NPC Behaviour

Syavira Amalia(1*), M. Dzawil Fadhol Abidullah(2), Fernanditho Marcellino(3), Diaz Dafa Rabani(4), Firna Fatima Azzahra(5), Abdiansah Abdiansah(6)


(1) Universitas Sriwijaya, Sumatera, Indonesia
(2) Universitas Sriwijaya, Sumatera, Indonesia
(3) Universitas Sriwijaya, Sumatera, Indonesia
(4) Universitas Sriwijaya, Sumatera, Indonesia
(5) Universitas Sriwijaya, Sumatera, Indonesia
(6) Universitas Sriwijaya, Sumatera, Indonesia
(*) Corresponding Author

Abstract


This research develops an AI-powered traffic simulation using the Unity Engine, leveraging finite state machines (FSM) to enable adaptive and responsive non-player characters (NPCs). The integration of FSM with advanced pathfinding algorithms, such as A*, allows NPCs to dynamically adjust their behavior based on traffic conditions, obstacles, and environmental changes. The experimental results indicate a 25% improvement in route optimization and a 30% reduction in path conflicts compared to conventional static models, demonstrating the robustness of the proposed approach. Optimized navmesh deployment further enhances navigation fluidity, ensuring efficient agent movement in high-density scenarios without compromising system performance. The findings establish the effectiveness of the FSM-driven NPC behavior in simulating realistic traffic environments, contributing both to the advancement of AI applications in game development and urban planning. By providing an interactive platform for traffic management, this simulation offers a practical tool to study congestion patterns and test intervention strategies. In addition, it improves player engagement by fostering emergent gameplay through dynamic NPC interactions. Future work could explore the integration of real-time procedural generation or multiplayer functionality to enrich simulation depth and scalability. This study provides a comprehensive framework that bridges AI-based mechanics with simulation technology, providing significant insights for researchers and practitioners in game design, artificial intelligence, and urban planning.

Keywords


ADAPTIVE NPC BEHAVIOR; FINITE STATE MACHINE; TRAFFIC SIMULATION; UNITY ENGINE; PATHFINDING ALGORITHM

Full Text:

PDF

References


Cao, K., Wang, L., Zhang, S., Duan, L., Jiang, G., Sfarra, S., Zhang, H., & Jung, H. (2024). Optimization Control of Adaptive Traffic Signal with Deep Reinforcement Learning. Electronics, 13(1), 198. https://doi.org/10.3390/electronics13010198

Hao, R., & Ruan, T. (2024). Advancing Traffic Simulation Precision and Scalability: A Data-Driven Approach Utilizing Deep Neural Networks. Sustainability, 16(7), 2666. https://doi.org/10.3390/su16072666

Iovino, M., Scukins, E., Styrud, J., Ögren, P., & Smith, C. (2022). A survey of Behavior Trees in robotics and AI. Robotics and Autonomous Systems, 154, 104096. https://doi.org/10.1016/j.robot.2022.104096

Lehmann, F., Roop, P. S., & Ranjitkar, P. (2018). Finite State Machines and Timed Automata: A Hierarchical Approach for Integrated Traffic Microsimulations. Journal of Traffic and Logistics Engineering, 25–36. https://doi.org/10.18178/jtle.6.2.25-36

Unity Technologies. (2024, October 18). Navigation and Pathfinding. Unity Manual.


Article Metrics

Abstract view : 15 times
PDF - 1 times

DOI: https://doi.org/10.26714/jichi.v5i2.14595

Refbacks

  • There are currently no refbacks.


____________________________________________________________________________
Journal of Intelligent Computing and Health Informatics (JICHI)
ISSN 2715-6923 (print) | 2721-9186 (online)
Organized by
Department of Informatics
Faculty of Engineering
Universitas Muhammadiyah Semarang

W : https://jurnal.unimus.ac.id/index.php/ICHI
E : [email protected], [email protected]

View My Stats