-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the "Terrain" option for TilemapTileInfo causes horrible lag. #169
Comments
ObservationsAfter further investigation, the issue isn't as simple to address as I thought it would be:
What's this mean for us?A consequence of these two observations is that it seems like no amount of thread_safe calls made in the TilemapGaeaRenderer seem to make much difference in our lag problem-- perhaps because one expensive call is just immediately followed by another expensive call, which all lead to a big huge physics update of some sort. Possible SolutionsWe have some options for addressing these limitations:
|
Maybe someone could help make a C# version for a larger scale, but usually making small chunks and only when you need them helps with GDScript performance-based generation, which probably would be better done at runtime rather than in the editor to generate things on the fly as the player is exploring. C# can be way faster for this type of procgen, either way, though it means your addon users would have to use the mono build of Godot. Unless you do a GDExtention in C++ then you have way more flexibility with performance and it should work with any build. When you say thread safety doesn't seem to help, that says to me that it's doing it's job and preventing parallel processes from accessing the data that you may want to be doing in parallel for speed, maybe. Typically, I would toss the thread safety for the first pass for full-speed parallel calculations of chunks and then do my seam fixing and other clean-up in a second pass. Take this with a grain of salt as I have not familiarized myself with your code and am likely missing something. |
To clarify, the thread_safe calls I mentioned are being used to call non-thread-safe code in parts of the code that can optionally be run from a thread so as to not block the main thread (see How to optimize your generators). The functions called this way are almost exclusively built-in Godot engine methods for setting tiles and such (implemented in C++). That being said...
I think you might be on to something here. I'm playing around with just forgoing the thread_safe call entirely (seeing as the bulk of the auto-tiling work is independently exclusive even when multiple chunks are loaded in parallel), and I'm seeing some promising results!
I get where you're coming from, but at the end of the day, this issue seems to be more of an implementation bottle-neck than a language bottle-neck. |
This issue is likely due to the
_set_terrain
function inside oftile_map_gaea_renderer.gd
.Our
set_cells_terrain_connect
calls are updating the connections over an entire chunk's worth of tiles all at once. This likely has performance implications and should be spread out over time (for example, connecting only 3x3 groups of neighbors, then repeating in separatethread_safe
calls over the entire chunk).I plan to make a PR for this issue soon, just wanted to document my findings in the meantime.
The text was updated successfully, but these errors were encountered: