Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Bug/Patch Discussion => Topic started by: scient on December 06, 2016, 08:17:15 AM

Title: Internal Player Structure
Post by: scient on December 06, 2016, 08:17:15 AM
I have completed my analysis of how the game parses and stores the faction related files internally. This Player structure is created from the faction text files found in the game folder (default or custom). This structure is used as the basis for the active game structure for each faction which I haven't completed yet. I tried to do a few updates to the wiki (http://alphacentauri2.info/wiki/Faction.txt_editing_guide) however I don't really have time to do a more through job.

I've noticed two bugs that I don't believe yitzi or kyrub have addressed. However, I could be wrong. I haven't kept up with the latest patches and do analysis on an unmodified version of the game.


While the free number of TECH value is correctly set, I've never actually received the tech at the start of the game. Perhaps I am doing something wrong, however this might be another neglected feature like COMMFREQ rule since none of the default factions use it. The default factions only grant single specific tech which is handled slightly differently. I didn't trace further to track down this potential bug since it is outside the scope of the parsing of the Player structure. If anyone can confirm this is broken or works, please let me know!

As for the social priority effect, I can 100% confirm this is broken. For example, inside gaians.txt you have the following line: Economics, Green, PLANET. The category (Economics) and model (Green) are correctly set inside the Player struct. However, no matter what the effect is (in this case PLANET) the code sets it to -1 (nil). The opposition effect is always nil in the default factions, so that would only affect custom factions. Now, if you set the custom game rule "randomize faction leader social agendas" then a non-nil value is randomly set in this field. The effect priority field is actively used in a couple functions when I did a cursory test: communicate(), social_ai(). I imagine this could cause the AI not to strive towards the effect goals they were meant to as well as incorrect reactions to factions with similar/opposing views. However, perhaps it has no real effect at all.

To bug fixers:
This happens in the read_faction() function at offset 0x586DF7 in the SMACX binary and offset 0x59DCDE inside the SMAC binary. If you look at the two loops above it, you'll see how the category and model are parsed and set (strcmp > increment > repeat). This could be expanded to properly parse the effect values.

Some undocumented things I've noticed:

If anyone has any questions, feel free to ask and I'll do my best to answer them or try to explain further.
Title: Re: Internal Player Structure
Post by: scient on December 09, 2016, 04:28:53 PM
While going through and verifying my findings in the code I noticed one final thing.

ROBUST, IMMUNITY: Both of these can take a modifier value like SOCIAL. So you could for example have "ROBUST, ++EFFIC" or "IMMUNITY, --ECONOMY". The modifier value is stored in the faction_bonus_val2[] variable just like SOCIAL. However, I am not sure the significance of this value in relation to ROBUST/IMMUNITY.

For SOCIAL, ROBUST and IMMUNITY if you do not specify a modifier value it will default to 1. So "SOCIAL, +EFFIC" and "SOCIAL, EFFIC" do exactly the same thing.

Perhaps these little quirks are already known but they aren't part of the original documentation on editing faction files. For the sake of completeness, I figured I would make a note of it.

Title: Re: Internal Player Structure
Post by: Yitzi on December 25, 2016, 06:16:29 PM
While going through and verifying my findings in the code I noticed one final thing.

ROBUST, IMMUNITY: Both of these can take a modifier value like SOCIAL. So you could for example have "ROBUST, ++EFFIC" or "IMMUNITY, --ECONOMY". The modifier value is stored in the faction_bonus_val2[] variable just like SOCIAL. However, I am not sure the significance of this value in relation to ROBUST/IMMUNITY.

I'm pretty sure it does nothing.
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 31 - 840KB. (show)
Queries used: 16.

[Show Queries]