Friday, October 8, 2010

Particles on iPad : Part III

I've worked out a few stability issues.  The iPod touch, first generation, seems to handle about 200 particles on screen (each colliding and exerting forces on each other) at about 15fps.  Not ideal...  I'm going to delve back into the math books and learn until I can implement a better integration scheme.

I have fixed the stability issues.  The force repelling the particles acted like a one-way spring.  That is, it just ejected stuff but did not apply forces to bring them back towards the particle (well, sphere).  My springs now are the same equation; but they have an area of effect equal to the radius of the particle.  This ensures that the maximum force that is applied to bring the particles together does not exceed the force that is used to repel particles.

Another issue was that my clamping of velocities to satisfy the stability criterion was done after the velocity was applied to the positions.  This meant that particles could travel further than what was safe (in other words, the distance it could travel before the simulation would oscillate to explosion).

Lastly, even all of this worked very nicely; I got the same jumbling I got with the SPH method, but a bit better.  The problem was that as particles were pushed down (say due to gravity), they would compress temporarily as the system (indirectly) resolved the pressure each frame.  Ideally, I'd want zero compression - or zero divergence.

To fix this last issue; I believe I need to brush up on the underlying mathematics.  Namely linear algebra to get a better hold of the concept of eigenvectors and eigenvalues in order to work out implicit methods to numerical integration.

The other problem is speed.  At 200 interacting particles, the iPod isn't a speed daemon.  It's rather slow.

In the end; because of speed and math - I'm shelving my particle idea for a year or so for hardware to improve and my knowledge of mathematics to improve.

In the meanwhile; working within my current limits, I'm mentally playing with a means of gameplay that would take advantage of the multi-touch screens.  For iPods/iPads I'm very interested in what interactions I can achieve which were impossible or impractical using regular game controllers, mice, and keyboards.

No comments:

Post a Comment