I am working on a game and I am trying to figure out a good technique for randomization, I have different items and each have a chance of appearing. I am not writing the blueprint code but am trying to figure out a good solid technique to hand off to the blueprint programmer. So far this is what I have from my design document:
For deciding randomness in the game, anything that needs to be randomized and uses rarity can use this number generator technique:
Numbers will be generated from 0 to a defined number and a randomized item will pick a defined number between a number within the defined number range. So if i have 4 random crates, a common, uncommon, rare, and ultra rare crate the common crate can have a number range from 0 to 10. And choose a number or number range between that, and since its such a small range the chance of getting a common crate is very high, for an ultra rare crate a range of 0 to 500 could be picked and a range between that would be chosen.
The values below should be set and used by anything that uses randomization. These values should be part of the crates blueprint since each crate will need to have its own randomization numbers, it should be under a new category called “Randomization Protocol”. The old randomization code should be deprecated.
If i wanted to have a single digit number instead of a range of numbers for BetweenFirstNumber and BetweenSecondNumber I would just enter that number in both of those fields.
NumberRangeStart[Int] - The minimum and maximum values that the random number will be chosen from(0-100 etc.)
**BetweenFirstNumber[Int] - the number between the first and second value where if landed on a number between these two values will choose the item. **
I am unsure if this will work or not, at least the way i intend it to. In the game I have 4 items a common item, an uncommon item a rare item and an ultra rare item, i need a way to make sure that each item appears according to rarity, but our current system doesnt seem to work like that. can someone please help me out. Preferably with some blueprint examples or at least a good explanation. Thanks in advance.