Search Unity

Question Adding a Delay to actions taken by the ML Agent and assigning a reward after output

Discussion in 'ML-Agents' started by rohan1992, Jul 29, 2020.

  1. rohan1992

    rohan1992

    Joined:
    Oct 21, 2017
    Posts:
    1
    I am making an ML agent that modifies different noise and height parameters on a generated terrain mesh.

    Is there some way for me to:
    1) Tell the agent to make a change to the parameters of the noise (I am doing this with OnActionReceived)
    2) Wait till the terrain chunks have been generated to collect observations on the generated terrain(About 2 seconds till the terrain is generated)
    3) AFTER the generation is completed(2-3 second delay), assign a reward based on the calculated parameters of the terrain and end the episode
    4) Start a new episode and reset the generator to random noise, make the agent take a new action and generate terrain

    I am quite stuck on 2 and 3. I was thinking of delaying the generator taking an action using the DecisionRequester but I am quite stuck as to how I can make the agent wait for the generation to complete and then add a reward.

    Is there some way for me to make it a decision every 5 seconds and then collect observations/assign rewards after the terrain is generated?
     
  2. celion_unity

    celion_unity

    Joined:
    Jun 12, 2019
    Posts:
    289
    There's nothing built-in for this. I would recommend not using a DecisionRequester, and just calling Agent.RequestDecision() on your on schedule.