Tech Stack and Why I Chose It
- FastAPI: It's fast, simple, and building APIs enjoyable. It was a perfect match for this project.
- WebSockets: Pictionary needs real-time updates for players, and WebSockets provide just that. They made the game feel alive.
- RedisJSON: Keeping track of game states and player data was simple with RedisJSON. It stores data in a structured format and is lightning fast.
- Docker: To make sure the app runs consistently on any system, Docker came to the rescue. No more "it works on my machine" issues.
When designing this backend, I focused on making it simple and fun for players to use. Here's what it can do:
- Create a Room: Imagine setting up a space where friends can join in. With just a click, a new room is created, waiting for players to hop in.
- Join a Room: Joining a game feels like walking into a fun gathering. Players pick their names and dive right into the action.
- Real-Time Gameplay: This is where the game shines. Drawings and guesses happen instantly, as if everyone's sitting in the same room. The excitement builds with every guess and every new sketch.
- Game Info at a Glance: Players can quickly check the leaderboard, see how many rounds are left, and keep track of the game's progress without missing a beat.
Every feature was built with one thing in mind-making the game fun and easy to play.
Challenges Faced and Lessons Learned
No journey is complete without some bumps along the way. Here are a few challenges I faced:
- Keeping Everyone in Sync: Making sure all players see the same updates in real-time was tricky. After some trial and error, managing updates with WebSockets worked. (I realized later that choosing the WebSocket library was a mistake. Handling session IDs was quite complex with it, while a library like Socket.IO could have made this process much simpler.)
- Handling Game States: Storing and updating player scores, room info, and game progress needed careful planning. RedisJSON turned out to be the hero here.
- Setting Up Docker: Getting Redis and the backend to play nice in their containers took some tweaking, but it was worth it to have a smooth deployment process.
Each challenge taught me something new, making the project even more rewarding.
The app is currently in development, but deployment will likely involve platforms like AWS or DigitalOcean for their scalability and ease of use. With Docker, everything runs smoothly, no matter where it's deployed.
- Real-time applications are challenging but incredibly rewarding to build.
- The right tool selection we can simplify even complex tasks.
- Docker is a must-have for seamless deployments and consistency.
You can find the code for this project on my GitHub: https://github.com/Kaushik13k/pictionary-game. Check it out and feel free to explore, star!
I'm sharing my progress as I go. If you're curious, follow me on linkedin: www.linkedin.com/in/kaushik13k
Stay tuned for more updates, and let me know what you think about the app so far. 😊