Author Topic: An explanation for the AI rarely running Green  (Read 1504 times)

0 Members and 1 Guest are viewing this topic.

Offline Bearu

An explanation for the AI rarely running Green
« on: April 24, 2020, 08:33:46 PM »
The important components of understanding the reasons for the AI's refusal to run Green remains a product of four factors.
The first factor consists of the original Green model in the stock game providing a negative in GROWTH. Explore factions emphasize Growth bonuses and penalties heavily.
The second component for the refusal of the AI to run Green remains the minimal AI emphasis on Planet either until late in the game or never.
The third factor consists of the lack of emphasis for the AI on Efficiency for Explore factions.
The fourth reason remains the removal of the social emphasis factor in the Player file for the stock game. The randomize faction social agenda rule provides the appropriate value for social effects emphasis, but the game without that rule disables the benefit of Social AI Emphasis on the AI. The disabled social emphasis benefit in the player files adds the number of bases a faction controls for the overall effect value for each model calculated.

I would recommend changing the social model penalty for Green to something an EXPLORE AI emphasizes less like INDUSTRY. The Peacekeepers, Gaians, and University receive a .5 modifier for INDUSTRY and no other positive emphasis in INDUSTRY.
With .exe modifying, I changed the initial 4 - PLANET to 2 - PLANET, and the AI runs Green consistently with ECONOMY and INDUSTRY penalties and a RESEARCH bonus.

I discuss the specific variables for the stock Green model below in all the details.
PLANET Variables
Important variables for understanding Planet Calculations:
Sum of the all the Bases under a single Owner:
Base Ecodamage * 4 / 4 - PLANET (Min. 1 and max. of 99)

1. Start with 4 - Sum of PLANET Values for considered social models and inherent faction bonuses.
2. Multiply the difference from Line 1 by sum for all bases the current faction controls of (Base Ecodamage * 4 / (4 - PLANET (Min. 1 and max. of 99)))
3. Multiply the product of step #2 by 4.
4. Add 25% of line 3 to the final value.
5. Check if the faction possesses an inherent faction bonus for Planet. Jump if +1 or higher and add the number of combat units the faction controls to the total value for planet.
6. If the faction does not possess an inherent Planet bonus, then check the strongest weapon the faction discovered in the game against the value of PSI weapons for the faction. If the faction's strongest weapon discovered exceeds the modified PSI value, then jump into the social mandate controls. (Most factions strongest weapon values will exceed the faction's modified psi value)
7. If the above check succeeded, check if the local variable for faction technological check remains equal to or greater than 2. Jump if 1 or less. If 2 or more, then halve the PLANET value.
8. Perform the Mandate checks discussed below:
Non-Conquer and Explore (In this specific order):
Explore and Discover: X 1 (The Peacekeepers)
Explore: X 4 (The Gaians)

Non-Conquer and Non-Explore (In this specific order):
Build: X .5 (The Morganites)
Build and Discover: X.5
Discover: X .5 (The University)

Conquer and any other mandate (In the order below):
Conquer and Explore: X 1 (The Believers)
Conquer and Discover: X .25 (The Spartans)
Conquer and Build: X .25 (The Hive)
Conquer, Discover, and Build: X .25
Conquer, Explore, and Discover: X 1
Conquer, Build, Discover, and Explore: X 1

GROWTH Variables:
Important Constants: Sum the surplus nutrients from each base the current faction controls (between 0-99 per base) in turn upkeep.
1. Insert (EXPLORE mandate value X 2 + 2)
2. Subtract Build Mandate Value: (EXPLORE mandate value X 2 + 2) - BUILD mandate
3. Sum of surplus nutrients from each base owned by the current faction (between 0-99 per base) in turn upkeep + Sum of differences between the faction bases' current population and Population goal (Next Hab facility + POPULATION) * ((EXPLORE mandate value X 2 + 2) - BUILD mandate)
4. Line 3 * Number of units with the Colonization AI plan the current faction controls + 1.
5. Line 4 * GROWTH value (no upper or lower limit) from Social engineering modifiers and faction modifiers
6. Line 5 * 2 / 3
7. Line 6 * 2 if the current faction possesses the most votes in a game with Diplomatic victory enabled and no cooperative victory enabled.
8. Multiply the value * .5 if the faction possesses tightened Habitation restrictions from the Faction bonuses and penalties (POPULATION > 0).
9. Proceed with the Mandate checks. Multiple Line 7 or 8 * 2 for factions with EXPLORE and CONQUER mandates in stock game.

EFFICIENCY Variables:
Local value used in the entry ranges Efficiency from 0 to 8 with -4 at 0 and +4 at 8.
1. -3 EFFICIENCY combinations: Modified EFFICIENCY value ( 1 ) X 2
2. -4 EFFICIENCY combinations: Modified EFFICIENCY value ( 0 ) X 4
3. Perform the Mandate checks described below:
Build: X 2 (The Morganites and the Drones)
Build and Conquer: X 1 (The Hive)
Build, Explore, and Conquer: X 1
Build, Discover, Explore, and Conquer: X 1
Conquer: X .5
Conquer and Explore: X .5 (The Believers)
Discover: X 2 (The University)
Discover and Conquer: X .5 (The Spartans)
Discover and Explore: X 1 (The Peacekeepers)
Discover and Build: X 2
Explore: X 1 (The Gaians)

Edit: Added the population goal modifier for GROWTH. I forgot to include this variable.
« Last Edit: April 26, 2020, 03:34:30 AM by Bearu »
Picture: Beldam
"I am half sick of shadows, said the Lady of Shallot."

Offline Nexii

Re: An explanation for the AI rarely running Green
« Reply #1 on: April 24, 2020, 09:30:35 PM »
Interesting and strange logic. Especially the bit about considering PSI attack vs weapons, since it's always 3:2. I know what they were getting at, if your weapons are weak then you'd be more tempted to run PSI units instead, but it's so flawed. The check should be like your weapons and armor vs any factions you're at war with.

Not surprised with the units bit, I'd noticed it too. Games where a faction gets Manifold Nexus and captures a few mind worms, they were more likely to go Green.

Like I said in the other the way they formulated SE choosing is not really how a human goes about it. Green is extremely non-linear in benefit. There is a breakpoint where even Trance barely overcomes PSI, and then there's not much else except artillery. A stronger model would be to put arbitrary weights to each aggregate SE (which each could be modified by faction agenda) and then maximize total points. But I'm not sure how workable that would be.

And as much as psi unit count and weapons matter, they rank way below things like whether you have Dream Twister, Neural Amplifier, or faction PSI

Offline Bearu

Re: An explanation for the AI rarely running Green
« Reply #2 on: April 25, 2020, 03:23:56 AM »
I believe if someone rewrites  most of the original code in the section, then it might remain possible to fit your changes in the logic for the AI selection. The developers already added modifiers for SUPPORT, EFFIC, MORALE, and ECONOMY.
I find most interesting the game's internal logic illustrates the eco-damage reduction and increase portion of PLANET bonuses and penalties remained the core of the mechanic. The PSI bonus and penalties, capture mind worms, and fungus penalties appear as later additions.
Picture: Beldam
"I am half sick of shadows, said the Lady of Shallot."

Offline Nexii

Re: An explanation for the AI rarely running Green
« Reply #3 on: April 25, 2020, 02:07:33 PM »
Yea it is curious. Especially where the AI ended up getting a massive ecodamage reduction compared to the human player. Somewhere around 1/8th so it rarely shows up. That was a lot of the reason I sort of gave up on modding ecodamage to be the primary consideration for PLANET. Ecodamage became secondary to PSI combat benefits. Because by the time the AI suffers any ecodamage at all, the human player would be overwhelmed by it.

Maybe they did this because it interfered with clean minerals or the worm pop progression I'm not sure... I think the intent really was to have ecodamage be an equal consideration to PSI benefits. I'd also have to check whether the AI considers the ecodamage facilities when under high ecodamage... my feeling is there isn't any logic there. Much like how they missed things like factions not rebuilding their HQ, or considering Punishment Spheres situationally

Offline Nexii

Re: An explanation for the AI rarely running Green
« Reply #4 on: April 25, 2020, 11:50:07 PM »
I said score when what I envisioned was more like a value that would represent the estimated power increase in percent. Then from 100% the total benefit would be all the SE scores multiplied together. I imagine right now the AI only picks the best total value in each category independently... at least the way it's described in your analysis. I've kind of noticed this... overpicking SEs that don't really 'go together' as a result. And underpicking ones that do.

So like maximize 1.00 * (1 + ECONOMY %) * (1 + GROWTH %) ... etc for all SEs.

The ECONOMY % value would be negative if below 0. The base values could still be modified by faction agenda or other factors like SPs or whether at war (fight). This assumes all the SEs are independent, which they aren't entirely. Such as ECONOMY, RESEARCH, EFFIC being positively correlated, PROBE and RESEARCH might be the best example of negatively correlated

Offline Bearu

Re: An explanation for the AI rarely running Green
« Reply #5 on: April 26, 2020, 01:56:29 AM »
From my understanding of the code, the AI sums the total of all the Social modifiers for the social models the faction has discovered and can run in the game (ie. ignores the player file aversion). The AI considers IMPUNITY, PENALTY,  Cloning Vat's impunity for Power and Thought Control, Network Backbone's impunity for cybernetic in the calculation of each social model's social effect values. Then the code modifies the sum of values with the Living Refinery's +2 SUPPORT, Ascetic Virtue's +1 POLICE, Manifold Nexus benefits for humans and Aliens, Faction SOCIAL benefits and penalties, ROBUST for the appropriate social effect (1/2 negative value), and Immunity for the appropriate Social effect (set to zero for appropriate negative value).  You then proceed and modify the values in the code laid out by the section and add or subtract values from the sum in local 1 dependent on the specific effect. The AI chooses the social models providing the best overall point benefit from the different modifiers. The maximum point value remains 256 points for combined sum of all the different values.

I split the different social effects because the social effect modifiers favor specific factions and provide more insight into why certain factions run certain social models. This explains unusual AI social model selection before the discovery of more social models. The process also includes changes in the game state relevant to the modified values where one value exceeds another value at some point.
Picture: Beldam
"I am half sick of shadows, said the Lady of Shallot."

Offline Nexii

Re: An explanation for the AI rarely running Green
« Reply #6 on: April 26, 2020, 03:28:13 AM »
Ah so it is better than I thought. I suppose the AI can't consider 'every' SE super important but here's my feelings on priority:

ECONOMY - underrates it strongly
EFFIC - about right (underrated for expansive empires)
SUPPORT - about right (overrated if it made clean units more as it should)
MORALE - overrates it
POLICE - about right (underrated if it made police units more as it should)
GROWTH - about right (though underrates stacking it to high amounts)
PLANET - about right (underrated strongly for factions with PSI or SPs that give PSI)
PROBE - about right
INDUSTRY - about right (though underrates stacking it to high amounts)
RESEARCH - about right

Others may have differing opinions. That feels like more underrated than over...but I guess its relative to those in the middle.
« Last Edit: April 26, 2020, 03:47:56 AM by Nexii »

Offline Induktio

Re: An explanation for the AI rarely running Green
« Reply #7 on: April 27, 2020, 06:36:41 PM »
I believe if someone rewrites  most of the original code in the section, then it might remain possible to fit your changes in the logic for the AI selection. The developers already added modifiers for SUPPORT, EFFIC, MORALE, and ECONOMY.

That has been done already if you refer to the social engineering model selection here. I rewrote all of that logic in Thinker Mod so that the AI would be able to consider the cumulative benefits of various social models and switch them based on the need to pop boom, for example. The config option is called "social_ai" in thinker.ini. The original code looked like such a mess I didn't see any point in patching it. It was very difficult to see any kind of clear logic in it, but I had only the raw disassembled form to work with.

As with most of the decision making in Thinker, the AI now iterates through all possible SE model changes each turn, calculates a score for each of them (plus some randomness), and then switches the SE model if necessary. Now the choices are much more like what a human player would do given a particular faction, but the AI still tries to maintain the flavor related to each faction.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: An explanation for the AI rarely running Green
« Reply #8 on: April 28, 2020, 02:42:54 AM »
Because by the time the AI suffers any ecodamage at all, the human player would be overwhelmed by it.

Which is the huge problem of Thinker Mod IMO.  It goes to town on this huge differential in ecodamage, building just silly numbers of Condensers and Boreholes that would put a human player 4000 meters underwater.  The original devs didn't do that.  They probably realized that 1/8th eco-damage was a hack to solve some other problem they were having.  Wasn't their plan to make that the way for the AI to curb stomp a human.

As for penalizing Green, although I might theoretically be interested in trying the INDUSTRY penalty idea, in practice I like everyone having an absolutely uniform amount of INDUSTRY.  When you aren't worrying about whether you can complete a Secret Project a little bit faster, it saves a lot of stress about switching back and forth between SE choices.  I don't miss having INDUSTRY as a tweak at all.
« Last Edit: April 28, 2020, 03:08:06 AM by bvanevery »

Offline Nexii

Re: An explanation for the AI rarely running Green
« Reply #9 on: May 03, 2020, 12:49:09 AM »
To add on this, the AI still doesn't really like Green all that much with penalties removed. AI seems to calculate a zero benefit for PLANET or EFFIC. Situationally it's taken still.

As far as the social emphasis, I have noticed that factions very rarely pick SEs outside their agenda. They'll often take Frontier/Simple/Survival if they don't like the benefits of their agenda. Which is nonsensical when their agenda has no downside

I suppose I can give Green a tertiery benefit, maybe GROWTH or RESEARCH, representing well-being or the knowledge that comes out of preserving planet. AI also seems to ignore TALENT which I think was mentioned before
« Last Edit: May 03, 2020, 02:40:13 AM by Nexii »

Offline Bearu

Re: An explanation for the AI rarely running Green
« Reply #10 on: May 03, 2020, 04:07:37 AM »
To add on this, the AI still doesn't really like Green all that much with penalties removed. AI seems to calculate a zero benefit for PLANET or EFFIC. Situationally it's taken still.

As far as the social emphasis, I have noticed that factions very rarely pick SEs outside their agenda. They'll often take Frontier/Simple/Survival if they don't like the benefits of their agenda. Which is nonsensical when their agenda has no downside

I suppose I can give Green a tertiery benefit, maybe GROWTH or RESEARCH, representing well-being or the knowledge that comes out of preserving planet. AI also seems to ignore TALENT which I think was mentioned before
I noticed the same behavior in the stock game. I cannot recommend much to fix the problem with the stock AI because the game's selection of the PLANET score remains very skewed. The AI needs a high sum of eco-damage for any significant positive values in PLANET, yet Eco-damage mostly originates from terraforming improvements and atrocities. These causes of eco-damage remain rare occurrences for the AI.
The AI does not explicitly ignore the TALENT value. The AI instead combines the TALENT score with a second round of POLICE modifiers in the code. I specifically targeted the area for a revision because the original code mixes the POLICE values twice in two separate calculations after the location developers clearly intended the original code for TALENT. In other words, the stock game confounds the variables.

More Details:
In the stock game, POLICE calculates POLICE values for 0 to -4 in one section and POLICE scores -5 to + 3 becomes modified into 0 to 8 for a second section of calculations with TALENT. The TALENT score from -4 to +3 as 0 to 7 gets added into the modified POLICE value in the second section.
Picture: Beldam
"I am half sick of shadows, said the Lady of Shallot."

Offline Nexii

Re: An explanation for the AI rarely running Green
« Reply #11 on: May 03, 2020, 05:01:38 AM »
Ah, interesting. Yes and also the AI gets a massive ecodamage reduction somewhere around 1/5th to 1/8th of a human player. So they need really low PLANET to care about PLANET. Which is a catch-22, of course. I'm guessing they had ecodamage as a primary consideration then realised the AI couldn't deal with it well, or it was causing global worm pop progression to get out of hand. Probably it wouldn't be too fun to the human player if every game had massive flooding because of AI terraforming. Ecodamage is very tough to balance I found even with all Yitzi's features added in for it. Personally I'm pretty okay with ecodamage being the secondary consideration, and PSI power being the primary. It's much harder to fight off boosted alien life with bad PLANET.

Seems you're right that +TALENT will entice Green agenda factions to consistenly pick it (at least Gaia, Cult is a bit less liking of it). As will +RESEARCH and +GROWTH. So there's a few thematic options to fix it.
« Last Edit: May 03, 2020, 06:12:03 AM by Nexii »

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: An explanation for the AI rarely running Green
« Reply #12 on: May 03, 2020, 07:24:36 PM »
To add on this, the AI still doesn't really like Green all that much with penalties removed. AI seems to calculate a zero benefit for PLANET or EFFIC. Situationally it's taken still.

Whether the AI will take it, depends on what else is available in the same row instead, and what the faction's restrictions are.  For instance I went through periods where my Planned / Socialist was obviously way too beneficial of a choice, and all the AIs obsessed about it.  So I removed benefits from that choice, until the AI factions weren't going nuts with it anymore.  Also my Deirdre has never been allowed to choose Free Market / Capitalist, just like the stock game.  Getting her to pick Green, was the whole point of my bug workaround exercise.  Green is her compulsion, she shouldn't be balking at it.  It is far less important if anyone else chooses Green.

The broad point is you can solve some of these problems with hand tuning.

Quote
I suppose I can give Green a tertiery benefit, maybe GROWTH

That's totally anti-narrative.

Quote
or RESEARCH,

Bad idea.  It means that selecting Knowledge really isn't a decision or tradeoff the player will have to make, because you're just going to sprinkle benefits and rewards no matter what they do.  Categories should mostly provide distinct tradeoffs that a human player has to decide between.

A corollary is that you'll run out of play mechanics to compare and contrast.  There are only so many, and in my experience there aren't enough to meaningfully flesh out the table, and keep things sanely balanced.

A corollary to the corollary, is some player will complain about the choices put in front of them, because some choices seem useless or not juicy enough.  Trying to explain "this is what the AI needs to function best" takes lots and lots of repetition, if the message gets through at all.

A corollary to the corollary to the corollary, is that redesigning the play mechanics is in order.  Whether at the binary level, or in a completely new commercial game.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: An explanation for the AI rarely running Green
« Reply #13 on: May 03, 2020, 07:33:02 PM »
I'm guessing they had ecodamage as a primary consideration then realised the AI couldn't deal with it well, or it was causing global worm pop progression to get out of hand. Probably it wouldn't be too fun to the human player if every game had massive flooding because of AI terraforming.


Indeed, and IIRC, there might have never been anything to guess at, at all.  I think the "stupid AI ruins the world with eco-damage" problem is readily observable in Civ II: Test of Time.  Can't use AI city automation because it won't build the recycling facilities and mass transit systems to mitigate the pollution problems.  Although, I could be misremembering, and it could have been Civ III.  Which would mean that nobody learned the lessons of SMAC.

Quote
It's much harder to fight off boosted alien life with bad PLANET.


Except that, in my current AAR I've come to realize there's this killer app attribute called "Empath Song".   :D  It merely gives you the equivalent Psi attack power of the Dream Twister.  I tend to forget that I can add this.  I'm wondering if I should tone it down.

Offline Nexii

Re: An explanation for the AI rarely running Green
« Reply #14 on: May 03, 2020, 08:34:08 PM »
I think you missed my point. I was saying that Green isn't consistently picked by the AI even if it gives +2 PLANET, +2 EFFIC with no downsides. Maybe a quarter of the time or half at best. It was preferring to say in Simple Economics the rest of the time because AI's don't like to pick choices against their Agenda. It has nothing to do with other choices in the category. And it would be the same case in your mod with +1 PLANET, +1 EFFIC.

So the question was what can Green have so the AI will always pick it? What is thematic? I went with +2 PLANET, +1 EFFIC, +1 RESEARCH instead. RESEARCH works to get Green agenda AIs to select it all the time. The concept would be that by preserving Planet, you learn about its ecosystems and therefore gain knowledge. Or just the need of having ecological researchers to properly preserve an economy.

Empath at 50% might be a bit strong. At -3 PLANET it's like going back to +0.5. At 0 PLANET it's like going to +5. And at +3 PLANET it's like having +9.5. I found that delaying dual ability units helped a lot, then you can't have the ultimate Trance+Empath native killers. Though I could see the case for decreasing Empath to around 25%. Especially with resonance weapons and armor being a thing.

 

* 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

Planet's Primary, Alpha Centauri A, blasts unimaginable quantities of energy into space each instant, and virtually every joule of it is wasted entirely. Incomprehensible riches can be ours if we can but stretch our arms wide enough to dip from this eternal river of wealth.
~CEO Nwabudike Morgan 'The Centauri Monopoly'

* 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: 37.

[Show Queries]