Experience Fun

GSoC’ 23: It’s a wrap!

Greetings, as you might have already guessed, this is the last blog post for this beautiful journey of GSoC’23, These last 3 months were amazing, and I would like to wrap it up by writing this final report!

My Introduction

I am Harishankar Kumar, a final-year student (at the time of writing), and working past three months on adding more support to the Director Engine, ScummVM implements a kind of Virtual Machines to support numerous engines, In these many engines the one which I was also working to add more support is called Macromedia Director

My work was to implement support for game titles like “Total Distortion”, “Journeyman Project”, “Meet Mediaband”, Now the thing was that ScummVM was already capable of running these titles however there were bugs and glitches which needed to be fixed before labeling these title as compatible!

What’s been done

According to the proposal, “total-distortion” right now is playable, a lot of work has been put into it and many bugs have been fixed. “meet-mediaband” has also progressed quite further due to adding UnDo Me, This in total added fixed lot of bugs, reimplemented core of Director engine and progressed it closer to what the original engine was like!

What’s left

In general, no amount of progress is ever sufficient as new bugs keep popping up, regressions that needs to be fixed, etc! But in my tenure what’s left to do:

  • Total Distortion is yet to be fully playable, many small bugs are yet to be fixed and the end needs to be tested thoroughly
  • Much work is left for meet-mediaband as well
  • Journey Man Project is almost untouched

My work

In short, all my work can be summarized by these blog posts and the PR’s attached with them:

29th May – 31st May

Implementing Mac Styled PopupMenu’s, First PR After GSoC Accepted!

PR Merged – #5005 #5056 #5059

1st June – 30th June

I am a Developer, and I add bugs in Code

PR Merged – #5074

Because spaces should have height too!

PR Merged – #5089 #5100

The Butterfly Effect of Fixing Bugs!

PR Merged – #5107 #5118

1st July – 31st July

The Art of Scaling Fonts

PR Merged – #5125 #5126

Regressions: I make code, then I break code

PR Merged – #5158 #5136 #5152 #5153 #5156

It’s not you, It’s me!

PR Merged – #5163 #5164

Creating sandwiches in Total Distortion!

PR Merged – #5191 #5190 #5176 #5178 #5196

1st August – 21st August

A background window

PR Merged – #5221 #5216 #5233

Reading Books in Total Distortion

PR Merged – #5182 #5245

The End

It was a beautiful and fun journey, these last three months were filled with endless learning and I couldn’t express how much grateful I am for being given this opportunity! The community is very impressive with lots of helpful members, for anybody looking to contribute, I would totally 200% recommend them!

Moreover, although GSoC is coming to an end however, I am planning to become a member of the Director Engine team and continue my contributions in the future, so expect occasional blogs and my presence in #engine-director channel!

With that being said, here’s the hall of fame, and my heartful gratitude to these people for being part of this project:

Hall of Fame (My gratitude list)

  1. Sev (Eugene Sandulenko) – First and foremost, Eugene, as my mentor, is probably one of the best people who have guided me. honestly, I didn’t expect any learning outside anything related to this organization (ie I expected to learn more about C++ ONLY) but to my surprise, the amount of growth I have seen in myself is surprising to me, in these three months I have learned from basic skills like communication, to how to use git, how to develop efficiently, to even reading gdb stack traces!!I am really thankful for the patience, and for not giving up on me despite so many mistakes, etc! The only reason I got my proposal selected, to complete this project (If I will be passed) will be amazing super-mentor Sev!
  2. My friends and Family – These last three months, I was especially very busy, didn’t pick up anybody’s call, super-duper unavailable! So shoutout to all my friends for understanding this and being there in support whenever needed, I am so grateful for them that here are some mentions to each of them
    1. Sahil Kadiyan – My best roomie who inspired me to work, a source of endless motivation and energy that pushed me through to do something with my career (and that’s how I found GSoC)
    2. Radhika Agrawal – For understanding my unavailability in all these hard times, and for being there for me in thick and thins!
    3. Abhinandan Singla – For managing all the other projects, and academic work, so I wouldn’t feel academic pressure while working for GSoC, He was a lifesaver.

With that being said, I look forward to submission and the final evaluation results! It was a great tenure and I will continue my support to this wonderful of an organization through more long-term contributions!

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 Technical

A background window

Greetings everybody. Welcome to yet another blog post for this week’s work, before starting I would like to express that since my university is started, progress is slowed down! So expect fewer PRs than in previous weeks! (Although trying to catch up on weekends)

So what’s in for this week? This week I am highlighting my work on MacWindows and explaining this new thing implemented that is called “background window”

To understand this, let’s start from the very basics, what is the window for Director Engine?

MacWindows – Why, What are they?

Director engine was first created for Pre-OSX Macintosh computers, thereby the headline being “MacWindows”, so basically, In director we say a window is a place where things happen (ie animations, object movie, you click things) this is like any other typical window that you encounter but with a catch!

They are mac window! Since the original director was built for Machintosh computers, We at scummvm needed to build a subsystem of graphics that wholly dedicate to Mac GUI and elements (ie we simulate a mac-desktop-experience), So we have separate code that mimics the look and feel of MacGUI (buttons, menu, borders etc), these are in “graphics/macgui” folder!

And while simulating the behavior, I mean we build everything from scratch, ie mac styled windows, a window manager that takes care of focusing, switching of windows (for example you click a window and it comes to foreground, etc), We even implement borders and other macgui components, Cool right? I’d say complex!

Now how is this all information even related to Director Engine?

Well… because

Window in Director Engine

Window in director engine uses a derived version of macwindow, and it uses the macgui codepaths for all its events handling/etc related to it! That’s why you can say that our director engine is fully dependent upon macgui for it to work! But what was the problem with existing code?

Well, the problem was…. like any window in machintosh computers, if you click outside window, it will lose it’s focus, if you have two overlapping windows and you click one of those, then one window will come foreground and hide another window! And that exactly was our problem!

There were some lingo commands where multiple windows were to be created in game, now it was all good and fine when there’s only one active window, however the moment we switch to multi-window environment we observed a peculiarity, that is: the hiding of windows due to director engine!

Since both director engine and the newly created window are same kind of windows, therefore if you click on director window anywhere except newly created window, then it will hide in the background (Couldn’t understand? See the gif below!)


The Fix? It was simple, to declare the main director window as a kind of background window, so when you click anywhere in background window, it doesn’t make it comes front of other windows on screen! This simple change fixed it all and the final result was:

See how the window is no longer hiding when clicking on title “ball” button? Well, there ya got it!

Link to PR – #5221

More work this week

Scoped and Scopeless Lingo Score

This was a problem with old (pre D4) created movies when used in Director 4, since previously there was scopeless lingo commands, and now director have scoped window, therefore there was some behaviour mismatch, It was fixed with some debugging.

Link to PR – #5216

Improve checking for recursive enterFrame

This was a problem with how checks for how many recursive enterFrame is called was performed, in director 4, you can have at most depth of 2 enterFrame calls, any more and it will ignore the handler! This was previously implemented with counting frozen lingo states, which was not enough to identify since lingo can be frozen for other situations as well.

Fixed it by having proper checking and counting of number of enterFrames in callstack.

Link to PR – #5233

The End

Thank you for reading so far, I hope it was a good read! As usual apologies for any grammatical/writing mistake, do comment our your honest suggestions/thoughts on this and with that being said, see you next week!