Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Fighter AI design discussion  (Read 3080 times)

0 Members and 1 Guest are viewing this topic.

Stainless

  • moderator
  • member
  • Offline Offline
  • Posts: 1534
Fighter AI design discussion
« on: June 17, 2019, 09:24:43 AM »

The basic design of my AI (currently) is in two parts.

  • Threat detection
  • Threat response

Threat detection uses all systems available on the aircraft, radar, PWR, mark 1 eyeball, etc. and builds a threat matrix using fuzzy logic and AI skill factors.

The biggest threat is then passed on into the threat response system.

The threat response system uses four 3 bit codes. (left, centre, right)(forward, centre, right),(below, level,above) to give a situational component and another 4 but code for distance (long, medium, short , and SHHHHHHHHIIIIIIIIITTTTTTTTTTTTT!!!!!!!!)

So the entire situation value packs into a single 16 bit code.

For each of those codes you have a list of possible actions.

A default set of actions will be built up from a combination of machine learning outside the game and well known tactics.

This table can be modified in the aircraft definition. Not just per aircraft, you could also do it per pilot. So if you wanted to do a mission with real world pilots who had well known tactics, you could define a table for that particular pilot.

Once a decision has been made, the AI pilot will fly the particular action until either the threat moves into a different threat region, or an interrupt occurs. Such as a cannon round in your engine.

The threat system will still be running. If another threat appears, it may swap to this threat and cause an interrupt, or it may not based on fuzzy logic and pilot skill.

So do you all see anything wrong with that?


 
Logged

vonofterdingen

  • Missioneer
  • member
  • Offline Offline
  • Posts: 1311
Re: Fighter AI design discussion
« Reply #1 on: June 17, 2019, 10:57:54 AM »

My only initial reservation was with the 16-bit code. Is that enough? I am thinking though that you gave that a lot of thought and it will work.
Logged

Pursuivant

  • member
  • Offline Offline
  • Posts: 711
Re: Fighter AI design discussion
« Reply #2 on: June 17, 2019, 07:37:34 PM »

I'm not clear on what the benefits of four 3-bit codes are other than ease of programming and processing speed.

It's elegant, but might ultimately be extremely limiting especially for ground vehicles, watercraft, and vertol aircraft where the ability to go backwards, straight up or down, or hold still are all options.

You could also get into trouble if you don't carefully define what you mean by "long, medium, short, and "too close." Those distances vary considerably based on the aircraft and weapon systems involved.

Threat Distance

Better to think in tactical distance "bands" set in meters or kilometers and based on weapons systems parameters:

0 - No Threat Detected/Not applicable

1- Over the Horizon - 100+ km. Ranges: Long-ranged ballistic, cruise, or 5th gen SAM missile, 5th gen AWACs radar, satellite communication, radio, ground-based radar, potential threats.

2- On the Horizon - 50+ km. Ranges: short-ranged cruise or guided missile, 4th gen SAM, 5th gen AA missile, 5th gen airborne radar, extreme high level bombing, potential tactical threats. Maneuver threshold for 5th gen fighters. Initial Point for very high level or standoff bombing/cruise missile attacks.

3 - Far Distant - ~20 km. Ranges: Tactical cruise or guided missile, JDAM/guided bombs, 3rd gen SAM, 4th gen AA missile, 4th gen airborne radar, high level bombing, heavy artillery, very heavy ground-based AAA, extreme visual range to detect aircraft under normal VFR. Maneuver threshold for 4th and later gen fighters. Initial point for high level or standoff bombing/guided bomb/guided AtG missile attacks.

4 - Distant - ~10 km. Ranges: Typical artillery or unguided rocket, 2nd gen SAM, 3rd gen AA missile or airborne radar, heavy ground-based AAA, medium level bombing, typical visual range to detect AC under VFR. Attack/avoid maneuver threshold for 1st-3rd gen jets and WW1 to WW2 era fighters. Initial point for medium level bombing, dive bombing, torpedo, and ground attacks.

5 - Far Tactical - ~5 km. Ranges: light artillery or unguided rocket, mortar, 1st gen SAM, 2nd gen AA missile or airborne radar, medium ground-based AAA, extreme heavy aerial cannon, visually guided bombs, advanced aerial torpedos, dive bombing. Tactical maneuvering threshold for WW2-era aircraft (i.e., where sub-units of a formation usually split off in order to gain advantageous position). Attack run initiation point for most bombing, missile, torpedo, or strafing attacks against ground targets.

6 - Distant Tactical - ~2 km. Ranges: extreme light aerial cannon, aerial torpedos, light AAA, low level bombing, glide bombing, extreme unguided Air-to-ground rockets, 1st gen AA missile or airborne radar. Attack run initiation point for opportunistic or hasty bombing, missile, and strafing attacks against ground targets. Attack initiation point for 1st to 3rd Gen jets vs. heavy aircraft. Tactical maneuvering threshold for WW1-era aircraft.

7 - Medium Tactical - ~1 km. Ranges: extreme unguided AA or AtG missiles, skip bombing, low-level strafing, heavy AAMG, extreme light aerial cannon/heavy MG, radar-guided gunsights. Attack initiation point for aerial attacks by WW2-era fighters vs. heavy aircraft/unmaneuvering enemy formations. 1st to 3rd Gen jets typically dogfight at these ranges.

8 - Close Tactical - ~500 m. Ranges: extreme small arms, light AAMG, extreme light aerial MG, aerial light cannon/heavy MG. Initiation point for aerial attacks by WW2-era fighters vs. light aircraft or WW1-era fighters vs. heavy aircraft. WW2-era aircraft typically dogfight at these ranges.

9 - Very Close Tactical - ~200 m., Ranges: small arms, light aerial MG. Initiation point for aerial attacks by WW1-era fighters vs. light aircraft. Optimum attack range for Air-to-Air gunnery attacks using heavy MG/light cannon. Inter-war aircraft might dogfight at these ranges.

10 - Near Contact Tactical - ~10 m. Ranges: thrown or dropped weapons or objects. Optiumum attack range for Air-to-Air gunnery attacks using light MG. Close formation or "buzzing" distances for fast-moving or heavy aircraft.  WW1-era aircraft typically dogfight at these ranges.

11 - Contact - ~2 m. Ranges: Close formation or "buzzing" distances for airshows and slow-moving small aircraft, ramming or flipping attacks.

Note that exact distances for various types of maneuver and attacks are notional and are probably incorrect for some weapons/sensor systems.

0-11 gives you 12 options for range. That could be four 3-valued logic options. Players could tweak exact range band distances.

0- Near, 1 - Medium, 2- Far

Near
0 - Contact, 1 - Near Contact Tactical, 2 - Very Close Tactical

etc.

Threat Assessment
Before you can be on the lookout for threats, you have to anticipate them. Combat pilots typically keep a lookout for hypothetical threats as well as actual ones, such as keeping a wary eye on potential ambush sites and directions from which enemy aircraft are likely to come. This is a huge factor that most flight sims ignore. This gives you four options:

0 - Non-Threat, 1 - Threat

Threat
0 - Possible threat (i.e., hypothetical or imagined threats not yet detected), 1 - Detected or known potential threat (e.g., known flak location, unknown AC on the horizon), 3- Confirmed threat.

Priority
Another place where combat flight sims fail is that they don't give options for prioritizing threats.

For example, if you're flying a F-86 over Korea, the Yak-9 that just passed you but which is just 100 m away to your 6 o'clock is a minor threat. You can use your superior speed to escape before he can turn and shoot. On the other hand, the MiG-15 at your 12 o'clock, but 2 km away and 1 km higher is the real threat. Most combat flight sims make AI respond to the nearest plane, meaning that an AI F-86 pilot will turn to dogfight the Yak-9 while ignoring the MiG-15.

Once a threat is detected, it gets prioritized:

0 - No response, 1 - Response Needed.

Response Needed Threat Level
0 - Minor, 1 - Major, 2 - Critical/Priority.

With modifications, threat response level can also be used to program aircraft behavior during in-flight emergencies or while aircrew are distracted or incapacitated. For example, you could program crew to prioritize fire-fighting vs. defensive responses, or program the pilot of a WW1-era fighter to try to unjam his guns or reload a magazine rather than maneuvering for advantageous position.

Threat Direction and Maneuver
It seems more logical from a game design point of view to use the classic clock system to determine threat Direction and Maneuver response. That makes it easier for players to program various maneuvers. Threat Maneuver response usually depends on whether the threat is to the rear, to the flank, or to the front, and whether it's above, below, very high above or below, or slightly above/below.

Height
0 - Low (-10 to -90*), 1 - Level (+/-10*), 2 - High (+10/+90*)

Low
0 - Low (-10 to -45*)  1 - Below (i.e., -45-80* downward from crew's point of view), 2 - Straight down (-80-90*).

High
0 - High (+10 to +45*), 1 - Above (i.e., +45-80* upwards from crew's PoV), 2 - Straight up (+80-90*).

Direction
0 - Forward (forward 120 degree arc), 1 - Flank (left or right 120-degree arc), 2 - Rear (rear 120 degree arc).

Forward
0 - 11 o'clock/330*, 1 - 12 o'clock/0*, 2 - 1 o'clock/30*

Flank
0 - Left, 1 - Right

Flank Left
0 - 10 o'clock/300*, 1 - 9 o'clock/270*, 2 - 8 o'clock/240*

Flank Right
0 - 2 o'clock/60*, 1 - 3 o'clock/90*, 3 - 4 o'clock/120*

Rear
0 - 7 o'clock/210*, 1 - 6 o'clock/180*, 3 - 5 o'clock/150*

Threat Detection
In some ways, it makes more sense to model threat detection based on an percentage-based algorithm based on distance, modified by aircrew skill, and modifiers to detection based on various factors which depend on the threat detection system. This allows players to model various threat recognition system including their weaknesses and blind spots. It also allows a chance that a machine can be "spoofed" or that a pilot can make an incorrect threat assessment.

In any case, there should be a robust system to customize individual aircrew, giving them levels of ability with various "skills" or areas of expertise. Not only does it lay the foundation for concepts necessary human-factors simulation like morale, fatigue, GLOC, hypoxia, etc., but it also allows players to model the behaviors of historical (or fictional) aircrew. For example, Manfred Von Richtofen should spot the enemy early, maneuver his squadron for advantageous position, and then try to hang out above and on the edges of the ensuing "furball," with a keen assessment of which comrades need help, and which enemies have lost situational awareness and are in an advantageous position to be attacked. By contrast, an ace like Werner Voss might dive right into the furball, use his superior situational awareness to mentally keep track of the aircraft around him, and his fantastic areobatics skills to gain position.

As a very rough guess, % visual detection = (skill + sighting aids - sighting penalties)/range.

Threat/Object Identification
This is another area where most flight sims fail. Just because you detect something doesn't necessarily mean that you know what it is. Adding a separate step to recognize a threat allows for friendly fire incidents. Slightly modified, it also can indicate that a plane gets lost because its crew fails to recognize certain waypoints. It could also be modified slightly to make low-flying aircraft using VFR use the classic "IFR - I Follow Roads" navigation technique, or to have aircraft orient themselves towards ground objects such as lights, cities, or airfields.

For visual ID, set % target identification to (skill + recognition aids/penalties -range)-100%.

Threat Response
This has to somehow follow (or at least allow) the classic OODA loop. Observation is covered by threat detection and identification. Orientation can be programmed into threat response maneuvering. The range at which the AI Decides and Acts could be set at (skill+modifiers)/+/-10% of optimal, where <0% indicates a failure to decide or act due to confusion, fear, surprise, or insufficient ability or skill.
Logged

Stainless

  • moderator
  • member
  • Offline Offline
  • Posts: 1534
Re: Fighter AI design discussion
« Reply #3 on: June 18, 2019, 03:39:55 AM »

I really don't want to hard code distances.

Some radars have effective ranges over 120 K , that is not valid for anything prior to about 1990.

Consider a WWII 1000 bomber raid, if I had 120 K hard coded , then virtually every aircraft would be within that range and the game would grind to a halt.

The reason I want a small number of range brackets is that they can be changed based on the entity.

So a weapon system on a WWII ship does not have to worry about anything beyond visual range, but the pilot of a F14 can see out beyond the horizon.

Also don't think of the logic in binary terms. I will be using fuzzy logic for everything.

So threat detection is in terms of "probable threat", "possible threat", "potential threat", and "IT'S SHOOTING AT ME".

All based on a whole bunch of settings. AI skill, relative position, targeting systems, sun position.

So a rookie gunner on his first flight in a B24 scared to death might fire on a little friend coming out of the sun and miss the BF109 that has him in his sights.



Logged

Pursuivant

  • member
  • Offline Offline
  • Posts: 711
Re: Fighter AI design discussion
« Reply #4 on: June 21, 2019, 12:52:46 PM »

I really don't want to hard code distances.

Fair enough. In some cases, however, users will want the equivalent of "hard-coded" distances which can be applied to broad classes of aircraft. As long as that functionality is possible, no problems.

My big point is that you (or users) might want more than just four range bands. Obviously, for most of aviation history, you can ignore them but they should be there for aircraft that need them/users that want them.

If you want just four range bands, then go for "Strategic," "Operational," "Tactical, " and "Maneuvering/Dogfighting." That's more in line with how Air Force generals plan. Apologies if I'm arguing over terminology for concepts you've already laid out.

Obviously, AI is an entirely different area of programming. As long as it allows the possibility of factoring in human performance issues, I'm happy.

To that end, AI has to take into account imperfect information. This models the abundance of caution that sensible people exercise in a combat zone. There might be nothing on the other side of the hill and no enemy for hundreds of miles, but the belief that trying to find out that fact might get you killed is going to change your entire mindset! (Alternately, base AI so that it paranoid and cowardly behavior is the baseline.)

Likewise, AI needs the ability to start from false assumptions (as opposed to no assumptions) and only "learn" to change its assumptions based on new information. It's the "to a man with a hammer, every problem looks like a nail" truism. For example, pilots not trained for combat will try to avoid trouble in a potential combat zone, and will flee if they encounter anything that looks like it. Until they discover that friendly planes are actually friendly, they'll react fearfully.

Conversely, it allows target misidentification and associated maladaptive behavior based on incorrect assumptions ("I'm lost and low on fuel. Visibility is terrible and really need to land. I think I'm over X city, so that must be Y airbase. They aren't responding to the usual radio frequencies, so they must be out. I'm coming in for a landing." Unfortunately, the reality is that you're 150 miles west of where you think you are and you've just landed at an enemy airfield!)

Also don't think of the logic in binary terms. I will be using fuzzy logic for everything.

So threat detection is in terms of "probable threat", "possible threat", "potential threat", and "IT'S SHOOTING AT ME".

More useful, at least for definitions, if not actual programming: unknown/undetected, hypothetical (e.g., "keep an eye on the Eastern horizon"), detected ("bogies"), incomplete assessment (e.g., single vs. multi-engine), positive assessment ("bandits"/"friendly"/"neutral", Spitfire/Bf-109), detailed assessment (e.g., exact aircraft make & model, unit ID, civilian/military, damage assessment, etc.).

After that AI could factor in perceived threat intensity (ranging from none to overwhelming), required planning time (ranging from "whenever . . ., to "NOW!"), and required complexity of action (ranging from easy to complex).

Detected threat, high intensity, long planning time, simple complexity = "Keep to the German side of the border or those [probably] Swiss AF fighters will be a real problem."

Identified threat, low intensity, short planning time, moderate complexity = "It looks like that enemy fighter is out of ammunition."

All based on a whole bunch of settings. AI skill, relative position, targeting systems, sun position.

Good as long as AI can be modified and settings can be customized by users. That could eventually turn into a "library" of emergency procedures, instinctive pilot behaviors, training doctrines, historical pilot profiles, etc.

So a rookie gunner on his first flight in a B24 scared to death might fire on a little friend coming out of the sun and miss the BF109 that has him in his sights.

That's the sort of AI I'd like to see! That said, AI which could use various "false premises" or "performance failures" to screw up in a variety of "realistic" ways would be even cooler. For example, the gunner to shoot at the closer target (P-51 with a Bf-109 on its tail), misinterpret target behavior (e.g., shooting at a friendly that's moving towards the bomber formation), fail to properly discriminate targets (e.g., shooting at anything with less than four engines.)
Logged

Stainless

  • moderator
  • member
  • Offline Offline
  • Posts: 1534
Re: Fighter AI design discussion
« Reply #5 on: June 22, 2019, 01:02:50 AM »

The way I see it working is.

1) QuadTree for objects
     A quad tree is a very efficient way of compartmentalising a large number of objects (don't forget I want to be able to have at least 2000 aircraft in the air at any one time).
     Using this I can very quickly get a list of nearby targets for any aircraft.

2) IFF
     Using fuzzy logic and skill values I trim this to targets that are probably hostile.

3) Threat assessment
    Again fuzzy logic is used to prioritise the potential targets.

4) Threat response
    This is the bit that is heavily aircraft dependant. A B17 in a bomber formation isn't going to be doing a lot of combat maneuvers. A Spitfire won't be looking for a good firing solution for it's Aim 9L.

This is also the bit that will require the most work.

I want this bit to be heavily moddable. So you guys can tweak the AI until we all think it's correct.

My task is to find a good way of going from a list of potential targets to a pilot moving the controls.
Logged

Pursuivant

  • member
  • Offline Offline
  • Posts: 711
Re: Fighter AI design discussion
« Reply #6 on: June 22, 2019, 12:57:30 PM »

1) QuadTree for objects
     A quad tree is a very efficient way of compartmentalising a large number of objects (don't forget I want to be able to have at least 2000 aircraft in the air at any one time).

Does this mean 2k aircraft or 2k entities which are capable of maneuver/AI behavior?

The latter option might be more appropriate for ground-attack scenarios, or a raid against a target protected by AAA, radar, barrage balloons, smoke screens, etc. Even if the default is 2K aircraft, it should be moddable to allow for AI-controlled objects.

2) IFF
     Using fuzzy logic and skill values I trim this to targets that are probably hostile.

Is it possible to to use fuzzy logic to make the sort of logical choices a combat pilot might make based on inferences rather than solid evidence?

E.g., A WW2-era Allied fighter pilot might reasonably conclude that any silver-colored, 4-engined aircraft in the sky are very likely to be friendly even if he can't determine exact model or markings. He could then conclude that the tracers he sees aimed at such an aircraft from above are probably coming from a hostile fighter he can't see. Then, making an inference as to the hidden attacker's flight path, based on the angle of the tracer fire, he could potentially position himself to be in an advantageous position to "bounce" the hostile fighter as it finishes its attack run on the bomber.

Likewise, could fuzzy logic for IFF be used to trick AI into making false inferences, to pull off the sort of ruse like "Pappy" Boyington did, using misleading formations and radio chatter to fool enemy fighters into using incorrect tactics?

4) Threat response
    This is the bit that is heavily aircraft dependent. A B17 in a bomber formation isn't going to be doing a lot of combat maneuvers. A Spitfire won't be looking for a good firing solution for it's Aim 9L.

This is where a "library" of user-created threat responses might be useful.
Possibly, threat responses could be developed based on behavior of online pilots in "full real" historical sims, particularly if using online squadrons whose members are willing to fight and fly according to proper historical tactical doctrine.

Also, would be possible to quickly build such libraries by somehow converting records of online combat (like .ntrks from IL-2) into AI routines via machine learning? (i.e., by assessing aircraft involved, engagement distances, and relative damage to each aircraft). Potentially that gives access to data collected over more than a decade.

My task is to find a good way of going from a list of potential targets to a pilot moving the controls.

Change potential targets to "potential actions" and I'm right with you. I say that because potential threat responses include escape/RTB, hide, ignore, get someone else to deal with it, or surrender/bail out.

I also have to wonder if fuzzy logic/AI could be used to model motivations and psychology like, "Will [x action] get me gongs, glory, grog, and girls?"
Logged

Koty

  • Mr. MiG
  • Modder
  • member
  • Offline Offline
  • Posts: 2274
  • It's a MiG!
Re: Fighter AI design discussion
« Reply #7 on: June 22, 2019, 01:24:37 PM »

Well, direction and distance only aren't really that important in itself. I'd say storing it simply as direction + threat priority straight away would be most advantageous. Pilot cannot really judge distance to a target unless he spots the target with radar (or has someone do the job for him). So threat type will be important for appropriate measure. You do not use a radar warning receiver to react to "a plane at 8 o'clock, 10 km away" but "radar spike, scan, 8 o'clock".

What also matters is the direction in which the threat is moving. There is difference between it moving towards you and away from you - and it closing or getting further away.
Logged
If I don't have to do it, I won't. If I have to do it, I'll make it quick.

Stainless

  • moderator
  • member
  • Offline Offline
  • Posts: 1534
Re: Fighter AI design discussion
« Reply #8 on: June 23, 2019, 02:12:03 AM »


Does this mean 2k aircraft or 2k entities which are capable of maneuver/AI behavior?

2000 AI controlled items, so aircraft, ships, anything that has a full AI. Other items such as AA guns will have a much simpler AI and be controlled by external AI sources.

So a barrage of 88MM AA guns will be told to fire at a certain formation or direction/altitude by a separate air defence AA.


Is it possible to to use fuzzy logic to make the sort of logical choices a combat pilot might make based on inferences rather than solid evidence?

The thing about fuzzy logic is that it can take hundreds of inputs and end up with a floating point value. Then you compare this floating point value against another floating point to decide what to do.

So anything you can think off can be included in the calculation.

This is where a "library" of user-created threat responses might be useful.

Yes, plus aircraft based doctrines. So BF109's could bounce allied formations. Aircraft that know they can't turn as fast as the opposition can favour high energy maneuvers. Everything we can read about can be added.

I also have to wonder if fuzzy logic/AI could be used to model motivations and psychology like, "Will [x action] get me gongs, glory, grog, and girls?"

Yes. We can add layers.

Do the first pass to get a floating point value based on the situation. 
Then do a second pass based on personality and compare the two.
Logged

Pursuivant

  • member
  • Offline Offline
  • Posts: 711
Re: Fighter AI design discussion
« Reply #9 on: June 25, 2019, 11:30:57 AM »

2000 AI controlled items, so aircraft, ships, anything that has a full AI. Other items such as AA guns will have a much simpler AI and be controlled by external AI sources.

Excellent! With the right add-ons, this sort of AI could model the sort of "operational" ground control that characterized the British defense during the Battle of Britain, as well as the complexities of the big late war bombing operations over Occupied Europe.

For example, you could have Luftwaffe ground controllers as AI objects, reacting in "real time" to things like radio jamming, "window" and diversionary raids. Likewise, you could have air traffic control AI respond realistically to aircraft behavior, such as prioritizing landing of aircraft with severe damage or wounded aboard.

So a barrage of 88MM AA guns will be told to fire at a certain formation or direction/altitude by a separate air defence AA.

Possibly have two "tiers" of AI.

The first is for aircraft and other human-controlled entities which must be capable of complex behavior, including AAA defenses where the player/scenario designer wants things like target recognition, choosing to conserve ammo vs. just shooting at every hostile, necessity of avoiding detection by certain aircraft, etc.

The second type would be purely "external" to the main AI engine and would be used to control objects with limited human control and/or where AI behavior is deliberately simplified for processing speed. Examples, light flak/infantry ground fire, tethered balloons, railroad trains, "dumb" cruise missiles and guided munitions, and non-parafoil parachutes.

Allow the option of complex or simple AI. Players could choose complex or simple AI. Simple AI routines for various types of vehicles could be provided as a stock feature to allow quick assignment of various classes of new equipment (e.g., all new parachute objects added to the game could be given non-parafoil parachute simple AI).

If you have 2 levels of AI, it might also be possible to "hand off" complex and simple AI as necessary. For example, a ship at sea with no enemies in sight could use simple AI (e.g., routine antisubmarine maneuvers). But, if it comes under attack it goes to complex AI. I'm not sure that would make a real savings in processing speed, however.
Logged
Pages: [1]   Go Up
 

Page created in 0.043 seconds with 25 queries.