AI For Pong

Started by
0 comments, last by speed_demon05 18 years, 5 months ago
I have been thinking on how I am going to do the AI for my 2d Pong that I am attempting to create. Here is what I plan on doing, and I would like some input on it: First, the computer will randomly choose one of the following moves: 1) Random - The paddle will move randomly up or down a random amount of space. 2) Prediction - The paddle will find where the ball will try to get past their "line" and move there. 3) Moving to ball - The paddle will get the current balls coodinates and move to that spot regaurdless of the bouncing that might happen during the balls flight. 4) Nothing - THe paddle will sit still for a random amount of time before getting a random number for the next move. Each movement will have a random amount of frames that they will have to complete their movement before getting another random move! So if it landed on Prediction then if it hasn't fully gotten to the correct coordinates in an X amount of frames, it will just move on to a different random movement. I hope this was easy to understand...and if it wasn't hopefully you will get the picture that I have.
Advertisement
Heres an idea: have the AI paddle calculate where it must move in order to hit the ball. To make it beatable, you could limit the speed at which it can move its paddle. For example: easy-moves slow, hard-moves fast. A little random movement might work if not over done. You only want to make the computer somewhat stupid, but yet not unbeatable. Right now i'm taking a shot at a pong game, so I not 100% sure either on how to do the AI. Good luck.

This topic is closed to new replies.

Advertisement