Perhaps it'll turn out to be a daft set of decisions but I'm going to risk being smug in advance. Hold my text editor, lads.

I'm working on a game. As with most things of this nature it started off as something small and got wildly out of control. It's written in Sugarcube and TWINE - that is to say it's a text-based adventure played in a browser and distributed either as just an HTML file or as an archive with resources.

Personally I'm not a fan of having to package up a load of resources. Not a fan. Also when I started work on it (and perhaps still now) images that were outside the dev environment wouldn't be displayed in the preview functionality.

I opted instead to embed the files as Base64 strings. Basically taking the file data and turning it into text that a browser is happy to decode. I use this method to embed images, sounds, and text.

Of course the immediate reaction from various people I asked when implementing this was "That's probably a bad idea" and comments about bloating a browser and the like. Doing this willy-nilly would absolutely risk that but this is me we're talking about. At this stage I'm old compared to lots of the young folks creating games. I grew up in the age of dial-up, tiny hard disks, and similar limitations. If there's one thing I know it's about compressing files!

The images I'm using are mostly run through Geometrize before being resized and squashed into tiny JPGs. They're also used sparingly. I think there's two images of that kind in the game so far.

The others are PNG-8 files with very limited colour counts to keep their file sizes as low as possible without becoming hideous.

Similarly there's sound in my game. I considered using Opus for audio but Safari doesn't currently support it natively. Everyone else has got their shit together (even Microsoft's Edge browser supports it, for gods' sakes) but that's a fairly big chunk of users and the saving isn't that great. I mean, percentage wise it's excellent - about a 30% reduction in filesize - but that's not really worth the trade off when that's 3592 bytes vs. 5184 bytes. That's the largest sound file in the game.

The largest image is much larger but that's because it's a struggle to compress images with transparency in this day and age because it would seem different vendors can't agree so we're still stuck using JPEG and PNG. As a result in order to actually be supported I've got an image that weighs in at 123 KB.

Fonts are where things get properly heavy

  • 21 KB - Trash Hand Regular
  • 63 KB - Patrick Hand SC
  • 27 KB - Black Biro
  • 21 KB - Rokkitt
132 KB. Ouch. Still - worth it.

So how big is the game? Currently it's 1404 KB. It'd fit on a floppy disk. Here's the breakdown:

  • 9 KB of sound
  • 132 KB of fonts
  • 163 KB of images
  • 1099 KB of text
I think it'll be fine this way.

0 responses to "I guess I'll go make a start on that ironing."

Leave a Reply