Today I want to share a technical update rather than a visual one but it’s a huge boost for performance. My game uses procedural city tiles. Generating a full city tile costs around 1 millisecond. When the player is flying fast over the world, dozens of tiles may need to be created quickly, and that can become a bottleneck even when each tile is loaded in a background thread (actually as a tile load task serviced by a fixed sized pool of threads). So I implemented a tile caching system and the speedups are dramatic.
Here’s how long each operation now takes:
Full city generation: 1.08 ms
Generate + save to cache (first time): 4.09 ms
Load from cache (disk hit): 6.79 µs
Load tile already in memory: 6.8 ns
That means loading from cache is roughly 159x faster than generating a tile from scratch. That’s a huge performance win for streaming an open world.
The core idea is simple:
Generate the tile once.
Serialize the result to disk.
Next time, load it instead of regenerating it.
Some technical details:
I compute a BLAKE3 hash of the map file to detect changes. If the map changes, the cache automatically invalidates.
Each tile uses a filename based on its coordinates, e.g. 5_7.bin.
Tile requests return a std::shared_future, so only the first thread generates the tile others wait for the same result.
The system is fully thread-safe and works perfectly with my streaming worker threads.
The game ships on Steam for Windows and Linux, including AppImage builds. AppImages are mounted as read-only, so the cache must go into the player’s writable directories, not beside the game files. Here’s where tile cache files are stored:
Windows: %LOCALAPPDATA%/Infinicity/TileCache
Linux / Steam Deck: $XDG_CACHE_HOME/Infinicity/TileCache or ~/.cache/Infinicity/TileCache
This keeps everything clean, safe, and consistent with OS conventions.
Caching procedural data is a massive win for performance.
Hashing the map file is a clean solution to cache invalidation.
Don't write to the game's install directory especially with AppImages.
std::shared_future is perfect for eliminating redundant work across threads.
strace is an excellent debugging tool when you want to see where your game is trying to write files.
Tile caching has completely transformed streaming performance in the world and it’s exciting to see how much smoother everything feels now. More updates soon!