8000 Fix sound, upgrade to Java 17 by StenAL · Pull Request #103 · PhilippvK/playforia-minigolf · GitHub
[go: up one dir, main page]

Skip to content

Fix sound, upgrade to Java 17 - #103

Merged
PhilippvK merged 13 commits into
PhilippvK:masterfrom
StenAL:sound
Apr 28, 2023
Merged

PhilippvK merged 13 commits into
PhilippvK:masterfrom
StenAL:sound

Conversation

@StenAL
@StenAL StenAL commented Apr 23, 2023
Copy link
Copy Markdown

This restores the satisfying thunk sound that plays on every stroke.

See individual commits for more details.

Highlights:

  • deobfuscate a decent chunk of code, including most classes related to playing sound
  • fix tests on Windows
  • upgrade to Java 17
  • remove some unused/duplicate resources
  • play sounds
    • for the player's strokes
    • for other players' strokes
    • when the player wins/draws/loses a multiplayer game

This makes it possible to run tests on Windows, otherwise files were
getting copied to a path using "\" but tests were looking for paths with
"/".
@PhilippvK
Copy link
Copy Markdown
Owner

@StenAL This is awesome. Give me a few days to try it out :)

@PhilippvK
Copy link
Copy Markdown
Owner

@StenAL Sound works as expected!

However I found out that the game crashes at the end of a singleplayer round:

>>> Packet{channel=[id: 0x058bf4fc, /127.0.0.1:54884 => /127.0.0.1:4242], type=DATA, count=112, message='game\tendstroke\t0\tt'}
>>> Packet{channel=[id: 0x058bf4fc, /127.0.0.1:54884 => /127.0.0.1:4242], type=DATA, count=113, message='error-debug\t4\tjava.lang.NullPointerException: Cannot load from int array because "outcome" is null\tgame\end\tgame\startturn\0\tgame\endstroke\0\t'}
>>> Packet{channel=[id: 0x058bf4fc, /127.0.0.1:54884 => /127.0.0.1:4242], type=COMMAND, count=0, message='end'}
Unhandled packet: Packet{channel=[id: 0x058bf4fc, /127.0.0.1:54884 :> /127.0.0.1:4242], type=DATA, count=113, message='error-debug\t4\tjava.lang.NullPointerException: Cannot load from int array because "outcome" is null\tgame\end\tgame\startturn\0\tgame\endstroke\0\t'}
Unhandled packet: Packet{channel=[id: 0x058bf4fc, /127.0.0.1:54884 :> /127.0.0.1:4242], type=COMMAND, count=0, message='end'}
Client disconnected: [id: 0x058bf4fc, /127.0.0.1:54884 :> /127.0.0.1:4242]

This does not happen in the master branch, aka. it might be related to the Sound changes or Java upgrade. I hope you can reproduce this...

@StenAL
StenAL commented Apr 28, 2023 •
Copy link
Copy Markdown
Author

Thanks for the thorough testing! I only tested in multiplayer.

I've pushed a fix now, the issue was with trying to play music at the end of a game based on the results, but in a single player game the server does not send any results so there was a null dereference.

@PhilippvK
Copy link
Copy Markdown
Owner

That was crazy fast!

I will approve and probably merge in a few hours unless you have anything against that.

@PhilippvK
Copy link
Copy Markdown
Owner

@StenAL the CI needs a patch to use Java 17 instead of 8. Should I fix this in a followup or can you have a look?

@StenAL
StenAL commented Apr 28, 2023
Copy link
Copy Markdown
Author

I can take a look and I'll also squash the crash fix commit into the original change.

@StenAL
StenAL commented Apr 28, 2023
Copy link
Copy Markdown
Author

@PhilippvK Looks like you need to approve every CI run, let's hope the first try works.
image

StenAL added 12 commits April 28, 2023 20:36
Java 17 is the latest LTS version of Java and comes with convenience
APIs and performance improvements. Changes to get it working:
- the Launch4j Maven plugin had to be upgraded. The new version has JRE
 path as a required option. Setting it to "jre" preserves the previous
 behavior of using the host's bundled JRE is preserved.
- a dependency of appbundle-maven-plugin had to be upgraded
- the Netty dependency could be removed, it was completely unused
This is in preparation of getting sound to work. No functional changes
intended.
No functional changes intended. Code changes except for renaming things:
- remove hardcoded static strings
- remove unnecessary escapes from debug log strings
No functional changes intended. Code changes except for renaming things:
- combine AApplet and Applet fields
- make `loadSoundClipsOnRegister` and `debug` fields final
- add generic types to Hashtables
Turns out this code is completely unused, however now that it's cleaned
up it can potentially be used in the future to add more sounds to the
game.

No functional changes intended. Code changes except for renaming things:
- remove unused soundplayer field from ClipPlaybackTask
- remove hardcoded static strings
- make some fields that do not change final
This makes SoundManager actually find the audio clips, previously it
failed silently. The only code playing audio at the moment is a
notification sound to a lobby host whenever someone joins their lobby,
however further commits will expand on audio functionality.
Works both in single player and multiplayer for other players' strokes.
No functional changes. This is in preparation of playing win/lose sounds
at the end of a multiplayer game.
This is used for displaying a "Winner" or "Draw" string next to player
names at the end of the game.
This contains the exact same files as the assets directory
Also remove the unused MANIFEST.MF file. A jar manifest is automatically
generated by Maven.
@StenAL
StenAL commented Apr 28, 2023 •
Copy link
Copy Markdown
Author

Alright, looks like CI passed (https://github.com/PhilippvK/playforia-minigolf/actions/runs/4834120524/jobs/8614993225?pr=103).

I've squashed the two fixup commits, the crash fix is now in d7cdeb8 and CI fix is in dc8b995

I'm ready for merging now.

@PhilippvK
PhilippvK merged commit 129c55b into PhilippvK:master Apr 28, 2023
@StenAL
StenAL deleted the sound branch June 4, 2023 17:27
@StenAL StenAL mentioned this pull request Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0