• 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.
Culture is. Not 100% sure about culture_group, but I think it is too.
However, unlike religion it doesn't have a massive performance effect. It's better than putting it in the trigger, but not by a massive amount.

It's a shame that they don't filter. Would be a massive help for total conversions.
 
Am I correct in thinking that:
Code:
random_list = {
   70 = { }
   30 = { add_trait = x }
is less efficient than:
Code:
random = {
   chance = 30
   add_trait = x
}
 
Has anything changed with localisations? My mod uses the 'zz_' format to override vanilla localisations and now when I start the game up, it solely uses vanilla localisations.
My provinces are all named with vanilla titles.

Please let me know if I can do anything to update localisations to 2.6.1. Thanks Meneth.
 
Last edited:
Has anything changed with localisations? My mod uses the 'zz_' format to override vanilla localisations and now when I start the game up, it solely uses vanilla localisations.
My provinces are all named with vanilla titles.

Please let me know if I can do anything to update localisations to 2.6.1. Thanks Meneth.
I'm no longer on the project, so I can't check how it works any more.
Though I've heard other modders say that something has changed too.

You could try going with aa_ rather than zz_ and see if that works.
 
I'm no longer on the project, so I can't check how it works any more.
Though I've heard other modders say that something has changed too.

You could try going with aa_ rather than zz_ and see if that works.

You were right. They flipped the override order. aa_ now works instead of zz_.

Kinda random...
 
Kinda random...
There probably was a good reason behind it; but it definitely should have been stated that the change was made.
 
What about scripted_triggers ? I use them a lot, and don't know how efficient it is. I was told that there should be no loss of performance, even maybe a slight boost, but I don't think it was an official answer.
 
What about scripted_triggers ? I use them a lot, and don't know how efficient it is. I was told that there should be no loss of performance, even maybe a slight boost, but I don't think it was an official answer.
Not much overhead there I believe. Probably equivalent to wrapping the actual trigger in "AND".

Can't check the code though, so not 100% sure about that.
 
  • 2
Reactions:
Not much overhead there I believe. Probably equivalent to wrapping the actual trigger in "AND".

Can't check the code though, so not 100% sure about that.
As long as it does not affect the game performances in a bad way, it's good enough for me. Thanks for the answer !
 
Question about decision optimization:
I've noticed that some vanilla decisions use 'potential = { is_alive = yes }' for targetted decisions.

Which has always confused me. Are those actually needed?

...if the potential doesn't include 'is_alive = yes', then does it check all characters, both dead and alive? If so, I can imagine that being extremely CPU-intensive, especially later in the game. In which case most decisions should be modified to exclude the dead...
 
Last edited:
@Meneth Now that you're back on the dev team, a question in case you can answer it: hoe often does the ai evaluate thehardcoded diploactions?
For example, if I want to replace the hardcoded request conversion woth a custom targeted decision, given that dexisions are evaluated monthly, will that be evaluated more or less often than the hardcoded version?
 
@Meneth Now that you're back on the dev team, a question in case you can answer it: hoe often does the ai evaluate thehardcoded diploactions?
For example, if I want to replace the hardcoded request conversion woth a custom targeted decision, given that dexisions are evaluated monthly, will that be evaluated more or less often than the hardcoded version?
I think the frequency probably depends on what interaction it is. Not entirely sure. Might be daily.
 
  • 1
Reactions:
Question: say my mod has to periodically check for all provinces or characters having a status from an array of mutually exclusive status. In this situations two wuestions come to mind:

1) Is there a difference CPU-wise between checking a midifier, a trait, and a flag? Which one is cheaper

2) Is there a difference CPU-wise between checking the presence of a flag/trait modifier and checking the absence of @ flag/trait/modifier?

3)would it be more advisable to send an event to a unique entity and call any_province/any_character each time the maintenance is done, or would it be better to do this just once, then put the maintenance in a second event, and repeat that event with a delay?
 
Question: say my mod has to periodically check for all provinces or characters having a status from an array of mutually exclusive status. In this situations two wuestions come to mind:

1) Is there a difference CPU-wise between checking a midifier, a trait, and a flag? Which one is cheaper

2) Is there a difference CPU-wise between checking the presence of a flag/trait modifier and checking the absence of @ flag/trait/modifier?

3)would it be more advisable to send an event to a unique entity and call any_province/any_character each time the maintenance is done, or would it be better to do this just once, then put the maintenance in a second event, and repeat that event with a delay?
1) They are all checked linearly, so it should be basically the same.
2) To determine it isn't there it has to go through all the flags/traits/modifiers, while to figure out that it is there on average only goes through half of them. In practice though it is unlikely to ever matter
3) Probably doesn't make much of a difference.
 
  • 4
Reactions:
1) They are all checked linearly, so it should be basically the same.
2) To determine it isn't there it has to go through all the flags/traits/modifiers, while to figure out that it is there on average only goes through half of them. In practice though it is unlikely to ever matter
3) Probably doesn't make much of a difference.

Thanks. BTW, how is the memory usage of storing flags vs. modifiers vs. traits? Should I for example use flags whenever possible?
 
Thanks. BTW, how is the memory usage of storing flags vs. modifiers vs. traits? Should I for example use flags whenever possible?
A modifier takes 16B as far as I can tell.
A flag takes 2B.
A variable takes 32B or so as far as I can tell.

Note that I'm not 100% sure about those counts, as the modifier and variable types are somewhat complex and thus not easy to tell the size of at a glance.

But flags are definitely your best bet when it comes to memory use.
 
  • 3
Reactions:
A modifier takes 16B as far as I can tell.
A flag takes 2B.
A variable takes 32B or so as far as I can tell.

Note that I'm not 100% sure about those counts, as the modifier and variable types are somewhat complex and thus not easy to tell the size of at a glance.

But flags are definitely your best bet when it comes to memory use.
I didn't expect the difference to be that big! Thanks for the info.

Edit: Another question.

Say I want to recurse through all province with an event to randomise a stat. I cannot use while because of a bug with random seeds, thus I'll use

Code:
        remove_flag = pending_setup
        <do my stuff>
        random_province = {
            limit = {
                has_province_flag = pending_setup
            }
            province_event = { id = my_event.1 }
        }
Will I speed things up if I repeat the random province = {...} clause several times instead of just one?
 
Last edited:
If you start getting stack overflows, you'll want to repeat it. Otherwise it probably won't matter.


Is this reported?
I reported it a while back. Divine said he'd consult Gars, and I never heard again of it. I've just reported it again since it also affects the use of random_list within while loops.