RAVTZN - The Techy Stuff

We're a week into the rating period, so it's time for my customary deep dive into my game RAVTZN, and how I was able to develop it. First of all, I'd like to say a massive "thank you" to everyone who's played and rated the game so far! I will, as always, get round to rating and reviewing the games of everyone who leaves feedback on it.


Decryption

I expected RAVTZN's decryption algorithms to be much harder to implement than they actually were. Well, two of them, anyway. I had to take an Affine decryption method I found online and translate it from Python into Lua because trying to figure it out by myself made my eyes glaze over.

The game stores both the encrypted and unencrypted versions of each signal. Each time you make a change to your selected decryption, the game selects the relevant algorithm, applies the relevant decryption logic to each letter of the cipher text in turn, and combines the outputs into a single "output" string. Finally, the game compares the output string to the unencrypted string and, if they're the same, marks the signal as having been decrypted.

I won't paste all three decryption algorithms here, but to give you an idea, here's the entire code for the Caesar cipher decryption algorithm:

``` function try_caesar() output="" local c=ciphers[cipher][2]

for i=1,#c do local char=string.byte(c,i)

if char>=65 and char<=90 then local newChar=char-rot

if newChar<65 then newChar=newChar+26 end

output=output..string.char(newChar) else output=output..string.char(char) end end

if output==ciphers[cipher][1] then --mark signal as decrypted end end ```

Speech

The game displays dialogue in a similar manner to my LD54 entry, Six Seats Left: one letter at a time, with a static sound effect played as each letter appears to sound like radio static. The sound effect is randomly pitch-shifted a little each time it's played, to better approximate speech, and isn't played if the character being displayed is a space, to approximate short gaps between words. The delay until the next character appears also increases if the previous character was a full stop, approximating a longer gap between sentences.

video248.gif

Visualizer

I've always wanted to try programming some sort of waveform visualizer, and RAVTZN gave me the perfect excuse to finally do so. Of course, RAVTZN's visualizer isn't actually "visualizing" anything - it's just an approximation.

I start with an array of hardcoded values between 1 and 15, indicating how tall each segment should be. On each frame, I loop over each segment and generate another number between 1 and 15, calculate the difference, and move the segment up or down by a fraction of that difference. The result is that the waveform jitters up and down in what is, hopefully, a convincing imitation of an actual visualizer.

video249.gif

Originally this was only going to be visible during dialogue scenes, but I liked the result enough (and thought the UI looked too bare without it) that I made it a permanent part of the background.


And that's everything I can think of to talk about! If you've made it this far, I hope you enjoyed this peek under the hood of RAVTZN's code, and I wish you good luck when the jam results come in!