Jump to content
  • Advertisement
Sign in to follow this  
Basket Case

AI For Pong

This topic is 4624 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!