Tuesday 9 August 2016

Improvements to the Magic Darts Wagon Wheel

Hello,
you may well have read my last post about what I was reluctantly calling a Magic Darts Wagon Wheel. If not, do that quickly now.

Done?

Good.

Anyway, if you read all the way to the end and read the comments, you'll have seen a nice suggestion from Michael Bench-Capon, in which he proposes making the first dart in a bed contribute more opacity than later darts in a bed. And he even comes up with a way of doing this using fractions and powers of things (yes, mathematicians, that's a simplification!).

Anyway, I thought this suggestion was excellent and I tried to implement it and the following few simple bullet points sum up what happened:
  • I struggled for a bit, not really knowing exactly how to do it;
  • I played around with some trial and error numbers;
  • I thought of concocting a formula which meant that for a specified number of darts (based on number of legs to win, like I initially had), you would reach 95% opacity;
  • I came up with something like 0.05 = n^x, where n is my parameter to be defined and x is my specified number of darts;
  • it's 0.05 transparency because opacity is one minus transparency;
  • I want to find n so I needed the xth root of 0.05
  • I realised that I didn't know how to find an xth root of something so I googled it and it turns out you just do ^1/x, which is very handy;
  • so I came out with something like 0.05^(1-/x) as my n;
  • I then substitute what I used to have as my number of darts for maximum transparency depending on bed type for x, so e.g. it's twice legs to win for missed doubles;
  • this gives me a paramter for each bed type which I called z;
  • then to generate the transparency I just need z^y, where y is the number of darts in the bed;
  • UPDATE: And this actually really helped tidy up the code as well because I could get rid of a "case" thingy I had in there which I had needed to check if the max no. of darts had been exceeded and just go to a super simple transparency = z^y;
  • happy days.
This is the result, using this match between Canada and New Zealand.



I think this really does create a better overall animation than with the previous method, though of course I'm still at a very early testing phase. Still fone-tuning, if you will. Thanks again though to my contributer and please everyone feel free to comment etc. and make further excellent suggestions. Half-hearted remarks or even exclamations would also be appreciated.

PS: I'm also still on the lookout for new name suggestions. Still not wholly happy with Magic Darts Wagon Wheel.

No comments:

Post a Comment