News:

Congratulations!
 You've won the News Item Lottery! Your prize? Reading this news item! :)

Routing issue directly behind tunnel portal

Started by Sique, Yesterday at 03:01:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sique

Simutrans 125.01
Pak 64x64 r12234

Maybe, I'll manage to upload screenshots in the future, but right now, I get a file too large error.

Situation:
I have a trainstation and a rail crossover directly in front of a tunnel portal, and within the tunnel, the rail branches immediately after the tunnel.

========\/U----
========/\U----
############`---

Legend:
= train station tile

\/
/\ Interconnection between parallel rails

U tunnel portal

` branching off

# Empty space for formatting

A train that comes in from the East into the northern platform of the train station unloads, changes direction and leaves the train station via the cross over back into the tunnel. The routing seems to be unable to route the train on the branching rail. Instead, the train continues straight after entering the tunnel.

If I put the branch one tile later, the train routing finds the branching off rail.

PS: I found a similar routing issue after a slope. Also there, trains don't necessarily find the branch. What's curious is that some do, and some don't, albeit they are running on different routes. And in both cases, it was a train carrying cars, consisting of a pair of DB Br 218 pulling four Laekks553 (a/b) units. But that last fact might be random.

martin509

Simutrans' train routing doesn't support alternate routes - it calculates the shortest possible route when a train leaves a station. If your branching rail acts as an overflow lane for the system and not e.g. a shortcut, trains won't use it outside of specific uses of choose signals (and even then, choose signals aren't really able to implement a multi-lane railway). This is also probably why some lines use the branch and some don't, because "what is the shortest possible route" depends on the destination.

prissi

Simutrans routing is never random. Also, the first tile of a route, Simutrans cannot determine yet if it is diagonal or not, since this requires at least two tiles. Instead, simutrans always assumed a V turn, so that tile was heavily discouraged. Should be fixed in r12364.

Might induce different routing now after choose signals.

martin509

Quote from: prissi on Today at 01:28:36 PMMight induce different routing now after choose signals.

Extended does have useful functionality (unless I'm reading wrong and Standard also has this?) where choose signals will route to an end-of-choose sign along the main route like it's a station platform. For instance, you can implement this kind of passing lane setup:
--<--E\       /---->--+\
-->--CX---X+------+X----XC--<--
                  \+---<---/       \E-->--
(E: end of choose, C: choose, +: signal, X: intersections, <->: one-way sign)

The trains default to the middle and take the alternate one if the middle is occupied, saving on having to make a turn. It's probably more expensive than it's really worth but is very satisfying to watch. The functionality is also very useful for pass-through stations since e.g. if you have four passenger platforms and a cargo train is passing through, it can route straight through e.g. platform 4 instead of waiting for platform 1 to be clear.

That said, there are issues, namely that choose signals (at least in Extended) will never pick an alternate route unless they can reserve the entire route, which makes the idea of having a choose signal fill out multiple lanes of traffic impossible. If choose signals allowed trains to take a route as long as the first block signal encountered was free, you could do some fun things with them.

Sique

Quote from: martin509 on Today at 12:47:24 PMSimutrans' train routing doesn't support alternate routes - it calculates the shortest possible route when a train leaves a station. If your branching rail acts as an overflow lane for the system and not e.g. a shortcut, trains won't use it outside of specific uses of choose signals (and even then, choose signals aren't really able to implement a multi-lane railway). This is also probably why some lines use the branch and some don't, because "what is the shortest possible route" depends on the destination.

While that might be true in theory, in my savegame, the routing does not work as expected. The train chooses a longer route, if the branch is immediately after the entry of the tunnel, but if the branch goes off a tile later, it chooses the shorter route. The route length of the shorter route should be the same independent on where the branch happens, because both rails go in parallel for several tiles and cross over via a bridge later, which might confuse the algorithm.

In both cases, the actual network looks like this:
                               ,---
-->--Ux----------------
            `-----------´
This routing causes the train to go straight first and make an U-turn later to join the branch somewhere else in the network.

resp.
                                 ,---
-->--U-x---------------
              `-----------´
This routing causes the train to go off immediately.
The difference is the single tile between the U (portal) and the x (switch).

In my second case, the layout is similar, but instead of a tunnel portal, it's a slope, and the branch immediately after the slope.