Multiple AI for one Model.

NodeCanvas Forums General Discussion Multiple AI for one Model.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #8921
    hcarriker
    Participant

    I have a question in regards to the best setup for game object creation and graph owners. In my example I have a prefab for a model with the animator object attached to it using root motion. This model is used in two different areas of gameplay which both require a different AI, thus needing different behaviour trees. The problem I keep running into is the graph tasks need the graph owner to contain the proper components attached to them in order to access and manipulate the information. What this means is I basically would need to create another model prefab anytime I wanted to have an AI that used a different graph owner setup that needed specific components. This does not play well with the game factory or the design of a typical system. What I basically need is for the tasks that manipulate movement/mecanim information to reference this model gameobject but NOT the graph owner. Using this method I could have one model prefab and many graph owner prefabs for separate AI. I think that in a normal scenario, AI would be able to reference the Agent(AI object) or the Entity(in this case the model object).I may be overlooking a simple solution for this which is why I am asking for help as I think of ideas.

    #8926
    hcarriker
    Participant

    Also, one side note. Now in version 2.0 the script control tasks automatically assume the agent is the one currently assigned inside the prefab. In the previous version i could specify the type even if it wasn’t assigned as a component yet on the agent. Is there a way to get a similar behaviour in 2.0? Another note on the same topic, If I use the override agent node, any tasks underneath this node do not use the new agent assigned when using the script control tasks.

    #8925
    Gavalakis
    Keymaster

    Hello,

    So from what I understand is that you have (for this example) 2 game objects “MasterA” and “MasterB”, and a prefab “Child”.
    – MasterA and MasterB have a BehaviourTreeOwner component
    – At runtime to instantiate Child
    – Child has critical components that you need to access from both MasterA and MasterB

    So, for starters 🙂 the agent of the task (eg Animator component) doesnt nesesarily have to be on the Owner. This can be overriden with the toggle control on the right of “Use Self”. If “Child” was not a prefab you could directly reference it.

    Now, since “Child” IS a prefab, the way this have to work is that you use Variables.
    – So in MasterA and MasterB blackboards you can create a variable lets call it “AnimatorTarget”.
    – In the Task, override the agent (toggle control) and select our variable “AnimatorTarget”.
    – All that is left is setting the “AnimatorTarget” variable once you instantiated “Child”. For example:

    Alternatively , you can instead use the rebust variables Property data binding. So you can have a component on MasterA and MasterB which have a public property for the instantiated runtime “Child”.
    In the Variables editor, clicking the small button on the right of the variable (not the x of course), lets you Bind it to a public property in one of the components on the same gameobject as the blackboard is.

    Let me know if that is what you are looking for.

    Thanks

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

    #8924
    Gavalakis
    Keymaster

    Om missed you second post.

    Regarding the script control tasks and type selection it’s now fixed and will send update soon. Here is a very temporary solution:
    – Select some temporary method (preferably a Transform one)
    – Now that the agent field is shown, click toggle to override it and leave the field null
    – Now you can select any method for any type.
    – of course un-override the agent in the end if you dont want to.

    Again, this is a temporary workaround. The issue is fixed.

    I am going to check right now the OverrideAgent node and post back.

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

    #8923
    hcarriker
    Participant

    Nice, thanks a ton for your help. This seems like it will do what I am trying to do. I’ll post back with any issues if I run into any.

    #8922
    Gavalakis
    Keymaster

    You are welcome 🙂
    Let me know.

    Regarding the ScriptControl and AgentOverride Node, indeed it doesnt work due to the new way of ScriptControl tasks work for performance. I will either have to sacrifice performance to support the BT AgentOverride Node in SciptControl Tasks or leave it as is.
    Hmm. I need to think this more thoroughly.

    Thanks

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

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