The minimum is supposed to be 10,000 km, which is range 1 as far as the program is concerned.
I think you're saying that you're using fixed width range bands (at 10,000 km intervals) when calculating damage, i.e. a laser shot at 19,999 km does the same damage as one at 10,000 km. So my "4 4 2 2" laser damage line really means that it won't ever do 3 points of damage? Is this correct?
No I am just saying that minimum range is 10,000 km. I do use 10,000 km range bands for ease of reference but you can fire at range 1.57 for example, just not less than 1. The weapon damage calculation is :
TargetX = Abs(Contact Xcor - Firing Ship Xcor)
TargetY = Abs(Contact Ycor - Firing Ship Ycor)
Contact Distance = (Sqr((TargetX ^ 2) + (TargetY ^ 2))) / 10000
Effective Range = Contact Distance / Weapon Range Modifier
If Effective Range < 1 Then Effective Range = 1
(All the above except the weapon range modifier are currency variables. Effective range is calculated to the nearest km.)
Weapon Damage = Int(Damage Output / Effective Range)
So you would see a potential 3 damage for your 4 4 2 2 weapon perhaps somewhere in the 20,000 to 25,000 range
The Weapon Range Modifier is the RM # displayed on the class summary for every weapon. For lasers for example, each higher wavelength increases it by 1. Infrared = 1, Visible light = 2, Near Ultraviolet = 3, etc.
An alternative would be to calculate the damage in floating point using (target distance/laser range) as the parameter in your damage formula and then round down to the nearest integer.
That is what happens now.
Also, are you doing the same thing for the hit probability vs. range calculation? The 4K fire control I was trying was giving "0 0 0 0" as the hit probabilities. Does this mean the fire control has no chance of hitting anything, even at point blank range?
The minimum fire control range is 10,000 km, which is the range at which point blank fire takes place. A fire control with a lower range will be treated as having a 0% chance to hit.
Steve