I had an interesting idea for game level compression, that compressed my level b...
š Andrew āļø @bnut@aus.social
I had an interesting idea for game level compression, that compressed my level by a 7:1 ratio. I probably won't use it as Iām not so memory constrained, but it was fun to see my idea work.
Summary
You can compress a hand authored level that can be represented by a wave function collapse (WFC) tile set by storing the choices that WFC would make at each step. It's also a lot faster than WFC as you remove the trial-and-error. You still get full creative control over what the level looks like, it's not really procedural, the only constraint is that it must be representable by the WFC patterns. If you're already using WFC, this is very easy to add on top.
Explanation
I believe this compresses well for two main reasons:
- WFC rapidly reduces the choices per tile
- WFC always picks the tile with the fewest choices
This means the bits you need to encode a tile asymptomatically approaches zero as you collapse toward a solution.
Future work
It may be able to be improved with variable-length encoding, and using tile probabilities, I just rounded up to the nearest bit using a uniform distribution.
It may be interesting to encode a pattern rather than a tile (picking the pattern that introduces the most new tiles), as although there's likely many more patterns (more bits), they impact a larger surface area (likely meaning fewer bits per tile).