Multiplayer Limits¶
Every limit in one place.
The limits¶
| What | Limit | What happens when it is passed |
|---|---|---|
| Size of a message a player sends | 4 KB each | The message is dropped and logged. Your room code never sees it. |
| Messages a player sends | 60 a second for each player | The extra messages are dropped and logged. Your room code never sees them. |
Time for one tick (update) |
Under 8 ms, on average over a second | The first breach is logged. Three breaches close the room. |
| Memory | 128 MB for each room | The first breach is logged. Three breaches close the room. |
| How long a room lasts | 60 minutes | The first breach is logged. Three breaches close the room. |
room.gamefuse calls |
120 a minute | The first breach is logged. Three breaches close the room. |
| Size of your room code | 5 MB, after it is bundled into one file | The upload is refused with status 413. |
| Your game's usage budget | Depends on your plan; on Starter: CPU 20% of one core, memory 256 MB, network 600 KB a second. For your whole game, averaged over a minute. See Plans and servers. | No new rooms are opened until your game is back under; games being played carry on. See Your game's usage budget. |
| Players in a room | 32. maxPlayers must be 1 to 32. |
A room locks when it has maxPlayers. Nobody else can join it. |
tickRate |
1 to 60 a second, or 0 for no loop | |
| Waiting for a match | 3 minutes (matchmaking.waitSeconds, 5 seconds to 30 minutes) |
The player is told "No one is online right now. Try again later." See Custom Matchmaking. |
One round of findRoom |
1 second for everyone waiting | The round is stopped and logged; nobody is placed that round. |
matchmaking.attributes |
20 attribute names | The upload is refused by the check. |
| Guest sign-ins | 10 a minute for each IP address | Further sign-ins get status 429 until the minute is up. |
| How long a ticket lasts | 60 seconds | The multiplayer server refuses an expired ticket. The client library gets a fresh ticket for every join, so you only meet this if you make the calls yourself. |
| How long a guest is kept | 30 days without playing | The guest player is removed. |
| Log lines kept | The last 2000 lines for each game | Older lines are gone. |
Plans and servers¶
Each multiplayer plan is per game. On a paid plan your game runs on its own server, which GameFuse sets up for you a few minutes after you choose the plan. No other game shares it.
| Plan | Price a month | Server | CPU | Memory | Network |
|---|---|---|---|---|---|
| Starter | $0 | Shared | 20% of one core | 256 MB | 600 KB/s |
| Small | $12 | Own: 0.5 CPU, 512 MB | 40% of one core | 350 MB | 1.5 MB/s |
| Medium | $39 | Own: 1 CPU, 2 GB | 85% of one core | 1.6 GB | 5 MB/s |
| Large | $99 | Own: 2 CPUs, 4 GB | 1.7 cores | 3.3 GB | 12 MB/s |
- Choose or change a plan on your game's Multiplayer tab, under Your server. It shows the server's status: Setting up, Live, Resizing or Problem.
- Players stay on the shared server until yours is live, then new rooms open on yours. Nothing changes in your code.
- Changing plan resizes the server; rooms already playing finish first. Ending the plan moves the game back to the shared server.
- Need more than Large? Write to support@gamefuse.co.
Your game's usage budget¶
There is no cap on how many rooms or players your game has. A game is limited by what it uses, because one heavy room can cost what a hundred light ones do.
Three things are measured for your whole game, across every room and game mode. The numbers below are Starter's; paid plans have the bigger ones in Plans and servers.
| Budget | Measured as | |
|---|---|---|
| CPU | 20% of one CPU core | The time your room code spends running (start, update, message, your other functions, and findRoom), averaged over a minute. |
| Memory | 256 MB | The memory all your rooms hold at once: mostly what is in room.state. |
| Network | 600 KB a second | What your rooms send to players with room.send and room.broadcast, counted once for each player a message goes to, averaged over a minute. |
How many rooms that is depends on your game. A turn-based game that only reacts to messages uses almost no CPU and can run a great many rooms. As a guide, our Dots example (an arcade game that updates 20 times a second, 4 players a room) used about 3% of a core, 30 MB and 100 KB a second with 20 players. Starter is sized so a typical arcade game holds at least 20 players at once.
When your game goes over its budget
- No new rooms are opened. A player who would need a new room gets an error like "This game is at its CPU limit right now, so no new room could be opened. Try again in a moment." (
joinQueueandcreateRoomreject witherror.code === 'busy'; show something like "All rooms are busy. Try again in a minute."). Players can still join rooms that are already open, and games being played carry on. - If it stays more than 3 times over for a whole minute, your heaviest room is closed, and its players get
closedwith the reason'error'. - As soon as the average is back under the budget, rooms open again. Nothing needs resetting.
Only your game is affected. Other games are never slowed down or closed because of it, and yours is never affected by theirs.
Seeing it coming
- The Usage chart on your game's Multiplayer tab shows CPU, memory and network as a percent of your budget for the last hour, 24 hours or 7 days, with a mark wherever players were turned away.
- The dashboard's Busiest minute today bar names the part (CPU, memory or network) that came closest to its limit.
- We email the account owner automatically:
| When | How often | |
|---|---|---|
| Any part reaches 80% | A heads-up. Nothing has stopped yet. | At most once a day per game |
| Any part reaches 100%, or players are turned away | New rooms are paused until usage drops. | At most once an hour per game |
- The same warnings appear in Logs.
Using less
- Lower
config.tickRate. Most games do not need 60 updates a second on the server; 20 or 30 with smoothing in the browser looks the same. - Send less often than you update, and send only what changed.
- Keep
room.statesmall; do not keep a history you never read. - End rooms when the game is over (
room.end) so they stop counting.
Messages¶
The two message limits protect your room code. They are applied before your room code sees anything, so message is never called for a message that is too big or too frequent.
They are counted for each player. One player sending too much does not use up another player's allowance.
To stay well under them:
- Send input, not state.
room.send('move', { dx: 1 })is a few bytes. - Send on change, or at a steady rate such as 20 times a second. Do not send on every animation frame.
// browser: send at most 20 times a second
let lastSent = 0;
function onPointerMove(x, y) {
const now = performance.now();
if (now - lastSent < 50) return;
lastSent = now;
room.send('aim', { x, y });
}
Tick time, memory, room lifetime and data calls¶
These four work the same way. The first time a room passes one, a line is written to the log. The third time, the room is closed.
Read the log with gamefuse multiplayer logs, or in the dashboard.
Ways to stay under them:
- Tick time. Lower
tickRate. Many games play well at 20 or 30. UsetickRate: 0if your game only reacts to messages. - Memory. Keep
room.statesmall. Do not keep a growing list of everything that ever happened. - Room lifetime. End the game with
room.end(result)when it is over. Do not keep one room open for game after game all day. - Data calls. Save at the end of the game in
gameEnd, not on every point. Read things that do not change, such as variables, once instart.
// 2 calls for each player, once, at the end
async gameEnd(room, result) {
for (const player of room.players) {
await room.gamefuse.users.addScore(player.id, result.scores[player.id]);
await room.gamefuse.rounds.update(room.round.gameRoundIds[player.id], {
score: result.scores[player.id],
end_time: true,
});
}
},
Uploads¶
Your room code may be at most 5 MB after the gamefuse command has bundled it into one file. A bigger upload is refused with status 413. See upload key and upload API.
Guests and tickets¶
Guest sign-in is limited to 10 a minute for each IP address. The client library makes a guest once and remembers it in the browser, so a player does not use this up by reloading.
A ticket lasts 60 seconds. The client library gets a new one each time it joins a room.
Guests who have not played for 30 days are removed.