melonjs / melonJS

a fresh, modern & lightweight HTML5 game engine
https://melonjs.org
MIT License
5.92k stars 643 forks source link

[Feature request] Custom integration for SSR/hot reloading/etc, likely for Astro #1134

Open L1lith opened 2 years ago

L1lith commented 2 years ago

It would be really cool to have custom Astro integration.

Is your feature request related to a problem? Please describe. Yes, currently melonJS has no SSR support. If we added custom SSR support we could pre-render the game to a static image and send that to the client so they can see the level before the JS has finished loading. Also we could do things like convert the TMX file to JSON automatically during build time or development so the dev could have hot reloading (though I'm not sure where this is at with regards to Astro's API). These features would pair really nicely with JSX support like melon-solid (though that lib kinda needs some work atm). We could also do automatic texture packing (so users could just import normal images and everything just works).

Describe the solution you'd like Some kind of plugin for the Astro Integration API most likely though it could be something else

Describe alternatives you've considered We could also integrate into Next.js or Gatsby, they're likely more popular (though I'm biased towards Astro a little probably but it does have some nifty features)

L1lith commented 2 years ago

It would also be super dope to inject preload links to load the assets (like images etc) before the JS even loads. That way by the time the game needs these assets they will either be already finished downloading or at least have a decent head start.