Coding Experience Fun Nerdy Talk Technical

Creating sandwiches in Total Distortion!

Greetings everybody, in this blog I will be going through my work for this week! So first of all like everytime let’s start with title!

Creating Sandwiches in TD!

Well, amazed? Just let me explain what I meant, so in this game of total distortion-win, there is this minigame/feature to create your own food for exploration. Why?

Because the story follows a guitarist who teleported himself to a faraway dimension called “Distortion Dimension”, where he must collect unique sounds and ideas to create his next blockbuster! (And thus make a return trip to earth)! In all of these ventures, He needs to have ample health (including mental and physical prowess), and that is where food comes in! The food in total distortion is created using something called “Food Goo”, and sandwiches are just one of the many things you can craft!

That’s it for background, now when I was playing and testing game, there was this bug where I could not change ingredients while creating food/drinks, and that left me quite unsatisfied (and hungry too, getting to eat only one type!) It has been documented here –

So with a sense of responsibility, I took it upon myself to fix this and with some tracing, debugging.. It has been found that the problem lied to this statement:

do("set sProtein2 = the number of items in sProteinDB")

Here, the up/down keys were not working because of the anonymous script that is being executed inside (ie set sProtein…), Why?

Because in traces it has been found that

varFetch: variable sProteinDB not found

and so, the whole logic short-circuited and the change in items were not being registered! Well after debugging it has been found to be a problem with how Lingo anonymous function execution works inside handler of factory!

The part do(…), is anonymous calling of script, because it dynamically compiles and execute whatever script or command you feed to it at runtime (just like Python’s eval function), and just like that when the statement was being executed, It didn’t have any idea about sProteinDB which is instance variable (or object variable) for factory! Now since the command is executed in a different Context (or background) therefore It didn’t have any knowledge of object variables and thus that error!

The Fix? Well it was easy, I added a simple check that allowed me to share underlying factory context when the call is made to an anonymous function belonging to factory/script! This allowed the function to view/modify factory variables and thus fixed Sandwiches in total distortion!

Now that’s what you will call a YUMMY change!

(Please ignore the sound when sandwiches are created.. kinda gross)

PR Link – #5191

Making Buildbot Happy

This week, I also dedicated some time in looking at director build bot leaks. If you don’t have much idea, I strongly advise you to read the section “Leaks are annoying (and dangerous)” from my previous blog, At that time, I broke things due to not checking for leaks which made Buildbot quite unhappy and complaining however this time, I tried looking into some common existing memory leaks and fixing them! While doing that I came across one where an “Archive” (ie a structure to manage resources used by game) was leaking when changing Shared Cast. Well don’t sweat up technical terms but after like 4-5 hrs of debugging through code and frustrating nights, I finally found the problem and fixed it!

Results? A good spam and buildbot happy!

buildbot reports on discord, green means what has been fixed since last build
me and sev agreeing on satisfaction of the green spams

PR Link – #5190

More work done this week

Rebuild frames when jumping to the current frame

As on-demand frames loading has been finished and merged, new bugs and regressions keep popping up, just like how in Majestic-win there was the freezing when opening game, I investigated this and fixed it up with simple change.

Link to PR – #5176

Fixing black patches in Mediaband

and there was this regression, where mediaband had black patches all around the screen, again after tracing and debugging where could be the problem, It was fixed with PR #5178

Improve screenshots comparison for buildbot

This one is an upcoming feature for our buildbot, as you know currently we don’t have any system to compare screenshots of game, we only run them and see debug logs for any problems, However in some time we will be implementing frame-by-frame screenshot comparison, so buildbot can flag changes that potentially can break graphics, palettes, rendering etc! (Just how cool is that!)

As part to support that transition, I improved the algorithm for screenshot comparison, initially MD5 of image bytes were compared but since this method wasn’t foolproof, I implemented logic to simple compare each pixels of two screenshots and check if they are within threshold or not! PR with change – #5196

…and that’s it for this week! Before ending up

I have something to tell you all, my university will be opening tomorrow, and I really hope that it will not affect my pace of working, or fixing bugs. But as much as hopeful I want to be, there’s no telling about delays, or slowing down in the future! So I hope everyone keeps up with it and keep looking forward to next blog post!

The End

Thank you for reading up, If you are still here with me, I’d like to express my sincere gratitude for reading this up, the support of fellow readers is one of the thing that keep me up and inspire me write creative/fun blogs. I hope it was a good read and like always do forgive me for any bad writing/grammatical mistakes, etc. With that being said, Adios!

One reply on “Creating sandwiches in Total Distortion!”

Leave a Reply

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