100% Orange Juice
fulf Oct 26, 2016 @ 9:26am
Question(s) about RNG
Not asking about CPU dice advantage, because that seems pretty well-documented. Just sort of wondering how the game actually determines random numbers? As in, just how "random" is it- in a game with all human players, completely ignoring the CPU aspect. It's joked about, I know, but the RNG does seem a little questionable and there isn't a lot of "transparency." You can't see what actually "happens" when you roll dice.

If anyone's played the game Tharsis, I think that game handled dice rolls pretty well. It got a lot of criticism for a lot of reasons, but the dice rolls were physically simulated right in front of you so you knew exactly why you rolled what you rolled and the way random numbers were determined felt very fair aside from a few technical hiccups, ignoring the game's other flaws. That kind of simulation might not be possible in this game, and it'd probably slow down gameplay a lot, and completely changing the RNG technique would change gameplay a lot as well, so it is impractical to implement; I just can't help but compare the two games' methods of RNG when I get an absurd series of rolls.

If the RNG technique's been explained before, I apologize for asking instead of finding out for myself but it is something that makes me wonder sometimes.
< >
Showing 1-10 of 10 comments
Kyle  [developer] Oct 26, 2016 @ 1:16pm 
I think it picks them randomly.
Dangerous Beans Oct 26, 2016 @ 2:29pm 
Originally posted by Kyle:
I think it picks them randomly.

It generates a random number, checks to see how badly it would inconvenience you, and if that value is not high enough it rolls again until it is.
Nargubyte Oct 26, 2016 @ 3:58pm 
Originally posted by Dangerous Beans:
Originally posted by Kyle:
I think it picks them randomly.

It generates a random number, checks to see how badly it would inconvenience you, and if that value is not high enough it rolls again until it is.

This is mostly accurate, but it will also check to see how lucky you are on a daily basis in other, unrelated activities, and adjust the final roll based on your average luck factor over the past two weeks.

Higher average luck factor = higher chance to roll low.
Ultrablockstar Oct 26, 2016 @ 4:22pm 
Originally posted by Nargubyte:
Originally posted by Dangerous Beans:

It generates a random number, checks to see how badly it would inconvenience you, and if that value is not high enough it rolls again until it is.

This is mostly accurate, but it will also check to see how lucky you are on a daily basis in other, unrelated activities, and adjust the final roll based on your average luck factor over the past two weeks.

Higher average luck factor = higher chance to roll low.
This might explain my awful losing streak... wait, are you serious?
|DI| AndyNPC Oct 26, 2016 @ 4:27pm 
I'm assuming that it's adjusted in some cases as a truly random system has a chance to be unfun, such as giving one player nothing but 1s the entire game. We know at least that the AI players cheat their rolls in order to increase difficulty in the single-player modes, so I'm sure that sometimes a player gets to "cheat" too if they've been having a bad roll streak or have fallen far behind. I'd be more suprised if the devs confirmed our rolls are completely random.
Corrodias Oct 26, 2016 @ 5:19pm 
Unfortunately, I don't think anyone besides the developers have any idea how the RNG works. A simple call to the C rand() function would probably suffice and is the most likely culprit. But I say that with little understanding of how games are made.
Martin Oct 26, 2016 @ 7:59pm 
I'm fairly certain dice rolls aren't random, but are instead pseudo-random, based on multiple factors such as held cards, actions, clicks, frames, system clock, etc. Many seemingly "random" situations in games are in fact based upon something predetermined based on whatever factor manipulates the RNG.
fulf Oct 26, 2016 @ 8:25pm 
Originally posted by Martin:
I'm fairly certain dice rolls aren't random, but are instead pseudo-random, based on multiple factors such as held cards, actions, clicks, frames, system clock, etc. Many seemingly "random" situations in games are in fact based upon something predetermined based on whatever factor manipulates the RNG.

I guess the point I'm trying to get at is that computers can't "do" true random, because they rely on statistical probability. I'm looking in to it too much. I'd imagine it's something rather simple but the problem you run in to when your game has a heavy emphasis on dice rolls and such is that randomness, in reality, isn't so simple. Knowing what goes in to it wouldn't really do much besides give a bit of insight, I guess.

Going back to talking about Tharsis for a bit, (not promoting the game, just using its dice roll system to sort of explain what I mean about "randomness" and dice rolls) I think the RNG on dice rolls in that game is more "convincing" because more goes in to it than just each side having a 1/6th chance coming up; pseudo-random factors like the velocity and angle at which the dice are thrown, and how they collide in to eachother and the surface, are simulated and it just sort of aids comprehension, I guess, to know and see why you roll what you roll. Not perfectly random, but it's more lifelike than just picking a number.

But it all works well enough in OJ and I'm not trying to criticize the game or ask for unreasonable changes. Having a slight enthusiasm for statistics just makes this stuff more interesting to me than it should be. Just saying "it generates a random number" doesn't really say anything.
Last edited by fulf; Oct 26, 2016 @ 8:26pm
Dangerous Beans Oct 27, 2016 @ 1:24am 
Originally posted by flikk:
I guess the point I'm trying to get at is that computers can't "do" true random

Can and do, at least to the best scientific defninition of random. Modern CPUs have hardware for querying all kinds of physical randomness, up to and including quantum states. Time is actually avoided in important cases because it can lead to problems in many situations and it can be easy to expliot.

For a game that requires high quality randomness, C++ includes std::random_device for querying the hardware RNG and std::mt19937, a well formed mersenne twister. The random device is slow, but it can be used to seed the twister with true randomness, and the twister can crap out high quality bits at a pretty good rate.

If a game or other application needs less quality then the same <random> library includes a classic linear congruential generator (like rand() usually is) that is lightweight and a bit faster than the already very fast mersenne twister. The <random> library also has distribution tools that avoid a lot of the pitfalls associated with distributing rand() results, like pigeonholing or uneven distributions due to incorrect modulo usage.

More information:
https://channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful
Last edited by Dangerous Beans; Oct 27, 2016 @ 1:32am
Corrodias Oct 27, 2016 @ 2:41pm 
Oh, neat. I'll have to watch that. I don't deal directly with RNG in my work.
< >
Showing 1-10 of 10 comments
Per page: 1530 50

Date Posted: Oct 26, 2016 @ 9:26am
Posts: 10