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.
Read full abstract