OLEGSHA / Progressia

A GPL sandbox survival game
GNU General Public License v3.0
10 stars 4 forks source link

Problems with running on macos #11

Open infirms opened 3 years ago

infirms commented 3 years ago

Tested on: Mac Os Big Sur ( last version ) The compilation process is successful. haven't encountered problems with it.

The main problem is that starting the progressia.jar nothing happens at all, not even a crash. Java terminal appears on main bar on the desktop, but you can't even close terminal itself or interact with it.

All my actions:

  1. Clone Progressia GitHub repository.
  2. Install Adopt JDK ( 11 LTS).
  3. Build Progressia with gradlew.
  4. Attempt to launch progressia.jar
Red-Teapot commented 2 years ago

So, I did some testing. However, it was done on QEMU running MacOS 11.6 on non-Apple hardware.

When launching Progressia on Java 1.8, I got a segfault. Haven't managed to get it working at all.

When launching the game on Java 17, I got the same behavior as described by the OP: dead silence.

Apparently, you have to do rendering on the main thread in Mac OS, and to achieve that, a couple things are required:

  1. Launch the game with -XstartOnFirstThread JVM flag.
  2. Do rendering on the main Java thread. As of writing this comment, it is done in a separate thread in Progressia.

This is briefly mentioned in the LWJGL guide and on LWJGL GitHub.

Based on that, I managed to get a white window showing by modifying the GraphicsBackend class:

private static void startRenderThread() {
    renderThread = new RenderThread();
    renderThread.run();
    //renderThread.start();
}

This is not a correct fix but to me it indicates we're on the right track. I tried to refactor the startup code so it would render the game on the main thread but couldn't get it to work yet.

OLEGSHA commented 2 years ago

Thanks for such an informative contribution! We're still waiting on more tests on Apple hardware, if anyone's interested.

Just as a reminder for my future self, here's the LWJGL javadoc for glfwCreateWindow which lists part of this and some other compat issues: GLFW.glfwCreateWindow(int,int,java.lang.CharSequence,long,long).