Sunday, April 7, 2013

Welcome and say hello to ifvms.js on npm

Welcome to the Parchment blog!

I enjoy reading technological articles about IF, so I thought there must be others who'd be interested in reading about the inner workings of Parchment. In the future I plan to write some explanations of how Parchment works: how the layers of virtual machines within virtual machines somehow manage to run games fast enough even on a simple phone, and how with the promise of future web technologies like asm.js I think it will even run faster than your favourite desktop interpreter! This will also be the place for Parchment news and announcements.

ifvms.js on npm

Inside Parchment are several virtual machines, but the one that is most commonly used is one I wrote myself, called ifvms.js. For now it is used only for Z-Machine stories, but eventually I will write a Glulx VM too. ifvms.js is written in JavaScript, but before now to build it you had to use Python. I decided it would be a little more straightforward to use JavaScript to build/compile it, and so I've switched to node.js and the excellent Grunt Task Runner. In addition to building it, Grunt uses JSHint to ensure my code is of a high quality, and it also runs the Praxix Z-Machine unit test. So hopefully the embarrassing moments when I fix a bug only to introduce a new one will be much less common, as these two tests will catch the problems before I push the code to iplayif.com! I will be adjusting Parchment itself to use Grunt in the near future, so that the one set of tools will be used everywhere.

It took a few small changes to get it to run in node.js, but once it had, I thought I might as well add it as a npm package. So I did! With one easy command you can now install a Z-Machine interpreter anywhere you can install node.js. I would love to one day discover that someone used it to create a chatbot, or maybe as part of a unique easter egg in some other JS project. Or maybe you have other ideas; whatever you have in mind, getting it is as easy as "npm install ifvms"!

No comments:

Post a Comment