You must be 18+ to view this content

Love of Magic WebGL may contain content you must be 18+ to view.

Are you 18 years of age or older?

or Return to itch.io

Love of Magic WebGL Update


WebGL is a... funny beast, Unity wise. It seems semi-supported, unloved and frequently with features broken for months, if not years. 

But when it works it's really cool. 

It would have been better if the game was smaller, of course... at 380MB the first 2 acts is a big chunk, but still only a fraction of the full game's 3.2GB. That's mostly just the nature of the beast; it's a big game, and as a sandbox it's hard to say what parts they'll stumble upon. In the end I left every event I couldn't guarantee wouldn't trigger in Act I/II, but removed the assets that were tied to timeline events afterwards.

This update fixes a bunch of little unity-WebGL idiosyncrasies. I originally saved to Application.persistentDataPath, which is the polite thing to do on most platforms. (c:/users/[username]/AppData/LocalLow/Droid Productions/Love of Magic, on windows). You don't want to save to the local path of the user, since that's potentially somewhere protected like Program Files. Turns out that on WebGL that's a *terrible* idea. Unity uses something called the IndexedDB for saving; it then generates a "persistentDataPath" by hashing your URL. So as long as your URL remains mygame.com/thisgame, you're free to replace the game ZIP files. 

The problem comes when you're hosting the game on another platform, since most of them will generate a unique URL for each *version* of the game. Unity's forgiven for not being aware of that, since it's mostly small platforms like Newgrounds, Facebook, or itch.io itself.

So that was fun. Turns out fixing it for good isn't actually that hard, but required rewriting the savegame system, thus losing existing savegames. I *hate* losing people's existing savegames. But in this case there wasn't really an option to avoid it; the new version would lose it *anyway*.  So at least I rewrote it nicer and cleaner, added an explicit flush, and in general cleaned up things.

I also fixed a bug some people had on Day 20 of the game, which would stop them there.

Finally, I managed to get something working that I'm quite proud of. What's the point of letting people play for 40 days, if they're going to have to restart when/if they buy the game? That seems a terrible idea, sales wise. So I cobbled together a "download save" system from inside the WebGL version, which will export the current state. You can do this at the end of the game automatically, or you can force it from the debug console (Enabled from the settings menu) at any time using the code: TriggerDownload

So... there's that. Sorry about your savegames, but I hope you like the update!

Files

love_of_magic_webgl3.zip Play in browser
Jan 30, 2021

Get Love of Magic WebGL

Comments

Log in with itch.io to leave a comment.

(1 edit)

Love of Magic on WebGL is like sending DVD by e-mail :)

(1 edit)

Well, Netflix had to start somewhere :) But yes, I agree the downloadable version is superior. Music and video streamin can be slow on WebGL. Rendering wise it's actually quite painless, but it's not as if it's a particularly demanding game in that respect.