Development of a Car Racing Simulator Game Using Artificial Intelligence Techniques

Abstract

This paper presents a car racing simulator game called Racer, in which the human player races a car against three game-controlled cars in a three-dimensional environment. The objective of the game is not to defeat the human player, but to provide the player with a challenging and enjoyable experience. To ensure that this objective can be accomplished, the game incorporates artificial intelligence (AI) techniques, which enable the cars to be controlled in a manner that mimics natural driving. The paper provides a brief history of AI techniques in games, presents the use of AI techniques in contemporary video games, and discusses the AI techniques that were implemented in the development of Racer. A comparison of the AI techniques implemented in the Unity platform with traditional AI search techniques is also included in the discussion.

1. Introduction

Games have become an integral part of everyday life for many people. A traditional game often presents a situation where “players engage in an artificial conflict, defined by rules and results in a quantifiable outcome” [1]. Such artificial conflicts are often represented as a puzzle or a challenge, and having the puzzle solved or the challenge resolved provides a real-world purpose to the game players [2]. This type of games is sometimes referred to as “serious” games [3]. However, this kind of traditional or “serious games” has been increasingly replaced by electronic games, especially for the so-called “game generation” [4]. This generation typically consists of “digital natives,” who, in contrast to the “digital immigrants” [4] of the older generation, grew up playing a lot of games and who are trained in skills such as “dealing with large amounts of information quickly even at the early ages, using alternative ways to get information, and finding solutions to their own problems through new communication paths” [5].

The artificial intelligence (AI) community has witnessed a similar transition from the “classical AI games” such as Samuel’s Checker Player [6] and Waterman’s Poker Player [7] to the contemporary AI techniques adopted in electronic games. The objective of the game is no longer a quantifiable outcome of beating the opponent in a checker or poker game. Instead, a contemporary game contains changing environments, multiple objectives, and dynamic aspects of the game that are revealed to the game player as the game unfolds. The objective is to offer to the human player an enjoyable experience through his or her interaction with the game, and this does not involve any specific quantifiable outcome.

The game Racer is a contemporary video game, and its objective is to offer the player a challenging and enjoyable experience in a car race against a game-controlled car. Although the player’s goal within the game is to win the race against the game-controlled car, the AI techniques adopted in the game are primarily designed to give the player an enjoyable time racing his or her car. In other words, the objective of winning by either side is not given the highest priority.

This paper proceeds as follows. Section 2 provides some background literature relevant to the work. Section 3 presents the design of the software system of Racer. Section 4 presents implementation of the game software system using some AI techniques. Section 5 gives a sample execution of the game system. Section 6 presents some discussion on the AI techniques adopted in Racer and its performance, and Section 7 includes the conclusion and some ideas on future directions of the work.

2. Background Literature

There has been substantial research work that focuses on developing AI-controlled components of game systems, which can approximate or emulate human game playing styles. These components are often referred to as “bots.” The motivation for developing the “bots” is that a human player’s enjoyment in the gaming experience will be higher if he or she can be led to believe that the opponents in the game are other human players. An example of this type of game is the popular multiplayer first person shooter game Counter-Strike [8], in which the objective is to eliminate all players on the enemy or opponent team.

Similar AI-controlled components or “bots” also appear in the early video game of PacMan; the computer-controlled ghosts in the maze are able to move towards the player-controlled characters because the former incorporated some path finding algorithms [9]. Other AI algorithms that were adopted by games include finite state machines, fuzzy state machines, and decision trees. Decision trees are used to represent the decision making process involved in games like Checkers or Chess. A decision tree can specify a number of possible game states given a current state and support a search process for a goal state, where the human player is defeated provided the AI-controlled game can identify the path to the goal state more efficiently than the human player.

In addition to decision trees, other AI techniques are also used for building bots so that they would mimic or emulate human behavior. Khoo and Zubek discussed their use of a behavior-based action selection technique in the software development kit (SDK) of Flexbot for developing an AI-controlled bot, called Groo [10]. Based on Groo, 32 bots were developed and can run simultaneously on a single machine, and human players who played against the bots believed the bots effectively emulated human behavior [10]. Similarly, Tatai and Gudwin [11] discussed the use of semiotics in their development of a bot, which can assist or attack the human player in the game of Counter-Strike. The objective of their work was to design the AI system so that the bot can entertain and challenge the human player and not simply to defeat him or her. Therefore, the performance of the bot is measured not by its efficiency in killing its opponents, but by its “capability to emulate as close as possible all the activities commonly performed by a human player” [11]. This consideration also means that the bot cannot be seen to be waiting because human players expect bots to be continuously working. Hence, the bot’s reaction time was one of the criteria in measuring its performance [11].

Similarly, in driving and racing games, human players expect to control their cars by making small adjustments to the car’s direction while driving, just like how they would control a car in real life. Therefore, the race car bot must make continuous adjustments to its car’s direction as opposed to simply driving in a straight line and turning only when a curve in the road approaches. To ensure the race car bot can mimic human behavior in this manner, some AI techniques were used for implementing the bots in Racer, which are explained in detail in the following section.

3. Game System Design

The design of the Racer game software involved three contemporary game AI concepts and techniques, which are presented as follows.

3.1. Waypoint System with Vector Calculations

The first technique used was the simple waypoint system used for controlling the car. The waypoint system includes a set of waypoints and each waypoint is a coordinate in 3D space that represents a key position on the racetrack. This system was used by many early car racing games because of its effectiveness and simplicity. In Racer, waypoints are stored as a sorted list of positions in 3D space using the List generic class from the System.Collections.Generic namespace [12]. The game software system reads this list of waypoints as input and then iterates through the list until all the waypoints have been passed by the game-controlled car. The game system only iterates to the next waypoint in the list when it detects that the game-controlled car is within a specified distance from its current waypoint. The (red) spheres along the racetrack in Figure 1 indicate the waypoints at key positions on the track.

Leave a Reply

Your email address will not be published. Required fields are marked *