AWS Logo
Menu
From Idea to Game: Building Two Words, One Letter Apart

From Idea to Game: Building Two Words, One Letter Apart

Two Words, One Letter Apart challenges players to solve word puzzles. Amazon Q Developer was the hero, enabling rapid development as an indispensable partner.

Published Jan 12, 2025

1. The Game in a Nutshell

Two Words, One Letter Apart is a fast-paced, brain-teasing word puzzle game where players guess pairs of words that differ by only one letter. With each correct guess, players earn points, race against the clock, and climb the leaderboard to showcase their linguistic skills.
The objective is to identify both words that fit the hints while differing by just one letter.**** For instance,
Garment for the foot - SOCK
Merchandise kept on the premises - STOCK
The two words, SOCK and STOCK, differ by only one letter! This simple twist makes each puzzle fun and challenging.
FrontEnd Code Repository : https://github.com/mohaksnghl/puzzle-app

2. The Tech That Powers the Fun

System design diagram
  1. AWS Amplify : Hosting the frontend React application and managing continuous deployment.**** The React app was deployed to AWS Amplify Hosting.CI/CD pipelines were set up using Amplify’s integration with the GitHub repository. This ensured automatic deployments on code updates.
  2. Amazon DynamoDB : Storing game sessions and leaderboard data.**** A table was created to store game session details, including userId, sessionId, playerName, startTime, endTime, and score.
  3. AWS Lambda : Backend logic for game session management and leaderboard functionality. Game Session Management Lambda - To create or update game sessions in DynamoDB. Leaderboard Lambda - To fetch leaderboard data and calculate high scores. These functions were triggered via API Gateway.
  4. Amazon API Gateway : Exposing RESTful APIs to communicate between the frontend and backend. APIs were set up for game session creation, updates, and fetching leaderboard data. Secure integration was established with Lambda functions to handle API requests.
  5. Amazon S3 : Storing static assets and game configuration files. A JSON file containing word pairs and hints was stored in an S3 bucket. Audio files that are used in game to enhance the gameplay user experience.
  6. AWS CloudWatch : Monitoring and logging application activity. Logs from Lambda functions were routed to CloudWatch for real-time debugging. Metrics like API latency and DynamoDB read/write capacity were monitored to ensure performance.

3. A True Development Partner - Amazon Q Developer

From drafting the first lines of code to debugging the final implementation, Amazon Q Developer was my co-creator. It turned what could have been a weeks-long effort into a streamlined 24-hour development sprint, helping me deliver a polished game that’s both fun and functional.

3.1. Frontend Development: Crafting an Intuitive User Interface

The frontend was the first step, and Amazon Q Developer made building a responsive, engaging UI effortless.
From Scratch: I asked Amazon Q to
"Build a React component for a word puzzle game with two input grids, one for each word."
User Experience: I wanted dynamic updates for scores and animations. My query:
"How to animate score increments in React?"
Custom Inputs: To enhance usability, I needed input boxes to behave in specific ways, like focusing on the next box automatically. My query:
"How to handle navigation between input fields dynamically in React?"

3.2. Backend Development: Building Robust Serverless APIs

The backend required creating and managing game sessions, storing high scores, and retrieving leaderboard data.
From Scratch: I started with
"How to create a Lambda function to save game session data in DynamoDB?"
Leaderboard Functionality: Retrieving unique high scores for the leaderboard was challenging. I asked,
"How to fetch top scores for unique users from DynamoDB, excluding guest players?"
Error Handling: Debugging became seamless. For example, when encountering data type issues in DynamoDB, my query was:
"How to handle Decimal types in DynamoDB when converting to JSON?"

3.3. Word Pair Generation: Adding Game Content

The game required a large dataset of word pairs where two words differ by just one letter. Instead of manually creating them, I leveraged Amazon Q Developer.
Dynamic Content Creation: My query:
"Generate word pairs where two words differ by one letter, with hints for each word."
JSON Formatting: To store the data, I asked:
"How to save word pairs in JSON format for S3 storage?"

3.4. Debugging: Turning Errors into Lessons

Every error became an opportunity to learn.
Common Pitfalls : Whether it was fixing navigation issues in React or resolving DynamoDB ConditionalCheckFailedException errors, Amazon Q turned cryptic errors into clear, actionable steps.
Iterative Problem-Solving: For example, my query,
"Why is my React component re-rendering unnecessarily?"
taught me about dependency arrays in useEffect.
Amazon Q Developer was instrumental in bringing "Two Words, One Letter Apart" to life. From brainstorming and coding to deployment and optimization, it acted as a co-developer, streamlining every aspect of the game’s creation.

4. Conclusion: Turning an Idea into Reality

Two Words, One Letter Apart came to life in just 24 hours, made possible by the incredible capabilities of Amazon Q Developer and AWS services. From generating word pairs to building the frontend and backend, and even debugging and deploying, Amazon Q was a game-changing collaborator at every step.
This project demonstrated how modern tools can simplify development, allowing me to focus on creativity and gameplay rather than technical roadblocks. The result is a game that’s fun, engaging, and a testament to the potential of AI-driven development.
 

Comments