josephwegner / makehex

GNU General Public License v3.0
3 stars 0 forks source link

Change grid data model to use a hash #16

Closed josephwegner closed 5 years ago

josephwegner commented 5 years ago

Right now we use a single-dimensional array to store all of the grid elements, and simply rely on the index of the item to determine where on the map that element exists. This is a simple structure, and works reasonably well, but it introduces quite a bit of complexity:

There are a number of options for better grid systems. I would suggest we implement some sort of coordinate based hash (x,y or x,y,z) and use that as a key in a JSON object.

josephwegner commented 5 years ago

As a note, some preliminary work has started here. I am using cube coordinates to calculate neighbors for fills: https://github.com/josephwegner/hexamagon/commit/91fd7f6ad31b9b9b311f346b38368825105e0774#diff-c21d4984f1216f95c91cdeb77d0880e4R147