Another quick update...
Finished the logic for dunks today. I'd put this one off - the other "shooting related" code was some of the first I finished off - because I had to work out the requirements for a player being able to dunk.
Initially I had a 'dunk' rating that I was going to use, which at player creation would factor in the player's jumping ability/height/athleticism etc. to come up with the rating, but I decide to scrap that and just use a mapping of height to jumping ability to determine a player's ability to dunk.
I mapped out a list of requirements for a player to be able to dunk in different situations - wide open, in traffic, alley-oop - in 3 categories of "chance" - minimum, average, and easy. I don't have the figures handy, but for example a 6'2 guy in the key might need a jump rating of 7 to dunk at all, a rating of 9 to dunk averagely, and a rating of 12 or more to dunk easily.
This is also used not just to determine the success of the dunk, but also the player's decision to attempt the dunk at all. A guy just hitting the minimum dunk requirements probably shouldn't be trying too many, and his 'offensive awareness' rating is checked to see if he lays it in instead. It's also checked by the passer in the decision whether to throw an alley-oop pass or not, again following an 'offensive awareness' check.
This is all done within the main "shot" code - a player takes his position into account and if he's at the basket, it checks to see whether to action the dunk or a regular shot. Similarly, the "pass" code factors in the recipient's position and will action an "alley oop pass" if the conditions are met.
I haven't completed the code for the alleyoop dunk finish as yet, but it will be a minor adjustment to the code I have for regular dunks.
Politics, n. Strife of interests masquerading as a contest of principles.