Coding Experience Fun Technical

It’s not you, It’s me!

Greetings, everybody. Welcome to this week’s blog post! I hope you are all doing fine, so first of all let’s start by this blog’s name, why “It’s not you, It’s me”, Well there’s the reason behind it as one of the bugs that I encountered has to do something related to this term ‘me‘ and thus when referring to this problem, rvanlaar (discord) used this as a joke… more ahead..

Let’s start with good news

Frame Loading Revamped

As presented in so many previous blogs, we are finally reaching the completion of demand frame loading and successfully working on total distortion’s bed dream games, this single big change took so many weeks, and after much effort frame loading has been completely revamped and the master branch is now updated to use on-demand frame load. If you do no know what I am talking about, read this and this to get a basic idea about the change!

PR #5124 by super mentor Sev laid the groundwork for frame loading by merging some 40 commits into master and thus the era of demand loading came! However, some more tweaking had to be done to get everything working properly and most importantly, getting total distortion bed dream games working, for which all this was started!

So after I made more changes and fine-tuned things after which bed dream games started to function normally.


PR Link – #5163

It’s not you, It’s ME

Finally, to the fun part, bed dream games were fixed, so what next? To go next part and play the minigames (the bulb one you see in the above video, at the end).. but while testing it, I encountered another bug documented here, that is:

################ LINGO: syntax error, unexpected tINT at line 1 col 13 in NoneScript id: 0!

What does this mean?

To explain it better, I would have to give you a brief idea of what lingo is, and how is it used! But first, you need to know that the Director engine(for which I fix bugs) is a multimedia authoring platform, oh btw

Multimedia authoring is a process of assembling different types of media contents like text, audio, image, animations and video as a single stream of information with the help of various software tools available in the market.

ie such a platform needs different tools and things to control/create movies, and games.. Similarly in director engine, there is Lingo, a programming language that can be used to control various elements of games, like sound, images, etc!

Quoting from this Wikipedia page about lingo

Lingo is a verbose object-oriented (OO) scripting language developed by John H. Thompson for use in Adobe Director (formerly Macromedia Director). Lingo is used to develop desktop application softwareinteractive kiosksCD-ROMs and Adobe Shockwave content.[1][2]

So it is a language that was originally used with director engines, now to replicate that engine in scummvm, scummvm must support reading/parsing this custom language right?

How is a programming language understood by the computer? or more specifically, how is lingo being read by scummvm? Well to understand so, we have to deep-dive into compiler designs and things even I am not comfortable with, but in a nutshell there are these components:

  1. A compiler, which takes for example Lingo and converts it to C++ comfortable instructions.
  2. AST Trees for operands, operations, etc.

Oh, Lingo is a context-free language, I would really love to go deep inside automata theory but that’s an article for some other time!

But what happens, in a nutshell, is a simple instruction like put “Hello” when read by our compiler/parser, jumps into state, ie, converts everything to the token and then token-by-token creates logic/relations etc about different components of instructions, for example here let’s say our parser was initially in state X where it can accept a,b,c,d…. tokens, “put” being one of them, once it received “put” token, it simultaneously jumps into state Y where now it can only accept token like " , etc.. well, all these are then converted to C++ objects which will later be used to execute lingo!

What did go wrong with this bug?

Well, as seen by the error, called syntax error, what happened was that the game was trying to execute an instruction that is little different than what scummvm expects, here in this case, the game tried to execute lingo instruction

me(bubdie2 5, 75)

however, we expected an instruction of this type to be written something like this:

me(bubdie2, 5, 75)

(Please note the comma there), until now, there were no cases observed when a game used the wrong syntax (well correct, to be precise, just non-documented syntax), which was working fine in the original engine, and once again, we didn’t implement this peculiarity!

To be extra sure that it’s “us” not “them” who did this wrong, I verified this by creating testing movies for the director engine and trying to work this off and as expected our Lingo parsing was incomplete as it didn’t account for this edge case! Well time to fix it (but with a twist)

As this was too difficult for me, again super mentor Sev came to the rescue, he told me the problem and after discussions, djsrv implemented this, Link to PR: #5170

Here’s a working screenshot:

screenshot showing working dreamlights minigame

Oh, by the way, this title was inspired by this message of rvanlaar

You can always join our discord using this link and watch progress, and even better contribute and help improve ScummVM!

More Work this Week:

Fixing leaks in lingo-tests: #5164

This fixes leaks, and errors in lingo-tests which makes the build bot green yet again!

The End

Thanks for reading so far, I hope you like it, as usual apologies for any grammar mistakes, etc! With that being said see you in next week!

Leave a Reply

Your email address will not be published. Required fields are marked *