setInterval(clock, 1000 / 100); Is there any reason for writing 1000/100 instead of 10? edit: Thanks guys!
Notch trying jsFiddle
41–50 of 143 posts
Re: Notch trying jsFiddle
#42Why is the framerate poor even when I shrink the viewing area down 10x10? It seems to have the same stutter as the original large view. Is it because it's doing the same calculations but just showing fewer pixels?
Re: Notch trying jsFiddle
#43Earlier quoted context omitted.
No I really mean low level :-) Javascript is high level, but here notch is using it as a low level framebuffer.
> And indeed it is pretty impressive how fast the rendering happens given that the code operates at such lower level. Sorry if this is a stupid question, but wouldn't you normally expect low level code, whilst more time consuming to write, be faster or just as fast as higher level code. For example, how C is used as a standard for fast code since it's so low level.
In this case, Notch is writing code that doesn't necessitate the overhead of using JS. It could easily be rewritten as C and probably run faster that way. Not that it isn't interesting, of course.
Re: Notch trying jsFiddle
#44Earlier quoted context omitted.
Update: Thanks for the repliers. You are absolutely right: this is a 3D rendering. What I meant to say is that it is using Canvas 2D, instead of Canvas 3D, also known as WebGl. Antirez gave a wonderful explanation above[1]: 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…
I appreciate it is written onto a 2d plain. But it does look like 3D. This appearance of looking like 3D when a screen is 2D is complicated and very mathsy (not a word - I know). I've tried reading about it before but it is not straight forward.
[1] Of course, it gets more complicated if you want to be more realistic, like including a field of view (cone) rather than a screen-sized chunk (prism) of 3D objects, and so on, but these are just details.
Re: Notch trying jsFiddle
#45setInterval(clock, 1000 / 100); Is there any reason for writing 1000/100 instead of 10? edit: Thanks guys!
Re: Notch trying jsFiddle
#46Re: Notch trying jsFiddle
#47setInterval(clock, 1000 / 100); Is there any reason for writing 1000/100 instead of 10? edit: Thanks guys!
Re: Notch trying jsFiddle
#48Why is the framerate poor even when I shrink the viewing area down 10x10? It seems to have the same stutter as the original large view. Is it because it's doing the same calculations but just showing fewer pixels?
Re: Notch trying jsFiddle
#49Why is the framerate poor even when I shrink the viewing area down 10x10? It seems to have the same stutter as the original large view. Is it because it's doing the same calculations but just showing fewer pixels?
It does get better framerate changing the variables: http://jsfiddle.net/wATAp/
Re: Notch trying jsFiddle
#50 for ( var x = 0; x