Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-04-2006, 09:06 PM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Pong game AI

Ok, so I am making a mini pong arcade game. Currently the ball bounces off walls and players and restarts when it goes behind the player- basic pong concept; but the enemy AI is too simple,
if the ball's y is less than its, it moves down and well, you know.

How would I make the enemy predict and possibly be wrong where the ball will be?

by the way, the ball doesnt use a direction to move, I have numbers being added or subtracted from the x and y of the ball.
__________________
Reply With Quote
  #2  
Old 06-04-2006, 09:27 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
I would use a random variable for the accuracy, and make the y possition either more or less than the ball y by that much, per movement. This would allow it to move twoard the ball, but it may be off, or move too slow.
Reply With Quote
  #3  
Old 06-04-2006, 11:09 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
best AI: paddle.y = ball.y - (paddle.width/2) !!
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #4  
Old 06-05-2006, 02:51 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Quote:
Originally Posted by ApothiX
best AI: paddle.y = ball.y - (paddle.width/2) !!
Thats what I have and the AI never loses. I think Ill try the variable accuracy.
__________________
Reply With Quote
  #5  
Old 06-05-2006, 03:44 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
That would screw up because I wasn't thinking. Should be paddleheight :P
anyways, the best way to do AI for pong is to make the paddle at a constant speed, and have it go up at that speed when the ball is higher, and down when the ball is lower, that way it's still possible to score against the AI, but it's not overly easy :P
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 06-09-2006, 11:32 PM
Polo Polo is offline
Classic Systems Admin
Join Date: Sep 2002
Location: Vancouver, Canada
Posts: 735
Polo is on a distinguished road
Send a message via AIM to Polo
I made a pong game for Playstation 2, and for the AI I basically said that if the ball is above the paddle, move up, if its below, move down. I then limited the maximum speed at which the paddle could move, so the way to beat it was to hit things at quite a sharp diagonal (so that it cant keep up with tracking), or into the corner opposite from it (so that it cant get there in time).

It worked ok. You could basically vary the difficulty by varying the maximum AI paddle speed.
__________________
Be good little players, or Master Storm will ban you!



Proof that the staff are crazy..
*Ghost Pirate: I'm a little teacup short and stubbe here is my raygun here is my butt
DragonX: Jumping jack rabbits Batman! Our eggo waffles have been stolen! To the batmobile Robin!
X-Mann (RC): I have a head ache
Reply With Quote
  #7  
Old 06-10-2006, 04:24 AM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
The maximum speed the opponent can move and the increasing speed of the ball are the two best factors.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.