Hi everyone, Markku here to talk about our plans for GeneRally 2′s AI drivers!

In this post I will briefly explain our approach to the AI and tell something about its current state and of the visions we have for the future.

Our latest release of the GeneRally 2 KS demo (released along with this blog post) contains the first iteration of the driver AI, one of the essential features of a GeneRally successor, and one of the most challenging and interesting ones to develop.

From the point of view of the developer, the AI is ultimately just a piece of code that manipulates the controls of a car based on information about its position, velocity and other parameters. The AI is fair in this sense, it drives the car by ‘pushing’ the same buttons that a human player has in front of him. The problem is to figure out, in any situation, the correct (or at least reasonable) input to give, so that the result is a clean lap of the track.

As in the original GeneRally, the starting point is a driving line that the track maker lays out when designing the track. Currently, this is done by setting turn-in points, apexes and corner exits. The line is then drawn between these using Bezier curves, giving a nice smooth result). The AI attempts to follow this line as quickly as possible, turning to follow it and slowing down if necessary.

It sounds simple but turns out to be not quite so straightforward – and with GR2, the problem is a bit more complex than it used to be. We have stated that in GeneRally 2 we want to give car makers new options to create a wider variety of different racing machines. The more flexible the car editor is, the more flexible the AI has to be, since it needs to be able to deal with any monstrosity that the modder can come up with. Already the cars in our current pre-alpha release are, from the point of view of the AI driver, more of a challenge than any of the default cars in the original GeneRally. Many of them have much more inertia, and require the driver to plan ahead further to anticipate the movements of the car (and while we will continue tweaking the driving model to achieve that much loved GeneRally sharpness, we don’t want to lose the ability to also make these kinds of cars, with significant weight and a heavy ‘feel’).

So one of the problems I faced when starting to experiment with the AI was that unlike the original GeneRally, which very much lived in the moment, the GeneRally 2 AI has to have some degree of foresight. In its current state the AI demonstrates this by anticipating braking points. It looks forward along the racing line to find the next corner, and figures out the correct point at which to start braking so that the corner can be cleared. On the other hand, I’ll admit, the AI in this first implementation is not yet a very good drifter. A proper drift also requires a lot more foresight than simply driving from braking point, to apex, to corner exit – as the drift has to be initiated a significant distance before the corner. In this first iteration, the AI tends to brake to turn in cleanly, and then exit the corner with the tail hanging out. This is just one of the things that will be improved upon in the future.

Another way in which we plan in the future to improve upon the original, is by giving the AI some awareness about the other cars on the track. The AI in GeneRally is notoriously indifferent to its fellow drivers, following stubbornly the optimal line in any and all circumstances. Obviously this is GeneRally, and some swapping of paint will be expected, but future revisions of the AI will give it some basics of the racing etiquette. We’re hoping to allow for the AI drivers to make decisions to overtake by adjusting their line, braking points, etc. rather than diving in blindly and knocking the other cars out of the way.

Stay tuned for more updates – and please don’t forget to give feedback on the AI you see in the new build! And don’t forget to share our Kickstarter campaign with anyone who will listen

– Markku