The Grid
Multiplayer server
The Gridâ
One day, I got in. - Kevin Flynn
The grid is the multiplayer server that runs your parcel scripts on the Cryptovoxels infrastructure. It runs the exact same API as the normal scripting engine, but it keeps track of the state on the server and sends changes to everyone connected. This means if you click a door and it opens, it will open for everyone else who is standing near you. It also means you can play multiplayer games with other players, and the server will maintain the state of the game.
The multiplayer server is free to use, and is hosted by the Cryptovoxels Corporation. Your scripts are spun up on demand, have a strict memory limit of 8MB of heap, are CPU time limited, and are killed when your parcel is idle.
The advantages of using The Grid:
- Your scripts are multiplayer
- Your scripts run in a trusted environment
- Your scripts are always available
- You don't have to pay for hosting, or wait for your hosting provider to spin up your scripts
Disadvantages:
- It can be tricky to debug
- You have to fit your experience into 8MB of rams
How to Activateâ
Go to your parcel in the Parcels tab. Be sure to be logged in!
If you own the parcel, and if you're logged in, you should see an admin panel like the one below:
{.align-center}
- Check the
on Gridcheckbox.
Done! Your scripts are now multiplayers.
What happensâ
(Example for parcel #78 - put in your own parcel ID to follow along)
- You enter a parcel
- The parcel is set to
grid: true(set this in parcel settings)
{.align-center}
- The web client connects to
wss://grid.cryptovoxels.com/grid/78 - The grid server spins up a v8 isolated-vm
- The isolate loads up the scripting host
- The isolate fetches your javascripts from
https://untrusted.cryptovoxels.com/grid/parcels/78/scripts.jsand evaluates it - The websocket connection is accepted and your client starts communicating with your grid server
- All clients disconnect and the isolate is destroyed
The grid server currently dispatches messages instantly from your script back to the client, but this will be throttled to 5 or 10 hz in a future version, because sending realtime 60hz updates over a websocket over the public internet causes lots of lag and bunching up of packets.
Viewing logsâ
Your logs are written to redis and persisted. They are publicly viewable (don't put any secrets in your logs ok) at:
https://grid.cryptovoxels.com/grid/78/logs
Available APIsâ
APIs are very basic as of version 1.1.2, more will become available over time
The grid server has it's own versioning info. See the currently released version at https://grid.cryptovoxels.com/
- Scripting API
- Built ins
setTimeoutsetIntervalconsole.log
Roadmap:
clearTimeoutclearIntervalfetchAsyncStorageimportScripts- Physics