comp500 / tinymap

A lightweight server-side stateless web map
MIT License
28 stars 6 forks source link

Threadsafe world access #16

Open comp500 opened 3 years ago

comp500 commented 3 years ago

I don't think the current behaviour (accessing the loaded world from Netty threads) is inherently dangerous - but it may cause corrupt or out-of-date chunks to be rendered on the map. The solution will likely be to use ChunkSection copying, similar to the process Minecraft's rendering threads use to build chunk data separately from the world thread. Unlike methods that Sodium and Canvas use, it is unlikely to be beneficial here to first copy the packed block representation into a format that can be more efficiently accessed, as TinyMap reads significantly fewer blocks in a chunk.