FtG 1.2 changelog said:
Fixed a serious bug (leftover from EU2) which caused the random number generator to be seeded with the same value roughly 1/6 of the time
Disregard this quote for the moment. This one's more important right now:
Offset mechanics and trigger checking:
Many theories have been elaborated in the past ten years. Thanks to MichaelM, it seems that we now know the truth, hopefully he will correct me if I am (again) wrong: the offset is only used for the first check happening between startdate and startdate + offset, after that it is not taken into account at all and the event is re-checked between 16 and 76 days after the last check until the deathdate is reached.
Ever since working with the Clausewitz engine in EvW I've thought more about the frequency of random events in FtG. Basically, the mean_time_to_happen parameter of Clausewitz events does nothing else than calculating a daily chance for an event to fire, which could theoretically easily be done in FtG by smart use of an offset, a random chance, and the persistent event type. This means that those events wouldn't be restricted to the limited frequency of random events, but that you could set the
absolute frequency for each random event separately. You could even have a scenario option that controls the overall frequency of random events! Sounds awesome, right? Well, and that's where the trouble starts, because I knew that the above explanation for the offset mechanic is wrong; I just never bothered to find out exactly how it works. So I ran a test with five events with different offsets (1, 2, 5, 15, and 30}. All have "year = 1492" as the startdate, and I loaded the 1492 scenario to see how often they fired. The results:
- Offset = 1 fired immediately on January 1.
- Offset = 2 fired immediately on January 1.
- Offset = 5 fired first on January 4.
- Offset = 15 fired first on January 2.
- Offset = 30 fired first on January 8.
- Offset = 1 fired a total of 360 times during 1492, i.e. exactly once per day.
- Offset = 2 fired a total of 240 times during 1492, i.e. approximately once every 1.5 days, but not regularly.
- Offset = 5 fired a total of 122 times during 1492, i.e. approximately once every 3 days, but not regularly.
- Offset = 15 fired a total of 44 times during 1492, i.e. approximately once every 8 days, but not regularly.
- Offset = 30 fired a total of 20 times during 1492, i.e. approximately once every 18 days, but not regularly.
So what seems to happen is that the offset is translated into a daily chance to fire:
- Offset = 1 -> 100% chance
- Offset = 2 -> 67% chance
- Offset = 5 -> 34% chance
- Offset = 15 -> 12% chance
- Offset = 30 -> 5% chance
Honestly, I don't think there's any kind of difference in performance whether you use an offset or a random trigger, so I thought: Well, from now on I'll only be using random triggers, at least then I'll always know the exact daily chances! But then I remembered the quote from the 1.2 changelog and pondered, "but can I ever truly know the chances?"
So, of course I immediately ran another test with "offset = 1" and random triggers:
- Random = 100 fired 360 times
- Random = 75 fired 344 times
- Random = 50 fired 317 times
- Random = 25 fired 224 times
- Random = 0 fired 0 times
Also, an event with two "random = 50" triggers (which should be the same as one "random = 25" trigger) fired 259 times, i.e. significantly more than "random = 25" but significantly less than "random = 50".
So, uhm. I guess it's good to know that "random = 0" and "random = 100" work as intended. For the range in between though, could we please have a proper RNG, for example MWC? That would be really awesome.
And because I don't expect anyone to simply believe my numbers, here's the code for my events so you can see for yourself:
Code:
event = {
id = 878947
trigger = {
ai = no
random = 0
}
persistent = yes
name = "Random000"
date = { year = 1492 }
offset = 1
deathdate = { year = 1999 }
action = {
command = { }
}
}
event = {
id = 878948
trigger = {
ai = no
random = 25
}
persistent = yes
name = "Random025"
date = { year = 1492 }
offset = 1
deathdate = { year = 1999 }
action = {
command = { }
}
}
event = {
id = 878949
trigger = {
ai = no
random = 50
}
persistent = yes
name = "Random050"
date = { year = 1492 }
offset = 1
deathdate = { year = 1999 }
action = {
command = { }
}
}
event = {
id = 878950
trigger = {
ai = no
random = 75
}
persistent = yes
name = "Random075"
date = { year = 1492 }
offset = 1
deathdate = { year = 1999 }
action = {
command = { }
}
}
event = {
id = 878951
trigger = {
ai = no
random = 100
}
persistent = yes
name = "Random100"
date = { year = 1492 }
offset = 1
deathdate = { year = 1999 }
action = {
command = { }
}
}
Simply let the game run for a year or so in handsoff mode, then count the instances of "random<xxx>" in the savegame history with N++ or whatever.