dungeon-revealer
dungeon-revealer copied to clipboard
improve performance of map updates
currently, we are sending the whole fog of war image as a png. The HTTP request payload could become pretty big for larger files. It makes sense to try out strategies for reducing the body size that must be uploaded from the dm and sent to the players.
One idea I have floating around in my head is sending draw instructions along side a version directly to the backend and the players. Of course we cannot store every single draw operation, as we would have to apply all of those in order to get the current fog state when loading the image for the first time. In order to make The initial load faster we could run a server-side canvas implementation (node-cairo) that also processes the draw instructions sent by the DM. Then when a map is first requested we can sent the image state from the server-side canvas. In case the client and Server-side state become out of sync the client can also request the computed state (canvas image) for being back in sync.