inicio mail me! sindicaci;ón

SCUMM in JavaScript

Soon after bumping into haXe and Doomed Online, they got me thinking. “Would it be possible to run SCUMM games in flash?”. The answer to that of course is yes, as was demonstrated by my SCUMM Interpreter written in haXe. Though as with anything, you really need to spend the time to implement everything, and justify it somewhat.

(Not to mention that Flash 10 is supposedly going to be able to compile C code, thus making my complete port more or less redundant)

Now i would have stopped there, if i hadn’t noticed that haXe targets multiple platforms, including every web developer’s best friend, JavaScript. Thus i thought, “Would it be possible to run SCUMM games in Javascript?”. For the answer… well, take a look!

OpenQuest in a browser

Yes, that is an image of OpenQuest running in a web browser, specifically Firefox. It can run in other browsers too, though to date i have only tested Firefox and Safari, the latter of which mysteriously crashes.

And if you want, you can try it yourself by clicking here. A word of warning though, it is highly recommended that you use Firefox to run it. Otherwise you might get a nasty crash, or a big disappointment.

As previously, just about enough is implemented to get the first room of OpenQuest loaded. Actors, verbs, objects, and sounds are not implemented, though it would certainly be possible. However the engine runs much slower than in Flash, so i doubt anything that could be considered to be “playable” could be implemented with it.

Still, i feel I’ve now accomplished what i set out to do when writing this interpreter – that is to push haXe, Flash, and JavaScript to the limit and see what i can get out of them. And of course, learn a bit more about SCUMM too.

Again, i would like to congratulate the ScummVM team for their SCUMM interpreter and Alban Bedel for his scummc compiler. Without their efforts, i wouldn’t have had any code or references from which to base my haXe-based SCUMM interpreter.

Edit: Source code available from github.

Edit: No longer crashes in Safari provided you are using Safari 3.1.2 or later.

  • bonder
    I get this error when I try to run in FF 3:

    JSTest.hx:38: Preloading resources
    JSByteIO.hx:390: XMLHttpRequest: Loaded 487 bytes
    JSByteIO.hx:390: XMLHttpRequest: Loaded 60549 bytes
    JSTest.hx:42: Resources loaded
    JSTest.hx:46: Engine init
    SCUMM.hx:505: boot state
    SPUTMResource.hx:312: Loading resource 1 from file 1, room 2 (SCRIPT)
    SCUMM.hx:507: Started
    SCUMM6.hx:1258: ARRAY = ""
    SCUMM6.hx:1258: ARRAY = "ScummC Paused !"
    SCUMM6.hx:1258: ARRAY = "Are you sure you want to quit ? (Y/N)Y"
    SCUMM6.hx:1258: ARRAY = "Are you sure you want to restart ? (Y/N)Y"
    SCUMM6.hx:1258: ARRAY = "Save it"
    SCUMM6.hx:1258: ARRAY = "Load it"
    SCUMM6.hx:1258: ARRAY = "Continue"
    SCUMM6.hx:1258: ARRAY = "Cancel"
    SCUMM6.hx:1258: ARRAY = "Quit"
    SCUMM6.hx:1258: ARRAY = "Ok"
    SCUMM6.hx:1258: ARRAY = "Saveing '%s'"
    SCUMM6.hx:1258: ARRAY = "Loading '%s'"
    SCUMM6.hx:1258: ARRAY = "ScummC test Menu"
    SCUMM6.hx:1258: ARRAY = "Save game"
    SCUMM6.hx:1258: ARRAY = "Load game"
    SCUMM6.hx:1258: ARRAY = "Game NOT saved"
    SCUMM6.hx:1258: ARRAY = "Game NOT loaded"
    SCUMM6.hx:1258: ARRAY = "Insert disk %c"
    SCUMM6.hx:1258: ARRAY = "You must enter a name"
    SCUMM6.hx:1258: ARRAY = "Insert your save disk"
    SCUMM6.hx:1258: ARRAY = "Failed to open %s (%c%d)"
    SCUMM6.hx:1258: ARRAY = "Read error on disk %c (%c%d)"
    SCUMM6.hx:788: 103, 645
    SPUTMResource.hx:312: Loading resource 2 from file 1, room 2 (ROOM)
    SPUTMRoom.hx:180: RMIM == RMIM
    SPUTMImage.hx:122: smap size == 8
    SPUTM.hx:1157: Internal exception, aborting! (state=SPUTM_RUNNING)
    SPUTM.hx:1158: ReferenceError: console is not defined
  • Really? Hmm.... I think you may need Firebug installed. Yes, that is probably it.

    I've modified the script so the haXe trace isn't called. This should solve your problem.

    Let me know if you encounter any other issues.
  • G. Uybrush
    Where did it go? It doesn't work (FF3), and it's gone from github.
  • James Urquhart
    Hi there,

    I moved it into the closet as i more or less stopped working on it. The reason being, it really liked to break for no apparent reason in a lot of browsers (e.g. FF3). Also, the novelty wore off. Still, could be useful if you want to implement a script interpreter for green threading. :)

    See:

    http://github.com/jamesu/closet/tree/master/his...
  • hm2k
    This is neat. A javascript scumm engine would be amazing.

    I noticed the links on this page have somewhat expired.

    I wonder if javascript could be fast enough?

    Otherwise it might be a flash scumm engine instead.

    Check this out: http://sarien.net/
blog comments powered by Disqus