Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

AI Planner - v0.1.1-preview Release!

Discussion in 'AI & Navigation Previews' started by TrevorUnity, Aug 30, 2019.

  1. eterlan

    eterlan

    Joined:
    Sep 29, 2018
    Posts:
    72
    Can't wait to explore your amazing tool!!
    The problem is that I can't run otto. I use Github Desktop to clone the project, and has a 26KB Domain.dll. And I use mac 10.14 & Unity 2019.3.04b. Wondering anything I did wrong?
    InvalidOperationException: The native container has been declared as [ReadOnly] in the job, but you are writing to it.
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) <0x1951026d0 + 0x00052> in <f55fb603e84f4928ae3dd5f6d0b3e174>:0
    Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Jobs/AtomicSafetyHandle.bindings.cs:153)
    Unity.Entities.EntityCommandBuffer+Concurrent.CheckWriteAccess () (at Library/PackageCache/com.unity.entities@0.1.1-preview/Unity.Entities/EntityCommandBuffer.cs:1562)
    Unity.Entities.EntityCommandBuffer+Concurrent.Instantiate (System.Int32 jobIndex, Unity.Entities.Entity e) (at Library/PackageCache/com.unity.entities@0.1.1-preview/Unity.Entities/EntityCommandBuffer.cs:1598)
    AI.Planner.Domains.StateData.Copy (System.Int32 jobIndex, Unity.Entities.EntityCommandBuffer+Concurrent entityCommandBuffer) (at <28519cad2e124d71a99d69d55e3fb90e>:0)
    AI.Planner.Domains.StateDataContext.CopyStateData (AI.Planner.Domains.StateData stateData) (at <28519cad2e124d71a99d69d55e3fb90e>:0)
    AI.Planner.Actions.WorkaholicAgent.Navigate.ApplyEffects (Unity.AI.Planner.DomainLanguage.TraitBased.ActionKey action, AI.Planner.Domains.StateEntityKey originalStateEntityKey) (at <7e7d171223244862a70018811e407552>:0)
    AI.Planner.Actions.WorkaholicAgent.Navigate.Execute (System.Int32 jobIndex) (at <7e7d171223244862a70018811e407552>:0)
    Unity.Jobs.IJobParallelForDeferExtensions+JobStructDefer`1[T].Execute (T& self, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.jobs@0.1.1-preview/Unity.Jobs/IJobParallelForDefer.cs:105)
     
  2. mplantady_unity

    mplantady_unity

    Unity Technologies

    Joined:
    Jun 19, 2019
    Posts:
    11
    You need Git LFS (Large File System) extension to clone Otto repo, perhaps there is some configuration to enable it in Github Desktop.
     
    eterlan likes this.
  3. eterlan

    eterlan

    Joined:
    Sep 29, 2018
    Posts:
    72
    Yes I know that, I guess Github desktop automatically handle it. The otto folder is 356.1M after Clone. Then I open it in Unity, it becomes 896M. (Is it correct? So it's not lfs problem right?)
     
  4. eterlan

    eterlan

    Joined:
    Sep 29, 2018
    Posts:
    72
    :)I use 2019.2 and run it correctly, such a surprise! The bug report sounds it's nothing related to the Unity version. Thanks for your help!
     
    mplantady_unity likes this.
  5. Justin_Larrabee

    Justin_Larrabee

    Joined:
    Apr 24, 2018
    Posts:
    88
    Happy to hear an update about this project, but I am still confused as to why the GameObject workflow is still being used. Is there a firm ETA on when this package will be usable in a pure ECS context?
     
  6. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    DOTS GameObject to Entity workflows are still in the process of being created, so DOTS usage of the planner would primarily be code-based currently. And currently, the planner should be able to be used code-based-wise. Do you have a DOTS-based project you are already wanting to use the planner on?
     
  7. Justin_Larrabee

    Justin_Larrabee

    Joined:
    Apr 24, 2018
    Posts:
    88
    Do you envision timing a pure ECS version when the core API hits 1.0, or do you think the authoring workflow won't be in a good enough spot at that point still?

    And yea I have a project booting up in a few months that would be a good candidate for this system. I've implemented a pure-ECS utility AI system for my current project, but from a workflow point of view this project is much more interesting to me.
     
  8. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    I can't comment on DOTS release plans, but once the authoring workflow has stabilized we will support that as best as we can.

    However, that brings me back to what you would be looking for re: your DOTS/ECS project. Are you planning to use a visual authoring workflow for that project or will you be working mostly from code?
     
    eterlan likes this.
  9. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    What @growling_egg says.

    And also screen capture one of your guys making a typical GOAP agent like a farmer (harvest vegetables, when tool broken gather parts and uses anvil to fix a new tool etc...), with sphere capsules and cubes. Even unedited that'll give us a thinking process to follow.

    Visual.

    Or download the zipped project from : https://drive.google.com/open?id=1BXLMI6NZFEAhqIxsj_2qqiW8vx7_A6nu
    If you want Github to fix their website LFS zip download, all of you contact them from this page https://support.github.com/contact
    In the meantime, Unity you can zip the Otto project and add it to release, this way it can be deployed by simply downloading it
     
    Last edited: Oct 3, 2019
  10. zephyr831125

    zephyr831125

    Joined:
    Mar 4, 2017
    Posts:
    46
    Actually this reminds me to talk about my project. It's a pure ECS project too. The gameplay is multi-villager management similar to Rimworld or Oxygen Not Included.
    upload_2019-10-3_15-49-0.png
    I am currently stuck at AI, since every facility in the game requires villagers to build and operate. I need villagers' behaviors to glue everything up to run the village.
    I have researched three types of AI ( FSM, Behaviour Tree, GOAP) and finally decided to use GOAP which I think is the fittest to my game. The problem is there's no out-of-box GOAP addon working for ECS World out there. Then I found your AI Planning project, Similar to GOAP and developing in Unity itself, and is ECS cored inside! Which is perfect to me!
    I apologize for so many non-sense talking not relevant to AI Planner, and my bad English. I am really anxious about my working progress, because it's been developed for 2 years, and I promised to release the demo this year. So I don't need visual authoring workflow that much, I would like to be working mostly from code, as long as I can implement AI and continue developing as soon as possible.
     
    eterlan likes this.
  11. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    15
    Do you know when you'll support 2019.3?

    [Edit]Also where is the best place to submit bugs/issues and help out? it's a very interesting project! :)

    I'm getting these errors in b5
    Code (csharp):
    1. InvalidOperationException: The native container has been declared as [ReadOnly] in the job, but you are writing to it.
    2. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <5e35e4589c1948aa8af5b8e64eea8798>:0)
    3. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <5e35e4589c1948aa8af5b8e64eea8798>:0)
    4. Unity.Entities.EntityCommandBuffer+Concurrent.CheckWriteAccess () (at Library/PackageCache/com.unity.entities@0.1.1-preview/Unity.Entities/EntityCommandBuffer.cs:1562)
    5. Unity.Entities.EntityCommandBuffer+Concurrent.AddBuffer[T] (System.Int32 jobIndex, Unity.Entities.Entity e) (at Library/PackageCache/com.unity.entities@0.1.1-preview/Unity.Entities/EntityCommandBuffer.cs:1635)
    6. AI.Planner.Actions.Worker.Navigate.Execute (System.Int32 jobIndex) (at <ff180c3d585443c1998ba955ec13f4e2>:0)
    7. Unity.Jobs.IJobParallelForDeferExtensions+JobStructDefer`1[T].Execute (T& self, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.jobs@0.1.1-preview/Unity.Jobs/IJobParallelForDefer.cs:105)
    8. Unity.Jobs.JobHandle:ScheduleBatchedJobsAndCompleteAll(Void*, Int32)
    9. Unity.Jobs.JobHandle:CompleteAll(NativeArray`1)
    10. AI.Planner.Actions.Worker.ActionScheduler:Schedule(JobHandle)
    11. Unity.AI.Planner.PlannerScheduler`8:ScheduleActionsJobs(JobHandle) (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/Planner/PlannerScheduler.cs:247)
    12. Unity.AI.Planner.PlannerScheduler`8:Schedule(JobHandle) (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/Planner/PlannerScheduler.cs:104)
    13. UnityEngine.AI.Planner.DomainLanguage.TraitBased.BaseAgent`10:Update()
    14. WorkerAgent:Update() (at Assets/Code/Ai/Planner/WorkerAgent.cs:31)
    and
    Code (CSharp):
    1. ArgumentException: A component with type:NavigateFixupReference [B] has not been added to the entity.
    2. Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.ComponentType componentType) (at Library/PackageCache/com.unity.entities@0.1.1-preview/Unity.Entities/EntityComponentStoreDebug.cs:216)
    3. Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, System.Int32 componentType) (at Library/PackageCache/com.unity.entities@0.1.1-preview/Unity.Entities/EntityComponentStoreDebug.cs:222)
    4. Unity.Entities.EntityManager.GetBuffer[T] (Unity.Entities.Entity entity) (at Library/PackageCache/com.unity.entities@0.1.1-preview/Unity.Entities/EntityManagerAccessComponentData.cs:315)
    5. AI.Planner.Actions.Worker.ActionScheduler.Schedule (Unity.Jobs.JobHandle inputDeps) (at <ff180c3d585443c1998ba955ec13f4e2>:0)
    6. Unity.AI.Planner.PlannerScheduler`8[TStateKey,TActionKey,TStateManager,TStateData,TStateDataContext,TActionScheduler,THeuristic,TTerminationEvaluator].ScheduleActionsJobs (Unity.Jobs.JobHandle inputDeps) (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/Planner/PlannerScheduler.cs:247)
    7. Unity.AI.Planner.PlannerScheduler`8[TStateKey,TActionKey,TStateManager,TStateData,TStateDataContext,TActionScheduler,THeuristic,TTerminationEvaluator].Schedule (Unity.Jobs.JobHandle inputDeps) (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/Planner/PlannerScheduler.cs:104)
    8. UnityEngine.AI.Planner.DomainLanguage.TraitBased.BaseAgent`10[TAgent,TObject,TStateKey,TStateData,TStateDataContext,TActionScheduler,THeuristic,TTerminationEvaluator,TStateManager,TActionKey].Update () (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/Agent/BaseAgent.cs:275)
    9. WorkerAgent.Update () (at Assets/Code/Ai/Planner/WorkerAgent.cs:31)
     
    Last edited: Oct 4, 2019
  12. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    For our next release we plan to support 2019.3 as the minimum version.
    For submitting bugs, please post on the forum thread for each release version. As we move closer to release we'll have a longer term plan for bug submissions either via GitHub issues or something similar.

    Re: the errors. Did you make any local changes to your project. Are you using a different version of of the Unity.Entities package?
     
    Djayp and PaulUsul like this.
  13. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    15
    That's awesome!

    I'm testing on a real project so there are loads of changes. I'll try starting a bare bones project and see how it goes.
    Unity.Entities is updated(0.1.1-preview). Here's my Packages manifest:
    "dependencies": {
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.addressables": "1.1.10",
    "com.unity.ads": "2.0.8",
    "com.unity.ai.planner": "0.1.1-preview",
    "com.unity.analytics": "3.3.2",
    "com.unity.burst": "1.1.2",
    "com.unity.cloud.userreporting": "0.2.4-preview",
    "com.unity.collections": "0.1.1-preview",
    "com.unity.entities": "0.1.1-preview",
    "com.unity.ext.nunit": "1.0.0",
    "com.unity.ide.rider": "1.1.1",
    "com.unity.ide.visualstudio": "1.0.11",
    "com.unity.ide.vscode": "1.1.2",
    "com.unity.jobs": "0.1.1-preview",
    "com.unity.mathematics": "1.1.0",
    "com.unity.memoryprofiler": "0.1.0-preview.7",
    "com.unity.performance.profile-analyzer": "0.4.0-preview.6",
    "com.unity.polybrush": "1.0.1",
    "com.unity.purchasing": "2.0.6",
    "com.unity.rendering.hybrid": "0.1.1-preview",
    "com.unity.test-framework": "1.1.3",
    "com.unity.textmeshpro": "2.0.1",
    "com.unity.timeline": "1.2.2",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0"
    }
     
  14. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    Hmm...Looking at your manifest I thought I might find a newer version of one of the dependent packages in there, but they all seem to be correct. Let me know how the bare bones project goes.

     
  15. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    134
    Thanks for sharing this! Had a bit of fun playing around with Otto. I found that by just moving the stations a bit further away, the AI simulation kind of falls apart very quickly.

    upload_2019-10-9_11-3-25.png

    Sometimes Otto will loop endlessly at a workstation, sometimes he'll recover after a few loops and use the station (adjust colliders maybe?). I've also found that Otto sometimes just sleeps over and over repeatedly while he dies from hunger and/or thirst (while he still has bottles/apples in inventory).
     

    Attached Files:

  16. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    Hmm...That's odd because Otto's custom navigate effects and reward are based on distances between locations.

    I took a look at your scene and this is an operational model issue. You are correct in that the colliders should be adjusted because Otto keeps doing 360 rotations when he reaches a location because the collider wasn't hit. This affects the plan's expectation of how long it should take to do something like consume a bottle. I think because these time estimations grow more and more apart that Otto eventually dies.

    Separate from that is how we modeled the needs and how quickly they escalate. It's possible that it isn't possible to keep Otto alive with the longer distances that have to be traveled across. If you look at the precondition for Consume, Otto will only consume when the urgency is greater than the need reduction (currently set when it is at 50%).

    All-in-all, you've certainly exposed the need for better domain modeling as this domain model is closely tied to the design of the level.
     
    Egil-Sandfeld and Gabriel_SG like this.
  17. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    60
    If AI Planner tutorials are still being discussed, and if domain modeling is something that we as game developers have to become skilled at, I might suggest adding this to your tutorials/docs as something to keep in mind. Certainly it would be nice to be able to have dynamic level elements which result in dynamic kinds of plans and situations. I'd be interested to know what kinds of practices are good and bad for domain modeling.
     
    Egil-Sandfeld likes this.
  18. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    That's a tad too restrictive for us. Any reason that makes our life better?
     
    JBR-games likes this.
  19. eterlan

    eterlan

    Joined:
    Sep 29, 2018
    Posts:
    72
    Hi, I configure a small scene mostly like Otto. I think I got the main idea, but it just can't run. What's the problem?
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.AI.Planner.DomainLanguage.TraitBased.PlanningDomainData`5+<>c[TObject,TStateKey,TStateData,TStateDataContext,TStateManager].<GetInitialState>b__12_1 (UnityEngine.AI.Planner.DomainLanguage.TraitBased.TraitObjectData t) (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/TraitBasedLanguage/PlanningDomainData.cs:82)
    System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToArray () (at <fbb5ed17eb6e46c680000f8910ebb50c>:0)
    System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <fbb5ed17eb6e46c680000f8910ebb50c>:0)
    UnityEngine.AI.Planner.DomainLanguage.TraitBased.PlanningDomainData`5[TObject,TStateKey,TStateData,TStateDataContext,TStateManager].GetInitialState (Unity.Entities.EntityManager entityManager, System.Collections.Generic.List`1[T] initialStateData) (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/TraitBased
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.AI.Planner.DomainLanguage.TraitBased.BaseAgent`10[TAgent,TObject,TStateKey,TStateData,TStateDataContext,TActionScheduler,THeuristic,TTerminationEvaluator,TStateManager,TActionKey].Update () (at Library/PackageCache/com.unity.ai.planner@0.1.1-preview/Runtime/Agent/BaseAgent.cs:273)
    Mu.Update () (at Assets/Scripts/Mu.cs:31)
     
  20. vincismurf

    vincismurf

    Joined:
    Feb 28, 2013
    Posts:
    192
    I have noticed that if you move the stations during the simulation Otto simply goes to it's original location.
     
  21. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    134
    The thing is that he's at 95% or so in rest ... (since he just got up from resting on bed) and even though hunger and thirst are both at below 20%, he choose to just sleep again instead of consuming the bottles/apples he has in his inventory.
     
  22. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    25
    It's simply a consequence of building our system on top of DOTS, which is moving to 2019.3. That said, DOTS is always improving, and our goal is to keep pace with new features that allow for better performance. Our next release, for example, will feature Burst-compiled parallel planning jobs.
     
    laurentlavigne likes this.
  23. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    25
    Hmm. It seems either that one of your objects doesn't have trait data or that one of the traits on the object has invalid trait data. Can you share more about how you set up your initial objects/traits?
     
  24. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    25
    Yes. It does not automatically update the state the planner/controller uses when you move objects around. You'll need to set the state with the updated position information on the controller for the planner to pick up the changes.
     
  25. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    OK I didn't know the planner is ECS. ECS makes life easier. I'll switch to 2019.3.
    And wow! multithreaded and burst compiled planner?! I can totally use that for my village. Do you you cut up the planning per agent?

    And tell me, it must be a challenge for you to do a planner cleanly. What I mean is GOAP usually creates strings to keep track of chains of actions during the planing process, strings I've seen produce a lot of allocations. How have you gone around those allocations?

    (could you put the zipped url for otto in the original post? I reinstalled my machine and when re setting unity I noticed this example project isn't in zip in the description of the post, others might want to bite in it)
     
    Last edited: Oct 15, 2019
  26. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    And speaking of Otto, I'm getting this in 2019.3b7
    upload_2019-10-14_18-28-6.png
     
  27. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    134
    I can't get AI Planner working in 2019.3.0b6 either.

    Note: Yes I read the documentation. Was testing 2019.3.0b6 for science. :)
     
    Last edited: Oct 15, 2019
    laurentlavigne likes this.
  28. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    25
    At the moment, each agent plans independently, so jobs for each can be scheduled in parallel. We also implemented an entirely new parallelized search algorithm, so in our next release, you'll see a multi-core benefit even for a single agent. In the following release, we're hoping to ship an experimental feature which allows a single planner to plan for multiple agents simultaneously, utilizing overlapping plans to save memory and computation time.

    Our code generation process outputs only job-friendly structs/native containers for state data, which lives in ECS, so we don't use any managed allocations for the data generated during the search process. It does limit which types we can use; for example, we are limited to fixed-length native strings rather than full strings. We do have a few managed allocations for the planner, controller, and agent classes, but they're relatively few.

    I'll add a link to the Otto repo. Thanks!
     
    laurentlavigne likes this.
  29. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    25
    Our next release will support 2019.3. It will likely land later this month. The current version supports 2019.2.
     
  30. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    Very interesting, thank you.
    And I didn't read all the doc so I didn't know it was generating code, the performance makes more sense now.
     
    Last edited: Oct 17, 2019
  31. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    Got it, is there a tool to visualize what the agent is thinking?
     
  32. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    134
    Here's where you find it.

    upload_2019-10-17_15-54-53.png
     
    laurentlavigne likes this.
  33. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    Got it thanks.

    Started reading the code, it's quite verbose for such a simple agent. Any plan to make it more terse? At least more readable would be good. Also comments please coz it might seem trivial to you devs but it reads like war and peace.

    also this :D
    upload_2019-10-17_18-58-34.png
    no red in the console so it doesn't seem to be slow by error spam.
     
    Last edited: Oct 18, 2019
    growling_egg likes this.
  34. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    25
    Which part(s)?
     
  35. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    2,050
    do you want everyone to come on board? then all of it :D
    After all, when you create a new script Update() and Start() get their comment.

    ex:
    before all declarations because unity has a new fashion in c#. It used to be simple stuff like void Update(), then it became the fashion of callbacks and now it's the fashion of whatever this stuff is called
    Code (CSharp):
    1. public class Otto : BaseAgent<Otto, DomainObject, StateEntityKey, StateData, StateDataContext, ActionScheduler, NeedHeuristic, TerminationEvaluator, StateManager, ActionKey>
    when I read this I'm like, uh what's that class doing? what are those types about? how does it work? how does it fit together and gets called? that's a lot of food to take at once, not good for digestion

    and a comment before
    Code (CSharp):
    1. #if PLANNER_ACTIONS_GENERATED
    stating where was it generated from (I think it gets generated from assets) just to get new people onboard.

    and in front of all these overrides
    Code (CSharp):
    1.     public override void BeginExecution(StateData state, ActionKey action, Otto actor)
    2.  
    most of it seems to be codegen, so just add documention inline, with a "Comment All" option on the codegen panel so when we're used to all that, training wheels off

    while I'm reading this code why do you use long and not unsigned int for need counter?
    Code (CSharp):
    1. public class ConsumeAction : OttoAction
    2. {
    3.     static readonly int k_Consumables = Animator.StringToHash("Consumables");
    4.     static readonly int k_EatFromPocket = Animator.StringToHash("EatFromPocket");
    5.     static readonly int k_DrinkFromPocket = Animator.StringToHash("DrinkFromPocket");
    6.  
    7.     ConsumableType m_ConsumableType;
    8.     NeedType       m_NeedType;
    9.     long           m_NeedReduction;
    and what's that? IOperationalAction
     
  36. mplantady_unity

    mplantady_unity

    Unity Technologies

    Joined:
    Jun 19, 2019
    Posts:
    11
    Hopefully, most of the code that you highlighted have been already simplified, and will be part of the new release, for example :
    - Instead of having to implement Operational Action interface, you can now use any methods as callbacks
    - No need to override a BaseAgent class anymore
    - More built-in actions, effects & rewards will be added for common use case (navigation...)

    Let us know your feedbacks after you tested this upcoming version, it's important for us to remove friction points for users.
     
  37. stuartiannaylor

    stuartiannaylor

    Joined:
    Oct 20, 2019
    Posts:
    9
    The ML stuff is really interesting.
    I was just wondering if Unity was doing anything with concepts of threat IE from differentiating safe from danger?
    I guess you could create your own threat system but having agent behavior either in a cooperative, neutral, or adversarial capacity is cool.
    Just wondered are these just example states and could be any such as defensive, neutral, or aggressive depending on what you place in a state list or are these more set in stone?
     
  38. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    I may be misunderstanding your question, but I can say that the planner is general purpose. So, it's definitely possible to create your own domain model that has modes of cooperative, neutral, or adversarial behavior, which could be specified in a state. Nothing at that level is set in stone.

    If I misunderstood your question can you give more context to what you were referring to?
     
  39. stuartiannaylor

    stuartiannaylor

    Joined:
    Oct 20, 2019
    Posts:
    9
    Don't worry as its me being a noob and just firing badly phrased questions.

    I watched one of the demo's where an agent would attack and then runaway if low on health.
    Which I presume is just a hardcoded state switch.

    I was just wondering with learning can it learn that more health than it is a threat, or I am outnumbered or they out gun me, from just prior training or is it all just like the above and hardcoded switches?
     
  40. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    60
    Hello, I just wondered how it's going? I feel like the big Unity announcements tend to skip over AI developments and it's one of the things I'm looking forward to the most.
    I remember we had discussed possible documentation/training enhancements awhile ago, is there anything new in the works regarding that?
    Also, are there upcoming changes to the Otto demo to look forward to?
     
    chenguohao likes this.
  41. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    Are you referring to an ML-Agents demo? I don't believe we've released or shown any demo for the AI Planner that has an agent that attacks.
     
  42. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    268
    I'll copy the response from the other (now locked) thread:
    We've begun the process of preparing our next release this week, so we're planning for a November release (probably somewhere during the middle of the month). However, we're also dependent on the next Entities package release, v0.2, which is going to be released soon.

    We'll have a new step-by-step guide for a first-time walk through. A video will be a nice-to-have, but I'm not sure we can commit to that yet.

    Otto will be updated to match with the new workflow changes, but no additional functionality will be added.
     
  43. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    40
    it would be nice to have a DOTS conversion-based workflow guide (code-based would also be great)
     
    mplantady_unity likes this.