Sign in to follow this  
Basket Case

AI For Pong

Recommended Posts

Basket Case    122
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.

Share this post


Link to post
Share on other sites
speed_demon05    122
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this