Multiplayer and random number generation

Things that already exist in the current mod API
orzelek
Smart Inserter
Smart Inserter
Posts: 3922
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Multiplayer and random number generation

Post 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.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Multiplayer and random number generation

Post 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.

Koub
Global Moderator
Global Moderator
Posts: 7743
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Multiplayer and random number generation

Post by Koub »

Maybe are you looking for that : https://forums.factorio.com/forum/vie ... 450#p46431 ?
Koub - Please consider English is not my native language.

orzelek
Smart Inserter
Smart Inserter
Posts: 3922
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Multiplayer and random number generation

Post 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?

Rseding91
Factorio Staff
Factorio Staff
Posts: 14150
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Multiplayer and random number generation

Post 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.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Already exists”