Take this example image:
All of the T-junctions are, internally, the same, trains can use each of them in the normal way, they just look different. This extension request has 2 parts, the first is about how the tracks actually look, the second about the way they behave.
1) How they look...
My idea is based on the way town growth works, with 3x3 grid templates which are checked against the town to determine where a house should be placed next, if the 8 tiles around the center tile match the pattern of the rule, then a house is built on that square, essentially. I am thinking, this could be applied to railway track also, have 3x3 grid rules to determine the placement of each type of switch.
In this image you can see the idea explained in detail, the grids would use the "ribi" or direction of each tile, both masked and unmasked. in this way you can make a rule for each possible permutation - each one linked to a particular switch type (which is built if the tiles around the tile in question match the pattern). By considering both masked and unmasked direction signalling can be taken into account, allowing the switches not only to reflect "realistic" train movement (see point 2) but also the ways trains could possibly move on account of signals.
[1] shows how a simple length of track looks (ribi 5 means North and South), [2] shows a spur, which would be produced by this pattern of ribis on tiles, if the track veered off, rather than going in the same direction as the origin track, a different switch could be used. [3] shows the same rule but with two spurs. [4] shows how the masked ribi affect the same physical track layout, producing differently drawn layouts. The first is for crossing over two parrallel tracks, the second a simple crossover, the third a somewhat unlikely layout. [5] Shows how patterns would "overlap" to produce more complex layouts over many tiles.
2) How the tracks work...
Consider [2] in the image above, trains coming from the north on one track would not, physically, be able to go around such a sharp bend and return along the parrallel north-bound track. Only trains from the south could go north on either spur, or vice-versa. This is why the graphic displays as it does - a reflection of physical restriction. However, in the game this would still allow trains to do the physically unlikely... I'd like to suggest stopping this sort of behaviour, by imposing ribi masking as a consequence of the above method. Trains coming from the north would see the switch as being "south-only", trains coming from the south would see the switch as having both exit options.
Quite a complex idea










