Creating a sandbox style traffic system in Unity is a challenge. As our previous posts have shown agents can use NavMesh and calculate shortest paths but the hit is high on processing which in turn limits the number of agents in a scene. Sander van der Vegte is a multidisciplinary game developer who for the past 12 years has fortunate enough to make a living creating games, part of his current development process is a city traffic game and thus finding ways for natural behaviour while maintaining a low processing requirment.
The clip below is a recording of an autonomous traffic system. Cars drive around while aware of crossings and other vehicles. When something is blocking their path, they will stop. If it takes too long, they will back up and look for another path, the basic ruleset allows for humorous situations:
Within the development the user is able to click on a car to take it over while falling off the edge triggers the random camera again.
It is well worth heading over to http://sandervandervegte.nl/ to view his other projects and to keep up to date on City Traffic.