Suicidal Vipers

General discussion for players of Oolite.

Moderators: winston, another_commander

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

Suicidal Vipers

Post by Smivs »

Now here's a funny thing. This afternoon I spent a while launching, turning around and firing at the station (don't ask :? ).
The odd thing was that about half the times I did this, a viper interceptor launched and flew in a dead straight line straight into the navigation buoy, destroying both.
I'm not sure that's supposed to happen, is it? :o
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Well, that's a loooooooooooooooooongtime acquaintance bug. However, I thought it was squashed... :?: Maybe not in the AI concerned?

EDIT: I can't reproduce it. What are you doing exactly?
User avatar
caracal
Deadly
Deadly
Posts: 205
Joined: Wed Jun 25, 2008 11:31 am
Location: The Desert, USA
Contact:

Re: Suicidal Vipers

Post by caracal »

Smivs wrote:
Now here's a funny thing. This afternoon I spent a while launching, turning around and firing at the station (don't ask :? ).
The odd thing was that about half the times I did this, a viper interceptor launched and flew in a dead straight line straight into the navigation buoy, destroying both.
I'm not sure that's supposed to happen, is it? :o
I saw that behavior when testing early versions of Furball. In that case it was because I'd set the AI of the launched police ships to policeInterceptAI.plist. Dumb thing to do, because (1) that AI is supposed to be stacked on top of another one (like route1patrol or whatever), and (2) it expects to be entered with a target set, which I did sometimes and didn't other times.

But I imagine that would be an easy way to reproduce it, at least. I also see a lot of smash-the-buoy at constores. Step 1, approach. Step 2, a ship launches, a trader I think. Step 3, smash!

Hope this helps!
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Post by Smivs »

Commander McLane wrote:
What are you doing exactly?
I've been playing with an Asp variant (potentially for use in Ramirez' Iron Raven OXP) so I added the necessaries to the shipdata.plist of my shipset to generate some of these as system vessels...I refered them to the Route1patrol.AI and gave them the role 'Interceptor'.
I then launched from the station, turned and stopped just off the straight-line between the station and buoy, and fired a few shots at the station to stir things up. The station then launched some Viper Interceptors and a few of my Asps to sort me out. It seemed a fun way to get a good look at several of the Asps, and try them out in combat.
I wasn't taking notes, but I get the impression this happened when there was quite a delay in launching the first ship...sometimes the response to my attack was immediate, sometimes rather slow, and I think it was mostly the slow ones that did the suicide thing. I don't remember any of the Asps doing this, but it was spawning around 3-4 Vipers for every 1-2 Asps.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hmmm. According to my tests defense ships do launch with policeInterceptAI and a stack-depth of 0, and they do not crash into the buoy, but circle around me and fire at me. So everything seems fine.

However, I am only seing ordinary Vipers as defense ships. I don't know why you get Viper Interceptors, and whether this makes the difference. In fact, Viper Interceptors should never be launched as defense ships, and cannot in unaltered main stations. Have you tweaked the station to do so?
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Post by Smivs »

Commander McLane wrote:
Hmmm. According to my tests defense ships do launch with policeInterceptAI and a stack-depth of 0, and they do not crash into the buoy, but circle around me and fire at me. So everything seems fine.

However, I am only seing ordinary Vipers as defense ships. I don't know why you get Viper Interceptors, and whether this makes the difference. In fact, Viper Interceptors should never be launched as defense ships, and cannot in unaltered main stations. Have you tweaked the station to do so?
No. No station-tweaking here.
I should also have mentioned that the reason I started to take the off-centre position was because a few launched and bumped into me to start with! There were also one or two that crashed back into the station. It just gets weirder.
Commander Smivs, the friendliest Gourd this side of Riedquat.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

After launch, many times the ships will pick a straight path to their target...and if that target happens to be almost directly above the station...they plow right into the station as they go.

Drop a cargo pod above the station and watch the fireworks as scavengers come out and try to get it. :lol:
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Commander McLane wrote:
Hmmm. According to my tests defense ships do launch with policeInterceptAI and a stack-depth of 0, and they do not crash into the buoy, but circle around me and fire at me. So everything seems fine.

However, I am only seing ordinary Vipers as defense ships. I don't know why you get Viper Interceptors, and whether this makes the difference. In fact, Viper Interceptors should never be launched as defense ships, and cannot in unaltered main stations. Have you tweaked the station to do so?
IIRC, it depends on the system tech level, or more specifically what type of station you're talking about (cori, dodec or ico). The higher tech stations have VI's as defenders.
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 »

Thargoid wrote:
Commander McLane wrote:
However, I am only seing ordinary Vipers as defense ships. I don't know why you get Viper Interceptors, and whether this makes the difference. In fact, Viper Interceptors should never be launched as defense ships, and cannot in unaltered main stations. Have you tweaked the station to do so?
IIRC, it depends on the system tech level, or more specifically what type of station you're talking about (cori, dodec or ico). The higher tech stations have VI's as defenders.
Yes, in higher tech systems it becomes more likely that interceptors are used for police tasks. Both for patrol ships as well as station launching ships. But it does not show when examining the ships with the console because on adding all primaryRoles are switched to "police".
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Post by Smivs »

Thargoid wrote:
IIRC, it depends on the system tech level, or more specifically what type of station you're talking about (cori, dodec or ico). The higher tech stations have VI's as defenders.
It was an Ico station, so a high TL.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
caracal
Deadly
Deadly
Posts: 205
Joined: Wed Jun 25, 2008 11:31 am
Location: The Desert, USA
Contact:

Post by caracal »

Commander McLane wrote:
Hmmm. According to my tests defense ships do launch with policeInterceptAI and a stack-depth of 0, and they do not crash into the buoy, but circle around me and fire at me. So everything seems fine.
Everything but my memory. I tend to forget the details of my errors once I've put them behind me. Thankfully git is not so, er, human. This reproduces the buoy-smack 100% of the time, in both 1.74.2 and r3734:
  1. Run debug console and start oolite.
  2. Pick an existing commander, or start a new one.
  3. Launch and motor out to a nice viewing distance where you can see the nav buoy, and preferably the station's docking slit too.
  4. Enter the following command in the debug console:

    Code: Select all

    var newShip = System.mainStation.launchShipWithRole("pirate", true); newShip.switchAI("interceptAI.plist");
  5. Big bada-boom! You can make it happen faster by adding newShip.desiredSpeed = 1.0; to the end of that line.
So I was close, but it was interceptAI, not policeInterceptAI, and it was the pirates, not the cops. D'oh! :oops:

Now, interceptAI is not the most full-bodied AI in the bunch, and I admit I didn't inspect it before I tried it in the early days of coding my OXP. But used mistakenly or not, I'd expect any ship to notice a large metal object in its path and, y'know, steer around it or something.
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 »

caracal wrote:
Enter the following command in the debug console:

Code: Select all

var newShip = System.mainStation.launchShipWithRole("pirate", true); newShip.switchAI("interceptAI.plist");
[*]Big bada-boom! You can make it happen faster by adding newShip.desiredSpeed = 1.0; to the end of that line.
So I was close, but it was interceptAI, not policeInterceptAI, and it was the pirates, not the cops. D'oh! :oops:
One thing is missing:

Code: Select all

newShip.target=PS;
Because the ship is expecting to have a target. However, without a target the AI should get a "TARGET_LOST" message after launch, induced by the "performAttackTarget" command and the code should be able to deal with it. Maybe vipers start to fast and slowdown not in time for the buoy when loosing the target.
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 »

One probable fix could be to add a state in the policeInterceptAI. This is the AI used by all launching vipers. Please replace the current "ATTACK_SHIP" state with the next two. It will force all defence ships to make a 5 second sideway movement in relation to the station. I just tested it with launching vipers while being cloaked myself. They used to fly straight ahead and stop near the buoy when launching without target. With this extra state they first make a sharp turn before proceeding with their docking after a wrong launch. I have not tested when they lose target later on but I don't expect this added code being a problem.

Code: Select all

	"ATTACK_SHIP" =
	{
		ENTER = (performAttack);
		"ENERGY_LOW" = ("setStateTo: FLEE");
		"INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: FLEE");
		"TARGET_DESTROYED" = ("setStateTo: DOCK_WITH_STATION");
		"TARGET_LOST" = ("setStateTo: CLEAR_STATION");
	};
	"CLEAR_STATION" = {
		ENTER = (getWitchspaceEntryCoordinates, setDestinationFromCoordinates, "setDesiredRangeTo: 100.0",
			"setSpeedFactorTo: 0.75", performFlyToRangeFromDestination, "pauseAI: 5");
		UPDATE = ("setStateTo: DOCK_WITH_STATION", "pauseAI: 5.0");
	};
User avatar
caracal
Deadly
Deadly
Posts: 205
Joined: Wed Jun 25, 2008 11:31 am
Location: The Desert, USA
Contact:

Post by caracal »

Eric Walch wrote:
One thing is missing:

Code: Select all

newShip.target=PS;
Because the ship is expecting to have a target.
Yes, I think all the "interceptor" AIs (intercept, policeIntercept, and traderIntercept) expect to have a target set, since they all start out by doing a performAttack. The example code I posted was intended to reproduce the buoy crash, not to present an example of good AI code.
Eric Walch wrote:
However, without a target the AI should get a "TARGET_LOST" message after launch, induced by the "performAttackTarget" command and the code should be able to deal with it. Maybe vipers start to fast and slowdown not in time for the buoy when loosing the target.
I direct your attention to this portion of my comment:
caracal wrote:
... it was the pirates, not the cops.
So not Vipers, or any other police, but traders, at least in my case. The police I launch in Furball need no assistance in finding and attacking the Fugitives. :twisted: Unlike Smivs, I've never seen them fly straight into any obstacle, though. And it's always a trader hitting the buoy after launching from a constore too, though I haven't taken the time to look at its code to see why.

But I'm sure you could make anything from a Viper to a Navy Frigate fly into any object you wanted if you used bad AI code like I did. ;) And I don't think it's related to them going too fast to dodge; at one point in my testing, I did see ships fly out of the station, hit the injectors, and fly at maximum speed into the buoy, but in the test I posted yesterday, they actually fly pretty slowly. If you get a Python, he'll often just bounce off the buoy, and then keep trying like a bull nudging a Volkswagen. :lol:
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Post by Smivs »

Caracal, you may not realise it but the above post was the 100,000th on the BB. Congrats on helping us pass this milestone.
Commander Smivs, the friendliest Gourd this side of Riedquat.
Post Reply