thesadrogue / TheSadRogue.Primitives

A collection of primitive data structures for working with a 2-dimensional grid.
MIT License
21 stars 6 forks source link

Add Hex Grid Support #83

Open Chris3606 opened 2 years ago

Chris3606 commented 2 years ago

Currently, the grid library supports only 4/8 way adjacencies. It should be possible to support hexagonal grids; the coordinates are mostly the same (although they are rendered differently). However, the adjacency is different (6 neighbors). This should be fairly easy to add, even without breaking changes.

There are two main ways to display hexagonal grids that I am aware of; see the first set of images here. In both of these cases, the adjacency (based on the coordinates themselves) would seem to be the same 6 directions. It may be possible to support some of the other common methods as well.

We would also have to add support for some different distance calculations, potentially.