Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Bug/Patch Discussion => Topic started by: kyrub on February 04, 2013, 01:26:50 PM

Title: Improving AI - what are the priorities?
Post by: kyrub on February 04, 2013, 01:26:50 PM
Let's put down a shortlist of AI improvements that could have the biggest impact on
a) improving the AI challenge in SMACX game
b) improving the fun of playing SMACX (while not necessarily forcing AI to play the "best way")
Only a few most popular/feasible things will be shortlisted.

Example: AI should build his second colony near his first base, to speed early development (a). AI should build a lot more SAM planes, to create more air contest (b).

Discuss.
(In this thread please: AVOID terraforming, social engineering and faction specific issues. I'll create special threads for them later. Thanks.)

LIST:

UNDER REVIEW
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 04, 2013, 01:39:40 PM
a few posts from elsewhere...

Kyrub, if you modify the AI so that it knows how to use gravship formers/supplies and aerial colonies properly, then I will be forever indebted to you!

Quote
I find the AI uses units extremely inefficiently in many situations, mostly because they are too cautious to attack and never (in my experience) attack with the hurry penalty.

Quote
I find that foe air power often comes in and kills some random units (police defenders, formers), then dies to air superiority counters.

Quote
...handling FM badly and having infinite pacifism drones), when there's a SMAX version I'll do some playtesting and see what else stands out. Using clean reactors and rehomeing to a punishment sphere/specialist base to avoid FM drones would be amazing if you could teach them it, but perhaps too complex.

Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 04, 2013, 01:45:18 PM
I add one personal priority:

AI almost never attacks from inside his own base when under siege. This is terrible, as it makes base sieges too easy and it draggs fun out of the game. As I have seen in the code, the AI actually uses emergency "attacking" defenders, so it's not an impossible step.

Possible occurences:
- land counterattack
- amphibious counterattack against ships
- SAM rovers (? are they effective enough to be built ?)
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 04, 2013, 02:13:27 PM
Speaking from almost entirely SMAX experience (I really hope you start including more of your improvements in SMAX, it seems to me like SMAC with plenty of interesting extras):

#1: Production issues
Far too many mins tied up with supporting useless/unwanted units (esp. transports, often combat units), not enough focus on building key facilities and productive units (formers, crawlers, CPs). Even the most aggressive factions MUST be able to build up infrastructure, otherwise even if they blast through and take over one or two players they don't equip their new empire properly and stagnate in the mid-late game.

Suggested changes:
More facilities (esp: recycling tanks, Tree Farms/Hybrid Forests, multiplying facilities).
More productive units (formers, crawlers, CPs).
Cap on transports, fewer transports.

#2: AI sharing tech with each other ineffectively
It's far too easy to get a massive leg up in tech simply by trading tech around, because while the AI accept most tech trades, they rarely offer them. If the AI offered tech trades more (preferentially trade tech with low tech players?), they'd perhaps trade with each other enough to stay in good positions on the tech chart. Also, they're FAR too resistant to trading techs which offer a SP. While a few SPs are key, a tech which gives a SP is not generally especially good.

Suggested changes:
AI should offer tech trades almost as much as possible.
AI should have no special problems with trading tech for Secret Projects (unless they're working on the project, and even then they should not be quite as averse to it).

#3 AI never attacking with hurry penalty
Both in defense and offense, this destroys their ability to beat better played armies, even if they have far more/better units.

Suggested changes:
Tweak whatever check stops them from attacking with hurry so they attack despite penalty when it's sensible (unit has higher weapon, target or target stack is valuable/has low armor).

#4 Terraforming
I've not seen the SMAC improvements, but the SMAX patch seems a little better, but could do with more. Mostly more forest, some rocky/road mines, less farm/solar and perhaps something which checks current fungus production and plants fungus if it's worthwhile. More formers in general would be pretty great, but that's to do with production.

Suggested changes:
More forest.
Planting fungus when appropriate.
More forest.
Some advanced terraforming when available (plenty of Boreholes, some heavy nutrient squares, maybe energy park?).
More forest.
Less farm/solar.

#5 Using Clean Reactors properly
Basically, the all units which are likely to be alive for a long time should be upgraded to clean once they're available (unless you've got really high support). This means defensive units staying in base and formers should be clean, and unless you're pulling the rehome trick or at peace, making air units and attacking units clean could be inefficient (especially with the AI's pure numbers/no tactics approach to combat).

Suggested changes:
Upgrade all formers and defensive units to clean when possible.
Upgrade air/combat units to clean if at peace with nearby people and have low Support.
Upgrade all combat units to clean then rehome them all to punishment sphere base before sending them into combat if Police is -4 or less (maybe -3, but one drone is dealable with usually).

#6 Combat unit production priorities
'copters. More of them are needed, a lot more with their current cost. They are much more effective than any other offensive unit for their cost. Needlejets are cool, but the bulk of an air army should be 'copters and anti air 'copters. And once they're available any army fighting without them is fighting with one hand tied behind its back.

Speeders should be favored more over infantry, though I believe you worked on this for SMAC. Infantry kind of suck in large numbers, though they can have good armor cheaply which cushions the AI's lack of tactical sense slightly.. Still, more mobility is key.

Defensive probe teams are important. No support and make the AI less probebait. One in each vaguely exposed base would help a lot, and probably be reasonable. More than one in some situations is ideal (vulnerable bases being probed), but not essential.

#7 Native issues
Native focus players don't really need to focus on making worms for much of the game, just capturing them and building up their bases economically while the worms handle military. The more they build, the less they capture. They just need to constantly explore fungus, and rushbuy facilities with the wormcash to give them a chance of matching/outproducing foes later on. A few worms in the short term (which holds up capture anyway) is not worth having no infrastructure.

#8 Production changing
This one's harder to observe without cheating to see the whole map which I usually don't do, but I've often seen AI bases be almost done with a secret project or major expensive facility/unit, then suddenly switch to something else losing a huge amount of minerals in the process.

Suggested changes:
Strongly discourage the AI from switching production when it would lose a lot of minerals, make it switch to another SP at least.

#9 Colony pods going off to die
I noticed this running a sim on a mostly land map, at one point the AI tried to send a colony pod a huge distance away off through fungus. This would have been entirely crippling to the faction.

#10 Drone control issues
Some factions have serious drone issues, but on the other hand some don't. It'd be nice for the AI to handle drone penalties a bit better.

There's also the stacking issue and air/ground force co-ordination thing which I mentioned before (I never got around to writing about the things other than combat in that thread), but on second thoughts.. those are usually less of a problem than most of these.

With a good portion of those improved, I think the AI would be vastly more of a challenge, at least enough to uncover some other issues currently obscured by the more clear flaws. Also, for b, I find it quite annoying when loyal (even submissive) pactmates refuse to trade tech due to the tech being SP-enabling, despite it being in both of our best interests. Dulling this tendency would improve AI-AI tech trading and overall improve their play, but also make them more useful allies and feel more real.
Title: Re: Improving AI - what are the priorities?
Post by: Petek on February 04, 2013, 09:15:51 PM
Suggestions:

1. Probe defense. AI should station Probe Teams in perimeter bases (and keep them there) to defend against enemy Probe Teams.
2. Probe offense. When an AI Probe Team approaches a base, it always uses all its movement points. This sometimes results in the probe stopping adjacent to the base where it can be intercepted. Instead, the probe should stop away from the base, where it has a chance of not being intercepted.
3. Data Angel Probe Teams seems to prefer stealing tech instead of infiltrating a faction. They should prefer to infiltrate to take advantage of their TECHSHARE ability.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 04, 2013, 10:07:36 PM
Thanks! ---- First note, I just added this line to my first post.
(please: AVOID terraforming, social engineering and faction specific issues. I'll create special threads for them later.)


Now onto your suggestions. I find these points most important and I put them on the list.


#1: Production issues, [and #10 Drone control issues falls here as I've seen]
 
#3 AI never attacking with hurry penalty
 
#6 Combat unit production priorities - 'copters.  Speeders [still not working despite effort]

#8 Production changing [crippling]


Quote
#5 Using Clean Reactors properly
Suggested changes:
Upgrade all formers and defensive units to clean when possible.
Upgrade air/combat units to clean if at peace with nearby people and have low Support.
Upgrade all combat units to clean then rehome them all to punishment sphere base.
I am aboard with using more clean reactors. But pardon my cooler interest...
- AI formers have really low survival rate due to worms. AI cannot make formers hide, avoid.. it's sheeps and wolves. Try spectator game... I actually thought about adding trance / armored formers. (Mind you, low formers' survival could also be a factor against boreholes etc.)
- air units when at peace, hehe. AI tends to produce few air units at peace. And when it produces, it's usually one of the Hive/Miriam types, so war is just around the corner.
- I somehow dislike rehoming to PS. It seems an expoit, not a proper strategy.
The 1 point that stands: the defenders should be clean (but: unless under death attack). Formers too, but I don't expect much of them. Maybe offense infantry units, as they are slow. - This can probably make the list, just. But don't expect miracles...

@Petek
Quote
Probe defense. AI should station Probe Teams in perimeter bases
Yes. Sadly. there are huge technical issues.
- How the heck shall we determine "perimeter" base? There's no data gathered on perimeter bases, or bases close to... AI has a "defend!" flag for endangered continent, but that is not very telling, since at that point, it needs to build defenders. AI has a "heat" base when planning a coordinated attack. I am afraid it is not used often.
- To build extra unit is simple. But to make it stay in a base might be actually hard to produce. The infowar unit has automatical push to search for enemy... so we have to figure, how a specific unit does not follow these orders, under what circumstances.

(These points will keep this issue out of shortlist, I am afraid. Let's do something simpler first.)

Quote
2. Probe offense. When an AI Probe Team approaches a base, ... adjacent to the base
Yes, I hate that behavior. I have to find it first, no idea about it yet. Then it will definitely move on the shortlist.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 04, 2013, 10:32:40 PM
Agreeing with all of Petek's suggestions. Expanding on 2, a probe team should generally stop as far away from a base as possible while being able to reach it next turn if it cannot reach the base this turn. And for infiltration, even though the AI does not actually *need* it because it cheats and sees everything, it'd feel more right if the first action a probe took was always to infiltrate if that faction targeted has not already infiltrated, since infiltration is absolutely key.


Quote
Thanks! ---- First note, I just added this line to my first post.
Okay, I'll save details on those things for later :)

Quote
I am aboard with using more clean reactors. But pardon my cooler interest...
- AI formers have really low survival rate due to worms. AI cannot make formers hide, avoid.. it's sheeps and wolves. Try spectator game... I actually thought about adding trance / armored formers. (Mind you, low formers' survival could also be a factor against boreholes etc.)
If the AI has enough formers, they should have cleared fungus from their main base area by the time clean reactors come along, minimizing worm contact. If possible, perhaps create formers as non-clean then upgrade them to clean every decade or two, so all the ones in safe areas are clean but not much is wasted on making formers in dangerous places clean?

Quote
- air units when at peace, hehe. AI tends to produce few air units at peace. And when it produces, it's usually one of the Hive/Miriam types, so war is just around the corner.
Hm, well, surely they must have some air units left over after war sometimes? I guess aggressiveness so maybe not.

Quote
- I somehow dislike rehoming to PS. It seems an expoit, not a proper strategy.
Agreed. However, it is effective, and would help the AI deal with market much better.

Quote
The 1 point that stands: the defenders should be clean (but: unless under death attack). Formers too, but I don't expect much of them. Maybe offense infantry units, as they are slow. - This can probably make the list, just. But don't expect miracles...
Okay.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 04, 2013, 10:48:04 PM
(I forgot to tell you, AI has really big problems with upgrading units. It has too many units for start, it has often units that are too different, very expensive upgrades... So relying on upgrading units in time is not gonna solve anything soon.)
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 04, 2013, 11:13:51 PM
With formers there should not be too many variants, and they could be upgrades one by one if there's some way to handle that? But yea, I see how the AI's massive amount of unit variation/large number of units could make upgrading very complex and expensive.

Also, I find AI tends to over-defend bases, especially compared to mine. If they can counterattack half decently (mobile units basically), it should be reasonable to have much smaller stacks of defenders than I sometimes see, at least in many bases. Though they seem to be pretty good at distributing defenders around places engagements are taking place, while leaving a few.
Title: Re: Improving AI - what are the priorities?
Post by: BFG on February 04, 2013, 11:19:24 PM
This discussion makes me wonder how the AI decides how, and when, to build a certain unit - and also when to design it.  I always suspected there was some kind of formula balancing cost versus need versus potential benefit.  If such a formula could be modified to consider all legal unit combinations during the design phase, it could help the AI immensely.  Or, we as a community might even be able to substitute static rankings (in Build/Discover/Explore/Conquer) for every possible unit and accomplish the same thing.
And yes, I realize that, especially since kyrub and yitzi are working with assembly code, either approach may be patently impossible.  Just brainstorming here.

Meanwhile, here's an issue I noticed in a game over the weekend - I had a UN probe attack one of my bases and "destroy my Children's Creche".  The funny thing is, that base didn't have a Children's Creche - it was building one.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 04, 2013, 11:50:35 PM
This discussion makes me wonder how the AI decides how, and when, to build a certain unit - and also when to design it.  I always suspected there was some kind of formula balancing cost versus need versus potential benefit.  If such a formula could be modified to consider all legal unit combinations during the design phase, it could help the AI immensely.  Or, we as a community might even be able to substitute static rankings (in Build/Discover/Explore/Conquer) for every possible unit and accomplish the same thing.
And yes, I realize that, especially since kyrub and yitzi are working with assembly code, either approach may be patently impossible.  Just brainstorming here.

Meanwhile, here's an issue I noticed in a game over the weekend - I had a UN probe attack one of my bases and "destroy my Children's Creche".  The funny thing is, that base didn't have a Children's Creche - it was building one.
All legal unit combinations would be kinda insane, considering how many there are, and how a huge majority of them are strictly worse than others. And probe teams can target things in production. You probably got hit by that, or it finished and was immediately destroyed.

Also, kryub, "more buildings to prevent unrest" should only be applied when there's some risk of riots. Many factions don't have huge drone issues usually from what I see, it tends to be only the ones which have almost no focus on facilities in general and those with drone penalties which have problems.

And how practical would it be to make the AI focus on the worthwhile SPs? There are huge differences in value between the better and worse SPs at each tech level, and the AI's choice of which to go for seems fairly random/poor.
Title: Re: Improving AI - what are the priorities?
Post by: BFG on February 05, 2013, 02:07:10 AM
All legal unit combinations would be kinda insane, considering how many there are, and how a huge majority of them are strictly worse than others.
Absolutely true.  But for modern systems, even the insanely high number of potential units would be easy to crunch through in a short period of time.  And it would only need to be done once per new tech per faction.
Title: Re: Improving AI - what are the priorities?
Post by: kraze on February 05, 2013, 04:39:23 PM
As in another thread - make AI attack adjacent tiles from within the city when it feels it has enough force to cripple the gathering attacking force.

As it is - it's really easy to exploit AI. Like you can gather a stack of 3 units near AI's city which you can't attack yet (good defense) so you just spend turns gathering more forces with AI doing nothing. Even when it has a unit with 13 attack in the city and you have a bunch of 1 def units AI is passive - considering that it can cripple the whole stack with just a single attack and thus buy himself a turn or more.

As a player when AI brings units to an adjacent tile near my city I will always attack AI's stack. Often it just makes him lose the turn since AI cannot mount a good attack anymore and I spend that free turn just bringing in more forces with my attacking unit moving nowhere from the city, getting repaired next turn.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 05, 2013, 10:10:26 PM
Out of curiosity, what puts you off shortlisting getting the AI to offer tech trades more? Current setup seems to be accept almost everything but hardly ever offer, which is just begging for a human player to get a huge tech advantage by trading with everyone, and if they could be made to offer tech more they'd trade the same amount with a smart human but MUCH more with other AI which would make all the AIs stronger (because they will all have more tech) and reduce the ability to tech broker (because they'll all have almost the same set of techs). And maybe even reduce the tech cost for AIs, if the tech cost formula does not count traded techs.

Especially before I got good enough at the game to outplay the AI in other ways, playing tech broker was usually the key to taking the lead, and even now playing against broken factions played by the AI it usually gives an important advantage in the early-mid game.

@kraze: Sounds like the not attacking with hurry issue? Although maybe it applies to other units too, but I think speeders come out sometimes.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 05, 2013, 10:45:12 PM
@kraze: Sounds like the not attacking with hurry issue? Although maybe it applies to other units too, but I think speeders come out sometimes.
I am with kraze. There is something wrong, the units hardly ever attack from inside the base.

Quote
Out of curiosity, what puts you off shortlisting getting the AI to offer tech trades more?
Yep, I forgot to explain. My experience with MoM AI tells me: trading techs is an exploit. It is a feature with no downsides, in 98% of cases good for all the parties. The genuine question is not "whether" but "how often" should AI trade techs? Every turn, I say, it's that good. - But if I make them trade techs every turn, it will turn into a disaster for you. And you'll have very little room for trading yourself.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 05, 2013, 10:55:53 PM
If as I believe you found the AI treats humans the same as AI it should be offering to trade with you just as much as with other AI, no? And by disaster, do you mean the AI will become much more powerful? Because that sounds really great to me.

I can see how tech trading is very important, but that does not necessarily make it an exploit in my mind. It feels entirely realistic to be able to exchange information and for information exchange to be almost entirely positive for both sides, and entirely realistic for the AI as well as human players to engage in tech trades whenever the opportunity arises (not every turn, but every time you get a new tech which someone with useful tech wants).

If one change which is consistent with the rules, consistent with the spirit or realism, and is not excessively complicated (hopefully) can let the AIs keep pace with humans in tech.. It seems like a definite priority to test if you're wanting the AI to be a challenge.
Title: Re: Improving AI - what are the priorities?
Post by: BFG on February 05, 2013, 11:01:27 PM
Out of curiosity, what puts you off shortlisting getting the AI to offer tech trades more?
Yep, I forgot to explain. My experience with MoM AI tells me: trading techs is an exploit. It is a feature with no downsides, in 98% of cases good for all the parties. The genuine question is not "whether" but "how often" should AI trade techs? Every turn, I say, it's that good. - But if I make them trade techs every turn, it will turn into a disaster for you. And you'll have very little room for trading yourself.
That could always be linked to the difficulty level - i.e. current trading practices at the lowest level but full-trading-every-turn behavior at Transcend.
Title: Re: Improving AI - what are the priorities?
Post by: Impaler on February 05, 2013, 11:43:08 PM
Base tech trade willingness on factors such as Pact status, attitude, Scrupulousness, and comparative power levels.  All these elements are non-biased between Humans/AI and are good sound criteria for a tech-trade.

An Faithful Pact make that an AI is Magnanimous towards and which is behind in power-level should be practically an automatic gime for technology, this will slightly lower the attitude for a while of course but not ruin it.  The further you are from that status the harder it is to get a tech trade and the better deal the AI needs to perceive in-order for it too agree.  But any AI should still take a 2 for 1 deal with a hated rival if they are making out like a bandit, their is no cut-off ware all trading is refused, it just requires a really lopsided deal to work.

One simple factor you could put in is a 'monopoly' period for each technology, if the AI knows or estimates that it has a monopoly on a technology then it could put a simple lock-out on any trading of said technology for a moderate number of turns.  The lockout could be renewed if necessary when it lapses.  This would keep the AI from doing some otherwise sloppy and ill-advised trades if the overall trade proclivity is going to go up.
 
Also with regard to Terraforming what ever you do DO NOT HARD CODE IN FOREST SPAMMING, make terraforming AI read the alpha.txt and do the math on what terraforming is worth what and try to maximize intelligently, many people mod the terraforming (nerf forests for one because they are OP irregardless of what the AI is doing) and to have the code force forests on the AI would cripple the AI if the forests were actually balanced.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 06, 2013, 11:06:44 PM
Okay, got something for you. Worker placement. And perhaps a better solution than hardcoding forming stuff in, assuming the forming code was/is linked to the square preference code. Basically, I think the AI has too strong a preference for Nutrients, which means that even if they are forced to plant forests they may not use them, and forcing them to plant forests may remove their original flexibility (I think there was some old thread which had AI planting fungus with enough fungal bonuses?).

Anyway, in the extremely early game Nutrients are key, but very quickly Minerals and Energy become comparably valuable and the AI's focus on getting maximum nutrients means they miss out on some great squares (easy to test the AI's current focus, just pick a base, turn all workers to specialists, then change them back by clicking on them). I've loaded up some old games and found things like AI picking (nut/min/eng):
1/0/0 over 0/3/0
2/0/0 over 1/2/1
Which is going to put them behind. Though in some situations the AI does seem to make sensible choices.. the people from the other thread seemed to think it was mostly to do with mission year.

I'm also very curious about what the AI takes into account when it's figuring out where to place workers.
Title: Re: Improving AI - what are the priorities?
Post by: TarMinyatur on February 07, 2013, 05:01:25 PM
...make the AI read the alpha.txt and do the math on terraforming and maximize intelligently...
I agree, if this is not too much of a programming headache.

I like to set Forest production to 0-1-2. Farms become essential. (In contrast, I've played entire vanilla games without ever cultivating a farm.)
Title: Re: Improving AI - what are the priorities?
Post by: Kilkakon on February 11, 2013, 01:04:36 AM
Two things which I'd like to add:

1. The Heroic Feat of Not Going Out To Kill Spore Launchers or Artillery
All SMAX players know this pain, and the AI is able to tolerate it. Emo AI. :|

2. Lots of Pathetic Defending Units
Suggest that if there's more than like, 3, to build new defenders and disband the old ones. Or send them out to the front.

On a minor note, one of my factions in LE has +50% PSI, and doesn't build enough native units. That's probably not worth including here though.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 11, 2013, 01:15:13 AM
@ete
There's a problem with workers, I concur. But I find it hard to decipher, how the AI does it and why it's wrong.

@Tarminyatur and @Impaler, terraforming does not belong in this thread. Please look at first post.


2. Lots of Pathetic Defending Units
Suggest that if there's more than like, 3, to build new defenders and disband the old ones. Or send them out to the front.
I am doubtful about this one. What is good for player, may not be very good for AI.

I'd prefer if AI had 3-4 AAA defenders + 1-2 ECM-police or ECM-Trance (which is free combination!), to prevent Air blitzkrieg by human player. It's not very cost-effective, but it's key to improve the mid-game AI and, even more so, to force human player to search alternatives to simple air-power + drop squad. And a killer unit that can attack from base on top, when in war?

For me, having 2-3 more defenders is far better than having bases prone to easy blitzkrieg.
Title: Re: Improving AI - what are the priorities?
Post by: Kilkakon on February 11, 2013, 01:21:05 AM
I'm just remembering games when people have like 10 1-2-1 units in a city which aren't going to do very much against tough units. But you know SMAX better than me!
Title: Re: Improving AI - what are the priorities?
Post by: BFG on February 12, 2013, 07:01:33 PM
Here's another one I'd like to see: improved pathing in uncharted areas.  I've lost count of how many times an AI Naval Transport, etc. has gotten "locked" in a small inlet, going back and forth between two cells over and over again while trying to find a way around the continent to the other side.

And here's another one:  Probe Team suicides.  I've had factions throw dozens of unenhanced Probe Teams at me when I had Hunter-Seeker Algorithm.  It's a waste of their time and resources, and no human player would have continued after the first unit died.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 12, 2013, 07:09:03 PM
Pathing is likely to be hard to tackle in assembly (edit: though improvements would be cool, and processing power is a VASTLY smaller concern now so maybe there's something there), but agree with adding a check for probe immunity before using probes offensively.
Title: Re: Improving AI - what are the priorities?
Post by: JarlWolf on February 13, 2013, 08:47:36 AM
One thing I'd like to see more of as well. While the AI concerning diplomacy can be quite tact at times, I would like the AI to have more devious planning and agreements. You often see pacts offered to betray certain groups, but I'd like to see the AI Work together quite a bit, and not only that use much more treacherous gameplay as well. Such as launching a planetbuster at you when you least expect it, etc. It'll keep us on our toes.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 13, 2013, 11:06:02 AM
They can be passive, but more often than not you'll be betrayed by your allies if you're starting to get too strong for their liking, and all but the pacifist factions are quite happy to backstab at higher difficulties. The more aggressive factions do sometimes launch a surprise PB at you, I had a surrendered Yang who I'd let build up a little too much PB one of my main SP bases out of the blue in one game. Making the AI more keen to betray may make them feel like constantly false allies, the balance seems pretty good currently in my opinion.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 19, 2013, 12:48:28 AM
Okay, got something for you. Worker placement. And perhaps a better solution than hardcoding forming stuff in, assuming the forming code was/is linked to the square preference code. Basically, I think the AI has too strong a preference for Nutrients, which means that even if they are forced to plant forests they may not use them, and forcing them to plant forests may remove their original flexibility (I think there was some old thread which had AI planting fungus with enough fungal bonuses?).

This seems more important than I thought. The problem lies in faction differences in treating worker placement, as the code shows. The value of nutrients/minerals/energy can be vastly different, depending on AI priorities. The most problematic is the treatment of minerals, where certain factions can see double value compared to others.

The formula uses as a factor:
Minerals value factor = (6 + ai_wealth + ai_fight + ai_power - ai_tech)


If you compare it with the list of classic SMAC factions, one faction has MVF = 9, while another three have MVF = 5. That's quite a gap in valoration and a sign of concern. The identities of the faction are telling as well: the former with the highest MVF is Hive, while the latters are University, Gaians and Peacemakers.

I am unfamiliar with SMAX factions, but if there is one with ai_tech=1 and ai_fight= -1 and ai_wealth and ai_power = 0, it will have MVF=4 and will probably fail to prioritize minerals, in a self-damaging way.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on February 19, 2013, 03:48:11 AM
As far as movement is concerned:

1) AI should create and move in stacks. This was finally solved in Civ4 (where AI has literally tens of units per stack) and I liked it, or at least it's the best approach you can give it. In SMAX, as in other Civ games, in 99% situations big stack = good stack. And too often you can win with just a handful of attackers against a cloud of undeveloped units, arranged and moving in no discernible pattern.

2) Several times in my life the AI employed the "chop & drop" strategy. I don't know what triggered that, but I was shocked and pleased at the same time. If you can just make the AI attack base tiles with air power, this combined with better tech parity (e.g. via trading) can be a powerful tool for AI.

3) I agree with the guys that there is big room for probe improvement. On the one hand, AI will never outsmart player, so it's bound to lose many resources allocated to probes. On the other, as it is right now, the AI use of probe is almost non-existent and in most cases you can safely take many bases per turn even from a rich AI without the fear of being on the receiving end of mind control. If AI so much as forced human to use one probe defender per base, I think it would be cool.

When we talk about diplomacy, I think it warrants a separate thread. Two notes that comes to my mind:

1) Some AI behaviour towards player could be improved. Tech trading is one, I also think that this 'everyone hates the Unsurpassed guy' makes for more static game, especially when you get Unsurpassed vey early and stay this way. If only it pushed all the AI towards some sort of uneasy alliance, it would be at least partly justified. As it is, they hate you for being the first, but also hate each other for reasons of their own and you still get to pick them one by one.

AI should be more peaceful/cooperative towards everyone when it gets its as$ kicked. Sometimes I'd like to help a dying AI (I prefer to collect pact-slaves than coffins), but it's so stubborn that it refuses to talk even when completely losing a war with somebody else. In some other situations, I would reduce Santiago to her last two bases... only to see her demand 3000 EC 'or else'. A huge chunk of "why AI is so stupid"  facepalms comes to me precisely on the diplomacy screen.

Basically, its mood should be more or less 'submissive' towards anyone who is stronger like ten times. Dear Colonel, you had your time to show me how feisty and tough you are. Now you're just being stupid and everyone watching it is embarassed.

2) Is it possible for you to fix the base trade bug? Can we teach AI to assess the value of bases? Is this feature non-existent or just flawed? Also, there are some other minor quirky bugs in diplomacy (very rarely, a Morgan AI can approach you and demand 0 EC for not killing you, and you can either bow to his demands or plea for mercy and offer 'just -1 EC'... :) ) I love it so much.

Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 19, 2013, 10:22:08 AM
stacks... that's unlikely, I am afraid.
air attacks on bases... hopefully, this should be possible.

Notes on diplomacy are interesting. AI works more with might ranks, than actual might assessment. It has some "humble pie" situations, but these are often bound to "being 7th in might". Maybe with faction elimination, this stops to work.
(I will make a thread on diplomacy)

Quote
2) Is it possible for you to fix the base trade bug? Can we teach AI to assess the value of bases? Is this feature non-existent or just flawed?

Yes. In fact I did already.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 19, 2013, 11:24:11 AM
Okay, got something for you. Worker placement. And perhaps a better solution than hardcoding forming stuff in, assuming the forming code was/is linked to the square preference code. Basically, I think the AI has too strong a preference for Nutrients, which means that even if they are forced to plant forests they may not use them, and forcing them to plant forests may remove their original flexibility (I think there was some old thread which had AI planting fungus with enough fungal bonuses?).

This seems more important than I thought. The problem lies in faction differences in treating worker placement, as the code shows. The value of nutrients/minerals/energy can be vastly different, depending on AI priorities. The most problematic is the treatment of minerals, where certain factions can see double value compared to others.

The formula uses as a factor:
Minerals value factor = (6 + ai_wealth + ai_fight + ai_power - ai_tech)


If you compare it with the list of classic SMAC factions, one faction has MVF = 9, while another three have MVF = 5. That's quite a gap in valoration and a sign of concern. The identities of the faction are telling as well: the former with the highest MVF is Hive, while the latters are University, Gaians and Peacemakers.

I am unfamiliar with SMAX factions, but if there is one with ai_tech=1 and ai_fight= -1 and ai_wealth and ai_power = 0, it will have MVF=4 and will probably fail to prioritize minerals, in a self-damaging way.
aha! Could you post the current formula for energy and nuts? And would you like suggestions on what the new one should be? Because, I'd think making it MUCH more consistent, and primarily based on the stage of the game (min/nut focus very early, with energy being phased in as almost equal after not too long so long as AI uses energy decently) would be of great help. Did the original terraforming function rely on this/something like this when weighing up the value of improvements?


As far as movement is concerned:

1) AI should create and move in stacks. This was finally solved in Civ4 (where AI has literally tens of units per stack) and I liked it, or at least it's the best approach you can give it. In SMAX, as in other Civ games, in 99% situations big stack = good stack. And too often you can win with just a handful of attackers against a cloud of undeveloped units, arranged and moving in no discernible pattern.
Even with collateral damage? I've found the AI moving in stack at chokepoints to be laughably easy to kill. I agree mostly with your other points though.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 19, 2013, 12:37:54 PM
You mean this?  ;)

Code: [Select]
NUTRI VALUE

(4+ai_growth) * (modiNutriSqProd)
-----------------------------------------------------
[IdleWorkersLeft - Size/3 + nutriSurplus] - 1


MINERAL VALUE

(6+ai_wealth+ai_aggr+ai_power-ai_tech) * BaseSize * (modiMineSqProd)
---------------------------------------------------------------------------------------------
                             mineralSurplus


ENERGY VALUE

(2*ai_tech + ai_wealth +1) * BaseSize * (modiEneSqProd)
--------------------------------------------------------------------------
              2*  TotalEnergyProd


where
(modiNutriSqProd) =
a) 200% NutriSquare IF   NutriProd + IdleWorkersLeft/2 >= NutriNeeded
b) 200% (NutriSquare+2) IF   NutriProd + IdleWorkersLeft >= NutriNeeded
c) 400% (NutriSquare) IF   NutriProd + IdleWorkersLeft < NutriNeeded

(modiMineSqProd) = 200% MineSquare
(modiEneSqProd) = 200% EneSquare

AND

IF (mineSquare) =0 AND massiveNutriSurplus (see a) above)
THEN double (modiMineSqProd)

AND

IF TotalNutriProd < BaseSize + NutriNeeded  AND NutriSquare = 0
THEN (modiMineSqProd) and (modiEneSqProd) are halved
Voila. It's a bit simplified, negligeibly.
The last line is terrible programming, by the way. This is THE victim of 1-0-0 chosen over a borehole 0-6-6 square.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on February 19, 2013, 01:53:45 PM
Quote
stacks... that's unlikely, I am afraid.

In that case, any step towards forces amassing or maybe protecting assault units with defenders could be helpful.

Quote
air attacks on bases... hopefully, this should be possible.

Could that be tied to drop units and their more extensive use? I see that in some scenarios AI can check for empty bases and take them with airborne. And in one game I saw Morgan cleaning bases with choppers followed by drop intrusions ('he thinks he's people!'). That would be wonderful.

Quote
Notes on diplomacy are interesting. AI works more with might ranks, than actual might assessment. It has some "humble pie" situations, but these are often bound to "being 7th in might". Maybe with faction elimination, this stops to work.
(I will make a thread on diplomacy)

I was thinking about and let me put it in a more general way - AI doesn't know it's dead. Very often it behaves like that Dark Knight from 'Holy Grail'. When you invade and take two bases, AI says it'll be pleasure to vivisect you. You take two more and AI demands huge cash for letting you live. Next two bases and AI can let you go for free this time, albeit bitterly. When its death is imminent, it offers you 50 bucks for peace. And when it's on the brink of extinction, it slowly dawns on AI that this war may be lost after all and it's time to surrender.

What I'd like to see more is that after the first base it offers some kind of arrangement and after the second base it offers huge pile of resources (on par with all techs and cash) but wants its bases back. Something along these lines. But it won't cut it if AI compares only ranks not actual mights. Is there any variable for 'score'?

Quote
Quote
2) Is it possible for you to fix the base trade bug? Can we teach AI to assess the value of bases? Is this feature non-existent or just flawed?

Yes. In fact I did already.

Great to hear that! However, we'll need more details how it exactly works if we are ever to amend the house rule on non-trading bases with AI.

EDIT: typo
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on February 19, 2013, 02:21:34 PM
Even with collateral damage? I've found the AI moving in stack at chokepoints to be laughably easy to kill. I agree mostly with your other points though.

Well, it would be nice if it wasn't so absurdly easy to take out AI units with air. Which is why I'd like to at least protect its units with several defenders. If we can throw AAA in the mix, this should at least give you some attacking damage before you win the battle anyway. That or give AI more interceptors. I think the AI knows that air power is useful, it just lags behind so much with tech that it's too late anyway.

And although I have never followed the AI movement patterns, I have never been able to discern any as well. In general, I have this impression (I can be wrong) that when AI attacks you, it's very self-conscious and nervous about it and doesn't really push the frontline as much as it could/should. A couple of infantries here, a lone rover there, some poor artillery yonder, God-knows-why. It should focus more on that one nearby base. But maybe I'm wrong, I didn't have any reason to study AI behaviour for a long time.

I wonder why some AI can be so aggressive even in the very first turns of the game. Like you meet Sven's foil and he declares Vendetta right off the bat, although he could benefit from trade or treaty. And of course he doesn't backs his words with any assault. AI shouldn't declare war when it's not intent to send any units in.

I know it's about terraforming, but before I forget - AI tends to build bunkers, whose only function seems to be that you waste a turn for capturing them. Maybe some airbases instead? And hiding air units in them so that you don't see them even after infiltration and it may counter attack from such airbase? Just a thought.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on February 19, 2013, 02:25:16 PM
I am unfamiliar with SMAX factions, but if there is one with ai_tech=1 and ai_fight= -1 and ai_wealth and ai_power = 0, it will have MVF=4 and will probably fail to prioritize minerals, in a self-damaging way.

Consider, though, what that ai priority means: It is a fairly pacifist faction (ai_fight=-1), with no interest in "conquer" or "build", but with a substantial technological focus.  The only example of such in SMAX is the Cyborgs.  And when you get right down to it, the Cyborgs probably do have a lot more use for energy than for minerals.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 19, 2013, 02:56:23 PM
Interesting kryub, good to see base size is a significant factor in nutrient priority (small bases need much less nuts per extra worker, so having nuts to grow is great, but when a base is big already other resources are often much more valuable so long as you're keeping your population fed). And yea, if I'm understanding it right the AI never stops attempting to force base growth due to that last line, even when sacrificing huge amounts of energy and minerals to attempt to force that growth. That's a huge base management issue.

Also, energy value seems like it is even more dependent on ai priorities than minerals?
"(2*ai_tech + ai_wealth +1) * BaseSize * (modiEneSqProd)"
With a constant of only one, the ai_tech/ai_wealth are going to be having a massive impact.. I bet that's part of why some factions fall quite so spectacularly behind on research in the mid/late game when there's more choice of useful squares so more ability to neglect energy.

@Kirov: The AI does try and assault one base/amass units, perhaps encouraging it to do so a bit more would be good, but holding back too much is not necessarily positive. Stacking more does help against air, but.. not all that much given that most AI units have armor anyway, and until they get good AAAs mixed into attack forces stacking more would just make them MUCH more vulnerable to rover counterattacks. Even with AAA, the best counter to air is usually more air/anti air air units in my experience.

And.. I really like the way the AI fights. If it surrendered quicker, a human would easily be able to bully AIs into submission without having to take their empire, then if they wanted the AI's bases they could just probe/be annoying until the AI wanted to fight again, but now the human has all their tech and money. I would perhaps like it if they surrendered, but it's not entirely wrong for some foes to have a fight to the death mentality. Just the messages feel strange when they're losing, ideally there would be a "we may be losing, but we'll do everything we can to hurt you" type message, but making them always surrender is not positive imo.

And Yitzi, the Cyborgs still desperately want all their multiplicative facilities running asap, so they want minerals almost as much as anyone else. I don't think there should be that much variation between factions resource priorities. They all want to grow small bases fast and get the facilities up fast, then mid-large bases which should have plenty of multiplying facilities to do with energy (network node, energy bank, hologram theater, later on Fusion Labs and Tree Farms) want to bring energy in (but still support their population and have a good amount of minerals, either for war or construction).
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on February 19, 2013, 03:23:44 PM
I bet that's part of why some factions fall quite so spectacularly behind on research in the mid/late game when there's more choice of useful squares so more ability to neglect energy.

That would seem to be mainly the factions that are programmed to not care so much about tech, though.

Quote
Even with AAA, the best counter to air is usually more air/anti air air units in my experience.

Yeah; changing that would require changing a few rules (make defense 4-6 available a bit earlier, make AAA priced like ECM so it's free for defensive units.)

Quote
And Yitzi, the Cyborgs still desperately want all their multiplicative facilities running asap, so they want minerals almost as much as anyone else. I don't think there should be that much variation between factions resource priorities. They all want to grow small bases fast and get the facilities up fast, then mid-large bases which should have plenty of multiplying facilities to do with energy (network node, energy bank, hologram theater, later on Fusion Labs and Tree Farms) want to bring energy in (but still support their population and have a good amount of minerals, either for war or construction).

So maybe the best approach is to set ai_tech and ai_build overrides for small and underconstructed bases (if the base lacks most of the available multiplying facilities, it treats ai_tech as 0 and ai_build as 1.)
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 19, 2013, 03:37:35 PM
Well.. All factions need to care about tech to some degree. Just like the most aggressive faction needs to be able to build once it's stolen someone's empire otherwise it stagnates, every faction needs to start paying significant attention to research in the mid/late game or they will fall too far behind in tech to even provide slight resistance to a higher tech foe.

Yep, but I'm mostly okay with battles moving mostly into the skies after a certain point so long as the AIs understand that. It keeps the pace up because air units are a whole lot faster, and allows much more rearrangement, as well as being quite realistic (taking the air in a real world war is huge, land units are primarily for holding ground or siege while air provides the agile firepower and intel).

And that would help, but even the cyborgs want to value minerals a fair amount for the whole game. Even after early facilities are in, minerals=advanced facilities, and more formers/crawlers, and long term more energy. I guess that's just pushing for all AI to want to build more. So perhaps yours would be a fitting way to deal with it, and preserve more difference between AIs. And probably have some very positive effects in general, getting AI building facilities early on.

Also kryub, have you looked at:
Quote
; Base Facilities
;
; Name, Cost, Maint, Preq, Free, Effect, (for SPs only) ai-fight, ai-mil, ai-tech, ai-infra, ai-colonize
;
; Name  = Name of facility type
; Cost  = Construction cost in minerals (x Minerals multiplier in RULES)
; Maint = Maintenance cost in energy per turn
; Preq  = Technology prerequisite (see TECHNOLOGY)
; Free  = No longer supported.
; Effect= Brief description of effect

....

Recycling Tanks,               4, 0, Biogen,  EcoEng2,  Bonus Resources
Perimeter Defense,             5, 0, DocLoy,  Disable,  Defense +100%
They were planning to make facilities free at certain techs. Perhaps there are still pointers to there, and those could be re-purposed as AI importance flags for facilities?
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 19, 2013, 11:56:35 PM
@ete
Pretty good point about the Energy equation being even more biased on ai_personnalities. I agree with Yitzi that some of ai personnalities difference should be conserved in the game as well. This is how SMACX was built. I'm for a compromise here, to conserve AI personnalities' influence, but make it less decisive in the equations.

Back to the job itself:
In my opinion, the whole Energy equation is suspect. 2* TotalEnergyProd in the denominator seems harsh, compared to Minerals' 1*(mineralSurplus). Early in the game, the mineralSurplus may be = TotalEnergyProd. But later, when AI builds lots of units, it loses focus on energy. It should be the reverse, no? Earlier, produce massively, later, a bit more energy.

And: what if AI runs Free Market? Every square gets +1 energy, so far so good, but the denominator (TotalEnergy) increases dramatically, so suddenly the energy loses 1/3 to 1/2 of its value compared to nutrients and minerals. Not sure about it, though it may end up working right.

Interesting kryub, good to see base size is a significant factor in nutrient priority (small bases need much less nuts per extra worker, so having nuts to grow is great, but when a base is big already other resources are often much more valuable so long as you're keeping your population fed).

The trouble is, that the - (BaseSize/3) in NutriValue denominator, makes Nutrients popular for large bases. A 15 size base with +6 nutrients has the denominator = 1 for the last IdleWorker, so it's quite likely to push for extra nutrients, which seems like a sub-par decision. Compare it with EnergyValue, where the factor is  * BaseSize / TotalEnergy, e.g. maybe something like * 15/22, rounded to * 3/4. So nutrients win, probably.

I understand that larger bases need more Nutrients to actually grow, but I would try to scale down the factor to - (BaseSize/5). This would make AI seek hungrily for a minimum of
+ 2 nutrients for bases with size 1-4   (but +3 nutrients halves the NutriValue already)
+3 nutrients for bases 5-9    (but +4 nutrients etc.)
+4 ..............................10-14  etc.

Code: [Select]
IF TotalNutriProd < BaseSize + NutriNeeded  AND NutriSquare = 0
If I understand this line correctly, it focuses on conserving growth at a base, under all conditions (like running FM, being Hive with massive focus on minerals, having many boreholes squre etc.). The trouble is how it works for bases > 4 size.

Personnally, I would put there either simple
Quote
IF TotalNutriProd < 2 + NutriNeeded AND NutriSquare = 0
or more sophisiticated
Quote
IF TotalNutriProd < BaseSize/8 + 2 + NutriNeeded  AND NutriSquare = 0

I'm inclined to test the simpler solution. Only +2 nutrients are the level for absolute nutrient priority.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 20, 2013, 12:07:00 AM
@Kirov
Lol at the Dark knight comparison, I enjoyed that paragraph. Yeah, I remember it from the AI and I'd like to see more realistic offers, that make sense and can be actually chosen by the HP.
AI Diplomacy needs more attention but I am leaving that for now. Note taken about early aggressivity, that should be easy to tone down for factions not on your continent.

As far as Base exchange goes, I had a look and I think I did not correct it, in fact, sorry for misinformation (my insight in the game has radically deepend in the meantime).
The basic price is:

(1000 + bigger_energy_reserve) * base_size
------------------------------ ---------------------------
(modified_distance_HQ + 4)

where modified_distance_HQ is distance changed by your bases on continent (-1) and his bases on continent (+1). There are a lot of other modifiers to the result and I will look into it properly once I have a bit more time. I promise.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 20, 2013, 12:28:41 AM
Compromising between ideal choice and faction character seems sane, just gotta make the faction character unable to influence the AI to the point where it makes terrible choices.

Agreeing with 2* TotalEnergyProd being probably too harsh, and more importantly, not very relevant to how much you want energy. Unlike nuts and mins which are pretty much all per base, trying to produce more than you use, to work out when you want energy more you want things like "how much am i going to lose to inefficiency" and "how many multiplicative facilities are in place", if functions are in place to figure those out. And yes, in mid-late game looking to focus more on energy is generally good for a human. But other than research (which is admittedly pretty key) the AI's only going to benefit from more energy if they're rushbuying intelligently (not sure of their current status) and making good use of probes in combat (maybe you've improved, but SMAX probe use is poor even for supposedly probe focused factions).

Right, I see that issue with nuts and base size.. yea, a large base should basically never be pushing for more than slightly positive nuts (and unless you're popbooming, 0 incoming nuts is often fine). Valuing them over energy or mins which are effectively always useful (the exceptions being mins spent on dead weight units, and heavy inefficiency) is not good. The change you outlined seems like it may make a significant difference.

Reading how the AI thinks is great, it'd be very cool if you post something similar to this with terraforming showing how it started and what your current setup does when you get to the terraforming thread.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on February 20, 2013, 12:56:34 AM
Back to the job itself:
In my opinion, the whole Energy equation is suspect. 2* TotalEnergyProd in the denominator seems harsh, compared to Minerals' 1*(mineralSurplus). Early in the game, the mineralSurplus may be = TotalEnergyProd. But later, when AI builds lots of units, it loses focus on energy. It should be the reverse, no? Earlier, produce massively, later, a bit more energy.

Well, what it's essentially saying is "minerals used on support don't count toward reducing the importance of having a decent amount of production", which makes a lot of sense.  I'd say a better way to deal with it is:
1. Teach the AI to not produce so many non-clean units.
2. Have a factor in there based on the number of facilities that it would like to build (i.e. don't count command centers if it is peaceful wouldn't build them anyway) but has not yet built.  That's the real reason for the shift from production to energy (early on there's a lot to build, later on the main limitation on facilities is getting the techs), so the most logical way would probably be to use that factor directly.  (You will want something so that militant factions building a lot of units and few facilities don't shift away from minerals for that reason, though; the best bet is probably just to have a faction that wants a lot of military units ignore the facility-based factor.)

Quote
And: what if AI runs Free Market? Every square gets +1 energy, so far so good, but the denominator (TotalEnergy) increases dramatically, so suddenly the energy loses 1/3 to 1/2 of its value compared to nutrients and minerals. Not sure about it, though it may end up working right.

I think it will, actually; they've got energy to spare, so they care more about the other stuff.  (Of course, those factions most likely to go Free Market are also going to have the most use for energy, but that's where the 5 main ai variables come in.)

Quote
The trouble is, that the - (BaseSize/3) in NutriValue denominator, makes Nutrients popular for large bases. A 15 size base with +6 nutrients has the denominator = 1 for the last IdleWorker, so it's quite likely to push for extra nutrients, which seems like a sub-par decision. Compare it with EnergyValue, where the factor is  * BaseSize / TotalEnergy, e.g. maybe something like * 15/22, rounded to * 3/4. So nutrients win, probably.

Worse: Couldn't you end up with a 0 denominator?
Title: Re: Improving AI - what are the priorities?
Post by: BFG on February 20, 2013, 03:48:27 PM
In my opinion, the whole Energy equation is suspect. 2* TotalEnergyProd in the denominator seems harsh, compared to Minerals' 1*(mineralSurplus). Early in the game, the mineralSurplus may be = TotalEnergyProd. But later, when AI builds lots of units, it loses focus on energy. It should be the reverse, no? Earlier, produce massively, later, a bit more energy.
For what it's worth, I suspect this denominator is due to the standard exchange rate between minerals and energy (i.e. 2 energy = 1 mineral).

I'd think a stronger approach would involve deprioritizing AI settings in favor of current situations at the base, or within the faction.  Something like:
1.  As the first-level minimum, require +0 Nutrients at expense of all others.
2.  As the second-level minimum, require +0 Minerals at the expense of all others.
3.  As the third-level minimum, require +0 Energy at the expense of all others.
4.  Next, require Nutrients, Minerals and Energy SURPLUS to match Basesize.  For example, a base size of 4 requires +4 Nutrients, +4 Minerals and +4 Energy.  These three are prioritized according to AI priorities (i.e. a Wealth faction would achieve +4 Energy before attempting +4 Nutrients or +4 Minerals.)
5.  Next, if a Secret Project or defensive unit is being produced, maximize Minerals.
6.  Next, if the faction is in a Vendetta and producing a combat unit or defensive facility, maximize Minerals.  Also prioritize Energy above Nutrients.
7.  Finally, additional resources are prioritized according to AI settings.  For example, an AI with Build = 5 and Wealth = 4 would want 125% as many Minerals (over the third-level minimum) as Energy.

Keep in mind I'm just a casual player, so this may not make much sense to others - or may not be feasible in programming.  It's just an idea.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on February 20, 2013, 03:52:39 PM
For what it's worth, I suspect this denominator is due to the standard exchange rate between minerals and energy (i.e. 2 energy = 1 mineral).

That's true when trading energy for minerals (though multiplier facilities can equalize or even reverse that.)  When trading minerals for energy, it's the other way around.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 20, 2013, 10:41:47 PM
I want to thank all last contributors, as every one of you have mentioned something that seems important.

@ete
I definitely like the idea of mixing Inefficiency into the denominator, a bit. A base with massive inefficiency should not prioritize energy too much! Besides, such a base is somewhere on the borders and it should produce minerals to defend itself, rather than focus on adding a few +energy.

@Yitzi
The idea about facilities number is quite original. Frankly, I forgot about the late game problem in SMAC. I am quite lazy and I dislike making too complicated changes, so unless I find a proper variable in the player data, I will not go this way. My personal feeling, however, is, that there will be something to hang upon.

(The less-unit-produced change is under-way, it was rather easy. But in my opinion, and in my AI experience from elsewhere, it cannot be too restrictive. AI needs a lot of units. It is unable to guess a HP attack, it is probably unable to fake attack somewhere and catch HP by surprise. Or it is unable to do these regularly. So it needs numbers on its side to defend or attack properly... Changing the army behaviour into a sophisticated model is out of the scope of my patch.)

@BFG
Hey, you're thinking in algorithms! Nice. Keep them coming.
The whole change would require a lot of my energy and I won't be doing it (but it is very interesting and it gives me a bunch of ideas). I have some doubts as well, but I won't discuss them now. Part of your way of thinking is even present in current code (AI searching minimum levels of nutrients).
Quote
5.  Next, if a Secret Project or defensive unit is being produced, maximize Minerals.
6.  Next, if the faction is in a Vendetta and producing a combat unit or defensive facility, maximize Minerals.  Also prioritize Energy above Nutrients.
This I find inspiring. - No 5. is already in the code, a base going for SP is hungry for minerals. I would love to add No 6., under defense the base will make minerals priority. It should be relatively easy as well.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 26, 2013, 10:31:58 AM
It would really help me if I had some saves just before the situations where

a) AI is about to attack with an aircraft and instead of the base, it attacks a former nearby
b) AI moves to contact with a unit on a road but fails to attack, probably because of hurry penalty
c) AI moves his probe team too close to the base and it spends all its movement instead of waiting
d) AI should attack from the base but does not (with a unit whose attack >1)

and this is more complicated but possible to find
e) where AIs have unequal techs and could easily trade them in next turns, yet they do not

I am cautiously optimistic. But without these saves, it all remains in hypothesis. With them we may see the solutions. - Thanks!
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 26, 2013, 04:41:17 PM
I'll play my next game in SMAC (maybe with total vision on) and watch out for those saves. Or would using scenario editor be unlikely to make situations unrealistic? How much info does the AI save between turns? Not sure when my next game will be though, lots of wikiprojects.

Also, about b, the AI does not generally move to contact then fail to attack. They tend to just not move into an attack unless they can attack their target without a hurry penalty.

And for d, there's a few common situations where attacking from base with a one attack unit is by far the best option (e.g. a Chaos Rover with no armor is sitting outside a base defended by only a plasma garrison. 1 weapon vs 1 armor is a lot better than 3 defense against 8 attack, even if the garrison had to take a 33% penalty or there's a Perimeter Defense (though not both).).
Title: Re: Improving AI - what are the priorities?
Post by: BFG on February 26, 2013, 05:57:57 PM
It would really help me if I had some saves just before the situations where

a) AI is about to attack with an aircraft and instead of the base, it attacks a former nearby
c) AI moves his probe team too close to the base and it spends all its movement instead of waiting
Rats. I had both of these happen in a game a week ago but didn't think to save either one.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on February 26, 2013, 08:23:52 PM
I'll play my next game in SMAC (maybe with total vision on) and watch out for those saves. Or would using scenario editor be unlikely to make situations unrealistic?
No problem with scenario editor. The key thing is that the situation when AI should act differently, happens there, and repeatedly.

Quote
Also, about b, the AI does not generally move to contact then fail to attack. They tend to just not move into an attack unless they can attack their target without a hurry penalty.
This explains why I have so many problems with tracking it. Next time, we need to be more specific. To move or to attack are quite different decisions.

Quote
And for d, there's a few common situations where attacking from base with a one attack unit is by far the best option (e.g. a Chaos Rover with no armor is sitting outside a base defended by only a plasma garrison. 1 weapon vs 1 armor is a lot better than 3 defense against 8 attack, even if the garrison had to take a 33% penalty or there's a Perimeter Defense (though not both).).
If I understood well, the AI fails to attack even in clearer cases. For testing, these would be ideal. Further on the road, we may need what you just mentioned.
Title: Re: Improving AI - what are the priorities?
Post by: ete on February 26, 2013, 08:59:30 PM
I'll play my next game in SMAC (maybe with total vision on) and watch out for those saves. Or would using scenario editor be unlikely to make situations unrealistic?
No problem with scenario editor. The key thing is that the situation when AI should act differently, happens there, and repeatedly.
Quote
Also, about b, the AI does not generally move to contact then fail to attack. They tend to just not move into an attack unless they can attack their target without a hurry penalty.
This explains why I have so many problems with tracking it. Next time, we need to be more specific. To move or to attack are quite different decisions.
Sorry about that, will try to be more precise in future.

Quote
And for d, there's a few common situations where attacking from base with a one attack unit is by far the best option (e.g. a Chaos Rover with no armor is sitting outside a base defended by only a plasma garrison. 1 weapon vs 1 armor is a lot better than 3 defense against 8 attack, even if the garrison had to take a 33% penalty or there's a Perimeter Defense (though not both).).
If I understood well, the AI fails to attack even in clearer cases. For testing, these would be ideal. Further on the road, we may need what you just mentioned.
Yes, you understand correctly. That was just a note that defenders with 1 attack may want to attack too, since you said only >1 attack.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on March 02, 2013, 12:46:38 AM
a) AI is about to attack with an aircraft and instead of the base, it attacks a former nearby

Would it be too bad, if AI simply stopped its general inclination to attack formers more than anything? For planes and for ground units? I find it a bit stupid, but I may be wrong. This seems so far the closest option to happen out of all. The production point as well.



(btw, I still need these saves with AI situations. The AI is creepily complicated, lot more than I thought and after dozens hours of work I am running out of patience. Fact is, without a bit of blind testing, 50 * (hit and miss), this will not get anywhere.)
Title: Re: Improving AI - what are the priorities?
Post by: Nevill on March 02, 2013, 10:33:39 AM
Quote
(btw, I still need these saves with AI situations. The AI is creepily complicated, lot more than I thought and after dozens hours of work I am running out of patience. Fact is, without a bit of blind testing, 50 * (hit and miss), this will not get anywhere.)
Hello, kyrub.

Here is something for you to ponder over.

Testing-Hurry-Base.SAV - here you can see that AI does indeed attack other bases if he has an overwhelming advantage, although not consistently. Note that defensive facilities can dissuade AI from attacking (Testing-Hurry-Base-Defence.SAV), even though they would not have altered the outcome significantly.

Testing-Hurry-More Units.SAV - here I added more units. Note that no attack comes (infantry units stand still or move aimlessly). For an added bonus, play this for 1 more turn. This shows that the problem lies deeper, because AI does not attack bases even when it doesn't have 'hasted' penalty. Sometimes, as the save indicates, it even fails to occupy a base that has no defenders.

Testing-Hurry-Other.SAV shows some quirks in AI behavior, as well as proves further that 'hasted' penalty is perhaps not at fault here. Note that defenses do not deter AI from attacking this time. Also note that a rover that could have attacked and possibly captured my HQ was assigned to attack a base that is further away.
Title: Re: Improving AI - what are the priorities?
Post by: Nevill on March 02, 2013, 11:03:39 AM
Here is another batch of saves.

I gave AI a pair of String Needlejets (Testing-Air-Base.SAV). It attacked me ONCE and then never bothered as much as to move the needlejets around. They just sat there, ignoring everything.

Then, after 30 years passes, it mounted an attack (Testing-Air-Attacking.SAV), but its units (not only the air ones, mind you) pretty much only attacked my formers, even when they had more defence (in a forest) than my scouts had inside the base. The problem is even more apparent with Choppers, as the AI only sends one to get rid of my formers and then ignores the rest (Testing-Air-Copters.SAV).
Title: Re: Improving AI - what are the priorities?
Post by: Nevill on March 02, 2013, 12:00:38 PM
Quote
d) AI should attack from the base but does not (with a unit whose attack >1)
Replicating this situation is a bit tricky. Most of the time AI will recognize the threat and act accordingly. However, sometimes it will assign units with a high attack power as defenders. Those units will not leave the base and will not attack. Please check the second base of the Peacekeepers. Their defences consist of 6-1-1 missile squad units. If you can hold off reinforcements from U.N. HQ, you will see that the AI will not attack with its 6-1-1 defenders, no matter how many are there.

Well, this covers a), b) and d). I am not sure if c) is even a bug, as making probe teams wait at a distance before commencing attacks might open a way to potential exploits. Still, it is easy to reproduce, as AI will use all of its probe moves  in any given situation. Just create a probe team 3 tiles away from your unit/base and you are set (it should move 2 tiles and end up at point blank range, provided there are no movement penalties due to terrain).

Please note that all of my previously posted savegames are affected by a bug I had not previously encountered. Then again, I have never before used Yitzi's patch with the GOG version.

All attack against my (Consciousness) units are made with a strenght at 25% of what is should have been. It is similar to how Psi combat with the wild life works at the beginning of the game (all their attacks up until 2115 are made at -75% strenght), except it lasts the whole game and only against my units.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on March 02, 2013, 09:00:47 PM
Nevill, welcome - and thanks for your effort!
The description made me avid to see it all, and the diagnostics seems very well thought out...


Only to read later that you used SMAX. I am afraid, I cannot use your saves, because my workspace is SMAC exe. So, to test, I would need these occurences made with SMAC.exe. (or is it possible to use SMAX saves if all factions are SMAC ones? I doubt that).

Could you please help me and reproduce them in SMAC? That would represent a big thing for me.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on March 03, 2013, 01:30:13 AM
Please note that all of my previously posted savegames are affected by a bug I had not previously encountered. Then again, I have never before used Yitzi's patch with the GOG version.

All attack against my (Consciousness) units are made with a strenght at 25% of what is should have been. It is similar to how Psi combat with the wild life works at the beginning of the game (all their attacks up until 2115 are made at -75% strenght), except it lasts the whole game and only against my units.

I don't really see any way that that could be caused by what I did.  However, have you tested whether it happens with Kyrub's patch but not mine?  Also, what difficulty are you playing on in that game?  (At low difficulties, you get a combat bonus.)
Title: Re: Improving AI - what are the priorities?
Post by: Nevill on March 03, 2013, 12:25:05 PM
Could you please help me and reproduce them in SMAC? That would represent a big thing for me.
I might be mistaken, but the behavior might differ between game versions. I might not be able to reproduce the exact same patterns.

Anyway, here is my latest attempt.
Testing-Hasted-Scouts - AI mobile units do not attack bases with scouts in them, hasted or not.
Testing-Hasted-Others - other units are fair play, it seems. I have replaced scouts with heavy attackers, and AI started to attack them. One of the enemy rovers attack with 'hasted' penalty 100% of the time, while the rest might decide not to (even though their advantage is overwhelming). Note that the AI is reluctant to attack a Scout Rover, and the HQ where it is located is the last to go down among 3 bases. But at least the AI attacks it eventually.
Testing-Hasted-Infantry - added missile infantry to the enemy force. They do not have problems with attacking scouts (or anything else, for that matter). Still they are reluctant to attack when hasted, which leads to much pointless roaming around.

If we leave AI alone, it will eventually build its own army and come knocking, and those new units apparently do not have any reservations against attacking scouts. Seeing as AI might attack with 2-1-2 rovers, but refuses to do so with 24-12-2 ones, it seems that it assigns certain plans for its units and then proceeds to use them accordingly, never utilising them for any other purpose. The problem is, its plans make little sense.

Here is a bit more tests on AI plans and maybe pathfinding.

Testing-Hurry-1 - four weapon-heavy rovers (24-12-2) placed in a closed space with my base covering the only exit. They get stuck, never attacking.
Testing-Hurry-2 - added 4 scouts to the other side of the base. They promply attack the base. 4 rovers are still stuck.
Testing-Hurry-3 - relocated 4 scouts to the same side where the rovers are. They get stuck along with the rovers.
Testing-Hurry-4 - put 4 scouts on the same side with the rovers but close to the base. They attack the base, and rovers may even help them, though it rarely happens.
Testing-Hurry-5 - removed 4 rovers, added 2 scout rovers to the other side of the base. They attacked the base. No problem here.
Testing-Hurry-6 - placed the same scout rovers in a closed space. They get stuck.
Testing-Hurry-7 - same as Testing-Hurry-2, except 4 scouts are replaced by missile squads. They do not attack my base immediately, and instead run around, doing random things. Eventually they either get to attacking my base, or Miriam just builds her own 2-1-2 rovers and assigns the task to them.

Some testing on air units.
Testing-Air-SMAC-Scouted-Once - here is an example of AI working semi-correctly. It has spotted my HQ, it sets its jets to attack mode until all defenders are dead. Note that if you kill the enemy scout, the attack never comes. More that that, the AI never bothers to destroy my own scout that is dangerously close to its Needlejets. It is as if AI never acknoledges it even has air units unless it is planning to attack.
Testing-Air-SMAC-Scouted-Twice - here is where things get worse. AI spots 2 bases. It attacks one of them and completely forgets about the other. When it captures one, it still has a scout near the other, its Needlejets are still intact, but it does nothing with them.
Testing-Air-SMAC-Scouted-Thrice - the AI prefers attacking units in the field to attacking bases, even when the bases have next to no defencive capabilities.

I don't really see any way that that could be caused by what I did.  However, have you tested whether it happens with Kyrub's patch but not mine?  Also, what difficulty are you playing on in that game?  (At low difficulties, you get a combat bonus.)
I never said your patch was responsible for that. It might have been a one-time glitch, seeing as I have never encountered this before and can not reproduce it. And no, it is not a difficulty bonus, none of them grant -75% penalties to your enemies. I just mentioned it in case you wanted to take a look at those saves and see what caused it.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on March 03, 2013, 04:30:43 PM
I never said your patch was responsible for that. It might have been a one-time glitch, seeing as I have never encountered this before and can not reproduce it. And no, it is not a difficulty bonus, none of them grant -75% penalties to your enemies. I just mentioned it in case you wanted to take a look at those saves and see what caused it.


Well, I looked at it, and it is difficulty-related (changing the difficulty to specialist reduces it); it is in fact nothing other than the difficulty bonus that gives a penalty to enemies attacking you on the lowest three difficulty levels.  It is mentioned here (http://apolyton.net/showthread.php/186592-Difficulty-Levels) (though not with the formula, which I do not remember at the moment).
Title: Re: Improving AI - what are the priorities?
Post by: Nevill on March 03, 2013, 04:53:27 PM
Sorry for the mix-up then. I didn't play at the lower difficulty levels for a long while. It seems that at Citizen all your attacks are made at twice their power level, and all AI attacks are made at a quarter of their power level.

I guess I just installed the game, hit quickstart, and the game picked up the lowest difficulty by itself.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on March 03, 2013, 11:55:28 PM
If we leave AI alone, it will eventually build its own army and come knocking, and those new units apparently do not have any reservations against attacking scouts.

Bad news again. There seems to be something affecting this type of tests with scenario editor. If the normally built AI units don't act like this, it's not probably a bug, no? Maybe the problem is that these scenario created units have not got the right unit plan, as you suggested. This messes AI up, obviously. I cannot blame it.

I will look at the saves to see if they are invalid. Have you made them all with editor?


Quote
Seeing as AI might attack with 2-1-2 rovers, but refuses to do so with 24-12-2 ones, it seems that it assigns certain plans for its units and then proceeds to use them accordingly, never utilising them for any other purpose. The problem is, its plans make little sense.

Why do you think its plans make little sense? It is the mechanics AI uses, indeed.
Title: Re: Improving AI - what are the priorities?
Post by: Nevill on March 04, 2013, 05:16:40 PM
Quote
There seems to be something affecting this type of tests with scenario editor. If the normally built AI units don't act like this, it's not probably a bug, no? Maybe the problem is that these scenario created units have not got the right unit plan, as you suggested. This messes AI up, obviously. I cannot blame it.
The first logical step would be checking up which plan these units were assigned with. There are only a dozen of them, and I think we can exclude non-military ones. Whatever the plan seems to be, the units behave erratically. If it is Offencive/Combat, then why do they not attack bases? If it is Defensive, then what are they doing in my territory? If it is set to Reconnaisance, then why do Scout Patrols (that have the same plan assigned) function correctly?

Another thing that I want to point out is that the units that are built through conventional means do behave the same when it comes to 'hasted' attacks. If, however, you will only accept a 'clean' sample, I can arrange that, though obviously I would be limited in what I can test.

And 'the AI gets things right eventually' does not mean that 'normally built AI units don't act like this'. It is only natural to see units with a correct plan attacking my bases, but that says nothing about the number of units that do not have the plan set correctly (and they exist, as indicated by 6-1-1 normally built  'defenders' from a previous SMAX save, which I haven't reproduced in SMAC yet).

Quote
Why do you think its plans make little sense? It is the mechanics AI uses, indeed.
Because I have no idea what the AI was trying to do. It is hard to explain things when I myself do not understand them. :)
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on March 04, 2013, 10:45:13 PM
If it is set to Reconnaisance, then why do Scout Patrols (that have the same plan assigned) function correctly?
What do you mean, correctly? Do Scout patrols ever attack? I cannot remind me of one such occurence.

Quote
It is only natural to see units with a correct plan attacking my bases, but that says nothing about the number of units that do not have the plan set correctly (and they exist, as indicated by 6-1-1 normally built  'defenders' from a previous SMAX save, which I haven't reproduced in SMAC yet).
These are "emergency defenders", I think. Ai has such a routine inside and it seems very normal to me. It's quite obvious, when there are too few defenders, let others defend. These units, however, are not able to counter-attack. This, I hope, can be changed.

I must say I am having very hard time to find the location of unit data in the saves. I need to understand which unit_plan do they use and change it. With this, your saves are good material and can be used for my testing.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on March 07, 2013, 07:49:14 PM
I don't think this is particularly a priority, but I've found that while the moddable psi offense/defense ratio for land finds 18 different mentions in the code, the ones for sea and air use only two of them and no others.  Presumably those two are the ones actually in combat, and the others are for the AI, implying that when the AI decides how to deal with psi, it only looks at the land ratio.  Of course that's SMAX, so SMAC might be different, but it's still something worth noting.
Title: Re: Improving AI - what are the priorities?
Post by: illumined on April 05, 2013, 08:17:36 AM
Great project, I've been off and on following some of Kyub's work with Alpha Centauri and Master of Orion and I'm always impressed by it. Recently I decided to fire up SMAX once again use the new Yitzi 1.3 patch, playing the standard Huge Map of Planet on librarian. I played Cybernetic in place of the University, with all the other factions being from the original. I ended up starting near the planetneck region, and after expanding to most of the southern portion of both continents (we really should give these continents names) I met the Hive, and as it turns out above him in the Upland Wastes and Eurytion Bay region was the Peacekeepers. The Hive went to war fairly early and wiped them out completely, and of course went to war with me soon after for believing in democracy. Here's what I noticed about his behavior:

-His offensives just didn't seem to pack much of a punch. Periodically he would send a few infantry units and maybe a rover or two over the border, but these were just lambs to the slaughter. With taking little to no losses of my own I was able to wipe them out with my speeders. Perhaps what would make it better is if he focused his attacks on one or two bases instead of trying to fight across the whole front (which is quite lengthy) all at once. Another strategy is to have a small "micro-offensive" in one part of the front as a diversion and then hit hard somewhere else. 

-His production didn't seem to be very high. One thing that would definately solve this is if the AI used more thermal boreholes, so far I haven't seen a single one besides the ones in the Borehole Cluster that was already on the map. It would hugely enhance his productivity if he had these, like me. :) I have the Empath Guild so I can always see how many units he has, his ground units were not much more than mine, at least not during round one of the war.

-His Air Force was practically nonexistent. At any given time he only had 4 or 5 aircraft, all of which were bombers. This is really surprising, before when I played previously using the vanilla build they usually have fairly large amounts of aircraft, both fighters and bombers, I don't think I've seen this before. Looking at other factions, the one that has been the most successful has been the Spartans who now control the continent that has the Freshwater Sea in its entirety, yet at this point in the game they only have 7 aircraft. Anyway, towards the end of round 1 of my war with the Hive I was pounding away at his positions and causing major casualties with my bombers, and despite that he did not produce a single interceptor. It used to be that the AI would build a large amount of fighters under this circumstance, I used to have major Battle of Britain types of air duels with them.

-He isn't really investing in his navy. In this situation that's a good thing because he's fighting a large scale war across two continents so he should be focusing on ground and air. What doesn't make sense is that even though the Spartans are now totally alone in their continent they have almost no navy. This is not good not only because it impairs her ability to defend her continent, it also makes it very difficult to wage an effective campaign to finish off Gaians and Believers by taking over the small smattering of sea bases they have left. She also recently declared war on me which is impossible for her to prosecute effectively since my navy is so much better than hers and the AI is evidently not capable of launching a major transcontinental invasion. While I do believe that development priority should be on the AI's terrain improvements (which do appear to be better than before), ground game and air force, it would be nice to eventually have it play an effective naval game. Civ 4 actually did a pretty good job with this.

-He isn't taking an easy island expansion. Ok, the war hasn't gone well for the Chairman and he is slowly but surely being driven back and has  lost several bases. But nearby to the northwest of his position is the Isle of Dierneda (or whatever it's called). There's a couple of small Believer seabases on its coast, but aside from that it's totally uninhabited and ripe for the picking. While making a minimum invest of a transport and a handful of colony pods he could quite easily establish several bases there, build them up, and then have them start cranking out combat units to reinforce his position on the mainland. This should be a viable strategy, even with having almost no naval presence the transport distance is very short, so protection shouldn't be a big problem.
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 05, 2013, 07:56:34 PM
You know, Yang's what wrestlers call a jobber.   He builds a bunch of puny bases close together and gives you someone to fight, but rarely makes for much of an actual challenge.  Morgan's usually like that, too.

Welcome to AC2, BTW, illumined.  How did you find us?
Title: Re: Improving AI - what are the priorities?
Post by: illumined on April 05, 2013, 09:43:17 PM
Heh, well in fairness Yang already managed to take out the Peacekeepers, and based on the number of bases they had that was no easy feat. His production bonus should give him more of a leg up in units than he actually has. After he took so many losses he called for a peace treaty (it was good that he recognized he was beaten) and, feeling my army was a bit overextended, accepted. I then was going to transition back to a free market economy (which didn't happen) and I expected he would build up a big offensively oriented army with lots of speeders, fighters and bombers. That didn't happen and not too long after the peace treaty he declared war again, and the initial offensive this time was seriously underwhelming, so much less capable than the last time. So, I've started rebuilding my bomber corp to go on the attack again, I've already succeeded in taking one or two of his bases. But still, shouldn't he have waited until he had a bigger edge to launch his attack?


So here's how I found you guys. I have a library of old games that I periodically cycle through, whatever I'm in the mood for. I was playing through Master of Orion 1 and discovered Kyrub had made an official patch for it on Realms Beyond. Eventually I found out he also made a patch for SMAX on Aptylon. Recently I started playing SMAX again, and found a link on that thread saying to come here since he doesn't go to Aptylon very much anymore. So, here I am.
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 05, 2013, 10:08:55 PM
Well have a good look around and don't be afraid to speak up; we'll take good care of you.
Title: Re: Improving AI - what are the priorities?
Post by: illumined on April 06, 2013, 03:40:59 AM
Well have a good look around and don't be afraid to speak up; we'll take good care of you.

That sounds ominous.  :P I also forget to mention, the aircraft refueling bug is still present.
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 06, 2013, 04:06:36 AM
Yeah; I get my kicks freaking people out with kind treatment...
Title: Re: Improving AI - what are the priorities?
Post by: illumined on April 06, 2013, 05:35:46 AM
Yeah; I get my kicks freaking people out with kind treatment...


I was just pulling your leg.


So now I'm a little farther along in round two, Yang finally started building his first interceptor, but its at a sea base with no minerals. He's finally built his first bunker, right on the front which is good, but so far has left it unmanned and open to be occupied. I'm waiting to see what he'll do next on this front while I attack in Eurytion sector. He did make another small attempt at an invasion around Mesa and Hive sectors, but once again it was easily repelled by my speeders. One thing I like is his increased use of artillery to destroy enhancements on my side of the border, it's a reasonable move, especially destroying roads leading to his bases to slow down any future attempts.
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on October 18, 2013, 09:11:44 PM
Hey kyrub - is there anything we can do to help?
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on October 21, 2013, 02:56:33 PM
Hey, BUncle, it's nice you've noticed me.

What can you do to help? Please wait a bit more, I am almost done.
At the moment I am consolidating what I've analyzed and putting it all in the patch. It looks good on paper, but let's wait and see how it works in game. 7 points from the original 10-point shortlist (see 1st page of the thread) have been adressed with two more issues pending to be finished. The only exception is, sadly, the smart probe movement, as I don't seem to find the way how to change it. Pity.

Looked from the other side, there seems to be massive room for improvement in all other areas. AI air attacks have received major boost, no more former targetting, AI should attack with hurry and it could/should even counter-attack from its bases. I have even found (to my surprise) a piece of code suggesting AI was taught to use "bomb and drop" technique - big thanks to the guy who mentioned it in the thread! AIs will trade technologies freely and build lot more of buildings. Again, let's see how it works.

I'll need help later, with testing and feedback. And more patience before the result is put into SMAX version.
Title: Re: Improving AI - what are the priorities?
Post by: Dio on October 21, 2013, 03:16:55 PM
Hey, BUncle, it's nice you've noticed me.

What can you do to help? Please wait a bit more, I am almost done.
At the moment I am consolidating what I've analyzed and putting it all in the patch. It looks good on paper, but let's wait and see how it works in game. 7 points from the original 10-point shortlist (see 1st page of the thread) have been adressed with two more issues pending to be finished. The only exception is, sadly, the smart probe movement, as I don't seem to find the way how to change it. Pity.

Looked from the other side, there seems to be massive room for improvement in all other areas. AI air attacks have received major boost, no more former targetting, AI should attack with hurry and it could/should even counter-attack from its bases. I have even found (to my surprise) a piece of code suggesting AI was taught to use "bomb and drop" technique - big thanks to the guy who mentioned it in the thread! AIs will trade technologies freely and build lot more of buildings. Again, let's see how it works.

I'll need help later, with testing and feedback. And more patience before the result is put into SMAX version.

I to can be patient. Also, it is nice to see you active :).
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on October 21, 2013, 04:53:32 PM
When you have stuff, please let me know so that I can incorporate it into my patch as well.

(By the way, your stockpile energy fix seems to have a few associated problems, most notably that when you change production, even to the same thing, it deletes your production gained that turn, so I'm redoing the whole thing.)
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on October 21, 2013, 09:44:02 PM
When you have stuff, please let me know so that I can incorporate it into my patch as well.
Feel free to do with it as you like, Yitzi. But this is just the AI stuff, no bugfixes. And I really cannot guarantee any results with so many changes your patch makes. The AIs usually looks very stupid with a lot of modding, they cannot cope with new rules, obviously.

As for stockpile energy bug, thanks for notice, I did not know. I'll look into it later, I certainly need to have a clean bug fix on the AI patch as well.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on October 21, 2013, 10:07:29 PM
Feel free to do with it as you like, Yitzi. But this is just the AI stuff, no bugfixes.

That's fine; I can handle bugfixes, but have more trouble with AI.

Quote
And I really cannot guarantee any results with so many changes your patch makes. The AIs usually looks very stupid with a lot of modding, they cannot cope with new rules, obviously.

My patch actually makes very few obligatory changes (just bugfixes and minor changes and closing off exploits the AI doesn't know to use anyway); if you explain what each change does, I should be able to figure out whether to include it in mine.

Quote
As for stockpile energy bug, thanks for notice, I did not know. I'll look into it later, I certainly need to have a clean bug fix on the AI patch as well.

That might get a bit tricky, as your fix is fundamentally inseparable from the bug it caused; what I'm doing is reverting your fix and introducing a new fix, but that's building on other stuff I did that builds on other stuff which took me a long time...
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 08, 2014, 02:51:34 PM
Updated the patch (see file section).
From the original list (page 1 of this thread), I have tackled primarily points 3,5,6,7. Points 1,2 and point C were touched as well, more than solved.
I am curious how it will work.

Quote
     
1.  Production issues      Far too many mins tied up with supporting useless/unwanted units
2.    More combat units with mobility.
3.    AI never attacking with hurry penalty
4.    Production changing
5.    Improve AI-AI trading of techs
6.    Smarter air attacks
7.    Better air defense

UNDER REVIEW
A.    Smart probe attacks
B.   Worker placement
C.    Attack from base
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 09, 2014, 03:45:46 PM
I played around with your patch yesterday. I'm surprised at the AI's trading techs so nicely, I still can't come up with the tech lead after 100+ turns (although to be fair, I do everything to help the AI, giving them techs and contacts as they ask). Their SE choices also seem interesting - Demo/FM/Knowledge for Zak, nice. I'm still surprised why some AI is so eager to pick up Fundie (Deirdre) and/or Power (Lal).

Oh, I forgot - I saw a Miriam's supply crawler actually crawling 2 energy! Granted, it was their only crawler and I fail to see another one anywhere else, but still it is a massively huge deal for me. I felt like I saw a unicorn. Thanks for that experience and keep up the work if you can. :)
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 09, 2014, 10:28:01 PM
I played around with your patch yesterday. I'm surprised at the AI's trading techs so nicely, I still can't come up with the tech lead after 100+ turns (although to be fair, I do everything to help the AI, giving them techs and contacts as they ask). Their SE choices also seem interesting - Demo/FM/Knowledge for Zak, nice. I'm still surprised why some AI is so eager to pick up Fundie (Deirdre) and/or Power (Lal).

Hey Kirov, you have played with badly damaged version, the corrected version [n] from today has much better results, as I have seen. So, I suggest you retry with the new one.

SE choices are not affected, I had to call off my previous attempt. It is a huge task, huge priority now as well. Main plan is to learn AIs to pop-boom. I have noticed that once they get Cloning Vats, they immediately become mounstrously efficient. There is hope that with pop-booming they could keep the pace a bit longer.

Quote
Oh, I forgot - I saw a Miriam's supply crawler actually crawling 2 energy! Granted, it was their only crawler and I fail to see another one anywhere else, but still it is a massively huge deal for me. I felt like I saw a unicorn.
Hehe, unicorn. Crawlers are actually part of some previous versions. Sadly, they are badly targetted... 2 energy is a great succes even in my book.
Title: Re: Improving AI - what are the priorities?
Post by: TarMinyatur on April 12, 2014, 05:57:41 PM
I played around with your patch yesterday. I'm surprised at the AI's trading techs so nicely, I still can't come up with the tech lead after 100+ turns (although to be fair, I do everything to help the AI, giving them techs and contacts as they ask). Their SE choices also seem interesting - Demo/FM/Knowledge for Zak, nice. I'm still surprised why some AI is so eager to pick up Fundie (Deirdre) and/or Power (Lal).

Oh, I forgot - I saw a Miriam's supply crawler actually crawling 2 energy! Granted, it was their only crawler and I fail to see another one anywhere else, but still it is a massively huge deal for me. I felt like I saw a unicorn. Thanks for that experience and keep up the work if you can. :)

I completed a game under 444(m). I, too, noticed the AI trading effectively among themselves. I didn't establish a lead in technology until I built Tree Farms (which the AI could benefit greatly from...but, understandably, the Hive, University, and Believers can be at war with each another for 100 years, and can't afford to invest in ivory-tower facilities when hostile troops are attacking relentlessly.) The Spartans suffered late in the game due to horrid inefficiency. Some cities were losing 36 energy out of 36 energy produced. But, in fairness, the Spartans aren't meant to rule a vast empire containing dozens of cities. (This is not a criticism of kyrub's patch -- he didn't change SE-related stuff.)

As far as kyrub's specific AI work: Miriam did attack my combat troops with her air force many times. Aggressive indeed. She would have done serious damage if I hadn't scrambled SAM Choppers which had a slight edge in weaponry (8 vs 6, at first). Which is, in fact, a good way for Miriam to kill my SAM Air units if she doesn't have any Needlejet Interceptors. My SAM Choppers lose their +100% attack bonus when they scramble to defend ground troops.

I was stunned to see a Miriam using a Supply Crawler to harvest a distant 4-mineral mine early in the game. Yes, like spotting a Unicorn! She didn't build another crawler, as far as I know.

I'll try the 444(n) patch now.
Title: Re: Improving AI - what are the priorities?
Post by: Geo on April 12, 2014, 11:39:42 PM
More or less the same story here (just finished a game with patch 'n'. Lots and lots of air units whizzing around, especially from Yang. And I think 3 factions build a single crawler. The only surviving one (Yang's, the other two I killed during some Vendetta) must have crawled a mine somewhere, it returned 4 minerals. Tech trading must have happened alot too, since most factions were pretty close in weapon level.
I'm wondering how the AI would react to more 'hardcoded' early units in the game, like a probe foil or supply trawler, in the alpha.txt units list.

My gut feeling is this revised AI is best for large(r) maps because of its tendency to leave new bases undefended.
Something else I noted was that Alien Artifacts weren't around that much. I catched a good amount of seapods and a fair amount of land pods on small islands, but none came out.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 15, 2014, 09:22:17 AM
I completed a game under 444(m).
Thanks for the reports!
It is good that you enjoyed the game. [m] version is cake due to the bug, fingers crossed for the [n] version, that should be quite different, significantly more effective from the AIs.

Themes:
- the crawlers: it is easy to let AIs make them more. I just saw a lot of examples of how badly they are used by the AIs, mining 1 mineral typically... Also, they are wiped away by worms. Not sure about it. On the other hand, I thought I saw AIs using them for the SPs. What do you think?
- air attacks, nice to hear the changes are visible.
- is AI more aggressive? This specifically should mean, that AI sometimes attacks with odds slightly out of favor. However, it is important that it avoids "dumb"attacks.
- did you see AIs attack out of base?
- did you witness AIs attack with a hurry (e.g. 2/3 strength, AI moving and attacking in the same turn)?
- undefended bases are a problem, I noted. Will se what can be done about it.
- SE changes, I will do them next. It will be done quite simply, but hopefully in an effective way. Right now, I am basig it on Kirov's post in the other thread, plus few notes that were there.

Keep the reports coming, any information is valuable for the assessment.
Title: Re: Improving AI - what are the priorities?
Post by: Geo on April 15, 2014, 11:05:55 AM
I did notice several air attacks on the same location a few times. Can't confirm if it was on the same unit or another in a stack.

I definitely would let the AI make more crawlers. At the very least it returns something before becoming worm bait. And it probably saves a combat unit from being badly damaged or destroyed in doing so.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 15, 2014, 12:46:48 PM
So how should we play it to test your changes in the most effective way? At first, under [m], I tried to be a peaceful Morgan and traded away any tech they asked for/demanded in order to facilitate their trade and growth. I understand now we should check out their battle movements more?

You mention popboom as well - in order to do it effectively, the AI must do better terraforming. It's too long waiting for Tree Farms or Cloning Vats, which they are not gonna get anyway. CV is a game-winning SP even in multiplayer. Any changes here?

I sure hope the AI will use crawlers to cash SPs. One of the problems I have in single player is that once I get PTS, I build crawlers everywhere for many turns and grab as many Projects as I can, usually almost all of them. It's kinda boring for a while, but allows me to win any game in the long run. In my [m] game Zak managed to get VW, which is not that bad. If they start to beeline to AI and cash crawlers by standard that would be a huge deal. But yeah, any use of crawlers, even suboptimum, is a massive change in my book.
Title: Re: Improving AI - what are the priorities?
Post by: BlaneckW on April 15, 2014, 01:06:42 PM
You couldn't program crawlers to stay one hex away from Fungus?
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 15, 2014, 01:42:18 PM
You couldn't program crawlers to stay one hex away from Fungus?

I imagine that could potentially drive them away from juicy tiles, besides a bulk of native life comes as worms disembarking from IoDs, you can't do much to stay away from them.
Title: Re: Improving AI - what are the priorities?
Post by: BlaneckW on April 15, 2014, 02:33:28 PM
I imagine that could potentially drive them away from juicy tiles, besides a bulk of native life comes as worms disembarking from IoDs, you can't do much to stay away from them.
That depends on map-size and land-to-sea ratio.  The AI's crawlers are also more valuable, as the AI is less efficient in build-planning.  Anything that might conserve them to begin with would be valuable.  One can have more than one AI behavior tendency anyway, and switch between them.  I.E. start off more conservatively.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 15, 2014, 02:55:02 PM
I did notice several air attacks on the same location a few times. Can't confirm if it was on the same unit or another in a stack.
Interesting, but next time the details would make the info useful. AIs typically gang an attack on a city, like, an air raid.

Quote
I understand now we should check out their battle movements more?
Yes. I strictly tried to make AI less "cautious" when assessing its attacking options. It may be subtle, but should be visible. Like: an infantry unit moves along the road and actually attacks your 10-1-2 rover. Hopefully also: an infantry unit in a city attacks your stack of attackers and deals good damage to it, instead of sitting back doing nothing waiting to be slaughtered as a defender. Note: sometimes, the moves can be too risky, sub-optimal for the AI (because it is less cautious). I'd like to know if it feels like AI gained an edge, in general, or not. Or if it feels like nothing has changed.

Air attacks are a bit different story, AIs should avoid your formers (although there may be a sudden swipe as well). Air attacks are lot less cautious, maybe gung-ho a bit. AIs should try to air attack a base, and then drop-pod an invader - at least sometimes! AIs should counter info war units more as well.

Quote
In my [m] game Zak managed to get VW, which is not that bad. If they start to beeline to AI and cash crawlers by standard that would be a huge deal. But yeah, any use of crawlers, even suboptimum, is a massive change in my book.

All AIs, regardless of orientation, now understand better the value of a few key SPs. Virtual World, Hunter-seeker algo, Cloning Vats and a few others are top targets, they'll try to beat you to them and build them ASAP if they can. I'll try to rapidly increase amount of crawlers, we'll se the problems with their usage better.

(By the way, if you think we can achieve anything near the level of MP games, you should probably lower your expectations. Personnally, I restrict myself from using crawlers in single player games, to help AIs, as I am sure, more players do.)

Quote
You mention popboom as well - in order to do it effectively, the AI must do better terraforming.
The terraforming has a lot of room for improvements. But if CV makes the AI peak already with this level of terraforming, I don't see why pop-booming could not be a big improvement now.

Terraforming (higher level) can come back as a theme in future... Please understand, that this is a step by step work. Everything is inter-connected, only after you fix the problem on three fronts, it starts to work. Example: I can push the bomb-and-drop tactics more. But then I realize that without the AIs actually building lot more drop units, the tactics will almost never occur. So I do it. But then I realize that without the needlejets targetting something else than formers, I'll still never see a dropping unit take a base.

For me, this is about priorities and a my lack of RL time. Right now, I have SE on the platter. And ensure that FM does not ruin the AI (which is a huge task in itself). This, in my opinion, is the big fish at the moment, AIs are self-destroying with social engineering.  Occasional pop-booming is half done (with Creches). So I'll try to tie the ends, no?
Title: Re: Improving AI - what are the priorities?
Post by: Nexii on April 15, 2014, 04:15:25 PM
I haven't played with this recent AI (will this be put into Yitzi's patch?) but I have to agree terraforming is probably where the AI could stand to improve the most.  Improve that alone and a lot of their more extreme cheating bonuses could be toned down.  I've noted some factions like Spartans only build like 2-3 formers tops at any time.  AI never builds advanced terraforming from what I've seen (borehole,condensor,echelon).  I suspect this is because the AI doesn't pollute.  Maybe a middle ground (to prevent AI from flooding the planet) would be to just make AI suffer from the fungal pop portion.

SE choices, yea the AI doesn't always take ideal SEs.  Pop booming is important but I believe with AI cheating bonuses (++GROWTH) that even when they take some mild +GROWTH SEs and Creches they end up booming.  It's usually more due to lack of nutrients that they stop that explosive growth.  I'm not sure if SEs should be the biggest priority though - I'm sure there's some hard coding for them to prioritize their affinities? 

Use of military units would be second and probably a lot more difficult to code.  Not just suicide attacks but more importantly suicide zones should be considered.  For example AI will stop low defense units next to yours, and they die easily.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 15, 2014, 05:06:25 PM
Hi, Nexii,
I have a different vision of the game and the current state of the patch. Please, try the patch first.

[Edited]
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 15, 2014, 10:41:45 PM
kyrub, is there anything the forum could do to help you that we aren't already?  Your work is valued, and important to the community.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 16, 2014, 12:08:07 AM
BU, I appreciate the input of the community, it is pretty good. I am probably a complicated person to communicate with about my work. I am too opinionated (I have edited my previous post to make it more neutral.). I still like people with differing opinions, when they argue about them coherently. In fact, the posts written by other people in this thread have contributed massively in work on the patch, so far.

I find that it's good if people try the patch before saying "what the AI should do". Maybe they could find out AI does part of it already? Or it does not - then their feedback is really helpful. To improve AI is usually a long march, with many twists. Without the experience, everything is hypothetical.
Title: Re: Improving AI - what are the priorities?
Post by: TarMinyatur on April 16, 2014, 09:38:30 PM
So how should we play [SMAC(n)] to test it in the most effective way? //paraphrased

Yeah. Kirov is onto something here. To get clearly useful data, it might help if we used common settings. There are thousands of combinations of options in SMAC that can drastically change the performance of the AI factions, such as the size of the map. (In my current game, Morgan has an impressive empire due to 150 years without conflict on his own continent. The Hive is a massive menace on the second continent.)

Anayway, I'll start to test kyrub's patch using the default settings for everything. (Although there is definitely value in testing the patch with custom settings, too.)

I'll look for things that are easily measured: hurried attacks and attacks-from-base.
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 16, 2014, 09:43:05 PM
I like how you're thinking, o' longest-lived King of Numenor.  The community can always help/encourage our treasured .exe modders in a big way with detailed feedback and careful playtesting.  ;b;
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 19, 2014, 03:37:49 AM
kyrub, a thought; would you be willing to cooperate in a news item about you and your patch?  I've already promised the next one to Ford_Prefect and his .cvr mod, but you're definitely working on one of the most interesting SMAC modding projects around.  The way I did it with Yitzi was to just conduct a slow interview by post, and then write it up when we thought we'd covered things.  It's my sneaky way of doing as little of the work as possible, too, depending.

SO - first lame question.  What's the deal with you and your .exe mod? :D
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 21, 2014, 01:54:14 AM
Have just played some until 2230 with your n patch. Huge map this time, Sparta. I played super sloppy (as I tend to do in single-p), neglecting hurries, failing to check drones, etc., and Sparta is not the best faction for huge maps, but even taking all that into account, I was still pleasantly surprised by what the AI is able to do. Usually playing a lazy game still nets me most Projects (I do use crawlers), this time I managed to grab only PTS and MCC. I've just came first with pop after a short boom and got elected, but still lagging tech-wise behind Morgan, who can be a real powerhouse with his regular Demo/FM/(either Knowledge or Wealth).

Got in a small war in Deirdre. Yep, she did pull out her 5-1-1 unit to kill my recon, you can't safely stop 2 tiles from a base anymore. And she mind controlled one unit, but this does happen anyway. For more info on movement I need to play another game - Deedee got somewhat confused on rocky/fungus with her 5-1-1s and I imagine it can be tough for you to teach her how to negotiate such stuff. But hey, at least she got A5! The AI's research is more and more resembling something decent. I opened the editor to see tree farms and hybrid forests in Morgan's bases! Truly, he thinks he's people.

What else? I see some forest, usually 1-tile, sometimes more, but it could be even more - I think it's tough to overdo foresting before advanced terraforming. Could you tell us something about it in the case of AI? Like, will AI replace its own improvement when a tech for something better comes? Is it possible at all to teach it to start with 'forest & forget', then gradually move to boreholes interspersed among condensors?

There are some bases with high unit maintenance, but all in all I think the AI is less clogged with support. And even if it wasn't, better tech means more useful units in the field, so maybe this will stop being a problem even for the Hive and Miriam.

Crawlers - not more than 2 per faction, some have 0. Some crawl terraformed terrain, but in two cases it's an unterraformed rocky square mined for 1 mineral just outside the base radius. Any idea how this results from your changes?

That's it for now, I need to play a longer and more serious game to see more. My main request would be just to keep doing what you do, the changes are all in good directions. I used to think that in SMAX I could win literally any single-p game under any circumstances, even in drunken stupor. This game I've just played looks like I would actually need to get a grip to pull it off! And any time I see an AI's crawler mining a tile, even undeveloped, something inside me cries a little. It's like watching a butterfly. I feel like that guy in "Alien:Resurrection" who admires the birth of the alien hybrid. :)

So it used to be insect evolution, now it's more like Intelligent Design.  ;b; Thanks for the experience and don't stop! I'll try to play more soon.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 21, 2014, 11:54:57 PM
This time as Miriam, large map. The beginning was super hard due to my proximity to Zak, who was always several steps ahead of me with combat techs. He managed to bring me some losses, but I overflowed him with cheaper units. I have this impression that the AI will never properly use infantry units - this really requires bringing some defence units, using terrain for bonuses, etc. The same goes for artillery - although it sure has its uses, the AI fails to see and exploit any. In some extremely rare situations batteries can be mildly annoying at best. Is it possible to simply switch off certain types of units? How does the selection work?

Although my start was tough and it took me some considerable time to make it to the top (2208), I feel that the AI underperformed in this game, mainly due the lack of bases. Hive and Dee could be a competition in the air power era, but they've got only a handful of bases spread over vast areas. Morgan built 2 (!), not for the lack of room.

Interesting stuff with Santiago - I killed her easily mainly because she got the Jungle and grew so quickly upwards that she was too busy building hospitals when I came to her. Again, I took some losses as she wisely used ECM garrison (do you have anything to do with it, kyrub?), but I stayed at a safe distance and managed to pick her bases one by one.

Maybe stronger focus on rovers would be useful? Infantry is no match to your best attack bikes, especially if you don't exploit terrain defence bonuses, which I guess is a long way for the AI.
 
***

Other quirks - my subdued Zak decided to help me with one former, which made it all the way from his territory to the Spartans'. I have no idea what he was up to.  :dunno: Hive and Dee built one crawler each, the former mined 2 energy (good Yang, have a peanut!), the latter rambled its way around in a very confused manner (I was watching it in the editor), then stumbled into a worm and promptly died.

I'm not sure if this is a bug, but I saw it for the first time - after I captured Sparta Command, it was in the production order before everything else, i.e. even before the Projects. Usually when you build a Project, it is your first construction that turn and you can safely take it into account one turn earlier. This time Sparta Command was ahead of the rest. I can't recall anything like that.

Sorry I didn't make it to the air warfare, but the industry discrepancy was way too high at this moment for the AI to remain significant. And I didn't want to spend the rest of the evening microing formers.

Oh, one more thing - what do you think and how viable are changes to probe teams? I don't mean any too smart moves, just basic stuff like probing from the maximum distance and above all, using infrantry chassis defenders (which stay in bases). Your AI is doing great in terms of research and it takes a longer while for me to achieve the best lab turnover - the only problem is, the AI likes to give free techs to every probe team which asks politely.

Miriam 2168 is after I pacified Zak, 2225 is when I gave up.

PS. Now I noticed that Dee built some bunkers. Again, is it possible to switch some terraforming options completely? Bunkers are probably the least useful improvements of them all.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 21, 2014, 11:56:32 PM

Quote
Got in a small war in Deirdre. Yep, she did pull out her 5-1-1 unit to kill my recon, you can't safely stop 2 tiles from a base anymore.

That is simply great to hear. Attacking from the base plus the hurry-attack (it is in the same place, in fact) is one of the least sure changes, it was basically a "leap of faith" into the darkness, following hours of study. I hope we see more of this and it can be confirmed.

Quote
The AI's research is more and more resembling something decent.
I actually did not much here, on the contrary - besides clearing the useless stuff and recommanding former prereq. We may talk about beelining further, in another thread, I certainly need some input and opinions on some simple ways and possibilities to focus the AI. Deirdre is still too mad about any Ecology techs, as far as I remember.

Quote
I opened the editor to see tree farms and hybrid forests in Morgan's bases!
There is a lot more here. For instance, building VW should now make AI hungry to build NNs all around his bases. AI is a bit more keen to protect its bases with PDs, it thinks the banks are pretty cool, aerospace complexes and other stuff.

Quote
What else? I see some forest, usually 1-tile, sometimes more, but it could be even more - I think it's tough to overdo foresting before advanced terraforming. Could you tell us something about it in the case of AI? Like, will AI replace its own improvement when a tech for something better comes?
There are exceptions and I may look into them. It requires further study, but I know where to look (I saw the thing), so 50% is done already.

Quote
Is it possible at all to teach it to start with 'forest & forget', then gradually move to boreholes interspersed among condensors?
This is the thing: I have done a lot of testing with boreholes only, made numerous hits and changes. And I cannot bring AI to do a lot of them, I see 4-5 every testgame, hmm. There is some mystery behind it.

AIs are doing a lot of push ups of terrain, which I don't understand why and (most importantly) how and where exactly it is decided. I'd like to cut off this behavior until later in the game and give it some meaning. My hypothese is that this (or something else) hampers the other desirable variants, condensors, boreholes etc.


Quote
There are some bases with high unit maintenance, but all in all I think the AI is less clogged with support.
Yep, this should be. We will do more "clean reactors" next.

Quote
Crawlers - not more than 2 per faction, some have 0. Some crawl terraformed terrain, but in two cases it's an unterraformed rocky square mined for 1 mineral just outside the base radius. Any idea how this results from your changes?
I have no input on where it crawls, 1 mineral variant is what I see a lot, sadly. I may think about formers "seeing" crawler terrain as desirable to improve. I may try to study crawler behaviour (too much time right now). I can certainly make AI churn crawlers like chickens.

Quote
Thanks for the experience and don't stop! I'll try to play more soon.
;b;
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 21, 2014, 11:59:23 PM
Re: Miriam

Do you have the earliest save as well?
(I like to do the spectator thing, give up immediately and watch AIs perform on their own... but there's some important difference when the AI does *not* have a strong human competitor in the game... so I'd like to see the result)
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 22, 2014, 12:05:04 AM
This is the earliest I had, I'll keep it more in order in the future.

I tried to stay away from the 'hurry' attacks, knowing they can happen. The next time I'll try to lure AI and confirm.

I'm going to play without crawlers to see what the AI does with the Projects. In this game, the AI was very slow to start the Projects - the constans I see is Dedee going for the EG. :)
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 22, 2014, 12:15:04 AM
One thing I like about this patch is that it renders what used to be my favourite challenge, 'switching sides', next to impossible. I remember I could bring a faction to Unsurpassed, switch to the worst one and repeat this process three or maybe even four times per game. No longer so if the first time takes 100+turns. So I'm positive we're getting somewhere here.  ;b;
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 22, 2014, 12:16:07 AM
I have this impression that the AI will never properly use infantry units - this really requires bringing some defence units, using terrain for bonuses, etc.
There is absolutely nothing I can do about this. That is the architecture of the AI movement, too complex a change. The only proper way, to me, is to let AI do rovers in bigger quantities. Like 2 rovers per 1 infantry, that would seem about right, and probably dangerous. This is certainly doable, although it is hard to find the balance.

Quote
The same goes for artillery - although it sure has its uses, the AI fails to see and exploit any. In some extremely rare situations batteries can be mildly annoying at best. Is it possible to simply switch off certain types of units? How does the selection work?
I agree, I hate AI artilleries and it builds them in wagons. There is a stupid switch in the code, when the AI makes *more* artilleries when it has a HP on its continent. The patch for this insanity is ready, we'll have a lot less of them. I thought about allowing only rover-batteries, as I find them more dangerous in the hands of AI, what do you think?

Quote
Although my start was tough and it took me some considerable time to make it to the top (2208), I feel that the AI underperformed in this game, mainly due the lack of bases.

Strange. I will study the map.

Quote
Morgan built 2 (!), not for the lack of room.
AI has problems with worms + Morgan lacks morale, to ammend for his faults.
(I still thought that Morgan required more specific effort in the code. He should ICS instead of careful spreading, no? Right now, he does the latter, although I improved him by cca 100%)


Quote
Interesting stuff with Santiago - I killed her easily mainly because she got the Jungle and grew so quickly upwards that she was too busy building hospitals when I came to her. Again, I took some losses as she wisely used ECM garrison (do you have anything to do with it, kyrub?)
Oh yes. Hospitals making Santiago vulnerable is not exactly good news, though. That is my work too.
 
***

Quote
I'm not sure if this is a bug, but I saw it for the first time - after I captured Sparta Command, it was in the production order before everything else, i.e. even before the Projects. Usually when you build a Project, it is your first construction that turn and you can safely take it into account one turn earlier. This time Sparta Command was ahead of the rest. I can't recall anything like that.
Not sure, what you mean. Was kind of problem? I think I did nothing with this.

Quote
Oh, one more thing - what do you think and how viable are changes to probe teams? I don't mean any too smart moves, just basic stuff like probing from the maximum distance and above all, using infrantry chassis defenders (which stay in bases).
This one is hard. I even thought about suggesting a Yitzi-like change of type: The encrypted defenders can defend against probes. That would work for the AI, but it is a mod, which I tend to avoid. - Otherwise, AIs don't see the infowar units as defenders or combattants and treat them separately. It is hard to explain there are two kinds of them, too many instances in the code. Not sure.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 22, 2014, 12:29:05 AM
Yeah, I understand with the infantry movement, I can't imagine the kind of effort needed for the AI to start move around like a reasonable, even if slightly drunk, man.

What is a HP?

The problem with rover batteries is their cost. And I think the AI will never handle the battery well in the offensive. Conversely, I do see some uses for stationary arty to soften up invaders. Still, it's crucial not to clog the support.

Morgan definitely thrives with many tight-packed bases, as should most factions, for that matter. I'll give another game a try now and see.

Santiago was actually doing quite fine, but she had the bad luck to end up close to my Miriam. Maybe if she had the time for air power... I think your AI can do much better on larger maps with delayed fight. Is it your impression as well?

The bug I mention is just a side note - Sparta Command is calculated before any Projects are built, which I noticed since it rioted with NN on the same turn I got VW. Probably nothing.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 22, 2014, 01:55:43 AM
What is a HP?
Human player.

Quote
The problem with rover batteries is their cost. And I think the AI will never handle the battery well in the offensive.
It still has some limited use, as I have seen AIs destroy my sensors with help of arty a lot. Also, if possible, I try to conserve the diversity in AI units. It makes them less predictable and it keeps the game being fun. Surely, we could let AI build only rovers, but, ehm... it somehow does not seem right.

Quote
Santiago was actually doing quite fine, but she had the bad luck to end up close to my Miriam. Maybe if she had the time for air power... I think your AI can do much better on larger maps with delayed fight. Is it your impression as well?
I certainly made the AI more "builder", so larger maps are the way to go. I play always on larger maps, maybe that's why? It could be done more carefully, I guess, make the map scale a factor, if necessary. But then I am pretty lazy, hmm.

Quote
The bug I mention is just a side note - Sparta Command is calculated before any Projects are built, which I noticed since it rioted with NN on the same turn I got VW. Probably nothing.
If you could re-run that bit with the old exe and see what happens, I'd be a bit calmer. Every instability smells of data corruption, which is our arch-enemy.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 22, 2014, 02:51:41 AM
Played some more with some self-imposed rules (only 6 bases, no crawlers) and will reply to your post soon. Meanwhile I had a thought - maybe you could post here your patch with some over-the-top yet still sane values, just for a few of us to check it out? I have in mind much more best attack rovers, crawlers, formers (still far from enough) and heavy foresting. I don't know if it's a standard and/or useful practice in design work, but maybe we'd have some food for thought afterwards (although I don't know when I will be able to spare an evening for AC next time... :) ).
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 22, 2014, 09:50:14 AM
SO - first lame question.  What's the deal with you and your .exe mod? :D

OK. Here we go.
The .exe mod (I called it "SMAC 444" or simply "AI patch") is an attempt to make AI in the Sid Meier's Alpha Centauri game play better and to give us, who love the game (or loved the game back then) more challenge, especially in the single player variant.

The artificial intelligence was the biggest weakness of the original game for me: seeing AIs not spreading quick enough, ignoring the seas until late, seeing endless hosts of artillery or other units and ultimately, seeing opponents invariably sink down at the moment when Air power became dominant, spoiled the strategic aspect and, at the end, turned me away to other titles.

The patch is so far limited to the original game, without the expansion (Alien Crossfire). The .exe mod self imposes to avoid any hard-coded changes to the game rules. You will play the game same as original, only the AI plays better, hopefully. It should be noted that scient's magnificent work (patch fixing the bugs) was incorporated into the SMAC 444 as well.

Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 22, 2014, 02:35:15 PM
maybe you could post here your patch with some over-the-top yet still sane values, just for a few of us to check it out? I have in mind much more best attack rovers, crawlers, formers (still far from enough) and heavy foresting.
Kirov, I plan to try it anyway (rovers, crawlers, formers, more or less ICS), in the next patch, with the exception of the heavy foresting, as I don't see it as a solution. I can point you easily to the all-forest variant then. Don't expect any improvement in advanced terrraforming, though. - Next patch is near. I have got a small window to finish the first SE attempt, then we will see. Afterwards, there will be a serious lull in progress.

(More info still is welcome, the patch was built on the excellent feedback from people in this thread).
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 22, 2014, 05:21:56 PM
Golden quote material there, k.

How did you get into this .exe modding project?  Was there a learning curve?  Any background in this sort of thing going in?
Title: Re: Improving AI - what are the priorities?
Post by: Geo on April 22, 2014, 05:44:28 PM
A mid-term report on a game with me playing as the Gaians. MY is now 2285 (I have 5 saves if you're interested in them, Kyrub). Settings were large map I think (maybe normal), predominant land, low erosion, rainy, and rampant native life. Oh, and unable to choose what to research.

Except for Morgan and the University, all factions made a fairly good to splendid effort at expansion, especially Miri who started a bit more isolated from the Monsoon area then Morgan but managed to colonize it completely.

War has been rampant between factions sofar, and perhaps as a result, not a single crawler was build by the AI. Both the Believers and Spartans went at length to get to their war target(s) over 20 tiles away with lots of fungus inbetween. Miri took a (recently settled) base of mine near my capital by surprise, and the follow up column of units was larger then I thought it would be, but less then 10 I think. I wonder how many she lost on the way to that base. Mostly infantry units though, and no artillery. Eventually I conquered all her Monsoon bases and depopulated them. By the end she had two bases left from which the nearby Hive took New Jerusalem (HQ). Also, by then air units came into play. Hive had declared war on me too, but didn't tried to use his needles over the small sea that separated the Monsoon area from his nearby snaky island area (more or less a phoney war). At some point he assembled quite a garrison on the closest harbor to Morgan (my pact partner), but after a few of my needles took out a couple foils he didn't pursue that way. He then took New Jerusalem where I sent a few assault infantry to, to take it after emptied by my needles. He then used his needles to devastating effect, forcing me to sent a second force which was at each stopping point covered by a tactical needle. Truce came shortly after I took New Jerusalem from him.

Santiago OTOH (which just declared war on me for the second time) has two land connections to me but fails to sent troops through the easiest one (massive land bridge). She builds alot more rovers (and uses them to some effect on my troops blocking one land approach), and regularly upgrades them on a nearby monolith to Sparta Command. She hasn't flight yet so nothing to tell there. She has nicely expanded lands.

Morgan was stumped for a long time (only 3 bases, perhaps because he had a long standing feud with Lal), but once we were committed on the Believers he managed to mind control the two nearest Believer bases and was keen to settle the colony pod I gifted him on the nearest available Monsoon area. He's starting to do fine now I think. Oh, and in the earlier game he infiltrated me. A "WTH" moment because why does the AI needs that? ;lol

Zakharov only founded 3 bases despite having plenty of space for more. Drone problems I think. Anyway, the surprise there is he got to orbital spaceflight and build two missiles and is in the progress of one planet buster. He won't be able to finish it though since he declared on me because due to my Power SE and my refusal to bribe him techs if he's not willing to trade Orbital Spaceflight. Also, he and Lal (his buddy) are sofar the only ones with missiles. I saw a couple bunkers on the edge of his bases field of view towards my border and enough sensor coverage to spot any unit I sent his way. Say 1 bunker and two sensors for each base. Too few units though to make a decent defense, about half on rovers and infantry. He build one or two chaos needles sofar. Haven't seen any other faction use bunkers, but the others (besides Morgan) don't have long shared borders with other factions.

Haven't kept an eye on Lal since he's pretty far south from me, but he's an on-an-off antagonist this game.

The thing that most disappointed me sofar in this game is that Santi doesn't build a naval force to harass me on our shared sea. At least 3 of her bases (including Sparta Command) are harbor bases on this sea, but not even a seaformer sofar.

Also, haven't spotted undefended bases in this game.
Title: Re: Improving AI - what are the priorities?
Post by: Dio on April 22, 2014, 06:09:53 PM
A mid-term report on a game with me playing as the Gaians. MY is now 2285 (I have 5 saves if you're interested in them, Kyrub). Settings were large map I think (maybe normal), predominant land, low erosion, rainy, and rampant native life. Oh, and unable to choose what to research.

Except for Morgan and the University, all factions made a fairly good to splendid effort at expansion, especially Miri who started a bit more isolated from the Monsoon area then Morgan but managed to colonize it completely.

War has been rampant between factions sofar, and perhaps as a result, not a single crawler was build by the AI. Both the Believers and Spartans went at length to get to their war target(s) over 20 tiles away with lots of fungus inbetween. Miri took a (recently settled) base of mine near my capital by surprise, and the follow up column of units was larger then I thought it would be, but less then 10 I think. I wonder how many she lost on the way to that base. Mostly infantry units though, and no artillery. Eventually I conquered all her Monsoon bases and depopulated them. By the end she had two bases left from which the nearby Hive took New Jerusalem (HQ). Also, by then air units came into play. Hive had declared war on me too, but didn't tried to use his needles over the small sea that separated the Monsoon area from his nearby snaky island area (more or less a phoney war). At some point he assembled quite a garrison on the closest harbor to Morgan (my pact partner), but after a few of my needles took out a couple foils he didn't pursue that way. He then took New Jerusalem where I sent a few assault infantry to, to take it after emptied by my needles. He then used his needles to devastating effect, forcing me to sent a second force which was at each stopping point covered by a tactical needle. Truce came shortly after I took New Jerusalem from him.

Santiago OTOH (which just declared war on me for the second time) has two land connections to me but fails to sent troops through the easiest one (massive land bridge). She builds alot more rovers (and uses them to some effect on my troops blocking one land approach), and regularly upgrades them on a nearby monolith to Sparta Command. She hasn't flight yet so nothing to tell there. She has nicely expanded lands.

Morgan was stumped for a long time (only 3 bases, perhaps because he had a long standing feud with Lal), but once we were committed on the Believers he managed to mind control the two nearest Believer bases and was keen to settle the colony pod I gifted him on the nearest available Monsoon area. He's starting to do fine now I think. Oh, and in the earlier game he infiltrated me. A "WTH" moment because why does the AI needs that? ;lol

Zakharov only founded 3 bases despite having plenty of space for more. Drone problems I think. Anyway, the surprise there is he got to orbital spaceflight and build two missiles and is in the progress of one planet buster. He won't be able to finish it though since he declared on me because due to my Power SE and my refusal to bribe him techs if he's not willing to trade Orbital Spaceflight. Also, he and Lal (his buddy) are sofar the only ones with missiles. I saw a couple bunkers on the edge of his bases field of view towards my border and enough sensor coverage to spot any unit I sent his way. Say 1 bunker and two sensors for each base. Too few units though to make a decent defense, about half on rovers and infantry. He build one or two chaos needles sofar. Haven't seen any other faction use bunkers, but the others (besides Morgan) don't have long shared borders with other factions.

Haven't kept an eye on Lal since he's pretty far south from me, but he's an on-an-off antagonist this game.

The thing that most disappointed me sofar in this game is that Santi doesn't build a naval force to harass me on our shared sea. At least 3 of her bases (including Sparta Command) are harbor bases on this sea, but not even a seaformer sofar.

Also, haven't spotted undefended bases in this game.

Perhaps Santiago has not built any sea forces because her stock AI interests do not include EXPLORE...
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 22, 2014, 08:32:22 PM
How did you get into this .exe modding project?  Was there a learning curve? 

This is my 4th project of this type. I got into .exe modding about 4 years ago, while replaying my favourite oldie, Master of Orion 1. At that time, I stumbled upon the work of a certain "Seb76", the grandmaster, who made an omnipotent patch for X-COM, with some magic program he called IDA. Wow, I said to myself, is this even possible? 3 months later I had the first patch to MoO ready.  - Then I focused on the few other games I used to love: Master of Magic, X-COM and - SMAC. I fixed the bugs first, then moved to AI, the creme de la creme of strategic games.

The problem of dissassembling (.exe modding) is that you analyze the program on very low level, but you try to understand very complicated structures (esp. with AI). It's like trying to understand that your partner is making her morning tea because she feels ill, by analyzing what every molecule of water does. On the other hand, disassemling is very fun and addictive.

As far as AI work goes, SMAC is by far the hardest I have seen so far, I gave up several times. My 2 cents are that the AI was derived from the Civ 2 engine and reworked. Sadly, complicated AI does not equal efficient one.
(I can talk about the structure later if you wish to read more non-coherent babble.)
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 22, 2014, 08:41:46 PM
He then used his needles to devastating effect, forcing me to sent a second force which was at each stopping point covered by a tactical needle.
Tactical needle? What do you mean by that?
Otherwise, nice to hear!

Quote
Santiago OTOH (which just declared war on me for the second time) has two land connections to me but fails to sent troops through the easiest one (massive land bridge).
Valuable info, AI failings are almost always interesting. Do you have a save with the situation? (Fixing AI pathfinding is less probable, but one may always try, especially with a good save.)

Quote
Anyway, the surprise there is he got to orbital spaceflight and build two missiles and is in the progress of one planet buster.
I think the ruthless tech exchanging plays here. He still had to offer something in return, though. Interesting.

Quote
Santi doesn't build a naval force to harass me on our shared sea. At least 3 of her bases (including Sparta Command) are harbor bases on this sea, but not even a seaformer sofar.
Great, valuable info. I think I saw that too. - Thanks!
Title: Re: Improving AI - what are the priorities?
Post by: Geo on April 22, 2014, 08:53:25 PM
Tactical needle? What do you mean by that?

I had to move infantry units two turns in a row over a road to reach New Jerusalem. On each turn I moved a 5/1/9 Tactical Needlejet (attacks air units ability) over the land units' position to protect them from a possible Hive needlejet attack.

Quote
Valuable info, AI failings are almost always interesting. Do you have a save with the situation? (Fixing AI pathfinding is less probable, but one may always try, especially with a good save.)

I have attached all saves I made this game. Roughly the last century of gameplay. Don't know if they will be of use for you.
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on April 22, 2014, 09:17:37 PM
Anything to relate about (AI?) structure?  A line or two of hard-tech talk won't hurt and might attract the tech hardcore...  English for the rest of us is also good.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 22, 2014, 10:25:07 PM
I just got out of a One City Challenge as Sparta, Huge map. The AI did extremely well and at one moment I actually had to go back a few dozen turns or die. However, I must say I have a problem telling apart which parts of the AI growth come from better unit management and which from better macroeconomy. I saw a lot of nice terraforming and probably tech sharing - even in a normal game with your patch (i.e. no self-imposed rules) some AI would still have a lot to offer to the player (they take the path to EnvEcon and to D:AP very quickly, although the one to AMA, PSA and Fusion is still popular).

My neighbour Lal definitely overdid probe teams (I have like 60 kills under my belt) and it's not the first time I see AI in your patch producing way too many spies. If those minerals went into regular, even if cheap units, I could as well be dead. And although he did manage to do some damage with them (there were moments when the frontline was very close to my base), all in all the AI just can't use them properly. The best it can do is buy back its bases (which happened to me when I forgot to bring my own PT, duh  :doh). Oh yeah, this reminds me - I saw much more mind controlling bases, some changed hands several times.

I got to the air power era, but can't say I noticed any groundbreaking changes - Lal went for my crawlers as usual and as usual got killed by SAM. At least I had to protect my land units with air cover, I think in vanilla SMAX you need to have a bad luck to lose anything except for occasional formers/crawlers. Lal did some 1-4-1 AAA garrison, but it could be much better. If he replaced most of his units with AAA, I'd have no other option than to put nerve gas on (as it was, Sparta+AeroComplex+Power proved enough).

Crawlers, again - I noticed two, both crawling undeveloped minerals outside of the base radius.

The AI helped me a lot with techs, both willingly and unwillingly. I think I'd like to talk with Yitzi to have an optional rule to implement those 'security interlocks' for the AI bases, making them harder to probe.

You guys mentioned pathfinding - how does it look and what do you think about teaching the AI proper landing techniques? The Hive did disembark some two of his units, but it was as relevant as it sounds. Is it possible to prepare at least a decent invasion and to force the HP to actually spare resources to patrol nearby waters? A must-do in multi-player, a complete waste of time in single.

Cherry on top, I'm happy to share this image. It's the Great Dunes terraformed by the Hivers. Before, I would never believe you this was done by the AI.  :o It's really, and I mean really awesome. Notice the cute crawler! All in all, several factions in this game fare actually pretty well.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 22, 2014, 11:14:23 PM
Anything to relate about (AI?) structure?  A line or two of hard-tech talk won't hurt and might attract the tech hardcore...  English for the rest of us is also good.
Thanks, for the English part. Please correct whatever is necessary.

(OK, next lines are obviously full of speculations. It is not technical info. I posted bits of this info here and there in the threads on ac2.)
The structure of AI in SMAC is quite unique, in both the good and the bad way. In trying to strengthen the role-playing aspect, the creators went very far. They let AI play a specific role in the story, weekening its reasoning in the process. We can easily see the fruits of this approach in AI diplomacy and SE agendas, as AI pursues those who contradict its likings and strictly follows preferred agendas, even if it hurts.

The second step is less obvious. Not only did the programmers made the AI specific for every faction (in 1999, which is now slowly becoming a modern standard), they made it customizable from the faction .txt files. Vast majority of AI processes are decided with strong contribution of 5 numbers, namely those called
Quote
ai-fight, ai-power, ai-tech, ai-wealth, ai-growth
From these numbers, ai-fight is by far the most influential [-1,0,1]. We could compare its meaning to the famous Builder/Hybrid/Warlord distinction from Vel's guide. A few number combinations give very feeble performances of the AI (Morgan, Zak, Santi), while another one (Hive) is really succesful (11010). Simple overwriting of all values to Hive's ones should result in slightly better performance.

The dilemma of the SMAC 444 project is: to create a competitive AI, it is necessary to minimize this customization feature. The AI should react based on situation and its factors, and not according to its "nature", since this makes it predictable and mostly stupid. Also, the factions should be more free to divert from their preferred settings, like human player does. I tried to conserve the variation, but the results (for Morgan etc.) remain feeble. So, reluctantly, the AI patch will change this RPG and AI-customization feature of the game.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 23, 2014, 12:01:21 AM
Yeah, it came to me that by encouraging tech sharing you probably made them do so indiscriminately, i.e. Miri trades with Zak, etc. Well, I will kinda miss their stupid bigotry, but definitely not if they improve their play. One thing comes to my mind - I'm quite sure I read somewhere that there are traditional pairs of factions bound only by mutual hate - Miriam hates Zak and vice versa even before the relevant SE is a factor, the same goes for Deedee with Morgan and Hive with Lal. I guess Santi hates everybody's guts equally. Can you confirm this info somehow? I have no idea now where I read it.

I can further confirm that the AI does leave bases with Infrantry to attack, however I fail to see anything new in their air force behaviour. They do build some air units, Aero-C and AAA, but nothing to write home about.

Still, I've just had a great game!  ;b; As is tradition, the Hive was coming top.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 24, 2014, 09:15:17 AM
My neighbour Lal definitely overdid probe teams (I have like 60 kills under my belt) and it's not the first time I see AI in your patch producing way too many spies.
The overprobing is a side effect of strengthening the rovers. Funnily enough, AIs still don't build rovers but they produce more probes on rover chassis. The other factor may be the fact that the AIs use a lot of Fundamentalism, for now.

Quote
I got to the air power era, but can't say I noticed any groundbreaking changes - Lal went for my crawlers as usual
There are changes to air power, maybe your special style of OCC (sitting back?) made you less aware of them. I will  look into ignoring crawlers again, I think I left that one out, since I avoid crawlers anyway. AAAs should be more frequent, this can be done, although I am always weighing between ECM, AAA or trance, and I simply cannot choose just one. That is bad design per definitionem.

Quote
how does it look and what do you think about teaching the AI proper landing techniques? The Hive did disembark some two of his units, but it was as relevant as it sounds. Is it possible to prepare at least a decent invasion and to force the HP to actually spare resources to patrol nearby waters? A must-do in multi-player, a complete waste of time in single.
That is pretty hard (too hard I am afraid), but it would really improve the game, I agree. My idea was at least: to force AI to use heavy transports. That would get +50% invasion troops, still not much, but occasionnally they can pull a surprise. On the larger chassis, that could be a small invasion force already.

Quote
Cherry on top, I'm happy to share this image.
Nice that you enjoy it. I am a borehole away from being happy as well.

Quote
Miriam hates Zak and vice versa even before the relevant SE is a factor, the same goes for Deedee with Morgan and Hive with Lal. I guess Santi hates everybody's guts equally. Can you confirm this info somehow?
Sorry. My knowledge of AI-AI diplomacy is limited. There are several places in Diplo code where specific factions are treated differently, regardless of "ai constants", that I can confirm.
Title: Re: Improving AI - what are the priorities?
Post by: Kirov on April 24, 2014, 01:50:29 PM
Well, I took it to the AI's turf, taking their bases and starving them down just to serve as outposts, in spirit of OCC. It's true that AI had 1, sometimes 2 AAA garrison units, quite often one ECM. Very nice, but I remember such scenarios in vanilla SMAX and this is still not nearly enough to stop the HP. Can you dabble with specific infrastructure choices? What's really annoying and has the potential to slow down my advances is AAA combined with A-Complexes. Works best with sensors under the base tile (I do take time to bombard these), but that's probably asking for too much.

I'm not sure if I would recommend Trance as on par with AAA and ECM, though. The order I'd pick is AAA, ECM, then maybe some Trance.

I noticed an interesting thing in this game - my Elite 8-1-10 jets against Lal's 1-4-1 AAA had combat odds at 24:25  but I swear I won more than 75% such fights. I understand that there sure is probability for that, it just made me think if the odds take the chances directly from the combat engine or are calculated separately and can be off if the rules change. I know for sure there is at least one error in calculating the odds - when fighting mind worms, your reactors better than fission actually do not work and are treated as fission, but the odds still are improved (e.g. your fusion infantry actually still has the 3:2 chance against a worm, but the game will say 6:2).

Can't agree more with that borehole thing.

As for diplomacy, I'd love to know more details about how it works, let me know if you ever want to check it out. I understand that the basics are simple - there is a scale of friendliness and you score on it depends on the actions. However, there are some quirks that always threw me off. The AI offers you a tech trade, but when you refuse and immediately offer the same deal, you are met with 'go to hell'. SE choices sometimes look like they change everything (a loyal ally can break a pact just because of that) and sometimes like they mean jack s*. And so on. And of course, I'd like to have a detailed table about the points awarded for each interaction - trades, tech gifts, base gifts, SE etc.
Title: Re: Improving AI - what are the priorities?
Post by: Kilkakon on April 25, 2014, 04:28:02 AM
Just a quick note, I have managed to bump into your work elsewhere Kyrub, like your X-COM stuff. :D Good on you, you're doing good work for everybody. :D
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 25, 2014, 12:49:56 PM
What's really annoying and has the potential to slow down my advances is AAA combined with A-Complexes. Works best with sensors under the base tile (I do take time to bombard these), but that's probably asking for too much.
A-complexes, excellentd, we'll make them even more.
Sensors: In my opinion it is a design mistake (or possibly an unintentional mistake), that sensor array is not destroyed when city is built. I find the tactics annoying and never use it- though I understand that in MP everybody can use it. Still, does anyone in MP build sensors in other places that in a city square? (What kind of feature is this? It flattens the game.)

Quote
I'm not sure if I would recommend Trance as on par with AAA and ECM, though. The order I'd pick is AAA, ECM, then maybe some Trance.
Naturally, that's what intended.
I looked in the code only to see that I have left my work unfinished (noths ago), so the AAA is only half done (as many other notes in AI building). Next time, it will be better!
On the other hand, I tried to strengthen DROPs. No change? Also, artillery is already nerfed.
Title: Re: Improving AI - what are the priorities?
Post by: TarMinyatur on April 25, 2014, 04:31:36 PM
Some data from a nearly default game of SMAC(n):
(Accelerated start, Hive removed, Gains given Gatlings)

Faction vs Faction attacks: 100
Hurried attacks: 11
Hurried attacks at -33%: 11
Hurried attacks at -66%: 0
Hurried attacker won the battle: 8 of 11

The Gaians represented 10 of 11 hurried attacks. All of these were done by 5-1-1 infantry vs my (Spartan) 4-2-1 infantry on a rocky road. The other attack was a Peacekeeper scout vs a mindworm on the first turn.

The Gaians did not do a hurried attack from base unless the base had a 1-2-1 defender. Three 5-1-1's in an otherwise empty base seemed happy to sit there. Could be a quirk -- need more data.

I should do a similar test using the default terran.exe for comparison.
Title: Re: Improving AI - what are the priorities?
Post by: ete on April 25, 2014, 04:40:10 PM
Excited at the idea of playing with a more tactically competent military AI when I get home! Good to hear hurry attacks are starting to happen. That should make it notably harder to invade well defended AI locations with zero armor rover/infantry forces, maybe even make mixing some armored units in essential :).
Title: Re: Improving AI - what are the priorities?
Post by: Geo on April 25, 2014, 05:04:47 PM
Sensors: In my opinion it is a design mistake (or possibly an unintentional mistake), that sensor array is not destroyed when city is built. I find the tactics annoying and never use it- though I understand that in MP everybody can use it. Still, does anyone in MP build sensors in other places that in a city square? (What kind of feature is this? It flattens the game.)

I usually construct them at the same time I plant a forest near a base, especially if there's still lost of fungus around. Early native life warning and such. In the beginning of a game (say first 50-100 turns) there's usually not enough formers around to delay a colony pod settling down.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on April 28, 2014, 02:08:28 AM
The Gaians did not do a hurried attack from base unless the base had a 1-2-1 defender. Three 5-1-1's in an otherwise empty base seemed happy to sit there. Could be a quirk -- need more data.

I should do a similar test using the default terran.exe for comparison.
Thanks a lot, Tarminyatur, for extensive testing. Great to see the systematic results. You don't need comparative testing on this.
Not attacking without another defender is a feature.


While working on another batch, last one for a while, I enabled ICS in a test for all faction, and... Morgan dominated over Miriam! I could not believe my eyes, hehe.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on May 02, 2014, 10:41:06 AM

I have analyzed AI crawler behaviour. AI uses all of its crawlers on SP once it starts building it. The crawlers normally search tiles outside of city radius, preferably rocky, convoying but 1 mineral. In late game, often before they reach it, they are eaten by worms, or redirected to SPs, not creating a single mineral.

This behaviour was changed, cralwers simply search for closest non-worked forest or mine tile. I recommended up to 3 crawlers per base. Crawlers will not be built during wars. SP focus stays, that is probably welcome.
Title: Re: Questions to modders, what would you like?
Post by: kyrub on May 02, 2014, 12:59:53 PM
Well, that was it. It seems you could have answered in one sentence, to make it short.


As for bunkers, transports and encryption defenders, I asked because there is no way known to me (so far) to introduce necessary AI changes, to tackle
- AI defending roads and tubes at crucial points
- better and dangerous AI invasions
- AI defending against probes (what you suggest is easy on paper, but due to the architecture of AI movement, nearly impossible)

So the options would have sidestepped the trouble. Similar with Cloaked, but I think I'll get to it.
Also, bunkers could stay as an AI improvement with extra option, but without it, I will simply erase them, because they are a farce (but this was the lowest priority).
Title: Re: Questions to modders, what would you like?
Post by: Yitzi on May 02, 2014, 02:47:24 PM
- AI defending roads and tubes at crucial points

Which is the hard part, teaching it to identify crucial points, or getting it to defend them?

Quote
- better and dangerous AI invasions

So there's no way to have it hold off on the invasion until it has an advantage?

Quote
- AI defending against probes (what you suggest is easy on paper, but due to the architecture of AI movement, nearly impossible)

What is the architecture of AI movement?
Title: Re: Improving AI - what are the priorities?
Post by: ete on May 02, 2014, 03:35:54 PM
hm, that explains a lot. I'm guessing the designers had issues with crawlers clogging up squares near bases (a big deal with the AI's old terrible forming) and sent them far away, which made them not very useful, so they made the AI not use them much. I'd recommend something like a sliding target number of crawlers per base, so as the base gets bigger it wants more crawlers. 3 crawlers per base is good early, but in mid/late it should have a lot more and this will help with SPs too. Hopefully the whole move all the crawlers to SP base thing will mean crawlers are rearranged often enough to not stifle development too badly, but if testing shows otherwise maybe something like if currently crawling and mission year is a multiple of 20 move to a new target square further from base would help (and allow AI to safely build lots of crawlers)?

For which resources to go for: bonus resources are notable. Crawlers are okay on forests and pretty good on rocky/road/mines, but an energy bonus with a solar or nutrient with farm also make excellent choices.

Do terraformers terraform outside city limits much? If there's spare former-turns putting r/r/ms on nearish squares for crawlers is good, though unless they're really serious about mass-producing formers there's probably not much spare.

Oh, and not crawlers in war? Does this include the kind of war where you declare war on someone on another continent who you're not actually fighting? Because I think going into war-mode for this rather than just building normally would be a mistake.
Title: Re: Improving AI - what are the priorities?
Post by: Geo on May 02, 2014, 04:03:06 PM
Oh, and not crawlers in war? Does this include the kind of war where you declare war on someone on another continent who you're not actually fighting? Because I think going into war-mode for this rather than just building normally would be a mistake.

Yeah. I think its a better idea to only let the military weaker faction forego building crawlers. In SMAC, basically all factions have an opponent with which an almost perpetual state of vendetta exists.
Title: Re: Questions to modders, what would you like?
Post by: kyrub on May 02, 2014, 04:05:02 PM
Which is the hard part, teaching it to identify crucial points, or getting it to defend them?
I cannot see either solved, probably bunker defending can be done, but that is not easy at all and it would need many well thought exceptions (when the chips are down, better defend your base). Getting AI to build less roads is at least thinkable (and desirable). Still, too little.
 
Quote
So there's no way to have it hold off on the invasion until it has an advantage?
Oh there is. Just where the "there" is... If I knew the solution, if I saw the place with the decision, one bit of it, I wouldn't ask, be sure about it.

Quote
What is the architecture of AI movement?
Infowar units are treated separately, there are too many instances. Defenders are totally separate again; I cannot easily explain the AI that this defender "cannot defend", in fact, so the base needs reinforcing. Every other unit other than defender moves out of base. There are emergency defenders, maybe I could try to squeeze probes inside that code, but then I'd lost emergency counter-attacking from the base, which I won't do.

I don't say it is impossible, just the function is so complex that I have very little idea what to do. I still have no clue how to stop Infowar units from running close to other bases. Maybe, after that, I can stop some of them from running out of the base, if there are no probes inside. Maybe.
Title: Re: Questions to modders, what would you like?
Post by: Yitzi on May 02, 2014, 04:13:51 PM
Which is the hard part, teaching it to identify crucial points, or getting it to defend them?
I cannot see either solved, probably bunker defending can be done, but that is not easy at all and it would need many well thought exceptions (when the chips are down, better defend your base). Getting AI to build less roads is at least thinkable (and desirable). Still, too little.
 
Quote
So there's no way to have it hold off on the invasion until it has an advantage?
Oh there is. Just where the "there" is... If I knew the solution, if I saw the place with the decision, one bit of it, I wouldn't ask, be sure about it.

Quote
What is the architecture of AI movement?
Infowar units are treated separately, there are too many instances. Defenders are totally separate again; I cannot easily explain the AI that this defender "cannot defend", in fact, so the base needs reinforcing. Every other unit other than defender moves out of base. There are emergency defenders, maybe I could try to squeeze probes inside that code, but then I'd lost emergency counter-attacking from the base, which I won't do.

So it sounds like the issue isn't one of possibility, but rather technical feasibility, i.e. it'd be too much work to be worth it.  Which is probably the most common sort of issue in assembly; very little is actually impossible there.
Title: Re: Questions to modders, what would you like?
Post by: kyrub on May 02, 2014, 04:20:47 PM
This one would actually be really interesting, albeit potentially game breaking, which means it would fit better into a revamped Warfare mod rather than a general purpose mod. But it would be a good balance to the ubiquity of air combat.
That was my thought. I understand it may be seen questionable.
The thread title asked "what would you like", so I went for it.  :)

@Yitzi, it's as you say, thanks for understanding. Not impossible, but lot of work, I tend to take chunks I can handle due to RL.  (See the last bit I edited in previous post. Maybe the probes are possible, I realized while writing the response.)
Title: Re: Improving AI - what are the priorities?
Post by: ete on May 02, 2014, 04:21:30 PM
hm, I think at least two factors are more important than who has a weaker military in determining whether to go into defensive war-mode:
1. does the foe have significant forces near your bases
2. have you lost units or bases recently in battles
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on May 02, 2014, 04:29:40 PM
I'd recommend something like a sliding target number of crawlers per base, so as the base gets bigger it wants more crawlers... Hopefully the whole move all the crawlers to SP base thing will mean crawlers are rearranged often enough to not stifle development too badly.
Nice. First we see how current version works, ok? My experience tells me that to move step by step before making things complex, is better.

Bonus resources are in, I forgot to mention them.

Quote
Do terraformers terraform outside city limits much?

Nope, and I'd rather not overcomplicate here.

Quote
Oh, and not crawlers in war? Does this include the kind of war where you declare war on someone on another continent who you're not actually fighting?
Not exactly sure, but I think the continent flag must be set on "offense" or "defense". So probably not, must be tested though.
Title: Re: Questions to modders, what would you like?
Post by: ete on May 02, 2014, 04:30:55 PM
Quote
What is the architecture of AI movement?
Infowar units are treated separately, there are too many instances. Defenders are totally separate again; I cannot easily explain the AI that this defender "cannot defend", in fact, so the base needs reinforcing. Every other unit other than defender moves out of base. There are emergency defenders, maybe I could try to squeeze probes inside that code, but then I'd lost emergency counter-attacking from the base, which I won't do.

I don't say it is impossible, just the function is so complex that I have very little idea what to do. I still have no clue how to stop Infowar units from running close to other bases. Maybe, after that, I can stop some of them from running out of the base, if there are no probes inside. Maybe.
hm, stab in the dark/a bit off topic, but could you potentially create a custom unit (infantry probe) and force it to use the defender plan, plus code unit building priorities so the base always 'wants' at least one of them?
Title: Re: Questions to modders, what would you like?
Post by: kyrub on May 02, 2014, 04:35:45 PM
Good try, but Infowar unit clash is built... on unit plan. And AI needs to recognize it has base only with infowar defender left and therefore emergency (many instances). Still, I don't say it cannot be tested (can a unit in alpha.txt be specified as defender?). I have my doubts.

[btw, we are cluttering this thread and we should not] [/move out]
Title: Re: Questions to modders, what would you like?
Post by: Buster's Uncle on May 02, 2014, 04:46:53 PM
I can always split topic drift off into its own thread on request.  A list of post #s would help.
Title: Re: Improving AI - what are the priorities?
Post by: ete on May 02, 2014, 08:10:52 PM
Good try, but Infowar unit clash is built... on unit plan. And AI needs to recognize it has base only with infowar defender left and therefore emergency (many instances). Still, I don't say it cannot be tested (can a unit in alpha.txt be specified as defender?). I have my doubts.

[btw, we are cluttering this thread and we should not] [/move out]
Right.. that could get very messy then. Still, probably worth a test, see if the defending probe starts an infowar clash even if it's set as defender. No AC access until July, so someone else will have to play around with it.

#UNITS does let you specify AI plan:
; Plan    = Unit "plan" for AI purposes:
;          -1  = Auto Calculate
;           0  = Offensive
;           1  = Combat
;           2  = Defensive
;           3  = Reconnaisance
;           4  = Air Superiority
;           5  = Planet Buster
;           6  = Naval Superiority
;           7  = Naval Transport
;           8  = Colonization
;           9  = Terraforming
;           10 = Supply Convoy
;           11 = Info Warfare
;           12 = Alien Artifact

hmm... tricky.. again, guessing at potential ways around it if the simple solution does not work (may be over complicated and/or non-functional: I've not seen the code)

If the infowar battle does not start when a probe goes into a base with a probe defender, perhaps that specific check is modifiable (from is there an infowar plan unit to is there a unit with probe module)? Sounds like it could get very messy though, so maybe not practical. Probably crazy alternative: make a unit plan 13 which switches between behaving as infowar (if other faction's turn) and defender (in its turn), so it'll act as a defender when it can move, and act as a probe when someone tries to probe its base.

Perhaps to stop AI's leaving bases with just a probe to defend, modify AI's 'do i need emergency defenders' to also count number of probe defenders, something like:
If total_defenders - probe_defenders = 0 then emergency

though counting a specific unit may be tricky.. though you're doing something like that for crawlers so maybe that code can be made to work?
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on May 02, 2014, 09:02:33 PM

Quote
If the infowar battle does not start when a probe goes into a base with a probe defender, perhaps that specific check is modifiable (from is there an infowar plan unit to is there a unit with probe module)?

I like your thinking, ete. This could actually work (the other things won't, though).  It is a fragile idea, we still don't know how AI will handle defensive probe, as there are many instances of check for def units, I am not even aware of them. But if the game does not immediately crash, one can solve side-effects later.

I'll stick for the moment with the idea I came upon while answering to Yitzi (as that seems less risky). If we can spot the right place, why not simply:
- check if Infowar unit, which is about to move, is in theplayer's base
- check if sum of Infowar units in the base without GoTo order > 1
- if not, stop movement (e.g. "defend")
- if yes, continue (issue GoTo order)

Let's have your plan, ete, in the reserve, always good to have more plans, when things get tough.
Title: Re: Improving AI - what are the priorities?
Post by: Yitzi on May 02, 2014, 09:24:04 PM

Quote
If the infowar battle does not start when a probe goes into a base with a probe defender, perhaps that specific check is modifiable (from is there an infowar plan unit to is there a unit with probe module)?

I like your thinking, ete. This could actually work (the other things won't, though).  It is a fragile idea, we still don't know how AI will handle defensive probe, as there are many instances of check for def units, I am not even aware of them. But if the game does not immediately crash, one can solve side-effects later.

That's a dangerous way of thinking, as side effects might not be discoverable immediately.  However, most checks for defensive units won't apply to defensive probes (i.e. unarmored infantry probes), so that's not so relevant there.

Quote
I'll stick for the moment with the idea I came upon while answering to Yitzi (as that seems less risky). If we can spot the right place, why not simply:
- check if Infowar unit, which is about to move, is in theplayer's base
- check if sum of Infowar units in the base without GoTo order > 1
- if not, stop movement (e.g. "defend")
- if yes, continue (issue GoTo order)

You'd also want to encourage the AI to distinguish between infantry and rover probes, and build the former but use them only for base defense.
Title: Re: Improving AI - what are the priorities?
Post by: Geo on May 03, 2014, 04:16:34 PM
In my latest (SMAC) game, I could designate a tactical needle as defender. It kept the flag where ever I sent it.
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on May 17, 2014, 03:12:11 AM
Updated the patch:

http://alphacentauri2.info/index.php?action=downloads;sa=view;down=260 (http://alphacentauri2.info/index.php?action=downloads;sa=view;down=260)
Quote
Description: New release of AI patch for SMAC - 17/5/2014
http://alphacentauri2.info/index.php?action=downloads;sa=view;down=260 (http://alphacentauri2.info/index.php?action=downloads;sa=view;down=260)

Features

AI Terraforming
- AI got a basic lesson in advanced terraforming (boreholes, condensers, less raising terrain)
- it builds no more bunkers
- it builds denser sensor array network

AI crawlers
- AI builds now tends to build crawlers earlier and slightly more of them
- AI crawls more intelligently its resources

AI Social Engineering
- the patch includes an emergency fix of the worst parts of social engineering code
- AI now understands that pacifist drones are a major problem

AI buidling units
- AI spreads quicklier on oceans
- Morgan has got new incentive to spread quickly
- AIs build less of probes, bar Miriam
- a lot more AAA defense
- AI now likes rovers and choppers


Special thanks to:
Kirov, Blaneck, TarMinyatur, Geo
Sorry, that I could not adress more features. Will try to do that in (more distant) future.
Title: Re: Improving AI - what are the priorities?
Post by: Buster's Uncle on May 17, 2014, 03:17:48 AM
File approved.

In more than one way. ;b;
Title: Re: Improving AI - what are the priorities?
Post by: ete on May 18, 2014, 03:45:27 AM
Cool stuff kyrub :)
Title: Re: Improving AI - what are the priorities?
Post by: kyrub on May 19, 2014, 04:23:25 PM
Thanks, ete and BU.

I have got reports of malfunctioning, on other forums. The AI seems to have big problems with manning their defensive lines  (as some have noticed here in the previous version), and the newest patch does not help, more the contrary. I am working on the matter, since I cannot leave the patch in such a disarray.
Title: Re: Improving AI - what are the priorities?
Post by: Nexii on May 21, 2014, 04:12:38 AM
Ok so I watched an AI game under the new patch.  Overall the AI is much stronger with terraforming farm/solar and forest/farm about 50%/50%.  They can now produce enough to close out a game consistently which is a big improvement.  They build Hab Domes meaning a lot more late-game power.

A few simpler things the AI could do better:
- AI doesn't rebuild destroyed HQs (or relocate if distant from most bases)
- AI avoids Children's Creches.  Similarly puts a low priority on Tree Farm / Hybrid Forest.  These are probably the top facilities to get, so should be built before things like Perimeter Defense, Energy Grid, etc.
- AI seems to pick techs based on category only.  Best example I can give was Sparta getting Fusion tech before Centauri Ecology.  AI should get Centauri Ecology and Biogenetics first so it can grow.  Predictably, Sparta fell way behind on its own continent in this game.
- AI will build some satellites but generally avoids them (higher priority for N-sats).
- AI prefers drop troops but tries to drop them into invalid Sea or Airport-covered zones, eventually giving up and ending the unit's turn
- AI could make more sea probes, for tech steal

More subjective/difficult things:
- AI is more expansionist although I would recommend pushing it to expand a little more.  At least to expand until bureaucracy limit.  Commonly I see 4-5 bases only constructed.  Seems some factions are more prone to this than others.  If boxed in, AI should go to sea bases early.
- AI generally is very war crazy, as others noted before.  Gaia won the game I watched because 5 of the other AI were on the same continent, and just warred each other into the ground while Gaia buildered to population victory.  I could write a lot more on diplomacy strategy - but probably this is the area where the AI could stand to improve the most.  At the same time, you wouldn't want to water down the hatred of picking certain governments, or faction personalities.  I haven't tested but it seems the AI wars between itself more indiscriminately and considers government more for Human player only.  I would say the AI should consider power level a lot more heavily when trading techs and when agreeing/breaking Treaty/Pact.  At least on higher difficulties, anyways.
- AI is pretty decent at land war.  AI could raise land towards enemy cities when having an advantage in war.  Probably more difficult where even advanced terraforming is complex.
- AI should probably go 90% forest, with the odd condensor/borehole.  Farm/solar can be okay but with default values it's generally weak.  The AI doesn't know how to do specific echelon strategies to really make use of solar/farm.  Terraforming/crawling gets rather complex if you start modding it - as both former-time and FOP can be modded. 

On the flip side, has anyone documented a list of AI "cheats" that exist in game that give it an advantage?  What is everyone's opinion of the various AI bonuses?  For example, extra workers that aren't drones, hidden IND bonus (I think +3 on Transcend), very low (or no) cost to subvert using probes.  Tech cost curve is one of the bigger ones (about 40% cost on Transcend).  At what point does the AI need less of these unfair advantages?
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 31 - 840KB. (show)
Queries used: 16.

[Show Queries]