Improved identification of rookie contracts in real players leagues

July 15, 2021-

The new player mood system introduced last year is working pretty well overall, but there are some small issues with it. One is related to a mood bonus given to players on rookie contracts, where it says "Eager to sign first non-rookie contract" and gives a big +8 bonus. This gives BBGM something like the NBA's restricted free agency, because it results in your drafted players being less likely to refuse to re-sign. (For FBGM and ZGMH, it only applies if you diasble the hard cap setting.)

Some people have noticed that the bonus was not correctly applied for some real players in historical leagues. Why? Because it was kind of hacky code. It identified "rookie contract" by comparing a player's draft year, the expiration year of their contract, and the length of a default rookie contract for their draft round.

This works fine for random players, since their rookie contracts all are generated by the game and all follow that same formula for length. But it's a bit tricky for real players leagues, or for custom league files, because they may have different length rookie contracts.

Today I have changed how rookie contracts are stored in the game. There is now an explicit rookie flag in the contract, so a player contract looks like this internally if it is a rookie contract:

{
    "amount": 1000,
    "exp": 2025,
    "rookie": true,
}

That makes some of my code simpler, since it's now easy to check if a contract is a rookie contract, which happens a few different places in the codebase. But it doesn't actually solve the problems mentioned above, because it still needs to figure out when to set that rookie flag.

After much thought (and I'm probably still forgetting some edge case), here's what I came up with:

So yeah, there's still some drawbacks. But in all cases where it won't work quite right, I think it still works better than the old way, and more contracts will be correctly identified as rookie contracts. But I could be wrong about that. And of course there could be bugs. Please let me know if you notice anything funny.

Maybe this gives you a taste of how complicated it gets maintaining a video game with a bunch of users and a bunch of old code. This seems like a really little thing, and maybe it would have been if I had done it like this in the first place, but it's sometimes hard to go back and fix things that were not done correctly in the first place.