-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add reproducible cross-platform random System.Random implementation #224
base: master
Are you sure you want to change the base?
Add reproducible cross-platform random System.Random implementation #224
Conversation
…nd feed wave spectrum from it.
Thanks @ShadowTeolog, great contribution again. I had no idea System.Random was not deterministic across platforms - thats a bit crap. I can't take the commented out warning (it indicates that waves are being lost, and can result in pops when the viewpoint moves and they come back) but i'll take the rest. I'm fairly sure I can add commits to this, I'll see if i can remember how! |
yes. This commented warning passed to pull request by mistake. Also I update this part later, because look like ocean state look not reproducible after waver change and move, need to keep original state at zero position for basis for predictable state for setorigin recalulation |
It's also probably worth checking that the Mersenne twister license is compatible with the project's MIT license and that we appropriately handle it. Going to do some research into that now. |
Look like artistic license compatible to MIT, GPL, etc. Only require to any changes of original code mast not be hidden from pulling to original version |
OK, so this version of the file appears to either come from this project: Which seems to be an adaption from this implementation: All of the above reference the original C program from which they are adapted: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c, but only the latter includes the original license. So the C# port appears to originally, orginally come from this now dead page http://www.centerspace.net/resources/free-stuff/mersenne-twister. |
So, part of the code appears to be licensed under the Artistic license (see also here). However, I couldn't find any evidence of which version of the license it was originally distributed under. The original C program has this license (which applies to the C# program as well):
This is the 3-Clause BSD License which the version of Mersenne Twister algorithm we are using is violating by not including it. |
So, trouble will fixed if original "bla-bla-bla bsd" code will added back to currently exists file? |
Let's just make sure we credit the source with that link you have
currently. The notice is not easily available as you've shown Tom.
…On Tue, 23 Apr 2019, 22:32 ShadowTeolog, ***@***.***> wrote:
So, trouble will fixed if original "bla-bla-bla bsd" code will added back
to currently exists file?
At least half of mathematics applications + boost, office, etc use code
based on original C implementation and I don't think what this impossible
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#224 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAHFO7NC6QOQQ2465PVLUSDPR56AHANCNFSM4HGHUWPA>
.
|
I havent fully understood - do you plan to make further changes or is this PR ready to be merged? |
This look not simple, initial data contains seed,wind speed and direction,and base offset position. This results some changes. Also need change in offset origin code. Not sure then can do this immediately/ |
I don't really get how setorigin is affecting this code - my impression from what you wrote above is that the seed is dependant on the position/base offset, in which case I would understand why this would break when these move... however in the code the seed is set by the user, which should always be consistent. There are some comments in FloatingOrigin.cs about requirements to get pop-free setorigin() and i wonder if you're seeing the normal map popping. I don't mind leaving this open in any case, no pressure from my side! |
Not this code, here only one part related with random reproduction, over parts has more impact to different files, and I not pull them before finish and clean. Trouble is copy ocean shape starting in middle of simulation, with any wind and any time moment. This require "Update conditions" function affecting different code parts. Also current code make origin changes from current position but not initial position. This result impossible to return to original state in cycle: |
I'm not confident i understand still, but this feels like it should be solvable. Changing wind direction at runtime is not possible as I think you refer to above. To still get flexibility, we used to have the ability to render the gerstner waves from geometry laid out in the world. As a concrete example if you want a big storm in the middle of the open ocean, it is possible to render a circular patch of geometry with whatever wave condition, wind direction, etc you want there: The numbers represent vertex weights to blend out the stormy waves smoothly at the edges. So wind direction is not modified dynamically for a set of waves, but is allowed to differ in different parts of the world using crossfades between different conditions. This would move around with the rest of the geometry in the world and should support the floating origin teleport and should also be 100% deterministic and consistent throughout the world. We can discuss bringing this mechanism to life if it its useful. In any case please let me know if/when you think this PR is ready to merge, as its not clear to me, and I'll leave it open in the meantime. |
This is a thing now, so will look at this as an alternative :) |
|
Just considering to add a good water system to a multiplayer project, and I came across this precious site. Regarding syncing different clients on network, I would like to ask the logic behind. I don't know the crest script itself, but is not this kind of ocean re-creations a result of some Fourier transformations, which creates a real time simulation from a frequency based distribution? In that case, form different wavelengths and frequencies into the time domain? If so, I could not get the logic how syncing the time would help to solve this issue. Even with the same parameters and same time, an infinite random outcomes are possible. Or is not it the case for Crest? |
if you have a reproducible source of random numbers that works the same on all clients and the server, as well as synchronized time, the waves will play exactly the same. To do this, it is enough to set the initial spectrum at time 0, the local point as a base and the source of random numbers. This is tested on a multi-display system with several computers displaying side-by-side images with a full angle of 270 degrees. |
Use local random source with cross-platform implementation, to allow reproduce same spectrum on server without Unity