Grand Deft Automation

What is automation? Why is it useful? Where can automation help you in your daily digital life? Read on. (Spoiler: Everywhere!)

I can’t tell how much time I have lost by doing repetitive stuff over and over, not just in my game development. How many times have I manually renamed many files by hand, how often have I duplicated, compiled, copied, uploaded and refreshed my executables when there was a patch? How much time of my life have I spent filing and administrating data in general?

Too many times. Too often. Too much.

Doing repetitive stuff by hand means asking for trouble. Humans are not too good at performing the same things over and over again with no margin for error or originality. We get tired; we make mistakes. Checklists, working in shifts, reviewing; those are all measures we take to counter that fact. But that’s not the solution, only a crutch.

The solution is automation; it’s having a machine do that tedious repetitive stuff for you.

There are a great many little tools out there that help you automating most of the daily data-dealing. For instance, there’s ReNamer to batch-rename a number of files, SyncBack for smart mirroring of files, and a lot of others. Software tools are out there for almost any everyday task you want to automate. And you should automate whatever you can.

When to automate.

But where to draw the line? Where does automation bring you a benefit?

I have a little way of finding that out for myself, based on how much time it’ll cost me down the line. Let’s say, for example, I have a bunch of files I need to rename now and then. Let’s assume that four times a month there’s a batch of about 10 to 20 files that need to be renamed. Not a big deal, right? This might take 3 to 5 minutes each. In total that’s 15 to 20 minutes spent renaming per month. Now researching for a tool and configuring it might also take 5 to 15 minutes. But after that, it costs no time at all. I’m sure you did the math yourself: After two or three sessions of manually renaming files, the benefits of automation surpassed tedious labor.

Where to automate.

You also want automation where errors are likely to happen because of some complicated sequence of steps you have to perform every time. In my case, that’s uploading the latest build of my game, Fine Sweeper, to Steam.

I need to save the project to a folder with a very specific folder-name, compile it from there, unzip the result (don’t ask), copy the executable and data files to another directory, perform some magic on the localization files and initiate the Steam submission. If I skip one step, the game will not upload, not load the proper language files or not run at all. Due to lack of sleep this happened more often than it should, as my players can assure you.

As we established, the interwebz is full of useful little tools for almost any everyday automation needs you might have. But when you do a lot of complex and rather specific stuff, you soon reach the point where there are no tools to help you out. Then you break down your steps and tape together what tools you find that partially do what you want in batch files and work some command line magic (Let me tell you, the command line deserves more credit than it gets these days!). Essentially you macgyver together your very own Swiss army knife with a glue gun, a paperclip and two miles of duct tape.

Still, especially in game development there are numerous occasions where automation would be helpful, but there are no tools for it out there, because of your own way of programming, you are the first to have these very special needs. Concocting a viable tool yourself would take much longer than to do it by hand, “just this one time”. But it rarely is. And after four passes of refactoring and clean-ups, you still do it by hand “just this one last time” for the hundred-and-seventeenth time. Grudgingly. And you accept the bugs you know that will pop up somewhere again because of it. This you endure with a stolid countenance. Like a pro. Or that’s what I have been telling myself the whole time.

Tool-up!

Out of necessity, I came up with some in-game tools to convert different data representations, create logs or drop level statistics as .csv, invoked by some key-combination, setting a macro in the compiler or changing a constant. Not very pro, but it works (at least for now).

For my next game, I have a different course of action. Instead of just nailing new features onto what once was a flimsy prototype and to just make it work somehow and move on, I want to really think through the architecture of my code before just hacking something into place as I encounter it. I now know enough about Game Maker and how I code to also be able to estimate where I would benefit from automation the most.

And that’s localization. Localization is a biggy.

Localization-Automatization.

When you have some text-strings, chances are that you keep them in data-structures and access their values via keys, since you can’t hard-code much of the stuff. (At least you shouldn’t). So they need to be in some format that can be read at runtime, like XML or JSON. Last and definitely not least, you don’t want your translators to mess around in the innards of your very own flavor of esoteric file formats.

That’s why I recently started with a GML/JSON/FODS cross converter I code in PureBasic. (If you’re not familiar, FODS is an Open/LibreOffice spreadsheet in XML markup). I put a lot of effort into making this solid at every step because I know I won’t have the time and motivation to hunt bugs in a tool once I’m knee-deep into game development. My goal is that I can just take the GML (Game Maker language) source code with the data structure, feed it to my tool and have it spit out a nicely formatted Excel-compatible spreadsheet for translation; including comments, sections, and examples. When I get a translated spreadsheet back, I can convert it to my custom flavor of JSON or straight to GML-code with one click, again, keeping all comments, sections and even blank lines.

The reason for spending so much time on this tool is that I don’t want to worry about performing open-heart surgery on my source code each time an updated translation arrives or I add a string to the structure.

That’s the goal for now. Once that works sufficiently, there will be a lot of testing. Test often. Test hard. Test with quotation marks, backslashes, null-bytes and ampersands.

Once that’s working okay, I will worry about a custom GUI system. God I hate coding GUI….

Links

Article by Phil Strahl

Phil got released around the same time as the Famicom and has since been constantly updated and bugfixed. Yet still, he considers himself to be in Early Access. Splines have been reticulated.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.