ManevilleF / hexx

Hexagonal tools lib in rust
Apache License 2.0
276 stars 22 forks source link

2D Vec storage for hex maps #163

Closed ManevilleF closed 3 months ago

ManevilleF commented 3 months ago

Work done

Added a storage optimized HexagonalMap utilizing some tricks to be able to store hex maps in a 2d vector instead on having to rely on hashmaps.

See https://www.redblobgames.com/grids/hexagons/#map-storage

Usage

This implementation only supports:

storage.

This can be useful for large hexagon shaped maps, as well as for chunk based maps, chunking would usually be of hexagonal shape.

TODO

ManevilleF commented 3 months ago

The benchmarks are mind blowing, On a 300 range (271k hexagons) the result goes from 11.145 ms to 775.89 µs it's more than 10x faster