Floating point is only a linear loss of speed, and a pretty minor one. I'm more concerned about lack of accuracy. For example, 0.99 can't be represented exactly in floating point; 0.75 can. Only additive powers of 2 can be represented exactly in floating point.
I agree.
I'm not following this. As a trivial example, let's assume that Probability_Absolute_maximum = 1/3, Random_Absolute_ maximum =0.01, Probability_reletive_ maximum = 0.05, and Random_reletive_ maximum = 1/11. These numbers don't appear to plug in correctly to the above equation.
Note that "relative" and "absolute" as I'm using them are for damage. So if a creature is doing 10 points of damage average, +/- 0.01 absolute grants 9.99-10.01 points of damage; +/-0.01 relative grants 9.9-10.1 points of damage. If they are doing 30 points of damage average, the former becomes 29.99-30.01, and the later becomes 29.7-30.3. So basically, absolute does not scale with damage; relative does. I don't know which one we'll finally want, but I don't think that implementing both will be significantly more expensive than implementing one.
Actually neaither static option scale exactly the way we want it, as the jump point spacing varies by N / (N+1) as your damage increases. Relative is the closest scaling of the two you mentioned, but even relative doesn’t scale perfectly with damage as the jump point spacing changes N/(N+1) and so the range that you’d need to smooth over changes accordingly as you progress up to higher ratios.
Hence if we want to make the smoothing zone perfectly extend to the midpoints (such as the last graph on post 3 in this thread) then we’ll actyally have to change the relative factor range depending on what our ratio is.
This can be calculated dynamically (I think I made a formula for random max and random max/min as a function or R in one of the previous posts), so the relative factor also dynamically scales as a function of R with the N/(N+1) jump point spacing factor.
Then I figured it could also be done with pre-stored values in a array, eg D[N] or alternatively C[N] so depending on where you are in the spectrum then it’ll pull out the value of the random factor. So then you have a base damage of 10 then N=10, while if you are doing 30 damage then N=3. So therefore D[N] or C[N] will be larger.
So 1/D[N]<Random_value<D[N]
Or C[N]<Random_value<C[N]
N is an indicator of which midpoints you are between. So for any N there is possibility of N or N+1 hits.
Since we are chosing the minimum and maximum ourselves we can chose whatever we want, so we can chose relative or absolute factor size that extends from each jump point to the mid point between jump points. (note there is a slightly different midpoint depending on if we’re talking in absolute or reletive)
Now ideally for the best function with smooth damage we’d have functions C(R) or D(R) as a dynamic function across R to get a smooth output hitpoints left, but the key thing we are looking at about the damage is how it affects the number of hits, ie jump points, so we can simplify our calculations by setting the rande C[N] or D[N] depending on which jump point(n) we are talking about.
Example when base_damage=30
N=3 //note N is not number of hits, number of hits is actually N or N+1. But this N works out better for array indexing, it is really telling you which two midpoints you are between
JP[N]=100/N
JP[3]=33.333
JP[3+1]=25
For absolute case:
Ma[N]=29.166 //absolute midpoint
C[N]=4.1666
-4.166<Random_absolute_damage_component<4.166
Final_Damage = Base_damage + Random_absolute_damage_component
Required_random_absolute_damage_component_for_JP = JP[N] - Base_damage
Required_random_absolute _damage_component_for_JP = 33.333-30=3.333
[/B]Probability of needing 4 hits (N=3). [/B]
If using linear relation(single die)
Probability_of_N= (C[N]+ Required_random_damage_component_for_JP)(2*C[N])= (4.1666+3.333)/ (4.1666+4.1666)=90%
//this is the probability of needing N+1 hits, ie needing 4 hits when base damage=30.
[/B]Probability of needing 3 hits. [/B]
Probability_of_(N-1)= (C[N]- Required_random_damage_component_for_JP)(2*C[N])= (4.1666-3.333)/ (4.1666+4.1666)=10%
This is the probability of being in the N-1 region, ie needing N hits, or 3 Hits required
For relative case:
When Base_damage=30, N=3
M[N]=JP[N]/D[N] =JP[N+1]*D[N] //note you need to be careful of which way you are moving the spectrum as JP[N+1]< JP[N]
M[3]= 33.33/D[3]= 25*D[3]
D[3]=Sqrt(JP[3]/JP[3+1])=1.1547
M[N]= JP[N]/D[N]=28.8675 //Note, we are looking at a different midpoint if we are talking absolute or reletive calculation
1/D[N]<Random_Reletive_damage_component<D[N]
0.866026 <Random_Reletive_damage_component<1.1547
Final_Damage = Base_damage * Random_Reletive_damage_component
Required_random_reletive_damage_component_for_JP = JP[N] / Base_damage=33.33/30=1.111
Note the case when random_factor>1 needs to be treated differently then then random_factor<1
Probability of needing 4 hits (N=3).
If Required_random_reletive_damage_component_for_JP>1 then:
Probability_of_N=50+50* (Required_roll-1)/(D-1)=50+50*(1.111-1)/(1.1547-1)=85.9%
Probability of needing 3 hits.
If Required_random_reletive_damage_component_for_JP>1 then:
Probability_of_(N-1)=50+50* (D-Required_roll)/(D-1)=50+50*(1.111-1)/(1.1547-1)=14.0918%
Note
Absolute or relative factor range can be scaled according to which jump point section(N) you are in.
Notice that these probabilities are slightly different, this is largely because the absolute and the relative midpoint between jump points is slightly different.
example when base_damage=10
Interesting you chose an example exactly on the jump point.
Now the same applies with base_damage=10
N=10
JP [10] = 10
JP [11] = 9.909090909
JP [9]=11.1111
For absolute case:
M[N]=(JP[N]+JP[N+1])/2=9.545
C[N]=JP[N]-M[N]=0.454545
-0.454545<Random_absolute_damage_component<0.454545
Final_Damage = Base_damage + Random_absolute_damage_component
Required_random_absolute_damage_component_for_JP = JP[N] - Base_damage
Required_random_absolute _damage_component_for_JP = 10 – 10 = 0
[/B]Probability of needing 11 hits (N=10). [/B]
If using linear relation(single die)
Probability_of_N= (C[N]+ Required_random_damage_component_for_JP)(2*C[N])= (0.454545+0)/ (2*0.454545)=50%
//this is the probability of needing N+1 hits, ie needing 11 hits when base damage=10.
[/B]Probability of needing 10 hits. [/B]
Probability_of_(N-1)= (C[N]- Required_random_damage_component_for_JP)(2*C[N])= (0.454545+0)/ (2*0.454545)=50%
This is the probability of being in the N-1 region, ie needing N hits, or 3 Hits required
For relative case:
When Base_damage=10, N=10
JP [10] = 10
JP [11] = 9.0909090909
JP [9]=11.1111
M[N]=JP[N]/D[N] =JP[N+1]*D[N] //note you need to be careful of which way you are moving the spectrum as JP[N]< JP[N+1]
M[10]= 10/D[10]= 9.09*D[10]
D[10]=Sqrt(JP[10]/JP[10+1])=1.1547=1.04881
M[10]= JP[10]/D[10]=9.53463
1/D[N]<Random_Reletive_damage_component<D[N]
0.953463 <Random_Reletive_damage_component<1.04881
Final_Damage = Base_damage * Random_Reletive_damage_component
Required_random_reletive_damage_component_for_JP = JP[N] / Base_damage=10/10=1
Note the case when random_factor>1 needs to be treated differently then then random_factor<1 at jump point it doesn’t make any difference as they are both the same.
Probability of needing 11 hits (N=10).
If Required_random_reletive_damage_component_for_JP>1 then:
Probability_of_N=0.5+0.5* (Required_roll-1)/(D-1)=50+50*(1-1)/(1.04881-1)=50%
Probability of needing 10 hits.
If Required_random_reletive_damage_component_for_JP>1 then:
Probability_of_(N-1)=1-0.5*(D-Required_roll)/(D-1)=1-0.5*(1.04881-1)/( 1.04881-1)=50%
Note:
Please note that the array indicies N refer to which two midpoints the ratio lies between. So for N then it is after midpoint N and before midpoint N+1. the jump points are between the midpoints, so for any N there is possibility of N or N+1 rits required.
This is what I mean also in the previous section saying that absolute and relative are similar, as the range C [N] or D[N] varies depending on where you are in the spectrum.
This array doesn’t need to be that big, eg, you could easily have an array of length 25, which would provide you with information about the workings of every jump point up till a ratio of 5:1, so when one unit does 100 damage and the other does 4 damage. past that I think ratios higher than 5:1 will rarely occur, and when they do occur I I don’t think the jump point smoothing will be an issue as it’s about 100% probability of victory, so a jump point goes from something like 99.9997% to 99.9999% is still smoothed with D[25] to 99.9998%it's just that the smoothing might extend over the midpoint, and you can just use an D[25] for all ratios above 5:1.
This won't causde any exceptions when using reletive dammage methods, even with a ratio of 200:1, you'll only do 0.1 dase dammage, and so reletive proportion will never go bellow zero, as 0.1/1.0001 is still positive. but this situation will need to be checked for if you are using absolute damage, as when getting to extreeme ratios you need to be careful not to accidently subtract a dammage component larger than the base dammage hence with reletive you can use D[25] for all N above 25, but with absolute damage you can't use C[25] for all N>25 because unless you put in a failsafe for extreeme situations that final_damage=max(basedamage+absolute_random,0). naturally these situations shouldent occur unless someone modifies one of their creatures to have 200 strength, but it's good to put in the failsafe just in case so the program doesn't crash.