Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Laser hit rate

For test results, bug reports, announcements of new builds etc.

Moderators: another_commander, winston, Getafix

Post Reply
dybal
---- E L I T E ----
---- E L I T E ----
Posts: 499
Joined: Mon Feb 10, 2020 12:47 pm

Laser hit rate

Post by dybal »

Today one of my escorts took a beating... it should have been destroyed, if not for what I think is a bug in N-Shields...

This is from Latest.log, using cat Latest.log | grep Millie| grep "taking 13":

Code: Select all

02:52:40.625 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 384 to 371, energy 256
02:52:40.626 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 371 to 358, energy 256
02:52:40.627 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 358 to 345, energy 256
02:52:40.628 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 345 to 332, energy 256
02:52:40.629 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 332 to 319, energy 256
02:52:40.630 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 319 to 306, energy 256
02:52:40.631 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 306 to 293, energy 256
02:52:40.632 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 293 to 280, energy 256
02:52:40.634 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 280 to 267, energy 256
02:52:40.635 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 267 to 254, energy 256
02:52:40.636 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 254 to 241, energy 256
02:52:40.637 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 241 to 228, energy 256
02:52:40.638 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 228 to 215, energy 256
02:52:40.639 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 215 to 202, energy 256
02:52:40.640 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 202 to 189, energy 256
02:52:40.641 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 189 to 176, energy 256
02:52:40.642 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 176 to 163, energy 256
02:52:40.643 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 163 to 150, energy 256
02:52:40.644 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 150 to 137, energy 256
02:52:40.646 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 137 to 124, energy 256
02:52:40.647 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 124 to 111, energy 256
02:52:40.648 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 111 to 98, energy 256
02:52:40.649 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 98 to 85, energy 256
02:52:40.650 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 85 to 72, energy 256
02:52:40.651 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 72 to 59, energy 256
02:52:40.652 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 59 to 46, energy 256
02:52:40.653 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 46 to 33, energy 256
02:52:40.654 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 33 to 20, energy 256
02:52:40.655 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 20 to 7, energy 256
02:52:40.656 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 7 to -6, energy 256
02:52:40.657 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 0 to -13, energy 256
02:52:40.661 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 0 to -13, energy 256
02:52:40.666 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 0 to -13, energy 256
02:52:40.668 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 0 to -13, energy 256
02:52:40.670 [NShields]: Military Manta Ray: Millie: taking 13 damage, FS from 0 to -13, energy 256
...
These messages are from a trace in shipTakingDamage event handler put into the ship's script by N-Shields.

It went this way for 1159 hits from 02:52:40.625 to 02:52:42.264, i.e., 1.639 seconds, to the rate of 707 hits/s

I was able to look into the scene as it happened, there was a single Mamba in my escort's 6, pursuing and hitting that escort.

As far as I know, the fastest lasers, Beam and Military, have a hit rate of 10 hits/s (if you can keep them on target the whole second).

Something isn't right... since there's no loop in the event handler (see code bellow), I'm guessing the shipTakingDamage event handler was called once for every message in the log...

Code: Select all

this.ForeAft_override_shipTakingDamage = function (amount, whom, type, caller) //'caller' is added when protecting frangible subEntities 
{
    if (amount == 0 || type == "hit a planet" || type == "hit a sun" || type == "cascade weapon" || type == "removed")
    {
        //cases where, for practical purposes, no shield handling is needed - but other OXPs' handlers may still need to run
        worldScripts.NShields.$applyDamageHandlers(this.ship, amount, whom, type)
        return;
    }

    worldScripts.NShields.ForeAft_updateRecharge.apply(this, [clock.absoluteSeconds - this.NShields_lastRechargeTime]);
    worldScripts.NShields.$resetRechargeTimer.call(this);
    if (caller) caller.energy += amount; //heal subEntity if called from there
    else this.ship.energy += amount;

    if (type == "heat damage") // will not be able to locate hit, and different handling is required anyway
    {
        worldScripts.NShields.$applyHeatDamage(this.ship, amount, ["forwardShield", "aftShield"]);
        return;
    }

    var hitLocation = worldScripts.NShields.$locateHit(this.ship, whom)
    var hitLocationRelative = hitLocation.subtract(this.ship.position);
    if (hitLocationRelative.dot(this.ship.vectorForward) > 0) // forward shield
    {
        if (this.ship.script.$EscortDeckUsable == true)
            log("NShields", this.ship.displayName+": taking "+amount+" damage, FS from "+this.ship.forwardShield.toFixed(0)+" to "+(this.ship.forwardShield-amount).toFixed(0)+", energy "+this.ship.energy.toFixed(1));
        this.ship.forwardShield -= amount;
        if (this.ship.forwardShield < 0)
        {
            if (caller) caller.energy += this.ship.forwardShield;
            else this.ship.energy += this.ship.forwardShield; // add negative shield value to energy
            if (this.ship.script.$EscortDeckUsable == true)
                log("NShields", this.ship.displayName+": FS zeroed, energy "+this.ship.energy.toFixed(1));
            worldScripts.NShields.$applyDamageHandlers(this.ship, -this.ship.forwardShield, whom, type)
            if (this.ship.isVisible) worldScripts.NShields.$drawSparks(hitLocation, this.ship, -this.ship.forwardShield);
            this.ship.forwardShield = 0;
        }
        else worldScripts.NShields.$applyDamageHandlers(this.ship, 0, whom, type);
        if (this.ship.isVisible) worldScripts.NShields.$drawShieldFX(hitLocation, this.ship.forwardShield, this.ship, whom)
    }
    else
    {        if (this.ship.script.$EscortDeckUsable == true)
            log("NShields", this.ship.displayName+": taking "+amount+" damage, AS from "+this.ship.aftShield.toFixed(0)+" to "+(this.ship.aftShield-amount).toFixed(0)+", energy "+this.ship.energy.toFixed(1));
        this.ship.aftShield -= amount;
        if (this.ship.aftShield < 0)
        {
            if (caller) caller.energy += this.ship.aftShield;
            else this.ship.energy += this.ship.aftShield;
            if (this.ship.script.$EscortDeckUsable == true)
                log("NShields", this.ship.displayName+": AS zeroed, energy "+this.ship.energy.toFixed(1));
            worldScripts.NShields.$applyDamageHandlers(this.ship, -this.ship.aftShield, whom, type)
            if (this.ship.isVisible) worldScripts.NShields.$drawSparks(hitLocation, this.ship, -this.ship.aftShield);
            this.ship.aftShield = 0;
        }
        else worldScripts.NShields.$applyDamageHandlers(this.ship, 0, whom, type);
        if (this.ship.isVisible) worldScripts.NShields.$drawShieldFX(hitLocation, this.ship.aftShield, this.ship, whom)
    }
}
The array that holds the other damage handlers that NShields.$applyDamageHandlers uses was empty (verified with DebugConsole), so the calls to worldScripts.NShields.$applyDamageHandlers did nothing.
dybal
---- E L I T E ----
---- E L I T E ----
Posts: 499
Joined: Mon Feb 10, 2020 12:47 pm

Re: Laser hit rate

Post by dybal »

Happened again today... investigating a bit more, that ship has subentities (two plasma turrets), the first one in my escort pack to have them. Today I've got a stackTrace that points to the subentity damage handler in N-Shields, a code I haven't looked into yet - it was in my TODO, so it just got pushed forward :lol:

So perhaps (I hope so) there is a loop in N-Shields applying the same damage over and over - I will keep you posted.
Post Reply