Game Development Reference
In-Depth Information
in the initial braking. If the blocking vehicle is moving at a reasonable rate, this
drawback is far less noticeable as the overtaking vehicle smoothly matches
speeds. Note that cars can never travel backward in our simulation. They can stop
if they have to, but on our freeway they never back up.
Physics can suggest a minimum feedback speed. In our case, a car that halves its
speed every second needs one second of travel distance to stop. If you sum the
sequence that begins one-half plus one-fourth plus one-eighth ..., you get a
number that is almost one. So our stopping distance is one second of travel
distance, but we also have to factor in reaction time. The car needs to see the
obstacle before it can get within one second of travel distance. So the AI must
look ahead more than one second, with two seconds travel distance being the
minimum. That minimum works only if the AI thinks at least once a second.
Our AI guarantees that it won't change lanes into another vehicle, avoiding direct
side-swipe collisions. In addition, it always makes sure that there is a safety
margin of about half a car length of daylight in front and behind before it changes
lanes right in front of or right behind another car. Since it only changes lanes to
increase or maintain speed, it tends not to change lanes to get behind a slower car
that it is now in danger of hitting. This is no help to overtaking drivers a little
farther back in the new lane. Giving the overtaking car a full second of clearance
would have been much more considerate.
The worst problem area for the simulation is when a slow vehicle changes into the
lane of a very-high-speed vehicle. If it cannot change to a clear lane, our fast-
vehicle AI needs to dump enough speed to keep it from slamming into the back
of the slower vehicle that instantly appeared in front of it. When it happens, it
appears unrealistic, even by the admittedly loose standards of our simulation.
The slow-vehicle AI could check for more than half a car length of daylight
behind it when it changes lanes and not change lanes into the clear zone in front
of an overtaking faster car, but the simulation is slanted toward a more enter-
taining American ''My taxes paid for that lane, I'm taking it'' style of freeway
driving than a German Autobahn style, where pulling into the path of an
overtaking car moving at nearly twice your speed is clearly suicidal.
As you might expect, the problem shows up when there are large differentials in
speed. Vehicles moving at speed of 50 to 85 pixels per second merely appear rude
to each other, but when they interact with vehicles travelling at 120 or 180 pixels
per second, it looks more like a death wish. If our rude vehicles were more
considerate and gave the overtaking vehicle at least a one-second buffer, we could
 
Search Nedrilad ::




Custom Search