#1516
Map ahead: the world keeps up at 300 km/h (draft, for discussion)
I like driving flat out on the Autobahn, and on a first visit the world could not keep up: the car stood at the block edge, and roads and trees popped in right next to it. So over the last two weeks I profiled drive after drive and fixed whatever was slowest. This draft is the whole pile, so you can see where it is going. It is not meant to be merged as one piece.
What's in it:
- Map data, road plans and trees for the way ahead are built in processes of their own, along the road the car is on instead of a straight line
- Terrain blocks are prefetched along that road (8 blocks, about 40 s ahead), the mod takes a block that is already built, and the blocks past an origin rebase are built before the rebase commits
- Work the car needs soon runs before work for later (Windows priorities; whatever the car reaches within 10 s goes first)
- Road tiles never sit in optional waits (roof photos, town signs) while the car is close
- A lot of plain CPU cuts found by profiling: map layers read once per block of cells, German road widths, water rasters, railways, tree cells, far buildings
- A dev panel that shows the work ahead as a map
Result on my PC (i7-9700K, 3 server cores, 2 m ground, cold Autobahn drives at 300+ km/h): the wait for the next block went from 7.8 s to 0.07 s (90th percentile), and blocks that are ready before the car asks went from 25 % to 89 %.
Still open before any of this is mergeable:
- It is merged with dev as of b0be90fd (2026-11-20), but I have only driven the merged state in a test harness so far, not in the game
- It still has test switches that have to go (BNGE_SQUARE, BNGE_VEG_PROCESSES)
- The last step (priority for work within 10 s) is not driven yet. On the drive before it, 21 % of the road tiles still arrived behind the car
- Happy to split it into small PRs like #767, #768 and #793. Tell me which parts you want first
Activity
49This pull request is a draft
Merging is unavailable until it is marked ready for review.