Node Channel Tester for FyreVM Stories

In my “chester” (channel tester) post, I talked about a CLI tool to run fyrevm stories using node. This is a part of the glulx-typescript GitHub repository called EngineWrapper. You’ll need the extensions from the fyrevm-web GitHub repository to enable usage of this tool.

This all assumes you’re familiar with Git/Github.

Clone the entire repository as you need the VM and a few other files in-place. We don’t have it setup for packaging as a dependency, but that’s on the to-do list. You’ll need to run this from the example\node\engineWrapper directory unless you change the dependencies. I’ve made a pull request for a compiled version of “chester” to be in the tools directory. Until then, you’ll have to follow these instructions:

You’ll need Node and npm installed. Then install typescript: npm install -g typescript

Change to the directory to where the _engineWrapper.ts file is located and compile it: tsc

This will produce engineWrapper.js, which we can use to run story commands.

node engineWrapper.js {story file name.ulx} {session name} ["command"] [turn number]

…which translates to:

node engineWrapper.js ifpress.ulx ifpress

This will start the story and leave a session file named ifpress.1. To continue, just add a command:

node engineWrapper.js ifpress.ulx ifpress "north"

…which will produce a session file named ifpress.2 and so on. You can also “branch” your testing by specifying a turn:

node engineWrapper.js ifpress.ulx ifpress "south" 1

…which will produce a session file named ifpress.1.1. Then to continue that branch, you’d use:

node engineWrapper.js ifpress.ulx ifpress.1 "south"

…which will produce a session file named ifpress.1.2. Subsequent turns will be .1.3, .1.4, etc.

Every command will emit the FyreVM channel data as a JSON array:

EXAMPLE:

{ "MAIN":"\nStop the IFPress!\nAn IF Press Demonstration by David Cornelson\nRelease 1 / Serial number 160421 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD\n\nAmidst the cavernous warehouse are large printing presses, large rolls of paper, and barrels of ink. Men and women scurry about, putting tomorrow's edition of the IF Press Gazette together. The loading dock is to the north while the offices are to the south.\n\n", "PLOG":"During the Great Underground Industrial Revolution, immediately following the disappearance of magic, the IF Press Gazette was created to make up for the lost tradition of the New Zork Times. Even without magic, some things seemed to get done in magical ways...\n", "PRPT":">", "LOCN":"Press Room", "SCOR":"0", "TIME":"540", "TURN":"1" }

From here you can create batch files to run regression tests, and record timings for turns to evaluate performance. You could of course pipe the output to one or more files, but that’s up to you.

There is a web version of engineWrapper, but I have yet to implement the vision for that yet. The plan is for it to automatically add the turn data to the DOM for usage in app frameworks. I also plan to add an extension that will translate the 4-byte channel names to something prettier, like MAIN->”mainContent”, LOCN->locationName, PLOG->prologue, etc. So after executing a turn, you’d be able to use document.fyrevm.mainContent in your HTML. Each channel will have a “default” pretty-name, but if you add your own channels, you’ll need to specify how those are added to the DOM. More on this later.