Math.randomseed
Posted: Sun Sep 18, 2016 4:30 pm
So i have been making a new scenario for factorio multiplayer basing a lot of my code off of what the devs made with the official team production challenge.
i am using a map blueprint I made in the map editor
i am also calling on math.random to generate random variables.
what i am learning from the forums is that math.random is always based off the seed of the map so i cant set a math.randomseed() of my own
I am here to see if anyone else has come to this before me and has found a good solution or could help walk me though it.
moar...
the problem i am having is the fact that i am using the map i created, with the math.random is always pulling the same number.
and i can't set math.randomseed(os.time) because from what i am understanding that would cause dyncs in multiplayer.
hence why they made it always based on the map seed, because that would make the same numbers for every client.
I had seen in the team production challenge that they added some interesting code function save_map_data(distance), and function recreate_map so instead of loading in a blueprint like i have been doing. They generate a map and erase it and load their map on top if the now empty map.
and i think( correct me if you know more than me..) they did all of that just to keep a stable use of math.random
what im getting at..
i am looking for clarification before i go do that same convoluted damn'd thing and not actually fix my problem.
i am using a map blueprint I made in the map editor
i am also calling on math.random to generate random variables.
what i am learning from the forums is that math.random is always based off the seed of the map so i cant set a math.randomseed() of my own
I am here to see if anyone else has come to this before me and has found a good solution or could help walk me though it.
moar...
the problem i am having is the fact that i am using the map i created, with the math.random is always pulling the same number.
and i can't set math.randomseed(os.time) because from what i am understanding that would cause dyncs in multiplayer.
hence why they made it always based on the map seed, because that would make the same numbers for every client.
I had seen in the team production challenge that they added some interesting code function save_map_data(distance), and function recreate_map so instead of loading in a blueprint like i have been doing. They generate a map and erase it and load their map on top if the now empty map.
and i think( correct me if you know more than me..) they did all of that just to keep a stable use of math.random
what im getting at..
i am looking for clarification before i go do that same convoluted damn'd thing and not actually fix my problem.