Search Unity

Question [SOLVED] Removing agents in ml-agents-dodgeball env

Discussion in 'ML-Agents' started by Hallahallan, Jan 20, 2023.

  1. Hallahallan

    Hallahallan

    Joined:
    Jan 16, 2023
    Posts:
    7
    Hello,

    I am trying to use the dodgeball-ml-agents environment for a study related to my Master's thesis. I am not too familiar with Unity development, so this is all pretty new to me.

    The environment: https://github.com/Unity-Technologies/ml-agents-dodgeball-env

    I am trying to reduce the amount of agents, as the study i wish to perform is more suited for 1v1 environments. I also want to use the Elimination mode. The problem is removing the agents, as simply trying to delete the variants of DodgeballAgentBlue and DodgeballAgentPurple leads to an error saying "Children of a Prefab instance cannot be deleted or moved". Unpacking the Small4v4Platform leads to an error occuring in the frame updates i believe, as it causes Dodgeballs to spawn continously. Removing the agents from Team 0 Players or Team 1 Players causes them to break, making them ungrounded and invincible.

    My question is then "What is the best procedure for removing variants of the DodgeballAgents to create a simple 1v1 environment while retaining all other functionality?(I will be re-training the AI and implementing my own version of AI for the study.)
     
  2. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    > Unpacking the Small4v4Platform leads to an error occuring in the frame updates i believe, as it causes Dodgeballs to spawn continously

    Tried that. Taht's hilarious :)
     
    Hallahallan likes this.
  3. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    Just so you know, the clean way to do what you're trying to do is: in Assets folder, find the small4x4 prefab. Double-click on it, to open it. Then delete the extra agents. However result is the same as you saw. I think there is a bug in the code somewhere. Somewhere something is hard-coded that assumes there are 4 agents, and fails if there aren't...
     
    Hallahallan likes this.
  4. Hallahallan

    Hallahallan

    Joined:
    Jan 16, 2023
    Posts:
    7
    Nah that solved everything! Thank you so much! Deleting the prefab variants in the small4x4 prefab was exactly what i needed to do, I was just trying to delete them in the scene instead, which was wrong. Works perfectly now.
     
    hughperkins likes this.
  5. Hallahallan

    Hallahallan

    Joined:
    Jan 16, 2023
    Posts:
    7
    Well.. perfectly might be to exaggerate a bit, but at least the problem of this thread is solved. Now theres new bugs introduced that need to be fixed :D
     
    hughperkins likes this.
  6. Hallahallan

    Hallahallan

    Joined:
    Jan 16, 2023
    Posts:
    7
    Something was absolutely hardcoded for 4 players. Setting the m_NumberOfBluePlayersRemaining and the corresponding purple one in DodgeBallGameController.cs to 1 instead of 4 fixed it though. Just had to do it twice, both where it is initialized and in ResetScene()
     
    hughperkins likes this.
  7. hughperkins

    hughperkins

    Joined:
    Dec 3, 2022
    Posts:
    191
    Super! :) Thank you for giving the information on how to fix this :)
     
    Hallahallan likes this.