-
Notifications
You must be signed in to change notification settings - Fork 141
feat(logic): Decouple scripted audio events from CRC computation #2075
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
base: main
Are you sure you want to change the base?
feat(logic): Decouple scripted audio events from CRC computation #2075
Conversation
xezon
left a comment
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.
In principle this looks like the right thing to avoid mismatching.
| extern Int GetGameLogicRandomValue( int lo, int hi, const char *file, int line ); | ||
| extern Int GetGameLogicRandomValueUnsynchronized(int lo, int hi, const char* file, int line); | ||
| extern Real GetGameLogicRandomValueReal( Real lo, Real hi, const char *file, int line ); | ||
| extern Real GetGameLogicRandomValueRealUnsynchronized(Real lo, Real hi, const char* file, int line); |
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.
Unsynchronized reads a bit brutal. Perhaps there is an alternative word for it? Perhaps GetGameLogicCurrentValue?
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.
Yeah, that's fair.
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.
Still a bit awkward but it's currently like this:
macro: GameLogicCurrentRandomValue
function: GetGameLogicCurrentRandomValue
Leaving the 'random' part out of the name seems undesirable to me.
| } | ||
|
|
||
| // | ||
| // Integer random value; does not change the seed 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.
I suspect this will always return the same value on consecutive calls?
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.
Yes, that's correct.
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.
Do you have a suggestion for a more descriptive code comment, or is it good 'as is'?
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.
I suggest to clarify that it just returns the current logic value without taking the necessary steps to generate a different value on next call. And then can also provide an example use case to explain what this is useful for.
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.
Info comments added.
Scripted audio events are synchronized across clients. That means that if the script execution fails for some reason (e.g. caused by another bug), there's a CRC mismatch. This PR changes that, so that scripted audio events are still likely to be same across clients but script execution failure does not result in a mismatch.
TODO:
AudioEventRTS::getIsLogicalAudio. Could maybe delete the function or add an assertion that it should be used with the new random value macros.