iCloud Multiplayer! Guess The Number Game

2

SP4CEBAR 2025-10-07 14:40 (Edited)

We Have Online Multiplayer!


        Open In Editor (single player)


How

Sharing a Disk.nx file between two running programs allows them to "talk" to each other.


Gameplay


How To Play Multiplayer Using iCloud

Prerequisites

  1. Make sure your iCloud is synchronized with your device.
    • IOS and Mac should do this already.
    • On Windows, you should download iCloud and enable the iCloud drive folder.
    • On Linux, you will need to get a tool to sync iCloud to a folder.
  2. Make sure there is a folder in your iCloud Drive root (highest level in folder structure) named "LowRes NX".

How to set up multiplayer

  1. On IOS, click "open in app" on the program upload below; on other platforms, Download this NX program and move it to your iCloud "LowRes NX" folder.
  2. If there is a Disk.nx in the same folder as your program, rename it so it couldn't be overwritten in the next steps.
  3. Save a shared Disk.nx file to your iCloud
    • Like my Disk.nx
      • anyone can modify it, read more about the risks in the section "Risks Of A Public Disk.nx" below
      • Section "servers" below may list more disks I shared.
  4. Move this Disk.nx to your iCloud "LowRes NX" folder.
    • be sure to remove it after playing multiplayer so you can use a standard Disk.nx again.
  5. Make sure that the NX program can access the shared "Disk.nx": it should be in the same folder as the program.

Joining Orderly

Now that you are ready to play, here are some guidelines to avoid confusing the program:

  1. If you are the first player of a session, clear the shared disk if the most-recent change was more than 15 minutes ago.
    • If changes are made very recently, there is a good chance someone is playing right now, In which case you can go to the section "Servers" below to use a different Disk.nx file I shared.
    • Clearing the disk will ensure a clean start, the previous game may not have been shut down properly and may confuse your game if not cleared.
    • If the disk has a lot of NX data inside of it, please mail it to whoever edited it last (see file metadata) because they probably saved this in the shared Disk accidentally.
    • If everyone clears it regularly, the potential impact of spam will be reduced.
  2. Wait for the moment agreed upon with your fellow players before running the program yourself
    • This is to prevent two players getting the same ID and their turns will be the same.
    • After your program shows that it is waiting for players, the next player should wait 30 seconds or less depending on the cloud synchronization speed before they should join.
  3. keep the program running, cancelling prematurely requires the disk to be wiped manually before it can be played again, as the disk won't "know" you left
    • the disk will "know" when the game ended, so you won't have to wipe it in between games
  4. When you are done, delete the shared Disk from your iCloud to avoid writing to it accidentally in the future.
    • If you do write your precious NX files to it, save them immediately, or you may lose them if someone wiped the disk before a game.
      • Check your apple email if you did lose this data, someone may have salvaged it for you.
    • It could also save you phone credit and background tasks as the file may change and synchronize a lot, a spammer may even upload 1GB of text to the file (the size of the iCloud Drive of the sharing account).

Game

Notes


I Shared Disks

I shared Disk.nx files on iCloud (see "Servers" below): Save one to your iCloud, then move it to your "Lowres NX" folder on iCloud, then NX should be able to use it. See instructions above on "how to play". Don't confuse your "recents" folder with your "Lowres NX" folder like I did.

Servers

if the shared disk were in use, you could use another one

Notes On My Shared Disks

Risks Of A Public Disk.nx

⚠️ Tread with caution: anyone on the internet could have modified one of the Disk.nx files I shared


Related topics

Technical details below


SP4CEBAR 2025-10-08 15:41 (Edited)

How To Share A Disk

  1. Get an empty Disk.nx file (you can rename your current Disk.nx to keep it saved)
    • make sure this empty disk file is in the same folder as your NX program you will be running
  2. Share it via iCloud Drive or equivalent or host it on your device.
    • each player needs both read and write access
    • I found that iCloud allows you to give anyone with a link both read and write access, but I'm not sure if you'd want that.
      • In that case you could better use the Disk on iCloud I shared above
      • See "Risks Of Using A Public Disk.nx" above.
    • make sure to stop sharing your Disk afterward as you may need it for other projects, though it would be funny if people left their disk files linked and did not notice it.
  3. Communicate to your players:
    • when you will be playing
    • the order of players to run the program (to join)
      • make sure to wait around 30 seconds, depending on the synchronization speed, between each joining player.
    • how to access your shared Disk.nx with FTP credentials or a URL
  4. Follow the steps from the section above named "How To Play".

Technical details


Multiplayer Example Code

Turn based

You may treat this code as an example of a turn-based multiplayer game, you could for example modify it into a card game.

Reveal

If you are more adventurous, you could mess with the code to make different multiplayer rules: game where each player can prepare their moves all at once before the result of them is revealed, like rock paper scissors.

All at once

You could even try to let each connected program modify their file (channel) continuously to sync the states of more action-packed games.


Improvement Ideas

  1. Clients get the same ID if they join at the same time and become indistinguishable
    • have each client save a timer variable, to file 4 + TIMER MOD 12
      • this allows a two clients that joined near each other to be identified
      • there is still a 1 in 12 chance that both clients still wrote to the same file, in which case one of them may not be able to see the other's message.
      • I think the timer is counted since the app opened, PC clients that run an NX programs on boot may have the same timer value when they join

SP4CEBAR          a sneaky markdown trick

Update 1: essential fixes

I tested it on Linux by running two NX instances and it actually works!


SP4CEBAR 2025-10-08 19:47 (Edited)

Update 2: reliability and clarity


jpospTynker 2025-10-09 00:02

this is SICK! it’s crazy multiplayer works in LOWRES NX now


SP4CEBAR 2025-10-09 11:51

I'm glad you like it!


SP4CEBAR 2025-10-09 13:49 (Edited)

Update 3: party player


SP4CEBAR 2025-10-09 14:37 (Edited)

I shared a Disk with all of you!

Now you can play multiplayer on IOS! See program desciption above for more details.

Please let me know if you managed to open and modify the Disk, with an NX program on platforms other than IOS. I also just updated the description to provide more instructions and details.


SP4CEBAR 2025-10-09 16:24 (Edited)

Update 4: single player


jpospTynker 2025-10-09 21:42

this is awesome, definitely doing something with this! imagine 12-player Co-op with fellow NXers!


SP4CEBAR 2025-10-10 13:06 (Edited)

I love the enthausiasm! I updated the instructions to make it clear for most platforms how to play.

All we need now is to arrange a time when anyone that wants to play will be online to play!
...as well as a joining order (with around 30 seconds between each joining player)


SP4CEBAR 2025-10-10 13:22 (Edited)

Also, if anyone wants to modify this turn-based online multiplayer example into a more complex game such as a card game, feel free to do so:


SP4CEBAR 2025-10-10 18:45 (Edited)

Update 5


Log in to reply.