Making Accounting with EmmaPosted
This is the first game I've ever polished. I've made throwaway efforts before, but for Accounting with Emma I was motivated to produce an appealing and useful resource for people trying to understand accounting. Polishing meant having decent graphics and music, flourishes with hints, sound effects and animations, and a story with beginning, middle and satisfying end.
Where I work, everyone benefits from having a grasp on the basics of accounting. I'm far from expert but I know enough to teach newcomers. I've noticed that we grok the concepts faster when a) any example transactions form a narrative describing a sequence of semi-realistic business events, so that the person can relate what's happening to the real world, and b) after each transaction they observe how that transaction affects the balance sheet, which is a snapshot of the health of the business's finances.
I grew fond of using the Ledger plain-text accounting tool to create my example narrative and resulting report, but for people uncomfortable on the command-line Ledger can be overwhelming.
That's when I read Phil Hagelberg's post describing This Is My Mech, a TIC-80 game put together by Phil and Emma Bukacek. I had followed Phil's blog post journey into game development, and came away motivated to try the Fennel language and the LÖVE framework. I loved Bussard especially, but felt that producing something as good was beyond my capabilities. But with This Is My Mech on TIC-80, I saw a Fennel platform with a lower barrier to entry that would still give me a fun, quality result. Perhaps I'd learn to use the music tracker too.
I am a longtime Emacs user. Emacs Lisp led me (via Paul Graham's ANSI Common Lisp book) to Clojure, but in both languages I've only ever tinkered on the sidelines. Writing the game in Fennel (a Lisp that compiles to Lua) was a chance to really write some Lisp. I found writing Fennel for TIC-80 in Emacs as joyous as those other Lisps, and after a while I forgot about the chore of having to restart the game after each edit (I used a Makefile and
M-x compile/recompile). I pinched structure and idioms from technomancy's games and referred to Programming in Lua and the fennel-lang.org website regularly.
I was keen to try out Lua coroutines, which are a mechanism for cooperative multitasking (concurrent tasks that willingly yield to one another). Coroutines are used in EXO_encounter 667 to implement the in-game tutorial such that all the tutorial's decision-making code remains together as a cohesive unit, rather than being intermingled with the main game code. I used coroutines for Accounting with Emma's puzzle hints. The hint sequence runs continually throughout a puzzle, so arguably coroutines aren't the right tool for the job — I start a new hinter coroutine every time the previous one finishes. Nevertheless I enjoyed learning the mechanics of coroutines with this simple use case.
I underestimated the effort required to produce pixel art. Turns out it's hard, even with limited colours and at low resolution. I got better with practice though. As my ambition grew I realised I needed a more capable tool than the TIC-80 built-in sprite editor. I discovered Aseprite, and with AdamCYounis' YouTube tutorial and a graphics tablet I was able to create the images I wanted, then import them into the game. I followed Pixel Grimoire's pixel art tutorials and the tutorial on pixeljoint.com. I decided to pass on the job of choosing colours that work well together: I grabbed an existing 16-colour palette from lospec.com.
Okay I had the game and pleasing graphics, now I must have music too. I started off by dropping random notes in the TIC-80 tracker. Once I had something slightly above abysmal, I dug out Music for Geeks and Nerds by Pedro Kroger, transferred the notes to a Python listing, and applied musical operations described in the book, like transposition. I tinkered, writing the results to a MIDI file which I sent to a keyboard. I now assume this is how all great electronic music is composed, because the result came out pretty well! At least, I had something memorable that hopefully lands on the right side of irritating.
The best part of putting together the game was getting to combine a whole lot of interests and skills to achieve effects. For example, to animate the fireworks that explode when you progress I had to learn about particle motion, express the formulae in code, figure out how to count TIC-80 'ticks' to determine the time element that goes into each formula, use a Lua iterator to hold the state of fireworks over time, determine which colours of the palette worked best on-screen, and play with sound waveforms to get a satisfying "bang" noise. The constraint of being inside TIC-80 helped limit the size of that challenge for me, and there're obvious nostalgia tingles that arise from the 80s-style game environment.
I hope that when people play Accounting with Emma they get a taste of the fun I had in making the game.