4 ms·
Building on this, the general approach you're describing is a "sparse" data structure. For example, https://en.wikipedia.org/wiki/Sparse_array https://en.wikip
by RodgerTheGreat 10y ago
Building on this, the general approach you're describing is a "sparse" data structure. For example,
https://en.wikipedia.org/wiki/Sparse_array https://en.wikipedia.org/wiki/Sparse_array
A cousin to this approach would be using some type of space partition with the assumption that most of the partitions represent large, uniform (empty or solid-filled) areas:
https://en.wikipedia.org/wiki/Space_partitioning https://en.wikipedia.org/wiki/Space_partitioning
You can see that these are fundamentally related ideas- pay for the complexity of the data you store rather than its volume.
- and0 10y agoRight, I also wanted to mention using a Quadtree but that seems excessive for pixel art (or most applications, for that matter). e: Another consideration would be keeping level-of-detail versions of each chunk of canvas as well, so zooming very far out loads/shows a lower resolution rendering. That would let you make a Google Maps style collaborative pixel art canvas or something.