Jump to content

Strange behavior in Character Generation - Abilities in both BG:ee and BG2:ee


Recommended Posts

Hi everybody!

 

Can somebody help me, I want to solve this problem:

I found strange behavior during abilities roll on character creation in both BG:EE and BG2:EE.

I used autoroller mod to try to get high rolls. Looking at autoroller source code (override/ui.menu), all it does - just presses standard in-game button REROLL many times.

I tried to roll on ELF-RANGER character.

I noticed that my highest rolls were all 104, but furthermore, each highest (last achieved) roll had the same stats distribution. For ELF-RANGER these are:

STR 18/54
DEX 17
CON 17
INT 18
WIS 17
CHA 17

I never saw 105+ roll, even after few days of non-stop autoroll. 104 roll appear after 3-15 minutes of rolling.

I tried exiting and restaring the game, reinstalling the game, rebooting PC - max rolls were the same. I asked my friend to buy BG:EE, install it, install autoroller and try to roll same ELF-RANGER character. He got the same 104 roll with same stats distribution.

I installed BG2:EE with another autoroller (https://github.com/r-e-d/EEUITweaks/releases) and tried to create ELF-RANGER in BG2.

Guess what - same 104 roll with same stats distribution.
I reproduced these results many times with same outcome.

 

And another thing - me and my friend also tried to roll HUMAN-PALADIN on two different PCs.
We also got exactly same highest rolls many times.
These are different from ELF-RANGER.
Total: 103
STR 18/86
DEX 17
CON 18
INT 17
WIS 16
CHA 17

So, do you know what script produces these rolls in Infinity Enfine?

bg1.jpg.305a07ec6660c70f41c1af45f7f4429b.jpg

 

 

Edited by lalakobe
Link to comment
6 hours ago, lalakobe said:

I noticed that my highest rolls were all 104, but furthermore, each highest (last achieved) roll had the same stats distribution.

Just checked this and what I see is: the auto-roller keeps rolling but when you press 'stop' it gives you the highest roll. You can get it rolling again but when you press stop again it will send you back to the highest roll. So it may seem like you rolled 104 twice with the same distribution, what really happened is you rolled 104 once, and every time the autoroller stops it send you back to that same 104 roll.

I just rolled an elf ranger and after about 20 seconds got a 102 total:

  • 17
  • 19
  • 16
  • 18
  • 18
  • 14

Two of those scores are higher than then ones in your 104 roll so I don't think there's any limit being applied.

EDIT - as far as restarting the game and having a friend do it: something about the RNG. These are not real dice rolls, and the rolls are not really random - no computer program can ever really achieve that. So when you push the system trying to get higher and higher rolls, you end up restricting the program's ability to simulate randomness.

Is my guess.

Edited by subtledoctor
Link to comment

The autoroller modify the stats distribution to be able to extract the exceptional strength value. This way it can keep the higher strength value for rolls with the same total. (to be precise, there is a tiny bug, this does not happen for the first roll of a new high value, this is why in @subtledoctor example, he only gets a 17 in strength it was the first time the autoroller encounter a total roll of 102).

So for high value, you will usually get the same stat distribution (as there is not a lot of ways to have 104 total roll with 18 strength). But you should not always get the same exceptional strength.

Link to comment

Still, I always get the same 18/54 STR every time in BG1-ee AND BG2-ee.

Could it be a bug in engine? I wanted to look at source code but I'm not sure, if rolling algorythm is in scripts inside archive files or some subroutine in executable.

Edited by lalakobe
Link to comment
On 6/21/2022 at 6:52 AM, subtledoctor said:

Two of those scores are higher than then ones in your 104 roll so I don't think there's any limit being applied.

Yes, I see higher individual numbers often (like str 18/00 or dex 19) on lower total rolls, but after some time I eventually get up to 104 and 104 has the exact same distribution (18/54 17 17 18 17 17)

Link to comment

Just because there were three rolls of 104 doesn’t mean they were identical; the autoroller might have deemed the 2nd and 3rd to be not improvement and discarded them, leaving you with the first one.

Again, the RNG is not really random. My guess is, your putting such extreme constraints on the “roll” is causing its limits to become apparent. 

Anyway you can move numbers around between stats, so who cares if the roll it static? There are a number of ways to arrange a roll of 104. This isn’t PnP - you’re allowed to arrange them however you want. So the arrangement delivered by the RNG doesn’t matter. 

Inb4 the objection “but I want a different exceptional Strength score with a roll of 104!” … it’s a 20-year-old game. It appears that the RNG is slightly junk. Accept it. In 99.9% of use cases it works perfectly well, so there’s not much impetus to improve it even if it was something they might consider for 2.7. 

Link to comment

My goal is not to create ultimate elf ranger, I just want to understand, if 105+ rolls are even possible in bg:ee (and bg2:ee, as I get the same stats distribution there) or there is some bug, or bad randomizer (I remember back in the days in GW-BASIC you had to execute RANDOMIZE TIMER command before any randomizer stuff, or else you would be getting same "random" numbers again and again 😀).

To check, if rolls were identical or not, I modified output (if chargen.totalroll >= 104 it shows concatenated chargen.ability[ from 1 to 6 ].roll) and here what I got:

104-2.thumb.JPG.7bf2a14b614efb4335c13171213dab97.JPG

 

Edited by lalakobe
Link to comment

You do know that the number generation in BG's is not actually random, but a code based, non random number generation ? Just like all the video game gambling machines, none of them are "random", but based on a list of preset numbers, which will guarantee you'll lose if you play long enough.
Aka, if you throw the numbers long enough, you'll eventually reach the max value that is somewhere in the middle of the max and min.

Edited by Jarno Mikkola
Link to comment
10 hours ago, lalakobe said:

I just want to understand, if 105+ rolls are even possible in bg:ee (and bg2:ee, as I get the same stats distribution there) or there is some bug, or bad randomizer

I mean, it sure sounds like you have exposed a weakness - either bug or simply a limitation - of the stat rolling RNG (which as Jarno says is not really random - it's just an algorithm created in 1998 that was deemed good enough for its purpose at the time). You are asking for someone to explain it to you but it seems like you are explaining it to us!

Edited by subtledoctor
Link to comment
On 6/23/2022 at 5:07 PM, lalakobe said:

I remember back in the days in GW-BASIC you had to execute RANDOMIZE TIMER command before any randomizer stuff, or else you would be getting same "random" numbers again and again

Yes, the old school way to generate random numbers is to call a function named rand() that generates a random number between 0 and RAND_MAX (32726, often), but that number is calculated via a mathematical function starting with one input called "seed". That seed is initialized, hopefully from another semi-random source using another function called srand(). Current time is often (mis)used for this, and normally that is good enough to make it hard to predict with just a few numbers. If the engine is not setting the seed correctly, or soon enough, maybe it would explain why this pattern on the numbers happens so obviously. Or maybe even the seed is useless because it just changes the starting point.

Note that it is perfectly normal and expected that the numbers generated are creating patterns. It's well known that generate planes when the numbers are used to be points in 3D, and even if you use them in 2D, they can also produce visible patterns.

I am, however, quite surprised that it's so easy to see the patterns that you've showed. I tried to look at the character generation by putting the executable in Ghidra (reverse engineering tool) some time ago, and it's too difficult for me. But if you want to give it a shot (you seem quite motivated and that's cool!), get the debug symbols, then search for CScreenCreateChar::OnAbilityReRollButtonClick.

Link to comment
15 hours ago, Bubb said:

though I can't tell you why.

Like I already said, the "computer random number generation" is not random. It's a series of randomly set, but set numbers*. So if you ask it to give you six sixes in a row, it will give you those, but it will not give you a random number after those sixes from it's generator, cause there's only so many number rows it has stored to give you the possibility of six 6's.

 

*easy example, any modern graphic calculator, depending on the model of course, will give you the exact number when you give it the order to pick a random number between 1 and a 100**, when it's asked to do so the first time. **Or really any numbers you like. This is because the function seeded so to speak.

Link to comment
1 hour ago, suy said:

Or maybe even the seed is useless because it just changes the starting point.

Yeah it reminds me a bit of a Rubik's Cube. A kid I know has gotten into Rubik's Cube a bit, and apparently there are a couple algorithms that can reliably solve it... to put it in layman's terms, the 104 roll above seems like it is the stat-roller's version of a solved Rubik's Cube. You can bounce off it if you keep changing things, but you will eventually keep coming back to it.

Edited by subtledoctor
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...