looking into this, i have a way to Determine
if desired range is "faulty" or limited
if Weapon Energy is "faulty" or limited...
I simply modify the missile in the shipdata.plist..
and run Oolite with no OXPs (no oxp this is editing of the native ships.plist and missileAI.plist)
On a side note i have a sneaky suspicion that the odd behaviour i have seen from missiles lately might have something todo with it...
That is Missiles explode right after launch, they seem to crash into the missile launching ship, as if they collide with it.. This can easely be misunderstood as if you where hitting the missiles with your lasers...
I have reported it though, since the guidance of missiles should avoid this...
But editing/testing now, will report back in a moment.
Edit: Missile with
Code: Select all
ENTER = ("setDesiredRangeTo: 10000.0", dealEnergyDamageWithinDesiredRange, becomeExplosion);
does not seem to do you any harm at 8 clicks..
hmm i think the energy dealt is being spread out the further away from the center of the explosion you are the less of damage your craft will take..
Trying with an astronomical number.... like say 100 million, of damage
Edit 2: a 100 million of damage and none taken at all...
range was still 10000, i think was at 2000 kms
Decreasing the range to 1000. that should be 10 clicks... or 10.000 meters..
Edit 3: Seems i misintreped the range thingi, 1000 seems to be 1000 meters... i did manage to kill myself quite a few times when i was under 1000 meters from the craft where at the missile exploded...
Increasing the range to 5000
Edit 4: still i need to be less than 1000 meters to the craft in order to blow up...
1.300 meters = no damage... im starting to think the maximum value for this is about 1000.
Taking a sneak peak at the code... and see if i can get anything usefull from it...
Tadaa
Code: Select all
dealEnergyDamageWithinDesiredRange
{
NSArray* targets = [UNIVERSE getEntitiesWithinRange:desired_range ofEntity:self];
if ([targets count] > 0)
{
unsigned i;
for (i = 0; i < [targets count]; i++)
{
Entity *e2 = [targets objectAtIndex:i];
Vector p2 = e2->position;
double ecr = e2->collision_radius;
p2.x -= position.x; p2.y -= position.y; p2.z -= position.z;
double d2 = p2.x*p2.x + p2.y*p2.y + p2.z*p2.z - ecr*ecr;
double damage = weapon_energy*desired_range/d2;
[e2 takeEnergyDamage:damage from:self becauseOf:[self owner]];
}
}
}
This looks confusing ehh, but ill take a shot on what is going on..
e2 is the target(current target in code, it runs through all ships in the area) at least so it looks like...
p2 is the targets posistion
ecr is the targets collision radius
p2.x, p2.y, p2.z is the targets posistion, which gets subtracted from the missile or "entity" or the Reactors posistion..
So if our "missile" is at posistion 0 , 0, 500 and the target is at posistion is 0.0.1000 and our targets collision_radous is 100 meters, and weapon energy is 10000 damage
we got the following
d2: 0*0+ 0*0 +500*500 - 100*100 = 240000
Damage: 10000*500/240000
Thats
Damage: 5000000 / 240000 = 20,8333333333¨ damage
and ofcourse, 20,83 damage is not exactly what we want...
lets take the following assumption then.. standard missile with 4500 damage and explode within 25 meters of the target of 100 meters collision radius, i think
Desiredrange is 250.0 like the missile..
Target 20 meters away gives us
d2: 0.0 * 0.0 + 0.0*0.0 + 20 * 20 - 100*100 = -9600
so
Damage: 4500 * 250 / -9600
Damage: 1125000 / -9600 = -117,1875
That also makes no sense,as a Negative value will be used when The damage is dealt
Energy -= Damage
Minus minus is positive, so actually the energy will be added... :S
Either im absolutely wrong, or this way of calculating the damage is very faulty... or actually supposed to work this way...
The bigger the ship, the less the damage it takes... thats makes sense.. though.. all though i cant see the Cobra MK III being killed by a single missile this way with just standard shields of which im not sure what punishment they are able to absorb..
so i´m altering my example to something i know cant survive a missile
Namely Cobra Mk I with max_energy = 150 and i guees has a collision radius of 70 meters as this is the maximum diemension value read in the model file. i dont know if it uses an average in which case the Collision radius would be about 46 meters.., im trying with 46 meters first...
Example 3.
cobra mk 1
// model size: 70.000 x 15.000 x 55.000
Standard missile...
4500 weapon_damage, distance away at detonation time: 20 meters, desired range 250, collision_radious 46 meters
d2: 0.0 + 0.0 + 20*20 - 46*46 = -1716
damage: 4500*250 / -1716 = -655,5944¨
again we get a negative value, which should in theory give energy not substract it.. But i know this aint happening since the Cobra dies..
since
even if the p2.z is a negative value to start with, it will become positive since minus * minus = positive...
unless the operator "-=" does not work as i presume, that is mathmatical correct. and just subtracts the value as if it where positive..
But I really cant beleive that is the case, and not what i remember from C++ coding...
since using my example, the cobra would get 655¨energy, not loose it, but i know the cobra dies.. so, im baffled...