Author Topic: SE choices for AI - suggestions  (Read 32032 times)

0 Members and 2 Guests are viewing this topic.

Offline kyrub

SE choices for AI - suggestions
« on: January 10, 2013, 02:42:53 PM »
This thread is created for help in an area that is severely under developped in the original game.


What should change for different factions?
What  is a typical SE mistake for AI?
How and when should they change to specific SE combinations?
What to do with AIs and the bloody Free Market option?

I'll be happy to hear your concrete suggestions.
« Last Edit: January 28, 2013, 11:43:43 AM by sisko »

Offline Kilkakon

  • Likes cute things but is
  • Mostly Harmless
  • *
  • Posts: 1155
  • €695
  • View Inventory
  • Send /Gift
  • It does something (It's free and yet priceless)  
  • Creator of Lost Eden and C&C: Dawn of Tomorrow
  • Scenario Creator Custom Faction Modder AC2 Hall Of Fame AC2 Wiki contributor Downloads Contributor Author of at least one AAR Planet tales writer author of the Lost Eden mod for Alien Crossfire
    • View Profile
    • My website!
    • Awards
Re: SE choices for AI - suggestions
« Reply #1 on: January 10, 2013, 03:38:26 PM »
The only thing I'll add from the outset--I would suggest to make it based on the specific stats that each SE choice gives, rather than just the slot, as many big mods and balance mods change what each individual thing does.
« Last Edit: January 11, 2013, 03:20:10 PM by Kilkakon »

Offline Kirov

Re: SE choices for AI - suggestions
« Reply #2 on: January 11, 2013, 02:58:10 PM »
I haven’t followed AI habits for a long time, but I’ll try to recall as much as I can and I have looked into my single player save games.

First and foremost, I need to say that I find SE unbalanced and I’m biased towards some. I’m most happy when I can run Demo/FM/Wealth and shun war-oriented SE even when at war.

On the Politics line – I find Demo very good, Fundie poor, PS sucky

The Economics are most balanced, where even experienced players can have different approaches. FM is very good, Green and Planned are OK. I don’t really use Planned anymore, but others could disagree.

Values – Wealth is the best SE choice, as it’s very useful and comes with very low penalty, Knowledge is so-so, Power is heinously, hilariously bad.

All in all, PS, Fundie and Power suck. Now, I’m not saying I’d never switch to them, but I’d never make it a general rule (“use Power at wars” is very bad advice in my opinion). If I was to give a general tip, it would go “avoid those SE settings unless your very precise calculations say otherwise”.

With that in mind, my thoughts on the AI SE:

First a special case: the Hive. He’s the simplest. As I learnt from good Hive players, you simply switch to PS/Planned/Wealth and stick to it until the end of time. I see no reason why AI shouldn’t do so 100% times. Hive AI does in fact use PS and Planned, but prefers Power to Wealth, which brings me to:

1st sin: they don’t use Wealth; even those who don’t hate it and can pick it, still avoid it at all costs. Instead, they love them some Power. I have a savegame where everybody along with Morgan and Dee have Power, and another game where Aki runs Power even without any war!

- in my opinion; everybody who can, should run Wealth; if they can’t, run Knowledge. Seriously, Power is bad for you

- Pirates need Wealth very desperately, but there is a problem here: they can pick it, but they hate Wealthers.

- Santiago should be simply immune or half-immune to penalties of Power. Barring that, I’d still limit her using Power only to the most heated wars


2nd sin: no SE at all, even with the proper tech. This takes place in several situations. One was mentioned already: Miriam has IA and could pick Wealth, but no way, ‘she’s a warrior not a builder and ain’t be usin’ no goddam Wealth.’ So she runs nothing until the advent of AMA. I think this is related to their ‘agendas’ which you set in the scenario. If it’s default ‘conquer’, not ‘build’, Miriam/Hive will avoid Wealth no matter what, even if it’s good for their conquest.

Another situation is that they’re bound on their ‘preferences’. This is a bit silly because for example Miriam can’t run Knowledge, but will hate your guts for running PS or Demo. Of course, a Miriam human player can use both to his great advantage, so AI is very stupid here. I believe that AI is sometimes too much stuck to their preferences. I understand this as a part of flavour and roleplay, but still… A human Morgan can run Green, let’s allow it to AI.

However, this raises the problem when they use an SE they “hate” you for. I think Miriam should run Demo sometimes, Pirates run Wealth always, Morgan – Green sometimes, but what if they hate you for doing the same at the same time? Well, if it possible, either we should switch off their stupid rant when they run the same SE as you, or simply live with this absurd – I’d rather Pirates on Wealth who hate me for Wealth than Pirates who run Power and are completely useless.

As a general rule, it’s usually better to run some SE than not run anything through the midgame.

3rd sin: Using SE the AI can’t handle. This is particularly true for FM, as the AI can have 20 pacifism drones and still not see any problem here. AI should know to run 20% PSYCH under FM. Not that it helps much with p-drones. I think it should check if and how many wars it has. Other such examples are energy or industry-killing SE. So it’s 2200, Miriam runs Fundie/nothing/nothing and she has like five techs under her belt… Sad. In a savegame of mine I see Cha Dawn running the same, this is pathetic. Also Power, PS and Planned can kill the AI’s energy or mineral output.

One important note: I accept the AI running Power+Fundie if it can check that the Spoils of war are on and it’s possible to steal tech this way. Otherwise, AI simply must have some moderate energy income.

I don’t know how the underlying code looks like, but I was thinking if AI SE choices might be related to other game elements in certain ways:

1) positive triggers – this could work both ways. Either “switch to FM when you have a pactmate” or “look for a pactmate when you have FM”. Seriously, I think AI is too aggressive, also towards each other, and I don’t see any pattern in AI warmongering; they don’t fight for land or ideals, they just fight and make peace almost a random (how easy you can convince AI to call of vendetta for free and then you read that they signed treaty; really guys, that’s all it takes?)
Other sample triggers (I can pay more thought to that if needed): “use early Planned to churn out colony pods” “switch to Fundie if you lost 2 bases to mind control” “switch to Green if your total ecodamage averages 20 per base”,

2) negative triggers – this is about the costs. “give up Fundie and switch to Demo if you have like 3.2 lab points per turn” (AI can seriously have this much in MY 2200). “give up FM if you have on average more than 2 p-drones per base”, but also “give up Demo/FM/Wealth if you’re losing a war”

3) I wonder if the AI can check other players, AI and humans, to decided what to do. “if you’re the last one with tech, consider Demo/FM/Wealth” “if you’re the last one with tech, consider Fundie and hordes of probes” “consider Knowledge if there’s not so many probe teams on the map”.

Also, some other general notes I took down:

- the pacifists and builders should run Demo most of the time, warriors - sometimes

- as I said, sometimes they shouldn’t run their preferences (Miriam, Santiago)

- early Planned would be good for AI, but must combine this with building colony pods and formers (and it should be set that AI starts every game with researching CE). Then builders can go FM, while warriors can stay Planned, but only if it doesn’t kill their tech (even warriors need some basic conquer techs)

- Santiago can go early FM and hunt for bugs (she still has better odds), but her units shouldn’t leave her territory.

- Fundie might be interesting in AI’s hands, but it takes smarts to successfully probe; maybe AI could probe other AI, humans aren't easy prey


This is my general overview. I’ll try to play some SP to find more food for thought, but am a bit busy these days, so it may not happen in January.

Offline kyrub

Re: SE choices for AI - suggestions
« Reply #3 on: January 11, 2013, 08:54:33 PM »
Great post, Kirov, interesting suggestions. It made me fire up IDA... only to remind myself how complex the damned SMAC code is. I don't understand my own comments. Incredible.

What I understand right from beginning:
a) I can free the AIs from using only their preferred setting.
b) I can free the AIs from not using their hated setting.
c) I have also something I have called "AI_max_pref_socio_var_unused". Any idea what it could be (these things most probably coincide with some faction setting in alpha)? Maybe that skipped Miriam option or what?

Maybe just freeing the AI from its own limits would give us some interesting fruits. (Modifying alpha afterwards to make Green undesirable for Morgan, so that his diplomatic agenda fits, is probably not hard.)


-------


General idea:
How the system works - it seems the program runs over all socio variants and gives them a rating. It ommits. At the end it probably chooses the best rated one. Really not sure, it's a bit wild guess.


other observations (take with a large handful of salt, I understand about 66% of the ultra complicated code here)

a) ECONOMY and EFFICENCY are considered together. If the AI player is not anti aggressive (-1) and not (some being_attacked flag) or interested in wealth (+1) or tech (+1), their basing factor is (times) 1. Any of above cases double/triple the effect. Interest in tech has double effect itself. (and other factors enter in afterwards, like energy increase times number of bases etc.). There is further 200% boost for factions that
have neither growth nor power setting +1. No extra FM considerations here, I am afraid. 

b) Support POLICE- very bad understading, since the program uses some general player variable (nr of supported units??? or drone supported units???) I cannot decipher. Let's name it X. X seems to be negative factor. If support = -4, X is trippeed, if the player in war flag = TRUE, and support is -3, X is doubled. If war = TRUE and support = -1 or -2 AND the FM is on, X is 150%. (It seems FM is considered only if -1 or -2 support, strange!!!). If aggressive_inclination +1, then X = 200%, if growth_incli, then X =150%, power_incli, 150%, wealth_incli, 50%, tech_incli, 75%. Basically, Morgan is reluctant to take support problems in consideration. Hmmm. This is very rough, it could really get some improvement, although expereimenting is necessary.

c) MORALE... complicated. Factors are number of bases, some attacking units variable, (being_at_war_flag+1), (aggressive_incli+2). This is multiplied together and by morale setting (so larger map with more bases and enemies and more developped empires give you geomertically more ++ morale settings for AIs). Here is the "power love", I think. It's divided by 8, then.
Further movement: If AI_aggressivity >1, 200% (seems like bug, since no AIs have >1?). Power_incli +1 and Growth and Wealth_incli = 0 gives you 200%. Anti agressive, not power_incli, tech_inclined and not_in_war - all in the same time gives you 50%.

... to be continued

« Last Edit: January 11, 2013, 11:59:32 PM by kyrub »

Offline Kilkakon

  • Likes cute things but is
  • Mostly Harmless
  • *
  • Posts: 1155
  • €695
  • View Inventory
  • Send /Gift
  • It does something (It's free and yet priceless)  
  • Creator of Lost Eden and C&C: Dawn of Tomorrow
  • Scenario Creator Custom Faction Modder AC2 Hall Of Fame AC2 Wiki contributor Downloads Contributor Author of at least one AAR Planet tales writer author of the Lost Eden mod for Alien Crossfire
    • View Profile
    • My website!
    • Awards
Re: SE choices for AI - suggestions
« Reply #4 on: January 12, 2013, 12:06:13 AM »
Remember that the player can't choose the hated SE setting either, so letting the AI do that would be cheating!

Will wait to see what else you add. :D

Offline Lord Avalon

Re: SE choices for AI - suggestions
« Reply #5 on: January 12, 2013, 12:36:01 AM »
Just a thought about AIs running an SE they hate: it's "do as I say, not as I do."

AI:  You greedy [progeny of unmarried parents], you're running Wealth, I despise you.

Player:  But you're running Wealth, too.

AI:  Shut up!  We're talking about you.  I hate you.
Your agonizer, please.

Offline kyrub

Re: SE choices for AI - suggestions
« Reply #6 on: January 12, 2013, 01:29:13 AM »
Incredible.
They royally messed the whole thing, beyond imagination.

They swapped POLICE and SUPPORT setting.
- So, the AI first checks its support rating instead of the police one, it uses it to count how much drones are induced in its cities (the actual drone count may be quite different, but AI does not notice).
- Then it considers it checks its police rating instead of the support one -  and again, it uses the police rating to count the number of minerals spent on support of military units.

This may explain why it does not work with Free Market: the AI does not notice that the bad police rating is destroying its bases. Also AI bases are being ran into ground by costly supports, especially if AI fails to notice, having nice ++POLICE, that support is apalling. Maybe that explains why Hive AI does so well: Police state improves both police and support rating and it covers the problem.

Offline Kilkakon

  • Likes cute things but is
  • Mostly Harmless
  • *
  • Posts: 1155
  • €695
  • View Inventory
  • Send /Gift
  • It does something (It's free and yet priceless)  
  • Creator of Lost Eden and C&C: Dawn of Tomorrow
  • Scenario Creator Custom Faction Modder AC2 Hall Of Fame AC2 Wiki contributor Downloads Contributor Author of at least one AAR Planet tales writer author of the Lost Eden mod for Alien Crossfire
    • View Profile
    • My website!
    • Awards
Re: SE choices for AI - suggestions
« Reply #7 on: January 12, 2013, 04:46:41 AM »
That might just the fix we need then! :O

Will you and Yitzi work together on one combined patch?

Online Green1

Re: SE choices for AI - suggestions
« Reply #8 on: January 12, 2013, 04:58:22 AM »
There also seems to be some kind of bug related to Free Market and spore lanchers. When an AI like Morgan or Aki run free market and a spore launcher is bombarding outside a city, the AI just sits building units instead of going out to kill the thing when it has units that could easily do so. A few games, including one of GrimthR's LPs (youtube) using your patch has pointed that out. It cripples an entire AI faction. I have noticed it myself.

EDIT: By the way... welcome to AC2. We are HUGE fans of your work here as well as Scient's. Your patch is more popular than you think. Many AC folks are lurkers, but AC does have a decent fan base. We are not bad people to boot.

Offline kyrub

Re: SE choices for AI - suggestions
« Reply #9 on: January 12, 2013, 11:57:22 AM »
Will you and Yitzi work together on one combined patch?
I have no time to cooperate or coordinate or whatever. But it should be very easy to combine our efforts in one patch, if Yitzi does not mind. I'm fine and as far as he lets me do my job (AI).

On the other hand, I still doubt (with past experience) everybody will want to "be forced" to play with AI changes. The changes have almost always some minor side effects, it's hard to avoid it in a game with such a complex AI code as SMAC. And I cannot make AI changes optional. So I think the patch will end with having two variants, (Yitzi + bugfixes) and (Yitzi + bugfixes + AI).

@Green
In this thread, we tackle just the SE settings. The problem you mentioined is AI units movement (and there are many, problems, I mean). So I 'd leave it elsewhere. Don't let your hopes raise, though, the movement function is a headache, in itself. Very hard to correct anything, I think I spent 3 days to locate the colony pod decision and I still could not force the game to do exactly what I wanted.

Offline Kirov

Re: SE choices for AI - suggestions
« Reply #10 on: January 12, 2013, 03:51:05 PM »
c) I have also something I have called "AI_max_pref_socio_var_unused". Any idea what it could be (these things most probably coincide with some faction setting in alpha)? Maybe that skipped Miriam option or what?

a) ECONOMY and EFFICENCY are considered together. If the AI player is not anti aggressive (-1) and not (some being_attacked flag) or interested in wealth (+1) or tech (+1), their basing factor is (times) 1. Any of above cases double/triple the effect. Interest in tech has double effect itself. (and other factors enter in afterwards, like energy increase times number of bases etc.). There is further 200% boost for factions that
have neither growth nor power setting +1. No extra FM considerations here, I am afraid. 

Thanks for your work kyrub, although I must say I barely follow you here (Ogg be no computer whiz). It took me a longer moment to figure out what you meant. I even downloaded an IDA tool and fired up terranx.exe, but let's not kid ourselves, I don't even know where to look. I have a question here - can you modify the strings or just the values? Can you flat out remove some consideration from the above list? I understand that you can't shoehorn the FM consideration here?

This SUPPORT and POLICE mix-up is a big thing, obviously. But there is something I don't get - so AI running FM 'thinks' it has -5 SUPPORT? What does it do with such a revelation? I still see it cranking units like there's no tomorrow.

I think that support stuff needs separate consideration. Like for example "don't clog your base minerals with more than (10-20%) maintenance unless" and 'unless' means here either 'you're winning a war' (took +2 bases), so it's a good idea to push on, or 'you're losing a war' (lost one base) so you must defend.

I'm quite busy this month, but for a longer while I wanted to start a thread on AI behaviour, especially in terms of diplomacy. I've always wondered if there is a slider like the one you see in Civ4, when you get 'points' for behaviour. I want to check the comparability of things, like for example 'running your hated SE is cancelled out by trading two techs'. I had this impression that sometimes it's better to refuse an outright demand from the AI and then gift them the very same tech. I could never prove it, though. Is it possible to see it with this tool you use?

And again, wow, this SUPPORT/POLICE thing is a crazy mistake. How could that fly under their radar?

Offline Kirov

Re: SE choices for AI - suggestions
« Reply #11 on: January 12, 2013, 04:07:05 PM »
Remember that the player can't choose the hated SE setting either, so letting the AI do that would be cheating!

I'm afraid there is a difference between "SE aversion" (you can't run it) and "SE hatred" (AI scolds you for it and will never use it itself). This is particularly conspicuous for Zak and Miriam, as their aversions and hatreds are not even in the same SE line. Either human or AI Zakharov can't run Fundie, but the AI Zak will additionaly never run Power and Wealth, something which is available to humans (and Zak should switch to Wealth in my opinion in the first possible moment). The same goes for Miriam, who won't use Knowledge (inherently), but also PS and Demo, and she could use Demo early on at least to grab basic conquest techs like NLM, Doc:Flex or maybe even SFF and D:AP.

Others are less obvious, but still - the AI will avoid 2 or 3 SE choices where the human has only one option off. This drives me crazy particularly for Wealth, which is 'averted' by Santiago and Cha Dawn, but also 'hated' by Zak and Pirates.

I'd like to remove this thing that Zak runs Wealth and hates you for running Wealth, because I find it absurd, but it's still better than what we have right now (especially the Pirates could use them some Wealth).

Offline kyrub

Re: SE choices for AI - suggestions
« Reply #12 on: January 12, 2013, 08:52:13 PM »
I have a question here - can you modify the strings or just the values? Can you flat out remove some consideration from the above list? I understand that you can't shoehorn the FM consideration here?
I can modify whatever I want as long as I find some space. People who are able to create DLL injections have no problems with space, sadly it's not my case - I am not a programmer, just a self learned  matemathician-amateur.

I can remove, move or replace a lot of AI SE choice. Don't worry. I cannot inflate the code with massive new tasks, basically, I have to work with the variables the AI already uses. Example: we have Nr_of_my_land_units_on_continent_X variable. We have Nr_of_my_naval_units as well. But we don't have Nr_of_my_air_units, so we cannot check that against running Free market - pity.

Quote
This SUPPORT and POLICE mix-up is a big thing, obviously. But there is something I don't get - so AI running FM 'thinks' it has -5 SUPPORT? What does it do with such a revelation? I still see it cranking units like there's no tomorrow.
Looking at the social agendas' table, perhaps the AI tries to offset -5 SUPPORT with POWER setting. It could be a factor.

Quote
I think that support stuff needs separate consideration. Like for example "don't clog your base minerals with more than (10-20%) maintenance unless" and 'unless' means here either 'you're winning a war' (took +2 bases), so it's a good idea to push on, or 'you're losing a war' (lost one base) so you must defend.
The game has it already, when choosing stuff to build in a base, the surplus is taken in consideration! The game AI has a lot of things inside, in fact. It is really complex, most complex AI from all games I have ever seen, I suppose it's a heritage from civ2 game. Just not working very well. (That's not a bad thing, since it's easier for me to make existing structures smoother, than creating AI code from the scratch.) 
Quote
I'm quite busy this month, but for a longer while I wanted to start a thread on AI behaviour, especially in terms of diplomacy. I've always wondered if there is a slider like the one you see in Civ4, when you get 'points' for behaviour.

I have not looked into diplomacy but I remember that all the main functions were identified. We can defeinitely look into AI diplomacy in not-very-near-future.

Quote
And again, wow, this SUPPORT/POLICE thing is a crazy mistake. How could that fly under their radar?
I actually think that there may be bigger problem in the Morale decision. The way it is counted, +Morale becomes a holy grail, just as you noticed in your analysis. The AI spawns many units, the more unit it spawns, the more continent it settles, the bigger the desire for +Morale. On bigger map, it's worse. I believe we should tone it down.

Quote
I'm afraid there is a difference between "SE aversion" (you can't run it) and "SE hatred" (AI scolds you for it and will never use it itself). This is particularly conspicuous for Zak and Miriam, as their aversions and hatreds are not even in the same SE line. Either human or AI Zakharov can't run Fundie, but the AI Zak will additionaly never run Power and Wealth, something which is available to humans.
I can switch off this behaviour easily, if you wish. If I'm right, it works like this: Zak has knowledge set as his preferred agenda, so he programmatically avoid the other options. That's in the code.

Offline Yitzi

Re: SE choices for AI - suggestions
« Reply #13 on: January 13, 2013, 02:27:40 AM »
Will you and Yitzi work together on one combined patch?
I have no time to cooperate or coordinate or whatever. But it should be very easy to combine our efforts in one patch, if Yitzi does not mind. I'm fine and as far as he lets me do my job (AI).

I'm fine with you doing AI; how should we coordinate so that one patch ends up with both sets of changes?  Generally actually changing the code is the last step for me (and I suspect for you), so we might just be able to have one person hold off any changes while the other is at that last stage, and then they can download that and work from there.

Also, in terms of AI changes, maybe it would be better just to list them, and if any seem likely to be controversial I can show you how to set a flag or set of flags based on alphax.  (If 0 is the current method, then it will be completely save-game compatible with my current patch.)

Offline kyrub

Re: SE choices for AI - suggestions
« Reply #14 on: January 13, 2013, 02:56:38 AM »
so we might just be able to have one person hold off any changes while the other is at that last stage, and then they can download that and work from there.
The nature of AI changes requires different approach, I am afraid. I need to create a lot of test builds, to see how AI reacts to different approaches. Afterwards, I reverse some features, I take others in. At the end of the process, a few months on, we may have a better game. Or not, if I fail. In between, the changes may seem even detrimental to the cause. I learned to understand that is normal with AI development.

So I guess you do your work, and I come late and join in. Then people here can agree on any options and flags etc.

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

We shall take only the greatest minds, the finest soldiers, the most faithful servants. We shall multiply them a thousandfold and release them to usher in a new era of glory.
~Col. Corazon Santiago 'The Council of War'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 42.

[Show Queries]