Actuated Traffic Lights demo with AI traffic

So the other day I decided to make some traffic lights, though not the fixed-time ones you’d expect.
For those of you not familiar with traffic engineering terms, “actuated” basically means sensored.
A phase is the length of time a traffic light remains green or red.

Why actuated traffic lights are better

Actuated traffic lights are better than fixed-time traffic lights because they can better adapt to varying traffic conditions, meaning less delay for everybody. In real life they’re more expensive to install, however.

How they work

Unlike fixed-time traffic lights, actuated traffic lights have not 1 time, but 2, which are the Minimum Green and Maximum Green times.
Minimum green is self-explanatory, it’s the minimum time the green light will be displayed for.
Maximum green is the maximum time the green light can be displayed for, basically a limit to prevent excessive delay to other cars.
There also is an intergreen (all-red interval), basically the time in between phases when both sides have a red light, to clear traffic before changing the light to green.
By default when there is no traffic, both sides are red to avoid unnecessarily delaying vehicles, because it’s faster to change a red traffic light to green, than it is to change a green traffic light to red, including the intergreen time.

Operation

When the light is red and a car hits the sensor, the system checks for cars waiting on the other side.
If there aren’t, the light immediately changes to green. A countdown begins with the minimum time, ticking down. Each car that hits the sensor while the light is green extends the green light by 2 seconds. The light turns red when there either is a gap in traffic, or the maximum time has been reached.
The system again checks for cars waiting on the other side. If there are, after the intergreen, their traffic light turns green, and the process repeats.

Video

I’ve scripted some basic AI cars for demonstration purposes only. (I am working on a better AI system, but it’s too raw to be used here.) They are guided by parts on both sides, similar to a railway track.
I uploaded the 1-lane bridge video to a file-sharing site because for some reason I can’t upload it here.

Here’s the intersection video.

14 Likes