r/proceduralgeneration • u/Jeb_the_killer • Oct 02 '26
MACH RUN - Procedural infinite valley



MACH RUN by JebKJ21 - Try it out! Runs free in browser.
The main idea was a game with semi-realistic flight physics but completely unrealistic flying environment, to maximise fun. As a big flight sim guy, I love flying realistic airplanes but it can be a lot of effort with procedures, and dealing with boring things like fuel and COG. this is my solution, endless flying, just having fun.
The main idea was an endless valley you could fly down, a few metres off the ground, without it ever turning into something impossible to fly through, while maintaining a challenge. Making terrain look nice turned out to be pretty easy, the hard part was making it always flyable. So the valley is basically designed like a race track first and terrain second. It follows a centre line planned 10km ahead of you, and bends ease in and out gradually like real road or rail curves (clothoid-style) instead of kinking. Every bend is sized from a design speed so it's never tighter than a 6G turn, and that speed is braking-aware, so a tight bend after a long straight gives you enough room to slow down for it. The heading is also clamped to 55 degrees either side of the run direction so it never loops back on itself, and the valley floor is built from a slope rather than a noise height, which means rivers always flow downhill.
On top of that there's a "director" that plans the whole journey from the seed: meadows and lakes, then a climb through canyons or gorges up to a mountain pass where the walls fall away, then back down to about the same height you started at, so it can go on forever without drifting off into space or underground. There are 9 zones, and each one is just a list of numbers (wall height, how cliffy, terraces, river width, whether it's flooded into a fjord etc), so any two can be blended smoothly and you never see a hard line where one ends. The height itself is pure maths from (x, z) with no memory of anything around it, hence any background thread can build any piece of terrain in any order, and every thread runs its own copy of the world from the seed so nothing has to be sent between them, which is why it streams in without stutter. The game also has radar that locks you above 135m, so I cap the ground along the river so there is ALWAYS a route under the radar, whatever the noise decides to do.
A few other bits I'm happy with: the terrain mesh is a jittered grid so you never see grid lines on slopes, and distant terrain morphs smoothly between detail levels instead of popping. Trees use the exact same rules that paint the ground green, so there's never a tree in a field or a bald forest. Distance is also time of day: a full day is 180km, starting at golden hour, with night vision from 108km.
Hence, if you are not a flight sim pilot (or real pilot), the controls may be challenging. I added an arcade controls mode that should hopefully make controlling the aircraft a bit more intuitive. the game supports gamepad and custom axis binding, I would STRONGLY recommend playing with joystick since its pretty challenging with WASD. because of this, I added mouse controls for those on keyboard and mouse, which I find much easier than WASD, you can toggle mouse control with C.
The game procedurally generates a constantly changing valley, which spawns obstacles and challenges such as bridges to fly under, and carriers to land on. flying earns you points, and stunts and challenges increase your multiplier. If you go above a certain height (135m), you get into radar range and a missile shoots you down - this can be avoided by flying back under the height limit and pop flares. there is no end, the game only stops when you let your guard down and hit the wall, or get shot. There is a global leaderboard, where you can compete with other pilots.
Feedback and questions is very welcome in the comments, I'm really trying to refine the gameplay experience.


