Test locally
On localhost the SDK answers with fakes, chosen in the page's query string, so you can build and draw everything before the space is listed.
How it works
The SDK runs in the local environment on localhost, 127.0.0.1 and [::1], or on any host with ?velven_local=1. At the top of a window it decides at once, so nothing waits. In a frame it first looks for Velven, so a game served by velven dev reaches the Velven page that frames it; with no answer it settles local after the probe's wait.
- Scores go to an in-memory board per key, ranked by your page's own block:
sort,mode,min,maxandcooldownall apply. 3 fake players are seeded so the board has rows to draw. Nothing survives a reload. - Boards roll over as they do on Velven:
dailyat 00:00 UTC,weeklyon Monday.bucketandseasonread past periods and seasons. Only the current bucket is seeded. - A score your page submits to a
serverboard is taken, with one console note that Velven would answerserver_only, so you can build a game that posts scores from its server before that server exists. Velven.datasaves tolocalStorageundervelven:data:local:alicefor?velven_user=alice, orvelven:data:local:guestwithout it, so changing the query string switches saves. It survives a reload; clear it from the browser's storage panel.- With no block on the page, or one that does not parse, score calls answer
no_boardand the console says why, once. The same warning appears in every environment. Velven.game.start()andVelven.game.stop()log each change to the console. Without?velven_muted=1, anonMutehandler is never called.- Achievements and stats come from your block and live in memory: an unlock reaches
onAchievement, and a stat reaching a trigger unlocks it. Content lives in memory until a reload. - A room holds only the local player:
chatandsetDatacome back to you as they would from the relay,sendreaches nobody. A friends read is your own row, ranked 1.presence.setandrooms.invitelog to the console.
Query parameters
Choose what the fakes answer by adding these to the page's address:
?velven_user=alice- Signs in a fake player,
{ id: "local-alice", handle: "alice", avatar: null }, with a fake token good for an hour. Without it,signInanswerssigned_out, as for a guest. ?velven_token=expired- Makes the token already expired, so your refresh path runs and your server refuses it.
?velven_seed=120000,40000,9000- Sets the 3 seeded players' values, so the board looks like your game's.
?velven_seed=noneseeds nobody. ?velven_strict=1- Refuses a score your page submits to a
serverboard withserver_only, as Velven does. ?velven_slow=800- Waits that many milliseconds before every answer, so your loading states show.
?velven_muted=1- Calls every
onMutehandler withtrueright after you register it, as for a player who has turned the sound off. ?velven_local=1- Uses the local environment on any host.
Previews and velven dev
A preview of a hosted space (velven publish, and its preview link) and velven dev (your folder, served on your machine and framed by https://velven.ai/dev) run inside Velven's page in sandbox mode: sign-in, boards, saves, achievements, stats, content and rooms all work, on the real API, but everything they write goes to your space's sandbox. The live space never sees it, and Velven.sandbox is true.
- Anyone signed in who holds a preview link can play there, so you can test a room with a friend.
velven resetclears the sandbox by kind (--scores,--saves,--achievements,--content,--rooms) or for one--player. Sandbox data is deleted 30 days after its last write.- The token a sandbox player gets carries
"sbx": true; your server can tell it apart withverifyToken.