How best to tackle developing a darts game?

Monkey Archive Forums/Digital Discussion/How best to tackle developing a darts game?

Milky Joe(Posted 2013) [#1]
I've been asked to look at writing a darts game, and I've decided to use the opportunity to give Monkey a whirl. As a long time Blitz user, I can't wait to get stuck in!

Can anyone suggest how best to approach implementing the board? I.e. what's the simplest/most efficient way of determining where on the board the dart has hit? Does anyone know where I might find some sample code?

I remember Gfk creating a great dart game, in Blitz, some time ago. Is it still possible to buy/download it?

Thanks


muddy_shoes(Posted 2013) [#2]
As a dart-board is segmented into sectors and radial bands it's probably easiest to use the angle and distance from the centre point.


GfK(Posted 2013) [#3]
What muddyshoes said.

That's how I did it for Double Top. Don't think you can get it any more but I still have the source code and stuff. ;)


Milky Joe(Posted 2013) [#4]
Thanks guys.

I don't suppose you could throw a few example calculations my way, could you GfK? ;)


c.k.(Posted 2013) [#5]
Watch this.

Then duplicate. :-D


benmc(Posted 2013) [#6]
I'm actually making a darts game prototype myself and got the flick functionality working over the weekend with some "wind". Was debating making an archery game instead.... might still do that anyway.

My Distance to the center code:

(sorry, don't know how to use forum markup to put in a code box)

Local DistanceToCenter:Float

DistanceToCenter = Sqrt(((centerX-dartX)*(centerX-dartX)) + ((centerY-dartY)*(centerY-dartY)))


I can do this for each ring.


Then the Angle between the 2 points so you know where you are on the board:

You would use some implementation of ATan2 kind-of like:

Local Angle:Float
Angle = ATan2(dartX-centerX, dartY-startY)

Of course you'd probably have to fiddle with these a bit to get them working. Depending on your implementation, centerX/dartX and Y's may have to be reversed, or you may want to add 180 to the ATan2 if you want 0/360 to be straight up (if I remember correctly).


Milky Joe(Posted 2013) [#7]
Great! Thanks benmc. Much appreciated.


John Galt(Posted 2013) [#8]
@ben - I think an archery game would appeal to a much wider audience.


c.k.(Posted 2013) [#9]
The archery could also tie in with the recent movie about the girl with archery skillz who had to battle for her life before a television audience. I can't remember the name right now. The Hunter Games? HUNGER GAMES?!! No... YES!!! My daughter said "Hunger Games." I knew it.

Anyway...


benmc(Posted 2013) [#10]
Agreed, I think between Brave and The Hunger Games, the weapon of choice for heroines in 2012 had to be the bow and arrow :)


GfK(Posted 2013) [#11]
@milky - got an email address?


Shagwana(Posted 2013) [#12]
Well we used to badger Gfk for a rotating dartboard, never did get it tho.


Milky Joe(Posted 2013) [#13]
<email address removed>

Cheers!


GfK(Posted 2013) [#14]
Well we used to badger Gfk for a rotating dartboard, never did get it tho.
I have a partly finished 'sequel' to Double Top which I wrote in 2005, which does have a rotating board.

@joe: check mailz.


Dabz(Posted 2013) [#15]
If your planning to sell a dart game, I wouldnt bother.... I made one, and, their not that popular, really, they arent, I sold two games for iOS, one a battleship type game, and a dart game, the battleship game got loads, the dart game, not so much!

If it's for freeware, well, fair do's, if not, be warned! :)

Dabz


Hotshot(Posted 2013) [#16]
There is darts game called Darts Night on ipad which is great but hard to get hang of when you try get 180 often