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(); }
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 -> https://trello.com/c/TllLPBYZ/626-game-save-loading-lingo-parse-error-totaldistortion
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
overhead.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:
Listing out things that were successfully working in total distortion:
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!
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!