I’m adapting some if games to Ubuntu Touch. It’s very simple to anything that can be run in a html5 (specially to great works as Parchment and Quixe).
But, as the first if games I played were the ones from Level 9 I wanted to give it a go, even the C interpreter is a bit old, I could compile the glk code (even I succeeded through emscripten) but trying to run it produces no result.
Now, you can guess I’m not a programmer, and I’m lost. I’m probably confused with concepts.
My idea is to be able to run Level 9 games in a html and it looks it’s possible through glk/glkote but I have no idea what’s the strategy or were to start.
Could someone show me the way? Or confirm that it is possible?
Incidentally Emscripten is the approach I took with the recently released JavaScript Hugo interpreter. It’s a custom JavaScript frontend with the engine compiled from C to JavaScript.
What you’d need to do is write C functions described in the porting instructions that would in turn call the JavaScript functions in the frontend. You could use preferably Glkote or the HugoJS frontend. You can look at how HugoJS does it for an example (the relevant bits start at line 275 or so.) You’ll also have to compile with the -s ASYNCIFY=1 option and make the player input methods asynchronous in the C code (e.g. lines 330-355 in the aforementioned file.)
It’s not a simple task, especially if you’re not a programmer. It took me about 70 hours to make the Hugo interpreter and I’ve been a JavaScript developer for almost 10 years. A simpler solution would be to have the games run on a server and pass the input and output between the device and the server, the downside being that you’d need your own server, a constant Internet connection and it’d be text-only. I think there are ready made solutions that would be easy to adapt, although I don’t know much anything about them. Good luck!
This is interesting for porting to Ubuntu Touch also.
I was looking in the glk port of the Level 9 interpreter and I thought that was already done.
So, I didn’t understand how this port works. What it does then? Convert the interpreter into a standard form?
I imagined that it will be not easy, but maybe I can do a little step closer for someone else.
Thanks!
You can’t use the standard Glk library because it uses an IO system that isn’t compatible with browsers/Emscripten. You need to make your own or use the JavaScript version of Glk (GlkOte). The Glk port isn’t directly compatible with GlkOte.
I have written JavaScript implementations for two interactive-fiction VMs, specifically Z-machine and OASYS. You will need to write the front-end yourself though. I didn’t include one for Level9 yet, nor TAVERN or various others (if I find documentation and they are simple enough to implement then I might do so).
[Updated]«Wrong» A-code. This is from Platt / Arnautov implementation.
[rant]Oooh! I found the updated website with a javascript implementation of an A-Code parser (I think).