Thursday, March 22, 2012

Strike Zone Heat Maps (Baseball Mogul)

As I mentioned here, this is the year that Baseball Mogul went from being a random number generator (like Strat-O-Matic or previous computer sports games) to becoming a true physics-based simulation of each pitch. However, it's difficult to determine if our model is realistic without having a way to visualize the results. So, I added heat maps to Baseball Mogul 2013, plus the functionality to record data for every single pitch.

Ideally, we should see the same patterns in our data that we see in Major League Baseball. For example, we know from actual pitch data that BABIP (Batting Average on Balls In Play) varies by pitch location:
Heat map by Dave Allen
This heat map is for right-handed batters only, with a view from behind the catcher. Imagine the batter standing to the left of the strike zone.

As you can see, BABIP is slightly higher in the lower part of the strike zone, because low pitches lead to more ground balls, and ground balls turn into hits a bit more often than fly balls.

And, the "hot zone" for BABIP tilts. That is, on low pitches, the highest BABIP occurs just inside the middle of the plate. On higher pitches, this region is a bit farther away from the batter.

This prime hitting zone tilts at this angle because the sweet spot of the bat passes through the strike zone roughly along this line. With the bat (and arms) pivoting on the batter's shoulder, it's easier to reach the high outside corner with the heart of the bat than it is to reach the high inside corner. So, with Baseball Mogul, I modeled the bat moving through the strike zone, by assigning different coeffecients of restitution to each point on the bat. The coefficient of restitution (COR) reflects how quickly the ball comes off the bat at each spot. It can be represented as a parabolic function along the length of the hitting surface, with the COR peaking at the bat's sweet spot.

I hope I didn't lose you with the technical jargon. Simply put, once this COR model is added to the simulation, we should see results that look somewhat like real life. So here's the same heat map from one season of Baseball Mogul:

Heat map by Baseball Mogul 2013
Wow.

I honestly didn't expect it would look that good. As with the first heat map, BABIP is highest from the middle of the plate down to the bottom edge. And, we see the same tilt: on low pitches, the batter is more likely to hit the ball solidly if it's over the inner half of the plate. As the pitch moves up in the strike zone, BABIP improves as the pitch moves toward the outer half.

Very cool. I'm really looking forward to using these heat maps to continue to dig into the new simulation engine.

Tuesday, March 20, 2012

Pitch Tracking and the "Charts" Tab (Baseball Mogul)

Baseball Mogul 2013 now tracks and records every single pitch of your simulation. Pitch type, speed, location, result. etc.

In conjunction with this, we have now added a 'Charts' tab to every player's Scouting Report:


The above chart was created by simulating from the 2012 season through 2025. It shows BABIP (Batting Average On Balls In Play) for all lefties that Strasborg faced.

You can also limit the search to certain pitch types (fastballs, sliders, etc.) and situations (2 outs, RISP, "close and late"). For example, here's Jason Heyward's Slugging Percentage on just fastballs:


Finally, you can limit the search to at-bats against one team or one specific player, such as Dustin Pedroia versus the Yankees from 2012 through 2020:


Saturday, March 10, 2012

Baseball Mogul 2013: Under The Hood, Part 2

For years, people have been asking for direct access to the Baseball Mogul database. Many of them want to be able to build mods that read and parse the data.

For example, Mizerak created a very cool app called the Box Score Parser that sifted through multiple seasons of box scores in order to derive data that can be easily viewed inside Baseball Mogul. Unfortunately, he had to use box scores because they were one of the only things saved in a human-readable form.

Thursday, March 1, 2012

Baseball Mogul 2013: Under The Hood, Part 1

When I first wrote Baseball Mogul, it simulated each game by simulating the result of each plate appearance. This isn't unusual. This is how Strat-O-Matic works. This is how other computer games work. This is even the method I used when writing my very first baseball simulation, using paper and dice, back in 1976.

But the thing is, baseball isn't played with paper and dice. It's played inside televisions. And the game on television isn't determined by comparing player stats and generating a random number. It's determined pitch-by-pitch. Each pitch has a velocity, a spin direction (and magnitude), and the location where it crosses the plate.


Photo by Wall Street Journal

So, for Baseball Mogul 2013, I rewrote the entire simulation engine to calculate:
  1. The velocity and path of each pitch (similar to that recorded by PITCHf/x).
  2. The timing and velocity of the bat swing.
  3. The plane of the bat swing (and the location of its sweet spot).
  4. The angle and velocity of the hit that results from the above.

Sunday, February 26, 2012

When Zombies Attack ... Morons


The Walking Dead is dumb. The premise is dumb. The writing is dumb. And the characters are especially dumb.

Sunday, February 5, 2012

Worst Call In Super Bowl History

Photo by Ed Yourdon
I realize that it's hyberbolic to call today's safety call the worst in 46 Super Bowls. But somebody needs to do it. Right now, there are thousands of people out there Googling "worst super bowl call ever", and they need to be able to find something.

Thursday, January 26, 2012

Super Bowl MVP Predictions

Photo by Keith Allison
As mentioned on Sunday, we used Football Mogul to predicts the results of Super Bowl XLVI by simulating the game 100,000 times. We also recorded the MVP of each game.

Odds are that it will go to a quarterback. But there's a 48.7% chance of someone else taking home the MVP trophy.