Author Topic: SMACX Thinker Mod  (Read 11185 times)

0 Members and 1 Guest are viewing this topic.

Offline Induktio

Re: SMACX Thinker Mod
« Reply #30 on: September 29, 2018, 12:25:10 PM »
  • Publish
  • The only way these fixes could hurt maintainability are if they 1) confuse your reverse engineering tools too much; 2) break the boundaries of functions you want to hijack (unlikely). Including these fixes is likely to improve maintainability by removing bugs from the code base and so reducing bug reports etc.

    Scient and others on the bugfixing team did good work over many years on SMACX. It seems pretty daft to me not to build on that work.

    Yes, I've seen what those changes are in v2, and maybe you consider them important changes but you can't expect to have the opinions heard if you don't comment which patch should be included. There's a big difference in patch size when it comes to v1 and v2. The first has 1300 bytes of changes while the second has over 3100 bytes. Even this website offers the v1.0 patch in the sidebar. Maybe it should be updated, but dunno. We might look into that later.

    I do take an issue here about saying that I would not be building on Scient's work. There's probably very little chance I would have undertook this project if it was not for the reverse engineered databases Scient had provided. Maybe you notice this if you look at the header files. Figuring out what all those variables do would have been way too time consuming to do without any help. Even then I had to fill in some gaps continuously because some features needed to added.

    ***

    Looks like I cannot overstate the importance of that borehole worker allocation patch. In some cases it can increase AI research output by as much as 50% because so many of those boreholes are left unused until the population is high. I actually continued the game in the screenshot after some changes and in only 10 short turns Gaia would deploy satellites, build cloning vats, and balloon the labs output to way over 2000 per turn. It would probably transcend around turn 180 but it is kinda bottlenecked by the mineral cost of the Ascent project when it has "only" 50 minerals in the top base.
    « Last Edit: September 29, 2018, 02:11:32 PM by Induktio »

    Offline DrazharLn

    Re: SMACX Thinker Mod
    « Reply #31 on: September 30, 2018, 05:54:14 PM »
  • Publish
  • > maintainability

    Why not load your code as a dll and only modify the stuff you want to? We can hack the .exe to load a common loader dll that will then load all mod dlls in the directory (perhaps identified in a text file?).

    That's roughly how PRACX works and would allow us to make these binary changes more easily composable and means you don't need to include anyone else's work in your project if you don't want to. It also means you don't need to distribute the updated terran binaries, just your dll, the loader dll and a script to patch terran.exe to use the loader.

    I can help you build this if you don't know how.

    > comment which patch should be included

    I've been through the list of changes a few times recently and I think all of scient v1 and v2 should be included. I think they're all important and together make the game more predictable/understandable and a lot less buggy.

    > Even this website offers the v1.0 patch in the sidebar

    It probably should be updated, but v2 wasn't released in a big way because it was included in Yitzi's patch.

    > building on that work

    The IDA db is very useful (and I hope you upload your local copy if you've made improvements :)), but there was a wider bug-fixing effort that catalogued, tested and fixed bugs. These bugs are real and do make a significant difference to how the game is played and the general quality of the game, IMO.

    Offline Induktio

    Re: SMACX Thinker Mod
    « Reply #32 on: September 30, 2018, 07:20:50 PM »
  • Publish
  • Why not load your code as a dll and only modify the stuff you want to? We can hack the .exe to load a common loader dll that will then load all mod dlls in the directory (perhaps identified in a text file?).

    That's roughly how PRACX works and would allow us to make these binary changes more easily composable and means you don't need to include anyone else's work in your project if you don't want to. It also means you don't need to distribute the updated terran binaries, just your dll, the loader dll and a script to patch terran.exe to use the loader.

    I'm not sure what do you exactly mean by the first part because the code is already executed in the dll. Binary patching is only used to insert dll function calls to certain important places. That was the idea of this project, to avoid binary patching as much as possible. Basically all the variable locations that I reversed are present in the header files. Borehole patch is almost the only thing that changes the logic without calling a dll function.

    Maybe it could be made more composable by some loader utilities but it's a potentially error-prone step for users if they patch an incompatible file, and dynamic patching brings some complexity too. The issue is just you commented about this thing so late in the release cycle, next mod version has already been delayed quite a lot. I'm in the process of finalizing changes to the build queue algorithms and other stuff can probably wait for later. Depending on how balanced the different factors are, it could be released very soon.

    Offline Induktio

    Re: SMACX Thinker Mod
    « Reply #33 on: October 01, 2018, 10:48:54 PM »
  • Publish
  • Looks like the new version is almost ready in most aspects, at least I shouldn't be adding any more features. The problem is a glitch with the AI psych management. Often the bases grow so fast that the psych buildings can't keep up. When a drone riot happens, the governor usually deploys enough doctors to suppress it. On the next turn it tends to always deploy the workers back, resulting in a perpetual drone riot.

    Some bases seem to get stuck into that loop, so it does not seem viable to rely on the AI to switch enough workers to doctors. Unless that behaviour is somehow changed. It would really need some kind of a fix or else those bases would just keep wasting production. Despite that, the AIs still tend produce huge amounts of stuff, like stacks of 30 needlejets etc.

    Offline DrazharLn

    Re: SMACX Thinker Mod
    « Reply #34 on: October 03, 2018, 05:58:55 AM »
  • Publish
  • I was proposing:

    1. A simple binary patch is made to terran.exe that causes it to load a dll. This is the only change made to the smacx binary on disk
    2. This dll provides functions that will edit SMAC's memory at runtime and perhaps a higher level hooks interface
    2. Other patches (PRACX, thinker, scient v2, yitzi) are implemented as dlls that call those functions

    Rationale:

    1. Patches are described more clearly and in a format that encourages inline documentation
    2. Patches are easier to combine for users and developers
    3. Conflicts can be identified
    4. Patches are easier to remove

    ---

    I'm not suggesting you delay your release. This is just an idea.

    Offline dino

    Re: SMACX Thinker Mod
    « Reply #35 on: October 03, 2018, 11:49:35 AM »
  • Publish
  • Hey @Inductio

    Why you didn't choose Ytzi's patch as a base for your work ?
    There are some serious bugs fixed there not included in Scient's patch and quiet a few modding features that can improve game balance and increase challenge.
    Don't remember... does popboom with golden age works with this patch ? It's the only way to boom with morgan/hive.
    Also I use only +GROWTH for PLANNED, to require golden age for every faction to boom before eudaumonia/clonning vats, to make booming more difficult.

    Being able to customize factions ai with weights in the tech tree is important, so all AIs don't play exactly the same.
    Do I understand correctly that tech_balance=0 value in thinker.ini gives me original formula and let me set all the weights myself ?

    After you give them more minerals to work with terraforming and other means.
    You could create some kind of support to production percentage treshold after which, they are forbidden from building more units.
    The treshold could be based on formula that would take into account ai-fight value and threat/diplomacy status.

    In simillar fasion you could hardcode it to keep at least one former per base  ( or develop some formula to determine how many ).
    So AI can rebuild lost formers at any stage of the game and doesn't have to depend having many formers build early, when it didn't had much stuff to pick.
    Same with crawlers.

    I've just installed the game for the first time this year, only to try your work.
    Thank you very much and I look forward to further developments.
    « Last Edit: October 03, 2018, 02:45:35 PM by dino »

    Offline Induktio

    Re: SMACX Thinker Mod
    « Reply #36 on: October 03, 2018, 05:06:10 PM »
  • Publish
  • > Why you didn't choose Ytzi's patch as a base for your work ?
    > There are some serious bugs fixed there not included in Scient's patch and quiet a few modding features that can improve game balance and increase challenge.

    It's just hard to see what those important bugfixes might be in Yitzi's patch. Mostly it deals with modding ecodamage, some variables in alphax.txt that provide new features instead of bugfixes. There's so many changes in the binary level that it's not very interesting to go through to see what they do.

    > Don't remember... does popboom with golden age works with this patch ? It's the only way to boom with morgan/hive.

    Pop booming with golden age should be working with this patch.

    > Do I understand correctly that tech_balance=0 value in thinker.ini gives me original formula and let me set all the weights myself ?

    It will take into account the weights regardless of which setting is selected here. Tech balance just prioritizes crawler/former/resource cap lifting techs so the AIs can hopefully reach them sooner.

    > You could create some kind of support to production percentage treshold after which, they are forbidden from building more units.
    > The treshold could be based on formula that would take into account ai-fight value and threat/diplomacy status.
    > In simillar fasion you could hardcode it to keep at least one former per base  ( or develop some formula to determine how many ).

    It's currently limited to 2 formers and 3 crawlers per base if the population is at least 6. There's a soft limit scaled on map size after which it stops producing new colony pods but sometimes it might go over it. I have not implemented any cap on military units yet. At least if players run into the global unit cap in real games, that kind of a limit might be coded in pretty easily. In the next version ai-fight values will have some impact on how many military units it produces.



    Offline bvanevery

    • Emperor of the Tanks
    • Librarian
    • *
    • Posts: 3248
    • €322
    • View Inventory
    • Send /Gift
    • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  
    • Planning for the next 20 years of SMACX.
    • AC Text modder Author of at least one AAR
      • View Profile
      • Awards
    Re: SMACX Thinker Mod
    « Reply #37 on: October 03, 2018, 06:50:50 PM »
  • Publish
  • [delurks]

    > Why you didn't choose Ytzi's patch as a base for your work ?
    It's just hard to see what those important bugfixes might be in Yitzi's patch.

    Tell me about it.  And it'll be a problem for every .exe modder who ever tries his/her/its hand, until some kind of standard way of interfacing and describing binary patches is devised.  5 years from now, if a modder is tired of their project and has moved on with their life, nobody else is going to be willing to maintain their code.  This has serious peril of "starting from scratch" problem over and over again, until finally nobody cares enough about SMAC anymore.  It's also a big deal if an .exe modder turns out to have made a serious game breaking bug that they didn't catch during their own development.  Effort of fixing a "showstopper" after the original modder is gone is prohibitive, it simply won't happen.  At least in Yitzi's case, he mainly had a bent about fixing bugs, so he was less likely to create them.  Still not impossible in his case though.

    [lurks]

    Offline dino

    Re: SMACX Thinker Mod
    « Reply #38 on: October 03, 2018, 07:47:46 PM »
  • Publish
  • It's just hard to see what those important bugfixes might be in Yitzi's patch.

    You are right, I've looked through Ytzi patch readme and there are no really critical bug fixes, I've attributed to him some stuff fixed earlier, my memory failed me.
    But few are useful, maybe you could look into incorporating few selected  fixes/features into your patch instead.

    Simple mods I find really nice to have and hopefully would be easy to do:
    Only units in enemy territory cause drones - you can explore unclaimed terrain, or defend pact brother territory without pacifism drones.
    Option for condenser to not provide extra nutrients, only rainfall, condensers are too good and this change makes ICS a bit less viable.
    Supply crawler penalty - I like 1 point penalty, so I don't have to fight my OCD and use crawlers only on tiles yelding more than two, improve challenge and reduces mikro.
    Modable "planet pearls"- I like to reduce it, worm farming in fungus or popbooms feels like a cheat and reduces economy balance. They should just be a threat, not a welcome income source.
    Option to choose landmarks to be used by map generator, including Nessus Canyon.
    Option to disable expansion features like spawning ogres, fungal towers, spore launchers:
    ai deals with them poorly, while greatly reduces amount of wandering worms in early game which are actual threat to human player, allows the original SMAC on terranx.exe mod, with alphax.txt edits.

    Important bugfixes:
    Capturing a base from, or by, a faction with a free facility ability will now work properly.
    AI units will no longer rehome to other factions' bases.
    Ending the turn where an air unit in the air has movement left will no longer cause all other air units to regenerate all fuel and prevent the turn number from progressing.
    The AI evaluation of the worth of psi no longer behaves erratically or causes crashes when psi-combat-relevant projects have been built.

    Minor bugfixes ( probably not worth the effort ):
    Artillery will no longer "intercept" other artillery from the same faction, or one with a truce or better. (As of patch 3.2, native-owned spore launchers will also not attack each other.)
    Drones will no longer revolt to their former owner if that faction has been eradicated.
    Techs that are supposed to give free maintenance to particular facilities will now do so.
    The bonus comm frequency and REVOLT abilities now work properly.
    Fungal pops on the shore now properly have a chance of overflowing into nearby sea spaces.
    When the AI frees a captured faction leader, it will now do so properly, and not have a substantial chance of "freeing" a faction that is still in the game.

    @bvanevery
    Induktio does dll injections and released source code of his mod, what else is he supposed to do. If he'll ever abandon it, it'll be easy to pickup by someone else.
    He made his ai tech weights optional as you requested. You sir camplain too much.
    « Last Edit: October 03, 2018, 09:24:34 PM by dino »

    Offline Induktio

    Re: SMACX Thinker Mod
    « Reply #39 on: October 03, 2018, 09:24:16 PM »
  • Publish
  • Okay, it took a while but decided now to release version 0.7 to the downloads:)

    Most important changes:

    * Land-based former code rewritten
    * Formers will attempt to raise land bridges to nearby islands
    * Crawler code improved to choose better tiles
    * Prototype picker values fast units and useful special abilities more
    * Design_units configuration option added. Produces improved probe teams and AAA garrisons.
    * AI produces now planet busters. Amount depends on the UN charter status and aggressiveness settings.
    * AI prioritizes secret projects that match their interests
    * AI builds secret projects now in their top third mineral output bases
    * Tech requirements now fully moddable in alphax.txt
    * Governors of all factions will use more borehole tiles
    * Scient patch v1.0 added

    With the auto design units feature it would be good to know what kind of special units the AI is lacking/should produce. It's now possible to specify all the proper tech requirements/special abilities in ANY combination and have the AI build the units too. Also, if you have some kind of a complex problem, send the save game to me so that it's possible to properly debug it.

    > Option to choose landmarks to be used by map generator, including Nessus Canyon.
    > Option to disable expansion features like spawning ogres, fungal towers, spore launchers:

    Actually I've been thinking about implementing some of that stuff. I'm not too keen on changing most game mechanics but these would be interesting to have, not sure if it will get added though.
    « Last Edit: October 04, 2018, 06:42:30 PM by Induktio »

    Offline dino

    Re: SMACX Thinker Mod
    « Reply #40 on: October 04, 2018, 09:12:23 AM »
  • Publish
  • I will have time to extensively test your mod on the weekend. Now I'll throw some ideas i had over time about improwing ai, but no knowledge to implement them:

    The major winning strategy for a player, is to do nothing but spawn crawlers in the early game, cover most of the territory with crawlers on forest.
    After lifting restrictions and growing bases, use all the excess crawlers to hurry projects, use huge mineral output to build huge army and destroy ai neighbors.
    It's almost fail proof strategy to dominate power chart within first 100 turns on transcend.

    You are allowed to do this only because as long you have noble integrity rating, ai will never attack you if you keep giving in to their demands, until you are ready to destroy them.
    It's wrong, military deterrent should be absolutely necessary condition of peace when dealing with agressive factions, like in real life cold war.

    So far, you've concentrated mostly on isolated builder efficiency. It's time to improve their diplomacy game performance against human player.
    If a player have poor integrity rating, ai often give demands and then attack anyway.
    My idea is to give ai modifier to how they perceive human player integrity, based on relative military power, social choices and agessiveness.

    You can design specifics of the formula as you see fit, but you should want to roughly achieve a state when:
    If ai has >2x military power of human and ai_fight=1, it will always attack the player even if he give in to all their demands.
    If ai has >2x military power of human, ai_fight=0 and the player is an ideological enemy ( social choices ), it will attack the player even if he give in to their demands.
    If ai_fight=-1 it shouldn't be affected by this modification.
    AI factions shouldn't be affected by this perceived integrity penalty either, since they start enough wars as it is.

    Human player will be forced to back their diplomacy with at least half the force AIs have to be able maintain peace with bribes.
    Being forced to mix more military units with crawlers, colony pods, formers and facilities will slow human builder early development speed at least 2x times.

    If player starts isolated it's fine, because he can't trade/steal techs early and naval invasion require more time and resources to execute, so AIs have more time to catch up.

    ***

    Regarding units and support I had this rough idea that ai shouldn't eat more than 70% production with military support:
     -10%,0,+10% depending on ai_fight,
    +10% when enemy units present within own territory,
    + 0-20% depending on military power compared to other factions,

    You can design your own formula, but AI's should have some minerals left for base facilities, crawlers, probe teams, formers production, etc.

    ***

    Does your ai rebuilds lost formers in mid and late game? Vanilla ai builds some in early game, but rarely builds them later.
    Thats why the mods to give them early additional super formers so it can do tons of terraforming in advance, before it'll loose them were used.
    With a function to always maintain certain number of them, it won't be necessary to give ai that many formers, or super former ability early.

    ***

    Option to disable expansion features - I'd seriously consider this.
    I know of people, who dislike most of expansion features, factions and tech tree changes enough, to refuse using Ytzi's patch until he made the original SMAC mod possible.

    « Last Edit: October 04, 2018, 01:01:41 PM by dino »

    Offline Induktio

    Re: SMACX Thinker Mod
    « Reply #41 on: October 04, 2018, 07:06:42 PM »
  • Publish
  • Phew, that's a lot of stuff there.

    > The major winning strategy for a player, is to do nothing but spawn crawlers in the early game, cover most of the territory with crawlers on forest.
    > After lifting restrictions and growing bases, use all the excess crawlers to hurry projects, use huge mineral output to build huge army and destroy ai neighbors.
    > It's almost fail proof strategy to dominate power chart within first 100 turns on transcend.

    Human players can always use crawler upgrading/rushing tricks and gain an advantage, sure. The AI doesn't rush production currently, so that also favors humans quite a lot. Other big factor is also pop booming. The AI doesn't understand how to do it, but maybe these are mechanics that can be modded away or maybe players can just refrain from using them too much.

    > You are allowed to do this only because as long you have noble integrity rating, ai will never attack you if you keep giving in to their demands, until you are ready to destroy them.
    > It's wrong, military deterrent should be absolutely necessary condition of peace when dealing with agressive factions, like in real life cold war.
    > If a player have poor integrity rating, ai often give demands and then attack anyway.

    Are you positive the AI refrains from attacking every time if you cave in with noble rating or is there some other factor influencing this? I have some idea where the diplomatic variables are stored so it could be pretty simple to just change them to cause more diplomatic friction.

    > You can design specifics of the formula as you see fit, but you should want to roughly achieve a state when:
    > If ai has >2x military power of human and ai_fight=1, it will always attack the player even if he give in to all their demands.
    > If ai has >2x military power of human, ai_fight=0 and the player is an ideological enemy ( social choices ), it will attack the player even if he give in to their demands.
    > If ai_fight=-1 it shouldn't be affected by this modification.
    > AI factions shouldn't be affected by this perceived integrity penalty either, since they start enough wars as it is.

    Something like that could be implemented. AI factions are currently so aggressive against each other it could be good to reduce their early wars so their development doesn't suffer so much. Against humans they probably declare very easily too unless that diplomatic exploit you described is working.

    Anyway, there are 3 main areas this mod doesn't touch currently: 1) diplomacy 2) social engineering 3) combat unit movement. Infrastructure is fully in place to modify #3 and I'm actually considering some changes on how the AI could use its combat units. Ideas are welcome there too.

    > Regarding units and support I had this rough idea that ai shouldn't eat more than 70% production with military support:
    > You can design your own formula, but AI's should have some minerals left for base facilities, crawlers, probe teams, formers production, etc.

    The formula was changed many times but currently it basically keeps half of the minerals in reserve before switching off combat unit production.

    > Does your ai rebuilds lost formers in mid and late game? Vanilla ai builds some in early game, but rarely builds them later.
    > Thats why the mods to give them early additional super formers so it can do tons of terraforming in advance, before it'll loose them were used.

    With this mod you could see AIs with 50 formers + 50 crawlers so I'm not sure if that super former ability would even be needed. It should still build them if possible.

    Offline dino

    Re: SMACX Thinker Mod
    « Reply #42 on: October 04, 2018, 09:33:13 PM »
  • Publish
  • I should probably first test your mod extensively before commenting, you seem to already addressed formers and production better than I thought.
    I have not enough time at the moment, but I was too excited that someone is working on it finally and couldn't hold off, sorry.

    As for diplomacy yes, with modded AI buffs it can be in possition to easily destroy my crawler parks and bases when I am in a building up phase.
    But as long as I keep noble integrity and give them whatever they want, they won't attack and giving them tech and money is not an issue, they'll trade them elsewhere anyway.
    If they hate you because you're leading power chart they'll attack eventually, but early game when I'm weak, I don't recall a situation when it didn't work.
    Maybe with intense rivalry it wouldn't work, but I never play with this option. I like to try maintain some stable treaties with one, or two factions in my games.

    So, my proposition is, if the human player is determined to be an easy prey and the AI is aggresive, or erratic but human is their ideological enemy, it should just attack.
    This way player won't be able to safely build up, with just one defender per base to fend off worms, supporting unused military deterrent is a huge strain on economy.
    « Last Edit: October 04, 2018, 09:58:00 PM by dino »

    Offline PvtHudson

    Re: SMACX Thinker Mod
    « Reply #43 on: October 05, 2018, 09:39:04 AM »
  • Publish
  • Interesting reading about endowing AI with right amount of aggression: https://steamcommunity.com/app/287580/discussions/0/1620599015872353241/
    It's about SMAC-like 4x TBS Pandora: First Contact, which currently possess one of the best AIs in the field. For example, the need to back your development up with a standing army is already a must there.

    Offline Induktio

    Re: SMACX Thinker Mod
    « Reply #44 on: October 05, 2018, 06:42:20 PM »
  • Publish
  • > If they hate you because you're leading power chart they'll attack eventually, but early game when I'm weak, I don't recall a situation when it didn't work.
    > Maybe with intense rivalry it wouldn't work, but I never play with this option. I like to try maintain some stable treaties with one, or two factions in my games.

    In early game I think it's usually that dialogue where they demand you two techs in a row. Refusing will almost certainly cause them to declare. Intense rivalry affects quite a lot of things in diplomacy, haven't checked if it has any effect here. Probably it harms the AIs more because they already have too much wars.

    > Interesting reading about endowing AI with right amount of aggression: https://steamcommunity.com/app/287580/discussions/0/1620599015872353241/

    Yeah, I've heard about that project. Not sure if he ever published any source code or described the algorithms in detail. It's closed source anyway?

     

    * User

    Welcome, Guest. Please login or register.
    Did you miss your activation email?


    Login with username, password and session length

    Select language:

    * Community poll

    SMAC v.4 SMAX v.2 (or previous versions)
    -=-
    17 (7%)
    XP Compatibility patch
    -=-
    8 (3%)
    Gog version for Windows
    -=-
    66 (27%)
    Scient (unofficial) patch
    -=-
    24 (9%)
    Kyrub's latest patch
    -=-
    14 (5%)
    Yitzi's latest patch
    -=-
    84 (34%)
    AC for Mac
    -=-
    2 (0%)
    AC for Linux
    -=-
    5 (2%)
    Gog version for Mac
    -=-
    10 (4%)
    No patch
    -=-
    12 (4%)
    Total Members Voted: 242
    AC2 Wiki Logo

    * Random quote

    Organic Superlube? Oh, it's great stuff, great stuff. You really have to keep an eye on it, though - it'll try and slide away from you the first chance it gets.
    ~T. M. Morgan-Reilly, Morgan Metagenics

    * Select your theme

    *

    Facebook Comments