The Story of 3 Branches

Ben Nolan
4 min readAug 23, 2018

--

Cryptovoxels is a virtual world on the Ethereum Blockchain. Follow us on Twitter or join the Discord.

Cryptovoxels has progressed to a point where there are some chunky pieces of work to solve. I think that with any large project, you should split your work between quick wins (bug fixes, small features) that you deploy often, and bigger chunks of work that you can’t smash out in a morning.

Some of my recent branches

This is the story of the 3 large long-running branches that I’ve had for Cryptovoxels.

feature/video

Playable videos in cryptovoxels

This feature adds video elements, the ability to embed a world in your parcel. Whether that’s a pre-recorded video that you host as a .mp4, or a live stream as a HTTP Live Streaming video.

This branch actually didn’t take too long to bring into existence, but I’ve been thinking about it for a long time. There are a few issue to keep in mind:

  • Video is heavy on rendering, so you can only do one at a time
  • How do you do positional audio on video playback
  • How should the user interface work
  • How do we proxy videos (to obey cors and HTTPS mixed content restrictions)
  • How do ensure all videos are in sync (so multiple users see the same video at the same time)

As it turned out, the main problem of synchronising videos, we solved by enabling HLS / aka streaming video. If everyone is watching a live stream, then it’s mostly in sync.

This branch I hope to have released sometime today.

feature/mic-chat

Mic chat is such a core ingredient of a virtual world, that it’s almost embarassing it’s taken this long to come to cryptovoxels. You can see other people, why can’t you talk to them. I actually had voice chat working in old versions of SceneVR several years ago, so I know how to do it, but implementing it to work in Cryptovoxels has had a bunch of little unexpected obstacles.

Hopefully this will come soon. Positional audio with voice chat (and muting, respecting peoples privacy) and the stuff that goes with it (mute someone who is AFK), the ability to block people. There are lots of stuff required to have really good voice chat, the basics of sending an audio stream over WebRTC is done, it’s all the fine details that still requires time.

I suspect with this branch I’ll just quickly finish this up and deploy, then come back around on all the privacy management tools, which is a bit problematic — if you join the world and someone is being awful on voice chat, your only option will be to mute the entire world, but we’ve got to start somewhere.

feature/scripting

The .JS icon shows where all your parcels scripts are stored

This branch has involved lots of experimentation (I was thinking of using Lua for the scripting language at once stage), lots of false starts, and finally a good hack at it.

The key to getting this branch running, was deciding that all editing should happen in world, that there isn’t a seperate page for writing your scripting for a parcel, you just drop in a .JS model, and that physical object contains the scripts for your parcel.

Once I had done this, I quickly got the UI and storage of script working, then I could start working on actually running the scripts in a sandboxed environment. Now I have all these components running, the key missing part is mirroring changes to the world to all connected clients. This involves sending diffs that are generated by your scripts, and sending them out over the websocket connection to everyone that is nearby to your parcel. Initially, we can just send changes for the entire world to all connected clients, because we won’t have that many scripts, but as with the initial world loading code that loaded the entire world, that’ll start to break down as we mint more and more parcels.

Editing scripts in world (mostly)

This branch is quite important, because there is a lot of functionality hiding behind scripting (procedurally creating scenes, creating galleries, having simple games, facilitating ethereum transactions) — so I’ll keep smashing this one, even a basic (but secure) implementation will be a good place to start, it’ll be exciting to see what people build with it!

Cryptovoxels is a virtual world on the Ethereum Blockchain. Follow us on Twitter or join the Discord.

--

--