|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
General::General Discussion General discussion about EverQuest(tm), EQEMu, and related topics. Do not post support topics here. |
 |
|
 |

09-20-2012, 01:12 AM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
ok i think I am getting a grasp of the new concept now.
From what I see if all item in the lootdrop have identical chance to drop, then it doesn't matter what % they are given as long as its equal.
In other words:
if mindrop 1, droplimit 1, multiplier 1
then
item1 10%
item2 10%
item3 10%
item4 10%
item5 10%
item6 10%
item7 10%
item8 10%
item9 10%
item0 10%
is equal to:
item1 66%
item2 66%
item3 66%
item4 66%
item5 66%
item6 66%
item7 66%
item8 66%
item9 66%
item0 66%
but next question arises about efficiency:
you said that the new code will "keep rolling" until it roll the needed value.
so if items all set to 10% and NONE fall within 10% on the first roll, the system has to roll again and again until one of them does. Of course the chance of that is small - but isn't it a strain on the system?
Theoretically the rolling can go on indefinitely, isn't it?
Another issue arises when more than 1 item suddenly satisfies drop parameters but with droplimit=1, how does system chooses which item drops if say all 10 have been rolled successfully?
Not to criticizing all the hard coding you put into it, but wasn't old system a bit simpler/faster? Since its only rolled once on the item list?
I know that the RND was bugged, and item order affected RND in a bad way, but wasn't fixing RND a more straight forward solution, than the a whole new approach?
Of course, I am not the person to judge the code on its performance, but just trying to think out loud and understand the reasoning beyond the rewamp 
|
 |
|
 |

09-20-2012, 01:14 AM
|
 |
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,072
|
|
That was a concern I had for Cavedude at the time but the way he had implemented poses no real performance hit whatsoever.
|
 |
|
 |

09-20-2012, 02:10 AM
|
 |
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
Quote:
From what I see if all item in the lootdrop have identical chance to drop, then it doesn't matter what % they are given as long as its equal.
|
It doesn't matter what the other items are doing, the only percentage that matters is the current item's chance. But, if neither droplimit or mindrop are set, then the percentage most certainly matters. If it's set to 1%, you'd be lucky to get a single item to drop. It it's set to 90%, you have a good chance of every item dropping. But, not every item has to be equal, and they don't all have to equal 100%... You could have 50 items in a lootdrop table with chances ranging from 0.01% to 100% if you wanted. In that case, yes the NPC could drop all 50 items if you're super lucky and you haven't set a droplimit.
droplimit = 1 the first item that rolls successfully drops, the remaining items aren't even rolled. As I said in the first post the order which each item is rolled is randomized each time, so when you do set a droplimit, the same item won't drop over and over again because it's first in the list.
There isn't a performance hit, PEQ showed no difference in time to boot zones. That was a concern of mine at first too, but KLS believed that if done right, we wouldn't see an impact provided we didn't have super long unlimited lists. It turns out he was correct. So, if you have a long list of 100+ items, be sure to set a droplimit so the server doesn't have to iterate through every item. (Although, the code does set a droplimit for lists 100+ automatically.) Rolling will never go indefinitely, but setting a high mindrop or not limiting long lists certainly can increase the rolls. Basically, if you're smart about your setup you'll be fine. In your example, if all the items failed they are only re-rolled if a multiplier is set to 2 or above or mindrop is 1 or above. If neither are true, then the loop ends and the table drops nothing.
Fixing RNG has nothing to do with this... This new system is far more powerful and indeed simpler than the old one. Seriously, the old system was unnecessarily complicated and backwards. Probability is gone, there is no longer a need to have multiple lootdrop tables, those tables no longer need to equal 100%, and we now have a method to have complete control over how many items drop, whether that be a specific number or a range without fiddling with multipliers or multiple tables.
|
 |
|
 |
 |
|
 |

09-20-2012, 12:40 PM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
Quote:
Originally Posted by cavedude
Fixing RNG has nothing to do with this... This new system is far more powerful and indeed simpler than the old one. Seriously, the old system was unnecessarily complicated and backwards. Probability is gone, there is no longer a need to have multiple lootdrop tables, those tables no longer need to equal 100%, and we now have a method to have complete control over how many items drop, whether that be a specific number or a range without fiddling with multipliers or multiple tables.
|
Oh Cavedude I strongly disagree that multiple lootdrop tables are no longer needed.
Look at following example:
So I have a Zombie in old system.
I want zombie to drop 1 body part and 1 weapon item on every kill
So you NEED 2 loottables for this:
loottable 1 - has all the zombie body parts in it
loottable 2 - has all the weapons in it
If you try to put this into same loottable and give a multiplier of 2 - you may end up in getting 2 weapons or 2 body parts per kill instead of 1 body part +1 weapon.
In your new system, this is still the case.
More to that, I don't have just 1 zombie type on my server, I have 50 different zombie TYPES from level 1 to level 50, EACH of whom can drop the SAME body parts, yet different gear.
For each of those npc types its much more practical to use TWO loottables - one to handle common body parts and another to handle gear drops, rather than to keep adding body parts into each and every gear table for each npc types.
Not to mention that gear loottable can be shared with other npcs - orcs, gnolls whatever, who can still drop the same weapon but NOT the zombie parts.
As you can see its way more practical to have:
-a loottable that handles create type unique items (per create type)
AND
-a lootable that handles universally shared items like weapons for given level range
and then use permutation of those to construct complete loottables for any given npc.
level 10 zombie will use:
-level 10 weapons table
-zombie body parts table
level 50 zombie will use:
-level 50 weapons table
-zombie body parts table
level 10 orc will use:
-level 10 weapons table
-orc body parts table
level 50 orc will use:
-level 50 weapons table
-orc body parts table
So as you can see I used 3 loottables to represent 4 different npcs.
And the difference only keeps growing as tables shared among even greater number of mobs, without the need to create unique table for each.
---------------------------------
PART 2
back to the subject on new system in general.
Going back to my example of where new item % drops are essentially multiplications of old probability times old item chance.
Math wise everything is the same, but human intuition wise - its a extra step added to get what you need.
In old system I would say: "I want an orc to drop 1 weapon out of 10 random ones once per 4 kills". And i would set my tables like this:
Loot_entry: mult 1, probability 25%
Loottable: 10 items with 10% chance each
In NEW system this converts to:
mult 1, droplimit 1:
each item set to 2.5%
Everything is identical MATH wise.
BUT in my mind to place data into DB with NEW system in mind, I still have to calculate "what I need" the OLD way, then do the multiplications in my head, and enter data the NEW way.
Now exmaple above is simple - cause its just 25% X 10%
now try soemthign liek this:
I want a mob to have 33% chance to drop something on his table that has 10 items in a following manner:
-item1 12%
-item2 9%
-item3 11%
-item4 8%
-item5 27%
-item6 13%
-item7 8%
-item8 2%
-item9 7%
-item0 3%
In old system I just set probability to 33% and items to what I want them to be.
In NEW system I have to do ALL OF THE WORK ABOVE PLUS do all the multiplication of item chance times the 33% and then put them in the DB.
I honestly don't consider this approach easier :(
The addition of droplimit and mindrop is GOOD.
But removal of loot_entry probability is not so great in my opinion - it makes things much harder to calculate in your mind and requires unnecessary per-calculation steps.
|
 |
|
 |
 |
|
 |

09-20-2012, 01:15 PM
|
 |
The PEQ Dude
|
|
Join Date: Apr 2003
Location: -
Posts: 1,988
|
|
First off, you're over thinking everything including my explanations!
Obviously we still need multiple lootdrop tables, that's why I didn't touch that. What I mean simply is we now have ways to reduce all of our tables down to 1 if we so choose. The old way, we essentially were forced into using multiple tables.
Okay, completely forget about the old system... Probability never existed, in fact EQEmu never has had a loot system before today. As a human, when you flip a coin what is the chance it'll land on heads? 50%. Now do you think well, it becomes 25% because there is a 50% chance I won't even flip the coin? No. You will always assume whatever prerequisite is already met before figuring out chance. That's what I've done. That table is always going to roll true, you're always going to flip that coin. Now what do you want the actual chance of an item dropping to be? We only multiplied chance by probability to convert to the new system. From here on out, forget about doing that in your head. How often do you want the item to drop, figure that out and put it in your DB!
|
 |
|
 |

09-20-2012, 01:57 PM
|
 |
Dragon
|
|
Join Date: Nov 2008
Location: GA
Posts: 904
|
|
Going from 1) Probability 2) Multiplier 3) Chance Per Item
To 1) Mindrop 2) Maxdrop 3) Multiplier 4) Chance per Item
= Easier?
Does not compute. I understand what you're trying to accomplish, but the math is more difficult. My tables are already setup so that if I want something to always drop, it does, and if I want it to be rare, it is. I'm not seeing how this system is going to simplify that.
I'm still going to have to have multiple lootdrop entries in order to control the differences between loot sets (quest items, random loot, guaranteed drops, etc) so nothing there has changed.
/mindblown
|
 |
|
 |

09-20-2012, 03:05 PM
|
 |
Demi-God
|
|
Join Date: Mar 2009
Location: Umm
Posts: 1,492
|
|
Quote:
Originally Posted by cavedude
Okay, completely forget about the old system... Probability never existed, in fact EQEmu never has had a loot system before today. As a human, when you flip a coin what is the chance it'll land on heads? 50%. Now do you think well, it becomes 25% because there is a 50% chance I won't even flip the coin? No. You will always assume whatever prerequisite is already met before figuring out chance. That's what I've done. That table is always going to roll true, you're always going to flip that coin. Now what do you want the actual chance of an item dropping to be? We only multiplied chance by probability to convert to the new system. From here on out, forget about doing that in your head. How often do you want the item to drop, figure that out and put it in your DB!
|
Cavedude, this approach looks easy when you only have 1 item in question that you setting chances for.
Obviously if my only dilemma to drop a Rusty Mace at 25% chance I am not going to set it to 50% check to drop anything at all and then another 50% check to drop the Rusty Mace.
However once multiple items come into play the new approach becomes a more complicated way of looking at things.
Imagine following (old system):
Imagine you have a orc who may or may not have a BAG.
In side that bag he may have 1 out of 10 items each with different % chances.
So old system would very roll to see if an orc had a BAG at all, and then it would start looking at - what exactly was in the bag?
So if I want to set it up such that Orc has 33% to "have the bag" (in other words "have anything to drop at all"), and in that bag I want an Ultra Rare Sword to only drop 1 time out of 50, I would use the Old system to set:
-general lootentry to 33%
-specific item in that loottable to 2%
-all other items in that loottable to other % as it suits their rarity
And that's it - system runs itself.
But in new system to achieve all this I have pre-calculate all that and THEN multiply all my values to 33% and then put them into the table.
This leads to: my simple system of:
-orc has "a bag with loot" 1/3 of the time
-the bag has Uber Sword 1/50 of the time
to "Mob drops sword 0.66% of the time" which is counter-intuitive to me ...
Now imagine there are 9 other items "in the bag" and I will have multiply each and all of them by 33% to get the values for the new system.
I am not talking about just internal math/coding inside the server- I am talking about the way human brain approaches this. When you want a mob to drop something you not thinking in terms of "I want this mod drop to Uber Sword 0.66% of the time and a Chain Bracer 8.25% of the time".
This is most definitely not an easier way to think (as a human).
Most people (server devs I guess) when they are designing the loottables they won't thinking in terms: "I want the Uber Sword to drop 0.66% of the time" They would think in terms: "I want an orc to drop a bag with loot 1/3 of the time, and 1 out of 50 there will be an Unber Sword there"
Extend this logic to 10 or even more items pet loottable and you see how much more complicated setting up the data becomes.
You are forced to move from nice round numbers like:
-mace drops 10%
-sword drops 15%
etc
to things like:
-mace drops 3.33%
-sword drops 1.678%
etc
Again, the final math will be the same, but setting up the tables is definitely becomes a headache. :(
|
 |
|
 |
 |
|
 |

09-20-2012, 05:00 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
I think I am understanding this new system, but haven't been through the code that supports it yet. I do have one concern though based on the stuff I have been reading in this thread. I have seen a few statements in this thread saying that the old system had to total 100% for the chance in the lootdrop_entries for any given lootdrop_id. This is not true, and if I am understanding the new system and SQL provided for converting it, this could break loot drops for any server that was not following that rule.
The way the old system worked with chance is that it totals the chance from all items with the same lootdrop_id in the lootdrop_entries table. It then rolled the chance to drop for each item against the total from all entries for that lootop_id. So, whether you have 10 items all set to 10% chance or 10 items all set to 100% chance, the result would be the same.
Here is an example:
item1 10%
item2 10%
item3 10%
item4 10%
item5 10%
item6 10%
item7 10%
item8 10%
item9 10%
item0 10%
So, the total chance is 100 in this case. It would then roll 1-100 for each item (starting at a random item location in that list) until one of the rolls was less than or equal to 10. This gives it 2 points of randomness when choosing the drops, where the first point is the random point that it starts in the list and the second point is the rolling of each item until it finds a winner.
Here is another example:
item1 100%
item2 100%
item3 100%
item4 100%
item5 100%
item6 100%
item7 100%
item8 100%
item9 100%
item0 100%
In this case, the total is 1000. So in the old system it would then roll 1-1000 for each item, effectively giving each of them a 10% chance to drop, the same as the first example.
I regularly started using values of 100 for chance for lootdrop_ids that were all supposed to have the same drop rate. My reasoning was that it means there is no math involved at all when setting drop rates, because you don't have to manually add up the totals and verify they total up to 100. I don't have to set 5 items each to 20, or 10 items each to 10 or 7 items each to 14 (which would actually be 5 set to 14 and 2 set to 15 to total 100) to make equal drop rates.
My concern is mainly with the SQL to convert the chances. If I am understanding the SQL from Cavedude correctly, my lootdrops that are set to 100 would now each have a 100% chance to drop (assuming probability of 100 was set for them). So, in the new system, it would always pick the first item it rolls for. The only saving point is that the new system should still be picking an item from the list to start rolling at by random, so there would still be a random factor in it. The problem is that there wouldn't be 2 random factors in cases like this like I mentioned previously.
I haven't messed with it yet, but I think it is probably possible to write a different query to do the conversion from the old system to the new that would take this issue into account. It would also correct any issues with loot drops where someone didn't do their math correctly when trying to total 100 in the chance field for a lootdrop_id.
I would guess we can use SUM() to total up the chance field for each lootdrop_id, and then do chance * 100 / total for each individual entry for that lootdrop_id before doing the rest of the math that cavedude provided for calculating the new chance values. For example, if the total is 1000 for 10 items that are each set to 100, SUM() would get 1000. So we would do chance * 100 / 1000 to get a value of 10 for each entry, which is what the chance should have been if following the concept of totaling them all to 100.
Here is another example to break it down and show a more complex result:
item1 50%
item2 50%
item3 20%
item4 20%
item5 60%
The SQL to convert this would then need to total those chances up to 200, and then it would do chance * 100 / 200 that was set there for the following results:
item1 50% (50 * 100 / 200 = 25%)
item2 50% (50 * 100 / 200 = 25%)
item3 20% (20 * 100 / 200 = 10%)
item4 20% (20 * 100 / 200 = 10%)
item5 60% (60 * 100 / 200 = 30%)
So then they would all total 100% chance.
Since SUM() has to be ran in a select and you can't select from a table while updating the same table, I think we would just need to create a temporary table to store the SUM() totals for each lootdrop_id and the id of the lootdrop_id, then we can do the rest of the math in a second query for the updates while selecting the sum values from the temp table. Then just drop the temp table.
The SQL should be something like this (untested):
Code:
CREATE TEMPORARY TABLE temp_table (
lootdrop_id INT(11) PRIMARY KEY,
chance_total INT(11) DEFAULT 0
);
INSERT INTO temp_table ( temp_table.lootdrop_id, temp_table.chance_total ) (SELECT lootdrop_entries.lootdrop_id, SUM(lootdrop_entries.chance) FROM lootdrop_entries GROUP BY lootdrop_entries.lootdrop_id);
UPDATE lootdrop_entries, temp_table SET lootdrop_entries.chance_total = (lootdrop_entries.chance_total * 100 / temp_table.chance_total) WHERE lootdrop_entries.lootdrop_id = temp_table.lootdrop_id;
DROP TEMPORARY TABLE temp_table;
This would need to be ran prior to the conversion cavedude committed, which is this:
Code:
update lootdrop_entries lde
inner join loottable_entries lte ON lte.lootdrop_id = lde.lootdrop_id
SET lde.chance = (lte.probability/100)*(lde.chance/100)*100;
I think that should resolve any issues with converting from the old system to the new. The only thing that might need to be accounted for is any lootdrop_ids that are set to a total chance of 0, as I think that might cause an error when trying to divide by 0.
Again, this SQL is untested, so do not run this until it has been tested and verified to work as intended!
If I am misunderstanding something with the new system, please let me know
FYI, this is what ChaosSlayer meant by setting them all to 10% or all to 66% is the same thing in the old system. As long as they were equal values, the chances were equal no matter what.
Last edited by trevius; 09-20-2012 at 05:14 AM..
|
 |
|
 |
 |
|
 |

09-20-2012, 03:26 AM
|
Dragon
|
|
Join Date: May 2010
Posts: 965
|
|
Quote:
Originally Posted by ChaosSlayerZ
From what I see if all item in the lootdrop have identical chance to drop, then it doesn't matter what % they are given as long as its equal.
|
No it matters. 10% != 66%
lootdrop 20 has mindrop=0 droplimit=1 and multiplier=1
This means that no matter how many items are in the lootdrop that between 0 and 1 of them will drop.
lootdrop 20 has 5 entries.
position 1: itemid 13071 = 90%
position 2: itemid 13072 = 50%
position 3: itemid 13073 = 50%
position 4: itemid 13074 = 50%
position 5: itemid 13075 = 1%
First, the code will roll a random number between 1 and 5.
This will determine which item gets rolled first.
Say the result is 2.
The code then looks at the % for the item in position 2 and rolls against that %.
If it hits, the item is dropped and the loop terminates, no more items are rolled.
If it does not hit, then the code moves on to position 3 and rolls against the % for that item.
This continues with positions 4 then 5 then loops back around to position 1.
If at this time no item has yet dropped, the loop terminates because there is no minimum drop requirement for the lootdrop.
Now, let us change the % for position 1 to 100% and assume that the random starts on position 3. If position 3, 4 or 5 hit, then that means position 1 will not even get rolled even though it is 100%. Similarly, if the random started on position 1 and it was 100% then none of the other 4 positions would even get rolled. the loop would be stopped.
Is that all clear?
Now if you have an item (or more than 1) that you DO want to be 100% Make a separate table for the 100% drop(s).
Lootdrop 21 contains 3 items that should ALWAYS drop.
Set mindrop=3, maxdrop=3 and multiplier=1
Position 1: item123 = 100%
Position 2: item456 = 100%
Position 3: item789 = 100%
No matter where the random 1 to 3 starts this loop each item will drop.
Now you have a loot drop where the mob always drops 2 items from a list of 3 (and can dupplicate a drop)
lootdrop 22 contains 3 items, set mindrop=2, maxdrop=2 multiplier=1
Position 1: item123 = 40%
Position 2: item456 = 40%
Position 3: item789 = 20%
The random 1 to 3 will start at 3 and roll against the 20% for that position.
Then it rolls against hte 40% for position 1 then against the 40% for position 2.
If only 1 of the 3 items dropped, the mindrop=2 has not yet been met so the loop will continue. pos 3, 1, 2 until a second item drops.
|
 |
|
 |
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 11:36 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |