Create MINECRAFT in Unity - S3 - P4 Making our code multithreaded P2

preview_player
Показать описание
In the Section 3 we will explore how easy it is to make our code for the procedural voxel world tutorial multithreaded when we have separated data creation from the rendering of the chunks.

Section 3 - Multithreading

Learn more from about Unity Game Dev in my video courses at:

Code files for everyone:

Project / code files for patreons:

Project / code files for YT members:

You can support me through Patreon:

Articles:

Join the discord if you have any questions!
Рекомендации по теме
Комментарии
Автор

Fantastic tutorials, really been enjoying it. Something I noticed with this is that once you move to the dictionaries to handle rendering, the ordering on SelectPositionsToCreate and SelectDataPositionsToCreate is pointless since a dictionary is not sorted. This will make the generation not prioritize rendering the chunks closest to the player first

LegndGames_YT
Автор

Hi! Because the ProcessChunkColumn() function only modifies one column of the chunk and doesn't need data from other parts of the chunk it's perfectly safe to parallelize this part of the code. The C# System.Threading.Tasks library has a handy function for parallelizing for loops, the Parallel.For() function. I parallelized the outermost for loop (the x loop) using this and got an 3x speedup. However, parallelizing it further by doing the z loop in parallel as well unfortunately makes it slower due to the overhead of keeping track of the threads.

BaraShiro
Автор

Would GPU instancing further improve the performance in this case? Having single draw calls would require the meshes to be the same, but they are not ofcourse.

Properpeanut
Автор

Something that I thought would seem really interesting is having infinite height ^^

quartzi
Автор

For some reason chunks are missing so there are just holes in the terrain

DrDandD
Автор

can you make a basebuilding game tutorial like rimworld

rahuldasrd
join shbcf.ru