Strange problem with unresponsive ships

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

Post Reply
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1244
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Strange problem with unresponsive ships

Post by UK_Eliter »

If I may ask for help again . .

I've got a ship type, the name and role of which is IST_thargoidDefenceShip. This ship type has a plist ai and a script. And ships of this type are launched from a - huge - ship. The problem is, these defence ships won't do anything when they go into performAttack. They come up red on the scanner, and my player ship's turrets fire on them when they are red, but they do not actually attack but rather sail on off into the void.

Here is some more detail. My ai checks for the LAUNCHED OKAY message, and the problem occurs after that message has been received. Moreover, while the ship script decides what the ships should attack, I've tried replacing that functionality with a 'scanForNonThargoid' and same attacking-without-attacking behavour occurs. I've even tried removing the huge launch ship - once the defence ships find a target - and still the defence ships won't attack. (I had thought that perhaps that some sort of misfiring anti-collision routine was stopping the shifts from attacking.) Any tharglets launched by the defence ships attack fine.

Now I'm completely stumped.

Here's the relevant part of the AI.

Code: Select all

	GLOBAL =
	{
		"LAUNCHED OKAY" = ("setStateTo: SCAN");
	};

	SCAN = 
	{
		ENTER = (performIdle, "randomPauseAI: 0.5 3.0");
		UPDATE = ("sendScriptMessage: $_findTarget", "pauseAI: 4.0");
			TARGET_FOUND = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
			[ . . code omitted . .]
	};

	ATTACK_SHIP =
	{
		ENTER = (performAttack);
		INCOMING_MISSILE = (fightOrFleeMissile, setTargetToPrimaryAggressor, "setStateTo: CONSIDER_RETALIATION");
		TARGET_DESTROYED = ("setStateTo: SCAN"); // I tried removing this line; doing so made no difference.
		TARGET_LOST = ("setStateTo: SCAN");  // I tried removing this line; doing so made no difference.
	};
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Strange problem with unresponsive ships

Post by Smivs »

Do they have scan_class 'CLASS_THARGOID'?
Commander Smivs, the friendliest Gourd this side of Riedquat.
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1244
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Strange problem with unresponsive ships

Post by UK_Eliter »

They do, Smivs, yes.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Strange problem with unresponsive ships

Post by Smivs »

Good. That's usually enough to make anything seriously anti-social!. :twisted:
Interesting problem - be good to know what it is then.
Commander Smivs, the friendliest Gourd this side of Riedquat.
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1244
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Strange problem with unresponsive ships

Post by UK_Eliter »

Smivs, you're toying with me! I thought you had a lead!
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1244
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Strange problem with unresponsive ships

Post by UK_Eliter »

To diagnose this problem, I need a serious dump of information about these wayward thargoids. How can I do that? Perhaps I could use the recovery console - that hitherto I've fought shy of.
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1244
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Strange problem with unresponsive ships

Post by UK_Eliter »

I suspect that the size of the launching ship - it's a generation ship, from the OXP of that name (which I've adapted in my OXP) - has something to do with it. If I get my player ship sufficiently far from the launching ship then the bugs attack (though, complicating things, if the player is far away, the bugs follow a different routine to reach it . .).

I'd really like to get this sorted out. For, I've rewritten my OXP in much better coding style, and (/partly for that reason) optimisations and bug fixes, and this is the one thing I need to get done before I can release it and escape the massive time sink that is Oolite OXPing!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Strange problem with unresponsive ships

Post by phkb »

UK_Eliter wrote:
escape the massive time sink that is Oolite OXPing!
Hmm. Unlikely! Here, have another cookie. :D
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1244
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Strange problem with unresponsive ships

Post by UK_Eliter »

Might any of the main Oolite's programmers shed some light? Who are they these days? I've lost track. another_commander?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Strange problem with unresponsive ships

Post by phkb »

One way to debug what's going on with the AI is to turn on different parts of "logcontrol.plist". In particular, these items:

Code: Select all

	ai							= yes; // AI messages are shown if a ship's reportAIMessages property is set, for instance through the JavaScript console.
	ai.message.receive					= inherit;
	ai.takeAction						= inherit;
	ai.takeAction.noAction					= inherit;
	ai.takeAction.orphaned					= $aiError;
	ai.takeAction.debugMessage				= inherit;
	ai.takeAction.badSelector				= inherit;
	ai.error						= $aiError;
	ai.error.recursion					= inherit;
	ai.error.recursion.stackTrace				= inherit;
	ai.error.stackOverflow					= inherit;
	ai.error.stackOverflow.dump				= inherit;
	ai.setTakeOffFromPlanet.noPlanet			= $aiError;
	ai.suggestEscort					= inherit;
	ai.suggestEscort.refused				= inherit;
	ai.rollD.invalidValue					= $aiError;
	ai.syntax.setCoordinates				= $aiError;
	ai.scanForNearestShipMatchingPredicate.compile.failed	= $aiError;
	ai.invalidFormat					= $aiError;
	ai.invalidFormat.state					= inherit;
	ai.invalidFormat.handler				= inherit;
	ai.invalidFormat.action					= inherit;
	ai.unpermittedMethod					= $aiError;
	ai.load							= no;
	ai.load.failed.unknownAI				= $aiError;
	ai.invalid.notAStation					= $aiError; // Warning when station AI message is used on non-station.
And as the comment says, make sure reportAIMessages is set to true on the ship.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Strange problem with unresponsive ships

Post by phkb »

And the Javascript console is invaluable. It makes it far easier to debug things while they are in motion.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Strange problem with unresponsive ships

Post by Smivs »

UK_Eliter wrote: Wed Jul 12, 2017 10:49 pm
Smivs, you're toying with me! I thought you had a lead!
No, sorry. I've had 'fun' in the past with Thargoids and I know the scan_class is a big deal in how they behave. It just seemed like a good place to start.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2475
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Strange problem with unresponsive ships

Post by Griff »

I don't know if it's any help (i'm totally AI clueless), but Eric Walch fixed a problem i had with some ships launching from a black monk station which would just pootle about the place non agressivley here: https://bb.oolite.space/viewtopic.ph ... 68#p176568
fatleaf's post just below eric's also might be usefull, weapon range seems to play a part in hw agressive the ships might be
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1244
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Strange problem with unresponsive ships

Post by UK_Eliter »

Thanks everyone. I think that, with your help, I am making progress. My launched ships now attack, though they do have a tendency, even when attacking, to try to be twiching off in the direction that they were flying in when they launched!

At one point I thought I might be able to solve problems by fiddling with the length of the dock from which the ships were launched. (It turned out the dock was very short, even though the ships containing the lock are very long.) Here's a picture, for your amusement, of an experiment that didn't really work out . . They grey snout/tube is the dock, extending, er, out of the ship.
Post Reply