Skip to content

Random number generation in Baldur's Gate

The_New_RomanceThe_New_Romance Member Posts: 839
edited September 2012 in Archive (General Discussion)
A few minutes ago, I came across this thread at Bioware Social: http://social.bioware.com/forum/Baldur039s-Gate-1-and-2/Baldur039s-Gate-2-and-Throne-of-Bhaal-Official-Campaigns-Spoilers-Warning/Serious-question-Loaded-dice-or-deliberately-overpowered-enemies-13594951-1.html

Basically, the question they're asking is whether the game really uses a random dice rolling system, or whether the dice (or basic game statistics) are skewed. They mentioned BG:EE in one of those post, so I wondered whether it'd be possible to get a statement from the guys that were allowed to look under the hood: How is dice rolling handled in BG? Is it random and "fair", or are there weird things going on?

Comments

  • CCarluNNCCarluNN Member Posts: 200
    My guess would be that it's based on some level of pseudorandom number generation.
  • BelgarathMTHBelgarathMTH Member Posts: 5,653
    LOL. Oh, no. I already expressed my opinion about this in that thread you linked. For some reason, the issue tends to start heated arguments.

    Maybe somebody here will know something about it, though.
  • ShinShin Member Posts: 2,345
    Without having any insight into the Infinity Engine RNG, it's my experience that in any game where random rolls are utilized by both you and the AI, perceptional bias will make a lot of players feel the rolls are being handled unfairly to their disadvantage. Just human nature I'd think.
  • Awong124Awong124 Member Posts: 2,643
    I don't think any of the devs are going to openly admit to it even if it's true. Maybe some of the mod savvy members on the board can pick through some of the code and see anything out of the ordinary.
  • The_New_RomanceThe_New_Romance Member Posts: 839

    LOL. Oh, no. I already expressed my opinion about this in that thread you linked. For some reason, the issue tends to start heated arguments.

    Maybe somebody here will know something about it, though.

    Yeah, I noticed that the thread derailed toward its middle. I hope this doesn't happen here, I don't even understand what everyone got that excited about. So, please play nice, everyone :)
  • eksterekster Member Posts: 234
    Here's a little secret about 'random' when it comes to computers:

    It does not exist.

    Everything is pseudo-random. It might use an algorithm for a random sequence that seems random, but it will repeat again after a while. It might use things like numbers based on current time, speed, memory, etc. and try to turn it into a random number.... But none of them are true random, and most of the time they will be skewed.
  • Awong124Awong124 Member Posts: 2,643
    ekster said:

    Here's a little secret about 'random' when it comes to computers:

    It does not exist.

    Everything is pseudo-random. It might use an algorithm for a random sequence that seems random, but it will repeat again after a while. It might use things like numbers based on current time, speed, memory, etc. and try to turn it into a random number.... But none of them are true random, and most of the time they will be skewed.

    Somebody already explained that in depth on page 3 of that thread.
  • Awong124Awong124 Member Posts: 2,643
    edited September 2012
    I remember the video game that I thought was the most rigged ever was the Governor of Poker series. That game pissed me off so much. They always tempt you with a seemingly pretty damn good hand (like a full house) and you go all in, only to find out the computer has a better hand. This happens time after time after time. That game is stupid. Tons of people say that game is rigged.

    The problem is that if the player feels that the game is unfair, even if it's meant to improve gameplay, they will be repulsed and resent any unfairness.
  • eksterekster Member Posts: 234
    @Awong124 Ah, I didn't get that far.
  • FrekFrek Member Posts: 15
    The thread probably no longer exists but this was brought up way back in 1998 and I remember Ray Muzuka addressing this as it was a concern he had. The system they use really is just picking a random number using a code call for a random number. There's only a few cases where the numbers are helped a little, like in the case of stat rolling.

    Can't provide a link but I remember that this was addressed.
  • ShinShin Member Posts: 2,345
    ekster said:

    Here's a little secret about 'random' when it comes to computers:

    It does not exist.

    Everything is pseudo-random. It might use an algorithm for a random sequence that seems random, but it will repeat again after a while. It might use things like numbers based on current time, speed, memory, etc. and try to turn it into a random number.... But none of them are true random, and most of the time they will be skewed.

    That isn't likely to matter though. As far as the perception of a human watching hitrolls on a screen goes they come out the same, with the human often feeling cheated.

  • CaptRoryCaptRory Member Posts: 1,660
    I always thought the roller was pretty fair. I remember back when I ran game in IRC, we had a dice rolling bot. After a few weeks we noticed the rolls came out in exactly the same order each week, so we had to "randomize" the roller by rolling a bunch of dice at random at the start of the night so we wouldn't know what was coming out.
  • l33tspockl33tspock Member Posts: 5
    edited September 2012
    @Awong124 the problem is many of those online pay to play poker games *are* rigged, I've read some comments from poker pros saying that the odds are off, their losses are greater than they should be according to statistics. For instance a pro knowing that a certain hand should win in a certain situation 60% of the time, finds that he's winning 40% after like 100 trials.

    The difference here is that the poker games have a reason to rig the game, wheras baldurs gate does not. If you don't pay for chips for a long time, you will find yourself losing more, but buy some chips and bet on some crappy hands right after and watch the cards catch.

    Though this isn't true of all poker rooms, it's been a big problem on the internets http://www.learn2holdem.com/poker-strategy/is-online-poker-rigged.htm
    not the best article, can't find the main one. But do some research.
  • RedcoatRedcoat Member Posts: 31
    I've occasionally noticed that, when rolling for stats, that exiting the game entirely and restarting would suddenly start generating higher scores than before. I might reroll for several minutes and get no scores higher than 88, but after restarting the game I'd suddenly start getting >90 scores semi-frequently.

    Assuming this isn't just some perceptual bias, I'm guessing it has something to do with the initial seed value for the pseudo-random number generator (I'm assuming BG uses the standard C++ rand() function). So how you long you have to reroll before getting a decent score might be a function of whatever the random seed was when you started up the game.
  • Awong124Awong124 Member Posts: 2,643
    l33tspock said:

    @Awong124 the problem is many of those online pay to play poker games *are* rigged, I've read some comments from poker pros saying that the odds are off, their losses are greater than they should be according to statistics. For instance a pro knowing that a certain hand should win in a certain situation 60% of the time, finds that he's winning 40% after like 100 trials.

    The difference here is that the poker games have a reason to rig the game, wheras baldurs gate does not. If you don't pay for chips for a long time, you will find yourself losing more, but buy some chips and bet on some crappy hands right after and watch the cards catch.

    Though this isn't true of all poker rooms, it's been a big problem on the internets http://www.learn2holdem.com/poker-strategy/is-online-poker-rigged.htm
    not the best article, can't find the main one. But do some research.

    The game I was referring to wasn't even an online poker game. It's just a single player game, that's what makes it so stupid, it doesn't benefit anyone.
  • BrudeBrude Member Posts: 560
    Shin said:

    As far as the perception of a human watching hitrolls on a screen goes they come out the same, with the human often feeling cheated.

    @Shin - This isan excellent point.

    I remember seeing an interview with Sid Meier of Firaxis and he was talking about the early development of the Civ games. He said that eventually, they decided to nerf the AI's ability to get good rolls in certain situations. Because if the computer got lucky during an invasion or siege, the player suspected it was cheating and became significantly less invested in the game.

    I wouldn't be surprised if the Infinity Engine was designed the same way.
  • Awong124Awong124 Member Posts: 2,643
    Brude said:

    Shin said:

    As far as the perception of a human watching hitrolls on a screen goes they come out the same, with the human often feeling cheated.

    @Shin - This isan excellent point.

    I remember seeing an interview with Sid Meier of Firaxis and he was talking about the early development of the Civ games. He said that eventually, they decided to nerf the AI's ability to get good rolls in certain situations. Because if the computer got lucky during an invasion or siege, the player suspected it was cheating and became significantly less invested in the game.

    I wouldn't be surprised if the Infinity Engine was designed the same way.
    That's why in the Civ games I turn off the "Preserve Random Seed" option. So if the AI gets "too lucky" (ie. beats me fair and square), I'll just reload and try again.
  • moody_magemoody_mage Member Posts: 2,054
    NWN2 creature dice rolls ARE rigged. As soon as your AC becomes high enough that a monster requires a 20 to hit it is not uncommon for them to roll consecutive 20's, whilst you struggle to roll above single digits. When several enemies mob up on you it's very telling.

    It's most commonly observed on some persistent worlds.
Sign In or Register to comment.