Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Topic started by: Dio on May 29, 2015, 03:43:58 PM

Title: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 03:43:58 PM
I am currently looking into functions that play an important role in determining various aspects of the AI behavior. I plan to release a text file with most of the information I have gathered once I have sufficently compiled accurate material. Presently, this thread is for any .exe coders that want to share the known functions of procedures or memory addresses with flags they have analzyed. I will start with the procedure at 005B9580. I know part of this procedure interacts Unit AI Plans. In particular it is switch 2 of 13 (hexadecimal) that interacts with the AI Unit Plans. In addition, Switch 6  of 13 interacts with Unit special ability flags. Finally, the most frequently called switch in the procedure is switch 2.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 03:49:57 PM
Here are some additional flags I have discovered:

0090E8EC: Custome Game Rules Flags
Do or Die: Don't restart eliminated players: 1
Total War: Allow Victory by Conquest: 2
Mine, All Mine: Allow Economic Victory: 4
Peace in Our Time: Allow Diplomatic Victory: 8
Look First: Flexible starting locations: 10
Tech Stagnation: Slower rate of research discoveries: 20
Intense Rivalry: Opponents more aggressive: 40
Time Warp: Accelerated Start: 80
No Unity Survey: World Map not visible: xh, 1 or 100
Blind Research: Cannot set precise research goals: xh, 2 or 200
Iron Man: Save/Restore restricted to exit: xh, 4 or 400
Higher Goal: Allow Victory by Transcendence: xh, 8 or 800
One for All: Allow Cooperative Victory: xh, 10 or 1000
No Unity Scattering: Supply Pods only at landing sites: xh, 20 or 2000
Spoils of War: Steal tech when conquer base: xh, 40 or 4000
Bell Curve: No Random Events: xh, 80 or 8000

0090E8F0:
Randomize faction leader personalities: 80 00 00
Randomize faction leader social agendas: 1 00 00 00
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 04:06:21 PM
Some more Flags for the interested:
0090EA68 <Current Base Governor Options>
Governor manages production: 1
Governor may HURRY production: 20
Governor manages citizens and specialists (including Drone Riots): 40
Governor sets new units to "fully automate": 80
Governor may produce land combat units/ Governor may produce units with Offensive AI Plan: xh, 2 or 2 00 at 004FD77E
Governor may produce naval combat units/ Governor may produce units Naval Superiority AI Plan: xh, 4 or 4 00 at 004FD7D8
Governor may produce air combat units/Governor may produce units with Planet Buster AI units: xh, 8
or 8 00 at 004FD7D1
Governor may produce land defense units/ Governor may produce units with Defensive AI Plan: xh, 10 or 10 00 at 004FD7B4
Governor may produce Combat AI Plan Units: 12 00 at 004FD78A
Governor may produce air defense units/ Governor may produce units with Air Superiority AI Plan: xh, 20 or 20 00 at 004FD7CA
Governor may produce terraformers/ Governor may produce units with Terraforming AI Unit Plans: 80 00/ edi
Governor may produce base facilities: 1 00 00/ esi
Governor may produce colony pods/ Governor may produce units with Colonization AI Unit Plan: 2 00 00
Governor may produce secret projects: 4 00 00
Governor may produce prototypes: 8 00 00
Governor may produce probe teams/ Governor may produce units with Info War AI Unit Plan: 10 00 00
Governor may use multiple priorities: 20 00 00
Governor may produce scout/exploration units/ Governor may produce Units with Reconnaissance AI Plan: 40 00 00
Governor may produce troop transports/Supply Convoys/ Governor may produce units with Naval Transport AI Plan and units with the Supply Convoy AI Plan: 80 00 00
Governor set base to EXPLORE: 1 00 00 00
Governor set base to DISCOVER: 2 00 00 00
Governor set base to BUILD: 4 00 00 00
Governor set base to CONQUER: 8 00 00 00
Governor is active: 80 00 00 00
Governor automatically manages Citizens and Drone Riots at Base (Including Nerve Stapling): 80 00 00 40
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 04:13:20 PM
Flags related to Faction Bonuses/Penalites
00946F58: x= memory register (a,b,c,d)
TECHSTEAL: xl, 10
TECHSHARE: Xdx, 20
WORMPOLICE: xl, 40
ALIEN: xl, 80
AQUATIC: xh, 1 or 100
FREEPROTO: xh, 2 or 200
FANATIC: xh, 4 or 400
MINDCONTROL: xh, 8 or 800
COMMFREQ: xh, 10 or 1000
TERRAFORM: xh, 20 or 2000
INTEREST, 0:, xh, 40 or 4000
MORALE, 0: xh, 80 or 8000

00946F60:
TECH, [Short Name]: 0
UNIT: 1
FACILITY: 2
SOCIAL: 3
IMMUNITY: 4
IMPUNITY: 5
PENALTY: 6
FUNGNUTRIENT: 7
FUNGMINERALS: 8
FUNGENERGY: 9
ROBUST: 0A
VOTES: 0B
FREEFAC: 0C
REVOLT: 0D
NODRONE: 0E
FREEABIL: 0F
PROBECOST: 10
DEFENSE: 11
OFFENSE: 12

Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 04:36:00 PM
Known Flags related to AI Strategies and Personalities. I know of additional flags associated with these addresses that I have not confirmed currently:

 0096C9E0:
 Progenitor Victory: 10 00 00
 Strategy: Attack enemy HQ: 20 00 00
 Cooperate with human player: 40 00 00
 Team up against human player: 80 00 00
 Commit atrocities wantonly: 1 00 00 00
 Obliterate captured bases: 2 00 00 00
 Emphasize Land Power: 4 00 00 00
 Emphasize Sea Power: 8 00 00 00
 Emphasize Air Power: 10 00 00 00
 Strategy: Search Objectives: 20 00 00 00
 Strategy: Defend Objectives: 40 00 00 00
 Strategy: Attack Objectives: 80 00 00 00

0096EA70:
Strategy: Lots of colony pods: 1
Strategy: Lots of terraformers: 2
Strategy: Lots of sea bases: 4
Strategy: Lots of probe teams: 8
Strategy: Lots of missiles: 10
Shamelessly betray human player: 20
Strategy: Lots of artillery: 40
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 04:47:34 PM
More memory addresses and their associated known flags. Their are more flags associated with these memory addresses that I am uncertain as to their function at this time.

009A649C:
Do or Die: Don't restart eliminated players: 1
Total War: Allow Victory by Conquest: 2
Mine, All Mine: Allow Economic Victory: 4
Peace in Our Time: Allow Diplomatic Victory: 8
Look First: Flexible starting locations: 10
Tech Stagnation: Slower rate of research discoveries: 20
Intense Rivalry: Opponents more aggressive: 40
Time Warp: Accelerated Start: 80
No Unity Survey: World Map not visible: xh, 1 or 100
Blind Research: Cannot set precise research goals: xh, 2 or 200
Iron Man: Save/Restore restricted to exit: xh, 4 or 400
Higher Goal: Allow Victory by Transcendence: xh, 8 or 800
One for All: Allow Cooperative Victory: xh, 10 or 1000
No Unity Scattering: Supply Pods only at landing sites: xh, 20 or 2000
Spoils of War: Steal tech when conquer base: xh, 40 or 4000
Bell Curve: No Random Events: xh, 80 or 8000
Unity Pods never produce resources: 1 00 00
Unity Pods never produce monoliths: 2 00 00
Unity Pods never produce artifacts: 4 00 00
Solo Mission: only human player victory/defeat: 8 00 00, esi
Force player to play current faction: 10 00 00
No native life--fungus, mind worms, Planet, etc.: 20 00 00
No colony pods can be built: 40 00 00
No terraforming (raising/lowering): 80 00 00
Force current difficulty level: 1 00 00 00
No technology trading: 2 00 00 00
No technological advances: 4 00 00 00
Objective Units must reach friendly objective base: 8 00 00 00
Objective Units must reach friendly HQ base: 10 00 00 00
All bases count as objectives: 20 00 00 00, edi
Secret Projects count as objectives: 40 00 00 00
No secret projects can be built: 80 00 00 00

009A64C0:
Each square of territory counts as objective: ch, 80 or 80 00
All artifacts are objective units: 4 00 00
Highest Alpha Centauri Score wins: 8 00 00
Diplomatic Victory Achieved: 20 00 00 at 0052C17B
Economic Victory Achieved: 40 00 00
All terrain enhancements count as objectives: 2 00 00 00
Base facilities as objectives: 4 00 00 00
Each population unit counts as objective: 20 00 00 00
Each technology counts as objective: 40 00 00 00
Each energy credit counts as objective: 80 00 00 00

009A681C:
Unity pods never produce vehicles: 1
Unity pods never produce tech: 2
No planetary council: 4
No social engineering: 8
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 05:12:34 PM
Here are some procedures with their associated functions:
00559060: Shows the Faction Leader Name in strings for Diplomatic Interactions.
005590A0: Shows the Faction Leader's Title in strings for Diplomatic Interactions.
005590E0: Shows the Faction Leader Adjective in strings for Diplomatic Interactions.
00559100: Shows the Faction Leader Perjorative in strings for Diplomatic Interactions.
00559120: Shows the General Faction Adjective in strings for Diplomatic Interactions.
00559140: Shows the General Faction Perjorative in strings for Diplomatic Interactions.
00559160: Shows the Faction Leader Derarogatory Name in strings for Diplomatic Interactions.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 05:25:50 PM
005BF1F0: Is one of the procedures that controls the appearance of Special Ability Names in Scripts.
The associated value for each Special Ability is as follows:
   Super Former: 1
   Deep Radar: 2
   Cloaking Device: 4
   Amphibious Pods: 8
   Drop Pods: 10
   Air Superiority: 20
   Deep Pressure Hull: 40
   Carrier Deck: 80
   AAA Tracking/Tracking Lasers: 1 00
   Comm Jammer: 2 00
   Antigrav Struts: 4 00
   Empath Song: 8 00
   Polymorphic Encryption: 10 00
   Fungicide Tanks: 20 00
   High Morale: 40 00
   Heavy Artillery: 80 00
   Clean Reactor: 1 00 00
   Blink Displacer: 2 00 00
   Hypontic Trance: 4 00 00
   Heavy Transport: 8 00 00
   Nerve Gas Pods: 10 00 00
   Repair Bay: 20 00 00
   Non-Lethal Methods: 40 00 00
   Slow Unit: 80 00 00
   Soporific Gas Pods: 1 00 00 00
   Dissociative Wave: 2 00 00 00
   Marine Detachment: 4 00 00 00
   Fuel Nanocells: 8 00 00 00
   Algorithimic Enchancement: 10 00 00 00
Title: Re: Analyzed Procedures and Flags
Post by: Yitzi on May 29, 2015, 05:52:48 PM
I am currently looking into functions that play an important role in determining various aspects of the AI behavior. I plan to release a text file with most of the information I have gathered once I have sufficently compiled accurate material. Presently, this thread is for any .exe coders that want to share the known functions of procedures or memory addresses with flags they have analzyed. I will start with the procedure at 005B9580. I know part of this procedure interacts Unit AI Plans. In particular it is switch 2 of 13 (hexadecimal) that interacts with the AI Unit Plans. In addition, Switch 6  of 13 interacts with Unit special ability flags. Finally, the most frequently called switch in the procedure is switch 2.

5B9580 takes the unit whose number is passed in argument 1, and finds the number of units in that square fulfilling certain other properties (depending on the other arguments, one of which is the switch).  So not purely AI.

(Also, be aware that AI unit plans, despite the name, are not purely AI-relevant; many other properties, such as ability to convoy resources or carry units, also seem to depend on this value.)

Here are some additional flags I have discovered:

0090E8EC: Custome Game Rules Flags
Do or Die: Don't restart eliminated players: 1
Total War: Allow Victory by Conquest: 2
Mine, All Mine: Allow Economic Victory: 4
Peace in Our Time: Allow Diplomatic Victory: 8
Look First: Flexible starting locations: 10
Tech Stagnation: Slower rate of research discoveries: 20
Intense Rivalry: Opponents more aggressive: 40
Time Warp: Accelerated Start: 80
No Unity Survey: World Map not visible: xh, 1 or 100
Blind Research: Cannot set precise research goals: xh, 2 or 200
Iron Man: Save/Restore restricted to exit: xh, 4 or 400
Higher Goal: Allow Victory by Transcendence: xh, 8 or 800
One for All: Allow Cooperative Victory: xh, 10 or 1000
No Unity Scattering: Supply Pods only at landing sites: xh, 20 or 2000
Spoils of War: Steal tech when conquer base: xh, 40 or 4000
Bell Curve: No Random Events: xh, 80 or 8000

0090E8F0:
Randomize faction leader personalities: 80 00 00
Randomize faction leader social agendas: 1 00 00 00

This could be very useful.  Thanks.

005BF1F0: Is one of the procedures that controls the appearance of Special Ability Names in Scripts.
The associated value for each Special Ability is as follows:
   Super Former: 1
   Deep Radar: 2
   Cloaking Device: 4
   Amphibious Pods: 8
   Drop Pods: 10
   Air Superiority: 20
   Deep Pressure Hull: 40
   Carrier Deck: 80
   AAA Tracking/Tracking Lasers: 1 00
   Comm Jammer: 2 00
   Antigrav Struts: 4 00
   Empath Song: 8 00
   Polymorphic Encryption: 10 00
   Fungicide Tanks: 20 00
   High Morale: 40 00
   Heavy Artillery: 80 00
   Clean Reactor: 1 00 00
   Blink Displacer: 2 00 00
   Hypontic Trance: 4 00 00
   Heavy Transport: 8 00 00
   Nerve Gas Pods: 10 00 00
   Repair Bay: 20 00 00
   Non-Lethal Methods: 40 00 00
   Slow Unit: 80 00 00
   Soporific Gas Pods: 1 00 00 00
   Dissociative Wave: 2 00 00 00
   Marine Detachment: 4 00 00 00
   Fuel Nanocells: 8 00 00 00
   Algorithimic Enchancement: 10 00 00 00

In particular, 5BF1F0 tests if unit number arg1 has any of the abilities whose corresponding bits are set in Arg2.  (Usually, only one such bit is set so it only tests for that ability, but it could be used to test for multiple abilities simultaneously.)

The order is simply the order in which they appear in alphax.txt.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 29, 2015, 09:54:13 PM
Some flags I know for certain that pertain to Diplomatic relationships.

0096C9F8:
Pact: 1
Treaty: 2
Truce: 4
Commfreq: 8
Vendetta: 10
I want revenge: 20
I shall betray: 4 00
I have infiltrator: 10 00/ edi
I want to talk: 20 00
I am atrocity victim: 4 00 00
I have surrendered: 2 00 00 00
Title: Re: Analyzed Procedures and Flags
Post by: Geo on May 29, 2015, 11:25:11 PM
Those sounds like the diplo flags in the scenario editor.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on May 30, 2015, 12:31:24 AM
Those sounds like the diplo flags in the scenario editor.
Your observation is correct.
Title: Re: Analyzed Procedures and Flags
Post by: Yitzi on May 31, 2015, 03:57:24 AM
Some flags I know for certain that pertain to Diplomatic relationships.

0096C9F8:
Pact: 1
Treaty: 2
Truce: 4
Commfreq: 8
Vendetta: 10
I want revenge: 20
I shall betray: 4 00
I have infiltrator: 10 00/ edi
I want to talk: 20 00
I am atrocity victim: 4 00 00
I have surrendered: 2 00 00 00

Actually, for the relationship faction #x has with faction #y, these are at 96C9F8+20CC*x+4*y.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on August 05, 2015, 11:22:10 PM
It appears as though the procedure at address 005B0E00 has some important impacts on the appearance on certain AI Editor traits.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on August 05, 2015, 11:32:21 PM
It appears as though part of the controls for AI production of colony pods is at address 004FB69C. What I have read so far is this:
If the current base population is less than 2, and the nutrient surplus of the base exceeds the mineral surplus, and nutrient surplus is equal to or greater than 1; than produce a colony pod.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on September 29, 2015, 01:43:27 AM
The procedure that starts at address 005AEDE0 controls various functions relating to the Accelerated Start Rule.
The procedure that starts at address 005B0420 controls various functions related to a non-accelerated start in the game.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on September 29, 2015, 02:16:55 AM
I also noticed that if the difficulty level on the scenario or game is Specialist or lower, than certain faction AI traits are not activated at the beginning of a game.
Aquatic Factions always start with the Emphasize Sea Power and Lots of Sea Bases options activated.
Alien Factions always have the Emphasize Air Power and Lots of Missiles options activated at the start of a game.
The Data Angels always start with the Lots of Probe Teams option activated.
The Free Drones always start with the Lots of Terraformers option activated.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on September 29, 2015, 02:20:35 AM
I also noticed that if the global difficulty level is at Talent or lower, than the AI factions receive a -2 Penalty to AI Nutrient Reserves for Base Growth (The value that the nutrient surplus from a base goes into each turn).
Title: Re: Analyzed Procedures and Flags
Post by: Dio on September 30, 2015, 11:37:24 PM
I knew the AI involved with the Believers was less than friendly, but I never expected it to have such negative attiudes towards many aspects of diplomacy. The following is information that I presently believe about this AI:
1. The Believer AI never purchases Technology from a human player while selecting the diplomatic option that says the faction needs energy credits.
2. The cost of purchasing bases from the believers is increased compared to other factions.
3. The benefit from giving them technology as gifts appears reduced compared to other factions.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 02, 2015, 04:38:10 PM
I am uncertain about the meaning of these features and the numbers that appear. They only operate while the scenario editor editor remains active. One of the features allows the toggling on and off of the faction boundaries. Another feature makes the colored numbers and letters appear. The letter in each case corresponds with the first letter of each faction adjective name. I have attached a screenshot with all the features active.
Title: Re: Analyzed Procedures and Flags
Post by: Yitzi on October 02, 2015, 06:30:22 PM
I am uncertain about the meaning of these features and the numbers that appear. They only operate while the scenario editor editor remains active. One of the features allows the toggling on and off of the faction boundaries. Another feature makes the colored numbers and letters appear. The letter in each case corresponds with the first letter of each faction adjective name. I have attached a screenshot with all the features active.

Interesting.  What is the feature that makes them appear?
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 02, 2015, 07:05:18 PM
The area that requires changes appears at addresses 0051A39E, 0051A3B8, and 0051A3D5 in Scient's 2010 SMAX Patch. These features will function if you replace the conditional jumps with no operation commands. The scenario editor must remain active in order to view these features because they appear alongside the keyboard shortcuts for numbers in the scenario editor. I also believe these unused shortcuts were developer tools employed to check various aspects of the code inside the game. The $ shortcut makes the white numbers appear, the % shortcut makes the numbers and letters with color appear, and the * shortcut toggles the faction territory boundaries on and off.
Title: Re: Analyzed Procedures and Flags
Post by: Yitzi on October 02, 2015, 10:41:41 PM
The area that requires changes appears at addresses 0051A39E, 0051A3B8, and 0051A3D5 in Scient's 2010 SMAX Patch. These features will function if you replace the conditional jumps with no operation commands. The scenario editor must remain active in order to view these features because they appear alongside the keyboard shortcuts for numbers in the scenario editor. I also believe these unused shortcuts were developer tools employed to check various aspects of the code inside the game. The $ shortcut makes the white numbers appear, the % shortcut makes the numbers and letters with color appear, and the * shortcut toggles the faction territory boundaries on and off.

Ok...I would have to check the code to figure out what they do, and that would take enough time that it's not worth doing unless other people want it...
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 02, 2015, 11:08:38 PM
The area that requires changes appears at addresses 0051A39E, 0051A3B8, and 0051A3D5 in Scient's 2010 SMAX Patch. These features will function if you replace the conditional jumps with no operation commands. The scenario editor must remain active in order to view these features because they appear alongside the keyboard shortcuts for numbers in the scenario editor. I also believe these unused shortcuts were developer tools employed to check various aspects of the code inside the game. The $ shortcut makes the white numbers appear, the % shortcut makes the numbers and letters with color appear, and the * shortcut toggles the faction territory boundaries on and off.

Ok...I would have to check the code to figure out what they do, and that would take enough time that it's not worth doing unless other people want it...
I believe that the values inside the procedure simply correspond to various overlays that the game can apply to the world map. As an example, the game uses the same type of process to show the patrol path of units on the world map.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 08, 2015, 11:48:48 PM
The procedure that starts at address 0052AEB0 controls the AI tendency to call or to support the council proposals. A few things I noticed include the following effects on the AI:
1. The Global Trade Pact Proposal AI interest decreases if the Faction Commerce Rate is equal to or lower than the faction that called the proposal. The interest in this proposal increases by 1 if the faction has a treaty or pact with the faction that called the proposal. The interest in this proposal increases if the AI has an interest in Build (set to 1). The interest in this proposal decreases if the faction has an interest in Conquer (set to 1). The interest in this proposal decreases if the faction has an aggresive value of 1 (AI Fight Value set to 1). The interest in this proposal increases if the faction has an ECONOMY score of 2 or higher. The interest in this proposal decreases if the faction has an ECONOMY score of -1 or lower. The sum from these effects become reversed if the proposal is the repeal global trade pact proposal (This means if it increased the value for the Global Trade Pact proposal it means that it decreases the value for repeal Global Trade Pact Proposal).
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 09, 2015, 12:04:42 AM
The AI effects of the Repeal U.N. Charter proposal include the following effects:
1. It first checks the technology pre-requisites to see if the faction has the needed tech. The game then checks a section that checks the number of planetbusters the faction controls and another value that I am uncertain about its meaning. The interest in this value decreases if the AI has a Fight Value of -1. The interest in this value decreases by 2 if the faction has an Discover and Explore AI value set to 1 (A.K.A. The Peacekeepers). It then adds the number of minor atrocities the faction has commited to the value. The procedure than adds 1 to the interest value if the faction has a fight value of 1. The procedure lastly increases the value by 1 if the faction has a Conquer value of 1.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 09, 2015, 04:41:40 AM
The salvage unity core proposal functions as follows for the AI:
1. If the faction has an interest in Power other than 0 (Conquer set to 1), place a value of 1 into Local 1 (AI interest in Proposal).
2. If the faction has a Fight interest of -1, than decrease AI interest in Proposal by 1.
3. If the faction has more than 500 Energy Credits in reserve, than decrease the interest in this proposal by 1.
4. If the faction has equal to or less than 99 energy credits in reserve, than increase the interest in this proposal by 1.
5. If the faction has equal to or less than 199 energy credits in reserve, than increase the interest in this proposal by 1.
6. If the faction that made the proposal has equal to or less than the number of energy credits of the current faction, decrease the value by 1. Otherwise, increase the value by 1. If the economy income of this faction is lower or equal to the energy income of the other faction, than decrease the value by 1. Otherwise, increase the value by 1.
7. The procedure than jumps if the total value from step six is equal to or less than 0 (the range of values varies from -2 to 2). If it greater than 0, it subtracts the value in edx from the value in step 6 and adds approximately 1/2 this value to the value used to determine AI interest in this proposal.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 09, 2015, 08:50:36 PM
The process to determine support from the AI with regards to the Elect Planetary Governor Proposal remains complicated due to numerous expections within the procedure. This does not mean, however, I could not figure specific aspects of the code. The procedure first ranks the factions by the number of votes they have as determined by summing the population of the faction bases, and adding any applicable modifiers from Clinical Immortality, The Empath Guild, and the VOTES Faction Power. The factions receive a ranking from 1-7 in votes. After this point, it checks to see which factions remain eligible to become planetary governor based upon the intial vote tally for that faction. It then jumps if the faction is not a faction eligible to become Planetary Governor. The section for non-eligible candiates first checks to see if the faction has a pact and surrendered to the faction that wants the vote. If the faction has surrendered and has a pact with the faction, insert a value of 99 into the local address that controls AI interest in this area. It then jumps if this condition is met over much of the procedure.  :( This is not all the expections within this procedure.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 09, 2015, 11:41:25 PM
I discoverd on Thinker difficulty that the AI essentially receives additional energy credits each turn equal to approximately 0.3 * Total Maintenance Cost for facilities controlled by the faction that require support with the product rounded up (e.g. 3.5 rounds to 4) or down (e.g. 3.4 rounds to 3) to the closest whole integer. On transcend difficulty the AI receives additional energy credits each turn approximately equal to 0.6 * Total Maintenance Cost for facilities controlled by the faction that require support with the product rounded up or down to the closest whole integer. The AI doe not receive a bonus on any difficulty level equal to or lower than Librarian. The calculations involving the facility maintenance cost, if this condition applies to the faction, uses the value after applying the Self-Aware Colony effect to determine the extra energy credits earned.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 10, 2015, 12:09:51 AM
It appears as though the native life against AI faction units receive penalities in addition to ignoring the non-combat unit penalty during the first 15 years of a game. I need to perform additional analysis before I can provide more precise results.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 10, 2015, 11:25:54 PM
It appears as though the AI will not attempt to bribe the human player to vote for them in governor elections if the difficulty level is Citizen.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 10, 2015, 11:48:04 PM
I noticed that the game ignores a techcost increase for human players if the game difficulty is Specialist or below. I also noticed that the function to determine the number of atrocities a faction needs to exceed in order to have the atrociousity script appear if the receiver of these atrocities does not want revenge against the instigator. The formula that determines this particular number appears as follows: 8 - Difficulty Level (always five if Intense Rivalry is active) * 2 - 1.
 
Title: Re: Analyzed Procedures and Flags
Post by: Yitzi on October 11, 2015, 02:16:21 AM
I also noticed that the function to determine the number of atrocities a faction needs to exceed in order to have the atrociousity script appear if the receiver of these atrocities does not want revenge against the instigator. The formula that determines this particular number appears as follows: 8 - Difficulty Level (always five if Intense Rivalry is active) * 2 - 1.

Interesting.  What's the address of this code?
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 11, 2015, 03:01:20 AM
This particular section starts at address 0055F09C in Scient's 2010 Patch. I failed to mention it then goes through the pseudo-"Randomizer" before performing a short series of other operations.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 11, 2015, 03:07:11 AM
I also noticed that the function to determine the number of atrocities a faction needs to exceed in order to have the atrociousity script appear if the receiver of these atrocities does not want revenge against the instigator. The formula that determines this particular number appears as follows: 8 - Difficulty Level (always five if Intense Rivalry is active) * 2 - 1.

Interesting.  What's the address of this code?
Why does the code for the Bureaucracy formula use the value of 6 while subtracting it from the Difficulty level? The concepts file says it should equal (8-Difficulty).
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 11, 2015, 03:40:52 AM
Another portion of the code that involves difficulty level and minor atrocities appears at address 0055F280 in Scient's 2010 Patch. This portion has some context because it appears directly after the game processes the portion of the procedure that causes the reputation of a faction to worsen by 1 after committing a minor atrocity unless the Diplomatic "I am atrocity victim" flag remains on with the receiver of the atrocity. The formula I have decoded at the moment appears as follows:
(8 - Faction Difficulty) * 4 compared to the number of minor atrocities the faction has commited.
Title: Re: Analyzed Procedures and Flags
Post by: Yitzi on October 11, 2015, 03:14:59 PM
This particular section starts at address 0055F09C in Scient's 2010 Patch. I failed to mention it then goes through the pseudo-"Randomizer" before performing a short series of other operations.

Ok, thanks.

I also noticed that the function to determine the number of atrocities a faction needs to exceed in order to have the atrociousity script appear if the receiver of these atrocities does not want revenge against the instigator. The formula that determines this particular number appears as follows: 8 - Difficulty Level (always five if Intense Rivalry is active) * 2 - 1.

Interesting.  What's the address of this code?

Why does the code for the Bureaucracy formula use the value of 6 while subtracting it from the Difficulty level? The concepts file says it should equal (8-Difficulty).

Because first it calculates the number of population before the first standard drone, which is 6-DIFF, then at 4EA5A6 it adds another 2 for the value to be used in bureacuracy calculations.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 13, 2015, 06:59:39 PM
I think the AI uses a special Unit Plan for Units with the Heavy Artillery Special Ability because at address 004FA097 in Scient's 2010 patch it jumps over moving 10 (16) into local 11 (Unit Plans) if the checked unit does not have the heavy artillery special ability. This appears to correspond with various features that treat artillery combat differently from regular combat.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 13, 2015, 07:46:15 PM
I think the address at 0046815B relates to the Unit Plan Names as they appear in the Alphax file under the secton #Plans. If I am wrong about this assumption, then please feel free to correct this error. I am going to provide the information that I presently know about the procedure that starts at address 004F81A0 in Scient's 2010 patch. Local 2 equals the base owner starting at address 004F8224; Local 3 equals the values associated with the short names from the plans section of the alphax file Local 4 equals the map check + 3 in local 14 starting at address 004F8245; Local 5 equals the unit prototype check from the Units section of alphax; Local 8 equals the Chassis Triad starting at 004F9570 and 004FA089  (As the triad value from the chassis section of Alphax); Local 11 equals the value from the unit plan section of Units in alphax starting at 004FA08C; Local 14 represents the checking of a map square features starting at 004F8245; Local 21 equals the base location in horizontal spaces starting at address 004F8219; Local 22 equals Technology (Discover) Interest; Local 24 equals AI Power (Conquer) Interest; Local 35 equals the base location vertically starting at address 004F8216; Local 38 equals AI Wealth (Build) Interest; Local 41 equals AI Growth (Explore) Interest; -- it is these values that I have deciphered so far in this extremely important procedure. If Yitzi cares to add additional information, then it would simply add to the available information about this procedure.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 13, 2015, 09:53:11 PM
It appears as though Drone Riots at a base with military facilities that completely repair a unit in a single turn prevent this effect from occuring while the drone riots remain active.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on October 24, 2015, 06:26:11 PM
The memory address at 0096DA48 appears to correspond the sum of population for the faction. This becomes important because it influences the number of energy credits probe teams steal and the AI Social Model choices.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on November 03, 2015, 01:25:31 AM
An analysis of the section that starts at address 00526A00 reveals some information about the manner that the AI allocates Energy to Laboratories. The formula to determine the research in this section appears as follows: (Faction Discover Interest (0 or 1) - Faction Conquer Interest (0 or 1) - Faction Allocations of energy to Economy (Perhaps Psych as well???) + 12 - Faction Allocations of energy to Economy (Perhaps Psych as well???) / 2) - Faction Interest in Build Mandate (0 or 1). The value at the end of this process moves into the register that holds the Faction Energy Allocations to Laboratories. The section following has a conditional increase to the faction Research Allocations that appears as follows: (AI Discover Interest [0 or 1] - AI Conquer Interest [0 or 1] - AI Build Interest [0 or 1] + 3. The next step involves taking the following: (Result from previous operation + Result from previous operation *4). After the previous operation, the procedure performs the following step: (Product from previous operation + Product from previous operation * 4) compared against the number of mission years elapsed. If the number of mission years elapsed exceeds the value from the last step, then the procedure jumps over a +1 increase to the allocations of energy towards Laboratories.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on December 18, 2015, 02:22:56 AM
The number of minor atrocities that a faction must commit before they become expelled from elections for planetary governor must exceed (8 - Difficulty) * 4.
    The number of energy credits in a loan that a human player requests from an AI faction through the energy loan diplomatic proposal depends upon a comparsion between the commerce rates of these two factions. If the commerce rate of the faction that requests a loan exceeds the commerce rate of the faction that provides this loan, than the faction that provides this loan offers 1/4 of his or her energy reserves. If the commerce rate of the faction that requests a loan equals the commerce rate of the faction that provides this loan, than the faction that provides this loan offers 1/3 of his or her energy reserves. If the commerce rate of the faction that requests a loan remains below that of the faction that provides this loan, than the faction that provides this loan offers 1/2 of his or her energy credit reserve. This procedure remains seperate from the calculation that occurs as the AI requests a loan from a human player.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on December 18, 2015, 02:44:32 AM
Why does this sound like a bug? This explaination means that the higher a faction's commerce rate, the less energy they receive from a loan that they request. This stands in contrast with the statement from the original help file for the Morgan Industries Faction because the small blurb for the commerce bonus states that it increases the value of pacts, treaties, and loans. Who thinks this represents an oversight or bug?
Title: Re: Analyzed Procedures and Flags
Post by: Dio on December 18, 2015, 02:47:02 AM
The number of minor atrocities that the AI must perform before the flag for Commit Atrocities wantonly activates is 5 or more. The faction also cannot have the diplomatic status flag "I am an atrocity victim" active.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on December 18, 2015, 03:58:49 AM
I also noticed that the faction bonus Interest, 0 actually increases the number of energy credits a faction has by 1 per base per year. This differs from the description in the Alphax file that states it increases the interest rate for the by 1% per base. This bonus also has a subtle influence on several AI diplomatic responses that include the AI loan request, AI bribe demand, and AI response towards the Salvage Unity Core Proposal. This value increases by 1 for each base the faction controls.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on December 20, 2015, 06:00:32 PM
The prerequisite conditions to activate the Askforloan script remain complicated. The procedure to determine the number of energy credits and payment per year that the AI requests in a loan remains simpler. The AI always requests a number of energy credits that equals 1/2 the energy credits reserves of the faction. The first portion of the formula to determine the number of energy credits per year they pay equals (AI Faction Reputation Values + (AI Faction Commerce Rate - Human Faction Commerce Rate) * 2 + 10). If the factions have a pact with each other, subtract 10 from the sum. Then the second portion of this formual appears as (10 - AI Faction Reputation Values) * 10. This then goes into the procedure as the [(first expression + 100) * the number of energy credits they request in the loan * 1,374,389,535 / 2^36] / the value from the first expression + 100. This procedure seems more complicated for some reason than the formula given above. I remain uncertain about the reason for this phenomenon.
Title: Re: Analyzed Procedures and Flags
Post by: Mart on December 20, 2015, 09:12:48 PM
I also noticed that the faction bonus Interest, 0 actually increases the number of energy credits a faction has by 1 per base per year. ...
Actually, what I read in alphax.txt Yitzi 3.3:
Code: [Select]
;   INTEREST    = Energy reserves interest.
;                 Non-zero = constant percentage per turn (including negative)
;                 Zero     = +1/base each turn
So it is indicated now (Maybe some exe coder has put it there?)

What would be interesting, how -0 works (minus zero)
Some languages do recognize minus  or plus zero
Title: Re: Analyzed Procedures and Flags
Post by: Dio on December 20, 2015, 10:07:31 PM
I also noticed that the faction bonus Interest, 0 actually increases the number of energy credits a faction has by 1 per base per year. ...
Actually, what I read in alphax.txt Yitzi 3.3:
Code: [Select]
;   INTEREST    = Energy reserves interest.
;                 Non-zero = constant percentage per turn (including negative)
;                 Zero     = +1/base each turn
So it is indicated now (Maybe some exe coder has put it there?)

What would be interesting, how -0 works (minus zero)
Some languages do recognize minus  or plus zero
I remain certain that the procedure remains unchanged by any .exe coder. The alphax file remains ambiguous on the actual terms. I only realized the difference between the code and the alphax file after I looked at the code for this bonus. This bonus provides + 1 Energy Credits per turn per year.
Title: Re: Analyzed Procedures and Flags
Post by: Mart on December 21, 2015, 12:33:21 AM
You mean, that the alphax.txt says "= Energy reserves interest." and not "energy credits"?
The bonus working on energy credits is more like what it is expected. It is 'interest' after all, and not raw energy source. It seems like alphax.txt does not say it right.
Title: Re: Analyzed Procedures and Flags
Post by: Dio on December 21, 2015, 03:02:28 PM
You mean, that the alphax.txt says "= Energy reserves interest." and not "energy credits"?
The bonus working on energy credits is more like what it is expected. It is 'interest' after all, and not raw energy source. It seems like alphax.txt does not say it right.
That is correct. The bonus simply provides +1 energy credits per turn per base. If the faction, for example, has 10 bases and 1000 energy credits at the end of a turn, than they will have an additional 10 energy credits the next turn that equals 1010 + Net Income as seen in the social engineering window.
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]