Coding Experience Fun Opinion Technical

Reading Books in Total Distortion

Greetings everybody! Just before we start, I have something to tell you all, It’s about time and we are in the final phases of GSoC ending, the final mentor evaluation is about to happen (2 weeks~) and unfortunately, that means my tenure will be coming to an end! With that being said let’s start with my work this week! (plus what has been merged)

This week I have worked on fixing more bugs and improve more support, let’s start with the title!

Reading Books in Total Distortion!

Linked to where in books library the index in book was overflowing (see image)

bad (or bugged) render of books

Now, like any good sensible developer I took it upon myself to fix this issue! To do that I have to investigate, that how this thing is different from other “texts” in Director.. and I found that:

Style: Scrolling and that’s it! The difference was that this “text cast” has this style “Scrolling”, which was giving issues as in ScummVM we didn’t implement “Scrolling” textcast! You might have been confused about one thing: What is “Cast?” or “Text Cast” here??

Well a cast is like an element of movie, it is like the building blocks of any game/multimedia in director engine, and among these elements, we have many different kinds, for example Image cast, text cast, filmloop (series of frames), digital-video etc etc. Now each of these building blocks can have properties, like here TextCast member has this property of Style, where we can choose what kind of cast that is!

The Cast terms originally coined right after movies

e.g. it is one of the actors in a movie, you put it on a Frame, and Frames compose a Score
~ sev, (#engine-director, discord server)

So as I have previously mentioned, there is only simple text cast implemented in ScummVM, therefore, what I had to do is to simply implement a scrolling cast member! One  that takes into account a scrollbar in side and the logic to click items in it!

Well to do that, I just reused the TextScrollingWindow (ie a special kind of window specially created for displaying text in mac styled windows), well I had to do this because of scrollbar, that I needed in order to implement this scroll behaviour! Now as a part of doing this, what I was basically doing is to reuse the code that was written for text display, google says about code reuse:

Code reuse aims to save time and resources and reduce redundancy by taking advantage of assets that have already been created in some form within the software product development process.
and that serves about right! I could have simply written everything into default text class (which was used to mactexts) however the thing is, to do that I have to add scrollbar, its render, then event functions.. basically all of these were there in textwindow itself, so why do that all again when all you can do is to reuse it!
and that is how, after fixing it up, and making more changes to make it work properly, here’s the final result:

and that’s how the working books look like, Happy Reading!

Link to PR – #5182

More work done

Fixing visibility issues when setting window properties

There was this bug where assigning windows property automatically used to bring them to foreground, but this was not good as it means that sometimes hidden window that are supposed to be hidden are now shown, to fix it all I had to do is to remove the statement that does this and voila, fixed!

Link to PR – #5245

Refactor frames loading, fixing chan command

If you have been reading my blogs for a while, you must be knowing about one of the biggest changes to frames loading, well there are still some things that pop out occasionally, one of them being this debugger command “chan <number>” which was used to list channel information on any specific frame! The fix was simple, to refactor some things and fix the logic!

Link to PR – #5255

The End

Thank you for reading so far, its been great writing and working for scummvm and I really enjoyed this whole journey! Before ending I’d like to say that I have been offered to become member of this organization (Director engine), and I am very happy for that! (the process is still underway but expect the results next week), what that means is I can officially start directly committing codes to scummvm, and get some perks (cool discord roles, etc!). With that being said see you in next article!

Coding Experience Fun Nerdy Talk Opinion Technical

The Butterfly Effect of Fixing Bugs!

Hello! It’s nice to see you again XD Welcome to another blog article demonstrating my progress for this week! How was your week? I hope it was good, for me It was amazing as I was quite productive -> (Read More)

So Let’s start!

Justice for Texts, Granted

In my previous blog post I mentioned this text problem where some texts were getting jumped up while others were overflowing! Well, the great detective (err.. developer) HSK, successfully investigated the problem to be linked with fonts!

What was happening in the original behavior is that, while calculating line height (because look, for rendering all those texts, we need to know the exact dimensions they occupy) with custom fonts, the heights were just a very small magnitude different from what It should be (I mean, for some texts, adding 1 to all line heights fixed the problem, but broke all other fonts)

The Solution?

Was very simple. In the original implementation, they only used the font’s height but didn’t make use of another parameter, that is called “Leading”

The vertical space between lines of type is called leading.

After simply making a change, from

virtual int getFontHeight() const { return_data._fRectHeight }
virtual int getFontHeight() const { return_data._fRectHeight + getFontLeading(); }
Everything was fixed, WOOHOO!
Obviously, the warlock-100 (game for which bug was discovered), became very happy, as text alignment now properly works! (Screenshot below)
fixed alignment of “The Blaster” text, now matching with it’s play button!
Merged PR link -> #5100

Game Save loading Error – Total Distortion

This is yet another bug which was discovered while playing through total distortion, where sometimes there is corruption in game properties which, when saved and loaded again, completely crash the game!

This is an interesting bug because It made me unable to progress further (and was quite annoying)

Details for this ->

Oh, by the way, there is a public Trello board for tracking bugs and issues. You can always look there to know the current state of the engine!

So again, after lot of digging through I finally found the rootcause of the problem! That was a simple comparison check:

In certain parts of games, two similar but different types were being compared (for example, you can compare Integer 4 and string “4” and expect them to be true). Similarly, it was happening that two datatypes of Director Engine Symbol and String were being checked for equality, now being similar but also different, ScummVM didn’t take them into account and just returned false even for similar ones and thus, this small issue was giving big troubles! The Fix was very simple, that is to tell scummvm to treat Symbol and String comparison by “String” way!

Just for reference, a symbol in Director looks like #mysymbol, while a string is “mysymbol” like if you also have doubts that WHY? aren’t they same?? Well they are not.. let’s see what books say about this!

A Universal “Name Constant”
Symbols are something special to Lingo. They’re sort
of a “name constant,” giving you the portability of
string names minus the computational and data

Lingo! (Tab Juilius)

Well, Let’s not go deep into the technical aspect of this, just know that they are similar but distinct!

And finally, here’s the fix: #5107

Butterfly Effect of Fixing Bugs

Bonus section! So I remember my mentor said this when I was starting to submit a proposal in GSoC! He told me:

and look, we are not testing GAMES, we are testing Director, so, there is a beautiful side effect they break because some feature we implemented is not correct or absent 
How is this relevant to my previous bug fix? Well, those words were precisely correct, they couldn’t be any more truth to what I do every day! The more I get into finding and fixing bugs, the more I realize that they are fixing many other things that I have no idea of!
This was very much visible in my last bugfix of symbols comparison, where once I fixed it and was testing game again, I observed that many big and small bugs were also fixed, and the game suddenly got a lot-lot better… Just like that!
That’s why putting emphasis on the butterfly effect of fixing bugs, you fix one bug, It fixes another, and that.. fixes another as well! (The converse is also true, make one bug, destroy the whole program)!

Listing out things that were successfully working in total distortion:

shops and calling feature working!
video sequencer now opening without crash!

Finishing what I started – Meet Mediaband’s UnDo Me

Now comes the last and most nostalgic part! One of the first things I worked on after being introduced to ScummVM is Quicktime Video playback!

Yes, I cannot remember exactly if this was my 2nd or 3rd task, but what I can remember is this was one of the things that gave me an, even more, deeper understanding of the codebase and made me familiar with how things work when you play video!

Anyways, so in the month of March-April, I was given the task to implement custom playback rate and reverse playback for Quicktime Videos, you can just think of it as how your video player can be set to play at twice the speed skipping boring university lectures (Yes, I have done it too, personal experience), but here It was no movie player, here it was ScummVM, and we needed this functionality for this game meet-mediaband where one of the movies were using a miniature sort of video-player with different playback speed and this was all a part of UnDo Me.

A little bit about “UnDo Me”

well, it is a very simple game where you can choose between four romances for our lady and have two controls, “Ice” and “Fire” for going passive or aggressive to different situations and scenarios that will be played throughout the movie, while there are two buttons “Un” and “Do” for reversing/resetting story and for quickly going forward)! This clever game was implemented by seeking different parts of our QuickTime movie! You can even watch this youtube video of gameplay

Continuing on,

In the months of March-April, I implemented this custom playback but didn’t implement/integrate this with UnDo Me (the very game for which it was made), fast forward to 2 months, and suddenly we got a fully explained video of mechanics, and how it looks like, sev (my mentor) asked me to look into it and I knew, This is destiny… (Well I was supposed to finish it either way :P)

Fast forward to another sleepless night and voila! We have our UnDo Me working with all the controls working and a smooth experience! YAY!

Also, special thanks to fracturehill and their PR #4965 that made this integration possible (because setting custom rate audio was not implemented when I first started looking into video playback)! Not only that I must thank him for finding a bug that I mistakenly thought was due to their work(In the end, it was me who didn’t debug it thoroughly)! And being so helpful!

undome in scummvm!

Link to PR – #5118

Ending Notes

As usual, thanks a lot for reading all the way up to here! Apologies for any grammatical, or writing mistakes (My Grammarly is screaming right now), and with this see you next week!

Experience Nerdy Talk Opinion

The road to GSoC’23 proposal acceptance!

Greetings everybody,

This is my first blog post after getting my GSoC proposal selected for this wonderful organization, ScummVm!

So here I am expressing my journey and experience before 4th May 2023 (GSoC proposal out), have fun reading!

The Start (Needle in Haystack)

How did I find this organization? What was it that told me this is where I want to contribute?

An interesting quote from an article i stumbled upon!

20. “This is going to sound crazy, but… from the moment I first set eyes on you I haven’t been able to stop thinking about you.” – Leigh Fallon

So how did I set my eyes on ScummVM?

It was April 1st, the organizations were announced, and I was running late in finding my match..

I am, but a very enthusiastic computer guy (the one people love to call tech nerd, but no, I’m not), so from a young age, I have been tinkering with technology, learning new things on the way and experimenting with systems, languages, and technology! Now that’s enough for my introduction. How does this answer the question you may ask, don’t worry, I got you covered! ?

So it was 1st March, and I was scrolling here and there, finding interesting organizations that align with my interests, etc. I shortlisted them, but it was ScummVM, the one and only one to which I decided to actively contribute in and submit a proposal! GSoC permits 3 proposals, but I couldn’t care less because what I found at ScummVM is something that just hooked me up to the community of these crazy game porters!

Listing some things out

The Vision

The Vision of ScummVM and what they are trying to build is so cool that it just attracted me to view their project out and consider contributing! What else could be cooler than something which allows me to play old games ? Look its GAME, I repeat, It’s GAME!!!

For someone like me who played lot of old school RPG games in childhood and have attachments to many of them, I could see why I instantly checked out their project and decided to join discord server of scummvm!

Why in italics? Because that was the most important decision I could take, just joining the discord server and introducing myself in #gsoc-channel resulted in a series of cascades of events that resulted in me writing this blog post!

Explaining better in next:


I cannot stress this out enough, I joined server out of enthusiasm but I stayed because of community, the friendliness of everyone and most important the amazing of a mentor that Sev is!

Who is sev?

If you are associated with ScummVM, I don’t even need to tell you about him, but just in case you have no idea then sev is..

Owner, lead, mentor, and developer for ScummVM (as per discord tags) but for me, he’s one of the best mentors I met till now, from the moment I joined the server and introduced myself in the channel, sev created a separate thread for communications (It was a custom to create a separate thread for each student to avoid spam in main channel) and assigned tasks after some communication! What I really loved about this guy is how he used to treat everyone, with kindness, politeness, and in a friendly way!

and most of all how committed he is to ScummVM, this guy has worked over in this organization for years more than I can count doing my computer science degree.

First Pull Request (Assigned Task)

So I was assigned my first task to implement a wrapper around an external library called mikmod for playing impulse tracker files (basically a very old audio format)! If you couldn’t understand, then don’t worry. Just think of I was assigned a technical task and have to implement an easy feature!

While trying to experiment and work on this, I experienced a lot of troubles, and every time I was gravely stuck, sev helped me out! Finally, after a week or two of tinkering and finishing pr, I got it merged! (With thousands of small code corrections, formatting, changes, etc)

What this first pull request taught me is about code conventions and how strictly it is to be followed!

The codes written for scummvm (and applies are not simply written or programmed. They are, instead, I believe, designed!

While the first pr was accepted, It was the 15th of March already, and I still lacked a lot of preparation, study, and commitment to the organization! Seeing the deadline (4th April) approaching, I decided to one-up my game and start actively working!

Link to merged pr

2nd & 3rd Pull Request

Before 2nd and 3rd pull request, I looked into recommended GSoC projects. I decided to work for the Director engine (after discussion with mentor and finding the priority of what is more needed for scummvm). Finding a goal, I started looking deeply into the director engine and getting some bug fixes, etc. to make me understand the engine before writing a proposal!

In the time span of another 2 weeks (by the end of March), I got another two pull requests accepted, link 1 and link 2

Working was very interesting, and I loved playing games, finding bugs, and fixing them! Not only that, but even the developer documentations are great. What I really loved about ScummVM is about how well-documented their codes are, with such a detailed description of almost everything, It was a lot easier to traverse and find relevant functions, classes, etc!

It didn’t feel like I was working with something that consisted of more than 5 Million lines of code.

But regardless, the journey was fun! I got these two pr accepted and finally wrote out a proposal For which I received a lot of scoldings (Thanks to comic-sans font, never using them again) and suggestions!

The Submission

It was the 4th of April, 2023, I double-checked everything and finally submitted it through the GSoC portal!

What I had to do now, is to wait!

The Result Day

It was the 4th of May 2023, as you have guessed right! The day when the accepted contributor’s list is out! This was the day I was very anxious about, being pessimistic I was hoping I could get selected and contribute to ScummVM during the summer vacations!

Finally, the results were out, as usual, the GSoC dashboard site was crashing and I was very anxious trying to open it and checking my emails every second, in the end since it was quite late in my country, I went to sleep giving up, thought wasn’t selected or so I thought, some one hours and minutes later I got an email from Google informing about my proposal being selected! This was a very happy moment and my friends around me were shouting and cheering for getting it!

Now I know that getting selected and completing the project is a different thing, but I plan to stay committed to this organization and finish all the deliverables, passing the project with flying colors!

The End

Thank you for reading this so far, This was just a small excerpt of events happening around me, but I very strongly believe that this is just the starting! For now, expect more blog posts every week following my adventures!