Building Blocks · World · Chapter 1 of 7 · 3 min read

From a file to a road

A GPX file is a list of points. Each one has a latitude and a longitude, most have a height, and some carry a note about the road surface. There are no roads in it, no towns and no trees. Everything you see on a ride is built around that list. This series explains how, starting with the road itself.

A line becomes a road

The points in a file are uneven. A bike computer usually records one every second, so they bunch up on climbs and spread out on descents, and each is off by a few metres. BlockRide first redraws the route as evenly spaced points a few metres apart, then smooths it enough to take out the GPS wobble without flattening the real bends.

At each of those points the game then knows three things: which way the road is heading, how steep it is, and how sharply it is turning. The road you ride is laid along them, with a width that fits its surface: a main road is wider than a dirt track.

Bends you have to brake for

How fast a rider can take a bend is school physics. Tyres can only push sideways so hard before they slide, and a tighter bend needs more sideways push at the same speed:

Top speed in a bend = √(grip × radius of the bend)Grip is the sideways acceleration the tyres can hold. A bend half as wide can be taken about 30% slower.

BlockRide works this speed out for every point on the route, then works backwards from each bend so that braking starts early enough. On a fast descent into a hairpin you see a Sharp bend notice and your rider slows, as you would outside. Everyone on the road follows the same limits. On a wet road the grip is lower, so the limits are too.

Roads ridden twice

An out-and-back ride, or a lap ridden three times, covers the same road more than once. A GPS never agrees with itself: each pass is recorded a few metres to one side and often several metres higher or lower. Built as recorded, that would be three roads side by side at three heights.

So the game looks for stretches that follow the same line, in the same or the opposite direction, at about the same height. It moves the later passes onto the first, so the road is built once. Any difference in height is eased in gently over the road before and after. Where a later pass joins or leaves the shared road you get a paved junction, and a blue arrow sign before the route turns off.

Climbs and sprints

With the gradient known everywhere, the game can find the route's climbs. Each becomes a timed segment for the polka-dot jersey, and flat stretches become short sprints for the green one. A segment has a target time worked out for a rider of your weight. Beat it, or your own best once you have one, and you wear the jersey for the rest of the ride.

Your fastest finished ride on a route is kept as well. Next time it rides beside you as a see-through ghost, so you can see where you gain and where you lose.

What the file alone gives

All of this comes from the file. If none of the lookups in the next chapters can be made, BlockRide still builds a route you can ride: the line, the gradients, the bends, the segments, and a countryside invented to go around them.

The rest of this series is about replacing invention with the real thing: real heights, real towns and water, the feel of the surface, today's weather, and a landscape that looks like the country you are in.

A file needs heights to give real climbs, and many files have poor ones or none. Real heights explains what BlockRide does about that.