moretrim / ccHFM

Community Curated HFM
14 stars 3 forks source link

Cleanup decisions for ai unification #43

Closed rogerburks closed 3 years ago

rogerburks commented 5 years ago

Sometimes unification events seem to produce unfortunate effects, such as eternal wars with non-existent countries that were absorbed during unification. This seems to (so far) happen only for Abyssinia and Argentina. While it would be elegant to provide a catch-all fix for any infinite war, scopes that would accomplish this do not seem to function in the allow and instead reference only the triggering nation. For this reason, I have started by referencing only pre-unifcation tags of Abyssinia and Argentina. Other methods of solving this may be tested in the future. This is set to function only for the ai.

https://github.com/moretrim/PFH/blob/0c981f6592a3d67c7fb449c5b18710467743f34a/PFH/decisions/rbx_cleanup.txt#L10-L37

For puppet-related issues, I have made decisions that allow ai nations to release themselves if their overlord does not exist (relatively simple decision) and to hopefully elevate themselves to the puppet of an independent country if they are puppets of puppets. This latter decision has not been tested yet. It may quite possibly do nothing, because the last overlord statement could reference the overlord of THIS instead of the overlord of the overlord:

https://github.com/moretrim/PFH/blob/0c981f6592a3d67c7fb449c5b18710467743f34a/PFH/decisions/rbx_cleanup.txt#L64-L92

moretrim commented 5 years ago

Sometimes unification events seem to produce unfortunate effects [...]

I'm sceptical of this diagnosis, i.e. looking at the results as if they were the cause. There are many countries that unite through the typical course of a playthrough, and I've yet to see e.g. a German or Italian minor hanging around after the fact.

My impression is that most unifications are conducted by annexation (be it through a CB, event, or decision) and leave no mess behind. To be clear, annexation means:

If there are zombie countries my first instinct would be to try and figure out if something went wrong and if they lost all provinces without being annexed.

That being the case, there is merit to cleaning up after zombie countries regardless of circumstances. Speaking of, what does exists = no report for a landless country that is still around (i.e. conducting diplomacy, being at war, etc.)?

For puppet-related issues, I have made decisions that allow ai nations to release themselves if their overlord does not exist (relatively simple decision) and to hopefully elevate themselves to the puppet of an independent country if they are puppets of puppets.

What are these issues and how do they relate to unification or zombie countries?

rogerburks commented 5 years ago

It is true that each of these issues reflects something else wrong somewhere in a mod that should hopefully be addressed separately--the purpose of all this is to more easily rescue playthroughs where the issues themselves are not of primary interest. These issues have also proven to be difficult to predict because of rare scenarios.

With reference to the cause--I think I have never seen a zombie country or improper puppet that was not also a small tag involved in a unification process. This means Ethiopia, Argentina, or (in a more limited way) Japan.

Regarding zombie countries

I think the reason that this does not happen with German or Italian tags is first because their flavor does not lead to it--either it happens before unification events or does not affect their level of autonomy or existence, second because most of the tags are too weak to break things, third because the cores mostly do not promote separate types of war, fourth because the route to unification may promote head-to-head conflict between the two strongest countries for resolution of the unification, and fifth because addition to the union may be voluntary for smaller tags through a relatively harmless decision or event that correctly gets best-practice requirements sorted out before absorbing the tag.

Zombie countries seem to happen under a limited number of circumstances: 1) more than one nation has the power and cores to absorb others involved in their cultural union through parallel and separate efforts. This should explain why a Shewa/Harar war often results in a zombie country, since Shewa and Gonder satisfy this requirement. I'm not entirely sure what causes the zombie Harar or Shewa here but the chief suspect is the tag switch of (*usually) GON to ETH in country event 111001.

2) events with overlapping or nearby mean-time-to-happen separately causing unification and a war. This may be a culprit where immediate early unification is possible, and so probably it is best fixed by adjusting requirements for unification.

3) another country gets into separate a war with a tag that is about to be absorbed. Again possibly best fixed by adding war = no for all the tags that are about to be absorbed in unification.

Regarding non-existent countries, I do not know what they can or cannot do. I do know that they cannot fire a decision like this one. I do not know if they cannot fire an event (this is a good reason for me to test some things). I also do not know if this affects crises involving non-existent tags that are candidates for appearing.

Regarding puppetry issues

As above, I think this is tangentially related because it seems to happen only to ai countries that are on some sort of railroad towards being automatically puppeted and/or absorbed through decision or event (such as: Ryukyu or Schleswig). Additionally, puppetry-by-a-zombie-nation is conceptually related to the war-with-a-zombie-nation issue. However, I think this could justifiably be split into a separate issue and branch because these puppet decisions are relatively different in structure from the zombie nation war decision.

This would also have the added effect of never allowing a puppet of a puppet, therefore Schleswig would not be a puppet of a vassal Holstein. This could have unintended effects that break other events, but it does seem like a proper move in gameplay mechanics.

rogerburks commented 5 years ago

There is also one reason to possibly not allow the puppet-of-puppet decision for players or possibly for the ai either: It could be used to acquire all of the Dutch puppets early on.

rogerburks commented 5 years ago

Confirmed that non-existent nations cannot fire events.

It turns out that Hejaz Vilayet is perfect for testing puppet-of-puppet (of Egypt, dominion of the Ottomans). Also confirmed that the decision does not work. This is also a great reason for thinking very carefully before implementing this decision (that is: it may change the balance of power for some events).

rogerburks commented 5 years ago

So here, based on all that, I think potentially the best solution is for me to remove the puppet-of-puppet decision and convert this into a "zombie nations should not have things or interact" issue.

Maybe the puppet system could use an overhaul, but that is a whole thing all to itself.

moretrim commented 5 years ago

Zombie countries seem to happen under a limited number of circumstances: […]

I'm all but certain that a zombie country is a country that has lost all lands, and has not been annexed (as per my previous comment) when it should have been. Some of the experience I'm relying on involves the case of the Argentina–Corrientes eternal war (in recent versions of HPM, granted) which I solved by killing off landless Corrientes for good.

I'm ready to write off concurrent wars because of this, especially in the light of #32 where the first to enforce and properly absorb a target receives all benefits, other wars and CBs vanish.

That being said, your description of Ethiopian wars and events gave me a hunch. I browsed the CBs used and the following stuck out to me:

https://github.com/moretrim/PFH/blob/dc856f83a37f545190437e73145eb7a0968799f9/PFH/events/Ethiopia.txt#L55-L61

This is a good lead because acquire_all_cores is very peculiar. It's modelled after acquire_core_state, which is a state-targeting CB:

https://github.com/moretrim/PFH/blob/dc856f83a37f545190437e73145eb7a0968799f9/PFH/common/cb_types.txt#L473

but note that the 'safety' is off in the state check:

https://github.com/moretrim/PFH/blob/dc856f83a37f545190437e73145eb7a0968799f9/PFH/common/cb_types.txt#L504

In other words if a country uses the CB on a target on which it has all cores then this should result in precisely the situation I'm talking about: the target loses all lands (even the capital), but is not annexed. (There are likely good reasons that acquire_all_cores is set up like this, namely because acquire_core_state is. I'm trying not to digress too much however, and this is probably best left for another discussion.)

The way to test whether this hunch holds or not is to setup, say, a 3-way war and see what happens if acquire_all_cores is used in one case and civil_war in the other. Which, I have to admit, sounds pretty complicated & I'm not about to try just now.

Back on topic

[…] convert this into a "zombie nations should not have things or interact" issue.

Writing these digressions and sharing experiences has been useful for me to keep track of the larger picture, so I'd rather we keep this issue as-is to preserve the discussions. (We can keep it open if you feel like there's more to say or do about the matter.)

On the matter of our priority actionable item, let's go kill some zombies!

moretrim commented 3 years ago

Do we still need to act on something here?

rogerburks commented 3 years ago

Do we still need to act on something here?

I think it's all done with the zombie-diplomacy fix, so I'm good with a closing here.