I am very excited to announce that I've built a gaming platform powered by Twilio SMS & Node.js!
That's right. Sounds impossible? Well, more on that part later. Essentially, the user can choose between 2 modes in which he/she wants to play. Each mode has it's own features/commands.
Commands allow a user to perform an action. This concept is inspired by Telegram's bot commands. Each command has this format: /<letter>
Some examples of commands that the platform exposes:
- /s - switch to the single-player mode
- /m - switch to multi-player mode
- /h - help message explaining available commands in the current mode
In the single-player mode, the user can choose a game to play by typing its number.
At the moment, the single-player mode has 5 games to choose from. The platform is extendible so if you have a game idea that is a perfect fit for SMS gaming style, feel free to submit the PR and expand our collection. 🤝 You can read the platform architecture and guide on contributing here.
Multi-player mode doesn't have any games by default.
The reason why multi-player mode was made is that it allows users to be creative. They are not limited to X number of games to play. They can create their own game, invite their friends (or make new friends!) and have a great time like Vladimir and James down below. 🎉🎉🎉
As you can see on the first image, Vladimir uses /c command to create a game session. He enters the name of the game and the number of users the game can have.
We have James on the other side. James has switched to multi-player mode and uses /g command to check if there are any game sessions available to join. He sees Vladimir's game session and joins it with /j command. As each user sends a message, the platform broadcasts them to other players. Just like a WhatsApp group! They can quit the game with /q command.
After they quit the game, they can do whatever else they want to do! Create another game session, list available game sessions, join them, switch to single-player mode. Lots of possibilities!
To be honest, it was a bit challenging. The codebase itself is not very large (1000+ LOC), but there is a lot of state... cough, cough, session management going on behind the scenes. I wanted it to be as simple as possible so everything is stored in memory. This is great because it's a live chat and users want response FAST.
I've left out Redis/Memcached/<put something in here> on purpose because it would add a bit of complexity to the project and also make it harder for everyone to try out. The detailed platform architecture is explained here.
At the end of this post, I want to thank DEV and Twilio for sponsoring this hackathon. The project was fun to build, and I am looking forward to more hackathons in the future.
Have you participated in hackathon & what do you think about my project?
I would like to hear your thoughts in the comment section.
Thank you for reading and bye till the next time!