09-10-2008, 10:56 AM
Once upon a time there were two races of collision shapes living in the land of Nif. The TriStripsShapes, huge, twenty feet tall creatures. They could survive almost anywhere without problems, but unfortunately their brain had the size of a peanut.
Then there were the Primitives, a race of intelligent, but tiny people. A single Primitive couldn't do much, but they were a social race and often came in large numbers.
These two races fought each other for a long time. Sometimes the TriStripsShapes would win when even a large number of Primitves couldn't overcome them. Other times the Primitves would claim victory when they found a single and weak TriStripsShape that was easy to defeat.
But none of the two races did any good to Nif. The TriStripsShapes used up more resources than they needed in their mindless idiocy, leaving a barren wasteland behind them. The Primitves were intelligent, but they were simply too small to make up for the damage the TriStripsShapes did.
But the gods were gracious. Tazpn, the mighty ruler of heaven, decided to create another race. They were of average size and were nearly as intelligent as the Primitves. He called them MOPPs.
Now the three races are fighting for domination. Who will perish, who will prevail? Will the land of Nif finally find its peace? This is the story of the great battle of collision shapes...
Hmmm...yeah. The reason for this thread is not that I want to tell you a story, it's about the performance tests I did using the different collision shapes available now. I simply wanted to know the exact performance differences between the different shapes.
The Setup
I've made two tests. I call them 'The Basic Test' and 'The Simple Test'. For all of the tests I used very simple placeholder meshes and skeletons without bodies (floating skulls) as creatures to make sure the rendering/animating of meshes doesn't influence the performance result. I created three different types of collision for each test and ran a performance test independantly by only using one type at a time. I've made collision built from primitives, MOPP shape collision and PackedTriStripsShape collision as comparison. I placed hundreds of those meshes and 21 creatures that walk around constantly in a test cell to get the result.
I loaded the cell, saved and ran the same way of about 5000 game units while running FRAPS for a benchmark with the different collision shapes. I ran each test twice and compared the results to make sure there was no weird coincidence messing with the results. But they all were about the same with +/- 2% difference only.
The Basic Test
This one uses a mesh similar to the Dwemer 2way from my tileset, so it has average detail (I replaced the mesh itself with a simple box afterwards for testing, see above). The primitive collision is made up of 12 box shapes and 2 capsule shapes. The mesh based collision has 48 triangles, covering the same areas as the primitives to the same degree.
MOPP
Avg: 120.561 - Min: 76 - Max: 170
Primitives
Avg: 79.911 - Min: 57 - Max: 106
PackedTriStripsShape
Avg: 61.293 - Min: 48 - Max: 74
The MOPP shape wins this one clearly. I was surprised how bad the PackedTriStripsShape really is. Don't even want to know how bad the non-packed TriStripsShape is.
The Simple Test
Most of the times you will have many redundant sides when using Primitves (like in the first test, where boxshapes were often used as one-sided planes), but some meshes have a nearly perfectly clean shape that uses most of the primitives without any redundant sides. In this test I used a mesh that is more appropriate for primitve collision. It uses a cube mesh with four quadratic pillars coming out of it. The primitve collision uses five boxshapes with only 5 sides of the total amount of 30 sides redundant, the MOPP and PackedStrips use 50 triangles.
MOPP
Avg: 118.509 - Min: 75 - Max: 170
Primitives
Avg: 104.219 - Min: 69 - Max: 145
PackedTriStripsShape
Avg: 60.868 - Min: 46 - Max: 75
To my surprise the MOPP won this one as well quite clearly. Just like before the PackedStrips had ~50% of the MOPP performance only.
I didn't make a test with a single box primitve compared to a 12 triangle MOPP/TriStrips shape. I think it's safe to assume the performance difference doesn't matter much, you can use one or the other. For mobile objects you should always use primitives or convexshapes I guess, that's at least what Beth did and there has to be a reason. Probably mesh based collision and animation doesn't work well.
...so the war came to an end. The TriStripsShapes vanished from the land of Nif and were never seen again. Only few Primitves were left, a shadow of what they used to be. A new age had begun, the glorious age of MOPP.
EDIT: Just did a test after converting the first real tile (Dwemer 2way) collision from my old PackedStrips/Boxshape combo to MOPP. Put 240 tiles in a cell with 10 creatures and ran the same route twice, just like I did with the other tests.
Old collision
Avg: 77.506 - Min: 71 - Max: 93
New MOPP collision
Avg: 136.919 - Min: 118 - Max: 194
Wohooo! You can expect a huge performance increase for my tileset once I'm done with updating all the tiles.
Then there were the Primitives, a race of intelligent, but tiny people. A single Primitive couldn't do much, but they were a social race and often came in large numbers.
These two races fought each other for a long time. Sometimes the TriStripsShapes would win when even a large number of Primitves couldn't overcome them. Other times the Primitves would claim victory when they found a single and weak TriStripsShape that was easy to defeat.
But none of the two races did any good to Nif. The TriStripsShapes used up more resources than they needed in their mindless idiocy, leaving a barren wasteland behind them. The Primitves were intelligent, but they were simply too small to make up for the damage the TriStripsShapes did.
But the gods were gracious. Tazpn, the mighty ruler of heaven, decided to create another race. They were of average size and were nearly as intelligent as the Primitves. He called them MOPPs.
Now the three races are fighting for domination. Who will perish, who will prevail? Will the land of Nif finally find its peace? This is the story of the great battle of collision shapes...
Hmmm...yeah. The reason for this thread is not that I want to tell you a story, it's about the performance tests I did using the different collision shapes available now. I simply wanted to know the exact performance differences between the different shapes.
The Setup
I've made two tests. I call them 'The Basic Test' and 'The Simple Test'. For all of the tests I used very simple placeholder meshes and skeletons without bodies (floating skulls) as creatures to make sure the rendering/animating of meshes doesn't influence the performance result. I created three different types of collision for each test and ran a performance test independantly by only using one type at a time. I've made collision built from primitives, MOPP shape collision and PackedTriStripsShape collision as comparison. I placed hundreds of those meshes and 21 creatures that walk around constantly in a test cell to get the result.
I loaded the cell, saved and ran the same way of about 5000 game units while running FRAPS for a benchmark with the different collision shapes. I ran each test twice and compared the results to make sure there was no weird coincidence messing with the results. But they all were about the same with +/- 2% difference only.
The Basic Test
This one uses a mesh similar to the Dwemer 2way from my tileset, so it has average detail (I replaced the mesh itself with a simple box afterwards for testing, see above). The primitive collision is made up of 12 box shapes and 2 capsule shapes. The mesh based collision has 48 triangles, covering the same areas as the primitives to the same degree.
MOPP
Avg: 120.561 - Min: 76 - Max: 170
Primitives
Avg: 79.911 - Min: 57 - Max: 106
PackedTriStripsShape
Avg: 61.293 - Min: 48 - Max: 74
The MOPP shape wins this one clearly. I was surprised how bad the PackedTriStripsShape really is. Don't even want to know how bad the non-packed TriStripsShape is.
The Simple Test
Most of the times you will have many redundant sides when using Primitves (like in the first test, where boxshapes were often used as one-sided planes), but some meshes have a nearly perfectly clean shape that uses most of the primitives without any redundant sides. In this test I used a mesh that is more appropriate for primitve collision. It uses a cube mesh with four quadratic pillars coming out of it. The primitve collision uses five boxshapes with only 5 sides of the total amount of 30 sides redundant, the MOPP and PackedStrips use 50 triangles.
MOPP
Avg: 118.509 - Min: 75 - Max: 170
Primitives
Avg: 104.219 - Min: 69 - Max: 145
PackedTriStripsShape
Avg: 60.868 - Min: 46 - Max: 75
To my surprise the MOPP won this one as well quite clearly. Just like before the PackedStrips had ~50% of the MOPP performance only.
I didn't make a test with a single box primitve compared to a 12 triangle MOPP/TriStrips shape. I think it's safe to assume the performance difference doesn't matter much, you can use one or the other. For mobile objects you should always use primitives or convexshapes I guess, that's at least what Beth did and there has to be a reason. Probably mesh based collision and animation doesn't work well.
...so the war came to an end. The TriStripsShapes vanished from the land of Nif and were never seen again. Only few Primitves were left, a shadow of what they used to be. A new age had begun, the glorious age of MOPP.
EDIT: Just did a test after converting the first real tile (Dwemer 2way) collision from my old PackedStrips/Boxshape combo to MOPP. Put 240 tiles in a cell with 10 creatures and ran the same route twice, just like I did with the other tests.
Old collision
Avg: 77.506 - Min: 71 - Max: 93
New MOPP collision
Avg: 136.919 - Min: 118 - Max: 194
Wohooo! You can expect a huge performance increase for my tileset once I'm done with updating all the tiles.