Limit Theory Redux is a fork of the discontinued open-world space simulation game Limit Theory. We have made it our mission to continue the development of the ambitious Limit Theory project as an open source initiative.
Apache License 2.0
62
stars
8
forks
source link
Introduce a cache for physics collision shapes. #334
With Trimesh enabled for Asteroids, spawning around 1,000 asteroids (5 asteroid fields x 200 asteroids each) take 30-40 seconds on my machine. This is because building the Trimesh hull is being done for the same mesh over and over again.
This PR adds a few things:
A unique caching key for each mesh, which is based upon the nanosecond timestamp when each mesh object is created.
A cache for rp::SharedShape objects, using the mesh cache key combined with the scaling factor (as scaling is "baked" into a rp::SharedShape right now).
Loading times in the above scenario has now decreased to only 2 seconds, which is a 20x improvement
With Trimesh enabled for Asteroids, spawning around 1,000 asteroids (5 asteroid fields x 200 asteroids each) take 30-40 seconds on my machine. This is because building the Trimesh hull is being done for the same mesh over and over again.
This PR adds a few things:
rp::SharedShape
objects, using the mesh cache key combined with the scaling factor (as scaling is "baked" into arp::SharedShape
right now).Loading times in the above scenario has now decreased to only 2 seconds, which is a 20x improvement