View Single Post
Old 09-08-2014, 03:06 AM   #37
Join Date: Dec 2003
Location: Sydney, Australia
Originally Posted by Groundhog View Post
After that's done, much of the core "basketball" stuff will be coded and creating additional plays for the most part should be fairly straight forward.

Yeah, so, not quite.

The further I got along in my coding, and the more decisions/outcomes I had to come up with, the less happy I got with the direction I was going in.

One of the real drivers for me to make this sim is to develop a strategy-focused sim that simulates a real(ish) game of basketball. I'm a huge fan of Brian's Fastbreak sims and I think they do a great job of generating realistic results and stats. I'm looking to approach it from the other side - a sim that attempts to accurately model a game of basketball. I think the disadvantage to doing it this way is that, the more complex it gets, the harder it's going to be to get realistic results.

From watching a lot of FIBA basketball at the world cup and thinking about it from a sim perspective, I had some more ideas about how I would like my sim to work. Most teams have basic sets they run with a number of options they are specifically looking for, but a lot of the time they make a play based on what the defense gives them - ie. if a team throws a 2-3 zone at them they'll find the three point shot is there if they want it, regardless of what set they are running (often to their own detriment), etc.

Currently my sim has been built very play-specific. Obviously plays and sets will still be an important part of any strategy-focused sim, but I wanted the ability to break from a play at any given moment when a scoring opportunity presents itself.

To do this, I created a function that defines where the defenders are on the court, and another that checks both this as well as the team defensive strategy to determine which offensive players are open.

For the defender's court position, for m2m it's an easy calculation, but for zone - 2-3 and 3-2 only at this stage - I defined where each defender should be relative to the ballhandler as well as what area on the court they are responsible for on the pass. For example, in a 3-2 zone the 4 and 5 man might be covering the low post if the ball is at the top of the key, but on a pass to either corner 3, they would be expected to rotate out and pick up the shooter. The defender's speed and defensive awareness determines if they make it to the player in time to prevent him being flagged as "open", with it being more difficult the further the player is from the shooter - in this case, he would be required to move across 3 zones to reach the shooter.

Each step of a play the sim calculates where the offensive and defensive players are, and if the offensive players are open. Taking into account whether a player off the ball is open, for example against a zone or a defender hedging off his man, the play could break, and a pass be actioned to the open man. The sim takes into account the skill of the player in scoring from the position he is in and determines if it's a good play to make the pass - the offensive awareness rating then determines if the player makes the good or bad play.

Right now this is 50% coded and 50% scribbled onto my notepad, but I'm putting a lot of effort into making this part of the game as "smart" as possible - also taking into account the ease of passing from each point on the court to another - ie. if a guy has the ball in the left corner, it's much more difficult to complete the pass to the opposite corner than it is to dump it inside.
Politics, n. Strife of interests masquerading as a contest of principles.
--Ambrose Bierce
Groundhog is offline   Reply With Quote