Introduction
Typing Hell was the first big project I did without tutorials, entirely on my own, at the age of 16. Before this, I had followed Fox Den's Java Tutorial for a Space Adventure Game and with the knowledge gained I created my Fireman Game.
The idea for Typing Hell was born while I was sitting in school, brainstorming with my friend Haron about making a fun game within my abilities that I could develop in Java. I came up with a Tetris-like game that combined elements of a type-racer game, thus, Typing Hell was born.
Journey
Preperation
The first step was creating a JavaFX application to display the words. I used an array of Labels, each either containing a letter or being empty, to represent the grid.
Having implemented that, now the fun part - implementing the game logic - could begin.
Game Logic and Physics
I developed a method to insert words into unused positions. Each word was distinguished by a background color, and margins between labels made it easier to understand where each word began and ended, when looking at the screen.
The next challenge was implementing "physics" to make the words drop down like Tetris pieces. However, there was a challenge in distinguishing between adjacent words since the only visual cue was the background color, because the backend / game logic only stored the array of Labels (which included information about the letter / text inside) and nothing more. In hindsight, mixing the game logic and UI like this wasn’t the best approach, as the backend should ideally work independently of the frontend, but it worked - so I count it as a success.
On the same note, the logic to drop and differentiate was implemented using background color and label content. Iterating through each label for each row, starting at a label that is not empty until a color change occurs. For this found word it was checked if it has enough space below for all letters to drop down or not. And that was it, gravity was invented, I felt as if I was Newton.
Design Choices
To make the game visually appealing and playable, I experimented with font size and contrast. The background color was randomized. Because of this, I encountered a problem where bright backgrounds made the text appear illegible.
The solution that I found to work the best was to make the font color dependant on the hue of the background color.
With the skeleton of the game standing, I had to decide on the gameplay goal. I implemented a survival mechanic where the player had to stay alive as long as possible, with words dropping faster over time. Additionally, I introduced a combo bonus system - shamelessly stolen from osu! - to reward accuracy and control beyond just typing speed. The game ended with a screen displaying stats from the round.
Release and Reception
I released Typing Hell on itch.io, and it gained significant traction from a Reddit post. As of 18th September 2024, it has more than 8,000 views and 2,300 downloads. The game was free, but optional donations filled me with joy. The experience of seeing people play and enjoy something I created was unforgettable.
Multiplayer and Leaderboard
I received feedback requesting a multiplayer mode, so I decided to keep learning and implemented it. Using a rented Netcup server, I ran a MySQL server to store game stats and created a website with a top 15 leaderboard. However, due to being inexperienced in working with databases I didn't know a better solution than to have the credentials in plaintext stored in the code. Nonetheless I can proudly say that my server stands unattacked until today, probably due to me obfuscating the code as a layer of protection, because I wasn't that stupid. I see this accomplishment as an absolute win.
I also proudly stand in third place on the leaderboard!
Features (and Bugs)
Word Highlighting
A fun algorithm was implementing a way to highlight the word that is currently being typed. Here I again ran into contrast issue with hardcoding a specific color to display this, so I chose to reverse the hue-adjusted font color. This algorithm simply iterates over all the words and checks if they start with whatever is being typed currently.
Themes
Themes was an idea I had since the beginning, but me still learning about color theory, I just couldn't find a good looking color palette for the background.
A entire background image filling the screen was also a concept I made, but wasn't able to implement. I honestly don't remember what it was that stopped me from implementing it. In a late version I decided to implement a simple theme that switches the color palette to grayscale, and the upside was that here I could show the highlighting better!
Rare Event Words
Just to have some variety and rare special events, each time a new word spawns, there is a 0.3% chance that one out of three special words will spawn. The word to be typed has been difficult on purpose to distract the player.
- Freeze (drops as "{fr33ze}"): Gravity is stopped and no new words spawn for 3 seconds
- Remove All (drops as "[r3moveALL]"): Removes all words on the screen (they won't get counted towards the score)
- No More Spawns (drops as "-NOMORESPAWNS-"): No new words spawn for 3 seconds
Font Scaling
One of the most common bugs reported was the text being incorrectly displayed due to different font scaling across operating systems. This caused the words to become too large, replaced with ... due to space limitations. Some players thought this was a feature, making the game even harder by forcing them to guess the words. So I guess #ItsNotABugItsAFeature is what we take away from this.
Written: 2024-09-19