It’s a Poor Craftsman Who Blames His Tools
February 14th, 2018
Also, chocolate.
I continue to have nothing really to talk about for the midweek doldrums of this season, which I suppose brings us ever closer to the day I do a real full review of Baldr Sky Dive 1, which will undoubtedly feature the phrase "Thank god for that cabal of benevolent interdimensional wizards watching out for us" as well as a full review of every single major plot point/event directly copied from Force, but not today. I still have things in my translation folder that I can look at and enumerate thoughts that I at least find interesting. Today, we're observing my Python script folder, where I have accumulated quite the little toolbox of scripts for accomplishing various things over the years, all written by me, personally. I would highly suggest any VN translator learn at least some basic scripting language. It takes about 0.01% the time to do yourself what it can take literally months begging and wheedling a hacker to do for you.
So, let's play the game: "Can I Remember and Identify What All These Scripts Were For?"
Duel Savior/Xross Scramble
SUPER_COMBINE
–DictDSJ
–DictPS2
–remapGraphics
–remapTags
–remapVoices
–importTaiga
linebreakDS
All of the above were a set of scripts (SUPER_COMBINE being the master orchestrator) designed to rectify the structural differences between the PS2 versions of the scripts and the PC version. For example, all the voice line IDs were different, and it looked up graphics by an internal table, so any given graphic (eg a background, or a CG) was likely to have a different ID between the two. The two Dict scripts are basically identical, aside from the input, and created relatively hefty dictionaries mapping graphics to characters, lines, etc. The remappers then used that information and modified the PS2 versions of the scripts to have the same graphic IDs/tag formats as the PC version. The voice remap also renamed all of the PS2 voice files into the PC format. The Taiga importer added the command to play his voice from the PS2 version into all the PC version's script. The linebreaker just adds linebreaks, which is still complicated since the text window size is variable width and the script has inline command codes that need to be ignored, but it's not glamorous.
Seinarukana
DictSei
–getSpeakers
–applySpeakers
–getNtags
–applyNtag
–getSaveTitles
–applySavelabels
–fix_indent
Ooookay, let's cut that off there and split this one up into multiple sets because this got out of hand. As I believe I mentioned, when I began on Seinarukana, we were using the old fan made tools. Actually, I translated the whole script on those. It wasn't until after I finished that we got actual dev tools which revealed a ton of issues with the original tools, mostly in the form of things that had gotten missing or corrupted. I had to do a pretty similar thing as with Duel Savior in importing the translated text from one script format to another. I don't quite remember what was funky with the speaker and name tag stuff (and don't care enough to go looking into my logs to find out), but I'm fairly certain those were part of the information that got lost/corrupted. Save labels were missing entirely from the original scripts.
MASTER_PACK
scrapeSei
Master_Pack was simply a utility script that ran the dev script compiler, copied the output into a working area, and ran the packager, and then apparently renamed the file to the proper extension. The scraper just counts output by character for length measuring purpose.
createSkillList
buildingExpl
createSkillDupKey
skillDescSheet
applySkills
copyImages
This abject mess of things is because Seinarukana has an absolutely staggering amount of text that isn't actually text at all. It all exists inside of images. Basically all of the status screens and gameplay things are images masquerading as text. To that end, I created a bunch of ginormous spreadsheets that held the text and then wrote scripts that converted those spreadsheets into sets of a bazillion Photoshop files… followed by Photoshop scripts (not included) for converting those into the final images. I can't quite remember why I didn't just do it with ImageMagick. There was something funky about the image format, or some kind of post-processing that I couldn't get to work right. The bottom two are outliers, but related. applySkills was used to rectify the translated skill strings (off in their own files) with the spreadsheets, and copyImages was for creating a faux second page if and only if a skill description didn't have one… for weird technical reasons I don't want to get into.
createSpeakers
sei_find_calls
sei_rem_voices
sei_rem_cg
sei_rem_stand
Jast at some point asked me to create a trial version for the game. These were for finding the voice files needed and then removing them from the packages. Note that because of a similar table of ID thing as Duel Savior had, and a lack of fully functional tools (or more likely, documentation for them), files couldn't actually be removed, just overwritten with 0 byte file. These scripts created a list of what was actually used in a subset of scripts passed to it, and then overwrote everything that wasn't with a 0 byte file. Jast eventually forgot they asked me to do this, asked me to do it again, forgot about that, and then I don't think there ever was a trial. Probably for the best anyway. I don't think I was ever able to get it to a manageable size.
Littlewitch Romanesque
textGen
combineNameIcon
Seems so much simpler, but that's a lie. While not as bad as Seinarukana, LWR also has a metric assload of text as images. textGen is a master script that takes in ten different formats of internal game files (eg spells, names, etc) and spits out sets of images based on them using ImageMagick for general formatting. combineNameIcon is a helper script for one of those formats (the backlog) that puts the right icon with the text.
LWRAuto
makeCredits
hVoiceRemove
LWR's text bubbles almost all had hard-set dimensions despite 'auto' being an available input. LWRAuto replaced all horizontal and vertical values to "auto." makeCredits is pretty similar to the text-as-image stuff above, but IIRC, a bunch of things could be variable in it, so needed to be more freeform and adaptive, and less matching the existing image dimensions. hVoiceRemove was the only work I did for the non-adult version (and I'm not even sure if it was used in the end). Like Seinarukana's trial stuff, it scanned the given scripts for all the voice files that the game actually used, and then deleted (instead of blanking, since the tools here actually worked) all files that weren't referenced, in this case, the ones being from the sex scenes that had been removed.
And as I look at the number of scripts still stretched before me, my mind begins to recoil. Baldr Sky was something of a minor disaster because its original tools were… a disaster and a lot of pre and post processing had to be done to make sure things were fully functional. And then there were all the internal problems in the scripts that existed by design, because Giga apparently despises the very notions of efficiency and sense. I also created a lot of dictionaries for Bunny Black 2 to make sure translations of items, monsters, skills, etc were as consistent as possible between BB1 and BB2. I think we'll simply leave things off there feeling that my point has been proven.
Perhaps I can get to that in part 2 should this somehow prove to be the most popular things I've written in years, or I need another excuse to stave off a long overdue continued evisceration of Dive 1. I mean, seriously? Interdimensional wizards.
Posted in Unimportant Crap | 2 Comments »
Python is a valuable data munging language. Combined with libraries like Pandas, calling into R, and so on, it’s a very good tool for ETL, automation, and data analysis. Two things I really like to see in employees: good Excel skills (complex formulas, VBA), and ability in at least one scripting language.
In recent years, I’ve been looking for an alternative to Python. You know how people dread the Excel spreadsheets mess in companies? Financial data, important customer lists, etc. being stored in personal spreadsheets all over the place? Now we’re starting to see a mess of Python scripts.
A sturdier language would be nice, but we don’t have anything approaching it. F# is too niche, Julia is focused on numerical problems, Go found a different place to be. Rust is trying to take over C’s space, not Python.
So, Python’s here to stay, and knowing even a bit of it will make you magnitudes more productive.