2D Physics Engine compared

Topics: Developer Forum, User Forum
Oct 25, 2008 at 8:52 PM


 I'm totally new to the world of 2D Physics Engines and so also to this forum. I need an engine for
 my 2D game engine and I'm trying to figure out which one is the best for my needs and experience.

 What is the force and weakness of Farseer 2.0a compared to the other 2D Physics Engine available ?

 Which one is the most advanced in term of features ? 
 Which one is the most performant on .NET / XNA ?
 Which one is the most simple to use ?
 What would be Farseer biggest limitations ?
 What would be Farseer biggest qualities ?

 Any commercial / known titles using Farseer so far ?

The devil being in the details, I rather seek opinions and advices from more knowledgeable developpers.

Oct 25, 2008 at 10:00 PM
Edited Oct 25, 2008 at 10:12 PM
Hi. Welcome to our forums.

I've numbered your questions so it's easier for me to answer:

1. We are trying to be as simple as possible. We don't have a lot of high level functions because we try to make it easy and flexible. Some physics engines have very extensive editors, comprehensive libraries with readymade objects such as cars, people, bridges and others. We on the other hand, think that simplicity is the way forward and make sure that everyone can use our library.

2. Depends on how you build your game. Farseer physics 2.0 has great performance and can get an even higher performance, if implemented correctly. We are building a document containing tips on how to implement Farseer with the highest possible performance using pools, multithreading, chunking up landscape and a lot of other stuff.

3. I've tried several engines and I have to admit that Farseer is by far the simplest one. Most engines are splitting their geometries up into shapes (circles, rectangles and so on) so that they can get some shape specific performance gains. Farseer don't. We just have polygons, polygons and even more polygons. We do however have a factory where you can create circles and rectangles very easily.

We have a split architecture so that bodies (Body class) are in charge of rotation, gravity, drag and other forces. Geometries (Geom class) are in charge of collision detection and sort of extends a body with geometry aware collision detection. Just create a body and a geometry and you are done. Can't be more simple than that.

4. Well, it again depends on what you are going to use Farseer for. I think that most people would agree, that the pre-calculated distance grid used in narrow phase collision detection system, is our biggest limitation, since it requires some time to calculate it when you create your geometry. This can be worked around though, by using pools/cache. The reason for the grid to be pre-calculated, is so that it's faster to do narrow phase collision later, when performance really count.

5. I could list 100 things here, but I'll just tell you some of the abstracts, since it's actually up to you, to find out what is good. :)

A. Simplicity
As said before, we try to make everything as simple as possible. We do this to make sure that people can jump right into creating physics enabled games, without any knowledge on how a physics simulator actually works. We have body/geometry that makes the game realistic and some simple joints and springs that makes the game dynamic.

Our engine is so easy to work with, that some people have implemented it as an education tool for schools. info here

B. Flexibility
A nice thing about simplicity, is that you also get some flexibility. Just like a baker making a cake. Imagine a baker who could create a cake on the fly with a 100 different ingredients instead of a baker who only have 20 already made cakes to choose from.

This does not mean that Farseer don't have any "ready made cake", It means we are able to create any kind of 2D games without being limited to only 20 different physics behaviors.

All this talk about cake makes my hungry :) anyways. It's important to us that you can use any part of our library in your own way, without being limited to only do what our imagination are able to come up with.

C. Performance
Every single line of code in Farseer is optimized for near-perfect performance (it's not possible to get perfect performance.). We are doing a lot of optimization with some complex algorithms and we also use all the powers that C# can give us. And as I said before, using Farseer correctly and maybe writing a little code on your own, can make your game very high performance.

Update: Oh, you might also find our debug view very interesting. In XNA (Silverligh version coming) you can use the debug view to show all the internals of Farseer Physics. This is great for debugging most physics related problems.

6. Indeed. I've actually encountered a Danish game (I come from Denmark) that uses Farseer in their game. You can buy it for $20 and you even get the source code of the game with it. A friend of mine told me that his kid's wanted it, so he bought it and was surprised that a folder called Farseer was created ;)

A lot of people uses Farseer Physics in their games, I think that one of the more known ones are Gymnast made by Walaber. There are a lot of movies about this game on youtube, but the one I like the most is this one: See it here
The reason for that is that it actually contains our logo and name ;)

Most of the games created with Farseer Physics, are hobby games. Some only created for own pleasure, some only created to learn more about game physics. Try searching for "Farseer Physics games" on Google and you will find a lot of hits.

Wanted to take some time writing this, since a lot of people might be considering Farseer Physics as their next physics engine.

Edit: "The devil being in the details, I rather seek opinions and advices from more knowledgeable developers." Forgot to read that one. I'm the current maintainer of Farseer Physics, Jeff Weber (crashlander) might have even more details as he build the engine, but I hope my answer was detailed enough to answer it to your satisfaction.
Oct 25, 2008 at 11:52 PM

I'm impressed by your answers, the quality of your post and the time it took for a reply of this quality, let alone the fact that the answers came  from the maintener of the engine. This indicates me that this project is well alive and will go a long way. 

I appreciate and decided for many reasons to go with Farseer for my project.

  Noob questions incoming in the next week... :)

 Thanks Genbox,

Oct 25, 2008 at 11:59 PM
Thanks for the kind words Vaenom. I'm well prepared and equipped with tools to answer any of your questions. :)

A great start is our samples. Right now they are no more than simple samples to show the usage of Farseer Physics, when 2.0 will be released (Not long before it's ready, more info on the release here)
we will have some more samples, including on how to make water simualtions, chains and other stuff.

Right now the simple samples should be sufficient for your needs. Hope you will come to like Farseer as much as us.