Cities: Skylines

Cities: Skylines

View Stats:
coolkys Jul 27, 2019 @ 8:02am
Why is the C:S traffic light to terrible?
First off, I'll just say I played this game a lot, so I know the ins and outs of this game.

I currently have a 450k pop city with traffic running at 88%~92% with no mods at all. I would say over 60% of my playtime is spent on traffic engineering. Traffic managing can sometimes be an total ♥♥♥, especially without the tmpe's lane management and stuff, but I enjoy making beautiful road systems that works smoothly in vanilla.

But here's the thing: why in the f**k does the vanilla traffic lights have only "2" light phases?
IRL traffic lights have around at least 4 phases that includes stuff like protected lefts.
In this game it's almost fascinating how stupid the lights work. Green means 'go' for a) pedestrians, b) left turns, c)straights. On BOTH SIDES.

They all f**cking collide in the intersection and just get stuck.

Why must players rely on mods to have actually functioning lights? Have the devs just given up? "Oh they'll just install mods so don't bother making an realistic light system"?

Is making a 4-phase traffic light so damn hard to do? Or is it an optimization issue? Why is it that tmpe can do it and the vanilla game can't?

Could someone give me some answers or have a conversation? Thanks for whoever takes my rant seriously.
Last edited by coolkys; Jul 27, 2019 @ 8:03am
Originally posted by leftbehind:
> One question though, if an aftermarket modding can incorporate all sorts of timed lights and phases into this game(and, as you said, while not tanking the performance), can't the devs take a leaf out of their book and make the lights at least sensible?

Technically, yes, and they'd do a better job than modders. But is it worth it for them to do that? Probably not - they're not going to get any extra money out of doing it. Might as well spend time on DLCs and start working on whatever their next game is. There's also the risk to sales if it goes wrong - like if it grinds on potato computers they lose vastly more users and thus less DLC sales. Again, better to leave what's already done as it is, and focus on DLCs to bring in extra revenue while they develop next game.

> I fail to follow, beacuse if so how does TMPE make it possible, on those said 'potatoes'?

It doesn't, it grinds like crazy on potatoes. But at least with a mod the user can easily just remove it if they decide framerate is more important than fancy traffic lights. If it was baked in to game, user would basically be stuck with pure lag.
< >
Showing 1-15 of 18 comments
leftbehind Jul 27, 2019 @ 10:24am 
It's because they had to squeeze an insane amount of 'city simulation' in to a single CPU core / thread. All the AIs and rendering run in that thread.

They managed to get the pathfinder separated out (which is a minor miracle considering Unity APIs aren't thread-safe) and the entire routes of vehicles and cims is determined in that pathfinder. Problem is, because all the paths are planned in advance, and can't refer to other traffic conditions, all the vehicles just choose the same shortest routes (with some pseudo-randomisation thrown in to mix things up a little). That's why you end up with traffic all using same lane.

When it comes to actually rendering the vehicles driving on roads, stopping at junctions, etc., they also had to perform minor miracles to make that work without literally tanking the fps to zero.

First trick they use is 'leader cars' - where cars on same route work out which car is at the front and then all the others, 'follower cars', re-use the vehicle AIs of the leader car, greatly reducing load on vehicle AIs.

The next trick, 'vehicle grids', deal with collisions. In order to allow all vehicles to be processed in a single iteration of the vehicle list, which is done to ensure maximum branch predication and minimum memalloc and gc, ie. max performance, there's no easy way to say "what car is on this road segment or junction I'm about to drive in to", because doing so would require multiple iterations of the vehicle list and again tank fps to zero. So they have a 'vehicle grid' which is basically just a crazy mathematical way of quickly working out what vehicles are in a certain 'square' on the map by multiplexing the x,y co-ords of all vehicles in to a single number that's encoded in such a way you can use bitwise maths (very fast) to later locate the vehicles....

So the vehicle AIs are iterating the vehicles in turn, and for each one that's moving has to check if it collides with another using the vehicle grid. Sometimes the vehicle at the back moves first (it's earlier on the list being iterated) and doesn't detect the front one, and all sorts of other fringe cases, which leads to momentary vehicle collisions and the AI just stops whatever appears to be the one at the back and lets the others keep moving. That's why you get weird stuff happening at junctions, because what exactly is "the back" when vehicles collide from different directions?

When you say 'Is making a 4-phase traffic light so damn hard to do' the answer is, obviously, "No - so long as you don't care about tanking fps to zero". When it comes to doing it without tanking fps, that takes an insane amount of effort considering how already-overloaded the game is due to the extensive amount of simulation it's doing in a single CPU core / thread.

If you want more control over traffic lights, then use TM:PE which allows you to control each lane at a junction independently. It will tank performance, but thanks to ~4 years of continual development[github.com], not to zero. Interestingly enough, the team are looking to use 'vehicle grid' technique but applied to other stuff like eg. 'network grid' and 'parking grid'. So we might be able to make performance a little better even with the timed traffic lights.
Last edited by leftbehind; Jul 27, 2019 @ 10:29am
coolkys Jul 27, 2019 @ 5:39pm 
Originally posted by KidAutism:
This game just has way too much going on at once. I don't think the game can always keep up so weird things happen sometimes. The traffic though, that especially is a real pain in the ass. It's so picky and nearly impossible to perfect. It's so annoying how picky these damn cims are. They're never happy with anything, it's just like real life. Who knew realism could be so damn annoying to deal with?
Thank you for the reply. I was not particularly complaining about the weirdness of the traffic AIs in general; I got over that ages ago. I'm currently complaining only about the lack of practicality in the vanilla traffic lights. You see, TMPE has timed lighting that has all sorts of traffic light phases. And the mod does so without taking the performance down immensely. So what I'm wondering is, why can't the devs integrate it into the vanilla state and make the lights at least sensible, from the very start?
leftbehind Jul 27, 2019 @ 5:42pm 
> why can't the devs integrate it into the vanilla state and make the lights at least sensible, from the very start?

Because a large number of users are on potato computers.
coolkys Jul 27, 2019 @ 5:47pm 
Originally posted by aubergine18:
It's because they had to squeeze an insane amount of 'city simulation' in to a single CPU core / thread. All the AIs and rendering run in that thread.

They managed to get the pathfinder separated out (which is a minor miracle considering Unity APIs aren't thread-safe) and the entire routes of vehicles and cims is determined in that pathfinder. Problem is, because all the paths are planned in advance, and can't refer to other traffic conditions, all the vehicles just choose the same shortest routes (with some pseudo-randomisation thrown in to mix things up a little). That's why you end up with traffic all using same lane.

When it comes to actually rendering the vehicles driving on roads, stopping at junctions, etc., they also had to perform minor miracles to make that work without literally tanking the fps to zero.

First trick they use is 'leader cars' - where cars on same route work out which car is at the front and then all the others, 'follower cars', re-use the vehicle AIs of the leader car, greatly reducing load on vehicle AIs.

The next trick, 'vehicle grids', deal with collisions. In order to allow all vehicles to be processed in a single iteration of the vehicle list, which is done to ensure maximum branch predication and minimum memalloc and gc, ie. max performance, there's no easy way to say "what car is on this road segment or junction I'm about to drive in to", because doing so would require multiple iterations of the vehicle list and again tank fps to zero. So they have a 'vehicle grid' which is basically just a crazy mathematical way of quickly working out what vehicles are in a certain 'square' on the map by multiplexing the x,y co-ords of all vehicles in to a single number that's encoded in such a way you can use bitwise maths (very fast) to later locate the vehicles....

So the vehicle AIs are iterating the vehicles in turn, and for each one that's moving has to check if it collides with another using the vehicle grid. Sometimes the vehicle at the back moves first (it's earlier on the list being iterated) and doesn't detect the front one, and all sorts of other fringe cases, which leads to momentary vehicle collisions and the AI just stops whatever appears to be the one at the back and lets the others keep moving. That's why you get weird stuff happening at junctions, because what exactly is "the back" when vehicles collide from different directions?

When you say 'Is making a 4-phase traffic light so damn hard to do' the answer is, obviously, "No - so long as you don't care about tanking fps to zero". When it comes to doing it without tanking fps, that takes an insane amount of effort considering how already-overloaded the game is due to the extensive amount of simulation it's doing in a single CPU core / thread.

If you want more control over traffic lights, then use TM:PE which allows you to control each lane at a junction independently. It will tank performance, but thanks to ~4 years of continual development[github.com], not to zero. Interestingly enough, the team are looking to use 'vehicle grid' technique but applied to other stuff like eg. 'network grid' and 'parking grid'. So we might be able to make performance a little better even with the timed traffic lights.

Thank you for your detailed explanation from software side of things! I'm not very studied in the aspects of the foundations of C:S, so this was educational.
One question though, if an aftermarket modding can incorporate all sorts of timed lights and phases into this game(and, as you said, while not tanking the performance), can't the devs take a leaf out of their book and make the lights at least sensible? Not even expecting the flexibility of TMPE - I just want protected lefts and non-conflicting light plans.

The vehicle collision algorithm would also be a lot more hassle-free if the intersections' lights were designed to not allow for any vehicle routes to overlap at all(like IRL), so I'm a bit confused.

Does this have to do with the efforts of the TMPE dev teams' efforts being stolen, or that this function is only possible by modding, and not from the ground-up without performance hits?

Thank you again for your detailed answer.
coolkys Jul 27, 2019 @ 5:48pm 
Originally posted by aubergine18:
> why can't the devs integrate it into the vanilla state and make the lights at least sensible, from the very start?

Because a large number of users are on potato computers.
I fail to follow, beacuse if so how does TMPE make it possible, on those said 'potatoes'? Are you saying that only mods can make it possible, and not the game itself?
Last edited by coolkys; Jul 27, 2019 @ 5:49pm
The author of this thread has indicated that this post answers the original topic.
leftbehind Jul 27, 2019 @ 6:01pm 
> One question though, if an aftermarket modding can incorporate all sorts of timed lights and phases into this game(and, as you said, while not tanking the performance), can't the devs take a leaf out of their book and make the lights at least sensible?

Technically, yes, and they'd do a better job than modders. But is it worth it for them to do that? Probably not - they're not going to get any extra money out of doing it. Might as well spend time on DLCs and start working on whatever their next game is. There's also the risk to sales if it goes wrong - like if it grinds on potato computers they lose vastly more users and thus less DLC sales. Again, better to leave what's already done as it is, and focus on DLCs to bring in extra revenue while they develop next game.

> I fail to follow, beacuse if so how does TMPE make it possible, on those said 'potatoes'?

It doesn't, it grinds like crazy on potatoes. But at least with a mod the user can easily just remove it if they decide framerate is more important than fancy traffic lights. If it was baked in to game, user would basically be stuck with pure lag.
coolkys Jul 27, 2019 @ 6:07pm 
Originally posted by aubergine18:
> One question though, if an aftermarket modding can incorporate all sorts of timed lights and phases into this game(and, as you said, while not tanking the performance), can't the devs take a leaf out of their book and make the lights at least sensible?

Technically, yes, and they'd do a better job than modders. But is it worth it for them to do that? Probably not - they're not going to get any extra money out of doing it. Might as well spend time on DLCs and start working on whatever their next game is. There's also the risk to sales if it goes wrong - like if it grinds on potato computers they lose vastly more users and thus less DLC sales. Again, better to leave what's already done as it is, and focus on DLCs to bring in extra revenue while they develop next game.

> I fail to follow, beacuse if so how does TMPE make it possible, on those said 'potatoes'?

It doesn't, it grinds like crazy on potatoes. But at least with a mod the user can easily just remove it if they decide framerate is more important than fancy traffic lights. If it was baked in to game, user would basically be stuck with pure lag.
So after all it just boils down to cost return and revenue... Colossal is a company, after all.
leftbehind Jul 27, 2019 @ 6:22pm 
I'd add risk to that equation, but essentially yes.

Also, I'd like to think they are investing resource in developing C:SL v2 with a new game engine that will drastically extend what can be done with the game. Although from what I've seen them say at some AMAs and other interviews I suspect they are probably wanting to try other genres as all they've done so far is transport / city builder type games.

Also, I think, for most people buying this game, it's to scratch a creative itch that city builders provide. Traffic is only one factor in that equation. I see loads of people spend ages detailing, or creating assets, or modding, or doing crazy public transport setups, or just generally enjoying the game in other ways, despite the issues with vanilla traffic and the low frame rate.

Out of all the 92 games I have, C:SL is the only one I keep coming back to because there's just so much room for creativity. Admittedly, I'm not sure that would be the case without the workshop, but then again I doubt any company could create so many features and assets without having to find all sorts of evil ways to extort more money from players.
coolkys Jul 27, 2019 @ 10:09pm 
Originally posted by aubergine18:
I'd add risk to that equation, but essentially yes.

Also, I'd like to think they are investing resource in developing C:SL v2 with a new game engine that will drastically extend what can be done with the game. Although from what I've seen them say at some AMAs and other interviews I suspect they are probably wanting to try other genres as all they've done so far is transport / city builder type games.

Also, I think, for most people buying this game, it's to scratch a creative itch that city builders provide. Traffic is only one factor in that equation. I see loads of people spend ages detailing, or creating assets, or modding, or doing crazy public transport setups, or just generally enjoying the game in other ways, despite the issues with vanilla traffic and the low frame rate.

Out of all the 92 games I have, C:SL is the only one I keep coming back to because there's just so much room for creativity. Admittedly, I'm not sure that would be the case without the workshop, but then again I doubt any company could create so many features and assets without having to find all sorts of evil ways to extort more money from players.
I agree. For me, the feeling when an interchange highway looks good and works nicely is just awesome. I would welcome a v2 of C:S where the optimization/capacity/graphics is better.
TLHeart Jul 27, 2019 @ 10:47pm 
Originally posted by coolkys:
Originally posted by aubergine18:
> why can't the devs integrate it into the vanilla state and make the lights at least sensible, from the very start?

Because a large number of users are on potato computers.
I fail to follow, beacuse if so how does TMPE make it possible, on those said 'potatoes'? Are you saying that only mods can make it possible, and not the game itself?
I play on a "potatoe" computer, with a frame rate of 6 to 9. I use TMPE advanced AI, and Parking AI... Yes it is slow, but I build slow, and enjoy the game. As I can afford to, I will save for a newer computer... Presently running a phenom II X2 a 3.0 ghz. A processor that is 9 years old. So it grinds, it chugs, but it still gets the job done, just like an old man can.
Vimes Jul 27, 2019 @ 11:26pm 
Originally posted by tenderloveheart:
Originally posted by coolkys:
I fail to follow, beacuse if so how does TMPE make it possible, on those said 'potatoes'? Are you saying that only mods can make it possible, and not the game itself?
I play on a "potatoe" computer, with a frame rate of 6 to 9. I use TMPE advanced AI, and Parking AI... Yes it is slow, but I build slow, and enjoy the game. As I can afford to, I will save for a newer computer... Presently running a phenom II X2 a 3.0 ghz. A processor that is 9 years old. So it grinds, it chugs, but it still gets the job done, just like an old man can.

I applaud your commitment to the game, as well as your patience.
I often use TMPE but I do not bother with the parking AI, perhaps I'll try it again. It does make a city seem much more realistic with having full cap parks everywhere.

Perhaps one day you might get to enjoy an upgrade to your system.

leftbehind Jul 28, 2019 @ 9:48am 
I suggest using TM:PE 10.21.1 or above if you want best results from the vehicle and parking AIs. Currently available on LABS (recommended) or ALPHA workshop pages. Hopefully STABLE will be updated soon when LinuxFan finishes moving city IRL.
Vimes Jul 28, 2019 @ 10:08am 
Originally posted by aubergine18:
I suggest using TM:PE 10.21.1 or above if you want best results from the vehicle and parking AIs. Currently available on LABS (recommended) or ALPHA workshop pages. Hopefully STABLE will be updated soon when LinuxFan finishes moving city IRL.


I always have TMPE loaded and I'm using the LABS version. I just remember on a very large city getting very close to the maximum allowed parked cars when using the Parking AI. It is not as though there is a percentage amount to use for that, it is either totally on or off.
I'll probably use it again now.
leftbehind Jul 28, 2019 @ 11:49am 
The LABS version of TM:PE is compatible with the More Vehicles (MV) mod which greatly increases vehicle limits. However, many other popular mods aren't yet compatible with MV, including 81 Tiles and IPT2, so check before using MV. Mods incompatible with MV will throw Array errors.
< >
Showing 1-15 of 18 comments
Per page: 1530 50

Date Posted: Jul 27, 2019 @ 8:02am
Posts: 18