Releases: gamerelay/sdk
Releases · gamerelay/sdk
Release list
v0.1.0-alpha.5
- Short links:
room.shareLink()is the room's link, the same for its life:
https://gamerelay.io/<game>/<link>once the game's owner sets a slug and a play URL (dashboard
→ instance → Short links), which previews in chat apps with the room's name and the game's cover
image and sends players to the play URL with?join=<link>. Without a slug it's the page's URL
with?join=<link>.relay.joinLink(link)joins by a link's id, andrelay.joinInvite()now
reads?join=as well as?room=.room.shareInvite()shares the short link (falling back to
the?room=one on an older server). - Link-only rooms:
createRoom({ linkOnly: true })androom.setAccess({ linkOnly })make a
room that its code doesn't get into (room_not_found, as for a wrong code), so nobody joins by
guessing one; a player with a seat in it still comes back by code.room.linkOnly, and
linkOnlyin theaccessevent.
v0.1.0-alpha.4
- Host controls: the room's host can run it like a game server.
room.kick(playerId, { ban?, message? })removes a player the way the owner's kick does (banned from the room by default).
room.setAccess({ locked?, public?, maxPlayers? })locks the room to newcomers (joins fail with
the newlockedcode; players in it can still reconnect), lists or unlists it, and changes its
size, never below the players in it.room.setListing({ name?, meta? })sets what room lists
show: a name of up to 48 characters and up to 512 bytes of JSON.room.transferHost(playerId)
hands the host role over. All four are host only (not_hostfor anyone else) and return
promises. Everyone gets the newaccessandlistingevents, androom.locked,
room.isPublic,room.nameandroom.metastay current (room.maxPlayerstoo, which is no
longer read-only). - Server browser:
relay.listRooms(tag, { includeFull: true })also lists full and locked
rooms, and every listing now hasname,meta,lockedandhostName.
relay.online()says how many players the game has online. - Kicked while offline: a player kicked while their connection was down now gets
closed('kicked', message)when the SDK reconnects, instead ofclosed('lost')or, without a
ban, quietly getting a fresh seat back (the reconnect asks to resume, and the server says why
it can't). - Refused joins stay put: joining a room that refuses you (locked, banned, full) no longer
takes you, or your party, out of the room you're in. A party moves only if every member can. - A party leader keeps its room over a reconnect: a leader whose connection drops gets its
own seat back even if a party member can't come in (kicked, or outside a room since locked or
filled), and nobody is pulled along; a reconnect also no longer hands the party's lead away.
This is the server's doing, so it applies to every SDK version. - These need a server with host controls (gamerelay.io has them). Older SDKs in the same room
are unaffected: they ignore the new events.
v0.1.0-alpha.3
- Smaller messages: the SDK asks the server for relayed messages in a short form (the
sender's room slot instead of its id), about 18% fewer bytes per message and per metered
byte. gamerelay.io serves it; an older server just sends the long form. - Player to player uses less upload: a player whose copies reach you after the server's
(common on a relayed route near the game server) is told so, and then sends you only every
10th copy for 30 s, which keeps checking whether the route got faster.
v0.1.0-alpha.2
- Player to player, on by default (experimental): broadcasts also go straight between
players, directly on the same network or else through GameRelay's nearest relay, racing the
server's copy, which still goes to everyone.connect({ lan: false })turns it off. Party
members can also connect directly over the internet withlan: { direct: 'party' }, if the
game's dashboard allows it (off by default). Players on older SDKs in the same room are
unaffected. See the docs page, "Experimental: player to player". - Player to player, more reliable: a relayed connection no longer drops every hour when its
relay credentials expire (the 20-minute refresh now reaches open connections, with an ICE
restart that keeps the channel open). After a network change (Wi-Fi to cellular), the route is
restarted after 3 s instead of sitting dead for ~30 s. With relays, a connection that didn't open
is tried again after 5 s, 30 s and 2 min. Copies over 2 KB go by the server only, since the lossy
channel mostly lost them. Connection setup sends far fewer server messages, and the debug overlay
shows each channel's round trip. - Security: another player can no longer learn your IP address through the player-to-player
shortcut (a fake relay candidate, or candidates inside an offer or answer), take over another
player's entity ids before a newcomer sees them, or grow your memory with made-up entity kinds
or input keys. A peer's copies get the server's size and rate limits, only a server copy starts
a sender's session, and a peer can make us reconnect at most once every 2 s. State patches can't
set__proto__. Entity ids now end in a short tag of their creator, 7 characters longer. - Reliability: a connection that died without closing (switching from Wi-Fi to cellular, a
laptop waking) is noticed within about 9 s, or at once when the page is shown again or comes
back online, and the player rejoins before their seat is given up. Calls to the server, and
claims, no longer wait forever: calls fail withtimeoutafter 10 s, and a claim is retried and
then settles.relay.now()no longer jumps when the device's clock changes, and follows the
server after a reconnect. The SDK no longer sends a burst the server's rate limit would drop
whole: position updates give way and everything else waits its turn (a full offline queue
also keeps your messages over heartbeats), with a warning when your entity rates can't fit.
Reconnects after a server restart are spread out, keyframes after a reconnect too, and sends
fromrelay.tickgo out without waiting for the next frame. - New error,
too_many_rooms:createRoomandquickMatchreject with it when a player
already has 4 rooms nobody else is in, or the game is at its plan's room limit. Reuse a room for
the next round instead of creating one each time. - Types: the published
gamerelay.d.tsno longer lists the SDK's internal plumbing
(relay.request,relay.warn,debugInfoand the like), so autocomplete shows only the
public API.new Room()is still not allowed; rooms come fromrelay.createRoom,
joinRoomandquickMatch. - Docs:
kind.mine()says what really happens when you write an entity you don't own: the
write is skipped, with a console warning.llms.txtlists the module build
(https://gamerelay.io/sdk/gamerelay.mjs) and saysrelay.featuresflags are reserved. - Also on JSR as
@gamerelay/sdk, and each release has notes on GitHub.