I've been asked several times if I could explain how the engine simulates certain plays, and recently the running play was brought up. I can give the generic details, I think, without breaking the seal on the game to allow you a better understanding of what the engine is doing. If it goes well, I may present a few more "behind the scenes" type posts with the caveat that when we work on the new update, it may change some of this. But maybe we can get some ideas stirring on something we haven't thought of.
So here, in general, is how a rushing play is simulated:
- Get the formation, style, and tendency from the playbook based on down and distance. Just a random check here to pick the play based on the ones you have listed.
- Set the offensive players on the field based on chosen formation, depth charts, and fatigue.
- Set the defensive players on the field based on the offensive formation, depth charts, and fatigue.
- Select play type from tendency - assume for this example that Run is chosen.
- Select the rusher based on rush frequency settings. Just a weighted random selection based on the players currently on the field.
- Determine if it is a wide rush or a rush inside based on style. More aggressive will be more likely to run wide. WRs always run wide.
- Determine if rusher is stopped at line or behind. Get offensive and defensive average ratings for rushing at location on field (more on that later) based on players on field minus any blocking factors for the ball carrier. Select a tackler based on location that would be trying to make the tackle. Factor in team ratings, ball carrier ratings, and defender ratings to get chance rusher is stopper. If stopped, determine yardage. If not stopped, continue on to next location.
- Repeat this check for each new location with a wide rush getting one more check based on trying to turn the corner up field.
The engine breaks the field of play into different locations to progress through the steps of each play. It's basically a grid from side-to-side and end-to-end. The middle is where the play starts and then it goes out to the sides and then down the field. So, for instance, a wide run would start in the middle and then move outside one location and then try to move down the field from location to location. The locations down the field basically represent 0 or less yards (a stuff), 1 to 5 yards, 6 to 15 yards and 15 or more yards. So if it was determined the runner was tackled in zone 3 down the field, we would then determine how many yards he got from 6 to 15 yards and that is based on the results of that initial check to see if he was tackled. When we get into the 15 or more yards, additional checks are used to determine tackle chances incrementally down the field. There is special code to check plays where the field is compacted (i.e. less than the 15 yards).
That is in a nutshell how the play progresses. I think it's a pretty solid structure, but there are some places where we can make improvements. For instance, when it factors in team average ratings and individual ratings it eventually just lumps everything together and produces a probability number to check for the result, where that could be broken down more into "smarter" logic to take into account mismatches in the teams. More importantly, we should be able to show some of this play progression in the play by play and maybe come up with a way to show some sort of "good play/bad play" analysis like we do for our baseball defensive plays.
The one thing I'd like to emphasize about this is that while we don't track all the players' positions and every step they take, we can account for players' likely locations so even the team average ratings are taking into account the players most likely to be involved in the play.