News for hackers. Stuff that matters.
Re:JavaScript particle simulator by pwnna on Tuesday November 19, 2013 @06:04PM (#6765134)
How is this made?

It's pretty slow on my computer. Would ASM.js work better?

Re:JavaScript particle simulator by fekberg on Tuesday November 19, 2013 @06:09PM (#6765158)
I'm getting 15 FPS in Chrome on my Surface Pro.

It uses OpenGL ES it seems, doesn't work in IE 11.

Edit: It would be interesting to know if this would perform better using WebGL and running it in IE 11, anyone has any thoughts on that?

Re:JavaScript particle simulator by nacs on Tuesday November 19, 2013 @06:54PM (#6765434)
60fps (cap I think) on Firefox 25 on i5 desktop.
Re:JavaScript particle simulator by pygy_ on Tuesday November 19, 2013 @07:28PM (#6765599)
It's GPU-, not CPU bound.
Re:JavaScript particle simulator by nacs on Wednesday November 20, 2013 @02:04PM (#6770267)
Yeah I assumed this when I noticed even the Retina laptops with the i7s weren't doing as well. I have an Nvidia GTX 560 Ti which must be doing most of the work.
Re:JavaScript particle simulator by consciousness on Tuesday November 19, 2013 @06:21PM (#6765232)
32 FPS - Chrome - Windows 7 - Thinkpad X1 Carbon i7

&

22 FPS on Firefox..

Re:JavaScript particle simulator by pwnna on Wednesday November 20, 2013 @12:22PM (#6769380)
Huh. A bug should be filed..
Re:JavaScript particle simulator by verisimilidude on Tuesday November 19, 2013 @06:19PM (#6765214)
45 FPS: Chrome on 2012 Macbook Pro. Looks fantastic.
Re:JavaScript particle simulator by blunte on Tuesday November 19, 2013 @06:39PM (#6765334)
51 FPS on new Macbook Pro Retina

It's gorgeous... reminds me of the good old "visualization" days of Winamp and MusicMatch

Re:JavaScript particle simulator by jhvh1134 on Tuesday November 19, 2013 @06:26PM (#6765263)
I could be wrong, but my understanding is that WebGL uses the exact same API as ES, including the same stripped down shader language.
Re:JavaScript particle simulator by pleasemakeitbig on Tuesday November 19, 2013 @06:12PM (#6765168)
25 FPS on Chrome/2013 Macbook Pro
Re:JavaScript particle simulator by Anderkent on Tuesday November 19, 2013 @06:59PM (#6765453)
Weird! I get 60 on Chrome 31.0.1650/2013 Macbook Pro.
Re:JavaScript particle simulator by TallboyOne on Tuesday November 19, 2013 @06:19PM (#6765212)
60fps on chrome
Re:JavaScript particle simulator by filipedeschamps on Tuesday November 19, 2013 @06:11PM (#6765166)
20 FPS - Chrome - MacBook Air/2011
Re:JavaScript particle simulator by shebson on Tuesday November 19, 2013 @08:20PM (#6765789)
I'm getting 38 FPS on a 2012 Macbook Air with Chrome. Didn't expect the HD4000/HD3000 difference to be so big.
Re:JavaScript particle simulator by mistercow on Tuesday November 19, 2013 @06:20PM (#6765222)
It looks like most of the heavy lifting is done in shaders, so asm.js probably wouldn't improve it much.
Re:JavaScript particle simulator by iamwil on Tuesday November 19, 2013 @06:28PM (#6765272)
It looks like there's some sort of gravity involved. So then how do you get around the O(n^2) problem of comparing the contribution of each particle to every other particle? Did they implement an quadtree of some sort, or is it something else?
Re:JavaScript particle simulator by admsyn on Tuesday November 19, 2013 @09:43PM (#6766007)
It looks like it's using a fluid solver. So, it's not that every particle is interacting with every other particle, but that there's a flow vector being established at each point on the screen and that's being added to each particle's position.

Disclaimer: I haven't actually analyzed the source.

Re:JavaScript particle simulator by mistercow on Tuesday November 19, 2013 @07:00PM (#6765467)
I'm wondering what optimization you can to that do with a quadtree. The only way I can see is if you sacrifice accuracy on distant particles by quantizing and counting. You could use geometric hashing to do the same thing.

Anyway, I don't think this demo is exhibiting inter-particle attraction, but I'm not positive.

Re:JavaScript particle simulator by brian_cloutier on Tuesday November 19, 2013 @07:38PM (#6765639)
Exactly right. The most common scheme uses a quadtree and runs around O(n log n).

http://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation