Appropriate physics library?

Started by
13 comments, last by Jernej.L 18 years, 8 months ago
Well, this is the first time I will be looking out for my physics needs...though I don't actually know if I need to. I am just looking for possibilities. Basically, in my optimal design, I would want a system that could do a couple thousand sphere-to-sphere and sphere-to-box collisions as fast as possible -- and thats all I need. Nothing more complex than that. Now, I would like my system to be super light weight (not memory intensive, easy to set up, and not an extremely large linked file [though, the last isn't that big an issue]). Also, free. Also, it must be cross platform (so no .dlls). Anyone have any suggestions for me? Should I write my own simple system? I think it would be best to use something tested and tried so that if I want to later, I can easily add in another component. Thoughts? Right now, I am looking at Newton. Has anyone worked with it? The other big names seem to be Novodex, ODE, and Tokamak, though, I have no experience in this field. Help please! Thanks!
Advertisement
Evaluate them all and see if they meet your needs. That means probably having to interface each one to your code..

Novodex is commercial, you can use it in non-commerical software only without a license. It will supposedly interface seemlessly to the PhysX card things they are making (so it should be very fast w/hardware accel).

Newton is pretty good, and is portable to Linux and Mac now.

Tokamak ... I hear people who like it but it seems not as powerful as the others.

ODE is open source and free, and a pain to compile on Windows without GNU tools but it works. I noticed it had some numerical problems a bit and wasn't very fast but it is the only open source one available so you can modify it (and release your changes) if you need to. The others are all close source.

I don't know, but they probably will work with alot of simple objects. Newton will get horribly slow if you try to do too many complex things at a time ( like sub-zero fps's....) but there is a Novodex demo with a bunch of rocks that runs about a frame per hour on my Athlon XP ;-) So.. keep it to simplified things as much as possible..

Oh, newton has that tree thing, which is pretty cool too.

"It's such a useful tool for living in the city!"
Quote:Original post by visage
Well, this is the first time I will be looking out for my physics needs...though I don't actually know if I need to. I am just looking for possibilities.

Basically, in my optimal design, I would want a system that could do a couple thousand sphere-to-sphere and sphere-to-box collisions as fast as possible -- and thats all I need. Nothing more complex than that. Now, I would like my system to be super light weight (not memory intensive, easy to set up, and not an extremely large linked file [though, the last isn't that big an issue]). Also, free.

Also, it must be cross platform (so no .dlls). Anyone have any suggestions for me? Should I write my own simple system? I think it would be best to use something tested and tried so that if I want to later, I can easily add in another component.
Thanks!

Umm the way you phrase it, you make it sounds trivial but it is not. Doing a couple of thousand sphere-to-sphere or sphere-to-box as fast as possible is not something trivial. On top of that you want it to be light weight on memory and free, among other things.

The question you have to answer first is can I do it myself? If you think you can come even close to those specifications, then you can go with an engine and save yourself time.
Physics engines are not magic wands that do miracles, they use the same algorithms that are written all over the internet, just more polished and optimized.

Good look on that one
While a specialized collision system using SSE and what's not may be able to run a few thousand dynamic spheres on a 3ghz system I doubt you will find a full physic solution able to do that. And sphere/box is a little bit more involved.

AFAIK Novodex is the fastest around and I'm pretty sure it can't do that without its magic board :). Not to mention that you will have to design a pretty efficient culling system because the graphic system is going to have a hard time displaying that too...

All I can think of is look into OPCODE, this might be a good place to start. From there design a simple mobile physic system on top of OPCODE, this should run pretty fast.

Note: I'm assuming you want a fully dynamic system, ie: a couple thousand spheres at once, falling from a cliff, etc...
Praise the alternative.
Well, I don't know why I didn't announce my purpose for the system...that was dumb of me...but I am going to use it for my particle system, which will play a very big part in my game. Particle collision is really what is necessary. I will be making the particles as big as possible, when I can, but they might get quite small. The game will be 2d, so that should help cut down a lot of the calculations. Thousands is probably an exaggeration...but I would like it to be handle at least 100 at a time. Culling isn't really a possibility, because those particles that would be culled will be in the same sphere anyway.

I think Newton is the one I am going to choose, as I am developing on a Mac.

Any other thoughts, people?

Thanks for the help so far.
Quote:Original post by visage
Well, I don't know why I didn't announce my purpose for the system...that was dumb of me...but I am going to use it for my particle system, which will play a very big part in my game. Particle collision is really what is necessary. I will be making the particles as big as possible, when I can, but they might get quite small. The game will be 2d, so that should help cut down a lot of the calculations. Thousands is probably an exaggeration...but I would like it to be handle at least 100 at a time. Culling isn't really a possibility, because those particles that would be culled will be in the same sphere anyway.

I think Newton is the one I am going to choose, as I am developing on a Mac.

Any other thoughts, people?

Thanks for the help so far.


Well, I imagine you have reasons for choosing an existing solution but Newton (or any other 3d package for that matter) will be overkill. Also, as mentionned earlier Newton really drops from >60fps to 0.00001fps as soon as the object count goes above 100. I have no idea why but this will certainly be a problem. It's a very good library otherwise but you'd better check on their forums if that problem has a known work-around before making your decision.

I know that Novodex has a mode especially designed for particles (no rotational effect) as do Tokamak. But, ok, displaying a couple thousand 2d particles is doable. You still need to be very careful because it's not that trivial. But it can be done.

Good luck :).

aftethought: If you are going to have 2000+ 2d particles on screen you should skip the particle/particle test altogether. From experience it won't look good unless you mean to model something like rocks etc... 2d particles with collision enabled really bring out the 2d constraint (you can tell it's 2d since you loose most of the parralax effect) plus it's usualy quite messy :).

[Edited by - b34r on August 2, 2005 1:21:23 AM]
Praise the alternative.
take a look at:

http://home.planet.nl/~woute890/disks.zip (hmm this is for windows, overlooked the mac thing )

there's an input file, where you can put a max of 700 particles. it's a small particle system which shouldn't take to long for you to write yourself.

[Edited by - Airo on August 2, 2005 8:41:25 AM]
Oh, ODE is BSD license, my bad. So you can do whatever you like with it.

But now that you say it is for a particle system well. You'd have to do 2000 or so collision tests every frame. Now, if you use SIMD (what is on Mac?) you could do 4x4 sphere tests at a time (Ericson). That would probably be much faster than Newton. What else do you need? Collision query with a BSP tree is cheap. I don't know what more you want or why you need such a heavy duty for particle physics, but maybe it will be cool so I won't stop you.



"It's such a useful tool for living in the city!"
Quote:Original post by Name_Unknown
You'd have to do 2000 or so collision tests every frame. Now, if you use SIMD (what is on Mac?) you could do 4x4 sphere tests at a time (Ericson). That would probably be much faster than Newton. What else do you need? Collision query with a BSP tree is cheap. I don't know what more you want or why you need such a heavy duty for particle physics, but maybe it will be cool so I won't stop you.

It is not 2000 check, it is 2000 time the complexity of the simulation. Since each ball can be in touch we at must 8 other balls, taking an value of 5 balls that's 2000 * 5 = 10000 collisions test conservativally!
that's only for collision, collision is the faster part of a physics engine.

about Newton this:
http://www.physicsengine.com/forum/viewtopic.php?t=1491&start=0
seems faster than 0.00001 frame per secunds to me.

[Edited by - jovani on August 2, 2005 4:04:46 AM]
Quote:Original post by jovani
about Newton this:
http://www.physicsengine.com/forum/viewtopic.php?t=1491&start=0
seems faster than 0.00001 frame per secunds to me.


I won't take the pain to reboot into Windows to provide a screenshot but if I have to, well, I will. I'm not saying that freely. I really like Newton but the point is that with the current version of the Newton Playground 99 bodies are above 60fps and 100 bodies are around 0.0000000647576fps. Don't know, don't care why. It's my experience with it.

There's nothing wrong about showing that it's not the case anymore but just don't make it look like I and others are making things up. That's not nice.
Praise the alternative.

This topic is closed to new replies.

Advertisement