View Single Post
Old 01-24-2013, 07:02 AM   PM User | #10
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,556
Thanks: 62
Thanked 4,055 Times in 4,024 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
But a big problem with this approach is the *granularity*.

Just to pick the example you used, if we wanted "rare" to be 1%, and still assuming the same 3 weapons (4 occurrences), we would need 20 values in the rarity array.

And *still* combined.rare.sword would be 2% instead of 1%.

And so on.

I think I would opt for a much simpler yet more flexible system:
Code:
var weapons = {
    "sword" : [ 70, 28, 2 ],
    "bow" : [ 60, 30, 10 ],
    "staff" : [ 80, 19, 1 ]
};
where the 3 numbers are the percentage chances that a given weapon will be common, uncommon, or rare.

Completely flexible: You can decide what "rare" means on a per-weapon basis *and* you can easily see the distribution *and* you can easily change it.

Changing the distribution with RndMe's dual array system might turn into a real challenge to get the numbers you actually want.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote