-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
I wanted to improve the loading process of an HTML5 game with libGDX.… #4265
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
Conversation
… As currently the process is. 1. Load index.html 2. Synchronously load the javascript files 3. Preload assets, get them cached in the browser (This is currently, where a player would see the libGDX logo and a progress bar). 4. (optional) Loading assets into memory with a custom loading screen via an AssetManager In smaller games this is can be acceptable loads times. However as a game grows I have generally found that whilst the code size (The JS files are around 1-3MB) the art (Artists demanding HD level quality) the process of getting a player into the game becomes longer and drawn out and offputting. I have also been involved in projects where a HTML5 gaming platform would require a single loading experience for all binary and asset loading, providing their own loading screen etc. I have a working example of a game where the JS is split and a boot strap occurs first then the main game JS is loaded separately. Then any assets are then loaded on demand, e.g. the AssetManager wishes to load a texture, this request is intercepted and the browser instructed to download the asset, then the loading into memory can occur. Before I unleash this all on the world I wanted to see if I could clean up a couple of things in the GWT backend to make what I did simplier and cleaner looking. So this commit is more about setting the stage ready for the next phase of the loading. When going through the code, I discovered that the canvasId that can be specified in the configuration is never used. Thus never letting you create and specify your own canvas, this commit fixes that. 1. I moved the preloading code into separate classes and I created an interface to allow other people to create their own preloaders and reuse the existing download code. 2. I have removed the config.root property as it was no longer needed, the code now only checks for the presence of the canvasId field. 3. If the canvasId does exist, the default preloader will still create the progress bar and libGDX logo except upon completion it no longers creates the canvas This is backwards compatible and I have tested it the project created via the project setup tool. I hope this makes sense to people, if I have done something I shouldn't have please let me know and I will fix it.
…into barkholt-gwtaudio_webaudio # Conflicts: # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java
Haven't looked at the code, but I 100% support the idea of refactoring/modernizing the preloading process on GWT. I understand the need for preloading in order to support the synchronous file API, but if we are only loading asynchronously, we should not have to force the users to wait for the preload (and potentially exhaust browser memory in process). |
I have the same issue, can any one solve this problem? |
# Conflicts: # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/Pixmap.java
# Conflicts: # gdx/src/com/badlogic/gdx/graphics/g2d/BitmapFont.java
# Conflicts: # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/resources/soundmanager2-jsmin.js # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/resources/soundmanager2-nodebug-jsmin.js # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/resources/soundmanager2.swf # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/resources/soundmanager2_debug.swf # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/resources/soundmanager2_flash9.swf # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/resources/soundmanager2_flash9_debug.swf # gdx/src/com/badlogic/gdx/graphics/g2d/BitmapFont.java
# Conflicts: # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java # gradle/dependencies.gradle
It will now allow for Gradle to be upgraded, as Jetty was deprecated and removed
…tion on resume, so the sound added on resume was being removed, not the original one.
I've been waiting for this for a while -- any idea when this will be merged? |
I feel this might be pretty out of date now as I made more changes etc. I think what might happen is this could become an extension. |
# Conflicts: # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplication.java # backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/GwtApplicationConfiguration.java # extensions/gdx-setup/src/com/badlogic/gdx/setup/DependencyBank.java # extensions/gdx-setup/src/com/badlogic/gdx/setup/resources/gradle/wrapper/gradle-wrapper.properties # extensions/gdx-setup/src/com/badlogic/gdx/setup/resources/html/build.gradle # gradle/dependencies.gradle # pom.xml
I can't run At first, I get this error:
After I implemented the methods from GwtApplication, I run into this error:
Please fix this so we can run the tests. Is it needed to improve the loading process to change from SoundManager2 to your WebAudioAPIManager implementation? If not, maybe splitting the PR increases the chance to get this merged. Why did you change the log behavior? If it's not necessary for this PR, you should open a new one with this change. Why did you deleted the jar's for gwt? The jar's are necessary because we build libGDX with a mix of Maven, Gradle and even Ant. Some formatting tips to increase the merge chance:
|
It's open source, feel free to do this yourself. |
I took your base idea and it is added now to the GWT backend with #5677 |
… As currently the process is.
In smaller games this is can be acceptable loads times. However as a game grows I have generally found that whilst the code size (The JS files are around 1-3MB) the art (Artists demanding HD level quality) the process of getting a player into the game becomes longer and drawn out and offputting. I have also been involved in projects where a HTML5 gaming platform would require a single loading experience for all binary and asset loading, providing their own loading screen etc.
I have a working example of a game where the JS is split and a boot strap occurs first then the main game JS is loaded separately. Then any assets are then loaded on demand, e.g. the AssetManager wishes to load a texture, this request is intercepted and the browser instructed to download the asset, then the loading into memory can occur.
Before I unleash this all on the world I wanted to see if I could clean up a couple of things in the GWT backend to make what I did simplier and cleaner looking. So this commit is more about setting the stage ready for the next phase of the loading.
When going through the code, I discovered that the canvasId that can be specified in the configuration is never used. Thus never letting you create and specify your own canvas, this commit fixes that.
This is backwards compatible and I have tested it the project created via the project setup tool.
I hope this makes sense to people, if I have done something I shouldn't have please let me know and I will fix it.