Page 1 of 1

What does a Physics engine need?

Posted: Mon Jan 07, 2008 10:06 am
by aussiedude
Hi everyone,

I'm planning on making a Physics engine. I got a few ideas of what I want to put into it (Fast Collision detection, gravity, friction, ragdoll etc) but I was wondering if anyone here could write me a checklist of sorts of what I should include in it.

Example:
A good Physics engine needs:
1. Good quality fast collision detection
2. Dynamic Individual Gravity for all entities
3. Ragdoll
4. Simple fluid simulator
5. etc...

Basically make a "Santa, for Christmas I want..." feature wishlist for a Physics Engine :wink:

Also I was going to try and design the engine a but like Irrlicht. Ya know, something really simple and easy to use.

Code: Select all

// Use physics engine
#include "PhysicsEngine.h"
using namespace pe;
...

// Create Physics Engine Device
PhysicsEngine* Device = createPhysicsEngine(gravity, game-mode/simulation-mode, etc...);

// Add a Cube-shape Bounding Box to represent a car
Entity* Box = Device->addCubeEntity(X,Y,Z);

// Edit a Entity
Box->setGravity(newGravity);

// While in game loop, run physics and update all entities.
while(game==run)
{
do stuff...

Device->Simulate(time);

... do more stuff

// Update car position based on the Physics engines output
CarX = Box->X;
CarY = Box->Y;
CarZ = Box->Z;

.. finish doing stuff
}

// Then to finish everything and close up
delete Device;
Hows that sound?

Any thoughts and opinions are appreciated! :D

Posted: Mon Jan 07, 2008 12:01 pm
by rogerborg
Why not copy the feature list from ODE, Bullet or Newton?

Which leads to the question: why not just use and contribute to ODE, Bullet or Newton?

Posted: Mon Jan 07, 2008 1:08 pm
by aussiedude
Copying the feature list of those engines is a good idea, thanks.

The reason I'm making my own physics engine is because I want to learn more about programming and physics. I *COULD* just use another physics engine already made, but then I wouldn't learn how to make one myself.

It's a bit like traveling, I could just take a taxi, but wouldn't it be better to learn to drive?

I just finished doing this same thing with AI, and I've come out the other side with a wealth of experience in programming that I wouldn't have otherwise gotten, so now I want to do the same thing with physics. I also ended up with a very fast/easy to use pathfinding library which I can claim full ownership of, which was a nice bonus. 8)

Also everytime I make something like this I add it to my programming portfolio and use it in job interviews, uni applications etc. Also I use the libraries I make in my games. There is lots of reasons I want to do this.

So any help/advice is welcome.

PS: Which physics library should I copy the feature list of, is there a specific one or all of them? :lol:

Posted: Mon Jan 07, 2008 1:13 pm
by MasterGod
Well, good luck with that and I like the idea of creating things for yourself as educational purpose too.
About the list, just mix them, choose whichever features you like and compile your own list.
May I suggest you should start with the features you think are most easy to implement then go through it until you reach the hardest features.

Posted: Tue Jan 08, 2008 3:51 am
by aussiedude
Thanks MasterGod,

Just finished looking at the features lists of Bullet, Newton and ODE, worked out now what I want. I'm thinking of starting just the basic shell of the engine, get that right and then move on to adding basic sphere and plane collision detection and then collision response. Then move from there to add basic physics laws (like gravity, friction). Hows that sound? :D

After that I want to add as many primitive shapes for collision as possible, capsule, cube. Then once I have those done, move on to trimesh. I got plenty of resources (ebooks/books, tutorials, forums) to use to make this, and if I focus on it I'm sure I can do it.

Posted: Fri Jan 11, 2008 8:24 pm
by agi_shi
You can't really have a "collision response" without any physics (gravity/friction/etc.). I say work on some particles that don't collide to get forces and what-not working. Then make simple spherical collisions. Then work your way up from that.

But what I think any modern physics engine needs is the ability to dynamically and efficiently grow/shrink objects.

Posted: Fri Jan 11, 2008 10:13 pm
by FuzzYspo0N
dont copy the feature list from physics engine (a) . Look at physics engine (a) (b) (c) and decide for yourself, what you think will be what you want for job interviews, uni applications games. etc, or specifically what you wanna learn about.

Ill read this in a while thorugh and make some suggestions

Posted: Sun Jan 13, 2008 8:06 am
by aboeing
I would suggest you look at the interface for the Simple Physics Engine, since as the name suggests, it is easy to use. Ageia PhysX also provides a nice features list.

An easy way to start your development might be to build a interface to the Physics Abstraction Layer, which already comes with a set of basic tests to verify your engine is working correctly, and will let you compare your engine with some others.

Posted: Sun Jan 13, 2008 7:08 pm
by FlyingIsFun1217
I hope you really love mathematical equations...

FlyingIsFun1217

Posted: Mon Jan 14, 2008 9:44 pm
by fireside
Let's see. You need:
gravity, collision, joints, constraints and !!!SPEED!!!.
This is one I would recommend using ODE. The guy has been working on it for quite a few years and it's good stuff and you can compile it statically. That way you can actually write a game before you're 90.

Posted: Wed Jan 16, 2008 3:42 am
by JonLT
here are some links that might help you:
http://www.cs.cmu.edu/~baraff/ (uni papers)
http://www.gaffer.org/game-physics/
http://www.gamasutra.com/resource_guide/20030121/ (need login - but its free)

happy coding :)