
WebGL + Node.js + WebSockets = A Web Technology Perfect Storm - travisglines
http://www.travisglines.com/uncategorized/webgl-node-js-websockets-a-web-technology-perfect-storm
======
jessedhillon
One of these is not like the others: node.js is a nice, progressive step
forward, not a leap that is discontinuous with what preceded it like WebGL and
WebSockets. And certainly, node.js did not enable this chat example to happen
-- not in the same way that WebGL or WebSockets did.

<rant>I am getting a little tired with the node.js cheerleading on HN. I've
tried it and I don't see it as a huge leap forward from what can be done with
Twisted + Python, or Go, or many other solutions. The major drawback is that
you're writing in Javascript -- and maybe I have been doing something wrong,
but any sufficiently complex JS app tends towards callback spaghetti, in my
experience. (And I do like writing JS)</rant>

~~~
weixiyen
> but any sufficiently complex JS app tends towards callback spaghetti

Callback spaghetti is quite easy to avoid.

> and maybe I have been doing something wrong

If you have callback spaghetti, regardless of the complexity of the app, you
are most likely doing something wrong.

> I don't see it as a huge leap forward from what can be done with Twisted +
> Python, or Go

Of course not, but it's not hard to imagine that Node.js will have the biggest
ecosystem in this space and with it comes advantages (and perhaps
disadvantages).

~~~
gambler
> Callback spaghetti is quite easy to avoid.

That's what people say about most bad programming practices. "It's not the
language, you can write good code in the language." This doesn't really help,
though. The reality of programming is that different languages encourage
different styles of programming. They shape the eco-system, the space of the
solutions you will find for you problems.

JavaScript lacks tools for managing complexity. I don't work with it a lot,
but most of the JS code I've seen recently was, in fact, callback spaghetti
(with arbitrary global state modifications). That's the ecosystem the language
created. Hearing how it's avoidable doesn't make my life any easier when I
work with such code.

------
nkassis
Yeah I tend to agree that the in the last year and half web technologies have
exploded in capabilities. And looking at what was traditionally only possible
on the desktop, that category is slowly starting to dwindle.

Part of my job has been to remake visualization software (for brain imaging
research) on the web and aside from some really heavy stuff, WebGL has served
me well. Javascript engines are getting so fast, I haven't had problem
computation heavy tasks that much. Most of the time it's my code that's
shitty.

Now my most limiting factor is the damn slow upload speeds I get in canada. If
only I could get 2-3 Mbps up, I could do some great stuff.

------
msy
This is awesome but it does seem a touch depressing we've taken 15 years to
incompletely replicate VRML. In the bleeding edge of one browser engine.

~~~
Fester
How can you compare OpenGL with XML?

------
kaib
WebSockets are really cool but we found the browser implementations unstable
enough that we switched back to XHR for Tinkercad. Especially since the secure
implementations were super shaky and we run all our traffic over SSL.

We also use Go and not Node.js for the backend so the only thing qualifying us
for this perfect storm is WebGL.. :-)

~~~
MatthewPhillips
I'd love to see a blog about your experience with using Go as your web server.
Did you use the standard library, Web.go, or something else? There have only
been a few deploy production web apps with Go so far, so the knowledge needs
to spread.

~~~
kaib
For Tinkercad the http server is just a relatively simple transport layer, the
magic happens with how the computation is distributed in the cluster. We'll
blog about it once things settle down a bit, at this point we are just trying
to soldier ahead with the beta. :-)

------
dshankar
<http://labs.travisglines.com/>

Very cool demo built by Travis, 3D WebGL chat

------
rachelbythebay
This turns my laptop into a space heater. Nice, but not the sort of thing I'd
want to run for extended periods of time.

------
daveelkan
I love the demo for it's thought provoking stab in the brain. I love three.js
and can't wait to tie it into my own app.

re: WebGL games. The clients will all be "open source" (as they're
javascript). What effect do you all think that'll have on the future web-based
gaming industry?

~~~
anty
The most obvious problem is probably that it's way easier to develop
bots/cheats for those games.

Since I'm currently developing a WebGL game I'm actively searching for ideas
to detect that behavior.

The only solution I can think of is, to capture any data with timestamp coming
from the client and applying some tests to it like "is the client sending more
messages than a normal client" or more advanced: sending the input through a
statistical filter to detect possible cheating and investigate from there on.

~~~
daveelkan
Sounds bloody hard!

It might be an idea to think about the actual mechanics of the game once
you've come up with a possible solution so that the game itself doesn't invite
cheating behaviour or at least makes it easier to detect. i.e. Making it
physically impossible to shoot faster than a specified rate or move too
quickly/accurately, etc.

Good luck!

------
bensummers
Is there a secure version of WebSockets yet?

[http://hacks.mozilla.org/2010/12/websockets-disabled-in-
fire...](http://hacks.mozilla.org/2010/12/websockets-disabled-in-firefox-4/)

~~~
wmf
Yes: [http://tools.ietf.org/html/draft-ietf-hybi-
thewebsocketproto...](http://tools.ietf.org/html/draft-ietf-hybi-
thewebsocketprotocol-06)

Hopefully it will be re-enabled in Firefox 5.

------
bad_user
On the latest version of Chrome / Ubuntu Linux, doesn't work for me.

~~~
JoshCole
Close your browser. Open the console. Open your browser with:

    
    
      google-chrome --enable-webgl --ignore-gpu-blacklist

~~~
drdaeman
This does not work on Chromium 12.0.712.0 (79102) on Ubuntu 10.10. Everything
just silently fails with "Error creating WebGL context." in JS console.

~~~
JoshCole
I'm not really sure what is wrong, but it might be that you lack OpenGL
libraries. You might want to check out this page:
<http://learningwebgl.com/blog/?p=11>

I figure I might as well let you know what you're missing. The guy coded up a
3D world in which you walked around as a square with text floating above your
head. It reminded me of World of Warcraft and other MMOs, despite its graphics
being far below those of Minecraft.

------
wh-uws
Great demo but you should have a warning because of that one color shifting
block in the middle

<http://webaim.org/articles/seizure/>

or make it not do that

~~~
travisglines
I should make people spawn in random places instead off all at the same spot
to change that (what you're seeing is like 100 overlapped blocks).

~~~
sthatipamala
What is the purpose of the large black Kaabah structure in the middle?

~~~
travisglines
It can be really hard to get your bearings sometimes if things are all the
same shape/size, especially if there isn't many people in the app. It needed a
central location or gathering point so I figured why not throw a giant obelisk
thingy in there?

Its fun watching what people say about it. They want to know why its there,
why its black and if its real.

~~~
demallien
I was just disappointed that the ratios don't appear to be 1:4:9

------
mcantelon
I love the demo. Reminds me of Swarmation... people dropped into a new world
there they have to figure out the rules and how to interact.

------
lux
That demo is good fun!

~~~
benatkin
Indeed it is! The best message I saw was, "I met my wife on here".

~~~
lux
That's awesome!

------
drivebyacct2
That was far too amusing. I found it interesting that we grouped on one spot
on the monolith. I ventured out away from everyone twice, once apparently with
the same person.

------
Aetius
<trivial app> in <less than 100LOC> with <new tech>.

Old meme is old!

Writing a chat app is one thing. Writing a node.js 3D MMO is _quite_ another.

