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

Suggestion for surrounding enemies

Discussion in 'ML-Agents' started by MrOCW, May 6, 2021.

  1. MrOCW

    MrOCW

    Joined:
    Feb 16, 2021
    Posts:
    51
    Hi everyone, I am trying to create a game where the player have allies that know how to surround an enemy to prevent it from escaping. Is MA-POCA the ideal way to go about doing this?
    I tried using simple methods like using vectorobs regarding information between every ally and enemy together with rayperception for avoiding walls, but my allies are just barely moving around and staying quite stationary. my reward function is such that the agents get positive rewards for being near an enemy and negative rewards for colliding with anything else.

    Does anyone have any suggestions to share?
     
  2. mahon123

    mahon123

    Unity Technologies

    Joined:
    Feb 9, 2021
    Posts:
    13
    Hi,

    In general cooperative behaviours need more tuning due to nature of the problem and MA-POCA is a novel multi-agent algorithm that can be used to train such behaviours.

    It's hard to diagnose the problem with the level of details provided. I suggest you first try to get the agents moving with the Heuristic Only mode in the Behaviour Parameters, this helps to make sure that the physics are in place.
     
  3. MrOCW

    MrOCW

    Joined:
    Feb 16, 2021
    Posts:
    51
    @mahon94 Yes the agents are moving fine with Heuristic.
     
  4. LexVolkov

    LexVolkov

    Joined:
    Sep 14, 2014
    Posts:
    62
    Some data may be missing. Make sure that all inputs are received by the agents.
    The agents don't move at all or a little?
    Remove everything you don't need, start with the simplest and most basic parameters. Use individual training rather than group training.
    Try different options and settings and write down what works and what doesn't.
     
  5. MrOCW

    MrOCW

    Joined:
    Feb 16, 2021
    Posts:
    51
    surround.jpg

    Seems like the agents really love to hug the walls for some reason.

    My input is
    RayPerception for detecting walls, raydistance set to maximum distance from 1 corner of square to the opposite corner. changes according to curriculum

    Vector3.Distance(this.transform.localPosition, target.transform.localPosition) (non-normalized) (can anyone explain why non-normalized works but normalized doesnt? the agents don't stay near the target at all)

    (target.transform.localPosition-this.transform.localPosition).normalized

    distance and signedangle to other agent

    velocity.x, velocity.z, angularvelocity.y

    the agents will surround the target if they happen to be in the area near the target otherwise, they will either hug the wall or just move tiny distances around their original spawn location.

    curiosity is set to true.

    Its strange that even though i provided the direction and distance to the target, they prefer hugging walls..?

    Any one had such issues before and can share your solution to fix it?