BuzzerBeater Forums

Bugs, bugs, bugs > Put at least some random in GE

Put at least some random in GE

Set priority
Show messages by
This Post:
00
263046.7 in reply to 263046.6
Date: 10/3/2014 7:10:10 PM
TrenseRI
III.2
Overall Posts Rated:
36003600
Second Team:
ChiLeaders
That's true, seems like a very easy thing to fix from a programmers point of view, right? Well, not in this case. As Charles once explained this to me, the cause of the problem does not lie in the code (we use server time to change the random seed) but in the language itself (C++) in this case. So, there's no easy fix, but hopefully we might stumble on a solution one day.

From: mplume

This Post:
11
263046.8 in reply to 263046.7
Date: 10/4/2014 3:58:19 AM
Overall Posts Rated:
5050
Maybe you use the server time to change the random seed but in my eyes those two games giving exactly the same results is the proof that the server time don't change the random seed at all.

I hope the are others variables who change the random seed. If not, that means that the random seed stay always the same in the game engine or in other words that there is no random seed at all in the game engine.

Last edited by mplume at 10/4/2014 4:00:15 AM

This Post:
00
263046.9 in reply to 263046.7
Date: 10/4/2014 1:29:26 PM
Overall Posts Rated:
32293229
That's true, seems like a very easy thing to fix from a programmers point of view, right? Well, not in this case. As Charles once explained this to me, the cause of the problem does not lie in the code (we use server time to change the random seed) but in the language itself (C++) in this case. So, there's no easy fix, but hopefully we might stumble on a solution one day.


Server time at the time the game is calculated? Depending on how much precision you're using, given that the games start calculating at the same time every game night for a given nation's games, that could lead to the same duplicate seeds. If it's c++ I'm not sure of the equivalent, but I'd probably use something like DateTime.Now.Ticks in C# to get a unique seed.

This Post:
11
263046.10 in reply to 263046.7
Date: 10/5/2014 1:17:02 PM
Kira Kira Koseki
II.3
Overall Posts Rated:
779779
Second Team:
Yubi Yubi
Personally I'm fine with the games being not-so-random like they are now. There's nothing more annoying for me in a manager game than to lose a game I should easily win, so it's nice that such things don't happen in this game; if you lose, there's almost always a good reason for it...

From: RSX

This Post:
00
263046.11 in reply to 263046.7
Date: 10/6/2014 3:09:02 PM
Overall Posts Rated:
181181
I'm having hard time believing this has anything to do with C++. If you didn't tell you are using random numbers, I would think you are calculating games just off the stuff like player attributes, tactics, lineup, arena, enthusiasm (that seems enough with exception like this, two same games and no training in between). In this case it must be either shitty programming or some really fancy algorithms.

This Post:
00
263046.12 in reply to 263046.9
Date: 10/7/2014 5:39:56 AM
TrenseRI
III.2
Overall Posts Rated:
36003600
Second Team:
ChiLeaders
Server time at the time the game is calculated? Depending on how much precision you're using, given that the games start calculating at the same time every game night for a given nation's games, that could lead to the same duplicate seeds. If it's c++ I'm not sure of the equivalent, but I'd probably use something like DateTime.Now.Ticks in C# to get a unique seed.
@GM-Hrudey: "The value returned generally represents the number of seconds since 00:00 hours, Jan 1, 1970 UTC (i.e., the current unix timestamp).", which is similar something like this 414086872.

Personally I'm fine with the games being not-so-random like they are now. There's nothing more annoying for me in a manager game than to lose a game I should easily win, so it's nice that such things don't happen in this game; if you lose, there's almost always a good reason for it...
@OTT9: There should be at least some variances between similar games though.

I'm having hard time believing this has anything to do with C++. If you didn't tell you are using random numbers, I would think you are calculating games just off the stuff like player attributes, tactics, lineup, arena, enthusiasm (that seems enough with exception like this, two same games and no training in between). In this case it must be either shitty programming or some really fancy algorithms.
@RSX: I'm not sure I understand exactly what you're trying to say, or whether I should feel complimented or offended Of course we use random numbers in many places in the code, that is certain.

This Post:
11
263046.13 in reply to 263046.12
Date: 10/7/2014 8:12:47 AM
Overall Posts Rated:
32293229
Server time at the time the game is calculated? Depending on how much precision you're using, given that the games start calculating at the same time every game night for a given nation's games, that could lead to the same duplicate seeds. If it's c++ I'm not sure of the equivalent, but I'd probably use something like DateTime.Now.Ticks in C# to get a unique seed.
@GM-Hrudey: "The value returned generally represents the number of seconds since 00:00 hours, Jan 1, 1970 UTC (i.e., the current unix timestamp).", which is similar something like this 414086872.


I think we'd had this same discussion previously when this came up and I just plain forgot it.

The only thing new I can think of, and this is even pretty unlikely, is that while the random seed is being assigned to some instance of an RNG, either when the calculations are using it they're either implicitly creating new random number from a new RNG, or possibly threading timing issues causing the RNG to be used before the seed is assigned. I don't think either of these is likely, especially the latter since it doesn't even seem to be a very likely design for this.

If it makes you feel any better, I understand how annoying this can be. I literally had a block of code where if I didn't do the following:

if (sli != null)
{
if (sli != null)
{
linenumber = sli.AltLineNumber;
}
}

I would get a null reference error because it would show as not null at first, but then null when I tried to access the property. I never did determine precisely what caused it other than finding that when I cleaned up some mistakes I mde in multithreading, it worked again. But it only affected that specific area of the code - inside other processes using the exact same code, it never failed.

But that's the life we choose. Just think in another ten years, with Moore's law, what the computers will do to us if they don't like our code then!


From: RSX

This Post:
00
263046.14 in reply to 263046.12
Date: 10/7/2014 9:51:03 AM
Overall Posts Rated:
181181
So how comes these two games are identical? Using srand with unix timestamp should give you different random values for these two games. I see no problem with C++ here (not to mention stdlib is a C library).

Last edited by RSX at 10/7/2014 9:51:20 AM

From: BB-Marin

To: RSX
This Post:
00
263046.15 in reply to 263046.14
Date: 10/8/2014 6:44:58 AM
TrenseRI
III.2
Overall Posts Rated:
36003600
Second Team:
ChiLeaders
I ask myself the same question: how? But it is. And Charles had the same problem, couldn't fix it. And he's a top notch programmer (understatement).

From: aamcguy

To: RSX
This Post:
00
263046.16 in reply to 263046.14
Date: 10/9/2014 12:29:42 PM
Overall Posts Rated:
1919
The problem with random number generators is that they aren't actually 100% random. Depending on how the stream is manipulated, even different seeds can create identical sequences for limited data sets.

Even with the limited chance of this happening, it could have all been avoided had at least one team played with a different attitude, had a different starting enthusiasm in game 1 so enthusiasm decay was different, set a different lineup, selected a different coach setting, played a different offense, played a different defense, or even guessed at their opponent's tactics.

Last edited by aamcguy at 10/9/2014 12:31:08 PM

From: RSX

This Post:
00
263046.17 in reply to 263046.16
Date: 10/9/2014 2:44:50 PM
Overall Posts Rated:
181181
If those two seeds were generating identical random numbers, then I'm pretty sure they would discover it quickly.

Advertisement