Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Topic started by: Bearu on April 25, 2020, 03:50:43 AM

Title: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: Bearu on April 25, 2020, 03:50:43 AM
I have been working on the AI Social engineering modifiers. This list covers all the  modifiers in the code. I expect certain sections will benefit any modifier of the stock factions.

I will start with ECONOMY. ECONOMY remains the most complex of the AI choices and this selection remains the only model I am not certain about in a few areas of values. I note those areas. The calculations occurred in the order I list them in this list.

This unused tidbit of code appears before Economy:
Unused in Stock Game:
Any faction with a CONQUER mandate: Local 2 always equals at least 1.

ECONOMY:
Important Variables:
Modified EFFICIENCY Value * 4 + Sum of Inefficiency scores for each base the faction controls. Moved into local 6.

ECONOMY -1 or lower (Special section ignored any modifiers from ECONOMY +0 or higher):
Jump to the final section:
Set economy modifier to -1.
If local 2 equals zero: -1 X 2

Skip to next section on Fight values after the +0 to +4 economy section.

ECONOMY Score (+1):
Not exactly certain:
The game checks 96 units AI plan for non defense status, and then sets a value to 1 and checks against an unknown flag. The number of units in the first part remain dependent on values for the units in a base. Unknown???
The value of the numerator remains the sum of units successful checked for non defense AI Plan and placed in a base??? The divisor remains the value of the unit last checked (min. 1 - max 3???).

Economy Score (+0)
Not exactly certain
Same as Economy +1 except the value after checking the unknown memory locationVirt and multiplying the result, you multiply the product by ECONOMY + 1 and subtract the final product from the numerator value. The divisor for the next and final step remains Local 2 + 1

ECONOMY Score +2 to +4
(Sum of tiles worked at each base this faction controls + ECONOMY Score (min. 2 - max. 4) * 2 - 4) / (Local 2. [war status] + 1.
If quotient from economy Scores of +0, +1, and +2 or more Economy greater than 0 and value from local 6 greater than 0, then decrease value of local 6 until either the quotient equals 0 or the value of local 6 reaches zero and place the remaining quotient (even negative) or 0 into local 6 (critical for later efficiency calculations).

0 or 1:
If current faction fight value 0 or higher, set the value of ecx modifier to 0.
If current faction fight value -1 or lower, compare local 2 value to 2 and jump if local 2 equal to or higher than 2. Set value to 0. If 0 or 1, than economy modifier equals 1.

(((0 or 1) + Discover * 2) + Build + 1) * Quotient, (Quotient * 2 for local 2 = 0), -1 for ECONOMY -1 or lower, or -2 for local 2 = 0 and ECONOMY -1 or lower.

(Unused) Social Mandates in Default Game:
BUILD and/or DISCOVER: Value X 2
EXPLORE and/or CONQUER: Value X .5

Stock AI Mandate modifiers:
Build: X 2
Build and Conquer: X 1
Build and Explore: X 1
Build and Discover: X 2
Any combination of Build with any other emphasis equals X 1
Any other combination of emphasis without Build yields X 1
Maximum interest yielded from Build and Discover combination from special value.

Divide the final value by local 3 (1-3) based on technology values.

Title: The Secrets of Alpha Centauri's AI Social Effect Selection: SUPPORT
Post by: Bearu on April 25, 2020, 03:55:27 AM
The support modifier employs the a virtual value where negative values remain considered only for the application of modifiers. Miriam possesses a high affinity for SUPPORT.

Load effective address: SUPPORT + 4: Value shown as 0 to 7 (-4 = 0 and +3 = 7)
x = Virtual SUPPORT value (0 to 7) * 4 + a memory segment that appears as zero I think (not 100% certain)

If actual SUPPORT value = -4:
3 * x = Virtual SUPPORT value (0 to 7) * 4 + a memory segment that appears as zero I think (not 100% certain) * 3
If local 2 = 0 skip the next section.
If local 2 = 1 or higher:
2 * x (max here of 6x) = Virtual SUPPORT value (0 to 7) * 4 + a memory segment that appears as zero I think (not 100% certain) * 2
If actual SUPPORT value > -3:
2 * x (maximum of 12 x here because -3 and -4 SUPPORT modifiers stack) or Virtual SUPPORT value (0 to 7) * 4 + a memory segment that appears as zero I think (not 100% certain) * 2
If actual SUPPORT value = to -1 OR -2 AND the faction ECONOMY score remains +1 or lower:
1.5 * x (max of 3x here because the previous modifiers besides the first after the check do not stack with this modifier)

Unused Faction Mandates in stock game: These values stack with each other (ie the Believers as a Conquer and Explore faction receive x * 6)
Conquer: x * 3
Explore: x * 2
Discover: x * .5

Stock game mandate modifiers: Modify x with the appropriate combination of Mandate combinations. (ie. Miriam receives a modifier of 4.5x)

Fight = 1: X 2

Explore: X 1.5
Discover: X .75
Build: X .5
Conquer: X 1.5
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: MORALE
Post by: Bearu on April 25, 2020, 04:17:00 AM
This section appears as the root cause of the AI's obsession for MORALE because the other modifiers work off these values. The other modifiers for MORALE remain a variable constant dependent on military power.
u = Sum for the # of bases this faction controls currently + the Faction military unit points (+1 for every military unit this faction controls and an additional +1 point for every Combat and Assault AI Plan military unit this faction controls in the current turn)
1. u * Local 2 (a value dependent on military unit calculated earlier) +1.
2. u * Local 2  * Faction "Fight" value + 2
3. u * Local 2  * Faction "Fight" value + 2 * modified MORALE value (Officially -6 to 6) 4. u * Local 2  * Faction "Fight" value + 2 * modified MORALE value (Officially -6 to 6)  * Local 3 (min. 1 - max. 3)
5. Then multiply by 9/8. I made an error in my previous valuation.
6. Multiply by stock mandate selection:
Fight 2 or higher (unused in stock game): X 2
Conquer: X 2
Conquer and Discover: X 2 (Spartans)
Conquer and Build: X 1 (Hive)
Conquer and Explore: X 1 (Believers)
Any other combination yields: X 1

Fight =< -1:
Conquer: X 1
Conquer and Explore: X 1
Conquer and Discover: X 1
Conquer and Build: X 1
Build and Explore: X .5 when the faction remains in a war mode
Discover: X.5 when the faction remains in a war mode.
Discover and Explore: X .5 when the faction remains in a war mode.
Discover and Build: X .5 when the faction remains in a war mode.
Explore ONLY: X1 (Gaians)
Conquer, Discover, Explore, and Build: X 1

Unused mandate modifiers: These modifiers stack with each other (ie. Miriam receives a modification of  u * 1.5 for Conquer = X 3 and Explore = X .5
CONQUER: X 3
EXPLORE and/or Build: X .5
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: EFFICIENCY
Post by: Bearu on April 25, 2020, 04:23:10 AM
Local value 6: Modified EFFICIENCY Values + Sum of inefficiency values from each base the faction controls and potentially modified in ECONOMY section.
Modified base Efficiency ranges 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. If local 2 remains = 0: Local 6 Value * 2
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)
Unused Alternate Mandate Check: These values stack
Discover: X 3
Conquer and/or Explore: X .5
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: GROWTH
Post by: Bearu on April 25, 2020, 04:26:31 AM
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 each faction bases' current population and base 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 stock Mandate checks:
Multiple Line 7 or 8 * 2 for factions with EXPLORE and CONQUER mandates in stock game.
EXPLORE and Conquer: X 2

Alternate Mandate Checks (unused)
Explore and/or Build: X 2
Discover: X.5

Edit: Added  population goal difference for GROWTH calculations. I forgot this variable.
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: POLICE
Post by: Bearu on April 25, 2020, 04:29:26 AM
This value in the original game covers parts of TALENT. I plan on making the game calculate all ranges of POLICE instead of only -4 to 0.

POLICE Score Part 1:
1. POLICE Score (-4 to 0 calculated as -2 to 2)

2. (# of Assault AI Plan Units with an unknown check before it * 2 + 1) * Modified POLICE Score * # of bases the current faction controls.

3. Current Faction Technology Points equal or less than the second faction tech points (Check from specific location)
AND
Current Faction might score equal to or less than the second might score (7 = weakest to 1 = strongest).
Value * 2

4. Current Faction Technology Points equal or greater than the second faction tech points (Check from specific location)
AND
Current Faction might score equal to or greater than the second might score (7 = weakest to 1 = strongest).
Value * .5
5. Value / 2 - Current Faction "Fight" Score (Final value of 1-3)

Unused in Stock Game:
Explore AND/OR Conquer: X 2
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: TALENT/POLICE
Post by: Bearu on April 25, 2020, 04:32:33 AM
TALENT/POLICE Score Part 2:

Talent Score (-4 to 3 calculated as 0 to 7)

Police Score (-5 to 3 calculated as 0 to 8 )

x = Modified TALENT Score + (Modified Faction TALENT Score * 8 ) + (Modified Faction Police Score)
 
u = x * 4 + Unknown constant data segment value (appears as 0)

If faction remains in a war mode (Local 2 > 0), then multiply number of bases a faction controls by the modified POLICE Score and add the value to u.
Bases * Modified Police + u
X = u + Modified Police Score * Current faction number of bases

Stock game Mandate modifiers:
Explore AND Discover: X * 2
Conquer AND Discover: X * .5
Conquer AND Build: X * .5
Any other combination X 1

Unused mandate modifiers:
Explore AND/OR Conquer mandates: X * 2 (Gaians, Peacekeepers, Hive, Spartans, and Believers all receive X 2)
Build and Discover without either Conquer or Explore: X * 1
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: PLANET
Post by: Bearu on April 25, 2020, 04:35:30 AM
PLANET
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

Unused Alternate Mandate modifiers:
Explore: X 2
Build: X .5
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: RESEARCH
Post by: Bearu on April 25, 2020, 04:37:42 AM
The simplest of the Social Effect AI.
RESEARCH:
RESEARCH Score (-5 to 5) * Sum of Laboratory Output from faction's bases * 2/3 * 2 if the faction possesses non-war status (Local 2 = 0) * Mandate modifiers.

Mandate Modifiers: (Unused in Stock Game)
Discover Mandate: X 2
Conquer Mandate: X .5
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: INDUSTRY
Post by: Bearu on April 25, 2020, 04:43:44 AM
Another simple AI appears in the INDUSTRY section.
INDUSTRY:
[Local 3.] (1-3): Technology lead variable
If less than 1, replace with 1.
If greater than 2, replace with value of 2 (Bug; should be 3).
If less than or equal to 2, replace with value of Local 2. (aka 1 or 2)

Final formula for calculating the value of an industry.
((Local 2 + Build) + (Local 2 + Build) + 1) * Sum of Current Faction's Base Populations * Local 3 (1-3) * INDUSTRY Score * 2/3 * Faction mandate scores

AI Mandates Modifiers: These stack with each other. Yang receives for example a X 3 modifier.

Conquer: X 2
Build: X 1.5
Discover: X .5

Fight < 0:
Any faction without a Build emphasis: X .5

No alternate mandate modifiers for the rest of the AI effects.
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: Upheaval Bonus
Post by: Bearu on April 25, 2020, 04:46:16 AM
Who would have thought upheavals provided additional values for the AI? This formula affects all values except PROBE which occurs after this section.

AI Only:
+0 interest if no social model changes.
Otherwise:
Social Model Changes + 1 (min. 2 to max. 5)

x = ((Social Model Changes + 1 * Social Model Changes + 1) * Social Model Changes + 1) * 3 for human player or * Faction difficulty level for AI Player (1 = easiest difficulty to 5 = transcend)

If an Alien faction: X * .5

Multiply by *.5 and add to the interest local value.
Title: The Secrets of Alpha Centauri's AI Social Effect Selection: PROBE
Post by: Bearu on April 25, 2020, 04:51:05 AM
The PROBE Modifiers feel like an after thought. I suspect the developers added PROBE late in the game's development.

PROBE:
Ignore for any social models or factions with 0 in PROBE.

+1 in ECX per cycle: Perform these checks for each faction beside the current faction.
Retain ECX values between checks.

Relationship modifiers:
Value X .5 for each pact with another faction
Ignore the modifiers until the faction base empahsis if the first faction "wants revenge" on the second faction.
Value X .5 for each treaty with another faction
Value X. 5 for each faction the current faction does not have a truce with
Value X .5 for each faction the current faction is not at war.

Move an unknown constant into the rountine (starts at 0 outside the rountine) + Add # of bases the current faction controls * PROBE modifier (-2 to 3) * (Modified Value of ECX from the Relationship flags check) * .5 * Mandate modifiers 

Mandate Modifier:
X2 for a faction with either BUILD or DISCOVER

This finishes the modifiers for important AI Social effects.
Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection: POLICE
Post by: bvanevery on April 28, 2020, 05:19:15 AM
I plan on making the game calculate all ranges of POLICE instead of only -4 to 0.

Good idea.  I made some predefined units with Non-Lethal Methods, and I was able to get the AI to use them.  I had to reduce my Democratic penalty for POLICE from -2 to -1, because the stock AI was too dumb to evaluate whether it should be using police units or not.  My compromise was to make the sum of all Politics and Economics choices be POLICE friendly, with only Democratic giving a -1 penalty.

I had already long since moved the POLICE penalties out of Free Market, which later I renamed to Capitalist.  The idea that a Free Market would be opposed to the use of police, is completely stupid IMO.  Look at the USA, ever heard of the Prison Industrial Complex?  Prisons are a profit center, we incarcerate more people per capita than any nation in the world.  Instead I moved the POLICE penalties to Democratic, Knowledge, and Cybernetic, so that a player can mix and match instead of having to swallow an egregious -5 POLICE for some SE choice.  Knowledge does make narrative sense, academics wanting to be free and freedom of information and all of that.

Not so sure about Cybernetic vs. Eudaimonic.  I just repeated the idea of POLICE being a RESEARCH restriction.  I'm not sure how I'd penalize Cyborgs if not with POLICE, as there are only so many play mechanics to choose from.  Not sure GROWTH makes any sense, as cyborgs could just replicate, or replicate substantial parts of a body.  I mean what's the Cyborg Factory for?
Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: Nexii on April 28, 2020, 04:52:15 PM
I gave Cybernetic (AI Control) negative PROBE. Automated systems always end up getting hacked. Same with the faction negative PROBE.

Eudaimonic (Utopian) got the negative POLICE, usually utopian societies are depicted as peaceful and light on population control. MORALE I guess wasn't a bad penalty but thinking in the vein of like Star Trek, they still make impressive war ships and have strong military training.

Yea I also found -5 POLICE too extreme for the early game, tried that on Democracy. Now I have Demo and Knowledge each giving -2.
Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: bvanevery on April 29, 2020, 05:59:35 AM
I gave the Cybernetic Consciousness +1 PROBE.  They are Borg.  They inject nanites into you.  Well not really, actually they just study attack and defense algorithms in kindergarten.  Funny how "automated systems" can mean any value to any person.  I mean if society gets far enough along, what's the real hack?  Touching things in real life, instead of doing it all through a virtual world?

Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: Nexii on April 29, 2020, 09:07:23 PM
PROBE is a tough SE because it might not be the best name for what it's really describing. And sometimes it's sort of a double edged sword. A great AI algorithm or technology might both assist probe offensively and make a faction more vulnerable. More broadly I see it as how good a faction is at espionage, and secondarily its resistance to propaganda. Which might be two seperate things lumped in

I still say negative probe for the borg. Using Star Trek, Data shut down the borg cube with a probe type attack to sleep. Their assimiliation is represented by TECHSTEAL, they have to conquer and capture to get tech. They aren't good at being sneaky on their own, too collectivistic to have individual spy operatives.

Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: bvanevery on April 30, 2020, 04:07:15 AM
Data shut down the borg cube with a probe type attack to sleep.

Selective observation.  Seven of Nine stuck her hand into someone's neck and turned them into a borg.  Being "probed" is quite literal there!  Even talking about the borg as a SMAC-like society is not meaningful.  This is a race that conquered much of the galaxy, with very few species they ran into that could resist them.  They're at a level of social organization and conquest waaaaaay beyond any faction or race depicted in SMAC.

Like when you are God, you can afford not to notice flies buzzing around.  Usually.  Humans ended up assuming the role of a virus, in the borg collective body.
Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: Alpha Centauri Bear on September 06, 2020, 06:56:04 PM
Thank you for researching that. Didn't understand what is it about, though. Are you saying that certain PC faction predispositions amplify the SE effects for them???
Can you share exact location of this in the code?
Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: Bearu on September 10, 2020, 08:09:14 PM
Thank you for researching that. Didn't understand what is it about, though. Are you saying that certain PC faction predispositions amplify the SE effects for them???
Can you share exact location of this in the code?

Each of the faction files contain a set of values for the BUILD, EXPLORE, DISCOVER, CONQUER, and FIGHT AI values of a faction. This comes from the stock game for the Human Hive:
Human Hive, The Despot, Hive, M, 1, Yang, M,  1,  1, 0, 1, 0,
The Hive possesses a mandate emphasis on FIGHT = 1, CONQUER, and BUILD. This means the AI for the Hive receives a modifier for positively or negatively selecting for Social Models in the social engineering screen after other modifiers in each section with these positive or negative values of INDUSTRY X 3, PROBE X 2, SUPPORT X1.75, X1 for ECONOMY, GROWTH, MORALE, RESEARCH, POLICE, and X.5 for PLANET, TALENT, and EFFIC.
This means the AI for the Hive receives for the Planned Social Engineering Model three times the points in the INDUSTRY Value, regular points for the GROWTH value, and one half the negative points for the EFFIC Value (This value is 0 in the stock game due to the Hive's IMMUNITY to EFFIC effect). The AI in SMAX selects Social Models based on the sum of points collected based on the output of values for each social model compared to each other output for social models in a category and collectively for the whole table. The AI mandates modify the points from each Social Effect calculated in each Social Model.


005B4A43: The start of the location for the movement of the address values for the BUILD, CONQUER, DISCOVER, and EXPLORE values from each faction file into local arguments for future calculations. The game mostly checks these local arguments for whether the values are either zero or not zero.
The Address locations for each social effect are:
005B4804: Start of Faction File AI Mandate Modifiers for ECONOMY
005B4CF4: Start of Faction File AI Mandate Modifiers for SUPPORT
005B4E80: Start of Faction File AI Mandate Modifiers for MORALE
005B4F0F: Start of Faction File AI Mandate Modifiers for EFFIC
005B4FCF: Start of Faction File AI Mandate Modifiers for GROWTH
005B50AF: Start of Faction File AI Mandate Modifiers for POLICE
005B5128: Start of Faction File AI Mandate Modifiers for TALENT
005B51C4: Start of Faction File AI Mandate Modifiers for PLANET
005B524F: Start of Faction File AI Mandate Modifiers for RESEARCH
005B5242: Start of Faction File AI Mandate Modifiers for INDUSTRY
005B5430: Start of Faction File AI Mandate Modifiers for PROBE


I hope this answers your questions on the AI's selection of Social Engineering Models based on the Positive and Negative Social Effects inside the Social Engineering Models and the effects of modifiers on these point totals.
.
Title: Re: The Secrets of Alpha Centauri's AI Social Effect Selection
Post by: Alpha Centauri Bear on September 10, 2020, 08:16:50 PM
Thanks, man. Very interesting info.
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: 17.

[Show Queries]