Tuesday, March 2, 2021

Text Resources, Magic, and the 12th FamJam

On Sunday, Febrary 28, my family completed our 12th FamJam, marking one year of monthly jams. The result of the jam is Rescue Writer, a typing game designed by my third son. My wife put it well when she said that this game did not capture the family's imagination, but the two younger boys seem to enjoy it. Despite its being unexciting, there were some interesting happenings in the development, and hence, this post.

I wanted to have a word bank that anyone in the family could edit. Clearly, this could be expressed as an array of string literals, but that's an awful lot of wasteful quotation marks and commas. I wanted to just have a plain text file, but it wasn't clear to me how to do that. After some tinkering, I was able to get the WordBank script to behave as I wanted. I created a text resource file—res://assets/wordbank.tres—that is loaded by the script and processed line by line. I am pleased to report that it works well in the editor and when exported to HTML5.

The original version of that script ignored duplicates, which was fine when we had 30 words. As we kept working, though, different people added to the word bank, and duplicates were inevitable. My wife, who works downstairs from me during the jam, sent a message asking if the script removes duplicates. It didn't at the time, but I went ahead and added the lines to handle it: the script skipped over duplicates and printed a message to the console that a duplicate was found. My wife's response was, "That's like magic." 

This was really interesting to me, but I tried not to get distracted by it while actually working on the project. To me, identifying and ignoring duplicates while reading a text file is completely mundane. Indeed, I am having some difficulty articulating how completely uninteresting detecting duplicates is in my conception of software development. The difference in perspectives is fascinating to me. What other things do I take for granted that an outsider would consider magical? How does this impact my capacity to operate in the world or, perhaps, to teach novices? At one point, removing duplicates from a plain text file was likely impressive to me, but now it's just a thing that must be done in order to do something else.

No comments:

Post a Comment