City Skylines traffic models fluid dynamics

Did you know that fluid dynamics perfectly models the traffic flow in City Skylines? It is true and allows for some great traffic flow hacks.

The formula for volumetric flow rate aka fluid flow (Q) is the volume (V) divided by time (t).

volumetric flow rate (Q) is the volume (V) divided by time (t).

This also happens to be the exact same formula that describes the traffic in City Skylines. This is because (in a slightly granular way) traffic acts as globs of 2D fluid.

City Skylines traffic quality equals traffic approaching over traffic departing

In this case, Q (quality of traffic flow) is better the smaller the “number” is. Which is where we come to the excellent YouTuber Biffa and how I somewhat disagree with his “lane mathematics”.

Lane mathematics and controlling for V.

According to Biffa, if you merge a lane in, you need to add a n extra lane to your road to balance the traffic. As rules of thumb go, this works but it is inaccurate.

For example, two sets of three lanes merge into another road. Make the road six lanes direction to keep the traffic moving.

This is really an example of neatging traffic compression and decompression (which I will come to later).

The upside to “lane mathematics” is that, all other factors being equal, it is an easy to remember rule that works well if your design is good.

What Biffa is doing (even if he does not know it) is using V (volume of traffic approaching) as the control for Q (quality of traffic flow). It works but only in the way that all things look like nails if all you have is a hammer.

Speed mathematics and controlling for t.

You can control for t (the time it takes the traffic to get there) not just V.

Traffic shaping that controls for t looks at how fast the traffic can move into and out of a problem area. So long as the traffic arrives at the site more slowly but leaves more quickly, you should never get a traffic jam.

The rule of thumb here is whatever you do to V also do for t.

For example, two sets of three lanes merge into another road. Add the speed of both roads and make that the speed of the merged into the road. This is super easy with the traffic manager mod.

City Skylines lane speed editing

When controlling for t, be sure to look at all factors that can slow your traffic down. Factors that slow traffic are things like bad merging, vehicles waiting to turn and getting in the way of other vehicles. Anything that can screw up free-flowing traffic is a factor of movement over time (t aka speed).

Controlling for both V and t.

With both factors under your control, you can have much greater control over traffic quality. You could even reduce the Q value and boost your flow quality.

This allows us to explore some more advanced techniques such as traffic compression.

Traffic compression in City Skylines

Traffic compression is when you make a number of lanes squeeze into a smaller number of lanes. On the whole, you will want to keep Q constant and increase speed (t) to compensate.

On a lightly used stretch of road, you may wish to compress your lanes in order to create dedicated merge in lanes for roads joining it.

I also use lane compression if I need to set a lot of traffic to later use a narrower road. The classic City Skylines example is cargo hubs and cargo train stations. The one-lane that can be used to turn into a cargo hub (without cross other lanes) will generally be the same as a single lane one-way road. Here, you will want to gently ease the traffic into a compression pattern for that lane.

Fixing competing t and V needs

What I found works best is to vary t (speed) in graduated steps. You don’t want to just merge down lanes as that causes blockages. You also don’t want to send the traffic racing towards the cargo hub as that causes tailbacks and then blockages.

The answer is to combine the speed of the merged lanes as the speed of the lane after the merge. This keeps the cars moving away at the same rate they arrive. However, I then step down the speed in small increments. I use steps of 5 if I can but steps of 10 if I have to.

This process of gradual breaking (speed reduction) spreads the pain of the merge over a larger amount of road. This should keep the traffic moving but allow you speed out of a merge and slow into the next turning or merge.

Giving traffic more time in City Skylines

To keep the speed steady, I find it helps to force the traffic to stay in lane. This stops traffic trying to merge and slowing other traffic in the wrong place.

Traffic decompression

Traffic decompression is where you force traffic to spread out and use more lanes. The node lane tool in traffic manager is good for this.

I like to use decompression when I have a lane on a highway that is used significantly more than other lanes. Generally, the inside and outside lanes get the most love as this is where turning takes place. The AI’s tendency to stick to turning lanes causes unforeseen V increases.

By forcing better lane usage, you can reduce V (traffic coming in) and improve Q (traffic quality).

Lane decompression is one of those areas where some experimentation (with your city’s layout in mind) is needed. Make good use of the built in tools to see where traffic wants to get to. This will help you work out which lanes need to decompress (or compress).

My video of City Skylines and fluid dynamics

The reason I have written this post is that I was up all night trying to finish a video about City Skylines’ traffic and fluid dynamics. I am pretty sure I used a good editing filter which filters out any trace of good editing. In other words, I wanted a second shot at explaining myself.

Although I sort of disagree with Biffa in this article, his videos are the direct inspiration for my own. Check out Biffa’s YouTube channel if you love City Skylines videos.

I’d love to get your thoughts on my comparison of City Skylines traffic and fluid dynamics. Please help yourself to the comments section and tell me what you are thinking.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Top