MovingBlocks/DestinationSol

Game crashes on startup on M2 mac

hesselink opened this issue · 8 comments

What you were trying to do

I downloaded the game using Steam on macos 13.5.2 (M2 mac). Then I clicked Play.

What actually happened

After starting, nothing happens. Looking in the game directory, I found a crash log (see below).

How to reproduce

No response

Game version

2.1.0

Log details

com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdx-box2d64.dylib' for target: Mac OS X, 64-bit
        at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:120)
        at com.badlogic.gdx.physics.box2d.Box2D.init(Box2D.java:32)
        at org.destinationsol.SolApplication.<init>(SolApplication.java:132)
        at org.destinationsol.desktop.SolDesktop.main(SolDesktop.java:135)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/lw/33dwv_5s409dw0y3xy6_s71n0828yj/T/libgdx<MY_USER>/d01668c7/libgdx-box2d64.dylib
        at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:316)
        at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:116)
        ... 3 more
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/lw/33dwv_5s409dw0y3xy6_s71n0828yj/T/libgdx<MY_USER>/d01668c7/libgdx-box2d64.dylib
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2408)
        at java.base/java.lang.Runtime.load0(Runtime.java:785)
        at java.base/java.lang.System.load(System.java:2011)
        at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:322)
        at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:291)
        ... 4 more

Operating System

MacOS

Additional Info

No response

That's unfortunately due to being on an M2 (or M1 really) Mac :-( Thank you for including that information, that makes it very clear.

I'm not sure if there's a native lib ready for that OS flavor quite yet, but if there is then we might be able to fix it. @BenjaminAmos may be able to find out at some point 👍

We'll need to use at least libGDX 1.11 for macOS ARM support (changelog). We're currently on 1.9.14. Upgrades in the past have been fairly trouble-free, so it shouldn't be too difficult.

I've attempted to fix this with #689.

@hesselink
If you've got time then I'd appreciate if you could test the changes and let me know if they work. You can get a build of the game with the M1/M2 changes here. To start the game, run the solOSX.sh script.

@BenjaminAmos Thanks, that was quick! I've just tested it. There's a small typo in the shell script (an X missing from the jre directory name, I've commented on the relevant line). After fixing that, the game starts for me!

any progress on this?

The changes I proposed apparently work, so I'll try and give #689 another test this week and see if I can merge them in. I can't test that it works personally but it should work after that. The project is very slowly maintained on my part at the moment, unfortunately.

@BenjaminAmos I've copypasted everything from this into my project and it compiled and started.

But now the buttons are messed up and I can't press them. Can you move me into the right directinon where to dig in?

Screenshot 2023-11-30 at 02 05 51

I think you've just resized the game window to be too small. Can you make it a bit larger by dragging the window corners around?

Not being able to press the buttons at all is a bit concerning. Is the display using any sort of DPI scaling? There's some code that checks the display density on Android but I'm not sure if that code is used in the desktop build.

// Mobile screen densities can vary considerably, so a large digital resolution can be displayed
// on a very small screen. Due to this, it makes sense to scale the UI roughly proportionally
// to form a more sensible default. Otherwise, the UI may appear to be too big/small.
// On very large mobile screens, such as tablets, you may need to adjust the UI scale further in the game options.
if (solApplication.isMobile()) {
baseUIScale = Gdx.graphics.getDensity() / MOBILE_UI_DENSITY;
} else {
baseUIScale = 1.0f;
}

If all else fails, you can try to manually adjust the window size and scale by editing engine/src/main/resources/settings.ini. The x value is width and the y value is height. nuiUiScale is the UI scaling factor. I've previously found that 800x600 is the smallest playable resolution.