Health Point/Hit Point Generator When Leveling

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
Guitarron
Posts: 9
Joined: Sun Aug 08, 2021 3:21 pm

Health Point/Hit Point Generator When Leveling

Post by Guitarron »

I'm thinking there might be a "bug" in the health point/hit point generator when leveling up (or I have a misunderstanding of how it works). It is my understanding that when you level up you get a random number of hit points up to a maximum of 8. I am using version 0.11.5, no mods and Windows 10 operating system.

I play a custom character. Before I rest I save the game and if I level up, I look at how many health points I get and will reload that save game several times to see if I get more or less with each time I rest and go up for that level. I noticed when I went from level 5 to level 6 I always got 4 health points if I rested until I was fully healed (50 out of 50 times). Didn't seem random. So I rested for 1 hour and never leveled with only 1 hour of rest. I rested for 2 hours and never leveled with 2 hours rest. Every time I rested for 3, 4, 5, 6 or 7 hours I always got 5 hit points/health points, always. That didn't seem random either.

If this is how it is supposed to work, there is no problem. If it isn't, then there might be. I have saved the save game for when I leveled from 5 to 6 if you all want to examine that save.

Now to display my ignorance on your updating. I had no problem with installing the game, the instructions were quite clear and easy to follow. I haven't seen or found anything about how to update. Do I just unpack the new version to my unity directory and it overwrites the old files? Do I have to delete that directory first? Do I make a 0.11.7 directory then run the file in that directory and configure it and use the exe file from there (and then delete my old 0.11.5 directory)?

Thank you

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Health Point/Hit Point Generator When Leveling

Post by Interkarma »

Welcome to the forums. :)

HP per level range is a random number from HitPointsPerLevel/2 to HitPointsPerLevel inclusive. The random generator is seeded by current frame count, so should generate a different value if you reload and try again before level-up. Happy to investigate if you can provide a save for me before level-up. Note that mods can override this formula, so your experience can vary based on mod loadout.

Updating is similar to installing - unzip to a new folder matching version number (e.g. C:\Games\Daggerfall Unity\0.11.7) and run the game from there instead. Optionally install mods if using any, and optionally delete old version. You don't need to copy over saves or settings, these are stored in a persistent path used by each new version.

Guitarron
Posts: 9
Joined: Sun Aug 08, 2021 3:21 pm

Re: Health Point/Hit Point Generator When Leveling

Post by Guitarron »

I am attaching a 7z file for the save folder of level 5 just prior to leveling to level 6. I use no mods.

Thanks for info on hit points when leveling and updating.

Thank you for your work on this game and speedy response.
Attachments
SAVE15.7z
(121.6 KiB) Downloaded 58 times

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Health Point/Hit Point Generator When Leveling

Post by Interkarma »

Thank you for save. :)

Your HitPointsPerLevel value is 8, so the range each levelup is 4 to 8. I loaded save and used quicksave/quickload to rest until healed > levelup > repeat 10 times in a row. These are the results I got.

Code: Select all

6, 6, 7, 8, 7, 4, 4, 6, 6, 4
All these values are within the correct range and were generated from a different seed. Because there's only a distribution of 5 possible values, it's not unreasonable to get the same value multiple times in a row.

It's also worth mentioning that randomness is clumpy and humans are good at finding patterns. This is more prevalent when the range for distribution is low. This might be the effect you were observing as everything is working as expected when stepping through formula code.

Guitarron
Posts: 9
Joined: Sun Aug 08, 2021 3:21 pm

Re: Health Point/Hit Point Generator When Leveling

Post by Guitarron »

If you are getting those random numbers then the only thing I can think of is that there has to be something wrong with my computer's ability to consistently seed a random number when the program calls for it on occasion but it has to be in my computer. (I am playing this on a cheap $300 laptop)

Thank you for checking it out.

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Health Point/Hit Point Generator When Leveling

Post by Jay_H »

No, no, there's nothing wrong with your computer :) The number is generated by the current frame being generated (of which there are 60 in a second). That's a pretty strong randomizing figure. Our expectations for probability are sometimes skewed. I highly recommend a brush-up with the gambler's fallacy as an explanation of why we think the way we do. On a perfectly balanced machine, you can still get the same result 100 times in a row if the machine is functioning perfectly well. (That's not likely, but it can happen).

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Health Point/Hit Point Generator When Leveling

Post by pango »

It depends if the "50 times out of 50" was metaphorical or real.
Getting 3 or 4 equal results in a row, fine on an odd chance. Expected if you look at tons of rolls.
But getting on first attempt 50 times in a row the same result out of rolls with 5 uniform outcomes (4, 5, 6, 7 or 8) has an odd in one in a decillion (1 followed by 33 zeroes). That would be way beyond improbable.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Health Point/Hit Point Generator When Leveling

Post by Interkarma »

Guitarron mentions having a low-end PC here. I wonder if the frame-rate is low enough that seed isn't being changed between attempts? Seems unlikely, even 5-10fps would mean some shuffling of the random generations while changing UIs, reloading saves, etc.

Guitarron, could you possibly let me know your fps? There's a built-in console command "tdbg" to enable an fps counter if you don't have any other way of measuring this.

Guitarron
Posts: 9
Joined: Sun Aug 08, 2021 3:21 pm

Re: Health Point/Hit Point Generator When Leveling

Post by Guitarron »

I ran tdbg and it shows 60 fps and the timer to the side fluctuated from 16.changing decimal to 17.changing decimal ms.

I literally rested, reloaded the save, rested, reloaded the save 50 times and got 4 every single time. I periodically go back and load the save on different days since this happened and still get 4. I have put the game on a good quality MSI (has a 240hz display) and will see what happens there.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Health Point/Hit Point Generator When Leveling

Post by Interkarma »

I don't have an answer for you right now, I'm sorry. The random function is seeded by frame count on every call, even a moderate framerate would reseed the random function fairly frequently. I'll spend some more time on this when I can.

Post Reply