I see there has been discussion of this topic in the past, but not quite my particular area of concern.
First off, I'm not entirely clear on whether this is the "classic" mode or the "alternate."
Regardless of which it is, here's how I understand it:
A dice roll is made from 1-100. A roll of 1-80 results in picking from the encounter table slots equal to the player level -3 to the player level +3, a range of six slots.
A roll of 81-95 means picking from slot 0 to a slot equal to the player level +1. And a roll of 96-100 uses the entire table after Level 5. Essentially, particularly at higher levels, it is much more random and the two special results combined allow the player to encounter enemies from below their normal range that otherwise no longer spawn, and there is a roughly 20% chance of this occurring.
The problem, as I see it, is in the code for for the 81-95 range. At Level 18, the code will set the minimum to 0 and the maximum to 19, creating the same result as if a 96 or higher had been rolled. But at Level 19, this will set the maximum to 20. And later in the code on lines 1508-1512, this means the maximum will be adjusted back to 19. All well and good, but then on line 1510 the minimum is ALSO changed, to 14. In other words starting at Level 19, a player's chance of seeing the full encounter list is reduced from 20% to 5%.
Do I have this right and if so, is this intentional?
(Either way I'm not clear on whether this calculation is made on a per enemy/encounter basis or per dungeon/area.)
Am I understanding RandomEncounters.cs correctly?
-
- Posts: 3
- Joined: Mon Jan 23, 2023 11:23 pm
- pango
- Posts: 3440
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: Am I understanding RandomEncounters.cs correctly?
That's classic. (I tried to understand what alternate does, quite some time ago, I found it less interesting).Odyzinomin wrote: ↑Tue Jan 24, 2023 12:02 am First off, I'm not entirely clear on whether this is the "classic" mode or the "alternate."
I come to the same conclusions, if I specialize the code with playerLevel = 18 I getOdyzinomin wrote: ↑Tue Jan 24, 2023 12:02 am Regardless of which it is, here's how I understand it:
[...]
But at Level 19, [....] a player's chance of seeing the full encounter list is reduced from 20% to 5%.
Code: Select all
if (roll > 80)
{
min = 0;
max = 19;
}
else
{
min = 14;
max = 19;
}
Code: Select all
if (roll > 95)
{
min = 0;
max = 19;
}
else
{
min = 14;
max = 19;
}
On one hard enemies are less diverse, on the other hand it focuses more on late game enemies. Is that on purpose? Hard to tell, first because this is reverse-engineered code, so we don't get to read comments or documentation about the rationale behind the code; And second, I guess the guy who did that reverse-engineering is no longer working on DFU, so he's most likely not reading this thread to comment either.
It's only used when you're resting or loitering is interrupted, and that the game spawns a new enemy. So that's by enemy/encounter, I guess?Odyzinomin wrote: ↑Tue Jan 24, 2023 12:02 am (Either way I'm not clear on whether this calculation is made on a per enemy/encounter basis or per dungeon/area.)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
-
- Posts: 3
- Joined: Mon Jan 23, 2023 11:23 pm
Re: Am I understanding RandomEncounters.cs correctly?
Well it's disappointing to learn that that information has been lost to the mists of time, but I suppose it really shouldn't be unexpected given this game is going to be 30 years old in a few years (I feel old.)pango wrote: ↑Tue Jan 24, 2023 11:47 pm On one hard enemies are less diverse, on the other hand it focuses more on late game enemies. Is that on purpose? Hard to tell, first because this is reverse-engineered code, so we don't get to read comments or documentation about the rationale behind the code; And second, I guess the guy who did that reverse-engineering is no longer working on DFU, so he's most likely not reading this thread to comment either.
Hmm, what determines dungeon enemy distribution then?
- pango
- Posts: 3440
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: Am I understanding RandomEncounters.cs correctly?
That's mentioned in more details in the thread linked above for the alternate algorithm.
But in short, they're 17 dungeon types (if you include cemeteries and lost cemeteries) that each have a 20 slots array of enemies (they're additional similar arrays for outside environments); The index min/max from the algorithm is used to pick a slot off those arrays.
That's how enemies distribution depends on the dungeon type you're in, and your level.
But in short, they're 17 dungeon types (if you include cemeteries and lost cemeteries) that each have a 20 slots array of enemies (they're additional similar arrays for outside environments); The index min/max from the algorithm is used to pick a slot off those arrays.
That's how enemies distribution depends on the dungeon type you're in, and your level.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
-
- Posts: 3
- Joined: Mon Jan 23, 2023 11:23 pm
Re: Am I understanding RandomEncounters.cs correctly?
Oh. I must have misunderstood what you meant earlier then. What is it that's only used when resting/loitering? Is the dice roll made only once when you enter a dungeon, or for every enemy generated? If the former, does it roll again if you leave/re-enter?pango wrote: ↑Wed Jan 25, 2023 7:53 am That's mentioned in more details in the thread linked above for the alternate algorithm.
But in short, they're 17 dungeon types (if you include cemeteries and lost cemeteries) that each have a 20 slots array of enemies (they're additional similar arrays for outside environments); The index min/max from the algorithm is used to pick a slot off those arrays.
That's how enemies distribution depends on the dungeon type you're in, and your level.
- Jay_H
- Posts: 4104
- Joined: Tue Aug 25, 2015 1:54 am
- Contact:
Re: Am I understanding RandomEncounters.cs correctly?
You could probably benefit from reading this page: https://en.uesp.net/wiki/Daggerfall_Mod ... Generation