Game Development Reference
In-Depth Information
to analyze. The physics implementation suggests a minimum think speed, as we
shall see.
Feedback in Cars and Trucks
In the Cars and Trucks simulation, we will have independent control over the
frame rate and the AI's thinking rate. While many games have a single update
loop for animation, AI, and game input, others split one or more of them out. We
get reasonable animation as low as six frames per second. We get reasonable AI
performance at two thoughts per second. The latter number was arrived at by
tuning the system after examining the various options.
It makes no sense to have the think rate higher than the frame rate. The vehicles
move forward only once per animation frame. The vehicles change lanes and
speed every time they think, but they only move when the animation calls for
them to move. Thinking faster than the system can react is pointless, as one
would expect. In terms of the military decision loop, this is the equivalent of
generals pounding their desks in frustration at their slow-reacting forces.
All games have this same upper limit. While you may or may not need to have the
AI think at the frame rate, there is never any need to exceed the frame rate. To be
more precise, the AI need not think faster than important things change. Most
games have animation and physics running in lockstep, so the basic rate of
change is the frame rate. Resource-limited mobile games that have small bits of
rapid animation but slow overall movement can let the AI slow down to the
movement rate. PCs and consoles left such limits behind years ago, making the
frame rate the basic change rate.
In Cars and Trucks , thinking almost as fast as the system can react did not prove
to be optimal, either. The cars changed lanes too often. We got the mayfly effect.
Some dampening was added to the code to make staying in the current lane
more acceptable if the car in front was too close but pulling away. In visual
terms, all the drivers appear to drive like indecisive maniacs; this might be a
reasonable model for some drivers but not for all drivers. Even after dampening
the lane changes, fast AI updates made it hard for the user to see what the AI
was thinking. The AI graphically shows what it is thinking, and the user can
absorb that information only so fast. The simulation would get smoother if the
AI ran more often, but the user would have a hard time keeping up with what
the AI is doing to each car. Game design can place limits on how fast the AI
should react.
 
 
Search Nedrilad ::




Custom Search