Some bugs I found

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

Moderators: winston, another_commander, Getafix

User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

wild turkey wrote:
Cmdr Wyvern wrote:
Eric Walch wrote:

Code: Select all

    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
Im still not sure if I indeed see effect, but other may give their opinion if they do see it.
This works! I'm seeing missiles leaping ahead of the launching ship before turning for the interception run, much like they did in v 1.65. Number of missiles hitting the launching ships: Zero.
Using this AI tweak, I'm calling the bug pretty much squished. 8)
Cool! So how do I implement it? :)
If you want to experiment/test this, then:
Filebrowse to Oolite/oolite.app/Resources/AIs
You're looking for missileAI.plist and hardmissileAI.plist. Vitally Important: Copy these files to a protected directory or a thumbdrive as a backup, in case you botch the tweak.
Open these files in a text editor of choice. (Kwrite, Notepad, Notepad+, yadda) Make the abovementioned tweak and save.
Start Oolite with the shift key held down, go look for dogfights to get into, and see if there's fewer missiles crashing into launching ships.
Get back to us on your results.
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Ramirez wrote:
That's very useful. The anti-thargoid missile in M&B used the simple scanForThargoid command, which meant it could find Thargoids but not the Thargon fighters, which is what I had meant it do in the first place (i.e. you fire the missile at the Thargoid, it launches a group of fighters in response, and then the missile splits into four warheads to take them out). I never got around to improving this, so I'll aim to fix that as well.
If you do that, all the submunitions will get the same target. You can work around this with a script along these lines (untested):

Code: Select all

this.spawnAntiThargletSubmunitions = function()
{
    function isTharglet(entity)
    {
        return entity.isShip && entity.hasRole("tharglet");
    }
    function isThargoid(entity)
    {
        return entity.isShip && entity.hasRole("thargoid");
    }
    
    // Find targets
    let targets = system.filteredEntities(this, isTharglet, player, 25600);    // Note: 25600 metres is 1:1 scanner range
    if (targets.length == 0) targets = system.filteredEntities(this, isThargoid, player, 25600);
    if (targets.length == 0)  targets = [this.target];
    
    let warheads = this.spawn("thargoid-warhead", 4);
    
    // Assign each warhead a target
    for (let i = 0; i < warheads.length; ++i)
    {
        warheads[i].target = warheads[Math.floor(Math.random() * warheads.length)];
    }
}
Cmdr Wyvern wrote:
Hey Ramirez, something I noticed that you probably didn't know.
You only get kill credits for lethal hits with single-stage missiles. The spawned warheads in MIRVs don't award kill cred when they make lethal hits.
Fixed for 1.72.

Specifically, any missile fired by a missile now inherits its parent’s owner. (This would matter if you added missiles to tharglets, for instance.) Additionally, a ship spawned by spawn: or JS spawn() will inherit its parent’s owner if the parent is a missile and the spawned ship has the property is_submunition set to true in shipdata.plist.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

It looks like live is growing more dangerous every week. Specially when multiple warheads fall in hand of NPC ships.

I think you must change

Code: Select all

system.filteredEntities(this, isTharglet, player, 25600);
into

Code: Select all

system.filteredEntities(this, isTharglet, this.ship, 25600);
It should look in a radius around the missile and not around the player. Both versions will have the same effect when launched by the player, but not when fired by a NPC.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Eric Walch wrote:
It looks like live is growing more dangerous every week. Specially when multiple warheads fall in hand of NPC ships.

I think you must change

Code: Select all

system.filteredEntities(this, isTharglet, player, 25600);
into

Code: Select all

system.filteredEntities(this, isTharglet, this.ship, 25600);
It should look in a radius around the missile and not around the player. Both versions will have the same effect when launched by the player, but not when fired by a NPC.
Good catch. Stupid copy & paste, not knowing what I mean.
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

Thanks, I'll give some of those a try. All I really needed was something that would be happy targetting both Thargoids and Thargons/Tharglets, though not necessarily at the same time. So this script would be called by the main missile, and checks the surrounding area for thargoids and tharglets, sets the target appropriately and then passes this target on to the submunitions?

What happens if the missile is launched at a non-thargoid? Would it intercept and detonate as usual?

I'm mindful that these multiple warheads are fun to use but being on the receiving end of them could be tricky, even with Eric's missile analyser add-on. I'll be v careful about letting NPCs get hold of them. I even considered some kind of mini mission where you have to get a qualification before you're allowed to have some of these weapons. Caracal's done a target practice OXP that I haven't looked at yet - maybe there's scope for a weapons training mission of the kind that you get in Tie Fighter, etc.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Ramirez wrote:
What happens if the missile is launched at a non-thargoid? Would it intercept and detonate as usual?

I'm mindful that these multiple warheads are fun to use but being on the receiving end ....
Ahrumans code anticipated on that. When no new targets is uses the one it was fired on. It just needs one aditional fix:
"targets = [this.target]" should be "targets = [this.ship.target]"

I know this problem, code copied from one place must sometimes be altered to work on other places because the references change.

-----
Coming back on my original AI code.:

I added a logging for missile launch in the player script and also one in the missile script. This way every launch should be logged twice.
player:

Code: Select all

this.shipAttackedWithMissile = function(missile, whom)
{
 log(this.name, "Missile nr. "+ missile.ID+ " is launched by: "+whom.shipDisplayName)
}
Missile:

Code: Select all

this.shipSpawned = function() 
{ 
    if(this.ship.target == player) {this.player=true; log(this.name, "Missile nr. "+this.ship.ID+ " is launched by: "+this.ship.owner.shipDisplayName)}
	else this.player=false
}

this.shipDied = function(who, why) 
{ 
    if(this.player) log(this.name, "Missile nr. "+this.ship.ID+ " fired by: "+this.ship.owner.shipDisplayName+ " killed by "+who.shipDisplayName+" by means of "+why);
}

this.shipCollided = function(who)
{
    if(this.player) log(this.name, "Missile nr. "+this.ship.ID+ " fired by: "+this.ship.owner.shipDisplayName+" collided with: "+who.shipDisplayName+" remaining energy: "+this.ship.energy)
}

this.shipLostTarget = function()
{
    if(this.player) log(this.name, "Missile nr. "+this.ship.ID+ " lost the target")
}
In most cases I see double entries in the log. The missile script also logs death and collision. (death by ECM is currently not logged). However, sometimes the log is wrong:

Code: Select all

[player] : Missile nr. 495 is launched by: Falcon-S
[player] : Missile nr. 496 is launched by: Falcon-S
[missile] : Missile nr. 495 is launched by: Falcon-S
[player] : Missile nr. 496 is launched by: Falcon-S
[player] : Missile nr. 497 is launched by: Falcon-S
[missile] : Missile nr. 496 is launched by: Falcon-S
Not all missiles that are created according to the player log have a log by the ship-script. This means they are already des-integrated before the ship script gets active. Changing the AI wont help for these missiles as the AI never gets a chance to run.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I changed my logging a bit so also the ECM is logged. I now noticed that most missiles that explode on launch are the ones that are added twice according to the player script and never execute the ship-script itself. I also noticed that both missiles get have the same ID number. (see "<--") (Or it is one missile and the system sends the warning twice)

Code: Select all

Added 1 pirates
Missile nr. 542 is launched by: Python (ds). (Player script)  <--
Missile nr. 542 is launched by: Python (ds). (Player script)  <--
Added 2 pirates
Missile nr. 563 is launched by: Aphid (ds). (Player script)
Missile nr. 563 is launched by: Aphid (ds)
Missile nr. 563 received ECM
Added 1 pirates
Missile nr. 566 is launched by: Boa Class Cruiser. (Player script)
Missile nr. 567 is launched by: Boa Class Cruiser. (Player script)
Missile nr. 566 is launched by: Boa Class Cruiser
Missile nr. 567 is launched by: Boa Class Cruiser
Missile nr. 566 received ECM
Missile nr. 567 received ECM
I also detected an occasion of death by scrap damage with the firing ship itself. With this cause of death an altered AI will help
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

yesterday I used the wrong command syntax: system.legacy_addShipsAt("asteroid", 1, -12) (wanted to use addSystemShips)

This resulted in an error, but not the one that was expected:

Code: Select all

Oolite [general.error.parameterError] OOLogGenericParameterErrorForFunction (OOLogging.m:522): ***** VectorFromArgumentList: bad parameters. (This is an internal programming error, please report it.)
It seems that the wrong list of arguments was not detected but leaded to an internal error.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Hmm, that happens because it’s trying to build a vector from zero parameters. I’ve added a check for argument count. (Everything involving vector parameters is complicated by the fact that it can be defined by one or three parameters. This particular piece of overcleverness is being phased out, though.)
Post Reply