• 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.

PeterCorless

General
83 Badges
May 4, 2006
1.979
1.286
  • Stellaris Sign-up
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Cities: Skylines
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Field Marshal
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Third Rome
  • Hearts of Iron IV: No Step Back
  • Divine Wind
  • Cities in Motion 2
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Europa Universalis III Complete
  • Cities in Motion
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Hearts of Iron III
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria 2
  • Victoria 2: A House Divided
Folks, I am doing some work on the EUIV Wiki, and I came across a question. Is the MTTH an actual mean, or is it a shorthand for "chance per month of occurrence?"

For example, I wrote this in another thread:

I just added a section on MTTH. Can someone check my math? I stated that if there is, for instance, an event with a MTTH of 120 (i.e., it has a 1/120 chance of triggering each month), that the actual 50% likelihood of it occurring happens around month 83.

I based this upon the following math:

Each month, it has a 0.8333% chance of occurring, or, a 99.1666% chance of *not* occurring.
Multiplying the chances of it not occurring together, you arrive at a 50% likelihood around month 83.
Thus, even though the "simple" MTTH is 10 years, the actual mean is just shy of 7 years.

Does that make sense to others so mathematically inclined? Am I a missing anything?


If someone from Paradox can read what I read here, and let me know if I am correct or incorrect in my assumptions, that would be great.

  • Is MTTH a simple "1 in x" (uncompounded) chance to occur in any month? or...
  • Is MTTH an actual "50% chance to occur by this month" (taking into account compounded likelihood)?

The world of EUIV gamers are eager to know!
 

the.ront

First Lieutenant
70 Badges
May 2, 2010
202
0
  • Sengoku
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III Collection
  • March of the Eagles
  • Cities in Motion
  • Victoria: Revolutions
  • Rome Gold
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Galaxy Edition
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III: Chronicles
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis III
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Europa Universalis IV: Cossacks
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV Sign-up
  • Victoria 2
  • Stellaris: Galaxy Edition
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines
I always assumed that it was broken down to the daily level (0.0023% per day or something like that) and each day is an independant event. So on a sufficiently large sample set it would occur 50% of the time on month 60 but for a specific day it would occur 0.0023% of the time regardless of how many days preceded it.

Probability is fun.
 

Pleonast

Second Lieutenant
112 Badges
Mar 13, 2003
116
93
  • Crusader Kings Complete
  • Crusader Kings II
  • Crusader Kings III
  • Europa Universalis III
  • Europa Universalis IV
  • Victoria: Revolutions
  • Victoria 2
  • Sengoku
  • Cities: Skylines Deluxe Edition
  • Stellaris
  • Hearts of Iron III
  • Hearts of Iron IV: Cadet
  • Imperator: Rome Deluxe Edition
  • 500k Club
As calvinhobbeslik has said, you've computed the median time to happen.

To compute the mean time for a single event to happen, you need to know the probability that the event occurs on a given month. The first month is p(1) = 1/120. The second month is p(2) = 1/120 * (1-1/120). You need the second factor because the event won't happen during the second month if it's already happened during the first. The third month is p(3) = 1/120 * (1-1/120)2. It can only happen in the third month if it failed to during the first two.

In general, the probability the event happened in month k is p(k) = 1/120 * (1-1/120)k-1.

The mean time to happen for a single event is m = sum k * p(k) for k = 1 to infinity. If you compute this, you'll find that it comes out to be 120.

The mean and the median are very different because this is a Poisson distribution (which is asymmetric and has a long tail), rather than a Gaussian distribution (which is symmetric and has smaller tails).
 

VorpalNeko

First Lieutenant
4 Badges
Jul 20, 2012
281
20
  • Crusader Kings II
  • Europa Universalis IV
  • 500k Club
  • Europa Universalis IV: Pre-order
Ah. Mea culpa. Okay... Does someone want to take a crack at this article and write it mathematically correctly?

http://eu4wiki.com/Events

I just did, assuming the same probability algorithm as in EU3. The name is confusing. It should be called median_time_to_happen.

Something I'm unclear on is what the game engine considers a month for the purposes of event triggering. I think it's always exactly 30 days, but it'd be nice if a developer clarified that (along with whether the event probability code was tweaked since EU3; I've no idea whether the above assumption holds in reality). It could be 365.25/12 or something, depending on how pedantic the coder felt that day.
 

calvinhobbeslik

Field Marshal
22 Badges
Nov 29, 2011
7.071
116
  • Europa Universalis III
  • Europa Universalis IV: Pre-order
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Crusader Kings II
  • Europa Universalis IV: Res Publica
  • Heir to the Throne
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III: Chronicles
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Mare Nostrum
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Victoria 2
I just did, assuming the same probability algorithm as in EU3. The name is confusing. It should be called median_time_to_happen.

Something I'm unclear on is what the game engine considers a month for the purposes of event triggering. I think it's always exactly 30 days, but it'd be nice if a developer clarified that (along with whether the event probability code was tweaked since EU3; I've no idea whether the above assumption holds in reality). It could be 365.25/12 or something, depending on how pedantic the coder felt that day.

Wouldn't a month be just that? I.e., it's the 1st of every month?
 

VorpalNeko

First Lieutenant
4 Badges
Jul 20, 2012
281
20
  • Crusader Kings II
  • Europa Universalis IV
  • 500k Club
  • Europa Universalis IV: Pre-order
Wouldn't a month be just that? I.e., it's the 1st of every month?

No, it's checked daily. At least, that's what Johan said happens in EU3, and hence why I emphasized the assumption that this part of the engine hasn't been changed for EU4.

Also, the snipped of code Johan posted clearly means that internally, MeanTimeToHappen is in days. However, what's not clear is in what way this internal variable is related to mean_time_to_happen in event scripts. That's the main reason I said that MTTH of 120 months corresponds to an average wait time of over 14 years; I left it imprecise because of this ambiguity, which can actually make a few months of a difference, as the average month is a bit over 30 days.
 

VorpalNeko

First Lieutenant
4 Badges
Jul 20, 2012
281
20
  • Crusader Kings II
  • Europa Universalis IV
  • 500k Club
  • Europa Universalis IV: Pre-order
I updated the MTTH section in light of the demo.
The only difference is that unlike EU3's hard-coded "every day" checking, EU4 checks every 20 days.
This has little effect on event waiting times for large MTTH values.

Still not sure what exact value the engine counts as a month (365.25/12, 365/12, 30 days, wot?) in the MTTH months-to-days conversion.