mapshot
mapshot copied to clipboard
Dynamic render resolution
As of writing, the whole map is rendered at the same resolution levels. However:
- Given that the area chosen is square, lots of space is not interesting, esp. those not containing any player structure.
- Highly detailed area are costly to render and store, even if there is nothing interesting.
It would be interesting to explore having a more dynamic rendering - with limited resolution where there is nothing of interest and better resolution on player structure for example.
It might not be completely straightforward:
- Detecting whether there is something of interest or not is doable, maybe even with some configurability. It might be expensive to query many parts of the map, but I suspect that Factorio is quite efficient here.
- We would need to store which zone is rendered at which level of details. In JSON, it might end up being some amount of data, though we can probably manage something decent there.
- That would probably require to convince Leaflet to use a mix of tiles for rendering (based on that information). Leaflet is relatively simple, that might make be tricky.
[Original suggestion from Soul-Burn on the mod page]
Regarding Leaflet, there is at least some prior art: https://github.com/ghybs/Leaflet.TileLayer.Fallback. It relies on trying a different resolutions when a tile is not available. It does introduce some extra round trips, but has the advantage of simplicity as it would not require recording what exists and what does not exists, making the whole thing reasonably simple.
https://github.com/Palats/mapshot/commit/9bd101562fe3b61d1c9a6d9f41ba9804a3c83a99 added a way to decrease the quality of tiles with no user entities.