top of page

A few behind-the-scenes breakdowns of programming and game design tasks I've come across while developing games!

Dialogue for one-time NPCs

The NPCs in Milo's Magical Adventure take the form of little cutscenes at the end of levels or in-between worlds, and the player doesn't have any dialogue options— they can either tap through the dialogue or skip it entirely and go to the next level. When designing the NPCs, then, I didn't have to worry about dialogue trees or interactivity. I designed an NPC prefab that had an adjustable collider so that when the player comes within some radius, the cutscene triggers. I also wrote a script which would take a list of strings (dialogue lines) and characters (which would be displayed as a talking-head animation and a character name string) so that every cutscene could be entered simply into the instance of the dialogue panel object in the scene. This made adding new NPCs a breeze, with the only notable tasks being adding importing the sprites for a new talking-head animation.

Turning a txt file into a game

Some of my first game projects were text-based games, and my first methods of coding them involved needlessly intricate if-else trees. I would end up with massive strings for the dialogue in the middle of my code and it got messy. I realized that all my logic was just displaying a string to describe the current gamestate, then offering between 1 and 3 string labels for the options the player could take, then going to the whichever gamestate the player chose. I cut my code way down and made it read from a .txt file which contained although game dialogue as numbered states on a list, paired with the logic for which state each option led to. This method let me create infinitely many text games with the same project template, only worrying about writing a fun plot.

Calculating the difficulty of a word search

For my sudden-death word search game project, the difficulty needs to scale incrementally every time the player clears a level. To do this fairly I needed to take into account which letters were drawn from to generate the board, and how many words in total were possible to find. To find all the possible words I used a depth-first search that referenced all the words in English (barring very obscure words) and cycled through every legal combination of tiles on the board, stopping if it ever came across a sequence of characters (like S-J or O-H-X) that no word began with. Using the list of possible words, I can count both the total amount of words and the average word length to estimate a point goal for the player to hit. At early levels, the letters drawn are quite common and the player only has to find approximately 10% of total words; later, they might have to find 35% with more obscure letters (which tend to create more obscure words).

bottom of page