-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
[3.3rc6] Values generated by simplex noise are different #47211
Comments
That's a bugfix, so I guess the value in 3.3 RC 6 is the new normal, and the value you had in 3.2.3 was wrong. CC @bruvzg |
There was signed integer overflow in 3.2.3 (which is undefined behavior). Values for the specific seed are different, but behavior of the noise should be the same. |
Yeah, I'm not doubting that this is a more correct implementation. However, it's a major breaking change that I found unexpected for a point release. For people making games with procedural level generation, this change would make level generation inconsistent between the two versions. I know Godot expects some breaking changes between versions, so if this change makes the output consistent across the currently supported platforms then it probably makes sense to accept it in 3.3. However, if the behaviour was already consistent on the supported platforms (even if undefined behaviour in C/C++), then I think it should be delayed till 4.0 since this change would cause unnecessary friction for people who want to update to the new version. If it is accepted, it should be documented in the release notes that simplex noise in 3.3 is not compatible with older versions. |
I'll mention it in the CHANGELOG.md for The previous logic was UB and would possibly behave differently on different platforms/compilers, so it was not consistent, even if it seems so on a given platform. Being UB, it could even change behavior when upgrading a given compiler to a new version. The fix simply clarifies the intent by removing the UB - so if it makes the results different, it means that you were actually hitting a case where the UB leads to an unexpected (thus buggy) behavior. Now with 3.3 you can actually expect that your level generation will be consistent across platforms/compilers, which it wouldn't have been in 3.2.3. |
Looks like this wasn't added to the CHANGELOG.md after all? |
I think it'd be possible to restore the original behaviour¹, without reintroducing UB, at the expense of emulating the two's complement behaviour in this line:
It's in a tight loop of 256 iterations, but this function is only called upon creation of ¹ To the best of my knowledge, none of the platforms that Godot runs on do anything surprising upon signed integer overflow. They just wrap around in the two's complement manner. So the original behaviour probably was consistent across platforms already. |
Apologies, I forgot about this. Feel free to open a pull request to add it to the 3.3 changelog on the |
This was fixed by #48154. |
Godot version:
3.3-rc6
OS/device including version:
Linux
Issue description:
The output of simplex noise has changed in 3.3rc6. Behaviour changed in this commit: da28904.
Steps to reproduce:
This outputs:
Minimal reproduction project:
simplex-noise-compat-break.zip
The text was updated successfully, but these errors were encountered: