How do i Make an Carrom Game AI?

1 favourites
  • 3 posts
From the Asset Store
A complete Carrom Board artwork for making an awesome board game.
  • I am Currently working on a carrom game and want to add an AI who can pick a token/coin which can be potted very easily can you help me with this thank you

    attaching C3p file-

    https://drive.google.com/file/d/1vJ-xdo_VVxNOh6Dhfa-zemq5fdapplg0/view?usp=drive_link

    if any one can make Ai better please reply

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • For that

    You can try line of sights behaviour

    Compare angles

    And for shoot

    Use bullet behaviour

    Example

    Which pieces is near by your striker

    Line of sight

    After pick

    Set angle to piece

    Shoot

    Compare speed to make goal

    It's very simple example not like actual ai

    But understand concept atleast

  • Can't open your file since I don't install addons but here are a few ideas:

    Most basic is to just randomly select a direction and speed to launch the striker.

    A bit better would be to pick a direction toward one of the men. You could randomize the angle a bit to add variance.

    More advanced would be to look at a straight line from each man to the pockets, and keep a list of then that have a clear path there. You could also check for bank shot paths. Next you'd can figure out a formula to figure out the required angle and speed for the striker to hit the men to make them move in that direction. The main requirement would be for there to be a clear path from the striker to where you want to hit the man. This would be rather math intensive and you'd have to deal with some quirks of the physics behavior, but if done right you'd get ai that could sink shots that most players try to go for. You can always add some randomness to make it not so good.

    To check for a clear path you can use a loop to move the circles in small steps in a line and check for overlaps.

    Now for a deeper ai that can handle complex bank shots or bouncing off other pieces you may need to re-design your game's internals. The idea is to simulate many frames of the simulation in one tick. That would allow you to test multiple different shots and then pick the one that had the best outcome. You could start with random shots, but you could then take the shots with the best outcome and run more tests as variations of that to make better shots. The limiting factor would be how much time you'd want to let the ai try to find a good shot.

    Other ideas could be to come up with a way to rate the shot by how many points you scored and how much closer your pieces were to the pockets vs how favorable the board layout is for the other player to score points.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)