A scalable traffic simulator where both simulation and rendering runs in WebGL. It shows cars on a downtown city grid, following simple right-hand traffic rules.
Cars drive at different preferred speeds, while avoiding collisions by observing the car in front of them. At intersections, drivers give way to cars coming from the right, and also perform emergency braking when necessary by observing cars in or about to enter their path. In addition, there is a simple deadlock solution that prevents cars from getting stuck indefinitely when a four-way deadlock occurs at a crossroads.
You can move the camera around by rotating (left mouse drag), panning (right mouse drag) and zooming (mouse wheel). On touch screens, drag and pinch gestures are at your disposal. To see how the traffic simulation scales, you can increase the car count and grid size in the demo settings. When increasing the car count, make sure to also scale the grid size accordingly or the cars will just be stuck in an eternal traffic jam.
Blog post: How this demo was implemented.