Skip to content

Chunk reference caching #16

@graspee

Description

@graspee

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions