The core of any racing game is good handling. You’re simply not going to enjoy driving a car round a track if it doesn’t behave how you expect, if a supercar is slow or a touring car has no grip. But after the handling comes the competition. How do you know you’ve mastered the ins and outs of a BMW M3 unless you can prove it by beating ten other drivers to the finish line?
That takes AI. And AI is hard.
I spoke with James Nicholls and Clive Moody to discover what it takes to teach a computer to race. And race well. “It’s quite a complicated part of our production,” James begins. “The car handling team spend ages getting the car handling just right for every car. They start with the real world simulation values and then they work into that the behaviour of that car to make sure it’s balanced against all the others in its class; but, also, that it feels right as a game experience instead of just the raw simulated values of real life.”
This means everything from tweaking the car’s grip on corners to how much the camera will pivot, to suggest the g-force affecting your driver. This process takes months, there are more than 80 cars in Grid: Autosport and each one of them has to be perfect.
Next they need lap times. Lots of them,
“We have dedicated guys on the team who do nothing but set the benchmark times for the AI,” James says. “If you think about it, we’re pushing 80… 85 cars in this game and we’ve got over 100 routes. That’s a hell of a lot of combinations of car and track that they have to go through to make sure we have benchmark times for the AI to go against.
“When the level design guys build their tracks they lay down the information the AI need to drive, they lay down the lines the cars will actually need to follow, which are quite organic in their nature. They lay down the braking zones for each corner. They tune things like track extents, so the map of the track that the AI could ever possibly use, so, now, if there’s a collision up front the AI can go around that collision, maybe go on the grass for a bit and then rejoin.”
Between the benchmarks, the track data, and the handling model, the AI now has enough raw elements to start learning.
“We have a bespoke tool that we use that we’ve built and modified over many years that actually trains the AI,” explains James. “The AI system then runs with all that raw data, so the AI runs lap after lap after lap at an accelerated super test, normally overnight using many different tracks and cars. It’s driving, it’s making mistakes, it’s correcting them, it’s training them up, it’s improving them gradually.
“That’s how we end up at the trained AI data that you see in the game.”
Still, the work’s not done. They’ve now got cars that will drive round each track pumping out consistent lap times. They’ll know where and when to brake, overtake, and go flat out, but they’ll be doing it pretty mindlessly. They’ll “go round the track fast but it won’t be doing anything especially interesting other than the base AI behaviours.”
To make things a little more interesting “we lay on top of that a set of information from each driver in the game,” says James. “Each driver has their own characteristics. How consistent they are, how aggressive they can be. Details like that mean you’ll see cars make mistakes, either through a lapse in competence or because they’re responding to a nudge they received on the last corner.”
“We also tune behaviours on a discipline basis,” James says, referring to the five different driving disciplines in Grid: Autosport – Touring Cars, Endurance, Open Wheel, Street Racing, and Tuner Competitions. “This is where you start to see unique behaviours such as… well, the extreme examples would be how to drift a car, but also things like in Touring Cars guys will protect the inside line and jostle for position on the track, whereas the opposite would be true in Open Wheel where they’ll try to avoid contact. Then in Street Racing they’ll give you a shove at the right point on the street.”
It means the team don’t need to resort to introducing any sort of rubber banding. If you fall behind during a race then you don’t need to worry about being out of the running: “if there’s a pack of cars they will be bleeding time off each other because they’re fighting for track position. There’s other variables in there like AI making mistakes, either minor ones or proper off-track incidents. There’s always ways to fall back in.
“If we did anything like the AI always slowed to a crawl when you were falling back it would shatter that illusion, we didn’t want to go that way for this game.
“It’s only by doing all that that we can get a very human-like AI. You can get cars to follow splines very easily by comparison but that’s how you get that robotic inhuman AI behaviour. Whereas we’ve taken it to a whole new level in Autosport.
“I think it’s one of the things we’re most proud of.”