Skip to content

The simplicity of CloudLink Classic, but with the power of CloudLink Omega.

License

Notifications You must be signed in to change notification settings

cloudlink-omega/cloudlink-phi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudLink Phi Banner

CloudLink Φ ("Phi")

Imagine the simplicity of Classic CloudLink, but with the power of CloudLink Omega. Introducing CloudLink Phi, a "diet coke" client/server suite built using the CL5 protocol.

Feature Phi (CLΦ) Omega (CLΩ) Classic (CL4 and older)
Uses the CL5 protocol on top of WebRTC
Hybrid connectivity (Server-client or peer-to-peer)
Voice calling support
Designed for Games ❔ possible but not recommended
For general-use connectivity
Mandatory authentication

Usage

Technical requirements

Your browser needs to support the following features:

  • WebSockets - This is used to talk to a Phi server that can negotiate connections for you.
  • WebRTC - This is used to communicate with other players.
  • Web Locks - An internal dependency.
  • Web Crypto - Used for end-to-end encryption of user data (Default lobby will not be CL5-level encrypted).

All modern browsers support these features out of the box. Unless you're using something old or obscure, it's probably best to update.

Importing

Download a copy of index.js from this repository and import the extension into your Scratch editor of choice as "Unsandboxed".

Getting connected

Simply use the Connect to server block to get started. Then, set a username so others can find you (This won't be used for data though).

block_12_20_2024-10_23_02 PM

Rooms

Like Classic CloudLink, you can create and join rooms.

Rooms keep players and data separated, and keeps things tidy. Think of them like matches or lobbies in a game.

If you want to see what other rooms are available, you can retrieve the list using these blocks (It will output as a JSON array of strings).

block_12_20_2024-10_27_44 PM

To see details about a specific room, use these blocks (It will return a JSON object):

block_12_20_2024-10_29_01 PM

You can use this block to make your own room at any time.

block_12_20_2024-10_29_47 PM

Setting the limit to zero will allow an unlimited number of players to join. This can cause problems if you're not careful.

There are several ownership modes available.

The default mode is "don't allow this room to be reclaimed", which does what it says on the tin: Once you leave, the room gets destroyed and everyone who joined will be forcibly disconnected.

"Allow the server to reclaim the room" will select the next available person to become the owner. This is the mode that the default room uses.

"Allow peers to reclaim the room" is currently an experimental feature that should be left alone.

On the other hand, if you want to join a room, use this block:

block_12_20_2024-10_32_58 PM

Broadcasts

When the server relay is enabled in your room (which is the case for the default room), broadcasts will be sent using the relay player automatically. Instead of having to send a message to each player one-by-one yourself, the server can do it for you. Otherwise, the client does this for you at the cost of extra time and network consumption.

To send a broadcast, use this block:

block_12_20_2024-10_35_11 PM

You can read the most recent broadcast received at any time using this block (Note that any broadcasts that you send won't be returned to you - only others will see it):

block_12_20_2024-10_35_47 PM

Additionally, if you want to know who was the one that last sent a broadcast, use this block:

block_12_20_2024-10_36_36 PM

If you want to process data when new messages come in, you can hook up code to this hat block (it works with clones):

block_12_20_2024-10_37_41 PM

Private data

To send some data directly to someone else, use this block:

block_12_20_2024-10_38_16 PM

Reading back the received data is as simple as using this block:

block_12_20_2024-10_38_45 PM

Like the broadcast blocks, you can listen to incoming messages using this hat block (it also works with clones):

block_12_20_2024-10_39_26 PM

Channels

Channels are a way to send vast amounts of different data using the same connection. Some might prefer being nice and tidy, others might prefer being extremely fast.

You can have as many as up to 65 thousand different channels per player (browser-dependent).

You can see if a player has a channel open:

block_12_20_2024-10_43_16 PM

Or get a list of all their open channels (Returns a JSON array of strings):

block_12_20_2024-10_43_33 PM

Opening a new channel can be performed at any time and from any side. Use this block to begin:

block_12_20_2024-10_43_45 PM

There are two modes:

"Reliability and order" and "Speed" do what exactly they say on the tin. One mode will try to keep messages in a timely and orderly fashion, while the other will prefer speed, knowing that some messages might get dropped.

Likewise, you can close a channel at any time and from any side using this block (note that you can't close the default channel; you can only close the connection with the player):

block_12_20_2024-10_45_55 PM

You can listen to new channels open/closing at any time using these hat blocks (even these work in clones):

block_12_20_2024-10_46_19 PM

block_12_20_2024-10_46_23 PM

About

The simplicity of CloudLink Classic, but with the power of CloudLink Omega.

Resources

License

Stars

Watchers

Forks