I’m currently working on implementing physics into my blocky-voxel game.
I just decided to go for bullet and it works astonishingly well so far, I create meshCollisionShapes from the meshes that are already created for a chunk (so another time I’m happy about greedy meshing) and I can have like a hundred of balls rolling around the world.
The only problem is memory footprint. Without physics the game takes about 2GB (that is heap and direct memory together) but when I enable physics it takes more than 5GB, so thats 3GB only from bullet and I cannot even see that memory increase in the ingame memory stats so I guess that also hints towards Bullet.
Now that I’m also working on writing chunks to disk that can be seen, but are too far to interact with, i was wondering if there is a similar way to handle the bullet memory. Since creating the collision shapes takes some time (I use the MeshCollisionShapes ‘advanced constructor’ and profiler tells me 99% of the time the collisionshape creation takes is spent in native ‘createShape’ method), I try to create collision shapes for all chunk even when they are too far to interact with, but instead of adding them to the physicsspace I would like to write them to disk
so question: is there a way to let bullet create the data it needs and then write all that data to disk, later read it back and initialize a collision shape from that?
and little side question: is there a way to ask bullet for the amount of memory it currently consumes?
As always, thanks in advance already and greetings from the shire,