I previously used 16x16 due to it each tile being conveniently addressable by a u8.
But 32x32 (or even bigger) might be useful to significantly reduce the number of chunks and the heap fragmentation.
The current 60UPS gigabase uses ~12_000_000 chunks.
At 32x32 that would be reduced to ~3_000_000. Saving at least ~300MB.
Downside is we could no longer have a O(1) ish lookup for entities as easily. Though that might be a foolish idea anyway due to the RAM usage.
It might also no longer be useful, since world lookups are only used for
- Rendering (where we just iterate over all entities in a chunk)
- Adding/removing entities (has_space, get_inserter_connection, etc) but importantly no longer for updating when merging power grids etc
- Generating the map view, which might be the most significant user, but that could be reduces by caching the index of the entity in the top left corner or by sorting the entity list by position in the chunk (which might be smart anyway).
Bigger chunks might also have advantages for systems like Radar, pollution (which I dont thing will add), and the way Factorio handles finding Roboports.
Previous work:
- I previously used 16x16. But my entities were also muuch bigger than the new ones so the increased overhead from smaller chunks was less noticable
- Factorio uses 32x32
I previously used 16x16 due to it each tile being conveniently addressable by a u8.
But 32x32 (or even bigger) might be useful to significantly reduce the number of chunks and the heap fragmentation.
The current 60UPS gigabase uses ~12_000_000 chunks.
At 32x32 that would be reduced to ~3_000_000. Saving at least ~300MB.
Downside is we could no longer have a O(1) ish lookup for entities as easily. Though that might be a foolish idea anyway due to the RAM usage.
It might also no longer be useful, since world lookups are only used for
Bigger chunks might also have advantages for systems like Radar, pollution (which I dont thing will add), and the way Factorio handles finding Roboports.
Previous work: