Hi, I have a question about some AI I want to put into a little PONG project I'm making to expand my game programming skills.
I've read a few AI tutorials, and I get lost a few paragraphs in. I want to create a very, very basic AI system for one of the paddles. The only problem is, I don't know how to do this. I've heard of many different types of AI, neural networks, fuzzy logic, etc, but I have no idea which one to use, or how to implement it in my game. If someone could point me in the right direction, that would be great.
A very simple way of doing this would have been the following:
1. When the player has hit the ball, calculate its trajectory and find out the exact location of where the ball is going to reach AI paddle
2. Now take the newly calculated position and add random values to it (with rand() or something)... The smaller level, the larger the possible value of random can be, and therefore the larger is the chance for the AI paddle to miss the ball. The higher the level, the smaller random value should be, and therefore chance of missing the ball will be smaller
3. Move the AI paddle to the position you calculated in step 2.
Or you can do it just like this:
//move the paddle to the location where the ball is going to hit
//move the paddle to some other location (for more realistic visual results somewhere near the ball, but not touching it)
Or you could have a paddle that goes to where the ball will hit, but moves slower than the ball, giving the player a chance.