Search Unity

AI Planner

Discussion in 'AI & Navigation Previews' started by amirebrahimi_unity, Mar 23, 2019.

Thread Status:
Not open for further replies.
  1. grizzly

    grizzly

    Joined:
    Dec 5, 2012
    Posts:
    278
    Yeh, looks like a server config issue.
     
    Lahcene likes this.
  2. 3Lighthouses

    3Lighthouses

    Joined:
    Sep 15, 2009
    Posts:
    9
    I tried it and gave up when I started getting a weird bug. When I try to edit either the domain or the plan and the relevant windows pop up with either editor, every window in unity -- hierarchy, scene, everything -- needs to be refreshed manually to see a change. I do this by resizing the windows slightly.

    So I'm having trouble typing in a new trait, for instance -- I type and nothing changes. I change the size of the editor window and I can now see what I typed. I close the window, thinking it has a bug and go back to my scene. I move a box, but it doesn't update on screen. I resize the window and the box has moved. So it's affecting the whole Unity Editor when it goes wrong. I'm guessing it's something like a Repaint method gone awry?
     
  3. 3Lighthouses

    3Lighthouses

    Joined:
    Sep 15, 2009
    Posts:
    9
    I should add that bugs would be the only thing blocking me right now -- it's the package I'm most interested of all to try out.
     
    vx4 and robin_v like this.
  4. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    Question, would the planner work in the Tiny environment (when they complete the c# port?)
     
  5. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    Preface:
    My master's project was incorporating a Planner into Unity, so I am very excited to see this project. ( https://www.slideshare.net/slideshow/embed_code/key/nrMRU97qwn4PFn )


    What is the one thing that would help you most?
    Currently I am working thru the Otto example and perhaps some additional documentation on how and why you integrated into ECS ( ie NeedsUpdateSystem ) could be useful. I have dabbled with DOTS so I can recognize the pattern, but most MonoBehavior developers might get lost. Similarly a brief mention of the StateMachineBehaviours to help also those who haven't seen them used.

    Also some documentation to show how the Definitions of the Plan and Domain correlate to code.
    Like this


    Finally an example of how to detect poor performance in a plan.

    For those of you who tried the planner, but are not going to use it yet -- what would unblock you?
    Assurances that it has been tested on all platforms, most importantly WebGL, Android, iOS and Tiny!!


    Question:
    Is there a reason the Navigate class was split into Navigate.cs and Navigate.Extra.cs
    - Answer: The Generated code allows you to implement SetCustomReward Method for each generated Action.

    When creating a Custom Trait, how do we set it to a user created classes?
    - Answer: These are initialized by the BaseAgent scripts' Initial Domain Object Data

    How is " BaseAgent :: Heuristic(Entity stateEntity) "incorporated within the system?
    - Answer: It is a override replacing built in Heuristic
    https://docs.unity3d.com/Packages/c...AI.Planner.Agent.BaseAgent-1.html?q=Heuristic

    Considering re usability by building a library of domains.
    Are there plans to allow a Plan Definition to use multiple domains?

    Why does duplicating Otto break him?

    Bug:
    There seems to be an error in the editor when setting fields in the Plan definition's Preconditions, it does not populate the fields.

    In 2019.1.0f2 and package preview4 AI planner. If I recreate the Time trait from Otto I get these errors

    Assets\AI.Planner\Generated\Agent_Domain\Agent_Domain.cs(54,27): error CS0122:
    'HashCode' is inaccessible due to its protection level
    Assets\AI.Planner\Generated\Agent_Domain\Agent_Domain.cs(54,36): error CS0115: 'Agent_DomainUpdateSystem.HashState(Entity)': no suitable method found to override
    Assets\AI.Planner\Generated\Agent_Domain\Agent_Domain.cs(36,18): error CS0534: 'Agent_DomainUpdateSystem' does not implement inherited abstract member 'PolicyGraphUpdateSystem.HashState(Entity)'

    In the generated source for Time it says HashCode is inaccessible due to its protection level.
    - Answer : Set Player Settings -> Other settings-> API Compatibility to 4.x
     
    Last edited: May 20, 2019
  6. tin_liminal

    tin_liminal

    Joined:
    Jan 20, 2017
    Posts:
    5
    Hey guys, this looks awesome! I've been very excited about GOAP.

    So the Otto project works and runs.

    However on a brand new project, installing the package, I'm unable to Edit a new Trait. The error comes from TraitDefinitionFieldDrawer.

    I've attached two screenshots.

    One shows an catch error and the other uses EditorGUILayout.PropertyField(property,true);
    It appears that m_Name doesn't exist in that property?
     

    Attached Files:

    Last edited: May 13, 2019
    vincismurf likes this.
  7. Evil-Otaku

    Evil-Otaku

    Joined:
    Oct 17, 2012
    Posts:
    26
    I've got Otto up and running. Now I've got a Domain and Actions setup. How do i go about setting goals for the planner?
     
  8. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    What version of unity are you running? It created compile errors for me when I Generate Domain
     
  9. Evil-Otaku

    Evil-Otaku

    Joined:
    Oct 17, 2012
    Posts:
    26
    Yea i got a few errors as well but i manager to clear them. Turns out you can't really remove Traits once you've added them. Also don't name any of your fields "object".

    I'm on 2019.1.2f1 AI Planner preview.4 0.0.1
     
  10. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    OK I found the problem

    You MUST change the Player Settings -> Other settings

    API Compatibility to 4.x

    Could the developers please post this information on the top of the thread and preferably in the package manager?
     
    Last edited: May 15, 2019
  11. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    11
    Sadly, changing API Compatibility to 4.x didn't correct the 'HashCode' is inaccessible due to its protection level issue for me.

    I tried to replicate every settings from the otto project to my own, and I found out that what was missing in my project was an Assembly Definition File for the Planner. I simply copied the file and it fixed the issue!

    The file (in otto project) is Assets/AI.Planner/AI.Planner.Domains.asmdef.

    I hope this solution works for everyone :)
     
    robin_v and vincismurf like this.
  12. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    11
    You're not the only one having troubles with the conditions UI, the parameter panel has just the first popup filled with the parameters name, but the following popups always stay empty, no matter what. I'm experiencing the same problem with the Otto project as well, so it's a bug I guess.

    There is a temporary solution: you have to activate the debug mode and modify directly the preconditions in the plan definition asset. There you can enter manually any value.

    Capture d’écran 2019-05-16 à 17.50.01.png
     
    vincismurf likes this.
  13. tin_liminal

    tin_liminal

    Joined:
    Jan 20, 2017
    Posts:
    5
    Sweet! That would explain why the Otto project works.
     
  14. santadiego

    santadiego

    Joined:
    Aug 31, 2014
    Posts:
    16
    Library\PackageCache\com.unity.entities@0.0.12-preview.29\Unity.Entities\DefaultWorld.cs(2,7): error CS0138: A 'using namespace' directive can only be applied to namespaces; 'PlayerLoop' is a type not a namespace. Consider a 'using static' directive instead

    2019.3.0a2
     
  15. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    11
    I've been dreaming for a planner AI plugin for a long time (I had to create my own GOAP system before that, and it was really complicated), so thanks to the team for writing this plugin! I'm actually having fun :D

    What would help me the most is to make the conditions easier to use. Actually I have to modify them directly in the debugged inspector because the popups are "empty" and I can't set a number or a string:
    Capture d’écran 2019-05-17 à 16.17.18.png


    A quick idea which would help me a lot is giving the possibility to write conditions in textfields instead of using the popups. You could still use popups, but they would simply fill correctly textfields. Another advantage of textfields is the possibility to copy / paste easily.

    Something like this:
    Capture d’écran 2019-05-17 à 15.51.55.png

    Thanks,
    Daniel
     
    Last edited: May 18, 2019
  16. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    Well put SunnySide Games, I would also like to see us create a standard for domains.

    One of the strengths of Planners is that domains and plan could be used for multiple projects.

    Creating a standard naming convention for things like Time, Inventories, Activities ( work, sleep ect) would help each other and reduce the learning curve to those interested in Advanced AI.
     
  17. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
  18. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    11
    I second that! :)

    Ok so I've been toying a lot with the plugin, and I was searching for a way to automatically fill the Initial Domain Object Data with the agent direct surroundings, because it's a pain to have to manually enter everything.

    The problem is, everything is private and with different namespaces, so the only solution I found was to write a BaseAgent extension where I could add new domainObjects to the current state.

    I guess there will be an easier way to do that in the next version ?

    Anyhow, here's my code to add new domain objecta to the current state (The script has to be somewhere inside the Assets/AI.Planner/ folder or it won't have access to the HashCode class):

    BaseAgentExtension.cs
    Code (CSharp):
    1.  
    2. using System.Collections;
    3. using System.Linq;
    4. using System.Reflection;
    5. using Unity.Entities;
    6. using Unity.AI.Planner;
    7. using UnityEngine.AI.Planner.Agent;
    8. using Unity.AI.Planner.DomainLanguage.TraitBased;
    9.  
    10. namespace UnityEngine.AI.Planner.Agent
    11. {
    12.     public static class BaseAgentExtension
    13.     {
    14.         public static Entity CreateDomainObject<TAgent>(this BaseAgent<TAgent> agent, params System.Type[] types) where TAgent:class
    15.         {
    16.             var archetype = agent.GetEntityManager().CreateArchetype(agent.GetComponentTypes(types));
    17.             Entity domainObject = agent.CreateDomainObject(archetype);
    18.  
    19.             SetDomainObjectHashCode(agent.GetEntityManager(), domainObject, types);
    20.  
    21.             return domainObject;
    22.         }
    23.  
    24.         public static EntityManager GetEntityManager<TAgent>(this BaseAgent<TAgent> agent) where TAgent:class
    25.         {
    26.             BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.NonPublic;
    27.             FieldInfo field = agent.GetType().GetField("m_EntityManager", bindFlags);
    28.             return field.GetValue(agent) as EntityManager;
    29.         }
    30.  
    31.         public static ComponentType[] GetComponentTypes<TAgent>(this BaseAgent<TAgent> agent, params System.Type[] types) where TAgent:class
    32.         {
    33.             ComponentType[] componentTypes = new ComponentType[types.Length + 1];
    34.             componentTypes[0] = GetHashCodeComponentType();
    35.  
    36.             for (int i = 1; i < componentTypes.Length; i++)
    37.             {
    38.                 componentTypes[i] = new ComponentType(types[i-1]);
    39.             }
    40.  
    41.             return componentTypes;
    42.         }
    43.  
    44.         public static Entity CreateDomainObject<TAgent>(this BaseAgent<TAgent> agent, EntityArchetype objectArchetype) where TAgent:class
    45.         {
    46.             Entity stateEntity = agent.Controller.CurrentStateEntity;
    47.             EntityManager entityManager = agent.GetEntityManager();
    48.  
    49.             var domainObject = entityManager.CreateEntity(objectArchetype);
    50.  
    51.             if (!entityManager.HasComponent<DomainObjectTrait>(domainObject))
    52.                 entityManager.AddComponentData(domainObject, DomainObjectTrait.GetNext());
    53.  
    54.             var domainObjectReferences = entityManager.GetBuffer<DomainObjectReference>(stateEntity);
    55.             domainObjectReferences.Add(new DomainObjectReference {DomainObjectEntity = domainObject});
    56.      
    57.             return domainObject;
    58.         }
    59.  
    60.         public static System.Type GetHashCodeComponentType()
    61.         {
    62.             System.Type type =typeof(HashCode);
    63.             return type;
    64.         }
    65.  
    66.  
    67.         public static void SetDomainObjectHashCode(EntityManager entityManager, Entity domainObjectEntity, params System.Type[] types)
    68.         {
    69.             var domainObjectHashCodeValue = 0;
    70.  
    71.             foreach (var type in types)
    72.             {
    73.                 ITrait trait = GetTraitWithType(entityManager, domainObjectEntity, type);
    74.                 ComponentType componentType = trait.GetType();
    75.  
    76.                 if (!componentType.IsZeroSized)
    77.                     trait.SetComponentData(entityManager, domainObjectEntity);
    78.                 else
    79.                     trait.SetTraitMask(entityManager, domainObjectEntity);
    80.  
    81.                 domainObjectHashCodeValue += trait.GetHashCode();
    82.             }
    83.  
    84.             var objectHash = entityManager.GetComponentData<HashCode>(domainObjectEntity);
    85.             objectHash.Value = domainObjectHashCodeValue;
    86.             entityManager.SetComponentData(domainObjectEntity, objectHash);
    87.         }
    88.  
    89.         static ITrait GetTraitWithType(EntityManager entityManager, Entity domainObjectEntity, System.Type type)
    90.         {
    91.             MethodInfo getComponentDataMethod   = typeof(EntityManager).GetMethod("GetComponentData");
    92.             MethodInfo getComponentDataGeneric  = getComponentDataMethod.MakeGenericMethod(type);
    93.  
    94.             return getComponentDataGeneric.Invoke(entityManager,new object[] { domainObjectEntity}) as ITrait;
    95.         }
    96.     }
    97. }
    Here's how I use it in my Agent script:
    Code (CSharp):
    1.  
    2.  
    3.         protected Entity CreateWorldEntityDomainObject(WorldEntity worldEntity, ActionType action, DriveModifier driveModifier)
    4.         {
    5.             Entity domainObject = this.CreateDomainObject(typeof(TestDomain.DriveModifier), typeof(Location), typeof(TestDomain.Visibility));
    6.             m_EntityManager.SetComponentData(domainObject, new Location { Transform = worldEntity.transform});
    7.             m_EntityManager.SetComponentData(domainObject, new TestDomain.DriveModifier {
    8.                 Need = GetDomainNeed(driveModifier.need),
    9.                 Amount = (int)driveModifier.amount,
    10.                 Action = GetDomainAction(action)});
    11.  
    12.             return domainObject;
    13.         }
     
    Last edited: May 18, 2019
    vincismurf and Djayp like this.
  19. Daft_Hunk

    Daft_Hunk

    Joined:
    Nov 15, 2016
    Posts:
    15
    Any ETA for the update ? I really want to dig into that package but I'm using Entities 30+ in my project ;)
     
    SunnysideGames likes this.
  20. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    11
    I would like to know too... Especially if it would be possible to make the planner work with multiple agents in the next preview ? Or maybe I'm doing something wrong ?

    Btw I get this error when generating my plan classes (because I use Prohibited Traits):

    error CS0619: 'ComponentType.Subtractive<T>()' is obsolete: 'ComponentType.Subtractive has been renamed. Use ExcludeComponent instead (UnityUpgradable) -> Exclude()'


    I have to manually replace Substractive by Exclude everytime I click on Generate Classes.
     
  21. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    200
    I third an Update ETA, A roadmap would be nice as well
     
  22. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    343
    I don't like this some connection with ESC, which I'm don't use. Is it really necessary? Also why not upload example just like unitypackage or something, because, you know, some people don't use GITHUB (unexpectedly yes?), and don't understand why they need to install it just for this.
     
  23. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    76
    There are free C# implementations of GOAP (like https://assetstore.unity.com/packages/tools/ai/regoap-77376). You need GitHub for the otto project sample, but you can go without it.

    This one is cool because it is ECS based, since AI is data-oriented stuff.
     
    Last edited: May 23, 2019
  24. id0

    id0

    Joined:
    Nov 23, 2012
    Posts:
    343
    I download without it, and there is no models, no animations, no textures, nothing. Lots of errors.
     
  25. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    76
    You don't need the otto sample to use the AI Planner, that's what I mean.
     
  26. Lahcene

    Lahcene

    Joined:
    Jun 18, 2013
    Posts:
    24
    When you download the project as a zip, large files won't be included (FBX files, textures, etc.).
    You'll have to clone the repo.
     
  27. threedots1

    threedots1

    Joined:
    Oct 9, 2014
    Posts:
    64
    Would love to have a roadmap for this. Looking to implement it in our current project.
     
  28. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    40
    Reactive techniques will scale better to many agents, as they typically incur less computation. This is the trade-off between autonomy and execution time. We have some ideas around plan sharing that will help scale up to many agents working in the same domain, so keep an eye out for multiagent demos down the road.
     
    vx4, SunnysideGames and Shinyclef like this.
  29. Justin_Larrabee

    Justin_Larrabee

    Joined:
    Apr 24, 2018
    Posts:
    91
    What's the status and roadmap of this project? The current version available in the package manager doesn't import without errors in 2019.1 with the latest ECS version.

    Additionally, why is the system built around class-based polymorphism when it is tied to and obviously intended to function with the ECS?
     
    Roldo, Ataraksia and Gekigengar like this.
  30. vx4

    vx4

    Joined:
    Dec 11, 2012
    Posts:
    105
    Natural Selection can implement easily by AI Planner.

    Feature request:

    • A mechanism to do random selection for action to take.
    • AI Planner should cover some aspect of behavior tree like below.
    • Sub action:where next action must from specific groups of action until exit action performed which exit from sub action .
    • Action should assign to layer and group ID.So current action can select from which group range and layer the next action will be.Also next action should select from which groupID range and layer the previously action was. like Preconditions(The current action will take only if previously action was belong to selected groupID range and layer).
    • Direct Action where next action will one of selected action.
    • more option for effects like move trait and clone trait.
    • Globe var and local var per action .
    • label system: where action can add an element to array(int[]) or check if specific value in array.
    • Inheritance trait,Where trait have parents and change value in parents trait reflect directly in child trait.
     
    Last edited: Jun 18, 2019
  31. Roldo

    Roldo

    Joined:
    Oct 25, 2014
    Posts:
    27
    I have encountered a problem when installing Ai Planner package alongside Entity package. I started to get errors about multiple assemblies being missing. The reason for that as i figured out was current updated version of Entities package, it is 0.0.12 preview 33, however the Planner requires preview 29. After downgrading Entities to preview 29 the as well as Hybrid renderer to preview 9 all compile errors disappeared.
    However i would like to use newer versions of Entities package and the Planner. Is there any way to fix the errors apart from downgrading the package? Will there be any updates to the Planner package, and if yes, how soon?
    Ive attached a screenshot of the error logs.

    In addition, i have the same question as Justin_Larrabee:
     

    Attached Files:

    • Log.png
      Log.png
      File size:
      358 KB
      Views:
      225
  32. zephyr831125

    zephyr831125

    Joined:
    Mar 4, 2017
    Posts:
    51
    I have the same issue, can not work with Entities 0.0.12 p33. Is this AI planner been abandoned or what? Still at version 0.0.1 for like 4 months?
     
    growling_egg and vx4 like this.
  33. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    60
    Hey all, have a favor to ask. If anyone has managed to get a sample project working with the latest version of Unity, would you be willing to share it? The otto project doesn't seem to work in the newest version, and I have a hunch that there are some implied steps in the AI Planner manual. I'm working on figuring out the gaps, but could use an example.

    My main questions are:

    1) The AI Planner tool seems to generate most of the files I need, but do I need to explicitly create and write my operational actions? If so, is there anything I need to know besides what is on the manual page?

    2) How does one distinguish between a terminal "goal" state and a terminal "this will kill you and invalidate your need to plan" state?

    Thanks!
     
  34. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    40
    Hello, everyone! In an effort to be transparent about the state of this project, here is a brief update from our team.

    We have updated the package to a new preview version (preview.7), which includes fixes for some of the issues some of you have encountered with previous releases. Additionally, for this release, we have updated our dependency on the Entities package to Entities preview.30, which is the latest version of the Entities package that is compatible with elements of our package, notably the plan visualizer. Future releases will support later versions of the Entities package, which we discuss below.

    Without going too much into the details, we'd like to give a sense of the direction the project has taken in the past months. Our highest priority objective after the previous release was to move much of the planning computation off of the main thread, in an effort to improve performance and to utilize multiple processor cores wherever possible. This directive led us to move much of the planning process out of ECS and into the C# Job System, which allows us to have finer control over the structure and access of our data. This not only improves the performance of our system but also provides a cleaner solution that we hope you will find more intuitive to understand as well as easier to control, debug, and modify. However, such a consideration was not taken lightly, as it has entailed an overhaul of the entire package.

    With that, let's discuss the changes you can expect in our next major release, which we hope to land in August 2019. Moving to the C# Job System has lessened our dependency on the entities package, allowing us to update to newer versions without breakages. As mentioned previously, you can expect improved performance, better utilization of jobs for distributed computation, as well as manual control over when planning jobs are scheduled. We have also removed all instances of recurring managed/GC memory allocations.

    We have also given much attention to the authoring UI/UX. User authored data will now be split into individual assets, allowing for better management, reuse, and editing of items such as traits and actions. These assets will be used to generate code into a separate assembly, with added measures to prevent the generation of code that would cause compilation errors in your project. Furthermore, we're giving the inspectors a new look, which should improve the authoring experience. We've included a snapshot below as a preview, but keep in mind the inspectors may continue to evolve before the next release.

    Finally, our long-term goals center on the authoring experience. Our objective is to provide a new workflow focused on a more iterative approach to authoring behavior. We hope to provide more feedback at each stage of authoring, providing a means of validating the incrementally built domain model as well as debugging unexpected results. And with this new workflow, we'll be releasing a new production-level demo, which you can use as a reference while integrating the planner into your own projects.


    Summary:

    ==================================
    v0.0.1-preview.7 (Available Now)
    ==================================

    1. Update to Entities preview.30.
    2. Fix UI errors when navigating traits/properties in preconditions and effects.


    ==================================
    Major Update (Expected August 2019)
    ==================================

    1. Moving from ECS to C# Jobs
    • Less reliant on ECS as a preview package.
    • Better data access patterns -> better performance.
    • Fewer main thread sync points.
    • Manual control of when planning occurs.
    • No recurring runtime GC allocations.

    2. UI Improvements
    • Serialized data for traits/actions/etc will be contained in individual assets, allowing for better management and editing.
    • Improved inspectors for editing.

    3. Code Generation
    • Code generation will now emit code to a separate assembly. This will prevent breaking user projects if the code generation fails due to errors in the generated code.

    4. Algorithmic Improvements
    • More condensed plan representation -> smaller memory footprint.
    • Better handling of cycles/loops in behavior.
    • Parallelized search to utilize multiple cores where appropriate.

    ==================================
    Late 2019 Initiatives
    ==================================

    1. New authoring workflow goals:
    • Faster iteration time for incrementally building behavior.
    • Better plan visualization support at authoring time (useful for debugging).
    • Better UI/UX support, such as tagging items in the scene with traits.

    2. New release and demo in Fall 2019
    • Production-level use case.
    • Multiple agents planning and acting simultaneously.


    ==================================
    New Inspector Preview
    ==================================

    AssetsAndInspector.PNG
     
    Last edited: Jul 17, 2019
    vamky, DreDiki, Egil-Sandfeld and 6 others like this.
  35. vx4

    vx4

    Joined:
    Dec 11, 2012
    Posts:
    105
    Great job.
     
  36. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    40
    The Otto project has been updated with the latest release (today). There was an issue with newer versions of Unity, which caused Otto to appear to be walking but not actually moving anywhere. Let us know if you experience any other issue in the new version!

    As to (1), you will need to create your own operational actions. Typically, this is where you trigger animations on the character or set a destination on a navmesh agent. This will hopefully be straight-forward, but please post any questions you have. It's useful feedback for us.

    For (2), the easiest way to distinguish between desirable or undesirable terminal states is to assign them high or low values respectively via the heuristic. These values will be added to the action costs for the total plan cost. Take a look at the heuristic for Otto in the sample project (Otto.cs).
     
  37. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    60
    Thanks so much for clearing that up for me! Excited to get home and try it out.
     
  38. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    60
    I'm curious if it's just me having this error but when I load the current and previous versions of the Otto project in 2019.1.10f1 and open the DemoScene, I don't think everything loads correctly. I have attached a screenshot, this is after I opened the project and wondered if I needed to run the scene for the objects to appear, but they did not.
     

    Attached Files:

  39. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    40
    Did you by chance download Otto as a zip from the repository? We've had others run into similar issues. The zip doesn't include larger files. If you downloaded Otto this way, try cloning via git instead.
     
    growling_egg likes this.
  40. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    @davenirline - I see I missed your post here among many others that our now larger team can hopefully catch up on. As you'll see from Trevor's latest post we have a small bugfix update to the planner. However, I did want to address your issue. Thanks for creating a simple domain / plan example as this was informative of how things can break. There were a few things that were an issue:

    1. Operation action, TestAction, was in a namespace, which we'll need to support. For now, you could simply comment out the namespace part to get that working.
    2. The operational action completes, but doesn't actually modify the state of the agent, which means that the state will seem unchanged as as such will match with an existing state in the policy graph. While this shouldn't cause an error in the planner it does. Here is a quick code fix:

      Code (CSharp):
      1.         public override void EndExecution(Entity stateEntity, ActionContext action, SimplePlanner agent) {
      2.             Debug.Log("TestAction.End");
      3.  
      4.             foreach (var domainObjectEntity in agent.GetObjectEntities(stateEntity, typeof(Condition)))
      5.             {
      6.                 var condition = agent.GetObjectTrait<Condition>(domainObjectEntity);
      7.                 condition.Value = 1;
      8.                 agent.SetObjectTrait(domainObjectEntity, condition);
      9.             }
      10.         }
     
    Djayp likes this.
  41. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    60
    I still seem to get an empty scene but the console message now mentions a higher version of Unity.

    EDIT: I was overcomplicating it and trying to use git via the Ubuntu command line in Windows 10, but I cloned it again with the git exe and it loaded without issue.
     

    Attached Files:

    Last edited: Jul 18, 2019
  42. threedots1

    threedots1

    Joined:
    Oct 9, 2014
    Posts:
    64
    Excellent news looking forward to the August release.

    What methods are planned for getting data into the planner? We currently have all data in entities, dynamic buffers and arrays on systems with no gameobjects in use.

    How do you see us using the planner?
     
  43. mplantady_unity

    mplantady_unity

    Unity Technologies

    Joined:
    Jun 19, 2019
    Posts:
    11
    Currently, you have to set all your initial state data on your agent instances, and soon we will add the possibility to set data on any game objects in your scene.

    For data in entities you'll have to write your own initializer or converter for now, but it's something we're looking for future releases.
     
    threedots1 likes this.
  44. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    Thank you for your feedback @robin_v. Some of your feedback has already been incorporated into what we hope to release in August. See this post for more info.

    Re: your individual points:
    1. With our changes coming in August we generate code outside of the project and compile a single DLL, which goes into the project and only if it compiles successfully.
    2. There are a few things going on here. I think we've already fixed the exception in our current code, but you are getting a null ref exception because assigning fields from traits requires that the domain definition code has already been generated, which brings us to the third issue...
    3. The reason why you are getting errors about HashCode being inaccessible is due to the project being set to ".NET Standard 2.0" instead of ".NET 4.x". Our codegen is different now, which should fix this, but I've added an issue for us to revisit this and at least warn if the .NET 4.x requirement still exists.
     
  45. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    Thank you for your feedback, @aaronjbaptiste. Re: not being able to set a value -- this was a miss on our last update and has now been fixed with the bugfix release that just got pushed in the updated package.

    Re: your other points, they have been noted and you are correct in your workarounds for the time being.
     
  46. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    @aaronjbaptiste, You have to set your project to ".NET 4.x" instead of ".NET Standard 2.0", so that the assembly definition gets created. These errors will go away after that.

    Re: multiple agents using the same domain - this will be fixed in the next release.
     
  47. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    @Shinyclef, I know this is an old post, but has been answered here now.

    Re: performance impact vs. reactive agents -- we haven't performed any in-depth analysis, but we'd have to talk specifics about other systems in order to do that. Currently, we've made the whole planner asynchronous and our goal is to keep the main thread time under 1ms.
     
    Shinyclef likes this.
  48. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    @3Lighthouses, I believe I saw this same behavior recently. After opening a domain or plan definition make sure it isn't also select in the project view, which will have it show in the inspector as well. We've dropped our custom editor windows in a future release and opted for using inspectors, so this issue will go away in our future release.
     
  49. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    Currently, no one on our team has tested this, but in the long term -- yes.
     
  50. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    295
    Thanks @vincismurf for your detailed feedback and for editing your post with answers to your own questions. I think others will benefit from this.

    Re: your feedback:
    1. Documentation will be improved along with our focus on workflow, which we're also focusing on to expose how to improve performance when a plan is suboptimal.
    2. Our goal is very much to support general purpose domains and plans, so that these can be exchanged between devs. I'm unsure about whether a plan definition will support multiple domains yet, but it may be possible.
    3. Duplicating Otto breaks him because the version that is extant did not support multiple instances of the same domain. This has been fixed already.
     
    vincismurf likes this.
Thread Status:
Not open for further replies.