Author Topic: How exactly does Blind Research pick techs?  (Read 675 times)

0 Members and 1 Guest are viewing this topic.

Offline pblur

How exactly does Blind Research pick techs?
« on: February 23, 2023, 05:45:35 PM »
Motivation:
In a game I'm currently in, I have no techs I need right now that are Explore. I have some high priority Conquer/Discover techs, and a lower-priority Build tech. I found myself wondering if going Conquer+Discover+Build would make me much less likely to get Explore than just going, say, Conquer. Searching around online, I'm not really seeing the mechanics at play here. I saw somebody say that you can't get the same category twice in a row; is that true? I've never noticed it...

So, how exactly does the game pick a tech in Blind Research?

Offline Vidsek

Re: How exactly does Blind Research pick techs?
« Reply #1 on: February 28, 2023, 10:27:23 AM »
  Excellent question!!  It's been a mystery to me as well.

  Makes me wonder if there could be alternate selection algorithms and if that would would be a good or bad thing.
All this talk of fungus and worms makes me hungry...

Offline pblur

Re: How exactly does Blind Research pick techs?
« Reply #2 on: March 02, 2023, 04:27:10 AM »
I know Thinker Mod has an option to tweak the process to some extent, prioritizing the critical exploitation techs like centauri ecology. That option is called 'tech_balance'. I suppose several of the modders must know how this works, but it doesn't seem to be easily available.

If I get the motivation, maybe I'll dig through thinker's code and try to understand it.

Offline DrazharLn

Re: How exactly does Blind Research pick techs?
« Reply #3 on: March 02, 2023, 12:51:20 PM »
The code for this was decompiled by scient in the opensmacx project. Check out the tech_val and tech_ai functions here: https://github.com/b-casey/OpenSMACX/blob/58e36e0bc86a9e050c1cab2d737f7108834ba7c9/src/technology.cpp#L529

Offline pblur

Re: How exactly does Blind Research pick techs?
« Reply #4 on: March 02, 2023, 08:22:35 PM »
Thank you so much DrazharLn! I spent a few hours hunting around the codebase to understand everything, and here's the procedure:

If it's the Formers tech, and faction has either Explore or Build selected, pick that. Otherwise, calculate weights.
Add base weights * focus for each category of tech: tech_Build_Weight * IsBuildFocused + tech_Conquer_Weight * IsConquerFocused + ... (where IsBuildFocused and similar variables are 5 if Build is focused, and 1 if it isn't.)
Modify with the following giant list of conditionals:
  • If the tech has no weights in any category you have focused, and is not a Conquer-weighted tech while you're at war or an Explore-weighted tech while you have 4 or more cities, halve the result.
  • Add up to 2 * tech_Conquer_Weight based on a complicated formula of how aggressive/defensive your posture is.
  • If the tech is a prereq (to depth 2) to Ascent to Transcendance and the player is about to win, multiply weight by x4.
  • If your faction has +PLANET built-in, you have Explore focused, and the tech is a prereq (to any depth) to Centauri Meditation/Plantary Economics, multiply weight by x3/x2.
  • If your faction has +PLANET built-in, you have Explore focused, and the tech is a prereq (to depth 3) to Secrets of Alpha Centauri, multiply weight by x2.
  • If your faction has -PROBE built-in, you have Conquer not focused, and the tech is a prereq (to depth 2, or 3 if also Discover focused) to the Hunter-Seeker Algorithm, multiply weight by x2.
  • If your faction has -PROBE built-in, you have Discover focused, and the tech is a prereq (to depth 3) to the Hunter-Seeker Algorithm, multiply weight by x2.
  • If you have Explore focused and the tech is a prereq (to depth 2) to Doctrine: Initiative, multiply weight by x2.
  • If you have Discover focused (or the map generation settings had low rainfall) and the tech is a prereq (to any depth) to Environmental Economics, multiply weight by x2.
  • If your faction has the (unused in any default faction) PSI modifier and the tech is a prereq (to any depth) to The Dream Twister, multiply weight by x2.
  • If the tech gives fusion or quantum reactors, multiply weight by x2.
  • If the tech is a prereq to fusion reactors to any depth, add 1 to weight
  • If you have too much ecodamage (by a formula we don't understand yet) and the tech is a prereq (to any depth) to Tree Farms, Hybrid Tree Farms, Centauri Preserves or Temples of Planet, add an eco-damage-based factor.
  • If your faction has a max population penalty (ala Morgan), and the tech is a prereq (to any depth) to Hab Complexes, multiply weight by x2.
  • If your faction has a max population penalty (ala Morgan), it's after turn 250, and the tech is a prereq (to any depth) to Hab Domes, multiply weight by x1.5
  • If you have Conquer focused and the tech gives a new offensive weapon, multiply weight by x4. If the tech is an immediate prereq to an offensive weapon, multiply weight by x3 instead.
  • If you do not have Conquer focused, or you do and ALSO have Discover focused, and this tech is a prereq (to depth 1) to a Secrets that has not been triggered yet, multiply weight by 3.
  • If the tech is a prereq (to any depth) to formers and you don't have the former tech, multiply weight by x4.
  • If the tech is a prereq (to any depth) to foils and you don't have the foil tech and you have practically complete ownership of any landmass, multiply weight by 6 per landmass you have practically complete ownership of.
  • If the tech is a prereq (to any depth) to foils and you don't have the foil tech and there are any players without bases on any landmass that you do have bases on, multiply weight by 2 and add 4.
  • If using Thinker mod with tech_balance enabled, and the tech gives Formers, Supplies, Probe Teams, Recycling Tanks, Children's Creches, or resource cap unlocks, add 40.
Then multiply by 256/TechTier, roll 1d(Weight + 1) for all available techs, and pick the highest (ties broken by 'earlier in the tech list')

Notes:
  • The prereq check includes the target tech. For instance, with the default tech tree, Threshold of Transcendance will recieve the x4 muliplier if the player is about to win, in addition to its parents and grandparents.
  • These steps are performed in order, so if multiple multiplications apply, they apply multiplicatively.
  • These all assume that you are a human player with Blind Research enabled. AI focus is significantly weaker than player focus, probably to avoid AIs getting stuck with their fixed agendas.

Note those +PLANET conditionals; those are some DANG good techs that Deidre/Cha Dawn/Caretakers get bonuses to, ESPECIALLY in original Alpha Centauri where Planetary Economics was dependent on Ecological Engineering. This is probably part of why Diedre tends to be a terror.

Offline pblur

Re: How exactly does Blind Research pick techs?
« Reply #5 on: March 03, 2023, 02:17:07 AM »
BWAHAHAHAHA AND NOW IT'S IN MY SPREADSHEET! AND IT ONLY TOOK ME SIX HOURS OF MANGLING GOOGLE DOCS!
 ;danc ;danc ;danc ;danc

Offline DrazharLn

Re: How exactly does Blind Research pick techs?
« Reply #6 on: March 03, 2023, 02:56:17 AM »
You're welcome :)

Offline pblur

Re: How exactly does Blind Research pick techs?
« Reply #7 on: March 03, 2023, 03:31:50 AM »
Updated version of the spreadsheet I downloaded off of here and have been using for while now with (mostly) accurate tech odds. I'm not incorporating a couple of factors that haven't been reverse-engineered, and I hardcoded things like 'the tech that gives foils' to their default values. That wouldn't be terribly difficult to change if some modder wants to use this though.

https://docs.google.com/spreadsheets/d/1n7rfYsu_vSj-bMnoL1nnkbckS527FUU7H1X0SrKwqwE/edit?usp=sharing

You'll have to click Make a Copy to use it.

It's immediately quite convenient in my current AAR game. Current Tech:



Suppose I want to focus on Advanced Spaceflight. It's a Discover tech, and focusing Discover gives pretty good odds. On the other hand... it gives a weapon. What if I enable Conquer too?



Much much better! I wonder why... Let's look at the Tech Tree tab.



You can see that it has a nice base value from the Discover, but it doesn't have anything impacting it beyond that.



Here it is with Conquest and Discover on, with that delicious 4x boost from having a weapon unlock.


Offline DrazharLn

Re: How exactly does Blind Research pick techs?
« Reply #8 on: March 03, 2023, 04:16:12 PM »
Neat. I found it interesting how specific the algorithm is. I would have expected something a lot simpler with just a random choice weighted by the tech's Growth/Explore/Conquer/Discover score in alphax.txt.

Offline Vidsek

Re: How exactly does Blind Research pick techs?
« Reply #9 on: March 03, 2023, 08:27:57 PM »
Indeed.  I too was expecting a slightly modified random pattern.  This is much more interesting, I may well start choosing it more often.
All this talk of fungus and worms makes me hungry...

Offline pblur

Re: How exactly does Blind Research pick techs?
« Reply #10 on: March 06, 2023, 02:52:47 PM »
One more update of the spreadsheet, courtesy of my brother. He tried using it on a potato, and found that I'd been really inefficient on a lot of the calculations. This is his update, optimized for performance and with a couple of bugs fixed:

https://docs.google.com/spreadsheets/d/1wA6CSoj_O2WrG98fj7HDCvMXl6kaKhMs-klxdDpkk5Y/edit?usp=sharing

Edit: Note that you can configure your setup in the Config page; this supports things like whether you're playing a planet faction, whether you're at war, etc. It also has a checkbox for Thinker's TechBalance option, if you use that.

Offline magic9mushroom

Re: How exactly does Blind Research pick techs?
« Reply #11 on: June 18, 2023, 03:24:11 AM »
Thank you so much DrazharLn! I spent a few hours hunting around the codebase to understand everything, and here's the procedure:
I think I spot a couple of errors here, assuming that code-dump is accurate:

Quote
If the tech has no weights in any category you have focused, and is not a Conquer-weighted tech while you're at war or an Explore-weighted tech while you have 4 or more cities, halve the result.
The Explore condition is "you don't have it focused and you have 4 or more cities", not "you don't have it focused and you don't have 4 or more cities". I.e. if you have 3 or less cities, it decides Explore is "useful" even if unfocused.
Quote
If you have Discover focused (or the map generation settings had low rainfall) and the tech is a prereq (to any depth) to Environmental Economics, multiply weight by x2.
This procs off Build ("wealth") focus, not Discover ("tech") focus.

Note those +PLANET conditionals; those are some DANG good techs that Deidre/Cha Dawn/Caretakers get bonuses to, ESPECIALLY in original Alpha Centauri where Planetary Economics was dependent on Ecological Engineering. This is probably part of why Diedre tends to be a terror.
I mean, yes, she gets bonuses to them, but it's not as great as it might seem. The x2 for the Environmental Economics beeline with Build turned on, combined with those techs' unusually-high Build and Explore values, makes restriction lifting highly favoured under Build or Build/Explore (the latter also favours Industrial Automation due to the Doc:Init x2, and more strongly favours restriction lifting over random other techs like Applied Physics, but practically ensures you will get Doc:Flex ASAP which is meh as a pure Builder).

What Deirdre's bonus does (in vanilla i.e. PlanEco reqs EnvEco) is make Explore and Build/Explore massively favour restriction lifting over everything else, including Industrial Automation and Doc:Flex (but not Doc:Mob; Deirdre still gets that one, because it's a prereq of Planetary Economics). Thing is, though, you want Industrial Automation, and (as Deirdre) ironically also Doc:Flex since she is never a pure Builder - and there's no actual way to prioritise these as Deirdre due to the same Explore that triggers their multipliers also triggering Deirdre's massive restriction-lifting multipliers.

Morgan's x2 to Industrial Automation beeline seems at least as good, and Zak's ability to home in on Pre-Sentient Algorithms (and, to some extent, therefore Fusion Power) with a x4 is pretty notable later on.
« Last Edit: June 19, 2023, 02:50:22 AM by magic9mushroom »

 

* 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

A ship at sea is its own world. To be the captain of a ship is to be the unquestionable ruler of that world and requires all of the leadership skills of a prince or minister.
~Col. Corazon Santiago 'Leadership and the Sea'

* 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: 38.

[Show Queries]