
Hacking Minecraft into WebGL - DanielRibeiro
http://metaphysicaldeveloper.wordpress.com/2011/12/20/implementing-minecraft-in-webgl/
======
rileya
Cool stuff!

It looks like you're just rendering plain cubes, I'd be curious to see how
much performance could be had by doing things the same as Minecraft (batching
only the visible surfaces into larger 'chunk' meshes). I've been interested in
WebGL for a while, and it'd be interesting to see how practical Javascript is
for a fairly CPU-intensive game like Minecraft.

I've always thought Minecraft was an interesting programming challenge (I made
a little clone of my own a while back (with portals, for whatever reason):
<http://www.youtube.com/watch?v=Qk_KjtbHUIs>).

~~~
DanielRibeiro
Wow, your minecraft portal implementation looks amazing! If you open source
it, please let me know.

~~~
rileya
Thanks! It's not the prettiest of code, but it's up on my github:
<https://github.com/RileyA/VoxelsAndPortals>

------
tluyben2
Lovely :) I guess we'll be seeing tons and tons of clones; I've seen many
Minecraft like games and engines appearing in the open source world in the
past month. If now only someone could explain what is fun about this game: I
tried playing Minecraft but didn't get it or something. It didn't appeal at
all. That might be just me though :) I do love coarse voxels though; the logo
for my company is a little voxel guy (made before this game).

~~~
SquareWheel
For me, Minecraft had a perfect gameplay flow. When I first entered the world,
I was lost and scared. Monsters came out and destroyed me. I hid.

Slowly I learned how to acquire and build resources. I found an island and
built a house on it. Monsters were no longer a threat. I made a farm and had
all the wheat I needed.

I started caving not for survival, but to acquire extra resources. I turned
those resources into large builds, both aesthetic and functional. I built a
minecart track into my mine shaft just for the convenience. I built art on my
island despite the fact that nobody else would see it. There was a huge amount
of freedom.

Minecarts used to act very strangely, to boost them you'd put them side by
side. I consulted the Wiki to figure this out, and learned about redstone at
the same time. I started building larger-scale contraptions with it, and made
a "challenge map" (I had never seen one before at this point).

Multiplayer came out around this time, and while extremely buggy, it allowed
us to play survival with friends. This hit at the perfect moment because up
till that point, I had a full understanding of the game and my interest was
beginning to wane. Multiplayer rejuvenated my interest, and I worked on some
large builds with friends. All vanilla, of course.

And now it's what, a year later? Minecraft has had some very large updates
lately, and while I'm not as enthused as I once was, I'm still looking forward
to see what the Mojang team and modders are able to do with the game.

------
yogrish
Looks like WebGL is really catching up. I see many posts on webGL these days
by fellow hackers. I hope it will be a great success.

------
wiradikusuma
The demo screen doesn't resize on browser resize. I'm using Chrome on Windows
7.

~~~
DanielRibeiro
Thanks for the feedback. Sorry about that, but it inherits from the fact that
none of Three.js' demos resize. This is because doing it is a lot more fun
than it looks: not the entire DOM canvas has to be changed, but all the
rendering engine behind has to be recreated (camera, scene and so on). I'll
see if I can make it work.

~~~
Arcanis
IIRC, you can change a Renderer size using renderer.setSize(w, h). In order to
update the camera aspect, you just have to use : camera.ratio = w / h;
camera.updateProjectionMatrix().

------
SquareWheel
Very cool, and a lot more involved than I would have expected.

------
Arcanis
Had you test it with a huge amount of blocks ?

~~~
DanielRibeiro
Yeah. Can't handle 14 million blocks as the original game (frameskip starts
going through the roof after 400 blocks). Doing this requires a lot more
tinkering, and I've got some great feedback on how to do this.

