Multiplayer rooms for the web
A web-native multiplayer layer, built from the ground up so rooms sleep when they're empty and wake in milliseconds.
npx @irtio/cli init my-game
Server and client in lockstep
State syncs seamlessly between the room and every client, and client-side prediction and lag compensation keep it looking right no matter the network conditions. Input reaches your server code as calls that read like ordinary functions, and ownership rules let the client change the fields it's allowed to directly.
1The client calls a functionClient
const roll = await room.calls.roll({ sides: 20 });2The room runs your handlerServer
roll({ sides }) {
return 1 + Math.floor(Math.random() * sides);
},3The client carries on with the resultClient
die.textContent = `You rolled ${roll}`;Declare a call once; its args are checked on both sides and its reply comes back typed. Calls
1The client draws health bars from the room's stateClient
function frame() {
for (const p of room.entities.all(Player)) {
drawHealthBar(p, p.hp);
}
requestAnimationFrame(frame);
}2The room changes itServer
onTick(room) {
for (const p of room.entities.all(Player)) {
p.hp = Math.min(100, p.hp + 1);
}
},3The next frame draws the new valueClient
drawHealthBar(p, p.hp); // p.hp is already the room'sOnly what changed is sent, as a binary delta, to the clients that can see it. State sync
1The player writes its own cursor, with no round tripClient
addEventListener("pointermove", (e) => {
for (const cursor of room.entities.mine(Cursor)) {
cursor.x = e.clientX;
}
});2The room checks every writeServer
writes: {
cursor(room, conn, cursor, write) {
if (write.x === undefined) return write;
return { ...write, x: Math.min(write.x, 800) };
},
},3Every other client sees it moveClient
room.entities.onChange(Cursor, (c) => drawCursor(c));Players write the fields they own with no round trip, and the room has the last word. Ownership
1The player fires at the target on their screenClient
input.fire = aimAt(others.get(target));2The room rewinds to what the shooter sawServer
onTick(room) {
for (const conn of room.connections.values()) {
const shot = conn.input?.fire;
if (!shot) continue;
const seen = room.rewind(poses, conn.viewTick);
const hit = firstHit(conn, shot, seen);
if (hit) room.broadcast({ type: "hit", id: hit.id });
}
},3A shot that looked like a hit is a hitClient
room.addEventListener("message", (e) => {
if (e.data.type === "hit") showHitMarker(e.data.id);
});The room keeps recent positions and checks each shot against the tick the shooter saw. Lag compensation
Rooms that sleep, and wake anywhere
IRT rooms are built from the ground up to be portable. While a room runs, its state changes stream to the state store, so it can be restarted at any time, on any server, from exactly where it left off. Connections are held outside the room, so a restart doesn't drop a single player.
What that gets you
Rooms sleep when nobody needs them
An empty room hibernates 30 seconds after its last player leaves, and an idle one, like a board game between turns, can sleep with its players still connected. A sleeping room costs nothing.
Scale without sizing servers
Each room is placed when it wakes, so a spike gets room after room and a lull holds nothing.
Crashes and deploys that don't kick players
A room that breaks is replaced from its saved state with its players' connections held. Running rooms stay on their build until they next hibernate, then wake on the new one.
Replays and state you can inspect
Because a room's state streams out of it, you get replays and shareable clips out of the box, and state you can inspect to debug problems.
Handled out of the box
irt deploy ships your rooms and site as one build, so clients always match their room code.Tested in process@irtio/testing runs rooms with test clients and a controlled clock, crashes included.Ready for coding agentsThe docs are published as llms.txt, and every example in them is compiled.Client trust based on game needs
A project can mix room types that make different choices.
- 1
Relay
A native room runs no code of yours. It passes messages on and keeps presence and a leader.
- 2
Shared entities
Players spawn, own and write entities under rules each kind declares, still with no server code.
- 3
Ownership
Players write the entities they control with no round trip, and the room checks every write.
- 4
Fully authoritative
The room runs the rules, clients predict their own movement, and hits are checked by rewinding.
Hosting on irt.io
You pay for room-hours, the time a room is awake, at the size you pick. The number of players in a room doesn't change it, and a hibernated or sleeping room costs nothing.
Prepaid credit, no subscriptions
irt.io runs on prepaid credit. You won't be surprised by a bill, or have a monthly subscription to manage.
| Meter | What it counts | Price |
|---|---|---|
| Room-hours | An hour of one room awake, however many players are in it. | From $0.005 an hour, by room size |
| Traffic | The bytes your rooms send to players and receive from them. | Free |
| Voice-minutes | Per participant, per minute in a call. Only if you turn voice on. | $0.001 a participant-hour |
| Storage | The room state your hibernated rooms keep, and your replays and clips. | Free |
irt.io is currently invite-only
We're inviting game developers in small groups, and every invite comes with $10 of credit to try out the platform. Tell us what you're building for access. We want to hear about it.
Build rooms that sleep
Tell us what you're building, and we'll email you an invite with $10 of credit to start.