<--Introduction ^--traffic--^ Model-->

Traffic simulation - targets

Currently, I have four targets which I want to aim for, generally increasing in complexity.

one lane, infinite highway

To start, I want but a single lane, with no on- or off-ramps, on which one (or hopefully more cars) move along. With hopes to make it at all interesting one car will eventually catch up to another, which will require it to respond so they do not collide. This will allow introduction of the drivers' ability to get input from their surroundings (an "approaching" vehicle) and the logic to deal with that input. Given enough time in this simulation, we'd expect to see clusters of vehicles, where the front vehicle in the cluster is holding back the faster ones behind it. Not too interesting, but it would give a starting target, one where rudimentary logic can be tested.

Drivers at this point would need to know how to detect that they're approaching another vehicle, that a vehicle ahead might be braking (though this isn't strictly necessary, since they would by consequence see that they are now approaching the vehicle if it is indeed braking), and how to brake themselves, and maintain a tailing speed and distance.

two lanes (one direction), infinite highway

Once the above is accomplished, we hit one of what I consider two large-scale problems with the simulation: parallel lanes and branching roadways. Parallel lanes are pretty much the reason this project has taken so long to get started. While it's easy enough to represent vehicle objects at some point on a line, each concerned with their own distance from each other on that line, we introduce a whole level of complexity when there are two of these lines, and the ability to transition between them at any time.

While it's certainly possible to take the approach of late-70s/early-80s video games where a vehicle's lane-change is done instantaneously, blinking from one lane to the next, it certainly takes away from the simulation of real traffic.

An idea used in later video games was a "tap" left or right on the controller which would show your vehicle change lanes in a smooth motion, while in fact the action wasn't interruptable. This meant that until your vehicle completed the journey from one lane to the other, you could not control it; it also meant that during the transition the vehicle is in both lanes at once.

This isn't so bad, if we are okay with our drivers not being able to start a lane-change and then swerve back into their original lane (because they suddenly noticed a vehicle that wasn't there before). I suppose it depends on how realistic we want our drivers to be able to be.

Lane-change implementation aside, the two-lane simulation adds a new set of interesting behaviour. Drivers can now have the demeanor of slower-traffic-keep-right, where they only pass in the left lane; other drivers might sit in the fast lane, because either they're the fast drivers (and might then tailgate others who are in the fast lane ahead of them) or they're righteous drivers, who block the passing lane at the speed limit, doing their part in slowing down the maniacs.

Two-lanes also allows logic to be added to simulate a stalled vehicle, and how drivers in the through lane let the others merge in, or how much time a stalled vehicle adds to an individual driver's travel time (and to the community's wasted time in total).

Drivers would need to understand brake lights here (to perhaps decide to quickly change lanes to avoid slowing down); would need to know how to look into the other lane, decide if it's "clear" or decide if it's "better"; because the lanes have a "purpose" (passing lane and not), the idea of an aggressive driver, or righteous driver, or nervous driver, can come into play; indicator lights would be introduced, though not necessarily used by all driver "personalities".

two-lane (two directions), infinite highway

This is the true highway driving, meant mainly to add in passing on the "wrong side" of the road. Of interest with this simulation is the amount of time lost when a slower vehicle (perhaps a semi-trailer) causes a back-up of traffic.

This back-up of traffic and passing problems actually contain quite a few factors. Given the simple case of one vehicle passing another, the vehicle's acceleration comes into play, as do the grade and curve of the road. The speed of oncoming traffic is a visual estimation, and the passing driver uses past experience and does some pretty impressive impromptu physics calculations to decide whether he or she has enough time to accelerate and pass the vehicle ahead in the time it will take that oncoming vehicle to reach the pair. And they're not always successful!

Throw in multiple oncoming vehicles (with variable gaps), weather conditions, and possibly a line of vehicles that the passer wishes to "leapfrog" through, this simulation adds a lot more to see, considering we've only turned around the traffic in one of the lanes.

Drivers are now aware of their vehicle's acceleration, the speed of the vehicle they're trying to pass and the speed of oncoming traffic; while no true driver knows these numbers, they visually estimate it with a degree of accuracy that will be represented by the simulation's drivers by an accuracy rating for the driver, which can and hopefully will lead to the case of a failed guess, and aborted attempts to pass. Drivers will need to watch vehicles ahead of them that are perhaps trying themselves to pass, or may have to determine that they aren't trying at all. Some drivers may wait until the one before them has finished passing before attempting their own pass, while other drivers will pass two-at-a-time, now dependent on the behaviour of the one they're following.

multi-lane, multi-direction, with off-ramps

This is the ultimate stage, implementing full traffic simulation. As mentioned before, the off-ramps, or any splitting or merging of lanes, is the second large hurdle I see with this project.

It should be easy enough to say that at point P of a lane, it all-of-a-sudden ends, and two new lanes branch from it -- either one that continues straight (along this road), and one that turns off (is the off-ramp, or turn lane). One big problem that can occur is that for a short time after this point, the vehicle is in both lanes (because they don't instantly become two full-width lanes), so other drivers must consider them in two places at once.

Additionally, new logic will be needed when a driver sees that either his lane branches into two, and must decide which path he or she is going to take, or if the opposite happens: that their lane is ending, being merged into another and they themselves must merge. This is part of a larger addition, which is that the drivers are now not necessarily driving down an infinite highway, but might be removing themselves from the main concern of the simulation (if we're watching, say the "main" road).

New traffic will be introduced by on-ramps, helping to break up static configurations of vehicles, and off-ramps will do the same. Traffic lights could now be introduced, allowing for testing of light duration, advance-lights, pedestrian crosswalk signals, etc. Stop-signs versus yield-signs could be implemented. Speed limits could be made variable, as roads merge and turning lanes are added.

Drivers, in addition to having a destination, will now have to have attributes for how well prepared they are for their destination -- that is, are they in the correct lane when their turn-off approaches, or are they more likely to start braking and changing lanes at the last minute, disrupting multiple lanes of traffic? Do they politely let in merging vehicles, or do they speed up to not allow anyone in (this is behaviour that would also be added to the two-lane/one-direction simulation, but in this case it's lane-merging and not just against lane-changing drivers). Yellow-light runners, red-light runners, advance-light runners -- these can now all be added as personality types for the drivers.
<--Introduction ^--traffic--^ Model-->

©2002-2017 Wayne Pearson