However! Some areas of complete suck remain! And I'm here to heckle you about it
Very simply, I have yet to see any of the "free form" AIs (KAI, RAI) or "slightly guided" AIs (AAI) properly determine what a "powerful" unit is, and they're often wasting resources on really stupid stuff.
For example, I've just finished coding a mobile siege mortar. It's designed to stop moving, via COB, every time it wants to fire. Even if that wasn't a problem, it'd still be useless as an offensive unit, except in its assigned role, because it has HighTrajectory=1 set, which combined with with a weapon MaxVelocity of 550, means "it's going be up to 10 seconds before a shot hits the ground after being fired". At maximum range, it literally will have the second shot in the air, on the way, before the first one hits, and it has a reloadtime of 10!
Basically, an AI should never, ever choose to build this, until the day cometh when AIs can determine, "hey, that's a siege mortar, I should use the special Siege Mortar attack routine with it".
There are dozens of examples of this problem that I see, when trying to get the AI to play a decent game.
Another example is that I have a Unit that is currently vastly, obviously OP. Here's a breakdown of why:
It flies (big power multiplier there),
It's fast (this is obviously relative to the scale of speeds in a mod, but its MaxVelocity is 13, which is fairly quick by most standards)
It's cheap (again, compared to other stuff, there are exactly 4 things cheaper on metal, and 3 things cheaper on energy)
It builds pretty quickly (there are two things that build faster).
Its weapon has a good range range=700), travels rapidly (weaponvelocity=700), and has a CollisionSize of 16 (iow, it's designed well, and will record hits almost every shot that travels through a collision sphere) and while the weapon is slightly inaccurate (accuracy = 1200), that doesn't matter very much, because of the fact that, shooting during a dive, the cone doesn't have that long to spread, and with a ReloadTime of 0.2, the law of averages says that it's going to generate a lot of hits even in air-to-air combat).
In my mod, you can build more of two (exactly two) combat units, using the same factory and time. Both of these units are inferior in combat strength, period, although they both have their uses in an otherwise balanced game. Yet none of the four somewhat-freeform AIs properly recognize this, and build vast fleets of this unit to decimate poor human players with!
Obviously, something is wrong here, with the way these AIs weigh combat potential.
Well, aside from heckling you, can I do anything helpful, or just bitch and moan? Well, I've been thinking about this major problem for well over a year now, and I think the answer is, "yes, to some extent".
Firstly, we should make some assumptions about Units, and their relative power:
1. Flying > Hover > Ground > Sea > Submarine. While this will lead to some obvious errors in generation of combat power, it's strategically true, which is what we want AIs to use- good strategy, not just good tactics. A flying Unit can go everywhere except under the ocean, and in most mods, it will go there far faster than anything else.
Moreover, any flying vehicle equipped with direct-fire or guided weapons is capable of something unique to Spring: concentration of firepower, due to height-stacking. It's kind've a big deal- you can only put so many Peewees around the ankles of a Krogoth... during that same time period, how many Hawks can all attack it? Hrmm.
It's a huge strategic advantage, only offset by high costs and low durability. There's a reason why aircraft are one of the things most-borked in game balance of mods- it's because their designers have a hard time factoring in the benefits of time and lack of terrain problems, too. I'd say that any aircraft, irregardless of other factors, is worth 1.15 of a hovercraft, 1.25 of a ground unit, 1.5-1.75 of a ship, and 3-4 of a submarine. At the very least.
Waitaminute. Think I'm stupid? Well, let's go look-see... hrmm...
In CA, which is fairly balanced, being based on BA... the basic values, for just building the sucker, are:
buildcostenergy=4593;
buildcostmetal=114;
buildtime=7685;
Let's put that into perspective: that's the Energy cost of a Fusion Reactor doing nothing but working on the Hawk for 4.593 seconds. As for the metal... 114 metal, in a mid-game economy, is maybe 2 seconds' worth, depending on a lot of factors. And the buildtime... hmm... a Peewee is less than 1/7th.
All of this cost, for a Unit that has fewer than twice a Peewee's hitpoints.
Whose "I'm an idiot who doesn't really understand DPS" figure (more on that in a minute) is 62.7, if one takes the highest number from the Armor damage figures, vs. a Peewee's 33. Hrmm, again, less than half.
Obviously, BA's designers, who represent and work with hardcore players, know what they're about here, and agree with me, at least on this point(and Day et al, feel free to quibble with my assignments of power levels in the listings below, I'm sure we all have valid perspectives here). While the Hawk looks like a loser on paper, it's obviously a winner otherwise, or it wouldn't come with so many penalties of cost upon cost.
So, why aren't the AIs seeing this golden opportunity to rip the puny human to shreds, when even a one-star nub would probably find this loophole?
Probably, the first response by a lot of people is going to be, "cuz it's Air, and none of the AIs handle Air really well", which I think is mistaken. Once AIs build Air, they do OK with actually using it- better than players who don't know how to use the good ol' tricks, like setting up multple bomber groups to execute after some Solars they're guarding die, etc.
No, this problem also happens on the ground, too. Let's look at a rather extreme example, which actually exists in my mod:
1 Unit costs the same amount as the other one on M/E right now, with very slight difference in Buildtime (which matters, but not as much).
Unit 1 has very few hitpoints, is slow, and has a weak weapon with a very large range, that uses HighTrajectory=1 and is inaccurate. Basically, this Unit was designed to do the job of my new siege mortar, but with an emphasis on spam, instead of big damage and wide area effects (obviously, the overall effect is similar, if you have enough spam, but the latter is a LOT less CPU-intensive, which is why I'm going that direction).
It's an utterly, miserably useless Unit for direct combat. In fact, because of the spam, the arc, and slow rate of fire, if mobile Units attack, they're quite likely to make packs of these guys shoot themselves, or at the very least, they will fail to engage the mobile units and will just die. I wanted a siege-cracker to blow open Simbase, and it works beautifully- for that purpose, in the hands of a player who knows what to do. In the hands of an AI... <shudder> it mainly serves to help me destroy their bases faster, by raining down random death inside their fortress lines...
An expert human player would use this unit in precisely two ways:
1. Fire it at a known chokepoint that is not currently observed, in the hope of randomly killing enemy units as they pass through. Sometimes a waste of micro-time, sometimes it obliterates an enemy force costing far more time to replace.
2. Scout enemy defenses or production facilities with something cheap and disposable, or a radar, and then snipe from maximum range, chipping away at the defenses while moving the unit between shots to prevent being targeted by strategic weapons, long-range artillery, or aircraft.
Until AIs can actually use these weapons properly, they shouldn't even build Units with this particular profile. KAI's chokepoint-identification system, and cheating ability, mean that it could probably use these weapons effectively, to either micro their shots in front of traveling packs (ouch!) or to snipe a human's base. However, once inside about half the range, these weapons are more dangerous to the AI's forces than to the enemy, and at a quarter of the range, the Unit should be running away from the fight at its best speed!
Now, let's look at the second Unit. Again, pretty much the same cost, and a completely different profile.
This Unit has an incredible Autoheal value, and while its hitpoints aren't super, the Autoheal means that its effective hitpoints are a completely different story. It moves quickly, and has a weapon that is short-ranged but very deadly to everything it can shoot. It's designed to close and kill things, basically. Any human player will see that right away, just from the fact that it moves about twice as fast as any other ground unit, yet has a decent weapon.
Which one of these two Units do the AIs build? Well, both of them- but not in anything like the right proportions. One of these should never get built- the other one should get built, assemble into a cluster at a random spot, and then assault a target, or roam on patrol, killing random stuff it encounters along the way, if it can.
Now, I got NTAI to do things correctly, by assigning a lot of values manually. This is good stuff, really, and it works. However, RAI failed miserably to realise what this unit was for, and built a lot of other crap that wasn't nearly as effective, and I strongly suspect, that whenever I get past the bugs currently making AAI crash and KAI unable to get an economy started, that they will perform equally miserably.
Basically, the problem here is that weapons aren't just weapons, and AIs need to see weapons in their proper contexts, and assign combat values accordingly. Here are some values, fairly random and off-the-top-of-my-head at the moment, that might provide a better weighting system, and prevent AIs from making a lot of basic mistakes:
COMBAT VALUE- multiply, starting with 1.0
MOVEMENT TYPES
SUBMERSIBLE AIR: 2.25
AIR: 2.0
HOVER: 1.5
SUBMERSIBLE LAND 1.25 (This refers to LAND units that have MaxWaterDepth over, say, 50)
LAND 1.0
SEA 0.75
DEFENSIVE STRUCTURE 0.75 (Yup, that's a movement type- zero is a number, too)
SUBMARINE 0.5
SPECIFIC FBI TAGS OF INTEREST
HighTrajectory=1; 0.0 Do not build these, unless you have a behavioral subroutine specific to this type!
HoverAttack=1; 1.15 (Hoverattack means that an Aircraft will likely deliver more attacks, on average, before dying than standard types, all other factors being even)
Autoheal 1.0 + Autoheal / hitpoints (high Autoheal should be a fairly large factor in rating real combat effectiveness)
IdleAutoHeal 1.0 + Autoheal / hitpoints / 3 (much lower importance than Autoheal, obviously)
MaxVelocity (this deserves an essay of its own, but basically, all Units of a given movement class should be averaged, and any of them above the mean should get a bonus here- we could also factor in movement issues relating to possible paths / slope stuff, but that goes into some very murky territory)
If AIR / SUB AIR, then Turnrate 1.0 + Turnrate / 2000 (otherwise, it's irrelevant, do not bother factoring for vehicles, ships, etc.- while it matters, factoring how much it matters is, well, really quite difficult, to the point of being impractical, frankly- if everybody wants concrete examples of why, I can provide them)
EnergyUse IF more than 10, THEN 1 - EnergyUse / 1000 (obviously to prevent AIs from using stuff that is very specialized, which they will almost certainly screw up- no game designer for Spring, aside from me, is likely to put things into their games with EnergyUse > 1000 anyhow)
MetalUse (same)
EnergyMake 1.0 + EnergyMake / 1000 (small bonus for energy production, we're unlikely to see many combat units that make Energy, but NanoBlobs has one- the MegaSheep- and nobody but me and Day really understood what they were about... one of my weirder ideas, but AIs should handle weird ideas, too, dammit)
MetalMake (same)
Hitpoints (a difficult topic- what are hitpoints, anyhow? Especially when one factors in idle / AutoHeal and most especially, the Armor Table, plus wildly-varying amounts used by different game designers for Spring... I think I'll leave this one undefined for now, it's going to require more thought)
Buildtime (very complex topic, again, I'll have to come back to this later)
BuildCostEnergy 1.0 + BuildCostEnergy / 1000
BuildCostMetal 1.0 + BuildCostMetal / 1000 * 2 (in the vast majority of mods, metal is harder to come by than Energy, and even in NanoBlobs, I kept the values exactly even, so it wouldn't have lead to greatly skewed results)
DamageModifier 1.0 / DamageModifier * 2 (this is a tricky one, because, contextually, this is usually only used by responsible game designers under scripted conditions via SET ARMORED TO TRUE, but it *could* be used, ad hoc, to avoid the Armor table entirely, but if you're going to do that, why not just have everything use Default damage values, and just straight hitpoints? Sometimes Spring's amazing variety and complexity of handling damage, let alone the whole damage-quadrants mess, just makes me shake my head)
... that's it for FBI values. Weapon values are a whole 'nother topic, obviously, and I'm too tired to go on. Argue about the specific values, or start hashing out the boundaries of Hitpoints and Buildtime, or the other rather complex topics, or yammering about how I've forgotten something vital (if it's not on here, it's probably because it's my educated opinion that it's actually irrelevant to combat power, but I may have missed a biggie or three.
