arx-tools/arx-level-generator

implement caching slices of polygons

Opened this issue · 3 comments

loading a piece of an existing map when only a small portion of it is needed is quite wasteful and would be nice if it could be cached in the cache directory.

image

The question is: how would the code know that this piece of map data's cached value needs to be invalidated? Two parts make up the caching here: the initial data and the instructions. We can assume that the original level data never changes, but how to store the intructions and compare them to a later version to see if they changed?

createHashOfObject() can help here from src/services/cache.ts similarly to how EntitiyModel caches FTL files

Maybe the transformation functions could create a diff similarly to how sequelize makes migrations. Storing information, like "load polygons from level11 and move them by 100/0/0" seems something that is more compact than storing the polygons themselves.