Possible bug with AI logic for destinationSystem (Resolved)

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

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
phkb
Commodore
Commodore
Posts: 2403
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Possible bug with AI logic for destinationSystem (Resolved)

Post by phkb » Fri Apr 24, 2015 7:59 am

This is a possible bug in Oolite 1.80. (I haven't had time to test in 1.81 yet).

I'm in Raleor (G5, planet ID 50). Nearby systems are Anleis (ID 0) and Tiqu (ID 202).

If I launch from a station and run this code:

Code: Select all

	var ships = system.addShips("[cobra3-trader]", 1, p.position.add(p.vectorForward.multiply(10000)), 1000);
	ships[0].fuel = 7;
	ships[0].setCargoType("PLENTIFUL_GOODS");
	ships[0].homeSystem = system.ID;
	ships[0].destinationSystem = 202;
I see a Cobra Mark 3 appear in front of me, and then take off and zip through a worm hole.

But if I launch and run this code:

Code: Select all

	var ships = system.addShips("[cobra3-trader]", 1, p.position.add(p.vectorForward.multiply(10000)), 1000);
	ships[0].fuel = 7;
	ships[0].setCargoType("PLENTIFUL_GOODS");
	ships[0].homeSystem = system.ID;
	ships[0].destinationSystem = 0;
The Cobra turns around and heads back into the station.

Note that in both these cases the Cobra is created a short distance from the main station. I don't know if that plays a big part or not.

I suspect (and I'm not sure) that the AI logic that's working out whether to jump to witchspace is doing a check of the destinationSystem and if it's greater than zero then it will do the jump. But I think the check should be greater than or equal to zero.

Have I done something wrong here? The code seems pretty straightforward. Does anyone else see this on their systems?
Last edited by phkb on Thu Apr 30, 2015 2:54 am, edited 3 times in total.

User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Disunited Kingdom
Contact:

Re: Possible bug with AI logic for destinationSystem

Post by Smivs » Fri Apr 24, 2015 12:02 pm

Maybe the pilot heard that Anleis is "...plagued by a lethal disease." and decided it was best to cancel the trip!
Commander Smivs, the friendliest Gourd this side of Riedquat.

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Possible bug with AI logic for destinationSystem

Post by cim » Fri Apr 24, 2015 4:54 pm

Thanks. Should be fixed in tonight's build.

User avatar
phkb
Commodore
Commodore
Posts: 2403
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Possible bug with AI logic for destinationSystem

Post by phkb » Fri Apr 24, 2015 11:36 pm

There was a bug? Oh, that's a relief! I thought I was going crazy. I was almost to the point of using strong language to get the ships to jump out!

User avatar
phkb
Commodore
Commodore
Posts: 2403
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Possible bug with AI logic for destinationSystem

Post by phkb » Mon Apr 27, 2015 3:43 pm

I just tested in 1.82 (latest build) but it appears the bug is still present. I also tested launching ships from a station and it appears to impact those ships as well. Any ship that has "0" (zero) set as their destination system will just go back to the main station either when created directly or launched from a station. At least, on my PC it does...

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Possible bug with AI logic for destinationSystem

Post by cim » Tue Apr 28, 2015 4:58 pm

Thanks. I've fixed a few more issues around this for tonight's build.

User avatar
phkb
Commodore
Commodore
Posts: 2403
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Possible bug with AI logic for destinationSystem

Post by phkb » Thu Apr 30, 2015 2:54 am

Tested, and confirmed - it's working!

Post Reply