Skip to content
Download all docs .md

GameFuse Multiplayer

GameFuse Multiplayer lets the players of your game play together in real time, in the browser, in Unity or in Unreal Engine.

You write one JavaScript file, called the room code. You upload it with one command. GameFuse runs it on the multiplayer server, one copy for each room of players. Your game connects to a room with a small client library: JavaScript for the browser, C# for Unity, C++ for Unreal Engine.

You do not set up or run a server.

Built on Colyseus

GameFuse Multiplayer is built on Colyseus, the open-source (MIT) multiplayer framework for Node.js. The multiplayer server runs Colyseus 0.16, and the browser library is a thin layer over its client, colyseus.js 0.16. GameFuse adds the parts around it: GameFuse sign-in and join tickets, uploading and versioning your room code, game modes, matchmaking, a sandbox for your code, saving to your game's GameFuse data, and the dashboard.

You write GameFuse room code, not Colyseus code. There is no Colyseus Room class to extend, no @colyseus/schema state, and no server to run. See Coming from Colyseus below.

How the pieces fit

How the pieces fit: 1. your game signs in and asks the GameFuse API for a ticket; 2. it joins a room on the multiplayer server with the ticket; 3. messages go both ways; 4. your room code saves data to the GameFuse API.

There are three pieces.

Your game. It uses a client library to sign the player in, join a room, send messages and receive messages. Every client library joins the same rooms, so players on different engines can play together.

Client Where it is Reference
JavaScript (browser, Node 22+) gamefuse-multiplayer, also built into game-fuse-js Browser client
C# (Unity) game-fuse-cs Unity C# client
C++ and Blueprints (Unreal Engine) game-fuse-cpp Unreal C++ client

The GameFuse API. It makes players, including guests who play without an account. It hands out tickets. It stores scores, credits, leaderboards, game rounds and the rest of your game's data. This is the same GameFuse your game may already use.

The multiplayer server. It keeps the connection to every player, puts players into rooms, and runs your room code. Your room code decides what happens in the game. See the room code reference.

What happens when a player joins

  1. The client library signs the player in. A guest needs no account.
  2. The client library asks the GameFuse API for a ticket. A ticket proves who the player is. It lasts 60 seconds.
  3. The client library joins a room on the multiplayer server with the ticket. The multiplayer server checks the ticket and refuses a bad or expired one.
  4. The player is placed in a room. This is either a queue room, shared with other players who asked for the same queue, or a private room that friends join with a 6-character code.
  5. When enough players are in, the multiplayer server calls start in your room code. From then on your room code and the players' browsers send messages to each other.
  6. Your room code calls room.end(result) when the game is over. It can save scores and other data to GameFuse before the room closes.

The client library does steps 1 to 4 for you.

What you write

You write Where it runs What it does
Room code, one file such as pong-default-gamefuse-multiplayer/room.js On the multiplayer server The rules of the game. It receives messages from players, keeps the state of the game, and sends messages back.
Game code that uses a client library In each player's browser or game Joins a room, sends the player's input, and draws what the room code sends back.

Because the room code runs on the multiplayer server, it is the one place that decides who scored and who won. It can save that to GameFuse itself, so your browser code does not have to. See saving GameFuse data from room code.

Words used in these pages

Word Meaning
Room code The JavaScript file you write and upload.
Room One group of players playing together. Each room runs its own copy of your room code.
Multiplayer server The GameFuse server that runs rooms.
Ticket A short-lived pass the GameFuse API gives a player so they can join a room.
Queue A named line of players waiting to be matched, such as '1v1'.
Private room A room players join with a 6-character code.
Game mode One kind of match in your game, such as pong or superpong. Its name is the queue name players join, and it has its own room code. A game with one kind of match only needs the default mode. See Game Modes.
Version One upload of a game mode's room code. Versions are numbered 1, 2, 3 and so on. Each mode has one live version at a time.
Upload key The key that lets you upload room code for one game.

Coming from Colyseus

If you have used Colyseus before, this is how the ideas map:

In Colyseus In GameFuse Multiplayer
A Room class you write and register with gameServer.define(...) One room code file with start, update, gameEnd, message... that you upload. GameFuse defines the room.
onCreate, onJoin, onLeave, onDispose start, playerJoined, playerDropped / playerReturned / playerLeft, gameEnd
this.onMessage(type, fn) message(room, player, type, data)
@colyseus/schema state, synced to clients automatically room.state is a plain object that stays on the server. You send what clients need with room.send / room.broadcast.
this.setSimulationInterval(fn) config.tickRate and update(room, dt)
this.clock.setTimeout room.after(seconds, fn)
allowReconnection(client, seconds) config.reconnectSeconds; the client library reconnects by itself
joinOrCreate / create / joinById joinQueue / createRoom / joinRoom(code) with 6-character codes
Colyseus matchmaker, filterBy, sortBy Game modes (queue names) and Custom Matchmaking with findRoom
colyseus.js Client in the browser GameFuseMultiplayer from the client library, which uses colyseus.js inside
Your own server, process and scaling GameFuse runs it. Paid plans get a server of their own, set up for you (Plans and servers)

Where to go next