Unfortunately it seems the problem persists. I deleted both FactionData.txt and ConversationData.txt from a save, loaded it and travelled 70 days to be sure to regenerate the news.
Anticlere ruler appeared to be randomly generated instead of being Lady Doryanna Flyte:
Edit: actually the bug is partially fixed by Allofich recent PR. Ruler immune flag (0x10) seems correctly taken into account, so the three main kindgoms which have this flag set (Daggerfall, Sentinel and Wayrest) do not appear in "Any news" regarding their ruler.
However, classic behavior is not fully implemented in DFU. In classic, when rumor about a new ruler appears, this ruler is randomly generated if and only if no individual faction of type nobility is found for this region. If there is at least one noble, the first one is taken as the ruler of the kingdom. In the above example, Lady Doryanna Flyte is the first noble which appears having region 22 (Anticlere), so in classic, she's mentioned as the new Anticlere ruler in case rumor about this country ruler is generated. Here is an example from classic, this time for the Isle of Balfiera:
And as there are many bugs in the original faction.txt file, this can also lead to weird information as I already mentioned, like this one:
Here there are two bugs. The first one is that the murdered ruler name should obviously be generated instead of being taken from faction.txt. The second one is a game data related bug from faction.txt. In the file, the Great Knight has the correct region number (-1, which means no region), however the faction he belongs too, the Septim Empire, has the incorrect one, 61, which is The Ilessan Hills region number. This explains the curious classic behavior there, but it also helps understand how classic "new ruler" rumor is implemented.
Btw, I'm working on a Faction.txt fix which includes all fixes made 8 years ago by DelphiSnake, as well as new ones. Will open a PR when this is ready. Maybe countries like Anticlere, the Isle of Balfiera, Lainlyn and a few others whose rulers are explicitly mentioned in Lore and appear in Faction.txt should have their RulerImmune flag set? What do you think?
0.7.91: Wrong ruler in "Any news" [RESOLVED]
- Ferital
- Posts: 282
- Joined: Thu Apr 05, 2018 8:01 am
- Interkarma
- Posts: 7247
- Joined: Sun Mar 22, 2015 1:51 am
Re: 0.7.91: Wrong ruler in "Any news"
Thanks for all the updated information. Since the original issue was partially fixed, I'll split this to a new bug report.
For bad game data, a PR to FACTION.TXT sounds the ticket. And I'm happy for other fixed rulers to also become RulerImmune.
For bad game data, a PR to FACTION.TXT sounds the ticket. And I'm happy for other fixed rulers to also become RulerImmune.
- Ferital
- Posts: 282
- Joined: Thu Apr 05, 2018 8:01 am
Re: 0.7.91: Wrong ruler in "Any news"
Did some reverse engineering lately and came to the function used to generate a new ruler name, so here it is, with my comments:
Here we see exactly what I was expecting: classic uses the province first child faction if any and if it's is an individual. As an example, this explains why in classic, Lady Doryanna Flyte is set as the "new" ruler of Anticlere, since the Anticlere faction does not have the ruler immune flag. I think whe should not respect classic in there and not implement the same in DFU, as it does not make much sense. Instead, as we agreed, I'll fix faction.txt by adding the ruler immune flag to these particular provinces: Lainlyn, Orsinium, Isle of Balfiera and Anticlere.
In the function, we also see that classic can use every race to generate the new ruler name. So we can get Dark Elf or Khajiit names... I think we should keep DFU current behavior there, which is to use the province faction race. That was probably what was intended in classic. Btw, I recently submitted a PR which correctly translates faction.txt race id to namegen.dat race id.
Code: Select all
char *__fastcall gen_new_ruler_name(int a1, int a2, int a3)
{
int v3; // ST04_4
char race_id; // al
int v5; // edx
int v6; // ecx
char *v7; // ST00_4
if ( *(_BYTE *)current_region_faction == 7 // Is the faction a province?
&& *(_DWORD *)(current_region_faction + 84) // Has the faction a child?
&& **(_BYTE **)(current_region_faction + 84) == 4 ) // Is this child an Individual?
{
return (char *)(*(_DWORD *)(current_region_faction + 84) + 3); // If so return this individual name
}
v3 = rand();
srand(*(_DWORD *)(current_region_faction + 39) & 0xFFFF); // Initialize the random number generator with the region ruler name seed
rand();
race_id = rand(); // Get a random race id
v7 = generate_name(race_id & 7, v5, a3, v6); // Generate the new ruler name using a race comprised between 0 (Breton) and 7 (Imperial)
srand(v3);
return v7;
}
In the function, we also see that classic can use every race to generate the new ruler name. So we can get Dark Elf or Khajiit names... I think we should keep DFU current behavior there, which is to use the province faction race. That was probably what was intended in classic. Btw, I recently submitted a PR which correctly translates faction.txt race id to namegen.dat race id.
- Interkarma
- Posts: 7247
- Joined: Sun Mar 22, 2015 1:51 am
Re: 0.7.91: Wrong ruler in "Any news"
Thank you Ferital!
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: 0.7.91: Wrong ruler in "Any news"
Good work.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods