You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Realtime space x4 with potentially dozens of thousand nodes.
Describe the problem or limitation you are having in your project
Initial loading of the space scene takes exponential time, based on how much nodes are added to the tree.
2x nodes means about 4x the initial loading time.
Adding a new fleet or fleets to the tree also takes longer if more nodes are in the tree.
I think the core of the problem is that with .add_child(newNode) newNode is checked against every node currently in tree.
I haven't looked up the source code, but that would explain the exponential loading time growth.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
solutions:
1:
add a bool to the node class, which indicates if the node is in tree and can be checked instead of checking every node in the whole tree.
This would eliminate the exponential growth in loading time.
2:
Only check if newNode is in tree in debug, but not in release build.
3:
add a boolean to the add_child() function to set if the node should be checked against in-tree nodes.
eg: add_child(newNode, false, false)
If this enhancement will not be used often, can it be worked around with a few lines of script?
I have not found a workaround at all.
Is there a reason why this should be core and not an add-on in the asset library?
Strategy games regularly use a high number of nodes in the tree, so i think it would be beneficial to the engine and its users.
edit:
adding new ships/fleets actually takes linearly longer depending on the number of nodes in the tree, but for adding single nodes it shouldn't matter how many nodes are in the tree, so it's still an issue.
edit2: queue_free(), call_deferred("free") and probably get_tree().change_scene() ,get_tree().change_scene_to() effected as well.
Removed "#" in solutions.
The text was updated successfully, but these errors were encountered:
Calinou
changed the title
faster "is node in tree" check or bypass
Speed up the "is node in tree" check when loading a scene or bypass it in release builds
Feb 27, 2021
I would be ok if this is it were somehow limited only to loading. I'm pretty sure that runtime checking is needed, since you don't want duplicate node names.
Describe the project you are working on
Realtime space x4 with potentially dozens of thousand nodes.
Describe the problem or limitation you are having in your project
Initial loading of the space scene takes exponential time, based on how much nodes are added to the tree.
2x nodes means about 4x the initial loading time.
Adding a new fleet or fleets to the tree also takes longer if more nodes are in the tree.
I think the core of the problem is that with .add_child(newNode) newNode is checked against every node currently in tree.
I haven't looked up the source code, but that would explain the exponential loading time growth.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
solutions:
1:
add a bool to the node class, which indicates if the node is in tree and can be checked instead of checking every node in the whole tree.
This would eliminate the exponential growth in loading time.
2:
Only check if newNode is in tree in debug, but not in release build.
3:
add a boolean to the add_child() function to set if the node should be checked against in-tree nodes.
eg:
add_child(newNode, false, false)
If this enhancement will not be used often, can it be worked around with a few lines of script?
I have not found a workaround at all.
Is there a reason why this should be core and not an add-on in the asset library?
Strategy games regularly use a high number of nodes in the tree, so i think it would be beneficial to the engine and its users.
edit:
adding new ships/fleets actually takes linearly longer depending on the number of nodes in the tree, but for adding single nodes it shouldn't matter how many nodes are in the tree, so it's still an issue.
edit2:
queue_free()
,call_deferred("free")
and probablyget_tree().change_scene()
,get_tree().change_scene_to()
effected as well.Removed "#" in solutions.
The text was updated successfully, but these errors were encountered: