Overview
LetterCore is a word puzzle game combining falling-tile mechanics with a real-time word detection engine. Letters fall from the top of the board and must be arranged into valid dictionary words. The engine scans the board in four directions on every frame, highlighting valid words as they form and scoring them when completed.
The game includes a full feature set: Story Mode with a narrative arc, Rogue Mode with procedural power-up selection on level up, global leaderboards, a custom tile theme store, and a dictionary sourced from a curated word list.
Game Architecture
LetterCore is built in vanilla JavaScript with no game engine dependency. The game loop runs on requestAnimationFrame with a fixed-timestep physics update. The board state is a flat array of cell objects, each holding a letter, a type flag, and a set of active word-match flags updated every frame.
- Real-time four-directional word scan running on every update tick
- Custom dictionary with over 170,000 valid English words, loaded and parsed on startup
- Story Mode with scripted level sequences, boss encounters, and cutscene events
- Rogue Mode with procedural power-up selection at each level threshold
- Global leaderboard backed by a REST API with score validation on the server
- Theme store with purchasable tile visual sets persisted to LocalStorage
- Hint system that surfaces valid playable words from the current board state
Word Detection Engine
The detection engine runs a scan from every occupied cell in four directions: horizontal, vertical, and both diagonals. For each direction, it builds a candidate string from consecutive filled cells and checks it against a trie data structure built from the dictionary at load time. A trie lookup is O(k) where k is the word length, making it fast enough to run the full board scan within a single frame budget even on mobile.
Words of three letters or more are highlighted in real time as the player moves tiles. This gives immediate feedback on whether an arrangement is working before the player commits to a placement.
Rogue Mode
Rogue Mode uses the same core loop as the standard game but adds a meta-progression layer. On reaching a score threshold, the game pauses and presents three randomly selected power-ups. Power-ups modify the game rules for the remainder of the session: extra time per word, bonus tiles, score multipliers, or special tile types that trigger effects when used in a word.
The procedural selection is weighted by run length so early power-ups are broadly useful and later selections are more specialized and higher risk. The system is designed so no two Rogue runs play identically.
What I Learned
Building a dictionary-backed word game taught me more about data structure performance than any other project in this portfolio. The naive approach of searching a sorted array was too slow by an order of magnitude once the dictionary exceeded 50,000 entries. Implementing a trie and seeing the scan time drop from 18ms to under 1ms per frame was a direct lesson in why the right data structure matters more than algorithmic cleverness.




