Backend server for Canvas
It's a platform meant allow people to interact with a global game (app). The app is identical and runs in one cloud computer, which broadcasts the app state to all user, and receive inputs from all connected users.
Users can interact with the app by clicking on it, in the simplest app "place" users can toggle the color of pixels in a grid. In the "space invaders" app, a game of space invaders runs, and users can click on either human or alien space ship to make them shoot rockets, or place shields to block rocksts. The username that "owns" a particular element is also kept and broadcast, so that the front-end can display it as opportune.
Currently, apps should abide the following Python interface and can be written however you'd like. The grid size is supposed to be small (space invaders is 64x64 pixels). A large grid (i.e. 1000x1000) would not scale well since the server broadcasts the entire grid state at every update. This limitation can force the apps to be simple and with a generally low refresh rate (<10fps). The main idea is to have users collaborate (or compete) in a long-running game.
Canvas is my pet project to learn about back-end (mostly) and front-end (a little) development. Technologies I touched on (which may not be present in the current implementation) are:
- Firebase authentication
- Firebase realtime database
- FastAPI
- NGINX
- Docker
- WebSockets (WS and WSS)
- HTTP and HTTPS
- Google Cloud computing services (Firebase, CI/CD, Cloud Compute, Cloud Run, Cloud Build, ..)
- Digital Ocean computing services (Droplets)
- Git submodules
This repository contains the back-end code that runs on a cloud computer (Digital Ocean rocks!). For the front-end part, check out the Canvas repo.