Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[Codechange] Reworked the sleeping mechanism #1187
But it also brings back parts of the 0.38.67 sleeping behavior:
Now that you touched this area...
- I've always been under strong impression our intricately recursive sleeping mechanism doesn't need to be neither intricate nor recursive. Why not have
bitset<> visited; bitset<> updated; bitset<> prev_updatedand simply iterate until
prev_updated == updated?
- Our sleep mechanism doesn't cache AABB intersections. That's pretty dumb because if truck A doesn't touch truck B, then naturally B doesn't touch A, although RoR will evaluate that. Also, performance; Ogre's AABBs are slow, check their impl: https://bitbucket.org/sinbad/ogre/src/108ab0bcc69603dba32c0ffd4bbbc39051f421c9/OgreMain/include/OgreAxisAlignedBox.h?at=v1-9&fileviewer=file-view-default#OgreAxisAlignedBox.h-562:591 and Matias N. Goldberg's notes in OGRE2+: http://www.ogre3d.org/docs/api/2.0/struct_ogre_1_1_aabb.html#details. Also possibly http://www.yosoygames.com.ar/wp/2013/07/good-bye-axisalignedbox-hello-aabb/ (Matias N. Goldberg again, but the link is blocked for me at work)
The current truck (the one the player sits in) is the only root of the graph.
It's not the first time I touched it. I've already simplified it greatly in this PR: a0a85c8
It doesn't need to cache them, because we never check the same edge twice.
It's not worth to mess with them before we upgrade Ogre in my opinion.
That was a big win indeed.
I'm afraid that's not an universal solution. It works for the most stereotypical RoR scenario. But what if you build a tower of paper boxes and then shoot it with a tennis-ball cannon?
The graph is still fine, but you'll need one per each moving element. Falling boxes may wake up other boxes. Under these circumstances, both caching and AABB efficiency come back to play.
Agreed. And nobody implemented anything like the tennis-ball scenario so far. But it'll come (I hope!). It's something to keep in mind.