Hey folks! I just barely got this working, but wanted to share it anyway.
I just managed to compile the whole inform7 compiler, including inform6 and inblorb, so that I can convert an inform7 source file into a working gblorb game, and play it, fully in the browser with no installation or server-side processing!
It required a very straight-forward patch to change the return types of indirect function calls to return int instead of void because WASM is stricter about the function call types.
There was a small shim added for some system functions that aren’t actually called I think, but otherwise there wasn’t really much actual porting to do.
I did this over the last couple days with a lot of AI help, but I think it’s pretty close to a very useful state.
I’m thinking I might experiment with a custom web-based IDE for inform. I’m hoping it might be able to make Inform a little easier for people to experiment with and get into. Not having to install anything could be pretty sweet. And I think being able to share web examples that can be tested and modified, and shared with just a link, would be pretty cool!
Web-compiling Inform is indeed cool, congrats on getting it working! FYI there already is a site that offers an online version of the Inform compiler (and several other languages), called Borogrove:
So might be worth taking a look and seeing if there’s anything they do in terms of the IDE setup or other features you’d want to do differently (or even if you want to do things the same way, since of course we’re all doing this for fun )
Yeah, thanks for the link! I found that earlier and thought it was pretty cool.
My work right now is making a somewhat Discord-like group chat application that also has features for long-term community resources like wiki pages, events, etc. and I was thinking it would be really neat if I could put inform right inside it so that people could collaboratively work on stories like a wiki maybe.
We’ve got so much other stuff to do that’d be a ways out, but it’s pretty fun to think about the possibility.
Now it’s quite easy for any JS project to include the inform7 compiler.
I don’t have it setup, but it’d also be really easy to let you install the inform CLI tools on any platform ( i.e. Windows, Mac, Linux ), just by running npm install -g inform7. A fun thing about WASM is that you can compile it once and run it on multiple different platforms.
I’m thinking I’ll make a VSCode extension to turn VSCode into an Inform IDE. Might go for a completely custom IDE later, but a VSCode extension is probably a really great start.
I’m having some trouble with the inform IDE for Linux crashing a lot if I have to open two projects at a time unfortunately. And the story interpreter is annoying sometimes and won’t scroll to the bottom of the output when I run commands.
So I don’t know how much you looked, but I’ve already written an Inform extension for VS Code that does basically that (compiling, underlining errors on compile, playing games directly in VS Code) using the compiler binary directly. You don’t need to have it compiled to Wasm. (Even if it’s cool.)
There’s still a lot missing to this extension, though, and I don’t really have the time right now. And while I haven’t added a no-AI policy to the repo yet, I don’t accept any contribution that involved AI at any step, just so you know. So feel free to create your own extension if mine doesn’t fit your needs, I guess.
Oh sweet! I honestly didn’t look, partially 'cause I only thought about how great VSCode would be for an IDE after I already had WASM working.
Hehe, yeah, I know I was thinking about that. I still might need WASM for embedding in my web app later, but not really necessary if all I wanted was a nice VSCode integration.
It does have actually helpful side-effect of the user not needing to install anything outside the extension, regardless of what platform they’re using.
I think the biggest thing I’d miss is the documentation and index which I reference constantly and think could integrate really nicely with VSCode.
Since this is really a side-project for me I really wouldn’t be doing any of it if I didn’t use AI, but I’m having a little fun making my own thing so far anyway so I think I’ll just keep playing around with it.
But it also means that either you have to update the extension when a new version of Inform is released, or have a server somewhere where the extension can download new versions (and you have to upload that new version to that server).
I guess the performance are not that good since the Inform compiler is already slow by default.
Anyway, it is cool to have Inform in Wasm, and I can definitely see places where it can be useful.
Yeah, it looks ~75% slower compiling Glass by Emily Short when run in Node.js.
Inform luckily catches compile errors quite quickly, but it does take a little longer than comfortable to get to a runnable game for frequent recompiling and testing.
Ooh, yeah, excellent point. The submodules dir has the exact commits used from inform, intest, and inweb during the build.
Inform7 Version: 10.1.2 'Krypton' (29 August 2022)
Intest Version: 2.1.0 'The Remembering' (21 August 2022)
Inweb Version: 7.2.0 'Escape to Danger' (20 August 2022)
I’ll have to put the info in the README at least. I might want to update the version number to match inform7’s with a suffix for the package / build version. Something ike 10.1.2-wasm.1.