wood burning stoves
The moose likes Game Development and the fly likes How to make Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "How to make "efficient" AI" Watch "How to make "efficient" AI" New topic

How to make "efficient" AI

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

So I made Pong (by myself). The only part I am stuck on is the AI. I am having trouble between making it unbeatable and too easy. So far it is doing the speed of the ball - 1. That is unbeatable. If you do the speed of the ball - 2, it is too easy. If you do the speed of the ball - 1.25, it is great on fast balls and fails on slow ones (obviously). How do I get this to balance out? Code will be provided on request.

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Mich Robinson
Ranch Hand

Joined: Jun 28, 2009
Posts: 260
I didn't know you needed much AI for pong but ...

rather than adjusting the speed of the game could you just adjust where the program wants to stick it's paddle. Assuming it decides where the paddle should be the moment you hit the ball then just adjust this position by a random amount depending on the level - on easy make it a large random amount and on hard don't vary it at all. You could increase the speed by a small fraction at the same time just to make it more "exciting" as well.


Arcade : Alien Swarm
Board : Chess - Checkers - Connect 4 - Othello
I agree. Here's the link: http://aspose.com/file-tools
subject: How to make "efficient" AI
It's not a secret anymore!