What a relatable and discouraging result. I feel your pain.
@AdaLollA Жыл бұрын
you just saved me days of coding! thank you so much. i would have gone through the exact same steps as you did, but now i know which work and which don't. you're the man
@Zuriki093 жыл бұрын
Hi, looking at the code snippets in the video, you have a few major issues: 1. Dictionaries are not ideal for this, they are relatively slow in comparison to other options, you should use PoolIntArray as this is the same as internal data of tilemap (see godot source code for format info) 2. Using set_cell in a loop will kill you on function call overhead, you want to set your tile data in bulk, thankfully you can use set("tile_data",...) method for this Arrays are thread safe so long as they don't change size, so try and collate as many threads into one payload and call the setter as late as possible/as few times as possible. Because the logic of setting each tile is now called within the engine instead of the script interpreter you get very little overhead. I think this should resolve your performance issues.
@Perfoon3 жыл бұрын
Thank you for this great feedback! 1. Replacing dictionaries with arrays is a valid point. It was just easier to implement it with dictionaries at first and currently, they are mostly used inside the threads. But if I ever get some results that would improve the performance, I will definitely replace them with arrays. 2. set_cell is indeed what is killing the performance right now. There is some discussion in Godot Github about adding a solution for setting cells via an array, and some people have tried to implement something similar. But it seems that this thread has got a bit stuck recently, so I won't put my hopes too high: github.com/godotengine/godot/issues/31020 I learned about the undocumented feature of setting the tilemap data by using set("tile_data",...) yesterday. Unfortunately, I think it won't help me in this case. Because what it does is that it clears the entire tilemap and adds all the tiles from the array (by calling set_cell internally). But I need to add the tiles iteratively and this means that I would have to rewrite all the tiles every time a thread finishes, which is definitely way slower. github.com/godotengine/godot/blob/3.2/scene/2d/tile_map.cpp#L1204 Thank you very much for your suggestions. All the help is appreciated!
@Zuriki093 жыл бұрын
@@Perfoon it's possible to write a C++ module to extend the class and strip the call to clear() - a little burdensome but probably worth the headache for you I think. Might even be possible just using a Gdnative plugin, but that will preclude compiling to Web if it matters to you.
@Perfoon3 жыл бұрын
@@Zuriki09yep, I also considered forking the Godot source and implementing the set_cell by the array myself. But I'm afraid all those options require a considerable amount of effort, which I could also use to improve the game itself :)
@Zuriki093 жыл бұрын
@Perfoon yes, I totally understand. At the very least I would give a try to: 1. Swap Dictionary for PoolIntArray 2. Queue changes from threads and submit them in bulk once per update Just be aware that threads may finish at any time during process so you will want to make a copy of the queued changes array for processing on the main thread.
@JakubSK10 ай бұрын
Pre-generate everything in the level upfront and isolate only what's visible in the viewport. Works for multiplayer.
@roboreck3 жыл бұрын
Really fun devlog! It’s great to see more technical stuff especially in Godot
@huguinhuok3 жыл бұрын
The game looks amazing, man! Keep it up!
@Sedokun5 ай бұрын
Thank you for sharing.
@fille.imgnry2 жыл бұрын
Thanks for sharing!
@junimeme56263 жыл бұрын
The game looks great!
@aimarsoots53753 жыл бұрын
Keep it up!
@Tudvari3 жыл бұрын
The steam link in the description is broken :\
@Perfoon3 жыл бұрын
Yep, I copied it without the tail. Thank you for letting me know!