dfillmore / viola Goto Github PK
View Code? Open in Web Editor NEWViola is a Z-Machine Interpreter written in Python.
Viola is a Z-Machine Interpreter written in Python.
VIOLA 0.8.1 Written by David Fillmore. Viola is a Z-Machine Interpreter. That is, it interprets programs written for the virtual machine known as the Z-Machine. There's a brief history of the Z-Machine at the bottom of this file, for some reason. The latest code for Viola is available at https://github.com/DFillmore/viola. FEATURES * Z-Machine Versions 1-8 support * Z-Machine Standards Document 1.1 compliance * Blorb Resource Format 2.0 compliance * Quetzal Saved Game Format 1.4 compliance * Support (via Blorb) for sounds and, in Version 6, images. INSTALLATION Some brief notes on getting the program up and running. You will need Python 3 (I use version 3.3.5), which you can get at http://www.python.org, and pygame (I use version 1.9.2), which you can get at http://www.pygame.org/. I genuinely don't know if the setup.py file does anything useful. BRIEF HISTORY OF THE Z-MACHINE FOR SOME REASON The Z-Machine was created in the early Eighties by Infocom in order to run text adventures. Infocom evolved the design of the Z-Machine gradually, and created six distinct versions, each with more capabilites than the previous. Versions 1, 2 and 3 are almost identical, with slight changes to certain parts of the design that make them incompatible. Most of Infocom's games were released for version 3. Version 3 was a fairly simple design, but a seperate upper window was introduced for one game, and support for sound effects (which was really part of the Version 5 design, but a scaled down version was stuck into Version 3). Version 4 introduced text styles, better upper window support and a few other features, as well as allowing games to be larger. Version 5 allowed even larger games, with several new features including better sound support. Version 6 allowed for graphics, up to eight windows which could be moved and resized, bigger games, and other less obvious features. Then Infocom went out of business, more or less. Several years later, Graham Nelson created Inform, which allowed anyone to create Z-Machine games. Two new Versions were created, numbered 7 and 8. These have none of the extra features of z6, but instead are identical to the z5 model, except that they both allow larger games. z7 was never really used. Most games created for the Z-Machine since Infocom stopped business are z5 games.
The [MORE] prompt is not actually erased when the user presses space, it just generally disappears because text is printed over it.
The interpreter should only allow input for characters the game defines for input. Currently it allows undefined characters to be passed to the game.
The ability to select which version of the Z-Machine Standard the game should support, and fail on any later Standard features the way an interpreter that knew nothing about them would, would be helpful in debugging complex games.
In Zork Zero, as soon as the game starts, the location 'Flatheadia' in the status window at the top of the screen slightly overlays the curve on the banner image the text is printed on. Below that, the 'Score' text should have a ':', but this is missing. Probably the same issue.
From the Standard: The routine is permitted to print to the screen even if it returns false to signal "carry on": the interpreter should notice and redraw the input line so far, before input continues.
Viola does not do this.
When the interpreter is supposed to prompt for a filename for an external file, it ignores this and provides a default name instead.
The z6 tab character is supposed to behave differently depending on whether it is printed at the beginning of a line, or in the middle of one. Viola does not do this, instead printing 3 spaces at all times.
Where there should be newlines, there are none. The text just prints at the bottom of the description box, in one long line, running off the end of the screen.
A command line option should be added to start transcription to a specified file immediately.
The Z-Machine screen and window positions start from 1,1. Currently, Viola assumes they start from 0,0, because that's how pygame works. Some simple conversion of coordinates is needed.
@buffer_screen allows the game to hint that the interpreter should use a backing store for all screen updates, until the game is finished whatever complicated drawing it's doing. It is legal to ignore the opcode completely, but it might be worthwhile using.
Games should be able to print as many Unicode characters as possible
Under various circumstances, text output is not supposed to be buffered, but instead printed immediately to the screen. Viola buffers all text output.
With the speed of modern computers, this is barely, if at all, noticeable.
In Zork Zero, in the banner at the top, the background colour for some of the text is a lighter shade than the banner it's printed on.
Leaving this alone for now, because it helps highlight the text positioning bug, and might help fix it.
The blocks do not fall, which indicates that timed input is not actually working correctly. Very likely to affect other games.
Some old code from back when Viola used wxPython is called to make a file dialog, but this does not make sense to pygame.
Version 6 of the Z-Machine allows the game to add menus to the interpreter's menu bar. This is an optional feature, which Viola does not support primarily because Viola does not currently have a menu bar.
If the interpreter is at the 'press any key to quit' prompt, and a sound is still playing, when the sound finishes it can call the interrupt routine, which will start the game running again.
When the interpreter thinks it has messed up the game display, and wants the game to redraw it, it can set a flag in the header. The main time to do this would be when the interpreter window is resized. Viola does not do this at all.
Especially when running Inform 7 games, it seems.
Timed input seems to work correctly, but when the game quits, or the window is closed, the interpreter doesn't quit at all, but keeps reading random opcodes.
It should be possible to get the colour of the pixel under the cursor. If this is one of the basic colours that the Z-Machine understand, the colour data for the current window should be set to the value of that basic colour. If it is not a basic colour, a higher value number should be stored, but the interpreter should internally keep track of the real number so that it can be used elsewhere.
Viola does not correctly store the value of the basic colour in the window's colour data. This doesn't seem to affect the appearance of any games.
Later Infocom games and most modern games support abbreviations such as 'x' for 'examine', but some early games do not do this. It should be possible to convert these abbreviations before handing the text over to the game for parsing.
It should be possible to turn off support for non-basic Z-Machine features like colour or sound, or even italics. This may be useful in testing games for support on interpreters that do not have those features.
When trying to restore the file, Frotz crashes with a 'Umem chunk wrong size' error.
I think the alphabet table for z1 and z2 is wrong.
Some Z-Machine features are requested by games using flags in the header, and the interpreter is not expected to provide the feature if the game does not ask for it. An option to turn off any features not explicitly requested might prove mildly useful.
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.