Creating RIA Interpreter for TADS 3

So it’s pretty clear to me that TADS 3 is a vastly superior system than Inform 7 in many of the mechanics. Presentation-wise, maybe not so much. But the underlying mechanics? Yeah. Much better. That’s an opinion but it’s a strong one on my part. The one thing I’ve heard is that one reason people still want to stick with the clunky z-machine or the apparently not-so-clunky Glulx/g-machine is because those can be played on a browser. If that’s one of the major things holding TADS back, I’d like to see about developing a browser-playable interpreter.

Has anyone started work in this area? Beyond the Jetty I found (that only works for TADS 2), are there any projects people are aware of that have been started? Whether or not there is, what have the thoughts been regarding technology implementation?

I can’t see doing this via Java applets or just in JavaScript. I could maybe be convinced on a JavaScript-type engine but I’d rather provide an RIA. I’m not too keen yet on the Google Web Toolkit, Apache’s Pivot, or JavaFX. (Anything Java worries me a little bit until Oracle stops being weird.) But I’m thinking something like Flash or Silverlight seem like much better options. I’d actually rather stay away from Adobe than Microsoft.

I’m curious what people think. If nothing else, I think this would be an interesting coding challenge.

One project that is currently under development is the online part of Tads 3. This is done by Mike Roberts himself. It should normally have been released by now, but real-life work got the better of him and so it got delayed. From what I know, it’s in good shape and he just needs a bit of time for wrapping it all up and doing the release.

Note that it’s not a Javascript interpreter. It’s a game server. Pretty much like any other game server (Counter-Strike, etc), but for Tads. The reason for this model is performance and language-level network support (like the Socket class in Java), allowing people to write multiplayer games in Tads.

For more info, you can browse the posts on the official Tads 3 blog:

community.livejournal.com/tads3

(Scroll down a bit to get to the relevant, 3-part series of posts about Tads networking support.)

As for a Javascript player, someone here mentioned that he’s experimenting with a Javascript implementation of the T3VM, but that at this point it’s just that: an experiment that doesn’t really work yet.

In the web application arena, I only know of two projects underway.

  • Wei-ju is adding TADS 3 support to ZMPP, which is JVM based. That could eventually lead to an applet or provide the server side of an AJAX client interface. I am more interested in it as the core of a Kindle publishing option.

  • MJR is adding web server capabilities to the main TADS virtual machine. When finished this can be used to deploy a TADS server in a suitable hosting environment; players would use a web browser to connect. My tentative plan is to add Webkit to Gargoyle and offer a desktop client that consumes the web output.

A Flash or Silverlight-based app would definitely fill a need, both now and down the road. Even with the options above, there’d be no provision for an author who just wants a quick and attractive way to deploy games on commodity web hosting. Something like Leaflet would be a big step forward.

The TADS3 VM is orders more complex than the Z-Machine and Glulx, so it’s little surprise that there is only the reference implementation currently. Wei-ju should be commended for making the second implementation ever.

I think that a pure JS interpreter is possible, but it will be difficult. I’m currently working on a generic VM system (ifvms.js at my Github) and am thinking that I’ll at least write a disassembler for it. I think it would be great if a team worked on it though, each person taking a chapter of the VM spec for example.

When I started working on a TADS3 VM, I initially thought “yeah cool, a Smalltalk-like VM for IF”.

Having put quite a bit of work into the implementation, I have learned to appreciate what the Z-Machine and Glulx offer to a VM implementor: awesome, comprehensive technical documentation, simple elegant designs and reference implementations that are easy to understand. You are actually able to write a VM by reading the specifications alone, that’s how good the specifications are.

The T3 documentation is huge - yet I would say it is impossible to write a VM by reading the specification alone, you do need to look at the reference implementation, which is not nearly as easy to understand as e.g. Glulxe. There are also some aspects of TADS3 which make it hard to simply reuse what your implementation language already offers, e.g. containers and regular expressions.

TADS3 has a lot of stuff built-in so it has potentially less runtime overhead than Inform where a lot is implemented in Inform itself. Yet, by making it easier for VM implementors, you can actually see more people successfully implementing a Glulx VM or Z-Machine. People who work on IF VMs in their spare time (which in my wild guess is the majority) can only spend so much time on it. So while ZMPP implements quite a bit of T3, there’s still quite a bit of way to go.

As for Java vs .NET, it’s like we germans say “the choice between plague and cholera”. Pick your favorite Evil Empire™, there are plenty to choose from these days. The folks who use pure Javascript are probably the luckiest in this respect.

ZMPP currently does use Swing as a frontend technology, but one of the reasons I have picked Scala was Lift, which has good Ajax and Comet integration. So this is ZMPP’s RIA strategy.

This is good news indeed. I had more or less lost hope as the months slid by.

The thing I still don’t understand is, who will be hosting the server? Will it be part of Mike’s web setup? The reason I’m asking is because I’m just a poor dumb game author. I have a website, but I lack the technical background I would need to even ask my site host the right questions about setting up a virtual T3 server within my site.

I have a vague recollection that there was also some question about whether existing games will run on the new machine, or whether they will need to be recompiled, or what. Am I totally off-base about this?

Games will need to be rebuilt. As for which people will be hosting servers, I’ve no idea :stuck_out_tongue:

Usually they say “you lose some, you gain some”, but in this case it’s more like “you lose a hell of a lot, you gain a hell of a lot”. Meaning that network services at the language level is something totally awesome, but not being able to simply post a game somewhere and have it run on the browser in Javascript is totally not-awesome.

It’s a standard-issue Mike Roberts solution, in other words. :stuck_out_tongue:

Seriously, I have enormous respect for Mike’s prowess as a code designer, and I’m sure once this solution is available, it will be amazingly slick. But as with T3 itself, there will be barriers to entry that new authors may find a bit daunting.

If he provides a virtual server himself, that will help a lot. I’m just hoping I can still find the source code for Lydia’s Heart so I can recompile it…

My sense is that Mike plans to host a server, perhaps even the server, but he’s understandably reluctant to make a stronger commitment in the absence of actual metrics for VM performance, game quantity, and player count.

I don’t think you need to worry. If you don’t care about the plumbing, you’ll be able to upload a game file somewhere, publish a hyperlink, and have it all work. If you want to host a server, someone will help you figure out your options once the software is released.

Good news. The system is pretty much feature-complete. Ironing out the last rough edges should hopefully not take that long. Mike Roberts also provided the modifications to make frobtads able to serve games through HTTP, so I was able to give this a go on my Linux box.

The result is quite nice. The system is able to support multimedia TADS through the web :smiley: As far as I know, the below are the first screenshots to demonstrate TADS on the web:

foss.math.aegean.gr/~realnc/pics/tadsweb1.png
foss.math.aegean.gr/~realnc/pics/tadsweb2.png

Speed feels very nice, since the game itself runs on the server, not on the player’s machine.

Although it’s possible to try out this stuff yourself (by building frobtads yourself from its Git repository), it’s a bit of manual work as there’s zero documentation for this right now (MJR is writing it, along with the needed PHP code so that people will be able to host their own game servers.)

This is quite exciting :mrgreen:

This rocks. (I’ve totally given up on I7, but this is not the place for a rant.) If I ever write another game, it will be in T3. Thanks for keeping us updated, and thanks to MJR for the hard work!

Totally awesome. :smiley:

Can you offer some modest guidance on getting this up and running? :slight_smile:

I’ve rebuilt the sample game with the new t3make and tried this command line:

The resulting process shows the first screen in the game and then exits immediately.

(It prints a warning about tadsweb.config but as far as I can tell from the source code, this is only used to connect to the optional storage server.)

Does it have to be started by Apache in order to stay running?

EDIT: it looks like all the web functionality is contained in new library modules like webui.t and browser.t, which weren’t included in the sample build. So I guess I have to include those somehow.

Yes indeed! I’m still going to wait for the newer, smaller library* before giving T3 a serious look, but it’s great to see so many decisive moves out of the Windows ghetto over the past year!

–Erik

  • and, realistically, a nice Mac-native IDE solution as well…

Oops, there are some needed files missing (adv3web). I’ve got the ready-made t3 file of Return to Ditch Day for testing purposes and ran it, and didn’t notice that you actually can’t build web-enabled games yet :stuck_out_tongue: I’ll be waiting for the next update from MJR, as I don’t have those files.

Nope, it can be launched stand-alone. For example, Gargoyle would run the VM like that, and then launch a browser window on localhost. Voila, there’s your HTML TADS 'terp :mrgreen:, at least for games build with WebUI.

Btw, I’d recommend poking MJR about getting the updated porting kit sources, because the TADS 3.1 compiler breaks backwards compatibility, meaning games won’t run in existing terps (WebUI or not doesn’t matter). That way you’ll have a chance in updating Gargoyle by the time 3.1 is officially released.

OK, if you pull from Git again, t3make should now work correctly.

To build a WebUI game, add the following to its Makefile.t3m:

-D TADS_INCLUDE_NET -lib adv3/adv3web -lib webui -source tadsnet
(Use only “adv3web”, not “adv3”.)

To run it, use “frob -i plain -N 44 sample.t3”. You don’t need to specify the hostname, unless it doesn’t detect it on its own. It will then print an address on stdout. Simply open that in a browser.

There’s a catch in this. If you have a game that uses the banner API (other than just using the default statusline), those parts need to be rewritten to use the new web API. Direct I/O calls will also need to be rewritten in games that use them, but that should be easy since Adv3 now provides equivalents functions.

Great, thanks! Now I have a new toy to occupy me this weekend.

I’ve rebuilt a small game and it worked just fine. I have another one that uses banners so I need to dig deeper to find the web API equivalent.

Network performance is decent. I spun up an Amazon EC2 micro instance which handles a single session with no apparent difficulty. It’ll be interesting to see how many sessions it can handle once the PHP scripts are ready.

When I tried it, it didn’t detect my wehost, I had to specify it and then it finally worked. Took me a while before I figured this :slight_smile: But now everything is running smoothly and I don’t have any problems.

Does the version in git allow any form of multiplayer facilities for TADS3?
Or is it more to allow multiple players each in their own independent instance of a game?

TIA,

Phil.