dndplayer/dnd-player

Refactor fog polygon storage

Closed this issue · 0 comments

Currently the fog data within a map treats the maskPolygons as an array. Firebase doesn't actually have any concept of arrays in the realtime DB, however it DOES try and detect where people use objects "like" arrays and then convert them in the API responses. The problem with this is that in certain cases it will fail.
One of these cases will likely affect the fog, that being that for it to detect an array it must have contiguous numerical keys, the important bit being contiguous. I believe Firebase can handle some gaps, but with the fog as more polys are deleted there will be more gaps until a point where I suspect bits will just break.

To combat this we need to rework the current bits so we store and expect an object back from the DB. We can still use the transform function to convert it into an array locally, but then we shouldn't be caught off guard when we delete too many fog polygons.