Game scrips on M1 Mac creates only giant circles

andyc67

Active member
I am trying to create a multi point mask using the Game script on an M1 Max MBP but I end up with a giant circle instead of the shape that I created. Is this just a bug in the script?
 
That's weird, I just tried it on my Mac (M1) and it works perfectly.

The first two dots that are added generate a circle, the following ones form the mask as desired.
 
Strange indeed. When I add more points the circle keeps getting bigger but never goes away. It essentially inscribes the shape that I create. Then the circle becomes the mask. I tried it on my PC and it works fine.
 
I have an update. The script works as expected on my M1 MacBook Air, not on the pro. I heard from the script developer and his assumption is that it's the Java scripting engine. He referred me to the PI developers for a solution.
I think I just have to use the Air just for the script and my Pro for everything else.
Another curious observation is that if I quit PI on the PRO and restart it, then I use the script, it works fine once, then for all the subsequent times the results are unpredictable.
 
is there a difference between the operating system versions on these two machines?

the javascript engine is built into PI and should be the same on both installations. is the PI version the same on both machines?
 
Here are the versions:

MBP
MacOS 13.2.1 (22D68)
PI 1.8.9-1 Ripley (x64)

MBAir
MacOS 13.2.1 (22D68)
PI 1.8.9-1 Ripley (x64)

I take it back the MBAir is also producing unpredictable results. I suppose it's across the board. I will have to revert to using the PC but only for the Game script. Not a big deal.
 
Last edited:
interesting that neither are M1 machines, was suspecting some kind of rosetta2 problem. maybe this is trackpad-related. what happens if you attach and use a mouse with one or both of these computers?
 
oh sorry - i saw the x64 and thought you were talking about intel machines but that's just the PI version.

there have definitely been rosetta problems - but they seemed to be performance related. but the mouse thing might still be worth trying if you have the plumbing for it and/or a bluetooth mouse.
 
I tried with a mouse, same result. This time the process console actually reported an error.
*** Error [000]: /Applications/PixInsight/src/scripts/GAME.js, line 2757: Error: Critical signal caught (11): Segmentation violation



PixInsight 1.8.9-1 - Critical Signal Backtrace

Received signal 11 (SIGSEGV)

Module: 0 PixInsight 0x00000001051dc85d InitializePixInsightModule + 1841965

================================================================================

9: 1 libsystem_platform.dylib 0x00007ff80244fc1d _sigtramp + 29

8: 2 ??? 0x00007fde38d4aae8 0x0 + 140592412928744

7: 3 libsystem_malloc.dylib 0x00007ff8022838e7 mvm_deallocate_pages + 110

6: 4 libsystem_malloc.dylib 0x00007ff80228226c free_large + 947

5: 5 libsystem_malloc.dylib 0x00007ff80228b6cf _szone_free + 676

4: 6 libsystem_malloc.dylib 0x00007ff80227b303 szone_realloc + 886

3: 7 libsystem_malloc.dylib 0x00007ff80227a1f2 malloc_zone_realloc + 69

2: 8 libsystem_malloc.dylib 0x00007ff802278d55 realloc + 309

1: 9 libmozjs-24.dylib 0x000000011624567e _ZN8JSObject12growElementsEPN2js17ThreadSafeContextEj + 222

================================================================================
 
FWIW, for me on my Mac Ultra I can only get GAME to work if I do a binary mask. So I'll do that and use Convolution to blur it out as I need. No idea why it would have such difficulty but whenever the next big update of PI with native Mac silicon support becomes available with the updated javascript engine it will work smoothly again?
 
interesting, i am running a studio with M1 ultra and i'm not seeing these problems. however, i'm still on macos12 which could be the difference.

clearly @andyc67 's trap is in the javascript engine, and i think as we all agree this is likely a rosetta2 problem. i don't have any x86 macs in production anymore so it's hard for me to test if macos13 is the problem or rosetta is the problem.

@TurtleCat i assume so but who knows.
 
Ok, now I can see the error and it seems to be random.

I can draw the mask with several points without problem, but when I hit the Ok button, sometimes I get the error Segmentation violation. Other times I have to click the Ok button more than once.

Also the resulting masks are strange, sometimes it mixes the shape of several dots with a circle.

Other times it works fine.

Definitely weird.
 
It definitely produces unpredictable results on my M1max MacBook Pro. I will have to use my PC just for the Game script when needed. Luckily it's not a script that I use often at all.
 
A trick that helps if you need a mask of a specific shape is to generate a binary mask, it will be flat and black and white. And then apply a blur (Convolution) to that mask.
 
I found a workaround! The Game script works fine on a Mac when drawing ellipses. Where it fails is when I try to draw a spline type shape.
The workaround is to approximate the desired shape with a number of overlapping ellipses. This will provide a mask of the desired shape and it will work on an M1 Mac.
 
Back
Top