Page 1 of 1
[boskid][2.0.12] Selector combinator returns wrong signal for the given index when choosing "sort ascending"
Posted: Tue Oct 29, 2024 4:17 pm
by teiriko
Description
When the selector combinator is set to "Sort ascending" and there are at least 8 signals in the network, the returned value of some indexes is wrong (see example below)
Example
Notes:
- on the left side all the selector combinators are set to "Sort descending" - everything is in order
- the right side fully copies the left side with the difference that "Sort ascending" is chosen - 5 and 6 should be switched
- below the setup, the marked combinator is opened, hopefully providing proof that I was not going crazy for the last 2 hours - the returned value should be 5
- 10-29-2024, 17-06-50.png (603 KiB) Viewed 1414 times
Blueprint
Code: Select all
0eNrlmNFuozAQRf/Fz26FsY0x0u6PRFVEEqe1BIYF0t0oyr/v2ASCKu9SLPGEKrUXx5y5Hs9MpN7QobioutGmQ9kN6WNlWpTtbqjV7yYv7JrJS4Uy1KpCHbuqeTlW5UGbHCS6Y6TNSf1BGbm/YaRMpzuteoB7uO7NpTyoBjbgAWRDdLnppiCM6qqFdytjI1oej145RleUyeSVQxx4q2uqYn9QH/mnhldgXwuGtDM81RB7MIXRWRedar6udtfaOvnUTXeBQ47W+kO/EFj5BR+Af1g0VVO6TeC3zhvnN0M/3MLFpo3c8QiPZ+HxMng8gdNZOF0GpxM4m4WzZXA2gfNZOF8G5xN4MgtPlsGTCVzMwsUyuJjA01l4ugyeTuByFi6XweX9bVrp8HS3z18aPcb/mxieRid9m0vX5ifd9I3sCtLX9FWtwJvb8YgA0F7syxyI57xo1WMw7Ydhg7LIZ5aOZk+6rYv8+lLnRhU+m3SYR/Kf88hmrVTjvIEtp5Fx1k3b7Z9TdeZqcnPtPrR5R32o4QxfLuenm8DHPsK3ifYav/sWQb60sbA7JhFZ+ZJjn1se6jZa2S3xuU2Wl+SQ143UJPXWpAjJW7SlvMXevKWh3UFX7g7mcytD3cYru6U+tyQKKUq6paJMvEVJSEji4i0ljvkTF4c2CF+5QRKvXRpql61sl3vtspCy5FsqS+EvSx6SOLalxHF/4pLQBhErN0jqtStC7SYr2xVeu2lIWYotlaX0l6UMSVyypcSldjtGv6Gi7aF2BBMcY/KGd/Ab84ei8GMVG9eskg9FceIUByWcSsdPrSL0IeFv5KS0kjhJ4ueOXotBwyLrtYvfB4ZR89yT2PW018JqGxSOoztVwhmf/zTG6BNuzV0VT2LJpOQsjoRg8H3/F95cfAk=
Re: [boskid][2.0.12] Selector combinator returns wrong signal for the given index when choosing "sort ascending"
Posted: Tue Oct 29, 2024 5:39 pm
by boskid
Can you provide a save file that shows this issue? This is highly unbelievable for me because the only difference between sorting ascending and descending is the compare function but the code under the hood that picks a specific signal uses standard c++ function so the chance of an error here are basically 0. I need to rule out player errors in this specific case because i see lab tiles which suggests an editor may be used and there is a common trap in this case where a time is paused. Also a log file could help if by any chance this is a platform specific issue (which would be even more unlikely)
Re: [boskid][2.0.12] Selector combinator returns wrong signal for the given index when choosing "sort ascending"
Posted: Tue Oct 29, 2024 7:36 pm
by teiriko
I've attached the log and the save file I've just created
Some notes:
- I'm using a MacBook with M1 Pro
- I've created a clean new game and used `/cheat` to get the items
- I've pasted the blueprint attached to the first message - got the same result
Re: [boskid][2.0.12] Selector combinator returns wrong signal for the given index when choosing "sort ascending"
Posted: Tue Oct 29, 2024 7:39 pm
by teiriko
I've tried to do exactly the same on my Windows machine - and couldn't reproduce
Re: [boskid][2.0.12] Selector combinator returns wrong signal for the given index when choosing "sort ascending"
Posted: Tue Oct 29, 2024 9:03 pm
by Quezler
can confirm on my m1 mac:
Re: [boskid][2.0.12] Selector combinator returns wrong signal for the given index when choosing "sort ascending"
Posted: Tue Oct 29, 2024 9:43 pm
by boskid
Ok, this issue was identified and is now fixed for 2.0.13.
This issue boils down to a c++ comparators, in this case the comparator used by selector combinator when comparing signal with itself would say it is lower and this apparently broke the underlying function that selects nth_element, but this issue only happened on mac since the nth_element function is provided by the library that comes with c++ compiler and it looks the standard library that comes with compiler on mac may perform the self compares which was giving wrong values causing wrong sorting order. On windows and linux the specific implementation must have been different as it was not doing self compares and the issue was not reproducible there.
Re: [boskid][2.0.12] Selector combinator returns wrong signal for the given index when choosing "sort ascending"
Posted: Wed Oct 30, 2024 8:35 am
by arphen
insane