-
Notifications
You must be signed in to change notification settings - Fork 621
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
[MP] seed RNG in modules #1125
[MP] seed RNG in modules #1125
Conversation
50d20f5
to
ecb70f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me
how's the status on this one? i think no new developments have been made and this version can be pushed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering the lengthy discussion we had on discord reagarding this, I think this is fine for merging. This is the closest we can get with random numbers compared to the original executable considering different build systems. Randoms are called all over the place, also with user interactions, so theres no pattern that can be recreated for the random values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As nobody found any indications of easily recognizable patterns and as the vanilla modules seem to have not used the bg_lib.c
version of rand
there is probably no need to revert the old commit and this should be enough to counter the mentioned side effects.
To reference the mentioned discussion and given the every compile feels different
discussions over the years I can understand why someone would want to revert the mentioned commit, but I suppose if someone is afraid of hidden side effects it's easier to recompile modules from a codebase closer to the vanilla code than to try and undo the cleanup made in OpenJK.
So let's use this PR. If something comes up in the future the two commits could still be reverted.
Honestly you made a point that I think is often overlooked here, sometimes it feels like people feel pushing some new thing to repo is a lifetime commitment :P |
This should fix unwanted side-effects introduced by 2bcf85c.
Each module has its own copy of the initial RNG seed (
holdrand
), but only the engine's copy was being updated on init.There were many effects of this, notably the "random" spawns on a
map_restart
were actually consistent, since the game module gets reloaded.See also: long discussion on JKCommunity discord over a couple days starting here breaking down the original rand usage and explanation of why this is the best fix (as opposed to reverting 2bcf85c).