collinsmith / riiablo

Diablo II remade using Java and LibGDX
http://riiablo.com
Apache License 2.0
895 stars 101 forks source link

Updated the documentation with Linux/MacOS build instructions #115

Closed Allsimon closed 3 years ago

Allsimon commented 4 years ago

Hello,

I added some documentation about building on Linux/MacOS.

Note: The game currently crash after creating a character with:

Exception in thread "LWJGL Application" java.lang.RuntimeException: Actor: TextButton
|  Label: OK
at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:192)
at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:152)
at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:132)
at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:122)
at com.badlogic.gdx.scenes.scene2d.ui.Button.toggle(Button.java:140)
at com.riiablo.screen.CreateCharacterScreen$7$1.keyDown(CreateCharacterScreen.java:315)
at com.badlogic.gdx.InputMultiplexer.keyDown(InputMultiplexer.java:80)
at com.badlogic.gdx.InputMultiplexer.keyDown(InputMultiplexer.java:80)
at com.badlogic.gdx.backends.lwjgl.DefaultLwjglInput.processEvents(DefaultLwjglInput.java:341)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:220)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)
Caused by: java.lang.NullPointerException
at com.riiablo.screen.panel.InventoryPanel.<init>(InventoryPanel.java:284)
at com.riiablo.screen.GameScreen.<init>(GameScreen.java:334)
at com.riiablo.screen.GameScreen.<init>(GameScreen.java:255)
at com.riiablo.screen.CreateCharacterScreen$5.changed(CreateCharacterScreen.java:191)
at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeListener.java:28)
at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:188)
... 10 more

I'm not sure if this is a Linux specific issue (didn't try on Windows yet).

The change on gradlew is simply a chmod +x gradlew

collinsmith commented 4 years ago

Fantastic, I'll take a look when I get a chance!

CharStats instances need to be coupled with d2s data, which a new character doesn't have. I dropped support for new characters when this change was made until I decided to properly implement character creation. The project will look for save files within your $diablo_home$/Save directory, which you may need to copy saves into manually as on windows saves are located somewhere else in 1.14. I use pluggy, so I have old-style saves. Generating a CharStats/d2s would not be difficult, just haven't gotten around to it since it's not very useful to test on new characters without stats/skills/items.

collinsmith commented 4 years ago

I looked into it a bit more. The specific crash you're seeing is caused by not having an attributes initialized correctly because of a new character. I could work around this issue by providing default values at that specific crash point, but it's asserted that certain stats are set for every character (such as gold, hitpoints, etc). This will eventually be resolved when new characters have a d2s created which calls CharStats#softReset which sets these default values.

yuripourre commented 4 years ago

@collinsmith the LibGDX LWJGL2 backend is not working with OpenJDK 14. I had to upgrade to LWJGL3 to use it. Maybe that's the case?

collinsmith commented 4 years ago

Ahh, I see. I remember upgrading to LWJGL2, we'll probably continue that trend with desktop to support as many features as we can on that platform. Android has been finicky with dependencies though (hence why I wrote an entire logging framework because Log4J2 didn't work), so source compatibility will remain at JDK7.

Allsimon commented 4 years ago

Why didn't JDK14 work?

For me, it was an issue with your gradle wrapper. It is currently configured to version 4.6 (see https://github.com/collinsmith/riiablo/blob/master/gradle/wrapper/gradle-wrapper.properties) and 4.6 doesn't support Java >= 11.

I tried to bump Gradle to 6.6.1 (current latest), but I had build issues with it. I didn't investigate further.

Is there a reason why gradlew is included?

gradlew was already committed in the repo, but it was not marked as executable, so if you tried to ./gradlew build on Linux/MacOS, it would simply throw a "This file is not executable"

What about the notes about the MacOS MPQ file format? AFAIK, there is no Linux version of the game which means you likely copied the MPQ files over

Yes I just copied the MPQ files. I didn't know there would be differences in MPQ for MacOS, so I didn't tried yet

Please don't commit whitespace changes.

My bad 😅 IntelliJ did it for me

collinsmith commented 4 years ago

I'm not great with building and build scripts, so I'm always worried I'll mess up my house of cards. It's happened before and completely halts development, so I typically leave it alone unless I absolutely need to change it (hence why the wrapper is 2.5 yrs old). It's definitely an area I need to learn more about or get help from someone who understands it 😄

collinsmith commented 3 years ago

5b5ecd8fbe0d58c01fba89f79264377a86bb036b added +x to gradlew using git update-index --chmod=+x gradlew

Closing due to inactivity.