AI Flappy Bird Processing Java

i found some problems.
in wall class, you cannot use circle collision detection. you have to use collision detection for rectangle since it is a block

boolean lookForHit(PVector loc) { 
 // circle collision detection
    //if (dist(pos.x, pos.y, loc.x, loc.y)< 50) {

   //rectangle collision detection
    if(loc.x > pos.x && loc.x < pos.x + s && loc.y > pos.y && loc.y  < pos.y + s){
      return true;
    }
    return false;
  }

like youve been using in check() function
if (pos.x >= ea.x && pos.x < ea.x + ea.w && pos.y >= ea.y && pos.y < ea.y + ea.h){

then the problem with normalization

    inputs[8] = pos.x;
    inputs[9] = pos.y;
    inputs[10] = ea.x;
    inputs[11] = ea.y;

dont forget to normalize the value first when it comes to be fired through the NN

 inputs[10] = ea.x;
     inputs[11] = ea.y;

just input the distance to the endarea. its better than its position.

and for this

    inputs[8] = pos.x;
    inputs[9] = pos.y;

you can just ignore its current position, since the player got enough information.

btw, the program will run smoothier if there are no strokes to be dislpayed. stroke() function is bad in performance

you can just increase how many directions the player sees, otherwise, you can manipulate the starting angle while scanning its environment

in the look() function, you can change the high of accuracy it get while scanning by decrease the direction magnitude direction.mult(10);
just change it to like direction.mult(5);

1 Like