DiSaMe Posted December 10, 2010 Share Posted December 10, 2010 In my script I use math.random to generate objects. The script is client-side, so to generate the same objects on all clients, I use the same random seed number. My question is, does the same random seed number generate the same random sequences on all OS versions? If not, then players with different OS versions will see different objects, so I will have to write my own random function. Link to comment
eAi Posted December 10, 2010 Share Posted December 10, 2010 You should be doing it on the server surely? Link to comment
DiSaMe Posted December 10, 2010 Author Share Posted December 10, 2010 No, I shouldn't. I don't want my server to waste bandwidth on so many objects. What I do on the server is setting primary data (coordinates, random seed...). Client uses it to generate objects. Because primary data is the same for all clients, they should generate objects in the same way. Unless there are differences between their systems which cause differences between math.random() results. So this is an example of the situation: two players have different versions of Windows. They have random seed set to the same number. Will sequence of math.random results be the same for players? Link to comment
[DKR]Chaosis Posted December 10, 2010 Share Posted December 10, 2010 I would also like to know the answer to this question I've had a similiar question when I was making a maze game with auto-generated mazes. I simply assumed that the sequence would be the same for all clients, and it does work for the large majority of the players. However, I began to doubt that assumption when I saw 2 players running through walls in the maze, it turned out they saw a different maze on their screen. They were using 1.0.2 (I forgot to ask about the OS), while everyone else was using 1.0.4 It might have been a very rare bug in my maze resource, but I couldn't find any mistakes in my code so, to be safe, I dropped the lua random function and went for a custom lineair congruential generator. Link to comment
DiSaMe Posted December 10, 2010 Author Share Posted December 10, 2010 What you wrote looks like an answer to me Ok, thanks, I'm gonna write my own random number generator function Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now