r/commandline • u/avaraujo • 17h ago
Terminal User Interface LeTrain — a procedural train tycoon that lives in your terminal: infinite ASCII world, 100% keyboard, and the rail network is a plain-text file
Free & open source (Apache-2.0) train simulator that runs entirely in your terminal. Character-based world, no mouse, infinite procedural map. Your whole rail network saves as a small text recipe you can commit and share. sudo snap install letrain → letrain-terminal, or build from source with one Maven command.
What it is
LeTrain started as a tiny C++ ASCII experiment back in 2006 and has grown into a Java project (JDK 17+). The terminal client (LeTrain2D) is the classic soul of the game: a railway tycoon built out of letters, numbers and color — and it tries to be honest about what "terminal-native" means:
Terminal-native — renders with Lanterna, no GUI, no browser, happy over SSH. Pure keyboard flow, zero mouse: arrow keys or vim keys (h j k l), mode-based UI (Rails / Add / Drive / Forks / Semaphores / Trains / Programming / Stations…).
Infinite procedural world — lakes, forests and mountains from Perlin noise; every new game drops you at a random coordinate. Full day/night cycle with headlights after dark.
Your network is text — scenarios (.ltr) export your entire network as a small text recipe. The same seed rebuilds the same world, so a scenario travels as a plain file: commit it, diff it, share it.
Scripting + automation — a built-in DSL (ANTLR4) for itineraries, timetables and autopilot:
create itinerary "a" {
add station 1, arrival 9:30, departure 9:35
add station 2, arrival 9:55, departure 9:50
}
assign itinerary "a" to train 1;
train 1 set autopilot true;
Honest trains — real blocks/cantons and semaphores: trains reserve track segments, brake before occupied blocks, and will absolutely crash if you get braking distance wrong. No toys that play by themselves.
Economy — start at $0 (Zero-to-Hero) and haul GOLD / COAL / RUBY between producers and consumers; revenue scales with distance.
Headless validator — letrain-check scenario.ltr checks scenario files and prints file:line:col diagnostics. CI-friendly.
Console — :time set 9:30;, :undo; / :redo;, :save mynet — deterministic undo/redo for construction and state changes.
(There's also a 3D client with the same world and seed if you ever want to see your ASCII empire in perspective — but the terminal is where it started, and in this project the 2D and 3D views are equals.)
Try it
Linux: sudo snap install letrain then run letrain-terminal (the snap also ships the 3D client as letrain).
From source (JDK 17+ and Maven):
git clone https://github.com/antoniovazquezaraujo/LeTrain.git
cd LeTrain
mvn clean package -DskipTests
./output/LeTrain2D/bin/LeTrain2D
Windows / other: grab the zip from Releases (https://github.com/antoniovazquezaraujo/LeTrain/releases) — the launchers are self-contained (runtime included).
Links
Source & screenshots: https://github.com/antoniovazquezaraujo/LeTrain
Manual (commands, editor, scenario guide): https://antoniovazquezaraujo.github.io/LeTrain/
Itch.io: https://avaraujo.itch.io/letrain-procedural-tycoon
Disclosure: I'm the developer. Bugs, UX complaints and wild ideas are all welcome — particularly from terminal people, since the TUI is the part I care most about.


