Best Drop Rate Practice?

0 favourites
  • 14 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • I am aware that I can do a Random Generated Number (RGN) in order to get a random number.

    I can take that Random Number and mathematically set the drop rate of an item using conditions.

    If the RGN is between 0 and 999

    Then I know 0-499 will be 50% and so will 500-999.

    When I have a low amount of items an enemy may drop, then it can easily be managed with a Random Generated Number. What do you do when you will constantly be adding to the list of dropped items. Every time you add a single item or change a single condition it changes everything. I should add that I am only giving one item out at a time. Is there an easier way to do this so I don't have to change every number in the conditions each time I add or change an item? I understand that every time you add in another item you change the percent of the other items. So if there isn't a way around this then I suppose I am looking for another tactic.

    I guess I am asking how to keep a fixed drop rate on some items.

    Does Random Number Generation tend to favor certain numbers over others?

    The only other thing I can think of is using an Array.

    Placing X amount of items into the Array to give each item weight.

    I would then select a random item.

    Similar to a sweepstakes or giveaway.

    ItemA will be put into an Array 10 times.

    ItemB will be put into an Array 20 times.

    ItemC will be put into an Array 1 time.

    ItemD will be put into an Array 15 times.

    Every time I put in a new item or adjust a number of entries the percent of every item changes. I was trying to avoid that but at least I won't have to adjust nearly every number. Using an Array seems to be going off of weight instead.

    Is this an accurate way of having a random item given?

    Would using an Array be more beneficial than RGN?

    I could do this without an Array, by using Cumulative.

    By adding 10, 20, 1 and 15 I get the max amount of entries.

    46 entries total.

    The random generated number is generated. Lets say 32.

    ItemA is 10.

    32 isn't equal or below 10.

    ItemA+ItemB = 30

    32 is not equal or below 30

    ItemA+ItemB+ItemC = 31

    32 is not equal or below 31

    ItemA+ItemB+ItemC+ItemD = 46

    32 is equal or below 46

    So the item generated is ItemD.

    It is a bit tedious, but it would prevent me from having to change a lot by making a simple change or adding an item. It would also prevent the need for an extra Array.

    I could probably set up a variable and just have it loop the correct amount of times automatically.

    I just need a small bit of guidance on how to do drop rates if the items that can be dropped will be increasing over time. Right now I have about 14 planned and I will still have more to add.

  • [quote:1ahvk5su]The only other thing I can think of is using an Array.

    Placing X amount of items into the Array to give each item weight.

    I would then select a random item.

    Similar to a sweepstakes or giveaway.

    ItemA will be put into an Array 10 times.

    ItemB will be put into an Array 20 times.

    ItemC will be put into an Array 1 time.

    ItemD will be put into an Array 15 times.

    Have you tried using "choose(ItemA, ItemA, [...etc], ItemD)" ?

  • Unconnected

    Maybe you could store your items into 'groups' of data.

    Give each group a percentage:

    001-042 = group: junk items

    043-066 = group: common items

    067-081 = group: uncommon items

    082-092 = group: rare items.

    093-098 = group: epic items.

    099-100 = group: legendary items.

    Roll a random number 1-100. Say the result = 72. This falls into the 'uncommon' item group. You can now choose a random item from the 'uncommon' group.

    You might need to scale those numbers a little.

  • TRMG That is basically the same thing as generating a random number, but it would take longer to change the odds. I think this is okay to do if you only have a few items, but I have quite a bunch.

    Yes, I am glad you brought that up. I was gonna go for weight. Where each one would get a variable for weight and then I could manipulate the pool of items easily, but this seems better.

    I was actually reading on loot drop practices. I probably wouldn't have made the connection of groups if you haven't mentioned it.

    I believe what you brought up would coincide with a dice role. The first dice roll (RGN) picks a group and the second dice (RGN) picks an item in that group.

    http://www.gamasutra.com/blogs/DanielCook/20141215/232300/Loot_drop_best_practices.php

    I also should point out that sometimes people cheat when they have a chance to get loot. They can save the game and keep reloading until they get what item they want..

    It is a good idea to store a random generated number or a few ahead of time to prevent people from reloading the game until they get the random number they want.

    Thanks guys. Input appreciated.

  • Unconnected

    Maybe you could store your items into 'groups' of data.

    Give each group a percentage:

    001-042 = group: junk items

    043-066 = group: common items

    067-081 = group: uncommon items

    082-092 = group: rare items.

    093-098 = group: epic items.

    099-100 = group: legendary items.

    Roll a random number 1-100. Say the result = 72. This falls into the 'uncommon' item group. You can now choose a random item from the 'uncommon' group.

    You might need to scale those numbers a little.

    this is usually best if you don't need item scaling.

    or you can set up like -> dual randoming - > 1st random selects group, 2nd random selects item in that group. for example

    let's say you random legendary item, you want people mostly getting some legendary item more then some uber super duper legendary item. so you put chance on them, for example, the one with high chance ~50, and the uber one with ~5 , if 2nd roll gets <5 drop uber item, otherwise drop weaker item if roll <50, if roll even <100 even weaker and so on..

    or you could do something like this (completely different, math):

    • (roll a number from 1 to 10 * 100) /numberofdroppableitems / max number of levels * level *1.1 * number of items in the group

    you can do much more math it all depends what you want

  • I also should point out that sometimes people cheat when they have a chance to get loot. They can save the game and keep reloading until they get what item they want..

    You could kind of get around this by using a seeded random number. When the player starts a character, new game or area, seed a random number generator. Then use this random number generator for your loot generator every time you need a loot reward. The player can load the save game as much as they like, the same 'random' number comes out of the generator each time. The only way they can change the outcome is by going back to where the seed was randomised for the generator in the first place.

    Of course, as you are saving a characters progress they could open the save file and change things there. You could implement a simple checksum to prevent casual tampering. The bottom line is, unless you do calculations and store data server side, people can cheat. I wouldnt worry about it. Have fun developing your game and worry about that stuff afterwards if its a major concern.

  • You can check my tutorial on how to code monster loot drop and having different rates of drops depending on rarity of items/type of monsters.

  • That does sound like a better idea.

    A seed is easier on the memory as well as more secure.

    I tried looking up how to use seeds, and couldn't figure it out completely, until I found this

    Https://cdsmith.wordpress.com/2011/10/10/build-your-own-simple-random-numbers/

    It is basically a formula that can be changed with a few variables.

    This allows the game to calculate repeatable randomness.

    The only issue is a pattern becomes noticeable if you limit the highest seed number to a lower number.

    11 would give you 10 numbers before a pattern is repeated.

    ***EDIT***

    The formula in the link reverses the Dividend and Divisor when it figures remainder.

    X*7 % 11

    1*7 % 11 is supposed to equal 4.

    This is proven by 7+4 = 11

    In link it does

    1*7%11= 7

    I believe this is done in order to keep the generator and it's calculation simple.

    In a spreadsheet I found out if you correct the Dividend and Divisor then the generator stops working.

    You end up getting stuck in a 0 or 1 loop.

    Also X can not be equal or a multiple of 11 (11, 22, 33, 44, 55)

    11%11 is 0 and will cause a 0 loop.

    22%11 is 0 and will cause a 0 loop.

  • I have a semi related question. I don't know what it's called so I'm not sure how to look it up.

    If I have a random number.

    275268

    How do I select a number from it to set it to a variable?

    How do I select 8?

    How do I select 268?

    Wildcard?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have a semi related question. I don't know what it's called so I'm not sure how to look it up.

    If I have a random number.

    275268

    How do I select a number from it to set it to a variable?

    How do I select 8?

    How do I select 268?

    Wildcard?

    I dont quite understand because if you know the values you want, you wont need a random number.

    edit: do you mean get the 8th or 268th number from the generator? Not tried. You could always keep a counter and run a loop on the generator.

    As usual, rexrainbow comes to the rescue: http://c2rexplugins.weebly.com/rex_randomgen.html

  • It is still part of the seed question.

    The more digits in the seeded number the less noticeable the pattern will be.

    If I can select a specific placement in the number than I can randomize anything in the game off of one seeded number.

    I want to compare values to 275268

    *****8 and *****268

    both would be true so it would trigger an event.

    * is wildcard.

    How do I do that?

    It is the same question as https://www.scirra.com/forum/wildcards-in-strings_t58257

    I am unable to open the cap file and not fully understanding the explained solution in the post.

    I even change the file type in hope it was a typo, but it didn't open.

  • Gashapon, which can simulate a box with some items like -

    ItemA will be put into a box 10 times.

    ItemB will be put into a box 20 times.

    ItemC will be put into a box 1 time.

    ItemD will be put into a box15 times.

    then pick an item randomly.

  • Ive always placed items into groups. Having a very organized item list is important. That means many overlapping lists as well. That means monster specific groups. Location specific groups. player level specific groups. The possibilities are limitless.

    Lets pretend I have 6 items

    -tooth

    -bone

    -jelly

    -magic essence

    -beginner weapon

    -gold.

    I could break that up into 3 groups

    group one

    -tooth

    -bone

    -gold

    group two

    -jelly

    -magic essence

    -gold

    group three

    -gold

    -beginner weapon

    lets say I have two enemies

    -kobold

    -slime

    kobold can pick from group one and group three

    slime can pick from group two and group three.

    Each group gets its own drop %

    lets say there is a chest.

    the chest can contain loot from groups one two and three

    I would decide probabilities for each group based on chest location. Those groups already have the item chance within the group pre-determined.

    I even create groups of groups.

  • Gashapon seems useful but I need to control the outcome for this one.

    The group thing, I think that is called a dice roll.

    I am actually using it and seed due to gameglaux

    I thought I had it accurate enough before all of this. I ran some simulations and an item that was suppose to drop .08% was given 0% - 6% of the time in 1 of the simulations. I couldn't have that for some items.

    I now have a dice roll to select a group and in each group I have probabilities for each item in that group, very similar to what gameglaux and TylerMon suggested.

    I have a seed that is set to pick a seemingly random number between 1-100 and not repeat an obvious pattern or the same number until item 101 is looted. Even after item 101 is looted the pattern shouldn't be noticeable because the subgroup will seemingly have randomness to it.

    Using this I can be sure that every item group is selected properly.

    A 1% chance to get an item from the legendary group will always be 1 out of 100, no matter what.

    If I need to increase the drop rate of an item I can be sure that it is given out as intended, while still maintaining a seemingly random aspect.

    What I put in the legendary group will be 100% of the 1% of the group's availability.

    If I pollute the legendary group with 90% potions and actually 10% legendary items. Then getting a legendary item is 10% of 1% or 0.1%.

    Using a formula for subgroups then I can control what 0.1% means.

    By having an uncontrolled random it will translate to where 0.1% means every time you get a chance to get an item from the legendary group you have an actual 0.1% chance to get it. Meaning you will get 0-1 legendary item(s) in 100 loots. I would do this by having a random or unrelated controlled seed for subgroups.

    By doing a controlled random. It will select all the numbers 1 by 1 seemingly random without repeats until all values are used. This means opening 10,000(100x100) will give you 1 of every available item, this means 100 legendary items. This is done by checking the main seed number. If the same main seed is picked twice then it means the main seed ran 100 times. I can then change a variable for the subgroup seed. Using the main seed and the same math I can calculate that every value in the subgroup is selected the same way as the main seed. This means 0-100 will be selected in each subgroup without repeats until the 101st item from that group is looted. Meaning no subgroup seed value will be repeated until 10,001 items have been looted. When the 10,001 item has been looted then the whole pattern starts over....

    What I was trying to do before was trying to compare a placement in a variable and set a new variable to it.

    I don't think it is easily possible.

    Example:

    A random number would be 435

    I was wanting to be able to get:

    4, 3 and 5 from it and set it to variables in order to randomize other things.

    I was hoping for a wildcard type thing but I couldn't find anything.

    I though about doing math. It would be a lot of extra unneeded calculations and I'm not sure how to do it.

    The combination of dice roll and seed seems to be best.

    Thanks guys.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)