Forbidden Lore Design Diary #13: Stop Hey What’s That Sound

I’m actually diverging from the tutorial a bit to try and fill one of the big holes in the game. There’s next to no feedback, aside from the text scrolling by at the bottom of the screen. If you don’t know what’s happening, it’s honestly pretty opaque.

So I managed to get sound effects in place! Or, rather, A sound effect; if somebody gets punched, there’s a “Thwack!” noise that plays. The important thing is that I set up a framework into which I can insert more sound effects. Coming soon: earth-shattering kabooms, death screams, and perhaps a muffled “Thud!” if you go into the wall face-first.

This was remarkably difficult, and the underlying code is still a work in progress. Apparently, pure Python sound code is tough to come by. Unless I’m understanding something — and it’s entirely possible I am — I’m going to need to install something called “ffmpeg” on my machine. (Which might make things difficult when the day comes that I have to package-up Forbidden Lore and share it with a world starved for clumsy amateurish roguelikes, lol.) Until then, I can’t control the volume, and the game basically pauses while the sound effect plays. So, gotta keep them fuckers short and punchy.

I also added a simple text effects mechanism. Right now, when you punch a dude, not only do you get the “Thwack!”, you ALSO see a big red hashmark briefly appear over whoever got punched! This was surprisingly tricky too, but in this case, it was tricky because I didn’t fully understand the nuances of the code I copied. Basically, I had to really dig in there and figure out EXACTLY which lines were responsible for getting the game to update visually. (For the record, they key line is ‘context.present(console)‘.)

So, for any given audio and/or visual cue I want, I need to extend the “Effect” class which handles the sound and the dirt-simple animation, and then stick an instance of that class into an FX queue in the engine. Then way up in the “main” loop, after all the proper events and actions have been dealt with, it checks the engine’s FX queue and, if it sees anything, pulls it off the queue and plays it. Easy-peasy.

I’ve also been getting in my head a bit about how far I want to go down the ASCII rabbit hole, but I’m currently leaning towards “Pretty far, actually.” Most of the things that I’m concerned about are kinda non-problems as long as I’m the only person playing this game. The graphics suck, but so what? It’s going to be hard as hell to present the information on the spells that will someday be the heart of the game, but who cares? As long as I’m the only one playing this game, I’m the only one who NEEDS to understand what’s happening. “How do I make this game accessible to people who aren’t me?” is tomorrow Pete’s problem. Or next year Pete’s problem. Right now, this is all about learning to write a game. And I am indeed learning.