The 64th Gamer

:computer: Pneumagination Multithreading

Multithreading is now working! This took a bit more work than I was expecting due to the fact that multiple important steps can only be accomplished on the main thread in Godot. To have every chunk go on a new thread and also be an async function that would conclude back on the main thread I had to create a pool of finalized data that the main thread would check every frame.

It runs great but sadly some chunks are missing and sometimes it’ll just crash. I assume this is somehow due to some thread-unsafe things because I’m sharing the finalized data across two lists. Next work is to combine them and give them hashed IDs.

Also experimented with world generation and got a decent result so far as seen above. During the process I got some weird results like this maze like terrain with thin walls.

Next will be assigning all the faces different materials and splitting up each chunk mesh. Before that I’ll look into if there’s any way to make them all one mesh with a custom material. (Like, maybe something like UV map value is converted into a lookup table of textures in the shader? These aren’t tiny Minecraft textures so I can’t shove them all in an atlas or anything, and they’re gonna be tri-planar anyways so they need to be seperate. We’ll see if I find anything.)

Tags: