induktio / thinker

AI improvement patch for SMACX.
https://discord.gg/XdFuwWzzku
GNU General Public License v2.0
70 stars 10 forks source link

TECHSHARE doesn't work on SMAC-in-SMAX #57

Closed Mjnd closed 1 year ago

Mjnd commented 1 year ago

The issue has been already discussed on https://old.reddit.com/r/alphacentauri/comments/15sx90w/techshare_doesnt_appear_to_work/

I understand I'm misusing the SMAC-in-SMAX mod by making use of expansion-related content, but I would like to ask anyway if it would be possible to fix the issue with TECHSHARE as descrived above in the reddit thread, where in SMAC-in-SMAX it behaves like SHARETECH (or is simply ignored), restoring the infiltration requirement for gaining techs.

In general, would be possible to have all the expansion-related rules for factions fully enabled also on SMAC-in-SMAX?

induktio commented 1 year ago

As I mentioned on the thread, there's some kind of known issue with SHARETECH and TECHSHARE modifiers such that the vanilla game does not operate like the descriptions in alphax.txt should imply. Can you clarify which description (original/thinker docs) did you use for these features and what would be the better choice for game design?

Regarding the latter question, I did not specifically check this, but the game binary should parse many of the expansion related rules for factions regardless if ExpansionEnabled flag is set or not. The SMAC-in-SMAX mod feature is not absolute since many of these feature flags are checked by the game binary and they're not necessarily 100% consistent regarding the original game. I would have to look at these rules one by one to get an accurate idea how the game binary handles them when ExpansionEnabled is set to disabled. Are there any specific issues?

Mjnd commented 1 year ago

I followed the Thinker TECHSHARE description included in alphax.txt in the smac_mod directory (but I have also tried other configurations, just to check): basically the infiltration requirement of TECHSHARE is ignored. I like to play the SMAC-in-SMACX mod with a custom Aki Zeta-5 faction, which requires expansion-related RULES (mainly TECHSHARE and TECHSTEAL) and so I would like to have these working... Now I'm not even sure if TECHSTEAL works (while playing the SMAC-in-SMACX mod), so that's why I asked for an overhaul of the expansion-related RULES: because they are not disabled when playing the SMAC-in-SMACX mod (for example TECHSHARE seems to behave like SHARETECH, dropping the infiltration requirement).

As I wrote, I'm misusing the SMAC-in-SMACX mod, so I should simply drop the expansion-related RULES in my custom faction, and that would solve the issue. I don't want to force you to waste time and energy in a marginal "problem", but if you can, could you check that TECHSHARE and TECHSTEAL works correctly also in the SMAC-in-SMACX mod?

induktio commented 1 year ago

It seems that capture_base calls steal_tech function when either or both or these conditions are met:

a) Scenario has RULES_SPOILS_OF_WAR enabled b) Faction definition has RFLAG_TECHSTEAL enabled

There does not seem to be any checking for ExpansionEnabled flag in those functions, so TECHSTEAL feature should work regardless. The only thing that could maybe prevent it from working is if the faction flag does not get parsed properly, but I did not check for this. It's possible to verify it by just starting a new game with the those parameters, whether scenario editor is used should not matter.

Mjnd commented 1 year ago

Thank you very much.

I was thinking that the expansion-related RULES for factions should be removed from alphax.txt in the smac_mod directory, if you don't plan to support them officially, or leave only the ones verified like TECHSTEAL.

induktio commented 1 year ago

The game might still parse those rules even if smac_only mode is activated, thus affecting game mechanics unless these instances in the binary are specifically patched out which might be non-trivial. Currently I'd say using expansion factions with smac_only mode is untested (maybe works, report here if you find something that clearly does not). Only alien factions are explicitly unsupported in smac_only mode and using them would not make sense anyway.

induktio commented 1 year ago

It seems there's one check in tech_achieved function for ExpansionEnabled flag, so it's probably related to the TECHSHARE issue. If expansion is disabled, the condition always evaluates to true and skips the checks for infiltration, pact, governor and Empath Guild before deciding whether to grant the tech. Not sure what purpose this behavior really serves in the game, so the check for expansion being disabled could maybe be removed.

Mjnd commented 1 year ago

I guess it was a way to disable that rule and to avoid problems if it was accidentally added to the original game... Yes, please remove that check if you can... In the meantime I'm glad to know the issue has been solved. Thank you very much! I think this can be closed.

Mjnd commented 1 year ago

Could you provide a test/develop build where the changes related to TECHSHARE are implemented? I would like to test and play with TECHSHARE fixed... have you time to program a provisional Thinker build?

induktio commented 1 year ago

Yeah got a little carried away by other things. Develop build 20230902 should now fix the techshare issue with smac_only. There's also some other tweaks to prototype naming when the new unit name generator is used.

Mjnd commented 1 year ago

Thank you very much. I just tried a game, and it appears to work (and there is no more continous tech gaining at the beginning).