arkhometha / Historical-Project-Mod

A mod for Victoria 2 - Heart of Darkness 3.04
157 stars 52 forks source link

[BUG] AI Japan Unable to Westernize #214

Open freecsu opened 4 years ago

freecsu commented 4 years ago

While playing on the latest dev branch The Shogunate unified Japan and then never westernized. Tag switching to them showed they were at 95% civilization progress and had the maximum amount of stored RP but were not taking any more reforms even though they could have. They remained stuck like that for the entire game.

As an aside, I am not sure if this is a bug or just a localization error or what, but the International Debt unciv reform claims to give 35% civilization progress in the tool tip but appears to only give 20% when taken.

moretrim commented 4 years ago

A quick history of changes I could locate that have been addressing this sticky issue:

7aab423e9f38d9d5f8d5a957a83532d866d473d2 bumped MAX_RESEARCH_POINTS from 25k to 28k (for reference the unmodded value is 35k), noting the following:

  • Slight increase to Max RP uncivs can store to avoid potential deadlocks over expensive reforms.

This was long before today’s master. Currently only on Development, 2e9cf03b0e2f437c3bd3b3f5b64bcdbd852e2bf1 mentions:

  • Fixed a bug that potentially made unciv AI stuck trying to pick a reform.

If I understand the change correctly, it made it so a couple 3-step reforms no longer need to be selected gradually, e.g.:

https://github.com/arkhometha/Historical-Project-Mod/blob/2e9cf03b0e2f437c3bd3b3f5b64bcdbd852e2bf1/HPM/common/issues.txt#L1112-L1113

Tag switching to them showed they were at 95% civilization progress and had the maximum amount of stored RP but were not taking any more reforms even though they could have.

In my experience (on master only, no Development) the 28k threshold can be too low for Foreign Universities, which as I understand it the AI prioritises. This leads to the country waiting for more RPs that it can’t possibly store. I’ve seen this happen for countries other than Shogunate Japan.

Can you include a save? (You can achieve this by compressing the .v2 save into the archive format of your choice, and then e.g. drag & dropping this archive onto the comment box. Hopefully, sometimes even the compressed save is too large.) This would help figure out on what the AI is stuck on. Otherwise, can you help provide the following:

As an aside, I am not sure if this is a bug or just a localization error or what, but the International Debt unciv reform claims to give 35% civilization progress in the tool tip but appears to only give 20% when taken.

The last time I looked into this, this is a limitation of the underlying game. The 35% progress is what will be achieved when reaching this particular level of reform, meaning this total also includes all previous progress and does not reflect the amount of just that step. There’s not much the mod can do about it.

freecsu commented 4 years ago

It doesn't seem to be a cost issue.

I wonder, since westernization progress doesn't technically cap at 100% does the AI maybe try to avoid going over? Since they are stuck at 95% and even the lowest reforms provide 10% progress.

moretrim commented 4 years ago

Thank you for the follow-up, we have now figured out this isn’t an RP cap issue since every possible reform is within reach.

I wonder, since westernization progress doesn't technically cap at 100% does the AI maybe try to avoid going over? Since they are stuck at 95% and even the lowest reforms provide 10% progress.

This can be tested by temporarily tweaking a reform to grant 5% progress, and loading the save.