Farseer on mono, without monogame etc.

Topics: Developer Forum
Sep 10, 2013 at 3:52 AM
Hello!
I'm looking for an opportunity to compile Farseer on Debian, Linux and Windows, without any Monogame on it (multiplatform server-side application with it's own 2d physics). Unfortunately, i discovered, that Farseer is tied to XNA strongly. Is it possible to overcome this barrier?

So far i've created this version:

https://github.com/m10914/FarseerMono

where i took from monogame all its math and embedded it into Farseer directly.
It works great on Windows and Debian with mono on it, but, maybe, there is
some difficulties, which i don't yet see?
Sep 10, 2013 at 7:47 AM
farseer physics is not tied to XNA.
Just use 'Farseer Physics.csproj' instead of 'Farseer Physics XNA.csproj'
It uses (but includes) 'Microsoft.Xna.Framework' for Vector2. So kind of looks like it's using XNA but it's not.
Sep 10, 2013 at 9:15 AM
RaymondEllis wrote:
farseer physics is not tied to XNA.
Just use 'Farseer Physics.csproj' instead of 'Farseer Physics XNA.csproj'
It uses (but includes) 'Microsoft.Xna.Framework' for Vector2. So kind of looks like it's using XNA but it's not.
Yes, i know, but there's no version of Farseer, which i can build and then use on Debian, or on Pure mono.
Actually, i can't see why Farseer is working with XNA primitives like Matrix, Vector2, Vector3, Plane, Curve etc.
I think, it would be much better to untie Farseer from Microsoft.Xna.Framework. Just like i did in the link above, but...
ehm... officially)
For my causes (server-side physics) it works great btw!
Developer
Sep 10, 2013 at 10:06 AM
There is a class version of 3.3.1 in the download section which does exactly that. I have not looked into the 3.5 release but you should be able to replace the Vector and Matrix math stuff with the one from the 3.3.1 class release. I doubt anything changed on that stuff recently.

The main reason to not roll our own vector math? There probably are a bazillion libraries out there on every platform which do vector math. They are probably highly optimized and do a better job than any common software solution could ever do. Most people use Farseer with monogame or xna. If you use their libraries you get hardware accelerated very fast implementations on a lot of systems/platforms.

Bottom line: Should you be on a system where this is not an option, just look for any other vector math library (im sure there exists a good bunch out there for mono) and write a little wrapper for that one. That should not be hard at all, but is something we could hardly provide for any combination/environment that exists out there.
Sep 10, 2013 at 10:06 AM
I can run my game-in-progress in Ubuntu through mono(don't know what you mean Pure), no problems. (C# / OpenTK)

I just double checked, and the only references in 'Farseer Physics.csproj' is 'System', 'System.Core', 'System.XML'

Maybe it's just in the FarseerPhysics SVN, or something.
For me FarseerPhysics\SourceFiles\Common
contains Vector, Matrix, MathHelper witch are all in the Xna Namespace. But they are compiled with FarseerPhysics.
As long as "#if !XNA && !WINDOWS_PHONE && !XBOX && !ANDROID" is true. Witch by the sounds of it, it should be true for you.
Developer
Sep 10, 2013 at 10:09 AM
I second that... the page took ages to load for me: But yes it is in the source and I would be very suprised if Ian forgot to bundle it with the 3.5 release ;)
Sep 10, 2013 at 10:25 AM
Elsch wrote:
I second that... the page took ages to load for me: But yes it is in the source and I would be very suprised if Ian forgot to bundle it with the 3.5 release ;)
Funny... Maybe i took the wrong version? I'll look into it, don't want to do extra work if everything is already done anyway)