Performance : load a BT and its subtrees

NodeCanvas Forums Support Performance : load a BT and its subtrees

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #14236
    aelkhan
    Participant

    Hello,

    I have several BT Assets containing subBT (as assets). For performance reason, we use a pool where I instantiate my monsters (with their BT).

    Unfortunatly, the subBT are not loaded at the same time as the root tree but only when needed. Looks a good idea on the paper but it does not work this way, the subBT loading is way too expensive to occur in runtime. I am looking for a way to load a BT and all its subBT at the same moment (when I show a progress bar and before returning the prepared monster to the pool). I had a look at OwnerGraph.Initialize and tried to invoke CheckInstance() on all its SubTree nodes at the end of OwnerGraph.Initialize but SubTree.subTree is not the same as when it is really executed (so I load the subtree twice : when I want and… when it is executed :/ )

    Thanks in advance.

    #14252
    Gavalakis
    Keymaster

    Hello and sorry for the late reply due to Eastern!

    Indeed. That is because the “currentInstance” field (in SubTree.cs), is only set in the SubTree.OnExecute method rather than in it’s CheckInstance method. A temporary (and rather dirty fix) for this would be to:

    – Open SubTree.cs and right before the return instance; at the end of the before, also set currentInstance = instance;.
    – Keep your changes in GraphOwner.Initialize thus invoking CheckInstance() as you already do.

    Having said that, I do plan to of course properly implement pre-initialization for the next version, that will be done with an option in the GraphOwner inspector by the way, so the above solution is only temporary one :).

    Please let me know if that works for you.

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #14340
    aelkhan
    Participant

    Ok thanks, I’ll give it a try. As I am not fond of dirty fixes (and as I want to keep your framework as clean as it is), have you any idea of the release date of your next version including the “prewarm” ?

    #14352
    Gavalakis
    Keymaster

    Hello again,

    I will send a new version to the asset store in the next coming days, but unfortunately this feature “prewarm”, will not make it to this version (because I have already delayed the new version), so it will appear on the version right next after this one.
    So, please do the “dirty fix” I’ve send you until your requested feature is implemented properly and once you update, it will be easy to move on the the “official” way of doing this (with the option in the inspector).

    Thank you!

    Join us on Discord: https://discord.gg/97q2Rjh

    #14606
    zsoik
    Participant

    Did the official fix made the cut for 2.9.7? Or is the “dirty fix” still applicable?

    #14608
    Gavalakis
    Keymaster

    Hey,

    I am currently working on a big update (both performance and features) and a proper “fix” will be part of this. The previous “dirty fix” is still applicable but a more clean way, would be to simply add this code in SubTree.cs:

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #14654
    w
    Participant

    Hi, is there an ETA for the proper “prewarm” toggle? We just upgraded to on 2.9.7 and were wondering if we should apply the fix above or just wait for the clean solution.

    Thanks

    #14658
    Gavalakis
    Keymaster

    Hey,

    The new version 3.0 (probably released this week) does have proper preload subgraphs toggle as well as a whole lot of other things! 🙂

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.