Hi,
i’m a beginner at mlagents, i played around with the example environments for a while, and took on to make my own flappy bird ai (i thought it’ll be easier considering almost everyone has done this, and i’ll be able to find a lot of resources in case i get stuck)
So i’m stuck here at configuring the actions,
can’t control the agent properly, the button press is not registered everytime,
and since i can’t get the heuristic right, i suppose i won’t be able to train the AI properly.
Heuristic Function
public override float[] Heuristic()
{
var action = new float[1];
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log("Pressed");
action[0] = 1 ;
}
else
{
action[0] = 0;
}
return action;
}
OnActionReceived Function
public override void OnActionReceived(float[] vectorAction)
{
{
AddReward(0.01f);
int action = Mathf.FloorToInt(vectorAction[0]);
if(action == 0)
{
}
if(action == 1)
{
m_AgentRb.velocity = Vector3;
m_AgentRb.AddForce(Vector2.up * tapForce, ForceMode2D.Force);
}
}
}
can’t figure out what’s wrong with this code
Please Help