
Show HN: Implementing UDP live – Write webgames today that use UDP, not TCP - shawn
https://www.twitch.tv/avaer?1
======
shawn
Hey HN, avaer and I have been working on a competitor to Chrome and Firefox.
As strange as it sounds, we seem to be winning -- our performance is >2x
faster than Chrome and FF. You can prove this to yourself today, right now, by
running `exokit zeovr.io` (which runs [https://zeovr.io](https://zeovr.io) in
our browser instead of Chrome).

Let me back up.

1\. Go to [https://zeovr.io](https://zeovr.io). Note that it appears to be a
Minecraft clone. (This is what originally hooked me into working with avaer. I
was blown away that someone had apparently cloned Minecraft successfully.)

2\. Note that you're not getting a smooth 90FPS. On my 2015 MBP, I get about
12FPS.

3\. Install exokit: `npm i -g exokit`

4\. Run `exokit zeovr.io`

5\. Note that you get 3x the FPS of Chrome. It should be butter smooth on most
semi-modern computers. (If you bought your laptop within the last 3 years,
chances are you're staring at a solid 90FPS.)

6\. Note that zeovr.io runs in Chrome! Meaning it's just a website.

You can build things like this today, right now. No need to wait for anyone.
It works, and we're showing it off on the stream live.

We submitted this Show HN on a lark and figured that it probably won't go
anywhere. But as long as we focus on delivering something good and on talking
to users, we figure the rest will follow.

The stream's viewer count doubled tonight, and it was mostly thanks to some
grassroots community support. There's a ~crapload of work to do to get this
done for real, so if anyone wants to pitch in, there's always _something_ you
can help out with. We need to set up docs, a support website, test installers,
set up continuous update, and just say hi to people as they show up and make
them feel welcome. Everyone can do that last part :)

Here's an example. If you go to
[https://emkolar.ninja](https://emkolar.ninja), it appears to be a regular
website: A portfolio showing off her projects.

If you run `exokit emkolar.ninja`, it shows a 3D rubik's cube using threejs.

And if you have a Vive headset, you see the cube in 3D and can physically move
your head around to look at it from different angles.

You also have access to the Vive controller API, so it's very easy to make the
cube respond based on the controller's orientation.

Now for the best part: Everything you've just seen also runs on the Magic
Leap. Today. I think avaer's probably the first person in the world to
integrate with the Magic Leap simulator so thoroughly. He exposed all the
relevant APIs to Javascript, as web standards. Meaning you can write websites
right now that runs in Chrome, on the Vive, and in the Magic Leap.

And if you happen to have a pair of ML goggles (Hi Rony!) you can even see it
running live in the real world.

Here's another example. Right now you can't write a web game that uses UDP.
There's WebRTC, which is horribly complicated. When I was a kid I taught
myself network programming with Beej's guide:
[http://beej.us/guide/bgnet/html/single/bgnet.html](http://beej.us/guide/bgnet/html/single/bgnet.html)

WebRTC is the polar opposite of that simplicity.

So tonight I was like, "Hey avaer, how muche effort do you think it would be
to expose UDP to websites?"

To his credit, he was very hesitant. He pointed out that there are security
concerns and standards concerns. But, theroetically, it could be done in ten
minutes.

"So do it."

Ten minutes later we shipped, and we now have a global `dgram` variable that
you can use:
[https://nodejs.org/api/dgram.html#dgram_dgram_createsocket_o...](https://nodejs.org/api/dgram.html#dgram_dgram_createsocket_options_callback)

If you write a website like this:

    
    
      if (typeof dgram !== 'undefined') {
        /* use UDP here */
      }
    

Then it will run properly in Chrome. But if you run it in exokit, it will
work! You can proceed to write games using UDP.

I would say the hardest part is conveying to people "This is just a website.
You already know how to do this. You can do this right now. It's real."

We don't have to wait for Chrome or Firefox to ship standards anymore. And
speaking as both a user and a cofounder, that's exciting as hell.

