Europa Universalis V

Europa Universalis V

(Mostly) Fix Trade Companies
 此主题已被置顶,因此可能具有重要性
Conner  [开发者] 11 月 21 日 下午 8:02
Fixes Discussion and Suggestions
Here is where all discussion and suggestions related to fixing the base game trade companies will occur. If you have suggestions that involve additions/balance changes/beyond just trying to fix the issues with the base game trade companies, see the overhaul discussion.

In general, I tried to limit this mod to making Trade Companies function as Paradox seemed to intend (whether or not I agree with it). While I've gotten them into at least a usable state, I've had to make some compromises to do so, and I've yet to figure out how to fix some things or whether it's possible to do so.

Explanation of Fixes:
1. Trade companies start with the Trade Company advancement:
I made it so that once a Trade Company Headquarters is built and the company is created, the advancement is unlocked for them. Preferably, I would like to have them inherit their overlords' technology, but I haven't yet figured out how to do so. If anyone knows how this can be accomplished, let me know.

2. Allow overlord to build Trade Company buildings:
There was a limit to the number of Trade Company buildings that could be constructed, `number_of_satellite_trade_buildings`. Where each building should be allowed if either the overlords, or the Trade Company's max number of satellite trade buildings was greater than the max number of satellite trade buildings. However, the only source of this was from the Trade Company headquarters, which only gave it to the Trade Company itself, so the overlord would never have any source of this. However, since they were explicitly checking against the overlords' limit as well, it seems Paradox intended for you to have some source of it and thus be able to build in your Trade Company subjects. They also accepted a bug report[forum.paradoxplaza.com] on this, so I assumed that to be the case.

So why remove the limit altogether rather than just make the `number_of_satellite_trade_buildings` apply to the overlord as well?
Because the limit never functioned to begin with. Despite, in theory, limiting trade companies to building only 2 of each type of company building, it never did so, and as a Trade Company, you could build unlimited numbers of each.

Additionally, this limit doesn't really make sense to begin with, as the company buildings themselves are already relatively weak, and you will already be limited by the Trade Company regions to begin with. Further, I'm not sure how this limit would even work with the overlord, anyway, as the modifier is a global one, and since you can already just make as many trade companies per region as you want, you could just bypass it entirely by making 10 subjects per region. So I don't know how Paradox intended this to work to begin with. But if anyone finds a limit may be needed and has a suggestion for doing so, leave a comment, and I'm willing to add one in.

3. Attempted to make the Trade Company AI build more:
Currently, it seems like the Trade Company AI is very against actually building more company buildings. I've tried to improve this by adding these two flags to each building so they will ignore the Burghers' requirement (since there likely won't be many where the Trade Companies are to start), and prioritize them more by adding the following to each building:
AI_ignore_available_worker_flag = yes important_for_AI = yes

However, even with these, they still don't seem to expand much, even if you give them loads of gold (probably because the base game Trade Company buildings are rather poor investments). I don't know if there is more I can do to encourage them, but if anyone knows of any way, let me know.

4. Removing the market access requirement:
Note: This still applies to constructing the headquarters, just not the buildings themselves.

Paradox clearly meant for your market access to count for the Trade Company itself, in the original file for all the buildings they used:
own_or_overlord_relation_needed = trade_access
(`trade_access` is just market access preference)

However, this check, `own_or_overlord_relation_needed`, doesn't actually count for the overlord. And the AI will never request market access preference on its own. Meaning they will never be able to build any of the Trade Company buildings with this requirement in place.

But, this requirement doesn't matter much as the base acceptance chance for request market access preference is already positive with no modifiers to ever make the AI deny this. So if the AI actually did request this, then they could get access to everyone with a market anyway.

But what this would have done had it functioned is prevent Trade Company buildings from being constructed in companies that did not own a market as long as they are still in the same Trade Company Region. I do not see this as much of an issue overall, but if I do find a way, or if Paradox fixes that check, then I will add it back so it is as 'intended'. But for now, the removal serves to allow trade companies to actually construct buildings.

5. Allow renaming trade companies:
This turned out to be far more troublesome then I had hoped. The `RENAME_COUNTRY` context menu action uses `[CanPlayerRenameCountry(Country.Self)]`. While I cannot modify that directly, I just added a or clause for Trade Company subjects. But while this made the Rename Country Dialog appear, after putting in a name and confirming, the company's name stayed the same, so the `RenameCountryDialog` must have its own individual check. But that seems to be handled by the executable and thus isn't accessible to mod.

I therefore modified the Trade Company subject type and added `is_colonial_subject = yes`, making it count as a colonial subject (but still is its own separate subject type), and allowing it to be renamed. This allows Trade Companies to be renamed, but I am not sure if this will lead to any unintended consequences. I looked at all the obvious places (i.e., there is no 'start colonial war' option) and didn't see any issues, but if something comes up, I may have to revert and see if there is any possible workaround until Paradox resolves the issue.

Todo List/Potentially Cannot Fix:
1. "We can not build a [Company Building] in [location] as there are already [Country Pops] there."
It's clearly an unintentional error, as once the Trade Company has a building in a location and it employs pops, you cannot build any more company buildings there. This issue doesn't apply to the Trade Company itself, only the overlord of it. But this means you cannot build more than one Trade Company building per location for your subject.

This requirement does not actually appear anywhere in the files except for its localization. After a lot of experimenting, I believe it stems from the `is_foreign = yes`. Removing this requirement allows the Trade Company to build within its already existing borders, but not expand at all. And it would prevent the overlord from building at all. There doesn't seem to be any way to modify the `is_foreign` check to omit the population requirement, and I've not found a way to let you construct any buildings abroad without it. So there is a high chance I will be unable to fix this and will have to wait for a patch from Paradox. They have already confirmed a bug report[forum.paradoxplaza.com] which points out this issue, so hopefully it won't be long. If anyone does know of a potential workaround, then let me know, and I would be happy to add it.

2. Fix issues with multiple trade companies per region.
Currently, if you have multiple trade companies in the same Trade Company region, then when either you or the Trade Company itself constructs a building, it will arbitrarily be transferred to one of them, with no way for you to decide which one. There may be a potential fix for this, or I may only allow one Trade Company per region. This is to be determined, and any suggestions are welcome.

3. Encourage the Trade Company AI to build more:
As mentioned in the above fix explanation, I would like to make the Trade Company AI build and expand more on its own. I'm not really sure what more I can do to encourage it more, but I'll keep poking around, and if anyone has any suggestions, let me know.

4. Possibly add back in the market access requirement for all company buildings
As mentioned in the above fix explanation, I removed this as it was not working as intended by completely blocking trade companies from building, and really wasn't contributing much, as the AI will always accept any request for market access anyway. The only thing this practically affects is preventing you from building in countries that do not own markets, which I'm not really sure if Paradox intended for anyway. I've included it since I'm not sure if the removal of this limit could cause any meaningful balance changes, but it is generally a low priority for me to change. If anyone finds that the limit does make a large difference and wants it added back, make a comment, and I'll see if I can make a functioning implementation.

And for reference, I've already tried adding a +1000 `wants_to_receive` reasons if the AI is a Trade Company, but they still don't request it for some reason.

Summary
This mod at least gets the trade companies functioning in a minimal state, but there are still some things not really working as intended. I'm working on fixes for as many as I can, but some may not be possible without a patch from Paradox.

If you are interested in helping with the mod, you can add or ping @arealconner on the EU5 Community discord server[discord.gg].

Please leave any feedback, suggestions, or more potential fixes to add below.
最后由 Conner 编辑于; 11 月 22 日 下午 2:28
< >
正在显示第 1 - 1 条,共 1 条留言
Pickle  [开发者] 11 月 23 日 下午 6:16 
You happened to upload this *minutes* after I checked to see if a Trade Company fix existed on Friday, or if I needed to make one myself xD. So I have my own version of this mod you may be interested in.

Diplomatic Relations
So I don't know if you noticed, but when the games files say "trade_access" it means the target country needs to be GIVING YOU market access preference. And you cannot receive market access preference if you have your own market. This means it's IMPOSSIBLE for Britain to build a TCHQ in, say, the Mughals, as a historical example. It would NEED to be done by the Trade Company after securing market access preference. This also means it's impossible to build a TCHQ in a country that doesn't own a market.

Personally, I think trade_access worked differently when they implemented Trade Companies, and when trade_access changed, they forgot to update Trade Companies. Why even let the player build a TCHQ otherwise? If you're trying to build one you almost certainly have your own market anyway. With vanilla behavior you can only build TCHQ's in your own colonies unless you're a small boi who doesn't even have a market.

I created a new diplomatic relation called "Trade Company Rights" to try and model the devs intention of requiring some kind of diplomatic agreement. I believe it also helps to give countries a means to stop letting you exploit their resources if you piss them off enough. I pretty much just copied "fleet_basing_rights" scripted_relation and renamed everything.

I was working on it so that if a TC's overlord has Trade Company Rights, that TC will be allowed to build in the target country, and their subjects, so you wouldn't need to worry about the TC requesting diplomacy. It also means that if the overlord gets on bad terms with the target country the TC suffers as well, which--to my limited knowledge--models history a little better.

I was also considering adding a new peace term to "Enforce Trade Company Rights". My vision was that something like the Anglo-Mughal war could evolve if the a country canceled trade company rights, and a foreign power could militarily force them back, but I still haven't gotten to looking into a peace term yet.

Trade Company Headquarters
Currently in vanilla, if you release a Trade Company, and that Trade Company builds a TCHQ, a new nested subject will be created under the Trade Company. I think that's madness and there's no way it's intended.

My solution was to just disable the ability to release a TC outright. In my mod the ONLY way to gain a TC subject is to construct a TCHQ. This also prevents a single country from having more than one TC in any region as you can't construct more than one TCHQ in a single region. I chose to do that as it was the behavior in EU4, it meant less work for the initial release, and it seems like the trade companies will struggle to be profitable already, dividing up their trade posts seems like they'll be even more neutered.

"We can not build a [Company Building] in [location] as there are already [Country Pops] there."
This is what I was working on all day today. I found the same localization string and couldn't find anything more. I'm glad you came to same conclusion, makes me more confident I'm not missing something obvious. I imagine a C++ function we don't have access to returns that, and is called when a building_type with the `is_foreign` flag is checked.

I have a fix working for that I plan to upload soon once I figure out some more about the GUI. I was making that a separate mod as it applies to more situations than just the trade company.

I create my own version of each foreign building that uses my own pop type that only exists for the purpose of circumventing this check. I created a new pop type called temp, and I redefined each foreign building to use this temp pop. Now, when the game checks for any existing pop types when I try to construct a foreign building it will NEVER find any because this pop ONLY exists during the construction of these buildings. Once the building is completed, I replace it with the standard building type, and delete the temporary pops. I use the `on_construction` trigger in `building_types` to facilitate this.

It works, but the problem is now the production menu shows two of EVERY foreign building. Tomorrow I will be spending the day reading through GUI files trying to understand their bizarre incantations to see if there is a way to hide duplicate buildings, and manipulate the counters so when the user clicks the regular permanent building icon it opens a view for them to construct the temporary buildings.

I hope that makes sense. I'm getting tired, and its all very confusing.

AI and Trade Companies
I hadn't gotten around to making the TC AI better yet either. I think there's more we can do that I've seen just skimming over game files, but I'm not sure.

---

Anyway, thanks for making such a thorough write up on your journey. We had *very* similar experiences xD. I @'d you in EU5 community discord as well.
最后由 Pickle 编辑于; 11 月 23 日 下午 6:16
< >
正在显示第 1 - 1 条,共 1 条留言
每页显示数: 1530 50