Inspiration
Our inspiration for this game came from when we found that our school has little to no (depending on printer) security when it comes to connecting to printers on the network. We then thought that the most optimal way to exploit this was to run a large scale printing operation across the entire school. Not large in the sense of pages printed but the range at which they can be printed at.
What it does
This web server runs multiple games at a time in threads called "rooms". These rooms run through 3 phases, starting/interround, inround, and end. In starting, players are put into a waiting room until enough players have joined to reach the threshold. Inround, the server prints a code to a random printer in the CUPS server. The players must then attempt to find that code before the time runs out. New players are still able to join and current players can still leave. Once one player enters the code, the round ends and the room goes into end mode. A congratulatory message is shown to all players and the winner has points added to its user. The room resets back to the waiting room or game after 30 seconds depending on how many users are still in the room. Multiple rooms (4) exist so players can join any room they want. All web pages are live* (*every 10 seconds) updating and the site also works with JS disabled (without live ticking timers).
How we built it
The web server is based on flask. The flask backend starts and interacts with the room threads when appropriate while also serving status, challenge, login and, register responses to the clients. Jinja is used for all HTML page generations, with no other fronend interfaces being used. All CSS is written manually as well (as you can see from some of the jank CSS that was written). Client JS was also written without any libraries being used. CUPS was used as the backend for printing. The software retrieved a random printer using pycups and used the lpr command to send a print job. mongoDB atlas was used to store user objects including their username and score.
Challenges we ran into
We ran into multiple challenges while coding the server software. MongoDB did not want to work until we ran a script that installed certificates onto our computers. Additionally, using Jinja was more difficult to use than we had originally anticipated. It had its own scripting language and expressions that we were not used to and it took multiple tries for our desired result to be properly programmed. As the room threads never ended gracefully (due to lack of time to program), flask itself could never be run in developer mode as it launches itself twice while in developer mode for some reason. We are proud of the backend API that was programmed that detects when players leave a room (either by a timeout after no request was sent or the user navigating to a different page/room on the site). We are also proud of the CSS and HTML that made the website look presentable and not a bare HTML page. We even managed to use pure HTML forms so no JS was required to use the website.
What we learned
During this hackathon we learnt how to use multiple frameworks. One of our team members learnt the basics of HTML/CSS while we both learnt more advanced flask functions in its framework. MongoDB and its integration was also completely new for both of us. CUPS integration was an easy but long integration process as we refused to give up pycups until we were sure the best way was through lpr. Pycups is still used to pick a random printer to use with lpr.
What's next for The Great RIT Printer Race
We need to patch some of the bugs as well as sanitize user input. We also should add a better user system that allows for more customizations and security (like passwords). It is possible we never release the game to production as our school may not be too happy with the waste of paper/ exploiting security oversights.
Log in or sign up for Devpost to join the conversation.