Quote from PCFredZ
How are you implementing arbitrary random ratios like rolling out out of 3 combinations? If you're using randomized switches, how many switches are you using?
Let the number of switches used be represented by the number "n".
The number of possible combinations is 2^n. (2 to the exponent of n)
Lets look at the shield roll on a common 1.0 planetsmasher with 7 shield generators, 7 lasers, and 2 alternate weapons incase of a "swarm".
I have named a bunch of switches "Random Bit 0", "Random Bit 1", "Random Bit 2", and so on. (Below referenced as [R.B. #])
When the planetsmasher gets an attack, the shield roll kicks in, and it uses the randomized switches like this:
[R.B. 2], [R.B. 1], [R.B. 0], [Shield Roll]
cleared, cleared, cleared, 0
cleared, cleared, set, 1
cleared, set, cleared, 2
cleared, set, set, 3
set, cleared, cleared, 4
set, cleared, set, 5
set, set, cleared, 6
set, set, set, 7
It's simple binary representation of numbers, with each switch acting as a single binary bit. 8 bits can yield 256 values (0-255) while 16 bits yields 65??? ("64k") values.
The heaviest use of random switches in the map is in the ship's death explosion-animation.
EDIT: I chose to name the random bit switches the way I did because the numbers remind me of the bit's value when I'm converting binary to decimal. R.B. 0 for example is worth 2^0, and can only add a 1 (or not) to the total decimal value.
In the planned 2.0 weapon damage bell curving, it will be a little more switch intensive, as there are alot more "chances" for the medium numbers to show up. The planned Fusion Beam has 20 numbers in it's damage distribution, so it will need 5 switches, 2^5 = 32, and 12 possibilities will be left over. Unfortunately, this does leave a slight possibility that the game will keep choosing one of the 12 "invalid" values and keep having to re-randomize, but statistically an acceptable value is generated within a few hyper cycles. I have already done this in all cases where the number of shield generators is not equal to [a power of 2 minus 1], and also for rail guns where the damage roll, 0-2, only used up 3 of 4 combinations with 2 randomized switches.
None.