Gamasutra: The Art & Business of Making Gamesspacer
The Pure Advantage: Advanced Racing Game AI
View All     RSS
November 21, 2017
arrowPress Releases
November 21, 2017
Games Press
View All     RSS






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 

The Pure Advantage: Advanced Racing Game AI


February 3, 2009 Article Start Previous Page 3 of 5 Next
 

Race Script

The AI still wasn't performing as well as you would expect for a next-gen AAA racing game, not to mention how well we wanted it to perform. It wasn't challenging, it wasn't fun, it wasn't respecting the groups we tried to keep together, and you still had this lonely racing sensation during most of the race.

Definition

We had a meeting to brainstorm around this subject, and that is where the "race script" concept came up. It was proposed that the designers wrote a "script" for how they wanted the race to develop. It had to cover all possible scenarios, such as when the player's skill is greater than the best AI, when it is lower than the worst AI, and at specific points somewhere in between.

Races don't always follow the ideal script, in other words, as they depend on the player's performance. The script forced the designers to think about that fact and how the game should behave on those occasions. The script is only a guideline, then, not a strict, linear script to be followed.

An example of what this script would look like could be:

  • If the player is as skilled as the top AI characters, the race will start and soon after the start he will be at the front of the back group of AI competitors. Then he will escalate positions throughout the first 70-80% of the race. When he is progressing to the next group, some AI characters will jump with him to try to avoid him feeling alone in the race. He should be fighting for the first position the last 20-30% of the race.

    The guys in the first group will make it a little bit easier for the human player to get in first place being more forgiving with mistakes, especially in the very last part of the race. This way it will seem like he has worked his way through the race, and even if he make a mistake in the last part he won't be so punished for that. This is the main script for the race.

How could a typical race scenario really play out, based on the player's skill level, without a race script?

  • If the player is more skilled than the AI, the player will get in the first position soon after the start of the race and will keep adding distance to the AI every lap.
  • If the player is less skilled than the AI, the player will start and will very soon end up in last place, staying there for the rest of the race while the AI will be adding distance every lap.
  • If the player is more skilled than the lesser AI characters, but not as good as the ones in the first group (minus the maximum skill reduction), he will spend the race progressing only to the second group or just struggling against the AI characters in the last group.

Using this, the programmer can focus on the standard case: the ideal situation. In the previous example, this would be the first point.

Implementation

We then had to find a way to implement the script. We came up with a method that worked very well in our case: we decided to have every AI character aiming for a point a number of meters ahead or behind the human player. If aiming ahead, this value will be positive; if behind, it will be negative.

Then, each AI character's skills were set up to change dynamically depending on the AI character's distance to their assigned point, not in relation to the player (although this target point depends directly on the player's position).

Thus, an AI character could be shifting up its skills to try to get to its target point, even though it is still ahead of the human player. The same could happen the other way around: the AI character lowering his skills to get to the point even though he is already behind the player.

The previous image shows how the skills shift according to the distance to the target point. The skill increase is proportional to the distance to the target point. There's a maximum distance (150 meters in the figure) after which the skill increase gets limited (both positively and negatively).


Article Start Previous Page 3 of 5 Next

Related Jobs

IGT Australia Pty Ltd
IGT Australia Pty Ltd — Hawthorn East, Victoria, Australia
[11.20.17]

Software Engineer – C#/Unity
Pixelberry Studios
Pixelberry Studios — Mountain View, California, United States
[11.20.17]

Engineering Manager
Shiny Shoe
Shiny Shoe — San Francisco, California, United States
[11.20.17]

Gameplay and Engine Programmer
Argo AI, LLC
Argo AI, LLC — Mountain View, California, United States
[11.20.17]

UI / Visualization Engineer





Loading Comments

loader image