Announcement

Collapse
No announcement yet.

Internal Player Structure (scient source code file)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Internal Player Structure (scient source code file)

    Originally posted by scient
    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 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.
    • [li]TECH, #: Free # of player selected tech at start seems to be broken. This would only affect custom factions.[/li]
      [li]Social Priority Effect: Completely broken and never set. This affects the AI for all factions, including default ones.[/li]
      [li]Social Opposition Effect: Also broken, but not used by default factions.[/li]


    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:
    • [li]There are 304 unused padding bytes in the Player struct that could be used to add features.[/li]
      [li]Noun gender can be "Neutral". Unsure if this has any difference compared to male/female.[/li]
      [li]Adjective names for the faction must be separated by a colon. Default faction files do not adhere to this having portions after the 1st comma ignored completely. I didn't look into what happens when colons are properly used.[/li]
      [li]Interlude variables: Assistant and Scientist name, Assistant City.[/li]
      [li]SHARETECH/TECHSHARE override one another. Contrary to the documentation, the TECHSHARE parameter is not ignored but writes to the same internal variable as SHARETECH. However, unlike SHARETECH a flag is set for TECHSHARE that must handle its spying caveat.[/li]
      [li]Maximum of 8 faction bonuses. Only the first 8 are parsed, any after that are ignored.[/li]


    If anyone has any questions, feel free to ask and I'll do my best to answer them or try to explain further.
    http://alphacentauri2.info/index.php?topic=18438.0
    AC2- the most active SMAC(X) community on the web.
    JKStudio - Masks and other Art

    No pasarán
Working...
X