Jump to content
Sign in to follow this  
Carnage-

Taming the RNG

Recommended Posts

There has been significant resistance to any attempts to change the way loot is generated and I don't really blame those in opposition. From a code point of view, the loot generation is highly complex, very difficult to follow, hard to test and easy to break. From a player point of view, any significant changes devalues hours of work they may have already put in. On the other hand, the end game seems to have sunk into farming campaign map weapon rewards and (mostly) Lab assault for everything else. So I am proposing a method by which we can tweak the RNG in a controlled manner which also opens up the possibility of making different maps attractive for farming.

First some background and some maths.

In an over simplified way, the game generates loot by randomly (usually, some end map rewards are fixed) selecting an item type (eg weapon, armour, acc) then randomly (again, most of the time; some rewards have fixed stats) generating stats for them. This random function has many different inputs based the difficulty of the map and the item being generated but is entirely responsible for the quality of the generated item, a point to note is - it doesn't randomly pick quality then generate the item based on that but instead generates the item and assigns quality afterwards.

This function is the main bit that no-one wants to mess with, thankfully with a little bit of maths we can avoid doing so. We can treat it as a black box and then reason about it's outputs based on it's input without changing it. For the purpose of this thread, I will refer to the function as g(). So what can we say about g()?

1) g() is a random function; this means that it will have a distribution of outputs based on it's inputs (instead of a single output from a set of inputs)

2) g() will give you a different output each time you call it, even with the same inputs.

3) g()'s output will have an average value and a standard deviation (different for each set of inputs)

Based on the above, we can say things like if you run kings game survival wave 25 with 4 players on nightmare, hardcore mix mode 100000 times you can expect the average quality of armour to be X, we can also say things like we expect that Y% of armour will be trans or better. Without actually running the above map 100000 times, there is no way to calculate X and Y so we will have to leave them as unknowns.

---------

Given the above reasoning, is it possible to change the values of X and Y observed by a player WITHOUT altering the function g()? Yes, there are several ways we could do this I will present one of them.

The idea is quite straight forward. During the generation of an item, once g() has been called (but before the item is dropped) we could add some code to examine it, this code can implement some conditions eg is this survival, is the wave > 24, is it nightmare, is the loot worse than trans? If true, call g() again and use the second result.

This will (roughly) double the value of Y from the previous example: improving the quality of the loot as more of it will be Trans+ (We can cause a smaller effect by only doing the reroll 50% of the time or 5% of the time; a greater effect could be achieved by increasing the number of rerolls to 3 or 4). This effect can be finely tuned and worked out mathematically - no more "I feel that the RNG has been nerfed/buffed" We can explicitly say: "RNG loot has been improved by 10% on survival waves 24+"

How does this improve replay-ability of older maps? Simple; the rules for when to apply this RNG boost can be fairly complex if required so we could say: is this the last survival wave of royal gardens and is the item a leather helm? If true, reroll* up to 10 times until you get a supreme+. This then makes royal gardens the go to map for leather helms. 

(*For some maps in order to get a loot boosting effect it may be required to roll ten times and pick the best instead of discard + reroll due to chances of high quality gear being low to start with)

---------

TL;DR:

Create map specific boosts to specific item types (eg leather helms) by rerolling poor stats on items to improve farming diversity.

Share this post


Link to post
Share on other sites

Prepare yourself for lots of old-timers crying over their spent time being devalued.

I still think a better solution still would be to scratch the entire terrible loot generation code and write a new one. But something has to be done.

Share this post


Link to post
Share on other sites


@Kuugen quote:

Prepare yourself for lots of old-timers crying over their spent time being devalued.

I still think a better solution still would be to scratch the entire terrible loot generation code and write a new one. But something has to be done.

The beauty of this idea is it doesn't require the huge effort to rewrite from scratch and it allows precise control over changes. Each of the post shards maps could be given a different boost - all helms, all leather armour, all squire weapons etc giving reason to play all of them depending on what you are looking to farm.

Share this post


Link to post
Share on other sites


@Kuugen quote:

Prepare yourself for lots of old-timers crying over their spent time being devalued.

I still think a better solution still would be to scratch the entire terrible loot generation code and write a new one. But something has to be done.

I've spent a while reading through the loot generation code, and there's nothing inherently wrong with it. The main issue is the relative disparity of loot rewards vs gear needed to complete the level. ;)


For no reason I can find, the important numbers about /why/ there's only one useful survival map aren't anywhere on google, so here we go:


EquipmentWeightingMultiplier=11.0

EquipmentQualityMultiplier=2.4

MapAdditiveDroppedEquipmentQuality=0.131,

EqupmentRandomizerAdditionPerScalingWave=0.45,


From looking at the (fairly tortuous) code, you can more-or less work out that Lab Assault has an item scaling of 26.4 - this is higher than any other map. 


Moonbase is EquipmentQualityMultiplier=2.2,EquipmentWeightingMultiplier=4.78 (10.5), and Embermount has 2.5 * 10 (25). 


That's then essentially multiplied up by a bit for hardcore, a bit for MM and then finally it's more-or-less just scaled by the wave. That final, single number ('quality', which incidentally could really do with being on the UI!) is then turned into the loot type. I have tried to do the maths, and work out which quality converts to which type of item, but the table goes from Godly at 8.5 to Cursed at -1000, then Mythical was hacked in at -4000 (!), which is about the point where the progression goes completely off the rails. Basically, your Roll is scaled up by the level, then the wave, then turned into Stats, then the game ret-cons those stats into an EquipmentRating, THEN it uses that against the hacked table of ValueThresholds, in order to set the Myth/Trans/Etc type.

I would suggest that a Drops-Per-Minute addition, as above, would work well - X map on Y difficulty should have guaranteed minimum item quality, and guaranteed rewards of type Z - you simply have an increasing pressure to drop a new item of the maps' pre-determined loot quality. Tada, fixed.

Share this post


Link to post
Share on other sites

@DjArcas quote:

@Kuugen quote:

Prepare yourself for lots of old-timers crying over their spent time being devalued.

I still think a better solution still would be to scratch the entire terrible loot generation code and write a new one. But something has to be done.

I've spent a while reading through the loot generation code, and there's nothing inherently wrong with it. The main issue is the relative disparity of loot rewards vs gear needed to complete the level. ;)


For no reason I can find, the important numbers about /why/ there's only one useful survival map aren't anywhere on google, so here we go:


EquipmentWeightingMultiplier=11.0

EquipmentQualityMultiplier=2.4

MapAdditiveDroppedEquipmentQuality=0.131,

EqupmentRandomizerAdditionPerScalingWave=0.45,


From looking at the (fairly tortuous) code, you can more-or less work out that Lab Assault has an item scaling of 26.4 - this is higher than any other map. 


Moonbase is EquipmentQualityMultiplier=2.2,EquipmentWeightingMultiplier=4.78 (10.5), and Embermount has 2.5 * 10 (25). 


That's then essentially multiplied up by a bit for hardcore, a bit for MM and then finally it's more-or-less just scaled by the wave. That final, single number ('quality', which incidentally could really do with being on the UI!) is then turned into the loot type. I have tried to do the maths, and work out which quality converts to which type of item, but the table goes from Godly at 8.5 to Cursed at -1000, then Mythical was hacked in at -4000 (!), which is about the point where the progression goes completely off the rails. Basically, your Roll is scaled up by the level, then the wave, then turned into Stats, then the game ret-cons those stats into an EquipmentRating, THEN it uses that against the hacked table of ValueThresholds, in order to set the Myth/Trans/Etc type.

I would suggest that a Drops-Per-Minute addition, as above, would work well - X map on Y difficulty should have guaranteed minimum item quality, and guaranteed rewards of type Z - you simply have an increasing pressure to drop a new item of the maps' pre-determined loot quality. Tada, fixed.

Aside from it being a total mess to look at, I agree that there is little wrong with the code as is. The trouble is that a high multiplier doesn't translate into better gear. The reason for this is that in order for something to be Trans+ it has a minimum upgrade levels requirement with the code as is, the upgrade levels roll over to 0 once you get to a high equipment multiplier making Trans+ less likely. This is why you'll often see myth items with 10 upgrade levels and 300+ in several stats - had the level not rolled over on that item it would have been an ultimate. 

Share this post


Link to post
Share on other sites

Yup, agreed that the modulo-256 bug should be fixed. I can't imagine it was by design - there just wasn't any gear of that level when that code was written.

Share this post


Link to post
Share on other sites


@DjArcas quote:

Yup, agreed that the modulo-256 bug should be fixed. I can't imagine it was by design - there just wasn't any gear of that level when that code was written.

I suggested fixing that bug; was pointed out that it would cause a lot of testing an other overhead to just fix it out right. So I suggested this solution as a more controlled way of bringing gear rewards in line with effort expended (esp on survival). 

Share this post


Link to post
Share on other sites


@Carnage- quote:


@DjArcas quote:

Yup, agreed that the modulo-256 bug should be fixed. I can't imagine it was by design - there just wasn't any gear of that level when that code was written.

I suggested fixing that bug; was pointed out that it would cause a lot of testing an other overhead to just fix it out right. So I suggested this solution as a more controlled way of bringing gear rewards in line with effort expended (esp on survival). 

Whilst testing is always good, the worst-case scenario I can possibly see from this is 'You end up throwing away a lot less gear'

Share this post


Link to post
Share on other sites


@DjArcas quote:

Whilst testing is always good, the worst-case scenario I can possibly see from this is 'You end up throwing away a lot less gear'

Worst case scenario is perfect Ult++ pristine armour dropping on easy deeper wells...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...