Those were some very interesting reads, and I've developed a sort of "suggestion" for how Mr. Parnell could improve the combat mechanics just by fixing the AI up a bit, but procedurally.
This is something I've done myself with procedural AI. The upside is that it's powerful, simple, and intelligent. The downside is that it uses a lot of decimal numbers. You guys might think of a way to fix it, though.
I could give a link to a blog post if somebody wants it, but it's a personal blog, so I'm on the fence about it.
The idea behind it is, Josh hardcodes a number of tactics for the AI to utilize. The AI for each ship then does a quick calculation every so often through a fight, taking various factors into account, and these factors are each able to give "weight" to different AI tactics. Over time, the AI can procedurally adjust the weighted values to mold their attack plans specifically to suit not only the universe, but the faction as well. Over time, therefore, the AI will evolve and become smarter, by taking the outcomes of their decisions into account.
This is an analog AI system. Like a human, the combat AI would not appear to be simply binary if-then, and would be realistically weighted due to various factors.
For example, a person doesn't say, "the sun is shining, therefore I must go outside." A human says, "it's a nice day, kind of cool, not too cold, there's a little bit of a breeze, and it's kind of bright, but I haven't gotten much sun in a while, and I'm feeling pretty good," and then goes outside. They take analog values into account and these weight the final decision. I think this will bring a degree of realism to LT that is missing from most games. Even better, these values can be weighted not only per universe, but per faction and per NPC as well - you could see different fighting styles evolve across the universe - all evolving specifically to suit the technology that has emerged there.
As an added bonus, this same system could be used for capital ship AI, simply by means of the "Personal HP/average nearby enemy HP ratio" - this value could weight other values in order to keep capital ships from dogfighting, and help them target the appropriate enemies, so they'll attack stations rather than other ships.
I've done work with AI of this type before, and I can say with conviction that it is an incredibly accurate and precise system, after it has evolved enough. Not only that, but it is fairly quick to calculate as well, only needing tactic calculations every so often, although it needs moving waypoint calculations (so you can avoid enemy fire, for instance, or flank a ship.) We might actually have to limit the AI's capacity. :\
Here's a quick example. Let's say alliedShip has 250 HP, and enemyShip has 500 HP; this comes to an allied HP/enemy HP ratio of 0.5. This ratio value is connected to all targeting, positioning, range, and movement tactics: each potential tactic is given extra weight based on the ratio:
Each tactic's weight is added to by (ratio * <1/>1 specific tactic value). Thus, in the above example, if the ratio was 3 for allied HP/enemy HP, that's greater than one, so Tactic A's weight would be increased by 3.3, Tactic B by 9.9, Tactic C by 2.1, and Tactic D by 14.1. The same is done for each of the other ratios that are being factored in, and after all the results are done, the game chooses the tactic that has the highest weight. It's a seemingly complex system, but actually very simple and adaptable when it comes down to it, as well as being easy to manipulate and change. Everything is controlled by decimal numbers.
Code: Select all
allied HP/enemy HP ratio < 1 > 1 Tactic A: 0.5 1.1 Tactic B: 2.5 3.3 Tactic C: 0.1 0.7 Tactic D: 9.6 4.7 allied firepower/enemy firepower ratio < 1 > 1 Tactic A: 0.1 4.2 Tactic B: 5.2 0.3 Tactic C: 5.1 3.2 Tactic D: 1.6 0.7
For so many numbers, that's quite a bit of math... however, a lot of the math could be optimized to not take as long, and if you stagger the calculations, as well as only needing to check a ship's tactics once every ten seconds or so, it'll even out a bit.
As a final little bonus, if you multiply each weighting by a very small value (i.e. something on the scale of 0.9-1.1), you get a feeling of impulsivity. This small value could change per NPC, so that some pilots are more impulsive than others.
And here's some suggested tactics and such:
Factors taken into account when weighting tactics: (where "reinforcements" are "ships and stations too far away to be drawn into combat, but still nearby")
(note: this list assumes that there are only two factions in a single fight. Other ratios such as "personal faction HP/weakest nearby attacking faction HP ratio" might be added so that ships could also target a single faction to wipe them out faster - making combat even smarter)
- Personal HP/average nearby enemy HP ratio
- Personal HP/average nearby enemy firepower ratio
- Personal firepower/average nearby enemy firepower ratio
- Total nearby Ally HP/Total nearby Enemy HP ratio
- Total nearby Ally firepower/Total nearby Enemy firepower ratio
- personal max speed/target max speed ratio
- personal max range/target max range ratio
- max nearby ally speed/max nearby enemy speed ratio
- total nearby ally count/total nearby enemy count ratio
- weakest nearby ally hp/average nearby enemy firepower ratio
- weakest nearby enemy hp/average nearby ally firepower ratio
- known allied potential reinforcement/known enemy potential reinforcement ratio
- distance to target (not a ratio) (this actually enables the ship's strategy to change when it gets close, so it can dive bomb and then afterburner out, for instance)
- nearest enemy priority percentage (just point and shoot)
- nobody: ignore all and go about your business (a temporary truce/ceasefire, or just ignoring the pathetic ships that can't scratch your hull)
- nearest ally's target priority percentage (team up to take enemies down)
- most powerful(wep) enemy priority percentage (target large ships with big guns (or stations))
- weakest(HP) enemy priority percentage (target fighters and heavily damaged craft)
- weakest nearby ally's aggressor priority percentage (defend allied fighters)
- most-attacked nearby ally's aggressor priority percentage (defend allied capital ships and heavily-targeted fighters)
- no preference (just point, fly and shoot) (what it does right now)
- attack from behind (try to attack from the blind spot)
- flank (attack from a different side as allies attacking same target)
- stay close to allies while en route (band together)
- stay away from allies while en route (simply don't get close to allied ships)
- avoid other enemies while en route (just try not to get killed)
- stay between enemies and known allied potential reinforcements (lure them into death, one parsec at a time)
- no preference (just point, fly and shoot) (what it does right now)
- short (stay on the enemy's tail)
- medium (stay within range of the enemy, but not necessarily on top of them)
- attack from just outside enemy's maximum range (taunt)
- attack from personal maximum range (snipe)
- get out of the combat zone (retreat) (putting it here gives you the advantage of being able to direct your retreat towards reinforcements)
- no preference: sit and fire (just point and shoot) (what it does right now)
- strafe while firing (basically, just find the enemy's line of fire and move away from it - simple math)
- dive bomb and afterburner out after a quick attack (charge and get out fast)
- stay close and avoid all enemy lines of fire unless untargeted (dogfight. short and simple.)
Everything becomes simple here - all the various bits can procedurally mix and match, allowing for new tactics to emerge. This would create a very fun gameplay experience, with the added advantage that the AI will exploit all the same tactics you're likely to - and will probably exploit them first.
Enemies will also retreat when they're dying now. Entire fleets could retreat at once, as if given orders to fall back. Allied pilots could send you messages given their plan of attack: "I'm getting out of here!" "Let's take down that capital ship!" etc. They work together when it's useful as well, and know how to avoid enemy fire. Suddenly, there's a very good reason to approach from a specific side, and you don't have to micromanage absolutely everything anymore. As an added bonus, the AI can learn from its mistakes, and hone its "skills" through "damage dealt vs damage received", making it seem even more like specific pilots are better at combat than others - because they're literally gaining experience as they fight. Pilots that see combat often will eventually be far smarter combat-wise than those who don't. Not only that, but factions that see more combat will be better at it!
I suppose the primary downside is that there would be large arrays of numbers for the game to keep track of. The above system would contain a total of 624 decimal numbers. If you have specific values for the entire universe, as well as for each faction and each ship, and you're in a system with two factions and 512 ships... That's a total of 321,360 stored decimal numbers for a single system. If you're in a universe with 128 factions and 8192 ships, that's a grand total 5,192,304 stored decimals, just for combat AI. In a word, that's ludicrous. Of course, it could be pared down quite a bit... but it's still a potential problem, I suppose, unless we don't mind working with that many decimal numbers.