Efficient Ground Vehicle
Path
Following in Game AI
Abstract
This short paper presents an efficient path following solution for ground vehicles tailored to game AI. Our focus is on adapting established techniques to design simple solutions with parameters that are easily tunable for an efficient benchmark path follower. Our solution pays particular attention to computing a target speed which uses quadratic Bézier curves to estimate the path curvature. The performance of the proposed path follower is evaluated through a variety of test scenarios in a first-person shooter game, demonstrating its effectiveness and robustness in handling different types of paths and vehicles. We achieved a 70% decrease in the total number of stuck events compared to an existing path following solution.
Index Terms:
Game AI, Path Following, Ground VehicleI Introduction and Related Work
An important component of game AI is driving vehicles along predefined paths in an effective and efficient manner. The task of computing control actions that keep a vehicle along a path while tracking a target speed is referred to as the path following problem. This problem has been extensively explored in robotics and control literature, particularly for applications in unmanned ground and aerial vehicles [1, 2]. In the context of game AI, path following presents particular challenges, including navigation in a wide range of environments, adhering to limited computational requirements, and achieving good performance across a range of vehicles for games that contain a wide selection of vehicle types.
While many of the works from robotics and control literature can be applied to game AI, few papers discuss the various adaptations necessary to make use of these established techniques. Most of the works that consider path following for AI controlled vehicles are for car racing games [3, 4, 5]. Onieva et al. [3] offer a comprehensive overview of their 7-part driving architecture, which utilizes several vehicle sensors to gather information about the vehicle’s position relative to the track. The sensor readings along with a learned module determine the optimal parameter values in the different modules. Another notable related work is the fuzzy logic based self-driving racing car control system by Etlik et al. [4]. The authors use a vision based lane detection system for online lane detection and fuzzy logic for generating position and velocity references. The work by Melder and Tomlinson [5] provide an introduction to Proportional-Integral-Derivative (PID) controllers for game AI, as well as brief descriptions of some of the PID variants.
In this work, we consider the path following problem for controlling ground vehicles in game AI. We propose a general framework which may serve as a benchmark solution offering reasonable path following accuracy and efficiency for a wide range of vehicles and environments. We leverage established, effective, and computationally cheap techniques for speed and steering control and use an analytical result for computing the maximum curvature of a quadratic Bézier curve in a novel algorithm for computing the target speed. The performance of our approach is evaluated by running experiments in a first-person shooter game containing a suite of different vehicles.
II Proposed Method
Problem Formulation. We consider the path following problem of commanding a ground vehicle with arbitrary kinematics to move along a given path. The objective is to minimize the cross track error (CTE) between the vehicle’s position (often defined at the centre of mass) and the path while maintaining a target speed and following a moving target point on the path. As a secondary objective, we wish to keep the vehicle within the safe boundaries of the path, commonly referred to as the path corridor. The path is represented as a list of waypoints and may change significantly across frames. A sample path is shown in Figure 1.

We denote vehicle speed along the axis of the vehicle’s forward vector as . The sign of denotes the direction of the vehicle’s motion, i.e., indicates the vehicle is going in reverse and vice versa. We assume there are two inputs to the game for changing the vehicle’s motion: steering and throttle for lateral and longitudinal motion, respectively.
Method Overview. The path follower technique used in this work consists of five core modules: target speed generation, target point generation, speed control, steering control, and stuck manager as shown in Figure 2. Our core contribution is the target speed generation module which uses a novel algorithm for efficiently calculating a desired vehicle speed. For the remaining modules, we provide brief descriptions of the established approaches we apply.
The speed controller leverages a Proportional-Integral (PI) controller which regulates vehicle speed via throttle commands using the difference between the target speed and the vehicle’s current speed, referred to as the error signal [6]. The PI controller uses both the proportional and integral terms of the error signal to generate a vehicle command. However, certain strategies must be implemented to mitigate common issues associated with the integral term including integral windup [6]. To generate a steering command, our first step is to compute a target position on the path some lookahead distance in front of the vehicle. From here, we use the geometric steering controller pure pursuit [7] which is based on a steering angle control law that minimizes the cross track error characterized by the target position. This algorithm effectively computes a gain at each time step for a proportional feedback controller using geometric properties of the path tracking problem in the case of a bicycle kinematic model. In case of a stuck event being triggered, which we define as a situation where the vehicle fails to make sufficient progress along the path within a certain time frame, the commands outputted from the speed and steering controllers are overridden by the stuck manager module. For instance, we invert the sign of the throttle input during several frames in the hopes that we recover to a position where the vehicle is no longer stuck. Another potential strategy is to simply teleport the vehicle to a new position. For further strategies, we refer readers to existing works [3].

Target Speed Generation. The high-level idea of our proposed method is to limit vehicle speed based on the estimated maximum curvature of the part of the path that extends from the vehicle position to a user-defined lookahead distance. The cheap computational cost of our approach is underpinned by an analytical expression for computing the maximum curvature of a quadratic Bézier curve. We first describe the inversely proportional relationship between target speed and path curvature.
A commonly used method for computing a target speed is to determine the optimal speed for a vehicle to travel through a turn of a given radius while maintaining tire traction. Often referred as critical speed, the following equation relates a vehicle’s safe turning speed to the balance between centripetal force and maximum lateral force that the tires can handle [8]:
(1) |
where is a tuning parameter, is gravitational acceleration, and is curvature. The parameter allows us to effectively tune vehicle speed around corners based on the handling of a particular vehicle. As a point of reference, the maximum lateral acceleration found in human normal driving is [9]. Once a suitable value has been specified for , the problem of computing target speed reduces to finding curvature . In a typical path following setting, this refers to the curvature at a particular point in the path. However, this assumes that curvature information of the path is readily available, e.g. the case of a path described by a function that is twice differentiable. If the path is defined by a list of waypoints, then the approach used here is to use curve-fitting functions to estimate the path curvature, which provides a candidate representation of the path curvature profile.
In our approach, we use a series of quadratic Bézier curves to efficiently capture an estimated curvature profile of the path . The following is the parametric equation which defines a quadratic Bézier curve with control points :
(2) |
The first and third control points are the endpoints (at and , respectively) while generally does not lie on the curve. To compute curvature along the curve, we may use the standard curvature equation , and a sampling strategy to sample curvature of points along the curve. However, a more efficient approach is to leverage the particular geometric constraints of quadratic Bézier curves. Specifically, the maximum curvature can be computed analytically, allowing us to determine an upper bound for the curvature profile without the need for sampling. This is the core motivation for employing quadratic Bézier curves over higher order curves which may provide better estimates of the curvature profile though at a much higher computation cost.
Figure 3(a) shows a sample quadratic Bézier curve and we highlight the two equally sized spheres drawn along the segment which meet at the midpoint m. The radius of these spheres is equal to half the euclidean distance between the endpoint and the midpoint m, i.e. . There are two possible cases that characterize the curvature profile of based on where the control point lies in relation to these two spheres. If lies outside of the two spheres, i.e. and , then from the work by Deddi et al. [10] the maximum curvature of is given by the expression:
(3) |
Note, the denominator is the squared area of the triangle characterized by the three control points. In the second case, lies inside one of the two spheres which means the curvature of is monotone [11]. This implies the maximum curvature occurs at either of the two endpoints , and therefore maximum curvature is the expression [10]:
(4) |
With these two results, we can efficiently compute the maximum curvature of an arbitrary quadratic Bézier curve without having to sample points along the curve like in the case of more complex parametric curves.

Algorithm 1 summarizes our approach to computing a target speed given inputs vehicle position r, the path to be followed , and parameters maximum lateral acceleration , waypoint spacing , waypoint count , and speed limits , . The first major step involves constructing a new path by sampling points from the original path at regular intervals of size (Lines 1-4). By capturing the salient features of the original path structure up to a lookahead distance from the vehicle’s current position r, we are able to determine appropriate target speeds in advance. This is particularly useful in areas where the vehicle needs to slow down, such as sharp corners. The purpose of initializing with r (Line 1) is made more clear in the steps to follow. In the next step, we iterate through the waypoints of our new path , and calculate the maximum curvature among all the quadratic Bézier curves that can be created from three sequential waypoints in (Lines 5-9). We use Equation (3) and (4) to compute the maximum curvature of each curve. Since the first Bézier curve is always defined by the vehicle position and two points on the path , we ensure the target speed is decreased whenever the vehicle is too far away from the path. In the final step of our algorithm, we use Equation (1) to compute target speed given and followed by clamping on given limits , .
Input: r, , , , , ,
III Experimental Setup
In this section, we describe the experimental setup used for collecting results for validating our proposed path follower. We used a first-person shooter game (Battlefield 2042) as the platform for running experiments and used a machine with an NVIDIA Tesla T4 GPU with a 16-core CPU and 110 GB of RAM. The game contains a wide selection of ground vehicles with varying driving characteristics. We integrated the proposed path follower with the test automation system which deploys AI bots for testing large multiplayer games, referred to as AutoPlayers [12]. To compare our approach, we used as a baseline the original path following logic present in AutoPlayers. Briefly, the path following logic leverages a series of heuristics that fail to generalize well across certain vehicles and environments. For instance, the target speed module computes a target inversely proportional to the largest angle between the vehicle forward vector and a segment on the path in front of the vehicle up until a lookahead distance. Such an approach can lead to noisy target speed outputs when the path is complex or contains sharp turns. In addition, the speed controller employs the simpler P-controller (i.e. no integral term) meaning no history of previous errors is kept to influence the throttle command.
Several metrics were used to assess the performance of the proposed path following solutions. During each frame, we recorded the cross track error, and indicators whether the vehicle is inside the path corridor and whether the vehicle is stuck. We consider the total number of stuck events to be the core metric of interest since its result has the widest set of implications. In the context of bots for testing, we would like to minimize the number of times vehicles get stuck to ensure good quality performance tests and effective soak tests. If vehicles get stuck too often, then the resulting test data may provide a poor representation of real gameplay and may not reflect realistic game scenarios. We note that it is very difficult to completely avoid vehicles getting stuck since the generated paths do not account for the vehicle kinematics and dynamics.
The following parameters were set for the target speed generation module: , , , , . For the parameters that are the same across the two approaches (e.g. min/max target speed), the same values were set to ensure fair comparisons.
IV Results
In our first set of experiments, we assessed the ability of different vehicles to follow a set of predefined test paths. For each test path, a particular vehicle is spawned at the first waypoint and then commanded to follow the path until the final waypoint. We generated 10 test paths capturing a wide range of challenging environments such as steep hills, narrow corridors, and sharp turns. Further, six different vehicles, each with a distinct set of driving characteristics, were considered for evaluation. These vehicles include Storm, Bolte, Panhard Crab, Zaha, Armata, and Hovercraft. The first three vehicles were deemed easily maneuverable, while the latter three presented greater challenges due to slower turning rate, larger turning radius, poor traction, etc. We performed a total of tests, for each one of the vehicles.
Table I summarizes the performance of three path followers: the baseline, our proposed solution with parameters from Section III, and our proposed solution with per-vehicle-tuned parameters including maximum lateral acceleration parameter from the target speed generation module. The reported metrics include the number of trials with at least one stuck event, the total number of stuck events as well as a breakdown per vehicle, mean cross track error, percentage of time spent inside the path corridor, total time taken to complete the path, and mean vehicle speed. The first major result is the decrease in the total number of stucks events when comparing our approach to the baseline. In the case of the hovercraft, the addition of the integral term in the speed controller helped resolve the issue of getting stuck while driving up steep hills. We see similar path following improvements across the other vehicles and the smaller range of stuck events suggests our proposed solution generalizes better to different vehicle types. Our approach with fixed parameters maintained similar performance as the baseline for tracking error and inside corridor percentage while driving vehicles at faster speeds. We improve in these two metrics when we use our approach with per-vehicle tuned parameters. With faster average vehicle speeds and a further decrease in number of stuck events, we achieved a decrease in mean total time when comparing with the baseline.
Baseline | Ours | Ours (vehicle-tuned) | |
Total stuck trials () | 33 | 15 | 8 |
Total stuck events | 56 | 17 | 11 |
Cross track error mean (m) | 1.46 | 1.48 | 1.32 |
Total time mean (s) | 59.6 | 40.9 | 36.1 |
Inside corridor mean (%) | 91 | 91 | 93 |
Speed mean (m/s) | 4.55 | 5.82 | 6.84 |
Breakdown of stuck events by vehicle | |||
Storm | 3 | 1 | 1 |
Bolte | 9 | 2 | 0 |
Panhard Crab | 8 | 4 | 2 |
Zaha | 5 | 3 | 2 |
Armata | 11 | 5 | 5 |
Hovercraft | 20 | 2 | 1 |
To assess the performance of our proposed method in a more realistic game scenario, we performed soak tests. These tests consisted of 5-minute game sessions in conquest mode and a specific map with 64 AI-controlled bots divided into two teams. A total of 5 randomized trials were ran for both the baseline and proposed path follower. We normalized the number of stuck events by the total number of seconds spent driving a ground vehicle across all 64 players. For the proposed approach, a ground vehicle was stuck on average every () of driving time and every () with the baseline. This means, we were more than twice as likely to get stuck with the baseline path follower compared to our proposed solution.
V Conclusions and Future Work
In this short paper we tackled the path following problem in the context of game AI. Our focus was on developing a simple and efficient framework that achieves reasonable performance across ground vehicles and game environments. Such a framework is particularly beneficial for bots that test games in development or for developing a benchmark solution. The main contribution of this work is the novel target speed generation algorithm which uses quadratic Bézier curves to efficiently estimate the curvature profile of a path. In future work, we plan to expand our framework to include aerial vehicles and to test the performance of our approach with a larger collection of ground vehicle types and game environments. Additionally, we intend to explore the use of automatic tuning methods such as black box optimization which may significantly increase path following performance and eliminate manual parameter tuning.
References
- Terlizzi et al. [2021] M. Terlizzi, G. Silano, L. Russo et al., “A vision-based algorithm for a path following problem,” in 2021 International Conference on Unmanned Aircraft Systems (ICUAS). IEEE, 2021, pp. 1630–1635.
- Bacha et al. [2017] S. Bacha, R. Saadi, M. Y. Ayad, A. Aboubou, and M. Bahri, “A review on vehicle modeling and control technics used for autonomous vehicle path following,” in 2017 International Conference on Green Energy Conversion Systems (GECS), 2017, pp. 1–6.
- Onieva et al. [2012] E. Onieva, D. A. Pelta, J. Godoy, V. Milanés, and J. Pérez, “An evolutionary tuned driving system for virtual car racing games: The autopia driver,” International Journal of Intelligent Systems, 2012.
- Etlik et al. [2021] U. B. Etlik, B. Korkmaz, A. Beke, and T. Kumbasar, “A fuzzy logic-based autonomous car control system for the javascript racer game,” Transactions of the Institute of Measurement and Control, 2021.
- Melder and Tomlinson [2014] N. Melder and S. Tomlinson, “Racing vehicle control systems using pid controllers,” Game AI Pro, pp. 491–500, 2014.
- Ang et al. [2005] K. H. Ang, G. Chong, and Y. Li, “Pid control system analysis, design, and technology,” Transactions on Control Systems Technology, 2005.
- Wallace et al. [1985] R. S. Wallace, A. Stentz et al., “First results in robot road-following.” in International Joint Conference on Artificial Intelligence, 1985.
- Gillespie [2021] T. Gillespie, Fundamentals of vehicle dynamics. SAE international, 2021.
- Bosetti et al. [2014] P. Bosetti, M. Da Lio, and A. Saroldi, “On the human control of vehicles: an experimental study of acceleration,” European Transport Research Review, vol. 6, pp. 157–170, 2014.
- Deddi et al. [2000] H. Deddi, H. Everett, and S. Lazard, “Interpolation problem with curvature constraints,” 2000.
- Sapidis and Frey [1992] N. S. Sapidis and W. H. Frey, “Controlling the curvature of a quadratic bézier curve,” Computer Aided Geometric Design, 1992.
- [12] J. Gillberg, “AI for testing: The development of bots that play Battlefield V,” https://www.gdcvault.com/play/1025905/AI-for-Testing-The-Development, accessed: 2019.