Hello, I am using a gridmap to create Minecraft-like 250x250 terrain. I am using FastNoiseLite to place the blocks at a random height. It is working but needs a while to generate, so I ran the function in a separate thread. Because I am now not doing anything in the main-thread, will running my function in a separate thread increase performance in any way ? Also passing parameters to the function doesn't seem to work. I did

thread.start(generate.bind([250,20,250]))

Also, is there any better way to generate random terrain than using gridmap ? I like this way because the code is short and comprehensible unlike SurfaceTool.
Note I am using Godot 4 rc2

    Bilal '''
    thread.start(generate.bind([250,20,250]))
    '''

    For future reference it's the accent on tilde key ` not the single quote ' that is used for code formatting. I'll edit and fix your post for you though.


    It's been a few years since I've done anything with threading, but I guess while it can benefit performance it likely depends on how exactly you are doing it. At some point the results of your work done in the thread needs to be synced back into the main thread somehow and depending on how you are doing it there is a chance that the main thread might end up waiting for the result from the thread in which case it probably isn't benefiting performance much if at all.

      Bilal Admins can. For transparency, if you hover mouse over the Edited label next to posts timestamp field you can see the username of the most recent edits author.