top of page
  • LinkedIn
  • GitHub

AI-Driver Behaviour

DEMO

I created this project as a solution to one of my university gaming modules. The module was designed to help us understand and apply game AI techniques. I took a unique approach by developing realistic AI-driver behaviour. 

Overview

This project is focused on developing a realistic AI-driver behaviour model simulation for car racing games using Unity. The primary goal was to implement AI techniques and partial car dynamics to create unique and realistic behaviours for AI-controlled car. these behaviours will include but not limited to accelerating, braking environmental awareness, steering behaviours, and reactive behaviours. 

​

AI techniques used: 

  • Behaviour modelling & Decision-making.

    • Finite State Automata (FSM, HFSM).​

    • Fuzzy Logic & Set.

  • Perception

    • Obstacle avoidance.​

    • Raycasting with Linear Algebra.

  • Pathfinding

    • Waypoints​

    • Dynamic waypoints.

      Addition Experiments:

In addition to this project, I explored other AI techniques intending to integrate them into the project:

  • Fuzzy Logic & Set. (Integrated)

  • PID - Proportional-Integral-Derivative.

  • Vector flow fields.​​

Figure 1, below show the sub-system of the AI driver behaviour as well as the Car system (aka Car Engine) which was built with the Unity Physics Wheel Collider.

DriverBehaviourSystem.png

Decision Making

Figure 1. Behaviour model

Driver Behaviour FSM UML.png

Figure 2. Behaviour State UML

Behaviour State - FSM

FSM was used to manage the drivers behaviours, Figure 2. illustrates the states and high level transition condition.

Behaviour State - FSM

Table 1, Illustrates Boolean logic condition are predefined to decide transition. Special state uses predefined values to decides transition when the threshold are met.  

Driver Behaviour FSM Transition condition.png

Table 1, State Transition condition

Speed Adjustment - Fuzzy Logic

Fuzzy Logic is used to model the degree to how unique drivers understanding of distance and their current speed, and make decision accordingly.

Fuzzy Process.png

Figure 3, Fuzzy Process

Speed Adjustment - Input Value/Data

Processes the driver current speed, distance (based on relative obstacle retrieved from perception module) and unique driver speed and distance allowance. 

Speed Adjustment - Fuzzifying the info

To avoid complex mathematical calculations, Unity Animation (Figure 4) Curve was leveraged ro define the degree of membership (DOM) 

Driver decision data fuzzification.png

Figure 4, Degree of Membership Unity Animation Curve

Speed Adjustment  - Interference 

Rated or define input data "Speed & Distance" as Big, medium or Small based on DOM.

Defuzzifying decision .png

Table 2, Fuzzy decision Rule set

Speed Adjustment - Defuzzification

where the system evaluates Speed and Distance Rating based on Action rule set (Table 2). 

Speed Adjustment - Output

A simple FSM within the main driver behaviour state, used to define how driver interface with Car Engine.

Fuzzy Logic decision output.png

Table 3, Action Fuzzy Set Definition

Perception

Perception Model UML system flow.png
DynamicOvertake.gif

Source code and in-depth details available on request.

Jagunmolu Oke

© 2025 by Jagunmolu Oke. Powered and secured by Wix

bottom of page