Game hub
The game hub lets Commodore 8-bit programs play together over the internet. You write the game. The hub does the networking chores: logging players in, lobbies with chat, matchmaking, passing messages between players, turn-based play that can stretch over days, leaderboards and saved data.
The protocol is plain TCP and text lines, so a BASIC program can take part
with PRINT# and INPUT#. Machine-language and cc65 programs can also use
compact binary frames.
New to all this? Start with a guided tour: a gentle walk through how the pieces fit together, with small examples you can try.
What you can build
| Kind | What it is | Examples |
|---|---|---|
| Live match | All players are connected at once. The hub passes their messages along as they come | Tic-tac-toe, a card game, a simple real-time game |
| Turn-based match | The hub stores the match. Players take turns and may be offline in between, for days if the game allows. A returning player gets the moves so far | Chess by mail, battleships |
| World | A persistent space run by a game server of your own. Players drop in and out. Players in the same place see each other and can chat | A multiplayer text adventure, a MUD, a cooperative puzzle |
Every game gets a lobby, chat, quick match, invitations and hosted tables, an automatic wins board for matches, up to 8 leaderboards of its own, and a little saved data per player. Results, leaderboards and achievements show on the game's page on commodoreonline.com.
Which devices work
Anything that gives a Commodore a TCP connection can talk to the hub. The ready-made software, playlib and the text client, runs on these machines:
| Machine | Devices |
|---|---|
| C64, and the C128 in C64 mode | A Flyer, a modem on the user port, a SwiftLink |
| PET with BASIC 4 (the 4000 and 8000 series, 40 or 80 columns) and 32 KB | A Flyer, on the IEEE-488 bus |
| VIC-20, and any other machine with a Flyer | No library: BASIC programs on the Flyer's tcp: channel, which suits turn-based games (a guided tour shows how) |
The devices:
| Device | How it connects |
|---|---|
| Flyer | Its tcp: channel, from BASIC or through playlib, on the C64's serial bus or a PET's IEEE-488 bus. Works on every firmware, 1.2.2 included |
| WiFi modem (Zimodem and others) on the user port | Hayes dialing (ATDT host:port) through playlib, at 300, 1200 or 2400 baud (playlib finds the modem's speed) |
| WiFi modem or other Hayes modem on a SwiftLink (C64) | The same, at 19,200 baud |
| User-port RS-232 to a PC | A PC program that answers Hayes commands and makes the TCP connection, such as tcpser. To playlib it looks like a modem |
| WiC64, Ultimate 64 and II+, Ethernet cartridges, others | Possible with a playlib driver for the device. None is written yet; the driver interface is documented so anyone can add one |
Flyer owners can use tcp: today, with no firmware change. The modem drivers
were tested against an emulated modem; modems differ in their command
dialect, so see playlib's notes on modems.
The library, playlib, hides the differences: the same program runs on each device by loading a different build of the library. A PET has a build of its own, at other addresses (playlib's page).
How the pieces fit
your Commodore program the hub your game server
(BASIC, ML, cc65) play.commodoreonline.com (optional)
| | |
|-- TCP port 6502: text ------>|<------ TLS port 6503: -----|
| lines, binary frames | JSON lines, |
| | the server dials in |
- Your Commodore program connects to
play.commodoreonline.comon port 6502 and logs in with a play token and your game's id. - The hub runs the lobby, forms matches, relays messages between seats, stores turn-based matches, and keeps scores and saved data.
- A game server is optional. Write one when a game needs rules on the server side: a referee that checks moves, hidden information such as a card game's hands, or a whole persistent world. The server connects out to the hub, so it can run anywhere, with no open ports. SDKs exist for Go, Python and C++.
- The website is where members get play tokens, register games, and see results and leaderboards.
The pages
| Page | What it covers |
|---|---|
| A guided tour | The whole system, slowly and from the beginning, with examples: start here |
| Getting started | A play token, registering a game, and a first BASIC program |
| The Commodore protocol | The reference: lines, frames, character sets, every verb and reply, matches, worlds, error codes |
| playlib | The library for the C64 and the PET: BASIC, machine language and cc65, drivers, the session, the keep-alive |
| Text worlds | The ready-made text client for the C64 and the PET, for players and for authors of text worlds |
| Game servers | Writing a server: the model, the protocol, server keys, achievements, and the SDKs |
| Downloads | playlib, the text client, the lobby and the examples; the SDKs; the development hub |
