Traluno▶ Back to the layout

The Loading Gauge, or: Why the Crane Ate the Train

Every real railway has a profile that nothing may intrude on. Traluno needed one too, and discovering that took a harbour crane demolishing a goods train at walking pace.

The harbour crane was finished on a Tuesday. It straddles the quay track so wagons can be loaded underneath it, with A-frames on each side and a bracing beam across the top to stop the frames splaying.

The bracing beam was at a sensible height. Sensible, in the sense that it looked right relative to the crane.

The first goods train through it drove clean into the beam and kept going, wagons passing through solid steel, and the fact that nothing collided was somehow worse than a crash would have been.

What a loading gauge is

Real railways have a defined cross-section — a profile in the air above the rails — that no fixed structure may intrude into, and that no vehicle may exceed. Bridges, tunnels, platform canopies, signal gantries and station roofs are all built outside it. It is why a container wagon that runs fine in America will not fit through an English tunnel.

The number is not a matter of taste. It is derived from the tallest and widest thing that is allowed to run.

Traluno needed the same discipline for the same reason, and had been getting away without one only because nothing had spanned the track before.

Finding the number

The tallest vehicle is the electric locomotive with its pantograph raised. That sets the ceiling, and everything else — the double-deck coach, the container wagon, the tank wagon — sits comfortably below it.

The awkward part is not measuring the loco. It is that the number a model needs is not "how tall is the train" but "how far below my own origin may I hang", and those are different questions with different answers depending on where the model's origin sits.

Track pieces put the rail head at a fixed height above the ground plane. An object placed on the layout has its own local frame with its origin on the ground. So the rail head, expressed in a placed object's frame, is a fixed offset up from that object's zero — and the clearance a spanning structure needs is that offset plus the height of the tallest vehicle.

Written down once, it becomes a single number that everything spanning track is checked against: nothing may hang below roughly 7.6 units in its own local frame where it crosses a rail. The crane's bracing was at about 5.

What it changed

Four models moved.

The harbour crane got its bracing lifted above the gauge and gained a second, lower cross-member outside the track envelope, so it still reads as braced without fouling anything.

The station canopy was fine over the platform and not fine over the running line, which is exactly the distinction a real canopy makes — the roof stops short of the track or is carried on a portal high enough to clear it.

The mountain was already correct, because it carves its tunnel bore from the track underneath rather than being placed at a fixed height. It reads the rails and cuts around them. That is the pattern the others should arguably follow.

The road bridge needed the most thought, because a bridge over a railway has two clearances to satisfy: the trains underneath and the road vehicles on top. The deck thickness is squeezed between them.

The rule that came out of it

Anything that spans a portal has to clear the loading gauge, and the check belongs in the model definition rather than in the placement code.

That last part is the interesting bit. The instinct is to validate at placement time: refuse to put the crane down if it would foul the track. That sounds safer and is much worse, because it produces a game where you place a perfectly reasonable-looking object and are told no for reasons you cannot see.

Building the clearance into the model instead means every crane is placeable everywhere, and the reason it fits is that it was drawn to fit. The constraint is invisible to the player, which is the correct place for a constraint that exists purely to prevent an absurdity.

The general lesson

The bug was not "the crane is too low". The bug was that there was no number, so every model author — which is to say, every past version of me — picked a height that looked right for that model in isolation.

Any project with a lot of independently authored pieces has this shape of problem waiting in it. The pieces are individually fine and collectively inconsistent, and the inconsistency only shows where two of them meet.

The fix is never to inspect the pieces more carefully. It is to find the number, write it down where the next author will read it, and go back through what exists. Half a day for the crane, twenty minutes for everything after.

  • engine
  • models
  • constraints

◀ All posts