Love of Magic WebGL version



The very first version of Love of Magic had a WebGL version, but I ended up not keeping it updated, ultimately taking it down as it went out of synch with the main game.

With book 1 finally done, I figured it was time to fix that, forking the finished code and preparing it for WebGL. There's obviously a bunch of things that had to change; the full game is 3.2GB; that's... probably not ideal for a WebGL game. WebGL's support for videos are also not ideal, and from Act III onwards there's a lot of little video snippets. To get around that I chopped the content at Act II, which (with some other optimizations) let me cut the file-size down to 450MB. Still a big tubby, but better.

Savegames are unfortunately not compatible between regular/WebGL; normal games allow you to save to the usual file system, but for security reasons WebGL does not. You end up saving to an in-browser location called PlayerPrefs, which is pretty limiting. To get around that I had to cut the screenshot aspect of the savegames; I didn't have space to store them.


Video playback on Unity WebGL is... quite different. Normally I stream them to a texture, then render that texture. That unfortunately doesn't work for WebGL, I can stream a video, but it needs to blit straight to screen. It works for most of the places, except the basement (which used an animating background). Audio's also pretty nerfed, but I'm not doing anything particularly advanced there... the only annoyance is the both video and audio come online 'when it's ready', so it's possible to click your way through the game before the music catches up.

I ended up spending a lot of time working on the compression and optimizing memory-usage; I suspect I've got some possible optimizations on that. Right now I'm using 1GB of RAM; I'll need to spend some time profiling to see if that's all critical (or enough). 

Anyway, hopefully this is a possibility for new players to experience the game. The full game is available here on itch.io as well. 

Files

love_of_magic_webgl_14.zip 380 MB
Jan 24, 2021

Get Love of Magic WebGL

Leave a comment

Log in with itch.io to leave a comment.