Inspiration

I am inspired by game like Scrabble and Bananagrams that involve creating words from tiles of randomized letters. There is a creative but competitive aspect to these games. I appreciate how two people will see the same game board of letters but they will see different words within it. This dynamic feature, where each play is never the same, is very interesting. It lets the player be creative with word formation (as long as they are English letters), and it also lets them be competitive against their friends.

I noticed that in some word games, people might get stuck if they have too many vowels or they're just having a hard time with the current letters in their hand. I added a feature that allows the user to remove letters and get new ones, but at the cost of a penalty. This adds strategy to the game, where the user can decide whether or not removing the letter is worth making a new word or forming a longer word. The possibilities are endless in word games and I wanted to create something like that.

What is Word Drop

Word Drop is a fast-paced word game developed for the Reddit Games and Puzzles Hackathon. Built using Reddit's Developer Platform, Word Drop offers a dynamic and engaging gameplay experience for users directly within Reddit communities.

  • Objective: Score as many points in 60 seconds by building words.
  • Gameplay Mechanics: Form words by connecting adjacent letters on a 5x5 game board. Once a word is formed, the used letters disappear, and new letters drop into place, creating fresh opportunities to score. Players can strategically remove single letters to help form longer words. Longer words are exponentially worth more points, adding a layer of strategy to the gameplay.

How we built it

  • Planning Phase: I decided the objective of the game and the main requirements such as the word formation mechanics and scoring breakdown.
  • 5x5 Game Board or randomized letters: I dynamically created a board of letters with randomized letters. The random letters have weights, so that frequently used English letters like "E", "T", and "S" appear more often than less used English letters like "Z", "X" and "Q".
  • Word Formation Mechanic: For each word being formed, I used a dynamic array to keep track of the letters. I calculated the points of each word by using the length of the array. I used a set to maintain the coordinates of the letters in the 5x5 matrix, ensuring that the same letter tiles are not being used multiple times in the same word. I kept track of the last letter used to ensure that I don't reuse it and that the next letter is adjacent.
  • Word Validation: I ensure that only valid English words could be used to score points so I used a set of all the words in the English dictionary and only validate words that are in the dictionary set.
  • Leaderboard: I used Redis to store and manage the high scores of players. When a game ends, the player's score is compared against their existing high score stored in Redis. If the new score is higher, it updates their high score in the database. -Sharing Scores: Utilizing the Reddit APIs, I fetched the current player's username and allowed them to share their scores directly to Reddit by creating a new post in the subreddit. This integration enables players to showcase their achievements. Data Communication: Implemented message passing between the Devvit app (server-side) and the WebViews app (client-side) to handle real-time score updates and leaderboard data. This communication ensures that the game state is consistently updated and displayed to the user.

Challenges I ran into

  • Choosing Between Blocks and Webviews: Reddit provides two ways to embed apps within Reddit posts. I spent a lot of time deciding whether to create a Blocks app or a WebViews app. I preferred the syntax and documentation of the Blocks app and attempted to implement the swiping feature. However, I realized that Blocks doesn't support JavaScript events like mouseup, mouseenter, or mousedown. As a workaround, I transitioned to using WebViews to create a more web-native app on Devvit platform. WebViews allow for more web-native JavaScript functions. This required me to learn about the constraints of each platform and find the best solution within those limitations.
  • Using an External Dictionary API: I planned to use an external API to validate English words. However, I realized that the Reddit Developer Platform restricts API domains, and I would have needed to submit a form to Reddit to use the dictionary API domain. With the time constraints of the hackathon, I was unable to use the dictionary API. As a workaround, I wrote a Python script to read a text file of all English words and convert it into a JavaScript set. The script took the words and inserted JavaScript syntax and commas, resulting in an 80k+ word list embedded directly in the project. This approach also makes sense because it reduces the need to call an API every time the user makes a word. Looking up words in a set within the project is more efficient.

Accomplishments that I'm proud of

  • Implementing Game Logic: I successfully developed the core game logic and game mechanics including word formation, scoring, and dynamic letter dropping on the game board. The gameplay is smooth and dynamic.
  • Leaderboard Implementation: I created a functional leaderboard that tracks and displays the high scores of Reddit users, fostering a competitive environment within the community.
  • Learning Devvit Developer Platform: I learned how to send messages between the Devvit app and the WebViews app, enabling seamless communication and enhanced functionality within the game. I also found a workaround for not being able to use a dictionary API to validate words. This was a main component of my game. The game would not be fun at all without a large dictionary of words so I am glad that I found a workaround that works.
  • Logic for Weighted Letter Distribution: The game would not be playable if there were a lot of Z's and X's on the board. I made the game more fun by writing the logic to have more common letters appear more often on the board. This makes the game more engaging and balanced because players are able to form more words.

What I learned

  • Working with project constraints: I learned that every platform has its limitations, and it is important to know those limitations early. Familiarizing myself with the Devvit platform's capabilities and restrictions allowed me to make informed decisions throughout the project. For example, the swiping feature, where the user can drag the mouse over adjacent letters and form words, is the main gameplay mechanic of my game. I didn't realize until later that the developer platform does not support this for mobile. Therefore, the game doesn't work on mobile because they can't swipe letters without inadvertently moving the screen. If I had realized this limitation earlier, I could have created a workaround or a new game mechanic such as a clicking mechanism with a submit button. I had project constraints in mind for the rest of the development process.

  • Working with Devvit: Reddit's Developer Platform: I gained valuable skills in JavaScript, Redis, and integrating different components within Reddit's Devvit platform. I also improved my problem-solving abilities by finding effective solutions under time constraints. This project taught me the importance of early testing and adapting to project constraints.

What's next for Word Drop

  • Daily boards: As the game gets larger, introduce daily boards with consistent letter banks, allowing Redditors to compete against each other using the same set of letters. This would increase replay value, fairness, and competition.
  • Mobile compatibility: Add a settings menu with "mobile settings" so that the player can switch from the swiping mechanic to a clicking mechanic, enabling mobile users to play.
  • Sound Effects: Add sound effects for word formation. Longer words would trigger longer and more satisfying sounds. This would improve gameplay.
  • Enhanced Leaderboard: Include the longest words to the leaderboard to increase competition among Redditors.

Built With

Share this project:

Updates