Advertisement

AI for Darts?

Started by October 12, 2006 07:20 AM
4 comments, last by GameDev.net 18 years, 1 month ago
Very new to programming...but I created a scorekeeper for English Darts...it keeps track of X01 (ie 501, 301, etc) and Cricket...right now I have the score keeper working properly from 1-4 players... now i'm interested in adding an AI player with different skill levels...I'm just not sure how to even start doing something like that...any ideas? I figured I'd start with an AI for the X01 games since they are much simpler...What I had in mind was the following: 1) Figure out an average point per dart or point per round score for the different levels... 2) develop % or probablility of missing the average +/- (eg. If point per round average was 50 then probability of hitting 50 +/- 10 would be 75%, 50 +/- 20 would be 20% and 50 +/- 30 would be 5%...realize i'm just making up %'s here...just trying to show what's on my mind) 3) then also have to account for doubling out (ie hitting a double with the exact score you have remaining) I have no idea how to get started or if my approach is even close...i'd love any help you guys could provide...thanks... note: currently my project is in VB6... thanks... [Edited by - TheNoocH on October 12, 2006 1:50:20 PM]
If you are wondering about how to approach having different abilities for computer players, i would suggest that a players difficulty is indicated by the radius around the target position on the board that the player can get it in. For example, a poor player like me knows to aim for treble 20, but im so bad that i could hit anywhere within a 4 inch diameter circle around trebl 20. A pro player might have a radius half a cm area.

Using this basic rule i think that you could make for fairly realistic targetting on the board.

I think it is an automatic decision as to what the computer player should aim for. I don't think there is too much AI to it. Each pro in the game will be aiming for treble 20 or treble 19 *most* of the time before an out is reached. Once an out is recieved there are only a few ways of acheiving it. The ability of a player to make an out comes down to their ability to hit a specific target on the board.

Once this basic system is in place, you could integrate other things like a player having preference over different outs and being able to hit certain doubles more often than others.

Hope this gives you some ideas.

Dave
Advertisement
I would just generate a gaussian distribution centered at the center of the target. Then you only have 1 parameter (the standard deviation) to vary according to player skill! The smaller the deviation, the better the player. And of course dont forget to normalize over the surface of your target.

Then, you can generate the radius from center using the gaussian distribution, and the orientation around that circle using an uniform distribution.

Gaussians rules.
actually the gaussian distribution sounds interesting...

I guess i would need to
1) determine what target to shoot at...
--i guess this would be best accomplished if >170 left on balance then target is Triple 20 ... and develop a database of finishes for under 170?
2) develop the gaussian distribution around that target based upon skill level
--need to figure out how this works??
3) guess need to figure out how to store how the segments are located on the board???
4) need to track 3 darts scored and balances (temp) and put out the final round total (perm)

any sample code to help me out? i'm very new to this stuff...but trying to learn...

[Edited by - TheNoocH on October 12, 2006 9:43:14 AM]
You can find the formula of the gaussian there (the first one).
http://mathworld.wolfram.com/NormalDistribution.html

You can extend it to 2D or simply run the same distribution twice (with the same parameters). srand in the stl will give you a normal random distribution.

Thats all you need for generation the skill

For choosing the target (inside the board), you can describe the desirability of each target using a formula like (value * area). You could also add a k factor that determines the style of the player: does he shoot to high values targets or targets that are easier to hit?

Once you have the desirability of each target, just normalize the sum to 1.0 to create your random distribution.
Steadtler,
thanks for your response...BUT...that all sounds greek to me...do you have any sample code or links to sample code that does something like this? that may help me understand...

thanks...

This topic is closed to new replies.

Advertisement