r/creativecoding • • 11d ago

Traffic Jam simulation

This is a simple model of traffic called the Nagel-Schreckenberg model. Each square represents a car. Red means it is at a full stop (stuck in a jam), and yellow means braking, and green means it is driving at vmax. At each tick, a car increases its speed by 1 or adjusts its speed so it doesn't crash, and with probability p(dawdle) it randomly brakes and decreases speed by 1. Through these very simple rules traffic jams can emerge due to just one person randomly changing speed. If you set vmax to 1 and p(dawdle) to 0, you get Wolfram's rule 184

This is a little TouchDesigner simulation I used to research my video about phantom traffic and its solutions

47 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/rbrtl 9d ago edited 9d ago

is vmax 5 car lengths per tick?

I feel that it makes more sense if you stare at the top row as it disappears. The green dots look like they're flashing right to left (which btw, OP, wtf??) and the red patches pause because the dots bunch up. But it's still a totally whack visualisation, sorry