Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question What time scale value to use for Training

Discussion in 'ML-Agents' started by GamerLordMat, Aug 19, 2021.

  1. GamerLordMat

    GamerLordMat

    Joined:
    Oct 10, 2019
    Posts:
    185
    Hello everyone!


    I am trying to train an Agent who highly depends on Physics. As far as I know cranking Time.timeScale up makes the game run faster, but the fixed time step stays the same, so the Physics gets "laggy".


    Now I am wondering:

    1. why is the standard value of time scale set so high (20)? Doesn't that destroy the physics?

    2. What has the value to do with training speed/performance in general?

    3. Could you recommend us a value for games that rely on Physics?


    I would genuinely appreciate if someone could enlighten me :D


    P.S.: I also noticed that setting it to 1 makes the game somehow look like it is running in slow-motion (maybe to low fps?).
     
  2. growsolutionsapp

    growsolutionsapp

    Joined:
    May 12, 2021
    Posts:
    16
    hii @GamerLordMat

    sorry for English.

    set time scale to how your processor is. 1 is normal and you are set what you want.

    it doesn't matter what value set to time scale it doesn't effect physics. as per my knowledge.
     
  3. GamerLordMat

    GamerLordMat

    Joined:
    Oct 10, 2019
    Posts:
    185
    Thanks for the response!
    So I am referring to: https://github.com/Unity-Technologi...docs/Python-API.md#engineconfigurationchannel
    there it states:
    time_scale: Defines the multiplier for the deltatime in the simulation. If set to a higher value, time will pass faster in the simulation but the physics may perform unpredictably. Default 20.
     
  4. growsolutionsapp

    growsolutionsapp

    Joined:
    May 12, 2021
    Posts:
    16
  5. growsolutionsapp

    growsolutionsapp

    Joined:
    May 12, 2021
    Posts:
    16

    In SImple Words. and not effected by physics i tested.
     
  6. ice_creamer

    ice_creamer

    Joined:
    Jul 28, 2022
    Posts:
    34
    Hi, time scale results in more frequent time change. Do you know frame-skipping? what difference between them? if i want to change frame-skipping,what should i do? Appreciate!
     
  7. Energymover

    Energymover

    Joined:
    Mar 28, 2023
    Posts:
    33
    Time scale can matter, the default is 20 time scale. The simple answer is try it and see if it is better, mine was better once I went to time-scale=1

    The way I understand it is related to calls to the Fixed Update and depends on how much / how often your physics is being used and for what purpose. If fixed update isn't called, the physics for the frame that is being evaluated may not be up-to-date and therefore bad data would be used in the observation to estimate an action.

    I think of it as if Update is called and my car hits the wall, but no Fixed Update was calculated, the collision information may not be updated at the call of collect observation.