Author Topic: Writing Royalties - A treatise  (Read 4756 times)

Offline Seabody

  • Global Moderator
  • Watcher
  • ******
  • Posts: 5071
Writing Royalties - A treatise
« on: January 09, 2013, 02:29:38 AM »
I was digging around in the Game's dll files and found an interesting equation that calculates the royalties for a novel. I thought I might share it with you. A note to Script Modders, if I've gotten anything wrong here, please tell me, I'm still learning ;) It's in Sims3.Gameplay.Skills.Writing.SetWritingRoyalty.

First, we assign two variables, conveniently called minValue and maxValue. Each is assigned a hardcoded value - that is, a person who wanted to tune the Writing Skill couldn't easily edit it - it's not available for tuning in any XML file. minValue is assigned to 100, and maxValue is 150. We then pass them by reference into the function GetMinMaxRoyalty. This means that the function is free to change them. If you don't pass it by reference, the function is free to use them but can't change them. Inside of the GetMinMaxRoyalty, the Game compares the Genre you're writing with the Min/Max values for the Genre, and changes the minValue and maxValue values accordingly. For instance, with the Fantasy Genre, it will take the minValue, and add on the value of kRoyaltyFantasyMin. Same for the maxValue. We then have our final minValue and maxValue. Now the Game generates a random number in the range of those two numbers and calls this value "num".

Now we get into the mathematics.

The game creates a new variable called num2, and assigns to this the following calculation: (Your Skill Level) divided by (Max Skill Level) multiplied by (the variable kRoyaltyMaxWritingSkillMultiplier, which is 2). The game then creates num3 and assigns to it (Complete Books Written by you in this Genre) multiplied by (kRoayltyMultiplierChangePerHiddenSkillPoint, which is 0.1). Then the game will check num3. If num3 is greater than "kRoyaltyMaxPercentHiddenSkill" (which is 3), it will reassign num3 to equal 3. Then it creates num4, which it assigns the value of (num) multiplied by (num3). Next it calculates your trait bonus. Traits that give bonuses are listed here according to Genre. Basically what happens here is, if your Sim has a "good trait", it will increase the trait bonus by one per trait, and calls this figure "traitBonus". So if your Sim has three "good traits" for the Genre they are writing, the bonus will be 3. Finally it reassigns the variable num to the value of num + num2 + num4 + traitBonus. In case this seems paradoxal to you, basically we are saying "x equals x + y + z" or, for example, "x = 1 + 2 + 3".

Next it takes into account the Quality of a Written book. If Leto is reading this, no doubt he'll be interested. ;) I won't go into the entire algorithm to figure out the quality here, but it calculates the quality and then checks it. If the book is a flop, num is multiplied by 0.5 and reassigned to num - again, it's a case of "x = x + y +z". Same for a hit, except it's multiplied by 1.5, and for a Best Seller, except it's multiplied by 3. Now we take num, and add to it the value of "num * this.OpportunityRoyaltyIncreasePercentage / 100" and call this "num". I'm not sure what the OpportunityRoyaltyIncreasePercentage is as a number, but I know it's the Royalty Increase from a Writing Op.

If your Sim does not have the High Roller LTR/Trait (still no idea what it is ingame. EA calls it "HighRoller" and describes it as the "Multi Tasker" LTR, but I don't know if that's accurate), this is the end of the journey and you now have your Royalty Value. If you do, however, you will get an extra bonus. num is assigned the value of (num * 1.25), and then it's over.

I hope you found this informative, and easy to follow. :)

Edit: Just found that drift9999 posted this information here. If you don't understand a word of what I've said above, I recommend that you read that, as it's clearer. However, the code itself has changed since drift posted that - I think EA just cleaned it up, though.

Leto85

  • Guest
Re: Writing Royalties - A treatise
« Reply #1 on: January 09, 2013, 07:14:28 AM »
Informative, yes and very interesting. But easy to follow... definately not.
Sorry Seabody, that's not because of you. Mathematics... isn't just my thing. Never was.
But I admire you for your discoveries here though.



Registered members do not see ads on this Forum. Register here.

Offline cathyknits

  • Immortal
  • *****
  • Posts: 898
Re: Writing Royalties - A treatise
« Reply #2 on: January 09, 2013, 12:43:28 PM »
Unless it's factored in somewhere else, "HighRoller" must be the Acclaimed Author LTR - it seems to be the only LTR or skill challenge that directly affects the value of books rather than the odds of getting a high-quality book.
Immortal Dynasty: A Bouquet of Blossoms