Page 1 of 1

Multiplayer and random number generation

Posted: Mon Apr 27, 2015 6:22 pm
by orzelek
Is there a way to generate random numbers in deterministic way in game to not break synchronization in multiplayer?

I noticed that there is a very convoluted way of doing that in RSO mod currently - it also seems it might not be enough. I'd like to make it MP friendly - rng seems to be main potential issue there.

Re: Multiplayer and random number generation

Posted: Mon Apr 27, 2015 6:47 pm
by Choumiko
I vaguely remember some FFF mentioning that they made rng deterministic, i don't know though if it was the one in c++ or lua.

Re: Multiplayer and random number generation

Posted: Mon Apr 27, 2015 7:33 pm
by Koub
Maybe are you looking for that : https://forums.factorio.com/forum/vie ... 450#p46431 ?

Re: Multiplayer and random number generation

Posted: Mon Apr 27, 2015 7:46 pm
by orzelek
Thanks Koub.
So this huge rng implemented in RSO is now obsolete I guess.
I'll try to remove it and see if it's more behaved after that. It could be that fancy random stuff is somehow causing desync.

Is there some kind of guideline for what mod shouldn't do to not break multiplayer?

Edit:
Are mods global variables synced or it would need to use glob.* to store those to make it synced correctly?

Re: Multiplayer and random number generation

Posted: Tue Apr 28, 2015 5:39 am
by Rseding91
orzelek wrote:Thanks Koub.
So this huge rng implemented in RSO is now obsolete I guess.
I'll try to remove it and see if it's more behaved after that. It could be that fancy random stuff is somehow causing desync.

Is there some kind of guideline for what mod shouldn't do to not break multiplayer?

Edit:
Are mods global variables synced or it would need to use glob.* to store those to make it synced correctly?
glob is the only thing synced.