Search Unity

Question ML Agents training change velocity and gravity, WHY?

Discussion in 'ML-Agents' started by peidencoding, Apr 4, 2023.

  1. peidencoding

    peidencoding

    Joined:
    Nov 11, 2022
    Posts:
    5
    Hey, i have a question regarding ML Agents. I programmed a 3D Flappy Bird Version and the Bird has a RigidBody. This works very well when i dont train the agent (Bird).
    As soon as i start the training ("mlagents-learn" in anaconda console) the gravity and velocity changes.
    The bird moves with transform.Translate(transform.right * moveSpeed * Time.deltaTime) and jumps with
    rig.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
    In training this is approx. 15 times faster than running the game without training.
    Has anybody an idea how this is possible?
     
  2. al3xj3ns3n

    al3xj3ns3n

    Joined:
    Sep 10, 2018
    Posts:
    21
    By default, during training, ML-Agents runs Unity at about 10x regular speed to speed up the training process. You can disable this when running by adding --time-scale=1 to your cmd command when starting the trainer.
     
    peidencoding likes this.
  3. peidencoding

    peidencoding

    Joined:
    Nov 11, 2022
    Posts:
    5
    Nice, it works, thanks!