Search Unity

  1. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice

AI Planner - v0.2-preview released

Discussion in 'AI & Navigation Previews' started by amirebrahimi_unity, Dec 7, 2019.

  1. PaulUsul

    PaulUsul

    Joined:
    Nov 20, 2012
    Posts:
    29
  2. eugolana

    eugolana

    Joined:
    Mar 27, 2019
    Posts:
    6
    Is there a recommended way to update a Decision Controller's 'worldObjectQuery' at runtime? I'm working with many agents, each with their own decision controller. I want each to include their own 'house' in their world query once they acquire it.

    Similarly, I was thinking of expanging the search radius if an agent can't find what it's looking for.

    Thanks again
     
  3. Curlyone

    Curlyone

    Joined:
    Mar 15, 2018
    Posts:
    41
    Is it possible to use AI Planner in ECS ?
     
  4. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    375
    For starters, if you have a specific object that you only want included by a single decision controller, then you have a few options:
    • Set Local Objects on the decision controller
    • Set a World Query to "From Object" and select the object you want (you'll have to set other constraints with traits, so that other decision controllers don't pick up the same house)
    upload_2020-1-29_9-48-45.png

    Re: updating the state of the planner. You have two options:
    • Automatically when an action completes by setting the Next State Update field in the decision controller to "Use World State"
    • Manually, outside of action completion by updating the traits on your GameObject's TraitComponent.GetTraitData<>.SetValue and then forcing an update to the planner state with IDecisionController.UpdateStateWithWorldQuery:
      https://docs.unity3d.com/Packages/c...I.Planner.Controller.IDecisionController.html
     

    Attached Files:

  5. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    375
    TrevorUnity likes this.
  6. Roycon

    Roycon

    Joined:
    Jul 10, 2012
    Posts:
    50
    Awesome work guys :)

    Can't wait to integrate this into my game I think it would be perfect
    Any ETA on pure ECS? Even a preview?
    Or tips on how to do it myself? I'm guessing setting up a hybrid ECS to GameObjects (AI components) would be easiest?
    You say months earlier and if thats still the case I'll hold off on developing my own complex AI or trying to integrate it with ECS myself
     
  7. eugolana

    eugolana

    Joined:
    Mar 27, 2019
    Posts:
    6
    Thanks for your response, but either you misunderstood me or I'm misunderdstanding you.

    I would like to add the 'From Object' to world query while through script as the game is running, not through the editor. I worked out an alternative for the time being using a trait on my Agent's TraitComponent.

    I've been having another issue, which may be a bug. An action, 'GoToWork' doesn't seem to be updating the planner state, meaning my agent plans to 'GoToWork' repeatedly, slowing everything down. As you can see in the screenshot., my Plan Size is only 3 but the 'Max Plan Depth' is 55. The same action leads to the same state leads to the same action ad infinitum. Despite me using a Max Plan Size of 25, there is only one state so there seems to be no limit on plan depth. Once the action is carried out, the world state updates correctly
    and things continue as they should, but while an agent is 'going to work', my frame rate drops from around 250 to 20 or thereabouts, as it processes the endless loop.

    In the screenshot I've included both the Plan Visualiser, the state data, and the planner action
    GoToWorkinfinity.png
     
  8. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Pure DOTS/ECS compatibility is one of our top priority features, but we don't have a firm ETA yet. Hopefully March/April.

    A hybrid approach would likely be the least amount effort to get working. Otherwise, you'd need to build DOTS systems for state monitoring, plan execution, each of the individual actions to be executed, as well as holding the live game state trait/object data (currently held on game object components).
     
    Roycon likes this.
  9. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Hmmmmm. Seems like it could be a bug. Would you mind sharing your project with us (either here or through private conversation)?
     
    Last edited: Feb 10, 2020
  10. Delphic_

    Delphic_

    Joined:
    Apr 23, 2018
    Posts:
    36
    found a little bug, i called a Int Field in a Trait "Amount", this causes an Error i guess because there is already a var with the same name (?)

    i wonder if its possible to access Trait values by code?
    Also generate Traits and Plans and so on at runtime ?

    Also i wonder how to do this, for example.
    I have a Trait int Food = 0.
    I have the Trait bool Hunger = true
    then i have an Action Eat it has an effect Food += 1
    and then i want to have an Effect where i can say If Food == 10 then modify Hunger = true.
    And then i can use Hunger == false as a Precondition.

    and i think it should work like this ?
    Atm i could only set a Precondition Food <= 10 or something to make it stop when satisfied ?
    Im still new to this trying to figure it out :)
    thx
     
  11. mplantady_unity

    mplantady_unity

    Unity Technologies

    Joined:
    Jun 19, 2019
    Posts:
    37
    Can you post the exact error you get with the Int field ?
    We fixed an issue with int32 recently, so you could test to use int64 (long) in case it fixes your problem, until a newer package version is published.

    You can access Trait value of a TraitComponent by code, by doing something like this:
    var myTraitComponent = GetComponent<ITraitBasedObjectData>();
    myTraitComponent.GetValue(TraitTypeName.FieldName);

    One way to do it is by having a precondition that check your Food value like you said.
    In this case the boolean Hunger trait is not really useful, because you already have a way to express it with the food value.

    And if you want the value to be more dynamic than having 10 repeated in all your actions, you could create a global object with a trait "HungerSatisfaction" that you initialize to 10 and use it in preconditions: "Food <= HungerSatisfaction"
     
  12. khalid_unity977

    khalid_unity977

    Joined:
    Sep 10, 2017
    Posts:
    25
    Getting
    Code (CSharp):
    1. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    when running the Escape Room Sample on 2019.3.0f6.
     
  13. Lucidish

    Lucidish

    Joined:
    Oct 22, 2015
    Posts:
    4
    I'm attempting to create a modular Eat action where the value recieved from the action is modulated by the animal's food type preference values.

    So, something along the lines of this:

    Enum Trait: EFoodType containing members Grass, Bush, Meat, Etc
    Trait FoodType with EFoodType field named "Type"
    Float Trait FoodPreference containing members Grass, Bush, Meat with associated values such as 1, 0.3, 0.05.
    Float Trait FoodValue with a value of X that varies depending on the plant.

    The Eat action in the Effects Modified section would do something like this:
    Agent.Hunger -= Food.FoodValue * MatchedValueOf(FoodType.Type, FoodPreference.Type)

    So the result if the animal ate Grass would be a value of 1 or a value of 0.05 in the case of eating meat. Where as another animal would recieve a value of 1 for Meat and 0 for Grass etc.

    What would be a good way to go about this? I don't wish to lock off the other potential food types from being considered by doing a FoodType == FoodType in the precondition, just modulate the recieved value based on a preference.

    I'm probably missing something absurdly obvious but the only approach I've come up with is to create duplicate eat actions for each plant and animal type, but that seems less than great as well.

    Also, it seems like it might be useful to have additional operands in the effects section such as *=.
     
  14. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    375
    Yes, this happens due to some constraints in the allocators because we make use of long-running jobs. Once the planner ends up being Burst-compiled these warnings go away because the jobs complete before 4 frames. We'll look into this further to avoid spamming the console.
     
  15. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    375
    Thanks for the suggestion of the operand. I've added it, so it will be in the next release.

    Re: your domain, I think you're on the right path, but I wasn't clear with your description whether FoodPreference is a trait that has a FoodType and a value multiplier field (e.g. FoodMultiplier). If not, then I'd suggest that that is what you add to the FoodPreference trait.

    This will be an odd way to model the domain, but it's similar to an inventory. Until we support something like collections your food preferences will need to be "free-floating". Think of having 3 (or N for the number of FoodTypes) trait-based objects called AgentGrassPreference, AgentBushPreference, AgentMeatPreference, etc.

    On each of those objects, you'd have the multiplier in the float field for that trait. Then in your action parameters you'd create a 'foodPreference' parameter for an object that has the FoodPreference trait.

    In the preconditions you'd simply make sure that
    foodPreference.FoodType == food.FoodType

    Unfortunately, we don't have temporaries, so I'd suggest adding a scratch float field to foodPreference, so you could do the following:
    foodPreference.FinalFoodValue = food.FoodValue
    foodPreference.FinalFoodValue *= foodPreference.FoodMultiplier (once this becomes available)
    Agent.Hunger -= foodPreference.FinalFoodValue

    This would also be a good place for a CustomActionEffect if you want to write one:
    https://docs.unity3d.com/Packages/com.unity.ai.planner@0.2/manual/CustomPlannerExtensions.html

    Does this help?
     
  16. avief

    avief

    Joined:
    Feb 13, 2020
    Posts:
    1
    is the value of trait parameter can be accessed in decision controller action callback?. or it must be do in someway?.
    i have already try this

    Code (CSharp):
    1. var myTraitComponent = GetComponent<ITraitBasedObjectData>();
    2. myTraitComponent.GetValue(TraitTypeName.FieldName);
    but it return default value of the parameters, it must be updated right?. because i have already set the value will be modified in action effects.
     
  17. Delphic_

    Delphic_

    Joined:
    Apr 23, 2018
    Posts:
    36
    This is what i get when i name an int32 "Amount", its fine when i name it "amount" or something else.
    And it points to this line in SetField(): Amount = (System.Int32)value;

     
  18. Delphic_

    Delphic_

    Joined:
    Apr 23, 2018
    Posts:
    36
    Hey Mplantady thx for your help !
    I tried the first version wich is having a fixed value = 10 in the precondition, this works, thanks!
    But when i make a Trait i.e. "Satisfaction" i set its basic value to 10 (i also added it to my agent trait component, and in the action parameters) and then i ask for it in the preconditon "Food"< "Satisfaction" nothing happens.
    In the visualizer it shows only the first Node.
    Or is there another way to make a "global object" like you said?

    Another question i have is there a way to make Actions take a certain time?
    In my game i was trying something similar to this project, but im by far not yet as good of a coder, wich is why i love this project :) . But there i had callbacks for start/mid/end of an action and also a time defined and also then it could choose a path of actions not only by shortest nodes but also by shortest time? On the other hand it makes sense to make it all with preconditions, its done when its done. But there must be a way to wait a certain time i.e. a cooldown after an attack ?
     
  19. Lucidish

    Lucidish

    Joined:
    Oct 22, 2015
    Posts:
    4
    Thanks amirebrahimi, that is a helpful suggestion for working around the lack of collections for now. And yup, that is how I setup the FoodPreferences. I'll look into the custom actions. Thanks!
     
  20. amirebrahimi_unity

    amirebrahimi_unity

    Unity Technologies

    Joined:
    Aug 12, 2015
    Posts:
    375
    If you are asking about how to get the updated value of a trait coming from the planner through an action, then take a look at the Player prefab in the Match 3 sample. It makes use of the Cell trait coming back from the SwapRight and SwapUp actions: https://github.com/Unity-Technologi...ob/master/Match3/Assets/Scripts/Player.cs#L80

    Hope that helps.
     
  21. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    80
    I think I need a hand understanding the Cost/Rewards piece of AI Planner. I'm sure it's logical, but it seems kind of arbitrary in my mind. What does it mean if I give an action a reward value of 1? What does 1 mean? Is there a unit? If I have two characters with two different goals, but they're considering the same set of actions, what reward are they "thinking" of, if that makes sense? Thanks!
     
    Lucidish likes this.
  22. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    This is a great question, one I hope to address in a very lengthy blog post in the near future. For now, I'll give a concise but hopefully clear answer.

    The costs/rewards in our system are a representation of "utility" (see: utility theory), which is nothing more than a numeric, unitless representation of preference. It allows the search algorithm to evaluate plans and order them according to these values. Specifically, the plans are given a total reward/cost, which is the (discounted) sum of the costs/rewards of each individual action over the course of the plan.

    Now, a unitless value can be difficult to reason about. However, a common practice is to map real values from your game into these costs/rewards. For example, if your game has a concept of "score" that you'd like to optimize, it would be natural to set the reward equal to the score given for a particular action, whether it be reaching a destination or destroying an enemy. Where this becomes complicated is in scenarios in which you'd like an agent to balance multiple objectives that don't have easily comparable values. Consider a Mario-style platformer. You may want an agent to collect coins but also to reach the end as quickly as possible. How do you map the comparison of collecting coins vs saving time into a singular value representation (rewards)? Is collecting a single coin worth sacrificing a few seconds to take a detour? What about 10 coins? Similarly, when assigning reward values to discrete events (e.g. consuming a potion), is each event of the same type equal in value? In many cases, consuming a potion while at low health is far more important than consuming one at full health.

    Ultimately, the process of mapping game mechanics to a generic cost/reward is a detail of the application domain, and the choices made in assigning these rewards are a tool for the user to affect the plans returned by the planning system. It is not always intuitive, and we are considering how best to help educate users on this front. Perhaps after GDC we'll record a tutorial showing how the choices in costs/rewards can be used to direct the search toward desirable behaviors.
     
  23. growling_egg

    growling_egg

    Joined:
    Sep 2, 2012
    Posts:
    80
    Super helpful! Thank you, look forward to your blog post! As for recommended/best practice, would it be fair to say I would just want to make sure the values relative to each other are as accurate as I can guess (ie: it's more important to get to the goal than to get coins, but exactly how much more is a little bit of an art), then test it out, and tweak the values from there?
     
  24. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Absolutely. For now, tweaking values exploring the ranking of decisions within the plan visualizer is your best bet. I'll also add that if your plans are more goal-driven (i.e. trying to get to some specific goal state), be sure to make use of terminal rewards (assigned on State Termination Definitions). You can use this as a final "bonus" reward or penalty for reaching the terminal state, depending on whether the outcome is desirable or not.
     
    growling_egg likes this.
  25. Lucidish

    Lucidish

    Joined:
    Oct 22, 2015
    Posts:
    4
    Thank you for the additional info Trevor, it is useful and I look forward to the blog post.

    Regarding the use of the utility approach in AI Planner; one of the nicer aspects of a utility based ai is the non-linear nature of the responses. Is that currently driven by the rewards heuristic or is there a good way of modeling that now?

    Also, when considering an action, does the current basic heuristic take the trait effect modifiers into account or is it solely driven by the action reward value?

    A few random things I found myself wanting while working with the system:
    • Line of sight based object filtering.
    • From collection object filtering.
    • Action duration
    • Effect modifier utilizing duration
    • Add trait @ action start (i.e. in use)
    • Remove trait at action end. (I understand there is the ability to add the group bit so perhaps that is the preferred flow)
    • Simultaneous or stacked actions (i.e. multi-tasking ala Sims4)
    • Effect utility modifier
    • Add/Remove conditions
    • Reward utility modifiers
    • Multiple, potentially competing, plans.
    • Near comparison (as opposed to == ) for vector based comparison.
    I understand that some of the above may be more project specific extensions that the end user is expected to make but thought I'd toss them out just in case.

    Pretty neat and solid system so far, really looking forward to the future updates.
     
    eugolana likes this.
  26. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    You can absolutely create a non-linear utility function using custom rewards and a custom heuristic. For more info, see: https://docs.unity3d.com/Packages/com.unity.ai.planner@0.2/manual/CustomPlannerExtensions.html

    The choice of an action is made by considering the cumulative future reward, which covers the immediate action's reward, the reward of all actions beyond the immediate action through the end of the incomplete plan, and the heuristic estimate of the reward to be gained beyond the incomplete plan.

    When the search has completed a plan, the action selected is the one that leads down the path of the highest reward/minimal cost.

    That's quite a list! Some of these (utility modifiers, conditions) can be done through the custom planner extensions (link above). I'll make a note of the others for our feature requests. Thanks!
     
    eugolana and Lucidish like this.
  27. Lucidish

    Lucidish

    Joined:
    Oct 22, 2015
    Posts:
    4
    Fantastic, thank you for the additional information!
     
  28. sam_unity266

    sam_unity266

    Joined:
    Nov 5, 2018
    Posts:
    5
    Is there any updates on when the ECS version of this will be out? Last comment mentioned it was on the pre-GDC roadmap. Thanks.
     
  29. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Despite GDC being cancelled, we are still planning a release this month. However, it won't include full DOTS/ECS support quite yet. We've decided to split our release into multiple, smaller scope releases. Our imminent release will focus on usability and bug fixes; DOTS support is now planned for a late April release. Here's a short preview of where we are in the process:

    There are two components of our package that require changing. First, the backing storage for the live game state will be moved to ECS (currently, only the simulated plan states use ECS). @amirebrahimi_unity has developed a working version of this, but we will need a few weeks to work with a few other teams internally as well as to test and finalize the changes. Secondly, we are working on nailing down the best pattern for executing plans in pure DOTS projects. This will likely be our highest priority feature once we have pushed out our March release. Luckily, I believe this to be the easier/smaller scope change of the two.
     
    Kender, PaulUsul, Delphic_ and 3 others like this.
  30. sam_unity266

    sam_unity266

    Joined:
    Nov 5, 2018
    Posts:
    5
    Sounds good. Thanks for the update.
     
  31. sam_unity266

    sam_unity266

    Joined:
    Nov 5, 2018
    Posts:
    5
    Hello @TrevorUnity . Are you guys still on track for the DOTS release this month? Thanks.
     
  32. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Full DOTS support has been postponed due to other, higher priority features. As the bulk of our users work with GameObjects/MonoBehaviours, we're focusing more on the usability/extensibility of our tools for the immediate time. Fortunately, some of the work coming in our next releases will enable users to build their own DOTS-compatible modules, but it will put more of the work on the users to do so rather than provide an official solution, for the time being.
     
    Lagermeister and Djayp like this.
  33. sam_unity266

    sam_unity266

    Joined:
    Nov 5, 2018
    Posts:
    5
    Appreciate the prompt response. We are trying to plan around integration with the AI Planner and using DOTS for us is a must for performance reasons. Is there a time table on this newest release or some way we could start building our own DOTS modules today in preparation? We really like the tech for our game. Thanks again.
     
  34. mplantady_unity

    mplantady_unity

    Unity Technologies

    Joined:
    Jun 19, 2019
    Posts:
    37
    We don't have a date for this release yet.
    Can you give more details about your project and what you try to achieve with the AI Planner ?
     
  35. sam_unity266

    sam_unity266

    Joined:
    Nov 5, 2018
    Posts:
    5
    Responded via PM.
     
  36. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Today we are releasing a new version of the package, 0.2.3-preview.1. This release primarily focuses on bug fixes and stability. The team has been hard at working making significant changes behind the scenes which will enable us to make the package more modular and extensible. I know that many of you are waiting for those features, and we are working closely with internal customers who have early previews of the new functionality. The early feedback has identified a few key areas on which we are currently iterating to ensure greater usability and clarity for our userbase.

    As a note, we have updated our dependency on the Entities package to 0.9.1, not to the current latest version, 0.10.0. While our goal is to keep the AI Planner package up to date with our dependencies, the latest Entities version introduced some changes that are not compatible with our planning jobs. We are in active discussions with the team on how best to address the issue. As soon as we have a fix, we will update our package with the latest Entities release.

    Additionally, if you are upgrading a project built with an older version of the AI Planner package, you may experience type errors due to a few refactors we have made. Be sure to delete previously generated code, update your enum/trait/action/plan definitions (which will show red errors for incorrect types), and then regenerate your code. For most instances, you will need to clear the type field, then reselect the type. The newly generated code will be found under "Packages/Generated.AI.Planner.*".

    The documentation and the samples repository will be updated shortly. As always, ask any questions you have here.
     
  37. StefanoCecere

    StefanoCecere

    Joined:
    Jun 10, 2011
    Posts:
    192
    yes please!
     
    eugolana likes this.
  38. FlavioB

    FlavioB

    Joined:
    May 26, 2020
    Posts:
    5
    Hallo
    AI planner does not appear in the package manager
    how can I install it?
    Do I need some licence upgade for the planner?
    I have unity 2019.3

    Thanks
     
  39. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Did you enable viewing preview packages (Advanced -> Show preview packages)?
     
  40. FlavioB

    FlavioB

    Joined:
    May 26, 2020
    Posts:
    5
    Hallo
    Ah ok that was the problem thanks!
    I will try to apply it not to a game but to an industrial environment simulation
    I am very curious to see the performance
    btw Great idea to offer a planner for games!

    Flavio
     
  41. FlavioB

    FlavioB

    Joined:
    May 26, 2020
    Posts:
    5
    Hallo
    I tried to setup a simple scene where a cube can move on an grid of locations controlled by the AI Planner.
    I can build the game as an exe file and it runs(even if cube does not move for some reason)
    The problem is that if I try to play it inside the editor I got this message here

    upload_2020-6-4_22-29-47.png

    Something in the generated code went wrong

    Tried the following:
    -remove the 'Temp' folder
    -remove the 'obj' folder
    -close and restart Unity and visual studio

    I am using
    Unity Version 2019.3.10f1
    AI Planner Version 0.2.3

    Any Idea?
    Thanks!
    upload_2020-6-4_22-29-47.png upload_2020-6-4_22-29-47.png
     
  42. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Hi @FlavioB!

    Have you tried removing the generated code folders and regenerating the code? Can you share the project?
     
  43. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    5,811
    Hi guys, question: is there any plan to bring this package up to 2020 beta or even alpha territory? I'm planning to work on an early prototype (4X civ-like game with a couple of twists and different setting, different themes and all), I would start to use full DOTS spectrum and the Hybrid Renderer V2 with URP support.
    It would be awesome to include the AI planner too.
    I will play around with it with lesser versions, obviously, but is there any rough timeline what can I expect?
    And obviously I'm not talking about production ready state by any means, only preview.

    Currently I'm getting this error trying Planner 0.2.3-p1 with Entities 0.11,0-p7 and on 2020.0a13.
    Library\PackageCache\com.unity.ai.planner@0.2.3-preview.1\Runtime\Controller\BaseTraitBasedPlanExecutor.cs(114,91): error CS0117: 'ScriptBehaviourUpdateOrder' does not contain a definition for 'CurrentPlayerLoop'

    I guess this is expected.
     
  44. FlavioB

    FlavioB

    Joined:
    May 26, 2020
    Posts:
    5
    Hallo Trevor
    I removed all the generated .prj project files but no luck.
    I noticed it is not regenerating them by the way, I guess the process stops before the generation....

    The project is here
    https://github.com/FlavioBortolan/ai-planner-samples/tree/master/Planner 7

    Thanks!
     
  45. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    Yes, we will likely move to 2020.1 with our next feature release. Stay tuned!
     
    Lurking-Ninja likes this.
  46. TrevorUnity

    TrevorUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    101
    I found the issue. The names of your traits, specifically "i" and "j", caused conflicts with index variables in our code gen template. I'll open an issue to try to refactor the code gen vars to less common names, but I'll also suggest more descriptive names for your traits as a near-term fix. I was able to generate the code without issue upon renaming the traits (i -> iTrait, j -> jTrait) and restarting Unity (need to reset cached typenames).

    Let me know if that does not fix the issue for you!
     
  47. FlavioB

    FlavioB

    Joined:
    May 26, 2020
    Posts:
    5
    Thanks a lot
    Now compilers errors have gone
    Let's see if I manage to get the cube to its destination:)
    Thanks
    Flavio
     
    TrevorUnity likes this.
  48. wilgieseler

    wilgieseler

    Joined:
    Oct 17, 2013
    Posts:
    7
    Hi there, we're really interested in using AI Planner but have a couple of questions we couldn't figure out:

    Our game involves subjective world state – each AI has their own memories of the world state, and they only actually interact with the real world when they can (for example) visually confirm the object is where they thought it was located. So all the AI decisions are made based on the agent's memory (a custom data structure we have), not the ground truth of the state of GameObjects.

    Is there a way to implement that with AI Planner? Perhaps with some kind of special World Query?

    Also, we are hoping to use ECS for this as we would like to simulate 500-1000 agents simultaneously, is AI Planner designed to handle that? In theory, our search space for each individual AI is relatively limited.

    Thanks!
     
  49. mplantady_unity

    mplantady_unity

    Unity Technologies

    Joined:
    Jun 19, 2019
    Posts:
    37
    It is in our roadmap to handle this case by using agent perception/memory to feed the Planner state instead of only the real world data.
    In the meantime it should be possible to do that using special traits & queries, it would mean to manage/update trait objects in the world to simulate agent memory and filter them for the correct agent.

    We are just moving world traits to ECS: a Trait basically become a ComponentData with some special authoring tools to manage them on objects.
    It should help to scale the usage of the Planner, but in your case you would also certainly need some sort of custom load balancer to only update agents plan when needed.
     
    Last edited: Jun 11, 2020
    vx4 likes this.
  50. Roycon

    Roycon

    Joined:
    Jul 10, 2012
    Posts:
    50
    Does the Planner use the job system? or is it planned?
    I would love to use it but I'm aiming for a LARGE scale rts with DOTS
    Some sort of load ballencer will probably help, but being able to schedule the planner as a job (which is able to take a few frames) would probably be necessary
     
unityunity