Chance % increase question (fishing game)

Started by
2 comments, last by mikuro 1 year, 3 months ago

I'm creating a fishing game. How should I go about rarity % increase per level of fishing pole?

Base percentage for each fish for a level 1 fishing pole:
Common: 65%, Uncommon: 0%, Rare: 0%, Super Rare: 0%, Garbage: 35%

That amounts to a total of 100%. I plan to have a level 2 fishing pole that increases uncommon % to 10%. Should I just add 10% like this? Common: 65%, Uncommon: 10%, Rare: 0%, Super Rare: 0%, Garbage: 35%

That is now equal to 110%. Or should it always end up equal to 100%, hence I should deduct % from other categories like common and garbage?

Thanks.

None

Advertisement

Your design, up to you.

It is an option to have them as percentages up front. Then compute a random number from 0 to 1 and see where it fits.

It is also an option to have a count or pool size, and use that instead of percentages. Pool 1 has 65, pool 2 has 10, pool 3 has 2, pool 4 has 1. The code can sum them up (78 total), and can compute percentages (65/78 = 83.3%, 10/78=12.8%, 2/78=2.5%, 1.3%.). You can compute a position exactly the same as with percentages.

Also, many games lie to players. That's okay, as long as it is fun. Your percentages don't need to be exact, they can be approximations and nobody will care. Games typically don't need to specify that the odds of a “super rare” item, or a unique item relative to all items, and unless you are off by a dramatic amount the players won't notice.

For selection with either approach, an easy method is to just subtract and loop. That is, pick a random target number from 0 to the sum. The sum will happen to be 100% if you started with percentages, or whatever number of items in all pools for that approach. If the number is between 0 and the size of the first pool, use it, otherwise subtract the size of the first pool. Then if the number is between 0 and the size of the next pool, use it, otherwise subtract the size of the pool. Repeat until you have identified the pool it is in..

There are more advanced algorithms for large collections, but for a reasonably small array under a few hundred or potentially even a few thousand category pools, the simple solution will be hard to beat, just checking against an array of sizes.

@frob thanks. That's enlightening.

None

This topic is closed to new replies.

Advertisement