dice

Once upon a time, I ported a turn-based strategy / tactical combat game to the web. The average play time for the game is quite long (many hours), so saving games is an important feature.

PC/Console games have two ways to do "game saves":

  1. Save on the machine, keyed to the user thanks to the operating system's file system and
  2. Save on the cloud, keyed to the user by some identity provider.

1) is easy to implement (writing and reading a file to disk). 2) is much harder to implement, costs money to run, and requires the gaming machine to have network connectivity.

Web games can do 2) just as easily as PC games. Since this is a hobby project with near-zero players, I don't plan to build my own Cloud service, and I don't trust any Cloud-hosted "gaming" API to be stable enough or not get killed in the future. So that leaves me with saving and loading games locally.

Unfortunately, browsers have a major road block: they do not allow native file system access. Back a decade ago when I started to write the game, it looked to me like browsers would eventually implement this: progress on browser compatibility and "native app" capabilities were pretty breathtaking at that time.

So I put up with some jankiness: To load a savegame, pick a file from your computer. To save a game, the web app downloads the savegame file to your computer. That kind of sucks and doesn't allow a save-as-you-play experience, but good enough for now. I threw in more jank with the option to use Google Drive API as well for a cheap-o version of a Cloud service. (Why not Play Games API? Because they eventually killed their Web API. See "stable forever" above.)

All this jank was an acceptable workaround until browsers caught up, or so I thought.

dice

Here we are a decade later. Though Chrome desktop has proposed and implemented the File System Access API for native file access, it's not quite enough when compared to what native apps can do - and other browser vendors have adamantly refused to implement true native file access, making this capability a sad bloated corpse floating in a lake. I'm saying native file access is dead in the water.

Why didn't I just use localStorage or IndexedDb for this? Well, for one, it was stubbornness and naïvety. For two, I worried about how much data I could store reliably. For three, I thought that users would expect their saved games in Chrome to be playable in Firefox or Safari on the same machine or want ways of passing their saved games around.

The fact my savegames are something like 35k means that storage was never really a concern.

The fact that most users only ever use a single browser, means I don't need to really worry that much about portability.

It's actually pretty straightforward to implement a virtual file system in IndexedDb that works good enough. Heck, Apple did it as some weird peace offering to people who wanted File System Access. [As an aside: as far as I can tell, an origin-private file system offers zero user-facing benefits over IndexedDb, you're just trading one API for another... so it's a devex offering. True native file access offers user benefits, such as backing up your save games, hacking, modding, sharing outside of the browser]

So in the end, I just wrote my own storage service that loads/saves games to an IndexedDB store in the browser. These days, superior user experience trumps web specification idealism for me every time.

apple

P.S. I'm no security expert. I'm sure Mozilla and Apple have good reasons for rejecting the File System Access API. I'm just sitting here loving the technology of the web (zero install, the APIs, JavaScript/Typescript) and the developer experience but wishing I had all the perks that native apps do.

P.P.S. I was surprised to learn that an IndexedDB instance for a page at foo.net is different than the IndexedDB instance of an iframe of foo.net hosted at bar.net. That's a subtlety I hadn't thought through.

§1394 · April 19, 2024 · Apple, Entertainment, Firefox, Games, Google, Software, Technology, Web · (No comments) ·


dice

I am a big BIG fan of Bethesda's Elder Scrolls and I consider Morrowind one of the best games ever made (my top 2 are Morrowind and Doom in no particular order). I have put in only a few hours into Starfield (so far), and I have to say I like it less and less. Primarily my complaints lie with all the loading scenes that break the illusion of an immersive, seamless galaxy to explore. It feels like Skyrim with even more disconnected regions.

In Morrowind you could walk from the wilderness into a city with no observable loading, the only loading screens were upon fast-travel (which was not necessary) or going indoors. As you leveled up, you could learn levitate spells that let you fly over seemingly insurmountable mountain ranges or water breathing spells that let you explore underwater. You could learn water walking and even walk across the ocean from the mainland to the new island included in the Bloodmoon expansion, if you were patient enough and didn't want to fast-travel via ship.

Oblivion did away with some of the crazier things (like Levitation and Water Walking), and added loading screens as you move into cities and this trend sadly continued into Skyrim. And yet, I still loved those games and devoured them, spending hours. Something about the ability to look at the horizon and say "I'm going to walk to there" was very captivating.

In Starfield, you get loading screen after loading screen, moving from location to location, outdoor to indoor, in and out of spaceships, launching from the surface, grav-jumping, etc. I know this criticism is not incredibly insightful or novel; many folks have already complained loudly about this online and contrasted it against the illusion of seamlessness in No Man's Sky. I know I'm just adding to the din, but I can't help myself, my disappointment is as vast as the regions in Starfield are not.

There are no enormous planets floating in endless space. You're just an ant hopping from leaf to pretty leaf trying to cross a river. I expected so much more.

I will give it a few more hours, but sadly it's been a dud for me so far. Anybody have a recommendation for a modern open world game that knows how to maintain the illusion?

§1376 · January 18, 2024 · Entertainment, Games, Microsoft · 1 comment ·


Ok, so I've got a little game I've been coding in my spare time. It uses SDL and Boost so that it's pretty cross-platform compatible. In fact, I've built, ran and tested the game in OpenSuse Linux. However, I'm not clear on an easy way of packaging the game up in a download for Linux users. The game has run-time dependencies on expat as well as many SDL libraries (specifically SDL_ttf, SDL_image, SDL_mixer, SDL_gfx, and of course, SDL itself). I'd like something simple, akin to what I do with Windows (which is a batch file that bundles up every file needed, including DLLs, into one ZIP file for download). Can anyone out there help me?

§388 · July 19, 2007 · Entertainment, Games, Linux, Questions, SDL, Software, Technology · 8 comments ·


Orinoco has put up a couple more SVG games that you can play inside your browser (either Firefox 1.5+ or Opera 9+). Read the rest of this entry ...

§342 · March 9, 2007 · Entertainment, Games, QuickLinks, Software, SVG, Technology, Web · Comments Off on And Still More SVG Games ·


I don't like to be reminded that I'm missing GDC this year, but Rob sent me this little video reminder. The video is of a soon-to-be-released game for the PS3 called "Little Big Planet" which allows up to 4 players to construct their own fully physical world, or download other levels from other players and play it as a game. Go watch it!

§340 · March 8, 2007 · Entertainment, Games, GDC, Life, QuickLinks, Technology · Comments Off on Little Big Planet ·