Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official AI Planner version 0.2.4 released

Discussion in 'AI & Navigation Previews' started by TrevorUnity, Nov 5, 2020.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    1,527
    @TrevorUnity Do u mean dots AI package like dots behavior tree?
     
    vx4 likes this.
  2. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    @TrevorUnity I am getting the following error on a seemingly simple domain:

    "ArgumentException: A component with type:BuildBarracksFixupReference has not been added to the entity."
    (BuildBarracks is one of my defined actions)

    I can't really figure out whether I am doing something wrong, it all looks good to me.

    I know you said the package hasn't been in active development for a long time but is there any chance at all there might be some way to resolve my compilation errors? Currently writing a bachelor thesis on the AI Planner package :/
     
  3. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    Hi, @haraldger! I've seen this error a few times. Typically, it means one of the earlier planning jobs failed. Are you seeing any other errors? Are you using custom preconditions or custom action effects? That tends to be where these failures crop up.
     
  4. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    Hi @TrevorUnity! Thanks for your response.

    I'll post a screenshot of the other error message I got below. There are also some warnings that I think are unrelated because I haven't seen them before, but the two error messages are what I have been getting lately.

    In terms of custom actions and preconditions, I haven't included anything custom. All my actions, problem definitions and termination criteria are very basic and simple ones, basically just following along the provided instructions in the AI Planner documentation.

    upload_2022-2-9_10-37-5.png

    Let me know if there's anything else I can provide that might help, code etc.

    Cheers!

    PS. I have noticed a couple of other issues quite frequently that I'd be happy to share as well.
     
  5. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    Hmmm. It's hard to tell from this what the issue might be. Can you share the BuildBarracks code, either here or over DM?
     
  6. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    @TrevorUnity Sharing here so others might benefit!

    A screenshot of the BuildBarracks action in the unity editor. I'll upload the code file as well.
    upload_2022-2-12_12-48-26.png

    Do let me know if there are any other files I can provide.

    Again, thanks for taking the time to help. Greatly appreciated!
     

    Attached Files:

  7. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    Stack trace seems to point to the following line 143. Not sure what < m_StatesToExpand[jobIndex] > does, but yeah.

    upload_2022-2-12_12-53-6.png


    Here is the declaration on line 28.
    upload_2022-2-12_12-55-42.png
     

    Attached Files:

  8. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    Without going too much into the details, that array represents the set of states on the horizon of the plan graph which are selected for forward simulation, in which potential actions are computed applied to said states, extending the plan graph. The array should not be empty, however. This particular error is new to me.

    Are you able to see any states in the plan visualizer when this error occurs? Is the plan considered complete (check the root state's complete status)?
     
    Metron likes this.
  9. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    @TrevorUnity Hi.

    The below is what the plan visualizer gives when I run the program. It seems to me that basically no plan is generated at all, and it is immediately marked as complete.

    upload_2022-2-16_14-49-2.png

    This has me thinking that there may be something I am doing wrong in my plan/termination definitions, although I have no idea what. Not sure why that would throw an argument exception, though.

    Cheers

    EDIT for some context, the building spot and citadel objects are two objects that are part of my scene, nothing that has been generated by the planner or anything like that.
     
  10. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    Apologies for the delayed response; I was OOF last week.

    That could be it, certainly. There are two causes for states to be marked complete: (1) the termination criteria is fulfilled, or (2) no valid action can be taken in the state. If you look over the actions in you've specified in the plan definition, is there any action whose preconditions are completely satisfied by this state?
     
  11. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    @TrevorUnity Sorry for also delayed response.

    Currently I only have one action, and it doesn't have any preconditions. This is what it looks like:
    upload_2022-3-2_20-34-13.png

    It's a very simple model, I didn't make it very far before getting errors D:

    This is the plan definition:
    upload_2022-3-2_20-35-16.png

    And there are no initial objects of type Barracks, so the plan wouldn't be terminating immediately on start up.

    Weird thing is that it was working at one point, but then (seemingly) inexplicably stopped working. My AI was actually building barracks! I don't know what I did and can't pinpoint exactly when it changed. I did have a lot of trouble with duplicate files however. I remember that the auto-generated code would generate duplicates, and I would have to manually delete the files. Maybe that helps? In case I messed something up and deleted something crucial. But then after that I re-did the entire project from scratch without deleting any files just to make sure that wasn't the issue.
     
  12. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    And just to re-iterate on some of my earlier posts, here is the error log I'm getting whenever I fire up the program:
    upload_2022-3-2_20-39-51.png
     
  13. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    This is very strange, indeed. Your action definition and state data indicate you should be able to build a barracks at the free building location. It's promising that it worked at an earlier point. When you recreated the project, did you delete the generated code ("AI Planner Plans" and "AI Planner StateRepresentation" in your packages directory) and regenerate it from the authoring assets?

    If you're handy with a debugger, you can also try setting a breakpoint in the job code for the action Build Barracks. A great place to start is in the execute method, after the action's valid argument permutations are computed (looking for >1 valid set of arguments).
     
  14. haraldger

    haraldger

    Joined:
    Nov 5, 2021
    Posts:
    10
    @TrevorUnity So when I recreated the project I didn't delete any of the generated code. But I didn't have to, because I got this very error immediately before any duplicates had had a chance to be generated.

    I'll give the debugging a try, although I'm not sure exactly what I'm looking for?
     
  15. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    I'd still recommend deleting the generated code for a fresh try. Occasionally, I have come into a situation where I've generated code with some set of preconditions/effects, then change one or more and forget to regenerate, causing issues down the line when the removed (in asset) parts linger in the generated code silently.

    Ah. I'll explain what you should look for. Without going too much into detail, given a target state, each action job first computes every valid permutation of action arguments (correct traits, satisfies precondition constraints), then for each permutation generates a resulting state (what the state should be after the action). I suspect your issue is somewhere in this process.

    By setting breakpoints in the action job, you should be able to quickly see if any valid argument permutations are found. If valid arguments were not found, the issue is likely at the point of querying the state and checking preconditions (in
    GenerateArgumentPermutations(...)). However, if valid arguments exist, the problem is likely in the forward simulation (in ApplyEffects(...)).
     
  16. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    329
    So AI team were busy making DOTS Navigation which is being on hold now. Will you guys resume work on AI Planner now? If not can you give us some insight into what are you working on?
     
  17. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    The AI teams are working on a few new projects, though it's too early to share information on them quite yet. I can confirm that the AI Planner is not part of these new initiatives, though some of the tech and many of the learnings we gained during development are heavily influencing the new tools.

    Regarding timing of future announcements on these fronts, I wouldn't expect any public news for six months to a year. Until then, you can track roadmap changes and request new features/tools through the public Unity roadmap portal: https://unity.com/roadmap/unity-platform
     
    DannyWebbie likes this.
  18. Onigiri

    Onigiri

    Joined:
    Aug 10, 2014
    Posts:
    329
    I see, thanks for update
     
  19. PixelizedPlayer

    PixelizedPlayer

    Joined:
    Feb 27, 2013
    Posts:
    645
    Unity really needs to open source and let us devs help make these things based on what unity wants, having these features announced in 2018 then put on hold 4 freaking years later, with likely no new updates for another year... Engines are made faster than some of these features it's ridiculous.
     
    TrevorUnity and vx4 like this.
  20. vx4

    vx4

    Joined:
    Dec 11, 2012
    Posts:
    171
    Is there a way to make AI Planner part of new initiatives?
     
  21. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    The best place to provide feedback on tools and features you'd like to see is the public roadmap, linked in my original comment. I'll note that under each sub-area, you can submit ideas/requests in the "Under Consideration" section. Relevant areas to our projects:

    https://unity.com/roadmap/unity-platform/navigation-game-ai
    https://unity.com/roadmap/unity-platform/3d-characters-and-animation
    https://unity.com/roadmap/unity-platform/gameplay-ui-design
    https://unity.com/roadmap/unity-platform/dots
     
  22. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    We can't account for all of Unity's codebase, but if you are using any of our packages (AI Planner, Traits, NavMeshComponents), you can copy the package files to a custom folder and import the package from disk, allowing you to make arbitrary changes to the code.
     
  23. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    936
    Bad thing about feedback site is that we can not see feedbacks of others and can not like them or vote for them

    So this looks like scream in a hole :)
     
  24. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    I understand that perspective. I quite enjoy hearing what other people have to say and often learn something in the process. Next time I meet with the relevant persons who manage the public roadmap, I'll raise the issue.

    That said, requests and comments made on the public roadmap portal are absolutely seen internally, from product managers operating at the top of the business down to specialized engineers such as myself. It is one of the up-and-coming means of receiving this kind of feedback from our users, and I would encourage its use despite the limitations on discoverability and the one-sidedness of the input.

    Of course, also keep having discussions here in the forums too. :)
     
    Jes28, DannyWebbie and Anthiese like this.
  25. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,747
    @ericbegue added GOAP in his PANDA.BT, I think it's the official version now.
     
    TrevorUnity likes this.
  26. PixelizedPlayer

    PixelizedPlayer

    Joined:
    Feb 27, 2013
    Posts:
    645
    It would be nice to have a response though, even Microsoft manages to reply with visual studio recommendations even if rejected or merged to another pre-existing idea.
     
  27. vx4

    vx4

    Joined:
    Dec 11, 2012
    Posts:
    171
    hi,is there any update for 2023.
     
  28. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    114
    Hello, vx4! We're not ready yet to announce or unveil anything just yet. That said, development on our next project has been proceeding quite well, and we are hoping to move from internal to public testing in the first half of 2023. We'll make an announcement here as soon as it's ready.
     
    Qhuhuit and Ruchir like this.
  29. vx4

    vx4

    Joined:
    Dec 11, 2012
    Posts:
    171
    thx for the update and amazing work.
     
  30. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,409
    Wow, thanks so much Trevor and AI planner team for this amazing package. I just learned about AI planner recently from a collegue and would like try it out. I attempted to install 0.30 preview of AI planner in unity 2021.3.9 LTS and got these errors.

    There are so many dependencies related to burst, jobs, entities, etc. Can you suggest what is the latest version of unity that AI planner works in and what versions of the various packages are needed.

    Many thanks.
     

    Attached Files: