Improved identification of rookie contracts in real players leagues
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:
The
rookie
flag is correctly set in all new random players leagues, and in all future drafts simulated in any league, because the game obviously knows when a contract is a rookie contract in those situations.In a new league created from a JSON league file with no rookie flags at all, it calculates rookie status the same as before (based on years since draft). So if you're a custom roster maker and you want to override this behavior, explicitly set the
rookie
flag in your rookie contracts like described above. But otherwise, this behavior is the same as before.In a new league created from a JSON league file, if there are any players with completely missing contract data, the game generates a contract on load. When it does this, it will also calculate rookie status the same as before. If you don't want this behavior in a custom roster file, specify a contract for everyone.
In real players leagues, players from the past few decades have pretty decent contract data. In that case, it will label a player's first contract as a rookie contract. I know that's not necessarily true. In reality, 2nd round picks and undrafted free agents don't get rookie contracts. And historically I don't think "rookie contracts" were always a thing.
In older real players leagues, where there is no contract data for some/all players, it handles those like described above for league files containing players with missing contract data.
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.