experimental 9p game server for uxn
Find a file
2021-07-04 23:44:58 -06:00
carts update DESIGN document, put skeleton code in place 2021-06-30 00:52:57 -06:00
.clang-format first commit -- hello from 9p 2021-06-13 11:22:58 -06:00
.gitignore first commit -- hello from 9p 2021-06-13 11:22:58 -06:00
aux.c added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
aux.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
build.sh added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
cart.c added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
cart.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
command.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
err.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
LICENSE added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
mkfile first commit -- hello from 9p 2021-06-13 11:22:58 -06:00
README.md add skeleton functions for write_ctl with documentation, tweak users table 2021-07-02 22:32:10 -06:00
realm.c added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
realm.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
universe.c added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
universe.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
user.c added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
user.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
util.c added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
util.h added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00
xrxs.c added MIT license and created headers and code files for all the types 2021-07-04 23:44:58 -06:00

xrxs

xrxs is an experimental game server using the Plan 9 protocol 9p.

The client is intended to be a specialized uxn ROM that can load other ROMs (possibly preserving its own code to maintain a common menu system or interface to xrxs).

design

This is the working structure of the 9p filesystem:

  • /ctl: Write-only control file for inputing system commands (should we check the /realms file for success or failure, or should we make ctl r/w and return success or failure of the current user's last command on read?)

    • 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)
    • protect REALM PW: Protect the realm with a password
    • enter REALM: Join an existing realm
    • leave: Leave the current realm
    • save: Save the current universe to the realm (redundant? or force universe/realm to flush?)
    • reset: Reset the cartridge (attempts to leave the realm, but doesn't save)
    • 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/}.

  • /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

  • /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 current state. Each cartridge will have its own format for encoding data here. Since this changes frequently in multiplayer games, perhaps only flush to disk at regular intervals instead of after every write.

realm format

Each realm directory on the server should have the following files:

  • 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.
  • members: Members currently in the realm, one per line.
  • universe: The actual game state in for the realm, format is cartridge-specific.

Everything in the realm directory is synchronized to disc both when realm membership, limit, or password changes, and at regular intervals. If a member makes no writes to the universe after a certain time, consider them gone from the realm (so there should be a common SYN message all cartridges implement to keep them alive in the realm).