Handling multi-version build for WebGL

Hey ! For all those who want to publish a post-jam version of their WebGL game and allow both versions to be playable in the same itch.io page, I have found a solution that works pretty well. It only asks basic knowledge of html/css/javascript. People who try to launch the web version of our game Super Mowser Bros will see that appear : firefoxem2022-04-19/em21-32-45.png

The first key to do this is to understand what WebGL builds are made of : Sans titre.png

The only files that are regenerated for each build are the ones in the Build folder. And more specifically, the ones with the .gz extension. They are fetched by the index.html, which contain html code and js that initializes the webgl build. This is all done here : Codeem2022-04-19/em22-13-47.png As you can see, the .gz files are fetched using their path, which means that you can basically put the Build content of multiple builds in different folders and launch the right version when you need it.

So here is what I did : I put the createUnityInstance in a function so that it does not launch right away, and added a path argument to be able to select the build to launch : Codeem2022-04-19/em23-02-44.png

Then, I added two buttons in the html code, that call this function when they are clicked : Codeem2022-04-19/em23-06-00.png

and now the build has this structure : explorerem2022-04-19/em23-07-04.png

I kept the Build folder just to keep the loader.js file at the same place, as it the same across builds and the javascript code needs it at this place. You can change its place if you want by changing the path in the tag that imports it.

Of course, this isn't really automated at the moment, but I might improve it in the future, and provide a github project with the full code and other stuff like custom splash screen videos and better itch.io fullscreen handling.

I hope it was useful, tell me if anything is not clear ! And if you have the time, please check out our game, Super Mowser Bros, we need feedback on the post jam version !

4a63f.png

https://ldjam.com/events/ludum-dare/50/super-mowser-bros