xrxs/README.md

45 lines
3.8 KiB
Markdown
Raw Normal View History

2021-07-01 07:45:48 +00:00
# xrxs
`xrxs` is an experimental game server using the Plan 9 protocol `9p`.
2021-07-01 07:49:00 +00:00
The client is intended to be a specialized [uxn](https://wiki.xxiivv.com/site/uxn.html) ROM that can load other ROMs (possibly preserving its own code to maintain a common menu system or interface to `xrxs`).
2021-07-01 07:45:48 +00:00
## design
This is the working structure of the 9p filesystem:
* `/ctl`: Write-only control file for inputing system commands
2021-07-01 07:45:48 +00:00
* `login PW`: Authenticate with `xrxs` -- password is hashed against realm password hash
* `load CART`: Load a cartridge
* `create REALM`: Create a new realm (start a new game) -- must have a cartridge loaded
* `protect REALM PW`: Protect the realm with a password if not already.
2021-07-01 07:45:48 +00:00
* `enter REALM`: Join an existing realm
* `leave`: Leave the current realm
* `unload`: Unload the cartridge
* `/users`: Read-only; Self and others in the realm are readable from here, one per line. It contains only yourself before joining a realm. Your username on your machine is used as your username in `xrxs` -- if your name is taken, you will get an error on attaching.
* `/carts`: Available game/app cartridges for this server, read only; Carts are listed per line upon reading the file. It is backed by files on the server in a directory structure like `carts/<cart_name>/{<cart_name.rom>, data/, realms/}`.
2021-07-01 07:45:48 +00:00
* `/slot`: After loading the cartridge, its ROM is read from here; Read-only.
* `/data/`: Any supporting data that comes with the cartridge will be found here; to serve different files to different users, perhaps all resources of one filetype should be concatenated (ie, one file for all sprite data, one file for all text data, one file for all sound data) and let the client read whatever offset/length they need; read only
2021-07-01 07:45:48 +00:00
* `/realms`: Open/saved realms, read-only. Realms and their associated universe are backed by real files on the server so that they can be preserved across service instantiations, in a directory structure like: `realms/<realm_name>/{realm, universe}`. Realms can either be solo, open, or protected; Open or protected realms can have limited member numbers. Depending on the cartridge, these settings can be user-managed or managed by the cartridge itself. Realms are listed per line upon reading the file like: `realmx 1 4 1`. `realmx` would be the name of the realm. The first number is number of members, second is member limit, third is 1 if protected, 0 if not. `0 1 1` represents a protected solo realm that is empty (saved game with password). `0 1 0` represents an unprotected solo realm that is empty (saved game with no password).
* `/universe`: Write here to update serverside state for this cart/realm; Read from here to get the complete current state. This is backed by a key-value-pair list on the server.
* `/scope`: Write here to tell the server the names of the `Atom`s (key/value pair of a `Universe`) you're interested in (one per line), and read from here to retrieve their values (one per line). In many cases this will be preferrable to fetching the entire `Universe`.
2021-07-01 07:45:48 +00:00
* `/random`: Read-only, get a random number from 0 to 99.
* `/grandom`: Read-only, get a random number from 0 to 99 -- These are doled out on a per-realm basis, and the number stays the same until everyone in the realm has had a chance to read it. If you've already read it this round or aren't in a realm, it will be empty.
2021-07-01 07:45:48 +00:00
## realm format
Each realm directory on the server should have the following files:
2021-07-01 07:49:00 +00:00
* `realm`: Basic data for the realm, file should contain only the maximum number of members, and the password hash, if any, separated by a space
* `universe`: The actual game state in for the realm, key value pairs, one per line, as "key = value"; limit 15 characters for keys, 63 for values.
2021-07-01 07:45:48 +00:00
The realm should be synchronized to disc when realm membership, limit, or password change. Fenagling some periodic autosave should be possible...