Hacker News new | past | comments | ask | show | jobs | submit login
Hacking Minecraft into WebGL (metaphysicaldeveloper.wordpress.com)
52 points by DanielRibeiro on Dec 21, 2011 | hide | past | favorite | 16 comments



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).


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


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


I too would like to see the performance improvement if he enables back face culling.


I doubt there would be one.

On modern graphics hardware, backface culling is done by the hardware itself. It would help if this demo were anywhere close to the limits of the hardware, which it isn't.

Instead, it's likely to be limited by the JavaScript code that runs it. Backface culling wouldn't help here.

riyela is probably referring to the way Minecraft itself draws the world. If you have a solid block floating in free space, Minecraft draws all six faces of that block. However, if you have two solid blocks touching, Minecraft doesn't bother drawing the faces between them. It only draws the faces that are exposed to air (and are, therefore, visible), so it doesn't need to draw nearly as many faces.

That should get a decent performance improvement.


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).


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.


Minecraft seems to be so many different things to different people:

1. It's an incredibly deep game about surviving, exploring, and reshaping the natural world.

2. It's an artistic medium that allows elaborate visions of architecture and fantasy worlds to be realized very easily, albeit with large blocks.

3. It's a fun way to hang out with people online, like Second Life without the indulgence and materialism.

4. There is whole field of "Minecraft science", where people do experiments to figure out how the game works and invent machines in-game that do things way beyond what the developers ever intended.

5. People design custom worlds and publish them for others to play. These can be long narrative adventures, short puzzles, parkour courses, and some team sports have recently emerged.

6. A huge developer ecosystem has grown from only decompiled and manually de-obfuscated source code. People have modified the game in amazing ways, and some mods have been incorporated into the official game. An official developer program is in the works.

7. "Let's Play Minecraft" shows on YouTube are unusually entertaining. The game is so open ended that you can really get creative with the format and content of the show.

I don't know what it will be for you, but I'd be amazed if you never got anything out of it.


Thanks! I think Minecraft does a great job into giving users superpowers[1] and let them show how awesome they are, instead on how cool the product or the company that created it is.

Having that said, the fun of Minecraft (besides doing survival mode's challenges/killing monsters) is being awesome: take a peek into Minecraft top 5[2] creations for mindblowing spaceships[3], castles[4], roller costers[5] and circuits[6]!

[1] http://konigi.com/notebook/kathy-sierra-creating-awesome-use...

[2] http://www.youtube.com/show?p=QfGZKvRNom4&tracker=show_a...

[3] http://www.youtube.com/watch?v=yKEbBX21igc&feature=sh_e_...

[4] http://www.youtube.com/watch?v=bTgmEB0IHcY&feature=sh_e_...

[5] http://www.youtube.com/watch?v=Noa-z3pqEL8&feature=sh_e_...

[6] http://www.youtube.com/watch?v=KgY7IpZtVNY&feature=sh_e_...


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.


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


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.


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().


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


Had you test it with a huge amount of blocks ?


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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: