This is The Mechanic, where Alex Wiltshire invites developers to discuss the inner workings of their games. This time, Cities: Skylines [official site].

Cities: Skylines is a game about building roads. Its lovely set of road-building tools allow you to scribe beautiful curved boulevards into the gentle slopes and combes of virgin lands, and it has inspired 19-page forum topics entitled Show Us Your Interchanges and Steam Workshop lists 24,482 interchange designs.

Oh, and an incidental byproduct of a good road system is the growth of a city around it.

Cities: Skylines is a sim that feels uncommonly alive and reactive to your planning. You can watch each citizen make its way through your creation, from home to place of work, and from there to visit a park. They may walk or take a bus or train, but you’ll mostly notice them driving, creating traffic which fundamentally represents the health of your city, a pulsing network that’s driven by Cities: Skylines’ beating heart:

THE MECHANIC: Traffic simulation

Developer Colossal Order was no stranger to transit when it started making Cities: Skylines. It’d already made two Cities in Motion games, which are about building public transportation systems. But for a game about managing a city, they needed to capture its essence. “Roads are part of the character of a city,” game designer Karoliina Korppoo tells me.

The team also wanted to achieve something rather tricky, to feature deep micromanagement-based play that would also appeal to less experienced players, and they realised that the realtime, flow-y nature of traffic could be the key. “It seemed like the one thing where constant quick changes felt good and it felt meaningful for the player to make changes to the road network,” says Korppoo.

They also wanted the city to feel alive with residents so players would feel attached to what they’d constructed, and so every citizen has a home, workplaces and family, and is simulated as they move around from one to another. Materials needed for commerce and industry are modelled moving from place to place, too. And once they’d built that system out, it was only logical that they’d extend it to the traffic, since it reflects all these movements.

“We do not like faking citizen behaviours,” says programmer Damien Morello. And thus you can watch cars purposefully drive around the city, showing off what’s running in the simulation itself. For the player, that means roads are absolutely necessary for linking each part of the city to the rest so the citizens can access them. After all, the city is not statistically modelled so that as long as amenities exist, they’re factored in. They have to be connected, and more than that, how they’re connected matters. There are a few circumstances in which the game does fake things, however. If a traffic jam gets completely out of control, the game will remove cars to avoid perpetual gridlock.

Surprise: Cities: Skylines’ traffic simulation wasn’t easy to develop. But not because it’s a difficult system to model so much as it was difficult to present in a way that players can understand the emergent complexity of thousands, and even hundreds of thousands of journeys.

In other words, Colossal Order’s early attempts at the traffic simulation initially lead to chaotic traffic jams that were hard for players to diagnose and therefore not fun to fix. The solution was to simplify citizens’ decision-making processes and the traffic rules, teasing out the causality so players could see how congestion was happening.

So what are Cities: Skylines’ traffic rules? The first rule is: you do not rear end the car in front of you. Programmer Antti Lehto is pretty emphatic about this rule. The second rule is: you don’t exceed the speed limit. Third rule: you stop at red lights. The fourth rule says that only one vehicle can be in an intersection at any one time. The fifth (it feels like this could maybe be prioritised a little higher?) is you don’t run over pedestrians. The sixth rule is that the first vehicle to decide to go to a given location is served first.

And the seventh and final rule is that these don’t rules apply when the player isn’t looking. This is a rule that is there to save CPU time, but even here, the game only skips rules that don’t have a major impact on the simulation.

The result is a game which runs according to the efficiency of your road system. Since your citizens and goods are moving around the city, the time they take to get to their destinations directly affects the speed of growth and change. “If your commercial areas are not getting goods to sell, they will eventually run out and if none arrive within a reasonable time, they can be abandoned,” says Korppoo.

The simulation has to react to the fact that it’s such a dynamic city, with buildings developing and becoming disused, as well as the player making direct changes to road layouts. But vehicles only recalculate their routes when they get close to a modified area. As you’d expect, it’s a solution for dealing with change that saves CPU time, but it also gives an extra sense of life to the cars. As a driver in the real world, you won’t necessarily know a shop has shut down or the road you’re using has closed before you get there.

All of this means that the other game mechanics in Cities: Skylines need to account for the fact that the time for citizens and goods to reach a given destination is unpredictable. All buildings spawn with their stocks of goods half full, so they won’t immediately go into decline before deliveries can reach them.

“Balancing is hard work and we spent a lot of time checking what kind of resource buffers felt right,” says Korppoo. “This is part of the core of the game, so while it was difficult to get right, the whole game would have felt empty without it and all that work was worth it.”

The effect is a game that continually nudges you to focus on roads. Every development starts with one: you can’t zone until asphalt is down. And improving the city by raising density and value is as much a matter of honing your road design, optimising routes between areas and amenities to be as short and clear as possible.

“Judging from Steam Workshop, there were and there still are optimal road layouts which are beyond weird,” says Morello. “But the simulation is realistic enough to allow real world layouts be optimal.” And so an official interchange design, the single-point urban interchange, which has been widely used in the US since the mid–1970s, is a mainstay for Cities: Skylines players, too. But few designs can hold up to the diverging diamond interchange, which is horrifically complex to build but shrugs off heavy traffic in a tight space.

“That said, the goal ultimately never was to mimic a real city road network, as the game is aimed to many kinds of players and both the ones who want to play optimally and those who wish to create beautiful cities need to have fun,” says Korppoo. “So the game focuses on flexibility with the road systems so that many different solutions can work.”

And the flexibility of roads in Cities: Skylines is its greatest joy. The building tools are simple and surprisingly expressive. Building curved roads is a pleasure, and assembling a functioning interchange holds the deep satisfaction that comes with all the learning and planning you have to put into it. Perfectionists might howl at the ease with which an attempt to build a perfect grid can turn out looking decidedly organic, but it feels like you’re laying down a place, with all the imperfections that come with that. And there’s something magic in watching little computer cars negotiating the bumps and turns you’ve set, by design or happenstance.

“City-building games are slow-paced and some of the time playing is spent on pondering what to do next or waiting for money or population to accumulate,” says Korppoo. “This is the time to just stare at an intersection and enjoy it.”