Earlier quoted context omitted.
I respectfully disagree with your use of low level, though I do understand your analogy about the pixelbuffer being like a frame buffer. But he's actually using Javascript arrays which can get passed around inside a javascript VM, and do not have a set size. Not very "low level". I spent a moment and changed the arrays to Float32Arrays which have set sizes and sit in memory without being fucked with by the VM and spe…
Side by side, this is amazingly smoother than the OP.
Notch trying jsFiddle
101–110 of 143 posts
Re: Notch trying jsFiddle
#102Part of me can't decide if that's awesome or tragic.
Re: Notch trying jsFiddle
#103Awesome implementation, actually no advanced feature is used, this code could easily ported even to assembler in any device where you can set pixels in RGB format. And indeed it is pretty impressive how fast the rendering happens given that the code operates at such lower level... Even selecting the color of every pixel requires non trivial work in the inner loop. AWESOME code.
Re: Notch trying jsFiddle
#104Doesn't any web browser on Android use a JIT?
Re: Notch trying jsFiddle
#105Re: Notch trying jsFiddle
#106Awesome implementation, actually no advanced feature is used, this code could easily ported even to assembler in any device where you can set pixels in RGB format. And indeed it is pretty impressive how fast the rendering happens given that the code operates at such lower level... Even selecting the color of every pixel requires non trivial work in the inner loop. AWESOME code.
I would argue that this is terrible code. It's not using the appropriate tools (webGL), it's badly structured, uncommented and unmaintainable (seriously, why on earth would anyone name their variables zd, _zd and __zd?). The Minecraft source code is also of notoriously poor quality. I honestly don't understand how you came to your conclusion.
Re: Notch trying jsFiddle
#107Can someone dissect this code and explain what it does?
The first set of three nested loops is procedurally generating texmap, which is a multidimensional Array(16 * 16 * 3 * 16). 16x16 pixel textures, one for each the top, sides, and bottom, and then 16 of those. The inner loop tests against i, which is the current block "type" and performs customizations to the procedurally generated textures. The next set of three nested loops is generating a random "world" with a tunn…
It is pretty cool to see how a trivial lightning model like that can produce a pretty looking result.
If you want to see just the brightness of faces without texture to see more easily how light is used, just change the line:
var cc = texmap[u + v * 16 + tex * 256 * 3];
Into: var cc = 255+(255
To also remove the "distant is less bright" effect just add: ddist = 255;
Before: var r = ((col >> 16) ...Re: Notch trying jsFiddle
#108Earlier quoted context omitted.
I would argue that this is terrible code. It's not using the appropriate tools (webGL), it's badly structured, uncommented and unmaintainable (seriously, why on earth would anyone name their variables zd, _zd and __zd?). The Minecraft source code is also of notoriously poor quality. I honestly don't understand how you came to your conclusion.
The code is a direct port of Minecraft4k[1], it's optimised for space considerations. [1] https://twitter.com/notch/status/275329867984302081
"Code is awful due to the nature of the project"
Re: Notch trying jsFiddle
#109I showed it to my mom, and she was like ":Ooohh mother fucker"
Re: Notch trying jsFiddle
#110using window.requestAnimationFrame just because we can!