Live data from Hacker News

The Powder Toy

powdertoy.co.uk

1–10 of 17 posts

Re: The Powder Toy

#2
This looks nice. But, ideas are more important than code. So to be honest, I would enjoy a description of how this works more than actually playing with this program.

Re: The Powder Toy

#6
Are you simulating the powder on the GPU or the CPU? I couldn't find any shader code that looked relevant to the sim, so I'm guessing it's the CPU. Any plans on making a GPU version? Seems loke you'd be able to overcome the perf issues and finally make that 3D version.

Re: The Powder Toy

#7
post #2

This looks nice. But, ideas are more important than code. So to be honest, I would enjoy a description of how this works more than actually playing with this program.

From a quick look at the code it seems to be coded as a fairly standard particle system. Modern processors are fast, if you have a million particles, a 2GHz processor, and do 20 simulation steps per second you can spend 100 clock cycles per particle on simulating it. On modern processors 100 clock cycles usually translates to over 100 instructions.

Of course the ~100 clock cycles latency for fetching from main memory has to be avoided, so you code in a language like c++ (like this project) and pack your data in big arrays in the order it's accessed in. Then processor caches and prefetching do the magic.

Particle interactions that usually imply quadratic runtime can be made fast by mapping particle positions to a grid and either looking up neighbouring particles in the grid or calculating large scale effects directly with the grid.

Personally, I think for this project the working whole and the value it provides as a fun educational tool is a bigger deal than architectural or development ideas that went into it (but I'm happy to be proven wrong)

Re: The Powder Toy

#8

Are you simulating the powder on the GPU or the CPU? I couldn't find any shader code that looked relevant to the sim, so I'm guessing it's the CPU. Any plans on making a GPU version? Seems loke you'd be able to overcome the perf issues and finally make that 3D version.

I have serious doubts a 3d version would be better. It would be hard (if possible at all) to make an equally simple interface that conveys the same information and is equally easy and fast to use while allowing free 3d interaction.

Maybe that becomes a lot easier once virtual reality and 3d input devices become common, but until then I think there are better ways to use extra computation power

Re: The Powder Toy

#10
post #8

Are you simulating the powder on the GPU or the CPU? I couldn't find any shader code that looked relevant to the sim, so I'm guessing it's the CPU. Any plans on making a GPU version? Seems loke you'd be able to overcome the perf issues and finally make that 3D version.

I have serious doubts a 3d version would be better. It would be hard (if possible at all) to make an equally simple interface that conveys the same information and is equally easy and fast to use while allowing free 3d interaction. Maybe that becomes a lot easier once virtual reality and 3d input devices become common, but until then I think there are better ways to use extra computation power

The grandparent said GPU simulation, for the extreme parallel benefits, not making it 3D. Encoding the simulation in a GPU shader, for example.
Post reply on HN