homenewstechnologygamesabout us

 

 

 

Drivatars: Learning Technology
Train a Drivatar - you won't regret it

Of all the novel elements included in the Forza Motorsport AI system, we like to think that the "Train Drivatar" feature stands out as the most inventive. However, although it offered the player an original and very distinctive gameplay experience, those who utilised the feature would likely suggest that the technology was not particularly well integrated into the game as a whole. On reflection, we would agree. [See this page for some further thoughts on Drivatars and how such a game concept might have been, or still may be, progressed.]  

The general Drivatar model 

As we emphasised earlier, the "standard" AI opponents in Forza are themselves Drivatar models. These built-in opponents were generated ahead of time using development tools we supplied to the Forza game design team. Roughly speaking, Drivatar models contain information pertaining to racing lines and desired speed profiles for that AI driver (along with a few other "characteristics").

 

Train Drivatar optionsRather than pre-compute this data with some external development tool, the same Drivatar model can instead be specified via an interactive training process. In other words, an AI driving entity can be created by monitoring, and learning from, the driving of the player in the game itself. This entity is of course the "Drivatar". While the learning code is inevitably quite complex, a pleasing consequence of the commonality of the design for the pre-computed AI competitors and the player's own learned Drivatar is that a large proportion of the code in the AI system is efficiently re-used.

 

Drivatar lessons Throughout the lessons, the Drivatar observes the player's road positioning and choice of racing line, the speeds achieved along the course, and the utilisation of the brake and accelerator. This information is then processed and absorbed into an AI Drivatar model which is representative of the driving "style" of that player. This model may be subsequently used to dynamically generate a plausible variety of racing lines and behaviours in race. Importantly too, this model is probabilistic, and will therefore not produce the same output every time; it is definitely not just a simple recording of the player's driving.

Drivatars and "generalisation"

In the machine learning vernacular, "generalisation" refers to the capacity of a model to produce an appropriate output for any input that was not used in the construction of the model. i.e. that the model had not "observed" previously. So, for example, we could implement and train a model to interpret hand-written English characters, based purely on our own writing, yet it should also correctly recognise you writing an "X" even though it would never have seen your individual handwriting before. Such a model "learns" to generalise by automatically discerning, during its "training", the underlying structure within the data that it is designed to process.


Observing the Drivatar in a new carIn the case of Drivatars, once the player has completed the program of lessons on the five tracks in the five cars, we want to be able to put that Drivatar to work on a brand new track in a completely different car and see it drive sensibly. Of course, we wouldn't expect it to do as well as if we had trained for those exact conditions (particularly, on the new track), but we would like it to behave credibly.

 

This desired behaviour is achieved by ensuring that the Drivatar learning system, analogous to the handwriting recogniser, learns the underlying style of the player's driving, and does not just record it like a "replay" for example. As we mentioned elsewhere, one of the veins of research we mined was that of automatic numerical optimisation of line and speed information. We were able to exploit this same technology in order to build an effective model of the player's "style" when training the Drivatar.

 

In general terms (forgive us if we are not at liberty to be more specific), the Drivatar learns:

 

  • a model of the player's line as a function of the local topology of the track (e.g. some geometric measurements of a particular turn)
  • a model of the player's speed as a function of both the player's line and some relevant properties of the car being driven

 

An AI revolution... Thereby, when the Drivatar is asked to drive on a new track, the geometry can be fed into the model as input, and a credible (if not perfect) racing line will emerge as output. The function that performs this mapping is probabilistic, so if an identical portion of track is repeatedly input, there will be a variety of lines output. This variety reflects both the fact that there are many instances of geometrically similar portions of track, and the fact that multiple laps of data may have been observed for such portions. 

 

Similarly, the racing line just generated, along with the relevant car variables, can be supplied to the speed function. This will automatically take account of the fact that the Drivatar may be driving a very different car from that used in training. So it won't drive at the same absolute speed (that would look clearly wrong), but will drive proportional to the capabilities of the new car, consistent with the training data. This isn't necessarily realistic in the real-world, but makes a lot of sense from a gameplay perspective.  

Drivatar statistics 

Because the Drivatar lessons were a little dry in the absence of any competitor cars, the Forza design team sensibly specified that we add the "Statistics" feature to the lessons. This gives a percentage "score" for each classification of turn (e.g. "right-angle", "decreasing radius" etc) that the player drives when training a Drivatar.

 

Drivatar Statistics This has led to one or two misunderstandings, as it has been inferred that the Drivatar will perform better in "real" races if it has better scores. In other words, that there is a causal link between scores and race performance in the game code. This is emphatically not the case! The scores are just a useful (and imperfect!) measurement indicator of how well most players are driving during the training sessions and do not directly affect how well the Drivatar will perform in races. (The Drivatar model used in races does not even have access to the scores...)

 

A question that has been asked many times is how are the scores produced? Well, without giving away the exact measurement mechanisms involved, marks are awarded according to several factors:

 

  • Smoothness of line (30 marks)
  • Closeness of line to apex (20)
  • Average speed, through the entire turn (30)
  • Exit speed (40)
  • Entry speed (20)
  • Off-track (-1.5 x percentage of turn off-track)
  • Off-track at exit (-40)

 

You will of course see that it is quite a generous system as there are considerably more than 100 marks available, and any score over 100 is treated as "100%".