Jump to content
  • Advertisement
Sign in to follow this  
programmermattc

Pong AI

This topic is 3645 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'm working on a Pong game and I've got the most basic implementation of AI going I can think of but it's too unrealistic currently. What I've got is the paddle follows the ball up and down no matter where it is on the screen. The speed of the paddle combined with the much faster speed of the ball though prevents the AI from being impossible to beat. The other idea I had awhile ago was to wait until the ball was 50-75% of the screen away from the paddle before I started to move towards where the ball is and then randomize a short amount of over- or under- compensation so the paddle would either go to far and try to come back or wouldn't go far enough (simulate human distance error). What do you think? I'm very bad with AI and am unsure of what method I should use. If you have another method by all means please share it.

Share this post


Link to post
Share on other sites
Advertisement
Sounds good to me. Any delay or parametric noise that you can put in to "fuzzy things up" a bit will make it more realistic.

Share this post


Link to post
Share on other sites
It's actually interesting, I was play testing some stuff last night and kept losing. I thought the simple AI I had built was much too simplistic but it's actually quite difficult and I think if I add anything I need to 1) make it seem more realistic, 2) add in some kind of handicap.

Share this post


Link to post
Share on other sites
I made pong not too long ago and for my AI, if the ball's center was above the paddle's center, move the paddle up a little, otherwise move it a little down. If the ball was moving away from the AI paddle, move it at half speed back to the center, once the ball was going towards it again, start moving it towards the ball. Still pretty simple, but worked good.

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!