Heya!
I wanted to check the web loading times and sizes for Godot compared to Unity. I have a long running test scene for Unity that compares different versions with different settings (link) and started replicating this for Godot (link).
First I want to get a nice basis before I start comparing different Godot versions. The two things I noticed now are:
- File sizes are a lot bigger compared to Unity (where I can get away with 2.5MB for the whole project)
- The loading time to start the engine in the browser takes quite long
File size
With Unity you have the option to select a compression for the files (gzip or brotli). I really like this setting, since I don't have to do anything afterwards to compress them and the server also does not have to compress them on the fly every time it serves the file (especially for brotli with high compression this would be quite some overhead).
I found the documentation for custom html templates and there is the option to hand over the filePath for the wasm to the init method. I would like to do something along the lines of
const myWasm = 'mygame.wasm.gz';
const myPck = 'mygame.pck.gz';
const engine = new Engine();
Promise.all([
// Load and init the engine
engine.init(myWasm),
// And the pck concurrently
engine.preloadFile(myPck),
]).then(() => {
// Now start the engine.
return engine.start({ args: ['--main-pack', myPck] });
}).then(() => {
console.log('Engine has started!');
});
But sadly this throws away my .gz
ending. I saw some others adding pako to unpack data, but I feel like this should be easier to achieve.Do you have any tips on how I can get a compressed version without adding an extra unpacker?
Loading times
Do you have any tips on how I can improve those, or is this in general an issue for Godot web projects?