dinosaur-exploder icon indicating copy to clipboard operation
dinosaur-exploder copied to clipboard

feat(web): enable browser-based gameplay via JPro and Render deployment (#127)

Open fmicelii opened this issue 6 months ago โ€ข 10 comments

โœ… PR Checklist

  • [x] My PR title follows the format: type(scope): description (#issue) (scope and #issue optional)
  • [ ] I used the correct type: feat, fix, refactor, docs, test, chore
  • [x] I reviewed my code and removed unnecessary debug logs or comments.
  • [x] I tested my changes and verified they work as expected.
  • [x] I ran the project to confirm it compiles and runs correctly.
  • [x] I read the Code of Conduct and the Contribution Guidelines.

๐Ÿ“ What does this PR do?

  • Added a Dockerfile (multi-stage build) to compile and run the game via JPro on Render, making it playable in the browser
  • Added run-game.bat convenience script to launch the game locally in desktop or browser mode
  • Added ImageCache utility class to avoid reloading PNG images on every menu/game session, preventing OutOfMemoryError on low-memory environments
  • Updated MenuHelper, LifeComponent, ScoreComponent, BombComponent and CollectedCoinsComponent to use ImageCache
  • Compressed heavy PNG textures with pngquant (60โ€“80% quality), reducing total texture size by ~65% on average
  • Fixed double FXGL initialization (IllegalArgumentException: Action already exists: Screenshot) by making DinosaurWebApp.fxglRoot static
  • Fixed JPro port binding by injecting -Dhttp.host=0.0.0.0 into vmoptions at runtime so Render detects the open port

๐Ÿ”— Related Issue

  • [x] This PR fixes/closes: #127

๐Ÿ“ธ Screenshots / Demos

๐ŸŒ Live demo: https://dinosaur-exploder-d70e.onrender.com/ (if it doesn't work, its because of the free plan used on Render...) (Im leaving some screenshots to proove the functioning)

Captura de pantalla 2026-05-06 231245 Captura de pantalla 2026-05-06 231519

โš ๏ธ Performance note: The game is functional but runs slowly on Render's free tier due to limited CPU and RAM (512 MB). This is purely an infrastructure constraint โ€” upgrading to a paid plan would resolve it entirely. If this hosting solution is not considered satisfactory long-term, alternative platforms (fly.io, Railway, self-hosted VPS) could be evaluated in a future iteration. This PR represents a solid first working version.

โœ… All changes are fully backward compatible โ€” mvn javafx:run works exactly as before.

๐Ÿ’ฌ Extra Notes

[!NOTE] ๐ŸŽ“ This contribution was made as part of a school assignment focused on open-source collaboration. I'm a student learning real-world development workflows โ€” this was a great challenge and I really enjoyed working on it! I'd appreciate any feedback the maintainers have. Thanks for building such a welcoming project! ๐Ÿฆ–

fmicelii avatar May 07 '26 02:05 fmicelii

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
dinosaur-exploder Ignored Ignored Preview May 7, 2026 2:41am

vercel[bot] avatar May 07 '26 02:05 vercel[bot]

โœ… Code Formatting Check Passed!

badge

Great job! ๐ŸŽ‰ Your code follows the Google Java Style Guide.


๐Ÿค– The DinoBot Team ๐Ÿฆ–

github-actions[bot] avatar May 07 '26 02:05 github-actions[bot]

Build preview ๐Ÿš€

badge

Thanks for your contribution to this open-source project! โค๏ธ

A new build has been generated for this pull request:

  • ๐ŸŽฎ Game Artifacts: ๐Ÿง Linux / ๐ŸŽ macOS / ๐ŸชŸ Windows
  • ๐Ÿงช Workflow Run: View Logs
  • ๐Ÿ”– Commit: c5e618418aeb69d2ccd6a9e707f64d845550deb2

[!TIP] This JAR lets you test the latest version of the game from this PR.

โณ Note: Artifacts auto-expire after ~90 days.

Happy testing & enjoy the game! ๐ŸŽฎ

The DinoBot Team ๐Ÿฆ–

github-actions[bot] avatar May 07 '26 02:05 github-actions[bot]

Performance note: The game is functional but runs slowly on Render's free tier due to limited CPU and RAM (512 MB). This is purely an infrastructure constraint โ€” upgrading to a paid plan would resolve it entirely. If this hosting solution is not considered satisfactory long-term, alternative platforms (fly.io, Railway, self-hosted VPS) could be evaluated in a future iteration. This PR represents a solid first working version.

Ah yes as you said, it could solve the issue yes, I could give it a try indeed !

jvondermarck avatar May 07 '26 15:05 jvondermarck

๐ŸŽ“ This contribution was made as part of a school assignment focused on open-source collaboration. I'm a student learning real-world development workflows โ€” this was a great challenge and I really enjoyed working on it! I'd appreciate any feedback the maintainers have. Thanks for building such a welcoming project! ๐Ÿฆ–

Thanks so much for this feedback, I really appreciate it!!

jvondermarck avatar May 07 '26 15:05 jvondermarck

thanks for your reply!!

I know the version I made is really basic ๐Ÿ˜…, but I wanted to share this solution with you because I thought it was a good starting point.

Regarding the error, I think it popped up because I was recently working on the mobile deployment: image

Also, I apologize if it sounded like I was suggesting a paid Render plan! That wasn't my intention at all; I just wanted to share it as a hosting option.

If you liked this first try, I can look for a better web hosting option for the game (with music and no crashes ๐Ÿ˜‚). Just let me know

fmicelii avatar May 07 '26 15:05 fmicelii

Hey @fmicelii

Yes maybe let's have a look for a good hosting with music working ๐Ÿ˜Ž

And how did you do on mobile to make it work ? Can you give me the steps please ? So I can have a look, thanks a lot

jvondermarck avatar May 10 '26 10:05 jvondermarck

Hey!

Thanks for the support! its new for me this whole world of contributing you know ๐Ÿ˜…

Im going to search which kind of hosting service can let us play the music. I will report my progress to you.

Talking about the mobile hosting, it wasn't complicated at all. I just had to host the game on Render and it worked on mobile. I do not remember doing any change for the mobile version...

Again, thanks a lot for the support and answering my comments this days! I didn't receive a response in many open source projects...

fmicelii avatar May 11 '26 01:05 fmicelii

Im going to search which kind of hosting service can let us play the music. I will report my progress to you.

Okay awesome, thanks a lot!!

Talking about the mobile hosting, it wasn't complicated at all. I just had to host the game on Render and it worked on mobile. I do not remember doing any change for the mobile version...

AHHHH yes okay you just went on the google web page okay, makes sense. I asked because there is also a way to run the app like an Android application, that's why :)

Again, thanks a lot for the support and answering my comments this days! I didn't receive a response in many open source projects...

Thanks a lot, it's a real pleasure!!

jvondermarck avatar May 17 '26 19:05 jvondermarck

Hello @jvondermarck , Im so sorry for the late inactivity Ive been having on the issue!!! The school is killing me and I dont have much free time to do the things I like. I wanted to tell you the reason why I didn't do anything in the last month

fmicelii avatar Jun 02 '26 11:06 fmicelii

Hey @fmicelii,

Ahahah yes don't worry; I know the struggle, I've been through it as well. Which year are you? Anyway, don't worry at all, no stress and focus on your exams and classes and then we will keep in touch :)

Many good luck mate!

jvondermarck avatar Jun 10 '26 17:06 jvondermarck

helloo @jvondermarck im in my last year of highschool. Im in a technical one sooo its very demanding for me. Its a lot of time that I have to dedicate to it if I want good grades. Thaks for the comprehension!!!

fmicelii avatar Jun 12 '26 16:06 fmicelii

Hey, yes I can understand that it can be very demanding, many good luck again @fmicelii

jvondermarck avatar Jul 12 '26 10:07 jvondermarck