Posts tagged "Penalties"


I rewrote the football game simulation engine to fix weird bugs and improve penalties

One frustrating thing about Football GM, both for me and for users of the game, is all the game simluation bugs. There are fewer than there used to be. I try to track them down and fix them when people report them to me. But sometimes, that doesn't work very well.

Like I got a bug report that sometimes the ball carrier would cross the first down line, fumble, the offense recovers the fumble behind the first down line, and yet it still counted as a first down.

I investigated it, found the part of the code that was doing the wrong thing, and... I couldn't fix it. The bug was ultimately caused not by a little typo or mistake, but a fundamental problem in how game simulation worked. Specifically, the problem was that there was no sense of history. All of the "state" of the game (possession, down, distance, score, etc.) was stored just once. As the game progressed, state was updated. But what if you need to go backwards? Like the aforementioned first down line example. Or, even more troubling, penalties. With penalties, there is always the possibility that anything that happens in the game could be reversed. I had some hacky code to handle some of that, but it was limited, mostly by the fundamental problem mentioned above.

Read more...