DECKELEVEN'S BLOG

Here you can find out what we have been up to. Feel free to leave a comment or give your feedback!

How switching works?

Switching happens when a train has multiple possible paths when going to a waypoint.

The game automatically creates a switching signal at the place where a switching decision is made:

A simple switch

When a train arrives at a switching signal, it must decide which path it will take.

For that, it inspects the different signalling blocks:
– the switching block is the block just after the switching signal
– the outgoing blocks are the blocks just after the switching block

The signalling blocks used for switching


Here are the rules for switching:
– If the switching block is occupied, the train waits at the switching signal.
– If not, the train inspects the outgoing blocks and chooses one that is not occupied.
– If all the outgoing blocks are occupied, the train waits at the signal.

In our simple example, in this situation, the train will choose the upper path, because the switching block and the upper outgoing block are not occupied :

Nothing in the way

In this situation, however, the train will choose the lower path, because the upper outgoing block is occupied:

Upper outgoing block is occupied

In this situation, the train will wait because all the outgoing blocks are occupied:

No free outgoing block

That’s it! Switching is quite easy when you know the rules.


For successful switching, you have to be careful how you place your signals though.

Let’s have a look at some common design errors:

Missing signalling blocks

In this situation, the switching will never happens, because there is no signals, and therefore no signalling blocks to inspect.

Missing signalling blocks

Long trains

In this situation, the switching will not happen either. The incoming train will always wait at the switching signal, even though the second platform is available. The reason: the tail of the long train on the station platform is blocking the switching block.

Long train tail is blocking the switching block

For long trains, you must use stations with long platforms. See the Railropedia to learn how to do that.

Incomplete blocks

This one is a bit trickier. Can you see what is missing?

Incomplete blocks

In this situation, the switching will never happen. The outgoing blocks are incomplete: there are signals at the station entries, but not at the exits. As a result, the two platforms form a single signalling block.

Wrong outgoing blocks

In this situation the incoming train will not go the lower track. It will go the the upper track even though the upper platform is occupied. Can you see why?

Wrong outgoing blocks

In this case, the outgoing blocks used to decide the switch are not the station platforms. They are the tracks just after the switching blocks and they are both empty. So the train will take the upper path, and will queue behind the loading train.

Sometimes, this is what your want, but if not, make sure you know which blocks are used to decide the switch.

Merged blocks

Sometimes a block is bigger than you think.
In this situation, the two outgoing blocks are connected by a crossing track. They are merged and form a single block. As a result, the switching will never happen.

Merged outgoing blocks

Multiple switches

In this network, the player connects two stations with two tracks. The player hopes that trains will switch at the first rail switch, choose an empty track, then switch at the second rail switch to find an empty platform.

Too many switches

But it does not work. Trains always end up facing each other.

Do you see why?

Things get clearer when you display the train paths:

Trains only switch once

The router will always look for the shortest paths. In this setup, this means that trains will switch only once between A and B, not twice. The second rail switch is never used.

Rail switches do not matter for train switching. Only the actual train paths are considered.

Balancing traffic between two bi-directional tracks is very difficult. A possible alternative here is to use one-way tracks instead. For this, you have to add intermediary waypoints on the tracks.
See the Railropedia/One-way tracks article for an example.

21 thoughts on “How switching works?

  1. In order to switch properly in last example, only ONE (from two) way must be ruled as entrance to station. Other word, trains must be ruled to go only on ONE side, right or left, out of stations.

    1. A possible solution is indeed to use intermediary waypoints on the two tracks. If you do this, you turn the two tracks into two one-way tracks, and the switching works (See Railropedia – one way track for an example).
      But that’s not what the user tries to do here. The user wants to make two bi-directional tracks with load balancing.
      Load balancing bi-directional tracks is very difficult.

      1. Thanks for the answer.
        Such balancing is not possible at all, especially on long sections of the path, because then the user will have to allocate a path to a specific train up to the point where it can diverge from the oncoming one. And this is completely impractical. So don’t bother with that.

        Now the General comments.
        1. As far as I understand, the train arriving from either side always tends to take the path closest to the station building, and this sometimes causes a collision with the oncoming train leaving the station. In my opinion, it would be advisable to give priority to the station track that is closest to the track on which the train arrives, regardless of which side the station is located. If it is possible, of course.
        2. In a number of annoying and incomprehensible cases, the arriving train tends to occupy exactly the station track from which the oncoming train departs, or ready to departs, although there are free tracks nearby. This is the main misunderstanding that I encountered…

        1. Trains facing each other are usually the result of crossing cases. For instance, train A can decide to go to platform 1 because it’s empty. However because train A is not yet at platform 1, it has not yet blocked the station platform.
          If for some reason, another train B makes the same decision at the same time, they can use the same platform (It can also be that train B is a new train that is dropped on platform 1)
          When train A and train B are entering/leaving from different sides, it’s ok (That’s why double sided terminus are working).
          When train A and train B are entering/leaving from the same side, it can lead to interblocking. It’s a rare crossing case that will probably be addressed in a future version.
          Your point 1 is possible, however we currently prefer to prioritize tracks this way to support an upcoming new node that will allow traffic balancing between tracks.

          1. Thanks.
            So far, the most reliable way to avoid collisions that I have found is to do – at end stations-a loop of the type: (direct) path 1 – all station paths-loop – (reverse) path 2. This not only eliminates all collisions, but also increases the capacity of the station.
            And at intermediate stations-divide the station tracks into one way – direct and reverse.

  2. Could you add a feature to tell/specify if an extended platform is long enough for a long train? Sometimes you’ll spend ages setting up a complex set of stations/warehouses/etc in a tight space and find out only when it’s up and running that either you’ve massively overestimated how long the track needs to be, or worse it’s JUST not long enough so the signals don’t work and you need to redo a lot of work. You can’t just test it to see if the train will fit until you’ve completed the whole circuit.

    Could you, for example place a train without a route on a track, and select which way it faces so you can see what room it needs?

    Love the game though. Looking forward to electric dreams. Keep it up!

    1. I’ll add “measuring tool” to the todo list. Unfortunately the todo list is quite long, so there is not ETC on this.

  3. Please add some feature like bridge over bridge, add road for railway crossing , on thing is if we exit the game accidentally the game progress not seved, pls correct this.

  4. In version 2.3.2, an unpleasant bug was found. At least in the sandbox. It is not possible to build a two-row (or more) bridge over the tracks, only a single-row one. In the same place, in the absence of tracks under the bridge, … is built without problems, even four-row… but then lay paths under it… it is also impossible. Repair, please… 😉
    Else one. Make mooore… up to 10 sandboxes, pleeeeeeease! 🙂

  5. Bonjour,
    Merci pour ce jeu Ă  rendre dingue n’importe quel fan de trains 🙂
    Cependant, j’ai un petit problĂšme de trains que se retrouvent nez-Ă -nez. J’ai une double voie qui desserre 3 stations A (terminus), B (passage) et C (terminus). J’ai mis des traversĂ©es jonction-doubles Ă  l’entrĂ©e et Ă  la sortie (pour B) de chacune des gares afin de rendre les voies des gares bi-directionnelles. Sur cette voie, j’ai des trains qui vont de A Ă  B et des trains qui vont de A Ă  C avec sens de marche unique sur les voies entre les gares (une voie pour aller de A Ă  B et l’autre pour aller de B Ă  A). Pour Ă©viter le cas du “Multiple switches”, j’ai dĂ» forcer l’arrĂȘt en B des trains AC (uniquement pour refueler).
    A l’approche d’une gare, il arrive que des trains grillent le signal d’entrĂ©e du switching block et viennent se mettre face Ă  un train en attente sur la voie la plus proche du bĂątiment mĂȘme quand l’autre voie de la gare est libre.
    Sinon, comme Ivan Kolin, je pense que les trains ne devraient pas ĂȘtre aiguillĂ©s prĂ©fĂ©rentiellement sur la voie la plus proche du bĂątiment ce qui, dans mon exemple, force les trains Ă  switcher sur la voie de droite Ă  l’entrĂ©e de B puis Ă  switcher sur la voie de gauche Ă  la sortie de B mĂȘme si la voie de gauche est libre (je ne sais pas si c’est trĂšs clair 🙂 ).

    1. Bonjour,
      Le cas des voies parallĂšles bidirectionnelles est un cas difficile Ă  rĂ©soudre, car les trains ne “voient” que deux blocs plus loin (le switching block et les outgoing blocks). Du coup, ils ne peuvent pas voir le train arriver un bloc plus loin.
      Ce qui se passe en gĂ©nĂ©ral, c’est que le train allant de A vers B choisit une voie parce qu’elle est libre au moment du choix, et que le train allant de C vers B fait le mĂȘme choix parce que la mĂȘme voie est libre de son point de vue. Une fois arrivĂ©s sur le bloc destination, il est trop tard.
      MĂȘme si les trains “voyaient” un bloc plus loin, ça ne corrigerait pas le problĂšme, parce que rien n’empĂȘche un train trĂšs loin sur le rĂ©seau, plusieurs blocs plus loin, de faire un choix qui l’amĂšne sur un chemin dĂ©finitif en collision.
      La solution idĂ©ale serait de faire du “path signalling”, mais l’algorithme est trop coĂ»teux pour tourner sur tablette ou tĂ©lĂ©phone.
      J’ai plusieurs expĂ©rimentations en cours pour essayer de rĂ©soudre la situation.
      En attendant, le mieux est d’Ă©viter de faire des voies parallĂšles bidirectionnelles, sauf si la station est un terminus, car dans ce cas les trains font demi-tour et il n’y a jamais blocage (voir Railropedia – double sided terminus)

  6. How tem I make a signal into a switching signal?
    I have set up a double rail with a X cross before getting into a double rail station but it doesn’t add the switching signal.

    1. Switching signal do not appear with the tracks layout.
      They appears when you create routes with multiple paths.

      1. Its still not working. I have several trains using the tracks and some of them stop at the station and others dont.
        When editing the routes, the color lines display correctly splitting properly using the tracks, but when the trains are running they get stuck one behind the other when the other track is free.
        Im pretty sure the signals are correct.
        Im scratching me head on this one.

        1. It’s hard to know without seeing your actual tracks and route setup, but if trains are not stopping at the station, it’s probably because one of the paths uses a station platform to “turn around” and reenter to another platform.
          The router will always find all the paths between all platforms. Sometimes you think a path between two platforms is impossible, because there is no direct connection between two platforms. But the router can find an unexpected one, using a distant track loop, using the station as a passing track (hence not stopping).
          In that case, the switching signal exists, but not where you think it would be. You should carefully inspect all the inbound paths and see if a path is not looping around your station.
          I added this post to explain everything:
          http://www.deckeleven.com/post-unruly-trains

          1. I have trains that are supposed to stop and others that dont need to stop so that is not an issue.
            The issue is that the trains do not pick automatically take an empty lane when they are available.
            Remember I have the tracks in a loop so they all move in one direction only going thru all the available stations. (I know, its goofy, but I do that once I complete the level I just make a huge loop around all the stations and cram as many trains as I can just to see them move around).

            So I check and recheck and I dont know what is missing. The tracks are set up correctly,
            Its a two lane track that enters into a three lane station.
            Theres the first signal, and at the next section of track I have another signal and then the tracks are in an X mode for the trains to pick one of the three lanes, and they all have a signal.
            There is also a signal at the end of the station.

            Checking the route for the train, it clearly show three color lines per lane on both tracks and they get split into the three lanes, making two color lines per track.
            But it doesnt work.

          2. Thank you for the assistance, but I think there is some confusion.

            The issue is that the trains are not picking up the empty tracks at the station and I am trying to understand why.

            Train arrives at track A. There’s three valid paths from tracks A, B and C available at the next block.
            Track A has a train, track B and C are empty.
            Train decides to take track A.

            Thats what Im trying to resolve.

  7. First, thank you for this fantastic game. I don’t currently have a problem with it, but I am having rendering issues with this page. I can’t see the left margin (before the word left, although that probably doesn’t help). Some of the grey area isn’t displaying and to see the right margin I’ve had to zoom out, giving a white area. This is on my mobile, a Samsung A21S running Android 11 – R. I haven’t had this problem on other pages of your blog, so I was wondering whether this might be a style sheet issue.
    Thanks

Leave a comment

Your email address will not be published. Required fields are marked *