I’ve just finished implementing my spherical grid system, based on the work and links I saw at Dungeon League. There were a couple of unique issues I had to work through, however, and I used a slightly different grid system from the one he’s using.
First, some sample images:
These hex grids are based on a Class I aperture 4 triangle hierarchy, starting with an icosahedron. (See the Discrete Global Grids site at Southern Oregon University for more details about grid types. Particularly the paper Geodesic Discrete Global Grid Systems by Sahr, White, and Kitterling.
The important number here is the aperture size. This determines how much bigger the grid is (or smaller the cells are) with each subdivision. The Dungeon League grid is slightly different, using alternating Class I and Class II subdivisions to produce an aperture 3 hierarchy. That means that he has more different “resolutions” available to him—an aperture 3 system could produce a grid of 5.9×105, 1.8×106, 5.3×106, 1.6×107 cells (going up one depth each time). An aperture 4 system could only produce grids in that general range at 6.6×105, 2.6×106, and 1.0×107 cells. (Take a look at the DGG website’s tables of grid characteristics for more details.)
The images above are at depths 0 through 9 from left to right. Each grid has 10·4d + 2 cells, where d is the depth. So the depth 0 grid is has an area of 12 cells. The depth 2 grid has an area of 162 cells. And the last image, at depth 9, has an area of 2,621,442 cells. At this depth, the sphere appears totally white because the image is only 984×984 pixels.
The next question that comes to mind is this: What depth would it take to model a body of approximately the size of the Earth down to a one meter resolution? Assuming the hexagons are regular (they’re not, but we’re just estimating here) with centers spaced 1m apart, each hexagon should have an area of approximately 3.46m2. The Earth’s surface area is approximately 5.10×1014m2—at 3.46m2 per hex, that’s 1.47×1014 cells.
Pretty huge compared to the depth 9 grid. It turns out that in order to get a resolution at this level, you’d need a depth 22 grid. Such a grid has 1.76×1014 cells, which isn’t too far off. 176 trillion cells. Yikes! It’s clear at this point that it would be completely impossible to keep any information at all about the entire grid in memory. But, there are two very important pieces of knowledge we need all the time: which cells are adjacent to any given cell, and where on the surface of the globe is any given cell located. We also need an efficient way to identify each cell, in order to keep track of information that cannot be automatically generated when the player is visiting a locationg. (For example, any changes the player has made to the area.)
Up next: A system for identifying cells and calculating their neighbors.