• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
If the only problem is with writing the code for it, given the formulaic nature of the system, couldn't you just write a program to write the long, repeatable part of the script for you? (Write a program to write you program : P )


Lets say you give each resource its own number so a province modifier looks like export_p_1_333 (exporting primary resource 1, grain, to province 333, Rome), couldn't you do something like

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void) {
  int P, p, i, prov_num;
  prov_num = 1463;
  P = 50;
  FILE *output;
 
  output = fopen("output.txt","w");
 
  for(p = 1; p <= P; p++) {
    for(i = 1; i <= prov_num; i++) {
  
      fprintf(output, "if = { \n");
      fprintf(output, "  limit = { \n");
      fprintf(output, "    ROOT = { \n");
      fprintf(output, "      province_id = %d \n", i);
      fprintf(output, "    } \n");
      fprintf(output, "  } \n");
      fprintf(output, "  set_province_flag = export_p_%d_%d \n", p, i);
      fprintf(output, "} \n");

    }
  }
 
  fclose(output);
  return EXIT_SUCCESS;
}

for 50 primary resources (this ignores other types of resources, but if you change the value of P to the number of refined resources and change export_p_ to export_r_ etc. you use it again and copy the next load in for refined goods etc.

edit: Obviously if having that many province flags exist at all is a problem this won't solve it, but it should help with the grunt work?

For just one resource type at a time, you could remove the first for loop (and corresponding bracket) and the variables p and P, and change the penultimate fprintf statemant to fprintf(output, " set_province_flag = export_p_grain_%d \n", i); , manually changing the resources one at a time.
 
Last edited:
Ok you are better versed in actual programming than me ^^
Well, I do know a bit about programming, I've had lets say a "crash course" - but I haven't done anything in years, so what you posted above would have cost me days to figure out again.

But yeah, that could help with the coding side, you are right.
I am just not convinced that it would be that effective because the AI would need to go through these long lists every time, both when it sets the flag and when it reads it. Thus, a lot depends on how often a tradegood change would really happen as compared to a regular interval.
And I can't go into too much detail yet (or I don't want to :p), but for unexplained reasons some tradegoods might be subject to frequent variations, and I need to... no, I can't really explain it without spoilers.

I think I will go with the regular interval check approach for now, but if performance becomes too slow, I can always come back and redo it with this flag system.
Some things that should minimize the impact I have already figured out, such as these:
a) divide provinces into several groups, let's say 10. These groups will get the maintenance events after each other, spreading the performance impact over a period of 10 days.
b) check each tradegood type independently. So first check for refined products, and then check for finalized products. Again spreads the performance impact over twice as many days - a total of 20 days now combined with a)
I might even split up each individual slot, i.e. three separate checks for the individual refined goods, then three for the finalized ones, depending on whether this really is necessary.

I've also run into a totally different problem: Graphics.
More specifically, province tradegood modifiers. There used to be some placeholders even in the old version, but now tradegood count has increased... like... significantly. There's no way I can get icons for them in a similar art style anytime soon, especially not if you need to be able to tell them apart easily.
So for now, without getting too much headaches about this, I will simply be using lots of placeholder graphics. And to still be able to identify them without hovering over them to see the tooltip, they will simply get their tradegood's initials written on them: For example, GRAI for Grain, GRAP for Grapes, BREA for Bread, STON for Stone etc.

Oh, and some good news as well: I have figured out a new explanation for the acronym - the new words fit perfectly. But again, would be spoilers :p

So, I will probably disappear from this thread for a bit now (but you can of course still post if you want), to actually get something done as opposed to endless brooding over problems ^^
See you in a bit for the next dev diary :)
 
woooow this looks amazing. this is what paradox should be working on, not just more characters with few changes in mechanics. Id love to add this for my vanilla game, but i guess its just one more thing to look forward to once JD is out and Plus patches it!
 
woooow this looks amazing. this is what paradox should be working on, not just more characters with few changes in mechanics. Id love to add this for my vanilla game, but i guess its just one more thing to look forward to once JD is out and Plus patches it!
Glad you like it, but don't hold your breath for it - I won't release an update when JD launches.
I'm nowhere near finished, and it'll probably take well into next year before this here is ready. But eventually it will be ready, don't worry I'm not quitting :)

Edit: Oh, and btw, since we will get a "climate" condition with the JD patch, at least vanilla compatibility is one step closer indeed.
 
Glad you like it, but don't hold your breath for it - I won't release an update when JD launches.
I'm nowhere near finished, and it'll probably take well into next year before this here is ready. But eventually it will be ready, don't worry I'm not quitting :)

Edit: Oh, and btw, since we will get a "climate" condition with the JD patch, at least vanilla compatibility is one step closer indeed.
Ah everything good is always a year away. I like ambitious projects like this, keep it up.
 
Hey pete you mentioned before how Advanced Trade Systems might clash with some of the features of The Great Trade League submod. Would the same apply to this mod? I am seriously hungering for some in depth economy mods since out of all features of the game, I think this is where vanilla CK2 is lacking the most. But both yours and Maal's mods sound fantastic. I realize GTS add CTD might not be fully completed for some time, just wondering if I should start thinking about choosing one or the other, given how long CK2 games can go on for. Or whether I can get the best of both worlds :)
 
Hey pete you mentioned before how Advanced Trade Systems might clash with some of the features of The Great Trade League submod. Would the same apply to this mod? I am seriously hungering for some in depth economy mods since out of all features of the game, I think this is where vanilla CK2 is lacking the most. But both yours and Maal's mods sound fantastic. I realize GTS add CTD might not be fully completed for some time, just wondering if I should start thinking about choosing one or the other, given how long CK2 games can go on for. Or whether I can get the best of both worlds :)
Well, the same thing applies between any combination of economy-themed mods, or any combination of similar-themed mods in general.
Note that this isn't any sort of "hard" incompatibility as between overhaul mods like CK2+ & HIP, where you'd get crashes when using them together. It's rather a "soft" incompatibility, that will not stop you from playing but rather produce undesired results.
As of my knowledge, there are currently at least 4 bigger economy mods in various states of development:
The Great Trade League, Advanced Trade Systems, CTD and L3T.
The latter two are currently not released and in development, though L3T ("The Three Towers", by Arko) is probably much closer to a release. All of them have a different "focus", so to say:
Maal's League focuses on a global trading society, and thus mostly on interactions between players, and simulates tradegoods as artifacts that you can by and sell as a ruler. Advanced Trade Systems expands on the vanilla traderoute system, and adds several new routes as well as buildings to simulate the import and export of tradegoods, and simulates tradegoods as province modifiers. Arko's L3T replaces the vanilla traderoutes completely with a dynamic system that uses major province modifiers, displays tradegoods as province modifiers and uses buildings to simulate their exploitation, and in addition it also features stuff such as a major "cathedral-building-system" - in many ways it is a bit similar to ATS, only more extensive, thought-out and dynamic (well, in my opinion at least ^^). Lastly, my CTD is focuses on simulating a global economy, and tradegood refinement solely through province modifiers, though like Arko's mod it now touches other subjects such as "Natural Barriers" like swamps, that will get cleared to display the progression from the early to the late Middle Ages.
As you can see, they are all slightly different, but their common subject is economy.
My submod will be unique insofar as it will be released as a submod for CK2+ only, with other compatibility to consider later. Reason is that mine is closely integrated with the map, which differs greatly between major overhauls.

Now you can use Maal's mod together with almost anything else, as the society will just get added on top. ATS will require compatches for overhauls like CK2+ because it changes the traderoutes, and the same is planned for the next version of CTD. L3T and CTD also produce compatibility problems because they add new modifier icons, which unlike traits are confined to a single file that will overwrite other versions of the same name if several exist.
Coming to think of that, there will be a "hard" incompatibility between CTD and L3T, because we both change that file. I do not know what's the case with ATS currently, but if that one adds unqiue icons (instead of re-using vanilla ones), then there will be a "hard" incompatibility between these three.
In addition, you get the old problem of multiple systems trying to do the same thing - worst case (and if hard incompatibility weren't a thing), you will see an "alcohol shipment" from Maal's mod, an alcohol export building from ATS, an alcohol producing province from L3T and an alcohol producing province from CTD: Which means 4 different province modifiers that all realte to alcohol, but do not "see" each other at all and act completely independent.

TL;DR: You can use Maal's mod with everything - it just might produce strange results in some cases. As for the others, there might be real problems if you use several of them. However, "sometimes less is more", to quote a recent CK2+ dev diary: Why would you need ATS on top of CTD, when my mod basically does the same things, only also additional things?
I know this sounds like a shameless promotion (well, this is my thread :D), and I don't want to talk bad of ATS: That mod is not a worse mod, it's just a bit simpler than these massive "half-overhaul" things like CTD: A quick, simple solution that adds to gameplay without getting complicated. But there is no reason to use it together with the more advanced ones, if you want even "more" stuff/complexity.
So for now, you really only can use the Trade League and ATS - and soon L3T, which however might not be compatible with CK2+.
Thus, use Maal's mod and ATS if you want to use them together with CK2+.
CTD is so far away, I guarantee you you'll have finished your next campaign before I release ;)
 
Thanks for taking the time with that reply. I think you're right. I'll probably skip out on ATS completely since I am looking for big expansion level changes. In which case Ill give GTL a go right now and eagerly await the release of this mod. I hadnt even heard of L3T ill have to look that up too. Appreciate you dropping the knowledge on the mod scene.
 
As of my knowledge, there are currently at least 4 bigger economy mods in various states of development:
The Great Trade League, Advanced Trade Systems, CTD and L3T.
The latter two are currently not released and in development, though L3T ("The Three Towers", by Arko) is probably much closer to a release. All of them have a different "focus", so to say
L3T has circa 10 released versions already. Even if we still calling it a beta lol.
 
L3T has circa 10 released versions already. Even if we still calling it a beta lol.
Ah well yeah, I was referring to the next "proper" version with the new cathedrals and stuff. I know you had versions before, because I played with them a bit :)
I just thought I shouldn't point to the older versions as to not get people to use them, and just wanted to point to your mod as an alternative.
 
So if you still havn't found a solution to your import/export problem, I may have a suggestion. Admittedly, its not much better than keeping track of each province and trade good together. If you break up the flags into two, one for each province and one for each good, you could reduce the number of flags stored. It doesn't help much for the checks, but it would reduce the number of flags from M x N to M + N. This could be handled by having the exporter keep track of where its goods are going and the importer handling what good it is importing. The exporter could send an event to all provinces it exports to. These importers would check their flag against the modifiers from the exporters. Ideally, these event would have a random delay added to them to distribute the calculations, as it could get rather stressful if a single province exported to many others. By triggering this only on resource change it should reduce the times its called to only when necessary. And if it's still too taxing, breaking the events into checking for each tier could reduce the number of checks when the events fire. Honestly, it still sounds like a rather bad fix; all it really does is reduce the amount of flags and cut the checks into smaller bites.
 
Another idea, indeed. Yet as you said, it has its drawbacks as well, and I'm afraid there's just no "optimal" solution to this problem.
I really appreciate the input from y'all, it's kinda motivating; but I've decided to make a decision and move on. Because otherwise, I'd be stuck on this problem for far too long, and I need to solve lots of other, smaller problems as well.
So the mod will use regular events that re-import everything, but only bother the player if there is need for adjustment. This really is the best solution also in relation to still unannounced parts of the new mod. And really the only thing that would make me reconsider this import-export thing is if performance would turn out to be abyssal.

You may have probably guessed already, but one reason for the delay is that I constantly find new fun things to add, and I'll probably need to cut some of these things from the initial release because fleshing them out will take more time. I also need to do several more passes of the tradegoods themselves, because as of now there are no "recipes" for the refined and finalized products, and only the resources are mostly finished. And I'm currently super-unmotivated to do this for some reason.
But right now, I'm working on a way to divide provinces into several (ten, to be precise) groups, where provinces in the same group do the import checks on the same day, but all the groups import one after the other so performance does not get crushed by one day where everything happens. I am thinking that these groups should be hierarchical, e.g. big cities like Constantinople, Venice and Cairo being in the first group, and thus being able to import before the smaller and less important ones. However, it turns out to not be that easy to sort and group things in a certain order, but I am pretty confident I have a decent solution, so I don't need suggestions here right now. Should this change, I'll let you know :)
 
sorry, wrong thread :D
I had a bit of a fever yesterday.

So yeah... Plus will have a new version before christmas. I don't know about this.
Haha, I figured so much ;)
Still, in the first second I wondered whether some unknown plot was ongoing, and you had abducted my idea and made your own economy submod. Only in the first second, but you can't blame me for being suspicious, with all your frequent talk of "we have super-secret plans about this, oh and this as well" :D

whoops sorry.... i would offer to help but it sounds like you need help with things map related and thats something i not learned to mod yet.... i can do buildings
Oh, that's nice! I appreciate your offer; however, as you say, I currently am so low level I wouldn't even outsource work to "professional" modders.
If that may change in the future, I shall let you know. I do have plans for buildings, but these are the very last thing on my list, and work on them will probably only start after the initial rework-version of this submod has been released.

That being said, while i can't give you a version, I can give you a dev diary. Because progress is slow, but steady, and I have gotten some overdue coding done recently. Dunno if I can get the diary ready today or tomorrow, but probably before Christmas.
And just to give you a rough estimate how far away a release still is: I plan to post at least 10 more dev diaries before that happens. So I'd guess a solid six month still, somewhere around the summer holidays.
 
Only in the first second, but you can't blame me for being suspicious, with all your frequent talk of "we have super-secret plans about this, oh and this as well" :D
As long as it isn't societies, I'm kind-of basking in my monopoly right now!
Oh, that's nice! I appreciate your offer; however, as you say, I currently am so low level I wouldn't even outsource work to "professional" modders.
If that may change in the future, I shall let you know. I do have plans for buildings, but these are the very last thing on my list, and work on them will probably only start after the initial rework-version of this submod has been released.

Technically being a professional CK2 modder would be against the TOS as it mean you live off it and thus make money! :p

I wouldn't consider you that low level anyways as what you are making does look more complex than the low-effort cheat mod that flood the workshop.