Skip to content

TpF2 Big Maps 0.4.0

Choose a tag to compare

@silver2127 silver2127 released this 16 Sep 02:44
· 45 commits to main since this release

Large maps now use far less memory and load substantially faster.

This release overwrites existing plugins/tpf2_bigmap.cfg, including user edits, on installation, upgrade and repair. Close the game before installing.

Measured on a 256x256-tile (65.5 x 65.5 km) save on a 94 GiB machine: working set fell from about 18 GB to about 10.5 GB, and load time from 73 s to 45 s.

  • Lossless terrain-cache compression, format 3. Planar prediction, zigzag residuals and a static per-tile rANS coder with four neighbour contexts replace the previous LZ4 nibble planes: 18.06% of raw down to 6.95%. Every decode is verified against a 64-bit content hash.
  • Fixed a silent capacity limit. The pager managed at most 131,072 tile versions; a 256x256 map reached exactly that while both terrain versions existed, and every allocation past it fell back to an uncompressed heap vector. Any map above about 181x181 tiles, and every 320..512-tile preset, was affected. The cap is now 2^20.
  • Material-index paging (material_cache_compress, new, on by default). The renderer keeps one 67,601-byte cell per tile for the whole session: 4.13 GiB on a 256x256 map, now kept compressed at about 20% of raw and restored on access at the same address.
  • Four engine optimizations, all on by default and all bit-exact against the game's own machine code in offline tests: SSE2 bicubic height refinement (terrain_refine_fast, 3.4x), SSE2 tile min/max plus a per-row block copy (terrain_minmax_fast), pooled scratch and an SSE2 blend for terrain alignment (terrain_align_fast, 1.57x-4.67x), and trimming unused capacity from tree and scenery instance lists during world creation (instance_shrink).
  • Cache budgets now scale with installed RAM. terrain_cache_hot_mb=0 and terrain_cache_warm_mb=-1 size the resident targets from physical memory (about 546/1365 MiB on 16 GiB, 3276/8192 MiB on 96 GiB) instead of fixed values tuned for one machine. Explicit values still override. The loading allowance is a fraction of free memory and backs off as memory and the system commit limit fill.
  • Copy-on-write sharing of terrain tiles between the two engine versions (terrain_cow_share) ships disabled: it was built, measured on a real load and found not to help, because the second version allocates its tiles rather than copying them.

The performance and octree options remain experimental. Multiplayer participants should use matching Big Maps settings.

Generating a very large map is still bounded by the terrain generator, which is not affected by the above: peak is about 2.5 MB per km2 per named generator buffer, so a 16 GiB machine should stay at or below 224x224 tiles (192x192 for the desert generator, which uses more buffers).

Shared loader binaries are unchanged from Multiplayer v0.5.0.