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
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Possible bug with AI logic for destinationSystem (Resolved)

Post by phkb »

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: Lost in space
Contact:

Re: Possible bug with AI logic for destinationSystem

Post by Smivs »

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: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Possible bug with AI logic for destinationSystem

Post by cim »

Thanks. Should be fixed in tonight's build.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Possible bug with AI logic for destinationSystem

Post by phkb »

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
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Possible bug with AI logic for destinationSystem

Post by phkb »

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: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Possible bug with AI logic for destinationSystem

Post by cim »

Thanks. I've fixed a few more issues around this for tonight's build.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Possible bug with AI logic for destinationSystem

Post by phkb »

Tested, and confirmed - it's working!
Post Reply