Inspiration
As we have all been forced to quarantine in our homes due to the Covid-19 pandemic, many of us have sparked social connection through playing online games. We decided to pick Rock, Paper, Scissors as it is a simple, international game that can be played without any installation or costs.
What it does
This web app allows users to play rock paper scissors with a real time queuing system and chat room. Users can chose between playing against the computer or against another player. If they chose playing against a player, then they will be queued to join a room. Once in a room they can play as many rounds as they like and are free to direct message their opponent in the chat box. The player's game stats are displayed at the top of the site and will be automatically updated in the stats page. If the player chooses to play against the CPU, then they will have the game start immidiately. In this mode, users can only message the global room where all online players can view the messages. Users can use the toggle switch to pick if they want to talk in their room (grey) or globally (white).
How we built it
We used Flask and Jinja to build the basic website itself. For the frontend, we used Jinja, Javascript, AJAX, and jQuery. For the backend, we used Python, Flask, and Socket.io. To monitor our site after it's deployed, we implemented cAdvisor, Prometheus, Grafana. Our game allows users to register and login to the site if they want to save their game statistics (Wins, Losses, and Draws), and displays them on the user's stats page. For this feature, we used MongoDB as our local database to do so. We have containerized the flask app, mongodb database, nginx, cAdvisor, grafana, and prometheus. RPS is hosted on an AWS EC2 instance.
Challenges we ran into
One thing we had difficulty with was getting Socket.io to work with nginx. As all of us were new to Socket.io and have never used it with nginx before, this is was a challenge. We needed Socket.io and nginx to work together for both the chat function and for dockerizing the game. In addition we were challenged by the fact that we ended up using a lot of new technology and learning how to use it in such little time (eg Socket.io, MongoDB).
Accomplishments that we're proud of
We are proud to have gone through the entire process during these three Sprints. It is an accomplishment to watch the project grow from a couple of ideas to a Minimum Viable Project to a fully deployed Flask app that works at this scale. Apart from completing it within the time frame and meeting the requirements, making a fully functioning multiplayer game with a chat feature is another accomplishment.
What we learned
During these few weeks we learned how websockets work for the chat feature in Player vs Player Mode. Those of us that have done a lot of front-end in the past, have learned some more back-end, and vice versa. We also used new monitoring software apart from cAdvisor.
What's next for RPS
Hopefully in the future we would like to try and add AI to the Player vs CPU part of the game. The AI could have different difficulty levels (easy, medium, and hard) that players can challenge themselves against. Levels of higher difficulty could make game choices based on the players previous choices to strategically win. Another feature is being able to see other players stats, and follow your friends so that you can easily play together! We also want users to be able to upload their own profile pictures and use cheat codes in the game (i.e. by typing codes into their Room Chat).
Log in or sign up for Devpost to join the conversation.