Skip to content

4 Run your virtual layout

Johannes Ringler edited this page Apr 26, 2023 · 6 revisions

This page describes how to run trains in your virtual layout. Running the layout with connected LEGO devices will be described in a later section.

Routes

A route in brickrail tells a Train how to get from its current block to its target. The current block as well as the target are actually logical blocks, since it matters in which direction the train leaves its starting block and from which direction it arrives at it's target.

Generally, to go from the start to the target, a train can or must go through other blocks first. Thus, we can consider a route a series of route legs, where each leg only connects two logical blocks directly without going through other blocks.

Internally, when a train has to flip its direction in a block, this is also considered a separate route leg, since flipping the heading connects two different logical blocks.

When other trains also occupy the layout, there might be a case where going to the first intermediate block via the first route leg is possible, but the following route leg going from the intermediate block to the target might be blocked by another train. In this case, the software allows the train to already start executing the first route leg, but the train will not advance to the second leg until the second leg is not blocked anymore.

Setting routes manually

To start running your trains in brickrail, first switch to the "Run trains" layout mode. This will disable editing your layout. Left click still allows you to select individual parts, but you won't be able to change most settings.

To start a train, right click and hold the button on a train, move your mouse over a logical block and release the button. The train will now try to find a route that enters the block from the correct direction, depending on which logical block you released the mouse button on. The full route will be highlighted in brown on the tracks. If the train already is able to start the first route leg, it will highlight this leg in green and start driving.

Track sections marked in green, as seen when a train executes one route leg, lock these tracks to be used only by this train. No other train will be allowed to start a leg that crosses these tracks.

Automatic routes

If you want to automate your trains fully, activate the "random targets" checkbox on the top of the viewport. This will now tell each train to randomly select a target. Once a train reaches its target, it will select a new random target after a short time.

In the future, automatic route scheduling will be expanded by schedules or the ability to enable/disable random targets for specific trains.