the SAS Hangar > Stainless' new Flight Simulator

Fighter AI design discussion

(1/2) > >>

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?


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.

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

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


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

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.

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.

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

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

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

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

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

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*

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.

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.


--- Quote from: Stainless on June 18, 2019, 03:39:55 AM ---I really don't want to hard code distances.

--- End quote ---

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!)

--- Quote from: Stainless on June 18, 2019, 03:39:55 AM ---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".
--- End quote ---

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."

--- Quote from: Stainless on June 18, 2019, 03:39:55 AM ---All based on a whole bunch of settings. AI skill, relative position, targeting systems, sun position.
--- End quote ---

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.

--- Quote from: Stainless on June 18, 2019, 03:39:55 AM ---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.
--- End quote ---

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.)


[0] Message Index

[#] Next page

Go to full version