Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Create a "Level Streaming" API or something #1141

Open
L1lith opened this issue Oct 4, 2022 · 1 comment
Open

[Feature request] Create a "Level Streaming" API or something #1141

L1lith opened this issue Oct 4, 2022 · 1 comment
Labels

Comments

@L1lith
Copy link
Contributor

L1lith commented Oct 4, 2022

Is your feature request related to a problem? Please describe.
It would be nice if there was some kind of feature or something to make it easy to stream levels on the fly. It would be cool if a level wanted to change to another one it could supply a URL to melonJS to load the level (the level actually being a JS module) from the specified URL.

Describe the solution you'd like
We're trying to make melonJS support es6 modules better and improve tree shaking atm, and that gives some nice features when used by a browser like you could stream the individual levels of your game. It would be nice if there was a clear and easy way to handle this as a user. Also as a neat bonus you could combine this technique with server side auth so if someone who hasn't met the requirements tries to play it they'll get a 404 error. This level change could also potentially be reflected in the page URL too. It would also be really sweet to be able to signal to melonJS to preload a level before it actually is required (thus making the transitions super smooth, and we can do it at smart times like in game events)

Describe alternatives you've considered
I can't think of any similar solutions atm

@L1lith L1lith added the Feature label Oct 4, 2022
@L1lith
Copy link
Contributor Author

L1lith commented Oct 16, 2022

Check out this StackOverflow post for details on how to change the page's url without navigating. If we fetched the page's content then used the History API to change the URL without reloading then we could have levels presented as actual pages (which can also be cold-loaded like a regular webpage from the server) However we can change the page's level without needing to do a full refresh. This would keep melonJS in memory which would would give us the best of both worlds when it comes to navigation and on the fly level loading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant