NX Multiplayer Communications Standard

4

SP4CEBAR 2026-08-16 15:53 (Edited)

order in multiplayer

I noticed that the icloud-based multiplayer programs are taking off, great!

However the current version of my multiplayer demo game doesn't handle disks very well that were used by other programs or that were shut down incorrectly.

So I would like to propose this standard to allow programs to understand each other, and detect ended games so they know when it is safe to reset a Disk. I haven't implemented it yet in the demo.

I would like to know what you think about it and if it fits your use cases

simplest version of the standard

To get started, here is the simplest version of the standard.

  1. implement file 0's name (see below)
  2. implement the first two bytes of file 0 (see below)
    • the second byte should hold the number 3 to tell that you used the simple version

the full standard

File 0's name

File 0's name should hold the program name and version to allow other programs to check compatibility,

File 0

File 0 should hold:

File 1

File 1. Stores variables that change regularly, this is moved to file 0 if set by the second byte of file 0

settings files

Depending on the second byte of file 0, there may be one or more settings files.

Remaining Files

All remaining files are assigned to players:

name of remaining files

The file name is the player's nickname


Recommendations

Checking Compatibility

Settings conventions (as I don't know how reliable icloud is here)

player timeout

NX doesn't have a built-in way to detect if a program stopped, so a multiplayer program should provide its own exit button

each player's timer value should be sent whenever they change their file so that any client can determine if a player timed out

In case a player did not exit correctly, each client should store the timer values it received from each player as well as the time it was sent on and the offset with its timer to check the other player's response time, if the player at play takes longer than the timeout duration stored in file 0 then they get kicked as they may have quit.

a second player could replace the host if the host quit and so on until there's only one player and the game stops and is reset

connection testing

the third byte of file 0 is used for connection testing, it should be left at 0, only an external party may set it to see if anyone is still connected, any connected player responds by sending their current timer value in their own chsnnel. If this causes version conflicts in icloud drive, then the value could be set so that only the players have to respond in a specific order so that the external party can check each of them. The second byte of the variable settings section is reserved for a connection testing round. A connected player such as the host may, if no test is active, set the second byte of the variable settings to ask someone's client if they are still connected

Without connection testing here are some alternative ideas to determine an ended session. Maybe even a new session could determine if the previous session is times out and know if it's safe to reset it, but to do that it may need to prompt the host for the date and time. Alternatively the new session could wait 5 minutes to see if the game from the disk is still active or prompt its user if the disk may be reset.

spectators

long duration games

forwards compatibility

This format may change, so be sure to make your program not freak out if it reads a type number that is greater than 16


Ideas

Sync timers

branch

If you have some great ideas that benefit general communication between programs for this format, you could add your own type to the second byte of file 0 that would hold your special file format, note that older multiplayer programs wouldn't be able to read it


SP4CEBAR 2026-08-16 16:07

I haven't implemented any of it yet so feel free to suggest changes to ensure it fits your use cases


SP4CEBAR 2026-08-16 16:38 (Edited)

Edit 1:


SP4CEBAR 2026-08-16 16:58 (Edited)

The format is not (edit: it is now) backwards compatible with my multiplayer demo as I find efficiency to be more important.

Let me know if your project was built on the demo and you would like backwards compatibility


SP4CEBAR 2026-08-16 18:14

Update 2


SP4CEBAR 2026-08-16 18:50 (Edited)

Update 3


SP4CEBAR 2026-08-17 09:01

Update 4


SP4CEBAR 2026-08-17 09:14 (Edited)

Update 5


SP4CEBAR 2026-08-17 09:15 (Edited)

In a week from now you may assume this format to be locked, as in, I won't change it drastically and it would remain backwards compatible


SP4CEBAR 2026-08-17 09:45 (Edited)

Update 6


SP4CEBAR 2026-08-17 14:58 (Edited)

Update 7


moechofe 2026-08-17 15:58

Putting data into File#0 will disable the internal font.


Timo 2026-08-17 22:15

Moechofe, that does not apply for the data disk, only for the runnable program itself.


moechofe 2026-08-18 05:26

I was thinking, if two players modify the same Disk at the same time who will win?


moechofe 2026-08-18 05:28

Second question: Disk exist because the FILES command requires a target. So it's possible to share other programs than Disk and open the game like it was an editor, will it works?


moechofe 2026-08-18 07:25

I mean, if it works, it does not requires user to rename/remove/re-add Disk.nx every time they want to do something else.


Timo 2026-08-18 08:35

File conflicts would be handled by iCloud Drive. Actually I’m not sure what would happen exactly.


SP4CEBAR 2026-08-18 16:08 (Edited)

@moechofe, that's a great idea actually! You can already do this:

  1. Add your favorite multiplayer program as a tool
  2. open a shared NX file (it would be beneficial if the shared files had names other than Disk.nx so that it can coexist with your local Disk.nx file)
  3. Launch the multiplayer program as a tool

I likely won't be adding more shared disks any time soon. But you can easily create a new icloud account on icloud.com which would get you 1GB (instead of the usual 5GB) of drive storage, this is plenty to share disks, then give everyone read and write access to these files and you can use them, see how to share a disk for more details


SP4CEBAR 2026-08-18 16:21

Neither do I know how icloud drive handles version conflicts, my testing included local tests with multiple NX instances, as well as tests where I manually changed the shared Disk on icloud while a multiplayer program was running, but no version control tests


Log in to reply.