02-05-2019, 08:55 PM | #1 | ||
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Very Simple Football Sim (and other projects), A Python-Learning Dynasty
A few years ago, there were several dynasties involving the programming language Python. That inspired me to start learning it, too, and I've dabbled here and there since. One of my goals this year is to finally dive in into Python and get reasonably good at it.
I'm probably going to make a ton of newbie mistakes along the way, even though I've been using programming languages since the 1980s. In some ways (maybe just a few), those who learn Python as their first programming language had an easier time starting out than me. I spent several years using C++ exclusively, and then moved on to C# for the past decade (and PASCAL and several others the decade before C++). Object-Oriented Programming is just the way I see things in code. After a few years of using Python, it still feels wrong to me to declare a variable without explicitly declaring it's type. It feels wrong to just type a list of commands instead nesting everything inside a class. It feels wrong just indenting code rather using { }. Learning Python has been a bit of a culture shock to my OOP structured brain. Very Simple Football Sim I love Very Detailed Sports Sims as much as anyone. Sometimes I'm in the mood to spend 30+ minutes looking over an opponent's roster, making tweaks to my game plan/tactics/lineups. Looking through a list of 50+ players trying to determine just the right FA signing, player to draft, etc. And then spending another 20-30 minutes on the actual game, making adjustments, watching my team slowly inch towards victory of defeat. And sometimes I want to blow through a few seasons in the time it takes to watch an episode of Law and Order. Not a lot of Very Simple Sims out there anymore, so I figured I'd make my own as one of the projects I'll make to help up my Python skillz. Last edited by sabotai : 02-05-2019 at 09:32 PM. |
||
02-05-2019, 09:21 PM | #2 |
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Just tossing out some ideas here...
Plays Everything in the game will be as top-down and abstract as possible, so no specific individual plays. I'm thinking something along the lines of picking a personnel set and play type Inside Run Outside Run Counter Run Option Run Screen Pass Short Pass Medium Pass Deep Pass And choosing personnel set (11, 12, 21, etc) And for Defense, a combination of Personnel Set and Coverage Type 3-4 4-3 4-2-5 3-3-5 4-1-6 3-2-6 Cover 0 (2 players picked somewhat at random as blitzers - weighted towards position and ability) Cover 1 (1 player picked as blitzer) Cover 2 Cover 2 Man Cover 3 Cover 4 Player Attributes A Very Simple Sim should have a very limited numbered of attributes for players. I'm thinking 5-7 attributes for QBs, 3-5 for all other positions. QB Pass Accuracy Pass Strength Read Defense Pocket Awareness Scrambling OL Run Blocking Pass Blocking RB Open Field Running (turn good runs into great runs) Power Running (break tackles and ability to push forward for an extra yard or two) Quickness (ability to make the defenders miss) Pass Protection WR/TE Catching Route Running Read Zone (ability to find and sit in the hole vs. Zone while Route Running would be the main counter to man coverage) Open Field Running (YAC) Run Blocking Pass Blocking (The blocking will obviously be more important for TE than WR, but having a WR with good Run Blocking if you run outside a lot should matter) DL Run Defense Pass Rush LB/DB Run Defense Pass Rush Man Coverage Zone Coverage Pursuit (A defenders counter to Open Field Running) K/P Kick/Punt Accuracy Kick/Punt Power None of these are set in stone. Just brainstorming them right now. Last edited by sabotai : 02-05-2019 at 09:28 PM. |
02-05-2019, 09:28 PM | #3 |
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Also, I'll post my code for the project as I work on it on Github.
GitHub - JayFromNJ/Very-Simple-Football-Sim: A very simple football sim |
02-05-2019, 10:45 PM | #4 |
Dark Cloud
Join Date: Apr 2001
|
will follow along on gh
__________________
Current dynasty: OOTP25 Blitz: RTS meets Moneyball | OOTP Mod: GM Excel Competitive Balance Tax/Revenue Sharing Calc | FBCB Mods on Github |
02-06-2019, 01:48 PM | #5 |
High School Varsity
Join Date: Feb 2007
|
Really cool, have dabbled with this in the past too. Will be watching with interest!
|
02-06-2019, 03:22 PM | #6 |
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Still brainstorming on how plays will be resolved, how plays will be called, etc. Thi sis going to be, at least for Version 1.0, purely a General Manager Sim, so no play calling or setting depth charts. That'll all be handled by Coaches.
Each offensive coach will have several sliders that control how often they run, where they run, what types of passes they call, etc. Coach Play Calling Sliders Run vs. Pass Inside Run vs. Outside Run Roll Out Passes vs. Dropback Passes Frequency of Play Action Options Passing System: Short Passing, Mixed Passing, Vertical Passing Personnel Preferences: List of their preferred personnel sets Example of a Run-First Vertical Passing Coach Run vs. Pass: Run (3) Inside Run vs. Outside Run: Inside (2) Roll-Out vs. Dropback: Dropback (2) Frequency of Play Action: 5 Passing System: Vertical Personnel Preferences: 12, 21 For Defensive Coaches, Sliders Frequency of Blitzes Frequency of Sending Multiple extra pass rushers Man vs Zone preference Play Calling Aggressiveness (higher chance of trying to predict run or pass play instead of just read-and-react) Personnel Options Base: 3-4 or 4-3 Nickel: 4-2, 3-3 or 2-4 Dime: 4-1, 3-2 or 2-3 Preferred Coverages Example of a Tampa 2 Defensive Coach: Frequency of Blitzes: Fewer Blitzes (2) Frequency of Multiple: Fewer Multiple (2) Man vs. Zone: Zone (4) Play Calling: Conservative (4) Base: 4-3; Nickel 4-2; Dime 4-1 Preferred Coverages: Cover 2 How a play will be called For both play calling and play results, I'll use the NFL averages as a base. For example, if in 1st and 10 from their own 25, all NFL teams call a run 50% of the time, and the team's Offensive Coordinator is 2 notches towards the run, he might run 54% of the time. Then, let's say it's an "Inside Run" 60% of the time they run the ball, and the coach's Inside Run vs, Outside run slider is 1 notch towards Outside Run, so now they have a 57.5% chance of calling an Inside Run instead of 60. In other words, there won't be any specific percentages for game plans or play calling. It'll all be relative to the NFL averages. So obviously I have my first real task. Compile a long list of NFL play calling tendencies, personnel usages, blitzing frequency, etc. |
02-06-2019, 10:51 PM | #7 |
High School Varsity
Join Date: Sep 2006
|
On my bucket list is coding a FOF-type game with a better interface (although I think that's FOF9 now). In the 80s, I actually wrote a simple 2-player game on an Atari computer. It was based on a board game called NFL Strategy. My friend kicked my ass in my computer game too.
I will be watching this thread with interest. Best of luck with the coding. |
02-08-2019, 03:48 PM | #8 |
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Play Resolution
Run Plays For running plays, I'm thinking something pretty straight forward. It will resolve in two stages. Start off with the average results for any given situation. Let's say on 1st and 10 from a team's own 25 yard line, run results are: At or behind the line of scrimmage: 7% 1-4 yard gain: 43% 5-9 yard gain: 25% 10-14 yard gain: 15% 15-20 yard gain: 8% 20+ yards: 2% 1) Every player on the field rolls to see how well they did. These results, based on position, will push the numbers up or down. A safety doing well increases 10-14 yard range and decreases 15-20 and 20+ yard range. An OL doing well pushes up 5-9 and and decreases 1-4 and 0 or less, etc. Not too much. A small change over the course of a game can have a big effect. Or not...maybe I'll need to add more than I thought. We'll figure that out later. Roll to find result 2) A player is chosen at random to make a "saving throw" against something good or bad happening. Let's say the result o the roll is run for 5-9 yards and an Inside Linebacker is chosen. If he passes the saving throw, the result will be in the lower range (5-7 yards). If he misses, it'll be the upper range (7-9 yards) Maybe even have a critical hit or critical miss. A critical hit will push the result down to the 1-4 range, a crit miss will make it a 10-14 yard run. Pass Plays These will be a little trickier. Pre-Stage: Figure out the type of pass and who the primary target is, who the secondary target is and who the check down is, what type of drop back, is there play action, etc. Stage 1) How clean is the pocket. Roll to see if the QB gets pressured or not. If pressured, roll to see if sacked. If not pressured, QB throws from a clean pocket. Four results from this 1) Sacked 2) QB pressured into early throw 3) QB pressured, but escapes and is on the run 4) Clean pocket Stage 2) Figure out how open the options are. Similar to the run play, everyone rolls to see how well they do on the play. Maybe I'll make it more specific later, but for Version 1.0, I'm not going to get into who is covering whom. All defenders in coverage roll to lower the completion chances to the 2 options. Just like with the running play, though, how these rolls change the base percentages will be based on the coverage and position for defense, pass play type and position for offense. For example, a Safety in deep zone coverage will have an effect on a vertical route's chance of completion, but not for any short or intermediate routes. Stage 3) QBs make a "Read Defense" saving throw. If he succeeds, he will not throw to his first option if he's covered too much and will instead move on to he 2nd option. Form there, a 2nd Read Defense check. If he passes and the receiver there is also well covered, check down, throw away or check to see if there was a coverage sack. NOTE: I'm also considering another attribute for Coaches that will be the option between "One Read System" and "Two Read System". A 1-Read system will just have 1 option plus a check down instead of the standard 2 options. The advantage will be an easier Read Defense check (since there's only 1) and a lower chance for a coverage sack. The downside is that there's only 1 option per pass play and could result is a lot of check downs and throw aways if the defense plays really well and/or the offense plays badly. But I only hear about these "One Read" types of passing systems in college. Not sure if anyone in the NFL runs such a passing system. Stage 4) A target has been determined (or the QB checked down, threw it away or there was a coverage sack), a pass is thrown. Calculate how good the pass is, calculate the chance of success and the chance for a drop, int, etc. Stage 5) If the pass is caught, calculate YAC. If dropped, incomplete, etc. play over. If INT, calculate result of INT. Now that I type that all out, there seems to be multiple chances for saving throws and general rolls in the passing game where with running plays, there's just 1. So maybe with running plays, I'll pick 3 players at random to make saving throws to change the result of the play. Anyway, still plenty of time to brainstorm this out. Step 1 is to get play calling data, play result data, and throw together some scripts that play out a game of football solely using NFL averages. I can build on top of that from there. |
02-10-2019, 11:21 PM | #9 |
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Some early numbers of the play calling front. Right now I'm using 2014's numbers because that's the last year of Football Outsiders play-by-play that I bought.
Their charting hase several directions for runs: Left End, Left Tackle, Left Guard, Middle, Right Guard, Right Tackle and Right End. For the purpose of this sim, I'm counting runs to the tackles as "Outside Runs". Use your own imagination as to whether that means an Off Tackle, Outside Zone, Sweeps, Tosses, etc. run while playing. And as it turns out, runs in almost all situations have a slight preference to Outside Runs. About a 52%/48% between Outside and Inside. (Had I counted runs to the Tackles as "Inside Runs", it would have been 25%/75%). The only exceptions are on 3rd or 4th and 1. Then it's 35% Outside / 65% Inside. Yes, even on 3rd and 2, the distribution goes back to the 52/48 ratio. 4th and 2 is too low of a sample size, but even that was 8 runs to the inside, 19 runs to the outside. Granted, there is going to probably be a big swing in the distribution when I look at it team-by-team, but for now I'm just interested in league averages. As for Run / Pass, on 1st and 10, that's very near a 50/50 split. For 2nd and 10, it jumps to 60% passes, 40% runs (when a team is on their side of the 50). Most 2nd and YTG (outside of the red zone) plays are around the 60/40 split, until we get down to 2nd and 4. That's close to 50/50, 2nd and 2-3 are 40/60, 2nd and 1 30/70. So for all that talk you'll hear from announcers that "teams love to throw on 2nd and 1. They're entire play book opens up on 2nd and 1" .... yeah, they still usually just run the ball. The 2nd and 10 passing percentage also goes up as teams get to midfield and their opponent's side of the field, and it drops a bit if a team is inside their own 20. And of course, once it's 2nd and 11, the pass percentage jumps up quickly. 2nd and 11 is 75/25, slowly increasing to 80/20 by 2nd and 15 On 3rd downs, teams pass it 85-90% of the time on 3rd and 3 or longer. 3rd and 2 is 75% passes, and 3rd and 1 is 30% passes (These numbers are for when a team is on their side of the 50). When deep in their own territory, 3rd and 1 passes drop even more to just ~15%. But opposite of 2nd downs, where teams start throwing it a bit more, they get more conservative on 3rd downs as they move down the field. At midfield, 3rd and 1 sees 25% passes, 65% on 3rd and 2, but at 3rd and 3 it's back to 85-90%. And then when a team is in enemy territory (21-40 yard line), 3rd and 1 just sees 20% passing, 3rd and 2 is at 60%, 3rd and 3 at 80% and 3rd and 4th and higher is back to 85-90%. And lastly, 4th down numbers mirror 3rd down numbers, except the jump up on passes is stronger. 4th and 1 is usually a run, 4th and 2 is about 80% passes, longer than 3 yards to go on 4th down is almost always a pass (95%+). Sorry if this post is pretty scatterbrained. Just trying to collect my thoughts in one place and show you guys what the numbers show. I'll look at red zone play calling and passing distances tomorrow. Last edited by sabotai : 02-10-2019 at 11:22 PM. |
02-11-2019, 05:32 PM | #10 |
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Red Zone Playcalling
From the 11-20 yard lines, there's not much difference between playing calling Run vs. Pass. On 1st and 10 from the 11-20, teams do get more conservative, running it 60% of the time, and more aggressive on 2nd and 10 passing it 70% of the time. But once they get down to 2nd and 4, it's the same as outside the red zone. 3rd and 4th downs seem very similar to outside the red zone. And when a team has a 1st or 2nd Down and TYG inside the 10, let's say 2nd and 4 from the 6, they get more conservative. Their run percentage shoots up. Inside the 10 yard line (Down and Goal situations) 1st down from the 1: 75% run 1st down from the 2 to 10: 60% run 2nd down from the 1: 70% run 2nd down from the 2-3: 50% run 2nd down from the 4-8: 35% run 2nd down from the 9-10: 20% run 3rd down from the 1: 55% run 3rd down form the 2: 25% run 3rd down from the 3-10: 10% run 4th down from the 1: 55% run 4th down from the 2: 20% run 4th down from the 3-10: <5% run |
02-11-2019, 06:28 PM | #11 |
General Manager
Join Date: Oct 2000
Location: The Satellite of Love
|
Unfortunately, Football Ousiders only splits passes between Short (up to 15 yards down the field) and Deep (over 15 yards). That, to me, is too simple.
I decided to split passes 4 ways. Behind the LOS, Short (0 to 10 yards down the field), Medium (11-20 yards down the field) and Deep (21+ yards down the field) This is where the ball is thrown, not the end result. 1st and 10, Own 20-39 yard line. 17.79% - Behind the line of Scrimmage (Football Outsiders doesn't list if a pass was a check down of a screen) 49.43% - Short 20.61% - Medium 12.16% - Deep And back to the topic of "Teams open up their playbook on 2nd and short", there were 48 pass attempts on 2nd and 1 from a team's own 20-39 yard line. 3 went more than 20 yards (6.25%). I'm not see much variation in pass distance on 2nd down. On 2nd and 4 up to 2nd and 10, Short passes go up some, 57% of passes. Behind the line of scrimmage goes down a bit, 15%, Deep drops a bit to 10% and Medium drops a bit, down to 18%. On 2nd and 1-3, Short drops down to ~50%, and Behind the line of scrimmage goes back up to near 20%. On 3rd and 1 to 6, teams pass short about 65% of the time. But then if falls quickly down to about 35% as Medium rises. And just as teams get more aggressive in picking pass plays the closer they get to their opponent's red zone, their passes get longer too. 1st and 10 from their opponent's 21-39 yard line 15.37% - Behind LOS 46.69% - Short 20.14% - Medium 17.80% - Deep A jump of 5% in Deep passes with a little off the rest. That trend holds true for 2nd down passing as well, Deep start increasing as the rest drop a bit. Jumping to the red zone, obviously only short and behind LOS passes in the last 10 yards, with the vast majority being short passes, 90%+. And everything from 11-20 is Behind, Short or Medium. 1st and 10 in those situations are 17.81% Behind, 34.35% Medium and 47.84% Short The rest are fairly similar. The frequency goes Short -> Medium -> Behind LOS. That should give me enough to build some kind of play calling look up table. |
02-19-2019, 05:02 PM | #12 |
High School Varsity
Join Date: Jul 2016
|
Football sims are the best. Can't wait to see how this develops. (I'm particularly interested in how player ratings evolve over time)
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|