Infixo / Civ6-Real-Strategy

Civ6 Real Strategy mod
8 stars 2 forks source link

Units - pseudo yields #30

Open Infixo opened 1 year ago

Infixo commented 1 year ago

Observations.

  1. UNIT_ROCK_BAND and UNIT_NATURALIST are PSEUDOYIELD_UNIT_RELIGIOUS.
  2. Only UNIT_SCOUT is PSEUDOYIELD_UNIT_EXPLORER.
  3. Great People are defined also in GreatPersonClasses. Which one is actually used? What happens if we put also the same defs into Units?
  4. Not a single unit is defined as PSEUDOYIELD_UNIT_COMBAT.
Phyrax1 commented 1 year ago
  1. I wonder if the AI's exploration will actually improve if all the upgrades from scouts are put in. I also think that assigning naval raider units the explorer pseudoyield could produce interesting results. I will try this out
  2. --
  3. Damn. At least the mistake seems easy to fix, but it may cause unwanted results in practice because I think the AI's military with RST is perfect how it is.
Infixo commented 1 year ago

Ad. 2. My understanding is that there is a difference between producing units and actually using them. Production is governed by scoring i.e. the biggest value. AiFavoredItems and PseudoYields can influence that (well, most of the time :)) But usage of units is governed by AiOperations and Behavior Trees. Here UnitAiTypes and UnitAiInfos are important imho. Ad. 4. I first try to understand if it really matters. So far, seems that it does not. It's a bugger nonetheless. RST uses extensively another system which is based on Unit Promo Class. Maybe that is why it is working.

Phyrax1 commented 1 year ago

Yes, using the units is of course a different matter. What I was excited about was that right now the AI probably just stops producing recon units (even with a high explorer pseudoyield) because they researched scout upgrades and can't produce scouts anymore. Adding the upgrades (not promotions, sorry) maybe makes them produce more recon units later on and the AI would hopefully be better at revealing the entire map that way.

Phyrax1 commented 1 year ago

So I just ran some quick tests where I put the DefaultValue of PSEUDOYIELD_UNIT_COMBAT to 100.0 and updated scouts in Units to have the PseudoYieldType PSEUDOYIELD_UNIT_COMBAT. In theory they should have produced scouts like crazy since they are the only unit with that pseudoyield and it being that high.

I ran 3 test games with both the DefaultValue at 100.0 and then with it at 0.1. On online speed Deity: Only 1-2 Scouts were produced in all games at the start. With the DefaultValue at 0.1 the AI had 100-250 military strenght at turn 21 in all 3 games. With the DefaultValue at 100.0 the AI had 500-600 military strenght at turn 21 in all 3 games.

So this is a crazy difference that shows that the pseudoyield already works as intended and doesn't actually use the Units table I think.

Infixo commented 1 year ago

The DefaultValue in PseudoYields table works, that is for sure. But it changes it for everyone, majors and minors and only in one way. The question for you - what did they produce when having 500-600 strength? Scouts? All units? The real issue is how to influence combat units production only in specific cases, that is how AiFavoredItems should work.

Phyrax1 commented 1 year ago

Yeah I just wanted to test if PSEUDOYIELD_UNIT_COMBAT works at all, even with different or no units being associated with it in the Units table. They produced a decent mix of units (warriors, slingers/archers, spearmen, unique units; didn't bother counting because the difference was so obvious). Only 1-3 scouts. I'm not sure why it doesn't work for minors. Maybe that specific pseudoyield really just doesn't work with the PseudoYields system in AiFavoredItems. I don't know how much you have tested other pseudoyields there.

Phyrax1 commented 1 year ago

I have run some not so quick tests now with adjusting PSEUDOYIELD_UNIT_COMBAT using AiFavoredItems. I added a ListType "DefaultPseudoYields" for all leaders and tested 5 games each with the Values 100 and -100. I did not change anything else (no assignments in the Units table made). To reduce randomness I picked a huge TSL map with selected civs, no city states, 0 disaster level etc.. I calculated and wrote down the average military strength of all civs for each game. This is still online speed on Deity, but this time I looked at turn 31.

Value -100:

160 190 214 206 213

Value 100:

260 352 343 302 284

It could still be that only the negative or only the positive value works, but adjusting PSEUDOYIELD_UNIT_COMBAT with the Pseudoyields system in AiFavoredItems definitively works; there is a big difference in military strength.

I really don't know why it doesn't seem to work for city states. If your tests stay unconclusive, I will try testing these also. Maybe I am doing something different somehow.

Phyrax1 commented 1 year ago

I have also confirmed a theory I had: I think all units that have no pseudoyield assigned automatically use PSEUDOYIELD_UNIT_COMBAT. So the pseudoyield assignment in the Units table is definitely VERY relevant.

I assigned all units without an assigned pseudoyield EXCEPT slingers with PSEUDOYIELD_UNIT_EXPLORER and then increased the DefaultValue of PSEUDOYIELD_UNIT_COMBAT to 100.0 again. Result is in the screenshot. slingers So with no assignment on slingers, they spammed them because it was the only unit that had no assignment which means they are the only unit that are treated as combat units.

Infixo commented 1 year ago

I have also confirmed a theory I had: I think all units that have no pseudoyield assigned automatically use PSEUDOYIELD_UNIT_COMBAT.

That is actually pretty neat explanation, very reasonable!

Infixo commented 1 year ago

My additional tests in #29 also confirm that there is no need to fill up the empty pseudos in Units. See here: https://github.com/Infixo/Civ6-Real-Strategy/issues/29#issuecomment-1497853502

Infixo commented 1 year ago

I really don't know why it doesn't seem to work for city states. If your tests stay unconclusive, I will try testing these also. Maybe I am doing something different somehow.

It works. I used the word "inconclusive" because the differences in results were very small. But after more thorough testing I am convinced that they work as they should.

Phyrax1 commented 1 year ago

I was wondering if builders are actually affected by the combat unit pseudoyield since they also do not have an assignment. But after some quick tests I conclude that they are not. I put in some crazy numbers in DefaultValue (from 0.1 to 500.0) for PSEUDOYIELD_UNIT_COMBAT with builders being the only unit with no assignment and also with them having it assigned and the AI produces builders all the same.

Great people also are missing an assignment but I assume that it also doesn't matter for them, especially because they can't be produced directly. And maybe the combat unit assignment just doesn't matter for both builders and great people because the AI evaluates these by their combat strength and for them it is 0.