Traffic Lights
Each intersection can have up to 4 traffic lights. They are switched in turn (CW). Similarly to the previous intersection implementation (FIFO), each vehicle approaching the intersection trigger, asks for permission to pass through. The intersection checks which traffic light corresponds to the vehicle and if it’s green, it lets it pass.
In case the active light turns red while a vehicle is stuck inside the intersection trigger, the next light is not switched to green, until the intersection is empty.
That’s it.
Compared to the previous video, spawn points have been fixed. A trigger has been added to each spawn point, and if it’s occupied by a vehicle, no new vehicle is spawned and it looses its turn.
Next time: I don’t know. Maybe I’ll try to “fix” A* by taking into account traffic on each road segment. But that sounds a bit complicated. We’ll see.
Made with Unity. Recorded with OBS.
Post time: Jun-18-2017