![]() |
|
|
#1 |
|
Colonel
Join Date: Apr 2003
Location: Kharkov province
Posts: 958
|
Peasants are never happy, or EU Random Number Generator
Played a couple of games for 50-100 years under 1.07beta (apr18 patch). Some observartions on random events:
Timurids: 3 "Political Crisis" in a row. Followed by 4 "Plague!" (which under Apr18 patch was not a bad thing, as Isfahan became mongol-cultured); Followed by 2 "Bad government policies"; Followed by 5 gifts. Venice: 3 "Unhappiness among the Peasantry" (???! I was one tick towards Free Subjects"; Followed by 3 "Rush of merchants"; Followed by 5 "Support for dissidents abroad". Russia: 3 "Unhappiness among the Peasantry"; Followed by 3 "Exceptional Year" (within 3 years); Followed by 5 "New Land Claimed", all in Moscow; Followed by 4 "Enthusiasm for the Navy", all in Greenland (which I've got off Norway). Small sample, of course, but it just seems like random number sequences are heavily autocorrelated. Could be bad random number generator (actually, default C rnd() function is notoriously bad) Or maybe random events are not random at all, i.e. the code looks something like i=1; // event counter j=1; // province counter for (; ; ) { // eternal loop target_country=GetOwnerCountry(j); wait(rnd()); TriggerEvent(target_country, i, j); i++; j++; if (i>MAX_EVENTS) i=1; if (j>MAX_PROVINCES) j=1; } Since provinces change hands over time, their owner countries would be eligible for different events in a fairly unpredictable way, so this would create an illusion of randomness. However, if political situation is relatively static for a long time, target_country would not change much and you will get the same random event over and over again, which seems to happen often. What is your experience? [Edit: modified code slightly] Last edited by mueller; 26-04-2003 at 19:36. |
|
|
|
|
|
#2 |
|
Dark Lord wannabe
Join Date: Oct 2002
Location: Deusone
Posts: 1,157
|
I am having similar experiences as well in my games, for example I have 30 years of no negative stab random events followed by a decade of massive upheavals having 3 unhappy peasantry events in a decade and some other nasty events thrown in for good measure. One of my most recent games under 1.07 beta saw me getting hit with 10 unhappy merchants events in 50 years time, I know this event is dp-related, but still this is quite a lot. I made hardly any progress in trade during that period.
__________________
My current HoI 2 DoomsDay AAR: Germany''s One Hundred Divisions Gamble |
|
|
|
|
|
#3 |
|
Second Lieutenant
Join Date: Mar 2003
Location: Chicago, IL
Posts: 146
|
Same thoughts
I've had 6 "fires" in 100 years. For some reason my art academy in Anglia must be made of gas-soaked rags. After the 4th one I got so annoyed I just edited the file and gave it back. Then it burned down again.
My last game I kept getting plagues. Probably over a dozen during the entire game, but not one fire. Now, not a single plague but fires every other decade. I'm guessing they are tied to something, but not sure what. |
|
|
|
|
|
#4 |
|
The Maverick
Join Date: Jun 2002
Location: The land of the ice and snow with the midnight sun where the hot springs flow
Posts: 3,104
|
The worst are the political crisises. In my current game as Russia I have 4 out of my 5 slider religions, and being at -6 stab isn't very fun.
__________________
Wow
|
|
|
|
|
|
#5 |
|
Colonel
Join Date: Jul 2002
Location: Earth, at least on even numbered days starting with T
Posts: 918
|
The big random number generation problem that I've seen is in discovering provinces with an explorer at naval tech below 18, which is not random at all. One in ten provinces that is sailed by will be explored, though this can be thrown off by the AI also sending explorers around. To demonstrate this, save a game with an explorer one day away from reaching a seazone that is adjacent to an unexplored province (and not more than one), and repeatedly load the game, let him reach the province, note whether he discovers it, then reload the game and try again. Unless some other explorer also tries to explore something, he'll discover the province every tenth time, though the first one could take fewer than ten tries.
Fortunately, it's not that hard to make a random number generator with properties suitable for the game. It's not absolutely vital that no one can discover what the random number generator is, as is the case, for example, with online gambling. Here's one that I use in a game I'm making in Visual Basic: Code:
Public Prime As Long = (some prime number)
Public Root As Long = (some primitive root of the prime)
Public RSeed As Long = (a positive integer less than the prime)
Function Rand() As Double
RSeed = (RSeed * Root) Mod Prime
Return CDbl(RSeed) / CDbl(Prime)
End Function
__________________
Free speech is not limited to those who have something intelligent to say. Version 1.06, no mods Completed grand campaigns with: Algiers, Auvergne, Cambodia, Castile/Spain, Cologne, Dakota, Hungary, Hyderabad, Kongo, Mantua, Ragusa, Qara Koyunlu, Wallachia |
|
|
|
|
|
#6 |
|
Captain
Join Date: Apr 2003
Location: 15 VII 1410 Tannenberg... right flank
Posts: 358
|
Playing Scotland right now... it's 1500 and within the last 20 years I had 5 or 6 Political Crisises... earlier I had massive Rush of Marchants (3 or 4 times)....
Obviously there's something wrong with the random number generator... and there's nothing we can do about it... but there's someone who can
__________________
War is not about who is right, it's about who is left. Anders Russel |
|
|
|
|
|
#7 |
|
Major
![]()
Join Date: Feb 2003
Posts: 644
|
What do you mean, -6 stab? Aren't you limited to -3? Also, I noticed the same thing playing Manchu, political crisis was the norm of these days, I've had at least 5 in close succession. If those events really are random, then random generator needs a good upgrade.
|
|
|
|
|
|
#8 |
|
The Maverick
Join Date: Jun 2002
Location: The land of the ice and snow with the midnight sun where the hot springs flow
Posts: 3,104
|
Whoops! I meant -3 stab.
__________________
Wow
|
|
|
|
|
|
#9 | |
|
Major
![]()
Join Date: Feb 2003
Posts: 644
|
Quote:
|
|
|
|
|
|
|
#10 | |
|
Colonel
Join Date: Apr 2003
Location: Kharkov province
Posts: 958
|
Quote:
I suspect it might be something similar with random events in EU (as per code in the first post...) |
|
|
|
|
|
|
#11 |
|
The Master
Paradox Dev Team
![]() ![]() ![]() Join Date: Dec 1999
Location: Always two there are...
Posts: 12,564
|
Plenty of stuff are not truely random, simply because they are processed locally and not on the server.
__________________
Johan Andersson Wizard "A patch is never late! Nor is it ever early. It arrives precisely when I mean it to do!" |
|
|
|
|
|
#12 | |
|
Colonel
Join Date: Apr 2003
Location: Kharkov province
Posts: 958
|
Quote:
|
|
|
|
|
|
|
#13 | |
|
Grandpa Maur
![]()
Join Date: Apr 2001
Location: Warsaw, Poland
Posts: 7,818
|
Re: Same thoughts
Quote:
__________________
Polyamory? And now also the (shorter, but expanding lately!) Polish version! Androgynous atheist bisexual feminist liberal libertine polyamorous transhumanist switch. |
|
|
|
|
|
|
#14 | |
|
Mostly Lurking
Join Date: Mar 2001
Location: CA, USA
Posts: 379
|
Quote:
__________________
-chris bond Last edited by clb; 27-04-2003 at 00:00. |
|
|
|
|
|
|
#15 | |
|
the Conqueror
![]() ![]() ![]() ![]()
Join Date: Mar 2001
Location: Beyond the infinite
Posts: 12,607
|
Quote:
)
__________________
When I said: "Death Before Dishonour!", I meant it alphabetically. ----- For new denizens of the forum: To post here you have already agreed to follow the user agreement and the general rules (pay specific attention to rules 2, 3, and 6 if writing while your temper is heated). Furthermore, there may be special rules for specific forums. These can usually be found in sticky posts at the top of a forum. Read the stickies and obey the rules and, overall, it is a much nicer forum for all of us. Disobey the rules and be moderated, warned, put on probation, or banned. |
|
|
|
|
|
|
#16 | |
|
Danish Guy
Join Date: Oct 2001
Location: Aarhus, Denmark
Posts: 2,327
|
Quote:
(I should probably stick to the threads talking about economic issues...not programming issues)
__________________
Currently spending my time on ... Empires in Arms & Mordheim ... |
|
|
|
|
|
|
#17 |
|
Colonel
Join Date: Jul 2002
Location: Earth, at least on even numbered days starting with T
Posts: 918
|
My point was that a good random number generator for various purposes didn't need to be complicated. What I posted would work for some purposes, and most likely for EU2, though it would be quite bad for others. In particular, the values it generates at once step would be uncorrelated with the values any reasonable number of steps later. For the purpose I needed it for, repeating quickly would have been quite bad, hence the choice of a primitive root.
__________________
Free speech is not limited to those who have something intelligent to say. Version 1.06, no mods Completed grand campaigns with: Algiers, Auvergne, Cambodia, Castile/Spain, Cologne, Dakota, Hungary, Hyderabad, Kongo, Mantua, Ragusa, Qara Koyunlu, Wallachia |
|
|
|
![]() |
| Thread Tools | |
|
|