Author Topic: The University cheats to get the Hunter-Seeker Algorithm  (Read 3290 times)

0 Members and 1 Guest are viewing this topic.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
The University cheats to get the Hunter-Seeker Algorithm
« on: February 16, 2020, 01:36:54 AM »
I have proven to my satisfaction that the University AI uses Directed Research, rather than Blind Research, to go after the Hunter-Seeker Algorithm no matter where it is located in the tech tree.  I noticed because my mod is different from vanilla.  My University is Passive rather than Erratic and does not have a -2 PROBE penalty.  None of my social engineering choices have PROBE penalties.  I consider the Hunter-Seeker Algorithm to be a Conquer tech and have it weighted accordingly.  My Pre-Sentient Algorithms is a Tier 5 Conquer tech with no Discover component at all.

Despite these differences, the University was beelining up the Conquer techs, totally bypassing the Discover part of the tech tree I'd laid out for it!  When I disabled the HSA from the game, the behavior stopped.  When I moved the HSA to my Explore 5 Centauri Psi, it would beeline for Centauri Psi.  It took longer because more prereqs in more categories were needed, but eventually it got there by the shortest path it could.

This is the 1st time in almost 2 years of modding, that I've come across definitive proof of the AI ignoring the tech weights in alphax.txt.  And AFAICT, it only happens in pursuit of the HSA.  Otherwise all the factions have seemed to do what I'd expect.  My Explore, Discover, Build, and Conquer trees are quite disentangled from each other nowadays, so when a faction starts researching stuff it shouldn't be, it's quite noticeable.

I believe at some point in SMAC's development, someone decided that the University absolutely must try to get the HSA and hardwired this cheat.  Whereas in my mod, I don't believe in the "easy mind control" play mechanic.  I think it's lousy and I got rid of it.

I also haven't found the University's research to be "all that", so I goosed it with free Biology Labs in addition to free Network Nodes.  My Gaians are also a part research faction with an Explore and Discover focus, and they get free Biology Labs only.  Well, when I put the HSA at Conquer 4 Advanced Military Algorithms, the University was beginning it by turn 75!  On a Huge map I might not even have Probe Teams by then.  Clearly this is intolerable, so I've been looking at fixes.

The best that I can seem to do to slow the University down, is to put in prereqs from broad sections of the tech tree, so that the University has to grind through the maximum amount of stuff to reach its goal.  That's not good lore, but it's an effective patch for the gameplay.

Offline scient

Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #1 on: February 26, 2020, 06:34:03 PM »
I found this scenario interesting. I think I found the code responsible. There is a tech_val() function that from what I can tell helps guide or add weight for reaching specific tech goals. It looks like if the faction's base SE Probe score is <= 0, then it focuses on trying to reach HSA. This is fairly early on in this large function. Try setting the University's SE probe value to 1 rather than 0. From my testing, this causes them to skip trying to build HSA. This looks like a fun function to do, I might try to decompile it tonight. It would also give me a temporary distraction from slogging through Path path-finding class that is 60-70% done.


Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #2 on: February 26, 2020, 11:18:34 PM »
Interesting deduction.  However I have trouble believing it's any faction and PROBE <=0.  Most factions in my mod have PROBE = 0 to start with.  The Hive and the Cyborgs have +1, the Data Angels have +2.  No faction has negative PROBE.  My SE table doesn't have PROBE penalties.

In the stock game, the University has -2 PROBE.  No other faction has a PROBE penalty.  I thought perhaps the binary had hardcoded a response to the University's problem.

In other factions, I have not previously noticed the HSA beelining behavior.  It's possible the behavior is there, but other factions have research rates that are too slow to matter.  In my mod, SPs are expensive, and it tends to be a "big distant economic powerhouse" faction that gets the HSA.  Assuming I don't.

Offline scient

Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #3 on: February 27, 2020, 02:43:58 AM »
The way most faction specific checks in the game work is by doing a compare to the faction's filename. For example, the Caretaker Secret Project exclusion check for bases.

There are some of these checks for University related to tech, but they're all diplomacy related (buy, trade, gift). Nothing specific to goals. That isn't to say there wasn't game logic designed around them that doesn't blatantly call out University (ex. FREEPROTO flag only used by Spartans).

Offline scient

Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #4 on: March 02, 2020, 12:22:52 AM »
Looks like there are some other factors that drive University towards HSA. Do you make any changes to AI values (ai-fight, ai-power, ai-tech, ai-wealth, ai-growth) inside faction text file? The default for University is all zeros with 1 set for ai-tech.

Here is the full code segment from the screenshot above. Based on default values, University is definitely driven to gain tech to build HSA. They are not alone, Peacekeepers and Consciousness are also driven towards this based on default values (x4 weight given to HSA tech). There are also 5 factions that give x2 weight towards HSA. You may be right that since University has faster tech gains it is more noticeable.

Code: [Select]
if (PlayersData[factionID].SE_ProbeBase <= 0) {
if(tech_is_preq(techID, Facility[FAC_HUNTER_SEEKER_ALGO].preqTech,
(PlayersData[factionID].AI_Tech != 0) + 2)) {
if (!PlayersData[factionID].AI_Power) {
valueRet *= 2;
}
if (PlayersData[factionID].AI_Tech) {
valueRet *= 2;
}
}
}

Excluded due to Probe SE (no weight):
Angels:         0, 0, 1, 1, 0 (+2 base PROBE)
Believers:      1, 1, 0, 0, 1 (+1 base PROBE)

Excluded non-zero ai-power with zero ai-tech (no weight):
Planet Cult:    1, 1, 0, 0, 1 (0 base PROBE)
Hive:           1, 1, 0, 1, 0 (0 base PROBE)
Pirates:        0, 1, 0, 0, 1 (0 base PROBE)
Usurpers:       1, 1, 0, 1, 0 (0 base PROBE)

ai-power zero, ai-tech zero (x2):
Drones:         0, 0, 0, 1, 0 (0 base PROBE)
Gaians:        -1, 0, 0, 0, 1 (0 base PROBE)
Morgan:        -1, 0, 0, 1, 0 (0 base PROBE)

ai-power non-zero, ai-tech non-zero (x2):
Caretakers:     1, 1, 1, 0, 1 (0 base PROBE)
Spartans:       0, 1, 1, 0, 0 (0 base PROBE)

ai-power zero, ai-tech non-zero (x4):
Consciousness: -1, 0, 1, 0, 1 (0 base PROBE)
Peacekeepers:   0, 0, 1, 0, 1 (0 base PROBE)
University:     0, 0, 1, 0, 0 (-2 base PROBE)

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #5 on: March 02, 2020, 03:43:12 AM »
I changed University Personality from Erratic 0 to Passive -1.  ai-fight doesn't appear to be a value in the case logic you found.

Does the game have hardwired modifiers for lots of SPs?  Or is it only the HSA specifically singled out for this treatment?

Offline scient

Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #6 on: March 02, 2020, 04:21:23 AM »
I changed University Personality from Erratic 0 to Passive -1.  ai-fight doesn't appear to be a value in the case logic you found.

Does the game have hardwired modifiers for lots of SPs?  Or is it only the HSA specifically singled out for this treatment?


In that case, University with SE base probe 0 and default ai-tech/ai-power then Univ would still put x4 priority towards HSA tech.

Yep, besides HSA there are two other SPs with tech weight values: Ascent to Trans and Dream Twister.

I'm still working through tech val function but once I'm finished I think there will be a better understanding of how AI and blind research works.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #7 on: March 02, 2020, 05:14:30 AM »
Ascent shouldn't matter in my mod.  It's at the end of my tech tree!  You have to complete all techs to learn it.

Dream Twister is all the way up the Explore tree in my mod.  Not so different from the original game that way.  I've changed some things as to "what's Explore", to make it more purely about mindworms.  For instance, you don't get Missile Launchers that way.

The HSA, I don't think of it as "avoid techs being stolen".  I think of it as, "avoid bases being mind controlled when I'm conquering."  That's why I put it in the Conquer part of the tree.  The HSA doesn't make your research go faster.  It just keeps other players from getting ahold of it.

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #8 on: March 08, 2020, 11:17:36 PM »
I've decided to put the Dream Twister super far up the Explore tree in my mod, to stop it from interfering with things.  It's overpowered anyways.  Now I've got it with Sentient Resonance.  If I understand your code, a qualified Discover faction would start getting the weights 3 prereqs before the Dream Twister tech.  A qualified non-Discover faction would get them 2 prereqs before the tech.  This definitely won't affect anything in the early to midgame now.  By the time the Dream Twister becomes available, the game should be over already.  Assuming a veteran butt-kicking player on Transcend; YMMV for lesser levels of player skill.

I've thrown in the towel and put the Hunter-Seeker Algorithm back in the Discover tree.  That way, qualified Discover factions actually learn Discover techs, instead of something else.

I am concerned that this strong Discover pull, may derail my version of the Gaians.  I have them as a combo Explore, Discover faction.  The Cult of Planet, in contrast, is my pure Explore faction.  I fear that the Gaians may not learn the Explore techs they're supposed to, instead 4X fixating on the HSA.  I'll be playtesting the Gaians to see what happens with my newly reworked tech tree.


Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #9 on: April 18, 2020, 06:43:11 AM »
Putting the Dream Twister far up my tech tree, isn't really working.  The game can still realistically go on as long as Sentient Resonance.  I'm actually trying to seek Economic Victory, which in my mod requires Global Energy Theory, a Build tech.  I can't seem to learn it until I've got Sentient Resonance, which is annoying.  The only thing positive I can say, is my research is fast enough that the disruption won't last too much longer.  But it can still translate into hours of real world play time.

Do you happen to know which choices trigger a big Dream Twister weighting boost?  I would hope it's not the same as the HSA, with Discover and non-Conquer.  It would be at least rational to expect Explore to take the place of Discover.  I'm currently doing Build only, so I'm a non-Conquer faction, and I haven't done Conquer at all since the beginning of the game.  I'm also +3 PLANET and it wouldn't surprise me if that exerts influence, same way that being 0 PROBE or lower exerts influence for the HSA.

Arguably, the game thinks a PLANET-friendly faction is supposed to want the Dream Twister above all else.  But I'm doing it for the resource bonuses from the Manifold Harmonics.

EDIT: it didn't beeline after all.  Just seemed like it was going to.  I'd still like to know when it beelines.
« Last Edit: April 18, 2020, 09:01:01 AM by bvanevery »

Offline scient

Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #10 on: April 22, 2020, 08:33:44 PM »
I've finished the tech_val() function and now just need to run it through my battery of regression tests. Pretty much everything is identified except for a couple checks that tie into Continent struct I've been working on. I'm going to wrap up a few more map functions and push an update sometime next week.  I've been pretty swamped with work and training. Will let you know once it's on git. They're not fixed weights because a lot of checks are dependent on current game state and faction. If you would like, I'll leave in my regression test code that dumps all tech weights for each faction to log file. You would just need to use a debugger to change current execution point (eventually I'm going to hook some of debug shortcut keys). I generally set a breakpoint on stack_fix() since it's pointless for singleplayer then change origin to tester function.

Here is reference to Dream Twister:

Code: [Select]
if (Players[factionID].rulePsi <= 0) {
<snip, various checks related to reactor tech>
}
else {
if (tech_is_preq(techID, Facility[FAC_DREAM_TWISTER].preqTech, 9999)) {
valueRet *= 2;
}
}

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #11 on: April 22, 2020, 09:59:40 PM »
Thanks for that, I'll try to wrap my head around it.  My musings are by no means some urgent request.  Not clear on what rulePsi is.

Offline scient

Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #12 on: April 22, 2020, 10:24:36 PM »
Of course! I figured I might as well keep test code there since I'll be building it out to ensure everything is working correctly anyway. I generally delete it from temp.cpp once I'm done so it doesn't get too cluttered. I'm sure there is interest how the AI picks tech.

; SPECIAL RULES = rule, parameter
;
;   PSI         = Percentage combat bonus for PSI Combat.

So rulePSI is if a faction has the special rule set for PSI. It looks like the default factions don't have this set. It would be something like "PSI, #" near top of faction file. If you don't have it set for any of your factions there is something else at work that is shifting priority towards Dream Twister tech.


Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • 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.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #13 on: April 22, 2020, 11:49:27 PM »
I have not actually observed a "pull to the Dream Twister" in the wild.  I was led to believe that such a pull could occur.  I'm now thinking this is debatable.  None of my factions have any inherent Psi combat bonus.  The Gaians ever so briefly did in one release, before I decided that was overpowered, and gave them free Biology Labs instead. 

Whereas, I've observed a pull to the HSA, and the effect is quite dramatic.  I didn't like having to work around that, but I did.

The Dream Twister deserves to be far up the tech tree anyways for other reasons.  It's overpowered.  Even the Xenoempathy Dome is overpowered for when it is offered.  I moved all that stuff farther up, in sequence.  I'm happier with it.  Means you actually have to use some fungal tactics and not just get a cakewalk by virtue of setting your focus to Explore.

I don't know when, if ever, I'll observe a Dream Twister pull.  I'm wondering what 9999 means.  It looks like a "disregard" value, the sort of thing you'd do if you wanted 0 to be a legitimate input.

 

Offline scient

Re: The University cheats to get the Hunter-Seeker Algorithm
« Reply #14 on: April 23, 2020, 12:07:09 AM »
From what I'm seeing, only modified factions with that PSI flag would ever see a pull towards Dream Twister tech. All the original SMAC/X factions would never get to the else section of code since rulePSI will be zero.

The 9999 basically tells it to find any prerequisite tech. There are about 15 instances inside tech_val() where it uses the max range. Not all tho, some are like a range of 2 or 5. It's basically telling it how far to recursively go to find prerequisite tech.

Purpose: Determine if preqTechID is a prerequisite of parentTechID within descending range.
Return Value: Is preqTechID prerequisite of parentTechID? true/false
BOOL __cdecl tech_is_preq(int preqTechID, int parentTechID, uint32_t range)

 

* 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)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

The substructure of the universe regresses infinitely towards smaller and smaller components. Behind atoms we find electrons, and behind electrons, quarks. Each layer unraveled reveals new secrets, but also new mysteries.
~Academician Prokhor Zakharov 'For I Have Tasted the Fruit'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 37.

[Show Queries]