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

Question Handling multi profile/class agents

Discussion in 'ML-Agents' started by TTrope, Apr 22, 2021.

  1. TTrope

    TTrope

    Joined:
    Dec 7, 2014
    Posts:
    20
    Hello,

    In a game with classes system, some agents can have different characteristics/capabilities depending on it's class/profile.
    Is there a good way to make the IA learn the global policy of the game (the goal) while adapting it's gameplay depending on the current class it is controlling?

    So far i'm using a one hot encoded observation of the class, but it doesn't make good results

    (In my case, i'd like to make them cooperate, so I cannot train different IA for each class)


    Thank you
     
  2. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    Hi,
    We added a feature in the latest release called "Goal Signals" that might help with this. The section in the documentation is here.

    Note that you'll need to add a new VectorSensorComponent, and access its VectorSensor; this is a separate instance than the one that gets passed to Agent.CollectObservations.
     
  3. TTrope

    TTrope

    Joined:
    Dec 7, 2014
    Posts:
    20
    Hello @celion_unity
    Thanks for your answer
    I've been running some tests with the new goal sensor (vectorSensorComponent) however it doesn't seems to help in my case.

    From my understanding, goal sensor is made in order to keep the same kind of behavior for another goal. In my game, I need the opposite: the goal is the same but the behavior will be different depending on the class of the character.
    Is there any plan for this kind of "Same goal/different behavior" ? Or no need for it, increasing the size of the network would be enough?
     
  4. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    Hi @The-Trope,
    I talked with some folks that are more familiar with goal signals, and they still think it should help with training in this sort of "Same goal/different behavior" scenario. That being said, it's not magic, and your game might still be too complicated for it to learn successfully.

    Some things to check:
    1) Can you get good training results with a single class (without using goal signals)? If you can't train the simpler scenario, you're probably not going to have much luck with a more complicated one.
    2) Is your VectorSensorComponent's Observation Type set to "Goal Signal"?
    3) Are you adding observations to the VectorSensorComponent's sensor? See the GridWorld agent as an example.
    4) (optional, may or may not help) Are you using
    conditioning_type: hyper
    in your configuration's network_settings?