Hi everyone !
I've been reading a lot this forum and other places on the web to find a way on my issue. I finally decided to ask you guys for some ideas. Maybe my problem is very simple, maybe it's very complicated... I don't know anymore... I'll try to be as precise as possible.
Here is the game i'm working on. The blue guy is the player and the yellow one is supposed to be an A.I. This is a simple indirect ball game where the players throw the ball to the wall in turns. You have to return the ball to the wall before the second rebound on the floor.
My problem is, i can't find a good way to make the A.I. clever enough to predict the ball trajectory. I tried a few desperate solutions and of course, it didn't work properly.
The main one was to make the AI player to run after the ball shadow until it collides with the ball and finally, throw it back to the wall. It looks terrible and it's very easy to trick him.
The other one was to throw an invisible second ball a way faster than the first one but, because of the gravity and speed, the trajectory of this new ball was a way more linear than the real one and unaccurate. I told you... desperate solutions...
I would like to find a way for the A.I. to predict the trajectory of the ball. Maybe it's just a too complicated for my tiny brain.
To be as precise as possible, let me tell you how the ball is thrown to the wall by the player. There's a few simple conditions to define the shot variables and quality. First the speed. When the X axis of the right is negative (or pulled to the left), the power gauge increase. When you push it back to the right, if the ball collides one of the player collision boxes, the ball is thrown at the power you set. When you hit the ball, the angle of the right analog Y axis defines the ball angle of motion. In other words, you can manage how high you want to throw the ball on the wall.
I hope someone will be able to help me...
Thank you very much and sorry for my average english...