NPC flight routines upgrades?

An area for discussing new ideas and additions to Oolite.

Moderators: another_commander, winston

User avatar
Cholmondely
Archivist
Archivist
Posts: 5002
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: NPC flight routines upgrades?

Post by Cholmondely »

szaumix wrote: Tue Nov 22, 2022 11:05 pm
(Revisiting this topic because I fired up my main jameson last night and remembered why it's been months since I've touched Oolite: the AI's chase, aim-and-fire, and dogfight subroutines. To clarify, this is about the movement and aim-and-fire programming, and the fact that AI groups observably just "sit around" in a dogfight unless engaged -- and they are easily dodged even in a straight line chase -- and this can not be solved by weapon strength or ship armor/energy or speed)
I just stumbled across this: Friend or Foe OXP

The blurb reads:
The Friend or Foe system will allow groups of ships to work as a team independently without being setup as escorts. There is no concept of a leader or escorts/wingmen in this system. Each ship has complete autonomy and can call on help from any other team member. Each ship keeps track of who has attacked them and will ignore stray shots, ie friendly fire. Also if an attacker disappears off the scanner and later comes back the team will remember them and restart the attack run.
Is it relevant?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: NPC flight routines upgrades?

Post by szaumix »

Cholmondely wrote: Wed Aug 23, 2023 11:13 am
I just stumbled across this: Friend or Foe OXP

The blurb reads:
The Friend or Foe system will allow groups of ships to work as a team independently without being setup as escorts. There is no concept of a leader or escorts/wingmen in this system. Each ship has complete autonomy and can call on help from any other team member. Each ship keeps track of who has attacked them and will ignore stray shots, ie friendly fire. Also if an attacker disappears off the scanner and later comes back the team will remember them and restart the attack run.
Is it relevant?
Looks like it might half be, but it also looks like Tricky's solution is such a PITA that it would need an added line of code referencing that script to every single ship you wanted it to apply to. And I say it might "half" solve it because the hard truth is this: the AI's dogfighting routines are completely lacking in teeth against veterans.

After making this thread last year I was genuinely surprised that noone else registered a problem except for Switeck. I thought about it and put this down to two reasons: first is that most of you are fine with the "target practice" model of Oolite, where dogfights are essentially a matter-of-time shooting gallery -- and that's fine for those for whom it is fine. Wake up, fly into a pirate pack of 20, ten minutes later you're 20 kills richer, woo bad boy. The other reason is I think that a lot of you are piloting haulers, and my gripes are slightly more specific to fighters (CobraM3 and lighter). In hauler mode I need to get to military laser in the rear before I do so in the front or I'm dead as a sinner on sunday. So I sighed deeply and did what I always do: I went full autist mode and overhauled the entire balance of my Oolite game. I actuarialised all ship data of vanilla and OXP ships and I was looking for balance. My Ooniverse is much more dangerous now, but the level of reconfiguration was so major that there is little untouched vanilla left at all, and it still lacks a dogfight that can pose even a mild danger. NOT EVEN MILD dogfight danger.

I acknowledge that the AI will evade your fire, and the smaller and faster and more maneuverable the ship, the harder that is. In fact, I find the AI's evasion maneuvers highly praiseworthy especially with some of the smaller ships (krait/ mamba/ gecko etc et al). I acknowledge that I can up their shields and specs and make fights kills go from one minute to 5-10 minutes per ship (blah). But there is no other way to say it: the AI simply has no code for locking onto you and shooting at you. They can dodge just fine, they can pot shot from a distance, they can shoot at you while you are oncoming (from a distance) or while you are fleeing -- and as for the former, even that is "wrecked" handled by the fact that they will mostly pull away as soon as they are fired at: they balk in a game of chicken, and the ones with better energy + better lasers than you need to NOT do that. And they will never, under any circumstances, be any danger to you while you are nearby and moving.

Since then I have made several useful observations as to what the AI specifically lacks and where it could be improved. For example, Ferdilances should theoretically be one of the more maneuverable of the dogfighters with their specs, but they register to everyone as one of the quicker and easier kills every time. Why? Their roll is too high! The AI rolls to evade, which presumes a rolling slow enough to result in a coil, and the faster the ship, the harder they are to shoot in that coil. But Ferdilances essentially just spin so fast that they continue in a straight line: the AI thinks it is dodging you but it's really just saying "please sir, have my life, I don't need it!" I have also observed that when the AI has LOS and aim, they still won't shoot. I watch them out of left-view and right-view in a dogfight, and I see them facing me (because I let them) and they don't shoot. They will shoot one shot (the shot that opens up) while they are in a dodging loop or similar, but the problem is I think that the underlying dogfighting code tells the AI to not really shoot at you until it is behind you. Since a veteran is always weaving in a dogfight, this will literally never happen. The ones that sit back and watch the dogfight between the one ship that you are engaged with are functionally the only danger to a veteran.

I think suspect therefore that deficiencies in AI dogfighting danger cannot be solved by OXP.
Last edited by szaumix on Wed Aug 30, 2023 5:21 am, edited 1 time in total.
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: NPC flight routines upgrades?

Post by szaumix »

And I'll say something else: I acknowledge that perfect centre-of-object accuracy is probably undesirable except in rare cases. We would never stumble upon fighting factions because they would already have wiped one another out within minutes. There has to be a happy medium; and that medium should probably random-variable or configurable

I desire what other dogfight games have: if they are pointed at your sides, they shoot, even if they aren't sure they can hit. Fixing this alone at the AI script level would make my broke adder Iron Ass with heavily-modified-against-the-player specs for every ship just as dangerous/deadly as I always wished it was.
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: NPC flight routines upgrades?

Post by szaumix »

The other thing I would probably point out from an AI-behavioral POV is that the AI appears to have two modes: the first is evade, and the second is try-to-attack. The main thing I would change is that the AI immediately turns to evade mode as soon as it is fired upon, and in some cases as soon as your crosshairs are pointed at it -- even, I think, near it.

So if I could suggest one change it would be:
1. loosen the threshold of the switch to evade mode. I *think* that particular switch is currently based on remaining energy%, at least in some cases, because I know some fighter-haulers will stare me down laser to laser a bit before swerving. Which is good.
2. If possible, make the evade/attack modes less all-or-nothing. In a dogfight, I feel like the AI *always* is running away, and almost never trying to hit you. They even pass up clear opportunities to do so. This right there needs to change to make the AI dangerous in a dogfight
User avatar
Cholmondely
Archivist
Archivist
Posts: 5002
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: NPC flight routines upgrades?

Post by Cholmondely »

I've put this thread as a link on the OXP howto AI wiki page
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: NPC flight routines upgrades?

Post by phkb »

I'd like to commit to checking this out in more detail, but I have too much other stuff I'm fixing/tweaking/repairing that I know I'm not going to be able to in the short term. So, I guess I'd just like to say - I hear you. And perhaps, once some other things are resolved I'll be in a better position to look into this more deeply.
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: NPC flight routines upgrades?

Post by szaumix »

phkb my good man, you have already contributed so much to my enjoyment of Oolite that you were off the hook from further necessity several hundred man-hours ago!
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: NPC flight routines upgrades?

Post by Switeck »

Switeck wrote: Fri Jul 22, 2022 6:10 pm
The lead freighter/fighter that the escorts were supposed to guard often just putters around often not even shooting back, using very short bursts on injectors if it has them even while not being hit and/or being shot at.
What is causing that?

And also what causes escorts of ships to not attack anything attacking their parent "mothership"?
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: NPC flight routines upgrades?

Post by szaumix »

Switeck wrote: Thu Aug 31, 2023 7:45 pm
Switeck wrote: ↑Sat Jul 23, 2022 4:10 am
The lead freighter/fighter that the escorts were supposed to guard often just putters around often not even shooting back, using very short bursts on injectors if it has them even while not being hit and/or being shot at.

What is causing that?
I've observed this behavior, and if it is what I think it is, the short injector bursts correspond to getting out of someone's crosshairs. Actually the crosshairs don't even have to be directly on it.

Freighters are useless in most battles, and all my freighter pirates are stacked to the hilt with ECM resistant missiles, max lasers on all sides and even for all this they are a shade above 'not COMPLETELY useless in a fight', so long as they have at least 2 fighters keeping me busy. I had an idea that I'm going to give hauler pirate mothers a 10-15% chance of Q-bomb, soon. I heard cim say last year in some thread that they can't use side lasers and he's wrong, I've seen them do it.

How would I improve hauler fighting AI? Launch missiles earlier, be ready to run earlier, stare down fighters in a sight-to-sight showdown and don't switch to evade mode so easy. Other than that, they are not dogfighters and shouldn't function as such, they should need support.

Mine also have deceptively small maneuverability and thrust bonuses, but not speed. Large enough bonuses that they matter in a scrap, small enough that if a new player is piloting the same ship it will not actually be noticable or advantageous. Why? Because to my extreme annoyance, ships do not fully utilize the specs they actually have.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: NPC flight routines upgrades?

Post by Switeck »

szaumix wrote: Sat Sep 02, 2023 3:05 am
Switeck wrote: Thu Aug 31, 2023 7:45 pm
The lead freighter/fighter that the escorts were supposed to guard often just putters around often not even shooting back, using very short bursts on injectors if it has them even while not being hit and/or being shot at.
I've observed this behavior, and if it is what I think it is, the short injector bursts correspond to getting out of someone's crosshairs. Actually the crosshairs don't even have to be directly on it.
Should friendly freighters be doing this even when they're not under attack nor is their escorts?

I remember Oolite v1.80 or so where a Python would slide past me having fired its front laser on the way in for moderate effect...and then turned its rear laser on me and done 2-4x the damage the front laser did! Now this level of devastation could be mostly reserved for above-normal higher-accuracy ships, but now this basically NEVER happens.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: NPC flight routines upgrades?

Post by phkb »

Question: Have you played with the settings at the top of the oolite-populator.js file?
this.$weaponLevelBias
this.$skillLevelBias
this.$skillLevelMaximum
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: NPC flight routines upgrades?

Post by szaumix »

Image

current NPC skill levels:
Pirate: 10
Assassin: 7
Hunter: 8
Trader: 10
Aliums: 7
Others: 10
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4646
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: NPC flight routines upgrades?

Post by phkb »

Skilled NPC's only affects a pilots accuracy level. From the oolite-populator.js file:

Code: Select all

	/* The global level of bias in weapon selection. A few useful
	 * threshold values if modifying this:
	 *
	 * 0: default weapon selection
	 *
	 * 0.2: above this military lasers start being granted to rare ships
	 *
	 * 1.2: above this aft military lasers start appearing; forward
	 * military/aft beam is common
	 *
	 * -0.8: no ships have aft beam laser; forward beam is rare
	 *
	 * -1.8: no ships have beam lasers
	 *
	 * A few ships (e.g. police ships) do not have variable lasers and
	 * are not affected by this setting.
	 */
	this.$weaponLevelBias = 0;
Increasing that value will mean you get more ships with rear lasers, which will then adjust what actions they perform.
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: NPC flight routines upgrades?

Post by szaumix »

Oh that. There are almost no unmodified ships left in my ooniverse, most of them come standard with military fore and beam (at least) aft. The pilots in my ooniverse are decked out like it's the wild west all the time and only the strongest wolves survive. Weapons sure aren't a problem!

EDIT: Anyway I'm going to retract this year-old request for a review of AI dogfight behavior. The solution, I suppose, was to increase unit packs until there are so many bystanding pot-shooters that movement must be constant or you die. A year ago before all my modifications and additions to the core ships, and oxp units, and their weapons and weights, it was much worse/blander.

We are all old men with better things to do, and Oolite is a pretty cool/fun distraction in between doing of those things I should really be doing with my life 8)
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: NPC flight routines upgrades?

Post by Switeck »

phkb wrote: Sat Sep 02, 2023 3:28 am
Question: Have you played with the settings at the top of the oolite-populator.js file?
this.$weaponLevelBias
this.$skillLevelBias
this.$skillLevelMaximum
I've forced skill levels to max before for individual shiptypes and added military lasers all the time to them.

I did make a Boa 2 Black Dog (pirate/hunter) in Switeck's Shipping OXP after all!
Post Reply