What does a Physics engine need?

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
aussiedude
Posts: 20
Joined: Mon Feb 26, 2007 8:45 am
Contact:

What does a Physics engine need?

Post 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
I'm Australian... so be nice to me!
Image miNav Pathfinding Library :D
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post 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?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
aussiedude
Posts: 20
Joined: Mon Feb 26, 2007 8:45 am
Contact:

Post 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:
I'm Australian... so be nice to me!
Image miNav Pathfinding Library :D
MasterGod
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel
Contact:

Post 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.
Last edited by MasterGod on Thu Jan 10, 2008 9:33 pm, edited 1 time in total.
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
aussiedude
Posts: 20
Joined: Mon Feb 26, 2007 8:45 am
Contact:

Post 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.
I'm Australian... so be nice to me!
Image miNav Pathfinding Library :D
agi_shi
Posts: 122
Joined: Mon Feb 26, 2007 12:46 am

Post 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.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post 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
aboeing
Posts: 16
Joined: Sat Oct 07, 2006 7:50 pm

Post 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.
FlyingIsFun1217
Posts: 219
Joined: Fri Apr 13, 2007 8:29 pm
Location: Illinois
Contact:

Post by FlyingIsFun1217 »

I hope you really love mathematical equations...

FlyingIsFun1217
fireside
Posts: 158
Joined: Thu Dec 01, 2005 10:55 pm

Post 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.
JonLT
Posts: 152
Joined: Thu Mar 15, 2007 5:47 pm
Location: Denmark

Post 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 :)
Post Reply