After attending the Docker workshop run by David, we were determined to build a solution which would solve his guests' arcade machine accessibility problem. So we built a mobile friendly, playable, cloud-powered, event-driven, TLS secure, serverless application to allow users to easily play arcade games.
What it does
The application allows the user to launch retro arcade games inside the MAME arcade game emulator from their phone, without having to worry about any configuration details. The user simply visits the website, taps a game, and plays to their heart's content.
How we built it
The applicaiton is divided into three primary components.
- Web-app mobile frontend (Hosted on GCP Compute Engine)
- Presents user with mobile-friendly UI for selecting which title to play
- Python3 arcade machine listener
- Listens for commands to play and change games
- Google Cloud Platform Serverless Function
- Links web-app frontend and python3 listener via GCP Storage
The Backend is built entirely on Google Cloud Platform.
Typical control-flow looks like this:
- The user taps their favorite game on the webapp, triggering the serverless function to update the GCP Storage object.
- The arcade machine listener polls the GCP Storage object every 4 seconds.
- If the title has changed, or if the server has just started, the listener kills the current game process and runs the newly selected game.
- Frontend is built on HTML5, CSS (Bootstrap) and JavaScipt (JQuery).
- Bootstrap was used for the Carousel with the game titles and for the Game Menu.
- We used jQuery for on click function to send request to start game process on the game icon click.
Challenges we ran into
SO. MUCH. SALT.
- GCP Serverless Functions have less than optimal logging capabilities. (Can't write directly to log?!?!)
- GCP Serverless Functions are not syntactically consistent.
blob.cache_control = "no-cache" # Set piece of metadata as field blob.upload_from_filename(source_file_name, content_type="text/html") # Set piece of metadata as function argument blob.make_public() # Set metadata by calling function on blob # W. T. F.
- Apparently there is a difference between http arguments and http parameters. Firefox and Postman seem to disagree on the precise definitions of both of those terms.
- Didn't have previous experience with Bootstrap nor with jQuery, had to figure out how to use both of them to get the front end working.
Accomplishments that we're proud of
- Actually wrote a 'functioning' GCP serverless function!
- Met every requirement in the NotBinary challenge!
What we learned
Python can be pain
Python on GCP is worse
Python on GCP serverless is hell
It is possible to make a decent enough MVP in a 24 hours
What's next for Quick and Dirty Arcade System
- Hopefully some modifications by David, making it better (websockets?) and getting it to run on the actual arcade box (which we understand runs Windows.)
Frontend menu carousel referenced from W3School, https://www.w3schools.com/bootstrap4/bootstrap_carousel.asp
Thanks to Sam Machin for his help in debugging our GCP Serverless function.