Background
Generating a tile is expensive and the same tile gets asked for more than once as the user moves around, so finished grids are kept rather than thrown away.
This is not a second store beside the sum and weight grids. It is the same tiled space at a later stage.
A tile is a fixed block of the world and does not overlap its neighbours. The sum and weight grids are held per tile, and a window crossing a boundary is split between the two tiles it covers.
A tile can only be handed out or dropped once every window covering it has been added. Dropping one part way through either loses it completely, or adds its windows a second time into the neighbour that shared them.
Description
Create a function to put a finished grid in under a tile and one to get it back out, returning nothing if that tile has not been generated yet.
A tile is identified by the global seed together with its coordinate, kept as three separate numbers rather than worked into one. See #59.
Testing:
- Assert a tile that was put in comes back out unchanged
- Assert asking for a tile that was never put in returns nothing
- Assert two different tiles do not overwrite each other
- Assert the same coordinate under two different global seeds does not overwrite either
Background
Generating a tile is expensive and the same tile gets asked for more than once as the user moves around, so finished grids are kept rather than thrown away.
This is not a second store beside the sum and weight grids. It is the same tiled space at a later stage.
A tile is a fixed block of the world and does not overlap its neighbours. The sum and weight grids are held per tile, and a window crossing a boundary is split between the two tiles it covers.
A tile can only be handed out or dropped once every window covering it has been added. Dropping one part way through either loses it completely, or adds its windows a second time into the neighbour that shared them.
Description
Create a function to put a finished grid in under a tile and one to get it back out, returning nothing if that tile has not been generated yet.
A tile is identified by the global seed together with its coordinate, kept as three separate numbers rather than worked into one. See #59.
Testing: