Jump to content
  • Advertisement
Sign in to follow this  
rahulpawar

Calculating Pool / Billiard Shots [New]

This topic is 2302 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

Hi guys,
I'm stuck while developing an A.I.[Now don't back off saying that not my field just continue reading]
for Pool / Billiard type game
[well actually its called "Carrom"; Carrom = (Flat pieces)Pool / Billiard - rolling balls;]

Details[Plz do visit this link, & Open in new tab]

well any thought How to do it ?






Note to Moderator:

Sorry this been double post but the nature of question need experts from both fields...So please don't delete this.....Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Just spouting off the top of my head.

Loop through every ball you need to hit in. (Solids or Stripes)
For each ball, check to see if there is a clear path to each pocket.
If there is a clear path, calculate where the q-ball needs to hit the ball in order to hit it into that pocket
Try to find a clear path from the q-ball to the ball in question allowing for a bounce or two off of the walls
If there is a clear path Make sure the q-ball doesn't go into a pocket, resulting in a scratch

Hopefully by looping through each of the balls and pockets like that you can come up with discrete shots that you can then score based on the following criteria
Does one of my balls go in?
Do I scratch?
If I hit a ball in, does the q-ball end up in a good place for my next shot (you may need to recursively evaluate shots)
If I do not hit the ball in, does the ball end up in a difficult place for the opposing player
How hard is the shot? (difficulty could be based on distance, sharper angles, and bouncing off of the wall)

After scoring each shot, pick the shot with the best score then have the computer execute that shot only applying a slight error in the angle and power of the shot. The amount of error applied to the shot could based on the difficulty of the player and the difficulty of the shot.

Just a few of my thoughts on the AI.

A tricky part of the AI would be calculating shots that bounce off the wall. The way I would approach that would be to mirror the pool table over the wall when checking for collisions. For example, if I find that there are no direct paths from the q-ball to the target then I duplicate the board and mirror it over the wall. Then I check for direct paths to the mirrored ball checking collisions on the original and mirrored board. You will need to take into consideration the loss of velocity when the ball bounces off the wall when calculating the velocity to hit the ball it.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!