Yearly Archives: 2007

Deflecting Blame

This is encouraging: In the following rant, other people (the whole of Ubuntu in this case) are taking the heat for FFmpeg’s shortcomings: 5 Things I hate about Ubuntu. Item #3: “It has defective or near unusable packages (ie ffmpeg, scribus)”

In this situation, the complaint refers to the fact that FFmpeg’s native, default codebase does not presently include the ability to encode AMR or MP3. The Guru is reportedly working on a native MP3 encoder. Native AMR… that certainly should be in the codebase by now, though it probably isn’t.

The Interpreter

Somewhere along the line I got sucked into this multimedia hacking field as an extracurricular activity. There are abundant specializations in the computer field that one can take up as a hobby. But other specialties that I have always been curious about got sidelined, such as 3D graphics and artificial intelligence — 2 things I have always wanted to study more carefully.

Yet another topic is that of compiler and interpreter theory. There were compiler construction elective courses in school but I honestly didn’t care back then. Let the compiler do its job; I have higher level tasks. Naturally, if I’m suddenly interested in compiler theory, there must a reason for it.

Certain computer games use (what are probably) custom scripting languages to describe the game flow and character interactions. When I study these plaintext scripting files, I find myself wondering what would be involved in writing an interpreter for such a language. One such game is Clue Chronicles: Fatal Illusion, based on the popular Clue board game (a.k.a. Cluedo).


Clue Chronicles cover

The scripting language appears to be mildly object oriented with C++-type comments (‘//’) and reliant upon a number of implicit library functions. Principally, it defines scenes with graphic backdrops and the transparent Smacker multimedia files that are to be played as animations, as well as the subtitle text that should be overlaid. At the conclusion of certain interactions, methods are called that, e.g., add an item to your inventory or a clue to your notepad.

From my computer science studies, I seem to recall something about tools named Lex and Yacc along with the GNU variants, Flex and Bison. These are supposed to be suited for the task of writing compilers and interpreters in some cases. Here is a page that discusses writing a simple interpreter using Lex and Yacc.

Here is a sample of the language:

  // ## Common Scripts ##

  //  Scarlet says, "Sorry...I don't know..."
  sc1105 = SequentialScript(Autoplay, Looping, Scripts
  (
    Cursor(Name("wait"),EnableWindows(false)),
    WaitScript(scActiveIdleAnim),
    SetState(ge(scarlet),state(scTalkState)),
    ParallelScript(Scripts
    (
      SequentialScript(Autoplay, Looping, Scripts
      (
        {scActiveStill.SetActive(false)},
        GraphicScript(Skippable,Graphic(SmackAnimation
        (
          Layer(0),
          Offset(0,50),
          File("assets\\act1\\scarlet\\sc1105.smk"),
          Looping(false), NoSkip(false),
          Transparent(0, 255, 0)
        ))),
        {scActiveStill.SetActive(true)}
      )),
      SequentialScript(Skippable,AutoPlay(true),Looping(true),Scripts
      (
        Caption(Text("Scarlet: Sorry...I don't know anything about that.")),
        Caption(Text(" ")),
        DelayScript(Seconds(3))
      ))
    )),
    Caption(Text(" ")),
    Caption(Text(" ")),
    Caption(Reset()),
    SetState(ge(scarlet),state(scActiveState)),
    Cursor(Name("default"),EnableWindows(true)),
    Dialogue(ge(scarlet))
  ))

And here is the full file (originally titled sc1.ini), which is one of many files used to drive the game: clue-chronicles-scarlet-1.txt

I’m just wondering if anyone reading this blog has the first clue about how one would go about writing an interpreter for this little language? This is not a field to which I have had extensive exposure.