Tag Info

New answers tagged

2

If your chunks are square, you could align Tiles into a single array, and use a little math to find you indices. For example: class Chunk { final int SIZE = 8; int[] tiles = new int[SIZE * SIZE]; int getTile(int col, int row) { return tiles[row * SIZE + col; } } The same this could be applied to Map. I'm not sure how much more efficient this ...


0

Another similar and useful data structure is the kd-tree. It divides the k dimensional space by spiting it recursively much like an R-tree. Some differences are described here: http://stackoverflow.com/questions/4326332/could-anyone-tell-me-whats-the-difference-between-kd-tree-and-r-tree An important difference is that some say kd-trees are hard to ...


2

You might want to give R-trees a try. They are similar to quad-trees in that they subdivide the plane recursively; however, unlike quad-trees, they do not necessarily split up each sub-plane into equally sized, non-overlapping quarters. Instead, sub-partitions are flexible in position and size. From wikipedia: The key idea of the data structure is to ...



Top 50 recent answers are included