Jump to content

  • Log In with Google      Sign In   
  • Create Account


Physics and huge game worlds


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 bmarci   Members   -  Reputation: 366

Like
0Likes
Like

Posted 16 January 2014 - 08:20 AM

Hi,

 

Did any of you used Bullet in huge game maps?

 

I'd say loading all the 100.000 objects and feeding them into the physics engine is not an option.

First I'd go for dynamicaly load/add collision shapes within a certain radius of the player and remove them when they are out of "interest".

So the question is;

How rapid modification (add/remove) of the physics world affects the performance, and what about memory fragmentation?

Is it advised to implement some self made memory manager for this, or does the bullet handle it fine?

Also btBvhTriangleMeshShape takes some time to build the hierarchy, so  serialize or not to serialize??

 

thanks for any help smile.png


Edited by bmarci, 16 January 2014 - 08:20 AM.


Sponsor:

#2 ferrous   Members   -  Reputation: 1453

Like
0Likes
Like

Posted 16 January 2014 - 01:01 PM

As an aside, Havok deals with that kind of problem with their concept of Islands.  I'm guessing Bullet doesn't have a similar built in structure? 



#3 xexuxjy   Members   -  Reputation: 553

Like
0Likes
Like

Posted 21 January 2014 - 08:02 AM

Adding / removing objects to bullet should be pretty quick, and the bullet broadphase would minimise any unnecessary collision tests, especially if most of the objects in the sim are static. Having said that, having all that collision data around in memory may not be that useful if the only things you ever test are near to the player.

You might also want to consider keeping a portion of the collision shapes/ rigid bodies available in memory even if they're not part of the simulation world , maybe creating the serialised versions of the collision shapes as part of a build rather than run-time step.

In terms of memory usage , it will depend a bit on which broadphase you use, AxisSweep will allocate a large block of memory base on what you set it up (maxHandles) , Dbvt has a freelist for nodes it creates so neither should thrash / fragment memory particularly.



#4 Krohm   Crossbones+   -  Reputation: 2921

Like
1Likes
Like

Posted 22 January 2014 - 11:12 PM

As an aside, Havok deals with that kind of problem with their concept of Islands.  I'm guessing Bullet doesn't have a similar built in structure? 

It does, but sadly, it doesn't expose them at library level.

 


Also btBvhTriangleMeshShape takes some time to build the hierarchy, so  serialize or not to serialize??
Do not serialize, do not use. Performance is terrible to start with and I cannot understand why so many people go for it.

#5 Dawoodoz   Members   -  Reputation: 290

Like
0Likes
Like

Posted 23 January 2014 - 04:09 AM

 

As an aside, Havok deals with that kind of problem with their concept of Islands.  I'm guessing Bullet doesn't have a similar built in structure? 

It does, but sadly, it doesn't expose them at library level.

 

 

 


Also btBvhTriangleMeshShape takes some time to build the hierarchy, so  serialize or not to serialize??
Do not serialize, do not use. Performance is terrible to start with and I cannot understand why so many people go for it.

 

 

The main problem is that small items will get stuck if the collision shape has no volume. I only use triangles in heightmaps and then I can't have small items in the game. Most shapes are easy to make a convex decomposition of manually.


Edited by Dawoodoz, 23 January 2014 - 04:14 AM.

My open source DirectX 10/11 graphics engine. https://sites.google.com/site/dawoodoz

"My design pattern is the simplest to understand. Everyone else is just too stupid to understand it."


#6 xexuxjy   Members   -  Reputation: 553

Like
0Likes
Like

Posted 23 January 2014 - 05:43 AM

Interested to know why the performance is so bad on bvhTriangleMesh and what you'd suggest using for say a non heightfield based terrain?  thanks



#7 Krohm   Crossbones+   -  Reputation: 2921

Like
1Likes
Like

Posted 26 January 2014 - 11:28 PM

Performance is bad because the algorithm cannot make any assumption about the collision data. This is not the case for other collision shapes, which also have a fully parametric representation.

I am currently using proxy hulls for everything (hand made). This is standard about now albeit we could discuss on the amount of automation.



#8 bmarci   Members   -  Reputation: 366

Like
0Likes
Like

Posted 30 January 2014 - 11:09 AM


Do not serialize, do not use. Performance is terrible to start with and I cannot understand why so many people go for it.

 

I agree with the first part, I always have the creeps saving 3rd party library's binary data into the content.

Again, I made some timing with the BVH mesh and I'm not convinced not to use it.

I loaded a test scene consisting of ~40.000 polys, as a single collision shape.

The bvh generation took about 60-70 ms. And dropping  150-200 convex hull bodies and some basic primitives (all of them using CCD) was running with acceptable speed (over 60fps).

So, at first I'd say: "Vincent, we happy" :D

 

Here is a test of 520 convex hull bodies:

It slows a bit down at the end, maybe because of the 600.000 polys on my IntelHD someting smile.png

 

 

Is there any (good) algorithm to generate low poly concave hull? (not mesh simplification)


Edited by bmarci, 30 January 2014 - 11:10 AM.


#9 Krohm   Crossbones+   -  Reputation: 2921

Like
0Likes
Like

Posted 03 February 2014 - 03:05 AM


acceptable speed (over 60fps).
This conveys no information at all. What processor are you running and how high is it clocking while running?

I did my tests on low-end hardware, where you can measure the difference in the first place and I can tell the difference in my case. With 10 spherical sweeps per frame, the performance hits about 15fps with the trimesh while it was in the realm of playability (not smoothness) with the basic hulls.

But don't take my word for granted, check out how AAA games do it in UDK (scroll to end of page).






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS