Cities: Skylines

Cities: Skylines

690 ratings
SingleTrainTrackAI
   
Award
Favorite
Favorited
Unfavorite
Mod
File Size
Posted
Updated
0.038 MB
Jun 18, 2017 @ 12:08am
Dec 29, 2018 @ 1:58pm
10 Change Notes ( view )

Subscribe to download
SingleTrainTrackAI

Description
Mod to avoid train collisions on single tracks 2 ways from BloodyPenguin mod One-Way Train Tracks.

How does this mod works?

It is simple. Before entering on a single track section, a train will check if there is already another train running the track in the opposite direction. If that's the case, the train will stop until the track is free.

For complex networks of interconnected single tracks, any train stopped will be put in a waiting list, and proceed on the single track section in first-arrived order.

When using long stretches of single track, be sure to lay down some double tracks section regularly so that train can intersect (they are called passing loops[en.wikipedia.org]). If there are many trains, jams might still occur. Also place a 2 tracks section before a terminus station, so that trains can properly enter/exit the station. -> Since 1.2 no need to this anymore!

Some settings can be changed in the file in ~\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\.

Single track stations are now supported and will get reserved like normal 2 ways single tracks!

Info

Link to the GitHub repository[github.com].

The mod hinders some functionalities of Traffic Manager : setting traffic lights or priority signs will not work on train tracks. Other things like speed restrictions do work :)

This mod uses detour and would be incompatible with any mod modifying the method UpdatePathTargetPositions of class TrainAI.
< >
202 Comments
justing Aug 23 @ 1:23am 
I've noticed some weird behaviour from my trains and I think it could be related to this mod. At the outside connections for train tracks, trains only use one side of the outside connection track, causing trains to back up since the track keeps spawning new trains. Other tracks on the same edge of the map are available, but the trains don't seem to use them, despite them being a valid path.
Damo Jun 29 @ 8:09am 
Apologies if this has been asked before. But is it possible to introduce the same UI for trams? And if so, would it be able to handle a single track dead end where the tram can go back the way it came?
MetroTitanD78 Mar 21 @ 12:51pm 
Looks like the approach to Bristol Temple Meads when you arrive from London or up North.
Pistro Dec 7, 2020 @ 10:32pm 
@vsvg.scattered too fast acceleration can be fixed with Advanced Vehicle Options mod. The stucking nose out too far issue seems possible to fix, at least in principle, because the fact that vehicles stop at different but consistent distances from a node depending on whether a track is nodeless or not suggests that there is a line of code which tells them how far away they should stop.
John Rambo  [author] Dec 6, 2020 @ 1:01am 
Exactly, in order to properly support two-way single track the train AI would have to be completely rewritten. I'm not sure if it's even possible in a mod. Besides, Cities Skylines isn't really a train simulator, there are other games better suited for complex rail networks :)
vsvg.scattered Dec 5, 2020 @ 7:50pm 
great mod. it seems to highlight some issues with the underlying stock AI which is outside the purview of this enhancement, like:
- following too closely, and even invading the space of the train in front up to 1/2 a train length
- not stopping quickly enough, and nosing into a junction
- inching forward a smidgen when they have not yet decided to actually move (playing chicken)
- accelerating way to fast, first-person camera says cargo trains can get up to 80-100 kph in just three car-lengths.
that's all the same in the stock AI.

At two-way tracks I haven't seen blatant collisions, just some paint swapping when a stopped train stuck its nose out too far.

it's good to remind folks:
if you have a long run of (mostly) two-way single track, the capacity will be directly (inversely) related to the length of the longest stretch of single-track.
And be sure the longest trains fit into the passing loops, allowing for buffer space.
Future Dec 5, 2020 @ 6:11am 
@John Rambo I've noticed that it seems to happen more on certain segments (once again, not train station tracks) than others-I'll try to find out what is the pattern
John Rambo  [author] Dec 5, 2020 @ 1:01am 
@Future yes there are situations where the single-track segment reservation doesn't work, it either blocks both trains or allows both at the same time. I haven't been able to reliably reproduce it though. Maybe CoarzFlovv can take a look.
Ilion Dec 4, 2020 @ 11:34am 
@Future, I've never used two way one lane tracks, so I'm speculating based on what I've recently noticed that TM allows me to do.

So, if the station has normal double-tracks, then I think you should be able to chick on the station's switches and then use TM's "lane tool" to direct the trains arriving on *this* track to pull into the station on *this* station-track, and direct the trains arriving on *that* track to pull into the station on *that* station-track. Similarly, you can direct trains leaving to use a specific track.
Future Dec 4, 2020 @ 5:33am 
@ Ilion not station tracks, just two way one lane tracks