-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I'm just about to write my own generic infinite map structure so i took a look at yours to see how you did it. I've only taken quick looks really so far so apologies if I've got this wrong but it seems like every time you want to get the data associated with an co-ord you are doing a dictionary look up on the co-ords to find what chunk it's in. Are you concerned about the performance of this when interrogating a lot of cells often, such as in pathfinding or FOV ?
I was considering having each chunk have a chunk reference for the 8 chunks surrounding it (2d version of infinimap only). If you wanted to check a line of cells going east for example you would check to see if you had gone off the edge of a chunk yet and if you had you would check the chunk's "east" chunkref; if it's nul you still have to look it up in the dictionary but then you write the answer in there so you only have to do it once. I was thinking entities (e.g. mobs) would have a chunk reference field so when you wanted to move them or check stuff associated with them you would be on the right chunk to start with.
Am I being too paranoid about the dictionary look up speed?