You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current sprite editor is lacking the "Separate Masks" checkbox as well as a field for "Alpha Threshold" which are saved properties in GMK and GMX. LGM is already loading the properties they are simply not present in the current sprite editor. I have since added them to the sprite editor.
The other issue is regarding the automatic bounding box calculation. It was previously not correctly zero'ing the pixel transparency of the BufferedImage when comparing it with the threshold. The threshold was also not being accounted for in the algorithm, we had it hardcoded to 0. In addition, the comparison was inverted and should have been checking if the alpha is greater than the threshold, not less than.
if (img.getRGB(i,y2) >> 24 < tolerance) breaky2loop;
// the correct comparison is thisif (((img.getRGB(i,y2) >> 24) & 0xff) > tolerance) breaky2loop;
// as opposed to the original versionif (img.getRGB(i,y2) >> 24 < tolerance) breaky2loop;
These changes make the calculation more compatible with GM8.1 and GMS. The following test case verifies the results, with one exception where GameMaker and LGM will continue to have different results after these changes.
(Left, Top, Right, Bottom)
Threshold: 0 (0, 0, 31, 31)
Threshold: 84 (0, 0, 31, 31)
Threshold: 85 (0, 19, 31, 31)
Threshold: 158 (0, 19, 31, 31)
Threshold: 159 (15, 19, 31, 31)
Threshold: 190 (15, 19, 31, 31)
Then when we set the threshold to 191 LGM will report (0, 0, 0, 0) where GameMaker reports (31, 31, 0, 0) because of a slight anomaly in the algorithm. It does not seem logical that right would be smaller than left, so I believe this is why LGM does it this way and is more correct. If I were doing this as my own game engine I would set the comparison as larger than or equal to the alpha threshold. It does not make logical sense that when the threshold is 255 it would for every sprite always select an inappropriate bounding box (what GM does) or no bounding box at all (what LGM does). However, using this comparison would not be off by one with GM and thus can not be done.
After these changes, all of the bounding boxes for every sprite in the game Croky, posted on the forum, are now calculated the same as GM. This should address many other collision detection issues ENIGMA side in previously tested games. http://enigma-dev.org/forums/index.php?topic=2612
The text was updated successfully, but these errors were encountered:
The current sprite editor is lacking the "Separate Masks" checkbox as well as a field for "Alpha Threshold" which are saved properties in GMK and GMX. LGM is already loading the properties they are simply not present in the current sprite editor. I have since added them to the sprite editor.
The other issue is regarding the automatic bounding box calculation. It was previously not correctly zero'ing the pixel transparency of the BufferedImage when comparing it with the threshold. The threshold was also not being accounted for in the algorithm, we had it hardcoded to 0. In addition, the comparison was inverted and should have been checking if the alpha is greater than the threshold, not less than.
LateralGM/org/lateralgm/resources/Sprite.java
Line 191 in c00edb3
These changes make the calculation more compatible with GM8.1 and GMS. The following test case verifies the results, with one exception where GameMaker and LGM will continue to have different results after these changes.
(Left, Top, Right, Bottom)
Then when we set the threshold to 191 LGM will report (0, 0, 0, 0) where GameMaker reports (31, 31, 0, 0) because of a slight anomaly in the algorithm. It does not seem logical that right would be smaller than left, so I believe this is why LGM does it this way and is more correct. If I were doing this as my own game engine I would set the comparison as larger than or equal to the alpha threshold. It does not make logical sense that when the threshold is 255 it would for every sprite always select an inappropriate bounding box (what GM does) or no bounding box at all (what LGM does). However, using this comparison would not be off by one with GM and thus can not be done.
After these changes, all of the bounding boxes for every sprite in the game Croky, posted on the forum, are now calculated the same as GM. This should address many other collision detection issues ENIGMA side in previously tested games.
http://enigma-dev.org/forums/index.php?topic=2612
The text was updated successfully, but these errors were encountered: