Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Polarith AI (Free/Pro) | Movement, Pathfinding, Steering

Discussion in 'Assets and Asset Store' started by Polarith, Apr 18, 2017.

  1. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hey there.

    We currently go through a major rebranding. It seems that we put the new AI sites back online during the next week. Nothing to be afraid of. :)


    Martin Kirst from Polarith
     
    Inspeinre and Skorcho like this.
  2. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hey guys.

    Have you tested the performance cost on how many agents Polarith can run at the same time ( I am building an RTS and would like to have at least 50 - 60 agents at any given time roaming around)
     
  3. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @Censureret,

    50 - 60 agents is a feasible count when using load balancing provided by AIMPerformance.

    I want to point out a few things though. Context Steering is more complex than classic steering and can become somewhat expensive. The most important question you may ask is how many agents perceive each other. In your scenario, the worst case is 60 * 60 => 3600 interactions per update.

    Issues arising from these N-Body systems can be tackled by reducing the perception range of expansive behaviours and/or by using our LOD system. In short, keeping the interaction count low has a significant impact on performance.

    In the Pro package, we have an example scene with 500 agents. However, it is not assumed for this scene, that they are ever so tightly packed, that everyone sees everybody.
    You may evaluate the impact of reducing interactions with Polarith AI Free.


    Franz Pieper from Polarith
     
    Inspeinre likes this.
  4. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    hi there,
    looking for a post or example, or a hint, to start displaying, and eventually setting, polarith values using scripts, eventually these would end up on a unity UI element:
    ui radius = Aim seek radius...
    apologies for vagueness, and if it's a repeat question...
     
  5. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @BCFEGAmes,

    indeed I´m a bit puzzled.

    What I understood was the following. You need to implement some kind of UI that displays certain parameters of an agent. For example, a panel that enables the user to manipulate the radii of the selected agent via a slider or some sort. Am I correct?

    Let's take AIMSeek behaviour as an example. In the docs, you can see that there is no public field for radius or others. There is only Seek. This is because we separated our actual behaviour code from Unity´s components (because of multi-threading reasons back then). To bind the radii values of a Seek behaviour you can simply do so for theses parameters a public. To get the Unity behaviours you would, of course, use the GetComponent<AIMSeek> method.

    If misinterpreted your question or you need further details let me know.

    Franz Pieper from Polarith.
     
  6. Skorcho

    Skorcho

    Joined:
    Jul 1, 2013
    Posts:
    16
    that's the idea exactly! In some cases these parameters would be read only, to generate time series visualisations of the behaviour of an agent, in others, as you pointed out, there would be sliders and input involved.

    Some resource to have a good starting point to read and write these values would be very welcome!

    thanks in advance for your fast reply.
    Sergio.
     
  7. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @Skorcho,

    there are, of course, many approaches to manipulate such values. However, one method is to implement an auxiliary component like the following.

    Code (CSharp):
    1. public class SeekRadiusModifier : MonoBehaviour {
    2.  
    3.   public AIMSeek Seek;
    4.   public float OuterRadius = 10.0f;
    5.   // Use this for initialization
    6.   void Start () {
    7.  
    8.   }
    9.  
    10.   void Update()
    11.   {
    12.     SetSeekOuterRadius(OuterRadius);
    13.   }
    14.  
    15.   float GetSeekOuterRadius()
    16.   {
    17.     return Seek.RadiusSteeringBehaviour.OuterRadius;
    18.   }
    19.  
    20.   void SetSeekOuterRadius(float value)
    21.   {
    22.     Seek.RadiusSteeringBehaviour.OuterRadius = value;
    23.   }
    24. }
    The public OuterRadius can be bound to UI objects or stored by yet another component to visualize it.

    Franz Pieper from Polarith
     
    BCFEGAmes and Skorcho like this.
  8. SunnyValleyStudio

    SunnyValleyStudio

    Joined:
    Mar 24, 2017
    Posts:
    67
    Hi,
    I have just opened your asset in a new Unity 2020 URP project. Any example scene throws "TLS Allocator ALLOC_TEMP_THREAD" error and eventually crashes Unity.
    What is going on?
    Thanks,
    Peter

    Update.
    After it crashed Unity I have run it again and it works.
     

    Attached Files:

  9. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @SunnyValleyStudio,

    I am happy, you could make it work since we could not reproduce the error. It seems to be a known error in the Unity forums and reimporting/restarting seems the workaround.

    Best wishes,
    Martin 'Zetti' Zettwitz from Polarith
     
  10. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    151
    Hi Martin, we talked before. that was long time ago:). I finally bought the pro version. Really impressed by the documentation and the examples. I believe I will learn a lot from the asset to perfect my own space ai. Just a question, can you give any ETA of formation?
     
  11. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @lolaswift.

    Welcome to the glorious pro family :cool:
    *Disclaimer: unfortunately, this is not an announcement*
    In a perfect world, we would have already released new updates and the formation addon. In the real world, we are bound to our vital industry projects and try to develop Polarith AI besides. Sadly, most of the time there is not enough space to focus on our AI. But there is a ray of hope: one of our bigger projects is coming to an end, and thus, we plan to prepare an update for our AI during this fall. Additionally, we hope to find enough time to finally prepare the last parts(final merge, marketing videos, etc) of the formation addon. We hope to finish the addon between fall and the holiday season, though we can not promise.

    Thanks for all your patience and support until now,
    Martin 'Zetti' Zettwitz from Polarith.
     
  12. Skorcho

    Skorcho

    Joined:
    Jul 1, 2013
    Posts:
    16
    Hi there,

    Really enjoying having some time to progress with Polarith, while waiting for formation, and general update.

    I've come across something that might peak your interest, you're probably already aware of it:

    https://www.exyn.com/

    They're doing autonomous cave exploration using drones, right in your territory! I've had some good breakthrough today, as this is very slantly related to my research, using seek with a raycast assigned to danger, and close range flee for the walls. Avoid, because of the symmetry of it's results, is not that good at avoiding walls, I'll leave that for obstacles.

    I was wandering if you had any suggestions, to further reduce collisions. One of the features I'd like to get to, is the ability to use follow in complex environments, to get to target in a tunnell, but this creates the problem that sometimes the "cave" turns in the wrong direction to the target, and both the seek constrain and flee are not enough to avoid a wall collision.

    In a world where I have infinite time and resources, one would code proxy follow objects away from walls, when a cave is encountered, that would produce a path of nodes towards the final target.

    I thought I'd share, hope your full time project is going well, and you can return to Polarith soon!

    Take care,

    Sergio.

    upload_2020-9-8_14-25-39.png
     

    Attached Files:

  13. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @Skorcho,

    Great to hear from you. We are always excited about your research!
    Exyn is a very fascinating approach to cartography caves autonomously!

    Regarding your problem, if you do not already do it, try the velocity prediction. Additionally, you can try AIMPursue instead of AIMFollow.

    Curious greetings and have a great Wednesday,
    Martin 'Zetti' Zettwitz from Polarith.
     
    BCFEGAmes likes this.
  14. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    how does AIM's core algorithm compare to AI planner? seems they are same general decision making tools at the heart..
     
  15. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Hi @Polarith

    I'm just learning Polarith and I would like to use it on uneven terrain for my creatures. Is there something to prevent an agent from going down too steep slopes? To test I removed part of the ground in your example. How would one make the agent go around this hole?

    Thanks!

    upload_2020-9-30_22-6-0.png
     
  16. Skorcho

    Skorcho

    Joined:
    Jul 1, 2013
    Posts:
    16
    with Pro, you could use the AIM nav mesh to determine navigable areas, if using free, my best bet for a regular gap like that, would be to have a game object with no renderer, just the collider, and use avoid or flee, or passive avoidance on danger, set to the "invisible" obstacle...
     
    Polarith likes this.
  17. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @filod,

    I am very sorry for the delay. I was on vacation and we oversaw the notification mail for this post.
    AI planner uses decision trees as state machines. In contrast, our AI uses context steering, the underlying multi-criteria optimization, respectively. For more information about context steering have a look at our doc or this publication.

    Best wishes,
    Martin'Zetti' Zettwitz from Polarith.
     
  18. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @iddqd,

    As @Skorcho said. There is nothing to add :)

    Thanks and have a great day,
    Martin 'Zetti' Zettwitz from Polarith.
     
  19. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Thanks guys for the answer! I'll look into Navmesh generation.
     
    Polarith likes this.
  20. kypronite

    kypronite

    Joined:
    Apr 15, 2013
    Posts:
    21
    Hi polarith team,

    How do I finetune my target destination for each ai agent instead of setting all my target under interest layer.

    Let say this is RTS game I made, I select a group of enemy unity to move to destination that I click.
    And then select different enemy group to move to another destination.

    I want to be precise my target destination for my ai agent as I'm only using Polarith to move around obstacles.

    thanks :)
     
  21. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @kypronite,

    In general, you can easily do this by setting a different GameObjects for each group. In your case of an RTS, I would suggest using AIMFollow where you can set the TargetPosition of your mouse click.

    Have fun coding your game,
    Martin 'Zetti' Zettwitz from Polarith.
     
    kypronite likes this.
  22. kypronite

    kypronite

    Joined:
    Apr 15, 2013
    Posts:
    21
    I though so too, there must be an easier way that I never figured out yet,
    Just went back and check the example once more for AimFollow usage and can't believe how simple is it.

    thanks for fast reply:)
     
  23. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    Hello Polarith Team,

    I'm considering Polarith AI paid version for an upcoming project. I've downloaded the free package to familiarize myself with the tool and have had good luck so far. Documentation and examples are top notch!

    The last thing I am trying to figure out is how to get agent cars to follow a racing line (spline). I plan to setup the spline with 3 zones: brake, accelerate, neutral. I haven't seen anything in the Documentation or on this forum thread about using Polarith AI with splines. Can you point me in the right direction? 2D is all that is needed by the way.

    Thanks,
    Wes
     
  24. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @nikescar,

    Polarith AI does not support splines out of the box since we work with linear paths as target directions. The more natural spline behaviour comes automatically by the physics of the controller. However, if you want to use splines, several ways are possible. First, you could implement your own implementation of pathfollowing that supports splines instead of linear paths, but that would be tough though and I think over the top since too many waypoints are created(infinitely many if you do not sample down). Alternatively, I highly recommend doing the same thing nearly every computer graphics tool does: spline interpolation. You have to 'approximate' the spline by several sub steps along the spline that in total form a linear path. That path can be passed to our AI as usual. For more information have a look at the De Casteljau algorithm. It's a great algorithm and fairly easy to implement.

    Have fun mastering the splines,
    Martin 'Zetti' Zettwitz from Polarith
     
    Inspeinre likes this.
  25. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    Are you going to support Unity 2019.3+ ? seems i can't get things work when i enable "Enter Play Mode Settings " with "Reload Domian" off.
     
  26. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @filod,

    We do support Unity 2019.3 and got no reports about problems with Unity 2020. Though we do not support the full feature set of each new release since these often come with major code impacts that need a huge rewrite of our codebase.
    I put this on our issues on Github, so we can have a look at this in a future release.

    Best wishes,
    Martin 'Zetti' Zettwitz from Polarith
     
    filod likes this.
  27. Skorcho

    Skorcho

    Joined:
    Jul 1, 2013
    Posts:
    16
    Hi Polarith team,

    One more quick question, in 3D Avoid, or any behavior dependant on environment, is there a suggested way to prioritize a plane of avoidance, or use something similar to Sensitivity Offset, but targeted at 3D, so that one could get results that are either on a horizontal or vertical plane? EG avoid all obstacles by going around, avoid terrain by going up, avoid overhangs by going down? I have a feeling it would be something done at the controller level, or by tagging and using different behaviors, but just thought I'd ask!

    Have a good weekend...
     
  28. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @Skorcho,

    Your feeling is right, that would be down to the controller level or a combination of behaviours. If performance is not a big deal, you can try to combine custom raycast behaviours with different conic angeles. Additionally, you can try to combine multiple contexts with different sensors (3D and additional vertical 2D e.g.) but you would have to deal with the plain projection. So propably, the raycasts maybe the most promising.

    I am curious about the results!
    Martin 'Zetti' Zettwitz from Polarith.
     
    BCFEGAmes likes this.
  29. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    i've found a possible bug:
    when i use Arrive(+target) and Seek(+SteeringPerceiver), target's(which is player object) transform will jitter, seems polarith is writing to transform (which it shouldn't)
     
  30. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @filod,

    Can you please send us a minimal example scene at support@polarith.com?

    Greetings,
    Martin 'Zetti' Zettwitz from Polarith.
     
  31. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    oh, btw i use unity 2020.2, maybe related to this. i'll try to reproduce this in a minimal scene later
     
  32. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    Last edited: Nov 18, 2020
  33. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Happy you found the problem. Feel free to ask if you have more questions.

    Martin 'Zetti' Zettwitz from Polarith
     
  34. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    my question is of course "how do i solve this"... i do need to change rotation, polarith shouldn't write to transform anyway, as i said
     
  35. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Oh, I am sorry, it sounds like you could fix it. I'll have a look at your example scene. I didn't see your last edit with the link before I was posting my answer.

    Best wishes,
    Martin 'Zetti' Zettwitz from Polarith.
     
  36. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    @filod,

    I have investigated your scene, but I can't reproduce the error. Neither with 2020.1 nor 2020.2. The object rotates/jitters the whole time, no matter what I do with the AI object.
    Additionally, neither we nor any customer reported an issue with this very common combination of behaviour and controller.
    For further questions, please email me support@polarith.com since this goes into detail.

    Best wishes,
    Martin 'Zetti' Zettwitz from Polarith.
     
  37. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    i uploaded a video which demonstrating the jittering (use the scene i uploaded above + polarith free version in assetstore)

     
  38. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Thanks for the video.

    I was focused on the rotation (that of course, jitters due to the random rotation) and not on the linear translation that I have to perform manually.
    Unfortunately, this problem is based on Unity since afaik there is no way to obtain object-oriented bounds without rotating the object. We provide a fix for this by attaching AIMSteeringTag with 'Ignore Local Bounds' to the affected object.

    Have a great Friday,
    Martin 'Zetti' Zettwitz from Polarith.
     
  39. filod

    filod

    Joined:
    Oct 3, 2015
    Posts:
    223
    Great , this works for me, thank you !
     
    BCFEGAmes likes this.
  40. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    Hey Guys,
    I know these questions can be annoying, but what is the likelihood of a Polarith Xmas present of a new release?!? It would look great, formations spinning around the tree , avoiding the decorations!
     
  41. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @BCFEGAmes,

    I hope to find some time during vacation to prepare an update, though I can't promise since we have deadlines in other projects. Currently, it's a 50/50 chance.

    Looking forward,
    Martin 'Zetti' Zettwitz from Polarith.
     
    filod and Skorcho like this.
  42. cubemap

    cubemap

    Joined:
    May 13, 2016
    Posts:
    5
    Hello People, I am struggling. :/

    With Polarith PRO in 3D, what is the best way to contain wandering (flying) agents in a defined area/box?

    Please advise...
     
  43. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    the two are not related as such, you could add a low value attraction to a center area, with follow or chase, or add either a passive danger on the sides of a containment mesh, or active avoidance, ideally both! If you're programming, you could modulate the wander to "containment" behaviours multipliers based on distance to a centre, or based on proximity to a border. A more accurate containment behaviour would be welcome, but you also might need to go at a lower level, if you want your agent to collide with walls, and not cross them under any circumstances driven by AIM behaviours!
     
    Polarith likes this.
  44. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @cubemap,

    Thanks @BCFEGAmes, there is just little to add. The most convenient way (with a radius instead of a box) would be a Seek (follow has no radius) to the center such that the further you are away the more interest is added. You can play around with multipliers, radius mapping (e.g. linear), and value writing.
    Another option could use a script that deactivates wander and if you are outside of a predefined box and activates follow to the center for a few seconds (or if a predefined inner radius is passed).

    Best wishes and stay safe,
    Martin 'Zetti' Zettwitz from Polarith.
     
    jmacgill likes this.
  45. cubemap

    cubemap

    Joined:
    May 13, 2016
    Posts:
    5
    @Polarith thank you for your swift reply, that will work for my usecase. :)
     
    Polarith likes this.
  46. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    hi there,
    happy Holidays, and a merry new year!
    hope all is going well with your deadlines, I was wondering if you would be willing to share a few of your experimental raycast solutions on the git-hub or elsewhere. I've deployed a few models based on the "seek ground" script that you provide, and made a forward looking raycast, and one with 6 directional rays, to cover up down, left right, and forward back, but I know there are many other things to try, and better integration with the 3D sensors mapping.
    One problem I seem to have is that the forward facing ray used in avoid, looses sight of the obstacle once avoidance takes place (since the ray turns with the agent) and then the seek behaviour takes priority and the agent steers back towards the obstacle, which normally ends up in the agent going through the obstacle...
    thanks for your time!
     
  47. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @BCFEGAmes,

    We wish you (and all the other guys) a happy and most important, healthy new year.
    The source code of our SeekGround script is already part of the package - I guess you want to share your results? :) In this case, we would be happy to host it.
    To your problem: first, we need to clarify the idea of your script. Avoid in our terms means an active avoidance by setting interest in the direction the agent needs to avoid (e.g. 90° angle to the surface normal, i.e. parallel). Our SeekGround usually works with passive avoidance using danger. However, what should work in both cases is the same we do in our script: if going out of sight, store the last position of the ray hit. This way, you keep the obstacle in memory and you can process the position (which is nice since is it moves away from the agent, and thus, the objective values become smaller).
    Another idea from computer vision: adaptive raycasts. If your primary ray hits, you cast additional rays around the hit point.

    Have a great start into the new year,
    Martin 'Zetti' Zettwitz from Polarith.
     
  48. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    hi Martin,
    Thanks for the reply, the seek ground script has been very helpful, I was actually fishing for more existing scripts like it that you guys might be willing to share! In conversations you mentioned many experiments with ray casting, and being lazy I was asking for the scripts :) conical, spherical, etc.
    I'll need to look at the stored position implementation better, and the adaptive raycast sounds great, as it would get more nuanced details on the shape of the obstacle!
     
  49. Polarith

    Polarith

    Joined:
    Nov 22, 2016
    Posts:
    315
    Hi @BCFEGAmes,

    Unfortunately, we do not have any other scripts:oops: We would upload all helpful scripts if we had any. The talks here in the forum were just of theoretical nature (scientists, duh). Cones and spheres would be pretty simple since you just need to sample points on circles, spheres respectively. I am pretty sure, Unity will provide something like this. For spheres, you may use our Spherical Sensor since it should be placed around the origin and the receptor positions should be accessible.

    Best,
    Martin 'Zetti' Zettwitz from Polarith.
     
  50. BCFEGAmes

    BCFEGAmes

    Joined:
    Oct 5, 2016
    Posts:
    36
    using the sensor as a raycast "scaffolding" is something I've been thinking about, would anyone at Polarith have a few minutes to point in the right direction from a coding point of view?!? Always productive conversations on this thread!!!