One of my 'oh wow' moments ;-)

While testing my trader cleanup code I stumbled over something that might interest you guys.

To test the behaviour of my trader cleanup code with stacks, I sold small stacks of arrows to the arrow seller in Cyseal. I needed to know what amount of arrows I could expect the trader to have after cleanup, so I changed the treasure table for the trader to have exactly 10 fire arrows and 10 silver arrows and no other arrows. (... too lazy to add more entries than the stuff I was interested in ;-)
I used a levelup skill so I could force trade treasure regeneration.

After a couple of tries (with quickload) I noticed that the amount of arrowheads the trader carried looked suspiciously familiar.

So I did many additional loads and tests, noting the number of generated arrowheads for each level.
The result: every time the same types of arrowheads with the same amounts were created !
(My tests went from level 1 to level 10.)
When I visited Celia the Enchantress or the Fish Vendor first, these numbers changed, but redoing that in the same order always produced the exact same result.


So I became really curious and placed three barrels on Cyseal Beach where characters start. I already have two crates there for testing purposes. I gave the 3 additional barrels the treasure 'MegaBoss' and made them level 20.

Started a new game, quicksaved at the beach and then started opening the three barrels, wrote down color and type of items inside. Reloaded, opened one of the test crates and then opened the three barrels, wrote down color and type of items. Reloaded, opened the other of the test crates and then the three barrels, wrote ... Reloaded, opened both of the test crates and then the three barrels, wrote ... Finally reloaded, opened the test crates in reverse order and then the three barrels.
I did this three times for every combination and the result was:
The same content in every case, and the order of treasure was the same, it was not bound to a certain barrel but dependent on the order in which I opened the barrels. (That means, no matter if I opened barrel one, two or three first, the first opened always had 'treasure 1', the second opened had 'treasure 2', the third opened had 'treasure 3'.)
Treasure became different when I opened the test crates before, but that could also be reproduced.
And something 'funny': even a 'Lucky Strike' through Lucky Charm always happened at the same time with the exact same result.

So this is the new treasure generation in EE, it is still random and only appears fixed because we were used to 'save scum' in the same order over and over again. They half prevent randomness by always feeding the seed from the previous treasure generation to the next one which produces the exact same result with an average computer RNG algorithm.
And they feed the seed from the generation, no container UUID or anything else is involved here, because in that case, the treasure would have changed when I flipped the order of opening my test crates before opening the barrels, which it did not.

Basically save scumming is probably still possible if you do things in a different order. At least for chests, barrels, etc.
I did not test mob drops though, it might be different with them although I doubt it. (That means if you want different boss drops, you have to kill the boss before or after another mob. If you only have a boss, it does not matter.)


Since it is more than tedious to save-load-load-load-load ... with only one container involved already, this can be considered a very effective way to 'prevent save scumming' although it's still possible.

The funniest thing is however, that even Lucky Charm drops are included in this 'save-scumming-prevention-treasure-generation' ;-)


So I don't know if I should say 'Thank you Larian' this time.
(After all I only stumbled over this thing because I need to test so much due to missing documentation.)