…this question does what it says on the tin, basically. If I want to have a Glulx game that uses external files, but I want to put it online, can that be done? How?
If you mean standard Inform 7 external files, I think Quixe can already do that? The external files will be stored in the user’s local storage, if I recall correctly. Else there is Vorple, which definitely supports external files.
(If you are thinking of some data stored in a file on the server hosting the game, then you’ll need Vorple to retrieve its contents via JS; the same if you what the user to upload a file from his computer. But I don’t think that’s what you meant.)
Quixe does this without any extra work from you; I too am pretty sure that the files go to Local Storage (although I’ve had a devil of a time trying to see them there).
This is how Tales from Castle Balderstone autosaves your progress, and how Ryan Veeder’s Authentic Fly Fishing will autosave your progress when it releases this Saturday.
What if I want to preload a file? That is, instead of having the game create a file as the player plays, start with my own file that the game will check.
(For instance–I’m probably not going to do this–have the game check words against some sort of sentiment analysis or something else drawn from a word database.)
I’m not sure I understand. Wouldn’t preloading the file as you explain it be equivalent to creating it when play begins?
In your example of storing things drawn from a database, you don’t event need an external file, you can just write them directly in a table, no? (If you need to draw that data before or during play, then again you need Vorple.)
The idea is that the game doesn’t create the file at all: the file was created beforehand, and the game accesses and checks it later. (This would be useful on the Z-machine, for example, where the address space is small but file I/O is cheap.)
Embed the file in the blorb and open it with a resource stream. Write it out to the file system only if it is modified.
Yes–other use cases might involve stuff I wasn’t going to type in the source code myself, like a file that was created by another project that isn’t going to get uploaded as part of the project, or a big text file from somewhere… can Glulx even read standard text files?
(I’d think it wouldn’t help for the z-machine, because the z-machine can’t use external files, or am I wrong about that?)
That sounds good! How specifically would one do this? Can it be done in the standard Quixe that you get when you release along with an interpreter, or do you need to do something else to open something as a resource stream?
Also I’m probably not going to actually do this, and it’d almost certainly be a bad idea, so everyone feel free not to spend any time answering the question.
Baker of Shireton and Fair both used the Recorded Endings extension which writes a small file to the hard drive or the browser cache and those got plays online and offline. I did get reports that some people playing online had errors, but that was the result of strict browser security settings preventing the file writing out and not the game.
See EmShort’s “Recorded Endings” and Aaron Reed’s “Config File” extensions.
It should work fine in Quixe, it’s actually ahead of Gargoyle. Inform 7 support is lacking however, so you’d need to postprocess the blorb. And you’d need some I6 code to create the resource stream. If anyone’s interested in trying things like this, the Startup Precomputation extension shows how it can be done.
It can! Inform 7 just adds a bit of a wrapper over its low-level file handling. But if you really wanted to pull text from a huge text file, or numbers from some huge binary blob, Glulx has ways of doing that.
Perhaps surprisingly, the Z-machine can in fact use external files! Inform 7 just never made use of this capability, for unknown reasons. (It’s not a new feature; “auxiliary files” were part of the Z-standard version 1.0.)
It’s somewhat clunkier than Glulx’s stream-based file handling, since it doesn’t allow arbitrary reading and writing—all it can do is dump an area of memory to an external file, or read the entirety of an external file into an area of memory. But that’s pretty much what I7 uses external files for by default anyway.
Slightly tangentially, the next version of Vorple includes a full set of tools just for this purpose (exchanging (virtual) files between Inform and the outside world.) It drops in about a week or so.
As Draconis said, it can. In fact, text files are the default (You have to declare an exeternal file as “binary” if you want a binary file.) One thing to remember is that Inform external files are encoded in ASCII Latin-1, so “exotic” characters will cause issues when writing or reading them.
True, though hopefully this will be one of the first things to change when I7 is open-sourced. Zarf already has a version of the parser and library that’s fully Unicode-capable; we just need to update I7’s internal text handling to be compatible with that.