The controller: what is it good for?
The role of the "controller" is to process the desired line and speed information for a given AI car and appropriately convert that data into a corresponding sequence of settings of the car's steering, accelerator and brake (and perhaps more, but these three represent the typical minimal set). This is performed in order that the car should adhere to the specified line and speed as closely as possible.
The controller is a very important component of the AI system. It is crucial for the perceived realism of the overall simulation that the AI cars utilise an identical control mechanism to those cars driven by the player. Equally, the AI vehicle dynamics should result from the computations of the same physical simulation engine as for the player. It inevitably leads to an unsatisfactory gameplay experience for the player if the competing AI racers are perceived to be contravening the laws of physics.
The problem of "control" is one that is closely related to the nature and complexity of the game's
"physics engine". Scientifically-speaking, the physics engine within a game models what are known as causal phenomena: the engine calculates the deterministic progression of the vehicle's dynamics from one time step to
the next given that vehicle's current state (position on the track, velocity, angle etc), its physical properties (engine
power, tyre grip etc) and its
control actuations (steering, accelerator, brake). Although many variables may be
involved and the necessary computational load quite significant, this is a relatively
straight-forward computation to perform mathematically (albeit, often requiring numerical estimation).
Control as a mathematical inverse problem
More problematically from a mathematical standpoint, the controller must perform an "inversion"
of the game's causal physics model. Given the current state of the car, and a desired
future state, the controller must deduce the necessary actuations. The relationship between the causal physics
model and the inverse controller model is illustrated in simplified form
below.
Mathematically-speaking, the "inverse problem" of control is much harder than modelling the forward causal system.
This is not a subjective statement — the fact is that in most cases (including here), there will be no formal algorithmic solution
to the control system problem, even when the physics system is straightforward to evaluate. [This footnote offers a contrived, yet simple, mathematical demonstration of the intractability of solving inverse problems.]
All is not lost, but to find a solution to such control problems, we will have to be happy with a workable (and hopefully accurate) approximation. However, even getting an
algorithm to approximately follow a
desired line and speed is very difficult if the physics system that is to be inverted
is non-trivial. Racing games with simple physics and environment models can
make do with a simple control model. Games with more complex physics cannot. Our impression is that many contemporary racing titles appear to
"dumb down" the models of the non-player cars while others compensate in other ways, e.g. by affording the AI cars exaggerated
grip between the tyres and the road (which makes control much simpler).
Simple vehicle steering control
One of the primary selling-points of Forza Motorsport was (and presumably, for the sequel, will continue to be) the fidelity of its simulation models; the driving and vehicle physics
models are some of the most complex and accurate to feature in a racing game to date.
Furthermore, to maximise the gameplay experience, it was strongly desired to
neither modify nor dumb down the physics processing for the AI cars. As a result, the
control problem is an extremely difficult one in Forza but one we hope we were able to solve to a highly satisfactory degree through the exploitation of "learning" technology.
How does this work? Well, we cannot reveal the precise detail, but here is a conceptual example.
Imagine a simple steering control system which navigates the car by evaluating the deviation (in radians say) between the car's current directional heading θ and the desired heading Φ specified by the racing line 20 metres ahead (we look ahead, of course, to take account of the inertial effects in the physical system). The system is designed to be linear in that the steering s is set proportional to the heading deviation. That is, s = K (Θ - Φ).
The question is, what value should K be set to?
In control theory, K would be referred to as a "gain" parameter. Now in this example, if the AI vehicle physics is dumbed-down, or other "work-arounds" are employed such as sticky tyres, then it may be relatively straight-forward to determine a workable gain factor via trial-and-error, and this might even work for all the different cars in the game. The price for this simplification is, as already remarked, that the AI cars will visibly appear to drive unrealistically and the player will perceive that the race competition is not fair.
If we do not dumb down the AI car physics, behaviour can be very sensitive to the gain parameter. Set it too low in this example, and the car will under-correct its errors (appear "over-damped" in control terms) and most likely continually diverge off the track. Set K too high, and the typical behaviour will be oscillation, or repeated veering from side to side ("under-damping"). What's more, the "correct" setting of K will be very dependent on the particular vehicle. The appropriate value for an Audi R8 will be quite different to that for a Jaguar E-Type, for example.
Vehicle control automation in Forza Motorsport
The actual control systems developed for Forza were of course a little more complex than this, and contained a number of parameters analogous to K. In order to retain Forza's high-fidelity physics for the AI competition, it would be necessary to carefully tune these multiple parameters independently for each of 231 different vehicles. It is questionable whether this can be done with appropriate accuracy by hand anyway, but regardless, it is simply not practically feasible to undertake this tuning across the entire range of cars. Even worse, the goalposts may be continuously shifting as the physics engine, along with car physics properties, are continually modified and tuned during the game development cycle. This inherent impraticality of the controller design process is a major contributor to modern-day racing titles still not offering the player completely fair or convincing AI competition.
In Forza Motorsport we overcame this problem by using a novel auto-calibration procedure founded on "machine learning" techniques. The multiple control parameters are estimated automatically as the car is driven around the track by the AI system. By doing so the AI system, even if disadvantaged by very poorly specified gain parameters at the outset, gradually "learns" to control the car, correcting its mistakes as it goes along. Using this completely automated approach, all the control algorithms across the entire range of 231 cars were determined automatically and, crucially, with good accuracy.
The bottom-line outcome of applying this innovative system is that in Forza Motorsport, the AI cars are subject to the exact same physics engine computations as the player's car, a fidelity of simulation which we believe is unique in the racing genre. Indisputably, this is a very positive element of the player's overall gameplay experience.
Footnote: causal and inverse problems
T
|