// THE SERVER //
The magmacrunch arcade runs on a Raspberry Pi in a closet, which hosts every game server and the chat around the clock. Nothing runs on a cloud service or a hosting provider.
Everything talks over WebSockets, so your browser keeps a live connection to the server while you play and moves and messages arrive as they happen, without the page reloading or asking again.
// MULTIPLAYER //
The multiplayer games each run their own server process on the Pi. When you create a room you get a four-letter code (like A3X7), and a friend who types it in joins you from wherever they are.
A room holds up to six players, and anyone else with the code can watch. The server keeps the rules and the state of the game; your browser sends your moves and draws what comes back.
Multiplayer games:
- Cribbage: the classic card game, 2 players
- Backgammon: blue screen edition, 2 players
- Checkers: phosphor edition, 2 players
- Scandinavian Stud: five-card stud poker, 2–4 players
- Chinese Checkers: hex-grid classic, 2–6 players
- Parchisi: indian cross and circle game, 2–4 players
- ..and more (in the private arcade)
// THE CHAT //
The arcade page has one chat room for everybody on it.
A multiplayer game has a second, private chat for the people in that room.
The "MULTIPLAYER ONLINE" light on the arcade page comes from the chat server too: every 30 seconds the page checks that it can reach it over HTTPS.
// PLAYING //
1. Open a game.
2. Click "Create Room" to start one, or enter a friend's
four-letter code to join theirs.
3. Wait for the others to join, or start at once if you are
playing the computer.
// THE TECH //
The pages are plain HTML, CSS and JavaScript with no framework, and each game is a folder of its own. The newer games load adenosine, our own game engine, as a prebuilt script.
The servers are written in Python using the websockets library. Newer games share a common server base that handles rooms, lobbies, and player management, so each game only needs to implement its own rules.
// SECURITY //
All traffic goes over HTTPS, with Let's Encrypt certificates that renew themselves, and a firewall on the Pi blocks every port it does not use.
SSH accepts keys only, and fail2ban bans addresses that keep guessing. Admin interfaces are password-protected, and config files are restricted to owner-only permissions.
// PRIVATE ARCADE //
Some games live in the private arcade, behind a password. If you have it, enter it when the arcade asks. Ask Jake.
// MAGMA//OPS //
The arcade is run from MAGMA//OPS, a dashboard on the Pi that watches the servers and manages the high scores, chat history, jukebox, TV channels and themes.