Game Development Reference
In-Depth Information
Figure 8.2
Cars and Trucks running on two lanes.
180-pixels-per-second exotic cars to the barely subsonic 600-pixels-per-second
collision test vehicle. The player controls the number of available lanes as the
simulation runs. Because the vehicles that have identical desired speeds are
reasonably separated, as long as there are two or more lanes available, the vehicles
eventually sort by speed as you would expect. Realistic group behavior results; the
exotic car can get stuck in the slow lane when it attempts to pass on the right and
fails to make it to a gap in time. When the 55-pixels-per-second truck passes the
50-pixels-per-second truck on a two-lane road, the rest of the convoy bunches up
and jockeys for the best lane position. If the player adds three extra lanes, the
really fast cars cannot clear off until the cluster of four bikes doing between
80 and 90 sort themselves out enough to clear an open lane. When the head of a
line of cars gets an opening, the line behind accordions very realistically as the
cars hold off on acceleration until the gap in front of them starts to open safely, as
shown in Figure 8.2.
The simulation starts with the vehicles in a single lane. Those behind the truck
start dangerously close together, forcing them to drop to a low speed. The upper
lane was added a few frames before the screenshot was captured. The vehicles that
change to the upper lane do so at a speed in the low 40s. In the upper lane, the
Coupe leads, and with nothing ahead of it quickly makes it to its desired speed of
60. With a stable speed, it has a white background. Behind it is Bike C at a speed
of 48 and climbing. The dark backgrounds of Bike C and Bike D are green when
seen in color. Bike D can only accelerate when Bike C starts pulling away, so Bike
D is at a speed of 44 and climbing. The 60-48-44 sequence of speeds shows the
accordion effect as acceleration in vehicles ahead makes for increased clearance,
calling for acceleration in the current vehicle.
Search Nedrilad ::

Custom Search