At 3/8/09 06:43 PM, flaminggranny wrote:
I have a innate problem with people who knock other people's work that haven't implemented anything like it, or at least, don't have any examples up to prove it.
I don't need to have done exactly what it is you want to do to know the limitations of it. I know exactly how to implement the type of ball physics you'd need for this game, I know the limitations of flash 3D engines (which frankly is why I don't do 3D in flash, I'd rather use the power flash has to do really good 2D), yet trying to say that your physics are too complicated for your game is inane and ridiculous.
Treat the sphere as a point and:
1-extra component for speed (x, y, z) : 8 bytes of memory
Store the slope (normal vector and slope vector) of each tile: 2 x 3 x 8 x #oftiles bytes of memory (for 100 tiles this is just over 4 KB, no big deal at all) and a Z-coordinate (8 bytes)
Adding the slope to the ball's speed on collision: (equation of a plane is Ax+By+Cz=D, A,B,C is the stored normal, you can easily pinpoint what tile your own (2 multiplications) then pump the ball's position into the plane equation (3 multiplications + 2 additions, and a greater than comparison), if you aren't doing bouncing this is even easier cause this is all you need, but even bouncing is a dot product (3 multiplications, 2 additions) and a subtraction (3 additions).
So your entire physics engine is a few KB of memory, plus 15 extra floating point operations per frame. What's the big deal with the physics exactly?