The Daily Click ::. Forums ::. Klik Coding Help ::. How do you make a good AI Pong computer?
 

Post Reply  Post Oekaki 
 

Posted By Message

G. Hull



Registered
  07/01/2009
Points
  125

Wii Owner
11th January, 2009 at 09:07:19 -

Hello, me again, I was wondering how to make a good MMF2 AI Pong computer, that follows the ball but unbeatable. Ya know what I mean?

 
n/a

Mr G



Registered
  31/12/2008
Points
  178

VIP MemberPS3 OwnerI like Aliens!Attention GetterDos Rules!
11th January, 2009 at 09:21:00 -

check out the link and search for pong...

http://clickteam.com/eng/learning_resources.php

 
Image

http://create-games.com/project.asp?id=1549

G. Hull



Registered
  07/01/2009
Points
  125

Wii Owner
11th January, 2009 at 09:41:48 -

Hey, thanks Mr Green, I totally forgot about clickteam.

 
n/a

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
11th January, 2009 at 23:26:37 -

If you want to do this really simply you can do it this way..

Set opponent paddle to bouncing ball, choose a max speed (set by difficulty perhaps).

Paddle Y position greater than Ball Y position = Set direction paddle to Downward, set speed paddle to speed paddle+1.

Paddle Y position less than than Ball Y position = Set direction paddle to upward, set speed paddle to speed paddle+1.

Paddle Y position equal to Ball Y position = set speed paddle to 0.

You can then add additional conditions to the 1st 2 events to define boundaries etc...

 
Current project:
Dynabrick (%70)

Rox Flame

Creative Talentician

Registered
  06/10/2004
Points
  383
11th January, 2009 at 23:55:25 -

And if you want it to be unbeatable, then just set, Always = Ypos Paddle to Ypos Ball.

 
Current project:
Dynabrick (%70)

Deleted User
12th January, 2009 at 00:00:55 -

There is actually a really good AI tutorial that goes over this in the articles section. I'll see if I can dig it up.

EDIT:http://www.create-games.com/article.asp?id=1154

Edited by an Administrator

 

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
12th January, 2009 at 04:50:16 -

If you want smooth movements try using interpolation.

Here is something I made a while back to play around with,
http://www.jsoftgames.com/breakoutengine2.zip

I don't have time to make a proper example at the moment so you'll have to study the code.
Its not pong but the engine is basically the same.

Enjoy!

 
n/a

G. Hull



Registered
  07/01/2009
Points
  125

Wii Owner
12th January, 2009 at 07:48:05 -

Wow, thanks Rox Flame! That was extremely helpful. Not only does it work, but it was easy to understand!

Keep it cool,


-Rannug

 
n/a
   

Post Reply



 



Advertisement

Worth A Click