curiousdannii / ifvms.js Goto Github PK
View Code? Open in Web Editor NEWThe Interactive Fiction Virtual Machines Suite - in Javascript
License: MIT License
The Interactive Fiction Virtual Machines Suite - in Javascript
License: MIT License
Some improvements are needed for text:
Hi,
Thought I'd posted this, but cannot find it now! Apologies if duped.
Will there be a one-file zvm.min.js release for the new V3 update?
Thanks.
I want to use ifvms.js as VM library to create a chatbot. And for that I need some way to pass user input to zvm. Previous versions (probably before adding compatibility with glkote-term) had a bootstrap.js with example how to work with vm programmatically, passing strings to the VM and getting the output.
Now ifvms seems to have tight integration with Glkote-term and I unable to get it working with string input.
So the question is: Are there any options to reduce library functionality to be able to do so?
Currently the output (at least in the zvm) outputs a property 'css' .
But what if you want to do the formatting yourself? maybe for a console application using vt100 codes or graphics output. If we had an abstract formatting option (maybe mimicing the css properties that would be nice). Then everybody can put their own css color scheme etc?
just my 2c
This should be good for performance, and necessary for asm.js
With Glk this should not be so difficult.
This should improve performance both when saving, but also when calling new functions and returning as typed arrays will be used.
I also want to do this before adding autosaves (#8).
Hi @curiousdannii , over the last weekend I've taken a great interest in Interactive Fiction.
I'm building a work situation simulator and would love to use ifvms.js or other javascript framework to 'play' these kind of situation.
From the code, it's hard to understand how to embed/use ifvms.js in your own code. It would be great if you have some examples to load it
I could not tell if the code only works inside a browser environment or you could also use it in a nodejs backend process that emit events that could be visualised through socket.io on the browser.
I've seen you have some tests, but from what I can judge the are running inside the browser?
My idea is to :
Any hints you can provide here are greatly appreciated!
zvm
version 1.1.6, installed with npm on Windows.
Game: https://eblong.com/infocom/gamefiles/hitchhiker-invclues-r31-s871119.z5
Use hint
command 2 times, and get
readline.js:1032
throw err;
^
glk_request_char_event: invalid window
Perhaps similar issue is observed in parchment online http://iplayif.com/?story=https://eblong.com/infocom/gamefiles/hitchhiker-invclues-r31-s871119.z5
After typing hint
twice the game hangs.
@save
really need to be supported to claim 1.1 standard support.Add Quixe style autosaves
At least Uint8Array.slice()
and Uint8Array.indexOf()
don't work in Safari and IE.
It's not strictly required, but it does seem more correct, especially if anyone is trying to use CSS to set the input colour.
Can we write an implementation of the TADS 2 VM?
Originally reported at curiousdannii/parchment#18.
Example file: ruins_polish_letters.z5
Command to run: "weΕΊ grzyb"
Shouldn't take too much now that version 3 is supported as it's just a mix of the two.
fyi -
throw new Error('Unknown encoding');
^
Error: Unknown encoding
at Buffer.toString (buffer.js:434:13)
at Object.fs.readFileSync (fs.js:236:33)
at Object.exports.zvm (/Users/patrick/dev/interactive-fiction/if/node_modules/ifvms/dist/bootstrap.js:92:16)
at Object.<anonymous> (/Users/patrick/dev/interactive-fiction/if/t.js:4:29)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Currently the code files of f.i. zvm.js is one big files with a lot of different object types.
For readability it would be nice to move them all into separate files.
For distribution we can generate them as one big file again?
zvm
version 1.1.6, installed with npm on Windows.
>
starting symbol breaks after using backspace. That causes visual artefacts after command launch.
E.g. type >lookk
and press Backspace makes leading >
to dissappear: look
.
Then press Enter and get llook
echo.
The same effect when starting previous command(s) from history buffer, available on Up/Down.
As you mentioned before,
in the bootstrap.js you rely on grabbing the previous order and changing just the message property. Can you provide an example on how to calculate/specify a correct inputEvent order?
As far as I can tell, I see you have to specify storer, terminator, len, parse, buffer, response etc...
thanks for helping me here!
It won't take much to run the Praxix unit tests in node (and with a grunt task.)
Write an implementation of the Glulx VM
13.2.2
to 13.2.4
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
yargs is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
The new version differs by 14 commits.
a6e67f1
chore(release): 13.2.4
fc13476
chore: update standard-verison dependency
bf46813
fix(i18n): rename unclear 'implication failed' to 'missing dependent arguments' (#1317)
a3a5d05
docs: fix a broken link to MS Terminology Search (#1341)
b4f8018
build: add .versionrc that hides test/build
0c39183
chore(release): 13.2.3
08e0746
chore: update deps (#1340)
843e939
docs: make --no-
boolean prefix easier to find in the docs (#1338)
84cac07
docs: restore removed changelog of v13.2.0 (#1337)
b20db65
fix(deps): upgrade cliui for compatibility with latest chalk. (#1330)
c294d1b
test: accept differently formatted output (#1327)
ac3f10c
chore: move .hbs templates into .js to facilitate webpacking (#1320)
0295132
fix: address issues with dutch translation (#1316)
9f2468e
doc: clarify parserConfiguration object structure (#1309)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
The current consumers of ZVM are node and Lectrote (Chrome) both of which support a lot of ES6 features which could be nice to use (I'm thinking arrow functions and classes mostly, but might as well use consts etc too). It might be time to start using ES6, and then when I bring the current version into Parchment, to use Babel to transpile it to ES5.
Technically this would I think be a semver major change, but version 1.0.0 is only one week old, and everyone who is using it can handle the upgrade.
I think what I would do is set the engine value in package.json, change the ESLint options, and bit by bit upgrade. For a while it would be a bit of a hodgepodge. Unless I decide to upgrade it all in one go.
16.3.0
to 16.4.0
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
browserify is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 5 commits.
8980670
16.4.0
f871a85
Update changelog.markdown
52de2c4
Merge pull request #1916 from browserify/stream-http
5dc1bf2
Upgrade stream-http to v3
4a5ea7e
Add funding.yml
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Emscripten's relooper algorithm (described in https://github.com/kripken/Relooper/blob/master/paper.pdf) looks like it should work for ZVM/Glulx too, and would cover more cases than the current idiom approach.
These follow the changes in erkyrath/glkote#46 , erkyrath/quixe#48 .
In zvm.js, the lines:
// The Quixe API expects the start function to be named init
this.init = this.start;
...must be changed to
// The Quixe API expects the prepare function to be named init
this.init = this.prepare;
ZVM.prepare() is now an obsolete name; you call ZVM.init(image, opts) first. ZVM.start() is now correctly named and doesn't have to be changed.
(I have made this change in the lectrote repo; see erkyrath/lectrote@ad7f87a .)
Also, in dispatch.js:
set_vm( vm )
{
this.vm = vm
}
...should now look like
init( opts )
{
this.vm = opts.vm
}
(In the Lectrote repo, I handled this with a patch line in zplay.html.)
Port ZVM to use Glk as its output system. Match Quixe for the general API.
Possibly develop a JS terminal Glk implementation for use as a terminal interpreter.
The VMs should probably accept blorbed storyfiles, even if they throw away everything but the bytecode.
They should also accept the data as a string.
Split from comment in #29 :
If you type HELP and then immediately quit out of the help menu, you get into a state where the status window is closed and the text that should go to the status window goes to the story window instead.
It should be possible to use asm.js for a lot of the JIT code.
I've noticed this before, but I thought it was a glkote error. It's not.
In Jigsaw (R3, serial 951129) if you go E. W. X PIECE
you should see a piece with two flat sides and two innie sides. ZVM/Lectrote instead draws one flat, two innie, one outie.
Repeating TURN PIECE
four times shows an inconsistent rotation.
The JSON handed to glkote is already wrong. (See attached file, which I copied from the JS console after some debugging.) Either ZVM is making incorrect output calls, or glkapi.js is handling the calls wrong. I haven't looked further into this.
Currently in my output stream I also get my input that was typed.
I'm wondering if there is a way to differentiate between the output and input stream?
See https://github.com/jedi4ever/ifplayer.js/ for how I try to handle it. Maybe I'm missing something here?
If we supported Z3 then Parchment could drop Gnusto.
This is an awesome project, and I'd like to stay current, but I'm having a lot of trouble.
I built a small HTTP server on top of ifvms.js here: https://github.com/statico/ifhttp/blob/master/server.js
It powers a text adventure game on my web site here: https://langworth.com
Unfortunately, with the latest code, I'm having a lot of trouble figuring out how to continue emulating this on the server side. Is there a way I can send commands and get output to the current version of the ZVM, similar to how my server works and how the "bootstrap" method worked in v0.1.0?
Or do I need to write a Glk subclass? If so, can you give me some pointers? The Glk and GlkTerm and DumbGlk seem closely tied to readline, and I have no idea what "Dialog" is. Can you give me a few pointers?
I appreciate the help.
@jedi4ever, I'd be keen on including a basic command line interpreter bin script. Is that what you're working on in ifplayer.js? If so, when you think it's ready, it could be brought into the main repository. What do you think?
I've released a version of Lectrote with autorestore, and it's working pretty good. Thanks! And quote boxes look good too.
A couple of autosave corner cases:
(You can see the support for this in glkapi.js, at the end of the update() function. If has_exited is true, it calls do_autosave() with a negative argument, which tells Quixe to call Dialog.autosave_write with a null snapshot argument.)
>
selection mark in the story window, instead of updating the status window. (But the next time you select a menu option it all gets back on track.)When given a blorb (#9) support the xml debug chunk if present. Use it to put original named on jit functions.
There's a line at the top:
if ( typeof buffer === 'number' )
I take it this is intended to convert a plain array to an ArrayBuffer, but it doesn't work as written. I changed it to
if ( typeof buffer[0] === 'number' )
...in my work tree, which I think is what you meant.
Support more Infocom games.
The problem is that the below code from MemoryView() assumes that a TypedArray's view always spans the entire ArrayBuffer.
// Typed arrays
if ( buffer.buffer )
{
buffer = buffer.buffer;
}
However, this is not necessarily true. Consider:
var a = new ArrayBuffer(10);
var i = new Int8Array(a, 3, 3);
console.log(i.byteLength); // <- Constructed view is from 3..6
console.log(i.buffer.byteLength); // <- ...but underlying buffer is still 0..9
In particular, for very short files, node returns the result of fs.readFileSync(..) in an 8kb buffer w/the contents at a non-zero offset. This causes file.identify() to fail immediately since the expected FourCC/zcode version is not at offset 0.
(Simple fix. I'll send a PR shortly.)
In the attached version of Advent.z5, enter
e
get all
i
The engine locks up (spinning) on the inventory command.
It's definitely the "i" going wrong, not the "get all". The attached save file was made in Frotz with "e", "get all", "save". So the game state is correct there. But when loaded into ZVM, "i" still locks up.
(This is the standard Advent.inf, but I've recompiled it so it's not exactly the same binary as on the Archive. That one shows the same bug, though.) (The files are zipped together because Github won't take raw files of unrecognized type.)
Reported in curiousdannii/parchment#48.
Theatre shows a long blank page, Christminster shows a long page with the title screen at the bottom.
Correctly handle @set_font 0
from the 1.1 spec.
(Also remove the formerly core @gestalt
selectors.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.