NodeCanvas Forums › General Discussion › Some Feature Suggestions
Hello.
So, after few month of work with NodeCanvas i have a few “nice to have” features, which absence is generating a lot of problems for me, especially when my tree is growing in size (and it just began). I will glad to see any of it in future updates.
* Avoid argument data loss on refactoring.
When some bidden method/property name is changed in C# – behavior tree does not handle the name and showing error message about that. It is ok for me to reassign new methods, but argument loss take to much time to restore it. It will be nice to see previous arguments in error message.
* Search by method/property name.
When tree is growing in size – it is a huge problem to find nodes, which using certain methods.
* Jump to next graph error.
It can be united with search tool if it will search among missed methods also.
* Error icon near the unity object in hierarchy inspector.
When there is a much of active objects in the scene, using the same tree, and any of it have been failed and interrupted – there is a big job, to define which one exactly and find the error reason.
* Nodes render performance.
It is obviously that big number of nodes and connections decrease the speed of it rendering and it is ok. But can you optimize it in some way? You can check node rectangle intersection with active area bounding box before it render, or add some low quality settings.
* Use Time.unscaledDeltaTime instead of Time.deltaTime.
If game is using an active pause, behavior tree does not update, when Time.timeScale is set to 0.
Thank you.
Hello!
Thank you for taking the time to write these suggestions.
Please let me address those in order:
Avoid argument data loss on refactoring.
This is a really good point. I will try retain arguments when re-assigning methods if their name/type match automatically.
Search by method/property name.
Jump to next graph error.
There are already a few more utilities coming in the new version (eg a specialized graph debug console that clicking errors, automatically focuses relevant nodes in graphs). Search utilities are definitely next in the convenience utilities line 🙂
Error icon near the unity object in hierarchy inspector.
The new Debug console in the upcoming version is going to certainly help in this, since by clicking the errors in that new console, it automatically opens up the relevant graph AND focuses the relevant node. I think it’s really handy and hopefully you will find it so too!
Nodes render performance.
Node rectangle overlap with view rectangle, is already checked. Actually, nodes (as well as connections) that are outside of view, are completely not rendered at all. With that said there have been some improvements in the next version, where I found out that the graphical grid was causing a lot of performance overhead when the graph is zoomed out, and that is now thankfully fixed!
Use Time.unscaledDeltaTime instead of Time.deltaTime.
Hmm. Just to confirm. Are you referring to the Time.timeScale usage in the BehaviourTree.OnGraphUpdate method?
Once again, I will take a look at your first suggestions once after the new version is out!
If you have any more, by all means they are very welcome.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Hmm. Just to confirm. Are you referring to the Time.timeScale usage in the BehaviourTree.OnGraphUpdate method?
Nope. It is changed outside by my ingame time controller (with speedup or pause). And when it is paused – editor does not redraw.
That what i changed in GraphEditor.cs to avoid that. Also i removed 2 extra Repaint calls, because did not get the reason for that.
Ah, thanks for clarifying. That part of the Editor is fixed already for the next version 🙂
What Repaint calls did you remove by the way?
Thank you.
Join us on Discord: https://discord.gg/97q2Rjh
What Repaint calls did you remove by the way?
They are already commented in both functions in attachment.
I dont know, it may be not necessary if Repaint DLL function just raising the flag before actual repaint, so i commented it just to be sure, that there is no 3 redraws instead of 1.
Ah, thank you. I didn’t notice the commented out in the screenshot.
Here is full fix around these:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
void Update(){ var currentTime = Time.realtimeSinceStartup; var deltaTime = currentTime - lastUpdateTime; lastUpdateTime = currentTime; DoSmoothPan(deltaTime); DoSmoothZoom(deltaTime); if (smoothPan != null || smoothZoomFactor != null){ Repaint(); } } void DoSmoothPan(float deltaTime){ if (smoothPan == null){ return; } var targetPan = (Vector2)smoothPan; if ( (targetPan - pan).magnitude < 0.1f ){ smoothPan = null; return; } targetPan = new Vector2(Mathf.FloorToInt(targetPan.x), Mathf.FloorToInt(targetPan.y)); pan = Vector2.SmoothDamp(pan, targetPan, ref _panVelocity, 0.05f, Mathf.Infinity, deltaTime); } void DoSmoothZoom(float deltaTime){ if (smoothZoomFactor == null){ return; } var targetZoom = (float)smoothZoomFactor; if ( Mathf.Abs(targetZoom - zoomFactor) < 0.00001f ){ smoothZoomFactor = null; return; } zoomFactor = Mathf.SmoothDamp(zoomFactor, targetZoom, ref _zoomVelocity, 0.05f, Mathf.Infinity, deltaTime); if (zoomFactor > 0.99999f){ zoomFactor = 1; } } |
Just make sure to also add a member field “float lastUpdateTime;”
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Wow, preview window in 2.7.0 is awesome, great job.
Thanks a lot! I am glad you like it 🙂
Join us on Discord: https://discord.gg/97q2Rjh