I've integrated Bullet physics into my engine, and would like to use it make a game that scales from very small objects to very large objects (similar to Katamari Damacy). So basically it spans objects over several orders of magnitude, but all dynamic objects are always within an order of magnitude or two. I've seen it stated in a few places, including the wiki (http://www.bulletphysics.org/mediawiki- ... _The_World), that you should try to stay within the range of 0.05 to 10 units in size. So that allows me to have objects 2-3 orders of magnitude difference at any given time. Also, I can get by with much smaller differences in mass (say 1 magnitude or factor of ten difference between smallest and largest object).
Because of the effect range limitation of 0.05 to 10 units, I'm assuming I will have to re-scale the world many times over the course of the game. My first hope was to have everything scale seamlessly in and out. So when the game is "zooming out" to allow larger objects to be visible, smaller objects would be removed from physics and eventually faded out graphically. This was to happen all in real time from the smallest magnitude to the largest. However, after reading the manual, I'm having doubts that I can do it seamlessly.
My plan is to basically find the maximum effective range in Bullet, and then have a sliding window (with a range smaller than the maximum effective Bullet range), that starts at smallest effective Bullet magnitude, and slides to the largest effective Bullet magnitude. As objects leave the window, they are removed from physics, and as they become relevant to physics (fading in graphically for example) they are added to the system. Once that sliding window's high value hits the largest effective Bullet magnitude, I would need to re-scale the world.
As far as I can tell, the way to scale in Bullet is to remove the object from the world and re-add it with the larger scale. I would also need to re-scale velocities, positions, gravity, etc (all the stuff listed in the "Scaling The World" article). So I'm basically re-creating the world completely from the old objects whenever that "sliding window" hits Bullet's edge of effectiveness. My intuition is that this will be too slow to do in real time without a stutter. I can do some gameplay solutions like pausing the game and saying "congrats! size increase!" or something along those lines while I re-create the world in the background, so the seamless real-time requirement isn't extremely important (but would be very nice).
Final notes:
- I say orders of magnitude a lot in the post. Just for clarity, I'm using base 10, and referring to exponents of 10.
- You may have noticed I didn't give any object counts or firm requirements. I'm only prototyping right now, so my design is likely to change a lot depending on how many objects I can have going at once.
- I'm targeting 2D on mobile devices, so that will likely affect my performance and number of objects a lot. I didn't declare this from the start because I could see this idea working well in 3D on more powerful devices as well, if I can't get it fast enough on my target device.
Thank you very much for reading!
-Will
P.S. I'm going to do some tests as soon as I have time on the performance of re-creating the world, and will hopefully have a prototype of my solution up and running by the end of the week.