Update from our project / Post mortem

Update from our project / Post mortem

Hey, I’m just posting this to give feedback about our experience with WebGL with our project. A lot of people seem to be insecure with WebGL, so maybe this post will help. We are a working on a port of a multiplayer 2D game, the game is already published and have players around the world. The main goal was to focus to port the current engine to Unity. We focused standalone/mobile for the development, WebGL was secondary. But we were trying to always have a semi-working WebGL version.

At the moment, our Android build is ~50mo and WebGL is 85mo Release and 25mo Compressed.
(without the asset bundles)

What went well:
-Almost no WebGL specific code, the only specific part in the project is the class that handle websocket request. We use the jslib on the asset store for that.
-I have almost 0 experience in web development and 0 interest, but I was to able to build and deploy easily.
-IL2CPP, it’s suprising how it work well. Our codebase have a lot of code with Linq and (unfortunately) some really complex part. And I think we needed to modify only 2-3 things to make it work. And the problem were related to AOT error. So it’s was not WebGL specific.
-No optimisation to do. Since it’s a 2D game and we had mobile in mind, it’s not surprising but I tought we whould have some optimisations to do.
-A lot of update/fixes from Unity team since January 2015 (the moment we started using WebGL)

What went not so well:
-Build time/Debugging: The iteration time is really slow. And some time only you can only debug with Debug.Log.
-Build is not consistent on different browser. Currently our build only work with Firefox. Since a lot of development is still done on WebGL for the browser, it’s probably the point that add the most insecurity to our project.

1 Like

Thanks for sharing your experience!

What kind of problem are you experiencing with Chrome? Is it a memory issue ?

I didn’t really investigate the problem. I get a websocket “Abnormal disconnection” error.

This seems odd. Are you looking at the compressed size of the WebGL build? Where does the size go (to which files)?

Oh, I never taken the time to check what was in the folder, I’ve just always upload all the output folder on the server.

Release: 85mo
Compressed: 25mo

So, if your web server is configured correctly, you only need the Compressed folder, which then brings your size down from 110 megs to a more acceptable 25.

Yes very acceptable. Thanks!

I completely forgot the part about the compressed folder when I read the documentation.

For those who want more info:

See Distribution size

Here’s an update on the tested browsers. I am really surprised with the mac test.

Tested on Win7:
-Firefox: Work
-Chrome: Load but have some Websocket abnormal disconnection error.
-IE: Doesn’t work

Tested on Mac OS X 10.10.4 (old 2010 MacBook 2.4gh intel core 2 duo, ram 2gb)
-Firefox: Work
-Chrome: Load but have some Websocket abnormal disconnection error.
-Safari: Work but really long to load

Tested on Windows10:
-Edge: Work

As for the WebSocket issues in Chrome:

I heard of other people having similar issues (apparently a recent regression in Chrome), and being able to fix it by changing this in the web socket wrapper:

Maybe try if that fixes it for you as well?

No it doesn’t fix our problem, still the same error message